@leanandmean/coding-agent 0.74.1-scramjet.22 → 0.74.1-scramjet.24
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/cli/list-models.d.ts +2 -0
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +8 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +10 -6
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +4 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +2 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/types.d.ts +7 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-registry.d.ts +3 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +87 -24
- package/dist/core/model-registry.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +4 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +21 -16
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +1 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/docs/compaction.md +3 -3
- package/docs/custom-provider.md +2 -0
- package/docs/extensions.md +3 -1
- package/docs/models.md +6 -1
- package/docs/rpc.md +6 -2
- package/examples/extensions/border-status-editor.ts +7 -3
- package/package.json +3 -3
- package/dist/modes/interactive/theme/dark.json +0 -86
- package/dist/modes/interactive/theme/light.json +0 -85
|
@@ -17,7 +17,7 @@ import { basename, dirname, resolve } from "node:path";
|
|
|
17
17
|
// SCRAMJET-DIVERGENCE: provider-safe harness tool-call id generation for the persisted-settlement
|
|
18
18
|
// acknowledgement key (#341).
|
|
19
19
|
import { generateHarnessToolCallId } from "@leanandmean/agent";
|
|
20
|
-
import { clampThinkingLevel, cleanupSessionResources, flattenSystemPrompt, getSupportedThinkingLevels, isContextOverflow, modelsAreEqual, resetApiProviders, } from "@leanandmean/ai";
|
|
20
|
+
import { clampThinkingLevel, cleanupSessionResources, flattenSystemPrompt, getContextWindowBudget, getSupportedThinkingLevels, isContextOverflow, modelsAreEqual, resetApiProviders, } from "@leanandmean/ai";
|
|
21
21
|
import { theme } from "../modes/interactive/theme/theme.js";
|
|
22
22
|
import { stripFrontmatter } from "../utils/frontmatter.js";
|
|
23
23
|
import { sleep } from "../utils/sleep.js";
|
|
@@ -1602,7 +1602,8 @@ export class AgentSession {
|
|
|
1602
1602
|
// Skip if message was aborted (user cancelled) - unless skipAbortedCheck is false
|
|
1603
1603
|
if (skipAbortedCheck && assistantMessage.stopReason === "aborted")
|
|
1604
1604
|
return;
|
|
1605
|
-
|
|
1605
|
+
// SCRAMJET-DIVERGENCE: operational context checks use the provider budget, not advertised capacity.
|
|
1606
|
+
const contextWindow = this.model ? getContextWindowBudget(this.model) : 0;
|
|
1606
1607
|
// Skip overflow check if the message came from a different model.
|
|
1607
1608
|
// This handles the case where user switched from a smaller-context model (e.g. opus)
|
|
1608
1609
|
// to a larger-context model (e.g. codex) - the overflow error from the old model
|
|
@@ -2158,7 +2159,8 @@ export class AgentSession {
|
|
|
2158
2159
|
if (message.stopReason !== "error" || !message.errorMessage)
|
|
2159
2160
|
return false;
|
|
2160
2161
|
// Context overflow is handled by compaction, not retry
|
|
2161
|
-
|
|
2162
|
+
// SCRAMJET-DIVERGENCE: retry classification uses the provider's operational context budget.
|
|
2163
|
+
const contextWindow = this.model ? getContextWindowBudget(this.model) : 0;
|
|
2162
2164
|
if (isContextOverflow(message, contextWindow))
|
|
2163
2165
|
return false;
|
|
2164
2166
|
const err = message.errorMessage;
|
|
@@ -2628,7 +2630,8 @@ export class AgentSession {
|
|
|
2628
2630
|
if (!model)
|
|
2629
2631
|
return undefined;
|
|
2630
2632
|
const contextWindow = model.contextWindow ?? 0;
|
|
2631
|
-
|
|
2633
|
+
const contextWindowBudget = getContextWindowBudget(model);
|
|
2634
|
+
if (contextWindow <= 0 || contextWindowBudget <= 0)
|
|
2632
2635
|
return undefined;
|
|
2633
2636
|
// After compaction, the last assistant usage reflects pre-compaction context size.
|
|
2634
2637
|
// We can only trust usage from an assistant that responded after the latest compaction.
|
|
@@ -2653,14 +2656,15 @@ export class AgentSession {
|
|
|
2653
2656
|
}
|
|
2654
2657
|
}
|
|
2655
2658
|
if (!hasPostCompactionUsage) {
|
|
2656
|
-
return { tokens: null, contextWindow, percent: null };
|
|
2659
|
+
return { tokens: null, contextWindow, contextWindowBudget, percent: null };
|
|
2657
2660
|
}
|
|
2658
2661
|
}
|
|
2659
2662
|
const estimate = estimateContextTokens(this.messages);
|
|
2660
|
-
const percent = (estimate.tokens /
|
|
2663
|
+
const percent = (estimate.tokens / contextWindowBudget) * 100;
|
|
2661
2664
|
return {
|
|
2662
2665
|
tokens: estimate.tokens,
|
|
2663
2666
|
contextWindow,
|
|
2667
|
+
contextWindowBudget,
|
|
2664
2668
|
percent,
|
|
2665
2669
|
};
|
|
2666
2670
|
}
|