@bastani/atomic 0.8.31-alpha.2 → 0.8.31-alpha.3
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 +4 -3
- package/dist/builtin/cursor/CHANGELOG.md +1 -1
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +11 -3
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/context-window.d.ts +15 -0
- package/dist/core/context-window.d.ts.map +1 -1
- package/dist/core/context-window.js +11 -0
- package/dist/core/context-window.js.map +1 -1
- package/dist/core/copilot-model-catalog.d.ts +26 -11
- package/dist/core/copilot-model-catalog.d.ts.map +1 -1
- package/dist/core/copilot-model-catalog.js +34 -9
- package/dist/core/copilot-model-catalog.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +6 -4
- package/dist/core/model-registry.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/docs/providers.md +3 -3
- package/package.json +2 -2
|
@@ -23,7 +23,7 @@ import { ATOMIC_GUIDE_COMMAND_NAME, ATOMIC_GUIDE_HELP_CHOICES, atomicGuideModeFo
|
|
|
23
23
|
import { formatNoApiKeyFoundMessage, formatNoModelSelectedMessage, formatUnresolvedModelMessage, } from "./auth-guidance.js";
|
|
24
24
|
import { executeBashWithOperations } from "./bash-executor.js";
|
|
25
25
|
import { calculateContextTokens, collectEntriesForBranchSummary, contextCompact as runContextCompact, estimateContextTokens, generateBranchSummary, prepareContextCompaction, shouldCompact, validateContextDeletionRequest, } from "./compaction/index.js";
|
|
26
|
-
import { getModelDefaultContextWindow, getSupportedContextWindows, selectContextWindow } from "./context-window.js";
|
|
26
|
+
import { getEffectiveInputBudget, getModelDefaultContextWindow, getSupportedContextWindows, selectContextWindow } from "./context-window.js";
|
|
27
27
|
import { formatCopilotProviderError, parseCopilotPromptLimitError } from "./copilot-errors.js";
|
|
28
28
|
import { DEFAULT_THINKING_LEVEL } from "./defaults.js";
|
|
29
29
|
import { exportSessionToHtml } from "./export-html/index.js";
|
|
@@ -2009,7 +2009,11 @@ export class AgentSession {
|
|
|
2009
2009
|
else {
|
|
2010
2010
|
contextTokens = calculateContextTokens(assistantMessage.usage);
|
|
2011
2011
|
}
|
|
2012
|
-
|
|
2012
|
+
// Compact against the effective input budget (the hard prompt cap for providers like Copilot
|
|
2013
|
+
// that advertise a larger total window) so we compact before overrunning the server-side limit
|
|
2014
|
+
// rather than relying on reactive overflow recovery near the cap.
|
|
2015
|
+
const compactionBudget = this.model ? getEffectiveInputBudget(this.model) : contextWindow;
|
|
2016
|
+
if (shouldCompact(contextTokens, compactionBudget, settings)) {
|
|
2013
2017
|
await this._runAutoCompaction("threshold", false);
|
|
2014
2018
|
}
|
|
2015
2019
|
}
|
|
@@ -2017,7 +2021,11 @@ export class AgentSession {
|
|
|
2017
2021
|
if (!this.model || this.model.provider !== "github-copilot" || !assistantMessage.errorMessage)
|
|
2018
2022
|
return false;
|
|
2019
2023
|
const promptLimitError = parseCopilotPromptLimitError(assistantMessage.errorMessage);
|
|
2020
|
-
|
|
2024
|
+
// Compare against the effective input budget (the model's real prompt cap), not the displayed
|
|
2025
|
+
// total window. A rejection at the prompt cap is a normal overflow we should compact-and-retry;
|
|
2026
|
+
// only a rejection *below* the cap (e.g. a missing long-context entitlement dropping the account
|
|
2027
|
+
// to a lower server tier) keeps the friendly error visible instead of silently compacting down.
|
|
2028
|
+
return promptLimitError !== undefined && getEffectiveInputBudget(this.model) > promptLimitError.limitTokens;
|
|
2021
2029
|
}
|
|
2022
2030
|
/**
|
|
2023
2031
|
* Internal: remove the trailing overflow error from retry context if it is still present.
|