Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
- **Personal Agent Protocol guide.** [docs/integrations/personal-agent-protocol.md](docs/integrations/personal-agent-protocol.md) covers traffic from a user's personal agent through Personal Agent Protocol: `[Agent] Message Source` = `personal_agent` for user turns an AI wrote and `user` for the user's own words, the personal agent's `client_id` as `poppy_personal_agent` context, the Conversation ID as the session ID with `sid` as `poppy_session_id` context, a device ID hashed from `iss` and `sub` (`sub` is unique only within one personal agent) so Amplitude merges pre-sign-in turns into the account at sign-in, and chart recipes. Listed in `manifest.json` under a new `protocols` key, the integrations README, `AGENTS.md` and `llms.txt`. The Sierra, Fin and Agentforce guides link to it. No new SDK API.
- **`personal_agent` Message Source.** The `[Agent] Message Source` catalog description and the `messageSource` JSDoc now list `personal_agent`: text an AI wrote on the end user's behalf. `agent` still means delegation inside your own system.

### Fixed
- **`agent.session()` accepts `trackSessionEnd`.** `Session` already honored `trackSessionEnd: false` at runtime, and the Codex guide, the `CodexSDKTracker` JSDoc and `amplitude-ai.md` pass it, but `BoundAgent.session()` left it out of its options type, so a strict type check rejected those examples. The option is now typed and documented there, matching Python's `agent.session(track_session_end=False)`. Covered by `test/bound-agent.test.ts`.

### Changed
- **Buzz forwarder orders same-second messages by Buzz's `ms` tag.** `docs/integrations/buzz.mjs` adds the sub-second `ms` tag (0-999, added to kind 9 in block/buzz#9548) to a message's time, so messages in one second keep Buzz's order and a delegation and its reply no longer swap. A missing or invalid `ms` counts as 0, so archives from before the tag behave as before. Covered by `test/buzz-forwarder.test.ts`.
- **Buzz guide re-pinned to `block/buzz@7e7ec73`** (source re-checked 2026-11-19). The goose `sessions.db` columns and the `toolRequest` / `toolResponse` JSON shapes that the forwarder reads are unchanged between goose v1.28.0 and v1.60.1. On 2026-11-19 a goose 1.60.1 run wrote a real `sessions.db`: the Developer shell set `AGENT_SESSION_ID` to that session id, and `gooseToolCalls` read the tool call and its `commit_sha`. The guide now states that Builderlab cloud-run agents are not covered by the desktop-archive forwarder.
Expand Down
6 changes: 6 additions & 0 deletions src/bound-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,12 @@ export class BoundAgent {
autoFlush?: boolean;
tags?: string[] | null;
experiments?: ExperimentInput[] | null;
/**
* Emit `[Agent] Session End` when `run()` finishes (default `true`).
* Pass `false` when one session spans many `run()` calls and you end
* it yourself with `trackSessionEnd`.
*/
trackSessionEnd?: boolean;
/**
* The inbound context from an `extract*` helper. Trusted context adopts
* the caller's session, user, parent agent and trace; untrusted context
Expand Down
15 changes: 15 additions & 0 deletions test/bound-agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,5 +397,20 @@ describe('BoundAgent', () => {
);
expect(sessionEndEvents).toHaveLength(1);
});

it('trackSessionEnd: false keeps one session open across run() calls', async (): Promise<void> => {
const mock = createMock();
const agent = mock.agent('bot', { userId: 'u1' });
const turn = () => agent.session({ sessionId: 'conv-1', trackSessionEnd: false });

await turn().run((s) => s.trackUserMessage('First'));
await turn().run((s) => s.trackUserMessage('Second'));
expect(mock.events.filter((e) => e.event_type === EVENT_SESSION_END)).toHaveLength(0);

agent.trackSessionEnd({ sessionId: 'conv-1' });
const ends = mock.events.filter((e) => e.event_type === EVENT_SESSION_END);
expect(ends).toHaveLength(1);
expect(ends[0]?.event_properties?.[PROP_SESSION_ID]).toBe('conv-1');
});
});
});
Loading