@genesislcap/ai-assistant 15.95.2-GENC-1665.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 +182 -226
- package/dist/chat-driver.cjs.map +4 -4
- package/dist/chat-driver.mjs +182 -224
- package/dist/chat-driver.mjs.map +4 -4
- package/dist/custom-elements.json +2053 -2007
- package/dist/dts/autopilot/decision-message.d.ts.map +1 -1
- package/dist/dts/chat-driver-node.d.ts +1 -1
- package/dist/dts/chat-driver-node.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.constants.d.ts +14 -10
- 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/chat-driver-node.js +1 -1
- package/dist/esm/components/chat-driver/chat-driver.constants.js +17 -10
- package/dist/esm/components/chat-driver/chat-driver.js +119 -35
- 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
package/dist/chat-driver.mjs
CHANGED
|
@@ -1218,13 +1218,10 @@ var SUPPORTED_GEMINI_MODEL_IDS = [
|
|
|
1218
1218
|
];
|
|
1219
1219
|
var SUPPORTED_ANTHROPIC_MODEL_IDS = [
|
|
1220
1220
|
"claude-fable-5",
|
|
1221
|
-
"claude-opus-5-5",
|
|
1222
1221
|
"claude-opus-4-8",
|
|
1223
1222
|
"claude-opus-4-7",
|
|
1224
|
-
"claude-sonnet-5-5",
|
|
1225
1223
|
"claude-sonnet-5",
|
|
1226
1224
|
"claude-sonnet-4-6",
|
|
1227
|
-
"claude-haiku-5-5",
|
|
1228
1225
|
"claude-haiku-4-5-20251001"
|
|
1229
1226
|
];
|
|
1230
1227
|
var SUPPORTED_OPENAI_MODEL_IDS = [
|
|
@@ -1261,40 +1258,14 @@ function scaleTemperature(normalized, { defaultTemp, maxTemp }) {
|
|
|
1261
1258
|
|
|
1262
1259
|
// ../../foundation-ai/dist/esm/utils/token-cost.js
|
|
1263
1260
|
var TOKENS_PER_MILLION = 1e6;
|
|
1264
|
-
var ANTHROPIC_LONG_CONTEXT_THRESHOLD = 1e5;
|
|
1265
1261
|
var ANTHROPIC_PRICING = {
|
|
1266
|
-
"claude-haiku-4-5-20251001": {
|
|
1267
|
-
kind: "flat",
|
|
1268
|
-
rate: { promptPerMillion: 1, candidatePerMillion: 5 }
|
|
1269
|
-
},
|
|
1270
|
-
// Haiku 5.5 has two rate cards chosen by prompt length; cache reads are 0.1× the input rate of
|
|
1271
|
-
// whichever card applies, like every other model here.
|
|
1272
|
-
"claude-haiku-5-5": {
|
|
1273
|
-
kind: "tiered",
|
|
1274
|
-
standard: { promptPerMillion: 0.1, candidatePerMillion: 0.5 },
|
|
1275
|
-
longContext: { promptPerMillion: 0.5, candidatePerMillion: 2.5 }
|
|
1276
|
-
},
|
|
1262
|
+
"claude-haiku-4-5-20251001": { promptPerMillion: 1, candidatePerMillion: 5 },
|
|
1277
1263
|
// Fable 5 — Anthropic's most capable widely-released model; priced above Opus tier.
|
|
1278
|
-
"claude-fable-5": {
|
|
1279
|
-
// Opus 5.5 — $4 / $20, cheaper than Opus 4.8. Its cache reads are $0.20 / MTok, i.e. 0.05× the
|
|
1280
|
-
// input rate (as on Sonnet 5.5), NOT the 0.1× every older model reads at: the global
|
|
1281
|
-
// multiplier would bill its cache reads at double.
|
|
1282
|
-
"claude-opus-5-5": {
|
|
1283
|
-
kind: "flat",
|
|
1284
|
-
rate: { promptPerMillion: 4, candidatePerMillion: 20 },
|
|
1285
|
-
cacheReadMultiplier: 0.05
|
|
1286
|
-
},
|
|
1264
|
+
"claude-fable-5": { promptPerMillion: 10, candidatePerMillion: 50 },
|
|
1287
1265
|
// Opus 4.7 / 4.8 — same $5 / $25 per MTok. Stated per model rather than shared through a
|
|
1288
1266
|
// fall-through, so neither is ever "whatever was left over".
|
|
1289
|
-
"claude-opus-4-8": {
|
|
1290
|
-
"claude-opus-4-7": {
|
|
1291
|
-
// Sonnet 5.5 — same $2 / $10 as Sonnet 5, but its cache reads are $0.10 / MTok (0.05×, like
|
|
1292
|
-
// Opus 5.5), half of Sonnet 5's $0.20.
|
|
1293
|
-
"claude-sonnet-5-5": {
|
|
1294
|
-
kind: "flat",
|
|
1295
|
-
rate: { promptPerMillion: 2, candidatePerMillion: 10 },
|
|
1296
|
-
cacheReadMultiplier: 0.05
|
|
1297
|
-
},
|
|
1267
|
+
"claude-opus-4-8": { promptPerMillion: 5, candidatePerMillion: 25 },
|
|
1268
|
+
"claude-opus-4-7": { promptPerMillion: 5, candidatePerMillion: 25 },
|
|
1298
1269
|
// Sonnet 5 is $2 / $10 — its OWN tier, and CHEAPER than the older Sonnet 4.6 below.
|
|
1299
1270
|
//
|
|
1300
1271
|
// This launched as an introductory rate through 2026-08-31, and an earlier version of this
|
|
@@ -1303,32 +1274,22 @@ var ANTHROPIC_PRICING = {
|
|
|
1303
1274
|
// standard price and cancelled the scheduled increase, so that reasoning is dead and the old
|
|
1304
1275
|
// figure over-charged every Sonnet 5 request by 50%.
|
|
1305
1276
|
// https://platform.claude.com/docs/en/about-claude/pricing#model-pricing
|
|
1306
|
-
"claude-sonnet-5": {
|
|
1277
|
+
"claude-sonnet-5": { promptPerMillion: 2, candidatePerMillion: 10 },
|
|
1307
1278
|
// Sonnet 4.6 remains on the older $3 / $15 Sonnet tier — the newer model is the cheaper one.
|
|
1308
|
-
"claude-sonnet-4-6": {
|
|
1279
|
+
"claude-sonnet-4-6": { promptPerMillion: 3, candidatePerMillion: 15 }
|
|
1309
1280
|
};
|
|
1310
|
-
function anthropicRatesFor(model
|
|
1311
|
-
|
|
1312
|
-
if (pricing.kind === "flat") {
|
|
1313
|
-
return pricing.rate;
|
|
1314
|
-
}
|
|
1315
|
-
return promptTokens > ANTHROPIC_LONG_CONTEXT_THRESHOLD ? pricing.longContext : pricing.standard;
|
|
1281
|
+
function anthropicRatesFor(model) {
|
|
1282
|
+
return ANTHROPIC_PRICING[model];
|
|
1316
1283
|
}
|
|
1317
1284
|
var ANTHROPIC_CACHE_READ_MULTIPLIER = 0.1;
|
|
1318
|
-
function anthropicCacheReadMultiplierFor(model) {
|
|
1319
|
-
var _a;
|
|
1320
|
-
return (_a = ANTHROPIC_PRICING[model].cacheReadMultiplier) !== null && _a !== void 0 ? _a : ANTHROPIC_CACHE_READ_MULTIPLIER;
|
|
1321
|
-
}
|
|
1322
1285
|
var ANTHROPIC_CACHE_WRITE_5M_MULTIPLIER = 1.25;
|
|
1323
1286
|
var ANTHROPIC_CACHE_WRITE_1H_MULTIPLIER = 2;
|
|
1324
1287
|
function anthropicTokenCost(model, usage) {
|
|
1325
|
-
const
|
|
1326
|
-
const { promptPerMillion, candidatePerMillion } = anthropicRatesFor(model, promptTokens);
|
|
1327
|
-
const cacheReadMultiplier = anthropicCacheReadMultiplierFor(model);
|
|
1288
|
+
const { promptPerMillion, candidatePerMillion } = anthropicRatesFor(model);
|
|
1328
1289
|
const m = TOKENS_PER_MILLION;
|
|
1329
1290
|
const cacheWrite5mTokens = Math.max(0, usage.cacheWriteTokens - usage.cacheWrite1hTokens);
|
|
1330
1291
|
const promptCost = usage.uncachedInputTokens / m * promptPerMillion;
|
|
1331
|
-
const cacheReadCost = usage.cacheReadTokens / m * promptPerMillion *
|
|
1292
|
+
const cacheReadCost = usage.cacheReadTokens / m * promptPerMillion * ANTHROPIC_CACHE_READ_MULTIPLIER;
|
|
1332
1293
|
const cacheWriteCost = cacheWrite5mTokens / m * promptPerMillion * ANTHROPIC_CACHE_WRITE_5M_MULTIPLIER + usage.cacheWrite1hTokens / m * promptPerMillion * ANTHROPIC_CACHE_WRITE_1H_MULTIPLIER;
|
|
1333
1294
|
const candidateCost = usage.outputTokens / m * candidatePerMillion;
|
|
1334
1295
|
const cacheReadFull = usage.cacheReadTokens / m * promptPerMillion;
|
|
@@ -2323,7 +2284,6 @@ var DEFAULT_MODEL = "claude-haiku-4-5-20251001";
|
|
|
2323
2284
|
var DEFAULT_TIMEOUT = 3e5;
|
|
2324
2285
|
var DEFAULT_STALL_TIMEOUT = 3e4;
|
|
2325
2286
|
var DEFAULT_MAX_TOKENS = 4096;
|
|
2326
|
-
var CLAUDE_55_DEFAULT_MAX_TOKENS = 64e3;
|
|
2327
2287
|
var ANTHROPIC_DEFAULT_TEMPERATURE = 1;
|
|
2328
2288
|
var ANTHROPIC_MAX_TEMPERATURE = 1;
|
|
2329
2289
|
function toAnthropicToolChoice(choice) {
|
|
@@ -2337,60 +2297,38 @@ function toAnthropicToolChoice(choice) {
|
|
|
2337
2297
|
}
|
|
2338
2298
|
var ANTHROPIC_CONTEXT_LIMITS = {
|
|
2339
2299
|
"claude-fable-5": 1e6,
|
|
2340
|
-
"claude-opus-5-5": 1e6,
|
|
2341
2300
|
"claude-opus-4-8": 1e6,
|
|
2342
2301
|
"claude-opus-4-7": 1e6,
|
|
2343
|
-
"claude-sonnet-5-5": 1e6,
|
|
2344
2302
|
"claude-sonnet-5": 1e6,
|
|
2345
2303
|
"claude-sonnet-4-6": 1e6,
|
|
2346
|
-
"claude-haiku-5-5": 1e6,
|
|
2347
2304
|
"claude-haiku-4-5-20251001": 2e5
|
|
2348
2305
|
};
|
|
2349
2306
|
var STRUCTURED_OUTPUT_TOOL_NAME = "emit_structured_response";
|
|
2350
2307
|
var SERVER_SIDE_FALLBACK_BETA = "server-side-fallback-2026-06-01";
|
|
2351
|
-
var THINKING_BINDING_CONTROLS_BETA = "thinking-binding-controls-2026-08-01";
|
|
2352
2308
|
function assertSupportedAnthropicModel(model) {
|
|
2353
2309
|
if (!SUPPORTED_ANTHROPIC_MODEL_IDS.includes(model)) {
|
|
2354
2310
|
throw new Error(`AnthropicTransport: unsupported model "${model}". Use one of: ${SUPPORTED_ANTHROPIC_MODEL_IDS.join(", ")}.`);
|
|
2355
2311
|
}
|
|
2356
2312
|
}
|
|
2357
|
-
function isClaude55(model) {
|
|
2358
|
-
return model === "claude-opus-5-5" || model === "claude-sonnet-5-5" || model === "claude-haiku-5-5";
|
|
2359
|
-
}
|
|
2360
2313
|
function rejectsSamplingParams(model) {
|
|
2361
|
-
return model === "claude-fable-5" || model === "claude-opus-4-8" || model === "claude-opus-4-7" || model === "claude-sonnet-5"
|
|
2362
|
-
}
|
|
2363
|
-
function supportsForcedToolChoice(model) {
|
|
2364
|
-
return model !== "claude-opus-5-5" && model !== "claude-sonnet-5-5";
|
|
2314
|
+
return model === "claude-fable-5" || model === "claude-opus-4-8" || model === "claude-opus-4-7" || model === "claude-sonnet-5";
|
|
2365
2315
|
}
|
|
2366
2316
|
function supportsNativeStructuredOutput(model) {
|
|
2367
|
-
return model === "claude-fable-5" || model === "claude-opus-4-8" || model === "claude-sonnet-5" || model === "claude-haiku-4-5-20251001"
|
|
2317
|
+
return model === "claude-fable-5" || model === "claude-opus-4-8" || model === "claude-sonnet-5" || model === "claude-haiku-4-5-20251001";
|
|
2368
2318
|
}
|
|
2369
2319
|
function supportsAdaptiveThinking(model) {
|
|
2370
2320
|
return model !== "claude-haiku-4-5-20251001";
|
|
2371
2321
|
}
|
|
2372
2322
|
function thinkingIsMandatory(model) {
|
|
2373
|
-
return model === "claude-fable-5"
|
|
2374
|
-
}
|
|
2375
|
-
function defaultsToThinking(model) {
|
|
2376
|
-
return model === "claude-sonnet-5" || model === "claude-sonnet-5-5" || model === "claude-haiku-5-5" || thinkingIsMandatory(model);
|
|
2377
|
-
}
|
|
2378
|
-
function thinkingOff(model) {
|
|
2379
|
-
return model === "claude-sonnet-5-5" ? { type: "between_tools" } : { type: "disabled" };
|
|
2380
|
-
}
|
|
2381
|
-
var POLICY_EFFORT = {
|
|
2382
|
-
"claude-opus-5-5": { off: "low" }
|
|
2383
|
-
};
|
|
2384
|
-
function sendsBlockBinding(model) {
|
|
2385
|
-
return isClaude55(model);
|
|
2323
|
+
return model === "claude-fable-5";
|
|
2386
2324
|
}
|
|
2387
2325
|
function anthropicThinking(model, policy) {
|
|
2388
|
-
const
|
|
2326
|
+
const defaultsToThinking = model === "claude-sonnet-5" || thinkingIsMandatory(model);
|
|
2389
2327
|
const adaptive = { type: "adaptive", display: "summarized" };
|
|
2390
2328
|
if (policy === "off") {
|
|
2391
2329
|
if (thinkingIsMandatory(model))
|
|
2392
2330
|
return adaptive;
|
|
2393
|
-
return
|
|
2331
|
+
return defaultsToThinking ? { type: "disabled" } : void 0;
|
|
2394
2332
|
}
|
|
2395
2333
|
if (policy === "auto") {
|
|
2396
2334
|
return supportsAdaptiveThinking(model) ? adaptive : void 0;
|
|
@@ -2398,10 +2336,10 @@ function anthropicThinking(model, policy) {
|
|
|
2398
2336
|
if (policy !== void 0) {
|
|
2399
2337
|
return supportsAdaptiveThinking(model) ? adaptive : void 0;
|
|
2400
2338
|
}
|
|
2401
|
-
return
|
|
2339
|
+
return defaultsToThinking ? adaptive : void 0;
|
|
2402
2340
|
}
|
|
2403
2341
|
function supportsEffort(model) {
|
|
2404
|
-
return model === "claude-fable-5" || model === "claude-opus-4-8" || model === "claude-sonnet-5"
|
|
2342
|
+
return model === "claude-fable-5" || model === "claude-opus-4-8" || model === "claude-sonnet-5";
|
|
2405
2343
|
}
|
|
2406
2344
|
var ANTHROPIC_EFFORT = {
|
|
2407
2345
|
minimal: "low",
|
|
@@ -2411,11 +2349,8 @@ var ANTHROPIC_EFFORT = {
|
|
|
2411
2349
|
max: "max"
|
|
2412
2350
|
};
|
|
2413
2351
|
function anthropicEffort(model, policy) {
|
|
2414
|
-
|
|
2415
|
-
if (policy === void 0)
|
|
2352
|
+
if (policy === void 0 || policy === "auto" || policy === "off")
|
|
2416
2353
|
return void 0;
|
|
2417
|
-
if (policy === "auto" || policy === "off")
|
|
2418
|
-
return (_a = POLICY_EFFORT[model]) === null || _a === void 0 ? void 0 : _a[policy];
|
|
2419
2354
|
if (!supportsEffort(model) || !supportsAdaptiveThinking(model))
|
|
2420
2355
|
return void 0;
|
|
2421
2356
|
return ANTHROPIC_EFFORT[policy];
|
|
@@ -2459,14 +2394,11 @@ var AnthropicTransport = class _AnthropicTransport {
|
|
|
2459
2394
|
* outcome the type's own docs promise callers never happens.
|
|
2460
2395
|
*/
|
|
2461
2396
|
clampWarning(policy) {
|
|
2462
|
-
var _a, _b;
|
|
2463
2397
|
switch (policy) {
|
|
2464
2398
|
case void 0:
|
|
2465
2399
|
return void 0;
|
|
2466
2400
|
case "off":
|
|
2467
|
-
|
|
2468
|
-
return void 0;
|
|
2469
|
-
return ((_a = POLICY_EFFORT[this.model]) === null || _a === void 0 ? void 0 : _a.off) ? `AnthropicTransport: thinkingPolicy 'off' approximated \u2014 ${this.model} always thinks and rejects an explicit disable, so the turn runs at effort '${(_b = POLICY_EFFORT[this.model]) === null || _b === void 0 ? void 0 : _b.off}' instead. It may still think a little, billed as output.` : `AnthropicTransport: thinkingPolicy 'off' ignored \u2014 ${this.model} always thinks and rejects an explicit disable. Reasoning tokens are still billed as output; switch model if you need them gone.`;
|
|
2401
|
+
return thinkingIsMandatory(this.model) ? `AnthropicTransport: thinkingPolicy 'off' ignored \u2014 ${this.model} always thinks and rejects an explicit disable. Reasoning tokens are still billed as output; switch model if you need them gone.` : void 0;
|
|
2470
2402
|
case "auto":
|
|
2471
2403
|
return supportsAdaptiveThinking(this.model) ? void 0 : `AnthropicTransport: thinkingPolicy 'auto' ignored \u2014 ${this.model} does not support adaptive thinking, so this turn runs without reasoning. Use a Sonnet or Opus tier if the agent needs it.`;
|
|
2472
2404
|
case "minimal":
|
|
@@ -2475,7 +2407,7 @@ var AnthropicTransport = class _AnthropicTransport {
|
|
|
2475
2407
|
case "high":
|
|
2476
2408
|
case "max":
|
|
2477
2409
|
if (!supportsAdaptiveThinking(this.model) || !supportsEffort(this.model)) {
|
|
2478
|
-
return `AnthropicTransport: thinkingPolicy '${policy}' ignored \u2014 ${this.model} predates output_config.effort, so this turn runs at its default posture. Use Opus 4.8
|
|
2410
|
+
return `AnthropicTransport: thinkingPolicy '${policy}' ignored \u2014 ${this.model} predates output_config.effort, so this turn runs at its default posture. Use Opus 4.8, Sonnet 5, or Fable 5 to set reasoning depth.`;
|
|
2479
2411
|
}
|
|
2480
2412
|
return void 0;
|
|
2481
2413
|
default: {
|
|
@@ -2485,11 +2417,10 @@ var AnthropicTransport = class _AnthropicTransport {
|
|
|
2485
2417
|
}
|
|
2486
2418
|
}
|
|
2487
2419
|
constructor(config = {}) {
|
|
2488
|
-
var _a, _b, _c, _d
|
|
2420
|
+
var _a, _b, _c, _d;
|
|
2489
2421
|
this.lifetimeCostUsd = 0;
|
|
2490
2422
|
this.lifetimeSavingsUsd = 0;
|
|
2491
2423
|
this.warnedThinkingClamped = false;
|
|
2492
|
-
this.warnedToolChoiceDowngraded = false;
|
|
2493
2424
|
this.warnedUnknownServingModels = /* @__PURE__ */ new Set();
|
|
2494
2425
|
const model = (_a = config.model) !== null && _a !== void 0 ? _a : DEFAULT_MODEL;
|
|
2495
2426
|
assertSupportedAnthropicModel(model);
|
|
@@ -2500,10 +2431,6 @@ var AnthropicTransport = class _AnthropicTransport {
|
|
|
2500
2431
|
logger.warn("AnthropicTransport: using claude-sonnet-4-6 \u2014 higher cost than Haiku; use for stronger reasoning or agent tasks.");
|
|
2501
2432
|
} else if (model === "claude-opus-4-7" || model === "claude-opus-4-8") {
|
|
2502
2433
|
logger.warn(`AnthropicTransport: using ${model} \u2014 significantly higher cost; reserve for tasks where Sonnet reliability is insufficient.`);
|
|
2503
|
-
} else if (model === "claude-opus-5-5") {
|
|
2504
|
-
logger.warn("AnthropicTransport: using claude-opus-5-5 \u2014 Opus tier ($4 / $20 per MTok) with thinking always on (effort defaults to medium). Reserve for tasks where Sonnet reliability is insufficient.");
|
|
2505
|
-
} else if (model === "claude-sonnet-5-5") {
|
|
2506
|
-
logger.warn("AnthropicTransport: using claude-sonnet-5-5 \u2014 standard Sonnet tier ($2 / $10 per MTok), higher cost than Haiku, and adaptive thinking runs by default so reasoning tokens add to output cost. Use for stronger reasoning or agent tasks.");
|
|
2507
2434
|
} else if (model === "claude-fable-5") {
|
|
2508
2435
|
logger.warn(`AnthropicTransport: using claude-fable-5 \u2014 Anthropic's most capable model, priced above Opus tier ($10 / $50 per MTok) with thinking always on. Reserve for the hardest reasoning/long-horizon work. Requires \u226530-day data retention (unavailable under ZDR) and may return stop_reason "refusal"; pair with an Opus 4.8 fallback.`);
|
|
2509
2436
|
}
|
|
@@ -2511,8 +2438,7 @@ var AnthropicTransport = class _AnthropicTransport {
|
|
|
2511
2438
|
this.stallTimeout = (_c = config.stallTimeout) !== null && _c !== void 0 ? _c : DEFAULT_STALL_TIMEOUT;
|
|
2512
2439
|
this.apiKey = config.apiKey;
|
|
2513
2440
|
this.serverEndpoint = config.serverEndpoint;
|
|
2514
|
-
this.maxTokens = (_d = config.maxTokens) !== null && _d !== void 0 ? _d :
|
|
2515
|
-
this.thinkingBlockBinding = (_e = config.thinkingBlockBinding) !== null && _e !== void 0 ? _e : "drop_block";
|
|
2441
|
+
this.maxTokens = (_d = config.maxTokens) !== null && _d !== void 0 ? _d : DEFAULT_MAX_TOKENS;
|
|
2516
2442
|
}
|
|
2517
2443
|
getConfig() {
|
|
2518
2444
|
return {
|
|
@@ -2552,9 +2478,6 @@ var AnthropicTransport = class _AnthropicTransport {
|
|
|
2552
2478
|
if (useNative) {
|
|
2553
2479
|
body.output_config = Object.assign(Object.assign({}, body.output_config), { format: { type: "json_schema", schema: responseSchema } });
|
|
2554
2480
|
} else if (useForcedTool) {
|
|
2555
|
-
if (!supportsForcedToolChoice(this.model)) {
|
|
2556
|
-
throw new Error(`AnthropicTransport: ${this.model} rejects forced tool_choice and must be listed in supportsNativeStructuredOutput.`);
|
|
2557
|
-
}
|
|
2558
2481
|
body.tools = [
|
|
2559
2482
|
{
|
|
2560
2483
|
name: STRUCTURED_OUTPUT_TOOL_NAME,
|
|
@@ -2564,9 +2487,8 @@ var AnthropicTransport = class _AnthropicTransport {
|
|
|
2564
2487
|
];
|
|
2565
2488
|
body.tool_choice = { type: "tool", name: STRUCTURED_OUTPUT_TOOL_NAME };
|
|
2566
2489
|
}
|
|
2567
|
-
if (
|
|
2568
|
-
body.thinking =
|
|
2569
|
-
}
|
|
2490
|
+
if (this.model === "claude-sonnet-5")
|
|
2491
|
+
body.thinking = { type: "disabled" };
|
|
2570
2492
|
const response = yield this.post(body);
|
|
2571
2493
|
if (useForcedTool) {
|
|
2572
2494
|
const toolUse = ((_a = response.content) !== null && _a !== void 0 ? _a : []).find((b) => b.type === "tool_use" && b.name === STRUCTURED_OUTPUT_TOOL_NAME);
|
|
@@ -2578,7 +2500,7 @@ var AnthropicTransport = class _AnthropicTransport {
|
|
|
2578
2500
|
// ── ChatTransport (multi-turn chat) ────────────────────────────────────
|
|
2579
2501
|
sendChatMessage(history, userMessage, options) {
|
|
2580
2502
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2581
|
-
var _a, _b, _c, _d, _e
|
|
2503
|
+
var _a, _b, _c, _d, _e;
|
|
2582
2504
|
const reachableModels = /* @__PURE__ */ new Set([
|
|
2583
2505
|
this.model,
|
|
2584
2506
|
...((_a = options === null || options === void 0 ? void 0 : options.fallbacks) !== null && _a !== void 0 ? _a : []).map((f) => f.model)
|
|
@@ -2595,11 +2517,15 @@ var AnthropicTransport = class _AnthropicTransport {
|
|
|
2595
2517
|
if ((_c = options === null || options === void 0 ? void 0 : options.tools) === null || _c === void 0 ? void 0 : _c.length) {
|
|
2596
2518
|
body.tools = options.tools.map((t) => Object.assign({ name: t.name, description: t.description, input_schema: t.enforceSchema ? enforceAnthropicToolSchema(t.parameters, t.name) : t.parameters }, t.enforceSchema ? { strict: true } : {}));
|
|
2597
2519
|
}
|
|
2598
|
-
|
|
2520
|
+
if ((_d = body.tools) === null || _d === void 0 ? void 0 : _d.length) {
|
|
2521
|
+
const toolChoice = toAnthropicToolChoice(options === null || options === void 0 ? void 0 : options.toolChoice);
|
|
2522
|
+
if (toolChoice)
|
|
2523
|
+
body.tool_choice = toolChoice;
|
|
2524
|
+
}
|
|
2599
2525
|
this.warnIfThinkingUnclampable(options === null || options === void 0 ? void 0 : options.thinkingPolicy);
|
|
2600
2526
|
const thinking = anthropicThinking(this.model, options === null || options === void 0 ? void 0 : options.thinkingPolicy);
|
|
2601
2527
|
if (thinking)
|
|
2602
|
-
body.thinking =
|
|
2528
|
+
body.thinking = thinking;
|
|
2603
2529
|
const effort = anthropicEffort(this.model, options === null || options === void 0 ? void 0 : options.thinkingPolicy);
|
|
2604
2530
|
if (effort)
|
|
2605
2531
|
body.output_config = Object.assign(Object.assign({}, body.output_config), { effort });
|
|
@@ -2613,83 +2539,19 @@ var AnthropicTransport = class _AnthropicTransport {
|
|
|
2613
2539
|
if ((options === null || options === void 0 ? void 0 : options.responseSchema) && supportsNativeStructuredOutput(this.model)) {
|
|
2614
2540
|
body.output_config = Object.assign(Object.assign({}, body.output_config), { format: { type: "json_schema", schema: options.responseSchema } });
|
|
2615
2541
|
}
|
|
2616
|
-
if ((
|
|
2542
|
+
if ((_e = options === null || options === void 0 ? void 0 : options.fallbacks) === null || _e === void 0 ? void 0 : _e.length) {
|
|
2617
2543
|
body.fallbacks = options.fallbacks.map((f) => f.maxTokens != null ? { model: f.model, max_tokens: f.maxTokens } : { model: f.model });
|
|
2618
2544
|
}
|
|
2619
2545
|
if (options === null || options === void 0 ? void 0 : options.cachePolicy) {
|
|
2620
2546
|
this.applyCacheControl(body, options.cachePolicy);
|
|
2621
2547
|
}
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
this.appendTailContext(body, tail);
|
|
2548
|
+
if (options === null || options === void 0 ? void 0 : options.tailContext) {
|
|
2549
|
+
this.appendTailContext(body, options.tailContext);
|
|
2625
2550
|
}
|
|
2626
2551
|
const response = yield this.post(body, options === null || options === void 0 ? void 0 : options.signal);
|
|
2627
|
-
|
|
2628
|
-
if (forcedToolNote && message.responseMeta) {
|
|
2629
|
-
message.responseMeta.toolChoiceDowngraded = true;
|
|
2630
|
-
}
|
|
2631
|
-
return message;
|
|
2552
|
+
return this.fromAnthropicResponse(response, body.max_tokens);
|
|
2632
2553
|
});
|
|
2633
2554
|
}
|
|
2634
|
-
/**
|
|
2635
|
-
* Set `tool_choice` from the caller's {@link ChatToolChoice}. `'required'`/`{ tool }` force a
|
|
2636
|
-
* tool call so a turn can only end via one (e.g. a sub-agent's completion tool); on a model that
|
|
2637
|
-
* rejects forcing they are downgraded (see `downgradeForcedToolChoice`), and the instruction
|
|
2638
|
-
* that replaces them is returned for the tail.
|
|
2639
|
-
*/
|
|
2640
|
-
applyToolChoice(body, choice, tools) {
|
|
2641
|
-
const toolChoice = toAnthropicToolChoice(choice);
|
|
2642
|
-
if (!toolChoice)
|
|
2643
|
-
return void 0;
|
|
2644
|
-
const forced = toolChoice.type === "any" || toolChoice.type === "tool";
|
|
2645
|
-
if (forced && !supportsForcedToolChoice(this.model)) {
|
|
2646
|
-
return this.downgradeForcedToolChoice(body, toolChoice, tools);
|
|
2647
|
-
}
|
|
2648
|
-
body.tool_choice = toolChoice;
|
|
2649
|
-
return void 0;
|
|
2650
|
-
}
|
|
2651
|
-
/**
|
|
2652
|
-
* Preserved thinking (5.5 family): say what a changed history does to replayed thinking, rather
|
|
2653
|
-
* than inheriting the account default (a 400 on accounts created on or after 2026-08-31).
|
|
2654
|
-
* Adaptive only — `between_tools` and `disabled` reject the field — and a fresh object, so the
|
|
2655
|
-
* shared `adaptive` constant in `anthropicThinking` is never mutated.
|
|
2656
|
-
*/
|
|
2657
|
-
withBlockBinding(thinking) {
|
|
2658
|
-
if (thinking.type !== "adaptive" || !sendsBlockBinding(this.model) || this.thinkingBlockBinding === "omit") {
|
|
2659
|
-
return thinking;
|
|
2660
|
-
}
|
|
2661
|
-
return Object.assign(Object.assign({}, thinking), { block_binding: { prefix_mismatch_behavior: this.thinkingBlockBinding } });
|
|
2662
|
-
}
|
|
2663
|
-
/**
|
|
2664
|
-
* Stand-in for a forced tool call on a model that rejects `tool_choice` `any`/`tool` with a 400
|
|
2665
|
-
* (Opus 5.5, Sonnet 5.5). The request goes out with `tool_choice` omitted (`auto`), and:
|
|
2666
|
-
*
|
|
2667
|
-
* - for a NAMED tool, that tool's schema is enforced (`strict: true`), so a call that does
|
|
2668
|
-
* happen has valid arguments — the half of forcing that `auto` can still guarantee. Not done
|
|
2669
|
-
* for `'required'`: enforcing every tool in a large surface can exceed the provider's
|
|
2670
|
-
* per-request compilation limits, and a tool the caller enforced already carries it;
|
|
2671
|
-
* - an instruction naming the tool is returned for the caller to append to the tail.
|
|
2672
|
-
*
|
|
2673
|
-
* `auto` lets the model answer in text instead, so the caller is told: a one-time warning here,
|
|
2674
|
-
* and `responseMeta.toolChoiceDowngraded` on every affected response, which a driver uses to
|
|
2675
|
-
* nudge and retry once when no tool was called.
|
|
2676
|
-
*/
|
|
2677
|
-
downgradeForcedToolChoice(body, toolChoice, tools) {
|
|
2678
|
-
var _a, _b;
|
|
2679
|
-
if (!this.warnedToolChoiceDowngraded) {
|
|
2680
|
-
this.warnedToolChoiceDowngraded = true;
|
|
2681
|
-
logger.warn(`AnthropicTransport: ${this.model} rejects a forced tool_choice; sending 'auto' with an instruction to call the tool instead. A reply may still come back without a tool call \u2014 check responseMeta.toolChoiceDowngraded.`);
|
|
2682
|
-
}
|
|
2683
|
-
if (toolChoice.type === "tool" && toolChoice.name) {
|
|
2684
|
-
const index = (_b = (_a = body.tools) === null || _a === void 0 ? void 0 : _a.findIndex((t) => t.name === toolChoice.name)) !== null && _b !== void 0 ? _b : -1;
|
|
2685
|
-
const source = tools.find((t) => t.name === toolChoice.name);
|
|
2686
|
-
if (index >= 0 && source && body.tools && !body.tools[index].strict) {
|
|
2687
|
-
body.tools[index] = Object.assign(Object.assign({}, body.tools[index]), { input_schema: enforceAnthropicToolSchema(source.parameters, source.name), strict: true });
|
|
2688
|
-
}
|
|
2689
|
-
return `<system-reminder>Respond to this turn by calling the \`${toolChoice.name}\` tool. Do not reply with text alone.</system-reminder>`;
|
|
2690
|
-
}
|
|
2691
|
-
return "<system-reminder>Respond to this turn by calling one of your tools. Do not reply with text alone.</system-reminder>";
|
|
2692
|
-
}
|
|
2693
2555
|
/**
|
|
2694
2556
|
* Place prompt-cache breakpoints on the outgoing request per the resolved {@link CachePolicy}.
|
|
2695
2557
|
* A breakpoint is `cache_control: {type:'ephemeral'}` on a content block / tool / system block;
|
|
@@ -2989,7 +2851,7 @@ ${att.content}` });
|
|
|
2989
2851
|
return this.logTokenUsage(model, (_e = usage.input_tokens) !== null && _e !== void 0 ? _e : 0, (_f = usage.output_tokens) !== null && _f !== void 0 ? _f : 0, cacheRead, cacheCreation, cacheCreation1h);
|
|
2990
2852
|
}
|
|
2991
2853
|
fromAnthropicResponse(response, effectiveMaxTokens = this.maxTokens) {
|
|
2992
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
2854
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2993
2855
|
let inputTokens;
|
|
2994
2856
|
let outputTokens;
|
|
2995
2857
|
let cacheReadTokens;
|
|
@@ -3089,16 +2951,6 @@ ${att.content}` });
|
|
|
3089
2951
|
};
|
|
3090
2952
|
if (response.stop_reason)
|
|
3091
2953
|
responseMeta.finishReason = response.stop_reason;
|
|
3092
|
-
if ((_h = response.input_transformations) === null || _h === void 0 ? void 0 : _h.length) {
|
|
3093
|
-
responseMeta.inputTransformations = response.input_transformations.map((t) => Object.assign(Object.assign({ type: t.type }, t.path != null ? { path: t.path } : {}), t.reason != null ? { reason: t.reason } : {}));
|
|
3094
|
-
const dropped = response.input_transformations.filter((t) => t.type === "thinking_dropped");
|
|
3095
|
-
if (dropped.length) {
|
|
3096
|
-
logger.debug(`AnthropicTransport: ${dropped.length} thinking block(s) dropped by ${(_j = response.model) !== null && _j !== void 0 ? _j : this.model}: ${dropped.map((t) => {
|
|
3097
|
-
var _a2, _b2;
|
|
3098
|
-
return `${(_a2 = t.path) !== null && _a2 !== void 0 ? _a2 : "?"} (${(_b2 = t.reason) !== null && _b2 !== void 0 ? _b2 : "unknown"})`;
|
|
3099
|
-
}).join(", ")}`);
|
|
3100
|
-
}
|
|
3101
|
-
}
|
|
3102
2954
|
base.responseMeta = responseMeta;
|
|
3103
2955
|
return base;
|
|
3104
2956
|
}
|
|
@@ -3130,13 +2982,9 @@ ${att.content}` });
|
|
|
3130
2982
|
}
|
|
3131
2983
|
post(body, signal) {
|
|
3132
2984
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3133
|
-
var _a
|
|
2985
|
+
var _a;
|
|
3134
2986
|
const { url, headers, credentials } = this.buildEndpoint();
|
|
3135
|
-
const
|
|
3136
|
-
((_a = body.fallbacks) === null || _a === void 0 ? void 0 : _a.length) ? SERVER_SIDE_FALLBACK_BETA : void 0,
|
|
3137
|
-
((_b = body.thinking) === null || _b === void 0 ? void 0 : _b.type) === "adaptive" && body.thinking.block_binding ? THINKING_BINDING_CONTROLS_BETA : void 0
|
|
3138
|
-
].filter((b) => Boolean(b));
|
|
3139
|
-
const requestHeaders = betas.length ? Object.assign(Object.assign({}, headers), { "anthropic-beta": [headers["anthropic-beta"], ...betas].filter(Boolean).join(",") }) : headers;
|
|
2987
|
+
const requestHeaders = ((_a = body.fallbacks) === null || _a === void 0 ? void 0 : _a.length) ? Object.assign(Object.assign({}, headers), { "anthropic-beta": [headers["anthropic-beta"], SERVER_SIDE_FALLBACK_BETA].filter(Boolean).join(",") }) : headers;
|
|
3140
2988
|
return yield postWithRetry({
|
|
3141
2989
|
url,
|
|
3142
2990
|
headers: requestHeaders,
|
|
@@ -4961,6 +4809,7 @@ var META_EVENT_IMPORTANCE = {
|
|
|
4961
4809
|
"turn.start": "normal",
|
|
4962
4810
|
"turn.end": "normal",
|
|
4963
4811
|
"turn.retry": "normal",
|
|
4812
|
+
"turn.finish-guard": "normal",
|
|
4964
4813
|
"tool.unresolved": "normal",
|
|
4965
4814
|
"subagent.started": "normal",
|
|
4966
4815
|
"subagent.completed": "normal",
|
|
@@ -5105,7 +4954,7 @@ var DEBUG_LOG_README = [
|
|
|
5105
4954
|
"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 \u2014 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.",
|
|
5106
4955
|
"kind:'message' \u2014 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 \u2014 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 \u2014 cache reads a fraction of uncached input, cache writes a premium, output highest \u2014 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 \u2014 and any tool calls it carries \u2014 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` \u2014 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 \u2014 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.",
|
|
5107
4956
|
"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 \u203A 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 \u2014 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.",
|
|
5108
|
-
"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.",
|
|
4957
|
+
"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.",
|
|
5109
4958
|
"Sub-agent messages appear inline. When a tool delegates to a sub-agent (via `requestSubAgent`), the sub-agent's whole conversation \u2014 its own assistant/tool messages, each with their own `content`/`thinking`/`toolCalls`/`toolResult` and per-message `model`/`providerName`/`inputTokens`/`outputTokens`/`cacheReadTokens`/`cacheWriteTokens`/`cost` \u2014 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, \u2026), `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> \u203A <sub-agent>\"` breadcrumb (composing when nested, e.g. `\"UI Builder \u203A Planner \u203A 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.",
|
|
5110
4959
|
"kind:'turn' \u2014 one LLM call. `turnIndex` is a string: a top-level turn is the bare counter ('0', '1', \u2026); a sub-agent's turns are numbered under the parent turn that activated them ('3-1', '3-2', \u2026, and a nested sub-agent contributes '3-2-1', \u2026), and `agentName` names the agent that ran the turn. `systemPrompt` and `toolNames` are what the model saw. A systemPrompt of '<repeated \u2014 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.",
|
|
5111
4960
|
"kind:'turn'.`model`/`providerName`/`provider` \u2014 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 \u2014 a flow that plans on a high tier and executes on a low one \u2014 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.",
|
|
@@ -5113,8 +4962,8 @@ var DEBUG_LOG_README = [
|
|
|
5113
4962
|
"kind:'turn'.`agentSnapshot` \u2014 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.",
|
|
5114
4963
|
"kind:'event' \u2014 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'.",
|
|
5115
4964
|
"Each 'event' also has an `importance`: 'high' (failures/limits \u2014 turn.error, tool.failed, subagent.failed, file.read-failed, suggestions.failed, context.threshold-crossed), 'normal' (session flow \u2014 connects, turns, retries, handoffs, agent/provider changes, interactions, sub-agent start/complete), or 'low' (skippable UI/bookkeeping noise \u2014 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 \u2014 read them together to see how many attempts were made before bailing. 'message' and 'turn' entries carry no importance \u2014 they are the substance, always read them.",
|
|
5116
|
-
"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\u2194loading), turn.start/turn.end (turn boundary; turn.end carries durationMs), turn.retry (a recoverable in-turn retry \u2014 detail.reason plus attempt/maxAttempts; for malformed calls also finishMessage; for empty responses also the provider finishReason + thoughtsTokens + parts breakdown; reason no-tool-call is a sub-agent on a model that rejects forced tool use (Opus 5.5 / Sonnet 5.5) answering its forced turn in text, retried once with a nudge), turn.error (a turn failed or hit a guardrail \u2014 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 \u2014 real earlier this activation but retired by the current state or hidden behind an open exclusive fold \u2014 and hallucinatedTools \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 see its own paragraph below), provider.selected (the resolved provider for the upcoming turns \u2014 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 \u2014 explain quiet gaps; note that when a sub-agent opens a widget, detail.agent \u2014 and the agentName on the interaction message \u2014 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 \u2014 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) \u2014 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 \u2014 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) \u2014 which then carries detail.resolvedItself: true instead, as the interaction message does \u2014 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 \u2014 the framing and those choice texts \u2014 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 \u2014 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 \u2014 detail.claimant + reason), autopilot.* (the autopilot, a decorator that answers interactions on behalf of the user \u2014 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 \u2014 a gate whose controller said it was asking, such as a failed build the autopilot may not cancel \u2014 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 \u2014 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 \u2014 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 \u2014 stale when a pause, a resume, a new turn or the end of its flow came before the answer landed, which then went nowhere \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 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.",
|
|
5117
|
-
"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` \u2014 a `\"<parent> \u203A <sub-agent>\"` breadcrumb that composes when nested (e.g. `\"UI Builder \u203A Planner \u203A Grounding\"`) \u2014 and interleaved by their original timestamps within the subagent.started\u2192completed/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 \u2014 read its hoisted messages for model/tokens/cost and turn-by-turn activity, and the bracketing subagent.* events for the run's span.",
|
|
4965
|
+
"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\u2194loading), turn.start/turn.end (turn boundary; turn.end carries durationMs), turn.retry (a recoverable in-turn retry \u2014 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 \u2014 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 \u2014 detail.nudge of detail.maxNudges, the note stored with driverNote completion-nudge \u2014 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 \u2014 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 \u2014 real earlier this activation but retired by the current state or hidden behind an open exclusive fold \u2014 and hallucinatedTools \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 see its own paragraph below), provider.selected (the resolved provider for the upcoming turns \u2014 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 \u2014 explain quiet gaps; note that when a sub-agent opens a widget, detail.agent \u2014 and the agentName on the interaction message \u2014 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 \u2014 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) \u2014 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 \u2014 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) \u2014 which then carries detail.resolvedItself: true instead, as the interaction message does \u2014 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 \u2014 the framing and those choice texts \u2014 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 \u2014 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 \u2014 detail.claimant + reason), autopilot.* (the autopilot, a decorator that answers interactions on behalf of the user \u2014 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 \u2014 a gate whose controller said it was asking, such as a failed build the autopilot may not cancel \u2014 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 \u2014 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 \u2014 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 \u2014 stale when a pause, a resume, a new turn or the end of its flow came before the answer landed, which then went nowhere \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 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.",
|
|
4966
|
+
"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` \u2014 a `\"<parent> \u203A <sub-agent>\"` breadcrumb that composes when nested (e.g. `\"UI Builder \u203A Planner \u203A Grounding\"`) \u2014 and interleaved by their original timestamps within the subagent.started\u2192completed/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 \u2014 read its hoisted messages for model/tokens/cost and turn-by-turn activity, and the bracketing subagent.* events for the run's span.",
|
|
5118
4967
|
"`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 \u2014 sessionCostUsd, sessionTokensConsumed, and the four-bucket sessionUsage lifted to the top of this log), activeDebugSnapshot (the active agent's `getDebugSnapshot()` taken fresh at export \u2014 reflects state NOW, which may have advanced beyond the last turn's agentSnapshot), debug (optional host-supplied debug state), host, and the export timestamp.",
|
|
5119
4968
|
"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\u2019s prompt again in the next turn\u2019s and is expected to dwarf the context size \u2014 that is not double-counting.",
|
|
5120
4969
|
"kind:'event' type 'routing.decided' \u2014 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 \u2014 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 \u2014 `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 \u2014 every classifier-eligible specialist \u2014 in ballot order, so `index` \u2014 the classifier's own answer \u2014 indexes it directly. `candidates` is absent on the three decisions that put nothing to a vote \u2014 '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.",
|
|
@@ -5139,10 +4988,23 @@ function frameDelegatedContent(content, framing) {
|
|
|
5139
4988
|
${content}`;
|
|
5140
4989
|
}
|
|
5141
4990
|
|
|
4991
|
+
// src/utils/driver-note.ts
|
|
4992
|
+
var isDriverNote = (message) => !!message.driverNote;
|
|
4993
|
+
var isUserUtterance = (message) => message.role === "user" && !message.driverNote;
|
|
4994
|
+
function finishGuardNoteMessage(note, kind = "finish-guard") {
|
|
4995
|
+
return {
|
|
4996
|
+
role: "user",
|
|
4997
|
+
content: `<system-reminder>
|
|
4998
|
+
${note.trim()}
|
|
4999
|
+
</system-reminder>`,
|
|
5000
|
+
driverNote: kind
|
|
5001
|
+
};
|
|
5002
|
+
}
|
|
5003
|
+
|
|
5142
5004
|
// src/utils/preserved-user-messages.ts
|
|
5143
5005
|
function freshUserMessages(toCompact) {
|
|
5144
5006
|
return toCompact.flatMap(
|
|
5145
|
-
(m) => m
|
|
5007
|
+
(m) => isUserUtterance(m) && m.content?.trim() ? [
|
|
5146
5008
|
{
|
|
5147
5009
|
content: m.content,
|
|
5148
5010
|
...m.timestamp ? { timestamp: m.timestamp } : {},
|
|
@@ -5353,7 +5215,7 @@ Additional guidance: "${prompt2}"` : "";
|
|
|
5353
5215
|
return `Generate exactly ${count} brief starter prompts to show a user what an AI assistant can do. Phrase each one as the user would write it. Keep them short and generic \u2014 do not invent specific names, IDs, or data (e.g. prefer "Search for a trade" over "Find all trades with Client A").` + capabilitiesBlock + guidanceBlock + OUTPUT_FORMAT(count);
|
|
5354
5216
|
}
|
|
5355
5217
|
const conversationContext = history.filter(
|
|
5356
|
-
(m) => reachesProvider(m) && (m.role === "user" || m.role === "assistant") && !m.toolCalls?.length && !m.thinking && !!m.content?.trim()
|
|
5218
|
+
(m) => reachesProvider(m) && !isDriverNote(m) && (m.role === "user" || m.role === "assistant") && !m.toolCalls?.length && !m.thinking && !!m.content?.trim()
|
|
5357
5219
|
).slice(-HISTORY_WINDOW).map(
|
|
5358
5220
|
(m) => m.role === "user" ? `User: ${m.delegate ? frameDelegatedContent(m.content ?? "", m.delegateFraming) : m.content}` : `Assistant: ${m.content}`
|
|
5359
5221
|
).join("\n");
|
|
@@ -5755,6 +5617,7 @@ function renderMessageForSummary(m) {
|
|
|
5755
5617
|
].join("\n");
|
|
5756
5618
|
case "user":
|
|
5757
5619
|
if (!m.content) return "";
|
|
5620
|
+
if (isDriverNote(m)) return `Framework note: ${m.content}`;
|
|
5758
5621
|
return `User: ${m.delegate ? frameDelegatedContent(m.content, m.delegateFraming) : m.content}`;
|
|
5759
5622
|
case "assistant": {
|
|
5760
5623
|
if (m.category === "reasoning") {
|
|
@@ -6201,13 +6064,17 @@ var MAX_EMPTY_RESPONSE_RETRIES = 3;
|
|
|
6201
6064
|
var MALFORMED_CALL_NUDGE = "IMPORTANT: Use only the structured function-call API to invoke tools. Do not write Python code or use Python-style syntax to call tools.";
|
|
6202
6065
|
var 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.";
|
|
6203
6066
|
var MAX_SETUP_TRANSPORT_RETRIES = 3;
|
|
6067
|
+
var MAX_SUB_AGENT_COMPLETION_NUDGES = 2;
|
|
6068
|
+
var 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.";
|
|
6204
6069
|
var HARVESTED_SUBAGENT_EVENTS = /* @__PURE__ */ new Set([
|
|
6205
6070
|
"turn.retry",
|
|
6206
6071
|
"turn.error",
|
|
6207
6072
|
"tool.failed",
|
|
6208
|
-
"tool.unresolved"
|
|
6073
|
+
"tool.unresolved",
|
|
6074
|
+
// A sub-agent held open by its finish guard or the completion nudge: otherwise invisible in the
|
|
6075
|
+
// parent's log, which shows only the hoisted messages.
|
|
6076
|
+
"turn.finish-guard"
|
|
6209
6077
|
]);
|
|
6210
|
-
var NO_TOOL_CALL_NUDGE = "IMPORTANT: Your previous reply ended without calling a tool, but this task can only be finished by calling one. Call the tool now; do not reply with text alone.";
|
|
6211
6078
|
|
|
6212
6079
|
// src/utils/tool-fold.ts
|
|
6213
6080
|
var TOOL_FOLD_SYMBOL = Symbol("toolFold");
|
|
@@ -8911,6 +8778,7 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
8911
8778
|
this.activeResponseSchemaInput = config.responseSchema;
|
|
8912
8779
|
this.activeFallbacks = config.fallbacks;
|
|
8913
8780
|
this.activeOnUnresolvedTool = config.onUnresolvedTool;
|
|
8781
|
+
this.activeFinishGuard = config.finishGuard;
|
|
8914
8782
|
this.resolvedProviderCache.clear();
|
|
8915
8783
|
this.lastResolvedProviderName = void 0;
|
|
8916
8784
|
if (typeof config.provider === "string") {
|
|
@@ -8946,6 +8814,54 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
8946
8814
|
return fallback;
|
|
8947
8815
|
}
|
|
8948
8816
|
}
|
|
8817
|
+
/**
|
|
8818
|
+
* Consult the active agent's `finishGuard` hook (U1) after a reply with no tool call. Returns the
|
|
8819
|
+
* verdict, normalised: `undefined` when there is no hook, it answered nothing, it threw, or it
|
|
8820
|
+
* answered `'continue'` with a blank note (nothing to tell the model, so nothing to hold for). A
|
|
8821
|
+
* misbehaving hook can never break the turn: it ends as if there were no hook.
|
|
8822
|
+
*/
|
|
8823
|
+
async consultFinishGuard(ctx) {
|
|
8824
|
+
if (typeof this.activeFinishGuard !== "function") return void 0;
|
|
8825
|
+
try {
|
|
8826
|
+
const verdict = await this.activeFinishGuard(ctx);
|
|
8827
|
+
if (verdict?.action === "continue") {
|
|
8828
|
+
if (typeof verdict.note === "string" && verdict.note.trim().length > 0) return verdict;
|
|
8829
|
+
logger2.warn(
|
|
8830
|
+
`ChatDriver(${this.activeAgentName ?? "unknown"}): finishGuard answered 'continue' with no note \u2014 ending the turn`
|
|
8831
|
+
);
|
|
8832
|
+
return void 0;
|
|
8833
|
+
}
|
|
8834
|
+
return verdict?.action === "end" ? verdict : void 0;
|
|
8835
|
+
} catch (e) {
|
|
8836
|
+
logger2.warn(
|
|
8837
|
+
`ChatDriver(${this.activeAgentName ?? "unknown"}): finishGuard threw \u2014 ending the turn`,
|
|
8838
|
+
e
|
|
8839
|
+
);
|
|
8840
|
+
return void 0;
|
|
8841
|
+
}
|
|
8842
|
+
}
|
|
8843
|
+
/**
|
|
8844
|
+
* Act on a finish guard's `{ action: 'end', release: true }` (U5): the same release a tool handler's
|
|
8845
|
+
* `releaseAgent()` asks for, for a turn that ended in prose and so had no handler context to call
|
|
8846
|
+
* it from. Subject to the same guards: not after a hand-off, not twice, and not on a sub-agent,
|
|
8847
|
+
* which owns no flow lock (it ends with `completeSubAgent`). Returns whether it released.
|
|
8848
|
+
*/
|
|
8849
|
+
requestReleaseFromFinishGuard() {
|
|
8850
|
+
const who = this.activeAgentName ?? "unknown";
|
|
8851
|
+
if (this.isSubAgent) {
|
|
8852
|
+
logger2.warn(`ChatDriver(${who}): finishGuard asked to release a sub-agent \u2014 ignoring`);
|
|
8853
|
+
return false;
|
|
8854
|
+
}
|
|
8855
|
+
if (this.handOffRequested || this.agentReleaseRequested) return false;
|
|
8856
|
+
this.agentReleaseRequested = true;
|
|
8857
|
+
this.currentActivation += 1;
|
|
8858
|
+
recordMetaEvent(this.sessionKey, "turn.finish-guard", {
|
|
8859
|
+
action: "end",
|
|
8860
|
+
agent: who,
|
|
8861
|
+
release: true
|
|
8862
|
+
});
|
|
8863
|
+
return true;
|
|
8864
|
+
}
|
|
8949
8865
|
/**
|
|
8950
8866
|
* Returns the most recently resolved provider name. Falls back to the
|
|
8951
8867
|
* registry's default when no per-turn resolution has happened yet.
|
|
@@ -10219,13 +10135,14 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
10219
10135
|
let iterations = 0;
|
|
10220
10136
|
let malformedAttempts = 0;
|
|
10221
10137
|
let emptyResponseAttempts = 0;
|
|
10222
|
-
let noToolCallRetried = false;
|
|
10223
|
-
let noToolCallNudgePending = false;
|
|
10224
10138
|
let setupTransportAttempts = 0;
|
|
10225
10139
|
let firstLlmCall = !!currentInput;
|
|
10226
10140
|
let pinnedThinkingPolicy;
|
|
10227
10141
|
let thinkingPolicyPinned = false;
|
|
10228
10142
|
let closingCallMade = false;
|
|
10143
|
+
let finishGuardContinuations = 0;
|
|
10144
|
+
let completionNudges = 0;
|
|
10145
|
+
let releasedByFinishGuard = false;
|
|
10229
10146
|
while (iterations < this.maxToolIterations || this.closingCallNote() && !closingCallMade) {
|
|
10230
10147
|
iterations += 1;
|
|
10231
10148
|
this.modelCallSeq += 1;
|
|
@@ -10273,9 +10190,7 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
10273
10190
|
|
|
10274
10191
|
${MALFORMED_CALL_NUDGE}` : emptyResponseAttempts > 0 ? `
|
|
10275
10192
|
|
|
10276
|
-
${EMPTY_RESPONSE_NUDGE}` :
|
|
10277
|
-
|
|
10278
|
-
${NO_TOOL_CALL_NUDGE}` : "";
|
|
10193
|
+
${EMPTY_RESPONSE_NUDGE}` : "";
|
|
10279
10194
|
const firstCallNote = tailNote && iterations === 1 ? `
|
|
10280
10195
|
|
|
10281
10196
|
${tailNote}` : "";
|
|
@@ -10632,28 +10547,58 @@ ${tailBody}
|
|
|
10632
10547
|
emptyResponseAttempts = 0;
|
|
10633
10548
|
malformedAttempts = 0;
|
|
10634
10549
|
setupTransportAttempts = 0;
|
|
10635
|
-
noToolCallNudgePending = false;
|
|
10636
10550
|
if (closing) return turnDone();
|
|
10637
10551
|
if (!response.toolCalls?.length) {
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10552
|
+
const canContinue = iterations < this.maxToolIterations;
|
|
10553
|
+
const guarded = typeof this.activeFinishGuard === "function" && !this.agentReleaseRequested && !this.handOffRequested;
|
|
10554
|
+
const verdict = guarded ? (
|
|
10555
|
+
// oxlint-disable-next-line no-await-in-loop
|
|
10556
|
+
await this.consultFinishGuard({
|
|
10557
|
+
...promptCtx,
|
|
10558
|
+
history: this.history,
|
|
10559
|
+
reply: response.content ?? "",
|
|
10560
|
+
continuations: finishGuardContinuations,
|
|
10561
|
+
canContinue
|
|
10562
|
+
})
|
|
10563
|
+
) : void 0;
|
|
10564
|
+
if (guarded && this.turnController.signal.aborted) {
|
|
10565
|
+
return this.completeAbortedTurn();
|
|
10566
|
+
}
|
|
10567
|
+
if (verdict?.action === "continue" && canContinue) {
|
|
10568
|
+
finishGuardContinuations += 1;
|
|
10569
|
+
recordMetaEvent(this.sessionKey, "turn.finish-guard", {
|
|
10570
|
+
action: "continue",
|
|
10571
|
+
agent: this.activeAgentName,
|
|
10572
|
+
continuation: finishGuardContinuations,
|
|
10573
|
+
note: verdict.note
|
|
10574
|
+
});
|
|
10575
|
+
this.appendToHistory(finishGuardNoteMessage(verdict.note));
|
|
10576
|
+
continue;
|
|
10577
|
+
}
|
|
10578
|
+
if (verdict?.action === "continue") {
|
|
10641
10579
|
logger2.warn(
|
|
10642
|
-
"
|
|
10580
|
+
`ChatDriver(${this.activeAgentName ?? "unknown"}): finishGuard answered 'continue' on the last tool-loop iteration \u2014 ending the turn`
|
|
10643
10581
|
);
|
|
10644
|
-
|
|
10645
|
-
|
|
10582
|
+
}
|
|
10583
|
+
if (this.isSubAgent && verdict === void 0 && canContinue && completionNudges < MAX_SUB_AGENT_COMPLETION_NUDGES) {
|
|
10584
|
+
completionNudges += 1;
|
|
10585
|
+
recordMetaEvent(this.sessionKey, "turn.finish-guard", {
|
|
10586
|
+
action: "continue",
|
|
10587
|
+
source: "completion-nudge",
|
|
10646
10588
|
agent: this.activeAgentName,
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
maxAttempts: 1
|
|
10589
|
+
nudge: completionNudges,
|
|
10590
|
+
maxNudges: MAX_SUB_AGENT_COMPLETION_NUDGES
|
|
10650
10591
|
});
|
|
10651
|
-
|
|
10592
|
+
this.appendToHistory(
|
|
10593
|
+
finishGuardNoteMessage(SUB_AGENT_COMPLETION_NUDGE, "completion-nudge")
|
|
10594
|
+
);
|
|
10652
10595
|
continue;
|
|
10653
10596
|
}
|
|
10597
|
+
if (verdict?.action === "end" && verdict.release) {
|
|
10598
|
+
releasedByFinishGuard = this.requestReleaseFromFinishGuard();
|
|
10599
|
+
}
|
|
10654
10600
|
break;
|
|
10655
10601
|
}
|
|
10656
|
-
noToolCallRetried = false;
|
|
10657
10602
|
const toolCalls = response.toolCalls;
|
|
10658
10603
|
const executedById = /* @__PURE__ */ new Map();
|
|
10659
10604
|
const unknownToolIds = /* @__PURE__ */ new Set();
|
|
@@ -10922,7 +10867,7 @@ RECOVERY: this tool failed once \u2014 you may retry it, or take a different val
|
|
|
10922
10867
|
return turnDone();
|
|
10923
10868
|
}
|
|
10924
10869
|
}
|
|
10925
|
-
if (iterations >= this.maxToolIterations) {
|
|
10870
|
+
if (iterations >= this.maxToolIterations && !releasedByFinishGuard) {
|
|
10926
10871
|
logger2.warn("ChatDriver: reached max tool iterations, stopping");
|
|
10927
10872
|
recordTurnError(this.sessionKey, "max-iterations", {
|
|
10928
10873
|
agent: this.activeAgentName,
|
|
@@ -11960,7 +11905,7 @@ var OrchestratingDriver = class _OrchestratingDriver extends BaseDriverDecorator
|
|
|
11960
11905
|
* message count — see the `CLASSIFIER_MESSAGE_CHARS` docblock for why.
|
|
11961
11906
|
*/
|
|
11962
11907
|
classifierTranscript(history) {
|
|
11963
|
-
const lines = history.filter((m) => (m.role === "user" || m.role === "assistant") && reachesProvider(m)).filter((m) => !!m.content?.trim()).slice(-this.classifierHistoryLength).map((m) => {
|
|
11908
|
+
const lines = history.filter((m) => (m.role === "user" || m.role === "assistant") && reachesProvider(m)).filter((m) => !isDriverNote(m)).filter((m) => !!m.content?.trim()).slice(-this.classifierHistoryLength).map((m) => {
|
|
11964
11909
|
const speaker = m.role === "user" ? "User" : "Assistant";
|
|
11965
11910
|
const content = m.role === "user" && m.delegate ? frameDelegatedContent(m.content ?? "", m.delegateFraming) : m.content ?? "";
|
|
11966
11911
|
const body = content.length > CLASSIFIER_MESSAGE_CHARS ? `${content.slice(0, CLASSIFIER_MESSAGE_CHARS)}\u2026` : content;
|
|
@@ -12234,6 +12179,14 @@ function restoreMachine(machine, restored, key = "machine") {
|
|
|
12234
12179
|
machine.stop();
|
|
12235
12180
|
machine.start({ state: snapshot });
|
|
12236
12181
|
}
|
|
12182
|
+
function bindStateOrDefault(hook, getState) {
|
|
12183
|
+
if (typeof hook !== "function") return void 0;
|
|
12184
|
+
return async (ctx) => {
|
|
12185
|
+
const state = getState();
|
|
12186
|
+
if (!state) return void 0;
|
|
12187
|
+
return hook({ ...ctx, state });
|
|
12188
|
+
};
|
|
12189
|
+
}
|
|
12237
12190
|
function defineStatefulAgent(opts) {
|
|
12238
12191
|
let state;
|
|
12239
12192
|
const assertNoFolds = (handlers) => {
|
|
@@ -12314,12 +12267,14 @@ function defineStatefulAgent(opts) {
|
|
|
12314
12267
|
state
|
|
12315
12268
|
});
|
|
12316
12269
|
} : opts.tailContext;
|
|
12317
|
-
const wrappedOnUnresolvedTool =
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12270
|
+
const wrappedOnUnresolvedTool = bindStateOrDefault(
|
|
12271
|
+
opts.onUnresolvedTool,
|
|
12272
|
+
() => state
|
|
12273
|
+
);
|
|
12274
|
+
const wrappedFinishGuard = bindStateOrDefault(
|
|
12275
|
+
opts.finishGuard,
|
|
12276
|
+
() => state
|
|
12277
|
+
);
|
|
12323
12278
|
const wrappedResumable = opts.resumable ? async (ctx) => {
|
|
12324
12279
|
if (state === void 0) return true;
|
|
12325
12280
|
return opts.resumable({
|
|
@@ -12346,6 +12301,7 @@ function defineStatefulAgent(opts) {
|
|
|
12346
12301
|
thinkingPolicy: wrappedThinkingPolicy,
|
|
12347
12302
|
tailContext: wrappedTailContext,
|
|
12348
12303
|
onUnresolvedTool: wrappedOnUnresolvedTool,
|
|
12304
|
+
finishGuard: wrappedFinishGuard,
|
|
12349
12305
|
resumable: wrappedResumable,
|
|
12350
12306
|
notResumableMessage: opts.notResumableMessage,
|
|
12351
12307
|
resumeOnRestore: opts.resumeOnRestore,
|
|
@@ -12453,6 +12409,9 @@ function filterVisibleMessages(messages, toggles) {
|
|
|
12453
12409
|
if (m.role === "system-event") {
|
|
12454
12410
|
return isSessionNoticeMarker(m) ? toggles.showRestoreNotices : toggles.showAgentSwitchIndicator;
|
|
12455
12411
|
}
|
|
12412
|
+
if (isDriverNote(m)) {
|
|
12413
|
+
return false;
|
|
12414
|
+
}
|
|
12456
12415
|
if (m.role === "tool") {
|
|
12457
12416
|
return false;
|
|
12458
12417
|
}
|
|
@@ -12631,6 +12590,7 @@ function visibleTranscript(messages, opts) {
|
|
|
12631
12590
|
);
|
|
12632
12591
|
return;
|
|
12633
12592
|
}
|
|
12593
|
+
if (isDriverNote(m)) return;
|
|
12634
12594
|
if ((m.role === "user" || m.role === "synthetic-user") && m.content?.trim()) {
|
|
12635
12595
|
lines.push(m.delegate ? `User (on their behalf): ${m.content}` : `User: ${m.content}`);
|
|
12636
12596
|
return;
|
|
@@ -13792,7 +13752,6 @@ export {
|
|
|
13792
13752
|
ANTHROPIC_CACHE_READ_MULTIPLIER,
|
|
13793
13753
|
ANTHROPIC_CACHE_WRITE_1H_MULTIPLIER,
|
|
13794
13754
|
ANTHROPIC_CACHE_WRITE_5M_MULTIPLIER,
|
|
13795
|
-
ANTHROPIC_LONG_CONTEXT_THRESHOLD,
|
|
13796
13755
|
AgenticActivityBus,
|
|
13797
13756
|
AnthropicProvider,
|
|
13798
13757
|
AnthropicTransport,
|
|
@@ -13826,7 +13785,6 @@ export {
|
|
|
13826
13785
|
agenticActivityBus,
|
|
13827
13786
|
aiServiceAccessRefusalOf,
|
|
13828
13787
|
aiServiceErrorCodeOf,
|
|
13829
|
-
anthropicCacheReadMultiplierFor,
|
|
13830
13788
|
anthropicRatesFor,
|
|
13831
13789
|
anthropicTokenCost,
|
|
13832
13790
|
assembleDebugLog,
|