@genesislcap/ai-assistant 15.95.2 → 15.96.0
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/dist/ai-assistant.api.json +264 -0
- package/dist/ai-assistant.d.ts +124 -0
- package/dist/chat-driver.cjs +149 -14
- package/dist/chat-driver.cjs.map +3 -3
- package/dist/chat-driver.mjs +149 -14
- package/dist/chat-driver.mjs.map +3 -3
- package/dist/custom-elements.json +178 -99
- package/dist/dts/autopilot/decision-message.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.constants.d.ts +14 -0
- package/dist/dts/components/chat-driver/chat-driver.constants.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.d.ts +16 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/config/config.d.ts +76 -0
- package/dist/dts/config/config.d.ts.map +1 -1
- package/dist/dts/config/define-stateful-agent.d.ts +30 -1
- package/dist/dts/config/define-stateful-agent.d.ts.map +1 -1
- package/dist/dts/react.d.ts +8 -8
- package/dist/dts/state/debug-event-log.d.ts +1 -1
- package/dist/dts/state/debug-event-log.d.ts.map +1 -1
- package/dist/dts/state/persistence/session-snapshot.d.ts +2 -1
- package/dist/dts/state/persistence/session-snapshot.d.ts.map +1 -1
- package/dist/dts/suggestions/generate-suggestions.d.ts.map +1 -1
- package/dist/dts/utils/driver-note.d.ts +26 -0
- package/dist/dts/utils/driver-note.d.ts.map +1 -0
- package/dist/dts/utils/history-transform.d.ts.map +1 -1
- package/dist/dts/utils/message-partition.d.ts.map +1 -1
- package/dist/dts/utils/preserved-user-messages.d.ts.map +1 -1
- package/dist/esm/autopilot/decision-message.js +3 -0
- package/dist/esm/components/chat-driver/chat-driver.constants.js +17 -0
- package/dist/esm/components/chat-driver/chat-driver.js +123 -6
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +4 -0
- package/dist/esm/config/define-stateful-agent.js +20 -13
- package/dist/esm/state/debug-event-log.js +4 -3
- package/dist/esm/state/persistence/session-snapshot.js +11 -3
- package/dist/esm/suggestions/generate-suggestions.js +2 -0
- package/dist/esm/utils/driver-note.js +30 -0
- package/dist/esm/utils/history-transform.js +4 -0
- package/dist/esm/utils/message-partition.js +5 -0
- package/dist/esm/utils/preserved-user-messages.js +2 -1
- package/dist/react.cjs +5 -5
- package/dist/react.mjs +4 -4
- package/docs/finish-guard.md +125 -0
- package/package.json +17 -17
|
@@ -13818,7 +13818,7 @@
|
|
|
13818
13818
|
"type": {
|
|
13819
13819
|
"text": "Record<MetaEventType, MetaEventImportance>"
|
|
13820
13820
|
},
|
|
13821
|
-
"default": "{\n 'turn.error': 'high',\n 'tool.failed': 'high',\n 'subagent.failed': 'high',\n 'file.read-failed': 'high',\n 'suggestions.failed': 'high',\n 'context.threshold-crossed': 'high',\n 'context.compacted': 'high',\n 'persistence.restore-orphan': 'high',\n // A save that did not land is silent data loss in progress: the transcript on screen\n // is no longer backed by the store, and every later turn widens the gap. GENC-1511.\n 'persistence.save-failed': 'high',\n\n 'assistant.connected': 'normal',\n 'assistant.disconnected': 'normal',\n 'assistant.popout': 'normal',\n 'assistant.popin': 'normal',\n 'driver.created': 'normal',\n 'state.changed': 'normal',\n 'turn.start': 'normal',\n 'turn.end': 'normal',\n 'turn.retry': 'normal',\n 'tool.unresolved': 'normal',\n 'subagent.started': 'normal',\n 'subagent.completed': 'normal',\n // One per routing decision, with what the classifier answered and what the call cost. Same\n // level as the handoff it produces: you read them together to follow how a turn was routed.\n 'routing.decided': 'normal',\n 'agent.handoff': 'normal',\n 'agent.pinned': 'normal',\n 'agent.unpinned': 'normal',\n 'provider.selected': 'normal',\n 'interaction.requested': 'normal',\n 'interaction.resolved': 'normal',\n // Bookkeeping about an already-finished turn; interesting when reconciling a session total.\n 'interaction.external-cost': 'normal',\n // Spend that was billed but could NOT be recorded (the message was trimmed/condensed away, or\n // the value was not real spend). 'high': it is the one way the session total goes quietly\n // wrong, so it must stand out when reconciling.\n 'interaction.external-cost-dropped': 'high',\n // What came of an answer, recorded by the tool that asked (see recordInteractionOutcome).\n 'interaction.outcome': 'normal',\n // An outcome that could not be recorded: the widget goes on showing only the answer.\n 'interaction.outcome-dropped': 'high',\n // A long action's step starting, finishing, or skipped on resume because it was already done.\n 'interaction.step': 'low',\n // A cut checkpoint taken over after a reload, refused (by sameWork, and kept for a later request;\n // or as malformed), or dropped at flow end, as is the live one.\n 'interaction.checkpoint': 'normal',\n // A claimant handing a pending interaction to the person, or taking it back.\n 'interaction.held': 'normal',\n // A claim on a `userOnly` interaction, refused. Expected when an interceptor claims broadly.\n 'interaction.claim-refused': 'low',\n // A claimant ran one of the surface's actions: what it did, and whether that settled it.\n 'interaction.invoked': 'normal',\n 'autopilot.claimed': 'normal',\n // One per interaction the autopilot does not take, so frequent and mostly expected.\n 'autopilot.declined': 'low',\n 'autopilot.decision-sent': 'low',\n 'autopilot.acted': 'normal',\n 'autopilot.handed-back': 'normal',\n 'autopilot.paused': 'normal',\n 'autopilot.resumed': 'normal',\n // The mode went with the task across a hand-off or its hand-back, rather than ending with the flow.\n 'autopilot.carried': 'normal',\n // The wrapper itself failed: the journey stops being automatic without anyone choosing that.\n 'autopilot.error': 'high',\n // A written answer counted against the step's limit; reaching it withdraws `reply`.\n 'autopilot.refinement': 'normal',\n // The autopilot showed its own widget because a working turn ended needing the person.\n 'autopilot.handback-presented': 'normal',\n // The autopilot was given the whole visible transcript: its first decision, a rebuild, or after\n // a compaction removed the last message it saw.\n 'autopilot.catch-up': 'normal',\n // Autopilot spend that reached no message, so it is missing from the session total.\n 'autopilot.cost-dropped': 'high',\n // A headless session attached to the driver: from here a host with no screen is the person.\n 'headless.attached': 'normal',\n // The host settled an interaction raw, without the widget's own actions: its result went to the\n // tool as given, unchecked by anything the widget would have enforced.\n 'headless.raw-resolved': 'normal',\n 'external-diagnostics.folded': 'normal',\n 'session.cleared': 'normal',\n 'session.switched': 'low',\n 'session.switch-deferred': 'low',\n 'persistence.restored': 'normal',\n // Whether a restored flow will be re-activated and resumed (GENC-1662), and how much the trim cut.\n 'persistence.resume-planned': 'normal',\n // A planned resume that did not run, and why (GENC-1662) — the divider was put back to plain.\n 'persistence.resume-withdrawn': 'normal',\n 'persistence.suppressed': 'normal',\n 'persistence.not-resumable': 'normal',\n\n 'driver.wired': 'low',\n 'driver.unwired': 'low',\n 'context.updated': 'low',\n 'context.condensed': 'low',\n 'panel.toggled': 'low',\n 'persistence.toggled': 'low',\n 'persistence.saved': 'low',\n 'attachment.added': 'low',\n}",
|
|
13821
|
+
"default": "{\n 'turn.error': 'high',\n 'tool.failed': 'high',\n 'subagent.failed': 'high',\n 'file.read-failed': 'high',\n 'suggestions.failed': 'high',\n 'context.threshold-crossed': 'high',\n 'context.compacted': 'high',\n 'persistence.restore-orphan': 'high',\n // A save that did not land is silent data loss in progress: the transcript on screen\n // is no longer backed by the store, and every later turn widens the gap. GENC-1511.\n 'persistence.save-failed': 'high',\n\n 'assistant.connected': 'normal',\n 'assistant.disconnected': 'normal',\n 'assistant.popout': 'normal',\n 'assistant.popin': 'normal',\n 'driver.created': 'normal',\n 'state.changed': 'normal',\n 'turn.start': 'normal',\n 'turn.end': 'normal',\n 'turn.retry': 'normal',\n 'turn.finish-guard': 'normal',\n 'tool.unresolved': 'normal',\n 'subagent.started': 'normal',\n 'subagent.completed': 'normal',\n // One per routing decision, with what the classifier answered and what the call cost. Same\n // level as the handoff it produces: you read them together to follow how a turn was routed.\n 'routing.decided': 'normal',\n 'agent.handoff': 'normal',\n 'agent.pinned': 'normal',\n 'agent.unpinned': 'normal',\n 'provider.selected': 'normal',\n 'interaction.requested': 'normal',\n 'interaction.resolved': 'normal',\n // Bookkeeping about an already-finished turn; interesting when reconciling a session total.\n 'interaction.external-cost': 'normal',\n // Spend that was billed but could NOT be recorded (the message was trimmed/condensed away, or\n // the value was not real spend). 'high': it is the one way the session total goes quietly\n // wrong, so it must stand out when reconciling.\n 'interaction.external-cost-dropped': 'high',\n // What came of an answer, recorded by the tool that asked (see recordInteractionOutcome).\n 'interaction.outcome': 'normal',\n // An outcome that could not be recorded: the widget goes on showing only the answer.\n 'interaction.outcome-dropped': 'high',\n // A long action's step starting, finishing, or skipped on resume because it was already done.\n 'interaction.step': 'low',\n // A cut checkpoint taken over after a reload, refused (by sameWork, and kept for a later request;\n // or as malformed), or dropped at flow end, as is the live one.\n 'interaction.checkpoint': 'normal',\n // A claimant handing a pending interaction to the person, or taking it back.\n 'interaction.held': 'normal',\n // A claim on a `userOnly` interaction, refused. Expected when an interceptor claims broadly.\n 'interaction.claim-refused': 'low',\n // A claimant ran one of the surface's actions: what it did, and whether that settled it.\n 'interaction.invoked': 'normal',\n 'autopilot.claimed': 'normal',\n // One per interaction the autopilot does not take, so frequent and mostly expected.\n 'autopilot.declined': 'low',\n 'autopilot.decision-sent': 'low',\n 'autopilot.acted': 'normal',\n 'autopilot.handed-back': 'normal',\n 'autopilot.paused': 'normal',\n 'autopilot.resumed': 'normal',\n // The mode went with the task across a hand-off or its hand-back, rather than ending with the flow.\n 'autopilot.carried': 'normal',\n // The wrapper itself failed: the journey stops being automatic without anyone choosing that.\n 'autopilot.error': 'high',\n // A written answer counted against the step's limit; reaching it withdraws `reply`.\n 'autopilot.refinement': 'normal',\n // The autopilot showed its own widget because a working turn ended needing the person.\n 'autopilot.handback-presented': 'normal',\n // The autopilot was given the whole visible transcript: its first decision, a rebuild, or after\n // a compaction removed the last message it saw.\n 'autopilot.catch-up': 'normal',\n // Autopilot spend that reached no message, so it is missing from the session total.\n 'autopilot.cost-dropped': 'high',\n // A headless session attached to the driver: from here a host with no screen is the person.\n 'headless.attached': 'normal',\n // The host settled an interaction raw, without the widget's own actions: its result went to the\n // tool as given, unchecked by anything the widget would have enforced.\n 'headless.raw-resolved': 'normal',\n 'external-diagnostics.folded': 'normal',\n 'session.cleared': 'normal',\n 'session.switched': 'low',\n 'session.switch-deferred': 'low',\n 'persistence.restored': 'normal',\n // Whether a restored flow will be re-activated and resumed (GENC-1662), and how much the trim cut.\n 'persistence.resume-planned': 'normal',\n // A planned resume that did not run, and why (GENC-1662) — the divider was put back to plain.\n 'persistence.resume-withdrawn': 'normal',\n 'persistence.suppressed': 'normal',\n 'persistence.not-resumable': 'normal',\n\n 'driver.wired': 'low',\n 'driver.unwired': 'low',\n 'context.updated': 'low',\n 'context.condensed': 'low',\n 'panel.toggled': 'low',\n 'persistence.toggled': 'low',\n 'persistence.saved': 'low',\n 'attachment.added': 'low',\n}",
|
|
13822
13822
|
"description": "Importance is intrinsic to the event *type*, not the instance, so it's\ndefined once here and stamped automatically by recordMetaEvent — call\nsites never pass it. The `Record` is exhaustive: adding a `MetaEventType`\nwithout a level here is a compile error.\n\n- `high` — failures and hard limits you almost always want to see.\n- `normal` — meaningful session flow you read to follow what happened.\n- `low` — frequent UI / bookkeeping noise, usually safe to skip."
|
|
13823
13823
|
},
|
|
13824
13824
|
{
|
|
@@ -13980,7 +13980,7 @@
|
|
|
13980
13980
|
"type": {
|
|
13981
13981
|
"text": "readonly string[]"
|
|
13982
13982
|
},
|
|
13983
|
-
"default": "[\n 'This is an exported debug log for the Genesis AI assistant. Read it top-to-bottom.',\n \"`sessionUsage` is what this session spent: `costUsd` (USD, provider-reported per request and summed, cache discounts already applied) plus the four TOKEN BUCKETS — `uncachedInputTokens`, `cacheReadTokens`, `cacheWriteTokens`, `outputTokens`. Those four are disjoint and safe to add up for a total-tokens figure; the per-message fields further down are NOT (see kind:'message'). Each bucket bills at a different rate — cache reads a fraction of uncached input, cache writes a premium, output highest — so a big token count against a small cost means the prompt was mostly cache hits, not a missing charge. It covers sub-agent turns and spend a compaction banked, so for the CONVERSATION it is the authoritative total: prefer it over re-summing the timeline, which can be short by whatever the ring buffers evicted. The same figures appear under `meta.context`. It is as current as the snapshot it came from: the assistant's own download stamps a fresh one, but a log stitched by another tool can carry an older one — compare `meta.timestamp` with the last timeline entry, and if it is well behind, read these totals as historical and fall back to summing the timeline. One scope caveat: it is derived from the transcript, so it excludes billed calls that produced no message (a blank or refused attempt that was retried — see kind:'turn'.`usage`). Summing the turns can therefore come out HIGHER than this, and the difference is exactly that discarded spend, not a double-count.\",\n \"What 'session' means for those figures: the CURRENT conversation under this session key (a host-supplied per-project id, or the element id + header title when the host supplies none) — which is not necessarily everything in `timeline`. It is re-derived from the live transcript, so it spans page loads only when the chat is being remembered, and a Clear resets it to zero. `timeline` is append-only regardless: it keeps every page load and the pre-Clear conversation, with the session.cleared event as the boundary. So on a long-lived log, read these totals as the latest conversation's and the earlier sections as history — not as a total of the whole file.\",\n '`timeline` is the entire session as one array, already sorted chronologically by `timestamp` (ISO 8601). Every entry has a `kind`.',\n 'Timestamps are millisecond-resolution; entries that share the same millisecond are ordered by a fixed kind rank (event, then turn, then message), which is a heuristic and may not reflect exact causal order within that millisecond — e.g. a user message and the turn it triggered, or a final assistant message and its turn.end event, can appear in either order depending on whether they landed in the same millisecond. Read the logical structure of a turn rather than over-interpreting the micro-ordering of co-timestamped entries of different kinds.',\n \"kind:'message' — the conversation. `role` is user/assistant/tool/system-event/synthetic-user; `agentName` says which agent produced it; `toolCalls`/`toolResult`/`interaction` carry tool and widget activity; `inputTokens`/`outputTokens`/`cost` are per-message LLM usage, where `inputTokens` is the WHOLE prompt for that request and `cacheReadTokens`/`cacheWriteTokens` BREAK IT DOWN rather than add to it — uncached input is `inputTokens` minus those two, and adding the cache fields to `inputTokens` counts the prompt twice. The cache fields are absent on providers that report no cache split (Gemini reports reads only, since implicit caching bills no write) and on messages persisted before they existed, so read them as 0 when missing. Each bucket bills at a different rate — cache reads a fraction of uncached input, cache writes a premium, output highest — so a large token count at a small cost means the prompt was mostly cache hits. `externalCostUsd` is any non-LLM cost a widget reported for its own external service calls (folded into the session cost total alongside `cost`). On model-produced assistant messages, `model` is the concrete model id that generated it (e.g. 'gemini-2.5-flash-lite') and `providerName` is the registry slot it resolved under (e.g. a tier name like 'high'/'low', or the default); together they attribute the message — and any tool calls it carries — to an exact model even across a mid-session vendor/tier switch, where one slot name can map to different models before and after the switch. Both are undefined on any entry that is NOT an LLM response: non-assistant roles (user/tool/system-event) and 'synthetic-user' echoes; assistant interaction/widget entries (empty content carrying an `interaction` — a rendered widget, not a model turn); driver-authored assistant fallbacks (the timeout, repeated-malformed-call, and empty-response apology messages); and messages restored from a session persisted before these fields existed. One partial case: on a genuine model turn whose provider exposes no `getStatus` (or reports no model), `providerName` is still set but `model` alone is undefined. A 'synthetic-user' message is a display-only echo of an interaction outcome (e.g. the answer a widget reported): it renders on the user's side of the chat and `agentName` is the agent that created it, but it is never sent to the LLM — so it has no matching 'turn' and the model learns the outcome only from the corresponding tool result. An echo of an answer an interceptor (such as an autopilot) gave is NOT synthetic-user: see the delegated-messages paragraph.\",\n 'The autopilot (GENC-1660) runs on a driver of its own, and everything it did is harvested into this log: entries with delegate: autopilot and an agentName ending in › Autopilot are its turns (the decision message it was sent is the user message of its turn, so what it was shown is there verbatim; its systemPrompt is its grounding, such as the brief), its tool calls (widget_read, widget_act, hand_back, any read-only tools of its own, and its widget tools — reads with parameters that a widget type declares, routed to the interaction of that type being decided and refused with a reason when none is, offered on every decision so its tool list never changes; while one is open its tail starts with a line naming them) and their results (a read, view or widget tool, is capped at about 20,000 characters, cut with a note asking for less, and leaves its history at the end of the decision as a one-line note), and its own events. Its cost is already in the session total: it is booked as externalCostUsd on the interaction each decision answered, or, for a written question it answered, on the user message it sent on the user behalf (delegate: autopilot), so do not add its turns to that total. Spend that reached no message is recorded as autopilot.cost-dropped instead.',\n \"Delegated messages (GENC-1660): a message with a `delegate` field was written or sent ON THE USER'S BEHALF by a driver decorator, and `delegate` names it (e.g. autopilot). The platform stamps it; nothing else can. It renders as the assistant whatever its role. A delegated `user` message was NOT typed by the user: it is an answer given on their behalf, and the model read it with `delegateFraming` in brackets in front of the content (the stored `content` is the bare text). A delegated `assistant` message is display-only (`excludeFromProvider`): the decorator's narration note, or, when its answer carried no note, the widget's own echo of the answer (its `userMessage`), shown as the assistant and never as the person. A widget answer a decorator gave with a note is not echoed at all: the note already says what was chosen. To tell what the person decided from what was decided for them, read `interaction.answeredBy` and these fields, never the role alone.\",\n \"Sub-agent messages appear inline. When a tool delegates to a sub-agent (via `requestSubAgent`), the sub-agent's whole conversation — its own assistant/tool messages, each with their own `content`/`thinking`/`toolCalls`/`toolResult` and per-message `model`/`providerName`/`inputTokens`/`outputTokens`/`cacheReadTokens`/`cacheWriteTokens`/`cost` — is hoisted into the timeline as ordinary kind:'message' entries, interleaved by timestamp right after the tool call that spawned them (so you read the delegation top-to-bottom). A hoisted entry is marked: `subAgentDepth` is its delegation depth (1 for a sub-agent, 2 for a sub-agent's sub-agent, …), `subAgentOf` is the id of the parent tool call that spawned it (correlates it back even when two sub-agents run in one parent turn), `subAgentName` is the sub-agent's own name, and `agentName` is rewritten to a `\\\"<parent> › <sub-agent>\\\"` breadcrumb (composing when nested, e.g. `\\\"UI Builder › Planner › Grounding\\\"`). The sub-agent's per-LLM-call snapshots also surface as kind:'turn' entries with an N-M `turnIndex`, and subagent.started/completed (or subagent.failed) events bracket the run. Per-message `cost` on hoisted entries is already part of the session total (it is summed from the un-flattened history), so summing the top-level timeline does NOT double-count.\",\n \"kind:'turn' — one LLM call. `turnIndex` is a string: a top-level turn is the bare counter ('0', '1', …); a sub-agent's turns are numbered under the parent turn that activated them ('3-1', '3-2', …, and a nested sub-agent contributes '3-2-1', …), and `agentName` names the agent that ran the turn. `systemPrompt` and `toolNames` are what the model saw. A systemPrompt of '<repeated — identical to turn N>' was byte-identical to turn N and de-duplicated; the full prompt is shown whenever it changes (often because a stateful agent advanced), so prompt evolution is visible.\",\n \"kind:'turn'.`model`/`providerName`/`provider` — which model ran that call: the concrete model id, the registry slot it resolved under (a tier name like 'high'/'low', or the default), and the vendor. Recorded per CALL, so an agent whose `provider` selector varies by state — a flow that plans on a high tier and executes on a low one — has every step attributed, including calls that produced no message. `model` is the SERVING model where the provider reports one, so a turn answered by a server-side fallback names the model that answered rather than the one requested; it always matches the `model` on the message that call produced. Absent when the provider exposes no `getStatus` and the transport stamped nothing.\",\n \"kind:'turn'.`usage` — what that ONE call cost, in the same four-bucket + `costUsd` shape as `sessionUsage`. Absent while a call is in flight and on providers that report no usage. This is the SAME money as the message the call produced, not extra money: never add turn usage to message usage, and read a turn plus its message as one charge. Its distinct value is the calls that produced NO message — a blank or refused response is billed and then discarded before the retry, so the turn entry is the only record of that spend, and a turn with `usage` but no message after it is exactly that. `costUsd: 0` alongside a nonzero token count means the provider reported no price, not that the call was free.\",\n \"kind:'turn'.`agentSnapshot` — the active agent's own view of its internal state, captured at that turn. An agent opts into this by exposing a `getDebugSnapshot()` that returns JSON-serializable per-state info; stateful/flow agents wire it automatically, so you can watch a flow advance turn-by-turn (e.g. current step, cursor, collected fields, pending changes). Absent for agents that don't expose one.\",\n \"kind:'event' — a meta/lifecycle event. `type` names it (see below); `detail` carries structured data. `detail.placement` is the emitting UI instance: 'bubble' (collapsed), 'panel' (popped-out), or 'standalone'.\",\n \"Each 'event' also has an `importance`: 'high' (failures/limits — turn.error, tool.failed, subagent.failed, file.read-failed, suggestions.failed, context.threshold-crossed), 'normal' (session flow — connects, turns, retries, handoffs, agent/provider changes, interactions, sub-agent start/complete), or 'low' (skippable UI/bookkeeping noise — panel.toggled, attachment.added, driver.wired/unwired, context.updated, context.condensed). To skim, ignore importance:'low'; to triage a failure, filter to importance:'high' then read the nearby messages and turns. A 'high' turn.error is often preceded by one or more 'normal' turn.retry events for the same reason — read them together to see how many attempts were made before bailing. 'message' and 'turn' entries carry no importance — they are the substance, always read them.\",\n \"Event types: assistant.connected/disconnected (mount + placement + whether the session was created or restored), assistant.popout/popin (window placement), driver.created/wired/unwired (which driver is live and why it stops/starts responding across a popout), state.changed (idle↔loading), turn.start/turn.end (turn boundary; turn.end carries durationMs), turn.retry (a recoverable in-turn retry — detail.reason plus attempt/maxAttempts; for malformed calls also finishMessage; for empty responses also the provider finishReason + thoughtsTokens + parts breakdown), turn.error (a turn failed or hit a guardrail — detail.reason is one of exception/malformed-function-call/empty-response/unknown-tool-limit/max-iterations/response-truncated/refusal/budget-exhausted/provider-refused/context-exhausted/ai-service-error, plus reason-specific diagnostics: attempts (for empty-response also finishReason + thoughtsTokens + a parts breakdown, distinguishing a thinking-only STOP from a truly empty turn), finishMessage, for response-truncated the model + maxTokens + outputTokens + tools, unknownTools (split into staleTools — real earlier this activation but retired by the current state or hidden behind an open exclusive fold — and hallucinatedTools — never advertised) + availableTools, iterations + limit, for budget-exhausted the budgetUsd + spentUsd figures reported by the proxy plus the resolved vendor, for provider-refused the kind (spend|auth) plus the upstream status and error type — the vendor refusing the ACCOUNT rather than us refusing to spend, so the remedy is a top-up or a key rotation rather than a raised cap, and the kind is the only place that distinction survives because the user-facing copy is deliberately cause-free, for context-exhausted the estimated contextTokens against the guard that stopped the turn plus the iterations reached — the driver ending a runaway tool loop at the edge of the context window rather than issuing a request the provider would reject, so the transcript survives intact and can still be compacted, for ai-service-error the code (one of AI_SERVICE_ERROR_CODES, e.g. NO_API_KEY) and the status the AI service answered with — its own text goes to the browser console only, or name + message for exceptions), tool.failed (a tool threw), tool.unresolved (the model called a tool that could not be dispatched — detail.kind is folded/fold-hidden/stale/unknown, plus tool + agent and, for the counted kinds, the consecutive streak; the recurring lead-up to an unknown-tool-limit turn.error), subagent.started/completed/failed (the lifecycle of a `requestSubAgent` delegation — detail.agent names the sub-agent; these bracket the sub-agent turns that appear as kind:turn entries with an N-M `turnIndex`; subagent.failed also carries detail.reason, one of max_iterations/malformed_tool_call/empty_response/unknown_tool_limit/timeout/response_truncated/refusal/budget_exhausted/provider_refused/context_exhausted/ai_service_error, and for timeout detail.cause: 'idle' when it was the sub-agent making no progress for `idleTimeoutMs` rather than the overall `timeoutMs` (absent for the latter); budget_exhausted and provider_refused are terminal for the PARENT turn too, and so is ai_service_error when the refusal is about the service rather than the request and came from the vendor the parent calls — the parent stops rather than calling the model again into the same wall; after context_exhausted the parent goes on, but its own next call is likely to stop on the same guard), agent.handoff (routing; from=null is the initial activation), agent.pinned/unpinned (forced routing), routing.decided (ONE PER ROUTING DECISION — see its own paragraph below), provider.selected (the resolved provider for the upcoming turns — detail.provider is the registry SLOT/tier name, detail.model the concrete model behind it and detail.vendor its vendor; emitted only when the slot CHANGES, so read the per-turn `model` for the model of any given call rather than assuming the nearest event still applies), interaction.requested/resolved (blocking user widgets — explain quiet gaps; note that when a sub-agent opens a widget, detail.agent — and the agentName on the interaction message — is the HOST agent that owns the widget, NOT the sub-agent that asked, because widgets render and resolve on the host driver; detail.ownerPath names the agents that actually asked, outermost first, the last being the one whose tool requested it, and detail.heldBy says who held it when it opened: user, or the id of the interceptor that claimed it, such as autopilot; on interaction.resolved, detail.answeredBy is who answered — the claimant id when it settled through its own hold, user for any other answer (a click counts as the person even on a widget a claimant held) — absent when it closed unanswered (a timeout or a stop), and absent too when it settled by itself other than through the hold of a claimant — a widget registered resolvesItself (one that does its work and settles on its own, asking the person nothing, such as a generation run), or one outcome its controller said settled itself (ctx.resolve with resolvedItself, such as a generation phase that failed outright before its review gate ever asked anything) — which then carries detail.resolvedItself: true instead, as the interaction message does — nobody answered it, and the platform cannot tell it finishing from the person interrupting it (a Skip), so only the result of the widget itself can say which; the same value is stamped on the interaction message as answeredBy and on the result the asking tool handler receives (absent there in the same cases), and when it is not user the tool result that interaction returned carries a decidedOnUsersBehalf record, so the model was told the choice was not made by the person; detail.edits, present only when non-zero, counts the editing actions a claimant ran on the widget before it was settled, whoever settled it, and those edits are stamped on the interaction message as edits, each with by, action, choice and args when it had some, in the order they ran, while a decidedOnUsersBehalf record carries their choice texts as edits, and when the person settled it after such edits the tool result carries an editedOnUsersBehalf record instead — the framing and those choice texts — so the model knows the widget was changed on the user behalf before the user answered, and that the user then confirmed it by finishing it), interaction.held (a claimant moved a pending interaction to the person or back to itself — detail.heldBy is the new holder, detail.claimant the interceptor; detail.late: true is an interceptor that declined it when it opened claiming it afterwards, such as the autopilot resumed while it was open; a widget held by anything but user was not answered by the person), interaction.claim-refused (a claim on a userOnly interaction, which stays with the person — detail.claimant + reason), autopilot.* (the autopilot, a decorator that answers interactions on behalf of the user — autopilot.claimed / autopilot.declined say whether it took each interaction and, for a decline, detail.reason: paused, other-flow, no-autopilot, unavailable, userOnly, policy or no-controller; one declined as paused that is still open when the person resumes the autopilot is looked at again, and the autopilot.claimed or autopilot.declined recorded for it then carries detail.onResume: true (a decline then can also be claimed-elsewhere, another interceptor having claimed it first); a restored mode looks at nothing; autopilot.decision-sent is what it was sent (detail.chars; detail.nothingEnabled: true when every action on the widget was unavailable — a gate whose controller said it was asking, such as a failed build the autopilot may not cancel — so it could only hand it back, which it may then do even after the person asked it to decide it itself; a widget whose controller says it is working (ctx.setWorking) is never sent a decision until it says it is asking, even when an action is enabled or the person resumes the autopilot); autopilot.acted is what it did (detail.action, detail.note, detail.finished); autopilot.handed-back is a decision it gave to the person (detail.reason and detail.trigger: model, no-decision or error); autopilot.paused / autopilot.resumed are mode changes (detail.scope, detail.trigger, detail.decideYourself when the person resumed during a hand-back; detail.trigger is restored when the mode came back with the session after a reload, applied once its flow re-activated, which starts nothing by itself); autopilot.carried is the mode, running or paused, going with the task to the agent that took it over, rather than ending with the flow as on any other change of flow owner: to the target of a hand-off, or back to its caller on the hand-back (detail.from, detail.to, detail.mode); a pause the person chose goes with it, and Stop and Clear still end it; a mode restored for the target of a hand-off applies to its caller when the reload hands back; autopilot.error is the wrapper itself failing; autopilot.refinement counts a refining action against its step — a written answer (reply) or a widget action declared refines, such as a regenerate with instructions, counted together (detail.action, detail.stepKey, detail.count, detail.limitReached, after which every refining action is withdrawn for that step: not listed, and refused; the decision and every relisting of its actions say how many are left at the step, as a line Refinements left at this step: N, wherever the widget has a refining action); autopilot.handback-presented is the turn-level hand-back, shown when a working turn ended needing the person with no widget to hand over (detail.why: max-iterations, context-exhausted, failure or question; detail.options; detail.choice once answered); autopilot.catch-up is the autopilot being given the whole visible transcript at once (detail.why: first, for its first decision in a flow or after a reload; size, when its own history passed its budget and was rebuilt short — detail.ownChars; or compacted, when a compaction removed the last message it had seen, so it reads the summary and everything since, short; in each, what it had sent on the user behalf is included and labelled as its own, since its own history does not hold it); autopilot.cost-dropped is autopilot spend that no message carries, so it is NOT in the session total (detail.costUsd and detail.why: handed-back, aborted or stale for a written question it answered that no reply was sent for — stale when a pause, a resume, a new turn or the end of its flow came before the answer landed, which then went nowhere — or no-recorder when the driver had no way to book a decision to its interaction); a hand-back trigger can also be budget (the decision passed its spend cap), watchdog (its work went quiet: no ready surface and no heartbeat, or its own decision stalled with no model call landing, which stops that decision) or detached (the autopilot was removed while it held the interaction, which went to the person with no reason shown). To debug one autopilot decision, follow its interactionId: interaction.requested (heldBy), autopilot.claimed, autopilot.decision-sent, autopilot.acted or autopilot.handed-back, interaction.invoked, interaction.resolved (answeredBy), then the next turn of the working agent), interaction.invoked (a claimant ran one of the actions the widget itself exposes, through its hold, the same code the button runs — detail.claimant, detail.action (an option id, select or reply) and detail.finished, whether that settled the interaction, and when it did not, the run is recorded as an edit; the choice and narration it recorded reach the result of the tool that asked as decidedOnUsersBehalf; the person's own programmatic action, from a host with no DOM to click, carries detail.by: user in place of detail.claimant, and is not recorded as an edit nor as a decision on their behalf, so what it settles is answered by user), interaction.step (a long action run as named steps through runSteps, which survive a reload — detail.step and detail.outcome: started, done, skipped when the step was already done before a reload, or resumed when it started before a reload and runs again with what it saved part-way, such as a job id it re-attaches to), interaction.checkpoint (the checkpoints a conversation keeps for its long actions: the one in flight, and each one a reload cut, held apart until a request of its own widget type takes it over, so a resumed flow that opens other long widgets first, which save their own, loses nothing — detail.action: resumed when a reload cut the work and a request of the same widget type that the registration sameWork agrees is the same work took it over, refused when sameWork said a new request is different work (detail.saved is the identity it kept; detail.kept: true, since it stays for a later request of that type, and is offered to every one until one agrees) or when runSteps found the handed-over checkpoint malformed and started fresh (detail.reason, detail.saved), or cleared when its flow ended, once per checkpoint, with detail.cut: true for one a reload cut that nothing took over), context.updated/threshold-crossed (token + cost), headless.attached (a HeadlessSession attached, for a host that drives the assistant with no screen — detail.label, what the host called itself, when it gave one) and headless.raw-resolved (that host settled an interaction raw, bypassing the widget's own actions: detail.interactionId and detail.component; the result went to the tool as given, so check what the widget would have enforced), context.condensed (a stale tool payload was collapsed out of the model-bound history by a `condenseWhen` declaration on the tool — detail.tool + toolCallId, target args|response, trigger (superseded:<key> or age:<n>), stubLen, and an estimated tokensSaved; stored history and this log keep the FULL payload, so the model-visible slice at any point is the full history minus the condensations recorded up to then), panel.toggled, attachment.added, file.read-failed, suggestions.failed.\",\n 'Sub-agent meta events: a sub-agent\\'s own turn.retry/turn.error/tool.failed/tool.unresolved events are merged into this same timeline, tagged with `detail.subAgent` — a `\"<parent> › <sub-agent>\"` breadcrumb that composes when nested (e.g. `\"UI Builder › Planner › Grounding\"`) — and interleaved by their original timestamps within the subagent.started→completed/failed bracket. These are the per-attempt/per-failure signals that do NOT appear among the sub-agent\\'s (hoisted) messages: a malformed/empty attempt that gets retried produces no message, and the stale-vs-hallucinated split and streak counts live only on the event. A sub-agent\\'s high-volume, message-derivable events (turn.start/turn.end, provider.selected, context.updated) are intentionally NOT merged — read its hoisted messages for model/tokens/cost and turn-by-turn activity, and the bracketing subagent.* events for the run\\'s span.',\n \"`meta` holds context captured at export time: agentSummary (full agent configs), context (active model, contextTokens/contextLimit/contextUsagePercent for the last call, and the session totals — sessionCostUsd, sessionTokensConsumed, and the four-bucket sessionUsage lifted to the top of this log), activeDebugSnapshot (the active agent's `getDebugSnapshot()` taken fresh at export — reflects state NOW, which may have advanced beyond the last turn's agentSnapshot), debug (optional host-supplied debug state), host, and the export timestamp.\",\n 'Note the two different scopes in `meta.context`: `contextTokens` is the prompt size of the LAST call (against `contextLimit`, the model context window), while `sessionUsage`/`sessionTokensConsumed` are cumulative BILLED throughput. Every turn resends the conversation, so the cumulative figure counts each turn’s prompt again in the next turn’s and is expected to dwarf the context size — that is not double-counting.',\n \"kind:'event' type 'routing.decided' — how ONE user turn was routed, emitted by the orchestrating driver before the agent runs. Only a user turn is routed: a hand-off names its target, so the agents a hand-off runs show up as agent.handoff events, not as more routing.decided. `decision` is why that agent was chosen: 'classified' (the classifier ran and picked one), 'no-match' (it ran and answered -1 — nothing listed covers the request), 'pinned' (a user pin, an agent named for that one message by the send's `agent` option, or an active stateful flow owned the turn, so no call was made), 'single-candidate'/'no-specialists' (configuration left nothing to decide), 'provider-unavailable' (the registry default exposes no chat()), 'classifier-failed' (every attempt threw — `error` carries the last one). `to` names the agent and `fallback` says whether that agent is the fallback. `candidates` is what was ON THE BALLOT — every classifier-eligible specialist — in ballot order, so `index` — the classifier's own answer — indexes it directly. `candidates` is absent on the three decisions that put nothing to a vote — 'pinned', 'single-candidate', 'no-specialists'. It IS present on 'provider-unavailable', which is not an exception worth removing: the ballot was built there, it simply never got sent. `attempts` covers the retry ladder. `durationMs` is on EVERY routing.decided, and is the field to read when a decision looks wrong: the decisions that can reach the fallback ('no-match', 'no-specialists', 'provider-unavailable', 'classifier-failed') are told apart by the clock as much as by their name, because a fallback routing that resolved in tens of milliseconds made no network call at all whatever its `decision` says.\",\n \"kind:'event' type 'routing.decided'.`usage` — what that classifier call cost, in the same four-bucket + costUsd shape as `sessionUsage`, plus `model`. Absent on the decisions that make no call (see 'pinned' and the configuration ones). THIS SPEND IS NOT IN `sessionUsage`: a classifier call never enters the transcript and `sessionUsage` is derived from the transcript, so classifier cost is missing from the session total by construction, not by accident. Sum these events to close that gap — it is the one component of a session's real spend that the totals cannot see.\",\n 'To debug a failure: find the last turn.error or tool.failed, then read upward for the user message, the turn(s), and the agent/provider/state events that led into it. For a turn that went to the wrong agent, read its routing.decided first — `decision` says whether anything was actually asked.',\n]",
|
|
13983
|
+
"default": "[\n 'This is an exported debug log for the Genesis AI assistant. Read it top-to-bottom.',\n \"`sessionUsage` is what this session spent: `costUsd` (USD, provider-reported per request and summed, cache discounts already applied) plus the four TOKEN BUCKETS — `uncachedInputTokens`, `cacheReadTokens`, `cacheWriteTokens`, `outputTokens`. Those four are disjoint and safe to add up for a total-tokens figure; the per-message fields further down are NOT (see kind:'message'). Each bucket bills at a different rate — cache reads a fraction of uncached input, cache writes a premium, output highest — so a big token count against a small cost means the prompt was mostly cache hits, not a missing charge. It covers sub-agent turns and spend a compaction banked, so for the CONVERSATION it is the authoritative total: prefer it over re-summing the timeline, which can be short by whatever the ring buffers evicted. The same figures appear under `meta.context`. It is as current as the snapshot it came from: the assistant's own download stamps a fresh one, but a log stitched by another tool can carry an older one — compare `meta.timestamp` with the last timeline entry, and if it is well behind, read these totals as historical and fall back to summing the timeline. One scope caveat: it is derived from the transcript, so it excludes billed calls that produced no message (a blank or refused attempt that was retried — see kind:'turn'.`usage`). Summing the turns can therefore come out HIGHER than this, and the difference is exactly that discarded spend, not a double-count.\",\n \"What 'session' means for those figures: the CURRENT conversation under this session key (a host-supplied per-project id, or the element id + header title when the host supplies none) — which is not necessarily everything in `timeline`. It is re-derived from the live transcript, so it spans page loads only when the chat is being remembered, and a Clear resets it to zero. `timeline` is append-only regardless: it keeps every page load and the pre-Clear conversation, with the session.cleared event as the boundary. So on a long-lived log, read these totals as the latest conversation's and the earlier sections as history — not as a total of the whole file.\",\n '`timeline` is the entire session as one array, already sorted chronologically by `timestamp` (ISO 8601). Every entry has a `kind`.',\n 'Timestamps are millisecond-resolution; entries that share the same millisecond are ordered by a fixed kind rank (event, then turn, then message), which is a heuristic and may not reflect exact causal order within that millisecond — e.g. a user message and the turn it triggered, or a final assistant message and its turn.end event, can appear in either order depending on whether they landed in the same millisecond. Read the logical structure of a turn rather than over-interpreting the micro-ordering of co-timestamped entries of different kinds.',\n \"kind:'message' — the conversation. `role` is user/assistant/tool/system-event/synthetic-user; `agentName` says which agent produced it; `toolCalls`/`toolResult`/`interaction` carry tool and widget activity; `inputTokens`/`outputTokens`/`cost` are per-message LLM usage, where `inputTokens` is the WHOLE prompt for that request and `cacheReadTokens`/`cacheWriteTokens` BREAK IT DOWN rather than add to it — uncached input is `inputTokens` minus those two, and adding the cache fields to `inputTokens` counts the prompt twice. The cache fields are absent on providers that report no cache split (Gemini reports reads only, since implicit caching bills no write) and on messages persisted before they existed, so read them as 0 when missing. Each bucket bills at a different rate — cache reads a fraction of uncached input, cache writes a premium, output highest — so a large token count at a small cost means the prompt was mostly cache hits. `externalCostUsd` is any non-LLM cost a widget reported for its own external service calls (folded into the session cost total alongside `cost`). On model-produced assistant messages, `model` is the concrete model id that generated it (e.g. 'gemini-2.5-flash-lite') and `providerName` is the registry slot it resolved under (e.g. a tier name like 'high'/'low', or the default); together they attribute the message — and any tool calls it carries — to an exact model even across a mid-session vendor/tier switch, where one slot name can map to different models before and after the switch. Both are undefined on any entry that is NOT an LLM response: non-assistant roles (user/tool/system-event) and 'synthetic-user' echoes; assistant interaction/widget entries (empty content carrying an `interaction` — a rendered widget, not a model turn); driver-authored assistant fallbacks (the timeout, repeated-malformed-call, and empty-response apology messages); and messages restored from a session persisted before these fields existed. One partial case: on a genuine model turn whose provider exposes no `getStatus` (or reports no model), `providerName` is still set but `model` alone is undefined. A 'synthetic-user' message is a display-only echo of an interaction outcome (e.g. the answer a widget reported): it renders on the user's side of the chat and `agentName` is the agent that created it, but it is never sent to the LLM — so it has no matching 'turn' and the model learns the outcome only from the corresponding tool result. An echo of an answer an interceptor (such as an autopilot) gave is NOT synthetic-user: see the delegated-messages paragraph.\",\n 'The autopilot (GENC-1660) runs on a driver of its own, and everything it did is harvested into this log: entries with delegate: autopilot and an agentName ending in › Autopilot are its turns (the decision message it was sent is the user message of its turn, so what it was shown is there verbatim; its systemPrompt is its grounding, such as the brief), its tool calls (widget_read, widget_act, hand_back, any read-only tools of its own, and its widget tools — reads with parameters that a widget type declares, routed to the interaction of that type being decided and refused with a reason when none is, offered on every decision so its tool list never changes; while one is open its tail starts with a line naming them) and their results (a read, view or widget tool, is capped at about 20,000 characters, cut with a note asking for less, and leaves its history at the end of the decision as a one-line note), and its own events. Its cost is already in the session total: it is booked as externalCostUsd on the interaction each decision answered, or, for a written question it answered, on the user message it sent on the user behalf (delegate: autopilot), so do not add its turns to that total. Spend that reached no message is recorded as autopilot.cost-dropped instead.',\n \"Delegated messages (GENC-1660): a message with a `delegate` field was written or sent ON THE USER'S BEHALF by a driver decorator, and `delegate` names it (e.g. autopilot). The platform stamps it; nothing else can. It renders as the assistant whatever its role. A delegated `user` message was NOT typed by the user: it is an answer given on their behalf, and the model read it with `delegateFraming` in brackets in front of the content (the stored `content` is the bare text). A delegated `assistant` message is display-only (`excludeFromProvider`): the decorator's narration note, or, when its answer carried no note, the widget's own echo of the answer (its `userMessage`), shown as the assistant and never as the person. A widget answer a decorator gave with a note is not echoed at all: the note already says what was chosen. To tell what the person decided from what was decided for them, read `interaction.answeredBy` and these fields, never the role alone. Driver notes: a `user` message with a `driverNote` field was written by the driver for the model, never by the user, and is hidden from the transcript; `driverNote: 'finish-guard'` is the agent's finishGuard holding the turn open after a prose reply, its content the guard's note in a `<system-reminder>`, and it follows a turn.finish-guard event; `driverNote: 'completion-nudge'` is the driver asking a sub-agent that replied in prose to call its completion tool.\",\n \"Sub-agent messages appear inline. When a tool delegates to a sub-agent (via `requestSubAgent`), the sub-agent's whole conversation — its own assistant/tool messages, each with their own `content`/`thinking`/`toolCalls`/`toolResult` and per-message `model`/`providerName`/`inputTokens`/`outputTokens`/`cacheReadTokens`/`cacheWriteTokens`/`cost` — is hoisted into the timeline as ordinary kind:'message' entries, interleaved by timestamp right after the tool call that spawned them (so you read the delegation top-to-bottom). A hoisted entry is marked: `subAgentDepth` is its delegation depth (1 for a sub-agent, 2 for a sub-agent's sub-agent, …), `subAgentOf` is the id of the parent tool call that spawned it (correlates it back even when two sub-agents run in one parent turn), `subAgentName` is the sub-agent's own name, and `agentName` is rewritten to a `\\\"<parent> › <sub-agent>\\\"` breadcrumb (composing when nested, e.g. `\\\"UI Builder › Planner › Grounding\\\"`). The sub-agent's per-LLM-call snapshots also surface as kind:'turn' entries with an N-M `turnIndex`, and subagent.started/completed (or subagent.failed) events bracket the run. Per-message `cost` on hoisted entries is already part of the session total (it is summed from the un-flattened history), so summing the top-level timeline does NOT double-count.\",\n \"kind:'turn' — one LLM call. `turnIndex` is a string: a top-level turn is the bare counter ('0', '1', …); a sub-agent's turns are numbered under the parent turn that activated them ('3-1', '3-2', …, and a nested sub-agent contributes '3-2-1', …), and `agentName` names the agent that ran the turn. `systemPrompt` and `toolNames` are what the model saw. A systemPrompt of '<repeated — identical to turn N>' was byte-identical to turn N and de-duplicated; the full prompt is shown whenever it changes (often because a stateful agent advanced), so prompt evolution is visible.\",\n \"kind:'turn'.`model`/`providerName`/`provider` — which model ran that call: the concrete model id, the registry slot it resolved under (a tier name like 'high'/'low', or the default), and the vendor. Recorded per CALL, so an agent whose `provider` selector varies by state — a flow that plans on a high tier and executes on a low one — has every step attributed, including calls that produced no message. `model` is the SERVING model where the provider reports one, so a turn answered by a server-side fallback names the model that answered rather than the one requested; it always matches the `model` on the message that call produced. Absent when the provider exposes no `getStatus` and the transport stamped nothing.\",\n \"kind:'turn'.`usage` — what that ONE call cost, in the same four-bucket + `costUsd` shape as `sessionUsage`. Absent while a call is in flight and on providers that report no usage. This is the SAME money as the message the call produced, not extra money: never add turn usage to message usage, and read a turn plus its message as one charge. Its distinct value is the calls that produced NO message — a blank or refused response is billed and then discarded before the retry, so the turn entry is the only record of that spend, and a turn with `usage` but no message after it is exactly that. `costUsd: 0` alongside a nonzero token count means the provider reported no price, not that the call was free.\",\n \"kind:'turn'.`agentSnapshot` — the active agent's own view of its internal state, captured at that turn. An agent opts into this by exposing a `getDebugSnapshot()` that returns JSON-serializable per-state info; stateful/flow agents wire it automatically, so you can watch a flow advance turn-by-turn (e.g. current step, cursor, collected fields, pending changes). Absent for agents that don't expose one.\",\n \"kind:'event' — a meta/lifecycle event. `type` names it (see below); `detail` carries structured data. `detail.placement` is the emitting UI instance: 'bubble' (collapsed), 'panel' (popped-out), or 'standalone'.\",\n \"Each 'event' also has an `importance`: 'high' (failures/limits — turn.error, tool.failed, subagent.failed, file.read-failed, suggestions.failed, context.threshold-crossed), 'normal' (session flow — connects, turns, retries, handoffs, agent/provider changes, interactions, sub-agent start/complete), or 'low' (skippable UI/bookkeeping noise — panel.toggled, attachment.added, driver.wired/unwired, context.updated, context.condensed). To skim, ignore importance:'low'; to triage a failure, filter to importance:'high' then read the nearby messages and turns. A 'high' turn.error is often preceded by one or more 'normal' turn.retry events for the same reason — read them together to see how many attempts were made before bailing. 'message' and 'turn' entries carry no importance — they are the substance, always read them.\",\n \"Event types: assistant.connected/disconnected (mount + placement + whether the session was created or restored), assistant.popout/popin (window placement), driver.created/wired/unwired (which driver is live and why it stops/starts responding across a popout), state.changed (idle↔loading), turn.start/turn.end (turn boundary; turn.end carries durationMs), turn.retry (a recoverable in-turn retry — detail.reason plus attempt/maxAttempts; for malformed calls also finishMessage; for empty responses also the provider finishReason + thoughtsTokens + parts breakdown), turn.finish-guard (the model replied with no tool call and the agent's finishGuard hook answered — detail.action is continue (the turn was held open: detail.continuation counts the holds this turn and detail.note is the note stored as a hidden user message with driverNote finish-guard, the next message in the log; detail.source: 'completion-nudge' is instead the driver holding a SUB-AGENT's turn open because it replied in prose without calling its completion tool — detail.nudge of detail.maxNudges, the note stored with driverNote completion-nudge — and a sub-agent that still answers in prose after the last nudge fails as before) or end with detail.release: true (the agent was released on a prose answer); a plain end records nothing), turn.error (a turn failed or hit a guardrail — detail.reason is one of exception/malformed-function-call/empty-response/unknown-tool-limit/max-iterations/response-truncated/refusal/budget-exhausted/provider-refused/context-exhausted/ai-service-error, plus reason-specific diagnostics: attempts (for empty-response also finishReason + thoughtsTokens + a parts breakdown, distinguishing a thinking-only STOP from a truly empty turn), finishMessage, for response-truncated the model + maxTokens + outputTokens + tools, unknownTools (split into staleTools — real earlier this activation but retired by the current state or hidden behind an open exclusive fold — and hallucinatedTools — never advertised) + availableTools, iterations + limit, for budget-exhausted the budgetUsd + spentUsd figures reported by the proxy plus the resolved vendor, for provider-refused the kind (spend|auth) plus the upstream status and error type — the vendor refusing the ACCOUNT rather than us refusing to spend, so the remedy is a top-up or a key rotation rather than a raised cap, and the kind is the only place that distinction survives because the user-facing copy is deliberately cause-free, for context-exhausted the estimated contextTokens against the guard that stopped the turn plus the iterations reached — the driver ending a runaway tool loop at the edge of the context window rather than issuing a request the provider would reject, so the transcript survives intact and can still be compacted, for ai-service-error the code (one of AI_SERVICE_ERROR_CODES, e.g. NO_API_KEY) and the status the AI service answered with — its own text goes to the browser console only, or name + message for exceptions), tool.failed (a tool threw), tool.unresolved (the model called a tool that could not be dispatched — detail.kind is folded/fold-hidden/stale/unknown, plus tool + agent and, for the counted kinds, the consecutive streak; the recurring lead-up to an unknown-tool-limit turn.error), subagent.started/completed/failed (the lifecycle of a `requestSubAgent` delegation — detail.agent names the sub-agent; these bracket the sub-agent turns that appear as kind:turn entries with an N-M `turnIndex`; subagent.failed also carries detail.reason, one of max_iterations/malformed_tool_call/empty_response/unknown_tool_limit/timeout/response_truncated/refusal/budget_exhausted/provider_refused/context_exhausted/ai_service_error, and for timeout detail.cause: 'idle' when it was the sub-agent making no progress for `idleTimeoutMs` rather than the overall `timeoutMs` (absent for the latter); budget_exhausted and provider_refused are terminal for the PARENT turn too, and so is ai_service_error when the refusal is about the service rather than the request and came from the vendor the parent calls — the parent stops rather than calling the model again into the same wall; after context_exhausted the parent goes on, but its own next call is likely to stop on the same guard), agent.handoff (routing; from=null is the initial activation), agent.pinned/unpinned (forced routing), routing.decided (ONE PER ROUTING DECISION — see its own paragraph below), provider.selected (the resolved provider for the upcoming turns — detail.provider is the registry SLOT/tier name, detail.model the concrete model behind it and detail.vendor its vendor; emitted only when the slot CHANGES, so read the per-turn `model` for the model of any given call rather than assuming the nearest event still applies), interaction.requested/resolved (blocking user widgets — explain quiet gaps; note that when a sub-agent opens a widget, detail.agent — and the agentName on the interaction message — is the HOST agent that owns the widget, NOT the sub-agent that asked, because widgets render and resolve on the host driver; detail.ownerPath names the agents that actually asked, outermost first, the last being the one whose tool requested it, and detail.heldBy says who held it when it opened: user, or the id of the interceptor that claimed it, such as autopilot; on interaction.resolved, detail.answeredBy is who answered — the claimant id when it settled through its own hold, user for any other answer (a click counts as the person even on a widget a claimant held) — absent when it closed unanswered (a timeout or a stop), and absent too when it settled by itself other than through the hold of a claimant — a widget registered resolvesItself (one that does its work and settles on its own, asking the person nothing, such as a generation run), or one outcome its controller said settled itself (ctx.resolve with resolvedItself, such as a generation phase that failed outright before its review gate ever asked anything) — which then carries detail.resolvedItself: true instead, as the interaction message does — nobody answered it, and the platform cannot tell it finishing from the person interrupting it (a Skip), so only the result of the widget itself can say which; the same value is stamped on the interaction message as answeredBy and on the result the asking tool handler receives (absent there in the same cases), and when it is not user the tool result that interaction returned carries a decidedOnUsersBehalf record, so the model was told the choice was not made by the person; detail.edits, present only when non-zero, counts the editing actions a claimant ran on the widget before it was settled, whoever settled it, and those edits are stamped on the interaction message as edits, each with by, action, choice and args when it had some, in the order they ran, while a decidedOnUsersBehalf record carries their choice texts as edits, and when the person settled it after such edits the tool result carries an editedOnUsersBehalf record instead — the framing and those choice texts — so the model knows the widget was changed on the user behalf before the user answered, and that the user then confirmed it by finishing it), interaction.held (a claimant moved a pending interaction to the person or back to itself — detail.heldBy is the new holder, detail.claimant the interceptor; detail.late: true is an interceptor that declined it when it opened claiming it afterwards, such as the autopilot resumed while it was open; a widget held by anything but user was not answered by the person), interaction.claim-refused (a claim on a userOnly interaction, which stays with the person — detail.claimant + reason), autopilot.* (the autopilot, a decorator that answers interactions on behalf of the user — autopilot.claimed / autopilot.declined say whether it took each interaction and, for a decline, detail.reason: paused, other-flow, no-autopilot, unavailable, userOnly, policy or no-controller; one declined as paused that is still open when the person resumes the autopilot is looked at again, and the autopilot.claimed or autopilot.declined recorded for it then carries detail.onResume: true (a decline then can also be claimed-elsewhere, another interceptor having claimed it first); a restored mode looks at nothing; autopilot.decision-sent is what it was sent (detail.chars; detail.nothingEnabled: true when every action on the widget was unavailable — a gate whose controller said it was asking, such as a failed build the autopilot may not cancel — so it could only hand it back, which it may then do even after the person asked it to decide it itself; a widget whose controller says it is working (ctx.setWorking) is never sent a decision until it says it is asking, even when an action is enabled or the person resumes the autopilot); autopilot.acted is what it did (detail.action, detail.note, detail.finished); autopilot.handed-back is a decision it gave to the person (detail.reason and detail.trigger: model, no-decision or error); autopilot.paused / autopilot.resumed are mode changes (detail.scope, detail.trigger, detail.decideYourself when the person resumed during a hand-back; detail.trigger is restored when the mode came back with the session after a reload, applied once its flow re-activated, which starts nothing by itself); autopilot.carried is the mode, running or paused, going with the task to the agent that took it over, rather than ending with the flow as on any other change of flow owner: to the target of a hand-off, or back to its caller on the hand-back (detail.from, detail.to, detail.mode); a pause the person chose goes with it, and Stop and Clear still end it; a mode restored for the target of a hand-off applies to its caller when the reload hands back; autopilot.error is the wrapper itself failing; autopilot.refinement counts a refining action against its step — a written answer (reply) or a widget action declared refines, such as a regenerate with instructions, counted together (detail.action, detail.stepKey, detail.count, detail.limitReached, after which every refining action is withdrawn for that step: not listed, and refused; the decision and every relisting of its actions say how many are left at the step, as a line Refinements left at this step: N, wherever the widget has a refining action); autopilot.handback-presented is the turn-level hand-back, shown when a working turn ended needing the person with no widget to hand over (detail.why: max-iterations, context-exhausted, failure or question; detail.options; detail.choice once answered); autopilot.catch-up is the autopilot being given the whole visible transcript at once (detail.why: first, for its first decision in a flow or after a reload; size, when its own history passed its budget and was rebuilt short — detail.ownChars; or compacted, when a compaction removed the last message it had seen, so it reads the summary and everything since, short; in each, what it had sent on the user behalf is included and labelled as its own, since its own history does not hold it); autopilot.cost-dropped is autopilot spend that no message carries, so it is NOT in the session total (detail.costUsd and detail.why: handed-back, aborted or stale for a written question it answered that no reply was sent for — stale when a pause, a resume, a new turn or the end of its flow came before the answer landed, which then went nowhere — or no-recorder when the driver had no way to book a decision to its interaction); a hand-back trigger can also be budget (the decision passed its spend cap), watchdog (its work went quiet: no ready surface and no heartbeat, or its own decision stalled with no model call landing, which stops that decision) or detached (the autopilot was removed while it held the interaction, which went to the person with no reason shown). To debug one autopilot decision, follow its interactionId: interaction.requested (heldBy), autopilot.claimed, autopilot.decision-sent, autopilot.acted or autopilot.handed-back, interaction.invoked, interaction.resolved (answeredBy), then the next turn of the working agent), interaction.invoked (a claimant ran one of the actions the widget itself exposes, through its hold, the same code the button runs — detail.claimant, detail.action (an option id, select or reply) and detail.finished, whether that settled the interaction, and when it did not, the run is recorded as an edit; the choice and narration it recorded reach the result of the tool that asked as decidedOnUsersBehalf; the person's own programmatic action, from a host with no DOM to click, carries detail.by: user in place of detail.claimant, and is not recorded as an edit nor as a decision on their behalf, so what it settles is answered by user), interaction.step (a long action run as named steps through runSteps, which survive a reload — detail.step and detail.outcome: started, done, skipped when the step was already done before a reload, or resumed when it started before a reload and runs again with what it saved part-way, such as a job id it re-attaches to), interaction.checkpoint (the checkpoints a conversation keeps for its long actions: the one in flight, and each one a reload cut, held apart until a request of its own widget type takes it over, so a resumed flow that opens other long widgets first, which save their own, loses nothing — detail.action: resumed when a reload cut the work and a request of the same widget type that the registration sameWork agrees is the same work took it over, refused when sameWork said a new request is different work (detail.saved is the identity it kept; detail.kept: true, since it stays for a later request of that type, and is offered to every one until one agrees) or when runSteps found the handed-over checkpoint malformed and started fresh (detail.reason, detail.saved), or cleared when its flow ended, once per checkpoint, with detail.cut: true for one a reload cut that nothing took over), context.updated/threshold-crossed (token + cost), headless.attached (a HeadlessSession attached, for a host that drives the assistant with no screen — detail.label, what the host called itself, when it gave one) and headless.raw-resolved (that host settled an interaction raw, bypassing the widget's own actions: detail.interactionId and detail.component; the result went to the tool as given, so check what the widget would have enforced), context.condensed (a stale tool payload was collapsed out of the model-bound history by a `condenseWhen` declaration on the tool — detail.tool + toolCallId, target args|response, trigger (superseded:<key> or age:<n>), stubLen, and an estimated tokensSaved; stored history and this log keep the FULL payload, so the model-visible slice at any point is the full history minus the condensations recorded up to then), panel.toggled, attachment.added, file.read-failed, suggestions.failed.\",\n 'Sub-agent meta events: a sub-agent\\'s own turn.retry/turn.error/tool.failed/tool.unresolved/turn.finish-guard events are merged into this same timeline, tagged with `detail.subAgent` — a `\"<parent> › <sub-agent>\"` breadcrumb that composes when nested (e.g. `\"UI Builder › Planner › Grounding\"`) — and interleaved by their original timestamps within the subagent.started→completed/failed bracket. These are the per-attempt/per-failure signals that do NOT appear among the sub-agent\\'s (hoisted) messages: a malformed/empty attempt that gets retried produces no message, and the stale-vs-hallucinated split and streak counts live only on the event. A sub-agent\\'s high-volume, message-derivable events (turn.start/turn.end, provider.selected, context.updated) are intentionally NOT merged — read its hoisted messages for model/tokens/cost and turn-by-turn activity, and the bracketing subagent.* events for the run\\'s span.',\n \"`meta` holds context captured at export time: agentSummary (full agent configs), context (active model, contextTokens/contextLimit/contextUsagePercent for the last call, and the session totals — sessionCostUsd, sessionTokensConsumed, and the four-bucket sessionUsage lifted to the top of this log), activeDebugSnapshot (the active agent's `getDebugSnapshot()` taken fresh at export — reflects state NOW, which may have advanced beyond the last turn's agentSnapshot), debug (optional host-supplied debug state), host, and the export timestamp.\",\n 'Note the two different scopes in `meta.context`: `contextTokens` is the prompt size of the LAST call (against `contextLimit`, the model context window), while `sessionUsage`/`sessionTokensConsumed` are cumulative BILLED throughput. Every turn resends the conversation, so the cumulative figure counts each turn’s prompt again in the next turn’s and is expected to dwarf the context size — that is not double-counting.',\n \"kind:'event' type 'routing.decided' — how ONE user turn was routed, emitted by the orchestrating driver before the agent runs. Only a user turn is routed: a hand-off names its target, so the agents a hand-off runs show up as agent.handoff events, not as more routing.decided. `decision` is why that agent was chosen: 'classified' (the classifier ran and picked one), 'no-match' (it ran and answered -1 — nothing listed covers the request), 'pinned' (a user pin, an agent named for that one message by the send's `agent` option, or an active stateful flow owned the turn, so no call was made), 'single-candidate'/'no-specialists' (configuration left nothing to decide), 'provider-unavailable' (the registry default exposes no chat()), 'classifier-failed' (every attempt threw — `error` carries the last one). `to` names the agent and `fallback` says whether that agent is the fallback. `candidates` is what was ON THE BALLOT — every classifier-eligible specialist — in ballot order, so `index` — the classifier's own answer — indexes it directly. `candidates` is absent on the three decisions that put nothing to a vote — 'pinned', 'single-candidate', 'no-specialists'. It IS present on 'provider-unavailable', which is not an exception worth removing: the ballot was built there, it simply never got sent. `attempts` covers the retry ladder. `durationMs` is on EVERY routing.decided, and is the field to read when a decision looks wrong: the decisions that can reach the fallback ('no-match', 'no-specialists', 'provider-unavailable', 'classifier-failed') are told apart by the clock as much as by their name, because a fallback routing that resolved in tens of milliseconds made no network call at all whatever its `decision` says.\",\n \"kind:'event' type 'routing.decided'.`usage` — what that classifier call cost, in the same four-bucket + costUsd shape as `sessionUsage`, plus `model`. Absent on the decisions that make no call (see 'pinned' and the configuration ones). THIS SPEND IS NOT IN `sessionUsage`: a classifier call never enters the transcript and `sessionUsage` is derived from the transcript, so classifier cost is missing from the session total by construction, not by accident. Sum these events to close that gap — it is the one component of a session's real spend that the totals cannot see.\",\n 'To debug a failure: find the last turn.error or tool.failed, then read upward for the user message, the turn(s), and the agent/provider/state events that led into it. For a turn that went to the wrong agent, read its routing.decided first — `decision` says whether anything was actually asked.',\n]",
|
|
13984
13984
|
"description": "Human/agent-facing guide emitted as the first key of the exported debug log,\nso whoever opens the JSON (often an AI agent) knows how to read it without\nreverse-engineering the shape. Kept here next to the event catalogue it\ndescribes — but proximity alone demonstrably did NOT keep the two in sync\n(`refusal` was missing from both reason lists for a whole release), so\n`debug-event-log.test.ts` now asserts that every `TurnFailureReason` and every\n`SubAgentFailureReason` is named here, and fails the build when one is added\nwithout a matching sentence. Enumerations below read as exhaustive and WILL be\ntrusted by an agent reading the JSON — keep them so."
|
|
13985
13985
|
}
|
|
13986
13986
|
],
|
|
@@ -16330,6 +16330,12 @@
|
|
|
16330
16330
|
}
|
|
16331
16331
|
]
|
|
16332
16332
|
},
|
|
16333
|
+
{
|
|
16334
|
+
"kind": "javascript-module",
|
|
16335
|
+
"path": "src/utils/driver-note.ts",
|
|
16336
|
+
"declarations": [],
|
|
16337
|
+
"exports": []
|
|
16338
|
+
},
|
|
16333
16339
|
{
|
|
16334
16340
|
"kind": "javascript-module",
|
|
16335
16341
|
"path": "src/utils/flatten-sub-agent-messages.ts",
|
|
@@ -20252,13 +20258,31 @@
|
|
|
20252
20258
|
},
|
|
20253
20259
|
"default": "3"
|
|
20254
20260
|
},
|
|
20261
|
+
{
|
|
20262
|
+
"kind": "variable",
|
|
20263
|
+
"name": "MAX_SUB_AGENT_COMPLETION_NUDGES",
|
|
20264
|
+
"type": {
|
|
20265
|
+
"text": "number"
|
|
20266
|
+
},
|
|
20267
|
+
"default": "2",
|
|
20268
|
+
"description": "How many times one sub-agent turn is held open by the driver's own completion nudge: a sub-agent\nreturns its result only through `completeSubAgent`, so a reply in prose (a provider that ignored\nthe forced tool call, or an agent on `toolChoice: 'auto'`) is given this many chances to call its\ncompletion tool before the sub-agent fails. Counted per turn; the iteration cap bounds it too."
|
|
20269
|
+
},
|
|
20270
|
+
{
|
|
20271
|
+
"kind": "variable",
|
|
20272
|
+
"name": "SUB_AGENT_COMPLETION_NUDGE",
|
|
20273
|
+
"type": {
|
|
20274
|
+
"text": "string"
|
|
20275
|
+
},
|
|
20276
|
+
"default": "'You ended your turn in prose, but nothing you write in prose reaches your caller: your result is returned only through the tool that completes your task. Call it now with your result. If you cannot complete the task, call it anyway and say why.'",
|
|
20277
|
+
"description": "The note the completion nudge stores (see MAX_SUB_AGENT_COMPLETION_NUDGES). Names no tool:\nthe driver cannot tell which of a sub-agent's tools calls `completeSubAgent`."
|
|
20278
|
+
},
|
|
20255
20279
|
{
|
|
20256
20280
|
"kind": "variable",
|
|
20257
20281
|
"name": "HARVESTED_SUBAGENT_EVENTS",
|
|
20258
20282
|
"type": {
|
|
20259
20283
|
"text": "ReadonlySet<MetaEventType>"
|
|
20260
20284
|
},
|
|
20261
|
-
"default": "new Set([\n 'turn.retry',\n 'turn.error',\n 'tool.failed',\n 'tool.unresolved',\n])",
|
|
20285
|
+
"default": "new Set([\n 'turn.retry',\n 'turn.error',\n 'tool.failed',\n 'tool.unresolved',\n // A sub-agent held open by its finish guard or the completion nudge: otherwise invisible in the\n // parent's log, which shows only the hoisted messages.\n 'turn.finish-guard',\n])",
|
|
20262
20286
|
"description": "Sub-agent meta events worth folding into the parent's debug timeline: the\nper-attempt and per-failure signals that do NOT otherwise surface in the\nsub-agent's (now hoisted) messages — a retried-away malformed/empty attempt\nproduces no message, and the stale-vs-hallucinated/streak diagnostics live only\non the event. High-volume, message-derivable events (turn.start/turn.end,\nprovider.selected, context.updated) are intentionally excluded: read the\nsub-agent's hoisted messages for model/tokens/cost and turn-by-turn activity.\nSee `ChatDriver.invokeSubAgent`."
|
|
20263
20287
|
}
|
|
20264
20288
|
],
|
|
@@ -20343,6 +20367,22 @@
|
|
|
20343
20367
|
"module": "src/components/chat-driver/chat-driver.constants.ts"
|
|
20344
20368
|
}
|
|
20345
20369
|
},
|
|
20370
|
+
{
|
|
20371
|
+
"kind": "js",
|
|
20372
|
+
"name": "MAX_SUB_AGENT_COMPLETION_NUDGES",
|
|
20373
|
+
"declaration": {
|
|
20374
|
+
"name": "MAX_SUB_AGENT_COMPLETION_NUDGES",
|
|
20375
|
+
"module": "src/components/chat-driver/chat-driver.constants.ts"
|
|
20376
|
+
}
|
|
20377
|
+
},
|
|
20378
|
+
{
|
|
20379
|
+
"kind": "js",
|
|
20380
|
+
"name": "SUB_AGENT_COMPLETION_NUDGE",
|
|
20381
|
+
"declaration": {
|
|
20382
|
+
"name": "SUB_AGENT_COMPLETION_NUDGE",
|
|
20383
|
+
"module": "src/components/chat-driver/chat-driver.constants.ts"
|
|
20384
|
+
}
|
|
20385
|
+
},
|
|
20346
20386
|
{
|
|
20347
20387
|
"kind": "js",
|
|
20348
20388
|
"name": "HARVESTED_SUBAGENT_EVENTS",
|
|
@@ -20867,6 +20907,15 @@
|
|
|
20867
20907
|
"privacy": "private",
|
|
20868
20908
|
"description": "Active agent's unresolved-tool hook, captured from `installAgent`. Consulted\nonly when a tool call cannot be dispatched (a stale or hallucinated name);\n`undefined` keeps the framework's default messages. See\n`resolveUnresolvedToolContent`."
|
|
20869
20909
|
},
|
|
20910
|
+
{
|
|
20911
|
+
"kind": "field",
|
|
20912
|
+
"name": "activeFinishGuard",
|
|
20913
|
+
"type": {
|
|
20914
|
+
"text": "FinishGuardInput | undefined"
|
|
20915
|
+
},
|
|
20916
|
+
"privacy": "private",
|
|
20917
|
+
"description": "The active agent's `finishGuard` hook (U1), consulted by `consultFinishGuard`."
|
|
20918
|
+
},
|
|
20870
20919
|
{
|
|
20871
20920
|
"kind": "field",
|
|
20872
20921
|
"name": "resolvedProviderCache",
|
|
@@ -21593,6 +21642,36 @@
|
|
|
21593
21642
|
],
|
|
21594
21643
|
"description": "Resolve the tool-result content for an unresolved tool call. Consults the\nactive agent's `onUnresolvedTool` hook (if any) with the attempted tool\nname, the failure `kind`, and the currently dispatchable tools, and returns\nthe hook's non-empty string. Falls back to `fallback` when no hook is set,\nthe hook returns nothing/empty, or the hook throws — so a misbehaving hook\ncan never break tool dispatch."
|
|
21595
21644
|
},
|
|
21645
|
+
{
|
|
21646
|
+
"kind": "method",
|
|
21647
|
+
"name": "consultFinishGuard",
|
|
21648
|
+
"privacy": "private",
|
|
21649
|
+
"return": {
|
|
21650
|
+
"type": {
|
|
21651
|
+
"text": "Promise<FinishGuardVerdict | undefined>"
|
|
21652
|
+
}
|
|
21653
|
+
},
|
|
21654
|
+
"parameters": [
|
|
21655
|
+
{
|
|
21656
|
+
"name": "ctx",
|
|
21657
|
+
"type": {
|
|
21658
|
+
"text": "FinishGuardContext"
|
|
21659
|
+
}
|
|
21660
|
+
}
|
|
21661
|
+
],
|
|
21662
|
+
"description": "Consult the active agent's `finishGuard` hook (U1) after a reply with no tool call. Returns the\nverdict, normalised: `undefined` when there is no hook, it answered nothing, it threw, or it\nanswered `'continue'` with a blank note (nothing to tell the model, so nothing to hold for). A\nmisbehaving hook can never break the turn: it ends as if there were no hook."
|
|
21663
|
+
},
|
|
21664
|
+
{
|
|
21665
|
+
"kind": "method",
|
|
21666
|
+
"name": "requestReleaseFromFinishGuard",
|
|
21667
|
+
"privacy": "private",
|
|
21668
|
+
"return": {
|
|
21669
|
+
"type": {
|
|
21670
|
+
"text": "boolean"
|
|
21671
|
+
}
|
|
21672
|
+
},
|
|
21673
|
+
"description": "Act on a finish guard's `{ action: 'end', release: true }` (U5): the same release a tool handler's\n`releaseAgent()` asks for, for a turn that ended in prose and so had no handler context to call\nit from. Subject to the same guards: not after a hand-off, not twice, and not on a sub-agent,\nwhich owns no flow lock (it ends with `completeSubAgent`). Returns whether it released."
|
|
21674
|
+
},
|
|
21596
21675
|
{
|
|
21597
21676
|
"kind": "method",
|
|
21598
21677
|
"name": "getActiveProviderName",
|
|
@@ -24392,102 +24471,6 @@
|
|
|
24392
24471
|
}
|
|
24393
24472
|
]
|
|
24394
24473
|
},
|
|
24395
|
-
{
|
|
24396
|
-
"kind": "javascript-module",
|
|
24397
|
-
"path": "src/components/chat-markdown/chat-markdown.ts",
|
|
24398
|
-
"declarations": [
|
|
24399
|
-
{
|
|
24400
|
-
"kind": "variable",
|
|
24401
|
-
"name": "MARKDOWN_EXPORTPARTS",
|
|
24402
|
-
"type": {
|
|
24403
|
-
"text": "string"
|
|
24404
|
-
},
|
|
24405
|
-
"description": "Every part this component exposes, as an `exportparts` value.\n\n`::part()` crosses exactly one shadow boundary, so a host that renders `<ai-chat-markdown>` in\nits own shadow root has to forward these for an app to reach them at all. Built from the map\nabove rather than written out, so the forwarded list cannot drift from what is emitted."
|
|
24406
|
-
},
|
|
24407
|
-
{
|
|
24408
|
-
"kind": "class",
|
|
24409
|
-
"description": "",
|
|
24410
|
-
"name": "AiChatMarkdown",
|
|
24411
|
-
"members": [
|
|
24412
|
-
{
|
|
24413
|
-
"kind": "field",
|
|
24414
|
-
"name": "content",
|
|
24415
|
-
"type": {
|
|
24416
|
-
"text": "string"
|
|
24417
|
-
},
|
|
24418
|
-
"default": "''",
|
|
24419
|
-
"description": "The markdown string to render."
|
|
24420
|
-
},
|
|
24421
|
-
{
|
|
24422
|
-
"kind": "method",
|
|
24423
|
-
"name": "annotateParts",
|
|
24424
|
-
"privacy": "private",
|
|
24425
|
-
"return": {
|
|
24426
|
-
"type": {
|
|
24427
|
-
"text": "string"
|
|
24428
|
-
}
|
|
24429
|
-
},
|
|
24430
|
-
"parameters": [
|
|
24431
|
-
{
|
|
24432
|
-
"name": "fragment",
|
|
24433
|
-
"type": {
|
|
24434
|
-
"text": "DocumentFragment"
|
|
24435
|
-
}
|
|
24436
|
-
}
|
|
24437
|
-
],
|
|
24438
|
-
"description": "Tag the generated elements with shadow parts so an embedding app can style them.\n\nTakes the tree DOMPurify built rather than re-parsing its serialised output: `content` changes\non every streamed chunk, so a second parse/serialise round trip would run per chunk over the\nwhole message, and the string the browser finally parses is then serialised straight from the\ntree DOMPurify checked. Parse/serialise mismatches are where mXSS bypasses have historically\nlived, and this walk has no need to introduce one.\n\nOnly ever *adds* attributes, to DOM that has already been cleared - so it is not itself\nsanitiser surface.\n\nLists additionally carry a level: a top-level list is `md-ul md-ul-level-1`, a list nested\ninside it is `md-ul-level-2`, and an `li` takes the level of the list holding it. Levels are\nclamped at `MAX_LIST_LEVEL`, so a list deeper than that answers to the deepest level\nrather than to a name no host forwards. Chat markdown rarely nests, so this is a safety valve\nrather than a feature - without it, every list at every depth would answer to one selector and\nthere would be no way to tell them apart afterwards. Depth comes from walking the tree rather\nthan from marked's renderers, which are invoked innermost-first and so cannot count downwards."
|
|
24439
|
-
}
|
|
24440
|
-
],
|
|
24441
|
-
"superclass": {
|
|
24442
|
-
"name": "GenesisElement",
|
|
24443
|
-
"package": "@genesislcap/web-core"
|
|
24444
|
-
},
|
|
24445
|
-
"tagName": "ai-chat-markdown",
|
|
24446
|
-
"customElement": true
|
|
24447
|
-
}
|
|
24448
|
-
],
|
|
24449
|
-
"exports": [
|
|
24450
|
-
{
|
|
24451
|
-
"kind": "js",
|
|
24452
|
-
"name": "MARKDOWN_EXPORTPARTS",
|
|
24453
|
-
"declaration": {
|
|
24454
|
-
"name": "MARKDOWN_EXPORTPARTS",
|
|
24455
|
-
"module": "src/components/chat-markdown/chat-markdown.ts"
|
|
24456
|
-
}
|
|
24457
|
-
},
|
|
24458
|
-
{
|
|
24459
|
-
"kind": "js",
|
|
24460
|
-
"name": "AiChatMarkdown",
|
|
24461
|
-
"declaration": {
|
|
24462
|
-
"name": "AiChatMarkdown",
|
|
24463
|
-
"module": "src/components/chat-markdown/chat-markdown.ts"
|
|
24464
|
-
}
|
|
24465
|
-
},
|
|
24466
|
-
{
|
|
24467
|
-
"kind": "custom-element-definition",
|
|
24468
|
-
"name": "ai-chat-markdown",
|
|
24469
|
-
"declaration": {
|
|
24470
|
-
"name": "AiChatMarkdown",
|
|
24471
|
-
"module": "src/components/chat-markdown/chat-markdown.ts"
|
|
24472
|
-
}
|
|
24473
|
-
}
|
|
24474
|
-
]
|
|
24475
|
-
},
|
|
24476
|
-
{
|
|
24477
|
-
"kind": "javascript-module",
|
|
24478
|
-
"path": "src/components/chat-markdown/index.ts",
|
|
24479
|
-
"declarations": [],
|
|
24480
|
-
"exports": [
|
|
24481
|
-
{
|
|
24482
|
-
"kind": "js",
|
|
24483
|
-
"name": "*",
|
|
24484
|
-
"declaration": {
|
|
24485
|
-
"name": "*",
|
|
24486
|
-
"package": "./chat-markdown"
|
|
24487
|
-
}
|
|
24488
|
-
}
|
|
24489
|
-
]
|
|
24490
|
-
},
|
|
24491
24474
|
{
|
|
24492
24475
|
"kind": "javascript-module",
|
|
24493
24476
|
"path": "src/components/message-feedback/index.ts",
|
|
@@ -24886,6 +24869,102 @@
|
|
|
24886
24869
|
}
|
|
24887
24870
|
]
|
|
24888
24871
|
},
|
|
24872
|
+
{
|
|
24873
|
+
"kind": "javascript-module",
|
|
24874
|
+
"path": "src/components/chat-markdown/chat-markdown.ts",
|
|
24875
|
+
"declarations": [
|
|
24876
|
+
{
|
|
24877
|
+
"kind": "variable",
|
|
24878
|
+
"name": "MARKDOWN_EXPORTPARTS",
|
|
24879
|
+
"type": {
|
|
24880
|
+
"text": "string"
|
|
24881
|
+
},
|
|
24882
|
+
"description": "Every part this component exposes, as an `exportparts` value.\n\n`::part()` crosses exactly one shadow boundary, so a host that renders `<ai-chat-markdown>` in\nits own shadow root has to forward these for an app to reach them at all. Built from the map\nabove rather than written out, so the forwarded list cannot drift from what is emitted."
|
|
24883
|
+
},
|
|
24884
|
+
{
|
|
24885
|
+
"kind": "class",
|
|
24886
|
+
"description": "",
|
|
24887
|
+
"name": "AiChatMarkdown",
|
|
24888
|
+
"members": [
|
|
24889
|
+
{
|
|
24890
|
+
"kind": "field",
|
|
24891
|
+
"name": "content",
|
|
24892
|
+
"type": {
|
|
24893
|
+
"text": "string"
|
|
24894
|
+
},
|
|
24895
|
+
"default": "''",
|
|
24896
|
+
"description": "The markdown string to render."
|
|
24897
|
+
},
|
|
24898
|
+
{
|
|
24899
|
+
"kind": "method",
|
|
24900
|
+
"name": "annotateParts",
|
|
24901
|
+
"privacy": "private",
|
|
24902
|
+
"return": {
|
|
24903
|
+
"type": {
|
|
24904
|
+
"text": "string"
|
|
24905
|
+
}
|
|
24906
|
+
},
|
|
24907
|
+
"parameters": [
|
|
24908
|
+
{
|
|
24909
|
+
"name": "fragment",
|
|
24910
|
+
"type": {
|
|
24911
|
+
"text": "DocumentFragment"
|
|
24912
|
+
}
|
|
24913
|
+
}
|
|
24914
|
+
],
|
|
24915
|
+
"description": "Tag the generated elements with shadow parts so an embedding app can style them.\n\nTakes the tree DOMPurify built rather than re-parsing its serialised output: `content` changes\non every streamed chunk, so a second parse/serialise round trip would run per chunk over the\nwhole message, and the string the browser finally parses is then serialised straight from the\ntree DOMPurify checked. Parse/serialise mismatches are where mXSS bypasses have historically\nlived, and this walk has no need to introduce one.\n\nOnly ever *adds* attributes, to DOM that has already been cleared - so it is not itself\nsanitiser surface.\n\nLists additionally carry a level: a top-level list is `md-ul md-ul-level-1`, a list nested\ninside it is `md-ul-level-2`, and an `li` takes the level of the list holding it. Levels are\nclamped at `MAX_LIST_LEVEL`, so a list deeper than that answers to the deepest level\nrather than to a name no host forwards. Chat markdown rarely nests, so this is a safety valve\nrather than a feature - without it, every list at every depth would answer to one selector and\nthere would be no way to tell them apart afterwards. Depth comes from walking the tree rather\nthan from marked's renderers, which are invoked innermost-first and so cannot count downwards."
|
|
24916
|
+
}
|
|
24917
|
+
],
|
|
24918
|
+
"superclass": {
|
|
24919
|
+
"name": "GenesisElement",
|
|
24920
|
+
"package": "@genesislcap/web-core"
|
|
24921
|
+
},
|
|
24922
|
+
"tagName": "ai-chat-markdown",
|
|
24923
|
+
"customElement": true
|
|
24924
|
+
}
|
|
24925
|
+
],
|
|
24926
|
+
"exports": [
|
|
24927
|
+
{
|
|
24928
|
+
"kind": "js",
|
|
24929
|
+
"name": "MARKDOWN_EXPORTPARTS",
|
|
24930
|
+
"declaration": {
|
|
24931
|
+
"name": "MARKDOWN_EXPORTPARTS",
|
|
24932
|
+
"module": "src/components/chat-markdown/chat-markdown.ts"
|
|
24933
|
+
}
|
|
24934
|
+
},
|
|
24935
|
+
{
|
|
24936
|
+
"kind": "js",
|
|
24937
|
+
"name": "AiChatMarkdown",
|
|
24938
|
+
"declaration": {
|
|
24939
|
+
"name": "AiChatMarkdown",
|
|
24940
|
+
"module": "src/components/chat-markdown/chat-markdown.ts"
|
|
24941
|
+
}
|
|
24942
|
+
},
|
|
24943
|
+
{
|
|
24944
|
+
"kind": "custom-element-definition",
|
|
24945
|
+
"name": "ai-chat-markdown",
|
|
24946
|
+
"declaration": {
|
|
24947
|
+
"name": "AiChatMarkdown",
|
|
24948
|
+
"module": "src/components/chat-markdown/chat-markdown.ts"
|
|
24949
|
+
}
|
|
24950
|
+
}
|
|
24951
|
+
]
|
|
24952
|
+
},
|
|
24953
|
+
{
|
|
24954
|
+
"kind": "javascript-module",
|
|
24955
|
+
"path": "src/components/chat-markdown/index.ts",
|
|
24956
|
+
"declarations": [],
|
|
24957
|
+
"exports": [
|
|
24958
|
+
{
|
|
24959
|
+
"kind": "js",
|
|
24960
|
+
"name": "*",
|
|
24961
|
+
"declaration": {
|
|
24962
|
+
"name": "*",
|
|
24963
|
+
"package": "./chat-markdown"
|
|
24964
|
+
}
|
|
24965
|
+
}
|
|
24966
|
+
]
|
|
24967
|
+
},
|
|
24889
24968
|
{
|
|
24890
24969
|
"kind": "javascript-module",
|
|
24891
24970
|
"path": "src/components/notification-level/index.ts",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-message.d.ts","sourceRoot":"","sources":["../../../src/autopilot/decision-message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"decision-message.d.ts","sourceRoot":"","sources":["../../../src/autopilot/decision-message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAOtF,6FAA6F;AAC7F,eAAO,MAAM,cAAc,QAAS,CAAC;AAErC;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,MAAuB,GAAG,MAAM,CAG1E;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAa3F;AAED,uFAAuF;AACvF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,mLACiJ,CAAC;AAEnL;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,SAAS,SAAS,aAAa,EAAE,EACjC,mBAAmB,OAAO,KACzB,OAA6E,CAAC;AAEjF;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAO,GACrE,eAAe,CAmDjB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAUjE;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,kBAAkB,CAAC;IAC5B,8FAA8F;IAC9F,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iGAAiG;IACjG,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,yFAAyF;IACzF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,eAAe,CA0ClB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CAWhG;AAkDD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5F,MAAM,EAAE,CAmDV"}
|
|
@@ -30,6 +30,20 @@ export declare const MALFORMED_CALL_NUDGE = "IMPORTANT: Use only the structured
|
|
|
30
30
|
*/
|
|
31
31
|
export declare const EMPTY_RESPONSE_NUDGE = "IMPORTANT: Your previous attempt returned nothing at all, which is never a valid response. Answer the user's last message now, in prose \u2014 even if all you can honestly say is that you cannot help with it and why. If a tool is the right way to answer, call it. Do not return an empty response.";
|
|
32
32
|
export declare const MAX_SETUP_TRANSPORT_RETRIES = 3;
|
|
33
|
+
/**
|
|
34
|
+
* How many times one sub-agent turn is held open by the driver's own completion nudge: a sub-agent
|
|
35
|
+
* returns its result only through `completeSubAgent`, so a reply in prose (a provider that ignored
|
|
36
|
+
* the forced tool call, or an agent on `toolChoice: 'auto'`) is given this many chances to call its
|
|
37
|
+
* completion tool before the sub-agent fails. Counted per turn; the iteration cap bounds it too.
|
|
38
|
+
*/
|
|
39
|
+
export declare const MAX_SUB_AGENT_COMPLETION_NUDGES = 2;
|
|
40
|
+
/**
|
|
41
|
+
* The note the completion nudge stores (see {@link MAX_SUB_AGENT_COMPLETION_NUDGES}). Names no tool:
|
|
42
|
+
* the driver cannot tell which of a sub-agent's tools calls `completeSubAgent`.
|
|
43
|
+
*
|
|
44
|
+
* @beta
|
|
45
|
+
*/
|
|
46
|
+
export declare const SUB_AGENT_COMPLETION_NUDGE = "You ended your turn in prose, but nothing you write in prose reaches your caller: your result is returned only through the tool that completes your task. Call it now with your result. If you cannot complete the task, call it anyway and say why.";
|
|
33
47
|
/**
|
|
34
48
|
* Sub-agent meta events worth folding into the parent's debug timeline: the
|
|
35
49
|
* per-attempt and per-failure signals that do NOT otherwise surface in the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-driver.constants.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-driver/chat-driver.constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,2FAA2F;AAE3F,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAS7C,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAKhD,eAAO,MAAM,oBAAoB,QAAqC,CAAC;AAIvE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,6IAC2G,CAAC;AAE7I;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,6SACsQ,CAAC;AAGxS,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"chat-driver.constants.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-driver/chat-driver.constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,2FAA2F;AAE3F,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAS7C,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAKhD,eAAO,MAAM,oBAAoB,QAAqC,CAAC;AAIvE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,6IAC2G,CAAC;AAE7I;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,6SACsQ,CAAC;AAGxS,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,yPACiN,CAAC;AAEzP;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,aAAa,CAQ/D,CAAC"}
|
|
@@ -469,6 +469,8 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
469
469
|
* `resolveUnresolvedToolContent`.
|
|
470
470
|
*/
|
|
471
471
|
private activeOnUnresolvedTool?;
|
|
472
|
+
/** The active agent's `finishGuard` hook (U1), consulted by `consultFinishGuard`. */
|
|
473
|
+
private activeFinishGuard?;
|
|
472
474
|
/**
|
|
473
475
|
* Caches validated provider lookups per name within the current agent. Cleared
|
|
474
476
|
* by `installAgent` so each new agent's static/function-resolved names are
|
|
@@ -876,6 +878,20 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
876
878
|
* can never break tool dispatch.
|
|
877
879
|
*/
|
|
878
880
|
private resolveUnresolvedToolContent;
|
|
881
|
+
/**
|
|
882
|
+
* Consult the active agent's `finishGuard` hook (U1) after a reply with no tool call. Returns the
|
|
883
|
+
* verdict, normalised: `undefined` when there is no hook, it answered nothing, it threw, or it
|
|
884
|
+
* answered `'continue'` with a blank note (nothing to tell the model, so nothing to hold for). A
|
|
885
|
+
* misbehaving hook can never break the turn: it ends as if there were no hook.
|
|
886
|
+
*/
|
|
887
|
+
private consultFinishGuard;
|
|
888
|
+
/**
|
|
889
|
+
* Act on a finish guard's `{ action: 'end', release: true }` (U5): the same release a tool handler's
|
|
890
|
+
* `releaseAgent()` asks for, for a turn that ended in prose and so had no handler context to call
|
|
891
|
+
* it from. Subject to the same guards: not after a hand-off, not twice, and not on a sub-agent,
|
|
892
|
+
* which owns no flow lock (it ends with `completeSubAgent`). Returns whether it released.
|
|
893
|
+
*/
|
|
894
|
+
private requestReleaseFromFinishGuard;
|
|
879
895
|
/**
|
|
880
896
|
* Returns the most recently resolved provider name. Falls back to the
|
|
881
897
|
* registry's default when no per-turn resolution has happened yet.
|