@kodax-ai/kodax 0.7.97-alpha.9 → 0.7.97-beta.2

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 (234) hide show
  1. package/CHANGELOG.md +393 -0
  2. package/README.md +170 -29
  3. package/README_CN.md +116 -17
  4. package/config-templates/config.example.jsonc +2 -3
  5. package/dist/artifacts/skills/artifact-review/SKILL.md +44 -7
  6. package/dist/builtin/code-review/SKILL.md +5 -17
  7. package/dist/builtin/git-workflow/SKILL.md +9 -8
  8. package/dist/builtin/skill-creator/SKILL.md +38 -108
  9. package/dist/builtin/skill-creator/references/evaluation.md +50 -0
  10. package/dist/builtin/skill-creator/scripts/analyze-benchmark.d.ts +2 -0
  11. package/dist/builtin/skill-creator/scripts/analyze-benchmark.js +6 -3
  12. package/dist/builtin/skill-creator/scripts/compare-runs.d.ts +2 -0
  13. package/dist/builtin/skill-creator/scripts/compare-runs.js +6 -3
  14. package/dist/builtin/skill-creator/scripts/grade-evals.d.ts +2 -0
  15. package/dist/builtin/skill-creator/scripts/grade-evals.js +6 -3
  16. package/dist/builtin/skill-creator/scripts/run-eval.js +3 -3
  17. package/dist/builtin/skill-creator/scripts/run-loop.js +2 -1
  18. package/dist/builtin/skill-creator/scripts/run-trigger-eval.d.ts +2 -0
  19. package/dist/builtin/skill-creator/scripts/run-trigger-eval.js +3 -1
  20. package/dist/builtin/skill-creator/scripts/utils.d.ts +1 -1
  21. package/dist/builtin/skill-creator/scripts/utils.js +8 -0
  22. package/dist/builtin/tdd/SKILL.md +24 -40
  23. package/dist/builtin/visual-review/SKILL.md +7 -3
  24. package/dist/chunks/agent-DS7M57WD.js +2 -0
  25. package/dist/chunks/agent-adapter-TLWGGK3V.js +2 -0
  26. package/dist/chunks/argument-completer-OGCXKTRQ.js +2 -0
  27. package/dist/chunks/bedrock-native-Z5VNWF5U.js +4 -0
  28. package/dist/chunks/cell-LV7MNPNQ.js +2 -0
  29. package/dist/chunks/chunk-2HH5AS7E.js +1157 -0
  30. package/dist/chunks/chunk-3CP7AUWY.js +2 -0
  31. package/dist/chunks/chunk-45ZP2YHG.js +2 -0
  32. package/dist/chunks/chunk-4Y6U7AH4.js +9 -0
  33. package/dist/chunks/chunk-52EN2777.js +2 -0
  34. package/dist/chunks/{chunk-HXCY52Z2.js → chunk-53CJDQS2.js} +1 -1
  35. package/dist/chunks/{chunk-JNB2FL6P.js → chunk-5MUVRFMU.js} +1 -1
  36. package/dist/chunks/chunk-65652LR4.js +2 -0
  37. package/dist/chunks/chunk-6TITQQAI.js +351 -0
  38. package/dist/chunks/chunk-AGUM5SWX.js +2 -0
  39. package/dist/chunks/chunk-BBZWF2EA.js +2 -0
  40. package/dist/chunks/chunk-C6JGLEYD.js +2 -0
  41. package/dist/chunks/chunk-D36OIMV7.js +142 -0
  42. package/dist/chunks/chunk-D425EZGC.js +2 -0
  43. package/dist/chunks/chunk-D5OW7UD5.js +2 -0
  44. package/dist/chunks/chunk-DCE7XQUG.js +2 -0
  45. package/dist/chunks/chunk-DV5YPYLW.js +10 -0
  46. package/dist/chunks/chunk-EISRVOBJ.js +4 -0
  47. package/dist/chunks/chunk-EPK6EWRI.js +12 -0
  48. package/dist/chunks/chunk-F6GJXQNA.js +29 -0
  49. package/dist/chunks/chunk-GJXOTOZB.js +465 -0
  50. package/dist/chunks/chunk-GZUWQZJD.js +2 -0
  51. package/dist/chunks/chunk-I325ER7D.js +2 -0
  52. package/dist/chunks/chunk-ISLK6R2P.js +2 -0
  53. package/dist/chunks/chunk-J2L2NK6E.js +366 -0
  54. package/dist/chunks/chunk-JAF2YLZO.js +14 -0
  55. package/dist/chunks/chunk-KDLOPBFZ.js +2 -0
  56. package/dist/chunks/chunk-KDSO7V4O.js +5 -0
  57. package/dist/chunks/chunk-KE2NBMAP.js +20 -0
  58. package/dist/chunks/chunk-MCDZNQWD.js +634 -0
  59. package/dist/chunks/chunk-NSR4RW2F.js +3 -0
  60. package/dist/chunks/chunk-OGTRDK4Q.js +359 -0
  61. package/dist/chunks/chunk-P55RJIOG.js +18 -0
  62. package/dist/chunks/chunk-P7OJRV5Z.js +2 -0
  63. package/dist/chunks/chunk-QP47JIWP.js +3 -0
  64. package/dist/chunks/chunk-QSZCR5GC.js +190 -0
  65. package/dist/chunks/chunk-R2HTPDI7.js +2 -0
  66. package/dist/chunks/chunk-R42S4BLA.js +2 -0
  67. package/dist/chunks/chunk-RYBUYHDL.js +5 -0
  68. package/dist/chunks/chunk-SDPZFH6M.js +4 -0
  69. package/dist/chunks/chunk-SK3RRGHJ.js +142 -0
  70. package/dist/chunks/chunk-TQ475LOI.js +2 -0
  71. package/dist/chunks/chunk-UF3GZ5PO.js +2 -0
  72. package/dist/chunks/chunk-UL6YIT4M.js +2 -0
  73. package/dist/chunks/chunk-V2XJSFFE.js +19 -0
  74. package/dist/chunks/chunk-V4WSBIXB.js +2 -0
  75. package/dist/chunks/chunk-V5RCDBKU.js +2 -0
  76. package/dist/chunks/{chunk-FX4R5PB3.js → chunk-W2CWO4PQ.js} +1 -1
  77. package/dist/chunks/chunk-W33QJA3M.js +2 -0
  78. package/dist/chunks/chunk-WMMESRP3.js +9 -0
  79. package/dist/chunks/chunk-WWPVEK6B.js +127 -0
  80. package/dist/chunks/chunk-X5M7TLJV.js +2 -0
  81. package/dist/chunks/chunk-XDMNJW6J.js +42 -0
  82. package/dist/chunks/{chunk-L22BDZGE.js → chunk-XZSFUGPN.js} +1 -1
  83. package/dist/chunks/client-LTIFNED5.js +2 -0
  84. package/dist/chunks/compaction-config-ECMOFP5H.js +2 -0
  85. package/dist/chunks/{construction-bootstrap-XBHM6NON.js → construction-bootstrap-OAZKGI5Y.js} +1 -1
  86. package/dist/chunks/devtools-MVOFT6N7.js +2 -0
  87. package/dist/chunks/devtools-TXYDDL2A.js +2 -0
  88. package/dist/chunks/dist-5J53DGAO.js +2 -0
  89. package/dist/chunks/errors-ER7ZRPWC.js +2 -0
  90. package/dist/chunks/google-native-WLL27OV7.js +2 -0
  91. package/dist/chunks/host-65E5NM5P.js +2 -0
  92. package/dist/chunks/mistral-native-JXPIDDYZ.js +5 -0
  93. package/dist/chunks/model-DZF6URW3.js +2 -0
  94. package/dist/chunks/permission-YVVMLQ5I.js +2 -0
  95. package/dist/chunks/pi-messages-5LLOZH57.js +16 -0
  96. package/dist/chunks/readline-helpers-UZXWBRXQ.js +2 -0
  97. package/dist/chunks/responses-websocket-Y4N5GXD3.js +2 -0
  98. package/dist/chunks/run-manager-ZFACIZM2.js +2 -0
  99. package/dist/chunks/running-session-Q5Y6A2QV.js +2 -0
  100. package/dist/chunks/skills-TJP6BLZJ.js +2 -0
  101. package/dist/chunks/tool-dispatch-MLM3QTSU.js +2 -0
  102. package/dist/chunks/utils-2QNMYRGA.js +2 -0
  103. package/dist/generated-config-templates.json +6 -0
  104. package/dist/index.d.ts +34 -32
  105. package/dist/index.js +6 -6
  106. package/dist/kodax_bootstrap.js +4 -2
  107. package/dist/kodax_cli.js +1755 -2979
  108. package/dist/kodax_doctor.js +3 -0
  109. package/dist/kodax_resume.js +30 -30
  110. package/dist/manual-topics.json +2211 -0
  111. package/dist/native/darwin-arm64/kodax-text-transaction.node +0 -0
  112. package/dist/native/darwin-arm64/manifest.json +1 -1
  113. package/dist/native/win32-x64/kodax-windows-sandbox.exe +0 -0
  114. package/dist/native/win32-x64/kodax-windows-text-transaction.node +0 -0
  115. package/dist/native/win32-x64/manifest.json +2 -2
  116. package/dist/one-shot-task.js +2 -0
  117. package/dist/provider-auth-cli.js +16 -0
  118. package/dist/provider-capabilities.json +560 -40
  119. package/dist/runtime-daemon-schema.json +1 -0
  120. package/dist/sandbox-network-broker.js +260 -795
  121. package/dist/script-cell.js +1 -0
  122. package/dist/script-worker.cjs +2189 -0
  123. package/dist/sdk-a2a.d.ts +23 -22
  124. package/dist/sdk-a2a.js +6 -8
  125. package/dist/sdk-agent.d.ts +125 -98
  126. package/dist/sdk-agent.js +1 -1
  127. package/dist/sdk-client.d.ts +16 -10
  128. package/dist/sdk-client.js +1 -1
  129. package/dist/sdk-coding.d.ts +109 -80
  130. package/dist/sdk-coding.js +1 -1
  131. package/dist/sdk-experimental-memory.d.ts +3 -3
  132. package/dist/sdk-experimental-memory.js +1 -1
  133. package/dist/sdk-llm.d.ts +265 -14
  134. package/dist/sdk-llm.js +1 -1
  135. package/dist/sdk-mcp.d.ts +3 -3
  136. package/dist/sdk-mcp.js +1 -1
  137. package/dist/sdk-media.d.ts +41 -166
  138. package/dist/sdk-media.js +1 -1
  139. package/dist/sdk-repl.d.ts +81 -51
  140. package/dist/sdk-repl.js +2 -2
  141. package/dist/sdk-runtime.d.ts +216 -2989
  142. package/dist/sdk-runtime.js +1 -1
  143. package/dist/sdk-sandbox.js +1 -1
  144. package/dist/sdk-session.d.ts +15 -14
  145. package/dist/sdk-session.js +1 -1
  146. package/dist/sdk-skills.d.ts +2 -2
  147. package/dist/sdk-skills.js +1 -1
  148. package/dist/semantic-worker.js +121 -75
  149. package/dist/static-text.json +371 -0
  150. package/dist/storage-repair-cli.js +3 -0
  151. package/dist/types-chunks/auth-file.d-ovsHEqD4.d.ts +178 -0
  152. package/dist/types-chunks/{bash-prefix-extractor.d-DFH463j2.d.ts → bash-prefix-extractor.d-CJliu5-D.d.ts} +326 -168
  153. package/dist/types-chunks/{capability-learning.d-B4pxKwP4.d.ts → capability-learning.d-BXDEOON2.d.ts} +4 -4
  154. package/dist/types-chunks/{capability.d-DOF3r0fJ.d.ts → capability.d-DapzKxy3.d.ts} +1 -1
  155. package/dist/types-chunks/{capsule.d-CwpmHGFB.d.ts → capsule.d-EMwSALqK.d.ts} +5 -5
  156. package/dist/types-chunks/{client-contract-CRm9ZpL2.d.ts → client-contract-B7q69yMA.d.ts} +265 -67
  157. package/dist/types-chunks/{controller.d-B4GyqWri.d.ts → controller.d-C0SAuNKu.d.ts} +1 -1
  158. package/dist/types-chunks/{controller.d-P3H97ddz.d.ts → controller.d-D-hPLKaA.d.ts} +71 -11
  159. package/dist/types-chunks/{cost-tracker.d-BeaenODW.d.ts → cost-tracker.d-D1CTx-IO.d.ts} +37 -7
  160. package/dist/types-chunks/{base.d-ZBOdjDUT.d.ts → errors.d-D73qdYbS.d.ts} +91 -74
  161. package/dist/types-chunks/{history-retrieval.d-BzKWDjzG.d.ts → history-retrieval.d-BwEUR9cb.d.ts} +2 -2
  162. package/dist/types-chunks/{manager.d-C8OlTe2J.d.ts → manager.d-BMH8Q6TV.d.ts} +1 -1
  163. package/dist/types-chunks/{manifest.d-COreAnXG.d.ts → manifest.d-YE3-AIeO.d.ts} +1 -1
  164. package/dist/types-chunks/{provider-credential-context.d-BH2OaB1b.d.ts → provider-credential-context.d-Dw-sWcnu.d.ts} +11 -2
  165. package/dist/types-chunks/{provider-request-observation.d-C_bEqr4m.d.ts → provider-request-observation.d-CNe9vse3.d.ts} +4 -2
  166. package/dist/types-chunks/{public-api.d-BLmqDi73.d.ts → public-api.d-BhDU643p.d.ts} +13 -10
  167. package/dist/types-chunks/queue-BxQhqhFM.d.ts +166 -0
  168. package/dist/types-chunks/{resolver.d-DLY01RHx.d.ts → resolver.d-DrkpD8wY.d.ts} +142 -103
  169. package/dist/types-chunks/{review-inbox.d-BTLDdpG2.d.ts → review-inbox.d-Bgt46S7L.d.ts} +16 -3
  170. package/dist/types-chunks/{review-packet.d-Crra1Q7t.d.ts → review-packet.d-ChOfJaNI.d.ts} +7 -7
  171. package/dist/types-chunks/{run-manager.d-DmS1edk4.d.ts → run-manager.d-ChzguipG.d.ts} +48 -12
  172. package/dist/types-chunks/{runtime-client-info-BBBxdU8V.d.ts → runtime-client-info-P_mRDG7j.d.ts} +93 -7
  173. package/dist/types-chunks/runtime-event-BW5Pla7a.d.ts +48 -0
  174. package/dist/types-chunks/sdk-runtime-cDe7qmN3.d.ts +2244 -0
  175. package/dist/types-chunks/{sdk-session-DipY_CCd.d.ts → sdk-session-D3pcSbnA.d.ts} +13 -4
  176. package/dist/types-chunks/{sdk-skills-DokfOoJF.d.ts → sdk-skills-C-UA1A6I.d.ts} +3 -1
  177. package/dist/types-chunks/{side-query.d-DTrhVd_r.d.ts → side-query.d-UFKdWSw7.d.ts} +4 -4
  178. package/dist/types-chunks/{types.d-Jxj49rqO.d.ts → skill-invocation-error.d-gsNNDnnt.d.ts} +24 -14
  179. package/dist/types-chunks/task-results.d-XMdWq0eA.d.ts +15 -0
  180. package/dist/types-chunks/{trusted-repl-entry-B1cb7lAn.d.ts → trusted-repl-entry-Bbkd2HlO.d.ts} +10 -10
  181. package/dist/types-chunks/{types.d-BjOq57-z.d.ts → types.d-Bi8iUd6x.d.ts} +248 -4
  182. package/dist/types-chunks/{types.d-NyCB6ztO.d.ts → types.d-BlXTogOo.d.ts} +24 -13
  183. package/dist/types-chunks/types.d-BvEGNdN-.d.ts +131 -0
  184. package/dist/types-chunks/{types.d-Cb8RdrjU.d.ts → types.d-D8qQjMeo.d.ts} +5 -1
  185. package/dist/types-chunks/{utils.d-Bt6USYa5.d.ts → utils.d-CxHyBvO6.d.ts} +11 -7
  186. package/dist/windows-native-scripts.json +5 -0
  187. package/docs/ARTIFACT_SDK.md +8 -0
  188. package/docs/CLIENT_CONTRACT.md +195 -9
  189. package/docs/SDK_MIGRATION.md +887 -2
  190. package/docs/SPACE_SDK_SEAMS.md +255 -2
  191. package/package.json +33 -6
  192. package/public_docs/README.md +27 -2
  193. package/public_docs/configuration/config-files.md +6 -0
  194. package/public_docs/configuration/custom-providers.md +62 -0
  195. package/public_docs/configuration/providers.md +238 -3
  196. package/public_docs/configuration/sandbox.md +30 -0
  197. package/public_docs/getting-started/quickstart.md +10 -1
  198. package/public_docs/sdk/embedder-guide.md +476 -206
  199. package/dist/chunks/agent-C7MMIRIH.js +0 -2
  200. package/dist/chunks/argument-completer-WIQAV5GP.js +0 -2
  201. package/dist/chunks/chunk-2AM3FRQ7.js +0 -137
  202. package/dist/chunks/chunk-2TBKGO2Q.js +0 -497
  203. package/dist/chunks/chunk-35P7QL2Q.js +0 -2
  204. package/dist/chunks/chunk-5DQTOU2E.js +0 -69
  205. package/dist/chunks/chunk-7NH5BGE4.js +0 -350
  206. package/dist/chunks/chunk-AWYO4MH3.js +0 -635
  207. package/dist/chunks/chunk-CIPS75XZ.js +0 -260
  208. package/dist/chunks/chunk-CRQWSDHV.js +0 -429
  209. package/dist/chunks/chunk-HD5BDOPC.js +0 -2
  210. package/dist/chunks/chunk-JXZMES45.js +0 -12
  211. package/dist/chunks/chunk-KJSZTP5N.js +0 -2
  212. package/dist/chunks/chunk-KYHMB6XR.js +0 -431
  213. package/dist/chunks/chunk-ONUPGMER.js +0 -2
  214. package/dist/chunks/chunk-P42PHZWC.js +0 -351
  215. package/dist/chunks/chunk-SHG3EIH5.js +0 -19
  216. package/dist/chunks/chunk-UH6VOCVP.js +0 -2
  217. package/dist/chunks/chunk-V26LAWJY.js +0 -2
  218. package/dist/chunks/chunk-WOHHMGEF.js +0 -394
  219. package/dist/chunks/chunk-WONYJBAA.js +0 -2
  220. package/dist/chunks/chunk-XJWNIFC2.js +0 -298
  221. package/dist/chunks/chunk-XMWTEVFZ.js +0 -1481
  222. package/dist/chunks/chunk-YJTIPSNW.js +0 -22
  223. package/dist/chunks/chunk-YVBBU6K5.js +0 -5
  224. package/dist/chunks/client-XFASU74S.js +0 -2
  225. package/dist/chunks/compaction-config-JZNGDKWW.js +0 -2
  226. package/dist/chunks/devtools-CD6KSIHE.js +0 -2
  227. package/dist/chunks/devtools-XR5F2C6T.js +0 -2
  228. package/dist/chunks/dist-M4HLQAX7.js +0 -2
  229. package/dist/chunks/dist-ZLR4OTDD.js +0 -2
  230. package/dist/chunks/host-EHVJWNGS.js +0 -2
  231. package/dist/chunks/readline-helpers-KIDMSK76.js +0 -2
  232. package/dist/chunks/run-manager-HNGIYMG7.js +0 -2
  233. package/dist/chunks/tool-dispatch-ON33NJR5.js +0 -2
  234. package/dist/chunks/utils-RHR6YHB2.js +0 -2
@@ -1,485 +1,240 @@
1
- import { e as ClientCommandService, a5 as ClientReviewInput, d as ClientCommandResult, c as ClientCommandInput, aq as ClientStatisticsService, I as ClientLifecycleService, an as ClientSessionView, Z as ClientObserveOptions, X as ClientObservation, F as ClientItemReadOptions, E as ClientItemContent, v as ClientHistoryReadOptions, u as ClientHistoryPage, w as ClientHistorySearchInput, x as ClientHistorySearchResult, L as ClientLineageSummary, j as ClientCreateSessionInput, ab as ClientSession, af as ClientSessionFilter, am as ClientSessionSummary, ar as ClientSubmitInput, z as ClientInputAcceptance, A as ClientInteraction, B as ClientInteractionResponse, D as ClientInteractionResult, W as ClientModelSelection, a as ClientCapabilityProbeResult, a2 as ClientProviderInfo, ap as ClientStartupProgress } from './types-chunks/client-contract-CRm9ZpL2.js';
2
- import { i as RuntimeExecutionAuthorization, R as RuntimeClientInfo, c as RuntimeCredentialBinding, g as RuntimeCredentialService, p as RuntimeHostToolService, h as RuntimeDaemonClientType } from './types-chunks/runtime-client-info-BBBxdU8V.js';
3
- export { d as RuntimeCredentialBroker, e as RuntimeCredentialLease, f as RuntimeCredentialRequest, j as RuntimeHostToolDescriptor, k as RuntimeHostToolHandler, l as RuntimeHostToolInvocation, m as RuntimeHostToolInvocationStatus, n as RuntimeHostToolLease, o as RuntimeHostToolResult, q as RuntimeScopedCredentialBroker, r as RuntimeScopedCredentialPurpose, s as RuntimeScopedCredentialRequest, t as RuntimeScopedCredentialTarget } from './types-chunks/runtime-client-info-BBBxdU8V.js';
4
- import { b9 as MemoryManagementController, by as PendingEpisodeReviewSummary, af as KodaXGoalState, aa as KodaXExtensionSessionRecord, w as AgentExecutionKind, N as AgentTreeSnapshot, s as AgentDetail, M as AgentSpawnInput, Q as AgentTurnRef, r as AgentDataClassification, y as AgentFollowupResult, I as AgentOutput, t as AgentEvent } from './types-chunks/review-inbox.d-BTLDdpG2.js';
5
- import { G as KodaXReasoningMode, d as KodaXCustomProviderConfig } from './types-chunks/types.d-BjOq57-z.js';
6
- export { k as KodaXMessage } from './types-chunks/types.d-BjOq57-z.js';
7
- import { b as KodaXContextOverflowFacts } from './types-chunks/base.d-ZBOdjDUT.js';
8
- import { j as AgentDispatchContext, aN as LearningQuery, aM as LearningPage, ax as LearnedCapabilityRecord, aP as LearningSurfaceSnapshot, aI as LearningEvent, aO as LearningSubscribeOptions, s as AgentExecutorFactory, k as AgentDispatchPolicy, i as AgentCredentialBroker, b as AgentArtifactPolicy, ak as KodaXImageInputArtifact, an as KodaXInputArtifactSource, ao as KodaXVideoInputArtifact, bt as WorkflowProcessSnapshot, bm as WorkflowProcessEvent, K as AgentRegistrationService, ac as DispatchableAgentQuery, aa as DispatchableAgentListing, G as AgentPreflightInput, H as AgentPreflightResult } from './types-chunks/types.d-NyCB6ztO.js';
9
- import { h as SkillHooks, i as SkillMetadata } from './types-chunks/types.d-Cb8RdrjU.js';
10
- import { a as McpServerConfig } from './types-chunks/config.d-CJy1WENT.js';
11
- import { t as McpServerStatus, u as McpServerToolList } from './types-chunks/manager.d-C8OlTe2J.js';
12
- import { K as KodaXSessionHistoryHit } from './types-chunks/history-retrieval.d-BzKWDjzG.js';
13
- import { aO as KodaXSkillInvocationContext, aa as KodaXOptions, aB as KodaXShellExecutionContract, X as KodaXExecutionFailure, af as KodaXOutputSegmentProjection, b9 as KodaXToolSandboxObservationUpdate, b7 as KodaXToolEventMeta, a3 as KodaXManagedTaskStatusEvent, W as KodaXEvents, at as KodaXResult, T as KodaXContextOptions, ai as KodaXOutputSegmentStarted, K as KodaXActivityEventMeta, bk as KodaXTurnStartedEvent, bh as KodaXTurnCompletedEvent, bj as KodaXTurnFailedEvent, bP as RuntimeContextBudgetSnapshot, al as KodaXPromptCacheDiagnosticEvent, bW as RuntimeToolExposurePlan, $ as KodaXLiveEventMeta, O as KodaXCompactionEndResult, bM as RuntimeCompactionSkippedEvent, R as KodaXContextCompactionFinishedEvent, S as KodaXContextIdentity } from './types-chunks/bash-prefix-extractor.d-DFH463j2.js';
14
- import { L as LoadedExtensionDiagnostic, v as ExtensionRuntimeDiagnostics } from './types-chunks/types.d-Jxj49rqO.js';
15
- import { W as ExecPolicyRuleInput, h as AutoModeDecisionDiagnostics, r as AutoModeStats, a4 as ManagedWorkflowSnapshot, al as WorkflowRunProcessMetadata } from './types-chunks/run-manager.d-DmS1edk4.js';
16
- import { Y as saveConfig, d as CommandInfo } from './types-chunks/utils.d-Bt6USYa5.js';
17
- import { n as FullTranscriptSessionData, ak as SessionTranscriptEntry, a5 as SessionConversationHistoryData, a9 as SessionConversationHistoryStatus, a7 as SessionConversationHistoryIssue, a6 as SessionConversationHistoryEntry, e as CompactSessionResult } from './types-chunks/public-api.d-BLmqDi73.js';
18
- import './types-chunks/provider-request-observation.d-C_bEqr4m.js';
19
- import './types-chunks/provider-credential-context.d-BH2OaB1b.js';
20
- import './types-chunks/capability.d-DOF3r0fJ.js';
21
- import 'vscode-languageserver-protocol';
22
- import './types-chunks/controller.d-P3H97ddz.js';
1
+ import { i as OAuthSessionStore, d as OAuthLoginInput, e as OAuthLoginResult, c as OAuthCredentialSession, K as KodaXCloudCredential, F as FileProviderCredentialStore, m as ProviderCredentialFileBinding, a as KodaXCloudCredentialResolution } from './types-chunks/auth-file.d-ovsHEqD4.js';
2
+ import { a as KodaXClientHostAuthorization, B as RuntimeScopedCredentialRequest, e as RuntimeCredentialBinding, i as RuntimeCredentialService } from './types-chunks/runtime-client-info-P_mRDG7j.js';
3
+ export { b as KodaXClientHostServices, R as RuntimeBusinessBinding, d as RuntimeClientInfo, f as RuntimeCredentialBroker, g as RuntimeCredentialLease, h as RuntimeCredentialRequest, j as RuntimeDaemonClientType, k as RuntimeDefaultSkill, l as RuntimeExecutionAuthorization, m as RuntimeExecutionBindingRequest, n as RuntimeExecutionBindingResolver, o as RuntimeExecutionBindingService, p as RuntimeExecutionBindingSnapshot, s as RuntimeHostToolDescriptor, t as RuntimeHostToolHandler, u as RuntimeHostToolInvocation, v as RuntimeHostToolInvocationStatus, w as RuntimeHostToolLease, x as RuntimeHostToolResult, y as RuntimeHostToolService, z as RuntimeScopedCredentialBroker, A as RuntimeScopedCredentialPurpose, C as RuntimeScopedCredentialTarget } from './types-chunks/runtime-client-info-P_mRDG7j.js';
4
+ import { i as KodaXCustomProviderConfig } from './types-chunks/types.d-Bi8iUd6x.js';
5
+ export { v as KodaXMessage } from './types-chunks/types.d-Bi8iUd6x.js';
6
+ import { aj as RuntimeDaemonMethod, al as RuntimeDaemonNotificationMethod, K as KODAX_DAEMON_PROTOCOL, b as KODAX_DAEMON_PROTOCOL_VERSION } from './types-chunks/sdk-runtime-cDe7qmN3.js';
7
+ export { C as ConnectKodaXRuntimeOptions, a as CreateKodaXRuntimeOptions, c as KODAX_RUNTIME_SDK_CAPABILITIES, d as KodaXDaemonRuntime, e as KodaXRuntime, f as KodaXRuntimeIsolation, g as KodaXRuntimeMode, R as RUNTIME_DAEMON_METHODS, h as RUNTIME_REDIRECT_STOP_REASON, i as RuntimeActiveAgentTurn, j as RuntimeActiveToolProjection, k as RuntimeAdminService, l as RuntimeAgentBindingService, m as RuntimeAgentFollowupOptions, n as RuntimeAgentOperationOptions, o as RuntimeAgentOwnerSession, p as RuntimeAgentService, q as RuntimeAppendNoticeInput, r as RuntimeArtifact, s as RuntimeArtifactKind, t as RuntimeArtifactRefInput, u as RuntimeArtifactService, v as RuntimeAutoModeConfigurationError, w as RuntimeAutoReviewOptions, x as RuntimeBoundDefaultAgent, y as RuntimeBoundLocalAgent, z as RuntimeBuildIdentity, A as RuntimeCapabilityRequirements, B as RuntimeCatalogService, D as RuntimeClientCapabilities, E as RuntimeCommandInfo, F as RuntimeCommandResolveInput, G as RuntimeCompactSessionInput, H as RuntimeCompactSessionResult, I as RuntimeCompactionReasoning, J as RuntimeConfigPatch, L as RuntimeConfigReloadResult, M as RuntimeConfigService, N as RuntimeConfirmIdentityAliasInput, O as RuntimeConnectionService, P as RuntimeConnectionState, Q as RuntimeContextCompactionEndedEventPayload, S as RuntimeContextCompactionFinishedEventPayload, T as RuntimeContextCompactionMessagesEventPayload, U as RuntimeContextCompactionSkippedEventPayload, V as RuntimeContextCompactionStartedEventPayload, W as RuntimeContextCompactionStatsEventPayload, X as RuntimeContextRecoveryWait, Y as RuntimeContinuationStatus, Z as RuntimeConversationHistory, _ as RuntimeConversationHistoryBoundary, $ as RuntimeConversationHistoryEntryChunk, a0 as RuntimeConversationHistoryEntryChunkInput, a1 as RuntimeConversationHistoryPageInput, a2 as RuntimeConversationHistorySlice, a3 as RuntimeConversationHistorySliceEntry, a4 as RuntimeCreateArtifactInput, a5 as RuntimeCreateSessionInput, a6 as RuntimeDaemonCapabilityUpgradeError, a7 as RuntimeDaemonClientSnapshot, a8 as RuntimeDaemonClientTransport, a9 as RuntimeDaemonContextOptions, aa as RuntimeDaemonDisconnectCode, ab as RuntimeDaemonDisconnectError, ac as RuntimeDaemonEndpoint, ad as RuntimeDaemonError, ae as RuntimeDaemonErrorCode, af as RuntimeDaemonFrame, ag as RuntimeDaemonKodaXOptions, ah as RuntimeDaemonManagementService, ai as RuntimeDaemonManagementState, ak as RuntimeDaemonNotification, am as RuntimeDaemonPreflight, an as RuntimeDaemonRequest, ao as RuntimeDaemonRequestControl, ap as RuntimeDaemonRunService, aq as RuntimeDaemonStartRunInput, ar as RuntimeDaemonTransportLifecycleState, as as RuntimeDefaultAgentStartInput, at as RuntimeDeliveredInterruptInput, au as RuntimeEffectiveConfigEntry, av as RuntimeEffectiveConfigSnapshot, aw as RuntimeEffectiveConfigSource, ax as RuntimeEffectiveCredentialEntry, ay as RuntimeEffectiveSkillRef, az as RuntimeEvent, aA as RuntimeEventEnvelope, aB as RuntimeEventFilter, aC as RuntimeEventListener, aD as RuntimeEventParseResult, aE as RuntimeEventPayloadMap, aF as RuntimeEventService, aG as RuntimeEventType, aH as RuntimeExactCallPermissionMatcher, aI as RuntimeExactCommandPermissionMatcher, aJ as RuntimeExactPathPermissionMatcher, aK as RuntimeExecPolicyOptions, aL as RuntimeExecutionToolPolicy, aM as RuntimeExtensionListResult, aN as RuntimeExtensionReloadResult, aP as RuntimeFailureDetail, aQ as RuntimeFailureStage, aR as RuntimeFileInput, aS as RuntimeForkSessionInput, aT as RuntimeGrantedScope, aU as RuntimeHostMigrationRequiredError, aV as RuntimeIdentity, aW as RuntimeImageInput, aX as RuntimeInput, aY as RuntimeIntegrationDiagnostic, aZ as RuntimeIntegrationDomainStatus, a_ as RuntimeIntegrationHealth, a$ as RuntimeInteractionResolvedEventPayload, b0 as RuntimeInteractionService, b1 as RuntimeInterruptInputStatus, b2 as RuntimeInvocationService, b3 as RuntimeKodaXOptions, b4 as RuntimeLearningService, b5 as RuntimeLocalAgentStartInput, b6 as RuntimeManagedTaskProjection, b7 as RuntimeMcpReloadResult, b8 as RuntimeMcpService, b9 as RuntimeMcpToolListFilter, ba as RuntimeMcpValidateResult, bb as RuntimeMemoryPlane, bc as RuntimeMemoryRebuildResult, bd as RuntimeMemoryService, be as RuntimeModelListFilter, bf as RuntimeObservationInvalidation, bg as RuntimeOutputSegmentStartedEventPayload, bh as RuntimeOwnerIdentity, bi as RuntimeOwnerPolicyState, bj as RuntimeOwnerState, bk as RuntimePendingUserInputProjection, bl as RuntimePermissionBroker, bm as RuntimePermissionDecision, bn as RuntimePermissionFilter, bo as RuntimePermissionGrant, bp as RuntimePermissionGrantChangedEventPayload, bq as RuntimePermissionGrantSuggestion, br as RuntimePermissionHostPlatform, bs as RuntimePermissionMatcher, bt as RuntimePermissionMode, bu as RuntimePermissionModeInput, bv as RuntimePermissionPrompt, bw as RuntimePermissionPromptContext, bx as RuntimePermissionPromptResolution, by as RuntimePermissionRequest, bz as RuntimePermissionRequestInput, bA as RuntimePermissionRespondOptions, bB as RuntimePermissionRisk, bC as RuntimePermissionScope, bD as RuntimePermissionScopeUpgradeRequiredError, bE as RuntimePermissionService, bF as RuntimePromoteSessionInput, bG as RuntimeProviderErrorCode, bH as RuntimeReadOptions, bI as RuntimeRecoverRunInput, bJ as RuntimeRecoverSessionInput, bK as RuntimeResolvedLocalAgent, bL as RuntimeRewindSessionInput, bM as RuntimeRunFailureKind, bN as RuntimeRunFilter, bO as RuntimeRunHandle, bP as RuntimeRunInputDeliveredEventPayload, bQ as RuntimeRunInputQueuedEventPayload, bR as RuntimeRunLifecycleError, bS as RuntimeRunMode, bT as RuntimeRunPhase, bU as RuntimeRunProgressEventPayload, bV as RuntimeRunRequirements, bW as RuntimeRunResult, bX as RuntimeRunService, bY as RuntimeRunSessionLoadedEventPayload, bZ as RuntimeRunStage, b_ as RuntimeRunStatus, b$ as RuntimeRunStopReceipt, c0 as RuntimeRunStopStatus, c1 as RuntimeSession, c2 as RuntimeSessionCancelInput, c3 as RuntimeSessionCancelReceipt, c4 as RuntimeSessionDiagnosticError, c5 as RuntimeSessionDiagnosticErrorCode, c6 as RuntimeSessionDiagnosticRun, c7 as RuntimeSessionDiagnostics, c8 as RuntimeSessionDiagnosticsInput, c9 as RuntimeSessionFilter, ca as RuntimeSessionLiveProjection, cb as RuntimeSessionLoadedEventPayload, cc as RuntimeSessionObservation, cd as RuntimeSessionObservationSnapshot, ce as RuntimeSessionObserveOptions, cf as RuntimeSessionPromotionResult, cg as RuntimeSessionService, ch as RuntimeSessionSettings, ci as RuntimeSessionSettingsPatch, cj as RuntimeSessionSettingsUpdatedEventPayload, ck as RuntimeSessionStatus, cl as RuntimeSessionSummary, cm as RuntimeSetActiveEntryInput, cn as RuntimeSkillDescribeInput, co as RuntimeSkillDescription, cp as RuntimeSkillFileSummary, cq as RuntimeSkillListFilter, cr as RuntimeSkillSummary, cs as RuntimeStartRunInput, ct as RuntimeStatusService, cu as RuntimeStatusSnapshot, cv as RuntimeSubmitInput, cw as RuntimeSubmitInputResult, cx as RuntimeSubscription, cy as RuntimeTerminalCode, cz as RuntimeTerminalFact, cA as RuntimeTextDeltaEventPayload, cB as RuntimeTextInput, cC as RuntimeThinkingFinishedEventPayload, cD as RuntimeTodoUpdatedEventPayload, cE as RuntimeToolFinishedEventPayload, cF as RuntimeToolProgressEventPayload, cG as RuntimeToolSandboxEventPayload, cH as RuntimeToolStartedEventPayload, cI as RuntimeTranscript, cJ as RuntimeTranscriptEntryChunk, cK as RuntimeTranscriptEntryChunkInput, cL as RuntimeTranscriptPageInput, cM as RuntimeTranscriptSearchHit, cN as RuntimeTranscriptSearchInput, cO as RuntimeTranscriptSearchResult, cP as RuntimeTranscriptSlice, cQ as RuntimeTranscriptSliceEntry, cR as RuntimeTransportBoundaryError, cS as RuntimeTypedEvent, cT as RuntimeTypedEventListener, cU as RuntimeUserInputFilter, cV as RuntimeUserInputKind, cW as RuntimeUserInputRequest, cX as RuntimeUserInputRequestedEventPayload, cY as RuntimeUserInputResolution, cZ as RuntimeUserInputService, c_ as RuntimeUserMarkdownAgentRef, c$ as RuntimeVersionedUpdateOptions, d0 as RuntimeVersionedValue, d1 as RuntimeVideoInput, d2 as RuntimeWarningEventPayload, d3 as RuntimeWorkflowFilter, d4 as RuntimeWorkflowListener, d5 as RuntimeWorkflowService, d6 as RuntimeWorkflowSnapshot, d7 as RuntimeWorkflowStartInput, d8 as RuntimeWorkflowStartResult, d9 as RuntimeWorkflowStartSource, da as RuntimeWorkflowSummary, db as RuntimeWorkspaceBinding, dc as captureRuntimeSessionDiagnostics, dd as connectKodaXRuntime, de as createKodaXRuntime, df as ensureKodaXRuntime, dg as getKodaXRuntimeOwnerState, dh as handleRuntimePermissionRequest, di as isRuntimeDaemonDisconnectError } from './types-chunks/sdk-runtime-cDe7qmN3.js';
8
+ export { ax as ClientStartupProgress } from './types-chunks/client-contract-B7q69yMA.js';
9
+ export { W as KodaXEvents, am as KodaXPromptCacheDiagnosticEvent, au as KodaXResult, bR as RuntimeContextBudgetSnapshot, bY as RuntimeToolExposurePlan } from './types-chunks/bash-prefix-extractor.d-CJliu5-D.js';
10
+ export { R as RuntimeDaemonShutdownVerification, a as RuntimeDaemonShutdownVerificationInput, b as RuntimeDaemonShutdownVerificationOwner, p as parseRuntimeEvent, w as waitForRuntimeDaemonShutdown } from './types-chunks/runtime-event-BW5Pla7a.js';
11
+ export { ak as SessionTranscriptEntry } from './types-chunks/public-api.d-BhDU643p.js';
12
+ import './types-chunks/review-inbox.d-Bgt46S7L.js';
13
+ import './types-chunks/errors.d-D73qdYbS.js';
14
+ import './types-chunks/types.d-BlXTogOo.js';
15
+ import './types-chunks/types.d-D8qQjMeo.js';
16
+ import './types-chunks/config.d-CJy1WENT.js';
17
+ import './types-chunks/manager.d-BMH8Q6TV.js';
18
+ import './types-chunks/capability.d-DapzKxy3.js';
19
+ import './types-chunks/history-retrieval.d-BwEUR9cb.js';
20
+ import './types-chunks/skill-invocation-error.d-gsNNDnnt.js';
21
+ import './types-chunks/controller.d-D-hPLKaA.js';
23
22
  import 'node:child_process';
24
- import './types-chunks/cost-tracker.d-BeaenODW.js';
25
- import './types-chunks/types-DDJu9iWX.js';
26
- import './types-chunks/side-query.d-DTrhVd_r.js';
27
- import './types-chunks/manifest.d-COreAnXG.js';
23
+ import './types-chunks/run-manager.d-ChzguipG.js';
24
+ import './types-chunks/cost-tracker.d-D1CTx-IO.js';
25
+ import './types-chunks/side-query.d-UFKdWSw7.js';
26
+ import './types-chunks/provider-credential-context.d-Dw-sWcnu.js';
27
+ import './types-chunks/manifest.d-YE3-AIeO.js';
28
+ import './types-chunks/utils.d-CxHyBvO6.js';
28
29
  import 'readline';
29
30
  import 'child_process';
31
+ import './types-chunks/provider-request-observation.d-CNe9vse3.js';
32
+ import './types-chunks/task-results.d-XMdWq0eA.js';
33
+ import 'vscode-languageserver-protocol';
34
+ import './types-chunks/types-DDJu9iWX.js';
30
35
 
31
- interface RuntimeBuildIdentity {
32
- readonly origin: string;
33
- readonly fingerprint: string;
34
- }
36
+ declare function providerOAuthStore(configPath: string): OAuthSessionStore;
37
+ /** Import only a linked registration. Retain the encrypted source for interrupted upgrades and rollback. */
38
+ declare function migrateProviderOAuthRegistration(input: {
39
+ readonly configPath: string;
40
+ readonly registrationId: string;
41
+ readonly legacyStore?: OAuthSessionStore;
42
+ }): Promise<'current' | 'absent' | 'migrated'>;
35
43
 
36
- type RuntimePreparedReview = {
37
- readonly kind: "prepared";
38
- readonly invocation: {
39
- readonly prompt: string;
40
- readonly source: "prompt";
41
- readonly displayName: string;
42
- };
43
- } | {
44
- readonly kind: "workflow";
45
- readonly workflow: {
46
- readonly request: string;
47
- readonly displayName: string;
48
- readonly builtinName: "scoped-review";
49
- readonly builtinArgs: Record<string, unknown>;
50
- };
51
- } | {
52
- readonly kind: "empty";
44
+ type StorageRepairTarget = {
45
+ readonly kind: 'runtime-agent-ledger' | 'runtime-agent-snapshot';
46
+ readonly root: string;
47
+ readonly taskId: string;
53
48
  } | {
54
- readonly kind: "error";
55
- readonly message: string;
56
- };
57
- type RuntimePreparedAgentsLean = {
58
- readonly kind: "prepared";
59
- readonly invocation: {
60
- readonly prompt: string;
61
- readonly source: "prompt";
62
- readonly displayName: string;
63
- };
49
+ readonly kind: 'extension' | 'a2a';
50
+ readonly root: string;
64
51
  } | {
65
- readonly kind: "missing";
66
- };
67
-
68
- interface RuntimePreparedSkillInvocation {
69
- readonly prompt: string;
70
- readonly source: "skill";
71
- readonly displayName: string;
52
+ readonly kind: 'lock';
53
+ readonly root: string;
72
54
  readonly path: string;
73
- readonly disableModelInvocation?: boolean;
74
- readonly allowedTools?: string;
75
- readonly context?: "fork";
76
- readonly agent?: string;
77
- readonly argumentHint?: string;
78
- readonly model?: string;
79
- readonly hooks?: SkillHooks;
80
- readonly skillInvocation: Omit<KodaXSkillInvocationContext, "runtimePolicy"> & {
81
- readonly runtimePolicy: {
82
- readonly enforceAtRuntime: true;
83
- };
84
- };
85
- }
86
- type RuntimePreparedSkill = {
87
- readonly kind: "prepared";
88
- readonly invocation: RuntimePreparedSkillInvocation;
89
- } | {
90
- readonly kind: "unknown";
91
- };
92
- /** FEATURE_298 T37 — discovered prompt-command preparation projection. */
93
- interface RuntimePreparedCommandInvocation {
94
- readonly prompt: string;
95
- readonly source: "prompt";
96
- readonly displayName: string;
97
- readonly path?: string;
98
- readonly disableModelInvocation?: boolean;
99
- readonly userInvocable?: boolean;
100
- readonly allowedTools?: string;
101
- readonly context?: "fork";
102
- readonly agent?: string;
103
- readonly argumentHint?: string;
104
- readonly model?: string;
105
- readonly hooks?: SkillHooks;
106
- readonly frontmatter?: Record<string, unknown>;
107
- }
108
- type RuntimePreparedCommand = {
109
- readonly kind: "prepared";
110
- readonly invocation: RuntimePreparedCommandInvocation;
111
- }
112
- /** Registry-known non-prompt commands have no discovered prompt to prepare. */
113
- | {
114
- readonly kind: "local";
115
- } | {
116
- readonly kind: "unknown";
117
55
  };
118
- interface RuntimeInvocationService {
119
- prepareSkill(input: {
120
- readonly projectRoot: string;
121
- readonly name: string;
122
- readonly argumentsText?: string;
123
- readonly sessionId?: string;
124
- }, options?: {
125
- readonly signal?: AbortSignal;
126
- }): Promise<RuntimePreparedSkill>;
127
- prepareCommand(input: {
128
- readonly projectRoot: string;
129
- readonly name: string;
130
- }): Promise<RuntimePreparedCommand>;
131
- /** FEATURE_298 T37 — /review preparation (git capture + packets Host-side). */
132
- prepareReview(input: {
133
- readonly projectRoot: string;
134
- readonly sessionId: string;
135
- readonly args: readonly string[];
136
- }): Promise<RuntimePreparedReview>;
137
- /** FEATURE_298 T37 — /agents lean prompt preparation. */
138
- prepareAgentsLean(input: {
139
- readonly projectRoot: string;
140
- }): Promise<RuntimePreparedAgentsLean>;
141
- }
142
-
143
- interface RuntimeProductCommandService {
144
- readCommandPrompt: ClientCommandService['readPrompt'];
145
- startReview(input: ClientReviewInput & {
146
- readonly authorization?: RuntimeExecutionAuthorization;
147
- }): Promise<ClientCommandResult>;
148
- startAgentsLean(input: Omit<ClientReviewInput, 'args'> & {
149
- readonly authorization?: RuntimeExecutionAuthorization;
150
- }): Promise<ClientCommandResult>;
151
- executeCommand(input: ClientCommandInput & {
152
- readonly authorization?: RuntimeExecutionAuthorization;
153
- }): Promise<ClientCommandResult>;
154
- }
155
-
156
- type RuntimePermissionHostPlatform = 'win32' | 'posix';
157
- interface RuntimePermissionMatcherBase {
56
+ interface Snapshot {
57
+ type: 'file' | 'directory';
58
+ sha256: string;
59
+ bytes: number;
60
+ dev: number;
61
+ ino: number;
62
+ mtimeMs: number;
63
+ }
64
+ interface StorageRepairPlan {
158
65
  readonly version: 1;
159
- readonly toolName: string;
160
- readonly fingerprint: string;
161
- }
162
- interface RuntimeExactCommandPermissionMatcher extends RuntimePermissionMatcherBase {
163
- readonly kind: 'exact-command';
164
- readonly shell: 'cmd' | 'posix' | 'powershell';
165
- /** Hash of the host-owned interpreter/environment contract, when configured. */
166
- readonly shellContractFingerprint?: string;
167
- /** SHA-256 of the normalized concrete command; raw command text is never persisted. */
168
- readonly commandFingerprint: string;
169
- readonly cwd: string;
170
- readonly executable?: string;
171
- readonly argvFingerprint?: string;
172
- readonly background: boolean;
173
- }
174
- interface RuntimeExactPathPermissionMatcher extends RuntimePermissionMatcherBase {
175
- readonly kind: 'exact-path';
176
- readonly path: string;
177
- }
178
- interface RuntimeExactCallPermissionMatcher extends RuntimePermissionMatcherBase {
179
- readonly kind: 'exact-call';
180
- readonly cwd: string;
181
- readonly inputFingerprint: string;
182
- }
183
- type RuntimePermissionMatcher = RuntimeExactCommandPermissionMatcher | RuntimeExactPathPermissionMatcher | RuntimeExactCallPermissionMatcher;
184
-
185
- interface RuntimeUserMarkdownAgentRef {
186
- readonly source: 'markdown:user';
187
- readonly name: string;
188
- }
189
- interface RuntimeEffectiveSkillRef {
190
- readonly name: string;
191
- readonly source: 'workspace' | 'user' | 'plugin' | 'builtin' | 'learned';
192
- readonly revision: string;
193
- }
194
- type RuntimeWorkspaceBinding = {
195
- readonly mode: 'managed';
196
- } | {
197
- readonly mode: 'fixed';
198
- readonly root: string;
199
- };
200
- interface RuntimeExecutionToolPolicy {
201
- readonly workspace: 'none' | 'read' | 'write';
202
- readonly process: 'deny' | 'isolated';
203
- readonly network: {
204
- readonly mode: 'deny';
205
- } | {
206
- readonly mode: 'allowlist';
207
- readonly origins: readonly string[];
66
+ readonly id: string;
67
+ readonly target: StorageRepairTarget;
68
+ readonly file: string;
69
+ readonly source: Snapshot;
70
+ readonly diagnosis: {
71
+ state: string;
72
+ validPrefixBytes?: number;
208
73
  };
209
- readonly tools: readonly string[];
210
- readonly mcp: Readonly<Record<string, readonly string[]>>;
211
- readonly skillScripts: Readonly<Record<string, readonly string[]>>;
212
- readonly subagents: 'deny' | 'inherit';
213
- /** Exact names of materialized host tools (capability ids host:<leaseId>:<toolName>) admitted by this policy. */
214
- readonly hostTools?: readonly string[];
215
- }
216
- interface RuntimeResolvedLocalAgent {
217
- readonly ref: RuntimeUserMarkdownAgentRef;
218
- readonly agentId: string;
219
- readonly displayName: string;
220
- readonly description: string;
221
- readonly configurationRevision: string;
222
- readonly effectiveSkills: readonly RuntimeEffectiveSkillRef[];
223
- readonly skillSetRevision: string;
224
- }
225
- interface RuntimeAgentOwnerSession {
226
- readonly ownerSessionId: string;
227
- }
228
- interface RuntimeBoundDefaultAgent {
229
- readonly ownerSessionId: string;
230
- readonly bindingId: string;
231
- readonly executionPolicyRevision: string;
232
- readonly toolPolicyRevision: string;
233
- readonly workspaceBindingRevision: string;
234
- readonly skillSetRevision: string;
235
- readonly effectiveSkills: readonly RuntimeEffectiveSkillRef[];
236
- readonly effectiveTools: readonly string[];
237
- }
238
- interface RuntimeBoundLocalAgent extends RuntimeResolvedLocalAgent {
239
- readonly ownerSessionId: string;
240
- readonly bindingId: string;
241
- readonly executionPolicyRevision: string;
242
- readonly toolPolicyRevision: string;
243
- readonly workspaceBindingRevision: string;
244
- readonly effectiveTools: readonly string[];
245
- }
246
- interface RuntimeAgentStartBase {
247
- readonly ownerSessionId: string;
248
- readonly bindingId: string;
249
- readonly expectedExecutionPolicyRevision: string;
250
- readonly sessionId: string;
251
- readonly input: RuntimeInput | readonly RuntimeInput[];
252
- readonly permissionBroker?: RuntimePermissionBroker;
253
- readonly agentContext?: AgentDispatchContext;
254
- }
255
- interface RuntimeDefaultAgentStartInput extends RuntimeAgentStartBase {
256
- }
257
- interface RuntimeLocalAgentStartInput extends RuntimeAgentStartBase {
258
- readonly expectedConfigurationRevision: string;
259
- }
260
- interface RuntimeAgentBindingService {
261
- resolveLocal(input: {
262
- readonly ref: RuntimeUserMarkdownAgentRef;
263
- readonly workspace: RuntimeWorkspaceBinding;
264
- }): Promise<RuntimeResolvedLocalAgent>;
265
- openOwnerSession(): Promise<RuntimeAgentOwnerSession>;
266
- bindDefault(input: {
267
- readonly ownerSessionId: string;
268
- readonly profileId?: string;
269
- readonly workspace: RuntimeWorkspaceBinding;
270
- readonly toolPolicy: RuntimeExecutionToolPolicy;
271
- readonly expectedExecutionPolicyRevision?: string;
272
- readonly workspaceByteLimit?: number;
273
- }): Promise<RuntimeBoundDefaultAgent>;
274
- startDefault(input: RuntimeDefaultAgentStartInput): Promise<RuntimeRunHandle>;
275
- bindLocal(input: {
276
- readonly ownerSessionId: string;
277
- readonly ref: RuntimeUserMarkdownAgentRef;
278
- readonly profileId?: string;
279
- readonly workspace: RuntimeWorkspaceBinding;
280
- readonly toolPolicy: RuntimeExecutionToolPolicy;
281
- readonly expectedConfigurationRevision?: string;
282
- readonly expectedExecutionPolicyRevision?: string;
283
- readonly workspaceByteLimit?: number;
284
- }): Promise<RuntimeBoundLocalAgent>;
285
- startLocal(input: RuntimeLocalAgentStartInput): Promise<RuntimeRunHandle>;
286
- prepareWorkspace(input: {
287
- readonly ownerSessionId: string;
288
- readonly bindingId: string;
289
- readonly contextKey: string;
290
- }): Promise<string>;
291
- releaseBinding(input: {
292
- readonly ownerSessionId: string;
293
- readonly bindingId: string;
294
- }): Promise<void>;
295
- closeOwnerSession(ownerSessionId: string): Promise<void>;
296
- }
297
-
298
- interface RuntimeLearningSubscription extends AsyncIterableIterator<LearningEvent> {
299
- /** Registration only; read a snapshot after awaiting ready. */
300
- readonly ready: Promise<void>;
301
- }
302
- interface RuntimeLearningService {
303
- list(query?: LearningQuery): Promise<LearningPage>;
304
- get(nameOrSlugOrId: string): Promise<LearnedCapabilityRecord>;
305
- getSnapshot(): Promise<LearningSurfaceSnapshot>;
306
- events(afterRevision?: number): Promise<readonly LearningEvent[]>;
307
- subscribe(options?: LearningSubscribeOptions): RuntimeLearningSubscription;
308
- acknowledge(nameOrSlugOrId: string): Promise<void>;
309
- snooze(nameOrSlugOrId: string, until: string): Promise<void>;
310
- reject(nameOrSlugOrId: string): Promise<void>;
311
- disable(nameOrSlugOrId: string): Promise<void>;
312
- rollback(nameOrSlugOrId: string): Promise<void>;
313
- promote(nameOrSlugOrId: string, scope: 'user'): Promise<void>;
314
- review(nameOrSlugOrId: string): Promise<void>;
315
- trust(nameOrSlugOrId: string): Promise<void>;
316
74
  }
317
-
75
+ interface StorageRepairReceipt {
76
+ readonly version: 1;
77
+ readonly plan: StorageRepairPlan;
78
+ readonly backup: string;
79
+ readonly candidateSha256?: string;
80
+ readonly fence?: string;
81
+ readonly completed: boolean;
82
+ readonly reclamationClaim?: string;
83
+ readonly verified?: true;
84
+ }
85
+ /** Read-only local Main/SDK maintenance. Plans contain metadata, never stored values or credentials. */
86
+ declare function inspectStorageRepair(target: StorageRepairTarget): StorageRepairPlan;
87
+ declare function inspectStorageRepairCandidate(file: string): {
88
+ path: string;
89
+ sha256: string;
90
+ bytes: number;
91
+ };
318
92
  /**
319
- * FEATURE_298 T36 — the Host-owned Memory management surface. Callers name a
320
- * project root; the Host derives the Memory identity itself (the same
321
- * derivation the run path uses) and owns the storage root, the control
322
- * plane, index rebuilds, and open-target resolution. The UI keeps only
323
- * presentation and the editor launch.
93
+ * Explicit offline repair, never a model tool. The acknowledgement is an operator
94
+ * prerequisite for every shared writer, especially unverifiable/unfenced owners;
95
+ * it is not a programmatic proof they stopped.
96
+ * Cooperating current writers are excluded by their actual storage lock.
324
97
  */
325
- interface RuntimeMemoryRebuildResult {
326
- readonly status: "missing-dir" | "no-topics" | "rebuilt";
327
- readonly memoryRoot: string;
328
- readonly entrypointPath: string;
329
- readonly entryCount: number;
330
- readonly malformedFiles: readonly string[];
331
- readonly warnings: readonly string[];
332
- }
333
- type RuntimeMemoryController = Pick<MemoryManagementController, "listInbox" | "showProposal" | "approveProposal" | "rejectProposal" | "listRefs" | "readRef" | "remember" | "forgetRef">;
334
- interface RuntimeMemoryPlane {
335
- readonly controller: RuntimeMemoryController;
336
- readonly memoryRoot: string;
337
- readonly entrypointPath: string;
338
- /** Pending episode reviews for the identities this project actually reads. */
339
- listReviews(): Promise<readonly PendingEpisodeReviewSummary[]>;
340
- /** Whether the Host's Memory reviewer Provider is usable. */
341
- reviewerProviderConfigured(): boolean;
342
- /** Rebuild the derived MEMORY.md index; topic files are never modified. */
343
- rebuild(): Promise<RuntimeMemoryRebuildResult>;
344
- /**
345
- * Validate a `/memory open` target against the project memory root
346
- * (mkdir of the untouched root is Host-owned; realpath containment blocks
347
- * escapes). The editor launch itself stays in the UI.
348
- */
349
- ensureOpenTarget(targetPath: string): Promise<string>;
350
- }
351
- interface RuntimeMemoryService {
352
- forProject(projectRoot: string): RuntimeMemoryPlane | Promise<RuntimeMemoryPlane>;
353
- }
98
+ declare function applyStorageRepair(plan: StorageRepairPlan, options: {
99
+ readonly allWritersStopped: boolean;
100
+ readonly candidate?: {
101
+ readonly path: string;
102
+ readonly sha256: string;
103
+ };
104
+ }): Promise<StorageRepairReceipt>;
105
+ /** Trusted operator/Main confirmation of the exact restored state; never inferred by an LLM or from a TTL. */
106
+ declare function confirmStorageRepair(receipt: StorageRepairReceipt, options: {
107
+ readonly allWritersStopped: boolean;
108
+ readonly verifiedCurrentState: boolean;
109
+ }): Promise<StorageRepairReceipt>;
354
110
 
355
- declare const KODAX_DAEMON_PROTOCOL = "kodax-runtime-daemon";
356
- declare const KODAX_DAEMON_PROTOCOL_VERSION = 1;
357
- type RuntimeDaemonMethod = 'initialize' | 'runtime.initialize' | 'ping' | 'runtime.identity' | 'runtime.status' | 'runtime.shutdown' | 'client.exit.request' | 'client.exit.read' | 'client.exit.pending' | 'session.facts.read' | 'session.facts.requests' | 'session.facts.tools' | 'runtime.capabilities' | 'daemon.status' | 'daemon.stop' | 'daemon.logs' | 'daemon.preflight' | 'daemon.management.get' | 'session.create' | 'session.load' | 'session.list' | 'session.status' | 'session.transcript' | 'session.transcript.page' | 'session.transcript.entryChunk' | 'session.transcript.search' | 'session.conversation' | 'session.conversation.page' | 'session.conversation.entryChunk' | 'session.observe' | 'session.view.observe' | 'session.view.close' | 'session.view.item' | 'session.diagnostics' | 'session.fork' | 'session.recover' | 'session.notice.append' | 'session.goal.get' | 'session.lineage.get' | 'session.lineage.label' | 'session.goal.create' | 'session.goal.pause' | 'session.goal.resume' | 'session.goal.clear' | 'session.rewind' | 'session.identityAlias.confirm' | 'session.active_entry.set' | 'session.activeEntry.set' | 'session.compact' | 'session.archive' | 'session.unarchive' | 'session.cancel' | 'session.delete' | 'session.settings.get' | 'session.settings.getVersioned' | 'session.autoMode.getStats' | 'session.settings.update' | 'session.settings.updateVersioned' | 'input.submit' | 'input.withdraw' | 'run.start' | 'run.input.submit' | 'input.read' | 'run.get' | 'run.list' | 'run.await' | 'run.abort' | 'run.model.set' | 'run.provider.set' | 'run.reasoning.set' | 'run.setModel' | 'run.setProvider' | 'run.setReasoning' | 'request.cancel' | 'request.ack' | 'subscription.close' | 'permission.grants.list' | 'permission.grants.revoke' | 'interaction.list' | 'interaction.respond' | 'credential.register' | 'credential.get' | 'credential.revoke' | 'credential.supply' | 'host_tool.register' | 'host_tool.get' | 'host_tool.invocation.get' | 'host_tool.revoke' | 'host_tool.complete' | 'workflow.list' | 'workflow.get' | 'workflow.subscribe' | 'workflow.unsubscribe' | 'workflow.pause' | 'workflow.resume' | 'workflow.stop' | 'workflow.start' | 'learning.list' | 'learning.get' | 'learning.snapshot' | 'learning.events' | 'learning.subscribe' | 'learning.unsubscribe' | 'learning.acknowledge' | 'learning.snooze' | 'learning.reject' | 'learning.disable' | 'learning.rollback' | 'learning.promote' | 'learning.review' | 'learning.trust' | 'config.read' | 'config.effective' | 'config.patch' | 'config.reload' | 'model.list' | 'provider.list' | 'provider.reasoning.efforts' | 'provider.reasoning.probe' | 'provider.capabilities.forget' | 'provider.custom.list' | 'provider.custom.upsert' | 'provider.custom.remove' | 'mcp.server.list' | 'mcp.server.status' | 'mcp.server.get' | 'mcp.server.validate' | 'mcp.server.upsert' | 'mcp.server.delete' | 'mcp.server.remove' | 'mcp.server.reload' | 'mcp.tool.list' | 'extension.list' | 'extension.reload' | 'command.list' | 'command.resolve' | 'skill.list' | 'skill.describe' | 'skill.read' | 'memory.describe' | 'memory.listReviews' | 'memory.listInbox' | 'memory.showProposal' | 'memory.listRefs' | 'memory.readRef' | 'memory.remember' | 'memory.forgetRef' | 'memory.approveProposal' | 'memory.rejectProposal' | 'memory.rebuild' | 'memory.ensureOpenTarget' | 'invocations.prepareSkill' | 'invocations.prepareCommand' | 'invocations.readCommandPrompt' | 'invocations.executeCommand' | 'invocations.startReview' | 'invocations.startAgentsLean' | 'invocations.prepareReview' | 'invocations.prepareAgentsLean' | 'artifact.create' | 'artifact.get' | 'artifact.delete' | 'agentRegistrations.list' | 'agentRegistrations.upsert' | 'agentRegistrations.setEnabled' | 'agentRegistrations.remove' | 'agents.listDispatchable' | 'agents.describe' | 'agents.preflight' | 'agents.tree' | 'agents.detail' | 'agents.spawn' | 'agents.send' | 'agents.followup' | 'agents.interrupt' | 'agents.output' | 'agents.events' | 'agents.wait';
358
- type RuntimeDaemonRetiredMethod = 'permission.request' | 'permission.list' | 'permission.listPending' | 'permission.respond' | 'user_input.listPending' | 'user_input.respond' | 'user_input.dismiss' | 'agentTasks.list' | 'agentTasks.start' | 'agentTasks.get' | 'agentTasks.events' | 'agentTasks.wait' | 'agentTasks.sendInput' | 'agentTasks.cancel' | 'agentTasks.reconcile';
359
- type RuntimeDaemonWireMethod = RuntimeDaemonMethod | RuntimeDaemonRetiredMethod;
360
- type RuntimeDaemonNotificationMethod = 'subscription.error' | 'session.view' | 'event' | 'observation.invalidated' | 'credential.request' | 'host_tool.invoke' | 'runtime.warning';
361
- interface RuntimeDaemonError {
362
- readonly code: RuntimeDaemonErrorCode;
363
- readonly message: string;
364
- readonly data?: unknown;
365
- }
366
- type RuntimeDaemonErrorCode = 'invalid_frame' | 'invalid_request' | 'invalid_params' | 'not_initialized' | 'method_not_found' | 'unauthorized' | 'permission_denied' | 'conflict' | 'not_found' | 'session_not_admitted' | 'cancelled' | 'overloaded' | 'client_upgrade_required' | 'resync_required' | 'read_timeout' | 'read_cancelled' | 'data_changed' | 'observation_invalidated' | 'runtime_changed' | 'data_corrupt' | 'version_incompatible' | 'credential_unavailable' | 'host_tool_unavailable' | 'host_tool_unknown' | 'internal_error';
367
- interface RuntimeDaemonFrameBase {
368
- readonly protocol: typeof KODAX_DAEMON_PROTOCOL;
369
- readonly version: typeof KODAX_DAEMON_PROTOCOL_VERSION;
370
- }
371
- interface RuntimeDaemonRequest<Method extends RuntimeDaemonWireMethod = RuntimeDaemonMethod> extends RuntimeDaemonFrameBase {
372
- readonly kind: 'request';
373
- readonly id: string;
374
- readonly method: Method;
375
- readonly params?: unknown;
376
- }
377
- interface RuntimeDaemonSuccessResponse extends RuntimeDaemonFrameBase {
378
- readonly kind: 'response';
379
- readonly id: string;
380
- readonly result: unknown;
381
- }
382
- interface RuntimeDaemonErrorResponse extends RuntimeDaemonFrameBase {
383
- readonly kind: 'error';
384
- readonly id?: string;
385
- readonly error: RuntimeDaemonError;
386
- }
387
- interface RuntimeDaemonNotification extends RuntimeDaemonFrameBase {
388
- readonly kind: 'notification';
389
- readonly method: RuntimeDaemonNotificationMethod;
390
- readonly params?: unknown;
391
- }
392
- type RuntimeDaemonFrame = RuntimeDaemonRequest<RuntimeDaemonWireMethod> | RuntimeDaemonSuccessResponse | RuntimeDaemonErrorResponse | RuntimeDaemonNotification;
393
- declare const RUNTIME_DAEMON_METHODS: readonly RuntimeDaemonMethod[];
111
+ interface ProviderOAuthLoginInput extends Omit<OAuthLoginInput, 'redirectUri'> {
112
+ readonly redirectUri?: string;
113
+ readonly store: OAuthSessionStore;
114
+ readonly profile?: string;
115
+ readonly browser?: (authorization: {
116
+ authorizationUrl: string;
117
+ signal?: AbortSignal;
118
+ }) => Promise<string>;
119
+ readonly device?: (authorization: {
120
+ verificationUri: string;
121
+ userCode: string;
122
+ expiresAt: number;
123
+ }) => Promise<void>;
124
+ /** Optional trusted issuer-specific validation; otherwise isolate the authenticated grant, without claiming a user identity. */
125
+ readonly verifyIdentity?: (result: OAuthLoginResult, context: {
126
+ service: OAuthLoginInput['service'];
127
+ clientId: string;
128
+ nonce?: string;
129
+ signal?: AbortSignal;
130
+ }) => Promise<string>;
131
+ }
132
+ /** Real PKCE/device login using the caller's issued registration, secure commit before publication. */
133
+ declare function loginProviderOAuth(input: ProviderOAuthLoginInput): Promise<{
134
+ registrationId: string;
135
+ accountId: string;
136
+ identityKind: "account" | "grant" | undefined;
137
+ session: OAuthCredentialSession;
138
+ }>;
394
139
 
395
- interface RuntimeDaemonClientTransport {
396
- request(method: RuntimeDaemonMethod, params?: unknown, control?: RuntimeDaemonRequestControl): Promise<unknown>;
397
- subscribe(listener: (notification: RuntimeDaemonNotification) => void): RuntimeSubscription;
398
- subscribeLifecycle?(listener: (state: RuntimeDaemonTransportLifecycleState) => void): RuntimeSubscription;
399
- close?(): Promise<void> | void;
400
- }
401
- interface RuntimeDaemonRequestControl {
402
- readonly signal?: AbortSignal;
403
- }
404
- /** Factual state for one daemon connection; disconnected does not imply daemon crash. */
405
- interface RuntimeDaemonTransportLifecycleState {
406
- readonly state: 'connected' | 'disconnected';
407
- readonly connectionId: string;
408
- readonly code?: RuntimeDaemonDisconnectCode;
409
- readonly reason?: string;
410
- readonly reconnectable: boolean;
411
- }
412
- /** Transport-observable close reason. Run/daemon crash classification needs durable evidence. */
413
- type RuntimeDaemonDisconnectCode = 'protocol_closed' | 'transport_error' | 'invalid_frame' | 'client_closed';
414
- declare class RuntimeTransportBoundaryError extends Error {
415
- readonly path: string;
416
- readonly code: "invalid_transport_value";
417
- constructor(path: string, message: string);
418
- }
419
- declare class RuntimePermissionScopeUpgradeRequiredError extends Error {
420
- readonly code: "daemon_upgrade_required";
421
- readonly capability: "runtimeAutoModeGuardrail";
422
- readonly requiredVersion: 3;
423
- readonly restartRequired: true;
424
- constructor();
425
- }
140
+ /** Supply an OS/user-bound authenticated sealer; no plaintext fallback is provided. */
141
+ interface OAuthSessionSealer {
142
+ seal(plaintext: Uint8Array): Promise<Uint8Array>;
143
+ unseal(ciphertext: Uint8Array): Promise<Uint8Array>;
144
+ }
145
+ /** Lock is held over refresh and durable commit, including across independent Main processes. */
146
+ declare function createEncryptedOAuthSessionStore(directory: string, sealer: OAuthSessionSealer): OAuthSessionStore;
147
+ declare function createWindowsOAuthSessionStore(directory: string): OAuthSessionStore;
426
148
 
427
- interface RuntimeDaemonShutdownOutcome {
428
- readonly version: 1;
429
- readonly runtimeId: string;
430
- readonly pid: number;
431
- readonly status: 'succeeded' | 'failed';
432
- readonly completedAt: string;
433
- readonly error?: string;
434
- }
149
+ /** Explicit trusted-Main opt-in. The daemon never starts an ambient credential chain. */
150
+ declare function createNativeCloudCredentialResolver(connection: KodaXCustomProviderConfig, environment?: () => Readonly<Record<string, string | undefined>>): (signal: AbortSignal) => Promise<KodaXCloudCredential>;
435
151
 
436
- interface RuntimeDaemonShutdownVerificationOwner {
437
- readonly runtimeId: string;
438
- readonly pid: number;
439
- readonly kind?: 'daemon' | 'inline';
440
- readonly processStartIdentity?: string;
441
- readonly processContainment?: 'windows-job';
442
- readonly supervisorPid?: number;
443
- readonly supervisorProcessStartIdentity?: string;
444
- }
445
- interface RuntimeDaemonShutdownVerificationInput {
446
- readonly configHome: string;
152
+ type ProviderCredentialSource = {
153
+ readonly provider: string;
154
+ readonly connectionFingerprint?: string;
447
155
  readonly profile?: string;
448
- readonly owner: RuntimeDaemonShutdownVerificationOwner;
449
- readonly timeoutMs?: number;
450
- readonly pollIntervalMs?: number;
451
- }
452
- type RuntimeDaemonShutdownVerification = {
453
- readonly status: 'succeeded' | 'failed';
454
- readonly outcome: RuntimeDaemonShutdownOutcome;
156
+ } & ({
157
+ readonly kind: 'external';
455
158
  } | {
456
- readonly status: 'replacement_running';
457
- readonly runtimeId: string;
458
- readonly pid: number;
159
+ readonly kind: 'environment';
160
+ readonly apiKeyEnv: string;
459
161
  } | {
460
- readonly status: 'unverified';
461
- readonly reason: 'daemon_active' | 'containment_active' | 'containment_unavailable' | 'outcome_missing';
462
- };
463
- /**
464
- * Verify one exact daemon shutdown from its durable outcome and process fence.
465
- * This is deliberately a quit-path API: it performs no steady-state polling.
466
- */
467
- declare function waitForRuntimeDaemonShutdown(input: RuntimeDaemonShutdownVerificationInput): Promise<RuntimeDaemonShutdownVerification>;
162
+ readonly kind: 'api-key';
163
+ readonly apiKeyEnv: string;
164
+ readonly store: FileProviderCredentialStore;
165
+ readonly binding: ProviderCredentialFileBinding;
166
+ readonly connectionFingerprint: string;
167
+ } | {
168
+ readonly kind: 'oauth';
169
+ readonly session: Pick<OAuthCredentialSession, 'service' | 'profile' | 'issuer' | 'acquire' | 'onInvalidate' | 'replayIdentity' | 'recoverRejectedCredential'>;
170
+ readonly service: NonNullable<KodaXCustomProviderConfig['oauth']>;
171
+ readonly profile?: string;
172
+ readonly issuer?: string;
173
+ } | {
174
+ readonly kind: 'cloud';
175
+ readonly connection: KodaXCustomProviderConfig;
176
+ readonly resolve: (request: RuntimeScopedCredentialRequest, signal: AbortSignal) => Promise<KodaXCloudCredentialResolution>;
177
+ });
178
+ interface ProviderCredentialAuthorizer {
179
+ readonly authorizeExecution: KodaXClientHostAuthorization;
180
+ close(): Promise<void>;
181
+ }
182
+ /** Trusted Main only. Sources are an explicit allowlist, never supplied by Product/model input. */
183
+ declare function createProviderCredentialAuthorizer(input: {
184
+ readonly sources: readonly ProviderCredentialSource[];
185
+ readonly environment?: () => Readonly<Record<string, string | undefined>>;
186
+ }): ProviderCredentialAuthorizer;
468
187
 
469
- interface RuntimeDaemonEndpoint {
470
- readonly kind: 'pipe' | 'unix';
471
- readonly path: string;
188
+ interface ProviderCredentialStatus {
189
+ readonly binding: ProviderCredentialFileBinding;
190
+ readonly configRevision: string;
191
+ readonly revision: string | null;
192
+ readonly apiKeyEnv: string;
193
+ readonly stored: boolean;
194
+ readonly configured: boolean;
195
+ readonly source: 'file' | 'environment' | 'cloud' | 'oauth' | 'external' | 'missing';
196
+ }
197
+ interface ProviderCredentialManager {
198
+ readonly filePath: string;
199
+ describe(provider: string): Promise<ProviderCredentialStatus>;
200
+ setApiKey(provider: string, key: string, expected: ProviderCredentialStatus): Promise<ProviderCredentialStatus>;
201
+ removeApiKey(provider: string, expected: ProviderCredentialStatus): Promise<ProviderCredentialStatus>;
202
+ }
203
+ /** Trusted Main facade: UI may write a Key and inspect status, never read its original value. */
204
+ declare function createProviderCredentialManager(input?: {
205
+ readonly configPath?: string;
206
+ readonly profile?: string;
207
+ readonly environment?: () => Readonly<Record<string, string | undefined>>;
208
+ }): ProviderCredentialManager;
209
+
210
+ interface RuntimeRequestCredentialBinding {
211
+ readonly credential: Extract<RuntimeCredentialBinding, {
212
+ mode: 'scoped';
213
+ }>;
214
+ close(): Promise<void>;
472
215
  }
473
- /** Pending RPC failure enriched with the same facts published by the lifecycle stream. */
474
- declare class RuntimeDaemonDisconnectError extends Error {
475
- readonly code: RuntimeDaemonDisconnectCode;
476
- readonly connectionId: string;
477
- readonly reconnectable: boolean;
478
- constructor(message: string, code: RuntimeDaemonDisconnectCode, connectionId: string, reconnectable: boolean, options?: ErrorOptions);
216
+
217
+ interface RuntimeOAuthCredentialBinding extends RuntimeRequestCredentialBinding {
218
+ switchAccount(session: OAuthCredentialSession): Promise<RuntimeOAuthCredentialBinding>;
479
219
  }
480
- declare function isRuntimeDaemonDisconnectError(error: unknown): error is RuntimeDaemonDisconnectError;
220
+ /**
221
+ * Trusted host adapter for the existing v2 broker. Refresh tokens remain in the
222
+ * host store. After Host restart call this again with the new credential service;
223
+ * persisted lease IDs are deliberately not resumed as fresh authority.
224
+ */
225
+ declare function bindOAuthCredentials(input: {
226
+ credentials: RuntimeCredentialService;
227
+ provider: Pick<KodaXCustomProviderConfig, 'name' | 'oauth'>;
228
+ session: OAuthCredentialSession;
229
+ }): Promise<RuntimeOAuthCredentialBinding>;
481
230
 
482
- declare function parseRuntimeEvent(value: unknown): RuntimeEventParseResult;
231
+ type RuntimeCloudCredentialBinding = RuntimeRequestCredentialBinding;
232
+ /** Trusted host may resolve ADC, Workload Identity, AWS profiles/STS or Entra using its own SDK provider. */
233
+ declare function bindCloudCredentials(input: {
234
+ credentials: RuntimeCredentialService;
235
+ provider: KodaXCustomProviderConfig;
236
+ resolve(request: RuntimeScopedCredentialRequest, signal: AbortSignal): Promise<KodaXCloudCredentialResolution>;
237
+ }): Promise<RuntimeCloudCredentialBinding>;
483
238
 
484
239
  type RuntimeDaemonJsonSchemaType = 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string';
485
240
  interface RuntimeDaemonJsonSchema {
@@ -505,2539 +260,11 @@ interface RuntimeDaemonProtocolSchema {
505
260
  readonly methods: Record<RuntimeDaemonMethod, RuntimeDaemonMethodSchema>;
506
261
  readonly notifications: Record<RuntimeDaemonNotificationMethod, RuntimeDaemonJsonSchema>;
507
262
  }
508
- declare const RUNTIME_DAEMON_METHOD_SCHEMAS: {
509
- initialize: {
510
- params: RuntimeDaemonJsonSchema;
511
- result: RuntimeDaemonJsonSchema;
512
- };
513
- 'runtime.initialize': {
514
- params: RuntimeDaemonJsonSchema;
515
- result: RuntimeDaemonJsonSchema;
516
- };
517
- ping: {
518
- params: RuntimeDaemonJsonSchema;
519
- result: RuntimeDaemonJsonSchema;
520
- };
521
- 'runtime.identity': {
522
- params: RuntimeDaemonJsonSchema;
523
- result: RuntimeDaemonJsonSchema;
524
- };
525
- 'runtime.status': {
526
- params: RuntimeDaemonJsonSchema;
527
- result: RuntimeDaemonJsonSchema;
528
- };
529
- 'runtime.shutdown': {
530
- params: RuntimeDaemonJsonSchema;
531
- result: RuntimeDaemonJsonSchema;
532
- };
533
- 'client.exit.request': {
534
- params: RuntimeDaemonJsonSchema;
535
- result: RuntimeDaemonJsonSchema;
536
- };
537
- 'client.exit.read': {
538
- params: RuntimeDaemonJsonSchema;
539
- result: RuntimeDaemonJsonSchema;
540
- };
541
- 'client.exit.pending': {
542
- params: RuntimeDaemonJsonSchema;
543
- result: RuntimeDaemonJsonSchema;
544
- };
545
- 'session.facts.read': {
546
- params: RuntimeDaemonJsonSchema;
547
- result: RuntimeDaemonJsonSchema;
548
- };
549
- 'session.facts.requests': {
550
- params: RuntimeDaemonJsonSchema;
551
- result: RuntimeDaemonJsonSchema;
552
- };
553
- 'session.facts.tools': {
554
- params: RuntimeDaemonJsonSchema;
555
- result: RuntimeDaemonJsonSchema;
556
- };
557
- 'runtime.capabilities': {
558
- params: RuntimeDaemonJsonSchema;
559
- result: RuntimeDaemonJsonSchema;
560
- };
561
- 'daemon.status': {
562
- params: RuntimeDaemonJsonSchema;
563
- result: RuntimeDaemonJsonSchema;
564
- };
565
- 'daemon.stop': {
566
- params: RuntimeDaemonJsonSchema;
567
- result: RuntimeDaemonJsonSchema;
568
- };
569
- 'daemon.logs': {
570
- params: RuntimeDaemonJsonSchema;
571
- result: RuntimeDaemonJsonSchema;
572
- };
573
- 'daemon.preflight': {
574
- params: RuntimeDaemonJsonSchema;
575
- result: RuntimeDaemonJsonSchema;
576
- };
577
- 'daemon.management.get': {
578
- params: RuntimeDaemonJsonSchema;
579
- result: RuntimeDaemonJsonSchema;
580
- };
581
- 'session.create': {
582
- params: RuntimeDaemonJsonSchema;
583
- result: RuntimeDaemonJsonSchema;
584
- };
585
- 'session.load': {
586
- params: RuntimeDaemonJsonSchema;
587
- result: RuntimeDaemonJsonSchema;
588
- };
589
- 'session.list': {
590
- params: RuntimeDaemonJsonSchema;
591
- result: RuntimeDaemonJsonSchema;
592
- };
593
- 'session.status': {
594
- params: RuntimeDaemonJsonSchema;
595
- result: RuntimeDaemonJsonSchema;
596
- };
597
- 'session.transcript': {
598
- params: RuntimeDaemonJsonSchema;
599
- result: RuntimeDaemonJsonSchema;
600
- };
601
- 'session.transcript.page': {
602
- params: RuntimeDaemonJsonSchema;
603
- result: RuntimeDaemonJsonSchema;
604
- };
605
- 'session.transcript.entryChunk': {
606
- params: RuntimeDaemonJsonSchema;
607
- result: RuntimeDaemonJsonSchema;
608
- };
609
- 'session.transcript.search': {
610
- params: RuntimeDaemonJsonSchema;
611
- result: RuntimeDaemonJsonSchema;
612
- };
613
- 'session.observe': {
614
- params: RuntimeDaemonJsonSchema;
615
- result: RuntimeDaemonJsonSchema;
616
- };
617
- 'session.view.observe': {
618
- params: RuntimeDaemonJsonSchema;
619
- result: RuntimeDaemonJsonSchema;
620
- };
621
- 'session.view.close': {
622
- params: RuntimeDaemonJsonSchema;
623
- result: RuntimeDaemonJsonSchema;
624
- };
625
- 'session.view.item': {
626
- params: RuntimeDaemonJsonSchema;
627
- result: RuntimeDaemonJsonSchema;
628
- };
629
- 'session.conversation': {
630
- params: RuntimeDaemonJsonSchema;
631
- result: RuntimeDaemonJsonSchema;
632
- };
633
- 'session.conversation.page': {
634
- params: RuntimeDaemonJsonSchema;
635
- result: RuntimeDaemonJsonSchema;
636
- };
637
- 'session.conversation.entryChunk': {
638
- params: RuntimeDaemonJsonSchema;
639
- result: RuntimeDaemonJsonSchema;
640
- };
641
- 'session.diagnostics': {
642
- params: RuntimeDaemonJsonSchema;
643
- result: RuntimeDaemonJsonSchema;
644
- };
645
- 'session.fork': {
646
- params: RuntimeDaemonJsonSchema;
647
- result: RuntimeDaemonJsonSchema;
648
- };
649
- 'session.recover': {
650
- params: RuntimeDaemonJsonSchema;
651
- result: RuntimeDaemonJsonSchema;
652
- };
653
- 'session.goal.get': {
654
- params: RuntimeDaemonJsonSchema;
655
- result: RuntimeDaemonJsonSchema;
656
- };
657
- 'session.lineage.get': {
658
- params: RuntimeDaemonJsonSchema;
659
- result: RuntimeDaemonJsonSchema;
660
- };
661
- 'session.lineage.label': {
662
- params: RuntimeDaemonJsonSchema;
663
- result: RuntimeDaemonJsonSchema;
664
- };
665
- 'session.goal.create': {
666
- params: RuntimeDaemonJsonSchema;
667
- result: RuntimeDaemonJsonSchema;
668
- };
669
- 'session.goal.pause': {
670
- params: RuntimeDaemonJsonSchema;
671
- result: RuntimeDaemonJsonSchema;
672
- };
673
- 'session.goal.resume': {
674
- params: RuntimeDaemonJsonSchema;
675
- result: RuntimeDaemonJsonSchema;
676
- };
677
- 'session.goal.clear': {
678
- params: RuntimeDaemonJsonSchema;
679
- result: RuntimeDaemonJsonSchema;
680
- };
681
- 'session.notice.append': {
682
- params: RuntimeDaemonJsonSchema;
683
- result: RuntimeDaemonJsonSchema;
684
- };
685
- 'session.identityAlias.confirm': {
686
- params: RuntimeDaemonJsonSchema;
687
- result: RuntimeDaemonJsonSchema;
688
- };
689
- 'session.rewind': {
690
- params: RuntimeDaemonJsonSchema;
691
- result: RuntimeDaemonJsonSchema;
692
- };
693
- 'session.active_entry.set': {
694
- params: RuntimeDaemonJsonSchema;
695
- result: RuntimeDaemonJsonSchema;
696
- };
697
- 'session.activeEntry.set': {
698
- params: RuntimeDaemonJsonSchema;
699
- result: RuntimeDaemonJsonSchema;
700
- };
701
- 'session.compact': {
702
- params: RuntimeDaemonJsonSchema;
703
- result: RuntimeDaemonJsonSchema;
704
- };
705
- 'session.archive': {
706
- params: RuntimeDaemonJsonSchema;
707
- result: RuntimeDaemonJsonSchema;
708
- };
709
- 'session.unarchive': {
710
- params: RuntimeDaemonJsonSchema;
711
- result: RuntimeDaemonJsonSchema;
712
- };
713
- 'session.delete': {
714
- params: RuntimeDaemonJsonSchema;
715
- result: RuntimeDaemonJsonSchema;
716
- };
717
- 'session.settings.get': {
718
- params: RuntimeDaemonJsonSchema;
719
- result: RuntimeDaemonJsonSchema;
720
- };
721
- 'session.settings.getVersioned': {
722
- params: RuntimeDaemonJsonSchema;
723
- result: RuntimeDaemonJsonSchema;
724
- };
725
- 'session.autoMode.getStats': {
726
- params: RuntimeDaemonJsonSchema;
727
- result: RuntimeDaemonJsonSchema;
728
- };
729
- 'session.settings.update': {
730
- params: RuntimeDaemonJsonSchema;
731
- result: RuntimeDaemonJsonSchema;
732
- };
733
- 'session.settings.updateVersioned': {
734
- params: RuntimeDaemonJsonSchema;
735
- result: RuntimeDaemonJsonSchema;
736
- };
737
- 'input.submit': {
738
- params: RuntimeDaemonJsonSchema;
739
- result: RuntimeDaemonJsonSchema;
740
- };
741
- 'input.withdraw': {
742
- params: RuntimeDaemonJsonSchema;
743
- result: RuntimeDaemonJsonSchema;
744
- };
745
- 'input.read': {
746
- params: RuntimeDaemonJsonSchema;
747
- result: RuntimeDaemonJsonSchema;
748
- };
749
- 'run.start': {
750
- params: RuntimeDaemonJsonSchema;
751
- result: RuntimeDaemonJsonSchema;
752
- };
753
- 'run.input.submit': {
754
- params: RuntimeDaemonJsonSchema;
755
- result: RuntimeDaemonJsonSchema;
756
- };
757
- 'run.get': {
758
- params: RuntimeDaemonJsonSchema;
759
- result: RuntimeDaemonJsonSchema;
760
- };
761
- 'run.list': {
762
- params: RuntimeDaemonJsonSchema;
763
- result: RuntimeDaemonJsonSchema;
764
- };
765
- 'run.await': {
766
- params: RuntimeDaemonJsonSchema;
767
- result: RuntimeDaemonJsonSchema;
768
- };
769
- 'run.abort': {
770
- params: RuntimeDaemonJsonSchema;
771
- result: RuntimeDaemonJsonSchema;
772
- };
773
- 'session.cancel': {
774
- params: RuntimeDaemonJsonSchema;
775
- result: RuntimeDaemonJsonSchema;
776
- };
777
- 'run.model.set': {
778
- params: RuntimeDaemonJsonSchema;
779
- result: RuntimeDaemonJsonSchema;
780
- };
781
- 'run.provider.set': {
782
- params: RuntimeDaemonJsonSchema;
783
- result: RuntimeDaemonJsonSchema;
784
- };
785
- 'run.reasoning.set': {
786
- params: RuntimeDaemonJsonSchema;
787
- result: RuntimeDaemonJsonSchema;
788
- };
789
- 'run.setModel': {
790
- params: RuntimeDaemonJsonSchema;
791
- result: RuntimeDaemonJsonSchema;
792
- };
793
- 'run.setProvider': {
794
- params: RuntimeDaemonJsonSchema;
795
- result: RuntimeDaemonJsonSchema;
796
- };
797
- 'run.setReasoning': {
798
- params: RuntimeDaemonJsonSchema;
799
- result: RuntimeDaemonJsonSchema;
800
- };
801
- 'request.cancel': {
802
- params: RuntimeDaemonJsonSchema;
803
- result: RuntimeDaemonJsonSchema;
804
- };
805
- 'request.ack': {
806
- params: RuntimeDaemonJsonSchema;
807
- result: RuntimeDaemonJsonSchema;
808
- };
809
- 'subscription.close': {
810
- params: RuntimeDaemonJsonSchema;
811
- result: RuntimeDaemonJsonSchema;
812
- };
813
- 'permission.grants.list': {
814
- params: RuntimeDaemonJsonSchema;
815
- result: RuntimeDaemonJsonSchema;
816
- };
817
- 'permission.grants.revoke': {
818
- params: RuntimeDaemonJsonSchema;
819
- result: RuntimeDaemonJsonSchema;
820
- };
821
- 'interaction.list': {
822
- params: RuntimeDaemonJsonSchema;
823
- result: RuntimeDaemonJsonSchema;
824
- };
825
- 'interaction.respond': {
826
- params: RuntimeDaemonJsonSchema;
827
- result: RuntimeDaemonJsonSchema;
828
- };
829
- 'credential.register': {
830
- params: RuntimeDaemonJsonSchema;
831
- result: RuntimeDaemonJsonSchema;
832
- };
833
- 'credential.get': {
834
- params: RuntimeDaemonJsonSchema;
835
- result: {
836
- oneOf: RuntimeDaemonJsonSchema[];
837
- };
838
- };
839
- 'credential.revoke': {
840
- params: RuntimeDaemonJsonSchema;
841
- result: RuntimeDaemonJsonSchema;
842
- };
843
- 'credential.supply': {
844
- params: RuntimeDaemonJsonSchema;
845
- result: RuntimeDaemonJsonSchema;
846
- };
847
- 'host_tool.register': {
848
- params: RuntimeDaemonJsonSchema;
849
- result: RuntimeDaemonJsonSchema;
850
- };
851
- 'host_tool.get': {
852
- params: RuntimeDaemonJsonSchema;
853
- result: {
854
- oneOf: RuntimeDaemonJsonSchema[];
855
- };
856
- };
857
- 'host_tool.invocation.get': {
858
- params: RuntimeDaemonJsonSchema;
859
- result: {
860
- oneOf: RuntimeDaemonJsonSchema[];
861
- };
862
- };
863
- 'host_tool.revoke': {
864
- params: RuntimeDaemonJsonSchema;
865
- result: RuntimeDaemonJsonSchema;
866
- };
867
- 'host_tool.complete': {
868
- params: RuntimeDaemonJsonSchema;
869
- result: RuntimeDaemonJsonSchema;
870
- };
871
- 'workflow.list': {
872
- params: RuntimeDaemonJsonSchema;
873
- result: RuntimeDaemonJsonSchema;
874
- };
875
- 'workflow.get': {
876
- params: RuntimeDaemonJsonSchema;
877
- result: {
878
- oneOf: RuntimeDaemonJsonSchema[];
879
- };
880
- };
881
- 'workflow.subscribe': {
882
- params: RuntimeDaemonJsonSchema;
883
- result: RuntimeDaemonJsonSchema;
884
- };
885
- 'workflow.unsubscribe': {
886
- params: RuntimeDaemonJsonSchema;
887
- result: RuntimeDaemonJsonSchema;
888
- };
889
- 'learning.subscribe': {
890
- params: RuntimeDaemonJsonSchema;
891
- result: RuntimeDaemonJsonSchema;
892
- };
893
- 'learning.unsubscribe': {
894
- params: RuntimeDaemonJsonSchema;
895
- result: RuntimeDaemonJsonSchema;
896
- };
897
- 'workflow.pause': {
898
- params: RuntimeDaemonJsonSchema;
899
- result: RuntimeDaemonJsonSchema;
900
- };
901
- 'workflow.resume': {
902
- params: RuntimeDaemonJsonSchema;
903
- result: RuntimeDaemonJsonSchema;
904
- };
905
- 'workflow.stop': {
906
- params: RuntimeDaemonJsonSchema;
907
- result: RuntimeDaemonJsonSchema;
908
- };
909
- 'workflow.start': {
910
- params: RuntimeDaemonJsonSchema;
911
- result: {
912
- oneOf: RuntimeDaemonJsonSchema[];
913
- };
914
- };
915
- 'learning.list': {
916
- params: RuntimeDaemonJsonSchema;
917
- result: RuntimeDaemonJsonSchema;
918
- };
919
- 'learning.get': {
920
- params: RuntimeDaemonJsonSchema;
921
- result: RuntimeDaemonJsonSchema;
922
- };
923
- 'learning.snapshot': {
924
- params: RuntimeDaemonJsonSchema;
925
- result: RuntimeDaemonJsonSchema;
926
- };
927
- 'learning.events': {
928
- params: RuntimeDaemonJsonSchema;
929
- result: RuntimeDaemonJsonSchema;
930
- };
931
- 'learning.acknowledge': {
932
- params: RuntimeDaemonJsonSchema;
933
- result: RuntimeDaemonJsonSchema;
934
- };
935
- 'learning.snooze': {
936
- params: RuntimeDaemonJsonSchema;
937
- result: RuntimeDaemonJsonSchema;
938
- };
939
- 'learning.reject': {
940
- params: RuntimeDaemonJsonSchema;
941
- result: RuntimeDaemonJsonSchema;
942
- };
943
- 'learning.disable': {
944
- params: RuntimeDaemonJsonSchema;
945
- result: RuntimeDaemonJsonSchema;
946
- };
947
- 'learning.rollback': {
948
- params: RuntimeDaemonJsonSchema;
949
- result: RuntimeDaemonJsonSchema;
950
- };
951
- 'learning.promote': {
952
- params: RuntimeDaemonJsonSchema;
953
- result: RuntimeDaemonJsonSchema;
954
- };
955
- 'learning.review': {
956
- params: RuntimeDaemonJsonSchema;
957
- result: RuntimeDaemonJsonSchema;
958
- };
959
- 'learning.trust': {
960
- params: RuntimeDaemonJsonSchema;
961
- result: RuntimeDaemonJsonSchema;
962
- };
963
- 'config.read': {
964
- params: RuntimeDaemonJsonSchema;
965
- result: RuntimeDaemonJsonSchema;
966
- };
967
- 'config.effective': {
968
- params: RuntimeDaemonJsonSchema;
969
- result: RuntimeDaemonJsonSchema;
970
- };
971
- 'config.patch': {
972
- params: RuntimeDaemonJsonSchema;
973
- result: RuntimeDaemonJsonSchema;
974
- };
975
- 'config.reload': {
976
- params: RuntimeDaemonJsonSchema;
977
- result: RuntimeDaemonJsonSchema;
978
- };
979
- 'model.list': {
980
- params: RuntimeDaemonJsonSchema;
981
- result: {
982
- oneOf: RuntimeDaemonJsonSchema[];
983
- };
984
- };
985
- 'provider.list': {
986
- params: RuntimeDaemonJsonSchema;
987
- result: RuntimeDaemonJsonSchema;
988
- };
989
- 'provider.reasoning.efforts': {
990
- params: RuntimeDaemonJsonSchema;
991
- result: {
992
- type: "array";
993
- items: RuntimeDaemonJsonSchema;
994
- };
995
- };
996
- 'provider.reasoning.probe': {
997
- params: RuntimeDaemonJsonSchema;
998
- result: RuntimeDaemonJsonSchema;
999
- };
1000
- 'provider.capabilities.forget': {
1001
- params: RuntimeDaemonJsonSchema;
1002
- result: RuntimeDaemonJsonSchema;
1003
- };
1004
- 'provider.custom.list': {
1005
- params: RuntimeDaemonJsonSchema;
1006
- result: RuntimeDaemonJsonSchema;
1007
- };
1008
- 'provider.custom.upsert': {
1009
- params: RuntimeDaemonJsonSchema;
1010
- result: RuntimeDaemonJsonSchema;
1011
- };
1012
- 'provider.custom.remove': {
1013
- params: RuntimeDaemonJsonSchema;
1014
- result: RuntimeDaemonJsonSchema;
1015
- };
1016
- 'mcp.server.list': {
1017
- params: RuntimeDaemonJsonSchema;
1018
- result: RuntimeDaemonJsonSchema;
1019
- };
1020
- 'mcp.server.status': {
1021
- params: RuntimeDaemonJsonSchema;
1022
- result: RuntimeDaemonJsonSchema;
1023
- };
1024
- 'mcp.server.get': {
1025
- params: RuntimeDaemonJsonSchema;
1026
- result: {
1027
- oneOf: RuntimeDaemonJsonSchema[];
1028
- };
1029
- };
1030
- 'mcp.server.validate': {
1031
- params: RuntimeDaemonJsonSchema;
1032
- result: {
1033
- oneOf: RuntimeDaemonJsonSchema[];
1034
- };
1035
- };
1036
- 'mcp.server.upsert': {
1037
- params: RuntimeDaemonJsonSchema;
1038
- result: RuntimeDaemonJsonSchema;
1039
- };
1040
- 'mcp.server.delete': {
1041
- params: RuntimeDaemonJsonSchema;
1042
- result: RuntimeDaemonJsonSchema;
1043
- };
1044
- 'mcp.server.remove': {
1045
- params: RuntimeDaemonJsonSchema;
1046
- result: RuntimeDaemonJsonSchema;
1047
- };
1048
- 'mcp.server.reload': {
1049
- params: RuntimeDaemonJsonSchema;
1050
- result: RuntimeDaemonJsonSchema;
1051
- };
1052
- 'mcp.tool.list': {
1053
- params: RuntimeDaemonJsonSchema;
1054
- result: RuntimeDaemonJsonSchema;
1055
- };
1056
- 'extension.list': {
1057
- params: RuntimeDaemonJsonSchema;
1058
- result: RuntimeDaemonJsonSchema;
1059
- };
1060
- 'extension.reload': {
1061
- params: RuntimeDaemonJsonSchema;
1062
- result: RuntimeDaemonJsonSchema;
1063
- };
1064
- 'command.list': {
1065
- params: RuntimeDaemonJsonSchema;
1066
- result: RuntimeDaemonJsonSchema;
1067
- };
1068
- 'command.resolve': {
1069
- params: RuntimeDaemonJsonSchema;
1070
- result: RuntimeDaemonJsonSchema;
1071
- };
1072
- 'skill.list': {
1073
- params: RuntimeDaemonJsonSchema;
1074
- result: RuntimeDaemonJsonSchema;
1075
- };
1076
- 'skill.describe': {
1077
- params: RuntimeDaemonJsonSchema;
1078
- result: RuntimeDaemonJsonSchema;
1079
- };
1080
- 'skill.read': {
1081
- params: RuntimeDaemonJsonSchema;
1082
- result: RuntimeDaemonJsonSchema;
1083
- };
1084
- 'memory.describe': {
1085
- params: RuntimeDaemonJsonSchema;
1086
- result: RuntimeDaemonJsonSchema;
1087
- };
1088
- 'memory.listReviews': {
1089
- params: RuntimeDaemonJsonSchema;
1090
- result: RuntimeDaemonJsonSchema;
1091
- };
1092
- 'memory.listInbox': {
1093
- params: RuntimeDaemonJsonSchema;
1094
- result: RuntimeDaemonJsonSchema;
1095
- };
1096
- 'memory.rebuild': {
1097
- params: RuntimeDaemonJsonSchema;
1098
- result: RuntimeDaemonJsonSchema;
1099
- };
1100
- 'memory.showProposal': {
1101
- params: RuntimeDaemonJsonSchema;
1102
- result: RuntimeDaemonJsonSchema;
1103
- };
1104
- 'memory.readRef': {
1105
- params: RuntimeDaemonJsonSchema;
1106
- result: RuntimeDaemonJsonSchema;
1107
- };
1108
- 'memory.listRefs': {
1109
- params: RuntimeDaemonJsonSchema;
1110
- result: RuntimeDaemonJsonSchema;
1111
- };
1112
- 'memory.remember': {
1113
- params: RuntimeDaemonJsonSchema;
1114
- result: RuntimeDaemonJsonSchema;
1115
- };
1116
- 'memory.forgetRef': {
1117
- params: RuntimeDaemonJsonSchema;
1118
- result: RuntimeDaemonJsonSchema;
1119
- };
1120
- 'memory.approveProposal': {
1121
- params: RuntimeDaemonJsonSchema;
1122
- result: RuntimeDaemonJsonSchema;
1123
- };
1124
- 'memory.rejectProposal': {
1125
- params: RuntimeDaemonJsonSchema;
1126
- result: RuntimeDaemonJsonSchema;
1127
- };
1128
- 'memory.ensureOpenTarget': {
1129
- params: RuntimeDaemonJsonSchema;
1130
- result: RuntimeDaemonJsonSchema;
1131
- };
1132
- 'invocations.prepareSkill': {
1133
- params: RuntimeDaemonJsonSchema;
1134
- result: RuntimeDaemonJsonSchema;
1135
- };
1136
- 'invocations.prepareCommand': {
1137
- params: RuntimeDaemonJsonSchema;
1138
- result: RuntimeDaemonJsonSchema;
1139
- };
1140
- 'invocations.readCommandPrompt': {
1141
- params: RuntimeDaemonJsonSchema;
1142
- result: {
1143
- oneOf: RuntimeDaemonJsonSchema[];
1144
- };
1145
- };
1146
- 'invocations.startReview': {
1147
- params: RuntimeDaemonJsonSchema;
1148
- result: RuntimeDaemonJsonSchema;
1149
- };
1150
- 'invocations.startAgentsLean': {
1151
- params: RuntimeDaemonJsonSchema;
1152
- result: RuntimeDaemonJsonSchema;
1153
- };
1154
- 'invocations.executeCommand': {
1155
- params: RuntimeDaemonJsonSchema;
1156
- result: RuntimeDaemonJsonSchema;
1157
- };
1158
- 'invocations.prepareReview': {
1159
- params: RuntimeDaemonJsonSchema;
1160
- result: RuntimeDaemonJsonSchema;
1161
- };
1162
- 'invocations.prepareAgentsLean': {
1163
- params: RuntimeDaemonJsonSchema;
1164
- result: RuntimeDaemonJsonSchema;
1165
- };
1166
- 'artifact.create': {
1167
- params: RuntimeDaemonJsonSchema;
1168
- result: RuntimeDaemonJsonSchema;
1169
- };
1170
- 'artifact.get': {
1171
- params: RuntimeDaemonJsonSchema;
1172
- result: RuntimeDaemonJsonSchema;
1173
- };
1174
- 'artifact.delete': {
1175
- params: RuntimeDaemonJsonSchema;
1176
- result: RuntimeDaemonJsonSchema;
1177
- };
1178
- 'agentRegistrations.list': {
1179
- params: RuntimeDaemonJsonSchema;
1180
- result: RuntimeDaemonJsonSchema;
1181
- };
1182
- 'agentRegistrations.upsert': {
1183
- params: RuntimeDaemonJsonSchema;
1184
- result: RuntimeDaemonJsonSchema;
1185
- };
1186
- 'agentRegistrations.setEnabled': {
1187
- params: RuntimeDaemonJsonSchema;
1188
- result: RuntimeDaemonJsonSchema;
1189
- };
1190
- 'agentRegistrations.remove': {
1191
- params: RuntimeDaemonJsonSchema;
1192
- result: RuntimeDaemonJsonSchema;
1193
- };
1194
- 'agents.listDispatchable': {
1195
- params: RuntimeDaemonJsonSchema;
1196
- result: RuntimeDaemonJsonSchema;
1197
- };
1198
- 'agents.describe': {
1199
- params: RuntimeDaemonJsonSchema;
1200
- result: RuntimeDaemonJsonSchema;
1201
- };
1202
- 'agents.preflight': {
1203
- params: RuntimeDaemonJsonSchema;
1204
- result: RuntimeDaemonJsonSchema;
1205
- };
1206
- 'agents.tree': {
1207
- params: RuntimeDaemonJsonSchema;
1208
- result: RuntimeDaemonJsonSchema;
1209
- };
1210
- 'agents.detail': {
1211
- params: RuntimeDaemonJsonSchema;
1212
- result: RuntimeDaemonJsonSchema;
1213
- };
1214
- 'agents.spawn': {
1215
- params: RuntimeDaemonJsonSchema;
1216
- result: RuntimeDaemonJsonSchema;
1217
- };
1218
- 'agents.send': {
1219
- params: RuntimeDaemonJsonSchema;
1220
- result: RuntimeDaemonJsonSchema;
1221
- };
1222
- 'agents.followup': {
1223
- params: RuntimeDaemonJsonSchema;
1224
- result: RuntimeDaemonJsonSchema;
1225
- };
1226
- 'agents.interrupt': {
1227
- params: RuntimeDaemonJsonSchema;
1228
- result: RuntimeDaemonJsonSchema;
1229
- };
1230
- 'agents.output': {
1231
- params: RuntimeDaemonJsonSchema;
1232
- result: RuntimeDaemonJsonSchema;
1233
- };
1234
- 'agents.events': {
1235
- params: RuntimeDaemonJsonSchema;
1236
- result: RuntimeDaemonJsonSchema;
1237
- };
1238
- 'agents.wait': {
1239
- params: RuntimeDaemonJsonSchema;
1240
- result: RuntimeDaemonJsonSchema;
1241
- };
1242
- };
1243
- declare const RUNTIME_DAEMON_NOTIFICATION_SCHEMAS: {
1244
- 'subscription.error': RuntimeDaemonJsonSchema;
1245
- 'session.view': RuntimeDaemonJsonSchema;
1246
- event: RuntimeDaemonJsonSchema;
1247
- 'observation.invalidated': RuntimeDaemonJsonSchema;
1248
- 'credential.request': RuntimeDaemonJsonSchema;
1249
- 'host_tool.invoke': RuntimeDaemonJsonSchema;
1250
- 'runtime.warning': RuntimeDaemonJsonSchema;
1251
- };
263
+ declare const RUNTIME_DAEMON_METHOD_SCHEMAS: Record<RuntimeDaemonMethod, RuntimeDaemonMethodSchema>;
264
+ declare const RUNTIME_DAEMON_NOTIFICATION_SCHEMAS: Record<RuntimeDaemonNotificationMethod, RuntimeDaemonJsonSchema>;
1252
265
  declare const RUNTIME_DAEMON_PROTOCOL_SCHEMA: RuntimeDaemonProtocolSchema;
1253
266
  declare const RUNTIME_DAEMON_PROTOCOL_SCHEMA_JSON: string;
1254
267
  declare function listRuntimeDaemonSchemaMethods(): readonly RuntimeDaemonMethod[];
1255
268
 
1256
- declare class RuntimeDaemonCapabilityUpgradeError extends Error {
1257
- readonly preflight?: RuntimeDaemonPreflight | undefined;
1258
- readonly ownerProfile?: string | undefined;
1259
- readonly code: "daemon_capability_upgrade_required";
1260
- readonly recoverable: true;
1261
- readonly restartRequired: true;
1262
- readonly capability: string;
1263
- readonly retryable: boolean;
1264
- constructor(message: string, preflight?: RuntimeDaemonPreflight | undefined, options?: ErrorOptions, capability?: string, ownerProfile?: string | undefined);
1265
- }
1266
- /** A recoverable Auto LLM configuration error that must never become approval work. */
1267
- declare class RuntimeAutoModeConfigurationError extends Error {
1268
- readonly code: "auto_mode_classifier_model_required";
1269
- readonly recoverable: true;
1270
- constructor(message: string);
1271
- }
1272
-
1273
- type KodaXRuntimeMode = "embedded" | "daemon";
1274
- type KodaXRuntimeIsolation = "inline" | "process";
1275
- interface RuntimeInlineOwnerHandle {
1276
- readonly profile: string;
1277
- readonly ownerId: string;
1278
- readonly ownerPolicy: RuntimeOwnerPolicyState;
1279
- close(): void;
1280
- }
1281
- interface RuntimeOwnerPolicyState {
1282
- readonly mode: "daemon" | "inline";
1283
- readonly revision: number;
1284
- readonly updatedAt: string;
1285
- }
1286
- interface RuntimeOwnerIdentity {
1287
- readonly runtimeId: string;
1288
- readonly pid: number;
1289
- readonly createdAt: string;
1290
- readonly kind?: "daemon" | "inline";
1291
- /** OS-issued identity used to distinguish a live owner from PID reuse. */
1292
- readonly processStartIdentity?: string;
1293
- readonly processContainment?: "windows-job";
1294
- readonly supervisorPid?: number;
1295
- /** OS-issued identity used to distinguish the original supervisor from PID reuse. */
1296
- readonly supervisorProcessStartIdentity?: string;
1297
- }
1298
- interface RuntimeOwnerState {
1299
- readonly profile: string;
1300
- readonly policy: RuntimeOwnerPolicyState;
1301
- readonly ownerStatus: "unowned" | "owned" | "unreadable";
1302
- readonly owner: RuntimeOwnerIdentity | null;
1303
- }
1304
- /**
1305
- * Reserve the Coder profile for inline rollback. Partner runtimes must not use
1306
- * this fence; they remain in their independent embedded namespace.
1307
- */
1308
- declare function acquireKodaXInlineOwner(input?: {
1309
- readonly homeDir?: string;
1310
- readonly profile?: string;
1311
- readonly enableRollback?: boolean;
1312
- }): RuntimeInlineOwnerHandle;
1313
- declare function getKodaXRuntimeOwnerState(input?: {
1314
- readonly homeDir?: string;
1315
- readonly profile?: string;
1316
- }): RuntimeOwnerState;
1317
- /**
1318
- * Enable daemon auto-start, atomically reclaiming an inline fence only when
1319
- * the SDK can prove that its owner process is gone.
1320
- */
1321
- declare function enableKodaXDaemonOwner(input?: {
1322
- readonly homeDir?: string;
1323
- readonly profile?: string;
1324
- }): RuntimeOwnerPolicyState;
1325
- declare function setKodaXRuntimeOwnerMode(input: {
1326
- readonly mode: "daemon" | "inline";
1327
- readonly expectedRevision: number;
1328
- readonly homeDir?: string;
1329
- readonly profile?: string;
1330
- }): {
1331
- readonly mode: "daemon" | "inline";
1332
- readonly revision: number;
1333
- readonly updatedAt: string;
1334
- };
1335
- type ReplRuntimeConfigPatch = Parameters<typeof saveConfig>[0];
1336
- declare const RUNTIME_CONFIG_PATCH_KEYS: readonly ["provider", "model", "effort", "planModeEffort", "thinking", "reasoningMode", "agentMode", "permissionMode", "locale", "providerModels", "extensions", "repoIntelligenceMode", "repoIntelligenceTrace", "stallLog", "fallbackProviders", "fastProvider", "fastModel", "deepProvider", "deepModel", "maxOutputTokens", "disablePromptCache", "lsp", "lspAutoDownload", "acpLogLevel", "sessionRetentionDays", "repoIntelligence", "workflow"];
1337
- type RuntimeConfigPatchKey = (typeof RUNTIME_CONFIG_PATCH_KEYS)[number];
1338
- interface RuntimeIdentity {
1339
- readonly runtimeId: string;
1340
- readonly mode: KodaXRuntimeMode;
1341
- readonly profile: string;
1342
- readonly startedAt: string;
1343
- readonly version: string;
1344
- /** Frozen installation identity for the local launcher; not a UI capability version. */
1345
- readonly build?: RuntimeBuildIdentity;
1346
- readonly isolation?: KodaXRuntimeIsolation;
1347
- }
1348
-
1349
- /**
1350
- * A read-only connection observation. Display metadata remains client-supplied
1351
- * and must not authorize work ownership, destructive actions, or process control.
1352
- */
1353
- interface RuntimeDaemonClientSnapshot {
1354
- /** Opaque daemon-generated identity for this connection; changes after reconnect. */
1355
- readonly daemonConnectionId: string;
1356
- /** Daemon-authenticated connection's claimed instance identity; not proof of destructive work ownership. */
1357
- readonly principalId: string;
1358
- readonly name?: string;
1359
- readonly title?: string;
1360
- readonly version?: string;
1361
- readonly clientType: RuntimeDaemonClientType;
1362
- readonly connectedAt: string;
1363
- }
1364
- interface RuntimeClientCapabilities {
1365
- readonly richEvents?: boolean;
1366
- readonly permissionPrompts?: boolean;
1367
- readonly configAdmin?: boolean;
1368
- readonly commandCatalog?: boolean;
1369
- readonly skillCatalog?: boolean;
1370
- readonly artifactUpload?: boolean;
1371
- readonly contextDiagnostics?: boolean;
1372
- }
1373
- type RuntimeGrantedScope = "session:observe" | "session:write" | "run:control" | "interaction:respond" | "permission:respond" | "permission:grant-admin" | "integration:admin" | "workflow:control" | "learning:read" | "learning:control" | "artifact:write" | "agent:control" | "credential:register" | "host-tool:register" | "owner:admin" | "daemon:admin";
1374
- interface RuntimeExternalAgentsOptions {
1375
- readonly factories: readonly AgentExecutorFactory[];
1376
- readonly policy: AgentDispatchPolicy;
1377
- readonly credentialBroker?: AgentCredentialBroker;
1378
- /** Authorizes an executor before it materializes any remote artifact. Defaults to deny. */
1379
- readonly artifactPolicy?: AgentArtifactPolicy;
1380
- /** Default host-derived context for Worker tools; run.start may override it. */
1381
- readonly defaultContext?: AgentDispatchContext;
1382
- }
1383
- interface CreateKodaXRuntimeOptions {
1384
- /** Runtime ownership form. Defaults to a caller-owned embedded Runtime. */
1385
- readonly mode?: KodaXRuntimeMode;
1386
- /** Base directory that owns `.kodax`, matching CLI `--home`; not the `.kodax` directory used by `KODAX_HOME`. */
1387
- readonly homeDir?: string;
1388
- readonly profile?: string;
1389
- readonly sessionsDir?: string;
1390
- readonly defaultProvider?: string;
1391
- readonly defaultModel?: string;
1392
- /** Fail-closed permission deadline in milliseconds; 0 disables it. Defaults to five minutes. */
1393
- readonly permissionTimeoutMs?: number;
1394
- /** AskUser deadline in milliseconds. A validated default wins on expiry. Defaults to five minutes. */
1395
- readonly userInputTimeoutMs?: number;
1396
- /** Internal daemon-host switch; keeps ordinary embedded runs non-interactive by default. */
1397
- readonly sharedDaemonHost?: boolean;
1398
- /** @internal Owner-fence identity assigned before a shared daemon Runtime is constructed. */
1399
- readonly daemonHostRuntimeId?: string;
1400
- readonly daemonStartupTimeoutMs?: number;
1401
- readonly daemonConnectTimeoutMs?: number;
1402
- /**
1403
- * Auto-started daemon only: after the last logical client disconnects,
1404
- * stop after governed work has remained idle for this grace period.
1405
- * Omit to retain the default SDK persistence (unless daemonLifecycle is interactive).
1406
- */
1407
- readonly daemonOrphanExitMs?: number;
1408
- /** Interactive startup gives new Hosts a 30-second idle exit; persistent startup retains the attached Host. */
1409
- readonly daemonLifecycle?: 'interactive' | 'persistent';
1410
- readonly daemonTransport?: RuntimeDaemonClientTransport;
1411
- readonly daemonEndpoint?: string | RuntimeDaemonEndpoint;
1412
- /** Defaults to true for daemon mode unless a transport or endpoint is supplied. */
1413
- readonly autoStartDaemon?: boolean;
1414
- readonly daemonToken?: string;
1415
- readonly clientInfo?: RuntimeClientInfo;
1416
- readonly capabilities?: RuntimeClientCapabilities;
1417
- readonly requirements?: RuntimeCapabilityRequirements;
1418
- /** Inline host injection. Functions never cross the daemon transport. */
1419
- readonly externalAgents?: RuntimeExternalAgentsOptions;
1420
- /** Trusted host-owned Exec Policy inputs. Detached daemon mode accepts them only for a new auto-started owner. */
1421
- readonly execPolicy?: RuntimeExecPolicyOptions;
1422
- /** Trusted host-owned Auto reviewer layers; detached daemon attach never mutates them. */
1423
- readonly autoReview?: RuntimeAutoReviewOptions;
1424
- }
1425
- interface RuntimeExecPolicyOptions {
1426
- readonly adminRules?: readonly ExecPolicyRuleInput[];
1427
- /** Canonical project roots whose local `.kodax/exec-policy.jsonc` may load. */
1428
- readonly trustedProjectRoots?: readonly string[];
1429
- }
1430
- interface RuntimeAutoReviewOptions {
1431
- /** Highest-priority reviewer policy; never accepted from config or conversation data. */
1432
- readonly administratorPolicy?: string;
1433
- /** Guidance supplied by the host's selected model/catalog. */
1434
- readonly modelGuidance?: string;
1435
- }
1436
- interface ConnectKodaXRuntimeOptions {
1437
- /** Local stage changes; observer work is not awaited. Failures are diagnosed without affecting startup. */
1438
- readonly onStartupProgress?: (progress: ClientStartupProgress) => void | Promise<void>;
1439
- readonly profile?: string;
1440
- /** @deprecated Connect is passive. Use ensureKodaXRuntime for startup; true is rejected here. */
1441
- readonly autoStart?: boolean;
1442
- readonly endpoint?: string | RuntimeDaemonEndpoint;
1443
- readonly transport?: RuntimeDaemonClientTransport;
1444
- /** Base directory that owns `.kodax`, matching CLI `--home`; not the `.kodax` directory used by `KODAX_HOME`. */
1445
- readonly homeDir?: string;
1446
- readonly sessionsDir?: string;
1447
- readonly defaultProvider?: string;
1448
- readonly defaultModel?: string;
1449
- /** Applied when this connection starts a new daemon owner; 0 disables it. Defaults to five minutes. */
1450
- readonly permissionTimeoutMs?: number;
1451
- /** AskUser deadline for a newly started daemon. Defaults to five minutes. */
1452
- readonly userInputTimeoutMs?: number;
1453
- readonly daemonStartupTimeoutMs?: number;
1454
- /** Local startup cancellation; never crosses the Host protocol. */
1455
- readonly daemonStartupSignal?: AbortSignal;
1456
- readonly daemonConnectTimeoutMs?: number;
1457
- /** Auto-started daemon idle-exit policy; see CreateKodaXRuntimeOptions. */
1458
- readonly daemonOrphanExitMs?: number;
1459
- /** Applies an interactive default only to new Hosts, or explicitly retains the attached Host. */
1460
- readonly daemonLifecycle?: 'interactive' | 'persistent';
1461
- readonly daemonToken?: string;
1462
- readonly clientInfo?: RuntimeClientInfo;
1463
- readonly capabilities?: RuntimeClientCapabilities;
1464
- readonly requirements?: RuntimeCapabilityRequirements;
1465
- }
1466
- /** SDK facts that embedders can inspect before auto-starting a daemon. */
1467
- declare const KODAX_RUNTIME_SDK_CAPABILITIES: Readonly<{
1468
- readonly productClient: 1;
1469
- readonly sessionDrafts: 1;
1470
- readonly actorSettlementConvergence: 2;
1471
- readonly conversationHistory: 2;
1472
- readonly crashOutcomeModel: 2;
1473
- readonly daemonOrphanExit: 1;
1474
- readonly daemonShutdownVerification: 1;
1475
- readonly effectiveConfig: 1;
1476
- readonly managedRunDurability: 1;
1477
- readonly runtimeAutoModeGuardrail: 6;
1478
- readonly sandboxRuntime: 11;
1479
- readonly sharedSessionSettings: 2;
1480
- readonly runtimeEventCoalescing: 1;
1481
- readonly liveOutputSegments: 1;
1482
- }>;
1483
- interface RuntimeCapabilityRequirements {
1484
- readonly productExitControl?: 1;
1485
- readonly productExecutionFacts?: 1;
1486
- readonly productActorAuthorization?: 1;
1487
- readonly productHistoryBoundaries?: 1;
1488
- readonly productExecutionAuthorization?: 1 | 2;
1489
- /** Unified product business operations and current-view lifecycle. */
1490
- readonly productClient?: 1;
1491
- readonly sessionDrafts?: 1;
1492
- /** Reject hosts that do not advertise an installed external Agent executor plane. */
1493
- readonly externalAgents?: boolean;
1494
- /** Require owner/revision-fenced external Agent registration administration. */
1495
- readonly externalAgentAdmin?: 1;
1496
- /** Require a daemon that owns and hot-reconciles its A2A integration config. */
1497
- readonly a2aConfigReconciler?: 1;
1498
- readonly sessionObservation?: 1;
1499
- readonly afterTurnInput?: 1;
1500
- readonly learningCenter?: 1;
1501
- readonly skillLearningLoop?: 1;
1502
- readonly interruptInput?: 1;
1503
- readonly askUserTransport?: 1;
1504
- readonly permissionCas?: 1;
1505
- readonly providerCredentialBroker?: 1 | 2;
1506
- /** v1: run-bound host tool leases. v2 additionally materializes bound host tools into the agent tool table and cached capability catalog. */
1507
- readonly runBoundHostTools?: 1 | 2;
1508
- readonly coderOwnerFencing?: 1;
1509
- readonly crashOutcomeModel?: 1 | 2;
1510
- readonly coderFeatureMatrix?: 1;
1511
- readonly sessionAdmission?: 1;
1512
- readonly completeObservationSnapshot?: 1;
1513
- /** Require always-on thresholds, stable context identity, and canonical compact events. */
1514
- readonly contextCompaction?: 1 | 2 | 3;
1515
- /** Require bounded transcript slices plus page/chunk recovery. */
1516
- readonly transcriptPaging?: 1;
1517
- /** Require deterministic exact-history search over merged persisted lineage. */
1518
- readonly transcriptSearch?: 1;
1519
- /** v2 also requires topology-transparent managed context and direct clone provenance. */
1520
- readonly conversationHistory?: 1 | 2;
1521
- readonly connectionLifecycle?: 1;
1522
- readonly typedRuntimeEvents?: 1;
1523
- readonly daemonSafeRunInput?: 1;
1524
- readonly sharedSessionSettings?: 1 | 2;
1525
- readonly durableRecoveryQueries?: 1;
1526
- /** Require durable accepted-input and completed-turn boundaries for managed Runs. */
1527
- readonly managedRunDurability?: 1;
1528
- /** Require fail-closed root fencing plus automatic same-owner Actor settlement repair. */
1529
- readonly actorSettlementConvergence?: 1 | 2;
1530
- /** Require Session-local event ordering and scoped event access. */
1531
- readonly daemonManagement?: 1;
1532
- /** Require a read-only inventory of initialized logical daemon clients. */
1533
- readonly daemonClientInventory?: 1;
1534
- /** Require an auto-started daemon whose current host has orphan idle-exit enabled. */
1535
- readonly daemonOrphanExit?: 1;
1536
- /** Require authoritative durable shutdown plus kernel-backed process containment. */
1537
- readonly daemonShutdownVerification?: 1;
1538
- /** Require source-level bounded coalescing before sequence allocation and persistence. */
1539
- readonly runtimeEventCoalescing?: 1;
1540
- /** Require provider-request-owned live output with explicit replacement semantics. */
1541
- readonly liveOutputSegments?: 1;
1542
- /** Optional integration failures are isolated, observable, and hot-recoverable. */
1543
- readonly integrationConfigResilience?: 1;
1544
- /** Require a secret-safe snapshot of applied Runtime configuration provenance. */
1545
- readonly effectiveConfig?: 1;
1546
- readonly actorControlPlane?: 1;
1547
- /** Require the sandbox-first execution chain and permission fallback revision. */
1548
- readonly sandboxRuntime?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
1549
- /** Runtime owns Auto[LLM] review at the proven host boundary. */
1550
- readonly runtimeAutoModeGuardrail?: 1 | 2 | 3 | 4 | 5 | 6;
1551
- }
1552
- interface RuntimeConnectionState {
1553
- readonly state: "connected" | "disconnected";
1554
- readonly connectionId: string;
1555
- readonly runtimeEpoch: string;
1556
- readonly code?: RuntimeDaemonTransportLifecycleState["code"];
1557
- readonly reason?: string;
1558
- readonly reconnectable: boolean;
1559
- }
1560
- interface RuntimeConnectionService {
1561
- current(): RuntimeConnectionState;
1562
- subscribe(listener: (state: RuntimeConnectionState) => void): RuntimeSubscription;
1563
- }
1564
- interface KodaXRuntime {
1565
- readonly statistics?: ClientStatisticsService;
1566
- readonly lifecycle?: ClientLifecycleService;
1567
- readonly identity: RuntimeIdentity;
1568
- /** Server-advertised facts. Authorization remains defined by grantedScopes. */
1569
- readonly capabilities?: Readonly<Record<string, unknown>>;
1570
- readonly grantedScopes?: readonly RuntimeGrantedScope[];
1571
- readonly sessions: RuntimeSessionService;
1572
- readonly runs: RuntimeRunService;
1573
- readonly events: RuntimeEventService;
1574
- readonly permissions: RuntimePermissionService;
1575
- readonly userInputs: RuntimeUserInputService;
1576
- /** Typed Interaction surface: precise request ids, first valid answer wins. */
1577
- readonly interactions: RuntimeInteractionService;
1578
- readonly credentials: RuntimeCredentialService;
1579
- readonly hostTools: RuntimeHostToolService;
1580
- readonly workflows: RuntimeWorkflowService;
1581
- readonly learning: RuntimeLearningService;
1582
- readonly memory: RuntimeMemoryService;
1583
- /** FEATURE_298 T37 — trusted Skill/command preparation lives Host-side. */
1584
- readonly invocations: RuntimeInvocationService & RuntimeProductCommandService;
1585
- readonly config: RuntimeConfigService;
1586
- readonly catalog: RuntimeCatalogService;
1587
- readonly mcp: RuntimeMcpService;
1588
- readonly artifacts: RuntimeArtifactService;
1589
- readonly status: RuntimeStatusService;
1590
- /** Present on daemon facades; emits disconnects without waiting for polling. */
1591
- readonly connection?: RuntimeConnectionService;
1592
- /** Present on daemon facades; the embedded Host's owner closes instead. */
1593
- readonly daemon?: RuntimeDaemonManagementService;
1594
- readonly admin: RuntimeAdminService;
1595
- readonly agents: RuntimeAgentService;
1596
- /**
1597
- * Release this facade. Inline closes its private Runtime and daemon mode
1598
- * only detaches this client.
1599
- */
1600
- close(): Promise<void>;
1601
- }
1602
- interface RuntimeAdminService {
1603
- readonly agentRegistrations: AgentRegistrationService;
1604
- }
1605
- interface RuntimeAgentService {
1606
- readonly enabled: boolean;
1607
- /** Present when this facade owns an embedded execution substrate. */
1608
- readonly execution?: RuntimeAgentBindingService;
1609
- listDispatchable(query: DispatchableAgentQuery): Promise<readonly DispatchableAgentListing[]>;
1610
- describe(agentId: string, query: DispatchableAgentQuery): Promise<DispatchableAgentListing | undefined>;
1611
- preflight(input: AgentPreflightInput): Promise<AgentPreflightResult>;
1612
- tree(sessionId: string): Promise<AgentTreeSnapshot>;
1613
- detail(sessionId: string, actorPath: string): Promise<AgentDetail>;
1614
- spawn(sessionId: string, input: AgentSpawnInput, options?: RuntimeAgentOperationOptions): Promise<AgentTurnRef>;
1615
- send(sessionId: string, actorPath: string, content: string, classification?: AgentDataClassification): Promise<void>;
1616
- followup(sessionId: string, actorPath: string, objective: string, options?: RuntimeAgentFollowupOptions): Promise<AgentFollowupResult>;
1617
- interrupt(sessionId: string, actorPath: string, reason?: string): Promise<void>;
1618
- output(sessionId: string, actorPath: string, turnId?: string): Promise<AgentOutput>;
1619
- events(sessionId: string, afterSequence?: number): Promise<readonly AgentEvent[]>;
1620
- wait(sessionId: string, afterSequence?: number, timeoutMs?: number, options?: Readonly<Pick<RuntimeReadOptions, "signal">>): Promise<AgentEvent | undefined>;
1621
- }
1622
- type RuntimeConfigPatch = {
1623
- [K in RuntimeConfigPatchKey]?: ReplRuntimeConfigPatch[K] | null;
1624
- };
1625
- interface RuntimeConfigReloadResult {
1626
- readonly ok: true;
1627
- readonly config: unknown;
1628
- }
1629
- type RuntimeEffectiveConfigSource = "runtime_override" | "environment" | "persisted" | "unset";
1630
- interface RuntimeEffectiveConfigEntry {
1631
- readonly present: boolean;
1632
- readonly applied: boolean;
1633
- readonly source: RuntimeEffectiveConfigSource;
1634
- readonly priority: number;
1635
- readonly value?: unknown;
1636
- }
1637
- interface RuntimeEffectiveCredentialEntry {
1638
- readonly present: boolean;
1639
- readonly source: "environment" | "unset";
1640
- }
1641
- interface RuntimeEffectiveConfigSnapshot {
1642
- readonly schemaVersion: 1;
1643
- readonly capturedAt: string;
1644
- readonly persistedConfig: {
1645
- readonly state: "loaded" | "missing" | "invalid";
1646
- };
1647
- readonly entries: Readonly<Record<string, RuntimeEffectiveConfigEntry>>;
1648
- /** Credential values are deliberately never included. */
1649
- readonly credentials: Readonly<Record<string, RuntimeEffectiveCredentialEntry>>;
1650
- }
1651
- interface RuntimeConfigService {
1652
- read(): Promise<unknown>;
1653
- readEffective(): Promise<RuntimeEffectiveConfigSnapshot>;
1654
- patch(patch: RuntimeConfigPatch): Promise<unknown>;
1655
- reload(): Promise<RuntimeConfigReloadResult>;
1656
- }
1657
- interface RuntimeModelListFilter {
1658
- readonly provider?: string;
1659
- }
1660
- interface RuntimeCommandResolveInput {
1661
- readonly name: string;
1662
- readonly projectRoot?: string;
1663
- }
1664
- interface RuntimeCommandInfo {
1665
- readonly name: string;
1666
- readonly aliases?: readonly string[];
1667
- readonly description: string;
1668
- readonly source: CommandInfo["source"];
1669
- readonly usage?: string;
1670
- readonly argumentHint?: string;
1671
- readonly location?: CommandInfo["location"];
1672
- readonly path?: string;
1673
- readonly userInvocable?: boolean;
1674
- readonly disableModelInvocation?: boolean;
1675
- readonly allowedTools?: string;
1676
- readonly context?: "fork";
1677
- readonly agent?: string;
1678
- readonly model?: string;
1679
- }
1680
- interface RuntimeSkillListFilter {
1681
- readonly projectRoot?: string;
1682
- /** @deprecated Every enabled Skill is explicitly user-invocable. */
1683
- readonly userInvocableOnly?: boolean;
1684
- }
1685
- interface RuntimeSkillDescribeInput {
1686
- readonly name: string;
1687
- readonly projectRoot?: string;
1688
- }
1689
- interface RuntimeSkillFileSummary {
1690
- readonly name: string;
1691
- readonly path: string;
1692
- readonly relativePath: string;
1693
- }
1694
- interface RuntimeSkillSummary {
1695
- readonly name: string;
1696
- readonly description: string;
1697
- /** Always true for enabled Skills; retained for wire compatibility. */
1698
- readonly userInvocable: boolean;
1699
- readonly argumentHint?: string;
1700
- readonly path: string;
1701
- readonly source: SkillMetadata["source"];
1702
- /** True when the Skill is hidden from model discovery and the model tool. */
1703
- readonly disableModelInvocation: boolean;
1704
- }
1705
- interface RuntimeSkillDescription extends RuntimeSkillSummary {
1706
- readonly content: string;
1707
- readonly skillFilePath: string;
1708
- readonly scripts?: readonly RuntimeSkillFileSummary[];
1709
- readonly references?: readonly RuntimeSkillFileSummary[];
1710
- readonly assets?: readonly RuntimeSkillFileSummary[];
1711
- readonly templates?: readonly RuntimeSkillFileSummary[];
1712
- readonly resources?: readonly RuntimeSkillFileSummary[];
1713
- }
1714
- interface RuntimeExtensionReloadResult {
1715
- readonly ok: true;
1716
- readonly active: boolean;
1717
- readonly diagnostics?: ExtensionRuntimeDiagnostics;
1718
- }
1719
- interface RuntimeExtensionListResult {
1720
- readonly active: boolean;
1721
- readonly extensions: readonly LoadedExtensionDiagnostic[];
1722
- readonly diagnostics?: ExtensionRuntimeDiagnostics;
1723
- }
1724
- interface RuntimeCatalogService {
1725
- reasoningEfforts(input: ClientModelSelection): Promise<readonly string[]>;
1726
- probeReasoningEfforts(input: ClientModelSelection & {
1727
- readonly efforts: readonly string[];
1728
- }): Promise<readonly ClientCapabilityProbeResult[]>;
1729
- forgetCapabilities(input?: {
1730
- readonly provider?: string;
1731
- readonly model?: string;
1732
- }): Promise<void>;
1733
- providers(): Promise<readonly ClientProviderInfo[]>;
1734
- models(filter?: RuntimeModelListFilter): Promise<unknown>;
1735
- commands(projectRoot?: string): Promise<readonly RuntimeCommandInfo[]>;
1736
- resolveCommand(input: RuntimeCommandResolveInput): Promise<RuntimeCommandInfo | null>;
1737
- skills(filter?: RuntimeSkillListFilter): Promise<readonly RuntimeSkillSummary[]>;
1738
- describeSkill(input: RuntimeSkillDescribeInput): Promise<RuntimeSkillDescription | null>;
1739
- customProviders(): Promise<readonly KodaXCustomProviderConfig[]>;
1740
- upsertCustomProvider(config: KodaXCustomProviderConfig): Promise<KodaXCustomProviderConfig>;
1741
- deleteCustomProvider(name: string): Promise<boolean>;
1742
- extensions(): Promise<RuntimeExtensionListResult>;
1743
- reloadExtensions(): Promise<RuntimeExtensionReloadResult>;
1744
- }
1745
- interface RuntimeMcpToolListFilter {
1746
- readonly server?: string;
1747
- readonly forceRefresh?: boolean;
1748
- }
1749
- interface RuntimeMcpReloadResult {
1750
- readonly ok: true;
1751
- readonly servers: readonly McpServerStatus[];
1752
- }
1753
- type RuntimeMcpValidateResult = {
1754
- readonly ok: true;
1755
- readonly config: McpServerConfig;
1756
- } | {
1757
- readonly ok: false;
1758
- readonly error: string;
1759
- };
1760
- interface RuntimeMcpService {
1761
- status(): Promise<readonly McpServerStatus[]>;
1762
- listServers(): Promise<Record<string, McpServerConfig>>;
1763
- getServer(name: string): Promise<McpServerConfig | undefined>;
1764
- validateServer(name: string, config: unknown): Promise<RuntimeMcpValidateResult>;
1765
- upsertServer(name: string, config: McpServerConfig): Promise<McpServerConfig>;
1766
- deleteServer(name: string): Promise<boolean>;
1767
- reloadServers(): Promise<RuntimeMcpReloadResult>;
1768
- listTools(filter?: RuntimeMcpToolListFilter): Promise<readonly McpServerToolList[]>;
1769
- }
1770
- type RuntimeArtifactKind = "image" | "file" | "video";
1771
- interface RuntimeCreateArtifactInput {
1772
- readonly kind: RuntimeArtifactKind;
1773
- readonly path: string;
1774
- readonly mediaType?: string;
1775
- readonly mimeType?: string;
1776
- readonly name?: string;
1777
- readonly source?: KodaXInputArtifactSource;
1778
- readonly description?: string;
1779
- }
1780
- interface RuntimeArtifact {
1781
- readonly id: string;
1782
- readonly kind: RuntimeArtifactKind;
1783
- readonly path: string;
1784
- readonly sizeBytes: number;
1785
- readonly mediaType?: string;
1786
- readonly mimeType?: string;
1787
- readonly name?: string;
1788
- readonly source?: KodaXInputArtifactSource;
1789
- readonly description?: string;
1790
- readonly createdAt: string;
1791
- }
1792
- interface RuntimeArtifactService {
1793
- create(input: RuntimeCreateArtifactInput): Promise<RuntimeArtifact>;
1794
- get(artifactId: string): Promise<RuntimeArtifact | undefined>;
1795
- delete(artifactId: string): Promise<boolean>;
1796
- }
1797
- interface RuntimeCreateSessionInput extends ClientCreateSessionInput {
1798
- }
1799
- type RuntimeSession = ClientSession;
1800
- /** Payload emitted when an executing run binds its provider session. */
1801
- interface RuntimeRunSessionLoadedEventPayload {
1802
- readonly provider: string;
1803
- readonly sessionId: string;
1804
- readonly turnId?: string;
1805
- readonly iteration?: number;
1806
- }
1807
- /** Durable compatibility event emitted when a run binds its provider session. */
1808
- type RuntimeSessionLoadedEventPayload = RuntimeSession | RuntimeRunSessionLoadedEventPayload;
1809
- type RuntimeSessionSummary = ClientSessionSummary;
1810
- type RuntimeTranscript = FullTranscriptSessionData;
1811
- interface RuntimeConversationHistory extends SessionConversationHistoryData {
1812
- /** Content-derived identity shared by direct and paged conversation reads. */
1813
- readonly revision: string;
1814
- }
1815
- interface RuntimeConversationHistorySliceEntry {
1816
- readonly index: number;
1817
- readonly boundaryId?: string;
1818
- readonly byteLength: number;
1819
- readonly oversized: boolean;
1820
- readonly entry?: SessionConversationHistoryEntry;
1821
- }
1822
- interface RuntimeConversationHistorySlice {
1823
- readonly revision: string;
1824
- readonly sourceRevision: string;
1825
- readonly status: SessionConversationHistoryStatus;
1826
- readonly issues: readonly SessionConversationHistoryIssue[];
1827
- readonly entries: readonly RuntimeConversationHistorySliceEntry[];
1828
- readonly hasMore: boolean;
1829
- readonly nextCursor?: string;
1830
- }
1831
- interface RuntimeConversationHistoryPageInput {
1832
- readonly sessionId: string;
1833
- readonly cursor?: string;
1834
- readonly limit?: number;
1835
- }
1836
- interface RuntimeTranscriptSliceEntry {
1837
- readonly index: number;
1838
- readonly entryId?: string;
1839
- readonly byteLength: number;
1840
- readonly oversized: boolean;
1841
- readonly entry?: SessionTranscriptEntry;
1842
- }
1843
- interface RuntimeTranscriptSlice {
1844
- readonly revision: string;
1845
- readonly entries: readonly RuntimeTranscriptSliceEntry[];
1846
- readonly hasMore: boolean;
1847
- readonly nextCursor?: string;
1848
- }
1849
- interface RuntimeTranscriptPageInput {
1850
- readonly sessionId: string;
1851
- readonly cursor?: string;
1852
- readonly limit?: number;
1853
- }
1854
- interface RuntimeReadOptions {
1855
- readonly timeoutMs?: number;
1856
- readonly signal?: AbortSignal;
1857
- }
1858
- interface RuntimeSessionDiagnosticsInput extends RuntimeReadOptions {
1859
- readonly sessionId: string;
1860
- /** Select one Run control record; otherwise the authoritative Session Run is used. */
1861
- readonly runId?: string;
1862
- }
1863
- /** Bounded support classification; `unknown` settlement remains fail-closed. */
1864
- type RuntimeSessionDiagnosticErrorCode = "run_control_unknown" | "run_status_unknown" | "owner_liveness_unconfirmed" | "owner_recovery_required" | "stop_outcome_unconfirmed" | "actor_settlement_retrying" | "actor_settlement_not_persisted" | "run_settlement_not_persisted" | "run_failed" | "terminal_time_unknown";
1865
- interface RuntimeSessionDiagnosticError {
1866
- readonly code: RuntimeSessionDiagnosticErrorCode;
1867
- readonly message: string;
1868
- }
1869
- interface RuntimeSessionDiagnosticRun {
1870
- readonly controlRecord: "present" | "unknown";
1871
- readonly runId?: string;
1872
- readonly turnId?: string;
1873
- readonly state: "queued" | "active" | "terminal" | "unknown";
1874
- readonly phase?: RuntimeRunPhase;
1875
- readonly stage: RuntimeRunStage | "unknown";
1876
- readonly stageChangedAt?: string;
1877
- readonly terminalAt?: string;
1878
- readonly terminalTimeKnown: boolean;
1879
- readonly terminal?: RuntimeTerminalFact;
1880
- readonly failureDetail?: RuntimeFailureDetail;
1881
- readonly activeSubtaskCount: number | null;
1882
- readonly activeSubtaskCountSource: "run_status" | "unknown";
1883
- readonly stop?: RuntimeRunStopStatus;
1884
- readonly interruptInputs?: readonly RuntimeInterruptInputStatus[];
1885
- readonly errors: readonly RuntimeSessionDiagnosticError[];
1886
- }
1887
- interface RuntimeSessionDiagnostics {
1888
- readonly schemaVersion: 1;
1889
- readonly captureStartedAt: string;
1890
- readonly capturedAt: string;
1891
- readonly sdkVersion: string;
1892
- readonly runtimeVersion: string;
1893
- readonly daemonVersion: string | null;
1894
- readonly runtimeId: string;
1895
- readonly runtimeMode: KodaXRuntimeMode;
1896
- readonly sessionId: string;
1897
- readonly observation: {
1898
- readonly seq: number;
1899
- readonly transcriptRevision: string;
1900
- };
1901
- readonly run: RuntimeSessionDiagnosticRun;
1902
- }
1903
- interface RuntimeTranscriptEntryChunkInput {
1904
- readonly sessionId: string;
1905
- readonly revision: string;
1906
- readonly entryIndex: number;
1907
- readonly cursor?: string;
1908
- }
1909
- interface RuntimeTranscriptEntryChunk {
1910
- readonly revision: string;
1911
- readonly entryIndex: number;
1912
- readonly entryId?: string;
1913
- readonly encoding: "base64-json";
1914
- readonly data: string;
1915
- readonly hasMore: boolean;
1916
- readonly nextCursor?: string;
1917
- }
1918
- interface RuntimeConversationHistoryEntryChunk {
1919
- readonly revision: string;
1920
- readonly entryIndex: number;
1921
- readonly boundaryId?: string;
1922
- readonly encoding: "base64-json";
1923
- readonly data: string;
1924
- readonly hasMore: boolean;
1925
- readonly nextCursor?: string;
1926
- }
1927
- interface RuntimeConversationHistoryEntryChunkInput {
1928
- readonly sessionId: string;
1929
- readonly revision: string;
1930
- readonly entryIndex: number;
1931
- readonly cursor?: string;
1932
- }
1933
- interface RuntimeTranscriptSearchInput {
1934
- readonly sessionId: string;
1935
- readonly query: string;
1936
- readonly limit?: number;
1937
- readonly role?: "user" | "assistant";
1938
- readonly scope?: "compacted" | "all";
1939
- }
1940
- interface RuntimeTranscriptSearchHit extends KodaXSessionHistoryHit {
1941
- /** Index accepted by transcriptEntryChunk for this exact transcript revision. */
1942
- readonly entryIndex: number;
1943
- }
1944
- interface RuntimeTranscriptSearchResult {
1945
- readonly revision: string;
1946
- readonly hits: readonly RuntimeTranscriptSearchHit[];
1947
- }
1948
- type RuntimeSessionFilter = ClientSessionFilter;
1949
- interface RuntimeForkSessionInput {
1950
- readonly before?: boolean;
1951
- readonly sessionId: string;
1952
- readonly selector?: string;
1953
- readonly newSessionId?: string;
1954
- readonly title?: string;
1955
- readonly historyBoundary?: RuntimeConversationHistoryBoundary;
1956
- }
1957
- interface RuntimeRecoverSessionInput {
1958
- readonly sessionId: string;
1959
- readonly title?: string;
1960
- readonly reason?: string;
1961
- }
1962
- interface RuntimeConversationHistoryBoundary {
1963
- readonly entryId: string;
1964
- readonly sourceRevision: string;
1965
- }
1966
- type RuntimePermissionMode = "plan" | "accept-edits" | "auto" | "full-access";
1967
- type RuntimePermissionModeInput = RuntimePermissionMode | "auto-in-project";
1968
- type RuntimeCompactionReasoning = boolean | {
1969
- readonly effort: NonNullable<KodaXOptions["effort"]>;
1970
- };
1971
- interface RuntimeSessionSettings {
1972
- readonly planModeEffort?: KodaXOptions["effort"];
1973
- readonly repoIntelligenceMode?: NonNullable<KodaXOptions['context']>['repoIntelligenceMode'];
1974
- readonly repoIntelligenceTrace?: boolean;
1975
- /** Shared manual/automatic summary policy; independent of the main turn's effort. */
1976
- readonly compactionReasoning?: RuntimeCompactionReasoning;
1977
- readonly provider?: string;
1978
- readonly model?: string;
1979
- readonly effort?: KodaXOptions["effort"];
1980
- readonly thinking?: boolean;
1981
- readonly reasoningMode?: KodaXReasoningMode;
1982
- readonly permissionMode?: RuntimePermissionMode;
1983
- readonly executionCwd?: string;
1984
- readonly shellExecution?: KodaXShellExecutionContract;
1985
- readonly agentMode?: KodaXOptions["agentMode"];
1986
- readonly autoModeClassifierModel?: string;
1987
- /** Auto-compaction percentage threshold, normalized to the inclusive 15-90 range. */
1988
- readonly compactionTriggerPercent?: number;
1989
- /** Optional absolute auto-compaction threshold. Missing or zero is inactive. */
1990
- readonly compactionTriggerTokens?: number;
1991
- /** Per-run iteration fuse; unset falls back to the engine default. */
1992
- readonly maxIter?: number;
1993
- }
1994
- interface RuntimeSessionSettingsPatch {
1995
- readonly planModeEffort?: KodaXOptions["effort"] | null;
1996
- readonly repoIntelligenceMode?: RuntimeSessionSettings['repoIntelligenceMode'] | null;
1997
- readonly repoIntelligenceTrace?: boolean | null;
1998
- readonly compactionReasoning?: RuntimeCompactionReasoning | null;
1999
- readonly provider?: string | null;
2000
- readonly model?: string | null;
2001
- readonly effort?: KodaXOptions["effort"] | null;
2002
- readonly thinking?: boolean | null;
2003
- readonly reasoningMode?: KodaXReasoningMode | null;
2004
- readonly permissionMode?: RuntimePermissionModeInput | null;
2005
- readonly executionCwd?: string | null;
2006
- readonly shellExecution?: KodaXShellExecutionContract | null;
2007
- readonly agentMode?: KodaXOptions["agentMode"] | null;
2008
- readonly autoModeClassifierModel?: string | null;
2009
- readonly compactionTriggerPercent?: number | null;
2010
- readonly compactionTriggerTokens?: number | null;
2011
- readonly maxIter?: number | null;
2012
- }
2013
- interface RuntimeAppendNoticeInput {
2014
- readonly sessionId: string;
2015
- readonly content: string;
2016
- readonly source?: string;
2017
- }
2018
- interface RuntimeRewindSessionInput {
2019
- readonly sessionId: string;
2020
- readonly selector?: string;
2021
- readonly expectedHead?: string | null;
2022
- readonly historyBoundary?: RuntimeConversationHistoryBoundary;
2023
- }
2024
- /** Host-confirmed alias backed by an existing interrupt delivery event. */
2025
- interface RuntimeConfirmIdentityAliasInput {
2026
- readonly sessionId: string;
2027
- readonly sourceEntryId: string;
2028
- readonly targetEntryId: string;
2029
- /** Latest conversation source revision. On data_changed, reload and revalidate
2030
- * before retrying; a cold Runtime's Actor claim can also change this revision. */
2031
- readonly expectedSourceRevision: string;
2032
- readonly confirmationReference: string;
2033
- readonly delivery: {
2034
- readonly runId: string;
2035
- readonly inputId: string;
2036
- readonly eventId: string;
2037
- };
2038
- }
2039
- interface RuntimeSetActiveEntryInput {
2040
- readonly sessionId: string;
2041
- readonly entryId: string;
2042
- /** FEATURE_298 T34 — summarize the abandoned branch before switching (REPL /branch semantics). */
2043
- readonly summarizeCurrentBranch?: boolean;
2044
- }
2045
- interface RuntimeCompactSessionInput {
2046
- readonly sessionId: string;
2047
- readonly provider?: string;
2048
- readonly model?: string;
2049
- readonly customInstructions?: string;
2050
- readonly contextWindow?: number;
2051
- /** Override the Session percentage threshold used to size the protected tail. */
2052
- readonly triggerPercent?: number;
2053
- /** Override the Session absolute threshold used to size the protected tail. */
2054
- readonly triggerTokens?: number;
2055
- /** Daemon-issued credential lease used only by this compaction operation. */
2056
- readonly credential?: RuntimeCredentialBinding;
2057
- }
2058
- /**
2059
- * FEATURE_298 T30 — agent mutations carry their own domain identity
2060
- * (followup expectedRevision, actor turn semantics); the generic operation
2061
- * envelope is deliberately not part of this contract.
2062
- */
2063
- interface RuntimeAgentOperationOptions {
2064
- readonly credential?: RuntimeCredentialBinding;
2065
- readonly authorization?: RuntimeExecutionAuthorization;
2066
- }
2067
- interface RuntimeAgentFollowupOptions extends RuntimeAgentOperationOptions {
2068
- readonly expectedRevision?: number;
2069
- }
2070
- interface RuntimeCompactSessionResult extends CompactSessionResult {
2071
- readonly session?: RuntimeSession;
2072
- }
2073
- interface RuntimeVersionedValue<T> {
2074
- readonly revision: number;
2075
- readonly value: T;
2076
- }
2077
- interface RuntimeVersionedUpdateOptions {
2078
- readonly expectedRevision: number;
2079
- }
2080
- interface RuntimeActiveToolProjection {
2081
- readonly key: string;
2082
- readonly runId: string;
2083
- readonly turnId?: string;
2084
- readonly started: unknown;
2085
- readonly progress?: unknown;
2086
- readonly sandbox?: RuntimeToolSandboxEventPayload;
2087
- }
2088
- interface RuntimePendingUserInputProjection {
2089
- readonly requestId: string;
2090
- readonly runId: string;
2091
- readonly turnId?: string;
2092
- readonly detail: unknown;
2093
- }
2094
- interface RuntimeManagedTaskProjection {
2095
- readonly runId: string;
2096
- readonly turnId?: string;
2097
- readonly status: KodaXManagedTaskStatusEvent;
2098
- }
2099
- interface RuntimeSessionLiveProjection {
2100
- readonly iterationsByRun?: Readonly<Record<string, {
2101
- readonly current: number;
2102
- readonly max: number;
2103
- }>>;
2104
- readonly assistantTextByRun: Readonly<Record<string, string>>;
2105
- readonly thinkingTextByRun: Readonly<Record<string, string>>;
2106
- readonly outputSegmentsByRun: Readonly<Record<string, KodaXOutputSegmentProjection>>;
2107
- readonly activeTools: readonly RuntimeActiveToolProjection[];
2108
- readonly todo?: unknown;
2109
- readonly pendingUserInputs: readonly RuntimePendingUserInputProjection[];
2110
- readonly managedTasks: readonly RuntimeManagedTaskProjection[];
2111
- }
2112
- interface RuntimeSessionObservationSnapshot {
2113
- readonly runtimeId: string;
2114
- /** Live event ordering high-water at capture; events with seq <= this are already reflected in the snapshot. */
2115
- readonly seq: number;
2116
- /** Content-derived token for the transcript captured at this observation boundary. */
2117
- readonly transcriptRevision: string;
2118
- readonly session: RuntimeSession;
2119
- readonly transcript: RuntimeTranscriptSlice | null;
2120
- readonly settings: RuntimeVersionedValue<RuntimeSessionSettings>;
2121
- readonly runs: readonly RuntimeRunStatus[];
2122
- readonly pendingPermissions: readonly RuntimePermissionRequest[];
2123
- readonly live: RuntimeSessionLiveProjection;
2124
- }
2125
- interface RuntimeSessionObservation extends RuntimeSubscription {
2126
- readonly snapshot: RuntimeSessionObservationSnapshot;
2127
- readonly invalidated: Promise<RuntimeObservationInvalidation>;
2128
- }
2129
- interface RuntimeObservationInvalidation {
2130
- readonly code: "observation_invalidated";
2131
- readonly reason: "event_overflow" | "event_order" | "delivery_failed" | "runtime_changed" | "transport_disconnected";
2132
- readonly runtimeId: string;
2133
- readonly message: string;
2134
- }
2135
- interface RuntimeSessionService {
2136
- observeView(sessionId: string, listener: (view: ClientSessionView) => void, options?: ClientObserveOptions): Promise<ClientObservation>;
2137
- readViewItem(sessionId: string, itemId: string, options?: ClientItemReadOptions): Promise<ClientItemContent | null>;
2138
- readHistory(sessionId: string, options?: ClientHistoryReadOptions): Promise<ClientHistoryPage>;
2139
- readHistoryEntry(sessionId: string, itemId: string, options?: ClientItemReadOptions): Promise<ClientItemContent | null>;
2140
- searchHistory(sessionId: string, input: ClientHistorySearchInput): Promise<ClientHistorySearchResult>;
2141
- readGoal(sessionId: string): Promise<KodaXGoalState | null>;
2142
- createGoal(input: {
2143
- readonly sessionId: string;
2144
- readonly objective: string;
2145
- readonly tokenBudget?: number;
2146
- }): Promise<KodaXGoalState>;
2147
- pauseGoal(sessionId: string): Promise<KodaXGoalState>;
2148
- resumeGoal(sessionId: string): Promise<KodaXGoalState>;
2149
- clearGoal(sessionId: string): Promise<void>;
2150
- readLineage(sessionId: string): Promise<ClientLineageSummary | null>;
2151
- labelEntry(input: {
2152
- readonly sessionId: string;
2153
- readonly selector: string;
2154
- readonly label?: string;
2155
- }): Promise<ClientLineageSummary>;
2156
- cancel(input: RuntimeSessionCancelInput): Promise<RuntimeSessionCancelReceipt>;
2157
- create(input?: RuntimeCreateSessionInput): Promise<RuntimeSession>;
2158
- load(sessionId: string, options?: RuntimeReadOptions): Promise<RuntimeSession>;
2159
- list(filter?: RuntimeSessionFilter): Promise<readonly RuntimeSessionSummary[]>;
2160
- status(sessionId: string): Promise<RuntimeSessionStatus>;
2161
- transcript(sessionId: string, options?: RuntimeReadOptions): Promise<RuntimeTranscript | null>;
2162
- transcriptPage(input: RuntimeTranscriptPageInput, options?: RuntimeReadOptions): Promise<RuntimeTranscriptSlice | null>;
2163
- transcriptEntryChunk(input: RuntimeTranscriptEntryChunkInput, options?: RuntimeReadOptions): Promise<RuntimeTranscriptEntryChunk | null>;
2164
- transcriptSearch(input: RuntimeTranscriptSearchInput, options?: RuntimeReadOptions): Promise<RuntimeTranscriptSearchResult | null>;
2165
- conversation(sessionId: string, options?: RuntimeReadOptions): Promise<RuntimeConversationHistory | null>;
2166
- conversationPage(input: RuntimeConversationHistoryPageInput, options?: RuntimeReadOptions): Promise<RuntimeConversationHistorySlice | null>;
2167
- conversationEntryChunk(input: RuntimeConversationHistoryEntryChunkInput, options?: RuntimeReadOptions): Promise<RuntimeConversationHistoryEntryChunk | null>;
2168
- observe(sessionId: string, listener: RuntimeEventListener, options?: RuntimeReadOptions): Promise<RuntimeSessionObservation>;
2169
- /**
2170
- * Captures a bounded, read-only diagnostic boundary without recovering,
2171
- * taking over, or otherwise mutating Session or Run state.
2172
- */
2173
- diagnostics(input: RuntimeSessionDiagnosticsInput): Promise<RuntimeSessionDiagnostics>;
2174
- fork(input: RuntimeForkSessionInput): Promise<RuntimeSession | null>;
2175
- recover(input: RuntimeRecoverSessionInput): Promise<RuntimeSession>;
2176
- getSettings(sessionId: string): Promise<RuntimeSessionSettings>;
2177
- getSettingsVersioned(sessionId: string): Promise<RuntimeVersionedValue<RuntimeSessionSettings>>;
2178
- /** Runtime-owned Auto classifier state used by diagnostics and status UI. */
2179
- getAutoModeStats(sessionId: string): Promise<AutoModeStats | undefined>;
2180
- updateSettings(sessionId: string, patch: RuntimeSessionSettingsPatch): Promise<RuntimeSessionSettings>;
2181
- updateSettingsVersioned(sessionId: string, patch: RuntimeSessionSettingsPatch, options: RuntimeVersionedUpdateOptions): Promise<RuntimeVersionedValue<RuntimeSessionSettings>>;
2182
- appendNotice(input: RuntimeAppendNoticeInput): Promise<SessionTranscriptEntry | null>;
2183
- rewind(input: RuntimeRewindSessionInput): Promise<RuntimeSession | null>;
2184
- confirmIdentityAlias(input: RuntimeConfirmIdentityAliasInput): Promise<KodaXExtensionSessionRecord>;
2185
- setActiveEntry(input: RuntimeSetActiveEntryInput): Promise<RuntimeSession | null>;
2186
- compact(input: RuntimeCompactSessionInput): Promise<RuntimeCompactSessionResult>;
2187
- archive(sessionId: string): Promise<void>;
2188
- unarchive(sessionId: string): Promise<void>;
2189
- delete(sessionId: string): Promise<void>;
2190
- }
2191
- type RuntimeRunPhase = "queued" | "running" | "waiting_agent" | "recovering" | "waiting_permission" | "waiting_user_input" | "unknown" | "completed" | "failed" | "cancelled" | "interrupted";
2192
- type RuntimeRunStage = "queued" | "executing" | "waiting_agent" | "recovering" | "finalizing" | "terminal" | "unknown" | "starting" | "routing" | "preflight" | "round" | "worker" | "upgrade" | "verifying";
2193
- interface RuntimeSessionStatus {
2194
- readonly sessionId: string;
2195
- readonly runtimeId: string;
2196
- readonly phase: "idle" | RuntimeRunPhase;
2197
- readonly observedAt: string;
2198
- readonly runId?: string;
2199
- }
2200
- type RuntimeRunMode = "coding" | "managed_task";
2201
- interface RuntimeTextInput {
2202
- readonly type: "text";
2203
- readonly text: string;
2204
- }
2205
- interface RuntimeImageInput {
2206
- readonly type: "image";
2207
- readonly path: string;
2208
- readonly mediaType?: KodaXImageInputArtifact["mediaType"];
2209
- readonly source?: KodaXInputArtifactSource;
2210
- readonly description?: string;
2211
- }
2212
- interface RuntimeFileInput {
2213
- readonly type: "file";
2214
- readonly path: string;
2215
- readonly mediaType?: string;
2216
- readonly mimeType?: string;
2217
- readonly name?: string;
2218
- readonly source?: KodaXInputArtifactSource;
2219
- readonly description?: string;
2220
- }
2221
- interface RuntimeVideoInput {
2222
- readonly type: "video";
2223
- readonly path: string;
2224
- readonly mediaType: KodaXVideoInputArtifact["mediaType"];
2225
- readonly name?: string;
2226
- readonly source?: KodaXInputArtifactSource;
2227
- readonly description?: string;
2228
- }
2229
- interface RuntimeArtifactRefInput {
2230
- readonly type: "artifact_ref";
2231
- readonly artifactId: string;
2232
- readonly description?: string;
2233
- }
2234
- type RuntimeInput = RuntimeTextInput | RuntimeImageInput | RuntimeFileInput | RuntimeVideoInput | RuntimeArtifactRefInput;
2235
- type RuntimePermissionBroker = "runtime" | "client";
2236
- interface RuntimeStartRunInput {
2237
- readonly authorization?: RuntimeExecutionAuthorization;
2238
- readonly sessionId: string;
2239
- /** Stable product identity for an explicit tool invocation. */
2240
- readonly inputId?: string;
2241
- readonly prompt?: string;
2242
- readonly input?: RuntimeInput | readonly RuntimeInput[];
2243
- readonly mode?: RuntimeRunMode;
2244
- readonly permissionBroker?: RuntimePermissionBroker;
2245
- readonly options?: RuntimeKodaXOptions;
2246
- /** Host-derived dispatch identity; never accepted from an LLM tool payload. */
2247
- readonly agentContext?: AgentDispatchContext;
2248
- /** Daemon-issued lease binding; contains no credential material. */
2249
- readonly credential?: RuntimeCredentialBinding;
2250
- /** Daemon-issued host capability binding. Unbound runs never inherit it. */
2251
- readonly hostTools?: {
2252
- readonly leaseId: string;
2253
- };
2254
- }
2255
- interface RuntimeSubmitInput {
2256
- readonly sessionId: string;
2257
- readonly afterRunId: string;
2258
- readonly delivery: "after_turn" | "interrupt";
2259
- readonly input: RuntimeInput | readonly RuntimeInput[];
2260
- /** Continuations receive only bindings explicitly supplied for this input. */
2261
- readonly credential?: RuntimeCredentialBinding;
2262
- readonly hostTools?: {
2263
- readonly leaseId: string;
2264
- };
2265
- }
2266
- type RuntimeSubmitInputResult = {
2267
- readonly accepted: true;
2268
- readonly delivery: "after_turn";
2269
- readonly runId: string;
2270
- readonly sessionId: string;
2271
- readonly afterRunId: string;
2272
- readonly sessionOrder: number;
2273
- } | {
2274
- readonly accepted: true;
2275
- readonly delivery: "interrupt";
2276
- readonly inputId: string;
2277
- /** The existing active Run that owns this input; no new Run is created. */
2278
- readonly runId: string;
2279
- readonly sessionId: string;
2280
- readonly afterRunId: string;
2281
- readonly sessionOrder: number;
2282
- } | {
2283
- readonly accepted: false;
2284
- readonly delivery: "after_turn" | "interrupt";
2285
- readonly sessionId: string;
2286
- readonly afterRunId: string;
2287
- readonly reason: "stale_run" | "unsupported_capability" | "interrupt_window_closed";
2288
- };
2289
- type RuntimeKodaXOptions = Omit<KodaXOptions, "provider" | "session" | "events"> & {
2290
- readonly provider?: string;
2291
- readonly session?: KodaXOptions["session"];
2292
- readonly events?: KodaXEvents;
2293
- };
2294
- type RuntimeDaemonContextOptions = Pick<KodaXContextOptions, "gitRoot" | "executionCwd" | "shellExecution" | "contextTokenSnapshot" | "projectSnapshot" | "longRunning" | "providerPolicyHints" | "repoRoutingSignals" | "repoIntelligenceMode" | "repoIntelligenceTrace" | "contextDiagnostics" | "disableAutoTaskReroute" | "toolConstructionMode" | "skillsPrompt" | "rawUserInput" | "skillInvocation" | "repoIntelligenceContext" | "inputArtifacts" | "promptOverlay" | "taskSurface" | "liveTurn" | "managedTaskWorkspaceDir" | "managedProtocolEmission" | "excludeTools" | "systemPromptOverride" | "taskMetadata" | "taskVerification" | "agentProfile" | "currentAgentId" | "parentAgentId">;
2295
- type RuntimeDaemonKodaXOptions = Pick<RuntimeKodaXOptions, "provider" | "model" | "modelOverride" | "effort" | "thinking" | "reasoningMode" | "agentMode" | "maxIter" | "toolInvocation" | "workflowHostPolicy" | "workflowRunsBaseDir" | "modelTiers" | "maxOutputTokens" | "disablePromptCache" | "lsp" | "workflow" | "selfManual" | "compaction" | "timeouts" | "sandbox"> & {
2296
- readonly context?: RuntimeDaemonContextOptions;
2297
- };
2298
- type RuntimeDaemonStartRunInput = Omit<RuntimeStartRunInput, "options" | "agentContext" | "permissionBroker"> & {
2299
- readonly options?: RuntimeDaemonKodaXOptions;
2300
- };
2301
- interface RuntimeDaemonRunService extends Omit<RuntimeRunService, "start"> {
2302
- start(input: RuntimeDaemonStartRunInput): Promise<RuntimeRunHandle>;
2303
- }
2304
- type KodaXDaemonRuntime = Omit<KodaXRuntime, "runs"> & {
2305
- readonly runs: RuntimeDaemonRunService;
2306
- readonly daemon: RuntimeDaemonManagementService;
2307
- };
2308
- interface RuntimeRunStatus {
2309
- readonly productInput?: {
2310
- readonly inputId: string;
2311
- readonly digest: string;
2312
- };
2313
- readonly runId: string;
2314
- readonly sessionId: string;
2315
- readonly turnId?: string;
2316
- readonly phase: RuntimeRunPhase;
2317
- /** Fine-grained executor stage within the coarse lifecycle phase. */
2318
- readonly stage?: RuntimeRunStage;
2319
- readonly stageChangedAt?: string;
2320
- /** Present only when the managed executor reported an authoritative count. */
2321
- readonly activeSubtaskCount?: number;
2322
- readonly startedAt: string;
2323
- /** Durable acceptance timestamp; equals startedAt for protocol v1. */
2324
- readonly acceptedAt?: string;
2325
- readonly sessionOrder?: number;
2326
- readonly queuedAt?: string;
2327
- readonly runningAt?: string;
2328
- readonly executionStartedAt?: string;
2329
- readonly endedAt?: string;
2330
- readonly provider: string;
2331
- readonly mode?: RuntimeRunMode;
2332
- readonly origin?: {
2333
- readonly principalId: string;
2334
- readonly clientName?: string;
2335
- readonly clientVersion?: string;
2336
- };
2337
- readonly model?: string;
2338
- readonly reasoning?: KodaXReasoningMode;
2339
- readonly error?: string;
2340
- readonly failureDetail?: RuntimeFailureDetail;
2341
- readonly lifecycleError?: RuntimeRunLifecycleError;
2342
- readonly terminal?: RuntimeTerminalFact;
2343
- readonly continuation?: RuntimeContinuationStatus;
2344
- readonly interruptInputs?: readonly RuntimeInterruptInputStatus[];
2345
- /** Durable Stop request/result; distinct from chat interruptInputs. */
2346
- readonly stop?: RuntimeRunStopStatus;
2347
- readonly requirements?: RuntimeRunRequirements;
2348
- }
2349
- /** Durable lifecycle uncertainty reported without converting it into a successful terminal. */
2350
- interface RuntimeRunLifecycleError {
2351
- readonly code: "actor_settlement_retrying" | "actor_settlement_not_persisted" | "run_settlement_not_persisted";
2352
- readonly message: string;
2353
- readonly retryable: boolean;
2354
- }
2355
- interface RuntimeRunRequirements {
2356
- readonly credential?: {
2357
- readonly leaseId: string;
2358
- readonly provider: string;
2359
- readonly state: "ready" | "expired" | "terminal";
2360
- };
2361
- readonly hostTools?: {
2362
- readonly leaseId: string;
2363
- readonly state: "ready" | "waiting_host" | "expired" | "terminal";
2364
- };
2365
- }
2366
- interface RuntimeContinuationStatus {
2367
- readonly inputId: string;
2368
- readonly afterRunId: string;
2369
- readonly delivery: "after_turn";
2370
- readonly state: "queued" | "delivered" | "terminal";
2371
- readonly contentPreview: string;
2372
- }
2373
- interface RuntimeInterruptInputStatus {
2374
- readonly inputId: string;
2375
- readonly afterRunId: string;
2376
- readonly delivery: "interrupt";
2377
- readonly state: "queued" | "delivered" | "terminal";
2378
- readonly contentPreview: string;
2379
- readonly queuedAt: string;
2380
- readonly deliveredAt?: string;
2381
- /** Canonical user-entry reference; absent before delivery or in legacy records. */
2382
- readonly entryId?: string;
2383
- readonly origin?: RuntimeRunStatus["origin"];
2384
- }
2385
- interface RuntimeRunStopStatus {
2386
- readonly requestedAt: string;
2387
- readonly state: "unknown" | "confirmed";
2388
- readonly outcome: "unknown" | "cancelled" | "interrupted" | "completed" | "failed";
2389
- readonly reason: string;
2390
- readonly resolvedAt?: string;
2391
- }
2392
- interface RuntimeRunStopReceipt {
2393
- readonly runId: string;
2394
- readonly sessionId: string;
2395
- /** True only when this invocation durably created the Stop request. */
2396
- readonly accepted: boolean;
2397
- readonly state: RuntimeRunStopStatus["state"];
2398
- readonly outcome: RuntimeRunStopStatus["outcome"];
2399
- readonly phase: RuntimeRunPhase;
2400
- /** Durable Run control-record revision observed by this receipt. */
2401
- readonly revision: number;
2402
- }
2403
- interface RuntimeSessionCancelInput {
2404
- readonly sessionId: string;
2405
- /** Must be nonterminal for a first request; accepted requests remain replayable after settlement. */
2406
- readonly expectedRunId: string;
2407
- readonly requestId: string;
2408
- }
2409
- interface RuntimeSessionCancelReceipt extends RuntimeSessionCancelInput {
2410
- readonly frontier: number;
2411
- readonly receipts: readonly RuntimeRunStopReceipt[];
2412
- }
2413
- type RuntimeTerminalCode = "completed" | "run_failed" | "blocked" | "cancelled" | "interrupted" | "runtime_restarted" | "daemon_crashed" | "credential_unavailable" | "host_not_dispatched" | "host_outcome_unknown" | "actor_settlement_not_persisted";
2414
- /** Credential-safe failure category; raw provider error text is never required. */
2415
- type RuntimeRunFailureKind = "auth" | "rate_limit" | "network" | "not_found" | "unknown_provider" | "request" | "upstream" | "cancelled" | "provider_aborted" | "invalid_response" | "runtime_cleanup" | "local_execution" | "context_capacity" | "provider";
2416
- type RuntimeFailureStage = "catalog" | "credential" | "request_build" | "transport" | "response_stream" | "runtime_control" | "local_execution" | "runtime_settlement";
2417
- type RuntimeProviderErrorCode = "credential_unavailable" | "authentication_failed" | "rate_limited" | "network_error" | "tls_error" | "request_timeout" | "provider_not_registered" | "catalog_error" | "model_not_found" | "endpoint_not_found" | "resource_not_found" | "request_build_failed" | "upstream_client_error" | "upstream_server_error" | "protocol_mismatch" | "response_stream_error" | "cancelled" | "runtime_settlement_failed" | "local_execution_error" | "context_capacity_exceeded" | "provider_error";
2418
- interface RuntimeFailureDetail {
2419
- readonly failureKind: RuntimeRunFailureKind;
2420
- readonly stage: RuntimeFailureStage;
2421
- /** Stable KodaX code suitable for programmatic handling. */
2422
- readonly providerErrorCode: RuntimeProviderErrorCode;
2423
- /** Bounded KodaX-owned display text; never derived from provider response bodies. */
2424
- readonly safeMessage: string;
2425
- readonly httpStatus?: number;
2426
- /** Provider-controlled code; informative only and not part of KodaX compatibility. */
2427
- readonly upstreamErrorCode?: string;
2428
- readonly requestId?: string;
2429
- readonly retryAfterMs?: number;
2430
- /** Actual Provider/model used by the failed child request, when safely representable. */
2431
- readonly provider?: string;
2432
- readonly model?: string;
2433
- /** Fine-grained Provider request lifecycle phase from the coding executor. */
2434
- readonly requestPhase?: KodaXExecutionFailure["requestPhase"];
2435
- readonly elapsedMs?: number;
2436
- /** Local context-capacity accounting (FEATURE_296); absent for non-capacity failures. */
2437
- readonly contextTokens?: {
2438
- readonly required: number;
2439
- readonly available: number;
2440
- };
2441
- /** Upstream token evidence; bounds are never presented as exact required totals. */
2442
- readonly contextOverflow?: KodaXContextOverflowFacts;
2443
- }
2444
- interface RuntimeTerminalFact {
2445
- readonly revision: number;
2446
- readonly kind: "completed" | "failed" | "cancelled" | "interrupted";
2447
- readonly code: RuntimeTerminalCode;
2448
- readonly effectOutcome: "none" | "known" | "unknown";
2449
- readonly message?: string;
2450
- /** Safe diagnostic category for failed terminals, independent from display text. */
2451
- readonly failureKind?: RuntimeRunFailureKind;
2452
- }
2453
- interface RuntimeRunResult {
2454
- readonly runId: string;
2455
- readonly sessionId: string;
2456
- readonly phase: RuntimeRunPhase;
2457
- readonly result?: KodaXResult;
2458
- readonly error?: Error;
2459
- readonly failureDetail?: RuntimeFailureDetail;
2460
- readonly terminal?: RuntimeTerminalFact;
2461
- readonly stop?: RuntimeRunStopStatus;
2462
- }
2463
- interface RuntimeRunHandle {
2464
- readonly runId: string;
2465
- readonly sessionId: string;
2466
- readonly turnId?: string;
2467
- readonly result: Promise<RuntimeRunResult>;
2468
- }
2469
- interface RuntimeRunFilter {
2470
- readonly sessionId?: string;
2471
- readonly phase?: RuntimeRunPhase | readonly RuntimeRunPhase[];
2472
- }
2473
- interface RuntimeRunService {
2474
- acceptInput(input: ClientSubmitInput & {
2475
- readonly authorization?: RuntimeExecutionAuthorization;
2476
- }): Promise<ClientInputAcceptance>;
2477
- getInput(sessionId: string, inputId: string): Promise<ClientInputAcceptance | null>;
2478
- withdrawInput(sessionId: string, inputId: string): Promise<ClientSubmitInput>;
2479
- start(input: RuntimeStartRunInput): Promise<RuntimeRunHandle>;
2480
- submitInput(input: RuntimeSubmitInput): Promise<RuntimeSubmitInputResult>;
2481
- await(runId: string): Promise<RuntimeRunResult>;
2482
- get(runId: string): Promise<RuntimeRunStatus>;
2483
- list(filter?: RuntimeRunFilter): Promise<readonly RuntimeRunStatus[]>;
2484
- /**
2485
- * Requests Stop for this Run and its owned work; successor Runs are retained.
2486
- * accepted means the request was recorded, not that effects have stopped.
2487
- * Observe state/outcome for confirmation; repeated requests are idempotent.
2488
- */
2489
- abort(runId: string): Promise<RuntimeRunStopReceipt>;
2490
- setModel(runId: string, model: string | undefined): Promise<void>;
2491
- setProvider(runId: string, provider: string): Promise<void>;
2492
- setReasoning(runId: string, reasoning: KodaXReasoningMode | undefined): Promise<void>;
2493
- }
2494
- type RuntimeEventType = "session.created" | "session.loaded" | "session.settings.updated" | "session.notice.appended" | "session.rewound" | "session.active_entry.updated" | "session.compacted" | "run.queued" | "run.started" | "run.updated" | "run.progress" | "run.input.queued" | "run.input.delivered" | "turn.started" | "turn.completed" | "turn.failed" | "output.segment.started" | "assistant.delta" | "thinking.delta" | "thinking.finished" | "tool.started" | "tool.progress" | "tool.sandbox" | "tool.finished" | "user_input.requested" | "user_input.resolved" | "permission.requested" | "permission.resolved" | "permission.grant.changed" | "workflow.started" | "workflow.updated" | "workflow.finished" | "context.compaction.started" | "context.compaction.stats" | "context.compaction.finished" | "context.compaction.messages" | "context.compaction.ended" | "context.compaction.skipped" | "context.budget.snapshot" | "tool.exposure.planned" | "child_activity.finished" | "provider.retry" | "provider.recovery" | "provider.cache.diagnostics" | "repo_intelligence.trace" | "todo.updated" | "todo.warning" | "run.completed" | "run.failed" | "run.cancelled" | "run.interrupted" | "artifact.created" | "config.effective" | "runtime.warning";
2495
- interface RuntimeTextDeltaEventPayload {
2496
- readonly text: string;
2497
- /** Absent only in events emitted before liveOutputSegments:1. */
2498
- readonly providerRequestId?: string;
2499
- readonly meta?: KodaXActivityEventMeta;
2500
- }
2501
- interface RuntimeOutputSegmentStartedEventPayload extends KodaXOutputSegmentStarted {
2502
- readonly meta?: KodaXActivityEventMeta;
2503
- }
2504
- interface RuntimeThinkingFinishedEventPayload {
2505
- readonly thinking: string;
2506
- readonly meta?: KodaXActivityEventMeta;
2507
- }
2508
- interface RuntimeToolStartedEventPayload {
2509
- readonly tool: {
2510
- readonly name: string;
2511
- readonly id: string;
2512
- readonly input?: Readonly<Record<string, unknown>>;
2513
- };
2514
- readonly meta?: KodaXToolEventMeta;
2515
- }
2516
- type RuntimeToolProgressEventPayload = {
2517
- readonly update: Parameters<NonNullable<KodaXEvents['onToolProgress']>>[0];
2518
- readonly meta?: KodaXToolEventMeta;
2519
- } | {
2520
- readonly toolName: string;
2521
- readonly partialJson: string;
2522
- readonly meta?: KodaXToolEventMeta;
2523
- };
2524
- interface RuntimeToolSandboxEventPayload {
2525
- readonly update: KodaXToolSandboxObservationUpdate;
2526
- readonly meta?: KodaXToolEventMeta;
2527
- }
2528
- interface RuntimeToolFinishedEventPayload {
2529
- readonly result: {
2530
- readonly id: string;
2531
- readonly name: string;
2532
- readonly content: string;
2533
- };
2534
- readonly meta?: KodaXToolEventMeta;
2535
- }
2536
- type RuntimeRunProgressEventPayload = {
2537
- readonly kind: "managed_task_status";
2538
- readonly status: KodaXManagedTaskStatusEvent;
2539
- } | {
2540
- readonly kind: "stream_end" | "complete";
2541
- readonly meta?: KodaXActivityEventMeta;
2542
- } | {
2543
- readonly kind: "iteration_start";
2544
- readonly iter: number;
2545
- readonly maxIter: number;
2546
- readonly meta?: KodaXActivityEventMeta;
2547
- } | {
2548
- readonly kind: "iteration_end";
2549
- readonly info: Readonly<Record<string, unknown>>;
2550
- } | {
2551
- readonly kind: "mid_turn_user_messages";
2552
- readonly contents: readonly string[];
2553
- readonly meta?: KodaXActivityEventMeta;
2554
- };
2555
- interface RuntimeTodoUpdatedEventPayload {
2556
- readonly items: readonly unknown[];
2557
- readonly meta?: KodaXActivityEventMeta;
2558
- }
2559
- interface RuntimeRunInputQueuedEventPayload {
2560
- readonly input: RuntimeInterruptInputStatus;
2561
- }
2562
- interface RuntimeDeliveredInterruptInput {
2563
- readonly inputId: string;
2564
- readonly afterRunId: string;
2565
- readonly input: RuntimeInput | readonly RuntimeInput[];
2566
- readonly queuedAt: string;
2567
- readonly deliveredAt: string;
2568
- /**
2569
- * Canonical user-entry reference created by durable input persistence.
2570
- * Optional only because legacy persisted events may not contain it.
2571
- */
2572
- readonly entryId?: string;
2573
- readonly origin?: RuntimeRunStatus["origin"];
2574
- }
2575
- interface RuntimeRunInputDeliveredEventPayload {
2576
- readonly inputs: readonly RuntimeDeliveredInterruptInput[];
2577
- }
2578
- interface RuntimeInteractionResolvedEventPayload {
2579
- readonly requestId: string;
2580
- readonly status?: string;
2581
- readonly decision?: RuntimePermissionDecision;
2582
- readonly kind?: RuntimeUserInputKind;
2583
- }
2584
- interface RuntimePermissionGrantChangedEventPayload {
2585
- readonly action: "created" | "revoked" | "expired";
2586
- readonly grant: RuntimePermissionGrant;
2587
- readonly revision: number;
2588
- }
2589
- interface RuntimeWarningEventPayload {
2590
- readonly message: string;
2591
- readonly source?: string;
2592
- readonly severity?: string;
2593
- readonly sourceEventId?: string;
2594
- }
2595
- interface RuntimeContextCompactionStartedEventPayload {
2596
- readonly meta?: KodaXActivityEventMeta;
2597
- }
2598
- type RuntimeContextCompactionStatsEventPayload = {
2599
- readonly tokensBefore: number;
2600
- readonly tokensAfter: number;
2601
- } & Partial<KodaXLiveEventMeta>;
2602
- /** Legacy events and non-managed compaction paths may omit the structured outcome. */
2603
- type RuntimeContextCompactionEndedEventPayload = ({
2604
- readonly meta?: KodaXActivityEventMeta;
2605
- } & KodaXCompactionEndResult) | {
2606
- readonly meta?: KodaXActivityEventMeta;
2607
- readonly outcome?: undefined;
2608
- };
2609
- type RuntimeContextCompactionSkippedEventPayload = RuntimeCompactionSkippedEvent & Partial<KodaXLiveEventMeta>;
2610
- type RuntimeContextCompactionFinishedEventPayload = KodaXContextCompactionFinishedEvent & KodaXContextIdentity & {
2611
- readonly beforeRevision: number;
2612
- readonly afterRevision: number;
2613
- readonly reason?: string;
2614
- };
2615
- interface RuntimeContextCompactionMessagesEventPayload {
2616
- readonly messageCount: number;
2617
- readonly update?: {
2618
- readonly hasAnchor: boolean;
2619
- readonly tokensBefore?: number;
2620
- readonly tokensAfter?: number;
2621
- readonly entriesRemoved?: number;
2622
- readonly reason?: string;
2623
- readonly artifactLedgerEntryCount: number;
2624
- readonly postCompactAttachmentCount: number;
2625
- readonly exactSnapshotAvailable: boolean;
2626
- };
2627
- readonly meta?: KodaXActivityEventMeta;
2628
- }
2629
- interface RuntimeSessionSettingsUpdatedEventPayload {
2630
- readonly sessionId: string;
2631
- readonly revision: number;
2632
- readonly settings: RuntimeSessionSettings;
2633
- readonly patch: RuntimeSessionSettingsPatch;
2634
- }
2635
- type RuntimeUserInputRequestedEventPayload = RuntimeUserInputRequest | {
2636
- readonly requestId: string;
2637
- readonly kind: RuntimeUserInputKind;
2638
- readonly options: unknown;
2639
- };
2640
- type RuntimeEventPayloadDefaults = {
2641
- readonly [K in RuntimeEventType]: unknown;
2642
- };
2643
- type RuntimeEventPayloadMap = Omit<RuntimeEventPayloadDefaults, "session.created" | "session.loaded" | "run.queued" | "run.started" | "run.updated" | "run.completed" | "run.failed" | "run.cancelled" | "run.interrupted" | "output.segment.started" | "assistant.delta" | "thinking.delta" | "thinking.finished" | "tool.started" | "tool.progress" | "tool.sandbox" | "tool.finished" | "run.progress" | "run.input.queued" | "run.input.delivered" | "todo.updated" | "user_input.requested" | "user_input.resolved" | "permission.requested" | "permission.resolved" | "permission.grant.changed" | "session.settings.updated" | "turn.started" | "turn.completed" | "turn.failed" | "workflow.started" | "workflow.updated" | "workflow.finished" | "context.budget.snapshot" | "provider.cache.diagnostics" | "tool.exposure.planned" | "context.compaction.started" | "context.compaction.stats" | "context.compaction.ended" | "context.compaction.skipped" | "context.compaction.messages" | "context.compaction.finished" | "runtime.warning"> & {
2644
- readonly "session.created": RuntimeSession;
2645
- readonly "session.loaded": RuntimeSessionLoadedEventPayload;
2646
- readonly "run.queued": RuntimeRunStatus;
2647
- readonly "run.started": RuntimeRunStatus;
2648
- readonly "run.updated": RuntimeRunStatus;
2649
- readonly "run.completed": RuntimeRunStatus;
2650
- readonly "run.failed": RuntimeRunStatus;
2651
- readonly "run.cancelled": RuntimeRunStatus;
2652
- readonly "run.interrupted": RuntimeRunStatus;
2653
- readonly "output.segment.started": RuntimeOutputSegmentStartedEventPayload;
2654
- readonly "assistant.delta": RuntimeTextDeltaEventPayload;
2655
- readonly "thinking.delta": RuntimeTextDeltaEventPayload;
2656
- readonly "thinking.finished": RuntimeThinkingFinishedEventPayload;
2657
- readonly "tool.started": RuntimeToolStartedEventPayload;
2658
- readonly "tool.progress": RuntimeToolProgressEventPayload;
2659
- readonly "tool.sandbox": RuntimeToolSandboxEventPayload;
2660
- readonly "tool.finished": RuntimeToolFinishedEventPayload;
2661
- readonly "run.progress": RuntimeRunProgressEventPayload;
2662
- readonly "run.input.queued": RuntimeRunInputQueuedEventPayload;
2663
- readonly "run.input.delivered": RuntimeRunInputDeliveredEventPayload;
2664
- readonly "todo.updated": RuntimeTodoUpdatedEventPayload;
2665
- readonly "user_input.requested": RuntimeUserInputRequestedEventPayload;
2666
- readonly "user_input.resolved": RuntimeInteractionResolvedEventPayload;
2667
- readonly "permission.requested": RuntimePermissionRequest;
2668
- readonly "permission.resolved": RuntimeInteractionResolvedEventPayload;
2669
- readonly "permission.grant.changed": RuntimePermissionGrantChangedEventPayload;
2670
- readonly "session.settings.updated": RuntimeSessionSettingsUpdatedEventPayload;
2671
- readonly "turn.started": KodaXTurnStartedEvent;
2672
- readonly "turn.completed": KodaXTurnCompletedEvent;
2673
- readonly "turn.failed": KodaXTurnFailedEvent;
2674
- readonly "workflow.started": WorkflowProcessEvent;
2675
- readonly "workflow.updated": WorkflowProcessEvent;
2676
- readonly "workflow.finished": WorkflowProcessEvent;
2677
- readonly "context.budget.snapshot": RuntimeContextBudgetSnapshot;
2678
- readonly "provider.cache.diagnostics": KodaXPromptCacheDiagnosticEvent;
2679
- readonly "tool.exposure.planned": RuntimeToolExposurePlan;
2680
- readonly "context.compaction.started": RuntimeContextCompactionStartedEventPayload;
2681
- readonly "context.compaction.stats": RuntimeContextCompactionStatsEventPayload;
2682
- readonly "context.compaction.ended": RuntimeContextCompactionEndedEventPayload;
2683
- readonly "context.compaction.skipped": RuntimeContextCompactionSkippedEventPayload;
2684
- readonly "context.compaction.messages": RuntimeContextCompactionMessagesEventPayload;
2685
- readonly "context.compaction.finished": RuntimeContextCompactionFinishedEventPayload;
2686
- readonly "runtime.warning": RuntimeWarningEventPayload;
2687
- };
2688
- interface RuntimeEventEnvelope<TPayload = unknown> {
2689
- readonly id: string;
2690
- /** Live in-process ordering hint within one Session; not comparable across restarts or Sessions. */
2691
- readonly seq: number;
2692
- readonly time: string;
2693
- readonly sessionId: string;
2694
- readonly runId: string;
2695
- readonly turnId?: string;
2696
- readonly type: RuntimeEventType;
2697
- readonly payload: TPayload;
2698
- }
2699
- type RuntimeTypedEvent<TType extends RuntimeEventType = RuntimeEventType> = {
2700
- readonly [K in TType]: RuntimeEventEnvelope<RuntimeEventPayloadMap[K]> & {
2701
- readonly type: K;
2702
- };
2703
- }[TType];
2704
- /** Raw event envelope; use parseRuntimeEvent for payload narrowing. */
2705
- type RuntimeEvent = RuntimeEventEnvelope;
2706
- type RuntimeEventParseResult = {
2707
- readonly ok: true;
2708
- readonly event: RuntimeTypedEvent;
2709
- } | {
2710
- readonly ok: false;
2711
- readonly error: string;
2712
- };
2713
- interface RuntimeEventFilterFields {
2714
- readonly type?: RuntimeEventType | readonly RuntimeEventType[];
2715
- }
2716
- type RuntimeEventFilter = RuntimeEventFilterFields & {
2717
- readonly sessionId: string;
2718
- readonly runId?: string;
2719
- };
2720
- type RuntimeEventListener = (event: RuntimeEvent) => void;
2721
- type RuntimeTypedEventListener = (event: RuntimeTypedEvent) => void;
2722
- interface RuntimeSubscription {
2723
- /** Resolves when a remote subscription handshake is complete; absent for synchronous local subscriptions. */
2724
- readonly ready?: Promise<void>;
2725
- close(): void;
2726
- }
2727
- interface RuntimeEventService {
2728
- subscribe(filter: RuntimeEventFilter, listener: RuntimeEventListener): RuntimeSubscription;
2729
- }
2730
- type RuntimePermissionRisk = "low" | "medium" | "high";
2731
- interface RuntimePermissionScope {
2732
- readonly toolName?: string;
2733
- readonly sessionId?: string;
2734
- /** Runtime-generated concrete matcher. Absent only on legacy 0.7.x grants. */
2735
- readonly matcher?: RuntimePermissionMatcher;
2736
- }
2737
- interface RuntimePermissionGrantSuggestion {
2738
- /** Opaque pending-request-local identifier; clients must return it unchanged. */
2739
- readonly id: string;
2740
- readonly kind: "session" | "persistent";
2741
- readonly label: string;
2742
- }
2743
- interface RuntimePermissionRequest {
2744
- /** Full finalized plan when the pending operation is exit_plan_mode. */
2745
- readonly plan?: string;
2746
- readonly id: string;
2747
- readonly sessionId: string;
2748
- readonly runId: string;
2749
- readonly turnId?: string;
2750
- readonly toolCallId?: string;
2751
- readonly toolName: string;
2752
- readonly reason?: string;
2753
- readonly risk?: RuntimePermissionRisk;
2754
- readonly inputPreview?: string;
2755
- /** Effective directory used to resolve relative tool paths for this run. */
2756
- readonly executionCwd?: string;
2757
- /** Structured Auto[LLM] decision metadata; never includes prompt or response text. */
2758
- readonly autoModeDiagnostics?: AutoModeDecisionDiagnostics;
2759
- readonly grantSuggestions?: readonly RuntimePermissionGrantSuggestion[];
2760
- readonly createdAt: string;
2761
- readonly expiresAt?: string;
2762
- }
2763
- interface RuntimePermissionRequestInput {
2764
- readonly plan?: string;
2765
- readonly sessionId: string;
2766
- readonly runId: string;
2767
- readonly turnId?: string;
2768
- readonly toolCallId?: string;
2769
- readonly toolName: string;
2770
- readonly reason?: string;
2771
- readonly risk?: RuntimePermissionRisk;
2772
- readonly inputPreview?: string;
2773
- readonly executionCwd?: string;
2774
- /** Structured Auto[LLM] decision metadata; never includes prompt or response text. */
2775
- readonly autoModeDiagnostics?: AutoModeDecisionDiagnostics;
2776
- readonly expiresAt?: string;
2777
- readonly timeoutMs?: number;
2778
- /**
2779
- * Concrete JSON tool input used by the Runtime to derive an opaque grant
2780
- * candidate. It is neither emitted on Runtime events nor persisted.
2781
- */
2782
- readonly toolInput?: Readonly<Record<string, unknown>>;
2783
- }
2784
- type RuntimePermissionDecision = {
2785
- readonly type: "allow_once";
2786
- } | {
2787
- readonly type: "allow_session";
2788
- readonly suggestionId: string;
2789
- } | {
2790
- readonly type: "allow_always";
2791
- readonly suggestionId: string;
2792
- }
2793
- /**
2794
- * @deprecated v2 compatibility input. The Runtime maps this selection to
2795
- * its narrower concrete candidate and never persists the supplied scope.
2796
- */
2797
- | {
2798
- readonly type: "allow_always";
2799
- readonly scope: RuntimePermissionScope;
2800
- } | {
2801
- readonly type: "reject";
2802
- readonly reason?: string;
2803
- readonly cause?: "approval_timeout";
2804
- };
2805
- interface RuntimePermissionPromptContext {
2806
- /** Aborted when the Runtime resolves, expires, or rejects the request first. */
2807
- readonly signal: AbortSignal;
2808
- }
2809
- type RuntimePermissionPrompt = (request: RuntimePermissionRequest, context: RuntimePermissionPromptContext) => Promise<RuntimePermissionDecision>;
2810
- interface RuntimePermissionPromptResolution {
2811
- readonly requestId: string;
2812
- readonly status: "responded" | "already_resolved";
2813
- readonly decision?: RuntimePermissionDecision;
2814
- }
2815
- /**
2816
- * Run one host approval surface without making its Promise part of the Runtime
2817
- * lifecycle. The Runtime remains authoritative: a timeout, abort, or competing
2818
- * client resolution aborts the host prompt and wins over any late answer.
2819
- */
2820
- declare function handleRuntimePermissionRequest(runtime: KodaXRuntime, request: RuntimePermissionRequest, prompt: RuntimePermissionPrompt): Promise<RuntimePermissionPromptResolution>;
2821
- interface RuntimePermissionFilter {
2822
- readonly sessionId?: string;
2823
- readonly runId?: string;
2824
- readonly toolName?: string;
2825
- }
2826
- interface RuntimePermissionRespondOptions {
2827
- readonly runId?: string;
2828
- }
2829
- interface RuntimePermissionGrant {
2830
- readonly id: string;
2831
- readonly scope: RuntimePermissionScope;
2832
- readonly createdAt: string;
2833
- readonly persistence?: "session" | "persistent";
2834
- readonly label?: string;
2835
- readonly sourcePermissionId?: string;
2836
- }
2837
- interface RuntimePermissionService {
2838
- request(input: RuntimePermissionRequestInput): Promise<RuntimePermissionDecision>;
2839
- listPending(filter?: RuntimePermissionFilter): Promise<readonly RuntimePermissionRequest[]>;
2840
- respond(requestId: string, decision: RuntimePermissionDecision, options?: RuntimePermissionRespondOptions): Promise<boolean>;
2841
- listGrants(): Promise<RuntimeVersionedValue<readonly RuntimePermissionGrant[]>>;
2842
- revokeGrant(grantId: string, expectedRevision: number): Promise<boolean>;
2843
- }
2844
- type RuntimeUserInputKind = "askUser" | "askUserMulti" | "askUserInput";
2845
- interface RuntimeUserInputRequest {
2846
- readonly id: string;
2847
- readonly revision: number;
2848
- readonly sessionId: string;
2849
- readonly runId: string;
2850
- readonly turnId?: string;
2851
- readonly kind: RuntimeUserInputKind;
2852
- readonly options: unknown;
2853
- readonly createdAt: string;
2854
- readonly expiresAt: string;
2855
- }
2856
- interface RuntimeUserInputFilter {
2857
- readonly sessionId?: string;
2858
- readonly runId?: string;
2859
- }
2860
- interface RuntimeUserInputResolution {
2861
- readonly requestId: string;
2862
- readonly accepted: boolean;
2863
- readonly status: "answered" | "dismissed" | "already_resolved";
2864
- }
2865
- interface RuntimeUserInputService {
2866
- listPending(filter?: RuntimeUserInputFilter): Promise<readonly RuntimeUserInputRequest[]>;
2867
- respond(requestId: string, answer: unknown, options?: {
2868
- readonly expectedRevision?: number;
2869
- readonly runId?: string;
2870
- }): Promise<RuntimeUserInputResolution>;
2871
- dismiss(requestId: string, options?: {
2872
- readonly expectedRevision?: number;
2873
- readonly runId?: string;
2874
- }): Promise<RuntimeUserInputResolution>;
2875
- }
2876
- /**
2877
- * Typed Interaction surface over the user-input and permission registries
2878
- * (FEATURE_298 T05). The client path works with precise request ids only; no
2879
- * interaction revision or lease is required.
2880
- */
2881
- interface RuntimeInteractionService {
2882
- list(filter?: {
2883
- readonly sessionId?: string;
2884
- }): Promise<readonly ClientInteraction[]>;
2885
- respond(requestId: string, response: ClientInteractionResponse): Promise<ClientInteractionResult>;
2886
- }
2887
- interface RuntimeWorkflowFilter {
2888
- readonly runId?: string;
2889
- readonly activeOnly?: boolean;
2890
- readonly limit?: number;
2891
- }
2892
- type RuntimeWorkflowSummary = ManagedWorkflowSnapshot & {
2893
- /** Host process facts; absent on older daemons. */
2894
- readonly updatedAt?: string;
2895
- readonly displayName?: string;
2896
- };
2897
- type RuntimeWorkflowSnapshot = WorkflowProcessSnapshot;
2898
- type RuntimeWorkflowListener = (event: WorkflowProcessEvent) => void;
2899
- /**
2900
- * FEATURE_298 T22 — serializable start sources. `inline`/`request` travel to
2901
- * the Host verbatim and are validated Host-side (the same gate the run_workflow
2902
- * tool uses); `name` resolves inside the Host against built-ins and the saved
2903
- * workflow directories. Clients never send a prepared module.
2904
- */
2905
- type RuntimeWorkflowStartSource = {
2906
- readonly kind: "inline";
2907
- readonly manifest: unknown;
2908
- readonly source: string;
2909
- } | {
2910
- readonly kind: "request";
2911
- readonly request: string;
2912
- } | {
2913
- readonly kind: "name";
2914
- readonly name: string;
2915
- };
2916
- interface RuntimeWorkflowStartInput {
2917
- readonly authorization?: RuntimeExecutionAuthorization;
2918
- /** Select product defaults; omitted low-level calls retain their existing defaults. */
2919
- readonly settingsDefaults?: 'product';
2920
- readonly sessionId?: string;
2921
- readonly credential?: RuntimeCredentialBinding;
2922
- readonly projectRoot: string;
2923
- readonly source: RuntimeWorkflowStartSource;
2924
- readonly args?: unknown;
2925
- readonly provider?: string;
2926
- readonly model?: string;
2927
- /** FEATURE_298 T22 — serializable run lineage the Host attaches verbatim. */
2928
- readonly metadata?: WorkflowRunProcessMetadata;
2929
- }
2930
- type RuntimeWorkflowStartResult = {
2931
- readonly kind: "declined";
2932
- readonly reason: string;
2933
- } | {
2934
- readonly kind: "started";
2935
- readonly runId: string;
2936
- };
2937
- interface RuntimeWorkflowService {
2938
- list(filter?: RuntimeWorkflowFilter): Promise<readonly RuntimeWorkflowSummary[]>;
2939
- get(runId: string): Promise<RuntimeWorkflowSnapshot | undefined>;
2940
- subscribe(filter: RuntimeWorkflowFilter, listener: RuntimeWorkflowListener, onError?: (error: unknown) => void): RuntimeSubscription;
2941
- pause(runId: string): Promise<boolean>;
2942
- resume(runId: string): Promise<boolean>;
2943
- stop(runId: string, options?: {
2944
- readonly sessionId: string;
2945
- }): Promise<boolean>;
2946
- /** FEATURE_298 T22 — start a workflow on the Host manager. */
2947
- start(input: RuntimeWorkflowStartInput): Promise<RuntimeWorkflowStartResult>;
2948
- }
2949
- interface RuntimeStatusSnapshot {
2950
- readonly runtimeId: string;
2951
- readonly mode: KodaXRuntimeMode;
2952
- readonly profile: string;
2953
- readonly startedAt: string;
2954
- readonly sessions: readonly RuntimeSessionSummary[];
2955
- readonly runs: readonly RuntimeRunStatus[];
2956
- readonly pendingPermissions: readonly RuntimePermissionRequest[];
2957
- readonly workflows: readonly RuntimeWorkflowSummary[];
2958
- }
2959
- interface RuntimeDaemonPreflight {
2960
- readonly runtimeId: string;
2961
- readonly clientCount: number;
2962
- /** Present only when the daemon advertises daemonClientInventory v1. */
2963
- readonly clients?: readonly RuntimeDaemonClientSnapshot[];
2964
- readonly activeRuns: readonly RuntimeRunStatus[];
2965
- readonly queuedRuns: readonly RuntimeRunStatus[];
2966
- readonly activeWorkflows: readonly RuntimeWorkflowSummary[];
2967
- readonly activeAgentTurns: readonly RuntimeActiveAgentTurn[];
2968
- /** @deprecated Use activeAgentTurns. Alias retained through the 0.7.x line. */
2969
- readonly activeAgentTasks: readonly RuntimeActiveAgentTurn[];
2970
- readonly pendingPermissions: readonly RuntimePermissionRequest[];
2971
- readonly pendingUserInputs: readonly RuntimeUserInputRequest[];
2972
- /** Optional work preserved by idle exit; explicit shutdown cancels/settles it. */
2973
- readonly pendingBackgroundWork?: number;
2974
- readonly blockers: readonly ("connected_clients" | "active_runs" | "queued_runs" | "active_workflows" | "active_agent_turns" | "active_agent_tasks" | "pending_interactions")[];
2975
- readonly canStop: boolean;
2976
- }
2977
- interface RuntimeActiveAgentTurn {
2978
- readonly sessionId: string;
2979
- readonly actorPath: string;
2980
- readonly turnId: string;
2981
- readonly kind: AgentExecutionKind;
2982
- }
2983
- interface RuntimeIntegrationDiagnostic {
2984
- readonly code: "invalid-config" | "activation-failed" | "watcher-degraded";
2985
- readonly message: string;
2986
- readonly time: string;
2987
- }
2988
- interface RuntimeIntegrationDomainStatus {
2989
- readonly domain: "mcp" | "a2a" | "extensions";
2990
- readonly path: string;
2991
- readonly revision?: string;
2992
- readonly source?: "user" | "legacy-user" | "default";
2993
- readonly lastReloadAt?: string;
2994
- readonly diagnostic?: RuntimeIntegrationDiagnostic;
2995
- readonly watching: boolean;
2996
- }
2997
- interface RuntimeIntegrationHealth {
2998
- readonly state: "healthy" | "degraded";
2999
- readonly domains: readonly RuntimeIntegrationDomainStatus[];
3000
- }
3001
- interface RuntimeDaemonManagementState {
3002
- readonly runtimeId: string;
3003
- /** Monotonic for logical client, mutation, Runtime event, and preflight state changes. */
3004
- readonly revision: number;
3005
- readonly ownerPolicy: RuntimeOwnerPolicyState;
3006
- readonly owner: RuntimeOwnerIdentity;
3007
- readonly preflight: RuntimeDaemonPreflight;
3008
- /** Optional integrations never make the core daemon unavailable. */
3009
- readonly integrations?: RuntimeIntegrationHealth;
3010
- }
3011
- interface RuntimeDaemonManagementService {
3012
- shutdown(): Promise<{
3013
- readonly accepted: true;
3014
- }>;
3015
- inspect(): Promise<RuntimeDaemonManagementState>;
3016
- }
3017
- interface RuntimeStatusService {
3018
- snapshot(): Promise<RuntimeStatusSnapshot>;
3019
- preflight(options?: {
3020
- readonly signal?: AbortSignal;
3021
- }): Promise<RuntimeDaemonPreflight>;
3022
- }
3023
- /**
3024
- * Capture one read-only, boundary-labelled diagnostic record without taking
3025
- * ownership of, resuming, or otherwise mutating the Session.
3026
- */
3027
- declare function captureRuntimeSessionDiagnostics(runtime: KodaXRuntime, input: RuntimeSessionDiagnosticsInput): Promise<RuntimeSessionDiagnostics>;
3028
- /**
3029
- * Durable Stop reason marking a user redirect: the old execution is cancelled
3030
- * but the explicitly requested follow-up input keeps its queue continuation.
3031
- * Distinct from a plain stop, which never auto-continues queued work.
3032
- */
3033
- declare const RUNTIME_REDIRECT_STOP_REASON = "runtime run redirected by user";
3034
- declare function createKodaXRuntime(options: CreateKodaXRuntimeOptions & {
3035
- readonly mode: "daemon";
3036
- }): Promise<KodaXDaemonRuntime>;
3037
- declare function createKodaXRuntime(options?: CreateKodaXRuntimeOptions): Promise<KodaXRuntime>;
3038
- declare function connectKodaXRuntime(options?: ConnectKodaXRuntimeOptions): Promise<KodaXDaemonRuntime>;
3039
- /** Starts the product Host when absent and updates an idle older Host before attaching. */
3040
- declare function ensureKodaXRuntime(options?: Omit<ConnectKodaXRuntimeOptions, "autoStart" | "transport">): Promise<KodaXDaemonRuntime>;
3041
-
3042
- export { ClientStartupProgress, KODAX_DAEMON_PROTOCOL, KODAX_DAEMON_PROTOCOL_VERSION, KODAX_RUNTIME_SDK_CAPABILITIES, KodaXEvents, KodaXPromptCacheDiagnosticEvent, KodaXResult, RUNTIME_DAEMON_METHODS, RUNTIME_DAEMON_METHOD_SCHEMAS, RUNTIME_DAEMON_NOTIFICATION_SCHEMAS, RUNTIME_DAEMON_PROTOCOL_SCHEMA, RUNTIME_DAEMON_PROTOCOL_SCHEMA_JSON, RUNTIME_REDIRECT_STOP_REASON, RuntimeAutoModeConfigurationError, RuntimeClientInfo, RuntimeContextBudgetSnapshot, RuntimeCredentialBinding, RuntimeCredentialService, RuntimeDaemonCapabilityUpgradeError, RuntimeDaemonClientType, RuntimeDaemonDisconnectError, RuntimeExecutionAuthorization, RuntimeHostToolService, RuntimePermissionScopeUpgradeRequiredError, RuntimeToolExposurePlan, RuntimeTransportBoundaryError, SessionTranscriptEntry, acquireKodaXInlineOwner, captureRuntimeSessionDiagnostics, connectKodaXRuntime, createKodaXRuntime, enableKodaXDaemonOwner, ensureKodaXRuntime, getKodaXRuntimeOwnerState, handleRuntimePermissionRequest, isRuntimeDaemonDisconnectError, listRuntimeDaemonSchemaMethods, parseRuntimeEvent, setKodaXRuntimeOwnerMode, waitForRuntimeDaemonShutdown };
3043
- export type { ConnectKodaXRuntimeOptions, CreateKodaXRuntimeOptions, KodaXDaemonRuntime, KodaXRuntime, KodaXRuntimeIsolation, KodaXRuntimeMode, RuntimeActiveAgentTurn, RuntimeActiveToolProjection, RuntimeAdminService, RuntimeAgentBindingService, RuntimeAgentFollowupOptions, RuntimeAgentOperationOptions, RuntimeAgentOwnerSession, RuntimeAgentService, RuntimeAppendNoticeInput, RuntimeArtifact, RuntimeArtifactKind, RuntimeArtifactRefInput, RuntimeArtifactService, RuntimeAutoReviewOptions, RuntimeBoundDefaultAgent, RuntimeBoundLocalAgent, RuntimeBuildIdentity, RuntimeCapabilityRequirements, RuntimeCatalogService, RuntimeClientCapabilities, RuntimeCommandInfo, RuntimeCommandResolveInput, RuntimeCompactSessionInput, RuntimeCompactSessionResult, RuntimeCompactionReasoning, RuntimeConfigPatch, RuntimeConfigReloadResult, RuntimeConfigService, RuntimeConfirmIdentityAliasInput, RuntimeConnectionService, RuntimeConnectionState, RuntimeContextCompactionEndedEventPayload, RuntimeContextCompactionFinishedEventPayload, RuntimeContextCompactionMessagesEventPayload, RuntimeContextCompactionSkippedEventPayload, RuntimeContextCompactionStartedEventPayload, RuntimeContextCompactionStatsEventPayload, RuntimeContinuationStatus, RuntimeConversationHistory, RuntimeConversationHistoryBoundary, RuntimeConversationHistoryEntryChunk, RuntimeConversationHistoryEntryChunkInput, RuntimeConversationHistoryPageInput, RuntimeConversationHistorySlice, RuntimeConversationHistorySliceEntry, RuntimeCreateArtifactInput, RuntimeCreateSessionInput, RuntimeDaemonClientSnapshot, RuntimeDaemonClientTransport, RuntimeDaemonContextOptions, RuntimeDaemonDisconnectCode, RuntimeDaemonEndpoint, RuntimeDaemonError, RuntimeDaemonErrorCode, RuntimeDaemonFrame, RuntimeDaemonJsonSchema, RuntimeDaemonKodaXOptions, RuntimeDaemonManagementService, RuntimeDaemonManagementState, RuntimeDaemonMethod, RuntimeDaemonMethodSchema, RuntimeDaemonNotification, RuntimeDaemonNotificationMethod, RuntimeDaemonPreflight, RuntimeDaemonProtocolSchema, RuntimeDaemonRequest, RuntimeDaemonRequestControl, RuntimeDaemonRunService, RuntimeDaemonShutdownVerification, RuntimeDaemonShutdownVerificationInput, RuntimeDaemonShutdownVerificationOwner, RuntimeDaemonStartRunInput, RuntimeDaemonTransportLifecycleState, RuntimeDefaultAgentStartInput, RuntimeDeliveredInterruptInput, RuntimeEffectiveConfigEntry, RuntimeEffectiveConfigSnapshot, RuntimeEffectiveConfigSource, RuntimeEffectiveCredentialEntry, RuntimeEffectiveSkillRef, RuntimeEvent, RuntimeEventEnvelope, RuntimeEventFilter, RuntimeEventListener, RuntimeEventParseResult, RuntimeEventPayloadMap, RuntimeEventService, RuntimeEventType, RuntimeExactCallPermissionMatcher, RuntimeExactCommandPermissionMatcher, RuntimeExactPathPermissionMatcher, RuntimeExecPolicyOptions, RuntimeExecutionToolPolicy, RuntimeExtensionListResult, RuntimeExtensionReloadResult, RuntimeExternalAgentsOptions, RuntimeFailureDetail, RuntimeFailureStage, RuntimeFileInput, RuntimeForkSessionInput, RuntimeGrantedScope, RuntimeIdentity, RuntimeImageInput, RuntimeInlineOwnerHandle, RuntimeInput, RuntimeIntegrationDiagnostic, RuntimeIntegrationDomainStatus, RuntimeIntegrationHealth, RuntimeInteractionResolvedEventPayload, RuntimeInteractionService, RuntimeInterruptInputStatus, RuntimeInvocationService, RuntimeKodaXOptions, RuntimeLearningService, RuntimeLocalAgentStartInput, RuntimeManagedTaskProjection, RuntimeMcpReloadResult, RuntimeMcpService, RuntimeMcpToolListFilter, RuntimeMcpValidateResult, RuntimeMemoryPlane, RuntimeMemoryRebuildResult, RuntimeMemoryService, RuntimeModelListFilter, RuntimeObservationInvalidation, RuntimeOutputSegmentStartedEventPayload, RuntimeOwnerIdentity, RuntimeOwnerPolicyState, RuntimeOwnerState, RuntimePendingUserInputProjection, RuntimePermissionBroker, RuntimePermissionDecision, RuntimePermissionFilter, RuntimePermissionGrant, RuntimePermissionGrantChangedEventPayload, RuntimePermissionGrantSuggestion, RuntimePermissionHostPlatform, RuntimePermissionMatcher, RuntimePermissionMode, RuntimePermissionModeInput, RuntimePermissionPrompt, RuntimePermissionPromptContext, RuntimePermissionPromptResolution, RuntimePermissionRequest, RuntimePermissionRequestInput, RuntimePermissionRespondOptions, RuntimePermissionRisk, RuntimePermissionScope, RuntimePermissionService, RuntimeProviderErrorCode, RuntimeReadOptions, RuntimeRecoverSessionInput, RuntimeResolvedLocalAgent, RuntimeRewindSessionInput, RuntimeRunFailureKind, RuntimeRunFilter, RuntimeRunHandle, RuntimeRunInputDeliveredEventPayload, RuntimeRunInputQueuedEventPayload, RuntimeRunLifecycleError, RuntimeRunMode, RuntimeRunPhase, RuntimeRunProgressEventPayload, RuntimeRunRequirements, RuntimeRunResult, RuntimeRunService, RuntimeRunSessionLoadedEventPayload, RuntimeRunStage, RuntimeRunStatus, RuntimeRunStopReceipt, RuntimeRunStopStatus, RuntimeSession, RuntimeSessionCancelInput, RuntimeSessionCancelReceipt, RuntimeSessionDiagnosticError, RuntimeSessionDiagnosticErrorCode, RuntimeSessionDiagnosticRun, RuntimeSessionDiagnostics, RuntimeSessionDiagnosticsInput, RuntimeSessionFilter, RuntimeSessionLiveProjection, RuntimeSessionLoadedEventPayload, RuntimeSessionObservation, RuntimeSessionObservationSnapshot, RuntimeSessionService, RuntimeSessionSettings, RuntimeSessionSettingsPatch, RuntimeSessionSettingsUpdatedEventPayload, RuntimeSessionStatus, RuntimeSessionSummary, RuntimeSetActiveEntryInput, RuntimeSkillDescribeInput, RuntimeSkillDescription, RuntimeSkillFileSummary, RuntimeSkillListFilter, RuntimeSkillSummary, RuntimeStartRunInput, RuntimeStatusService, RuntimeStatusSnapshot, RuntimeSubmitInput, RuntimeSubmitInputResult, RuntimeSubscription, RuntimeTerminalCode, RuntimeTerminalFact, RuntimeTextDeltaEventPayload, RuntimeTextInput, RuntimeThinkingFinishedEventPayload, RuntimeTodoUpdatedEventPayload, RuntimeToolFinishedEventPayload, RuntimeToolProgressEventPayload, RuntimeToolSandboxEventPayload, RuntimeToolStartedEventPayload, RuntimeTranscript, RuntimeTranscriptEntryChunk, RuntimeTranscriptEntryChunkInput, RuntimeTranscriptPageInput, RuntimeTranscriptSearchHit, RuntimeTranscriptSearchInput, RuntimeTranscriptSearchResult, RuntimeTranscriptSlice, RuntimeTranscriptSliceEntry, RuntimeTypedEvent, RuntimeTypedEventListener, RuntimeUserInputFilter, RuntimeUserInputKind, RuntimeUserInputRequest, RuntimeUserInputRequestedEventPayload, RuntimeUserInputResolution, RuntimeUserInputService, RuntimeUserMarkdownAgentRef, RuntimeVersionedUpdateOptions, RuntimeVersionedValue, RuntimeVideoInput, RuntimeWarningEventPayload, RuntimeWorkflowFilter, RuntimeWorkflowListener, RuntimeWorkflowService, RuntimeWorkflowSnapshot, RuntimeWorkflowStartInput, RuntimeWorkflowStartResult, RuntimeWorkflowStartSource, RuntimeWorkflowSummary, RuntimeWorkspaceBinding };
269
+ export { KODAX_DAEMON_PROTOCOL, KODAX_DAEMON_PROTOCOL_VERSION, RUNTIME_DAEMON_METHOD_SCHEMAS, RUNTIME_DAEMON_NOTIFICATION_SCHEMAS, RUNTIME_DAEMON_PROTOCOL_SCHEMA, RUNTIME_DAEMON_PROTOCOL_SCHEMA_JSON, RuntimeCredentialBinding, RuntimeCredentialService, RuntimeDaemonMethod, RuntimeDaemonNotificationMethod, RuntimeScopedCredentialRequest, applyStorageRepair, bindCloudCredentials, bindOAuthCredentials, confirmStorageRepair, createEncryptedOAuthSessionStore, createNativeCloudCredentialResolver, createProviderCredentialAuthorizer, createProviderCredentialManager, createWindowsOAuthSessionStore, inspectStorageRepair, inspectStorageRepairCandidate, listRuntimeDaemonSchemaMethods, loginProviderOAuth, migrateProviderOAuthRegistration, providerOAuthStore };
270
+ export type { OAuthSessionSealer, ProviderCredentialAuthorizer, ProviderCredentialManager, ProviderCredentialSource, ProviderCredentialStatus, ProviderOAuthLoginInput, RuntimeCloudCredentialBinding, RuntimeDaemonJsonSchema, RuntimeDaemonMethodSchema, RuntimeDaemonProtocolSchema, RuntimeOAuthCredentialBinding, StorageRepairPlan, StorageRepairReceipt, StorageRepairTarget };