@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
|
@@ -7,13 +7,14 @@ import { generateSuggestions } from '../../suggestions/generate-suggestions';
|
|
|
7
7
|
import { applyCondensation, condenseForPersistence, isValidCondenseTrigger, parsePersistedCondensePolicy, rebaseRestoredCondensePolicy, snapshotCondensePolicies, toolCallIdsIn, } from '../../utils/condense-history';
|
|
8
8
|
import { estimatePreambleTokens, estimateRequestTokens, } from '../../utils/context-tokens';
|
|
9
9
|
import { DEFAULT_DELEGATE_FRAMING, delegatedFields, frameDelegatedContent, } from '../../utils/delegated-message';
|
|
10
|
+
import { finishGuardNoteMessage } from '../../utils/driver-note';
|
|
10
11
|
import { applyHistoryCap, buildCompactionSummaryPrompt, planCompaction, normalizeForProvider, } from '../../utils/history-transform';
|
|
11
12
|
import { logger } from '../../utils/logger';
|
|
12
13
|
import { freshUserMessages } from '../../utils/preserved-user-messages';
|
|
13
14
|
import { resolveTurnInput } from '../../utils/resolve-turn-input';
|
|
14
15
|
import { messageUsage, sumUsage } from '../../utils/sum-usage';
|
|
15
16
|
import { AgentSession } from '../agent-session/agent-session';
|
|
16
|
-
import { DEFAULT_MAX_FOLD_OPERATIONS, DEFAULT_MAX_TOOL_ITERATIONS, DEFAULT_MAX_TURN_SNAPSHOTS, DEFAULT_MAX_UNKNOWN_TOOL_CALLS, EMPTY_RESPONSE_NUDGE, HARVESTED_SUBAGENT_EVENTS, MALFORMED_CALL_NUDGE, MAX_EMPTY_RESPONSE_RETRIES, MAX_MALFORMED_RETRIES, MAX_SETUP_TRANSPORT_RETRIES, MAX_STALE_TOOL_CALLS, } from './chat-driver.constants';
|
|
17
|
+
import { DEFAULT_MAX_FOLD_OPERATIONS, DEFAULT_MAX_TOOL_ITERATIONS, DEFAULT_MAX_TURN_SNAPSHOTS, DEFAULT_MAX_UNKNOWN_TOOL_CALLS, EMPTY_RESPONSE_NUDGE, HARVESTED_SUBAGENT_EVENTS, MALFORMED_CALL_NUDGE, MAX_EMPTY_RESPONSE_RETRIES, MAX_MALFORMED_RETRIES, MAX_SETUP_TRANSPORT_RETRIES, MAX_STALE_TOOL_CALLS, MAX_SUB_AGENT_COMPLETION_NUDGES, SUB_AGENT_COMPLETION_NUDGE, } from './chat-driver.constants';
|
|
17
18
|
import { FoldController } from './fold-controller';
|
|
18
19
|
import { IdleClock, isIdleLimit } from './idle-clock';
|
|
19
20
|
import { InteractionController, } from './interaction-controller';
|
|
@@ -1131,6 +1132,7 @@ export class ChatDriver extends EventTarget {
|
|
|
1131
1132
|
this.activeResponseSchemaInput = config.responseSchema;
|
|
1132
1133
|
this.activeFallbacks = config.fallbacks;
|
|
1133
1134
|
this.activeOnUnresolvedTool = config.onUnresolvedTool;
|
|
1135
|
+
this.activeFinishGuard = config.finishGuard;
|
|
1134
1136
|
this.resolvedProviderCache.clear();
|
|
1135
1137
|
this.lastResolvedProviderName = undefined;
|
|
1136
1138
|
// Static validation: resolve the name now so unknown-provider and missing-
|
|
@@ -1175,6 +1177,58 @@ export class ChatDriver extends EventTarget {
|
|
|
1175
1177
|
}
|
|
1176
1178
|
});
|
|
1177
1179
|
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Consult the active agent's `finishGuard` hook (U1) after a reply with no tool call. Returns the
|
|
1182
|
+
* verdict, normalised: `undefined` when there is no hook, it answered nothing, it threw, or it
|
|
1183
|
+
* answered `'continue'` with a blank note (nothing to tell the model, so nothing to hold for). A
|
|
1184
|
+
* misbehaving hook can never break the turn: it ends as if there were no hook.
|
|
1185
|
+
*/
|
|
1186
|
+
consultFinishGuard(ctx) {
|
|
1187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1188
|
+
var _a, _b;
|
|
1189
|
+
if (typeof this.activeFinishGuard !== 'function')
|
|
1190
|
+
return undefined;
|
|
1191
|
+
try {
|
|
1192
|
+
const verdict = yield this.activeFinishGuard(ctx);
|
|
1193
|
+
if ((verdict === null || verdict === void 0 ? void 0 : verdict.action) === 'continue') {
|
|
1194
|
+
if (typeof verdict.note === 'string' && verdict.note.trim().length > 0)
|
|
1195
|
+
return verdict;
|
|
1196
|
+
logger.warn(`ChatDriver(${(_a = this.activeAgentName) !== null && _a !== void 0 ? _a : 'unknown'}): finishGuard answered 'continue' with no note — ending the turn`);
|
|
1197
|
+
return undefined;
|
|
1198
|
+
}
|
|
1199
|
+
return (verdict === null || verdict === void 0 ? void 0 : verdict.action) === 'end' ? verdict : undefined;
|
|
1200
|
+
}
|
|
1201
|
+
catch (e) {
|
|
1202
|
+
logger.warn(`ChatDriver(${(_b = this.activeAgentName) !== null && _b !== void 0 ? _b : 'unknown'}): finishGuard threw — ending the turn`, e);
|
|
1203
|
+
return undefined;
|
|
1204
|
+
}
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Act on a finish guard's `{ action: 'end', release: true }` (U5): the same release a tool handler's
|
|
1209
|
+
* `releaseAgent()` asks for, for a turn that ended in prose and so had no handler context to call
|
|
1210
|
+
* it from. Subject to the same guards: not after a hand-off, not twice, and not on a sub-agent,
|
|
1211
|
+
* which owns no flow lock (it ends with `completeSubAgent`). Returns whether it released.
|
|
1212
|
+
*/
|
|
1213
|
+
requestReleaseFromFinishGuard() {
|
|
1214
|
+
var _a;
|
|
1215
|
+
const who = (_a = this.activeAgentName) !== null && _a !== void 0 ? _a : 'unknown';
|
|
1216
|
+
if (this.isSubAgent) {
|
|
1217
|
+
logger.warn(`ChatDriver(${who}): finishGuard asked to release a sub-agent — ignoring`);
|
|
1218
|
+
return false;
|
|
1219
|
+
}
|
|
1220
|
+
if (this.handOffRequested || this.agentReleaseRequested)
|
|
1221
|
+
return false;
|
|
1222
|
+
this.agentReleaseRequested = true;
|
|
1223
|
+
// The flow has wrapped up — advance the clock exactly as `releaseAgent` does.
|
|
1224
|
+
this.currentActivation += 1;
|
|
1225
|
+
recordMetaEvent(this.sessionKey, 'turn.finish-guard', {
|
|
1226
|
+
action: 'end',
|
|
1227
|
+
agent: who,
|
|
1228
|
+
release: true,
|
|
1229
|
+
});
|
|
1230
|
+
return true;
|
|
1231
|
+
}
|
|
1178
1232
|
/**
|
|
1179
1233
|
* Returns the most recently resolved provider name. Falls back to the
|
|
1180
1234
|
* registry's default when no per-turn resolution has happened yet.
|
|
@@ -2623,7 +2677,7 @@ export class ChatDriver extends EventTarget {
|
|
|
2623
2677
|
// oxlint-disable-next-line complexity, max-lines-per-function
|
|
2624
2678
|
runToolLoop(userInput, attachments, transientPrimer, tailNote) {
|
|
2625
2679
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2626
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
2680
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
2627
2681
|
if (!this.systemPrompt) {
|
|
2628
2682
|
logger.warn('ChatDriver: no systemPrompt set. The assistant will have no instructions — provide a systemPrompt via agents config or the foundation-ai-assistant property.');
|
|
2629
2683
|
}
|
|
@@ -2657,6 +2711,14 @@ export class ChatDriver extends EventTarget {
|
|
|
2657
2711
|
// A closing call (see `closingCallNote`) is one model call, made even past the iteration cap;
|
|
2658
2712
|
// whatever path brings the loop back after it, a retry included, the turn ends there.
|
|
2659
2713
|
let closingCallMade = false;
|
|
2714
|
+
// How many times the agent's `finishGuard` held this turn open (U1). Handed to the hook, so the
|
|
2715
|
+
// host can cap it; the iteration cap bounds it regardless. The driver's own completion nudges to
|
|
2716
|
+
// a sub-agent are counted apart, so they never eat into the hook's cap.
|
|
2717
|
+
let finishGuardContinuations = 0;
|
|
2718
|
+
let completionNudges = 0;
|
|
2719
|
+
// Set when the finish guard released the agent, so the loop ending on its last iteration is not
|
|
2720
|
+
// reported as the iteration cap: the guard said the flow finished cleanly.
|
|
2721
|
+
let releasedByFinishGuard = false;
|
|
2660
2722
|
while (iterations < this.maxToolIterations || (this.closingCallNote() && !closingCallMade)) {
|
|
2661
2723
|
iterations += 1;
|
|
2662
2724
|
// Monotonic across the driver's life — the age clock. Unlike `iterations`,
|
|
@@ -3258,6 +3320,61 @@ export class ChatDriver extends EventTarget {
|
|
|
3258
3320
|
if (closing)
|
|
3259
3321
|
return turnDone();
|
|
3260
3322
|
if (!((_o = response.toolCalls) === null || _o === void 0 ? void 0 : _o.length)) {
|
|
3323
|
+
// The model ended in prose. The agent's finish guard may hold the turn open (a note stored
|
|
3324
|
+
// in history, then the next call) or end it and release the agent. Consulted on the loop's
|
|
3325
|
+
// last iteration too, since a release needs no further call; only a hold is refused there.
|
|
3326
|
+
const canContinue = iterations < this.maxToolIterations;
|
|
3327
|
+
// Not consulted once a handler released the agent or handed off earlier in this turn: its
|
|
3328
|
+
// flow has ended, so there is nothing left to hold the turn open for (or release again).
|
|
3329
|
+
const guarded = typeof this.activeFinishGuard === 'function' &&
|
|
3330
|
+
!this.agentReleaseRequested &&
|
|
3331
|
+
!this.handOffRequested;
|
|
3332
|
+
const verdict = guarded
|
|
3333
|
+
? // oxlint-disable-next-line no-await-in-loop
|
|
3334
|
+
yield this.consultFinishGuard(Object.assign(Object.assign({}, promptCtx), { history: this.history, reply: (_p = response.content) !== null && _p !== void 0 ? _p : '', continuations: finishGuardContinuations, canContinue }))
|
|
3335
|
+
: undefined;
|
|
3336
|
+
// A Stop pressed while the guard was pending wins over its verdict, whatever it was (a guard
|
|
3337
|
+
// that threw on the aborted signal included), so the turn ends with the usual stop marker.
|
|
3338
|
+
// Only when a guard was awaited: without one, a full answer that arrived despite an abort
|
|
3339
|
+
// stands, as it always has.
|
|
3340
|
+
if (guarded && this.turnController.signal.aborted) {
|
|
3341
|
+
return this.completeAbortedTurn();
|
|
3342
|
+
}
|
|
3343
|
+
if ((verdict === null || verdict === void 0 ? void 0 : verdict.action) === 'continue' && canContinue) {
|
|
3344
|
+
finishGuardContinuations += 1;
|
|
3345
|
+
recordMetaEvent(this.sessionKey, 'turn.finish-guard', {
|
|
3346
|
+
action: 'continue',
|
|
3347
|
+
agent: this.activeAgentName,
|
|
3348
|
+
continuation: finishGuardContinuations,
|
|
3349
|
+
note: verdict.note,
|
|
3350
|
+
});
|
|
3351
|
+
this.appendToHistory(finishGuardNoteMessage(verdict.note));
|
|
3352
|
+
continue;
|
|
3353
|
+
}
|
|
3354
|
+
if ((verdict === null || verdict === void 0 ? void 0 : verdict.action) === 'continue') {
|
|
3355
|
+
logger.warn(`ChatDriver(${(_q = this.activeAgentName) !== null && _q !== void 0 ? _q : 'unknown'}): finishGuard answered 'continue' on the last tool-loop iteration — ending the turn`);
|
|
3356
|
+
}
|
|
3357
|
+
// A sub-agent returns its result only through `completeSubAgent`, so its prose is never an
|
|
3358
|
+
// answer. With no verdict from its own guard (`'end'` is the guard giving up), the driver
|
|
3359
|
+
// holds the turn open and asks for the completion call, a bounded number of times.
|
|
3360
|
+
if (this.isSubAgent &&
|
|
3361
|
+
verdict === undefined &&
|
|
3362
|
+
canContinue &&
|
|
3363
|
+
completionNudges < MAX_SUB_AGENT_COMPLETION_NUDGES) {
|
|
3364
|
+
completionNudges += 1;
|
|
3365
|
+
recordMetaEvent(this.sessionKey, 'turn.finish-guard', {
|
|
3366
|
+
action: 'continue',
|
|
3367
|
+
source: 'completion-nudge',
|
|
3368
|
+
agent: this.activeAgentName,
|
|
3369
|
+
nudge: completionNudges,
|
|
3370
|
+
maxNudges: MAX_SUB_AGENT_COMPLETION_NUDGES,
|
|
3371
|
+
});
|
|
3372
|
+
this.appendToHistory(finishGuardNoteMessage(SUB_AGENT_COMPLETION_NUDGE, 'completion-nudge'));
|
|
3373
|
+
continue;
|
|
3374
|
+
}
|
|
3375
|
+
if ((verdict === null || verdict === void 0 ? void 0 : verdict.action) === 'end' && verdict.release) {
|
|
3376
|
+
releasedByFinishGuard = this.requestReleaseFromFinishGuard();
|
|
3377
|
+
}
|
|
3261
3378
|
break;
|
|
3262
3379
|
}
|
|
3263
3380
|
const toolCalls = response.toolCalls;
|
|
@@ -3474,7 +3591,7 @@ export class ChatDriver extends EventTarget {
|
|
|
3474
3591
|
// The response was appended before execution — find it and annotate.
|
|
3475
3592
|
let tcMsgIdx = -1;
|
|
3476
3593
|
for (let i = this.history.length - 1; i >= 0; i -= 1) {
|
|
3477
|
-
if (this.history[i].role === 'assistant' && ((
|
|
3594
|
+
if (this.history[i].role === 'assistant' && ((_r = this.history[i].toolCalls) === null || _r === void 0 ? void 0 : _r.length)) {
|
|
3478
3595
|
tcMsgIdx = i;
|
|
3479
3596
|
break;
|
|
3480
3597
|
}
|
|
@@ -3512,7 +3629,7 @@ export class ChatDriver extends EventTarget {
|
|
|
3512
3629
|
const unknownTools = [
|
|
3513
3630
|
...new Set([
|
|
3514
3631
|
...this.recentUnknownToolNames,
|
|
3515
|
-
...((
|
|
3632
|
+
...((_s = response.toolCalls) !== null && _s !== void 0 ? _s : [])
|
|
3516
3633
|
.filter((tc) => unknownToolIds.has(tc.id))
|
|
3517
3634
|
.map((tc) => tc.name),
|
|
3518
3635
|
]),
|
|
@@ -3524,7 +3641,7 @@ export class ChatDriver extends EventTarget {
|
|
|
3524
3641
|
const staleTools = [
|
|
3525
3642
|
...new Set([
|
|
3526
3643
|
...this.recentStaleToolNames,
|
|
3527
|
-
...((
|
|
3644
|
+
...((_t = response.toolCalls) !== null && _t !== void 0 ? _t : [])
|
|
3528
3645
|
.filter((tc) => staleToolIds.has(tc.id))
|
|
3529
3646
|
.map((tc) => tc.name),
|
|
3530
3647
|
]),
|
|
@@ -3564,7 +3681,7 @@ export class ChatDriver extends EventTarget {
|
|
|
3564
3681
|
}
|
|
3565
3682
|
// The loop fell through: either it hit the iteration cap (a failure) or it
|
|
3566
3683
|
// broke on a clean final answer (success). Only the former carries a reason.
|
|
3567
|
-
if (iterations >= this.maxToolIterations) {
|
|
3684
|
+
if (iterations >= this.maxToolIterations && !releasedByFinishGuard) {
|
|
3568
3685
|
logger.warn('ChatDriver: reached max tool iterations, stopping');
|
|
3569
3686
|
recordTurnError(this.sessionKey, 'max-iterations', {
|
|
3570
3687
|
agent: this.activeAgentName,
|
|
@@ -4,6 +4,7 @@ import { validateStaticAgentProviders } from '../../config/validate-providers';
|
|
|
4
4
|
import { recordMetaEvent } from '../../state/debug-event-log';
|
|
5
5
|
import { reachesProvider } from '../../utils/context-tokens';
|
|
6
6
|
import { delegatedFields, frameDelegatedContent, } from '../../utils/delegated-message';
|
|
7
|
+
import { isDriverNote } from '../../utils/driver-note';
|
|
7
8
|
import { transformHistoryForAgent } from '../../utils/history-transform';
|
|
8
9
|
import { logger } from '../../utils/logger';
|
|
9
10
|
import { messageUsage } from '../../utils/sum-usage';
|
|
@@ -935,6 +936,9 @@ export class OrchestratingDriver extends BaseDriverDecorator {
|
|
|
935
936
|
// It also drops the `reasoning` / `narration` splits, which are `role: 'assistant'` too and
|
|
936
937
|
// would otherwise show up as duplicate `Assistant:` lines. Reviewer catch on #2496.
|
|
937
938
|
.filter((m) => (m.role === 'user' || m.role === 'assistant') && reachesProvider(m))
|
|
939
|
+
// A driver note (a finish guard's reason to go on) is not the user speaking; it would read to
|
|
940
|
+
// the router as the user's latest request.
|
|
941
|
+
.filter((m) => !isDriverNote(m))
|
|
938
942
|
// Blank rows need their own test: `reachesProvider` keys on role, category and the exclusion
|
|
939
943
|
// flag, never on content, so a tool-call carrier or an interaction placeholder still passes
|
|
940
944
|
// it and renders as a bare `Assistant: ` — a line that spends prompt on nothing and tells a
|
|
@@ -88,6 +88,21 @@ export function restoreMachine(machine, restored, key = 'machine') {
|
|
|
88
88
|
machine.stop();
|
|
89
89
|
machine.start({ state: snapshot });
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Bind a stateful agent's hook to its live state, for the hooks whose pre-init call must degrade
|
|
93
|
+
* to the framework default (`undefined`) instead of throwing: `onUnresolvedTool` fires on the
|
|
94
|
+
* tool-dispatch path and `finishGuard` as a turn is ending, and neither may break the turn.
|
|
95
|
+
*/
|
|
96
|
+
function bindStateOrDefault(hook, getState) {
|
|
97
|
+
if (typeof hook !== 'function')
|
|
98
|
+
return undefined;
|
|
99
|
+
return (ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const state = getState();
|
|
101
|
+
if (!state)
|
|
102
|
+
return undefined;
|
|
103
|
+
return hook(Object.assign(Object.assign({}, ctx), { state }));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
91
106
|
/**
|
|
92
107
|
* Build an `AgentConfig` whose `systemPrompt`, `toolDefinitions`, and tool
|
|
93
108
|
* handlers all close over a long-lived state object created on activation.
|
|
@@ -218,18 +233,10 @@ export function defineStatefulAgent(opts) {
|
|
|
218
233
|
return opts.tailContext(Object.assign(Object.assign({}, ctx), { state }));
|
|
219
234
|
})
|
|
220
235
|
: opts.tailContext;
|
|
221
|
-
// `onUnresolvedTool`
|
|
222
|
-
//
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const wrappedOnUnresolvedTool = typeof opts.onUnresolvedTool === 'function'
|
|
226
|
-
? (ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
227
|
-
if (!state) {
|
|
228
|
-
return undefined;
|
|
229
|
-
}
|
|
230
|
-
return opts.onUnresolvedTool(Object.assign(Object.assign({}, ctx), { state }));
|
|
231
|
-
})
|
|
232
|
-
: opts.onUnresolvedTool;
|
|
236
|
+
// `onUnresolvedTool` (tool dispatch) and `finishGuard` (a turn ending) degrade before init
|
|
237
|
+
// rather than throwing: a pre-init call keeps the framework default instead of breaking the turn.
|
|
238
|
+
const wrappedOnUnresolvedTool = bindStateOrDefault(opts.onUnresolvedTool, () => state);
|
|
239
|
+
const wrappedFinishGuard = bindStateOrDefault(opts.finishGuard, () => state);
|
|
233
240
|
// `resumable` threads the LIVE state bag in (like the resolvers above) rather
|
|
234
241
|
// than the serialized image the raw `AgentConfig` form receives — so a machine
|
|
235
242
|
// agent gates on `state.machine.state` directly. Consulted only while active
|
|
@@ -247,7 +254,7 @@ export function defineStatefulAgent(opts) {
|
|
|
247
254
|
});
|
|
248
255
|
})
|
|
249
256
|
: undefined;
|
|
250
|
-
const base = Object.assign(Object.assign({ name: opts.name, displayName: wrappedDisplayName, primerHistory: opts.primerHistory, subAgents: opts.subAgents, manualSelection: opts.manualSelection, chatInputDuringExecution: opts.chatInputDuringExecution, toolDefinitions: wrappedTools, toolHandlers: wrappedHandlers, provider: wrappedProvider, temperature: wrappedTemperature, toolChoice: wrappedToolChoice, cachePolicy: wrappedCachePolicy, thinkingPolicy: wrappedThinkingPolicy, tailContext: wrappedTailContext, onUnresolvedTool: wrappedOnUnresolvedTool, resumable: wrappedResumable, notResumableMessage: opts.notResumableMessage, resumeOnRestore: opts.resumeOnRestore, contextReserve: opts.contextReserve }, (opts.autopilot && {
|
|
257
|
+
const base = Object.assign(Object.assign({ name: opts.name, displayName: wrappedDisplayName, primerHistory: opts.primerHistory, subAgents: opts.subAgents, manualSelection: opts.manualSelection, chatInputDuringExecution: opts.chatInputDuringExecution, toolDefinitions: wrappedTools, toolHandlers: wrappedHandlers, provider: wrappedProvider, temperature: wrappedTemperature, toolChoice: wrappedToolChoice, cachePolicy: wrappedCachePolicy, thinkingPolicy: wrappedThinkingPolicy, tailContext: wrappedTailContext, onUnresolvedTool: wrappedOnUnresolvedTool, finishGuard: wrappedFinishGuard, resumable: wrappedResumable, notResumableMessage: opts.notResumableMessage, resumeOnRestore: opts.resumeOnRestore, contextReserve: opts.contextReserve }, (opts.autopilot && {
|
|
251
258
|
autopilot: {
|
|
252
259
|
config: opts.autopilot,
|
|
253
260
|
state: () => state,
|
|
@@ -54,6 +54,7 @@ export const META_EVENT_IMPORTANCE = {
|
|
|
54
54
|
'turn.start': 'normal',
|
|
55
55
|
'turn.end': 'normal',
|
|
56
56
|
'turn.retry': 'normal',
|
|
57
|
+
'turn.finish-guard': 'normal',
|
|
57
58
|
'tool.unresolved': 'normal',
|
|
58
59
|
'subagent.started': 'normal',
|
|
59
60
|
'subagent.completed': 'normal',
|
|
@@ -261,7 +262,7 @@ export const DEBUG_LOG_README = [
|
|
|
261
262
|
'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.',
|
|
262
263
|
"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.",
|
|
263
264
|
'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.',
|
|
264
|
-
"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.",
|
|
265
|
+
"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.",
|
|
265
266
|
"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.",
|
|
266
267
|
"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.",
|
|
267
268
|
"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.",
|
|
@@ -269,8 +270,8 @@ export const DEBUG_LOG_README = [
|
|
|
269
270
|
"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.",
|
|
270
271
|
"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'.",
|
|
271
272
|
"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.",
|
|
272
|
-
"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.",
|
|
273
|
-
'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.',
|
|
273
|
+
"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.",
|
|
274
|
+
'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.',
|
|
274
275
|
"`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.",
|
|
275
276
|
'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.',
|
|
276
277
|
"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.",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDriverNote, isUserUtterance } from '../../utils/driver-note';
|
|
1
2
|
/**
|
|
2
3
|
* Schema version of the persisted session shape. Bump on an incompatible
|
|
3
4
|
* change; a snapshot whose `version` doesn't match is discarded on load rather
|
|
@@ -48,9 +49,10 @@ export function resolveNonResumableNotice(input) {
|
|
|
48
49
|
* @internal
|
|
49
50
|
*/
|
|
50
51
|
export function lastUserMessageIndex(messages) {
|
|
51
|
-
var _a;
|
|
52
52
|
for (let i = messages.length - 1; i >= 0; i -= 1) {
|
|
53
|
-
|
|
53
|
+
// A driver note (`driverNote`) is `role: 'user'` on the wire, but the user never said it.
|
|
54
|
+
const m = messages[i];
|
|
55
|
+
if (m && isUserUtterance(m))
|
|
54
56
|
return i;
|
|
55
57
|
}
|
|
56
58
|
return -1;
|
|
@@ -169,7 +171,8 @@ const STOPPED_EVENT = 'Stopped.';
|
|
|
169
171
|
* waiting on a widget);
|
|
170
172
|
* - the restored transcript ends on a `tool` result — the results landed, the model call that
|
|
171
173
|
* would read them never finished;
|
|
172
|
-
* - it ends on a user message — the user's turn never got its first reply
|
|
174
|
+
* - it ends on a user message — the user's turn never got its first reply (or, for a driver note,
|
|
175
|
+
* the turn was held open and the model had not acted on the note).
|
|
173
176
|
* An assistant reply, or the driver's `Stopped.` event, ends the transcript on a finished turn.
|
|
174
177
|
*
|
|
175
178
|
* The note gives CONTEXT, never an instruction to repeat anything: the model reads where things
|
|
@@ -194,6 +197,11 @@ export function buildResumeNote(restored, dropped) {
|
|
|
194
197
|
if ((last === null || last === void 0 ? void 0 : last.role) === 'tool') {
|
|
195
198
|
return `${lead} Your last tool results came back, but you had not yet responded to them. ${tail}`;
|
|
196
199
|
}
|
|
200
|
+
// A driver note is `role: 'user'` on the wire, but the user never wrote it: the turn was held open
|
|
201
|
+
// (a finish guard's note, or a sub-agent's completion nudge) and the model had not acted on it.
|
|
202
|
+
if (last && isDriverNote(last)) {
|
|
203
|
+
return `${lead} You were asked to continue before finishing, in the framework note that is the last message, and had not yet acted on it. ${tail}`;
|
|
204
|
+
}
|
|
197
205
|
if ((last === null || last === void 0 ? void 0 : last.role) === 'user' || (last === null || last === void 0 ? void 0 : last.role) === 'synthetic-user') {
|
|
198
206
|
return `${lead} You had not yet replied to the user's last message. ${tail}`;
|
|
199
207
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { reachesProvider } from '../utils/context-tokens';
|
|
3
3
|
import { frameDelegatedContent } from '../utils/delegated-message';
|
|
4
|
+
import { isDriverNote } from '../utils/driver-note';
|
|
4
5
|
import { logger } from '../utils/logger';
|
|
5
6
|
/** Turns of transcript given to the model when suggesting follow-ups. */
|
|
6
7
|
const HISTORY_WINDOW = 8;
|
|
@@ -70,6 +71,7 @@ export function buildSuggestionsPrompt(ctx, history, prompt, count, allAgentInfo
|
|
|
70
71
|
.filter((m) => {
|
|
71
72
|
var _a, _b;
|
|
72
73
|
return reachesProvider(m) &&
|
|
74
|
+
!isDriverNote(m) &&
|
|
73
75
|
(m.role === 'user' || m.role === 'assistant') &&
|
|
74
76
|
!((_a = m.toolCalls) === null || _a === void 0 ? void 0 : _a.length) &&
|
|
75
77
|
!m.thinking &&
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `message` is a model-facing note the driver wrote (`ChatMessage.driverNote`), such as a
|
|
3
|
+
* finish guard's reason for holding a turn open. It is a `role: 'user'` message on the wire, but the
|
|
4
|
+
* user never wrote it: it is hidden from the transcript and must not be read as their words.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export const isDriverNote = (message) => !!message.driverNote;
|
|
9
|
+
/**
|
|
10
|
+
* Whether `message` is something the user (or a decorator on their behalf) actually said: a
|
|
11
|
+
* `role: 'user'` message that is not a driver note.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export const isUserUtterance = (message) => message.role === 'user' && !message.driverNote;
|
|
16
|
+
/**
|
|
17
|
+
* Build the stored message for a note that holds a turn open: a finish guard's `'continue'` note,
|
|
18
|
+
* or the driver's completion nudge to a sub-agent. A `role: 'user'` message, framed as a
|
|
19
|
+
* `<system-reminder>` like the tail context, so the model reads it as framework guidance and not as
|
|
20
|
+
* the person's reply.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export function finishGuardNoteMessage(note, kind = 'finish-guard') {
|
|
25
|
+
return {
|
|
26
|
+
role: 'user',
|
|
27
|
+
content: `<system-reminder>\n${note.trim()}\n</system-reminder>`,
|
|
28
|
+
driverNote: kind,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { COMPACTION_SUMMARY_TOKEN_ESTIMATE, estimateMessageTokens, projectCompaction, reachesProvider, } from './context-tokens';
|
|
3
3
|
import { frameDelegatedContent } from './delegated-message';
|
|
4
|
+
import { isDriverNote } from './driver-note';
|
|
4
5
|
import { preservedUserLine, verbatimUserMessagesBlock } from './preserved-user-messages';
|
|
5
6
|
/**
|
|
6
7
|
* Masks the tool-specific payload of a single message — clears tool call args
|
|
@@ -215,6 +216,9 @@ function renderMessageForSummary(m) {
|
|
|
215
216
|
// user's mouth that outlive the message itself (GENC-1660).
|
|
216
217
|
if (!m.content)
|
|
217
218
|
return '';
|
|
219
|
+
// A driver note (a finish guard's reason to go on) is guidance, not something the user said.
|
|
220
|
+
if (isDriverNote(m))
|
|
221
|
+
return `Framework note: ${m.content}`;
|
|
218
222
|
return `User: ${m.delegate ? frameDelegatedContent(m.content, m.delegateFraming) : m.content}`;
|
|
219
223
|
case 'assistant': {
|
|
220
224
|
// Reasoning ("Thinking") and narration ("Working") are display-only assistant splits
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDriverNote } from './driver-note';
|
|
1
2
|
/**
|
|
2
3
|
* Display-only session-restore notices (GENC-1351 §6): the "Restored…" divider on
|
|
3
4
|
* a successful reload restore, and the "Couldn't restore…" divider when a saved
|
|
@@ -68,6 +69,10 @@ export function filterVisibleMessages(messages, toggles) {
|
|
|
68
69
|
? toggles.showRestoreNotices
|
|
69
70
|
: toggles.showAgentSwitchIndicator;
|
|
70
71
|
}
|
|
72
|
+
// Notes the driver wrote for the model (a finish guard's reason to go on) are wire-only.
|
|
73
|
+
if (isDriverNote(m)) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
71
76
|
// Tool result messages are never shown to the user.
|
|
72
77
|
if (m.role === 'tool') {
|
|
73
78
|
return false;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { frameDelegatedContent } from './delegated-message';
|
|
2
|
+
import { isUserUtterance } from './driver-note';
|
|
2
3
|
/**
|
|
3
4
|
* The user messages a compaction of `toCompact` keeps word for word (GENC-1660, critique C2): the
|
|
4
5
|
* range's own, oldest first, delegated ones still marked as such.
|
|
@@ -11,7 +12,7 @@ import { frameDelegatedContent } from './delegated-message';
|
|
|
11
12
|
export function freshUserMessages(toCompact) {
|
|
12
13
|
return toCompact.flatMap((m) => {
|
|
13
14
|
var _a;
|
|
14
|
-
return m
|
|
15
|
+
return isUserUtterance(m) && ((_a = m.content) === null || _a === void 0 ? void 0 : _a.trim())
|
|
15
16
|
? [
|
|
16
17
|
Object.assign(Object.assign({ content: m.content }, (m.timestamp ? { timestamp: m.timestamp } : {})), (m.delegate ? { delegate: m.delegate, delegateFraming: m.delegateFraming } : {})),
|
|
17
18
|
]
|
package/dist/react.cjs
CHANGED
|
@@ -163,14 +163,14 @@ const AiChatInteractionWrapper = React.forwardRef(function AiChatInteractionWrap
|
|
|
163
163
|
return React.createElement(customElements.getName(AiChatInteractionWrapperWC) ?? 'ai-chat-interaction-wrapper', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
-
const
|
|
166
|
+
const MessageFeedback = React.forwardRef(function MessageFeedback(props, ref) {
|
|
167
167
|
const { children, ...rest } = props;
|
|
168
|
-
return React.createElement(customElements.getName(
|
|
168
|
+
return React.createElement(customElements.getName(MessageFeedbackWC) ?? 'foundation-ai-message-feedback', { ...rest, ref }, children);
|
|
169
169
|
});
|
|
170
170
|
|
|
171
|
-
const
|
|
171
|
+
const AiChatMarkdown = React.forwardRef(function AiChatMarkdown(props, ref) {
|
|
172
172
|
const { children, ...rest } = props;
|
|
173
|
-
return React.createElement(customElements.getName(
|
|
173
|
+
return React.createElement(customElements.getName(AiChatMarkdownWC) ?? 'ai-chat-markdown', { ...rest, ref }, children);
|
|
174
174
|
});
|
|
175
175
|
|
|
176
176
|
const AiNotificationLevel = React.forwardRef(function AiNotificationLevel(props, ref) {
|
|
@@ -212,8 +212,8 @@ module.exports = {
|
|
|
212
212
|
AgentPicker,
|
|
213
213
|
AiChatBubble,
|
|
214
214
|
AiChatInteractionWrapper,
|
|
215
|
-
AiChatMarkdown,
|
|
216
215
|
MessageFeedback,
|
|
216
|
+
AiChatMarkdown,
|
|
217
217
|
AiNotificationLevel,
|
|
218
218
|
FoundationAiPopoutManager,
|
|
219
219
|
GenesisWriteReview,
|
package/dist/react.mjs
CHANGED
|
@@ -161,14 +161,14 @@ export const AiChatInteractionWrapper = React.forwardRef(function AiChatInteract
|
|
|
161
161
|
return React.createElement(customElements.getName(AiChatInteractionWrapperWC) ?? 'ai-chat-interaction-wrapper', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
|
|
162
162
|
});
|
|
163
163
|
|
|
164
|
-
export const
|
|
164
|
+
export const MessageFeedback = React.forwardRef(function MessageFeedback(props, ref) {
|
|
165
165
|
const { children, ...rest } = props;
|
|
166
|
-
return React.createElement(customElements.getName(
|
|
166
|
+
return React.createElement(customElements.getName(MessageFeedbackWC) ?? 'foundation-ai-message-feedback', { ...rest, ref }, children);
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
-
export const
|
|
169
|
+
export const AiChatMarkdown = React.forwardRef(function AiChatMarkdown(props, ref) {
|
|
170
170
|
const { children, ...rest } = props;
|
|
171
|
-
return React.createElement(customElements.getName(
|
|
171
|
+
return React.createElement(customElements.getName(AiChatMarkdownWC) ?? 'ai-chat-markdown', { ...rest, ref }, children);
|
|
172
172
|
});
|
|
173
173
|
|
|
174
174
|
export const AiNotificationLevel = React.forwardRef(function AiNotificationLevel(props, ref) {
|