@bastani/atomic 0.9.20-alpha.6 → 0.9.20-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 (155) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/builtin/intercom/package.json +2 -2
  3. package/dist/builtin/mcp/package.json +2 -2
  4. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  5. package/dist/builtin/subagents/package.json +3 -3
  6. package/dist/builtin/subagents/src/extension/index.bundle.mjs +18 -8
  7. package/dist/builtin/web-access/package.json +2 -2
  8. package/dist/builtin/workflows/CHANGELOG.md +21 -0
  9. package/dist/builtin/workflows/README.md +5 -19
  10. package/dist/builtin/workflows/builtin/{chunk-deq63d9p.js → chunk-7bzcersz.js} +30 -19
  11. package/dist/builtin/workflows/builtin/goal.js +1 -1
  12. package/dist/builtin/workflows/builtin/index.js +1 -1
  13. package/dist/builtin/workflows/package.json +2 -2
  14. package/dist/builtin/workflows/skills/prompt-engineer/SKILL.md +10 -9
  15. package/dist/builtin/workflows/skills/prompt-engineer/references/advanced_patterns.md +4 -4
  16. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5.md +96 -23
  17. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5_1.md +75 -27
  18. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_4_8.md +72 -26
  19. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5.md +58 -22
  20. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5_5.md +118 -0
  21. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_sonnet_5.md +70 -29
  22. package/dist/builtin/workflows/skills/prompt-engineer/references/core_prompting.md +1 -1
  23. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_5_5.md +95 -32
  24. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_5_6.md +79 -30
  25. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6.md +139 -0
  26. package/dist/builtin/workflows/skills/prompt-engineer/references/quality_improvement.md +4 -4
  27. package/dist/builtin/workflows/src/extension/index.bundle.mjs +247 -603
  28. package/dist/builtin/workflows/src/index.js +17 -7
  29. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  30. package/dist/core/agent-session-message-queue.js +3 -1
  31. package/dist/core/agent-session-message-queue.js.map +1 -1
  32. package/dist/core/agent-session-methods.d.ts +3 -0
  33. package/dist/core/agent-session-methods.d.ts.map +1 -1
  34. package/dist/core/agent-session-methods.js.map +1 -1
  35. package/dist/core/agent-session-runtime.d.ts +4 -0
  36. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  37. package/dist/core/agent-session-runtime.js +6 -0
  38. package/dist/core/agent-session-runtime.js.map +1 -1
  39. package/dist/core/agent-session-tasks.d.ts +9 -0
  40. package/dist/core/agent-session-tasks.d.ts.map +1 -1
  41. package/dist/core/agent-session-tasks.js +68 -16
  42. package/dist/core/agent-session-tasks.js.map +1 -1
  43. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  44. package/dist/core/agent-session-tool-registry.js +9 -21
  45. package/dist/core/agent-session-tool-registry.js.map +1 -1
  46. package/dist/core/agent-session-types.d.ts +2 -0
  47. package/dist/core/agent-session-types.d.ts.map +1 -1
  48. package/dist/core/agent-session-types.js.map +1 -1
  49. package/dist/core/agent-session.d.ts +3 -0
  50. package/dist/core/agent-session.d.ts.map +1 -1
  51. package/dist/core/agent-session.js +5 -2
  52. package/dist/core/agent-session.js.map +1 -1
  53. package/dist/core/execution-model-router.d.ts +14 -0
  54. package/dist/core/execution-model-router.d.ts.map +1 -1
  55. package/dist/core/execution-model-router.js +67 -21
  56. package/dist/core/execution-model-router.js.map +1 -1
  57. package/dist/core/fast-model-variants.d.ts +16 -0
  58. package/dist/core/fast-model-variants.d.ts.map +1 -1
  59. package/dist/core/fast-model-variants.js +27 -0
  60. package/dist/core/fast-model-variants.js.map +1 -1
  61. package/dist/core/model-runtime.d.ts +13 -1
  62. package/dist/core/model-runtime.d.ts.map +1 -1
  63. package/dist/core/model-runtime.js +16 -1
  64. package/dist/core/model-runtime.js.map +1 -1
  65. package/dist/core/sdk-types.d.ts +5 -0
  66. package/dist/core/sdk-types.d.ts.map +1 -1
  67. package/dist/core/sdk-types.js.map +1 -1
  68. package/dist/core/sdk.d.ts.map +1 -1
  69. package/dist/core/sdk.js +4 -0
  70. package/dist/core/sdk.js.map +1 -1
  71. package/dist/core/settings-types.js.map +1 -1
  72. package/dist/core/structured-output/index.d.ts +1 -0
  73. package/dist/core/structured-output/index.d.ts.map +1 -1
  74. package/dist/core/structured-output/index.js +34 -26
  75. package/dist/core/structured-output/index.js.map +1 -1
  76. package/dist/core/structured-output/jev-client.d.ts +9 -0
  77. package/dist/core/structured-output/jev-client.d.ts.map +1 -1
  78. package/dist/core/structured-output/jev-client.js +57 -3
  79. package/dist/core/structured-output/jev-client.js.map +1 -1
  80. package/dist/core/structured-output/jev.d.ts.map +1 -1
  81. package/dist/core/structured-output/jev.js +35 -53
  82. package/dist/core/structured-output/jev.js.map +1 -1
  83. package/dist/core/structured-output/resolver.d.ts +32 -24
  84. package/dist/core/structured-output/resolver.d.ts.map +1 -1
  85. package/dist/core/structured-output/resolver.js +57 -9
  86. package/dist/core/structured-output/resolver.js.map +1 -1
  87. package/dist/core/structured-output/types.d.ts +8 -4
  88. package/dist/core/structured-output/types.d.ts.map +1 -1
  89. package/dist/core/structured-output/types.js.map +1 -1
  90. package/dist/core/tasks/child-command-owner.d.ts +34 -0
  91. package/dist/core/tasks/child-command-owner.d.ts.map +1 -0
  92. package/dist/core/tasks/child-command-owner.js +70 -0
  93. package/dist/core/tasks/child-command-owner.js.map +1 -0
  94. package/dist/core/tools/bash-pty-native.d.ts +5 -1
  95. package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
  96. package/dist/core/tools/bash-pty-native.js +15 -7
  97. package/dist/core/tools/bash-pty-native.js.map +1 -1
  98. package/dist/core/tools/kill.d.ts +2 -2
  99. package/dist/core/tools/kill.d.ts.map +1 -1
  100. package/dist/core/tools/kill.js +3 -4
  101. package/dist/core/tools/kill.js.map +1 -1
  102. package/dist/index.d.ts +3 -3
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +2 -2
  105. package/dist/index.js.map +1 -1
  106. package/dist/modes/interactive/interactive-auth-login.js +2 -4
  107. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  108. package/dist/modes/interactive-engine/isolated-auth.d.ts +16 -0
  109. package/dist/modes/interactive-engine/isolated-auth.d.ts.map +1 -1
  110. package/dist/modes/interactive-engine/isolated-auth.js +27 -0
  111. package/dist/modes/interactive-engine/isolated-auth.js.map +1 -1
  112. package/dist/modes/interactive-engine/isolated-runtime.d.ts +4 -0
  113. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  114. package/dist/modes/interactive-engine/isolated-runtime.js +4 -1
  115. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  116. package/dist/modes/rpc/rpc-client-api.d.ts +2 -1
  117. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  118. package/dist/modes/rpc/rpc-client-api.js +7 -2
  119. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  120. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  121. package/dist/modes/rpc/rpc-command-handler.js +3 -1
  122. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  123. package/dist/modes/rpc/rpc-provider-auth.d.ts +2 -1
  124. package/dist/modes/rpc/rpc-provider-auth.d.ts.map +1 -1
  125. package/dist/modes/rpc/rpc-provider-auth.js +2 -2
  126. package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
  127. package/dist/modes/rpc/rpc-types.d.ts +2 -0
  128. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  129. package/dist/modes/rpc/rpc-types.js.map +1 -1
  130. package/docs/background-tasks.md +11 -2
  131. package/docs/environment-variables.md +1 -1
  132. package/docs/getting-started/first-session.md +2 -2
  133. package/docs/llama-cpp.md +2 -2
  134. package/docs/models/evals.md +47 -43
  135. package/docs/models/reference.md +1 -1
  136. package/docs/providers.md +11 -4
  137. package/docs/reference/cli.md +2 -2
  138. package/docs/rpc/examples.md +2 -0
  139. package/docs/sdk/reference.md +1 -1
  140. package/docs/sdk/structured-decisions.md +20 -14
  141. package/docs/settings.md +8 -8
  142. package/docs/skills.md +5 -1
  143. package/docs/subagents/reference.md +2 -2
  144. package/docs/subagents.md +1 -1
  145. package/docs/workflows/api-reference.md +5 -34
  146. package/docs/workflows/builtins.md +1 -1
  147. package/docs/workflows/operations.md +11 -77
  148. package/docs/workflows/reliable-design.md +14 -29
  149. package/docs/workflows.md +8 -7
  150. package/examples/rpc-client.ts +38 -0
  151. package/examples/rpc-extension-ui.ts +19 -5
  152. package/examples/sdk/README.md +1 -1
  153. package/npm-shrinkwrap.json +65 -65
  154. package/package.json +7 -7
  155. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_astra.md +0 -58
package/dist/index.js CHANGED
@@ -23,12 +23,12 @@ export { CLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL, createGatewayBindingFetch, }
23
23
  // Compaction
24
24
  export { calculateContextTokens, collectEntriesForBranchSummary, DEFAULT_COMPACTION_SETTINGS, estimateTokens, generateBranchSummary, getLastAssistantUsage, prepareBranchEntries, prepareCompactionBoundary, runVerbatimCompaction, serializeConversation, serializeConversationForCompaction, shouldCompact, startNewContextWindow, } from "./core/compaction/index.js";
25
25
  export { createEventBus } from "./core/event-bus.js";
26
- export { routeExecutionModel } from "./core/execution-model-router.js";
26
+ export { AutoRoutingInferenceError, routeExecutionModel, } from "./core/execution-model-router.js";
27
27
  export { areExperimentalFeaturesEnabled } from "./core/experimental.js";
28
28
  export { sessionScopedExtensionState } from "./core/extension-session-state.js";
29
29
  export { getModelFastRoute, resolveUpstreamModelId, usesChatGptCodexTransport, usesFirstPartyCodexRouting, withCodexFastRouteHeaders, withFastRouteStreamOptions, } from "./core/fast-model-routing.js";
30
30
  export { CODEX_FAST_ROUTE_HEADER, CODEX_FAST_ROUTE_ORIGINATOR, } from "./core/fast-model-routing-transport.js";
31
- export { copilotAdvertisedFastModelIds, deriveFastModelVariants, FAST_MODEL_ID_SUFFIX, FAST_MODEL_SERVICE_TIER, fastModelId, isNativeFastRouteApi, usesOpenAIFastServiceTier, withFastModelVariants, } from "./core/fast-model-variants.js";
31
+ export { ANTHROPIC_FAST_MODE_MODEL_IDS, copilotAdvertisedFastModelIds, deriveFastModelVariants, FAST_MODEL_ID_SUFFIX, FAST_MODEL_SERVICE_TIER, FAST_MODEL_SPEED, fastModelId, isNativeFastRouteApi, usesAnthropicFastMode, usesOpenAIFastServiceTier, withFastModelVariants, } from "./core/fast-model-variants.js";
32
32
  export { parseFlattenedKeyPath, reconstructFlattenedKeys, unflattenArgumentsWithSchema, } from "./core/flattened-tool-arguments.js";
33
33
  export { RUNTIME_INTERCOM_GROUP_ENV, readRuntimeIntercomGroup, runtimeIntercomGroupEnvKey, } from "./core/intercom-runtime-group.js";
34
34
  export { keybindingIdentity } from "./core/keybinding-identity.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,WAAW,GAIX,MAAM,wBAAwB,CAAC;AAWhC,OAAO,EAAE,mBAAmB,EAAyB,MAAM,4BAA4B,CAAC;AACxF,gEAAgE;AAChE,OAAO,EAAE,aAAa,EAA0D,MAAM,+BAA+B,CAAC;AAEtH,OAAO,EAA0B,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC3G,OAAO,EAAE,OAAO,EAAE,MAAM,4CAA4C,CAAC;AACrE,OAAO,EACN,0BAA0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rB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,4BAA4B,EAE5B,sBAAsB,GAEtB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACN,mBAAmB,EACnB,sCAAsC,EACtC,uBAAuB,GACvB,MAAM,mDAAmD,CAAC;AAC3D,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,uCAAuC;AACvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,6BAA6B,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACvF,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EACN,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,qCAAqC,EACrC,uCAAuC,EAGvC,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC3G,OAAO,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AACvE,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export type { ExtensionBindings } from \"./core/agent-session-types.js\";\nexport {\n\tCacheWarmer,\n\ttype CacheWarmingDecisionEvent,\n\ttype CacheWarmingDecisionEventResult,\n\ttype CacheWarmingStatus,\n} from \"./core/cache-warmer.ts\";\nexport type {\n\tHostDiagnostic,\n\tHostInput,\n\tHostInputOptions,\n\tQuestionAnswer,\n\tQuestionnaireError,\n\tQuestionnaireResult,\n\tQuestionParams,\n} from \"./core/extensions/host-input.js\";\nexport type { UsageEntry } from \"./core/session-manager.ts\";\nexport { CACHE_WARMING_MODES, type CacheWarmingMode } from \"./core/settings-manager.ts\";\n// Internal trusted-host task integration (not model authority).\nexport { AgentTaskHost, type AgentTaskHostBinding, type AgentTaskRunnerFactory } from \"./core/tasks/agent-adapter.js\";\nexport type { AgentIntent, OperationId, TaskId, TaskResult, WaitPolicy } from \"./core/tasks/contracts.js\";\nexport { type AdmittedAgentTask, collectAgentTasks } from \"./core/tasks/execution-scope.js\";\nexport { bindOwnerTaskStore, getOwnerTaskStore, OwnerTaskStore } from \"./core/tasks/owner-store.js\";\nexport { renderTaskFooter, TaskList, taskListSections } from \"./modes/interactive/components/task-list.js\";\nexport { TaskRow } from \"./modes/interactive/components/task-row.js\";\nexport {\n\tapplyAssistantMessageDelta,\n\tbeginStreamingAssistantMessage,\n} from \"./modes/interactive/streaming-assistant-message.ts\";\n// Core session management\n\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\tCONFIG_DIR_NAME,\n\tCONFIG_DIR_NAMES,\n\tgetAgentConfigPaths,\n\tgetAgentDir,\n\tgetAgentDirs,\n\tgetBundledInteractiveAssetPath,\n\tgetChangelogPath,\n\tgetDocsPath,\n\tgetEnvNames,\n\tgetEnvValue,\n\tgetExamplesPath,\n\tgetExportTemplateDir,\n\tgetInteractiveAssetsDir,\n\tgetLegacyAgentDir,\n\tgetPackageDir,\n\tgetPackageJsonPath,\n\tgetProjectConfigDirs,\n\tgetProjectConfigPaths,\n\tgetReadmePath,\n\tgetThemesDir,\n\tgetUserConfigDirs,\n\tgetUserConfigPaths,\n\thasEnvValue,\n\tisBunBinary,\n\tLEGACY_CONFIG_DIR_NAME,\n\tLEGACY_ENV_PREFIX,\n\tPACKAGE_NAME,\n\tsetEnvValue,\n\tVERSION,\n\tWORKFLOW_STAGE_SUBAGENT_GUARD_ENV,\n} from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype CompactionReason,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model runtime\nexport { AuthStorage, readStoredCredential } from \"./core/auth-storage.ts\";\nexport {\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n} from \"./core/auth-storage-backends.ts\";\nexport { type BashResult, executeBashWithOperations } from \"./core/bash-executor.ts\";\nexport { getBuiltinPackagePaths } from \"./core/builtin-packages.ts\";\nexport {\n\ttype CallbackActivityDescriptor,\n\ttype CallbackActivityKind,\n\trunCallback,\n\trunSynchronousCallback,\n} from \"./core/callback-activity.ts\";\n// Cloudflare AI Gateway over the Workers AI binding (no API token; see docs/providers.md)\nexport {\n\ttype AiGatewayBinding,\n\ttype AiGatewayBindingGateway,\n\ttype AiGatewayUniversalRequestLike,\n\tCLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL,\n\tcreateGatewayBindingFetch,\n\ttype GatewayBindingFetchOptions,\n} from \"./core/cloudflare-gateway-binding.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactedTranscript,\n\ttype CompactionPlannerModel,\n\ttype CompactionPlanOptions,\n\ttype CompactionRung,\n\ttype CompactionRungResult,\n\ttype CompactionRunRequest,\n\ttype CompactionUrgency,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgetLastAssistantUsage,\n\ttype LineRange,\n\ttype PlannerAuth,\n\ttype PlannerBudget,\n\ttype PlannerLimitClass,\n\ttype PlannerOutcome,\n\tprepareBranchEntries,\n\tprepareCompactionBoundary,\n\trunVerbatimCompaction,\n\tserializeConversation,\n\tserializeConversationForCompaction,\n\tshouldCompact,\n\tstartNewContextWindow,\n\ttype VerbatimCompactionDetails,\n\ttype VerbatimCompactionParameters,\n\ttype VerbatimCompactionPreparation,\n\ttype VerbatimCompactionResult,\n} from \"./core/compaction/index.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\nexport { type ModelRoute, type ModelRoutingContext, routeExecutionModel } from \"./core/execution-model-router.js\";\nexport { areExperimentalFeaturesEnabled } from \"./core/experimental.ts\";\nexport { sessionScopedExtensionState } from \"./core/extension-session-state.ts\";\nexport {\n\tgetModelFastRoute,\n\tresolveUpstreamModelId,\n\tusesChatGptCodexTransport,\n\tusesFirstPartyCodexRouting,\n\twithCodexFastRouteHeaders,\n\twithFastRouteStreamOptions,\n} from \"./core/fast-model-routing.ts\";\nexport {\n\tCODEX_FAST_ROUTE_HEADER,\n\tCODEX_FAST_ROUTE_ORIGINATOR,\n} from \"./core/fast-model-routing-transport.ts\";\nexport {\n\tcopilotAdvertisedFastModelIds,\n\tderiveFastModelVariants,\n\tFAST_MODEL_ID_SUFFIX,\n\tFAST_MODEL_SERVICE_TIER,\n\ttype FastModelVariantDerivation,\n\ttype FastModelVariantDiagnostic,\n\ttype FastModelVariantsOptions,\n\tfastModelId,\n\tisNativeFastRouteApi,\n\tusesOpenAIFastServiceTier,\n\twithFastModelVariants,\n} from \"./core/fast-model-variants.ts\";\nexport {\n\tparseFlattenedKeyPath,\n\treconstructFlattenedKeys,\n\tunflattenArgumentsWithSchema,\n} from \"./core/flattened-tool-arguments.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tRUNTIME_INTERCOM_GROUP_ENV,\n\treadRuntimeIntercomGroup,\n\truntimeIntercomGroupEnvKey,\n} from \"./core/intercom-runtime-group.ts\";\nexport { keybindingIdentity } from \"./core/keybinding-identity.js\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport type {\n\tModelFallbackFailureKind,\n\tModelFallbackFailureSignal,\n\tModelFallbackFailureSource,\n} from \"./core/model-fallback-failures.ts\";\nexport {\n\terrorMessage,\n\tisRetryableModelFailure,\n\tisRetryableSameModelFailure,\n\tmodelFailureMessage,\n\tnormalizeModelFailureSignal,\n} from \"./core/model-fallback-failures.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport {\n\teligiblePair,\n\ttype ModelConstraints,\n\tModelConstraintsSchema,\n\ttype ModelRouterOutput,\n\tparseModelConstraints,\n} from \"./core/model-routing-constraints.js\";\nexport {\n\ttype CreateModelRuntimeOptions,\n\tCredentialSynchronizationError,\n\ttype CredentialSynchronizationOperation,\n\tModelRuntime,\n\ttype ModelRuntimeAuthOverrides,\n} from \"./core/model-runtime.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport type {\n\tDefaultResourceLoaderInheritanceSnapshot,\n\tResourceCollision,\n\tResourceDiagnostic,\n\tResourceLoader,\n\tSkillCandidate,\n\tSkillCatalog,\n\tSkillCatalogCommand,\n\tSkillResolution,\n} from \"./core/resource-loader.ts\";\nexport {\n\tbuildSkillCatalog,\n\tDefaultResourceLoader,\n\tgetSkillCatalog,\n\tloadProjectContextFiles,\n} from \"./core/resource-loader.ts\";\nexport { nextRetryDecision, type RetryDecision, type RetryPolicySettings } from \"./core/retry-policy.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype AtomicBuiltin,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateLsTool,\n\tcreatePowerShellTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateSearchTool,\n\tcreateStructuredOutputCapture,\n\tcreateStructuredOutputTool,\n\tcreateWriteTool,\n\ttype JsonObject,\n\ttype JsonPrimitive,\n\ttype JsonValue,\n\ttype MessageEndEvent,\n\ttype MessageStartEvent,\n\ttype MessageUpdateEvent,\n\ttype PromptTemplate,\n\tSTRUCTURED_OUTPUT_TOOL_NAME,\n\ttype StructuredOutputCapture,\n\ttype StructuredOutputFileCapture,\n\ttype StructuredOutputToolOptions,\n\ttype ToolExecutionEndEvent,\n\ttype ToolExecutionStartEvent,\n\ttype ToolExecutionUpdateEvent,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildContextEntries,\n\tbuildSessionContext,\n\tbuildSessionProjection,\n\ttype CompactionEntry,\n\ttype ContextEditableContent,\n\ttype ContextEditEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionBoundaryEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\ttype ProjectedSessionEntry,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype SessionNameState,\n\ttype SessionProjection,\n\ttype SessionTreeNode,\n\ttype SessionWorkflowMetadata,\n\tsessionEntryToContextMessages,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\tWORKFLOW_SESSION_METADATA_ENV,\n\tworkflowSessionMetadataFromEnv,\n} from \"./core/session-manager-classification.ts\";\nexport type { DefaultProjectTrust } from \"./core/settings-manager.ts\";\nexport {\n\ttype CompactionModelOverride,\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport {\n\tgetStructuredOutputProviders,\n\tinferRouterDecision,\n\tinferStructuredOutput,\n\tJEV_STRUCTURED_OUTPUT_PROVIDER,\n\ttype RouterDecisionRequest,\n\ttype RouterModelSelectionOptions,\n\tresolveRouterModel,\n\ttype StructuredChoiceQuestion,\n\ttype StructuredOutputModel,\n\ttype StructuredOutputRequest,\n\ttype StructuredOutputResult,\n} from \"./core/structured-output/index.js\";\nexport type { NormalizedBuildSystemPromptOptions } from \"./core/system-prompt.ts\";\nexport { type EditDiffResult, generateDiffString, generateUnifiedPatch } from \"./core/tools/edit-diff.ts\";\n// Builtin tool definitions reusable by first-party extensions (e.g. workflows\n// invoking the structured ask_user_question UI deterministically).\n// Tools\nexport {\n\tBASH_SHELL_PRESENTATION,\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashToolSystemPromptContribution,\n\tcreateAskUserQuestionToolDefinition,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateKillTool,\n\tcreateKillToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLocalPowerShellOperations,\n\tcreateLsToolDefinition,\n\tcreatePowerShellToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateSearchToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditToolSystemPromptContribution,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindToolSystemPromptContribution,\n\tformatSize,\n\ttype KillToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsToolSystemPromptContribution,\n\ttype PowerShellOperations,\n\ttype PowerShellSpawnContext,\n\ttype PowerShellSpawnHook,\n\ttype PowerShellToolDetails,\n\ttype PowerShellToolInput,\n\ttype PowerShellToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadToolSystemPromptContribution,\n\ttype SearchToolDetails,\n\ttype SearchToolInput,\n\ttype SearchToolOptions,\n\ttype ShellToolPresentation,\n\tsearchToolSystemPromptContribution,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteFileOptions,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n\twriteToolSystemPromptContribution,\n} from \"./core/tools/index.ts\";\nexport {\n\thasProjectTrustInputs,\n\thasTrustRequiringProjectResources,\n\ttype ProjectTrustDecision,\n\tProjectTrustStore,\n\ttype ProjectTrustStoreEntry,\n\ttype ProjectTrustUpdate,\n\tTRUST_REQUIRING_PROJECT_CONFIG_RESOURCES,\n} from \"./core/trust-manager.ts\";\nexport { StringEnum, type StringEnumOptions } from \"./core/typebox-compat.ts\";\nexport * from \"./index-extensions.js\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEvent,\n\ttype RpcEventListener,\n\ttype RpcExtensionUIRequest,\n\ttype RpcExtensionUIResponse,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\t// Internal host seam for bundled workflow stage chat; not yet a stable extension API.\n\tChatSessionHost,\n\ttype ChatSessionHostBashRequest,\n\ttype ChatSessionHostCommands,\n\ttype ChatSessionHostEntry,\n\ttype ChatSessionHostOpts,\n\ttype ChatSessionHostStyle,\n\ttype ChatSessionSubmitMode,\n\tChatTranscriptComponent,\n\ttype ChatTranscriptEntryLike,\n\ttype ChatTranscriptRenderer,\n\ttype ChatTranscriptRole,\n\tCustomEditor,\n\ttype CustomEditorOptions,\n\tCustomEntryComponent,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyHintIfBound,\n\tkeyText,\n\tLiveChatEntriesController,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderChatMessageEntry,\n\trenderDiff,\n\tScrollableChatTranscriptComponent,\n\tScrollableComponentViewport,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTRANSCRIPT_JUMP_TO_END_URL,\n\tTranscriptFollowIndicator,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUsageMeterComponent,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n\tWorkingStatusComponent,\n\ttype WorkingStatusComponentOptions,\n} from \"./modes/interactive/components/index.ts\";\nexport {\n\tclassifyChatCommand,\n\tcreateSessionSkillAutocompleteProvider,\n\tgetSessionSkillCommands,\n} from \"./modes/interactive/skill-command-autocomplete.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Run modes for programmatic SDK usage\nexport { pickWhimsicalWorkingMessage } from \"./modes/interactive/whimsical-messages.ts\";\nexport { createChildProcessEnvironment, spawnProcess } from \"./utils/child-process.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport {\n\tisSafeFsWatchPathError,\n\tisUnsafeWindowsShortPath,\n\tresolveNativeWatchPath,\n\tSAFE_FS_WATCH_CANONICALIZATION_FAILED,\n\tSAFE_FS_WATCH_UNSAFE_WINDOWS_SHORT_PATH,\n\ttype SafeFsWatchErrorCode,\n\ttype SafeFsWatchPathError,\n\twatchWithErrorHandler,\n} from \"./utils/fs-watch.ts\";\nexport { createGitEnvironment, GIT_LOCAL_ENV_VARS } from \"./utils/git-env.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\nexport { INTERACTIVE_ENGINE_ENV_VARS, scrubInteractiveEngineEnv } from \"./utils/interactive-engine-env.ts\";\nexport { detectSupportedImageMimeTypeFromFile } from \"./utils/mime.ts\";\n// Shell utilities\nexport { getPowerShellConfig, getShellConfig } from \"./utils/shell.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,WAAW,GAIX,MAAM,wBAAwB,CAAC;AAWhC,OAAO,EAAE,mBAAmB,EAAyB,MAAM,4BAA4B,CAAC;AACxF,gEAAgE;AAChE,OAAO,EAAE,aAAa,EAA0D,MAAM,+BAA+B,CAAC;AAEtH,OAAO,EAA0B,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC3G,OAAO,EAAE,OAAO,EAAE,MAAM,4CAA4C,CAAC;AACrE,OAAO,EACN,0BAA0B,EAC1B,8BAA8B,GAC9B,MAAM,oDAAoD,CAAC;AAC5D,0BAA0B;AAE1B,OAAO,EAAa,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,eAAe;AACf,OAAO,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,8BAA8B,EAC9B,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBA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,2CAA2C,CAAC;AACxF,OAAO,EAAE,6BAA6B,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACvF,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EACN,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,qCAAqC,EACrC,uCAAuC,EAGvC,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC3G,OAAO,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AACvE,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export type { ExtensionBindings } from \"./core/agent-session-types.js\";\nexport {\n\tCacheWarmer,\n\ttype CacheWarmingDecisionEvent,\n\ttype CacheWarmingDecisionEventResult,\n\ttype CacheWarmingStatus,\n} from \"./core/cache-warmer.ts\";\nexport type {\n\tHostDiagnostic,\n\tHostInput,\n\tHostInputOptions,\n\tQuestionAnswer,\n\tQuestionnaireError,\n\tQuestionnaireResult,\n\tQuestionParams,\n} from \"./core/extensions/host-input.js\";\nexport type { UsageEntry } from \"./core/session-manager.ts\";\nexport { CACHE_WARMING_MODES, type CacheWarmingMode } from \"./core/settings-manager.ts\";\n// Internal trusted-host task integration (not model authority).\nexport { AgentTaskHost, type AgentTaskHostBinding, type AgentTaskRunnerFactory } from \"./core/tasks/agent-adapter.js\";\nexport type { AgentIntent, OperationId, TaskId, TaskResult, WaitPolicy } from \"./core/tasks/contracts.js\";\nexport { type AdmittedAgentTask, collectAgentTasks } from \"./core/tasks/execution-scope.js\";\nexport { bindOwnerTaskStore, getOwnerTaskStore, OwnerTaskStore } from \"./core/tasks/owner-store.js\";\nexport { renderTaskFooter, TaskList, taskListSections } from \"./modes/interactive/components/task-list.js\";\nexport { TaskRow } from \"./modes/interactive/components/task-row.js\";\nexport {\n\tapplyAssistantMessageDelta,\n\tbeginStreamingAssistantMessage,\n} from \"./modes/interactive/streaming-assistant-message.ts\";\n// Core session management\n\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\tCONFIG_DIR_NAME,\n\tCONFIG_DIR_NAMES,\n\tgetAgentConfigPaths,\n\tgetAgentDir,\n\tgetAgentDirs,\n\tgetBundledInteractiveAssetPath,\n\tgetChangelogPath,\n\tgetDocsPath,\n\tgetEnvNames,\n\tgetEnvValue,\n\tgetExamplesPath,\n\tgetExportTemplateDir,\n\tgetInteractiveAssetsDir,\n\tgetLegacyAgentDir,\n\tgetPackageDir,\n\tgetPackageJsonPath,\n\tgetProjectConfigDirs,\n\tgetProjectConfigPaths,\n\tgetReadmePath,\n\tgetThemesDir,\n\tgetUserConfigDirs,\n\tgetUserConfigPaths,\n\thasEnvValue,\n\tisBunBinary,\n\tLEGACY_CONFIG_DIR_NAME,\n\tLEGACY_ENV_PREFIX,\n\tPACKAGE_NAME,\n\tsetEnvValue,\n\tVERSION,\n\tWORKFLOW_STAGE_SUBAGENT_GUARD_ENV,\n} from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype CompactionReason,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model runtime\nexport { AuthStorage, readStoredCredential } from \"./core/auth-storage.ts\";\nexport {\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n} from \"./core/auth-storage-backends.ts\";\nexport { type BashResult, executeBashWithOperations } from \"./core/bash-executor.ts\";\nexport { getBuiltinPackagePaths } from \"./core/builtin-packages.ts\";\nexport {\n\ttype CallbackActivityDescriptor,\n\ttype CallbackActivityKind,\n\trunCallback,\n\trunSynchronousCallback,\n} from \"./core/callback-activity.ts\";\n// Cloudflare AI Gateway over the Workers AI binding (no API token; see docs/providers.md)\nexport {\n\ttype AiGatewayBinding,\n\ttype AiGatewayBindingGateway,\n\ttype AiGatewayUniversalRequestLike,\n\tCLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL,\n\tcreateGatewayBindingFetch,\n\ttype GatewayBindingFetchOptions,\n} from \"./core/cloudflare-gateway-binding.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactedTranscript,\n\ttype CompactionPlannerModel,\n\ttype CompactionPlanOptions,\n\ttype CompactionRung,\n\ttype CompactionRungResult,\n\ttype CompactionRunRequest,\n\ttype CompactionUrgency,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgetLastAssistantUsage,\n\ttype LineRange,\n\ttype PlannerAuth,\n\ttype PlannerBudget,\n\ttype PlannerLimitClass,\n\ttype PlannerOutcome,\n\tprepareBranchEntries,\n\tprepareCompactionBoundary,\n\trunVerbatimCompaction,\n\tserializeConversation,\n\tserializeConversationForCompaction,\n\tshouldCompact,\n\tstartNewContextWindow,\n\ttype VerbatimCompactionDetails,\n\ttype VerbatimCompactionParameters,\n\ttype VerbatimCompactionPreparation,\n\ttype VerbatimCompactionResult,\n} from \"./core/compaction/index.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\nexport {\n\tAutoRoutingInferenceError,\n\ttype ModelRoute,\n\ttype ModelRoutingContext,\n\trouteExecutionModel,\n} from \"./core/execution-model-router.js\";\nexport { areExperimentalFeaturesEnabled } from \"./core/experimental.ts\";\nexport { sessionScopedExtensionState } from \"./core/extension-session-state.ts\";\nexport {\n\tgetModelFastRoute,\n\tresolveUpstreamModelId,\n\tusesChatGptCodexTransport,\n\tusesFirstPartyCodexRouting,\n\twithCodexFastRouteHeaders,\n\twithFastRouteStreamOptions,\n} from \"./core/fast-model-routing.ts\";\nexport {\n\tCODEX_FAST_ROUTE_HEADER,\n\tCODEX_FAST_ROUTE_ORIGINATOR,\n} from \"./core/fast-model-routing-transport.ts\";\nexport {\n\tANTHROPIC_FAST_MODE_MODEL_IDS,\n\tcopilotAdvertisedFastModelIds,\n\tderiveFastModelVariants,\n\tFAST_MODEL_ID_SUFFIX,\n\tFAST_MODEL_SERVICE_TIER,\n\tFAST_MODEL_SPEED,\n\ttype FastModelVariantDerivation,\n\ttype FastModelVariantDiagnostic,\n\ttype FastModelVariantsOptions,\n\tfastModelId,\n\tisNativeFastRouteApi,\n\tusesAnthropicFastMode,\n\tusesOpenAIFastServiceTier,\n\twithFastModelVariants,\n} from \"./core/fast-model-variants.ts\";\nexport {\n\tparseFlattenedKeyPath,\n\treconstructFlattenedKeys,\n\tunflattenArgumentsWithSchema,\n} from \"./core/flattened-tool-arguments.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tRUNTIME_INTERCOM_GROUP_ENV,\n\treadRuntimeIntercomGroup,\n\truntimeIntercomGroupEnvKey,\n} from \"./core/intercom-runtime-group.ts\";\nexport { keybindingIdentity } from \"./core/keybinding-identity.js\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport type {\n\tModelFallbackFailureKind,\n\tModelFallbackFailureSignal,\n\tModelFallbackFailureSource,\n} from \"./core/model-fallback-failures.ts\";\nexport {\n\terrorMessage,\n\tisRetryableModelFailure,\n\tisRetryableSameModelFailure,\n\tmodelFailureMessage,\n\tnormalizeModelFailureSignal,\n} from \"./core/model-fallback-failures.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport {\n\teligiblePair,\n\ttype ModelConstraints,\n\tModelConstraintsSchema,\n\ttype ModelRouterOutput,\n\tparseModelConstraints,\n} from \"./core/model-routing-constraints.js\";\nexport {\n\ttype CreateModelRuntimeOptions,\n\tCredentialSynchronizationError,\n\ttype CredentialSynchronizationOperation,\n\tModelRuntime,\n\ttype ModelRuntimeAuthOverrides,\n} from \"./core/model-runtime.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport type {\n\tDefaultResourceLoaderInheritanceSnapshot,\n\tResourceCollision,\n\tResourceDiagnostic,\n\tResourceLoader,\n\tSkillCandidate,\n\tSkillCatalog,\n\tSkillCatalogCommand,\n\tSkillResolution,\n} from \"./core/resource-loader.ts\";\nexport {\n\tbuildSkillCatalog,\n\tDefaultResourceLoader,\n\tgetSkillCatalog,\n\tloadProjectContextFiles,\n} from \"./core/resource-loader.ts\";\nexport { nextRetryDecision, type RetryDecision, type RetryPolicySettings } from \"./core/retry-policy.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype AtomicBuiltin,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateLsTool,\n\tcreatePowerShellTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateSearchTool,\n\tcreateStructuredOutputCapture,\n\tcreateStructuredOutputTool,\n\tcreateWriteTool,\n\ttype JsonObject,\n\ttype JsonPrimitive,\n\ttype JsonValue,\n\ttype MessageEndEvent,\n\ttype MessageStartEvent,\n\ttype MessageUpdateEvent,\n\ttype PromptTemplate,\n\tSTRUCTURED_OUTPUT_TOOL_NAME,\n\ttype StructuredOutputCapture,\n\ttype StructuredOutputFileCapture,\n\ttype StructuredOutputToolOptions,\n\ttype ToolExecutionEndEvent,\n\ttype ToolExecutionStartEvent,\n\ttype ToolExecutionUpdateEvent,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildContextEntries,\n\tbuildSessionContext,\n\tbuildSessionProjection,\n\ttype CompactionEntry,\n\ttype ContextEditableContent,\n\ttype ContextEditEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionBoundaryEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\ttype ProjectedSessionEntry,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype SessionNameState,\n\ttype SessionProjection,\n\ttype SessionTreeNode,\n\ttype SessionWorkflowMetadata,\n\tsessionEntryToContextMessages,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\tWORKFLOW_SESSION_METADATA_ENV,\n\tworkflowSessionMetadataFromEnv,\n} from \"./core/session-manager-classification.ts\";\nexport type { DefaultProjectTrust } from \"./core/settings-manager.ts\";\nexport {\n\ttype CompactionModelOverride,\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport {\n\tgetStructuredOutputProviders,\n\tinferRouterDecision,\n\tinferStructuredOutput,\n\tJEV_STRUCTURED_OUTPUT_PROVIDER,\n\ttype JevStructuredOutputProvider,\n\ttype RouterDecisionRequest,\n\ttype RouterModelSelectionOptions,\n\tresolveRouterModel,\n\ttype StructuredChoiceQuestion,\n\ttype StructuredOutputModel,\n\ttype StructuredOutputRequest,\n\ttype StructuredOutputResult,\n} from \"./core/structured-output/index.js\";\nexport type { NormalizedBuildSystemPromptOptions } from \"./core/system-prompt.ts\";\nexport { type EditDiffResult, generateDiffString, generateUnifiedPatch } from \"./core/tools/edit-diff.ts\";\n// Builtin tool definitions reusable by first-party extensions (e.g. workflows\n// invoking the structured ask_user_question UI deterministically).\n// Tools\nexport {\n\tBASH_SHELL_PRESENTATION,\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashToolSystemPromptContribution,\n\tcreateAskUserQuestionToolDefinition,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateKillTool,\n\tcreateKillToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLocalPowerShellOperations,\n\tcreateLsToolDefinition,\n\tcreatePowerShellToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateSearchToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditToolSystemPromptContribution,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindToolSystemPromptContribution,\n\tformatSize,\n\ttype KillToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsToolSystemPromptContribution,\n\ttype PowerShellOperations,\n\ttype PowerShellSpawnContext,\n\ttype PowerShellSpawnHook,\n\ttype PowerShellToolDetails,\n\ttype PowerShellToolInput,\n\ttype PowerShellToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadToolSystemPromptContribution,\n\ttype SearchToolDetails,\n\ttype SearchToolInput,\n\ttype SearchToolOptions,\n\ttype ShellToolPresentation,\n\tsearchToolSystemPromptContribution,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteFileOptions,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n\twriteToolSystemPromptContribution,\n} from \"./core/tools/index.ts\";\nexport {\n\thasProjectTrustInputs,\n\thasTrustRequiringProjectResources,\n\ttype ProjectTrustDecision,\n\tProjectTrustStore,\n\ttype ProjectTrustStoreEntry,\n\ttype ProjectTrustUpdate,\n\tTRUST_REQUIRING_PROJECT_CONFIG_RESOURCES,\n} from \"./core/trust-manager.ts\";\nexport { StringEnum, type StringEnumOptions } from \"./core/typebox-compat.ts\";\nexport * from \"./index-extensions.js\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEvent,\n\ttype RpcEventListener,\n\ttype RpcExtensionUIRequest,\n\ttype RpcExtensionUIResponse,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\t// Internal host seam for bundled workflow stage chat; not yet a stable extension API.\n\tChatSessionHost,\n\ttype ChatSessionHostBashRequest,\n\ttype ChatSessionHostCommands,\n\ttype ChatSessionHostEntry,\n\ttype ChatSessionHostOpts,\n\ttype ChatSessionHostStyle,\n\ttype ChatSessionSubmitMode,\n\tChatTranscriptComponent,\n\ttype ChatTranscriptEntryLike,\n\ttype ChatTranscriptRenderer,\n\ttype ChatTranscriptRole,\n\tCustomEditor,\n\ttype CustomEditorOptions,\n\tCustomEntryComponent,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyHintIfBound,\n\tkeyText,\n\tLiveChatEntriesController,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderChatMessageEntry,\n\trenderDiff,\n\tScrollableChatTranscriptComponent,\n\tScrollableComponentViewport,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTRANSCRIPT_JUMP_TO_END_URL,\n\tTranscriptFollowIndicator,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUsageMeterComponent,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n\tWorkingStatusComponent,\n\ttype WorkingStatusComponentOptions,\n} from \"./modes/interactive/components/index.ts\";\nexport {\n\tclassifyChatCommand,\n\tcreateSessionSkillAutocompleteProvider,\n\tgetSessionSkillCommands,\n} from \"./modes/interactive/skill-command-autocomplete.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Run modes for programmatic SDK usage\nexport { pickWhimsicalWorkingMessage } from \"./modes/interactive/whimsical-messages.ts\";\nexport { createChildProcessEnvironment, spawnProcess } from \"./utils/child-process.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport {\n\tisSafeFsWatchPathError,\n\tisUnsafeWindowsShortPath,\n\tresolveNativeWatchPath,\n\tSAFE_FS_WATCH_CANONICALIZATION_FAILED,\n\tSAFE_FS_WATCH_UNSAFE_WINDOWS_SHORT_PATH,\n\ttype SafeFsWatchErrorCode,\n\ttype SafeFsWatchPathError,\n\twatchWithErrorHandler,\n} from \"./utils/fs-watch.ts\";\nexport { createGitEnvironment, GIT_LOCAL_ENV_VARS } from \"./utils/git-env.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\nexport { INTERACTIVE_ENGINE_ENV_VARS, scrubInteractiveEngineEnv } from \"./utils/interactive-engine-env.ts\";\nexport { detectSupportedImageMimeTypeFromFile } from \"./utils/mime.ts\";\n// Shell utilities\nexport { getPowerShellConfig, getShellConfig } from \"./utils/shell.ts\";\n"]}
@@ -103,7 +103,7 @@ InteractiveModeBase.prototype.showApiKeyLoginDialog = async function (providerId
103
103
  this.ui.requestRender();
104
104
  };
105
105
  try {
106
- await this.session.modelRuntime.login(providerId, "api_key", {
106
+ const loginResult = await this.runtimeHost.loginApiKeyProvider(providerId, {
107
107
  signal: dialog.signal,
108
108
  prompt: (prompt) => dialog.showPrompt(prompt.message, "placeholder" in prompt ? prompt.placeholder : undefined),
109
109
  notify: (event) => {
@@ -114,9 +114,7 @@ InteractiveModeBase.prototype.showApiKeyLoginDialog = async function (providerId
114
114
  },
115
115
  });
116
116
  restoreEditor();
117
- await this.completeProviderAuthentication(providerId, providerName, "api_key", previousModel, {
118
- modelsRefreshed: true,
119
- });
117
+ await this.completeProviderAuthentication(providerId, providerName, "api_key", previousModel, loginResult);
120
118
  }
121
119
  catch (error) {
122
120
  restoreEditor();
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-auth-login.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEN,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,oBAAoB,EAGpB,IAAI,EACJ,KAAK,GACL,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAExF,MAAM,UAAU,yBAAyB,CAAC,WAAmB,EAAE,gBAAwB;IACtF,OAAO,gBAAgB,KAAK,CAAC;QAC5B,CAAC,CAAC,GAAG,WAAW,yFAAyF;QACzG,CAAC,CAAC,GAAG,WAAW,8EAA8E,CAAC;AACjG,CAAC;AAED,mBAAmB,CAAC,SAAS,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BAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;YAElF,iBAAiB,EAAE,GAAG,EAAE,CAAC,iBAAiB;YAE1C,kBAAkB,EAAE,GAAG,EAAE;gBACxB,MAAM,CAAC,mBAAmB,EAAE,CAAC;gBAC7B,iBAAiB,EAAE,CAAC,EAAE,CAAC,CAAC;gBACxB,iBAAiB,GAAG,SAAS,CAAC;gBAC9B,gBAAgB,GAAG,SAAS,CAAC;YAC9B,CAAC;YAED,MAAM,EAAE,MAAM,CAAC,MAAM;SACrB,CAAC,CAAC;QACH,cAAc,GAAG,IAAI,CAAC;QAEtB,UAAU;QACV,aAAa,EAAE,CAAC;QAChB,MAAM,IAAI,CAAC,8BAA8B,CAAC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;IAC1G,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACzB,aAAa,EAAE,CAAC;QAChB,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,KAAK,YAAY,8BAA8B,EAAE,CAAC;YACrD,IAAI,CAAC,SAAS,CAAC,gBAAgB,YAAY,sDAAsD,QAAQ,EAAE,CAAC,CAAC;QAC9G,CAAC;aAAM,IAAI,cAAc,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;IACF,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { CredentialSynchronizationError } from \"../../core/model-runtime.js\";\nimport { isOAuthLoginCancelled } from \"../../core/oauth-login.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Api,\n\tdefaultModelPerProvider,\n\tExtensionSelectorComponent,\n\tgetAuthPath,\n\tgetDocsPath,\n\tLoginDialogComponent,\n\ttype Model,\n\ttype OAuthSelectPrompt,\n\tpath,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\nimport { hasDefaultModelProvider, isUnknownModel } from \"./interactive-mode-helpers.ts\";\n\nexport function llamaCppPostLoginGuidance(actionLabel: string, loadedModelCount: number): string {\n\treturn loadedModelCount === 0\n\t\t? `${actionLabel}. No llama.cpp models are loaded. Use /llama to load a model, then /model to select it.`\n\t\t: `${actionLabel}. Use /model to select a loaded llama.cpp model, or /llama to manage models.`;\n}\n\nInteractiveModeBase.prototype.completeProviderAuthentication = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tauthType: \"oauth\" | \"api_key\",\n\tpreviousModel: Model<Api> | undefined,\n\toptions: { modelsRefreshed?: boolean } = {},\n): Promise<void> {\n\tif (!options.modelsRefreshed) {\n\t\t// Match pi: after authentication persists the credential, a thrown catalog\n\t\t// refresh failure remains visible to the caller without rolling it back.\n\t\tawait this.session.modelRuntime.refresh();\n\t}\n\n\tconst actionLabel = authType === \"oauth\" ? `Logged in to ${providerName}` : `Saved API key for ${providerName}`;\n\n\tlet selectedModel: Model<Api> | undefined;\n\tlet selectionError: string | undefined;\n\tif (providerId !== \"typesafe-ai\" && isUnknownModel(previousModel)) {\n\t\tconst availableModels = this.session.modelRuntime.getAvailableSnapshot();\n\t\tconst providerModels = availableModels.filter((model) => model.provider === providerId);\n\t\tif (providerId === \"llama.cpp\") {\n\t\t\tselectionError = llamaCppPostLoginGuidance(actionLabel, providerModels.length);\n\t\t} else if (!hasDefaultModelProvider(providerId)) {\n\t\t\tselectionError = `${actionLabel}, but no default model is configured for provider \"${providerId}\". Use /model to select a model.`;\n\t\t} else if (providerModels.length === 0) {\n\t\t\tselectionError = `${actionLabel}, but no models are available for that provider. Use /model to select a model.`;\n\t\t} else {\n\t\t\tconst defaultModelId = defaultModelPerProvider[providerId];\n\t\t\tselectedModel =\n\t\t\t\tproviderModels.find((model) => model.id === defaultModelId) ??\n\t\t\t\t(providerId === \"radius\" ? providerModels[0] : undefined);\n\t\t\tif (!selectedModel) {\n\t\t\t\tselectionError = `${actionLabel}, but its default model \"${defaultModelId}\" is not available. Use /model to select a model.`;\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.session.setModel(selectedModel);\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tselectedModel = undefined;\n\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tselectionError = `${actionLabel}, but selecting its default model failed: ${errorMessage}. Use /model to select a model.`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tawait this.updateAvailableProviderCount();\n\tthis.setupAutocompleteProvider();\n\tthis.footer.invalidate();\n\tthis.updateEditorBorderColor();\n\tif (selectedModel) {\n\t\tthis.showStatus(`${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`);\n\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n\t\tthis.checkDaxnutsEasterEgg(selectedModel);\n\t} else {\n\t\tthis.showStatus(`${actionLabel}. Credentials saved to ${getAuthPath()}`);\n\t\tif (selectionError) {\n\t\t\tthis.showError(selectionError);\n\t\t} else {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth();\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showBedrockSetupDialog = function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): void {\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t() => restoreEditor(),\n\t\tproviderName,\n\t\t\"Amazon Bedrock setup\",\n\t);\n\tdialog.showDetails([\n\t\ttheme.fg(\"text\", \"Amazon Bedrock uses AWS credentials instead of a single API key.\"),\n\t\ttheme.fg(\"text\", \"Configure an AWS profile, IAM keys, bearer token, or role-based credentials.\"),\n\t\ttheme.fg(\"muted\", \"See:\"),\n\t\ttheme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n\t]);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.showApiKeyLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\ttry {\n\t\tawait this.session.modelRuntime.login(providerId, \"api_key\", {\n\t\t\tsignal: dialog.signal,\n\t\t\tprompt: (prompt) =>\n\t\t\t\tdialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined),\n\t\t\tnotify: (event) => {\n\t\t\t\tif (event.type === \"info\") dialog.showInfo(event.message, event.links);\n\t\t\t\telse if (event.type === \"progress\") dialog.showProgress(event.message);\n\t\t\t},\n\t\t});\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"api_key\", previousModel, {\n\t\t\tmodelsRefreshed: true,\n\t\t});\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(\n\t\t\t\t`Saved API key for ${providerName}, but local model state could not be synchronized: ${errorMsg}`,\n\t\t\t);\n\t\t} else if (!isOAuthLoginCancelled(error)) {\n\t\t\tthis.showError(`Failed to save API key for ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showOAuthLoginSelect = function (\n\tthis: InteractiveModeBase,\n\tdialog: LoginDialogComponent,\n\tprompt: OAuthSelectPrompt,\n): Promise<string | undefined> {\n\treturn new Promise((resolve) => {\n\t\tconst restoreDialog = () => {\n\t\t\tthis.editorContainer.clear();\n\t\t\tthis.editorContainer.addChild(dialog);\n\t\t\tthis.ui.setFocus(dialog);\n\t\t\tthis.ui.requestRender();\n\t\t};\n\t\tconst labels = prompt.options.map((option) => option.label);\n\t\tconst selector = new ExtensionSelectorComponent(\n\t\t\tprompt.message,\n\t\t\tlabels,\n\t\t\t(optionLabel) => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(prompt.options.find((option) => option.label === optionLabel)?.id);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(undefined);\n\t\t\t},\n\t\t);\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(selector);\n\t\tthis.ui.setFocus(selector);\n\t\tthis.ui.requestRender();\n\t});\n};\n\nInteractiveModeBase.prototype.showLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\tconst metadata = this.session.modelRuntime?.getOAuthProviderMetadata().find(({ id }) => id === providerId);\n\tconst usesCallbackServer = metadata?.usesCallbackServer === true;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t\tmetadata?.loginLabel,\n\t);\n\n\t// Show dialog in editor container\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\t// Promise for manual code input (racing with callback server)\n\tlet manualCodeResolve: ((code: string) => void) | undefined;\n\tlet manualCodeReject: ((err: Error) => void) | undefined;\n\tconst manualCodePromise = new Promise<string>((resolve, reject) => {\n\t\tmanualCodeResolve = resolve;\n\t\tmanualCodeReject = reject;\n\t});\n\n\t// Restore editor helper\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tlet loginSucceeded = false;\n\ttry {\n\t\tconst loginResult = await this.runtimeHost.loginOAuthProvider(providerId, {\n\t\t\tonAuth: (info: { url: string; instructions?: string }) => {\n\t\t\t\tdialog.showAuth(info.url, info.instructions, {\n\t\t\t\t\tshowCancelHint: !usesCallbackServer,\n\t\t\t\t});\n\n\t\t\t\tif (usesCallbackServer) {\n\t\t\t\t\t// Show input for manual paste, racing with callback\n\t\t\t\t\tdialog\n\t\t\t\t\t\t.showManualInput(\"Paste redirect URL below, or complete login in browser:\")\n\t\t\t\t\t\t.then((value) => {\n\t\t\t\t\t\t\tif (value && manualCodeResolve) {\n\t\t\t\t\t\t\t\tmanualCodeResolve(value);\n\t\t\t\t\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch(() => {\n\t\t\t\t\t\t\tif (manualCodeReject) {\n\t\t\t\t\t\t\t\tmanualCodeReject(new Error(\"Login cancelled\"));\n\t\t\t\t\t\t\t\tmanualCodeReject = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// For Anthropic: onPrompt is called immediately after\n\t\t\t},\n\n\t\t\tonDeviceCode: (info) => {\n\t\t\t\tdialog.showDeviceCode(info);\n\t\t\t\tdialog.showWaiting(\"Waiting for authentication...\");\n\t\t\t},\n\n\t\t\tonPrompt: async (prompt: { message: string; placeholder?: string }) => {\n\t\t\t\treturn dialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined);\n\t\t\t},\n\n\t\t\tonProgress: (message: string) => {\n\t\t\t\tdialog.showProgress(message);\n\t\t\t},\n\n\t\t\tonInfo: (message, links) => {\n\t\t\t\tdialog.showInfo(message, links);\n\t\t\t},\n\n\t\t\tonSelect: (prompt: OAuthSelectPrompt) => this.showOAuthLoginSelect(dialog, prompt),\n\n\t\t\tonManualCodeInput: () => manualCodePromise,\n\n\t\t\tonManualCodeCancel: () => {\n\t\t\t\tdialog.dismissPendingInput();\n\t\t\t\tmanualCodeResolve?.(\"\");\n\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\tmanualCodeReject = undefined;\n\t\t\t},\n\n\t\t\tsignal: dialog.signal,\n\t\t});\n\t\tloginSucceeded = true;\n\n\t\t// Success\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"oauth\", previousModel, loginResult);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(`Logged in to ${providerName}, but local model state could not be synchronized: ${errorMsg}`);\n\t\t} else if (loginSucceeded || !isOAuthLoginCancelled(error)) {\n\t\t\tthis.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n};\n"]}
1
+ {"version":3,"file":"interactive-auth-login.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEN,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,oBAAoB,EAGpB,IAAI,EACJ,K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AK,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;IACF,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { CredentialSynchronizationError } from \"../../core/model-runtime.js\";\nimport { isOAuthLoginCancelled } from \"../../core/oauth-login.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Api,\n\tdefaultModelPerProvider,\n\tExtensionSelectorComponent,\n\tgetAuthPath,\n\tgetDocsPath,\n\tLoginDialogComponent,\n\ttype Model,\n\ttype OAuthSelectPrompt,\n\tpath,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\nimport { hasDefaultModelProvider, isUnknownModel } from \"./interactive-mode-helpers.ts\";\n\nexport function llamaCppPostLoginGuidance(actionLabel: string, loadedModelCount: number): string {\n\treturn loadedModelCount === 0\n\t\t? `${actionLabel}. No llama.cpp models are loaded. Use /llama to load a model, then /model to select it.`\n\t\t: `${actionLabel}. Use /model to select a loaded llama.cpp model, or /llama to manage models.`;\n}\n\nInteractiveModeBase.prototype.completeProviderAuthentication = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tauthType: \"oauth\" | \"api_key\",\n\tpreviousModel: Model<Api> | undefined,\n\toptions: { modelsRefreshed?: boolean } = {},\n): Promise<void> {\n\tif (!options.modelsRefreshed) {\n\t\t// Match pi: after authentication persists the credential, a thrown catalog\n\t\t// refresh failure remains visible to the caller without rolling it back.\n\t\tawait this.session.modelRuntime.refresh();\n\t}\n\n\tconst actionLabel = authType === \"oauth\" ? `Logged in to ${providerName}` : `Saved API key for ${providerName}`;\n\n\tlet selectedModel: Model<Api> | undefined;\n\tlet selectionError: string | undefined;\n\tif (providerId !== \"typesafe-ai\" && isUnknownModel(previousModel)) {\n\t\tconst availableModels = this.session.modelRuntime.getAvailableSnapshot();\n\t\tconst providerModels = availableModels.filter((model) => model.provider === providerId);\n\t\tif (providerId === \"llama.cpp\") {\n\t\t\tselectionError = llamaCppPostLoginGuidance(actionLabel, providerModels.length);\n\t\t} else if (!hasDefaultModelProvider(providerId)) {\n\t\t\tselectionError = `${actionLabel}, but no default model is configured for provider \"${providerId}\". Use /model to select a model.`;\n\t\t} else if (providerModels.length === 0) {\n\t\t\tselectionError = `${actionLabel}, but no models are available for that provider. Use /model to select a model.`;\n\t\t} else {\n\t\t\tconst defaultModelId = defaultModelPerProvider[providerId];\n\t\t\tselectedModel =\n\t\t\t\tproviderModels.find((model) => model.id === defaultModelId) ??\n\t\t\t\t(providerId === \"radius\" ? providerModels[0] : undefined);\n\t\t\tif (!selectedModel) {\n\t\t\t\tselectionError = `${actionLabel}, but its default model \"${defaultModelId}\" is not available. Use /model to select a model.`;\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.session.setModel(selectedModel);\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tselectedModel = undefined;\n\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tselectionError = `${actionLabel}, but selecting its default model failed: ${errorMessage}. Use /model to select a model.`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tawait this.updateAvailableProviderCount();\n\tthis.setupAutocompleteProvider();\n\tthis.footer.invalidate();\n\tthis.updateEditorBorderColor();\n\tif (selectedModel) {\n\t\tthis.showStatus(`${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`);\n\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n\t\tthis.checkDaxnutsEasterEgg(selectedModel);\n\t} else {\n\t\tthis.showStatus(`${actionLabel}. Credentials saved to ${getAuthPath()}`);\n\t\tif (selectionError) {\n\t\t\tthis.showError(selectionError);\n\t\t} else {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth();\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showBedrockSetupDialog = function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): void {\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t() => restoreEditor(),\n\t\tproviderName,\n\t\t\"Amazon Bedrock setup\",\n\t);\n\tdialog.showDetails([\n\t\ttheme.fg(\"text\", \"Amazon Bedrock uses AWS credentials instead of a single API key.\"),\n\t\ttheme.fg(\"text\", \"Configure an AWS profile, IAM keys, bearer token, or role-based credentials.\"),\n\t\ttheme.fg(\"muted\", \"See:\"),\n\t\ttheme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n\t]);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.showApiKeyLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\ttry {\n\t\tconst loginResult = await this.runtimeHost.loginApiKeyProvider(providerId, {\n\t\t\tsignal: dialog.signal,\n\t\t\tprompt: (prompt) =>\n\t\t\t\tdialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined),\n\t\t\tnotify: (event) => {\n\t\t\t\tif (event.type === \"info\") dialog.showInfo(event.message, event.links);\n\t\t\t\telse if (event.type === \"progress\") dialog.showProgress(event.message);\n\t\t\t},\n\t\t});\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"api_key\", previousModel, loginResult);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(\n\t\t\t\t`Saved API key for ${providerName}, but local model state could not be synchronized: ${errorMsg}`,\n\t\t\t);\n\t\t} else if (!isOAuthLoginCancelled(error)) {\n\t\t\tthis.showError(`Failed to save API key for ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showOAuthLoginSelect = function (\n\tthis: InteractiveModeBase,\n\tdialog: LoginDialogComponent,\n\tprompt: OAuthSelectPrompt,\n): Promise<string | undefined> {\n\treturn new Promise((resolve) => {\n\t\tconst restoreDialog = () => {\n\t\t\tthis.editorContainer.clear();\n\t\t\tthis.editorContainer.addChild(dialog);\n\t\t\tthis.ui.setFocus(dialog);\n\t\t\tthis.ui.requestRender();\n\t\t};\n\t\tconst labels = prompt.options.map((option) => option.label);\n\t\tconst selector = new ExtensionSelectorComponent(\n\t\t\tprompt.message,\n\t\t\tlabels,\n\t\t\t(optionLabel) => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(prompt.options.find((option) => option.label === optionLabel)?.id);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(undefined);\n\t\t\t},\n\t\t);\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(selector);\n\t\tthis.ui.setFocus(selector);\n\t\tthis.ui.requestRender();\n\t});\n};\n\nInteractiveModeBase.prototype.showLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\tconst metadata = this.session.modelRuntime?.getOAuthProviderMetadata().find(({ id }) => id === providerId);\n\tconst usesCallbackServer = metadata?.usesCallbackServer === true;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t\tmetadata?.loginLabel,\n\t);\n\n\t// Show dialog in editor container\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\t// Promise for manual code input (racing with callback server)\n\tlet manualCodeResolve: ((code: string) => void) | undefined;\n\tlet manualCodeReject: ((err: Error) => void) | undefined;\n\tconst manualCodePromise = new Promise<string>((resolve, reject) => {\n\t\tmanualCodeResolve = resolve;\n\t\tmanualCodeReject = reject;\n\t});\n\n\t// Restore editor helper\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tlet loginSucceeded = false;\n\ttry {\n\t\tconst loginResult = await this.runtimeHost.loginOAuthProvider(providerId, {\n\t\t\tonAuth: (info: { url: string; instructions?: string }) => {\n\t\t\t\tdialog.showAuth(info.url, info.instructions, {\n\t\t\t\t\tshowCancelHint: !usesCallbackServer,\n\t\t\t\t});\n\n\t\t\t\tif (usesCallbackServer) {\n\t\t\t\t\t// Show input for manual paste, racing with callback\n\t\t\t\t\tdialog\n\t\t\t\t\t\t.showManualInput(\"Paste redirect URL below, or complete login in browser:\")\n\t\t\t\t\t\t.then((value) => {\n\t\t\t\t\t\t\tif (value && manualCodeResolve) {\n\t\t\t\t\t\t\t\tmanualCodeResolve(value);\n\t\t\t\t\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch(() => {\n\t\t\t\t\t\t\tif (manualCodeReject) {\n\t\t\t\t\t\t\t\tmanualCodeReject(new Error(\"Login cancelled\"));\n\t\t\t\t\t\t\t\tmanualCodeReject = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// For Anthropic: onPrompt is called immediately after\n\t\t\t},\n\n\t\t\tonDeviceCode: (info) => {\n\t\t\t\tdialog.showDeviceCode(info);\n\t\t\t\tdialog.showWaiting(\"Waiting for authentication...\");\n\t\t\t},\n\n\t\t\tonPrompt: async (prompt: { message: string; placeholder?: string }) => {\n\t\t\t\treturn dialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined);\n\t\t\t},\n\n\t\t\tonProgress: (message: string) => {\n\t\t\t\tdialog.showProgress(message);\n\t\t\t},\n\n\t\t\tonInfo: (message, links) => {\n\t\t\t\tdialog.showInfo(message, links);\n\t\t\t},\n\n\t\t\tonSelect: (prompt: OAuthSelectPrompt) => this.showOAuthLoginSelect(dialog, prompt),\n\n\t\t\tonManualCodeInput: () => manualCodePromise,\n\n\t\t\tonManualCodeCancel: () => {\n\t\t\t\tdialog.dismissPendingInput();\n\t\t\t\tmanualCodeResolve?.(\"\");\n\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\tmanualCodeReject = undefined;\n\t\t\t},\n\n\t\t\tsignal: dialog.signal,\n\t\t});\n\t\tloginSucceeded = true;\n\n\t\t// Success\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"oauth\", previousModel, loginResult);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(`Logged in to ${providerName}, but local model state could not be synchronized: ${errorMsg}`);\n\t\t} else if (loginSucceeded || !isOAuthLoginCancelled(error)) {\n\t\t\tthis.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n};\n"]}
@@ -1,3 +1,4 @@
1
+ import type { AuthInteraction } from "@bastani/pi-ai";
1
2
  import type { AgentSession } from "../../core/agent-session.js";
2
3
  import { type AtomicOAuthLoginCallbacks } from "../../core/oauth-login.ts";
3
4
  import type { RpcClient } from "../rpc/rpc-client.ts";
@@ -7,4 +8,19 @@ export type { AtomicOAuthLoginCallbacks } from "../../core/oauth-login.ts";
7
8
  export declare function loginIsolatedOAuthProvider(session: AgentSession, client: RpcClient, catalog: RemoteModelCatalog, provider: string, callbacks: AtomicOAuthLoginCallbacks): Promise<{
8
9
  modelsRefreshed: true;
9
10
  }>;
11
+ /**
12
+ * Acquire an API key with the frontend's login dialog, then persist it in the engine.
13
+ *
14
+ * The engine owns credential storage for the isolated runtime, so the frontend
15
+ * only collects the key and adopts the engine's catalog and credential snapshot
16
+ * afterwards. A dialog cancelled before the engine save is sent persists nothing on
17
+ * either side; once the save is in flight it completes and the login is reported, the
18
+ * same commit point the local credential store uses. The engine save
19
+ * deliberately skips the remote catalog refresh: catalog freshness belongs to
20
+ * /model's bounded background refresh, and a failed fetch would otherwise leave the
21
+ * key persisted in the engine while the frontend took the error branch.
22
+ */
23
+ export declare function loginIsolatedApiKeyProvider(session: AgentSession, client: RpcClient, catalog: RemoteModelCatalog, provider: string, interaction: AuthInteraction): Promise<{
24
+ modelsRefreshed: true;
25
+ }>;
10
26
  //# sourceMappingURL=isolated-auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isolated-auth.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive-engine/isolated-auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,KAAK,yBAAyB,EAA4B,MAAM,2BAA2B,CAAC;AACrG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAE3E,6GAA6G;AAC7G,wBAAsB,0BAA0B,CAC/C,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,yBAAyB,GAClC,OAAO,CAAC;IAAE,eAAe,EAAE,IAAI,CAAA;CAAE,CAAC,CAUpC"}
1
+ {"version":3,"file":"isolated-auth.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive-engine/isolated-auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,KAAK,yBAAyB,EAA4B,MAAM,2BAA2B,CAAC;AAErG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAE3E,6GAA6G;AAC7G,wBAAsB,0BAA0B,CAC/C,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,yBAAyB,GAClC,OAAO,CAAC;IAAE,eAAe,EAAE,IAAI,CAAA;CAAE,CAAC,CAUpC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,2BAA2B,CAChD,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,eAAe,GAC1B,OAAO,CAAC;IAAE,eAAe,EAAE,IAAI,CAAA;CAAE,CAAC,CAWpC"}
@@ -1,4 +1,5 @@
1
1
  import { normalizeOAuthLoginError } from "../../core/oauth-login.js";
2
+ import { operationSignal, raceWithAbortSignal } from "../../utils/abort.js";
2
3
  import { loginRpcOAuthProvider } from "../rpc/rpc-oauth-client.js";
3
4
  /** Acquire and persist OAuth entirely in the engine, transporting only UI callbacks and catalog metadata. */
4
5
  export async function loginIsolatedOAuthProvider(session, client, catalog, provider, callbacks) {
@@ -12,4 +13,30 @@ export async function loginIsolatedOAuthProvider(session, client, catalog, provi
12
13
  await session.modelRuntime.reloadCredentials({ refreshAvailability: false });
13
14
  return { modelsRefreshed: true };
14
15
  }
16
+ /**
17
+ * Acquire an API key with the frontend's login dialog, then persist it in the engine.
18
+ *
19
+ * The engine owns credential storage for the isolated runtime, so the frontend
20
+ * only collects the key and adopts the engine's catalog and credential snapshot
21
+ * afterwards. A dialog cancelled before the engine save is sent persists nothing on
22
+ * either side; once the save is in flight it completes and the login is reported, the
23
+ * same commit point the local credential store uses. The engine save
24
+ * deliberately skips the remote catalog refresh: catalog freshness belongs to
25
+ * /model's bounded background refresh, and a failed fetch would otherwise leave the
26
+ * key persisted in the engine while the frontend took the error branch.
27
+ */
28
+ export async function loginIsolatedApiKeyProvider(session, client, catalog, provider, interaction) {
29
+ const apiKeyAuth = session.modelRuntime.getProvider(provider)?.auth.apiKey;
30
+ if (!apiKeyAuth?.login)
31
+ throw new Error(`Provider does not support api_key login: ${provider}`);
32
+ const signal = operationSignal(interaction.signal);
33
+ signal.throwIfAborted();
34
+ const credential = await raceWithAbortSignal(apiKeyAuth.login({ ...interaction, signal }), signal);
35
+ if (signal.aborted)
36
+ throw normalizeOAuthLoginError(signal.reason ?? new Error("Login cancelled"), signal);
37
+ const remoteCatalog = await client.saveProviderCredential(provider, credential, { refreshCatalog: false });
38
+ catalog.apply(remoteCatalog);
39
+ await session.modelRuntime.reloadCredentials({ refreshAvailability: false });
40
+ return { modelsRefreshed: true };
41
+ }
15
42
  //# sourceMappingURL=isolated-auth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isolated-auth.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/isolated-auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAkC,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErG,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAKnE,6GAA6G;AAC7G,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC/C,OAAqB,EACrB,MAAiB,EACjB,OAA2B,EAC3B,QAAgB,EAChB,SAAoC;IAEpC,MAAM,aAAa,GAAG,MAAM,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC/E,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;QAC7B,MAAM,wBAAwB,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,IAAI,IAAI,KAAK,CAAC,iBAAiB,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5G,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7B,4EAA4E;IAC5E,yEAAyE;IACzE,MAAM,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AAClC,CAAC","sourcesContent":["import type { AgentSession } from \"../../core/agent-session.js\";\nimport { type AtomicOAuthLoginCallbacks, normalizeOAuthLoginError } from \"../../core/oauth-login.ts\";\nimport type { RpcClient } from \"../rpc/rpc-client.ts\";\nimport { loginRpcOAuthProvider } from \"../rpc/rpc-oauth-client.ts\";\nimport type { RemoteModelCatalog } from \"./remote-model-catalog.ts\";\n\nexport type { AtomicOAuthLoginCallbacks } from \"../../core/oauth-login.ts\";\n\n/** Acquire and persist OAuth entirely in the engine, transporting only UI callbacks and catalog metadata. */\nexport async function loginIsolatedOAuthProvider(\n\tsession: AgentSession,\n\tclient: RpcClient,\n\tcatalog: RemoteModelCatalog,\n\tprovider: string,\n\tcallbacks: AtomicOAuthLoginCallbacks,\n): Promise<{ modelsRefreshed: true }> {\n\tconst remoteCatalog = await loginRpcOAuthProvider(client, provider, callbacks);\n\tif (remoteCatalog.cancelled) {\n\t\tthrow normalizeOAuthLoginError(callbacks.signal?.reason ?? new Error(\"Login cancelled\"), callbacks.signal);\n\t}\n\tcatalog.apply(remoteCatalog);\n\t// The engine owns persistence. Refresh the frontend snapshot only after its\n\t// credential transaction and catalog refresh both complete successfully.\n\tawait session.modelRuntime.reloadCredentials({ refreshAvailability: false });\n\treturn { modelsRefreshed: true };\n}\n"]}
1
+ {"version":3,"file":"isolated-auth.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/isolated-auth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkC,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAKnE,6GAA6G;AAC7G,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC/C,OAAqB,EACrB,MAAiB,EACjB,OAA2B,EAC3B,QAAgB,EAChB,SAAoC;IAEpC,MAAM,aAAa,GAAG,MAAM,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC/E,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;QAC7B,MAAM,wBAAwB,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,IAAI,IAAI,KAAK,CAAC,iBAAiB,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5G,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7B,4EAA4E;IAC5E,yEAAyE;IACzE,MAAM,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAChD,OAAqB,EACrB,MAAiB,EACjB,OAA2B,EAC3B,QAAgB,EAChB,WAA4B;IAE5B,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IAC3E,IAAI,CAAC,UAAU,EAAE,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,QAAQ,EAAE,CAAC,CAAC;IAChG,MAAM,MAAM,GAAG,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,CAAC,cAAc,EAAE,CAAC;IACxB,MAAM,UAAU,GAAG,MAAM,mBAAmB,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,GAAG,WAAW,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IACnG,IAAI,MAAM,CAAC,OAAO;QAAE,MAAM,wBAAwB,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,KAAK,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC;IAC1G,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3G,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7B,MAAM,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AAClC,CAAC","sourcesContent":["import type { AuthInteraction } from \"@bastani/pi-ai\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport { type AtomicOAuthLoginCallbacks, normalizeOAuthLoginError } from \"../../core/oauth-login.ts\";\nimport { operationSignal, raceWithAbortSignal } from \"../../utils/abort.js\";\nimport type { RpcClient } from \"../rpc/rpc-client.ts\";\nimport { loginRpcOAuthProvider } from \"../rpc/rpc-oauth-client.ts\";\nimport type { RemoteModelCatalog } from \"./remote-model-catalog.ts\";\n\nexport type { AtomicOAuthLoginCallbacks } from \"../../core/oauth-login.ts\";\n\n/** Acquire and persist OAuth entirely in the engine, transporting only UI callbacks and catalog metadata. */\nexport async function loginIsolatedOAuthProvider(\n\tsession: AgentSession,\n\tclient: RpcClient,\n\tcatalog: RemoteModelCatalog,\n\tprovider: string,\n\tcallbacks: AtomicOAuthLoginCallbacks,\n): Promise<{ modelsRefreshed: true }> {\n\tconst remoteCatalog = await loginRpcOAuthProvider(client, provider, callbacks);\n\tif (remoteCatalog.cancelled) {\n\t\tthrow normalizeOAuthLoginError(callbacks.signal?.reason ?? new Error(\"Login cancelled\"), callbacks.signal);\n\t}\n\tcatalog.apply(remoteCatalog);\n\t// The engine owns persistence. Refresh the frontend snapshot only after its\n\t// credential transaction and catalog refresh both complete successfully.\n\tawait session.modelRuntime.reloadCredentials({ refreshAvailability: false });\n\treturn { modelsRefreshed: true };\n}\n\n/**\n * Acquire an API key with the frontend's login dialog, then persist it in the engine.\n *\n * The engine owns credential storage for the isolated runtime, so the frontend\n * only collects the key and adopts the engine's catalog and credential snapshot\n * afterwards. A dialog cancelled before the engine save is sent persists nothing on\n * either side; once the save is in flight it completes and the login is reported, the\n * same commit point the local credential store uses. The engine save\n * deliberately skips the remote catalog refresh: catalog freshness belongs to\n * /model's bounded background refresh, and a failed fetch would otherwise leave the\n * key persisted in the engine while the frontend took the error branch.\n */\nexport async function loginIsolatedApiKeyProvider(\n\tsession: AgentSession,\n\tclient: RpcClient,\n\tcatalog: RemoteModelCatalog,\n\tprovider: string,\n\tinteraction: AuthInteraction,\n): Promise<{ modelsRefreshed: true }> {\n\tconst apiKeyAuth = session.modelRuntime.getProvider(provider)?.auth.apiKey;\n\tif (!apiKeyAuth?.login) throw new Error(`Provider does not support api_key login: ${provider}`);\n\tconst signal = operationSignal(interaction.signal);\n\tsignal.throwIfAborted();\n\tconst credential = await raceWithAbortSignal(apiKeyAuth.login({ ...interaction, signal }), signal);\n\tif (signal.aborted) throw normalizeOAuthLoginError(signal.reason ?? new Error(\"Login cancelled\"), signal);\n\tconst remoteCatalog = await client.saveProviderCredential(provider, credential, { refreshCatalog: false });\n\tcatalog.apply(remoteCatalog);\n\tawait session.modelRuntime.reloadCredentials({ refreshAvailability: false });\n\treturn { modelsRefreshed: true };\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { AuthInteraction } from "@bastani/pi-ai";
1
2
  import type { AgentSession } from "../../core/agent-session.js";
2
3
  import { AgentSessionRuntime, type CreateAgentSessionRuntimeFactory } from "../../core/agent-session-runtime.ts";
3
4
  import type { ResourceOverlap } from "../../core/diagnostics.ts";
@@ -61,6 +62,9 @@ export declare class IsolatedInteractiveRuntime extends AgentSessionRuntime {
61
62
  loginOAuthProvider(provider: string, callbacks: AtomicOAuthLoginCallbacks): Promise<{
62
63
  modelsRefreshed: true;
63
64
  }>;
65
+ loginApiKeyProvider(provider: string, interaction: AuthInteraction): Promise<{
66
+ modelsRefreshed: true;
67
+ }>;
64
68
  logoutProvider(provider: string): Promise<import("../rpc/rpc-types.ts").RpcLogoutProviderResult>;
65
69
  onDiagnostic(listener: EngineDiagnosticListener): () => void;
66
70
  onEngineMessage(listener: (message: InteractiveEngineMessage) => void): () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"isolated-runtime.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive-engine/isolated-runtime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,KAAK,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AAEjH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EACX,mBAAmB,EAEnB,qBAAqB,EACrB,sBAAsB,EAEtB,oBAAoB,EACpB,eAAe,EACf,MA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,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAQjC;IAEc,UAAU,CAAC,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAQ/F;IAEc,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAWvG;IAEc,IAAI,CAClB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAA;KAAE,GACtC,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAexD;IAED;;;;;;OAMG;IACH,UAAyB,kCAAkC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAG;IAEtE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAYhC;IAED,OAAO,CAAC,YAAY;IA6OpB;;;;;OAKG;YACW,eAAe;IAY7B,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,2BAA2B;IAQnC,OAAO,CAAC,mBAAmB;YAcb,yBAAyB;IAavC,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,YAAY;CAoCpB"}
@@ -5,7 +5,7 @@ import { SessionManager } from "../../core/session-manager.js";
5
5
  import { sleep } from "../../utils/sleep.js";
6
6
  import { isRpcTransportFailure, markRpcTransportFailure, rpcTransportError } from "../rpc/rpc-transport-error.js";
7
7
  import { EngineHealthController } from "./engine-health.js";
8
- import { loginIsolatedOAuthProvider } from "./isolated-auth.js";
8
+ import { loginIsolatedApiKeyProvider, loginIsolatedOAuthProvider, } from "./isolated-auth.js";
9
9
  import { RemoteCommandCatalog } from "./remote-command-catalog.js";
10
10
  import { RemoteModelCatalog } from "./remote-model-catalog.js";
11
11
  import { RemoteQueuePause } from "./remote-queue-pause.js";
@@ -194,6 +194,9 @@ export class IsolatedInteractiveRuntime extends AgentSessionRuntime {
194
194
  async loginOAuthProvider(provider, callbacks) {
195
195
  return loginIsolatedOAuthProvider(super.session, this.client, this.remoteModelCatalog, provider, callbacks);
196
196
  }
197
+ async loginApiKeyProvider(provider, interaction) {
198
+ return loginIsolatedApiKeyProvider(super.session, this.client, this.remoteModelCatalog, provider, interaction);
199
+ }
197
200
  async logoutProvider(provider) {
198
201
  const result = await this.client.logoutProvider(provider);
199
202
  this.remoteModelCatalog.applyModels({ models: result.models, scopedModels: result.scopedModels ?? [] });