@silverprotocol/google-adk 1.0.0-rc.3 → 1.0.0-rc.4

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.
Files changed (2) hide show
  1. package/README.md +4 -2
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -64,7 +64,7 @@ facet's per-field dispositions, including its disclosed `silently-dropped` gaps)
64
64
 
65
65
  > **Search grounding (spec §13.3).** When Gemini grounds a reply with Google Search, the facet emits `display.required` carrying the Search Suggestions HTML (`groundingMetadata.searchEntryPoint.renderedContent`), which the reducer records on the turn. Rendering, storing and re-displaying it are governed by Google's grounding terms (SPEC §13.3). `toPersistable` from `@silverprotocol/core` gives a fold without it, for a host that stores the result.
66
66
 
67
- > **Prompt blocks.** In `StreamingMode.NONE`, `@google/adk` 2.1.0 turns a blocked prompt into an event whose `errorCode` is the block reason, with no `finishReason` and no content. The facet records one `prompt.blocked` for each such event while its turn is open, before the turn's terminal: `SAFETY` → `"safety"`, `BLOCKLIST` → `"blocklist"`, `PROHIBITED_CONTENT` → `"prohibited"`, and any other treated value → `"other"` with `reasonRaw` verbatim, with no `safety`, since the event carries no ratings. The treated values are genai's `BlockedReason` values (`BLOCKED_REASON_UNSPECIFIED`, `SAFETY`, `OTHER`, `BLOCKLIST`, `PROHIBITED_CONTENT`, `IMAGE_SAFETY`, `MODEL_ARMOR`, `JAILBREAK` at genai 2.24.0) and the Gemini API's `BLOCK_REASON_UNSPECIFIED`. The record changes no terminal: the turn ends as it would without it. Detect a block from `prompt.blocked` (or the fold's `promptBlocked`), not from the terminal. An event with a `finishReason` beside its `errorCode` is a response-level block and records nothing. The facet checks each event on its own. An event that carries an `a2a:response` entry in `customMetadata`, whoever wrote it (ADK's `RemoteA2AAgent` writes one on every event it relays), is never read as a prompt block: at 2.1.0 the relay drops the `finishReason` that tells a prompt block from a response-level one; in a relay that streams, the relayed event carries the block's code in `errorCode` when the remote agent sends one, and then ends the turn as an error. A session service that reloads an event without its raw form (for Vertex, an event stored without `rawEvent`) can drop its `finishReason`, so a response-level block that reaches the facet through such a reload is recorded as a prompt block. So is a Workflow node's error event when the node throws an error whose `code` is a treated value. At 2.1.0, ADK's SSE aggregator absorbs a prompt-block chunk, so a prompt block in SSE mode records no `prompt.blocked`; the Live and Interactions routes never produce the shape.
67
+ > **Prompt blocks.** In `StreamingMode.NONE`, `@google/adk` 2.1.0 through 2.3.0 turns a blocked prompt into an event whose `errorCode` is the block reason, with no `finishReason` and no content. The facet records one `prompt.blocked` for each such event while its turn is open, before the turn's terminal: `SAFETY` → `"safety"`, `BLOCKLIST` → `"blocklist"`, `PROHIBITED_CONTENT` → `"prohibited"`, and any other treated value → `"other"` with `reasonRaw` verbatim, with no `safety`, since the event carries no ratings. The treated values are genai's `BlockedReason` values (`BLOCKED_REASON_UNSPECIFIED`, `SAFETY`, `OTHER`, `BLOCKLIST`, `PROHIBITED_CONTENT`, `IMAGE_SAFETY`, `MODEL_ARMOR`, `JAILBREAK` at genai 2.24.0) and the Gemini API's `BLOCK_REASON_UNSPECIFIED`. The record changes no terminal: the turn ends as it would without it. Detect a block from `prompt.blocked` (or the fold's `promptBlocked`), not from the terminal. An event with a `finishReason` beside its `errorCode` is a response-level block and records nothing. The facet checks each event on its own. An event that carries an `a2a:response` entry in `customMetadata`, whoever wrote it (ADK's `RemoteA2AAgent` writes one on every event it relays), is never read as a prompt block: at 2.1.0 the relay drops the `finishReason` that tells a prompt block from a response-level one; in a relay that streams, the relayed event carries the block's code in `errorCode` when the remote agent sends one, and then ends the turn as an error. A session service that reloads an event without its raw form (for Vertex, an event stored without `rawEvent`) can drop its `finishReason`, so a response-level block that reaches the facet through such a reload is recorded as a prompt block. So is a Workflow node's error event when the node throws an error whose `code` is a treated value. In SSE mode ADK's aggregator absorbs a prompt-block chunk (observed at 2.1.0 and 2.3.0), so a prompt block records no `prompt.blocked`: with a usage report it arrives as a usage-only event with no `errorCode` and no `finishReason`, which closes the turn as `success` (`stop`) on the host-completion event and as `turn.abort` (`stream-truncated`) at `flush()` without it; with no usage report ADK yields no event and no turn opens. Only `StreamingMode.NONE` yields the shape the facet records. The Live and Interactions routes never produce it.
68
68
 
69
69
  > **Streamed text (SSE and Live).** In `StreamingMode.SSE` on the generateContent route, and on the Live API, ADK streams a model call's text as `partial:true` chunks, then repeats the streamed text in one `partial:false` event: when the call closes, in SSE before a non-text part in the same stream, and on the Live API before a tool call, on a switch between thought and text, and on a barge-in. The facet renders the chunks and drops the repeat (spec §8.0 item 3). It matches a repeat only to the text streamed by the same source (the event's author, branch and node path, and for an event `@google/adk`'s `RemoteA2AAgent` relays, the relayed task and, within it, the relayed artifact or the relayed status messages, read from its `customMetadata`), so interleaved streams stay apart, and a new relayed task never reads an earlier one's text. An event serialized from ADK-Python's relay (`custom_metadata`) is matched by author, branch and node path alone: that relay records the whole task for every event it relays, so its relayed streams cannot be told apart. A text event is the repeat when one text starts with the other (an equal or shorter one renders nothing, a longer one renders only its added text: the repeat before a function call also holds that chunk's own text, and an after-model callback may extend the final), or when the streamed text ends with it (a later call's repeat after a call whose close never arrived, or ADK's structured-output rewrite). Any other text renders in full. Every other event of the source ends the match, except the ones ADK yields between the chunks and the repeat: a block's finish, a Live usage report or grounding record on its own, a transcription, a function response, and a `partial:false` event whose parts are all non-text. The source's next chunks then start a new match. An event without a branch that finds no match of its own (ADK's A2A relay rebuilds its repeat without one, and a failed call's in-band error carries none) reads the matches of the same author and node path: a repeat takes one only when exactly one is open, and an event that ends the match ends them all, so two open matches of one author and node path that differ only by branch would both end. A relayed artifact with no match of its own reads its task's status messages; a relayed Task or Message restates its task, so it is matched, in the order ADK renders a Task, against that task's artifacts and then its status messages (else the artifacts alone, else the status messages alone), and it ends them; and the relay's own failure event ends every relayed match of its author and node path. It assumes no agent or response processor of yours yields a text event of the same source between a call's chunks and its repeat (ADK registers none by default): such a text that starts with, is a start of, or ends the streamed text is read as the repeat.
70
70
 
@@ -109,7 +109,9 @@ agEvents.push(...n.flush()); // seal anything still open
109
109
 
110
110
  > **Errors the runtime throws (spec §8.0 host obligation 1).** When ADK throws instead of ending the stream (for example its LLM-call limit), catch it and push `{ type: "__host_error__", code, message, usage? }` (exported as `ADK_HOST_ERROR_TYPE`) before `flush()`: the open turn closes `turn.error` with that code and message and the turn's usage plus the sentinel's `usage`: the sentinel's usage covers only work the stream did not report, and is added to what the stream reported, so pass the usage of unreported work only, never a total, and with no turn open a fresh terminal turn, `turn_<invokeId>_host_error_<n>`, carries it. A turn whose pause was signalled closes `paused` first, with its asks and its usage, and the error then closes on a new top-level turn, `<turn id>_error`, with one message and no content, carrying only the sentinel's usage. The sentinel may be the caught Error itself with `type` and `code` assigned; its message is kept.
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
+ > **Chrome built-in model.** When `@google/adk` 2.3.0's Chrome built-in model backend gets a reply it cannot parse that looks like a cut-off JSON envelope, and it can recover no text from it, ADK answers with the fixed text "The model started an answer and did not finish it. Ask again." and `turnComplete: true` instead of the raw output. The facet maps that event as any final answer: the text lands in the turn, which closes as `success` (`stop`) when no ask is pending. Nothing in the event marks the text as ADK's, so a host that must tell it from the model's own answer matches the text.
113
+
114
+ > **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 through 2.3.0 the Live path yields none: a Live failure reaches the facet as the host-terminal event. A failed Interactions call can lose its code: `@google/adk` 2.3.0 reads a failed interaction's code and message from a singular `error` member, while `@google/genai` 2.30.0 declares an interaction's failures as an `errors` array and gives the stream's status update no error member, so a failure the service reports that way reaches the facet as `errorCode` `"UNKNOWN_ERROR"` with `errorMessage` `"Unknown error"`, and the `error` event and `turn.error` carry those. The code of the Interactions stream's own `error` event reaches them unchanged.
113
115
 
114
116
  > **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
117
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silverprotocol/google-adk",
3
- "version": "1.0.0-rc.3",
3
+ "version": "1.0.0-rc.4",
4
4
  "description": "AgJSON normalizer for the official Google Agent Development Kit — @google/adk (ADK Event / Gemini Content.parts[] → AgEvent[]).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "!dist/**/*.test.*"
35
35
  ],
36
36
  "dependencies": {
37
- "@silverprotocol/core": "1.0.0-rc.3"
37
+ "@silverprotocol/core": "1.0.0-rc.4"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@google/adk": ">=1.0.0 <3"