@silverprotocol/google-adk 1.0.0-rc.1 → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +130 -40
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +138 -39
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ facet's per-field dispositions, including its disclosed `silently-dropped` gaps)
|
|
|
33
33
|
|
|
34
34
|
| `@google/adk` | verified | with | evidence |
|
|
35
35
|
| --- | --- | --- | --- |
|
|
36
|
+
| `2.3.0` | 2026-10-15 | 1.0.0-rc.3 | @google/adk 2.2.1 -> 2.3.0 with @google/genai 2.28.0 -> 2.30.0 (2.3.0 declares @google/genai ^2.29.1). Event and Part surfaces unchanged: the drift gate finds no new member. NEW RUNTIME PATH: when the host's abortSignal fires during runAsync, the Runner yields a closing event with errorCode "INVOCATION_ABORTED" (and a functionResponse {error} for each call left unanswered) before it returns (runner.js, events/abort_events.js). Its 24 engine-built natives (a text reply, one and two dangling calls, a pending confirmation ask, an ask after a pause, and an unaborted control; both streaming modes, two runs each) are fixtures/adk-abort; the facet's close for that event ships in this cohort. ENGINE FIXTURES regenerated at 2.3.0 (adk-error, adk-pause; 81 files) show two engine changes. In SSE, the partial chunks and the final aggregate of one model response now share one event id (2.2.1 gave each its own); this does not reach the wire. The engine-built adk_request_credential ask's auth URI no longer carries an empty redirect_uri=; this does reach the wire, since the facet carries that URL verbatim in tool.args, the hitl.ask and the paused close. 160 of 162 runs (with and without host completion) are identical once run ids and timestamps are masked; the two plain-credential runs differ by that URL only. genai 2.28.0 -> 2.30.0: Part is byte-identical (verifiedAt 2.30.0); usageMetadata gains initialPromptTokenCount and Transcription gains startOffset/endOffset, none of which the recorded streams carry. LIVE at 2.3.0 / 2.30.0 on gemini-3.8-flash: echo-gemini38 and app-spec-gemini38 re-captured green, each with its one tool call (echo, render_card) and the same event sequence as at 2.1.0; census zero drops and zero new fields. |
|
|
36
37
|
| `2.2.1` | 2026-10-07 | 0.12.4 | @google/adk 2.1.0 -> 2.2.1 with @google/genai 2.24.0 -> 2.27.0. Dependency shape unchanged except adm-zip, which adk now declares at ^0.6.1, so the adm-zip security override is retired. 2.2.1 widens its Gemini 3.x Live path to every gemini-3.*-live model: on gemini-3.8-live a toolCall's function calls are yielded at once, input transcriptions arrive per fragment as finished, and text input goes through sendRealtimeInput. the CONTINUATION finish reason (new in genai 2.26.0) and the per-fragment transcriptions are covered by facet tests. Live: the three gemini-3.8-live seeds re-captured green (live-bargein, live-bargein2, live-tool): the same interruptions and the same turn outcomes; in live-tool the function call now opens the message. The text-input capture cannot exercise the per-fragment input transcription (capture backlog: an audio-input Live capture). |
|
|
37
38
|
| `2.1.0` | 2026-09-23 | 0.6.3 | @google/adk 2.0.0 -> 2.1.0, the first minor since the 2.0 major, with @google/genai 2.22.0 -> 2.24.0. WIRE CONTRACT UNCHANGED: Event, LlmResponse, CompactedEvent, InMemoryRunner, MCPToolset and the MCP runtime are byte-identical and the EventActions interface is unchanged; the capture agent compiles against 2.1.0. genai 2.24.0 adds one Part member, speechMetadata (16 -> 17), CARRIED through the existing unmapped-part-fields provider-raw carry. Hardened three pre-existing assumptions the genai types never promised: ExecutableCode.code, Blob.mimeType/data and FileData.fileUri are optional, and a part missing one now rides verbatim as provider-raw instead of throwing or emitting a schema-invalid block. DEPENDENCY SHAPE is where 2.1.0 bites: it adds dockerode as an optionalDependency, which brings back ssh2 and cpu-features, both with install scripts, so both workspace files now declare them false under allowBuilds (without that, every strict-builds install fails ERR_PNPM_IGNORED_BUILDS). @types/dockerode is a REGULAR dependency and puts a second @types/node (18.x) into the program of every `import from "@google/adk"`; consumers compiling with skipLibCheck:false may notice. genai stays a regular dependency at ^2.9.0 and resolves to a single 2.24.0 copy (plus the expected legacy 1.52.0 under @google-cloud/vertexai). adk 2.1.0 moved its OpenTelemetry exporters 0.205.0 -> 0.222.0, which exact-pin @opentelemetry/core 2.11.0, so the ^2.8.0 core override is RETIRED (confirmed after a fresh resolution: one core copy, 2.11.0). adm-zip is STILL ^0.5.17 in 2.1.0, so the ^0.6.1 override stays; upstream fix is google/adk-js#923. NEW RUNTIME PATH: an unregistered or hallucinated tool name now yields functionResponse {error: "Function X is not found in the toolsDict."} instead of throwing, and this facet classifies that envelope tool.done outcome "ok" - a pre-existing gap (ADK's {error} tool-failure envelope has always read as ok) that 2.1.0 makes reachable from ordinary model hallucination; pinned by a synthetic test at the current behaviour until decided. LIVE at 2.1.0 / 2.24.0 on gemini-3.8-flash: echo-, app-spec- and thinking-gemini38 refreshed (thinking-gemini38: 2 thought parts, 2 signatures); NEW tool-error-gemini38, which steers the bare tool name because ADK registers MCP tools without the mcp__<server>__ prefix, recording the clean MCP isError path rather than the hallucinated-tool envelope; and the grammar seeds multi-turn, single-tool-call and text-only MIGRATED from gemini-2.5-flash at adk 1.3.0, where they had sat since July proving nothing about the current peer. Census ZERO drops / ZERO new fields on every adk seed. The 2026-09-21 nightly typechecked adk 2.1.0 but did not exercise genai 2.24.0. Facet tests now 105. |
|
|
38
39
|
| `2.0.0` | 2026-09-15 | 0.6.2 | @google/adk unchanged at 2.0.0 (still npm latest, still declaring @google/genai ^2.9.0 as a regular dependency); @google/genai 2.21.0->2.22.0 studied by tarball d.ts diff - SIXTEEN lines, three hunks, and NONE of them touches a type this facet consumes: a file-level @ts-ignore, an optional from_environment added to an environment type, and one REMOVAL - the required call_id on the internal Live-API type FunctionResultDelta (a `declare type`, reachable only through the Live/streaming session surface this facet does not drive). Recorded explicitly because a removal is breaking drift in general, just not here: Part, Content, Candidate, FinishReason, GenerateContentResponseUsageMetadata, ThinkingConfig/ThinkingLevel, FunctionCall/FunctionResponse, Transcription and MediaProcessing are all block-identical, and every runtime bundle differs only in the SDK_VERSION constant. The draft.3 thoughtsTokenCount fold, the gemini-3.8-flash seed trio and the '>=1.0.0 <3' peer range therefore all stand unchanged, and no capture refresh was warranted. Single-copy lockfile resolution re-verified: exactly one @google/genai 2.x (2.22.0) workspace-wide, plus the expected legacy 1.52.0 under @google-cloud/vertexai. SECURITY: adm-zip reaches the tree ONLY through @google/adk's skills loader, which nothing on this facet's code path imports; the workspace override was nevertheless moved to a bare-key '^0.6.1' floor (see the cohort's security note) because @google/adk 2.0.0 still pins ^0.5.17 (google/adk-js#601 still OPEN). No facet code change. |
|
|
@@ -110,16 +111,20 @@ agEvents.push(...n.flush()); // seal anything still open
|
|
|
110
111
|
|
|
111
112
|
> **In-band errors (spec §8.0 item 35).** ADK yields an error it meets as an event carrying both `errorCode` and `errorMessage` (a rate-limit error, a response-level block with a finish message, a failed Interactions call), and keeps running: a SequentialAgent runs its next sub-agent, a Workflow node retries, a callback or a further model round follows. So the facet never closes a turn on one. The `push()` that receives it emits the non-terminal `error` event, with `code` from `errorCode` and `message` from `errorMessage`, and every later event of the invocation lands in the same turn. At the invocation's end, on the host-completion event, on a host-terminal event, or at `flush()`, the turn closes with one `turn.error`, never as `success`, even when a later sub-agent or a retried node answered. Its `code` and `message` are the host-terminal event's when you fed one, otherwise the invocation's first in-band error's, and it carries the turn's accumulated usage. When the turn's pause was signalled, it closes `paused` first, and the error then closes on a new top-level turn, `<turn id>_error`, with one message and no content. In SSE mode ADK repeats an error as a model call's stream closes, in a `partial: false` event with the code and message of the previous event of the same author, branch and node path; that repeat yields no further `error`, and the call's usage counts once, from the later report. ADK's `RemoteA2AAgent` can report one remote failure twice, the second time in the event with which it closes the remote run (it carries an `a2a:request` entry in `customMetadata`); that event yields no further `error` and adds no usage when it carries the same code, message and usage report as the earlier one and the same `a2a:task_id` entry, present on both. Every other such event is a further error. An event with `errorMessage` and no `errorCode` is not an in-band error: it yields no `error` event and closes as it otherwise would, and its message rides the event-level `provider-raw` carry verbatim (ADK's A2A relay reports its own failure that way). The relay's message is the text of the error it caught, which can include data the remote agent returned and the agent-card URL; treat it as remote content before forwarding it to a client. At `@google/adk` 2.1.0 the Live path yields none: a Live failure reaches the facet as the host-terminal event.
|
|
112
113
|
|
|
114
|
+
> **Client aborts (spec §8.0 items 35 and 26).** From `@google/adk` 2.3.0, when the host's `abortSignal` ends a `runAsync()` run and the host keeps reading, ADK yields one more event and stores it as the session's last: its seal, with `errorCode` `"INVOCATION_ABORTED"` and `errorMessage` `"Invocation was aborted by client."`, which answers each call still unanswered with an error result, a pending `adk_request_*` call included. The facet recognises the seal by that `errorCode` value alone, and it is not an in-band error. The `push()` that receives it closes each call it answers with `tool.done` (`outcome: "error"`), then closes the turn as `turn.abort` (`cancelled`), with the turn's usage, when any, on the `message.end`, and emits no `error` or `turn.error`. An ask whose call the seal answers is no longer pending, so the turn does not close `paused`; the same holds when any other non-partial event of the invocation answers an ask's call. The seal's code and message ride the event-level `provider-raw` carry verbatim. A host that stops reading when it aborts never sees the seal, so `flush()` closes its turn as it closes any stream cut at that point: as `turn.abort` (`stream-truncated`), or as `paused` while an ask was pending, once ADK had signalled the pause. A run aborted before ADK yielded any event opens no turn. `runLive()` yields no seal.
|
|
115
|
+
|
|
113
116
|
> **Ids across invokes (spec §8.0).** A host that folds several invokes of one conversation into one `reduce()` needs turn and message ids that never repeat across them. ADK's `invocationId` alone doesn't guarantee that: ADK-JS mints a fresh one on every `runAsync()`, but ADK-Python's resumable resume reuses `invocation_id`. So every turn id carries a per-invoke stem, `turn_<invokeId>_<invocationId>`, and its message id is `msg_<turnId>`. By default each normalizer draws a random `adk_<16 hex>` stem once, when it is constructed. Pass `createAdkNormalizer({ invokeId })` only to make the output reproducible (tests, replay), and then keep it unique per invoke within a fold.
|
|
114
117
|
|
|
115
118
|
> **Live sessions (`runLive`).** One live session is one ADK invocation that can hold several model generations. On a barge-in, ADK sends `interrupted: true` first, then the interrupted generation's usage and `turnComplete`, then the reply. The interrupted generation closes as `turn.abort` (`interrupted`) on its own `turnComplete`, with its usage on the `message.end`, and the reply opens the next turn, `turn_<invokeId>_<invocationId>_g1`. A transcription reads once: ADK's `finished` transcription is not re-emitted when it repeats the chunks already streamed. A tool call and the model's reply share one turn: ADK yields the call generation's `turnComplete` after the tool's response, and the turn closes on the `turnComplete` that follows the reply. In the corpus capture `live-tool-gemini38live`, gemini-3.8-live reports no `toolUsePromptTokenCount`: the tool result is counted in the next usage report's `promptTokenCount`. A generation that follows a completed generation opens the next turn, and an `interrupted: true` that follows a completed generation interrupts the next one, which closes as `turn.abort` (`interrupted`). When text is buffered at the interrupt, ADK yields only the text aggregate, without the flag, so the turn closes at `flush()` as `stream-truncated`.
|
|
116
119
|
|
|
117
|
-
> **Credential material (spec §8.0 item 28).** ADK credential material is one of
|
|
120
|
+
> **Credential material (spec §8.0 item 28).** ADK credential material is one of four exceptions to the compatibility table's "carried losslessly". In an `adk_request_credential` call and its reply, the facet carries only the auth-config members it knows to be non-secret. In `state.delta` it omits every entry that holds an ADK credential object, and every `temp:` entry. A patch that is itself an ADK credential object is emitted as `{}`, other keys in that patch included. Inside a `provider-raw` carry it reduces each ADK credential object, and each response to `adk_request_credential`, to its non-secret members; when that reduces a node's output, the text part ADK renders from that output is skipped too. A credential an application keeps in a shape of its own is not recognised, and rides unchanged.
|
|
118
121
|
|
|
119
|
-
> **A2A relay entries.** ADK's `RemoteA2AAgent` writes up to four bookkeeping entries into the `customMetadata` of the events it relays: `a2a:request`, `a2a:response`, `a2a:task_id` and `a2a:context_id`. The facet does not carry them, an exception to draft.8's carry of unmapped event fields (§8.0 item 23) and another exception to "carried losslessly". Every other `customMetadata` entry, including one a remote agent wrote, rides unchanged, and a `customMetadata` that held nothing else is not carried. The same applies to a native the facet passes through as `ext.google.unparsed`, whose metadata an event serialized from Python spells `custom_metadata`.
|
|
122
|
+
> **A2A relay entries.** ADK's `RemoteA2AAgent` writes up to four bookkeeping entries into the `customMetadata` of the events it relays: `a2a:request`, `a2a:response`, `a2a:task_id` and `a2a:context_id`. The facet does not carry them, an exception to draft.8's carry of unmapped event fields (§8.0 item 23) and another exception to "carried losslessly". Every other `customMetadata` entry, including one a remote agent wrote, rides unchanged, apart from ADK's internal entries (below), and a `customMetadata` that held nothing else is not carried. The same applies to a native the facet passes through as `ext.google.unparsed`, whose metadata an event serialized from Python spells `custom_metadata`.
|
|
120
123
|
|
|
121
124
|
> **Repeated requests.** A remote agent can answer ADK's `RemoteA2AAgent` by repeating the request it was sent, as its first, submitted status in the `"user"` role (ADK-Python's A2A executor does on a new task, on a2a-sdk 0.3.x), and the relay turns that message into the relayed event's content. The facet maps such an event as if those parts, and the long-running ids of the calls among them, were absent, maps its other parts and members as usual, and emits one `ext.google.relay-echo-omitted` event inside the turn that event maps into (after its `turn.start`, with no `turnId` of its own), whose `parts` is the number it omitted. It recognizes the event by its `a2a:response` entry (in `customMetadata`, or `custom_metadata` in an event serialized from Python): a status update or a task in the `submitted` state whose `status.message` is in the `"user"` role, or, as a relay on a2a-sdk 1.x records it, a task with no `kind` in `TASK_STATE_SUBMITTED` whose message is `ROLE_USER`. The repeated parts are the event's content parts after the first k, where k is the number of parts the recorded task's artifacts hold (0 when it records none): ADK's relay converts a recorded task's artifact parts before its status message, and ADK-Python's relay, which records the whole task for a status update too, converts a submitted status update from its message alone and a submitted task from its artifacts alone. A user-role message in any other state, such as a remote workflow's tool result relayed while it is working, maps as before. This is the third exception to "carried losslessly", and another to draft.8's carry of unmapped event fields (§8.0 item 23). It does not reach a repeated request in any other shape, or a copy the framework keeps in its own session store or model context. Where a plugin, a callback or a part converter changed the content so that the recorded artifacts' parts no longer come first, one content part for each, the omission can miss repeated parts or also omit an artifact's parts (a converter that maps one artifact part to two leaves more parts than k); the marker's `parts` counts every part omitted. On a non-blocking send ADK also stores the repeated message in its own session; to remove it there as well, drop it before the relay converts it, with an `afterRequestCallbacks` entry that deletes `status.message` from a submitted status update or task whose message is in the `"user"` role.
|
|
122
125
|
|
|
126
|
+
> **ADK internal metadata (spec §8.0 item 38).** ADK reserves the `customMetadata` entries whose name begins with `__adk_internal_` for its own components: callers cannot set them, and while stored events keep them, ADK removes them from the API responses, saved session files and A2A messages it produces. At `@google/adk` 2.2.1 they hold a tool-call integrity stamp (`ToolCallIntegrityPlugin`) and a restored-history marker. The facet does not carry them, in `customMetadata` or in the `custom_metadata` of a native it passes through as `ext.google.unparsed`. This is the fourth exception to "carried losslessly". Only top-level entries are matched: a value nested below another entry rides unchanged, whatever its keys, and a `customMetadata` that held only such entries is not carried, so the event yields no `provider-raw` block when nothing else of it is unmapped.
|
|
127
|
+
|
|
123
128
|
> **Cross-session state.** ADK's `user:` and `app:` state entries ride `state.delta` under their prefixed keys (SPEC §8.0 item 30) and a thread `state.snapshot` replaces them. The working copy holds the value ADK yielded — a point-in-time copy of the per-user / per-application store ADK re-merges on every session read — so a host that renders or restores the working copy across threads may show a value another session has since replaced. A mapping of these two prefixes onto `memory.write` (`user:` → scope `user`, `app:` → scope `agent`) is not part of this facet's output.
|
|
124
129
|
|
|
125
130
|
Then fold the resulting `AgEvent`s into messages and turns with
|
|
@@ -128,4 +133,4 @@ framework produced the stream.
|
|
|
128
133
|
|
|
129
134
|
Spec: [silverprotocol.io/AgJSON](https://silverprotocol.io/AgJSON) — canonical
|
|
130
135
|
in [silverprotocol/AgJSON](https://github.com/silverprotocol/AgJSON); wire
|
|
131
|
-
version `1.0.0-rc.
|
|
136
|
+
version `1.0.0-rc.3`.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,OAAO,EAKL,KAAK,cAAc,EAOnB,SAAS,EACT,KAAK,UAAU,EAKhB,MAAM,sBAAsB,CAAC;AAsB9B;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,OAAO,CAAC,EAAE,O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;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,uEAAuE;AACvE,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AA0RpD,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,UAAU,CAKlF"}
|
package/dist/index.js
CHANGED
|
@@ -147,31 +147,45 @@ export function isLossyFinishReason(reason) {
|
|
|
147
147
|
return resolveFinishReason(reason).lossy;
|
|
148
148
|
}
|
|
149
149
|
// ─── stateful factory helpers ─────────────────────────────────────────────────
|
|
150
|
-
// ───
|
|
151
|
-
//
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
//
|
|
156
|
-
//
|
|
157
|
-
//
|
|
150
|
+
// ─── customMetadata entries the facet does not carry ─────────────────────────
|
|
151
|
+
// Two kinds of customMetadata entry are not event data, and the facet does not
|
|
152
|
+
// carry them, wherever customMetadata is carried (the provider-raw carry and
|
|
153
|
+
// the ext.google.unparsed native, where an event serialized from Python spells
|
|
154
|
+
// it custom_metadata):
|
|
155
|
+
// - ADK's RemoteA2AAgent writes up to four bookkeeping entries into the
|
|
156
|
+
// customMetadata of the events it relays: its send request, the peer's raw
|
|
157
|
+
// A2A event and their task and context ids.
|
|
158
|
+
// - ADK reserves the entries whose name begins with `__adk_internal_` for its
|
|
159
|
+
// own components (events/internal_metadata.js, @google/adk 2.2.1): callers
|
|
160
|
+
// cannot set them, and ADK removes them from the API responses, saved
|
|
161
|
+
// session files and A2A messages it produces. At that version they hold a
|
|
162
|
+
// tool-call integrity stamp and a restored-history marker (SPEC §8.0 item
|
|
163
|
+
// 38).
|
|
164
|
+
// Only top-level entries are matched. Every other entry, including one a
|
|
165
|
+
// remote agent wrote and a value nested below a carried entry, rides
|
|
166
|
+
// unchanged.
|
|
158
167
|
const RELAY_BOOKKEEPING_KEYS = new Set(["a2a:request", "a2a:response", "a2a:task_id", "a2a:context_id"]);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
168
|
+
const ADK_INTERNAL_METADATA_PREFIX = "__adk_internal_";
|
|
169
|
+
/** Whether a top-level customMetadata entry is one the facet does not carry. */
|
|
170
|
+
function isUncarriedMetadataKey(key) {
|
|
171
|
+
return RELAY_BOOKKEEPING_KEYS.has(key) || key.startsWith(ADK_INTERNAL_METADATA_PREFIX);
|
|
172
|
+
}
|
|
173
|
+
/** A customMetadata value without the entries the facet does not carry, as a
|
|
174
|
+
* new value; the argument is not changed. A value holding none of them, or
|
|
175
|
+
* one that is not an object, is returned as it is; undefined when those
|
|
176
|
+
* entries were all it held. */
|
|
177
|
+
function carriedMetadata(value) {
|
|
178
|
+
if (!isJsonObject(value) || !Object.keys(value).some(isUncarriedMetadataKey))
|
|
165
179
|
return value;
|
|
166
|
-
const kept = Object.entries(value).filter(([k]) => !
|
|
180
|
+
const kept = Object.entries(value).filter(([k]) => !isUncarriedMetadataKey(k));
|
|
167
181
|
return kept.length > 0 ? Object.fromEntries(kept) : undefined;
|
|
168
182
|
}
|
|
169
183
|
/** A native with its customMetadata, or the custom_metadata of an event
|
|
170
|
-
* serialized from Python, reduced as by
|
|
171
|
-
*
|
|
172
|
-
*
|
|
184
|
+
* serialized from Python, reduced as by carriedMetadata and dropped when
|
|
185
|
+
* nothing is left, as a new value; every other member is unchanged, and the
|
|
186
|
+
* argument is not changed. The new value's members are defined, never
|
|
173
187
|
* assigned, and one named __proto__ is not copied (SPEC §13.7). */
|
|
174
|
-
function
|
|
188
|
+
function nativeWithCarriedMetadata(native) {
|
|
175
189
|
if (!isJsonObject(native))
|
|
176
190
|
return native;
|
|
177
191
|
let changed = false;
|
|
@@ -183,7 +197,7 @@ function nativeWithoutRelayBookkeeping(native) {
|
|
|
183
197
|
out.push([key, value]);
|
|
184
198
|
continue;
|
|
185
199
|
}
|
|
186
|
-
const kept =
|
|
200
|
+
const kept = carriedMetadata(value);
|
|
187
201
|
if (kept !== value)
|
|
188
202
|
changed = true;
|
|
189
203
|
if (kept !== undefined)
|
|
@@ -1755,7 +1769,7 @@ function driveAdkTopLevel(a, event, messageId, turnId, pendingAsks, reserved, st
|
|
|
1755
1769
|
if (groundingSupports !== undefined)
|
|
1756
1770
|
unmappedEvent["groundingMetadata"] = groundingSupports;
|
|
1757
1771
|
if (event.customMetadata !== undefined) {
|
|
1758
|
-
const kept =
|
|
1772
|
+
const kept = carriedMetadata(JsonValue.parse(event.customMetadata));
|
|
1759
1773
|
if (kept !== undefined)
|
|
1760
1774
|
unmappedEvent["customMetadata"] = kept;
|
|
1761
1775
|
}
|
|
@@ -1854,9 +1868,21 @@ function isHostCompleteNative(v) {
|
|
|
1854
1868
|
// event, and the invocation's turn closes with one turn.error at the
|
|
1855
1869
|
// invocation's end (the host-completion event, a host-terminal event or
|
|
1856
1870
|
// flush()), never as success.
|
|
1871
|
+
/** The `errorCode` of the seal `@google/adk` (2.3.0, `runAsync`) appends when
|
|
1872
|
+
* a client abort ends the invocation (events/abort_events.js, read by ADK's
|
|
1873
|
+
* own `isAbortEvent` on this value alone). */
|
|
1874
|
+
const ADK_ABORT_SEAL_CODE = "INVOCATION_ABORTED";
|
|
1875
|
+
/** Spec §8.0 item 35: the client-abort seal is keyed on its `errorCode` value
|
|
1876
|
+
* alone, never on content or author (a seal with no call to answer carries
|
|
1877
|
+
* no content). It is outside item 35. */
|
|
1878
|
+
function isAbortSeal(event) {
|
|
1879
|
+
return event.errorCode === ADK_ABORT_SEAL_CODE;
|
|
1880
|
+
}
|
|
1857
1881
|
/** Spec §8.0 item 35: an in-band invocation error carries both errorCode and
|
|
1858
|
-
* errorMessage. */
|
|
1882
|
+
* errorMessage. The client-abort seal is not one. */
|
|
1859
1883
|
function inBandErrorOf(event) {
|
|
1884
|
+
if (isAbortSeal(event))
|
|
1885
|
+
return undefined;
|
|
1860
1886
|
const code = event.errorCode;
|
|
1861
1887
|
const message = event.errorMessage;
|
|
1862
1888
|
return typeof code === "string" && typeof message === "string" ? { code, message } : undefined;
|
|
@@ -1939,15 +1965,15 @@ function relayStreamOf(event) {
|
|
|
1939
1965
|
}
|
|
1940
1966
|
/** The open windows a non-partial event reads and closes: the one under its
|
|
1941
1967
|
* own key; else, for an event without a branch, every open window of the
|
|
1942
|
-
* same turn, author and node path.
|
|
1943
|
-
|
|
1944
|
-
|
|
1968
|
+
* same turn, author and node path. `own`, `relay` and `wantStream` are the
|
|
1969
|
+
* event's own window key, relay record and relay stream, read once by the
|
|
1970
|
+
* caller. */
|
|
1971
|
+
function windowCandidates(windows, turnId, event, own, relay, wantStream) {
|
|
1945
1972
|
if (windows.has(own))
|
|
1946
1973
|
return [own];
|
|
1947
1974
|
// A relayed artifact with no chunks of its own can repeat the status text
|
|
1948
1975
|
// of its own task (a peer that sends its answer as status messages, then
|
|
1949
1976
|
// the same text as its final artifact).
|
|
1950
|
-
const relay = relayOf(event);
|
|
1951
1977
|
if (relay !== null && relay.stream.startsWith("artifact:")) {
|
|
1952
1978
|
const status = aggregateWindowKey(turnId, event, relayStreamKey(relay.task, "status"));
|
|
1953
1979
|
if (windows.has(status))
|
|
@@ -1955,7 +1981,6 @@ function windowCandidates(windows, turnId, event) {
|
|
|
1955
1981
|
}
|
|
1956
1982
|
if (typeof event.branch === "string")
|
|
1957
1983
|
return [];
|
|
1958
|
-
const wantStream = relayStreamOf(event);
|
|
1959
1984
|
return sourceWindows(windows, turnId, event, true)
|
|
1960
1985
|
.filter(([, stream]) => stream === wantStream)
|
|
1961
1986
|
.map(([key]) => key);
|
|
@@ -2009,8 +2034,8 @@ function snapshotReading(artifactText, statusText, text) {
|
|
|
2009
2034
|
* relayed itself: ADK's RemoteA2AAgent reports a failed request with an
|
|
2010
2035
|
* event of its own (errorMessage, turnComplete, no relay record), which ends
|
|
2011
2036
|
* every relayed stream of that author and node path. */
|
|
2012
|
-
function relayWindowsEndedBy(windows, turnId, event) {
|
|
2013
|
-
if (
|
|
2037
|
+
function relayWindowsEndedBy(windows, turnId, event, relay) {
|
|
2038
|
+
if (relay !== null)
|
|
2014
2039
|
return [];
|
|
2015
2040
|
if (event.errorMessage === undefined && event.turnComplete !== true)
|
|
2016
2041
|
return [];
|
|
@@ -2080,6 +2105,13 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2080
2105
|
// Host obligation 4 (opt-in): a success close stashed until the sentinel, and
|
|
2081
2106
|
// the non-HITL long-running calls still unanswered, per turn.
|
|
2082
2107
|
const deferredClose = new Map();
|
|
2108
|
+
// Per turn: a final response of a pausing agent (the author of a pending
|
|
2109
|
+
// ask's event) arrived while that ask was pending, one of item 26's pause
|
|
2110
|
+
// signals. A final stashed before any ask is not one, and neither is another
|
|
2111
|
+
// agent's final, which only follows the signal.
|
|
2112
|
+
const finalWhileAsking = new Set();
|
|
2113
|
+
const askingAuthors = new Map();
|
|
2114
|
+
const finalOfPausingAgent = (turnId, event) => (pendingAsks.get(turnId)?.length ?? 0) > 0 && askingAuthors.get(turnId)?.has(event.author) === true;
|
|
2083
2115
|
// Live barge-ins (`interrupted: true`, ADK's live aggregator) awaiting their
|
|
2084
2116
|
// close. An interrupt on a PARTIAL text event is followed by ADK's full-text
|
|
2085
2117
|
// aggregate of the same model turn (utils/live_connection_utils.js:175-178),
|
|
@@ -2138,6 +2170,9 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2138
2170
|
function maybeCloseTurn(event, turnId, messageId, isPartial) {
|
|
2139
2171
|
if (isPartial || closedTurns.has(turnId))
|
|
2140
2172
|
return;
|
|
2173
|
+
// The client-abort seal closes the turn in drive() (closeCancelled), never here.
|
|
2174
|
+
if (isAbortSeal(event))
|
|
2175
|
+
return;
|
|
2141
2176
|
const parts = event.content?.parts ?? [];
|
|
2142
2177
|
const hasFunctionCall = parts.some((p) => p.functionCall !== undefined);
|
|
2143
2178
|
const interrupted = event.interrupted === true || interruptPending.has(turnId);
|
|
@@ -2180,8 +2215,11 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2180
2215
|
if (inBandErrorOf(event) !== undefined)
|
|
2181
2216
|
return;
|
|
2182
2217
|
if (firstInBandError.has(turnId)) {
|
|
2183
|
-
if ((pendingAsks.get(turnId)?.length ?? 0) > 0)
|
|
2218
|
+
if ((pendingAsks.get(turnId)?.length ?? 0) > 0) {
|
|
2184
2219
|
deferredClose.set(turnId, event);
|
|
2220
|
+
if (finalOfPausingAgent(turnId, event))
|
|
2221
|
+
finalWhileAsking.add(turnId);
|
|
2222
|
+
}
|
|
2185
2223
|
return;
|
|
2186
2224
|
}
|
|
2187
2225
|
// ── The nodeInfo gate (R&D item 6, step 1) ──
|
|
@@ -2204,6 +2242,8 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2204
2242
|
// so a stream ending here is byte-identical.
|
|
2205
2243
|
if (hostCompletion || (pendingAsks.get(turnId)?.length ?? 0) > 0) {
|
|
2206
2244
|
deferredClose.set(turnId, event);
|
|
2245
|
+
if (finalOfPausingAgent(turnId, event))
|
|
2246
|
+
finalWhileAsking.add(turnId);
|
|
2207
2247
|
return;
|
|
2208
2248
|
}
|
|
2209
2249
|
// ── The branch gate ──
|
|
@@ -2327,8 +2367,7 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2327
2367
|
* the call counts once, from the later report), and the relay's closing
|
|
2328
2368
|
* event (it adds no usage). Any other in-band error emits `error` from this
|
|
2329
2369
|
* push and, when it is the invocation's first, latches it. */
|
|
2330
|
-
function recordErrorAndUsage(event, turnId, isPartial) {
|
|
2331
|
-
const sourceKey = aggregateWindowKey(turnId, event, null);
|
|
2370
|
+
function recordErrorAndUsage(event, turnId, isPartial, sourceKey) {
|
|
2332
2371
|
const previous = previousBySource.get(sourceKey);
|
|
2333
2372
|
const error = inBandErrorOf(event);
|
|
2334
2373
|
const counting = !isPartial && !closedTurns.has(turnId);
|
|
@@ -2373,7 +2412,7 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2373
2412
|
* pause's end (its pause-end event, or a final response while the ask was
|
|
2374
2413
|
* pending). An in-band invocation error is never one. */
|
|
2375
2414
|
function pauseSignalled(turnId) {
|
|
2376
|
-
return (pendingAsks.get(turnId)?.length ?? 0) > 0 && (pauseEnded.has(turnId) ||
|
|
2415
|
+
return (pendingAsks.get(turnId)?.length ?? 0) > 0 && (pauseEnded.has(turnId) || finalWhileAsking.has(turnId));
|
|
2377
2416
|
}
|
|
2378
2417
|
/** Spec §8.0 item 35 at the invocation's end: the one turn.error of a turn
|
|
2379
2418
|
* whose invocation met an invocation error, with the given code and message
|
|
@@ -2524,15 +2563,16 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2524
2563
|
typeof p.text === "string" &&
|
|
2525
2564
|
p.text.length > 0;
|
|
2526
2565
|
const carriesText = parts.some(isTextPart);
|
|
2527
|
-
const ownKey = aggregateWindowKey(turnId, event);
|
|
2528
2566
|
const relay = relayOf(event);
|
|
2567
|
+
const relayStream = relay === null ? null : relayStreamKey(relay.task, relay.stream);
|
|
2568
|
+
const ownKey = aggregateWindowKey(turnId, event, relayStream);
|
|
2529
2569
|
const snapshot = !isPartial && relay !== null && relay.stream === "snapshot" ? relay : null;
|
|
2530
2570
|
const restated = snapshot !== null ? snapshotWindows(streamedText, turnId, event, snapshot.task) : null;
|
|
2531
2571
|
const candidates = isPartial
|
|
2532
2572
|
? []
|
|
2533
2573
|
: restated !== null
|
|
2534
2574
|
? [...restated.artifacts, ...restated.status]
|
|
2535
|
-
: windowCandidates(streamedText, turnId, event);
|
|
2575
|
+
: windowCandidates(streamedText, turnId, event, ownKey, relay, relayStream);
|
|
2536
2576
|
const [onlyCandidate] = candidates;
|
|
2537
2577
|
const readKey = !isPartial && candidates.length === 1 && onlyCandidate !== undefined ? onlyCandidate : ownKey;
|
|
2538
2578
|
const alreadyStreamed = isPartial
|
|
@@ -2557,7 +2597,7 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2557
2597
|
(eventText.startsWith(alreadyStreamed) || alreadyStreamed.startsWith(eventText) || suffixRepeat);
|
|
2558
2598
|
const aggregateText = isAggregate ? eventText : "";
|
|
2559
2599
|
const suppressAggregateText = isAggregate && aggregateText.length > 0 && (alreadyStreamed.startsWith(aggregateText) || suffixRepeat);
|
|
2560
|
-
return { isTextPart, carriesText, ownKey, snapshot, candidates, readKey, alreadyStreamed, isAggregate, aggregateText, suppressAggregateText };
|
|
2600
|
+
return { isTextPart, carriesText, ownKey, relay, relayStream, snapshot, candidates, readKey, alreadyStreamed, isAggregate, aggregateText, suppressAggregateText };
|
|
2561
2601
|
}
|
|
2562
2602
|
/** Whether an event after a success close only repeats the closed turn's
|
|
2563
2603
|
* streamed text: ADK's aggregate after a message-less block chunk closed
|
|
@@ -2669,7 +2709,7 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2669
2709
|
// then its status window (snapshotReading), and closes them; and
|
|
2670
2710
|
// the relaying agent's own failure event ends every relayed window of its
|
|
2671
2711
|
// author and node path. An empty text part is not text.
|
|
2672
|
-
const { isTextPart, carriesText, ownKey, snapshot, candidates, readKey, alreadyStreamed, isAggregate, aggregateText, suppressAggregateText, } = readWindow(turnId, event, parts, skipped, isPartial);
|
|
2712
|
+
const { isTextPart, carriesText, ownKey, relay, relayStream, snapshot, candidates, readKey, alreadyStreamed, isAggregate, aggregateText, suppressAggregateText, } = readWindow(turnId, event, parts, skipped, isPartial);
|
|
2673
2713
|
let residualTail = isAggregate && !suppressAggregateText ? aggregateText.slice(alreadyStreamed.length) : "";
|
|
2674
2714
|
let accumulated = alreadyStreamed;
|
|
2675
2715
|
parts.forEach((part, index) => {
|
|
@@ -2731,7 +2771,7 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2731
2771
|
for (const key of snapshot !== null ? candidates : [readKey])
|
|
2732
2772
|
streamedText.delete(key);
|
|
2733
2773
|
else if (!keepsWindowOpen)
|
|
2734
|
-
for (const key of [...candidates, ...relayWindowsEndedBy(streamedText, turnId, event)])
|
|
2774
|
+
for (const key of [...candidates, ...relayWindowsEndedBy(streamedText, turnId, event, relay)])
|
|
2735
2775
|
streamedText.delete(key);
|
|
2736
2776
|
// Round-3 review finding (regression on finding b): the resend window's
|
|
2737
2777
|
// lifecycle is scoped PER CONTENT KEY, never per turn. `mintNullIdCallId`
|
|
@@ -2748,7 +2788,19 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2748
2788
|
// per-invoke.
|
|
2749
2789
|
if (!isPartial)
|
|
2750
2790
|
trackLongRunning(event, turnId);
|
|
2791
|
+
const asksBefore = pendingAsks.get(turnId)?.length ?? 0;
|
|
2751
2792
|
driveAdkTopLevel(a, event, messageId, turnId, pendingAsks, reserved, streamedTranscription, closedTurns.has(turnId)); // standalone and content arms
|
|
2793
|
+
if ((pendingAsks.get(turnId)?.length ?? 0) > asksBefore) {
|
|
2794
|
+
const authors = askingAuthors.get(turnId) ?? new Set();
|
|
2795
|
+
authors.add(event.author);
|
|
2796
|
+
askingAuthors.set(turnId, authors);
|
|
2797
|
+
}
|
|
2798
|
+
// Spec §8.0 item 26: an ask is pending only while its adk_request_* call
|
|
2799
|
+
// has no functionResponse in a non-partial event of the invocation. One
|
|
2800
|
+
// that answers it (the client-abort seal answers every unanswered call)
|
|
2801
|
+
// ends the ask, and a turn holding no pending ask does not close paused.
|
|
2802
|
+
if (!isPartial)
|
|
2803
|
+
pruneAnsweredAsks(turnId, parts);
|
|
2752
2804
|
// A turn gets ONE terminal: an interrupt on a turn that already closed
|
|
2753
2805
|
// (a second barge-in, or one after a success close) adds none.
|
|
2754
2806
|
if (event.interrupted === true && !closedTurns.has(turnId))
|
|
@@ -2758,8 +2810,14 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2758
2810
|
awaitingReply.add(turnId);
|
|
2759
2811
|
else if (hasModelOutput(event))
|
|
2760
2812
|
awaitingReply.delete(turnId);
|
|
2761
|
-
|
|
2813
|
+
// A non-relayed event's own window key is its source key.
|
|
2814
|
+
recordErrorAndUsage(event, turnId, isPartial, relayStream === null ? ownKey : aggregateWindowKey(turnId, event, null));
|
|
2762
2815
|
maybeCloseTurn(event, turnId, messageId, isPartial);
|
|
2816
|
+
// Spec §8.0 item 35: the client-abort seal is the invocation's native
|
|
2817
|
+
// terminal. Its functionResponse parts closed their calls above (item 25);
|
|
2818
|
+
// it closes the turn now, from this push().
|
|
2819
|
+
if (!isPartial && isAbortSeal(event) && !closedTurns.has(turnId))
|
|
2820
|
+
closeCancelled(turnId);
|
|
2763
2821
|
// The interrupted generation closes on its own turnComplete (its trailing
|
|
2764
2822
|
// usageMetadata arrives before it), or at flush() / host completion.
|
|
2765
2823
|
if (!isPartial && event.turnComplete === true && interruptPending.has(turnId))
|
|
@@ -2825,6 +2883,38 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2825
2883
|
* The turn is marked closed in the facet's own bookkeeping too (audit M21),
|
|
2826
2884
|
* so neither maybeCloseTurn nor flush() fabricates a later success. The
|
|
2827
2885
|
* message.end carries the turn's accumulated usage, as flush()'s does. */
|
|
2886
|
+
/** Drop each pending ask of the turn whose adk_request_* call one of these
|
|
2887
|
+
* parts answers (spec §8.0 item 26). */
|
|
2888
|
+
function pruneAnsweredAsks(turnId, parts) {
|
|
2889
|
+
const asks = pendingAsks.get(turnId);
|
|
2890
|
+
if (asks === undefined)
|
|
2891
|
+
return;
|
|
2892
|
+
const answered = new Set();
|
|
2893
|
+
for (const p of parts) {
|
|
2894
|
+
const id = p.functionResponse?.id;
|
|
2895
|
+
if (typeof id === "string")
|
|
2896
|
+
answered.add(id);
|
|
2897
|
+
}
|
|
2898
|
+
if (answered.size === 0)
|
|
2899
|
+
return;
|
|
2900
|
+
const left = asks.filter((ask) => ask.toolCallId === undefined || !answered.has(ask.toolCallId));
|
|
2901
|
+
if (left.length === asks.length)
|
|
2902
|
+
return;
|
|
2903
|
+
if (left.length > 0)
|
|
2904
|
+
pendingAsks.set(turnId, left);
|
|
2905
|
+
else
|
|
2906
|
+
pendingAsks.delete(turnId);
|
|
2907
|
+
}
|
|
2908
|
+
/** Spec §8.0 item 35: the client-abort seal closes the invocation's turn with
|
|
2909
|
+
* one turn.abort, reason "cancelled", and no `error` or `turn.error`. As for
|
|
2910
|
+
* an interruption (item 17), the message.end before it carries the turn's
|
|
2911
|
+
* accumulated usage, and the turn is marked closed, so neither the
|
|
2912
|
+
* host-completion event nor flush() adds a terminal. */
|
|
2913
|
+
function closeCancelled(turnId) {
|
|
2914
|
+
closedTurns.add(turnId);
|
|
2915
|
+
a.closeMessage(`msg_${turnId}`, mapUsage(usageByTurn.get(turnId)));
|
|
2916
|
+
a.emit({ type: "turn.abort", turnId, reason: "cancelled" });
|
|
2917
|
+
}
|
|
2828
2918
|
function closeInterrupted(turnId) {
|
|
2829
2919
|
interruptPending.delete(turnId);
|
|
2830
2920
|
interruptClosed.add(turnId);
|
|
@@ -2870,7 +2960,7 @@ function createInnerAdkNormalizer(options, invokeStem) {
|
|
|
2870
2960
|
omitted = stripped.omitted;
|
|
2871
2961
|
}
|
|
2872
2962
|
if (!isAdkEvent(event)) {
|
|
2873
|
-
a.emitExt("google", "unparsed", { native:
|
|
2963
|
+
a.emitExt("google", "unparsed", { native: nativeWithCarriedMetadata(event) });
|
|
2874
2964
|
return a.drain();
|
|
2875
2965
|
}
|
|
2876
2966
|
drive(event, omitted);
|