@bastani/atomic 0.9.4-alpha.6 → 0.9.4-alpha.7

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/builtin/cursor/package.json +3 -3
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/package.json +2 -2
  5. package/dist/builtin/subagents/CHANGELOG.md +14 -0
  6. package/dist/builtin/subagents/package.json +1 -1
  7. package/dist/builtin/subagents/src/runs/background/async-execution-chain.ts +11 -1
  8. package/dist/builtin/subagents/src/runs/background/async-execution-single.ts +11 -1
  9. package/dist/builtin/subagents/src/runs/background/async-execution-types.ts +2 -0
  10. package/dist/builtin/subagents/src/runs/background/subagent-runner-step.ts +27 -4
  11. package/dist/builtin/subagents/src/runs/background/subagent-runner-streaming.ts +25 -0
  12. package/dist/builtin/subagents/src/runs/foreground/chain-execution-dynamic-step.ts +1 -0
  13. package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +1 -0
  14. package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-step.ts +1 -0
  15. package/dist/builtin/subagents/src/runs/foreground/chain-execution-sequential-step.ts +1 -0
  16. package/dist/builtin/subagents/src/runs/foreground/chain-execution-types.ts +2 -0
  17. package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +3 -1
  18. package/dist/builtin/subagents/src/runs/foreground/execution-attempt.ts +22 -0
  19. package/dist/builtin/subagents/src/runs/foreground/execution-run-sync.ts +15 -5
  20. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +5 -1
  21. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +2 -0
  22. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +4 -1
  23. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +4 -1
  24. package/dist/builtin/subagents/src/runs/shared/attempt-watchdog.ts +126 -0
  25. package/dist/builtin/subagents/src/runs/shared/model-candidate-filter.ts +53 -0
  26. package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +52 -53
  27. package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +2 -0
  28. package/dist/builtin/subagents/src/shared/model-info.ts +16 -0
  29. package/dist/builtin/subagents/src/shared/types-config.ts +2 -0
  30. package/dist/builtin/web-access/package.json +1 -1
  31. package/dist/builtin/workflows/CHANGELOG.md +6 -0
  32. package/dist/builtin/workflows/package.json +1 -1
  33. package/dist/builtin/workflows/src/runs/shared/model-fallback-failures.ts +34 -4
  34. package/dist/core/agent-session-extension-bindings.d.ts +2 -0
  35. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  36. package/dist/core/agent-session-extension-bindings.js +10 -2
  37. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  38. package/dist/core/agent-session-methods.d.ts +2 -1
  39. package/dist/core/agent-session-methods.d.ts.map +1 -1
  40. package/dist/core/agent-session-methods.js.map +1 -1
  41. package/dist/core/copilot-model-catalog.d.ts +25 -74
  42. package/dist/core/copilot-model-catalog.d.ts.map +1 -1
  43. package/dist/core/copilot-model-catalog.js +118 -68
  44. package/dist/core/copilot-model-catalog.js.map +1 -1
  45. package/dist/core/copilot-model-synthesis.d.ts +10 -0
  46. package/dist/core/copilot-model-synthesis.d.ts.map +1 -0
  47. package/dist/core/copilot-model-synthesis.js +89 -0
  48. package/dist/core/copilot-model-synthesis.js.map +1 -0
  49. package/dist/core/model-registry-builtins.d.ts.map +1 -1
  50. package/dist/core/model-registry-builtins.js +21 -3
  51. package/dist/core/model-registry-builtins.js.map +1 -1
  52. package/dist/core/tools/read-selectors.d.ts.map +1 -1
  53. package/dist/core/tools/read-selectors.js +19 -1
  54. package/dist/core/tools/read-selectors.js.map +1 -1
  55. package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
  56. package/dist/modes/interactive/interactive-model-routing.js +1 -0
  57. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  58. package/docs/models.md +3 -3
  59. package/docs/providers.md +1 -1
  60. package/docs/rpc.md +2 -2
  61. package/docs/sdk.md +1 -1
  62. package/docs/settings.md +2 -1
  63. package/docs/subagents.md +6 -0
  64. package/docs/workflows.md +2 -0
  65. package/npm-shrinkwrap.json +27 -27
  66. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-model-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-model-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAwB,WAAW,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AACnc,OAAO,EAAE,mCAAmC,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAEpH,mBAAmB,CAAC,SAAS,CAAC,kBAAkB,GAAG,KAAK,WAAqC,UAAmB;IAC5G,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IACzD,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACzB,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC/B,IAAI,CAAC,UAAU,CAAC,UAAU,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;YACtC,KAAK,IAAI,CAAC,uCAAuC,CAAC,KAA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C;AACL,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, getAgentDir, findExactModelReferenceMatch, resolveModelScope, ContextWindowSelectorComponent, formatContextWindow, copilotApiBaseUrlFromToken, copilotCatalogCacheHost, copilotCatalogCachePath, fetchCopilotModelCatalog, readCopilotCatalogCache, setActiveCopilotModelCatalog, writeCopilotCatalogCache, ModelSelectorComponent, ScopedModelsSelectorComponent, UserMessageSelectorComponent } from \"./interactive-mode-deps.ts\";\nimport { ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, isAnthropicSubscriptionAuthKey } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.handleModelCommand = async function(this: InteractiveModeBase, searchTerm?: string): Promise<void> {\n if (!searchTerm) {\n this.showModelSelector();\n return;\n }\n\n const model = await this.findExactModelMatch(searchTerm);\n if (model) {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n this.showStatus(`Model: ${model.id}`);\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n return;\n }\n\n this.showModelSelector(searchTerm);\n };\n\nInteractiveModeBase.prototype.findExactModelMatch = async function(this: InteractiveModeBase, searchTerm: string): Promise<Model<Api> | undefined> {\n const models = await this.getModelCandidates();\n return findExactModelReferenceMatch(searchTerm, models);\n };\n\nInteractiveModeBase.prototype.getModelCandidates = async function(this: InteractiveModeBase): Promise<Model<Api>[]> {\n if (this.session.scopedModels.length > 0) {\n return this.session.scopedModels.map((scoped) => scoped.model);\n }\n\n await this.refreshCopilotModelCatalog();\n this.session.modelRegistry.refresh();\n try {\n return await this.session.modelRegistry.getAvailable();\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.refreshCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n if (this.copilotCatalogApplied) return;\n if (!this.copilotCatalogInFlight) {\n this.copilotCatalogInFlight = this.loadCopilotModelCatalog();\n }\n try {\n await this.copilotCatalogInFlight;\n } finally {\n this.copilotCatalogInFlight = undefined;\n }\n };\n\nInteractiveModeBase.prototype.loadCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n const registry = this.session.modelRegistry;\n // Gate: do nothing unless the user has a Copilot token, including COPILOT_GITHUB_TOKEN env auth.\n try {\n const token = await registry.getApiKeyForProvider(\"github-copilot\");\n if (!token) return;\n const baseUrl = copilotApiBaseUrlFromToken(token);\n const cachePath = copilotCatalogCachePath(getAgentDir());\n let catalog = readCopilotCatalogCache(cachePath, { host: copilotCatalogCacheHost(baseUrl) });\n if (!catalog) {\n catalog = await fetchCopilotModelCatalog({ token, baseUrl });\n writeCopilotCatalogCache(cachePath, baseUrl, catalog);\n }\n setActiveCopilotModelCatalog(catalog);\n registry.refresh();\n this.copilotCatalogApplied = true;\n } catch {\n // Best-effort: leave the active catalog as-is on any failure (offline, auth, parse).\n }\n };\n\nInteractiveModeBase.prototype.updateAvailableProviderCount = async function(this: InteractiveModeBase): Promise<void> {\n const models = await this.getModelCandidates();\n const uniqueProviders = new Set(models.map((m) => m.provider));\n this.footerDataProvider.setAvailableProviderCount(uniqueProviders.size);\n };\n\nInteractiveModeBase.prototype.maybeWarnAboutAnthropicSubscriptionAuth = async function(this: InteractiveModeBase, model: Model<Api> | undefined = this.session.model): Promise<void> {\n if (this.settingsManager.getWarnings().anthropicExtraUsage === false) {\n return;\n }\n if (this.anthropicSubscriptionWarningShown) {\n return;\n }\n if (!model || model.provider !== \"anthropic\") {\n return;\n }\n\n const storedCredential =\n this.session.modelRegistry.authStorage.get(\"anthropic\");\n if (storedCredential?.type === \"oauth\") {\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n return;\n }\n\n try {\n const apiKey = await this.session.modelRegistry.getApiKeyForProvider(\n model.provider,\n );\n if (!isAnthropicSubscriptionAuthKey(apiKey)) {\n return;\n }\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n } catch {\n // Ignore auth lookup failures for warning-only checks.\n }\n };\n\nInteractiveModeBase.prototype.showModelSelector = function(this: InteractiveModeBase, initialSearchInput?: string): void {\n this.showSelector((done) => {\n const selector = new ModelSelectorComponent(\n this.ui,\n this.session.model,\n this.settingsManager,\n this.session.modelRegistry,\n this.session.scopedModels,\n async (model) => {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n done();\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n if (this.session.supportsContextWindowSelection()) {\n this.showContextWindowSelector(model);\n } else {\n this.showStatus(`Model: ${model.id}`);\n await this.resumePendingFirstRunOnboardingSeed();\n }\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSearchInput,\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showContextWindowSelector = function(this: InteractiveModeBase, model: Model<Api>): void {\n const availableContextWindows = this.session.getAvailableContextWindows();\n const currentContextWindow =\n this.session.model?.contextWindow ?? availableContextWindows[0] ?? 0;\n this.showSelector((done) => {\n const selector = new ContextWindowSelectorComponent(\n model.name ?? model.id,\n availableContextWindows,\n currentContextWindow,\n async (contextWindow) => {\n try {\n this.session.setContextWindow(contextWindow, {\n persistDefault: true,\n });\n this.footer.invalidate();\n this.usageMeter.invalidate();\n this.updateEditorBorderColor();\n done();\n this.showStatus(\n `Model: ${model.id} \\u00b7 ${formatContextWindow(contextWindow)} context`,\n );\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.showStatus(`Model: ${model.id}`);\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showModelsSelector = async function(this: InteractiveModeBase): Promise<void> {\n // Get all available models\n this.session.modelRegistry.refresh();\n const allModels = this.session.modelRegistry.getAvailable();\n\n if (allModels.length === 0) {\n this.showStatus(\"No models available\");\n return;\n }\n\n // Check if session has scoped models (from previous session-only changes or CLI --models)\n const sessionScopedModels = this.session.scopedModels;\n const hasSessionScope = sessionScopedModels.length > 0;\n\n // Build enabled model IDs from session state or settings\n let currentEnabledIds: string[] | null = null;\n\n if (hasSessionScope) {\n // Use current session's scoped models\n currentEnabledIds = sessionScopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n } else {\n // Fall back to settings\n const patterns = this.settingsManager.getEnabledModels();\n if (patterns !== undefined && patterns.length > 0) {\n const scopedModels = await resolveModelScope(\n patterns,\n this.session.modelRegistry,\n );\n currentEnabledIds = scopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n }\n }\n\n // Helper to update session's scoped models (session-only, no persist)\n const updateSessionModels = async (enabledIds: string[] | null) => {\n currentEnabledIds = enabledIds === null ? null : [...enabledIds];\n if (\n enabledIds &&\n enabledIds.length > 0 &&\n enabledIds.length < allModels.length\n ) {\n const newScopedModels = await resolveModelScope(\n enabledIds,\n this.session.modelRegistry,\n );\n this.session.setScopedModels(\n newScopedModels.map((sm) => ({\n model: sm.model,\n thinkingLevel: sm.thinkingLevel,\n })),\n );\n } else {\n // All enabled or none enabled = no filter\n this.session.setScopedModels([]);\n }\n await this.updateAvailableProviderCount();\n this.setupAutocompleteProvider();\n this.ui.requestRender();\n };\n\n this.showSelector((done) => {\n const selector = new ScopedModelsSelectorComponent(\n {\n allModels,\n enabledModelIds: currentEnabledIds,\n },\n {\n onChange: async (enabledIds) => {\n await updateSessionModels(enabledIds);\n },\n onPersist: (enabledIds) => {\n // Persist to settings\n const newPatterns =\n enabledIds === null || enabledIds.length === allModels.length\n ? undefined // All enabled = clear filter\n : enabledIds;\n this.settingsManager.setEnabledModels(\n newPatterns ? [...newPatterns] : undefined,\n );\n this.showStatus(\"Model selection saved to settings\");\n },\n onCancel: () => {\n done();\n this.ui.requestRender();\n },\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showUserMessageSelector = function(this: InteractiveModeBase): void {\n const userMessages = this.session.getUserMessagesForForking();\n\n if (userMessages.length === 0) {\n this.showStatus(\"No messages to fork from\");\n return;\n }\n\n const initialSelectedId = userMessages[userMessages.length - 1]?.entryId;\n\n this.showSelector((done) => {\n const selector = new UserMessageSelectorComponent(\n userMessages.map((m) => ({ id: m.entryId, text: m.text })),\n async (entryId) => {\n try {\n const result = await this.runtimeHost.fork(entryId);\n if (result.cancelled) {\n done();\n this.ui.requestRender();\n return;\n }\n\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n done();\n this.showStatus(\"Forked to new session\");\n } catch (error: unknown) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSelectedId,\n );\n return { component: selector, focus: selector.getMessageList() };\n });\n };\n"]}
1
+ {"version":3,"file":"interactive-model-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-model-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAwB,WAAW,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AACnc,OAAO,EAAE,mCAAmC,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAEpH,mBAAmB,CAAC,SAAS,CAAC,kBAAkB,GAAG,KAAK,WAAq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AC;gBAC/C,IAAI,EAAE,CAAC;gBACP,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,IAAI,EAAE,CAAC;gBACP,IAAI,CAAC,SAAS,CACZ,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;YACJ,CAAC;QACH,CAAC,EACD,GAAG,EAAE;YACH,IAAI,EAAE,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QAC1B,CAAC,EACD,iBAAiB,CAClB,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,cAAc,EAAE,EAAE,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, getAgentDir, findExactModelReferenceMatch, resolveModelScope, ContextWindowSelectorComponent, formatContextWindow, copilotApiBaseUrlFromToken, copilotCatalogCacheHost, copilotCatalogCachePath, fetchCopilotModelCatalog, readCopilotCatalogCache, setActiveCopilotModelCatalog, writeCopilotCatalogCache, ModelSelectorComponent, ScopedModelsSelectorComponent, UserMessageSelectorComponent } from \"./interactive-mode-deps.ts\";\nimport { ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, isAnthropicSubscriptionAuthKey } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.handleModelCommand = async function(this: InteractiveModeBase, searchTerm?: string): Promise<void> {\n if (!searchTerm) {\n this.showModelSelector();\n return;\n }\n\n const model = await this.findExactModelMatch(searchTerm);\n if (model) {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n this.showStatus(`Model: ${model.id}`);\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n this.showError(error instanceof Error ? error.message : String(error));\n }\n return;\n }\n\n this.showModelSelector(searchTerm);\n };\n\nInteractiveModeBase.prototype.findExactModelMatch = async function(this: InteractiveModeBase, searchTerm: string): Promise<Model<Api> | undefined> {\n const models = await this.getModelCandidates();\n return findExactModelReferenceMatch(searchTerm, models);\n };\n\nInteractiveModeBase.prototype.getModelCandidates = async function(this: InteractiveModeBase): Promise<Model<Api>[]> {\n if (this.session.scopedModels.length > 0) {\n return this.session.scopedModels.map((scoped) => scoped.model);\n }\n\n await this.refreshCopilotModelCatalog();\n this.session.modelRegistry.refresh();\n try {\n return await this.session.modelRegistry.getAvailable();\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.refreshCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n if (this.copilotCatalogApplied) return;\n if (!this.copilotCatalogInFlight) {\n this.copilotCatalogInFlight = this.loadCopilotModelCatalog();\n }\n try {\n await this.copilotCatalogInFlight;\n } finally {\n this.copilotCatalogInFlight = undefined;\n }\n };\n\nInteractiveModeBase.prototype.loadCopilotModelCatalog = async function(this: InteractiveModeBase): Promise<void> {\n const registry = this.session.modelRegistry;\n // Gate: do nothing unless the user has a Copilot token, including COPILOT_GITHUB_TOKEN env auth.\n try {\n const token = await registry.getApiKeyForProvider(\"github-copilot\");\n if (!token) return;\n const baseUrl = copilotApiBaseUrlFromToken(token);\n const cachePath = copilotCatalogCachePath(getAgentDir());\n let catalog = readCopilotCatalogCache(cachePath, { host: copilotCatalogCacheHost(baseUrl) });\n if (!catalog) {\n catalog = await fetchCopilotModelCatalog({ token, baseUrl });\n writeCopilotCatalogCache(cachePath, baseUrl, catalog);\n }\n setActiveCopilotModelCatalog(catalog);\n registry.refresh();\n this.session.refreshCurrentModelFromRegistry();\n this.copilotCatalogApplied = true;\n } catch {\n // Best-effort: leave the active catalog as-is on any failure (offline, auth, parse).\n }\n };\n\nInteractiveModeBase.prototype.updateAvailableProviderCount = async function(this: InteractiveModeBase): Promise<void> {\n const models = await this.getModelCandidates();\n const uniqueProviders = new Set(models.map((m) => m.provider));\n this.footerDataProvider.setAvailableProviderCount(uniqueProviders.size);\n };\n\nInteractiveModeBase.prototype.maybeWarnAboutAnthropicSubscriptionAuth = async function(this: InteractiveModeBase, model: Model<Api> | undefined = this.session.model): Promise<void> {\n if (this.settingsManager.getWarnings().anthropicExtraUsage === false) {\n return;\n }\n if (this.anthropicSubscriptionWarningShown) {\n return;\n }\n if (!model || model.provider !== \"anthropic\") {\n return;\n }\n\n const storedCredential =\n this.session.modelRegistry.authStorage.get(\"anthropic\");\n if (storedCredential?.type === \"oauth\") {\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n return;\n }\n\n try {\n const apiKey = await this.session.modelRegistry.getApiKeyForProvider(\n model.provider,\n );\n if (!isAnthropicSubscriptionAuthKey(apiKey)) {\n return;\n }\n this.anthropicSubscriptionWarningShown = true;\n this.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING);\n } catch {\n // Ignore auth lookup failures for warning-only checks.\n }\n };\n\nInteractiveModeBase.prototype.showModelSelector = function(this: InteractiveModeBase, initialSearchInput?: string): void {\n this.showSelector((done) => {\n const selector = new ModelSelectorComponent(\n this.ui,\n this.session.model,\n this.settingsManager,\n this.session.modelRegistry,\n this.session.scopedModels,\n async (model) => {\n try {\n await this.session.setModel(model);\n this.footer.invalidate();\n this.updateEditorBorderColor();\n done();\n void this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n this.checkDaxnutsEasterEgg(model);\n if (this.session.supportsContextWindowSelection()) {\n this.showContextWindowSelector(model);\n } else {\n this.showStatus(`Model: ${model.id}`);\n await this.resumePendingFirstRunOnboardingSeed();\n }\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSearchInput,\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showContextWindowSelector = function(this: InteractiveModeBase, model: Model<Api>): void {\n const availableContextWindows = this.session.getAvailableContextWindows();\n const currentContextWindow =\n this.session.model?.contextWindow ?? availableContextWindows[0] ?? 0;\n this.showSelector((done) => {\n const selector = new ContextWindowSelectorComponent(\n model.name ?? model.id,\n availableContextWindows,\n currentContextWindow,\n async (contextWindow) => {\n try {\n this.session.setContextWindow(contextWindow, {\n persistDefault: true,\n });\n this.footer.invalidate();\n this.usageMeter.invalidate();\n this.updateEditorBorderColor();\n done();\n this.showStatus(\n `Model: ${model.id} \\u00b7 ${formatContextWindow(contextWindow)} context`,\n );\n await this.resumePendingFirstRunOnboardingSeed();\n } catch (error) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.showStatus(`Model: ${model.id}`);\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showModelsSelector = async function(this: InteractiveModeBase): Promise<void> {\n // Get all available models\n this.session.modelRegistry.refresh();\n const allModels = this.session.modelRegistry.getAvailable();\n\n if (allModels.length === 0) {\n this.showStatus(\"No models available\");\n return;\n }\n\n // Check if session has scoped models (from previous session-only changes or CLI --models)\n const sessionScopedModels = this.session.scopedModels;\n const hasSessionScope = sessionScopedModels.length > 0;\n\n // Build enabled model IDs from session state or settings\n let currentEnabledIds: string[] | null = null;\n\n if (hasSessionScope) {\n // Use current session's scoped models\n currentEnabledIds = sessionScopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n } else {\n // Fall back to settings\n const patterns = this.settingsManager.getEnabledModels();\n if (patterns !== undefined && patterns.length > 0) {\n const scopedModels = await resolveModelScope(\n patterns,\n this.session.modelRegistry,\n );\n currentEnabledIds = scopedModels.map(\n (scoped) => `${scoped.model.provider}/${scoped.model.id}`,\n );\n }\n }\n\n // Helper to update session's scoped models (session-only, no persist)\n const updateSessionModels = async (enabledIds: string[] | null) => {\n currentEnabledIds = enabledIds === null ? null : [...enabledIds];\n if (\n enabledIds &&\n enabledIds.length > 0 &&\n enabledIds.length < allModels.length\n ) {\n const newScopedModels = await resolveModelScope(\n enabledIds,\n this.session.modelRegistry,\n );\n this.session.setScopedModels(\n newScopedModels.map((sm) => ({\n model: sm.model,\n thinkingLevel: sm.thinkingLevel,\n })),\n );\n } else {\n // All enabled or none enabled = no filter\n this.session.setScopedModels([]);\n }\n await this.updateAvailableProviderCount();\n this.setupAutocompleteProvider();\n this.ui.requestRender();\n };\n\n this.showSelector((done) => {\n const selector = new ScopedModelsSelectorComponent(\n {\n allModels,\n enabledModelIds: currentEnabledIds,\n },\n {\n onChange: async (enabledIds) => {\n await updateSessionModels(enabledIds);\n },\n onPersist: (enabledIds) => {\n // Persist to settings\n const newPatterns =\n enabledIds === null || enabledIds.length === allModels.length\n ? undefined // All enabled = clear filter\n : enabledIds;\n this.settingsManager.setEnabledModels(\n newPatterns ? [...newPatterns] : undefined,\n );\n this.showStatus(\"Model selection saved to settings\");\n },\n onCancel: () => {\n done();\n this.ui.requestRender();\n },\n },\n );\n return { component: selector, focus: selector };\n });\n };\n\nInteractiveModeBase.prototype.showUserMessageSelector = function(this: InteractiveModeBase): void {\n const userMessages = this.session.getUserMessagesForForking();\n\n if (userMessages.length === 0) {\n this.showStatus(\"No messages to fork from\");\n return;\n }\n\n const initialSelectedId = userMessages[userMessages.length - 1]?.entryId;\n\n this.showSelector((done) => {\n const selector = new UserMessageSelectorComponent(\n userMessages.map((m) => ({ id: m.entryId, text: m.text })),\n async (entryId) => {\n try {\n const result = await this.runtimeHost.fork(entryId);\n if (result.cancelled) {\n done();\n this.ui.requestRender();\n return;\n }\n\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n done();\n this.showStatus(\"Forked to new session\");\n } catch (error: unknown) {\n done();\n this.showError(\n error instanceof Error ? error.message : String(error),\n );\n }\n },\n () => {\n done();\n this.ui.requestRender();\n },\n initialSelectedId,\n );\n return { component: selector, focus: selector.getMessageList() };\n });\n };\n"]}
package/docs/models.md CHANGED
@@ -271,15 +271,15 @@ Users can select a supported context window independently from thinking level:
271
271
  atomic --model custom/long-context-model --thinking high --context-window 1m
272
272
  ```
273
273
 
274
- In interactive mode, run `/model` and pick a model; when the chosen model exposes more than one window, Atomic immediately prompts for the context window as a follow-up step — a GitHub Copilot CLI-style picker that lists numbered `Default` and `Long context` tiers with their token counts (for example `272k tokens` / `922k tokens` for `github-copilot/gpt-5.5`, or `200k tokens` / `936k tokens` for the Claude/Gemini long-context models) — so you can choose one of the active model's supported budgets. Persisted interactive selections are stored per model under `defaultContextWindows["provider/modelId"]` (raw token counts and compact labels such as `400k` or `1m` are accepted), so a Copilot-specific prompt cap does not leak into Anthropic, Cursor, or other providers. GitHub Copilot long-context requests treat `1m` as a branded budget request and resolve it to the model's largest advertised long-context tier not exceeding the request (for example `936k` for Copilot Claude Opus), while other providers continue to require one of their own exact supported windows or use their natural scalar default. Successful explicit startup selections are recorded as `context_window_change` entries even when the chosen value equals the scalar default, preserving the user's explicit budget choice across future settings changes and resume.
274
+ In interactive mode, run `/model` and pick a model; when the chosen model exposes more than one window, Atomic immediately prompts for the context window as a follow-up step — a GitHub Copilot CLI-style picker that lists numbered `Default` and `Long context` tiers with their token counts (for example `272k tokens` / `922k tokens` for `github-copilot/gpt-5.5`, or `200k tokens` / `936k tokens` for Claude/Gemini long-context models such as `github-copilot/claude-sonnet-5`) — so you can choose one of the active model's supported budgets. Persisted interactive selections are stored per model under `defaultContextWindows["provider/modelId"]` (raw token counts and compact labels such as `400k` or `1m` are accepted), so a Copilot-specific prompt cap does not leak into Anthropic, Cursor, or other providers. GitHub Copilot long-context requests treat `1m` as a branded budget request and resolve it to the model's largest advertised long-context tier not exceeding the request (for example `936k` for Copilot Claude models), while other providers continue to require one of their own exact supported windows or use their natural scalar default. Successful explicit startup selections are recorded as `context_window_change` entries even when the chosen value equals the scalar default, preserving the user's explicit budget choice across future settings changes and resume.
275
275
 
276
276
  Use larger context windows deliberately. Some providers charge more for larger windows, and Atomic preserves each model's default unless the user explicitly opts in through `--context-window`, the `/model` selection flow, per-model `defaultContextWindows`, or the optional global `defaultContextWindow` fallback.
277
277
 
278
278
  #### GitHub Copilot context windows
279
279
 
280
- GitHub Copilot context windows are measured in **input (prompt) tokens**, exactly like every other provider's `contextWindow`, and are derived **dynamically from GitHub's live CAPI model catalog** (`GET {baseUrl}/models`) rather than a hardcoded model list — so models GitHub adds, removes, or retiers are reflected automatically. Atomic fetches the catalog only when you actually have the GitHub Copilot provider authenticated and caches it on disk for 30 minutes.
280
+ GitHub Copilot context windows are measured in **input (prompt) tokens**, exactly like every other provider's `contextWindow`, and are derived **dynamically from GitHub's live CAPI model catalog** (`GET {baseUrl}/models`) rather than a hardcoded model list — so plain Copilot model ids GitHub adds, removes, or retiers are reflected automatically. Atomic fetches the catalog only when you actually have the GitHub Copilot provider authenticated, caches it on disk for 30 minutes, and refreshes the active interactive session's model metadata as soon as that catalog is applied. Dynamic model creation is intentionally limited to picker-enabled, non-disabled `chat` entries with plain, non-namespaced ids; enterprise/org-deployed catalog ids containing `/` (for example `octodemo/Octodemo_Foundry/DeepSeek-V3.2`) are skipped instead of being exposed as `github-copilot/*` models. The same catalog also supplies Copilot output-token caps and selectable thinking levels: when CAPI advertises `capabilities.limits.max_output_tokens`, Atomic uses that live value as the model's `maxTokens` instead of the bundled fallback; when CAPI advertises `capabilities.supports.reasoning_effort` as an array, Atomic hides unsupported thinking levels for both dynamically synthesized Copilot models and bundled `pi-ai` Copilot models. Models that only advertise thinking budgets or a boolean reasoning-effort flag keep their existing thinking-level behavior.
281
281
 
282
- Each selectable Copilot window is a prompt/input budget. Atomic reads `capabilities.limits.max_prompt_tokens` for the full prompt cap and treats `capabilities.limits.max_context_window_tokens` as the model's total context capacity (prompt plus output reserve) and a compatibility fallback only when the prompt cap is absent. Models with tiered pricing expose their per-tier prompt budgets through `billing.token_prices.<tier>.context_max`: the `default` tier becomes the base window and a larger `long_context` tier is offered as a selectable option. For example `github-copilot/gpt-5.5` resolves to a `272k` default / `922k` long window, and the Claude/Gemini long-context models resolve to `200k` default / `936k` long. When the request is a rounded budget such as `1m`, Atomic selects the largest advertised Copilot long-context prompt tier at or below that budget instead of falling back to the base `200k`/`272k` window. Offline, unauthenticated, or non-Copilot sessions leave the built-in scalar window untouched and show no picker.
282
+ Each selectable Copilot window is a prompt/input budget. Atomic reads `capabilities.limits.max_prompt_tokens` for the full prompt cap, `capabilities.limits.max_output_tokens` for the maximum response/output cap, and treats `capabilities.limits.max_context_window_tokens` as the model's total context capacity (prompt plus output reserve) and a compatibility fallback only when the prompt cap is absent. Models with tiered pricing expose their per-tier prompt budgets through `billing.token_prices.<tier>.context_max`: the `default` tier becomes the base window and a larger `long_context` tier is offered as a selectable option. For example `github-copilot/gpt-5.5` resolves to a `272k` default / `922k` long prompt budget, `github-copilot/mai-code-1-flash-picker` advertises a `128k` prompt cap with a `256k` total context window, and `github-copilot/claude-sonnet-5` plus other Claude/Gemini long-context models resolve to `200k` default / `936k` long. When the request is a rounded budget such as `1m`, Atomic selects the largest advertised Copilot long-context prompt tier at or below that budget instead of falling back to the base `200k`/`272k` window. Offline, unauthenticated, or non-Copilot sessions leave the built-in scalar window and output-token cap untouched and show no picker.
283
283
 
284
284
  Selecting the long-context window does two client-side things:
285
285
 
package/docs/providers.md CHANGED
@@ -40,7 +40,7 @@ Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party h
40
40
  - Press Enter for github.com, or enter your GitHub Enterprise Server domain
41
41
  - When using `COPILOT_GITHUB_TOKEN` instead of `/login`, Atomic uses the token's `proxy-ep` when present, honors `COPILOT_API_TARGET` or `GITHUB_COPILOT_BASE_URL` overrides, derives `copilot-api.<tenant>.ghe.com` from `GITHUB_SERVER_URL=*.ghe.com`, derives `https://api.enterprise.githubcopilot.com` from other non-`github.com` server URLs, and otherwise falls back to the public Copilot routing hub `https://api.githubcopilot.com` instead of the account-specific individual endpoint.
42
42
  - If you get "model not supported", enable it in VS Code: Copilot Chat → model selector → select model → "Enable"
43
- - Supported built-in Copilot long-context models, including `github-copilot/gpt-5.5`, `github-copilot/claude-opus-4.8`, and `github-copilot/gemini-3.1-pro-preview`, expose an opt-in long-context choice through `--context-window`, the `/model` selection flow, per-model `defaultContextWindows`, SDK, and RPC controls. The long-context option advertises the model's full context window (for example `1m` or `1.05m` — GitHub's `max_context_window_tokens`), matching how the native `openai/*` and `anthropic/*` providers report these models and what the chat footer shows. GitHub's lower server-side prompt cap (`max_prompt_tokens`, for example `936k` or `922k`) is retained internally as the effective input budget that drives compaction thresholds and overflow recovery, so the branded window is displayed without overrunning the server limit.
43
+ - GitHub Copilot models are populated dynamically from Copilot's live CAPI `/models` catalog when Copilot auth is available. Atomic synthesizes only picker-enabled, non-disabled `chat` entries with plain ids (for example `github-copilot/claude-sonnet-5` and `github-copilot/mai-code-1-flash-picker`); namespaced enterprise deployments containing `/` are skipped rather than exposed as `github-copilot/*` models. Models that advertise long-context limits, such as `github-copilot/gpt-5.5`, `github-copilot/claude-opus-4.8`, and `github-copilot/gemini-3.1-pro-preview`, expose an opt-in long-context choice through `--context-window`, the `/model` selection flow, per-model `defaultContextWindows`, SDK, and RPC controls. The long-context option advertises the model's full context window (for example `1m` or `1.05m` — GitHub's `max_context_window_tokens`), matching how the native `openai/*` and `anthropic/*` providers report these models and what the chat footer shows. GitHub's lower server-side prompt cap (`max_prompt_tokens`, for example `936k` or `922k`) is retained internally as the effective input budget that drives compaction thresholds and overflow recovery, and GitHub's live output cap (`max_output_tokens`) replaces Atomic's bundled `maxTokens` fallback for provider requests. If CAPI advertises `capabilities.supports.reasoning_effort` as an array, Atomic also gates `/model` and thinking-level cycling to only those live levels for both dynamic Copilot models and bundled `pi-ai` Copilot models; budget-only or boolean-only reasoning metadata leaves the existing thinking map untouched. Active interactive sessions refresh from this metadata as soon as the catalog is applied, so a startup fallback model does not keep stale reasoning levels until restart. This lets Atomic display the branded context window, request the catalog-advertised output budget, and avoid offering unsupported Copilot reasoning levels.
44
44
  - Selecting long context sets Atomic's displayed window to the model's full capacity while compaction triggers against the effective prompt-token budget, and makes Copilot requests include `X-GitHub-Api-Version: 2026-06-01`. Atomic does not send a body field, `contextTier`, or model-id variant; GitHub automatically applies the server-side `long_context` tier when prompt tokens exceed the default budget.
45
45
  - Long-context Copilot requests consume more AI credits and require Copilot long-context/usage-based billing entitlement. A prompt that reaches the model's normal prompt cap is compacted and retried automatically. Only when GitHub rejects a prompt *below* that cap — for example because the account lacks the long-context/usage-based billing entitlement and is dropped to a smaller server tier — does Atomic surface a friendly entitlement/server-cap/cost hint rather than silently truncating context.
46
46
  - **Gemini models** (`github-copilot/gemini-3.1-pro-preview`, `github-copilot/gemini-3.5-flash`, …) are served through Copilot's CAPI gateway, which re-translates the OpenAI request into Google's GenAI format and enforces Gemini's stricter `FunctionDeclaration` schema (it rejects a tool-parameter `anyOf`/`oneOf` whose branch is a complex object, returning `400 invalid request body`). Atomic automatically sanitizes outbound tool/function JSON Schemas for these models into the supported subset — resolving object/array-bearing unions to their most expressive branch, converting `const`/literal unions to `enum`, collapsing nullable unions to `nullable`, and dropping non-portable keywords such as `additionalProperties`, `patternProperties`, `format`, and numeric/length bounds. Gemini also serializes array/object tool-call **arguments** as flattened indexed keys (`keywords[0]`, `keywords[1]`, …); Atomic reconstructs these back into proper arrays/objects before validation so tool calls (including `structured_output` and MCP tools) don't fail and loop. Both transforms are transparent and scoped to GitHub Copilot Gemini models only; no configuration is required and other providers/models are unaffected.
package/docs/rpc.md CHANGED
@@ -335,7 +335,7 @@ Unsupported or malformed selections return the standard RPC error response:
335
335
  }
336
336
  ```
337
337
 
338
- Larger provider context windows may consume more credits/cost. For allowlisted GitHub Copilot long-context models (including `github-copilot/gpt-5.5` and `github-copilot/gemini-3.1-pro-preview`), selecting `1m` raises Atomic's local budget and sends `X-GitHub-Api-Version: 2026-06-01`; GitHub applies the long-context billing tier server-side by prompt token count. That tier consumes more Copilot AI credits and requires Copilot long-context/usage-based billing entitlement, otherwise requests over GitHub's server cap are rejected with a friendly hint.
338
+ Larger provider context windows may consume more credits/cost. For catalog-advertised GitHub Copilot long-context models (including `github-copilot/gpt-5.5`, `github-copilot/claude-sonnet-5`, and `github-copilot/gemini-3.1-pro-preview`), selecting `1m` raises Atomic's local budget and sends `X-GitHub-Api-Version: 2026-06-01`; GitHub applies the long-context billing tier server-side by prompt token count. That tier consumes more Copilot AI credits and requires Copilot long-context/usage-based billing entitlement, otherwise requests over GitHub's server cap are rejected with a friendly hint.
339
339
 
340
340
  ### Thinking
341
341
 
@@ -1042,7 +1042,7 @@ Emitted when the active context-window token budget changes through RPC `set_con
1042
1042
  }
1043
1043
  ```
1044
1044
 
1045
- Larger provider context windows may consume more credits/cost. Prefer the model default unless the additional repository/session context is useful for the current task. For allowlisted GitHub Copilot long-context models such as `github-copilot/gpt-5.5` and `github-copilot/gemini-3.1-pro-preview`, a `1m` selection raises Atomic's local budget and sends `X-GitHub-Api-Version: 2026-06-01`; GitHub applies the long-context billing tier server-side by prompt size, consumes more Copilot AI credits, and requires long-context/usage-based billing entitlement.
1045
+ Larger provider context windows may consume more credits/cost. Prefer the model default unless the additional repository/session context is useful for the current task. For catalog-advertised GitHub Copilot long-context models such as `github-copilot/gpt-5.5`, `github-copilot/claude-sonnet-5`, and `github-copilot/gemini-3.1-pro-preview`, a `1m` selection raises Atomic's local budget and sends `X-GitHub-Api-Version: 2026-06-01`; GitHub applies the long-context billing tier server-side by prompt size, consumes more Copilot AI credits, and requires long-context/usage-based billing entitlement.
1046
1046
 
1047
1047
  ### compaction_start / compaction_end
1048
1048
 
package/docs/sdk.md CHANGED
@@ -439,7 +439,7 @@ If no model is provided:
439
439
 
440
440
  Context-window selection is independent from `thinkingLevel`. `contextWindow` accepts a raw token count such as `400_000` or `1_000_000`; for most providers the value must be present in the model's supported context windows (`model.contextWindowOptions` plus the scalar default). GitHub Copilot is the only provider with rounded long-context budget handling: when a tiered Copilot model advertises a long tier below the branded request (for example `936_000` for a `1_000_000` request), Atomic selects the largest advertised Copilot long tier at or below the request instead of falling back to the short tier. Settings lookup first checks the selected model's `defaultContextWindows["provider/modelId"]` entry, then the optional global `defaultContextWindow` fallback; unsupported model-specific settings keep the model default and return `contextWindowWarning`, while unsupported global fallback values are ignored silently as not applicable to the active model. When you pass `contextWindowStrict: true`, an unsupported explicit selection is reported as `contextWindowError` so callers can fail before prompting. A successful explicit `contextWindow` startup option is journaled as a `context_window_change` entry even when it equals the scalar model default, so the user's explicit budget choice survives future settings changes and resume.
441
441
 
442
- At runtime, use `session.getAvailableContextWindows()` to inspect supported values, `session.supportsContextWindowSelection()` to check whether more than one value is selectable, and `session.setContextWindow(tokens, { persistDefault })` to change the active model budget. `setContextWindow()` journals a `context_window_change` entry only when the active value changes. Passing `{ persistDefault: true }` also writes the effective selected budget to `defaultContextWindows["provider/modelId"]` in settings instead of the global fallback, so a Copilot prompt cap such as `936k` does not leak into Anthropic, Cursor, or other providers. Tree navigation replays the target branch's `context_window_change` state into the active model without adding another journal entry or changing settings. Larger provider context windows may consume more credits/cost, so opt into larger values deliberately. For allowlisted GitHub Copilot long-context models (including `github-copilot/gpt-5.5` and `github-copilot/gemini-3.1-pro-preview`), selecting `1m` raises Atomic's local budget to the model's advertised `922k`/`936k` tier and sends `X-GitHub-Api-Version: 2026-06-01`; GitHub applies the long-context tier server-side by prompt token count, consumes more Copilot AI credits, and requires long-context/usage-based billing entitlement.
442
+ At runtime, use `session.getAvailableContextWindows()` to inspect supported values, `session.supportsContextWindowSelection()` to check whether more than one value is selectable, and `session.setContextWindow(tokens, { persistDefault })` to change the active model budget. `setContextWindow()` journals a `context_window_change` entry only when the active value changes. Passing `{ persistDefault: true }` also writes the effective selected budget to `defaultContextWindows["provider/modelId"]` in settings instead of the global fallback, so a Copilot prompt cap such as `936k` does not leak into Anthropic, Cursor, or other providers. Tree navigation replays the target branch's `context_window_change` state into the active model without adding another journal entry or changing settings. Larger provider context windows may consume more credits/cost, so opt into larger values deliberately. For catalog-advertised GitHub Copilot long-context models (including `github-copilot/gpt-5.5`, `github-copilot/claude-sonnet-5`, and `github-copilot/gemini-3.1-pro-preview`), selecting `1m` raises Atomic's local budget to the model's advertised `922k`/`936k` tier and sends `X-GitHub-Api-Version: 2026-06-01`; GitHub applies the long-context tier server-side by prompt token count, consumes more Copilot AI credits, and requires long-context/usage-based billing entitlement.
443
443
 
444
444
  The package root exports the same context-window helpers and types used by the runtime: `parseContextWindowValue()`, `formatContextWindow()`, `validateContextWindowValue()`, `normalizeContextWindowOptions()`, `getModelDefaultContextWindow()`, `getSupportedContextWindows()`, `withContextWindowOptions()`, `selectContextWindow()`, `ContextWindowParseResult`, `ContextWindowSelection`, `ContextWindowSelectionError`, and `ContextWindowSelectionOptions`. Importing from `@bastani/atomic` also includes the `@earendil-works/pi-ai` `Model<Api>` augmentation for `contextWindowOptions` and `defaultContextWindow`, so SDK consumers can use the helper types without importing internal source paths.
445
445
 
package/docs/settings.md CHANGED
@@ -250,12 +250,13 @@ When multiple sources specify a session directory, precedence is `--session-dir`
250
250
  "defaultContextWindow": "1m",
251
251
  "defaultContextWindows": {
252
252
  "github-copilot/claude-opus-4.8": "936k",
253
+ "github-copilot/claude-sonnet-5": "936k",
253
254
  "github-copilot/gpt-5.5": "922k"
254
255
  }
255
256
  }
256
257
  ```
257
258
 
258
- Context-window settings are independent of `defaultThinkingLevel`: selecting a larger context window does not change reasoning effort. Interactive users can change the active model's budget through the `/model` selection flow, which prompts for a context window whenever the chosen model supports more than one window and persists the effective selection under `defaultContextWindows["provider/modelId"]`. Atomic treats `defaultContextWindow` as a broad fallback only: if the active model does not support that value, the model's own default is used without a startup warning; targeted `defaultContextWindows` entries still warn when they become unsupported for their exact model. Larger provider context windows can carry higher usage cost. For GitHub Copilot allowlisted long-context models (including `github-copilot/gpt-5.5` and `github-copilot/gemini-3.1-pro-preview`), selecting `1m` raises Atomic's local prompt budget to the largest advertised long-context tier at or below that rounded request (for example `922k` or `936k`) and sends `X-GitHub-Api-Version: 2026-06-01`; GitHub then applies the long-context tier server-side by prompt token count. That tier consumes more Copilot AI credits and requires Copilot long-context/usage-based billing entitlement, otherwise requests over the server cap are rejected with a friendly hint. Custom providers and explicit model overrides can still declare their own selectable `contextWindowOptions`.
259
+ Context-window settings are independent of `defaultThinkingLevel`: selecting a larger context window does not change reasoning effort. Interactive users can change the active model's budget through the `/model` selection flow, which prompts for a context window whenever the chosen model supports more than one window and persists the effective selection under `defaultContextWindows["provider/modelId"]`. Atomic treats `defaultContextWindow` as a broad fallback only: if the active model does not support that value, the model's own default is used without a startup warning; targeted `defaultContextWindows` entries still warn when they become unsupported for their exact model. Larger provider context windows can carry higher usage cost. For catalog-advertised GitHub Copilot long-context models (including dynamically populated plain catalog ids such as `github-copilot/claude-sonnet-5`, while namespaced enterprise deployment ids containing `/` are skipped), selecting `1m` raises Atomic's local prompt budget to the largest advertised long-context tier at or below that rounded request (for example `922k` or `936k`) and sends `X-GitHub-Api-Version: 2026-06-01`; GitHub then applies the long-context tier server-side by prompt token count. That tier consumes more Copilot AI credits and requires Copilot long-context/usage-based billing entitlement, otherwise requests over the server cap are rejected with a friendly hint. Custom providers and explicit model overrides can still declare their own selectable `contextWindowOptions`.
259
260
 
260
261
  ### Markdown
261
262
 
package/docs/subagents.md CHANGED
@@ -175,6 +175,12 @@ Dynamic fanout `collect.outputSchema` validates the collected result array after
175
175
 
176
176
  Agents can define ordered `fallbackModels` for retryable provider or model failures such as rate limits, quota/auth problems, unavailable models, network timeouts, or 5xx errors. Atomic tries the requested primary model first, then configured fallbacks, and finally appends the current user-selected model as the last fallback candidate when available.
177
177
 
178
+ A candidate that cannot serve the current request — for example an HTTP 400/413/422 bad/unprocessable/payload-too-large request, an unsupported tool or parameter, a context-length/context-window overflow, or a `too large` / `invalid_request` error — is treated as request/context incompatible and the chain advances to the next candidate rather than stopping. This means that if none of the configured candidates are applicable to the request, Atomic falls back to the currently selected user model instead of failing outright.
179
+
180
+ Each foreground and background model candidate is bounded by a per-attempt idle watchdog (default 5 minutes without child stdout, stderr, or JSON child events) and an absolute wall-clock cap (default 60 minutes). An in-flight tool execution counts as activity, so a slow, quiet tool call (a long build or test run that streams nothing until it finishes) is not mistaken for a stalled attempt; only the wall-clock cap bounds such attempts. If either watchdog trips, Atomic terminates that child attempt, records a retryable timeout in `modelAttempts`, and continues to the next fallback candidate. The defaults can be overridden with `ATOMIC_SUBAGENT_ATTEMPT_IDLE_TIMEOUT_MS` and `ATOMIC_SUBAGENT_ATTEMPT_TIMEOUT_MS`; `ATOMIC_SUBAGENT_ATTEMPT_KILL_GRACE_MS` controls SIGTERM-to-SIGKILL escalation. Setting the idle or wall-clock variable to `0` (or a negative value) disables that timeout entirely; non-numeric values are ignored and the default applies. The kill-grace period cannot be disabled — `0`, negative, or non-numeric values fall back to its default so escalation always stays bounded.
181
+
182
+ When registry availability shows that a known candidate provider has no configured auth, Atomic records a skipped model attempt before spawning a child. Unknown/custom providers are still attempted, and the current user-selected model appended as the final fallback is never filtered out by this pre-spawn check.
183
+
178
184
  Fallbacks do not retry ordinary task failures, validation failures, tool failures, cancellations, or workflow-code errors. Because a fallback may send the same prompt and context to a different provider, choose models that match your cost, privacy, and data-handling requirements.
179
185
 
180
186
  Each candidate can also carry its own reasoning effort — see [Reasoning levels](#reasoning-levels).
package/docs/workflows.md CHANGED
@@ -1816,6 +1816,8 @@ For lower-level integrations, `@bastani/workflows` also exports `setupGitWorktre
1816
1816
 
1817
1817
  `fallbackModels` retries transient provider/model failures with the primary `model` first, then each fallback, then the current Atomic-selected model when available. It is for rate limits, quota/auth/provider outages, unavailable models, network timeouts, generic transport errors such as `Connection error.` / `fetch failed`, and 5xx errors — not workflow-code errors, tool failures, validation failures, or cancellations.
1818
1818
 
1819
+ A candidate that is **request/context incompatible** with the current turn — for example an HTTP 400/413/422 bad/unprocessable/payload-too-large request, an unsupported tool or parameter, a context-length/context-window overflow, or a `too large` / `invalid_request` / `bad_request` error — also advances the chain to the next candidate rather than stopping. This ensures that if none of the configured candidates can serve the request, the workflow stage falls back to the currently selected user model instead of hard-failing. Refusals, content-filter/safety blocks, cancellations, and task failures still stop the chain and are never retried on another model.
1820
+
1819
1821
  When a finished stage's session is reattached for a follow-up (for example a post-completion follow-up, or after the CLI is reloaded), the stage resumes on the model the session last settled on — the one that actually worked — instead of replaying the chain from the primary. If that model fails again with a transient/retryable error, the full chain is retried from the primary.
1820
1822
 
1821
1823
  ### Reasoning levels
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.9.4-alpha.6",
3
+ "version": "0.9.4-alpha.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bastani/atomic",
9
- "version": "0.9.4-alpha.6",
9
+ "version": "0.9.4-alpha.7",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@bastani/atomic-natives": "0.9.4-alpha.6",
13
- "@bufbuild/protobuf": "^2.0.0",
12
+ "@bastani/atomic-natives": "0.9.4-alpha.7",
13
+ "@bufbuild/protobuf": "^2.12.1",
14
14
  "@earendil-works/pi-agent-core": "^0.80.3",
15
15
  "@earendil-works/pi-ai": "^0.80.3",
16
16
  "@earendil-works/pi-tui": "^0.80.3",
17
- "@modelcontextprotocol/ext-apps": "^1.7.2",
17
+ "@modelcontextprotocol/ext-apps": "^1.7.4",
18
18
  "@modelcontextprotocol/sdk": "^1.25.1",
19
19
  "@mozilla/readability": "^0.6.0",
20
20
  "@silvia-odwyer/photon-node": "0.3.4",
@@ -33,7 +33,7 @@
33
33
  "open": "^11.0.0",
34
34
  "p-limit": "^7.3.0",
35
35
  "proper-lockfile": "4.1.2",
36
- "semver": "7.8.0",
36
+ "semver": "7.8.5",
37
37
  "turndown": "^7.2.0",
38
38
  "typebox": "1.1.38",
39
39
  "undici": "8.5.0",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "@mariozechner/clipboard": "0.3.9",
46
- "@dbos-inc/dbos-sdk": "4.20.11"
46
+ "@dbos-inc/dbos-sdk": "4.22.6"
47
47
  },
48
48
  "bin": {
49
49
  "atomic": "dist/cli.js"
@@ -514,16 +514,16 @@
514
514
  }
515
515
  },
516
516
  "node_modules/@bastani/atomic-natives": {
517
- "version": "0.9.4-alpha.6",
518
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.4-alpha.6.tgz",
517
+ "version": "0.9.4-alpha.7",
518
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.4-alpha.7.tgz",
519
519
  "license": "MIT",
520
520
  "optionalDependencies": {
521
- "@bastani/atomic-natives-darwin-arm64": "0.9.4-alpha.6",
522
- "@bastani/atomic-natives-darwin-x64": "0.9.4-alpha.6",
523
- "@bastani/atomic-natives-linux-arm64-gnu": "0.9.4-alpha.6",
524
- "@bastani/atomic-natives-linux-x64-gnu": "0.9.4-alpha.6",
525
- "@bastani/atomic-natives-win32-arm64-msvc": "0.9.4-alpha.6",
526
- "@bastani/atomic-natives-win32-x64-msvc": "0.9.4-alpha.6"
521
+ "@bastani/atomic-natives-darwin-arm64": "0.9.4-alpha.7",
522
+ "@bastani/atomic-natives-darwin-x64": "0.9.4-alpha.7",
523
+ "@bastani/atomic-natives-linux-arm64-gnu": "0.9.4-alpha.7",
524
+ "@bastani/atomic-natives-linux-x64-gnu": "0.9.4-alpha.7",
525
+ "@bastani/atomic-natives-win32-arm64-msvc": "0.9.4-alpha.7",
526
+ "@bastani/atomic-natives-win32-x64-msvc": "0.9.4-alpha.7"
527
527
  },
528
528
  "engines": {
529
529
  "bun": ">=1.3.14",
@@ -531,8 +531,8 @@
531
531
  }
532
532
  },
533
533
  "node_modules/@bastani/atomic-natives-darwin-arm64": {
534
- "version": "0.9.4-alpha.6",
535
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.4-alpha.6.tgz",
534
+ "version": "0.9.4-alpha.7",
535
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.4-alpha.7.tgz",
536
536
  "license": "MIT",
537
537
  "os": [
538
538
  "darwin"
@@ -543,8 +543,8 @@
543
543
  "optional": true
544
544
  },
545
545
  "node_modules/@bastani/atomic-natives-darwin-x64": {
546
- "version": "0.9.4-alpha.6",
547
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.4-alpha.6.tgz",
546
+ "version": "0.9.4-alpha.7",
547
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.4-alpha.7.tgz",
548
548
  "license": "MIT",
549
549
  "os": [
550
550
  "darwin"
@@ -555,8 +555,8 @@
555
555
  "optional": true
556
556
  },
557
557
  "node_modules/@bastani/atomic-natives-linux-arm64-gnu": {
558
- "version": "0.9.4-alpha.6",
559
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.4-alpha.6.tgz",
558
+ "version": "0.9.4-alpha.7",
559
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.4-alpha.7.tgz",
560
560
  "license": "MIT",
561
561
  "os": [
562
562
  "linux"
@@ -570,8 +570,8 @@
570
570
  "optional": true
571
571
  },
572
572
  "node_modules/@bastani/atomic-natives-linux-x64-gnu": {
573
- "version": "0.9.4-alpha.6",
574
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.4-alpha.6.tgz",
573
+ "version": "0.9.4-alpha.7",
574
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.4-alpha.7.tgz",
575
575
  "license": "MIT",
576
576
  "os": [
577
577
  "linux"
@@ -585,8 +585,8 @@
585
585
  "optional": true
586
586
  },
587
587
  "node_modules/@bastani/atomic-natives-win32-arm64-msvc": {
588
- "version": "0.9.4-alpha.6",
589
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.4-alpha.6.tgz",
588
+ "version": "0.9.4-alpha.7",
589
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.4-alpha.7.tgz",
590
590
  "license": "MIT",
591
591
  "os": [
592
592
  "win32"
@@ -597,8 +597,8 @@
597
597
  "optional": true
598
598
  },
599
599
  "node_modules/@bastani/atomic-natives-win32-x64-msvc": {
600
- "version": "0.9.4-alpha.6",
601
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.4-alpha.6.tgz",
600
+ "version": "0.9.4-alpha.7",
601
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.4-alpha.7.tgz",
602
602
  "license": "MIT",
603
603
  "os": [
604
604
  "win32"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.9.4-alpha.6",
3
+ "version": "0.9.4-alpha.7",
4
4
  "description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "atomicConfig": {
@@ -75,12 +75,12 @@
75
75
  "prepublishOnly": "bun run clean && bun run build && bun run shrinkwrap"
76
76
  },
77
77
  "dependencies": {
78
- "@bastani/atomic-natives": "0.9.4-alpha.6",
79
- "@bufbuild/protobuf": "^2.0.0",
78
+ "@bastani/atomic-natives": "0.9.4-alpha.7",
79
+ "@bufbuild/protobuf": "^2.12.1",
80
80
  "@earendil-works/pi-agent-core": "^0.80.3",
81
81
  "@earendil-works/pi-ai": "^0.80.3",
82
82
  "@earendil-works/pi-tui": "^0.80.3",
83
- "@modelcontextprotocol/ext-apps": "^1.7.2",
83
+ "@modelcontextprotocol/ext-apps": "^1.7.4",
84
84
  "@modelcontextprotocol/sdk": "^1.25.1",
85
85
  "@mozilla/readability": "^0.6.0",
86
86
  "@silvia-odwyer/photon-node": "0.3.4",
@@ -99,7 +99,7 @@
99
99
  "open": "^11.0.0",
100
100
  "p-limit": "^7.3.0",
101
101
  "proper-lockfile": "4.1.2",
102
- "semver": "7.8.0",
102
+ "semver": "7.8.5",
103
103
  "turndown": "^7.2.0",
104
104
  "typebox": "1.1.38",
105
105
  "undici": "8.5.0",
@@ -115,7 +115,7 @@
115
115
  },
116
116
  "optionalDependencies": {
117
117
  "@mariozechner/clipboard": "0.3.9",
118
- "@dbos-inc/dbos-sdk": "4.20.11"
118
+ "@dbos-inc/dbos-sdk": "4.22.6"
119
119
  },
120
120
  "devDependencies": {
121
121
  "@types/cross-spawn": "6.0.6",