@ai-agent-forge/agent-forge 0.86.2 → 0.86.4

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 (154) hide show
  1. package/CHANGELOG.md +38 -1
  2. package/dist/bundle/.build-manifest.json +183 -177
  3. package/dist/bundle/chunks/{anthropic-messages-RJYU4TCY.js → anthropic-messages-EVFQ6MLR.js} +3 -3
  4. package/dist/bundle/chunks/{azure-openai-responses-LESTCUL7.js → azure-openai-responses-WQCZWFAH.js} +1 -1
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
  6. package/dist/bundle/chunks/{chunk-MDOTREMR.js → chunk-3WE3W52L.js} +2 -2
  7. package/dist/bundle/chunks/chunk-F6SBZUJG.js +141 -0
  8. package/dist/bundle/chunks/{chunk-SER2HCLE.js → chunk-PE3XUHPT.js} +3 -3
  9. package/dist/bundle/chunks/chunk-TBPTHASB.js +2 -0
  10. package/dist/bundle/chunks/chunk-ZV3W36HK.js +1445 -0
  11. package/dist/bundle/chunks/github-copilot.js +1 -1
  12. package/dist/bundle/chunks/google-generative-ai-LQ375GYC.js +2 -0
  13. package/dist/bundle/chunks/google-vertex-HXSRAKEZ.js +2 -0
  14. package/dist/bundle/chunks/jiti-static-loader-CDSTNEDU.js +2 -0
  15. package/dist/bundle/chunks/mistral-conversations-CSNMFR4J.js +5 -0
  16. package/dist/bundle/chunks/{openai-codex-responses-UFH6O5K6.js → openai-codex-responses-YDJSZOIH.js} +1 -1
  17. package/dist/bundle/chunks/{openai-completions-A55GHA4O.js → openai-completions-UPRWTQPT.js} +3 -3
  18. package/dist/bundle/chunks/openai-responses-O63W6HQ3.js +2 -0
  19. package/dist/bundle/chunks/virtual-modules-O72ICTMQ.js +2 -0
  20. package/dist/bundle/cli.js +1 -1
  21. package/dist/bundle/index.js +1 -1
  22. package/dist/bundle/rpc-entry.js +1 -1
  23. package/dist/cli/args.d.ts.map +1 -1
  24. package/dist/cli/args.js +14 -4
  25. package/dist/cli/args.js.map +1 -1
  26. package/dist/cli/session-picker.d.ts +1 -1
  27. package/dist/cli/session-picker.d.ts.map +1 -1
  28. package/dist/cli/session-picker.js +8 -2
  29. package/dist/cli/session-picker.js.map +1 -1
  30. package/dist/core/agent-session-compaction.d.ts +4 -4
  31. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  32. package/dist/core/agent-session-compaction.js +161 -45
  33. package/dist/core/agent-session-compaction.js.map +1 -1
  34. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  35. package/dist/core/agent-session-runtime.js +1 -1
  36. package/dist/core/agent-session-runtime.js.map +1 -1
  37. package/dist/core/agent-session.d.ts +13 -4
  38. package/dist/core/agent-session.d.ts.map +1 -1
  39. package/dist/core/agent-session.js +91 -93
  40. package/dist/core/agent-session.js.map +1 -1
  41. package/dist/core/compaction/compaction.d.ts +15 -0
  42. package/dist/core/compaction/compaction.d.ts.map +1 -1
  43. package/dist/core/compaction/compaction.js +20 -1
  44. package/dist/core/compaction/compaction.js.map +1 -1
  45. package/dist/core/export-html/template.css +10 -0
  46. package/dist/core/export-html/template.js +50 -17
  47. package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +1 -1
  48. package/dist/core/extensions/bootstrap-compaction-policy.js +1 -2
  49. package/dist/core/extensions/bootstrap-compaction-policy.js.map +1 -1
  50. package/dist/core/extensions/capability-plugin.d.ts.map +1 -1
  51. package/dist/core/extensions/capability-plugin.js +25 -30
  52. package/dist/core/extensions/capability-plugin.js.map +1 -1
  53. package/dist/core/extensions/jiti-static-loader.d.ts +2 -0
  54. package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -0
  55. package/dist/core/extensions/jiti-static-loader.js +5 -0
  56. package/dist/core/extensions/jiti-static-loader.js.map +1 -0
  57. package/dist/core/extensions/microcompact.d.ts +16 -8
  58. package/dist/core/extensions/microcompact.d.ts.map +1 -1
  59. package/dist/core/extensions/microcompact.js +9 -7
  60. package/dist/core/extensions/microcompact.js.map +1 -1
  61. package/dist/core/extensions/virtual-modules.d.ts +3 -0
  62. package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
  63. package/dist/core/extensions/virtual-modules.js +32 -0
  64. package/dist/core/extensions/virtual-modules.js.map +1 -0
  65. package/dist/core/facade/coding-agent-facade.d.ts +3 -3
  66. package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
  67. package/dist/core/facade/coding-agent-facade.js.map +1 -1
  68. package/dist/core/facade/coding-agent-runtime-facade.d.ts +2 -2
  69. package/dist/core/facade/coding-agent-runtime-facade.d.ts.map +1 -1
  70. package/dist/core/facade/coding-agent-runtime-facade.js +4 -4
  71. package/dist/core/facade/coding-agent-runtime-facade.js.map +1 -1
  72. package/dist/core/model-resolver.d.ts.map +1 -1
  73. package/dist/core/model-resolver.js +2 -2
  74. package/dist/core/model-resolver.js.map +1 -1
  75. package/dist/core/package-install-host.d.ts +1 -1
  76. package/dist/core/package-install-host.d.ts.map +1 -1
  77. package/dist/core/package-install-host.js +4 -3
  78. package/dist/core/package-install-host.js.map +1 -1
  79. package/dist/core/prompt-templates.d.ts +6 -1
  80. package/dist/core/prompt-templates.d.ts.map +1 -1
  81. package/dist/core/prompt-templates.js +61 -35
  82. package/dist/core/prompt-templates.js.map +1 -1
  83. package/dist/core/resource-loader.d.ts.map +1 -1
  84. package/dist/core/resource-loader.js +6 -2
  85. package/dist/core/resource-loader.js.map +1 -1
  86. package/dist/core/session-manager.d.ts +23 -4
  87. package/dist/core/session-manager.d.ts.map +1 -1
  88. package/dist/core/session-manager.js +146 -108
  89. package/dist/core/session-manager.js.map +1 -1
  90. package/dist/core/settings-manager.d.ts +3 -0
  91. package/dist/core/settings-manager.d.ts.map +1 -1
  92. package/dist/core/settings-manager.js +5 -1
  93. package/dist/core/settings-manager.js.map +1 -1
  94. package/dist/core/tools/bash.d.ts +2 -1
  95. package/dist/core/tools/bash.d.ts.map +1 -1
  96. package/dist/core/tools/bash.js +27 -13
  97. package/dist/core/tools/bash.js.map +1 -1
  98. package/dist/main.d.ts.map +1 -1
  99. package/dist/main.js +6 -7
  100. package/dist/main.js.map +1 -1
  101. package/dist/modes/interactive/components/footer.d.ts +8 -0
  102. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  103. package/dist/modes/interactive/components/footer.js +40 -4
  104. package/dist/modes/interactive/components/footer.js.map +1 -1
  105. package/dist/modes/interactive/components/session-selector.d.ts +5 -5
  106. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  107. package/dist/modes/interactive/components/session-selector.js +74 -50
  108. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  109. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  110. package/dist/modes/interactive/components/tool-execution.js +18 -9
  111. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  112. package/dist/modes/interactive/interactive-mode.d.ts +2 -2
  113. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  114. package/dist/modes/interactive/interactive-mode.js +35 -32
  115. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  116. package/dist/modes/rpc/rpc-client.d.ts +14 -6
  117. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  118. package/dist/modes/rpc/rpc-client.js +47 -10
  119. package/dist/modes/rpc/rpc-client.js.map +1 -1
  120. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  121. package/dist/modes/rpc/rpc-mode.js +9 -10
  122. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  123. package/dist/modes/rpc/rpc-types.d.ts +10 -1
  124. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  125. package/dist/modes/rpc/rpc-types.js.map +1 -1
  126. package/dist/remote/server-assembly.d.ts.map +1 -1
  127. package/dist/remote/server-assembly.js +1 -1
  128. package/dist/remote/server-assembly.js.map +1 -1
  129. package/dist/utils/clipboard-image.d.ts.map +1 -1
  130. package/dist/utils/clipboard-image.js +1 -12
  131. package/dist/utils/clipboard-image.js.map +1 -1
  132. package/dist/utils/clipboard.d.ts.map +1 -1
  133. package/dist/utils/clipboard.js +88 -13
  134. package/dist/utils/clipboard.js.map +1 -1
  135. package/dist/utils/mime.d.ts.map +1 -1
  136. package/dist/utils/mime.js +1 -1
  137. package/dist/utils/mime.js.map +1 -1
  138. package/dist/utils/shell.d.ts +1 -3
  139. package/dist/utils/shell.d.ts.map +1 -1
  140. package/dist/utils/shell.js +3 -30
  141. package/dist/utils/shell.js.map +1 -1
  142. package/dist/utils/wsl.d.ts +3 -0
  143. package/dist/utils/wsl.d.ts.map +1 -0
  144. package/dist/utils/wsl.js +15 -0
  145. package/dist/utils/wsl.js.map +1 -0
  146. package/docs/rpc.md +7 -5
  147. package/docs/sdk.md +9 -8
  148. package/package.json +1 -1
  149. package/dist/bundle/chunks/chunk-JR3Q27QP.js +0 -1581
  150. package/dist/bundle/chunks/chunk-KQEGUM34.js +0 -2
  151. package/dist/bundle/chunks/google-generative-ai-NZ66X6K7.js +0 -2
  152. package/dist/bundle/chunks/google-vertex-2ZZOFBNQ.js +0 -2
  153. package/dist/bundle/chunks/mistral-conversations-B6DZRMEK.js +0 -5
  154. package/dist/bundle/chunks/openai-responses-TJLXRAXR.js +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"coding-agent-facade.d.ts","sourceRoot":"","sources":["../../../src/core/facade/coding-agent-facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AAE5F,OAAO,KAAK,EACX,YAAY,EACZ,yBAAyB,EACzB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,MAAM,qBAAqB,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,CAAC;IACzB,iDAAiD;IACjD,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAG3C,2CAA2C;IAC3C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,+FAA+F;AAC/F,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,YAAY,GAAG,mBAAmB,CAiGlF","sourcesContent":["/**\n * Stable facade v1: a read-only mirror plus pass-through run control and\n * session write paths over one AgentSession.\n *\n * Design: docs/design/稳定门面统一入口设计.md (§2.5 阶段 0 实际面, §2.6 slice 1\n * 读面, §2.7 slice 2 读面, §2.8 阶段 2 写面, §2.9 阶段 3 RPC 面, §3 API 面 v1,\n * §4 阶段 0/1/2/3). Every member is a pure delegate onto the wrapped\n * AgentSession or its existing curated surfaces (`getSessionAPI()`, `host`).\n * No new behavior, no policy, no state of its own. Product entry points\n * (TUI/CLI/RPC/Embedded) migrate onto this surface in later phases;\n * AgentSession stays the internal adapter behind it.\n *\n * Scope: in-package stable surface for those product entry points. It is not\n * exported from the package root and is not a cross-package public contract.\n */\n\nimport type { AgentState, ThinkingLevel } from \"@agent-forge/agent-core\";\nimport type { AuthCheck, AuthResult, ImageContent } from \"@agent-forge/ai\";\nimport type { Api, Model } from \"@agent-forge/ai/compat\";\nimport type { ModelCatalogRuntime } from \"../../modes/interactive/model-catalog-refresh.ts\";\nimport { readSessionSuiteBinding } from \"../../profiles/suite-loader.ts\";\nimport type {\n\tAgentSession,\n\tAgentSessionEventListener,\n\tModelCycleResult,\n\tModelMutationOptions,\n\tPromptOptions,\n\tSessionStats,\n} from \"../agent-session.ts\";\nimport type { CompactionCancelledResult } from \"../agent-session-compaction.ts\";\nimport type { BashResult } from \"../bash-executor.ts\";\nimport type { ModelPriceSource } from \"../cache-stats.ts\";\nimport type { CompactionResult } from \"../compaction/index.ts\";\nimport type { ResourceDiagnostic } from \"../diagnostics.ts\";\nimport type { ContextUsage, PromptOutcome, SessionAPI } from \"../extensions/public-api.ts\";\nimport type { InputSource } from \"../input-source.ts\";\nimport type { ModelRuntime } from \"../model-runtime.ts\";\nimport type { PromptTemplate } from \"../prompt-templates.ts\";\nimport type { ThemeMetaV1 } from \"../resource-loader.ts\";\nimport type { BranchSummaryEntry, SessionEntry, SessionHeader, SessionTreeNode } from \"../session-manager.ts\";\nimport type { Skill } from \"../skills.ts\";\nimport type { BashOperations } from \"../tools/bash.ts\";\nimport type { ToolDefinition } from \"../tools/tool-definition.ts\";\n\n/** Prompt options for the facade. Identical to AgentSession PromptOptions. */\nexport type CodingAgentFacadePromptOptionsV1 = PromptOptions;\n\n/**\n * Narrow credential/provider auth projection (D-048): the TUI auth surface\n * only. Covers exactly the seven methods the auth host consumes\n * (`getProviders`/`getProvider`/`getProviderAuthStatus`/`isUsingOAuth`/\n * `listCredentials`/`login`/`logout`); the full ModelRuntime never leaks to\n * the host. The credential-management CapabilityAPI semantics question stays\n * open (D-047 裁决 3); this narrows the TUI host path without deciding it.\n */\nexport type ModelAuthRuntime = Pick<\n\tModelRuntime,\n\t\"getProviders\" | \"getProvider\" | \"getProviderAuthStatus\" | \"isUsingOAuth\" | \"listCredentials\" | \"login\" | \"logout\"\n>;\n\n/**\n * Stable facade v1: the consumption surface for product hosts, versioned per\n * repo convention (EmbeddedSdkBindingV1 precedent). Members are pass-throughs\n * onto the wrapped AgentSession; new members must extend the facade design\n * doc first (门面腐化 guard, 设计 §6).\n */\nexport interface CodingAgentFacadeV1 {\n\treadonly version: 1;\n\n\t// --- Run control ---\n\t/**\n\t * Delegates to AgentSession.prompt(). The full PromptOptions pass through,\n\t * including the internal RPC preflight hook (`preflightResult`) that RPC\n\t * mode uses to observe prompt acceptance (阶段 3, 设计 §2.9).\n\t */\n\tprompt(text: string, options?: CodingAgentFacadePromptOptionsV1): Promise<PromptOutcome>;\n\t/** Delegates to AgentSession.steer(). */\n\tsteer(text: string, images?: ImageContent[], options?: { source?: InputSource }): Promise<void>;\n\t/** Delegates to AgentSession.abort(). */\n\tabort(): Promise<void>;\n\t/** Delegates to AgentSession.waitForIdle(). */\n\twaitForIdle(): Promise<void>;\n\n\t// --- Session write paths ---\n\t/** Delegates to AgentSession.compact(). */\n\tcompact(customInstructions?: string): Promise<CompactionResult | CompactionCancelledResult>;\n\t/** Delegates to AgentSession.navigateTree(). */\n\tnavigateTree(\n\t\ttargetId: string,\n\t\toptions?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string },\n\t): Promise<{ editorText?: string; cancelled: boolean; aborted?: boolean; summaryEntry?: BranchSummaryEntry }>;\n\t/** Delegates to AgentSession.reload(). */\n\treload(options?: { beforeSessionStart?: () => void | Promise<void> }): Promise<void>;\n\t/** Delegates to AgentSession.setModel(). */\n\tsetModel(model: Model<Api>, options?: ModelMutationOptions): Promise<void>;\n\t/** Delegates to AgentSession.setThinkingLevel(). */\n\tsetThinkingLevel(level: ThinkingLevel, options?: ModelMutationOptions): void;\n\t/** Delegates to AgentSession.setActiveToolsByName(). */\n\tsetActiveToolsByName(toolNames: string[]): void;\n\t/**\n\t * Queued-message read view, composed from AgentSession.getSteeringMessages()\n\t * and AgentSession.getFollowUpMessages(). AgentSession has no single\n\t * getQueuedMessages(); the shape mirrors clearQueue()'s return value.\n\t */\n\tgetQueuedMessages(): { steering: readonly string[]; followUp: readonly string[] };\n\t/** Delegates to AgentSession.clearQueue(). */\n\tclearQueue(): { steering: string[]; followUp: string[] };\n\t/** Delegates to AgentSession.recordSuiteMismatch(). */\n\trecordSuiteMismatch(originalSuiteId: string, currentSuiteId: string): void;\n\t/** Delegates to AgentSession.getSessionAPI(). */\n\tgetSessionAPI(): SessionAPI;\n\n\t// --- Read-only mirror ---\n\t/** Delegates to AgentSession.isIdle. */\n\tisIdle(): boolean;\n\t/** Mirrors AgentSession.state verbatim (phase 0; a projected state view is a later phase, 设计 §3). */\n\tgetState(): AgentState;\n\t/** Delegates to AgentSession.model. */\n\tgetModel(): Model<Api> | undefined;\n\t/** Delegates to AgentSession.getActiveToolNames(). */\n\tgetToolNames(): string[];\n\t/** Delegates to AgentSession.sessionId (via SessionAPI.getSessionId semantics). */\n\tgetSessionId(): string;\n\t/**\n\t * Suite id from the session-suite binding entry (设计 §10.1), read through\n\t * SessionAPI.getBranchEntries(). Undefined when the session carries no\n\t * suite binding.\n\t */\n\tgetSuiteId(): string | undefined;\n\t/** Delegates to AgentSession.sessionManager.getHeader(). SessionManager itself never leaks. */\n\tgetHeader(): SessionHeader | null;\n\t/** Delegates to AgentSession.subscribe(). Event types pass through verbatim (设计 §3). */\n\tsubscribe(listener: AgentSessionEventListener): () => void;\n\t/**\n\t * Invoked after each raw agent event is delivered to session processing;\n\t * the listener is awaited serially by the agent loop and participates in\n\t * run settlement. Exists for stdout backpressure pacing (D-046); the raw\n\t * event payload and abort signal are deliberately not exposed.\n\t */\n\tsubscribeRawEventGate(listener: () => void | Promise<void>): () => void;\n\n\t// --- Read surface (phase 1 slice 1, TUI display/selector reads, 设计 §2.6) ---\n\t/** Delegates to AgentSession.sessionName (which reads sessionManager.getSessionName()). */\n\tgetSessionName(): string | undefined;\n\t/** Delegates to AgentSession.isCompacting: a compaction or branch summarization is running (session level). */\n\tisCompacting(): boolean;\n\t/**\n\t * Delegates to AgentSession.isStreaming: an agent run is active at the\n\t * session level. Distinct from AgentState.isStreaming (agent-level stream\n\t * flag); do not interchange the two.\n\t */\n\tisStreaming(): boolean;\n\t/** Delegates to AgentSession.getContextUsage(). */\n\tgetContextUsage(): ContextUsage | undefined;\n\t/** Delegates to AgentSession.systemPrompt (effective prompt, including per-turn extension modifications). */\n\tgetSystemPrompt(): string;\n\t/** Delegates to AgentSession.scopedModels. Read view only; setScopedModels stays a phase 2 write path. */\n\tgetScopedModels(): ReadonlyArray<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\t/** Delegates to SessionManager.getTree() on the wrapped session. SessionManager itself never leaks. */\n\tgetTree(): SessionTreeNode[];\n\t/** Delegates to SessionManager.getLeafId() on the wrapped session. SessionManager itself never leaks. */\n\tgetLeafId(): string | null;\n\n\t// --- Read surface (phase 1 slice 2, TUI display/selector cluster convergence, 设计 §2.7) ---\n\t/** Delegates to AgentSession.promptTemplates (file-based prompt templates). */\n\tgetPromptTemplates(): ReadonlyArray<PromptTemplate>;\n\t/** Delegates to AgentSession.getToolDefinition(name): the registered tool definition by name, for diagnostics/rendering. */\n\tgetToolDefinition(name: string): ToolDefinition | undefined;\n\t/** Delegates to SessionManager.getCwd() on the wrapped session; identical to host.cwd. SessionManager itself never leaks. */\n\tgetCwd(): string;\n\t/** Delegates to SessionManager.getEntries() on the wrapped session; identical to host.entries. SessionManager itself never leaks. */\n\tgetEntries(): SessionEntry[];\n\t/** Delegates to AgentSession.pendingMessageCount: queued steering + follow-up message count. */\n\tgetPendingMessageCount(): number;\n\n\t// --- Write surface (phase 2, TUI write path convergence, 设计 §2.8) ---\n\t/** Delegates to AgentSession.followUp(). */\n\tfollowUp(text: string, images?: ImageContent[], options?: { source?: InputSource }): Promise<void>;\n\t/** Delegates to AgentSession.setScopedModels(). */\n\tsetScopedModels(scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>): void;\n\t/** Delegates to AgentSession.cycleModel(). */\n\tcycleModel(\n\t\tdirection?: \"forward\" | \"backward\",\n\t\toptions?: ModelMutationOptions,\n\t): Promise<ModelCycleResult | undefined>;\n\t/** Delegates to AgentSession.cycleThinkingLevel(). */\n\tcycleThinkingLevel(options?: ModelMutationOptions): ThinkingLevel | undefined;\n\t/** Delegates to AgentSession.setSteeringMode(). */\n\tsetSteeringMode(mode: \"all\" | \"one-at-a-time\"): void;\n\t/** Delegates to AgentSession.setFollowUpMode(). */\n\tsetFollowUpMode(mode: \"all\" | \"one-at-a-time\"): void;\n\t/** Delegates to AgentSession.setAutoCompactionEnabled(). */\n\tsetAutoCompactionEnabled(enabled: boolean): void;\n\t/** Delegates to AgentSession.setSessionName(). */\n\tsetSessionName(name: string): void;\n\t/** Delegates to AgentSession.abortBash(). */\n\tabortBash(): void;\n\t/** Delegates to AgentSession.abortCompaction(). */\n\tabortCompaction(): void;\n\t/** Delegates to AgentSession.abortRetry(). */\n\tabortRetry(): void;\n\t/** Delegates to AgentSession.abortBranchSummary(). */\n\tabortBranchSummary(): void;\n\t/** Delegates to AgentSession.captureBashEpoch(). */\n\tcaptureBashEpoch(): number;\n\t/** Delegates to AgentSession.isBashEpochCurrent(). */\n\tisBashEpochCurrent(epoch: number): boolean;\n\t/** Delegates to AgentSession.emitUserBash(): dispatches the user.bash lifecycle facts. */\n\temitUserBash(excludeFromContext: boolean): void;\n\t/** Delegates to AgentSession.executeBash(). */\n\texecuteBash(\n\t\tcommand: string,\n\t\tonChunk?: (chunk: string) => void,\n\t\toptions?: { excludeFromContext?: boolean; id?: string; operations?: BashOperations },\n\t): Promise<BashResult>;\n\t/** Delegates to AgentSession.recordBashResult(). */\n\trecordBashResult(\n\t\tcommand: string,\n\t\tresult: BashResult,\n\t\toptions?: { excludeFromContext?: boolean; epoch?: number },\n\t): void;\n\n\t// --- Read surface (phase 3, RPC host state reads, 设计 §2.9) ---\n\t/** Delegates to AgentSession.thinkingLevel. */\n\tgetThinkingLevel(): ThinkingLevel;\n\t/** Delegates to AgentSession.steeringMode. */\n\tgetSteeringMode(): \"all\" | \"one-at-a-time\";\n\t/** Delegates to AgentSession.followUpMode. */\n\tgetFollowUpMode(): \"all\" | \"one-at-a-time\";\n\t/** Delegates to AgentSession.sessionFile. */\n\tgetSessionFile(): string | undefined;\n\t/** Delegates to AgentSession.autoCompactionEnabled. */\n\tisAutoCompactionEnabled(): boolean;\n\t/** Delegates to AgentSession.getAvailableThinkingLevels(). */\n\tgetAvailableThinkingLevels(): ThinkingLevel[];\n\t/** Delegates to AgentSession.getUserMessagesForForking(). */\n\tgetUserMessagesForForking(): Array<{ entryId: string; text: string }>;\n\t/** Delegates to AgentSession.getLastAssistantText(). */\n\tgetLastAssistantText(): string | undefined;\n\t/** Delegates to AgentSession.getSessionStats(). */\n\tgetSessionStats(): SessionStats;\n\n\t// --- Write surface (phase 3, RPC host writes, 设计 §2.9) ---\n\t/** Delegates to AgentSession.setAutoRetryEnabled(). */\n\tsetAutoRetryEnabled(enabled: boolean): void;\n\t/** Delegates to AgentSession.exportToHtml(), including the themeName option. */\n\texportToHtml(outputPath?: string, options?: { themeName?: string }): Promise<string>;\n\n\t// --- Session write path (阶段 4 slice 3 v1 修订, D-041) ---\n\t/**\n\t * Delegates to SessionManager.appendLabelChange() on the wrapped session.\n\t * TUI tree selector label rename write point; SessionAPI has no label write.\n\t */\n\tappendLabelChange(entryId: string, label: string | undefined): string;\n\n\t// --- Resource read surface (阶段 4 slice 3 v1 修订, D-041) ---\n\t/**\n\t * Clean read projections over the wrapped session's resource loader. Skills/\n\t * prompts/agents-files results pass through verbatim; themes and extensions\n\t * are the metadata projections (themes as ThemeMetaV1 without the modes\n\t * Theme class; loader registration maps and the shared runtime never\n\t * leak). Guard reason: TUI startup listing/autocomplete/diagnostics\n\t * consume these read points directly; SessionAPI/CapabilityAPI are\n\t * capability-side contracts with no host display projections.\n\t */\n\t/** Delegates to ResourceLoader.getSkills() on the wrapped session. */\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getPrompts() on the wrapped session. */\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getThemes() on the wrapped session. */\n\tgetThemes(): { themes: ThemeMetaV1[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getAgentsFiles() on the wrapped session. */\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> };\n\t/** Delegates to ResourceLoader.getSystemPromptSource() on the wrapped session. */\n\tgetSystemPromptSource(): { path: string } | undefined;\n\t/** Delegates to ResourceLoader.getAppendSystemPromptSources() on the wrapped session. */\n\tgetAppendSystemPromptSources(): Array<{ path: string }>;\n\n\t// --- Model/catalog/context read surface (v1 修订, D-047: TUI direct session reads zeroed) ---\n\t/** Delegates to ModelRuntime.getAvailableSnapshot() on the wrapped session (D-047); ModelRuntime itself never leaks. */\n\tgetAvailableModels(): readonly Model<Api>[];\n\t/** Delegates to ModelRuntime.isUsingSubscription() on the wrapped session (D-047). */\n\tisUsingSubscription(providerId: string): boolean;\n\t/** Delegates to ModelRuntime.getError() on the wrapped session (D-047). */\n\tgetModelsError(): string | undefined;\n\t/**\n\t * Narrow `ModelCatalogRuntime` projection of the wrapped session's\n\t * ModelRuntime for the shared catalog-refresh coordinator (D-047). A\n\t * projection, not a wrapper: the full runtime never leaks.\n\t */\n\tgetModelCatalog(): ModelCatalogRuntime;\n\t/** Delegates to ModelRuntime.checkAuth() on the wrapped session (D-047). */\n\tcheckProviderAuth(providerId: string): Promise<AuthCheck | undefined>;\n\t/** Delegates to ModelRuntime.getAuth() on the wrapped session (D-047). */\n\tgetProviderAuth(providerId: string): Promise<AuthResult | undefined>;\n\t/**\n\t * Narrow `ModelPriceSource` projection of the wrapped session's\n\t * ModelRuntime for the cache-stats pure functions (D-047). A projection,\n\t * not a wrapper: the full runtime never leaks.\n\t */\n\tgetModelPriceSource(): ModelPriceSource;\n\t/**\n\t * Delegates to SessionManager.buildContextEntries() on the wrapped session\n\t * (D-047; delegation restored by the D-047 regression fix — the\n\t * incrementally maintained byId index is required for correct context\n\t * paths after a compaction commit). SessionManager itself never leaks.\n\t */\n\tgetContextEntries(): SessionEntry[];\n\n\t// --- Credential/provider auth read surface (v1 修订, D-048: TUI auth host path) ---\n\t/**\n\t * Narrow `ModelAuthRuntime` projection of the wrapped session's ModelRuntime\n\t * for the TUI auth surface (D-048). A projection, not a wrapper: the full\n\t * runtime never leaks. The credential-management CapabilityAPI semantics\n\t * question stays open (D-047 裁决 3); this only narrows the TUI host path.\n\t */\n\tgetModelAuthRuntime(): ModelAuthRuntime;\n\n\t// --- Session stats/text read surface (v1 修订, B-S2b③-S3a: TUI direct\n\t// session stats/text read cluster convergence) ---\n\t/** Delegates to AgentSession.getSteeringMessages(). */\n\tgetSteeringMessages(): readonly string[];\n\t/** Delegates to AgentSession.getFollowUpMessages(). */\n\tgetFollowUpMessages(): readonly string[];\n\n\t// --- Status/settings + export read surface (v1 修订, B-S2b③-S3b+c: TUI\n\t// status/settings/export cluster direct session read convergence) ---\n\t/** Delegates to AgentSession.retryAttempt. */\n\tgetRetryAttempt(): number;\n\t/** Delegates to AgentSession.isBashRunning. */\n\tisBashRunning(): boolean;\n\t/** Delegates to AgentSession.exportToJsonl(). */\n\texportToJsonl(outputPath?: string): string;\n\n\t// --- Lifecycle ---\n\t/** Delegates to AgentSession.dispose(). */\n\tdispose(): Promise<void>;\n}\n\n/** Creates a facade v1 view over one AgentSession. Pure wrapper: holds no state of its own. */\nexport function createCodingAgentFacade(session: AgentSession): CodingAgentFacadeV1 {\n\treturn {\n\t\tversion: 1,\n\t\tprompt: (text, options) => session.prompt(text, options),\n\t\tsteer: (text, images, options) => session.steer(text, images, options),\n\t\tabort: () => session.abort(),\n\t\twaitForIdle: () => session.waitForIdle(),\n\t\tcompact: (customInstructions) => session.compact(customInstructions),\n\t\tnavigateTree: (targetId, options) => session.navigateTree(targetId, options),\n\t\treload: (options) => session.reload(options),\n\t\tsetModel: (model, options) => session.setModel(model, options),\n\t\tsetThinkingLevel: (level, options) => session.setThinkingLevel(level, options),\n\t\tsetActiveToolsByName: (toolNames) => session.setActiveToolsByName(toolNames),\n\t\tgetQueuedMessages: () => ({\n\t\t\tsteering: session.getSteeringMessages(),\n\t\t\tfollowUp: session.getFollowUpMessages(),\n\t\t}),\n\t\tclearQueue: () => session.clearQueue(),\n\t\trecordSuiteMismatch: (originalSuiteId, currentSuiteId) =>\n\t\t\tsession.recordSuiteMismatch(originalSuiteId, currentSuiteId),\n\t\tgetSessionAPI: () => session.getSessionAPI(),\n\t\tisIdle: () => session.isIdle,\n\t\tgetState: () => session.state,\n\t\tgetModel: () => session.model,\n\t\tgetToolNames: () => session.getActiveToolNames(),\n\t\tgetSessionId: () => session.sessionId,\n\t\tgetHeader: () => session.sessionManager.getHeader(),\n\t\tsubscribe: (listener) => session.subscribe(listener),\n\t\tsubscribeRawEventGate: (listener) => session.agent.subscribe(() => listener()),\n\t\tgetSessionName: () => session.sessionName,\n\t\tisCompacting: () => session.isCompacting,\n\t\tisStreaming: () => session.isStreaming,\n\t\tgetContextUsage: () => session.getContextUsage(),\n\t\tgetSystemPrompt: () => session.systemPrompt,\n\t\tgetScopedModels: () => session.scopedModels,\n\t\tgetTree: () => session.sessionManager.getTree(),\n\t\tgetLeafId: () => session.sessionManager.getLeafId(),\n\t\tgetPromptTemplates: () => session.promptTemplates,\n\t\tgetToolDefinition: (name) => session.getToolDefinition(name),\n\t\tgetCwd: () => session.sessionManager.getCwd(),\n\t\tgetEntries: () => session.sessionManager.getEntries(),\n\t\tgetPendingMessageCount: () => session.pendingMessageCount,\n\t\tfollowUp: (text, images, options) => session.followUp(text, images, options),\n\t\tsetScopedModels: (scopedModels) => session.setScopedModels(scopedModels),\n\t\tcycleModel: (direction, options) => session.cycleModel(direction, options),\n\t\tcycleThinkingLevel: (options) => session.cycleThinkingLevel(options),\n\t\tsetSteeringMode: (mode) => session.setSteeringMode(mode),\n\t\tsetFollowUpMode: (mode) => session.setFollowUpMode(mode),\n\t\tsetAutoCompactionEnabled: (enabled) => session.setAutoCompactionEnabled(enabled),\n\t\tsetSessionName: (name) => session.setSessionName(name),\n\t\tabortBash: () => session.abortBash(),\n\t\tabortCompaction: () => session.abortCompaction(),\n\t\tabortRetry: () => session.abortRetry(),\n\t\tabortBranchSummary: () => session.abortBranchSummary(),\n\t\tcaptureBashEpoch: () => session.captureBashEpoch(),\n\t\tisBashEpochCurrent: (epoch) => session.isBashEpochCurrent(epoch),\n\t\temitUserBash: (excludeFromContext) => session.emitUserBash(excludeFromContext),\n\t\texecuteBash: (command, onChunk, options) => session.executeBash(command, onChunk, options),\n\t\trecordBashResult: (command, result, options) => session.recordBashResult(command, result, options),\n\t\tgetThinkingLevel: () => session.thinkingLevel,\n\t\tgetSteeringMode: () => session.steeringMode,\n\t\tgetFollowUpMode: () => session.followUpMode,\n\t\tgetSessionFile: () => session.sessionFile,\n\t\tisAutoCompactionEnabled: () => session.autoCompactionEnabled,\n\t\tgetAvailableThinkingLevels: () => session.getAvailableThinkingLevels(),\n\t\tgetUserMessagesForForking: () => session.getUserMessagesForForking(),\n\t\tgetLastAssistantText: () => session.getLastAssistantText(),\n\t\tgetSessionStats: () => session.getSessionStats(),\n\t\tsetAutoRetryEnabled: (enabled) => session.setAutoRetryEnabled(enabled),\n\t\texportToHtml: (outputPath, options) => session.exportToHtml(outputPath, options),\n\t\tappendLabelChange: (entryId, label) => session.sessionManager.appendLabelChange(entryId, label),\n\t\tgetSkills: () => session.resourceLoader.getSkills(),\n\t\tgetPrompts: () => session.resourceLoader.getPrompts(),\n\t\tgetThemes: () => session.resourceLoader.getThemes(),\n\t\tgetAgentsFiles: () => session.resourceLoader.getAgentsFiles(),\n\t\tgetSystemPromptSource: () => session.resourceLoader.getSystemPromptSource(),\n\t\tgetAppendSystemPromptSources: () => session.resourceLoader.getAppendSystemPromptSources(),\n\t\tgetSuiteId: () => readSessionSuiteBinding(session.getSessionAPI().getBranchEntries())?.suiteId,\n\t\tgetAvailableModels: () => session.modelRuntime.getAvailableSnapshot(),\n\t\tisUsingSubscription: (providerId) => session.modelRuntime.isUsingSubscription(providerId),\n\t\tgetModelsError: () => session.modelRuntime.getError(),\n\t\tgetModelCatalog: () => session.modelRuntime,\n\t\tcheckProviderAuth: (providerId) => session.modelRuntime.checkAuth(providerId),\n\t\tgetProviderAuth: (providerId) => session.modelRuntime.getAuth(providerId),\n\t\tgetModelPriceSource: () => session.modelRuntime,\n\t\tgetModelAuthRuntime: () => session.modelRuntime,\n\t\t// Delegates to the SessionManager method: its incrementally maintained\n\t\t// byId index walks the full entry graph, which rebuild-from-entries\n\t\t// diverges from after a compaction commit (D-047 regression fix).\n\t\tgetContextEntries: () => session.sessionManager.buildContextEntries(),\n\t\tgetSteeringMessages: () => session.getSteeringMessages(),\n\t\tgetFollowUpMessages: () => session.getFollowUpMessages(),\n\t\tgetRetryAttempt: () => session.retryAttempt,\n\t\tisBashRunning: () => session.isBashRunning,\n\t\texportToJsonl: (outputPath) => session.exportToJsonl(outputPath),\n\t\tdispose: () => session.dispose(),\n\t};\n}\n"]}
1
+ {"version":3,"file":"coding-agent-facade.d.ts","sourceRoot":"","sources":["../../../src/core/facade/coding-agent-facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AAE5F,OAAO,KAAK,EACX,YAAY,EACZ,yBAAyB,EACzB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAA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E,CAAC;IAC5C,sFAAsF;IACtF,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IACjD,2EAA2E;IAC3E,cAAc,IAAI,MAAM,GAAG,SAAS,CAAC;IACrC;;;;OAIG;IACH,eAAe,IAAI,mBAAmB,CAAC;IACvC,4EAA4E;IAC5E,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IACtE,0EAA0E;IAC1E,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IACrE;;;;OAIG;IACH,mBAAmB,IAAI,gBAAgB,CAAC;IACxC;;;;;OAKG;IACH,iBAAiB,IAAI,YAAY,EAAE,CAAC;IAGpC;;;;;OAKG;IACH,mBAAmB,IAAI,gBAAgB,CAAC;IAIxC,uDAAuD;IACvD,mBAAmB,IAAI,SAAS,MAAM,EAAE,CAAC;IACzC,uDAAuD;IACvD,mBAAmB,IAAI,SAAS,MAAM,EAAE,CAAC;IAIzC,8CAA8C;IAC9C,eAAe,IAAI,MAAM,CAAC;IAC1B,+CAA+C;IAC/C,aAAa,IAAI,OAAO,CAAC;IACzB,iDAAiD;IACjD,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAG3C,2CAA2C;IAC3C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,+FAA+F;AAC/F,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,YAAY,GAAG,mBAAmB,CAiGlF","sourcesContent":["/**\n * Stable facade v1: a read-only mirror plus pass-through run control and\n * session write paths over one AgentSession.\n *\n * Design: docs/design/稳定门面统一入口设计.md (§2.5 阶段 0 实际面, §2.6 slice 1\n * 读面, §2.7 slice 2 读面, §2.8 阶段 2 写面, §2.9 阶段 3 RPC 面, §3 API 面 v1,\n * §4 阶段 0/1/2/3). Every member is a pure delegate onto the wrapped\n * AgentSession or its existing curated surfaces (`getSessionAPI()`, `host`).\n * No new behavior, no policy, no state of its own. Product entry points\n * (TUI/CLI/RPC/Embedded) migrate onto this surface in later phases;\n * AgentSession stays the internal adapter behind it.\n *\n * Scope: in-package stable surface for those product entry points. It is not\n * exported from the package root and is not a cross-package public contract.\n */\n\nimport type { AgentState, ThinkingLevel } from \"@agent-forge/agent-core\";\nimport type { AuthCheck, AuthResult, ImageContent } from \"@agent-forge/ai\";\nimport type { Api, Model } from \"@agent-forge/ai/compat\";\nimport type { ModelCatalogRuntime } from \"../../modes/interactive/model-catalog-refresh.ts\";\nimport { readSessionSuiteBinding } from \"../../profiles/suite-loader.ts\";\nimport type {\n\tAgentSession,\n\tAgentSessionEventListener,\n\tModelCycleResult,\n\tModelMutationOptions,\n\tPromptOptions,\n\tQueuedInputDisposition,\n\tSessionStats,\n} from \"../agent-session.ts\";\nimport type { CompactionCancelledResult } from \"../agent-session-compaction.ts\";\nimport type { BashResult } from \"../bash-executor.ts\";\nimport type { ModelPriceSource } from \"../cache-stats.ts\";\nimport type { CompactionResult } from \"../compaction/index.ts\";\nimport type { ResourceDiagnostic } from \"../diagnostics.ts\";\nimport type { ContextUsage, PromptOutcome, SessionAPI } from \"../extensions/public-api.ts\";\nimport type { InputSource } from \"../input-source.ts\";\nimport type { ModelRuntime } from \"../model-runtime.ts\";\nimport type { PromptTemplate } from \"../prompt-templates.ts\";\nimport type { ThemeMetaV1 } from \"../resource-loader.ts\";\nimport type { BranchSummaryEntry, SessionEntry, SessionHeader, SessionTreeNode } from \"../session-manager.ts\";\nimport type { Skill } from \"../skills.ts\";\nimport type { BashOperations } from \"../tools/bash.ts\";\nimport type { ToolDefinition } from \"../tools/tool-definition.ts\";\n\n/** Prompt options for the facade. Identical to AgentSession PromptOptions. */\nexport type CodingAgentFacadePromptOptionsV1 = PromptOptions;\n\n/**\n * Narrow credential/provider auth projection (D-048): the TUI auth surface\n * only. Covers exactly the seven methods the auth host consumes\n * (`getProviders`/`getProvider`/`getProviderAuthStatus`/`isUsingOAuth`/\n * `listCredentials`/`login`/`logout`); the full ModelRuntime never leaks to\n * the host. The credential-management CapabilityAPI semantics question stays\n * open (D-047 裁决 3); this narrows the TUI host path without deciding it.\n */\nexport type ModelAuthRuntime = Pick<\n\tModelRuntime,\n\t\"getProviders\" | \"getProvider\" | \"getProviderAuthStatus\" | \"isUsingOAuth\" | \"listCredentials\" | \"login\" | \"logout\"\n>;\n\n/**\n * Stable facade v1: the consumption surface for product hosts, versioned per\n * repo convention (EmbeddedSdkBindingV1 precedent). Members are pass-throughs\n * onto the wrapped AgentSession; new members must extend the facade design\n * doc first (门面腐化 guard, 设计 §6).\n */\nexport interface CodingAgentFacadeV1 {\n\treadonly version: 1;\n\n\t// --- Run control ---\n\t/**\n\t * Delegates to AgentSession.prompt(). The full PromptOptions pass through,\n\t * including the internal RPC preflight hook (`preflightResult`) that RPC\n\t * mode uses to observe prompt acceptance (阶段 3, 设计 §2.9).\n\t */\n\tprompt(text: string, options?: CodingAgentFacadePromptOptionsV1): Promise<PromptOutcome>;\n\t/** Delegates to AgentSession.steer(). */\n\tsteer(text: string, images?: ImageContent[], options?: { source?: InputSource }): Promise<QueuedInputDisposition>;\n\t/** Delegates to AgentSession.abort(). */\n\tabort(): Promise<void>;\n\t/** Delegates to AgentSession.waitForIdle(). */\n\twaitForIdle(): Promise<void>;\n\n\t// --- Session write paths ---\n\t/** Delegates to AgentSession.compact(). */\n\tcompact(customInstructions?: string): Promise<CompactionResult | CompactionCancelledResult>;\n\t/** Delegates to AgentSession.navigateTree(). */\n\tnavigateTree(\n\t\ttargetId: string,\n\t\toptions?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string },\n\t): Promise<{ editorText?: string; cancelled: boolean; aborted?: boolean; summaryEntry?: BranchSummaryEntry }>;\n\t/** Delegates to AgentSession.reload(). */\n\treload(options?: { beforeSessionStart?: () => void | Promise<void> }): Promise<void>;\n\t/** Delegates to AgentSession.setModel(). */\n\tsetModel(model: Model<Api>, options?: ModelMutationOptions): Promise<void>;\n\t/** Delegates to AgentSession.setThinkingLevel(). */\n\tsetThinkingLevel(level: ThinkingLevel, options?: ModelMutationOptions): void;\n\t/** Delegates to AgentSession.setActiveToolsByName(). */\n\tsetActiveToolsByName(toolNames: string[]): void;\n\t/**\n\t * Queued-message read view, composed from AgentSession.getSteeringMessages()\n\t * and AgentSession.getFollowUpMessages(). AgentSession has no single\n\t * getQueuedMessages(); the shape mirrors clearQueue()'s return value.\n\t */\n\tgetQueuedMessages(): { steering: readonly string[]; followUp: readonly string[] };\n\t/** Delegates to AgentSession.clearQueue(). */\n\tclearQueue(): { steering: string[]; followUp: string[] };\n\t/** Delegates to AgentSession.recordSuiteMismatch(). */\n\trecordSuiteMismatch(originalSuiteId: string, currentSuiteId: string): void;\n\t/** Delegates to AgentSession.getSessionAPI(). */\n\tgetSessionAPI(): SessionAPI;\n\n\t// --- Read-only mirror ---\n\t/** Delegates to AgentSession.isIdle. */\n\tisIdle(): boolean;\n\t/** Mirrors AgentSession.state verbatim (phase 0; a projected state view is a later phase, 设计 §3). */\n\tgetState(): AgentState;\n\t/** Delegates to AgentSession.model. */\n\tgetModel(): Model<Api> | undefined;\n\t/** Delegates to AgentSession.getActiveToolNames(). */\n\tgetToolNames(): string[];\n\t/** Delegates to AgentSession.sessionId (via SessionAPI.getSessionId semantics). */\n\tgetSessionId(): string;\n\t/**\n\t * Suite id from the session-suite binding entry (设计 §10.1), read through\n\t * SessionAPI.getBranchEntries(). Undefined when the session carries no\n\t * suite binding.\n\t */\n\tgetSuiteId(): string | undefined;\n\t/** Delegates to AgentSession.sessionManager.getHeader(). SessionManager itself never leaks. */\n\tgetHeader(): SessionHeader | null;\n\t/** Delegates to AgentSession.subscribe(). Event types pass through verbatim (设计 §3). */\n\tsubscribe(listener: AgentSessionEventListener): () => void;\n\t/**\n\t * Invoked after each raw agent event is delivered to session processing;\n\t * the listener is awaited serially by the agent loop and participates in\n\t * run settlement. Exists for stdout backpressure pacing (D-046); the raw\n\t * event payload and abort signal are deliberately not exposed.\n\t */\n\tsubscribeRawEventGate(listener: () => void | Promise<void>): () => void;\n\n\t// --- Read surface (phase 1 slice 1, TUI display/selector reads, 设计 §2.6) ---\n\t/** Delegates to AgentSession.sessionName (which reads sessionManager.getSessionName()). */\n\tgetSessionName(): string | undefined;\n\t/** Delegates to AgentSession.isCompacting: a compaction or branch summarization is running (session level). */\n\tisCompacting(): boolean;\n\t/**\n\t * Delegates to AgentSession.isStreaming: an agent run is active at the\n\t * session level. Distinct from AgentState.isStreaming (agent-level stream\n\t * flag); do not interchange the two.\n\t */\n\tisStreaming(): boolean;\n\t/** Delegates to AgentSession.getContextUsage(). */\n\tgetContextUsage(): ContextUsage | undefined;\n\t/** Delegates to AgentSession.systemPrompt (effective prompt, including per-turn extension modifications). */\n\tgetSystemPrompt(): string;\n\t/** Delegates to AgentSession.scopedModels. Read view only; setScopedModels stays a phase 2 write path. */\n\tgetScopedModels(): ReadonlyArray<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\t/** Delegates to SessionManager.getTree() on the wrapped session. SessionManager itself never leaks. */\n\tgetTree(): SessionTreeNode[];\n\t/** Delegates to SessionManager.getLeafId() on the wrapped session. SessionManager itself never leaks. */\n\tgetLeafId(): string | null;\n\n\t// --- Read surface (phase 1 slice 2, TUI display/selector cluster convergence, 设计 §2.7) ---\n\t/** Delegates to AgentSession.promptTemplates (file-based prompt templates). */\n\tgetPromptTemplates(): ReadonlyArray<PromptTemplate>;\n\t/** Delegates to AgentSession.getToolDefinition(name): the registered tool definition by name, for diagnostics/rendering. */\n\tgetToolDefinition(name: string): ToolDefinition | undefined;\n\t/** Delegates to SessionManager.getCwd() on the wrapped session; identical to host.cwd. SessionManager itself never leaks. */\n\tgetCwd(): string;\n\t/** Delegates to SessionManager.getEntries() on the wrapped session; identical to host.entries. SessionManager itself never leaks. */\n\tgetEntries(): SessionEntry[];\n\t/** Delegates to AgentSession.pendingMessageCount: queued steering + follow-up message count. */\n\tgetPendingMessageCount(): number;\n\n\t// --- Write surface (phase 2, TUI write path convergence, 设计 §2.8) ---\n\t/** Delegates to AgentSession.followUp(). */\n\tfollowUp(text: string, images?: ImageContent[], options?: { source?: InputSource }): Promise<QueuedInputDisposition>;\n\t/** Delegates to AgentSession.setScopedModels(). */\n\tsetScopedModels(scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>): void;\n\t/** Delegates to AgentSession.cycleModel(). */\n\tcycleModel(\n\t\tdirection?: \"forward\" | \"backward\",\n\t\toptions?: ModelMutationOptions,\n\t): Promise<ModelCycleResult | undefined>;\n\t/** Delegates to AgentSession.cycleThinkingLevel(). */\n\tcycleThinkingLevel(options?: ModelMutationOptions): ThinkingLevel | undefined;\n\t/** Delegates to AgentSession.setSteeringMode(). */\n\tsetSteeringMode(mode: \"all\" | \"one-at-a-time\"): void;\n\t/** Delegates to AgentSession.setFollowUpMode(). */\n\tsetFollowUpMode(mode: \"all\" | \"one-at-a-time\"): void;\n\t/** Delegates to AgentSession.setAutoCompactionEnabled(). */\n\tsetAutoCompactionEnabled(enabled: boolean): void;\n\t/** Delegates to AgentSession.setSessionName(). */\n\tsetSessionName(name: string): void;\n\t/** Delegates to AgentSession.abortBash(). */\n\tabortBash(): void;\n\t/** Delegates to AgentSession.abortCompaction(). */\n\tabortCompaction(): void;\n\t/** Delegates to AgentSession.abortRetry(). */\n\tabortRetry(): void;\n\t/** Delegates to AgentSession.abortBranchSummary(). */\n\tabortBranchSummary(): void;\n\t/** Delegates to AgentSession.captureBashEpoch(). */\n\tcaptureBashEpoch(): number;\n\t/** Delegates to AgentSession.isBashEpochCurrent(). */\n\tisBashEpochCurrent(epoch: number): boolean;\n\t/** Delegates to AgentSession.emitUserBash(): dispatches the user.bash lifecycle facts. */\n\temitUserBash(excludeFromContext: boolean): void;\n\t/** Delegates to AgentSession.executeBash(). */\n\texecuteBash(\n\t\tcommand: string,\n\t\tonChunk?: (chunk: string) => void,\n\t\toptions?: { excludeFromContext?: boolean; id?: string; operations?: BashOperations },\n\t): Promise<BashResult>;\n\t/** Delegates to AgentSession.recordBashResult(). */\n\trecordBashResult(\n\t\tcommand: string,\n\t\tresult: BashResult,\n\t\toptions?: { excludeFromContext?: boolean; epoch?: number },\n\t): void;\n\n\t// --- Read surface (phase 3, RPC host state reads, 设计 §2.9) ---\n\t/** Delegates to AgentSession.thinkingLevel. */\n\tgetThinkingLevel(): ThinkingLevel;\n\t/** Delegates to AgentSession.steeringMode. */\n\tgetSteeringMode(): \"all\" | \"one-at-a-time\";\n\t/** Delegates to AgentSession.followUpMode. */\n\tgetFollowUpMode(): \"all\" | \"one-at-a-time\";\n\t/** Delegates to AgentSession.sessionFile. */\n\tgetSessionFile(): string | undefined;\n\t/** Delegates to AgentSession.autoCompactionEnabled. */\n\tisAutoCompactionEnabled(): boolean;\n\t/** Delegates to AgentSession.getAvailableThinkingLevels(). */\n\tgetAvailableThinkingLevels(): ThinkingLevel[];\n\t/** Delegates to AgentSession.getUserMessagesForForking(). */\n\tgetUserMessagesForForking(): Array<{ entryId: string; text: string }>;\n\t/** Delegates to AgentSession.getLastAssistantText(). */\n\tgetLastAssistantText(): string | undefined;\n\t/** Delegates to AgentSession.getSessionStats(). */\n\tgetSessionStats(): SessionStats;\n\n\t// --- Write surface (phase 3, RPC host writes, 设计 §2.9) ---\n\t/** Delegates to AgentSession.setAutoRetryEnabled(). */\n\tsetAutoRetryEnabled(enabled: boolean): void;\n\t/** Delegates to AgentSession.exportToHtml(), including the themeName option. */\n\texportToHtml(outputPath?: string, options?: { themeName?: string }): Promise<string>;\n\n\t// --- Session write path (阶段 4 slice 3 v1 修订, D-041) ---\n\t/**\n\t * Delegates to SessionManager.appendLabelChange() on the wrapped session.\n\t * TUI tree selector label rename write point; SessionAPI has no label write.\n\t */\n\tappendLabelChange(entryId: string, label: string | undefined): string;\n\n\t// --- Resource read surface (阶段 4 slice 3 v1 修订, D-041) ---\n\t/**\n\t * Clean read projections over the wrapped session's resource loader. Skills/\n\t * prompts/agents-files results pass through verbatim; themes and extensions\n\t * are the metadata projections (themes as ThemeMetaV1 without the modes\n\t * Theme class; loader registration maps and the shared runtime never\n\t * leak). Guard reason: TUI startup listing/autocomplete/diagnostics\n\t * consume these read points directly; SessionAPI/CapabilityAPI are\n\t * capability-side contracts with no host display projections.\n\t */\n\t/** Delegates to ResourceLoader.getSkills() on the wrapped session. */\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getPrompts() on the wrapped session. */\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getThemes() on the wrapped session. */\n\tgetThemes(): { themes: ThemeMetaV1[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getAgentsFiles() on the wrapped session. */\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> };\n\t/** Delegates to ResourceLoader.getSystemPromptSource() on the wrapped session. */\n\tgetSystemPromptSource(): { path: string } | undefined;\n\t/** Delegates to ResourceLoader.getAppendSystemPromptSources() on the wrapped session. */\n\tgetAppendSystemPromptSources(): Array<{ path: string }>;\n\n\t// --- Model/catalog/context read surface (v1 修订, D-047: TUI direct session reads zeroed) ---\n\t/** Delegates to ModelRuntime.getAvailableSnapshot() on the wrapped session (D-047); ModelRuntime itself never leaks. */\n\tgetAvailableModels(): readonly Model<Api>[];\n\t/** Delegates to ModelRuntime.isUsingSubscription() on the wrapped session (D-047). */\n\tisUsingSubscription(providerId: string): boolean;\n\t/** Delegates to ModelRuntime.getError() on the wrapped session (D-047). */\n\tgetModelsError(): string | undefined;\n\t/**\n\t * Narrow `ModelCatalogRuntime` projection of the wrapped session's\n\t * ModelRuntime for the shared catalog-refresh coordinator (D-047). A\n\t * projection, not a wrapper: the full runtime never leaks.\n\t */\n\tgetModelCatalog(): ModelCatalogRuntime;\n\t/** Delegates to ModelRuntime.checkAuth() on the wrapped session (D-047). */\n\tcheckProviderAuth(providerId: string): Promise<AuthCheck | undefined>;\n\t/** Delegates to ModelRuntime.getAuth() on the wrapped session (D-047). */\n\tgetProviderAuth(providerId: string): Promise<AuthResult | undefined>;\n\t/**\n\t * Narrow `ModelPriceSource` projection of the wrapped session's\n\t * ModelRuntime for the cache-stats pure functions (D-047). A projection,\n\t * not a wrapper: the full runtime never leaks.\n\t */\n\tgetModelPriceSource(): ModelPriceSource;\n\t/**\n\t * Delegates to SessionManager.buildContextEntries() on the wrapped session\n\t * (D-047; delegation restored by the D-047 regression fix — the\n\t * incrementally maintained byId index is required for correct context\n\t * paths after a compaction commit). SessionManager itself never leaks.\n\t */\n\tgetContextEntries(): SessionEntry[];\n\n\t// --- Credential/provider auth read surface (v1 修订, D-048: TUI auth host path) ---\n\t/**\n\t * Narrow `ModelAuthRuntime` projection of the wrapped session's ModelRuntime\n\t * for the TUI auth surface (D-048). A projection, not a wrapper: the full\n\t * runtime never leaks. The credential-management CapabilityAPI semantics\n\t * question stays open (D-047 裁决 3); this only narrows the TUI host path.\n\t */\n\tgetModelAuthRuntime(): ModelAuthRuntime;\n\n\t// --- Session stats/text read surface (v1 修订, B-S2b③-S3a: TUI direct\n\t// session stats/text read cluster convergence) ---\n\t/** Delegates to AgentSession.getSteeringMessages(). */\n\tgetSteeringMessages(): readonly string[];\n\t/** Delegates to AgentSession.getFollowUpMessages(). */\n\tgetFollowUpMessages(): readonly string[];\n\n\t// --- Status/settings + export read surface (v1 修订, B-S2b③-S3b+c: TUI\n\t// status/settings/export cluster direct session read convergence) ---\n\t/** Delegates to AgentSession.retryAttempt. */\n\tgetRetryAttempt(): number;\n\t/** Delegates to AgentSession.isBashRunning. */\n\tisBashRunning(): boolean;\n\t/** Delegates to AgentSession.exportToJsonl(). */\n\texportToJsonl(outputPath?: string): string;\n\n\t// --- Lifecycle ---\n\t/** Delegates to AgentSession.dispose(). */\n\tdispose(): Promise<void>;\n}\n\n/** Creates a facade v1 view over one AgentSession. Pure wrapper: holds no state of its own. */\nexport function createCodingAgentFacade(session: AgentSession): CodingAgentFacadeV1 {\n\treturn {\n\t\tversion: 1,\n\t\tprompt: (text, options) => session.prompt(text, options),\n\t\tsteer: (text, images, options) => session.steer(text, images, options),\n\t\tabort: () => session.abort(),\n\t\twaitForIdle: () => session.waitForIdle(),\n\t\tcompact: (customInstructions) => session.compact(customInstructions),\n\t\tnavigateTree: (targetId, options) => session.navigateTree(targetId, options),\n\t\treload: (options) => session.reload(options),\n\t\tsetModel: (model, options) => session.setModel(model, options),\n\t\tsetThinkingLevel: (level, options) => session.setThinkingLevel(level, options),\n\t\tsetActiveToolsByName: (toolNames) => session.setActiveToolsByName(toolNames),\n\t\tgetQueuedMessages: () => ({\n\t\t\tsteering: session.getSteeringMessages(),\n\t\t\tfollowUp: session.getFollowUpMessages(),\n\t\t}),\n\t\tclearQueue: () => session.clearQueue(),\n\t\trecordSuiteMismatch: (originalSuiteId, currentSuiteId) =>\n\t\t\tsession.recordSuiteMismatch(originalSuiteId, currentSuiteId),\n\t\tgetSessionAPI: () => session.getSessionAPI(),\n\t\tisIdle: () => session.isIdle,\n\t\tgetState: () => session.state,\n\t\tgetModel: () => session.model,\n\t\tgetToolNames: () => session.getActiveToolNames(),\n\t\tgetSessionId: () => session.sessionId,\n\t\tgetHeader: () => session.sessionManager.getHeader(),\n\t\tsubscribe: (listener) => session.subscribe(listener),\n\t\tsubscribeRawEventGate: (listener) => session.agent.subscribe(() => listener()),\n\t\tgetSessionName: () => session.sessionName,\n\t\tisCompacting: () => session.isCompacting,\n\t\tisStreaming: () => session.isStreaming,\n\t\tgetContextUsage: () => session.getContextUsage(),\n\t\tgetSystemPrompt: () => session.systemPrompt,\n\t\tgetScopedModels: () => session.scopedModels,\n\t\tgetTree: () => session.sessionManager.getTree(),\n\t\tgetLeafId: () => session.sessionManager.getLeafId(),\n\t\tgetPromptTemplates: () => session.promptTemplates,\n\t\tgetToolDefinition: (name) => session.getToolDefinition(name),\n\t\tgetCwd: () => session.sessionManager.getCwd(),\n\t\tgetEntries: () => session.sessionManager.getEntries(),\n\t\tgetPendingMessageCount: () => session.pendingMessageCount,\n\t\tfollowUp: (text, images, options) => session.followUp(text, images, options),\n\t\tsetScopedModels: (scopedModels) => session.setScopedModels(scopedModels),\n\t\tcycleModel: (direction, options) => session.cycleModel(direction, options),\n\t\tcycleThinkingLevel: (options) => session.cycleThinkingLevel(options),\n\t\tsetSteeringMode: (mode) => session.setSteeringMode(mode),\n\t\tsetFollowUpMode: (mode) => session.setFollowUpMode(mode),\n\t\tsetAutoCompactionEnabled: (enabled) => session.setAutoCompactionEnabled(enabled),\n\t\tsetSessionName: (name) => session.setSessionName(name),\n\t\tabortBash: () => session.abortBash(),\n\t\tabortCompaction: () => session.abortCompaction(),\n\t\tabortRetry: () => session.abortRetry(),\n\t\tabortBranchSummary: () => session.abortBranchSummary(),\n\t\tcaptureBashEpoch: () => session.captureBashEpoch(),\n\t\tisBashEpochCurrent: (epoch) => session.isBashEpochCurrent(epoch),\n\t\temitUserBash: (excludeFromContext) => session.emitUserBash(excludeFromContext),\n\t\texecuteBash: (command, onChunk, options) => session.executeBash(command, onChunk, options),\n\t\trecordBashResult: (command, result, options) => session.recordBashResult(command, result, options),\n\t\tgetThinkingLevel: () => session.thinkingLevel,\n\t\tgetSteeringMode: () => session.steeringMode,\n\t\tgetFollowUpMode: () => session.followUpMode,\n\t\tgetSessionFile: () => session.sessionFile,\n\t\tisAutoCompactionEnabled: () => session.autoCompactionEnabled,\n\t\tgetAvailableThinkingLevels: () => session.getAvailableThinkingLevels(),\n\t\tgetUserMessagesForForking: () => session.getUserMessagesForForking(),\n\t\tgetLastAssistantText: () => session.getLastAssistantText(),\n\t\tgetSessionStats: () => session.getSessionStats(),\n\t\tsetAutoRetryEnabled: (enabled) => session.setAutoRetryEnabled(enabled),\n\t\texportToHtml: (outputPath, options) => session.exportToHtml(outputPath, options),\n\t\tappendLabelChange: (entryId, label) => session.sessionManager.appendLabelChange(entryId, label),\n\t\tgetSkills: () => session.resourceLoader.getSkills(),\n\t\tgetPrompts: () => session.resourceLoader.getPrompts(),\n\t\tgetThemes: () => session.resourceLoader.getThemes(),\n\t\tgetAgentsFiles: () => session.resourceLoader.getAgentsFiles(),\n\t\tgetSystemPromptSource: () => session.resourceLoader.getSystemPromptSource(),\n\t\tgetAppendSystemPromptSources: () => session.resourceLoader.getAppendSystemPromptSources(),\n\t\tgetSuiteId: () => readSessionSuiteBinding(session.getSessionAPI().getBranchEntries())?.suiteId,\n\t\tgetAvailableModels: () => session.modelRuntime.getAvailableSnapshot(),\n\t\tisUsingSubscription: (providerId) => session.modelRuntime.isUsingSubscription(providerId),\n\t\tgetModelsError: () => session.modelRuntime.getError(),\n\t\tgetModelCatalog: () => session.modelRuntime,\n\t\tcheckProviderAuth: (providerId) => session.modelRuntime.checkAuth(providerId),\n\t\tgetProviderAuth: (providerId) => session.modelRuntime.getAuth(providerId),\n\t\tgetModelPriceSource: () => session.modelRuntime,\n\t\tgetModelAuthRuntime: () => session.modelRuntime,\n\t\t// Delegates to the SessionManager method: its incrementally maintained\n\t\t// byId index walks the full entry graph, which rebuild-from-entries\n\t\t// diverges from after a compaction commit (D-047 regression fix).\n\t\tgetContextEntries: () => session.sessionManager.buildContextEntries(),\n\t\tgetSteeringMessages: () => session.getSteeringMessages(),\n\t\tgetFollowUpMessages: () => session.getFollowUpMessages(),\n\t\tgetRetryAttempt: () => session.retryAttempt,\n\t\tisBashRunning: () => session.isBashRunning,\n\t\texportToJsonl: (outputPath) => session.exportToJsonl(outputPath),\n\t\tdispose: () => session.dispose(),\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"coding-agent-facade.js","sourceRoot":"","sources":["../../../src/core/facade/coding-agent-facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AA+TzE,+FAA+F;AAC/F,MAAM,UAAU,uBAAuB,CA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,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC;QACzE,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY;QAC/C,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY;QAC/C,uEAAuE;QACvE,oEAAoE;QACpE,kEAAkE;QAClE,iBAAiB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE;QACrE,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAmB,EAAE;QACxD,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAmB,EAAE;QACxD,eAAe,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY;QAC3C,aAAa,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,aAAa;QAC1C,aAAa,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC;QAChE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;KAChC,CAAC;AAAA,CACF","sourcesContent":["/**\n * Stable facade v1: a read-only mirror plus pass-through run control and\n * session write paths over one AgentSession.\n *\n * Design: docs/design/稳定门面统一入口设计.md (§2.5 阶段 0 实际面, §2.6 slice 1\n * 读面, §2.7 slice 2 读面, §2.8 阶段 2 写面, §2.9 阶段 3 RPC 面, §3 API 面 v1,\n * §4 阶段 0/1/2/3). Every member is a pure delegate onto the wrapped\n * AgentSession or its existing curated surfaces (`getSessionAPI()`, `host`).\n * No new behavior, no policy, no state of its own. Product entry points\n * (TUI/CLI/RPC/Embedded) migrate onto this surface in later phases;\n * AgentSession stays the internal adapter behind it.\n *\n * Scope: in-package stable surface for those product entry points. It is not\n * exported from the package root and is not a cross-package public contract.\n */\n\nimport type { AgentState, ThinkingLevel } from \"@agent-forge/agent-core\";\nimport type { AuthCheck, AuthResult, ImageContent } from \"@agent-forge/ai\";\nimport type { Api, Model } from \"@agent-forge/ai/compat\";\nimport type { ModelCatalogRuntime } from \"../../modes/interactive/model-catalog-refresh.ts\";\nimport { readSessionSuiteBinding } from \"../../profiles/suite-loader.ts\";\nimport type {\n\tAgentSession,\n\tAgentSessionEventListener,\n\tModelCycleResult,\n\tModelMutationOptions,\n\tPromptOptions,\n\tSessionStats,\n} from \"../agent-session.ts\";\nimport type { CompactionCancelledResult } from \"../agent-session-compaction.ts\";\nimport type { BashResult } from \"../bash-executor.ts\";\nimport type { ModelPriceSource } from \"../cache-stats.ts\";\nimport type { CompactionResult } from \"../compaction/index.ts\";\nimport type { ResourceDiagnostic } from \"../diagnostics.ts\";\nimport type { ContextUsage, PromptOutcome, SessionAPI } from \"../extensions/public-api.ts\";\nimport type { InputSource } from \"../input-source.ts\";\nimport type { ModelRuntime } from \"../model-runtime.ts\";\nimport type { PromptTemplate } from \"../prompt-templates.ts\";\nimport type { ThemeMetaV1 } from \"../resource-loader.ts\";\nimport type { BranchSummaryEntry, SessionEntry, SessionHeader, SessionTreeNode } from \"../session-manager.ts\";\nimport type { Skill } from \"../skills.ts\";\nimport type { BashOperations } from \"../tools/bash.ts\";\nimport type { ToolDefinition } from \"../tools/tool-definition.ts\";\n\n/** Prompt options for the facade. Identical to AgentSession PromptOptions. */\nexport type CodingAgentFacadePromptOptionsV1 = PromptOptions;\n\n/**\n * Narrow credential/provider auth projection (D-048): the TUI auth surface\n * only. Covers exactly the seven methods the auth host consumes\n * (`getProviders`/`getProvider`/`getProviderAuthStatus`/`isUsingOAuth`/\n * `listCredentials`/`login`/`logout`); the full ModelRuntime never leaks to\n * the host. The credential-management CapabilityAPI semantics question stays\n * open (D-047 裁决 3); this narrows the TUI host path without deciding it.\n */\nexport type ModelAuthRuntime = Pick<\n\tModelRuntime,\n\t\"getProviders\" | \"getProvider\" | \"getProviderAuthStatus\" | \"isUsingOAuth\" | \"listCredentials\" | \"login\" | \"logout\"\n>;\n\n/**\n * Stable facade v1: the consumption surface for product hosts, versioned per\n * repo convention (EmbeddedSdkBindingV1 precedent). Members are pass-throughs\n * onto the wrapped AgentSession; new members must extend the facade design\n * doc first (门面腐化 guard, 设计 §6).\n */\nexport interface CodingAgentFacadeV1 {\n\treadonly version: 1;\n\n\t// --- Run control ---\n\t/**\n\t * Delegates to AgentSession.prompt(). The full PromptOptions pass through,\n\t * including the internal RPC preflight hook (`preflightResult`) that RPC\n\t * mode uses to observe prompt acceptance (阶段 3, 设计 §2.9).\n\t */\n\tprompt(text: string, options?: CodingAgentFacadePromptOptionsV1): Promise<PromptOutcome>;\n\t/** Delegates to AgentSession.steer(). */\n\tsteer(text: string, images?: ImageContent[], options?: { source?: InputSource }): Promise<void>;\n\t/** Delegates to AgentSession.abort(). */\n\tabort(): Promise<void>;\n\t/** Delegates to AgentSession.waitForIdle(). */\n\twaitForIdle(): Promise<void>;\n\n\t// --- Session write paths ---\n\t/** Delegates to AgentSession.compact(). */\n\tcompact(customInstructions?: string): Promise<CompactionResult | CompactionCancelledResult>;\n\t/** Delegates to AgentSession.navigateTree(). */\n\tnavigateTree(\n\t\ttargetId: string,\n\t\toptions?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string },\n\t): Promise<{ editorText?: string; cancelled: boolean; aborted?: boolean; summaryEntry?: BranchSummaryEntry }>;\n\t/** Delegates to AgentSession.reload(). */\n\treload(options?: { beforeSessionStart?: () => void | Promise<void> }): Promise<void>;\n\t/** Delegates to AgentSession.setModel(). */\n\tsetModel(model: Model<Api>, options?: ModelMutationOptions): Promise<void>;\n\t/** Delegates to AgentSession.setThinkingLevel(). */\n\tsetThinkingLevel(level: ThinkingLevel, options?: ModelMutationOptions): void;\n\t/** Delegates to AgentSession.setActiveToolsByName(). */\n\tsetActiveToolsByName(toolNames: string[]): void;\n\t/**\n\t * Queued-message read view, composed from AgentSession.getSteeringMessages()\n\t * and AgentSession.getFollowUpMessages(). AgentSession has no single\n\t * getQueuedMessages(); the shape mirrors clearQueue()'s return value.\n\t */\n\tgetQueuedMessages(): { steering: readonly string[]; followUp: readonly string[] };\n\t/** Delegates to AgentSession.clearQueue(). */\n\tclearQueue(): { steering: string[]; followUp: string[] };\n\t/** Delegates to AgentSession.recordSuiteMismatch(). */\n\trecordSuiteMismatch(originalSuiteId: string, currentSuiteId: string): void;\n\t/** Delegates to AgentSession.getSessionAPI(). */\n\tgetSessionAPI(): SessionAPI;\n\n\t// --- Read-only mirror ---\n\t/** Delegates to AgentSession.isIdle. */\n\tisIdle(): boolean;\n\t/** Mirrors AgentSession.state verbatim (phase 0; a projected state view is a later phase, 设计 §3). */\n\tgetState(): AgentState;\n\t/** Delegates to AgentSession.model. */\n\tgetModel(): Model<Api> | undefined;\n\t/** Delegates to AgentSession.getActiveToolNames(). */\n\tgetToolNames(): string[];\n\t/** Delegates to AgentSession.sessionId (via SessionAPI.getSessionId semantics). */\n\tgetSessionId(): string;\n\t/**\n\t * Suite id from the session-suite binding entry (设计 §10.1), read through\n\t * SessionAPI.getBranchEntries(). Undefined when the session carries no\n\t * suite binding.\n\t */\n\tgetSuiteId(): string | undefined;\n\t/** Delegates to AgentSession.sessionManager.getHeader(). SessionManager itself never leaks. */\n\tgetHeader(): SessionHeader | null;\n\t/** Delegates to AgentSession.subscribe(). Event types pass through verbatim (设计 §3). */\n\tsubscribe(listener: AgentSessionEventListener): () => void;\n\t/**\n\t * Invoked after each raw agent event is delivered to session processing;\n\t * the listener is awaited serially by the agent loop and participates in\n\t * run settlement. Exists for stdout backpressure pacing (D-046); the raw\n\t * event payload and abort signal are deliberately not exposed.\n\t */\n\tsubscribeRawEventGate(listener: () => void | Promise<void>): () => void;\n\n\t// --- Read surface (phase 1 slice 1, TUI display/selector reads, 设计 §2.6) ---\n\t/** Delegates to AgentSession.sessionName (which reads sessionManager.getSessionName()). */\n\tgetSessionName(): string | undefined;\n\t/** Delegates to AgentSession.isCompacting: a compaction or branch summarization is running (session level). */\n\tisCompacting(): boolean;\n\t/**\n\t * Delegates to AgentSession.isStreaming: an agent run is active at the\n\t * session level. Distinct from AgentState.isStreaming (agent-level stream\n\t * flag); do not interchange the two.\n\t */\n\tisStreaming(): boolean;\n\t/** Delegates to AgentSession.getContextUsage(). */\n\tgetContextUsage(): ContextUsage | undefined;\n\t/** Delegates to AgentSession.systemPrompt (effective prompt, including per-turn extension modifications). */\n\tgetSystemPrompt(): string;\n\t/** Delegates to AgentSession.scopedModels. Read view only; setScopedModels stays a phase 2 write path. */\n\tgetScopedModels(): ReadonlyArray<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\t/** Delegates to SessionManager.getTree() on the wrapped session. SessionManager itself never leaks. */\n\tgetTree(): SessionTreeNode[];\n\t/** Delegates to SessionManager.getLeafId() on the wrapped session. SessionManager itself never leaks. */\n\tgetLeafId(): string | null;\n\n\t// --- Read surface (phase 1 slice 2, TUI display/selector cluster convergence, 设计 §2.7) ---\n\t/** Delegates to AgentSession.promptTemplates (file-based prompt templates). */\n\tgetPromptTemplates(): ReadonlyArray<PromptTemplate>;\n\t/** Delegates to AgentSession.getToolDefinition(name): the registered tool definition by name, for diagnostics/rendering. */\n\tgetToolDefinition(name: string): ToolDefinition | undefined;\n\t/** Delegates to SessionManager.getCwd() on the wrapped session; identical to host.cwd. SessionManager itself never leaks. */\n\tgetCwd(): string;\n\t/** Delegates to SessionManager.getEntries() on the wrapped session; identical to host.entries. SessionManager itself never leaks. */\n\tgetEntries(): SessionEntry[];\n\t/** Delegates to AgentSession.pendingMessageCount: queued steering + follow-up message count. */\n\tgetPendingMessageCount(): number;\n\n\t// --- Write surface (phase 2, TUI write path convergence, 设计 §2.8) ---\n\t/** Delegates to AgentSession.followUp(). */\n\tfollowUp(text: string, images?: ImageContent[], options?: { source?: InputSource }): Promise<void>;\n\t/** Delegates to AgentSession.setScopedModels(). */\n\tsetScopedModels(scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>): void;\n\t/** Delegates to AgentSession.cycleModel(). */\n\tcycleModel(\n\t\tdirection?: \"forward\" | \"backward\",\n\t\toptions?: ModelMutationOptions,\n\t): Promise<ModelCycleResult | undefined>;\n\t/** Delegates to AgentSession.cycleThinkingLevel(). */\n\tcycleThinkingLevel(options?: ModelMutationOptions): ThinkingLevel | undefined;\n\t/** Delegates to AgentSession.setSteeringMode(). */\n\tsetSteeringMode(mode: \"all\" | \"one-at-a-time\"): void;\n\t/** Delegates to AgentSession.setFollowUpMode(). */\n\tsetFollowUpMode(mode: \"all\" | \"one-at-a-time\"): void;\n\t/** Delegates to AgentSession.setAutoCompactionEnabled(). */\n\tsetAutoCompactionEnabled(enabled: boolean): void;\n\t/** Delegates to AgentSession.setSessionName(). */\n\tsetSessionName(name: string): void;\n\t/** Delegates to AgentSession.abortBash(). */\n\tabortBash(): void;\n\t/** Delegates to AgentSession.abortCompaction(). */\n\tabortCompaction(): void;\n\t/** Delegates to AgentSession.abortRetry(). */\n\tabortRetry(): void;\n\t/** Delegates to AgentSession.abortBranchSummary(). */\n\tabortBranchSummary(): void;\n\t/** Delegates to AgentSession.captureBashEpoch(). */\n\tcaptureBashEpoch(): number;\n\t/** Delegates to AgentSession.isBashEpochCurrent(). */\n\tisBashEpochCurrent(epoch: number): boolean;\n\t/** Delegates to AgentSession.emitUserBash(): dispatches the user.bash lifecycle facts. */\n\temitUserBash(excludeFromContext: boolean): void;\n\t/** Delegates to AgentSession.executeBash(). */\n\texecuteBash(\n\t\tcommand: string,\n\t\tonChunk?: (chunk: string) => void,\n\t\toptions?: { excludeFromContext?: boolean; id?: string; operations?: BashOperations },\n\t): Promise<BashResult>;\n\t/** Delegates to AgentSession.recordBashResult(). */\n\trecordBashResult(\n\t\tcommand: string,\n\t\tresult: BashResult,\n\t\toptions?: { excludeFromContext?: boolean; epoch?: number },\n\t): void;\n\n\t// --- Read surface (phase 3, RPC host state reads, 设计 §2.9) ---\n\t/** Delegates to AgentSession.thinkingLevel. */\n\tgetThinkingLevel(): ThinkingLevel;\n\t/** Delegates to AgentSession.steeringMode. */\n\tgetSteeringMode(): \"all\" | \"one-at-a-time\";\n\t/** Delegates to AgentSession.followUpMode. */\n\tgetFollowUpMode(): \"all\" | \"one-at-a-time\";\n\t/** Delegates to AgentSession.sessionFile. */\n\tgetSessionFile(): string | undefined;\n\t/** Delegates to AgentSession.autoCompactionEnabled. */\n\tisAutoCompactionEnabled(): boolean;\n\t/** Delegates to AgentSession.getAvailableThinkingLevels(). */\n\tgetAvailableThinkingLevels(): ThinkingLevel[];\n\t/** Delegates to AgentSession.getUserMessagesForForking(). */\n\tgetUserMessagesForForking(): Array<{ entryId: string; text: string }>;\n\t/** Delegates to AgentSession.getLastAssistantText(). */\n\tgetLastAssistantText(): string | undefined;\n\t/** Delegates to AgentSession.getSessionStats(). */\n\tgetSessionStats(): SessionStats;\n\n\t// --- Write surface (phase 3, RPC host writes, 设计 §2.9) ---\n\t/** Delegates to AgentSession.setAutoRetryEnabled(). */\n\tsetAutoRetryEnabled(enabled: boolean): void;\n\t/** Delegates to AgentSession.exportToHtml(), including the themeName option. */\n\texportToHtml(outputPath?: string, options?: { themeName?: string }): Promise<string>;\n\n\t// --- Session write path (阶段 4 slice 3 v1 修订, D-041) ---\n\t/**\n\t * Delegates to SessionManager.appendLabelChange() on the wrapped session.\n\t * TUI tree selector label rename write point; SessionAPI has no label write.\n\t */\n\tappendLabelChange(entryId: string, label: string | undefined): string;\n\n\t// --- Resource read surface (阶段 4 slice 3 v1 修订, D-041) ---\n\t/**\n\t * Clean read projections over the wrapped session's resource loader. Skills/\n\t * prompts/agents-files results pass through verbatim; themes and extensions\n\t * are the metadata projections (themes as ThemeMetaV1 without the modes\n\t * Theme class; loader registration maps and the shared runtime never\n\t * leak). Guard reason: TUI startup listing/autocomplete/diagnostics\n\t * consume these read points directly; SessionAPI/CapabilityAPI are\n\t * capability-side contracts with no host display projections.\n\t */\n\t/** Delegates to ResourceLoader.getSkills() on the wrapped session. */\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getPrompts() on the wrapped session. */\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getThemes() on the wrapped session. */\n\tgetThemes(): { themes: ThemeMetaV1[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getAgentsFiles() on the wrapped session. */\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> };\n\t/** Delegates to ResourceLoader.getSystemPromptSource() on the wrapped session. */\n\tgetSystemPromptSource(): { path: string } | undefined;\n\t/** Delegates to ResourceLoader.getAppendSystemPromptSources() on the wrapped session. */\n\tgetAppendSystemPromptSources(): Array<{ path: string }>;\n\n\t// --- Model/catalog/context read surface (v1 修订, D-047: TUI direct session reads zeroed) ---\n\t/** Delegates to ModelRuntime.getAvailableSnapshot() on the wrapped session (D-047); ModelRuntime itself never leaks. */\n\tgetAvailableModels(): readonly Model<Api>[];\n\t/** Delegates to ModelRuntime.isUsingSubscription() on the wrapped session (D-047). */\n\tisUsingSubscription(providerId: string): boolean;\n\t/** Delegates to ModelRuntime.getError() on the wrapped session (D-047). */\n\tgetModelsError(): string | undefined;\n\t/**\n\t * Narrow `ModelCatalogRuntime` projection of the wrapped session's\n\t * ModelRuntime for the shared catalog-refresh coordinator (D-047). A\n\t * projection, not a wrapper: the full runtime never leaks.\n\t */\n\tgetModelCatalog(): ModelCatalogRuntime;\n\t/** Delegates to ModelRuntime.checkAuth() on the wrapped session (D-047). */\n\tcheckProviderAuth(providerId: string): Promise<AuthCheck | undefined>;\n\t/** Delegates to ModelRuntime.getAuth() on the wrapped session (D-047). */\n\tgetProviderAuth(providerId: string): Promise<AuthResult | undefined>;\n\t/**\n\t * Narrow `ModelPriceSource` projection of the wrapped session's\n\t * ModelRuntime for the cache-stats pure functions (D-047). A projection,\n\t * not a wrapper: the full runtime never leaks.\n\t */\n\tgetModelPriceSource(): ModelPriceSource;\n\t/**\n\t * Delegates to SessionManager.buildContextEntries() on the wrapped session\n\t * (D-047; delegation restored by the D-047 regression fix — the\n\t * incrementally maintained byId index is required for correct context\n\t * paths after a compaction commit). SessionManager itself never leaks.\n\t */\n\tgetContextEntries(): SessionEntry[];\n\n\t// --- Credential/provider auth read surface (v1 修订, D-048: TUI auth host path) ---\n\t/**\n\t * Narrow `ModelAuthRuntime` projection of the wrapped session's ModelRuntime\n\t * for the TUI auth surface (D-048). A projection, not a wrapper: the full\n\t * runtime never leaks. The credential-management CapabilityAPI semantics\n\t * question stays open (D-047 裁决 3); this only narrows the TUI host path.\n\t */\n\tgetModelAuthRuntime(): ModelAuthRuntime;\n\n\t// --- Session stats/text read surface (v1 修订, B-S2b③-S3a: TUI direct\n\t// session stats/text read cluster convergence) ---\n\t/** Delegates to AgentSession.getSteeringMessages(). */\n\tgetSteeringMessages(): readonly string[];\n\t/** Delegates to AgentSession.getFollowUpMessages(). */\n\tgetFollowUpMessages(): readonly string[];\n\n\t// --- Status/settings + export read surface (v1 修订, B-S2b③-S3b+c: TUI\n\t// status/settings/export cluster direct session read convergence) ---\n\t/** Delegates to AgentSession.retryAttempt. */\n\tgetRetryAttempt(): number;\n\t/** Delegates to AgentSession.isBashRunning. */\n\tisBashRunning(): boolean;\n\t/** Delegates to AgentSession.exportToJsonl(). */\n\texportToJsonl(outputPath?: string): string;\n\n\t// --- Lifecycle ---\n\t/** Delegates to AgentSession.dispose(). */\n\tdispose(): Promise<void>;\n}\n\n/** Creates a facade v1 view over one AgentSession. Pure wrapper: holds no state of its own. */\nexport function createCodingAgentFacade(session: AgentSession): CodingAgentFacadeV1 {\n\treturn {\n\t\tversion: 1,\n\t\tprompt: (text, options) => session.prompt(text, options),\n\t\tsteer: (text, images, options) => session.steer(text, images, options),\n\t\tabort: () => session.abort(),\n\t\twaitForIdle: () => session.waitForIdle(),\n\t\tcompact: (customInstructions) => session.compact(customInstructions),\n\t\tnavigateTree: (targetId, options) => session.navigateTree(targetId, options),\n\t\treload: (options) => session.reload(options),\n\t\tsetModel: (model, options) => session.setModel(model, options),\n\t\tsetThinkingLevel: (level, options) => session.setThinkingLevel(level, options),\n\t\tsetActiveToolsByName: (toolNames) => session.setActiveToolsByName(toolNames),\n\t\tgetQueuedMessages: () => ({\n\t\t\tsteering: session.getSteeringMessages(),\n\t\t\tfollowUp: session.getFollowUpMessages(),\n\t\t}),\n\t\tclearQueue: () => session.clearQueue(),\n\t\trecordSuiteMismatch: (originalSuiteId, currentSuiteId) =>\n\t\t\tsession.recordSuiteMismatch(originalSuiteId, currentSuiteId),\n\t\tgetSessionAPI: () => session.getSessionAPI(),\n\t\tisIdle: () => session.isIdle,\n\t\tgetState: () => session.state,\n\t\tgetModel: () => session.model,\n\t\tgetToolNames: () => session.getActiveToolNames(),\n\t\tgetSessionId: () => session.sessionId,\n\t\tgetHeader: () => session.sessionManager.getHeader(),\n\t\tsubscribe: (listener) => session.subscribe(listener),\n\t\tsubscribeRawEventGate: (listener) => session.agent.subscribe(() => listener()),\n\t\tgetSessionName: () => session.sessionName,\n\t\tisCompacting: () => session.isCompacting,\n\t\tisStreaming: () => session.isStreaming,\n\t\tgetContextUsage: () => session.getContextUsage(),\n\t\tgetSystemPrompt: () => session.systemPrompt,\n\t\tgetScopedModels: () => session.scopedModels,\n\t\tgetTree: () => session.sessionManager.getTree(),\n\t\tgetLeafId: () => session.sessionManager.getLeafId(),\n\t\tgetPromptTemplates: () => session.promptTemplates,\n\t\tgetToolDefinition: (name) => session.getToolDefinition(name),\n\t\tgetCwd: () => session.sessionManager.getCwd(),\n\t\tgetEntries: () => session.sessionManager.getEntries(),\n\t\tgetPendingMessageCount: () => session.pendingMessageCount,\n\t\tfollowUp: (text, images, options) => session.followUp(text, images, options),\n\t\tsetScopedModels: (scopedModels) => session.setScopedModels(scopedModels),\n\t\tcycleModel: (direction, options) => session.cycleModel(direction, options),\n\t\tcycleThinkingLevel: (options) => session.cycleThinkingLevel(options),\n\t\tsetSteeringMode: (mode) => session.setSteeringMode(mode),\n\t\tsetFollowUpMode: (mode) => session.setFollowUpMode(mode),\n\t\tsetAutoCompactionEnabled: (enabled) => session.setAutoCompactionEnabled(enabled),\n\t\tsetSessionName: (name) => session.setSessionName(name),\n\t\tabortBash: () => session.abortBash(),\n\t\tabortCompaction: () => session.abortCompaction(),\n\t\tabortRetry: () => session.abortRetry(),\n\t\tabortBranchSummary: () => session.abortBranchSummary(),\n\t\tcaptureBashEpoch: () => session.captureBashEpoch(),\n\t\tisBashEpochCurrent: (epoch) => session.isBashEpochCurrent(epoch),\n\t\temitUserBash: (excludeFromContext) => session.emitUserBash(excludeFromContext),\n\t\texecuteBash: (command, onChunk, options) => session.executeBash(command, onChunk, options),\n\t\trecordBashResult: (command, result, options) => session.recordBashResult(command, result, options),\n\t\tgetThinkingLevel: () => session.thinkingLevel,\n\t\tgetSteeringMode: () => session.steeringMode,\n\t\tgetFollowUpMode: () => session.followUpMode,\n\t\tgetSessionFile: () => session.sessionFile,\n\t\tisAutoCompactionEnabled: () => session.autoCompactionEnabled,\n\t\tgetAvailableThinkingLevels: () => session.getAvailableThinkingLevels(),\n\t\tgetUserMessagesForForking: () => session.getUserMessagesForForking(),\n\t\tgetLastAssistantText: () => session.getLastAssistantText(),\n\t\tgetSessionStats: () => session.getSessionStats(),\n\t\tsetAutoRetryEnabled: (enabled) => session.setAutoRetryEnabled(enabled),\n\t\texportToHtml: (outputPath, options) => session.exportToHtml(outputPath, options),\n\t\tappendLabelChange: (entryId, label) => session.sessionManager.appendLabelChange(entryId, label),\n\t\tgetSkills: () => session.resourceLoader.getSkills(),\n\t\tgetPrompts: () => session.resourceLoader.getPrompts(),\n\t\tgetThemes: () => session.resourceLoader.getThemes(),\n\t\tgetAgentsFiles: () => session.resourceLoader.getAgentsFiles(),\n\t\tgetSystemPromptSource: () => session.resourceLoader.getSystemPromptSource(),\n\t\tgetAppendSystemPromptSources: () => session.resourceLoader.getAppendSystemPromptSources(),\n\t\tgetSuiteId: () => readSessionSuiteBinding(session.getSessionAPI().getBranchEntries())?.suiteId,\n\t\tgetAvailableModels: () => session.modelRuntime.getAvailableSnapshot(),\n\t\tisUsingSubscription: (providerId) => session.modelRuntime.isUsingSubscription(providerId),\n\t\tgetModelsError: () => session.modelRuntime.getError(),\n\t\tgetModelCatalog: () => session.modelRuntime,\n\t\tcheckProviderAuth: (providerId) => session.modelRuntime.checkAuth(providerId),\n\t\tgetProviderAuth: (providerId) => session.modelRuntime.getAuth(providerId),\n\t\tgetModelPriceSource: () => session.modelRuntime,\n\t\tgetModelAuthRuntime: () => session.modelRuntime,\n\t\t// Delegates to the SessionManager method: its incrementally maintained\n\t\t// byId index walks the full entry graph, which rebuild-from-entries\n\t\t// diverges from after a compaction commit (D-047 regression fix).\n\t\tgetContextEntries: () => session.sessionManager.buildContextEntries(),\n\t\tgetSteeringMessages: () => session.getSteeringMessages(),\n\t\tgetFollowUpMessages: () => session.getFollowUpMessages(),\n\t\tgetRetryAttempt: () => session.retryAttempt,\n\t\tisBashRunning: () => session.isBashRunning,\n\t\texportToJsonl: (outputPath) => session.exportToJsonl(outputPath),\n\t\tdispose: () => session.dispose(),\n\t};\n}\n"]}
1
+ {"version":3,"file":"coding-agent-facade.js","sourceRoot":"","sources":["../../../src/core/facade/coding-agent-facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAgUzE,+FAA+F;AAC/F,MAAM,UAAU,uBAAuB,CAAC,OAAqB,EAAuB;IACnF,OAAO;QACN,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;QACxD,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC;QACtE,KAAK,EAAE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AAmB,EAAE;QACrE,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAmB,EAAE;QACxD,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAmB,EAAE;QACxD,eAAe,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY;QAC3C,aAAa,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,aAAa;QAC1C,aAAa,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC;QAChE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;KAChC,CAAC;AAAA,CACF","sourcesContent":["/**\n * Stable facade v1: a read-only mirror plus pass-through run control and\n * session write paths over one AgentSession.\n *\n * Design: docs/design/稳定门面统一入口设计.md (§2.5 阶段 0 实际面, §2.6 slice 1\n * 读面, §2.7 slice 2 读面, §2.8 阶段 2 写面, §2.9 阶段 3 RPC 面, §3 API 面 v1,\n * §4 阶段 0/1/2/3). Every member is a pure delegate onto the wrapped\n * AgentSession or its existing curated surfaces (`getSessionAPI()`, `host`).\n * No new behavior, no policy, no state of its own. Product entry points\n * (TUI/CLI/RPC/Embedded) migrate onto this surface in later phases;\n * AgentSession stays the internal adapter behind it.\n *\n * Scope: in-package stable surface for those product entry points. It is not\n * exported from the package root and is not a cross-package public contract.\n */\n\nimport type { AgentState, ThinkingLevel } from \"@agent-forge/agent-core\";\nimport type { AuthCheck, AuthResult, ImageContent } from \"@agent-forge/ai\";\nimport type { Api, Model } from \"@agent-forge/ai/compat\";\nimport type { ModelCatalogRuntime } from \"../../modes/interactive/model-catalog-refresh.ts\";\nimport { readSessionSuiteBinding } from \"../../profiles/suite-loader.ts\";\nimport type {\n\tAgentSession,\n\tAgentSessionEventListener,\n\tModelCycleResult,\n\tModelMutationOptions,\n\tPromptOptions,\n\tQueuedInputDisposition,\n\tSessionStats,\n} from \"../agent-session.ts\";\nimport type { CompactionCancelledResult } from \"../agent-session-compaction.ts\";\nimport type { BashResult } from \"../bash-executor.ts\";\nimport type { ModelPriceSource } from \"../cache-stats.ts\";\nimport type { CompactionResult } from \"../compaction/index.ts\";\nimport type { ResourceDiagnostic } from \"../diagnostics.ts\";\nimport type { ContextUsage, PromptOutcome, SessionAPI } from \"../extensions/public-api.ts\";\nimport type { InputSource } from \"../input-source.ts\";\nimport type { ModelRuntime } from \"../model-runtime.ts\";\nimport type { PromptTemplate } from \"../prompt-templates.ts\";\nimport type { ThemeMetaV1 } from \"../resource-loader.ts\";\nimport type { BranchSummaryEntry, SessionEntry, SessionHeader, SessionTreeNode } from \"../session-manager.ts\";\nimport type { Skill } from \"../skills.ts\";\nimport type { BashOperations } from \"../tools/bash.ts\";\nimport type { ToolDefinition } from \"../tools/tool-definition.ts\";\n\n/** Prompt options for the facade. Identical to AgentSession PromptOptions. */\nexport type CodingAgentFacadePromptOptionsV1 = PromptOptions;\n\n/**\n * Narrow credential/provider auth projection (D-048): the TUI auth surface\n * only. Covers exactly the seven methods the auth host consumes\n * (`getProviders`/`getProvider`/`getProviderAuthStatus`/`isUsingOAuth`/\n * `listCredentials`/`login`/`logout`); the full ModelRuntime never leaks to\n * the host. The credential-management CapabilityAPI semantics question stays\n * open (D-047 裁决 3); this narrows the TUI host path without deciding it.\n */\nexport type ModelAuthRuntime = Pick<\n\tModelRuntime,\n\t\"getProviders\" | \"getProvider\" | \"getProviderAuthStatus\" | \"isUsingOAuth\" | \"listCredentials\" | \"login\" | \"logout\"\n>;\n\n/**\n * Stable facade v1: the consumption surface for product hosts, versioned per\n * repo convention (EmbeddedSdkBindingV1 precedent). Members are pass-throughs\n * onto the wrapped AgentSession; new members must extend the facade design\n * doc first (门面腐化 guard, 设计 §6).\n */\nexport interface CodingAgentFacadeV1 {\n\treadonly version: 1;\n\n\t// --- Run control ---\n\t/**\n\t * Delegates to AgentSession.prompt(). The full PromptOptions pass through,\n\t * including the internal RPC preflight hook (`preflightResult`) that RPC\n\t * mode uses to observe prompt acceptance (阶段 3, 设计 §2.9).\n\t */\n\tprompt(text: string, options?: CodingAgentFacadePromptOptionsV1): Promise<PromptOutcome>;\n\t/** Delegates to AgentSession.steer(). */\n\tsteer(text: string, images?: ImageContent[], options?: { source?: InputSource }): Promise<QueuedInputDisposition>;\n\t/** Delegates to AgentSession.abort(). */\n\tabort(): Promise<void>;\n\t/** Delegates to AgentSession.waitForIdle(). */\n\twaitForIdle(): Promise<void>;\n\n\t// --- Session write paths ---\n\t/** Delegates to AgentSession.compact(). */\n\tcompact(customInstructions?: string): Promise<CompactionResult | CompactionCancelledResult>;\n\t/** Delegates to AgentSession.navigateTree(). */\n\tnavigateTree(\n\t\ttargetId: string,\n\t\toptions?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string },\n\t): Promise<{ editorText?: string; cancelled: boolean; aborted?: boolean; summaryEntry?: BranchSummaryEntry }>;\n\t/** Delegates to AgentSession.reload(). */\n\treload(options?: { beforeSessionStart?: () => void | Promise<void> }): Promise<void>;\n\t/** Delegates to AgentSession.setModel(). */\n\tsetModel(model: Model<Api>, options?: ModelMutationOptions): Promise<void>;\n\t/** Delegates to AgentSession.setThinkingLevel(). */\n\tsetThinkingLevel(level: ThinkingLevel, options?: ModelMutationOptions): void;\n\t/** Delegates to AgentSession.setActiveToolsByName(). */\n\tsetActiveToolsByName(toolNames: string[]): void;\n\t/**\n\t * Queued-message read view, composed from AgentSession.getSteeringMessages()\n\t * and AgentSession.getFollowUpMessages(). AgentSession has no single\n\t * getQueuedMessages(); the shape mirrors clearQueue()'s return value.\n\t */\n\tgetQueuedMessages(): { steering: readonly string[]; followUp: readonly string[] };\n\t/** Delegates to AgentSession.clearQueue(). */\n\tclearQueue(): { steering: string[]; followUp: string[] };\n\t/** Delegates to AgentSession.recordSuiteMismatch(). */\n\trecordSuiteMismatch(originalSuiteId: string, currentSuiteId: string): void;\n\t/** Delegates to AgentSession.getSessionAPI(). */\n\tgetSessionAPI(): SessionAPI;\n\n\t// --- Read-only mirror ---\n\t/** Delegates to AgentSession.isIdle. */\n\tisIdle(): boolean;\n\t/** Mirrors AgentSession.state verbatim (phase 0; a projected state view is a later phase, 设计 §3). */\n\tgetState(): AgentState;\n\t/** Delegates to AgentSession.model. */\n\tgetModel(): Model<Api> | undefined;\n\t/** Delegates to AgentSession.getActiveToolNames(). */\n\tgetToolNames(): string[];\n\t/** Delegates to AgentSession.sessionId (via SessionAPI.getSessionId semantics). */\n\tgetSessionId(): string;\n\t/**\n\t * Suite id from the session-suite binding entry (设计 §10.1), read through\n\t * SessionAPI.getBranchEntries(). Undefined when the session carries no\n\t * suite binding.\n\t */\n\tgetSuiteId(): string | undefined;\n\t/** Delegates to AgentSession.sessionManager.getHeader(). SessionManager itself never leaks. */\n\tgetHeader(): SessionHeader | null;\n\t/** Delegates to AgentSession.subscribe(). Event types pass through verbatim (设计 §3). */\n\tsubscribe(listener: AgentSessionEventListener): () => void;\n\t/**\n\t * Invoked after each raw agent event is delivered to session processing;\n\t * the listener is awaited serially by the agent loop and participates in\n\t * run settlement. Exists for stdout backpressure pacing (D-046); the raw\n\t * event payload and abort signal are deliberately not exposed.\n\t */\n\tsubscribeRawEventGate(listener: () => void | Promise<void>): () => void;\n\n\t// --- Read surface (phase 1 slice 1, TUI display/selector reads, 设计 §2.6) ---\n\t/** Delegates to AgentSession.sessionName (which reads sessionManager.getSessionName()). */\n\tgetSessionName(): string | undefined;\n\t/** Delegates to AgentSession.isCompacting: a compaction or branch summarization is running (session level). */\n\tisCompacting(): boolean;\n\t/**\n\t * Delegates to AgentSession.isStreaming: an agent run is active at the\n\t * session level. Distinct from AgentState.isStreaming (agent-level stream\n\t * flag); do not interchange the two.\n\t */\n\tisStreaming(): boolean;\n\t/** Delegates to AgentSession.getContextUsage(). */\n\tgetContextUsage(): ContextUsage | undefined;\n\t/** Delegates to AgentSession.systemPrompt (effective prompt, including per-turn extension modifications). */\n\tgetSystemPrompt(): string;\n\t/** Delegates to AgentSession.scopedModels. Read view only; setScopedModels stays a phase 2 write path. */\n\tgetScopedModels(): ReadonlyArray<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\t/** Delegates to SessionManager.getTree() on the wrapped session. SessionManager itself never leaks. */\n\tgetTree(): SessionTreeNode[];\n\t/** Delegates to SessionManager.getLeafId() on the wrapped session. SessionManager itself never leaks. */\n\tgetLeafId(): string | null;\n\n\t// --- Read surface (phase 1 slice 2, TUI display/selector cluster convergence, 设计 §2.7) ---\n\t/** Delegates to AgentSession.promptTemplates (file-based prompt templates). */\n\tgetPromptTemplates(): ReadonlyArray<PromptTemplate>;\n\t/** Delegates to AgentSession.getToolDefinition(name): the registered tool definition by name, for diagnostics/rendering. */\n\tgetToolDefinition(name: string): ToolDefinition | undefined;\n\t/** Delegates to SessionManager.getCwd() on the wrapped session; identical to host.cwd. SessionManager itself never leaks. */\n\tgetCwd(): string;\n\t/** Delegates to SessionManager.getEntries() on the wrapped session; identical to host.entries. SessionManager itself never leaks. */\n\tgetEntries(): SessionEntry[];\n\t/** Delegates to AgentSession.pendingMessageCount: queued steering + follow-up message count. */\n\tgetPendingMessageCount(): number;\n\n\t// --- Write surface (phase 2, TUI write path convergence, 设计 §2.8) ---\n\t/** Delegates to AgentSession.followUp(). */\n\tfollowUp(text: string, images?: ImageContent[], options?: { source?: InputSource }): Promise<QueuedInputDisposition>;\n\t/** Delegates to AgentSession.setScopedModels(). */\n\tsetScopedModels(scopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>): void;\n\t/** Delegates to AgentSession.cycleModel(). */\n\tcycleModel(\n\t\tdirection?: \"forward\" | \"backward\",\n\t\toptions?: ModelMutationOptions,\n\t): Promise<ModelCycleResult | undefined>;\n\t/** Delegates to AgentSession.cycleThinkingLevel(). */\n\tcycleThinkingLevel(options?: ModelMutationOptions): ThinkingLevel | undefined;\n\t/** Delegates to AgentSession.setSteeringMode(). */\n\tsetSteeringMode(mode: \"all\" | \"one-at-a-time\"): void;\n\t/** Delegates to AgentSession.setFollowUpMode(). */\n\tsetFollowUpMode(mode: \"all\" | \"one-at-a-time\"): void;\n\t/** Delegates to AgentSession.setAutoCompactionEnabled(). */\n\tsetAutoCompactionEnabled(enabled: boolean): void;\n\t/** Delegates to AgentSession.setSessionName(). */\n\tsetSessionName(name: string): void;\n\t/** Delegates to AgentSession.abortBash(). */\n\tabortBash(): void;\n\t/** Delegates to AgentSession.abortCompaction(). */\n\tabortCompaction(): void;\n\t/** Delegates to AgentSession.abortRetry(). */\n\tabortRetry(): void;\n\t/** Delegates to AgentSession.abortBranchSummary(). */\n\tabortBranchSummary(): void;\n\t/** Delegates to AgentSession.captureBashEpoch(). */\n\tcaptureBashEpoch(): number;\n\t/** Delegates to AgentSession.isBashEpochCurrent(). */\n\tisBashEpochCurrent(epoch: number): boolean;\n\t/** Delegates to AgentSession.emitUserBash(): dispatches the user.bash lifecycle facts. */\n\temitUserBash(excludeFromContext: boolean): void;\n\t/** Delegates to AgentSession.executeBash(). */\n\texecuteBash(\n\t\tcommand: string,\n\t\tonChunk?: (chunk: string) => void,\n\t\toptions?: { excludeFromContext?: boolean; id?: string; operations?: BashOperations },\n\t): Promise<BashResult>;\n\t/** Delegates to AgentSession.recordBashResult(). */\n\trecordBashResult(\n\t\tcommand: string,\n\t\tresult: BashResult,\n\t\toptions?: { excludeFromContext?: boolean; epoch?: number },\n\t): void;\n\n\t// --- Read surface (phase 3, RPC host state reads, 设计 §2.9) ---\n\t/** Delegates to AgentSession.thinkingLevel. */\n\tgetThinkingLevel(): ThinkingLevel;\n\t/** Delegates to AgentSession.steeringMode. */\n\tgetSteeringMode(): \"all\" | \"one-at-a-time\";\n\t/** Delegates to AgentSession.followUpMode. */\n\tgetFollowUpMode(): \"all\" | \"one-at-a-time\";\n\t/** Delegates to AgentSession.sessionFile. */\n\tgetSessionFile(): string | undefined;\n\t/** Delegates to AgentSession.autoCompactionEnabled. */\n\tisAutoCompactionEnabled(): boolean;\n\t/** Delegates to AgentSession.getAvailableThinkingLevels(). */\n\tgetAvailableThinkingLevels(): ThinkingLevel[];\n\t/** Delegates to AgentSession.getUserMessagesForForking(). */\n\tgetUserMessagesForForking(): Array<{ entryId: string; text: string }>;\n\t/** Delegates to AgentSession.getLastAssistantText(). */\n\tgetLastAssistantText(): string | undefined;\n\t/** Delegates to AgentSession.getSessionStats(). */\n\tgetSessionStats(): SessionStats;\n\n\t// --- Write surface (phase 3, RPC host writes, 设计 §2.9) ---\n\t/** Delegates to AgentSession.setAutoRetryEnabled(). */\n\tsetAutoRetryEnabled(enabled: boolean): void;\n\t/** Delegates to AgentSession.exportToHtml(), including the themeName option. */\n\texportToHtml(outputPath?: string, options?: { themeName?: string }): Promise<string>;\n\n\t// --- Session write path (阶段 4 slice 3 v1 修订, D-041) ---\n\t/**\n\t * Delegates to SessionManager.appendLabelChange() on the wrapped session.\n\t * TUI tree selector label rename write point; SessionAPI has no label write.\n\t */\n\tappendLabelChange(entryId: string, label: string | undefined): string;\n\n\t// --- Resource read surface (阶段 4 slice 3 v1 修订, D-041) ---\n\t/**\n\t * Clean read projections over the wrapped session's resource loader. Skills/\n\t * prompts/agents-files results pass through verbatim; themes and extensions\n\t * are the metadata projections (themes as ThemeMetaV1 without the modes\n\t * Theme class; loader registration maps and the shared runtime never\n\t * leak). Guard reason: TUI startup listing/autocomplete/diagnostics\n\t * consume these read points directly; SessionAPI/CapabilityAPI are\n\t * capability-side contracts with no host display projections.\n\t */\n\t/** Delegates to ResourceLoader.getSkills() on the wrapped session. */\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getPrompts() on the wrapped session. */\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getThemes() on the wrapped session. */\n\tgetThemes(): { themes: ThemeMetaV1[]; diagnostics: ResourceDiagnostic[] };\n\t/** Delegates to ResourceLoader.getAgentsFiles() on the wrapped session. */\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> };\n\t/** Delegates to ResourceLoader.getSystemPromptSource() on the wrapped session. */\n\tgetSystemPromptSource(): { path: string } | undefined;\n\t/** Delegates to ResourceLoader.getAppendSystemPromptSources() on the wrapped session. */\n\tgetAppendSystemPromptSources(): Array<{ path: string }>;\n\n\t// --- Model/catalog/context read surface (v1 修订, D-047: TUI direct session reads zeroed) ---\n\t/** Delegates to ModelRuntime.getAvailableSnapshot() on the wrapped session (D-047); ModelRuntime itself never leaks. */\n\tgetAvailableModels(): readonly Model<Api>[];\n\t/** Delegates to ModelRuntime.isUsingSubscription() on the wrapped session (D-047). */\n\tisUsingSubscription(providerId: string): boolean;\n\t/** Delegates to ModelRuntime.getError() on the wrapped session (D-047). */\n\tgetModelsError(): string | undefined;\n\t/**\n\t * Narrow `ModelCatalogRuntime` projection of the wrapped session's\n\t * ModelRuntime for the shared catalog-refresh coordinator (D-047). A\n\t * projection, not a wrapper: the full runtime never leaks.\n\t */\n\tgetModelCatalog(): ModelCatalogRuntime;\n\t/** Delegates to ModelRuntime.checkAuth() on the wrapped session (D-047). */\n\tcheckProviderAuth(providerId: string): Promise<AuthCheck | undefined>;\n\t/** Delegates to ModelRuntime.getAuth() on the wrapped session (D-047). */\n\tgetProviderAuth(providerId: string): Promise<AuthResult | undefined>;\n\t/**\n\t * Narrow `ModelPriceSource` projection of the wrapped session's\n\t * ModelRuntime for the cache-stats pure functions (D-047). A projection,\n\t * not a wrapper: the full runtime never leaks.\n\t */\n\tgetModelPriceSource(): ModelPriceSource;\n\t/**\n\t * Delegates to SessionManager.buildContextEntries() on the wrapped session\n\t * (D-047; delegation restored by the D-047 regression fix — the\n\t * incrementally maintained byId index is required for correct context\n\t * paths after a compaction commit). SessionManager itself never leaks.\n\t */\n\tgetContextEntries(): SessionEntry[];\n\n\t// --- Credential/provider auth read surface (v1 修订, D-048: TUI auth host path) ---\n\t/**\n\t * Narrow `ModelAuthRuntime` projection of the wrapped session's ModelRuntime\n\t * for the TUI auth surface (D-048). A projection, not a wrapper: the full\n\t * runtime never leaks. The credential-management CapabilityAPI semantics\n\t * question stays open (D-047 裁决 3); this only narrows the TUI host path.\n\t */\n\tgetModelAuthRuntime(): ModelAuthRuntime;\n\n\t// --- Session stats/text read surface (v1 修订, B-S2b③-S3a: TUI direct\n\t// session stats/text read cluster convergence) ---\n\t/** Delegates to AgentSession.getSteeringMessages(). */\n\tgetSteeringMessages(): readonly string[];\n\t/** Delegates to AgentSession.getFollowUpMessages(). */\n\tgetFollowUpMessages(): readonly string[];\n\n\t// --- Status/settings + export read surface (v1 修订, B-S2b③-S3b+c: TUI\n\t// status/settings/export cluster direct session read convergence) ---\n\t/** Delegates to AgentSession.retryAttempt. */\n\tgetRetryAttempt(): number;\n\t/** Delegates to AgentSession.isBashRunning. */\n\tisBashRunning(): boolean;\n\t/** Delegates to AgentSession.exportToJsonl(). */\n\texportToJsonl(outputPath?: string): string;\n\n\t// --- Lifecycle ---\n\t/** Delegates to AgentSession.dispose(). */\n\tdispose(): Promise<void>;\n}\n\n/** Creates a facade v1 view over one AgentSession. Pure wrapper: holds no state of its own. */\nexport function createCodingAgentFacade(session: AgentSession): CodingAgentFacadeV1 {\n\treturn {\n\t\tversion: 1,\n\t\tprompt: (text, options) => session.prompt(text, options),\n\t\tsteer: (text, images, options) => session.steer(text, images, options),\n\t\tabort: () => session.abort(),\n\t\twaitForIdle: () => session.waitForIdle(),\n\t\tcompact: (customInstructions) => session.compact(customInstructions),\n\t\tnavigateTree: (targetId, options) => session.navigateTree(targetId, options),\n\t\treload: (options) => session.reload(options),\n\t\tsetModel: (model, options) => session.setModel(model, options),\n\t\tsetThinkingLevel: (level, options) => session.setThinkingLevel(level, options),\n\t\tsetActiveToolsByName: (toolNames) => session.setActiveToolsByName(toolNames),\n\t\tgetQueuedMessages: () => ({\n\t\t\tsteering: session.getSteeringMessages(),\n\t\t\tfollowUp: session.getFollowUpMessages(),\n\t\t}),\n\t\tclearQueue: () => session.clearQueue(),\n\t\trecordSuiteMismatch: (originalSuiteId, currentSuiteId) =>\n\t\t\tsession.recordSuiteMismatch(originalSuiteId, currentSuiteId),\n\t\tgetSessionAPI: () => session.getSessionAPI(),\n\t\tisIdle: () => session.isIdle,\n\t\tgetState: () => session.state,\n\t\tgetModel: () => session.model,\n\t\tgetToolNames: () => session.getActiveToolNames(),\n\t\tgetSessionId: () => session.sessionId,\n\t\tgetHeader: () => session.sessionManager.getHeader(),\n\t\tsubscribe: (listener) => session.subscribe(listener),\n\t\tsubscribeRawEventGate: (listener) => session.agent.subscribe(() => listener()),\n\t\tgetSessionName: () => session.sessionName,\n\t\tisCompacting: () => session.isCompacting,\n\t\tisStreaming: () => session.isStreaming,\n\t\tgetContextUsage: () => session.getContextUsage(),\n\t\tgetSystemPrompt: () => session.systemPrompt,\n\t\tgetScopedModels: () => session.scopedModels,\n\t\tgetTree: () => session.sessionManager.getTree(),\n\t\tgetLeafId: () => session.sessionManager.getLeafId(),\n\t\tgetPromptTemplates: () => session.promptTemplates,\n\t\tgetToolDefinition: (name) => session.getToolDefinition(name),\n\t\tgetCwd: () => session.sessionManager.getCwd(),\n\t\tgetEntries: () => session.sessionManager.getEntries(),\n\t\tgetPendingMessageCount: () => session.pendingMessageCount,\n\t\tfollowUp: (text, images, options) => session.followUp(text, images, options),\n\t\tsetScopedModels: (scopedModels) => session.setScopedModels(scopedModels),\n\t\tcycleModel: (direction, options) => session.cycleModel(direction, options),\n\t\tcycleThinkingLevel: (options) => session.cycleThinkingLevel(options),\n\t\tsetSteeringMode: (mode) => session.setSteeringMode(mode),\n\t\tsetFollowUpMode: (mode) => session.setFollowUpMode(mode),\n\t\tsetAutoCompactionEnabled: (enabled) => session.setAutoCompactionEnabled(enabled),\n\t\tsetSessionName: (name) => session.setSessionName(name),\n\t\tabortBash: () => session.abortBash(),\n\t\tabortCompaction: () => session.abortCompaction(),\n\t\tabortRetry: () => session.abortRetry(),\n\t\tabortBranchSummary: () => session.abortBranchSummary(),\n\t\tcaptureBashEpoch: () => session.captureBashEpoch(),\n\t\tisBashEpochCurrent: (epoch) => session.isBashEpochCurrent(epoch),\n\t\temitUserBash: (excludeFromContext) => session.emitUserBash(excludeFromContext),\n\t\texecuteBash: (command, onChunk, options) => session.executeBash(command, onChunk, options),\n\t\trecordBashResult: (command, result, options) => session.recordBashResult(command, result, options),\n\t\tgetThinkingLevel: () => session.thinkingLevel,\n\t\tgetSteeringMode: () => session.steeringMode,\n\t\tgetFollowUpMode: () => session.followUpMode,\n\t\tgetSessionFile: () => session.sessionFile,\n\t\tisAutoCompactionEnabled: () => session.autoCompactionEnabled,\n\t\tgetAvailableThinkingLevels: () => session.getAvailableThinkingLevels(),\n\t\tgetUserMessagesForForking: () => session.getUserMessagesForForking(),\n\t\tgetLastAssistantText: () => session.getLastAssistantText(),\n\t\tgetSessionStats: () => session.getSessionStats(),\n\t\tsetAutoRetryEnabled: (enabled) => session.setAutoRetryEnabled(enabled),\n\t\texportToHtml: (outputPath, options) => session.exportToHtml(outputPath, options),\n\t\tappendLabelChange: (entryId, label) => session.sessionManager.appendLabelChange(entryId, label),\n\t\tgetSkills: () => session.resourceLoader.getSkills(),\n\t\tgetPrompts: () => session.resourceLoader.getPrompts(),\n\t\tgetThemes: () => session.resourceLoader.getThemes(),\n\t\tgetAgentsFiles: () => session.resourceLoader.getAgentsFiles(),\n\t\tgetSystemPromptSource: () => session.resourceLoader.getSystemPromptSource(),\n\t\tgetAppendSystemPromptSources: () => session.resourceLoader.getAppendSystemPromptSources(),\n\t\tgetSuiteId: () => readSessionSuiteBinding(session.getSessionAPI().getBranchEntries())?.suiteId,\n\t\tgetAvailableModels: () => session.modelRuntime.getAvailableSnapshot(),\n\t\tisUsingSubscription: (providerId) => session.modelRuntime.isUsingSubscription(providerId),\n\t\tgetModelsError: () => session.modelRuntime.getError(),\n\t\tgetModelCatalog: () => session.modelRuntime,\n\t\tcheckProviderAuth: (providerId) => session.modelRuntime.checkAuth(providerId),\n\t\tgetProviderAuth: (providerId) => session.modelRuntime.getAuth(providerId),\n\t\tgetModelPriceSource: () => session.modelRuntime,\n\t\tgetModelAuthRuntime: () => session.modelRuntime,\n\t\t// Delegates to the SessionManager method: its incrementally maintained\n\t\t// byId index walks the full entry graph, which rebuild-from-entries\n\t\t// diverges from after a compaction commit (D-047 regression fix).\n\t\tgetContextEntries: () => session.sessionManager.buildContextEntries(),\n\t\tgetSteeringMessages: () => session.getSteeringMessages(),\n\t\tgetFollowUpMessages: () => session.getFollowUpMessages(),\n\t\tgetRetryAttempt: () => session.retryAttempt,\n\t\tisBashRunning: () => session.isBashRunning,\n\t\texportToJsonl: (outputPath) => session.exportToJsonl(outputPath),\n\t\tdispose: () => session.dispose(),\n\t};\n}\n"]}
@@ -88,13 +88,13 @@ export interface CodingAgentRuntimeFacadeV1 {
88
88
  * Delegates to SessionManager.list(cwd, sessionDir) on the current session's
89
89
  * manager: sessions of the current cwd/session dir, newest first.
90
90
  */
91
- listSessions(onProgress?: SessionListProgress): Promise<SessionInfo[]>;
91
+ listSessions(onProgress?: SessionListProgress, signal?: AbortSignal): Promise<SessionInfo[]>;
92
92
  /**
93
93
  * Delegates to SessionManager.listAll() on the current session's manager:
94
94
  * the default session dir when the session uses it, the session's own dir
95
95
  * otherwise (same branch as the interactive selector).
96
96
  */
97
- listAllSessions(onProgress?: SessionListProgress): Promise<SessionInfo[]>;
97
+ listAllSessions(onProgress?: SessionListProgress, signal?: AbortSignal): Promise<SessionInfo[]>;
98
98
  /** Delegates to SessionManager.getSessionFile() on the current session's manager. */
99
99
  getSessionFile(): string | undefined;
100
100
  /** Delegates to SessionManager.getSessionDir() on the current session's manager. */
@@ -1 +1 @@
1
- {"version":3,"file":"coding-agent-runtime-facade.d.ts","sourceRoot":"","sources":["../../../src/core/facade/coding-agent-runtime-facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK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A;KAAE,CAAC,CAAC;IACnC,0DAA0D;IAC1D,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC1F,kDAAkD;IAClD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,qEAAqE;IACrE,0BAA0B,CAAC,uBAAuB,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACvE,2DAA2D;IAC3D,gBAAgB,CAAC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAGjF;;;;;;;;;;;OAWG;IACH,gBAAgB,IAAI,mBAAmB,CAAC;IAGxC;;;OAGG;IACH,YAAY,CAAC,UAAU,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACvE;;;;OAIG;IACH,eAAe,CAAC,UAAU,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC1E,qFAAqF;IACrF,cAAc,IAAI,MAAM,GAAG,SAAS,CAAC;IACrC,oFAAoF;IACpF,aAAa,IAAI,MAAM,CAAC;IACxB,4FAA4F;IAC5F,qBAAqB,IAAI,OAAO,CAAC;IACjC,kFAAkF;IAClF,WAAW,IAAI,OAAO,CAAC;IACvB,mFAAmF;IACnF,YAAY,IAAI,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,mBAAmB,GAAG,0BAA0B,CA8BvG","sourcesContent":["/**\n * Stable runtime facade v1 (阶段 4 slice 3): a versioned surface over\n * AgentSessionRuntime for host session lifecycle orchestration and the static\n * session selector reads.\n *\n * Design: docs/design/稳定门面统一入口设计.md (§3.5 阶段 4 slice 3 runtime 面,\n * D-041). This is an independent versioned contract alongside the frozen\n * `CodingAgentFacadeV1` session face (§3.1): the v1 session face is unchanged,\n * and lifecycle orchestration never belonged on a per-session facade because\n * the runtime owns teardown/rebind ordering across session replacement\n * (session_shutdown → beforeSessionInvalidate → dispose → create → rebind).\n * Every member is a pure delegate onto the wrapped AgentSessionRuntime or the\n * current session's SessionManager (instance reads / static selectors). No new\n * behavior, no policy, no state of its own. SessionManager does leak at two\n * controlled points: the `newSession` `setup` callback receives the new\n * session's `SessionManager` for assembly-time writes — hosts and extensions\n * seed session content (e.g. `appendMessage`) before the runtime applies the\n * built context; deprecated on the extension surface in favor of the\n * CapabilityAPI session surface — and the `setRebindSession` callback receives\n * the internal `AgentSession` instance so hosts can rebind their session\n * references after replacement.\n *\n * D-063 adds the one projection member, `getSessionFacade()`: the v1 session face\n * over the runtime's current session, re-derived per call, so a stable consumer\n * that only needs the active session's facade never touches the raw\n * `AgentSession` and never re-constructs anything after a replacement.\n */\n\nimport type { AgentSession } from \"../agent-session.ts\";\nimport type { AgentSessionRuntime, ReplacedSessionContext } from \"../agent-session-runtime.ts\";\nimport type { SessionInfo, SessionListProgress } from \"../session-manager.ts\";\nimport { SessionManager } from \"../session-manager.ts\";\nimport { type CodingAgentFacadeV1, createCodingAgentFacade } from \"./coding-agent-facade.ts\";\n\n/**\n * Stable runtime facade v1: the consumption surface for host lifecycle\n * orchestration, versioned per repo convention (CodingAgentFacadeV1\n * precedent). New members must extend the facade design doc first (门面腐化\n * guard, 设计 §6).\n */\nexport interface CodingAgentRuntimeFacadeV1 {\n\treadonly version: 1;\n\n\t// --- Lifecycle orchestration (delegates to AgentSessionRuntime verbatim) ---\n\t/** Delegates to AgentSessionRuntime.newSession(). */\n\tnewSession(options?: {\n\t\tparentSession?: string;\n\t\tsetup?: (sessionManager: SessionManager) => Promise<void>;\n\t\twithSession?: (ctx: ReplacedSessionContext) => Promise<void>;\n\t}): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.fork(). */\n\tfork(\n\t\tentryId: string,\n\t\toptions?: { position?: \"before\" | \"at\"; withSession?: (ctx: ReplacedSessionContext) => Promise<void> },\n\t): Promise<{ cancelled: boolean; selectedText?: string }>;\n\t/** Delegates to AgentSessionRuntime.switchSession(). */\n\tswitchSession(\n\t\tsessionPath: string,\n\t\toptions?: { cwdOverride?: string; withSession?: (ctx: ReplacedSessionContext) => Promise<void> },\n\t): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.importFromJsonl(). */\n\timportFromJsonl(inputPath: string, cwdOverride?: string): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.dispose(). */\n\tdispose(): Promise<void>;\n\t/** Delegates to AgentSessionRuntime.setBeforeSessionInvalidate(). */\n\tsetBeforeSessionInvalidate(beforeSessionInvalidate?: () => void): void;\n\t/** Delegates to AgentSessionRuntime.setRebindSession(). */\n\tsetRebindSession(rebindSession?: (session: AgentSession) => Promise<void>): void;\n\n\t// --- Current-session projection (bridge to the v1 session face) ---\n\t/**\n\t * The v1 session facade over the runtime's **current** session\n\t * (`createCodingAgentFacade(runtime.session)`), re-derived on every call.\n\t *\n\t * Replacements (newSession/switchSession/fork/importFromJsonl) invalidate the\n\t * previous session, so a facade held across one of them would keep reading a\n\t * dead session — call this accessor again after a replacement instead of\n\t * caching it. Complement to `setRebindSession`: that hook keeps host-held\n\t * *internal* session references fresh (extension binding, host state), while\n\t * this member is the stable-surface way to reach the current session without\n\t * the raw `AgentSession` ever leaving the adapter (D-063).\n\t */\n\tgetSessionFacade(): CodingAgentFacadeV1;\n\n\t// --- Session selector reads (SessionManager statics + instance reads) ---\n\t/**\n\t * Delegates to SessionManager.list(cwd, sessionDir) on the current session's\n\t * manager: sessions of the current cwd/session dir, newest first.\n\t */\n\tlistSessions(onProgress?: SessionListProgress): Promise<SessionInfo[]>;\n\t/**\n\t * Delegates to SessionManager.listAll() on the current session's manager:\n\t * the default session dir when the session uses it, the session's own dir\n\t * otherwise (same branch as the interactive selector).\n\t */\n\tlistAllSessions(onProgress?: SessionListProgress): Promise<SessionInfo[]>;\n\t/** Delegates to SessionManager.getSessionFile() on the current session's manager. */\n\tgetSessionFile(): string | undefined;\n\t/** Delegates to SessionManager.getSessionDir() on the current session's manager. */\n\tgetSessionDir(): string;\n\t/** Delegates to SessionManager.usesDefaultSessionDir() on the current session's manager. */\n\tusesDefaultSessionDir(): boolean;\n\t/** Delegates to SessionManager.isPersisted() on the current session's manager. */\n\tisPersisted(): boolean;\n\t/** Delegates to SessionManager.getSessionId() on the current session's manager. */\n\tgetSessionId(): string;\n}\n\n/**\n * Creates a runtime facade v1 view over one AgentSessionRuntime. Pure wrapper:\n * holds no state of its own. Derive on each access (or after a rebind) so the\n * wrapper always reads the runtime's current session.\n */\nexport function createCodingAgentRuntimeFacade(runtime: AgentSessionRuntime): CodingAgentRuntimeFacadeV1 {\n\tconst sessionManager = () => runtime.session.sessionManager;\n\treturn {\n\t\tversion: 1,\n\t\t// Rest-args forwarding keeps the delegation call-arity identical to a\n\t\t// direct runtime call (optional options are not materialized as\n\t\t// explicit undefined arguments).\n\t\tnewSession: (...args) => runtime.newSession(...args),\n\t\tfork: (...args) => runtime.fork(...args),\n\t\tswitchSession: (...args) => runtime.switchSession(...args),\n\t\timportFromJsonl: (...args) => runtime.importFromJsonl(...args),\n\t\tdispose: () => runtime.dispose(),\n\t\tsetBeforeSessionInvalidate: (beforeSessionInvalidate) =>\n\t\t\truntime.setBeforeSessionInvalidate(beforeSessionInvalidate),\n\t\tsetRebindSession: (rebindSession) => runtime.setRebindSession(rebindSession),\n\t\t// Re-projected per call so the accessor follows the runtime's current session\n\t\t// across replacements (the v1 session facade holds no state of its own).\n\t\tgetSessionFacade: () => createCodingAgentFacade(runtime.session),\n\t\tlistSessions: (onProgress) =>\n\t\t\tSessionManager.list(sessionManager().getCwd(), sessionManager().getSessionDir(), onProgress),\n\t\tlistAllSessions: (onProgress) =>\n\t\t\tsessionManager().usesDefaultSessionDir()\n\t\t\t\t? SessionManager.listAll(onProgress)\n\t\t\t\t: SessionManager.listAll(sessionManager().getSessionDir(), onProgress),\n\t\tgetSessionFile: () => sessionManager().getSessionFile(),\n\t\tgetSessionDir: () => sessionManager().getSessionDir(),\n\t\tusesDefaultSessionDir: () => sessionManager().usesDefaultSessionDir(),\n\t\tisPersisted: () => sessionManager().isPersisted(),\n\t\tgetSessionId: () => sessionManager().getSessionId(),\n\t};\n}\n"]}
1
+ {"version":3,"file":"coding-agent-runtime-facade.d.ts","sourceRoot":"","sources":["../../../src/core/facade/coding-agent-runtime-facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,mBAAmB,EAA2B,MAAM,0BAA0B,CAAC;AAE7F;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAGpB,qDAAqD;IACrD,UAAU,CAAC,OAAO,CAAC,EAAE;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,KAAK,CAAC,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1D,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KAC7D,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACpC,+CAA+C;IAC/C,IAAI,CACH,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,IA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AqF;IACrF,cAAc,IAAI,MAAM,GAAG,SAAS,CAAC;IACrC,oFAAoF;IACpF,aAAa,IAAI,MAAM,CAAC;IACxB,4FAA4F;IAC5F,qBAAqB,IAAI,OAAO,CAAC;IACjC,kFAAkF;IAClF,WAAW,IAAI,OAAO,CAAC;IACvB,mFAAmF;IACnF,YAAY,IAAI,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,mBAAmB,GAAG,0BAA0B,CA8BvG","sourcesContent":["/**\n * Stable runtime facade v1 (阶段 4 slice 3): a versioned surface over\n * AgentSessionRuntime for host session lifecycle orchestration and the static\n * session selector reads.\n *\n * Design: docs/design/稳定门面统一入口设计.md (§3.5 阶段 4 slice 3 runtime 面,\n * D-041). This is an independent versioned contract alongside the frozen\n * `CodingAgentFacadeV1` session face (§3.1): the v1 session face is unchanged,\n * and lifecycle orchestration never belonged on a per-session facade because\n * the runtime owns teardown/rebind ordering across session replacement\n * (session_shutdown → beforeSessionInvalidate → dispose → create → rebind).\n * Every member is a pure delegate onto the wrapped AgentSessionRuntime or the\n * current session's SessionManager (instance reads / static selectors). No new\n * behavior, no policy, no state of its own. SessionManager does leak at two\n * controlled points: the `newSession` `setup` callback receives the new\n * session's `SessionManager` for assembly-time writes — hosts and extensions\n * seed session content (e.g. `appendMessage`) before the runtime applies the\n * built context; deprecated on the extension surface in favor of the\n * CapabilityAPI session surface — and the `setRebindSession` callback receives\n * the internal `AgentSession` instance so hosts can rebind their session\n * references after replacement.\n *\n * D-063 adds the one projection member, `getSessionFacade()`: the v1 session face\n * over the runtime's current session, re-derived per call, so a stable consumer\n * that only needs the active session's facade never touches the raw\n * `AgentSession` and never re-constructs anything after a replacement.\n */\n\nimport type { AgentSession } from \"../agent-session.ts\";\nimport type { AgentSessionRuntime, ReplacedSessionContext } from \"../agent-session-runtime.ts\";\nimport type { SessionInfo, SessionListProgress } from \"../session-manager.ts\";\nimport { SessionManager } from \"../session-manager.ts\";\nimport { type CodingAgentFacadeV1, createCodingAgentFacade } from \"./coding-agent-facade.ts\";\n\n/**\n * Stable runtime facade v1: the consumption surface for host lifecycle\n * orchestration, versioned per repo convention (CodingAgentFacadeV1\n * precedent). New members must extend the facade design doc first (门面腐化\n * guard, 设计 §6).\n */\nexport interface CodingAgentRuntimeFacadeV1 {\n\treadonly version: 1;\n\n\t// --- Lifecycle orchestration (delegates to AgentSessionRuntime verbatim) ---\n\t/** Delegates to AgentSessionRuntime.newSession(). */\n\tnewSession(options?: {\n\t\tparentSession?: string;\n\t\tsetup?: (sessionManager: SessionManager) => Promise<void>;\n\t\twithSession?: (ctx: ReplacedSessionContext) => Promise<void>;\n\t}): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.fork(). */\n\tfork(\n\t\tentryId: string,\n\t\toptions?: { position?: \"before\" | \"at\"; withSession?: (ctx: ReplacedSessionContext) => Promise<void> },\n\t): Promise<{ cancelled: boolean; selectedText?: string }>;\n\t/** Delegates to AgentSessionRuntime.switchSession(). */\n\tswitchSession(\n\t\tsessionPath: string,\n\t\toptions?: { cwdOverride?: string; withSession?: (ctx: ReplacedSessionContext) => Promise<void> },\n\t): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.importFromJsonl(). */\n\timportFromJsonl(inputPath: string, cwdOverride?: string): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.dispose(). */\n\tdispose(): Promise<void>;\n\t/** Delegates to AgentSessionRuntime.setBeforeSessionInvalidate(). */\n\tsetBeforeSessionInvalidate(beforeSessionInvalidate?: () => void): void;\n\t/** Delegates to AgentSessionRuntime.setRebindSession(). */\n\tsetRebindSession(rebindSession?: (session: AgentSession) => Promise<void>): void;\n\n\t// --- Current-session projection (bridge to the v1 session face) ---\n\t/**\n\t * The v1 session facade over the runtime's **current** session\n\t * (`createCodingAgentFacade(runtime.session)`), re-derived on every call.\n\t *\n\t * Replacements (newSession/switchSession/fork/importFromJsonl) invalidate the\n\t * previous session, so a facade held across one of them would keep reading a\n\t * dead session — call this accessor again after a replacement instead of\n\t * caching it. Complement to `setRebindSession`: that hook keeps host-held\n\t * *internal* session references fresh (extension binding, host state), while\n\t * this member is the stable-surface way to reach the current session without\n\t * the raw `AgentSession` ever leaving the adapter (D-063).\n\t */\n\tgetSessionFacade(): CodingAgentFacadeV1;\n\n\t// --- Session selector reads (SessionManager statics + instance reads) ---\n\t/**\n\t * Delegates to SessionManager.list(cwd, sessionDir) on the current session's\n\t * manager: sessions of the current cwd/session dir, newest first.\n\t */\n\tlistSessions(onProgress?: SessionListProgress, signal?: AbortSignal): Promise<SessionInfo[]>;\n\t/**\n\t * Delegates to SessionManager.listAll() on the current session's manager:\n\t * the default session dir when the session uses it, the session's own dir\n\t * otherwise (same branch as the interactive selector).\n\t */\n\tlistAllSessions(onProgress?: SessionListProgress, signal?: AbortSignal): Promise<SessionInfo[]>;\n\t/** Delegates to SessionManager.getSessionFile() on the current session's manager. */\n\tgetSessionFile(): string | undefined;\n\t/** Delegates to SessionManager.getSessionDir() on the current session's manager. */\n\tgetSessionDir(): string;\n\t/** Delegates to SessionManager.usesDefaultSessionDir() on the current session's manager. */\n\tusesDefaultSessionDir(): boolean;\n\t/** Delegates to SessionManager.isPersisted() on the current session's manager. */\n\tisPersisted(): boolean;\n\t/** Delegates to SessionManager.getSessionId() on the current session's manager. */\n\tgetSessionId(): string;\n}\n\n/**\n * Creates a runtime facade v1 view over one AgentSessionRuntime. Pure wrapper:\n * holds no state of its own. Derive on each access (or after a rebind) so the\n * wrapper always reads the runtime's current session.\n */\nexport function createCodingAgentRuntimeFacade(runtime: AgentSessionRuntime): CodingAgentRuntimeFacadeV1 {\n\tconst sessionManager = () => runtime.session.sessionManager;\n\treturn {\n\t\tversion: 1,\n\t\t// Rest-args forwarding keeps the delegation call-arity identical to a\n\t\t// direct runtime call (optional options are not materialized as\n\t\t// explicit undefined arguments).\n\t\tnewSession: (...args) => runtime.newSession(...args),\n\t\tfork: (...args) => runtime.fork(...args),\n\t\tswitchSession: (...args) => runtime.switchSession(...args),\n\t\timportFromJsonl: (...args) => runtime.importFromJsonl(...args),\n\t\tdispose: () => runtime.dispose(),\n\t\tsetBeforeSessionInvalidate: (beforeSessionInvalidate) =>\n\t\t\truntime.setBeforeSessionInvalidate(beforeSessionInvalidate),\n\t\tsetRebindSession: (rebindSession) => runtime.setRebindSession(rebindSession),\n\t\t// Re-projected per call so the accessor follows the runtime's current session\n\t\t// across replacements (the v1 session facade holds no state of its own).\n\t\tgetSessionFacade: () => createCodingAgentFacade(runtime.session),\n\t\tlistSessions: (onProgress, signal) =>\n\t\t\tSessionManager.list(sessionManager().getCwd(), sessionManager().getSessionDir(), onProgress, signal),\n\t\tlistAllSessions: (onProgress, signal) =>\n\t\t\tsessionManager().usesDefaultSessionDir()\n\t\t\t\t? SessionManager.listAll(onProgress, signal)\n\t\t\t\t: SessionManager.listAll(sessionManager().getSessionDir(), onProgress, signal),\n\t\tgetSessionFile: () => sessionManager().getSessionFile(),\n\t\tgetSessionDir: () => sessionManager().getSessionDir(),\n\t\tusesDefaultSessionDir: () => sessionManager().usesDefaultSessionDir(),\n\t\tisPersisted: () => sessionManager().isPersisted(),\n\t\tgetSessionId: () => sessionManager().getSessionId(),\n\t};\n}\n"]}
@@ -49,10 +49,10 @@ export function createCodingAgentRuntimeFacade(runtime) {
49
49
  // Re-projected per call so the accessor follows the runtime's current session
50
50
  // across replacements (the v1 session facade holds no state of its own).
51
51
  getSessionFacade: () => createCodingAgentFacade(runtime.session),
52
- listSessions: (onProgress) => SessionManager.list(sessionManager().getCwd(), sessionManager().getSessionDir(), onProgress),
53
- listAllSessions: (onProgress) => sessionManager().usesDefaultSessionDir()
54
- ? SessionManager.listAll(onProgress)
55
- : SessionManager.listAll(sessionManager().getSessionDir(), onProgress),
52
+ listSessions: (onProgress, signal) => SessionManager.list(sessionManager().getCwd(), sessionManager().getSessionDir(), onProgress, signal),
53
+ listAllSessions: (onProgress, signal) => sessionManager().usesDefaultSessionDir()
54
+ ? SessionManager.listAll(onProgress, signal)
55
+ : SessionManager.listAll(sessionManager().getSessionDir(), onProgress, signal),
56
56
  getSessionFile: () => sessionManager().getSessionFile(),
57
57
  getSessionDir: () => sessionManager().getSessionDir(),
58
58
  usesDefaultSessionDir: () => sessionManager().usesDefaultSessionDir(),
@@ -1 +1 @@
1
- {"version":3,"file":"coding-agent-runtime-facade.js","sourceRoot":"","sources":["../../../src/core/facade/coding-agent-runtime-facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAA4B,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AA4E7F;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,OAA4B,EAA8B;IACxG,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC;IAC5D,OAAO;QACN,OAAO,EAAE,CAAC;QACV,sEAAsE;QACtE,gEAAgE;QAChE,iCAAiC;QACjC,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;QACpD,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACxC,aAAa,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;QAC1D,eAAe,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC;QAC9D,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;QAChC,0BAA0B,EAAE,CAAC,uBAAuB,EAAE,EAAE,CACvD,OAAO,CAAC,0BAA0B,CAAC,uBAAuB,CAAC;QAC5D,gBAAgB,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC;QAC5E,8EAA8E;QAC9E,yEAAyE;QACzE,gBAAgB,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,OAAO,CAAC,OAAO,CAAC;QAChE,YAAY,EAAE,CAAC,UAAU,EAAE,EAAE,CAC5B,cAAc,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,cAAc,EAAE,CAAC,aAAa,EAAE,EAAE,UAAU,CAAC;QAC7F,eAAe,EAAE,CAAC,UAAU,EAAE,EAAE,CAC/B,cAAc,EAAE,CAAC,qBAAqB,EAAE;YACvC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC;YACpC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE,EAAE,UAAU,CAAC;QACxE,cAAc,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE;QACvD,aAAa,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE;QACrD,qBAAqB,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,qBAAqB,EAAE;QACrE,WAAW,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,WAAW,EAAE;QACjD,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,YAAY,EAAE;KACnD,CAAC;AAAA,CACF","sourcesContent":["/**\n * Stable runtime facade v1 (阶段 4 slice 3): a versioned surface over\n * AgentSessionRuntime for host session lifecycle orchestration and the static\n * session selector reads.\n *\n * Design: docs/design/稳定门面统一入口设计.md (§3.5 阶段 4 slice 3 runtime 面,\n * D-041). This is an independent versioned contract alongside the frozen\n * `CodingAgentFacadeV1` session face (§3.1): the v1 session face is unchanged,\n * and lifecycle orchestration never belonged on a per-session facade because\n * the runtime owns teardown/rebind ordering across session replacement\n * (session_shutdown → beforeSessionInvalidate → dispose → create → rebind).\n * Every member is a pure delegate onto the wrapped AgentSessionRuntime or the\n * current session's SessionManager (instance reads / static selectors). No new\n * behavior, no policy, no state of its own. SessionManager does leak at two\n * controlled points: the `newSession` `setup` callback receives the new\n * session's `SessionManager` for assembly-time writes — hosts and extensions\n * seed session content (e.g. `appendMessage`) before the runtime applies the\n * built context; deprecated on the extension surface in favor of the\n * CapabilityAPI session surface — and the `setRebindSession` callback receives\n * the internal `AgentSession` instance so hosts can rebind their session\n * references after replacement.\n *\n * D-063 adds the one projection member, `getSessionFacade()`: the v1 session face\n * over the runtime's current session, re-derived per call, so a stable consumer\n * that only needs the active session's facade never touches the raw\n * `AgentSession` and never re-constructs anything after a replacement.\n */\n\nimport type { AgentSession } from \"../agent-session.ts\";\nimport type { AgentSessionRuntime, ReplacedSessionContext } from \"../agent-session-runtime.ts\";\nimport type { SessionInfo, SessionListProgress } from \"../session-manager.ts\";\nimport { SessionManager } from \"../session-manager.ts\";\nimport { type CodingAgentFacadeV1, createCodingAgentFacade } from \"./coding-agent-facade.ts\";\n\n/**\n * Stable runtime facade v1: the consumption surface for host lifecycle\n * orchestration, versioned per repo convention (CodingAgentFacadeV1\n * precedent). New members must extend the facade design doc first (门面腐化\n * guard, 设计 §6).\n */\nexport interface CodingAgentRuntimeFacadeV1 {\n\treadonly version: 1;\n\n\t// --- Lifecycle orchestration (delegates to AgentSessionRuntime verbatim) ---\n\t/** Delegates to AgentSessionRuntime.newSession(). */\n\tnewSession(options?: {\n\t\tparentSession?: string;\n\t\tsetup?: (sessionManager: SessionManager) => Promise<void>;\n\t\twithSession?: (ctx: ReplacedSessionContext) => Promise<void>;\n\t}): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.fork(). */\n\tfork(\n\t\tentryId: string,\n\t\toptions?: { position?: \"before\" | \"at\"; withSession?: (ctx: ReplacedSessionContext) => Promise<void> },\n\t): Promise<{ cancelled: boolean; selectedText?: string }>;\n\t/** Delegates to AgentSessionRuntime.switchSession(). */\n\tswitchSession(\n\t\tsessionPath: string,\n\t\toptions?: { cwdOverride?: string; withSession?: (ctx: ReplacedSessionContext) => Promise<void> },\n\t): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.importFromJsonl(). */\n\timportFromJsonl(inputPath: string, cwdOverride?: string): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.dispose(). */\n\tdispose(): Promise<void>;\n\t/** Delegates to AgentSessionRuntime.setBeforeSessionInvalidate(). */\n\tsetBeforeSessionInvalidate(beforeSessionInvalidate?: () => void): void;\n\t/** Delegates to AgentSessionRuntime.setRebindSession(). */\n\tsetRebindSession(rebindSession?: (session: AgentSession) => Promise<void>): void;\n\n\t// --- Current-session projection (bridge to the v1 session face) ---\n\t/**\n\t * The v1 session facade over the runtime's **current** session\n\t * (`createCodingAgentFacade(runtime.session)`), re-derived on every call.\n\t *\n\t * Replacements (newSession/switchSession/fork/importFromJsonl) invalidate the\n\t * previous session, so a facade held across one of them would keep reading a\n\t * dead session — call this accessor again after a replacement instead of\n\t * caching it. Complement to `setRebindSession`: that hook keeps host-held\n\t * *internal* session references fresh (extension binding, host state), while\n\t * this member is the stable-surface way to reach the current session without\n\t * the raw `AgentSession` ever leaving the adapter (D-063).\n\t */\n\tgetSessionFacade(): CodingAgentFacadeV1;\n\n\t// --- Session selector reads (SessionManager statics + instance reads) ---\n\t/**\n\t * Delegates to SessionManager.list(cwd, sessionDir) on the current session's\n\t * manager: sessions of the current cwd/session dir, newest first.\n\t */\n\tlistSessions(onProgress?: SessionListProgress): Promise<SessionInfo[]>;\n\t/**\n\t * Delegates to SessionManager.listAll() on the current session's manager:\n\t * the default session dir when the session uses it, the session's own dir\n\t * otherwise (same branch as the interactive selector).\n\t */\n\tlistAllSessions(onProgress?: SessionListProgress): Promise<SessionInfo[]>;\n\t/** Delegates to SessionManager.getSessionFile() on the current session's manager. */\n\tgetSessionFile(): string | undefined;\n\t/** Delegates to SessionManager.getSessionDir() on the current session's manager. */\n\tgetSessionDir(): string;\n\t/** Delegates to SessionManager.usesDefaultSessionDir() on the current session's manager. */\n\tusesDefaultSessionDir(): boolean;\n\t/** Delegates to SessionManager.isPersisted() on the current session's manager. */\n\tisPersisted(): boolean;\n\t/** Delegates to SessionManager.getSessionId() on the current session's manager. */\n\tgetSessionId(): string;\n}\n\n/**\n * Creates a runtime facade v1 view over one AgentSessionRuntime. Pure wrapper:\n * holds no state of its own. Derive on each access (or after a rebind) so the\n * wrapper always reads the runtime's current session.\n */\nexport function createCodingAgentRuntimeFacade(runtime: AgentSessionRuntime): CodingAgentRuntimeFacadeV1 {\n\tconst sessionManager = () => runtime.session.sessionManager;\n\treturn {\n\t\tversion: 1,\n\t\t// Rest-args forwarding keeps the delegation call-arity identical to a\n\t\t// direct runtime call (optional options are not materialized as\n\t\t// explicit undefined arguments).\n\t\tnewSession: (...args) => runtime.newSession(...args),\n\t\tfork: (...args) => runtime.fork(...args),\n\t\tswitchSession: (...args) => runtime.switchSession(...args),\n\t\timportFromJsonl: (...args) => runtime.importFromJsonl(...args),\n\t\tdispose: () => runtime.dispose(),\n\t\tsetBeforeSessionInvalidate: (beforeSessionInvalidate) =>\n\t\t\truntime.setBeforeSessionInvalidate(beforeSessionInvalidate),\n\t\tsetRebindSession: (rebindSession) => runtime.setRebindSession(rebindSession),\n\t\t// Re-projected per call so the accessor follows the runtime's current session\n\t\t// across replacements (the v1 session facade holds no state of its own).\n\t\tgetSessionFacade: () => createCodingAgentFacade(runtime.session),\n\t\tlistSessions: (onProgress) =>\n\t\t\tSessionManager.list(sessionManager().getCwd(), sessionManager().getSessionDir(), onProgress),\n\t\tlistAllSessions: (onProgress) =>\n\t\t\tsessionManager().usesDefaultSessionDir()\n\t\t\t\t? SessionManager.listAll(onProgress)\n\t\t\t\t: SessionManager.listAll(sessionManager().getSessionDir(), onProgress),\n\t\tgetSessionFile: () => sessionManager().getSessionFile(),\n\t\tgetSessionDir: () => sessionManager().getSessionDir(),\n\t\tusesDefaultSessionDir: () => sessionManager().usesDefaultSessionDir(),\n\t\tisPersisted: () => sessionManager().isPersisted(),\n\t\tgetSessionId: () => sessionManager().getSessionId(),\n\t};\n}\n"]}
1
+ {"version":3,"file":"coding-agent-runtime-facade.js","sourceRoot":"","sources":["../../../src/core/facade/coding-agent-runtime-facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAA4B,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AA4E7F;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,OAA4B,EAA8B;IACxG,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC;IAC5D,OAAO;QACN,OAAO,EAAE,CAAC;QACV,sEAAsE;QACtE,gEAAgE;QAChE,iCAAiC;QACjC,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;QACpD,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACxC,aAAa,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;QAC1D,eAAe,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC;QAC9D,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;QAChC,0BAA0B,EAAE,CAAC,uBAAuB,EAAE,EAAE,CACvD,OAAO,CAAC,0BAA0B,CAAC,uBAAuB,CAAC;QAC5D,gBAAgB,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC;QAC5E,8EAA8E;QAC9E,yEAAyE;QACzE,gBAAgB,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,OAAO,CAAC,OAAO,CAAC;QAChE,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CACpC,cAAc,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,cAAc,EAAE,CAAC,aAAa,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC;QACrG,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CACvC,cAAc,EAAE,CAAC,qBAAqB,EAAE;YACvC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC;YAC5C,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC;QAChF,cAAc,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE;QACvD,aAAa,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE;QACrD,qBAAqB,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,qBAAqB,EAAE;QACrE,WAAW,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,WAAW,EAAE;QACjD,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,YAAY,EAAE;KACnD,CAAC;AAAA,CACF","sourcesContent":["/**\n * Stable runtime facade v1 (阶段 4 slice 3): a versioned surface over\n * AgentSessionRuntime for host session lifecycle orchestration and the static\n * session selector reads.\n *\n * Design: docs/design/稳定门面统一入口设计.md (§3.5 阶段 4 slice 3 runtime 面,\n * D-041). This is an independent versioned contract alongside the frozen\n * `CodingAgentFacadeV1` session face (§3.1): the v1 session face is unchanged,\n * and lifecycle orchestration never belonged on a per-session facade because\n * the runtime owns teardown/rebind ordering across session replacement\n * (session_shutdown → beforeSessionInvalidate → dispose → create → rebind).\n * Every member is a pure delegate onto the wrapped AgentSessionRuntime or the\n * current session's SessionManager (instance reads / static selectors). No new\n * behavior, no policy, no state of its own. SessionManager does leak at two\n * controlled points: the `newSession` `setup` callback receives the new\n * session's `SessionManager` for assembly-time writes — hosts and extensions\n * seed session content (e.g. `appendMessage`) before the runtime applies the\n * built context; deprecated on the extension surface in favor of the\n * CapabilityAPI session surface — and the `setRebindSession` callback receives\n * the internal `AgentSession` instance so hosts can rebind their session\n * references after replacement.\n *\n * D-063 adds the one projection member, `getSessionFacade()`: the v1 session face\n * over the runtime's current session, re-derived per call, so a stable consumer\n * that only needs the active session's facade never touches the raw\n * `AgentSession` and never re-constructs anything after a replacement.\n */\n\nimport type { AgentSession } from \"../agent-session.ts\";\nimport type { AgentSessionRuntime, ReplacedSessionContext } from \"../agent-session-runtime.ts\";\nimport type { SessionInfo, SessionListProgress } from \"../session-manager.ts\";\nimport { SessionManager } from \"../session-manager.ts\";\nimport { type CodingAgentFacadeV1, createCodingAgentFacade } from \"./coding-agent-facade.ts\";\n\n/**\n * Stable runtime facade v1: the consumption surface for host lifecycle\n * orchestration, versioned per repo convention (CodingAgentFacadeV1\n * precedent). New members must extend the facade design doc first (门面腐化\n * guard, 设计 §6).\n */\nexport interface CodingAgentRuntimeFacadeV1 {\n\treadonly version: 1;\n\n\t// --- Lifecycle orchestration (delegates to AgentSessionRuntime verbatim) ---\n\t/** Delegates to AgentSessionRuntime.newSession(). */\n\tnewSession(options?: {\n\t\tparentSession?: string;\n\t\tsetup?: (sessionManager: SessionManager) => Promise<void>;\n\t\twithSession?: (ctx: ReplacedSessionContext) => Promise<void>;\n\t}): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.fork(). */\n\tfork(\n\t\tentryId: string,\n\t\toptions?: { position?: \"before\" | \"at\"; withSession?: (ctx: ReplacedSessionContext) => Promise<void> },\n\t): Promise<{ cancelled: boolean; selectedText?: string }>;\n\t/** Delegates to AgentSessionRuntime.switchSession(). */\n\tswitchSession(\n\t\tsessionPath: string,\n\t\toptions?: { cwdOverride?: string; withSession?: (ctx: ReplacedSessionContext) => Promise<void> },\n\t): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.importFromJsonl(). */\n\timportFromJsonl(inputPath: string, cwdOverride?: string): Promise<{ cancelled: boolean }>;\n\t/** Delegates to AgentSessionRuntime.dispose(). */\n\tdispose(): Promise<void>;\n\t/** Delegates to AgentSessionRuntime.setBeforeSessionInvalidate(). */\n\tsetBeforeSessionInvalidate(beforeSessionInvalidate?: () => void): void;\n\t/** Delegates to AgentSessionRuntime.setRebindSession(). */\n\tsetRebindSession(rebindSession?: (session: AgentSession) => Promise<void>): void;\n\n\t// --- Current-session projection (bridge to the v1 session face) ---\n\t/**\n\t * The v1 session facade over the runtime's **current** session\n\t * (`createCodingAgentFacade(runtime.session)`), re-derived on every call.\n\t *\n\t * Replacements (newSession/switchSession/fork/importFromJsonl) invalidate the\n\t * previous session, so a facade held across one of them would keep reading a\n\t * dead session — call this accessor again after a replacement instead of\n\t * caching it. Complement to `setRebindSession`: that hook keeps host-held\n\t * *internal* session references fresh (extension binding, host state), while\n\t * this member is the stable-surface way to reach the current session without\n\t * the raw `AgentSession` ever leaving the adapter (D-063).\n\t */\n\tgetSessionFacade(): CodingAgentFacadeV1;\n\n\t// --- Session selector reads (SessionManager statics + instance reads) ---\n\t/**\n\t * Delegates to SessionManager.list(cwd, sessionDir) on the current session's\n\t * manager: sessions of the current cwd/session dir, newest first.\n\t */\n\tlistSessions(onProgress?: SessionListProgress, signal?: AbortSignal): Promise<SessionInfo[]>;\n\t/**\n\t * Delegates to SessionManager.listAll() on the current session's manager:\n\t * the default session dir when the session uses it, the session's own dir\n\t * otherwise (same branch as the interactive selector).\n\t */\n\tlistAllSessions(onProgress?: SessionListProgress, signal?: AbortSignal): Promise<SessionInfo[]>;\n\t/** Delegates to SessionManager.getSessionFile() on the current session's manager. */\n\tgetSessionFile(): string | undefined;\n\t/** Delegates to SessionManager.getSessionDir() on the current session's manager. */\n\tgetSessionDir(): string;\n\t/** Delegates to SessionManager.usesDefaultSessionDir() on the current session's manager. */\n\tusesDefaultSessionDir(): boolean;\n\t/** Delegates to SessionManager.isPersisted() on the current session's manager. */\n\tisPersisted(): boolean;\n\t/** Delegates to SessionManager.getSessionId() on the current session's manager. */\n\tgetSessionId(): string;\n}\n\n/**\n * Creates a runtime facade v1 view over one AgentSessionRuntime. Pure wrapper:\n * holds no state of its own. Derive on each access (or after a rebind) so the\n * wrapper always reads the runtime's current session.\n */\nexport function createCodingAgentRuntimeFacade(runtime: AgentSessionRuntime): CodingAgentRuntimeFacadeV1 {\n\tconst sessionManager = () => runtime.session.sessionManager;\n\treturn {\n\t\tversion: 1,\n\t\t// Rest-args forwarding keeps the delegation call-arity identical to a\n\t\t// direct runtime call (optional options are not materialized as\n\t\t// explicit undefined arguments).\n\t\tnewSession: (...args) => runtime.newSession(...args),\n\t\tfork: (...args) => runtime.fork(...args),\n\t\tswitchSession: (...args) => runtime.switchSession(...args),\n\t\timportFromJsonl: (...args) => runtime.importFromJsonl(...args),\n\t\tdispose: () => runtime.dispose(),\n\t\tsetBeforeSessionInvalidate: (beforeSessionInvalidate) =>\n\t\t\truntime.setBeforeSessionInvalidate(beforeSessionInvalidate),\n\t\tsetRebindSession: (rebindSession) => runtime.setRebindSession(rebindSession),\n\t\t// Re-projected per call so the accessor follows the runtime's current session\n\t\t// across replacements (the v1 session facade holds no state of its own).\n\t\tgetSessionFacade: () => createCodingAgentFacade(runtime.session),\n\t\tlistSessions: (onProgress, signal) =>\n\t\t\tSessionManager.list(sessionManager().getCwd(), sessionManager().getSessionDir(), onProgress, signal),\n\t\tlistAllSessions: (onProgress, signal) =>\n\t\t\tsessionManager().usesDefaultSessionDir()\n\t\t\t\t? SessionManager.listAll(onProgress, signal)\n\t\t\t\t: SessionManager.listAll(sessionManager().getSessionDir(), onProgress, signal),\n\t\tgetSessionFile: () => sessionManager().getSessionFile(),\n\t\tgetSessionDir: () => sessionManager().getSessionDir(),\n\t\tusesDefaultSessionDir: () => sessionManager().usesDefaultSessionDir(),\n\t\tisPersisted: () => sessionManager().isPersisted(),\n\t\tgetSessionId: () => sessionManager().getSessionId(),\n\t};\n}\n"]}