@genesislcap/ai-assistant 14.451.3 → 14.451.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-assistant.d.ts +27 -1
- package/dist/dts/components/chat-driver/align-event-globals.d.ts +19 -0
- package/dist/dts/components/chat-driver/align-event-globals.d.ts.map +1 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts +26 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.test.d.ts +2 -0
- package/dist/dts/components/chat-driver/chat-driver.test.d.ts.map +1 -0
- package/dist/dts/main/main.template.d.ts.map +1 -1
- package/dist/dts/state/debug-event-log.d.ts +3 -2
- package/dist/dts/state/debug-event-log.d.ts.map +1 -1
- package/dist/esm/components/chat-driver/align-event-globals.js +23 -0
- package/dist/esm/components/chat-driver/chat-driver.js +119 -5
- package/dist/esm/components/chat-driver/chat-driver.test.js +196 -0
- package/dist/esm/main/main.template.js +5 -1
- package/dist/esm/state/debug-event-log.js +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/src/components/chat-driver/align-event-globals.ts +23 -0
- package/src/components/chat-driver/chat-driver.test.ts +315 -0
- package/src/components/chat-driver/chat-driver.ts +125 -5
- package/src/main/main.template.ts +5 -1
- package/src/state/debug-event-log.ts +6 -3
|
@@ -28,7 +28,11 @@ import { ANIMATION_DEFS } from './main.types';
|
|
|
28
28
|
|
|
29
29
|
function unknownToolPayload(tc: ChatToolCall): string {
|
|
30
30
|
if (!isChatToolCallUnknown(tc)) return '';
|
|
31
|
-
|
|
31
|
+
// A stale tool was real earlier in this agent's lifetime but isn't available
|
|
32
|
+
// in the current state — distinct from a hallucinated name that never existed.
|
|
33
|
+
const lines = [
|
|
34
|
+
tc.stale ? `${tc.name} — no longer available at this step` : `${tc.name} — tool does not exist`,
|
|
35
|
+
];
|
|
32
36
|
if (tc.availableTools.length > 0) {
|
|
33
37
|
lines.push('Available tools:');
|
|
34
38
|
tc.availableTools.forEach((t) => lines.push(` • ${t}`));
|
|
@@ -45,6 +45,7 @@ export type MetaEventType =
|
|
|
45
45
|
| 'turn.retry'
|
|
46
46
|
| 'turn.error'
|
|
47
47
|
| 'tool.failed'
|
|
48
|
+
| 'tool.unresolved'
|
|
48
49
|
// Routing / providers
|
|
49
50
|
| 'agent.handoff'
|
|
50
51
|
| 'agent.pinned'
|
|
@@ -95,6 +96,7 @@ export const META_EVENT_IMPORTANCE: Record<MetaEventType, MetaEventImportance> =
|
|
|
95
96
|
'turn.start': 'normal',
|
|
96
97
|
'turn.end': 'normal',
|
|
97
98
|
'turn.retry': 'normal',
|
|
99
|
+
'tool.unresolved': 'normal',
|
|
98
100
|
'agent.handoff': 'normal',
|
|
99
101
|
'agent.pinned': 'normal',
|
|
100
102
|
'agent.unpinned': 'normal',
|
|
@@ -130,7 +132,7 @@ export interface MetaEvent {
|
|
|
130
132
|
* allowed to float above this cap rather than lose a failure signal; in normal
|
|
131
133
|
* use the frequent `low`/`normal` events keep it near the cap. Entries are cheap.
|
|
132
134
|
*/
|
|
133
|
-
const DEFAULT_MAX_META_EVENTS =
|
|
135
|
+
const DEFAULT_MAX_META_EVENTS = 800;
|
|
134
136
|
|
|
135
137
|
interface MetaEventBuffer {
|
|
136
138
|
events: MetaEvent[];
|
|
@@ -186,7 +188,8 @@ export function recordMetaEvent(
|
|
|
186
188
|
* - `exception` — an uncaught error escaped the tool loop (catch-all).
|
|
187
189
|
* - `malformed-function-call`— the provider returned an unparseable tool call.
|
|
188
190
|
* - `empty-response` — the model returned no content and no tool calls.
|
|
189
|
-
* - `unknown-tool-limit` — the model repeatedly called tools
|
|
191
|
+
* - `unknown-tool-limit` — the model repeatedly called tools it couldn't dispatch,
|
|
192
|
+
* whether hallucinated or stale (real earlier, retired now).
|
|
190
193
|
* - `max-iterations` — the tool loop hit its iteration cap.
|
|
191
194
|
*/
|
|
192
195
|
export type TurnFailureReason =
|
|
@@ -242,7 +245,7 @@ export const DEBUG_LOG_README: readonly string[] = [
|
|
|
242
245
|
"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.",
|
|
243
246
|
"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'.",
|
|
244
247
|
"Each 'event' also has an `importance`: 'high' (failures/limits — turn.error, tool.failed, file.read-failed, suggestions.failed, context.threshold-crossed), 'normal' (session flow — connects, turns, retries, handoffs, agent/provider changes, interactions), or 'low' (skippable UI/bookkeeping noise — panel.toggled, attachment.added, driver.wired/unwired, context.updated). 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.",
|
|
245
|
-
'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), 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, plus reason-specific diagnostics: attempts, finishMessage, unknownTools + availableTools, iterations + limit, or name + message for exceptions), tool.failed (a tool threw), agent.handoff (routing; from=null is the initial activation), agent.pinned/unpinned (forced routing), provider.selected (model/provider for the upcoming turns), interaction.requested/resolved (blocking user widgets — explain quiet gaps), context.updated/threshold-crossed (token + cost), panel.toggled, attachment.added, file.read-failed, suggestions.failed.',
|
|
248
|
+
'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), 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, plus reason-specific diagnostics: attempts, finishMessage, 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, 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), agent.handoff (routing; from=null is the initial activation), agent.pinned/unpinned (forced routing), provider.selected (model/provider for the upcoming turns), interaction.requested/resolved (blocking user widgets — explain quiet gaps), context.updated/threshold-crossed (token + cost), panel.toggled, attachment.added, file.read-failed, suggestions.failed.',
|
|
246
249
|
"`meta` holds context captured at export time: agentSummary (full agent configs), context (active model, token usage, session cost), 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.",
|
|
247
250
|
'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.',
|
|
248
251
|
];
|