open-multi-agent-kit 0.90.4 → 0.90.6
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/CHANGELOG.md +54 -0
- package/README.md +9 -9
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/codexbar-cli.d.ts +39 -0
- package/dist/codexbar-cli.d.ts.map +1 -0
- package/dist/codexbar-cli.js +230 -0
- package/dist/codexbar-cli.js.map +1 -0
- package/dist/commands/doctor-provider.d.ts.map +1 -1
- package/dist/commands/doctor-provider.js +16 -3
- package/dist/commands/doctor-provider.js.map +1 -1
- package/dist/core/adaptorch-bridge.d.ts +14 -21
- package/dist/core/adaptorch-bridge.d.ts.map +1 -1
- package/dist/core/adaptorch-bridge.js +11 -18
- package/dist/core/adaptorch-bridge.js.map +1 -1
- package/dist/core/agent-session.d.ts +6 -39
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +37 -107
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/codexbar-adapter.d.ts +44 -0
- package/dist/core/codexbar-adapter.d.ts.map +1 -0
- package/dist/core/codexbar-adapter.js +211 -0
- package/dist/core/codexbar-adapter.js.map +1 -0
- package/dist/core/compaction/index.d.ts +2 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +2 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/model-policy.d.ts +9 -0
- package/dist/core/compaction/model-policy.d.ts.map +1 -0
- package/dist/core/compaction/model-policy.js +37 -0
- package/dist/core/compaction/model-policy.js.map +1 -0
- package/dist/core/compaction/resume-policy.d.ts +6 -0
- package/dist/core/compaction/resume-policy.d.ts.map +1 -0
- package/dist/core/compaction/resume-policy.js +8 -0
- package/dist/core/compaction/resume-policy.js.map +1 -0
- package/dist/core/context-budget-v2-planner.d.ts.map +1 -1
- package/dist/core/context-budget-v2-planner.js +10 -2
- package/dist/core/context-budget-v2-planner.js.map +1 -1
- package/dist/core/context-budget-v2-types.d.ts +7 -1
- package/dist/core/context-budget-v2-types.d.ts.map +1 -1
- package/dist/core/context-budget-v2-types.js.map +1 -1
- package/dist/core/domain-loadouts.d.ts.map +1 -1
- package/dist/core/domain-loadouts.js +68 -1
- package/dist/core/domain-loadouts.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +12 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +3 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +15 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/grok-harness-dispatch.d.ts +22 -0
- package/dist/core/grok-harness-dispatch.d.ts.map +1 -0
- package/dist/core/grok-harness-dispatch.js +44 -0
- package/dist/core/grok-harness-dispatch.js.map +1 -0
- package/dist/core/grok-harness.d.ts +25 -0
- package/dist/core/grok-harness.d.ts.map +1 -0
- package/dist/core/grok-harness.js +61 -0
- package/dist/core/grok-harness.js.map +1 -0
- package/dist/core/grok-playbook.d.ts +7 -0
- package/dist/core/grok-playbook.d.ts.map +1 -0
- package/dist/core/grok-playbook.js +34 -0
- package/dist/core/grok-playbook.js.map +1 -0
- package/dist/core/reasoning-router-bias.d.ts +11 -23
- package/dist/core/reasoning-router-bias.d.ts.map +1 -1
- package/dist/core/reasoning-router-bias.js +9 -18
- package/dist/core/reasoning-router-bias.js.map +1 -1
- package/dist/core/reasoning-router-resolver.d.ts +44 -0
- package/dist/core/reasoning-router-resolver.d.ts.map +1 -0
- package/dist/core/reasoning-router-resolver.js +79 -0
- package/dist/core/reasoning-router-resolver.js.map +1 -0
- package/dist/core/reasoning-router-v4-weights.d.ts +28 -72
- package/dist/core/reasoning-router-v4-weights.d.ts.map +1 -1
- package/dist/core/reasoning-router-v4-weights.js +16 -60
- package/dist/core/reasoning-router-v4-weights.js.map +1 -1
- package/dist/core/reasoning-router-v4.d.ts +25 -70
- package/dist/core/reasoning-router-v4.d.ts.map +1 -1
- package/dist/core/reasoning-router-v4.js +46 -144
- package/dist/core/reasoning-router-v4.js.map +1 -1
- package/dist/core/router-feedback-collector.d.ts +13 -16
- package/dist/core/router-feedback-collector.d.ts.map +1 -1
- package/dist/core/router-feedback-collector.js +5 -8
- package/dist/core/router-feedback-collector.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +31 -12
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +16 -98
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +3 -2
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +42 -17
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/correctness-wall.md +117 -0
- package/docs/grok-harness.md +63 -0
- package/docs/loadout-domains/README.md +2 -1
- package/docs/loadout-domains/ai-agent-ops.md +8 -1
- package/docs/loadout-domains/grok-harness.md +74 -0
- package/docs/providers.md +4 -0
- package/docs/usage.md +11 -12
- package/examples/extensions/correctness-wall/LOADOUT.md +87 -0
- package/examples/extensions/correctness-wall/README.md +111 -0
- package/examples/extensions/correctness-wall/adjudication-fixture.ts +151 -0
- package/examples/extensions/correctness-wall/index.ts +470 -0
- package/examples/extensions/correctness-wall/repair-state.ts +77 -0
- package/examples/extensions/correctness-wall/wall-cache.ts +81 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/agent-capability-router.test.ts +123 -0
- package/examples/extensions/subagent/agent-capability-router.ts +274 -0
- package/examples/extensions/subagent/agents/planner.md +3 -0
- package/examples/extensions/subagent/agents/reviewer.md +3 -0
- package/examples/extensions/subagent/agents/scout.md +3 -0
- package/examples/extensions/subagent/agents/worker.md +2 -0
- package/examples/extensions/subagent/agents.ts +14 -0
- package/examples/extensions/subagent/capabilities.ts +368 -0
- package/examples/extensions/subagent/domain-profiles.ts +1089 -0
- package/examples/extensions/subagent/index.ts +71 -3
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/12-full-control.ts +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +5 -5
- package/dist/core/compactor.d.ts +0 -42
- package/dist/core/compactor.d.ts.map +0 -1
- package/dist/core/compactor.js +0 -128
- package/dist/core/compactor.js.map +0 -1
- package/dist/core/reasoning-router-v2.d.ts +0 -94
- package/dist/core/reasoning-router-v2.d.ts.map +0 -1
- package/dist/core/reasoning-router-v2.js +0 -288
- package/dist/core/reasoning-router-v2.js.map +0 -1
- package/dist/core/reasoning-router-v3.d.ts +0 -15
- package/dist/core/reasoning-router-v3.d.ts.map +0 -1
- package/dist/core/reasoning-router-v3.js +0 -193
- package/dist/core/reasoning-router-v3.js.map +0 -1
- package/dist/core/reasoning-router-weights.d.ts +0 -155
- package/dist/core/reasoning-router-weights.d.ts.map +0 -1
- package/dist/core/reasoning-router-weights.js +0 -204
- package/dist/core/reasoning-router-weights.js.map +0 -1
- package/dist/core/reasoning-router.d.ts +0 -44
- package/dist/core/reasoning-router.d.ts.map +0 -1
- package/dist/core/reasoning-router.js +0 -138
- package/dist/core/reasoning-router.js.map +0 -1
- package/dist/core/token-optimizer.d.ts +0 -58
- package/dist/core/token-optimizer.d.ts.map +0 -1
- package/dist/core/token-optimizer.js +0 -179
- package/dist/core/token-optimizer.js.map +0 -1
|
@@ -23,19 +23,19 @@ import { formatNoApiKeyFoundMessage, formatNoModelSelectedMessage } from "./auth
|
|
|
23
23
|
import { parseBangInvocation } from "./bang-skill-invocation.js";
|
|
24
24
|
import { executeBashWithOperations } from "./bash-executor.js";
|
|
25
25
|
import { classifyShellCommand } from "./command-safety.js";
|
|
26
|
-
import { calculateContextTokens, collectEntriesForBranchSummary, compact, estimateContextTokens, estimateProjectedContextTokens, generateBranchSummary, prepareCompaction, shouldCompact, } from "./compaction/index.js";
|
|
26
|
+
import { calculateContextTokens, collectEntriesForBranchSummary, compact, estimateContextTokens, estimateProjectedContextTokens, generateBranchSummary, prepareCompaction, resolveCompactionModel, shouldCompact, } from "./compaction/index.js";
|
|
27
|
+
import { compactionEmitWillRetry } from "./compaction/resume-policy.js";
|
|
27
28
|
import { DEFAULT_THINKING_LEVEL } from "./defaults.js";
|
|
28
29
|
import { exportSessionToHtml } from "./export-html/index.js";
|
|
29
30
|
import { createToolHtmlRenderer } from "./export-html/tool-renderer.js";
|
|
30
31
|
import { buildBlockedBashResult, evaluateCommandGate, isCommandSafetyAssumeYesEnabled, } from "./extensions/builtin/command-safety-gate.js";
|
|
31
32
|
import { ExtensionRunner, wrapRegisteredTools, } from "./extensions/index.js";
|
|
32
33
|
import { emitSessionShutdownEvent } from "./extensions/runner.js";
|
|
34
|
+
import { assertTextChatModelForCompletion } from "./grok-harness.js";
|
|
35
|
+
import { grokPlaybookAppendForProvider } from "./grok-playbook.js";
|
|
33
36
|
import { assertLoadoutAccess, decideLoadoutAccess } from "./loadout-access-policy.js";
|
|
34
37
|
import { expandPromptTemplate } from "./prompt-templates.js";
|
|
35
|
-
import { classifyTask, resolveThinkingLevel } from "./reasoning-router.js";
|
|
36
38
|
import { getBiasStepsForCell, getDefaultRouterBiasSnapshotPath, parseRouterBiasSnapshot, } from "./reasoning-router-bias.js";
|
|
37
|
-
import { classifyTaskV2, DEFAULT_WEIGHTS, resolveThinkingLevelV2ForAuto, } from "./reasoning-router-v2.js";
|
|
38
|
-
import { classifyTaskV3, resolveThinkingLevelV3ForAuto } from "./reasoning-router-v3.js";
|
|
39
39
|
import { classifyTaskV4, resolveThinkingLevelV4WithUncertainty } from "./reasoning-router-v4.js";
|
|
40
40
|
import { appendRouterFeedbackRecord, } from "./router-feedback-collector.js";
|
|
41
41
|
import { detectSandboxBackend } from "./sandbox/backend.js";
|
|
@@ -109,18 +109,9 @@ export class AgentSession {
|
|
|
109
109
|
* auto-resolved levels are never written to the user's persisted settings.
|
|
110
110
|
*/
|
|
111
111
|
_thinkingMode = "manual";
|
|
112
|
-
/**
|
|
113
|
-
* Reasoning router version used by auto thinking mode. "v1" (default) keeps
|
|
114
|
-
* the frozen v1 classifyTask/resolveThinkingLevel; "v2" uses the Goal 004
|
|
115
|
-
* weighted router; "v3" uses the Goal 007 calibrated classifier; "v4" uses
|
|
116
|
-
* the Goal 009 confidence-bearing classifier (classifyTaskV4 +
|
|
117
|
-
* resolveThinkingLevelV4WithUncertainty). Default "v1" so behavior is
|
|
118
|
-
* unchanged until explicitly opted in.
|
|
119
|
-
*/
|
|
120
|
-
_thinkingRouterVersion = "v1";
|
|
121
112
|
/**
|
|
122
113
|
* N=8 ring buffer of recent auto-turn task classes (newest first), feeding
|
|
123
|
-
*
|
|
114
|
+
* v4's multi-turn prior feature. Never persisted to settings.
|
|
124
115
|
*/
|
|
125
116
|
_taskClassHistory = [];
|
|
126
117
|
/**
|
|
@@ -837,7 +828,12 @@ export class AgentSession {
|
|
|
837
828
|
}
|
|
838
829
|
const loaderSystemPrompt = this._resourceLoader.getSystemPrompt();
|
|
839
830
|
const loaderAppendSystemPrompt = this._resourceLoader.getAppendSystemPrompt();
|
|
840
|
-
const
|
|
831
|
+
const grokAppend = grokPlaybookAppendForProvider(this.model?.provider);
|
|
832
|
+
const appendParts = [...loaderAppendSystemPrompt];
|
|
833
|
+
if (grokAppend) {
|
|
834
|
+
appendParts.push(grokAppend);
|
|
835
|
+
}
|
|
836
|
+
const appendSystemPrompt = appendParts.length > 0 ? appendParts.join("\n\n") : undefined;
|
|
841
837
|
const loadedSkills = this._resourceLoader.getSkills().skills;
|
|
842
838
|
const loadedContextFiles = this._resourceLoader.getAgentsFiles().agentsFiles;
|
|
843
839
|
this._baseSystemPromptOptions = {
|
|
@@ -972,6 +968,8 @@ export class AgentSession {
|
|
|
972
968
|
if (!this.model) {
|
|
973
969
|
throw new Error(formatNoModelSelectedMessage());
|
|
974
970
|
}
|
|
971
|
+
// Grok OAuth: refuse Imagine ids on the chat/completions path (tool-only).
|
|
972
|
+
assertTextChatModelForCompletion(this.model.id, this.model.provider);
|
|
975
973
|
if (!this._modelRegistry.hasConfiguredAuth(this.model)) {
|
|
976
974
|
const isOAuth = this._modelRegistry.isUsingOAuth(this.model);
|
|
977
975
|
if (isOAuth) {
|
|
@@ -1330,6 +1328,8 @@ export class AgentSession {
|
|
|
1330
1328
|
if (!this._modelRegistry.hasConfiguredAuth(model)) {
|
|
1331
1329
|
throw new Error(`No API key for ${model.provider}/${model.id}`);
|
|
1332
1330
|
}
|
|
1331
|
+
// Grok OAuth: block selecting Imagine models as the session chat model.
|
|
1332
|
+
assertTextChatModelForCompletion(model.id, model.provider);
|
|
1333
1333
|
const previousModel = this.model;
|
|
1334
1334
|
const thinkingLevel = this._getThinkingLevelForModelSwitch();
|
|
1335
1335
|
this.agent.state.model = model;
|
|
@@ -1431,18 +1431,6 @@ export class AgentSession {
|
|
|
1431
1431
|
setThinkingMode(mode) {
|
|
1432
1432
|
this._thinkingMode = mode;
|
|
1433
1433
|
}
|
|
1434
|
-
/**
|
|
1435
|
-
* Reasoning router version selection for auto thinking mode.
|
|
1436
|
-
* Default "v1". Switching to "v2", "v3", or "v4" activates the
|
|
1437
|
-
* corresponding opt-in router; the multi-turn history buffer is only
|
|
1438
|
-
* consulted there.
|
|
1439
|
-
*/
|
|
1440
|
-
get thinkingRouterVersion() {
|
|
1441
|
-
return this._thinkingRouterVersion;
|
|
1442
|
-
}
|
|
1443
|
-
setThinkingRouterVersion(version) {
|
|
1444
|
-
this._thinkingRouterVersion = version;
|
|
1445
|
-
}
|
|
1446
1434
|
/**
|
|
1447
1435
|
* In auto thinking mode, resolve and apply this turn's thinking level from the
|
|
1448
1436
|
* prompt content. Updates agent state, records the change in the session, and
|
|
@@ -1455,79 +1443,12 @@ export class AgentSession {
|
|
|
1455
1443
|
return;
|
|
1456
1444
|
if (!this.supportsThinking())
|
|
1457
1445
|
return;
|
|
1458
|
-
|
|
1459
|
-
this._applyAutoThinkingLevelV4(promptText);
|
|
1460
|
-
return;
|
|
1461
|
-
}
|
|
1462
|
-
if (this._thinkingRouterVersion === "v3") {
|
|
1463
|
-
this._applyAutoThinkingLevelV3(promptText);
|
|
1464
|
-
return;
|
|
1465
|
-
}
|
|
1466
|
-
if (this._thinkingRouterVersion === "v2") {
|
|
1467
|
-
this._applyAutoThinkingLevelV2(promptText);
|
|
1468
|
-
return;
|
|
1469
|
-
}
|
|
1470
|
-
const taskClass = classifyTask({ prompt: promptText });
|
|
1471
|
-
const resolved = resolveThinkingLevel(taskClass, this.getAvailableThinkingLevels());
|
|
1472
|
-
const previousLevel = this.agent.state.thinkingLevel;
|
|
1473
|
-
if (resolved === previousLevel)
|
|
1474
|
-
return;
|
|
1475
|
-
this.agent.state.thinkingLevel = resolved;
|
|
1476
|
-
this.sessionManager.appendThinkingLevelChange(resolved);
|
|
1477
|
-
this._emit({ type: "thinking_level_changed", level: resolved });
|
|
1478
|
-
}
|
|
1479
|
-
/**
|
|
1480
|
-
* v2 auto-mode resolver (Goal 004). Builds the caller-side features the pure
|
|
1481
|
-
* classifier cannot reach on its own (multi-turn ring buffer, context-pressure
|
|
1482
|
-
* bucket), then applies classifyTaskV2 + resolveThinkingLevelV2ForAuto. The
|
|
1483
|
-
* resolved class is pushed to the N=8 history for the NEXT turn's prior.
|
|
1484
|
-
*/
|
|
1485
|
-
_applyAutoThinkingLevelV2(promptText) {
|
|
1486
|
-
const availableLevels = this.getAvailableThinkingLevels();
|
|
1487
|
-
const taskClass = classifyTaskV2({
|
|
1488
|
-
prompt: promptText,
|
|
1489
|
-
history: this._taskClassHistory,
|
|
1490
|
-
pressureBucket: this._computePressureBucket(),
|
|
1491
|
-
}, DEFAULT_WEIGHTS);
|
|
1492
|
-
this._taskClassHistory.unshift(taskClass);
|
|
1493
|
-
if (this._taskClassHistory.length > 8)
|
|
1494
|
-
this._taskClassHistory.length = 8;
|
|
1495
|
-
const resolved = resolveThinkingLevelV2ForAuto(taskClass, availableLevels, undefined);
|
|
1496
|
-
const previousLevel = this.agent.state.thinkingLevel;
|
|
1497
|
-
if (resolved === previousLevel)
|
|
1498
|
-
return;
|
|
1499
|
-
this.agent.state.thinkingLevel = resolved;
|
|
1500
|
-
this.sessionManager.appendThinkingLevelChange(resolved);
|
|
1501
|
-
this._emit({ type: "thinking_level_changed", level: resolved });
|
|
1502
|
-
}
|
|
1503
|
-
/**
|
|
1504
|
-
* v3 auto-mode resolver (Goal 007). Reuses the same N=8 recent-class history
|
|
1505
|
-
* and context-pressure bucket as v2, but routes through the v3 classifier and
|
|
1506
|
-
* resolver pair.
|
|
1507
|
-
*/
|
|
1508
|
-
_applyAutoThinkingLevelV3(promptText) {
|
|
1509
|
-
const availableLevels = this.getAvailableThinkingLevels();
|
|
1510
|
-
const taskClass = classifyTaskV3({
|
|
1511
|
-
prompt: promptText,
|
|
1512
|
-
history: this._taskClassHistory,
|
|
1513
|
-
pressureBucket: this._computePressureBucket(),
|
|
1514
|
-
});
|
|
1515
|
-
this._taskClassHistory.unshift(taskClass);
|
|
1516
|
-
if (this._taskClassHistory.length > 8)
|
|
1517
|
-
this._taskClassHistory.length = 8;
|
|
1518
|
-
const resolved = resolveThinkingLevelV3ForAuto(taskClass, availableLevels, undefined);
|
|
1519
|
-
const previousLevel = this.agent.state.thinkingLevel;
|
|
1520
|
-
if (resolved === previousLevel)
|
|
1521
|
-
return;
|
|
1522
|
-
this.agent.state.thinkingLevel = resolved;
|
|
1523
|
-
this.sessionManager.appendThinkingLevelChange(resolved);
|
|
1524
|
-
this._emit({ type: "thinking_level_changed", level: resolved });
|
|
1446
|
+
this._applyAutoThinkingLevelV4(promptText);
|
|
1525
1447
|
}
|
|
1526
1448
|
/**
|
|
1527
|
-
*
|
|
1528
|
-
*
|
|
1529
|
-
*
|
|
1530
|
-
* confidence-bearing v4 classifier and its uncertainty-aware resolver. No
|
|
1449
|
+
* Auto-mode resolver. Reuses the N=8 recent-class history and
|
|
1450
|
+
* context-pressure bucket, routed through the confidence-bearing v4 classifier
|
|
1451
|
+
* and its uncertainty-aware resolver. No
|
|
1531
1452
|
* `laneType` applies to the main session (always "none"/`undefined`);
|
|
1532
1453
|
* `hint` is permanently `null` -- the Adaptorch advisory bridge has no
|
|
1533
1454
|
* transport wired into the session (out of this lane's scope; see
|
|
@@ -1626,9 +1547,8 @@ export class AgentSession {
|
|
|
1626
1547
|
* Locally derives the same three bounded, privacy-safe feedback-ledger
|
|
1627
1548
|
* features (`lenBucket`, `hadFence`, `hadDiff`) the v4 classifier computes
|
|
1628
1549
|
* internally (reasoning-router-v4.ts keeps those helpers file-private, so
|
|
1629
|
-
* they cannot be imported here). Mirrors reasoning-router-
|
|
1630
|
-
* `
|
|
1631
|
-
* `hasDiffMarkers` byte-for-byte. Operates on the same trimmed prompt text
|
|
1550
|
+
* they cannot be imported here). Mirrors reasoning-router-v4.ts's
|
|
1551
|
+
* length-bucket, `hasCodeFence`, and `hasDiffMarkers` helpers. Operates on the same trimmed prompt text
|
|
1632
1552
|
* the classifier scores; never returns raw prompt content or its exact
|
|
1633
1553
|
* length, only the clamped [0,7] bucket and two booleans.
|
|
1634
1554
|
*/
|
|
@@ -1743,7 +1663,8 @@ export class AgentSession {
|
|
|
1743
1663
|
if (!this.model) {
|
|
1744
1664
|
throw new Error(formatNoModelSelectedMessage());
|
|
1745
1665
|
}
|
|
1746
|
-
const
|
|
1666
|
+
const compactionModel = resolveCompactionModel(this.model, this._modelRegistry.getAvailable());
|
|
1667
|
+
const { apiKey, headers } = await this._getCompactionRequestAuth(compactionModel);
|
|
1747
1668
|
const pathEntries = this.sessionManager.getBranch();
|
|
1748
1669
|
const settings = this.settingsManager.getCompactionSettings();
|
|
1749
1670
|
const preparation = prepareCompaction(pathEntries, settings);
|
|
@@ -1786,7 +1707,7 @@ export class AgentSession {
|
|
|
1786
1707
|
}
|
|
1787
1708
|
else {
|
|
1788
1709
|
// Generate compaction result
|
|
1789
|
-
const result = await compact(preparation,
|
|
1710
|
+
const result = await compact(preparation, compactionModel, apiKey, headers, customInstructions, this._compactionAbortController.signal, this.thinkingLevel, this.agent.streamFn);
|
|
1790
1711
|
summary = result.summary;
|
|
1791
1712
|
firstKeptEntryId = result.firstKeptEntryId;
|
|
1792
1713
|
tokensBefore = result.tokensBefore;
|
|
@@ -1976,17 +1897,21 @@ export class AgentSession {
|
|
|
1976
1897
|
});
|
|
1977
1898
|
return false;
|
|
1978
1899
|
}
|
|
1900
|
+
const compactionModel = resolveCompactionModel(this.model, this._modelRegistry.getAvailable());
|
|
1979
1901
|
let apiKey;
|
|
1980
1902
|
let headers;
|
|
1981
1903
|
if (this.agent.streamFn === streamSimple) {
|
|
1982
|
-
const authResult = await this._modelRegistry.getApiKeyAndHeaders(
|
|
1904
|
+
const authResult = await this._modelRegistry.getApiKeyAndHeaders(compactionModel);
|
|
1983
1905
|
if (!authResult.ok || !authResult.apiKey) {
|
|
1906
|
+
const providerLabel = compactionModel.provider;
|
|
1984
1907
|
this._emit({
|
|
1985
1908
|
type: "compaction_end",
|
|
1986
1909
|
reason,
|
|
1987
1910
|
result: undefined,
|
|
1988
1911
|
aborted: false,
|
|
1989
1912
|
willRetry: false,
|
|
1913
|
+
errorMessage: `Auto-compaction could not authenticate for "${providerLabel}" (${compactionModel.id}). ` +
|
|
1914
|
+
`Check proxy/OAuth health and run '/login ${providerLabel}' if needed.`,
|
|
1990
1915
|
});
|
|
1991
1916
|
return false;
|
|
1992
1917
|
}
|
|
@@ -1994,7 +1919,7 @@ export class AgentSession {
|
|
|
1994
1919
|
headers = authResult.headers;
|
|
1995
1920
|
}
|
|
1996
1921
|
else {
|
|
1997
|
-
({ apiKey, headers } = await this._getCompactionRequestAuth(
|
|
1922
|
+
({ apiKey, headers } = await this._getCompactionRequestAuth(compactionModel));
|
|
1998
1923
|
}
|
|
1999
1924
|
const pathEntries = this.sessionManager.getBranch();
|
|
2000
1925
|
const preparation = prepareCompaction(pathEntries, settings);
|
|
@@ -2046,7 +1971,7 @@ export class AgentSession {
|
|
|
2046
1971
|
}
|
|
2047
1972
|
else {
|
|
2048
1973
|
// Generate compaction result
|
|
2049
|
-
const compactResult = await compact(preparation,
|
|
1974
|
+
const compactResult = await compact(preparation, compactionModel, apiKey, headers, undefined, this._autoCompactionAbortController.signal, this.thinkingLevel, this.agent.streamFn);
|
|
2050
1975
|
summary = compactResult.summary;
|
|
2051
1976
|
firstKeptEntryId = compactResult.firstKeptEntryId;
|
|
2052
1977
|
tokensBefore = compactResult.tokensBefore;
|
|
@@ -2081,7 +2006,8 @@ export class AgentSession {
|
|
|
2081
2006
|
tokensBefore,
|
|
2082
2007
|
details,
|
|
2083
2008
|
};
|
|
2084
|
-
|
|
2009
|
+
const emitWillRetry = compactionEmitWillRetry(willRetry, this.agent.hasQueuedMessages());
|
|
2010
|
+
this._emit({ type: "compaction_end", reason, result, aborted: false, willRetry: emitWillRetry });
|
|
2085
2011
|
if (willRetry) {
|
|
2086
2012
|
const messages = this.agent.state.messages;
|
|
2087
2013
|
const lastMsg = messages[messages.length - 1];
|
|
@@ -2270,6 +2196,10 @@ export class AgentSession {
|
|
|
2270
2196
|
},
|
|
2271
2197
|
getThinkingLevel: () => this.thinkingLevel,
|
|
2272
2198
|
setThinkingLevel: (level) => this.setThinkingLevel(level),
|
|
2199
|
+
// Optional: no in-process MCP client manager yet. Leave unbound so
|
|
2200
|
+
// ExtensionAPI.callMcpTool remains present (load-time capture) but throws
|
|
2201
|
+
// until a session-level handler is provided. Tests / future MCP hub bind here.
|
|
2202
|
+
callMcpTool: undefined,
|
|
2273
2203
|
}, {
|
|
2274
2204
|
getModel: () => this.model,
|
|
2275
2205
|
isIdle: () => !this.isStreaming,
|