@kodax-ai/kodax 0.7.68 → 0.7.69

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 (102) hide show
  1. package/CHANGELOG.md +137 -3
  2. package/README.md +56 -9
  3. package/README_CN.md +53 -8
  4. package/config-templates/config.example.jsonc +26 -0
  5. package/config-templates/integrations/a2a.example.jsonc +54 -0
  6. package/config-templates/integrations/extensions.example.jsonc +7 -0
  7. package/config-templates/integrations/mcp.example.jsonc +16 -0
  8. package/dist/chunks/agent-DQRXT6M7.js +2 -0
  9. package/dist/chunks/argument-completer-RSK6CCGP.js +2 -0
  10. package/dist/chunks/chunk-4WIODYOH.js +329 -0
  11. package/dist/chunks/chunk-AWMTNUDS.js +37 -0
  12. package/dist/chunks/chunk-F7C7J6IM.js +7 -0
  13. package/dist/chunks/{chunk-PEGSHZAA.js → chunk-I4TPQEJN.js} +1 -1
  14. package/dist/chunks/chunk-M7TCFYTO.js +107 -0
  15. package/dist/chunks/chunk-NGHQIGVW.js +46 -0
  16. package/dist/chunks/chunk-NGJURAY5.js +306 -0
  17. package/dist/chunks/{chunk-KGAI32VS.js → chunk-PA76WUBL.js} +2 -2
  18. package/dist/chunks/chunk-PQ3XUSY2.js +357 -0
  19. package/dist/chunks/chunk-UJEMSPM5.js +78 -0
  20. package/dist/chunks/{chunk-CC4BVVE7.js → chunk-URC6ZI6P.js} +1 -1
  21. package/dist/chunks/{chunk-CTHUX5ZH.js → chunk-VAZ25MDX.js} +122 -122
  22. package/dist/chunks/chunk-VYKFM3TB.js +751 -0
  23. package/dist/chunks/{chunk-TOGESFRN.js → chunk-WW2O2DEP.js} +1 -1
  24. package/dist/chunks/chunk-Y4WOTWUC.js +2 -0
  25. package/dist/chunks/chunk-Z4PPLJF2.js +60 -0
  26. package/dist/chunks/chunk-ZG4DMYBS.js +422 -0
  27. package/dist/chunks/compaction-config-ABLL6UH3.js +2 -0
  28. package/dist/chunks/{construction-bootstrap-PYWJHO35.js → construction-bootstrap-GH6RW6ST.js} +1 -1
  29. package/dist/chunks/dist-DRBKYVHF.js +2 -0
  30. package/dist/chunks/dist-RWL2RBO4.js +2 -0
  31. package/dist/chunks/host-7SAB4WEC.js +2 -0
  32. package/dist/chunks/run-manager-XMDKTONJ.js +2 -0
  33. package/dist/chunks/utils-QYE5Y73D.js +2 -0
  34. package/dist/index.d.ts +19 -19
  35. package/dist/index.js +6 -6
  36. package/dist/kodax_cli.js +1590 -1316
  37. package/dist/runtime-worker.js +1355 -1105
  38. package/dist/sdk-a2a.d.ts +397 -0
  39. package/dist/sdk-a2a.js +9 -0
  40. package/dist/sdk-agent.d.ts +61 -30
  41. package/dist/sdk-agent.js +1 -1
  42. package/dist/sdk-coding.d.ts +126 -51
  43. package/dist/sdk-coding.js +1 -1
  44. package/dist/sdk-experimental-memory.d.ts +1 -1
  45. package/dist/sdk-experimental-memory.js +1 -1
  46. package/dist/sdk-llm.d.ts +16 -9
  47. package/dist/sdk-llm.js +1 -1
  48. package/dist/sdk-mcp.d.ts +1 -1
  49. package/dist/sdk-mcp.js +1 -1
  50. package/dist/sdk-media.d.ts +1 -1
  51. package/dist/sdk-media.js +1 -1
  52. package/dist/sdk-repl.d.ts +35 -101
  53. package/dist/sdk-repl.js +2 -2
  54. package/dist/sdk-runtime.d.ts +744 -21
  55. package/dist/sdk-runtime.js +1 -1
  56. package/dist/sdk-session.d.ts +7 -7
  57. package/dist/sdk-session.js +1 -1
  58. package/dist/sdk-skills.js +1 -1
  59. package/dist/semantic-worker.js +100 -12
  60. package/dist/types-chunks/{base.d-C8mXDhLL.d.ts → base.d-CYjtB68X.d.ts} +1 -1
  61. package/dist/types-chunks/{bash-prefix-extractor.d-Dm-T865v.d.ts → bash-prefix-extractor.d-BkIA8Wto.d.ts} +68 -17
  62. package/dist/types-chunks/{capability-learning.d-BLEmCib0.d.ts → capability-learning.d-WtsyRv3O.d.ts} +1 -1
  63. package/dist/types-chunks/{capsule.d-CzaamUUv.d.ts → capsule.d-xJvfh4YR.d.ts} +3 -3
  64. package/dist/types-chunks/{commands.d-DxKjVSNU.d.ts → commands.d-DkPfcQWG.d.ts} +4 -4
  65. package/dist/types-chunks/{cost-tracker.d-CBLk1fiD.d.ts → cost-tracker.d-BeaenODW.d.ts} +4 -1
  66. package/dist/types-chunks/{guardrail.d-D7r6zVSR.d.ts → guardrail.d-6ZDbNbHO.d.ts} +1 -1
  67. package/dist/types-chunks/{guardrail.d-CPDfZyJp.d.ts → guardrail.d-R7AiGfrI.d.ts} +4 -4
  68. package/dist/types-chunks/integration-config.d-ojG4swOP.d.ts +95 -0
  69. package/dist/types-chunks/{manager.d-Zum9cGHU.d.ts → manager.d-CoEuPRAo.d.ts} +4 -1
  70. package/dist/types-chunks/{public-api.d-BcKbBy1E.d.ts → public-api.d-7G4--RZE.d.ts} +3 -3
  71. package/dist/types-chunks/{resolver.d-DmBnoilY.d.ts → resolver.d-CIVoGc97.d.ts} +2 -2
  72. package/dist/types-chunks/{run-manager.d-CSj7_kWk.d.ts → run-manager.d-BaXtkryp.d.ts} +1 -1
  73. package/dist/types-chunks/{sdk-session-C6nDgyh8.d.ts → sdk-session-BQccrODn.d.ts} +6 -4
  74. package/dist/types-chunks/{types.d-D2frCRaY.d.ts → types.d-BtC4yLYO.d.ts} +35 -8
  75. package/dist/types-chunks/{types.d-CzscbsG0.d.ts → types.d-C9YHEAmA.d.ts} +38 -7
  76. package/dist/types-chunks/{types.d-D9FKbAmf.d.ts → types.d-CJR7t6iW.d.ts} +2 -2
  77. package/dist/types-chunks/{types.d-CO_ZkmOd.d.ts → types.d-TTvpAGWf.d.ts} +5 -0
  78. package/dist/types-chunks/{utils.d-DOXxnOnI.d.ts → utils.d-BbB5jzi1.d.ts} +15 -7
  79. package/docs/SDK_EMBEDDER_GUIDE.md +627 -9
  80. package/package.json +10 -2
  81. package/dist/chunks/agent-DATNZOBK.js +0 -2
  82. package/dist/chunks/argument-completer-X7MMM7Y6.js +0 -2
  83. package/dist/chunks/chunk-5GL55MOH.js +0 -36
  84. package/dist/chunks/chunk-67XJ4YUA.js +0 -703
  85. package/dist/chunks/chunk-C4SBXBWH.js +0 -346
  86. package/dist/chunks/chunk-D6QVXQNI.js +0 -1
  87. package/dist/chunks/chunk-HFM2D5BP.js +0 -2
  88. package/dist/chunks/chunk-HLBHSA2B.js +0 -325
  89. package/dist/chunks/chunk-K2NCKRVY.js +0 -33
  90. package/dist/chunks/chunk-KIQRCGVR.js +0 -419
  91. package/dist/chunks/chunk-MP52BDK5.js +0 -15
  92. package/dist/chunks/chunk-O5OJQFPY.js +0 -307
  93. package/dist/chunks/chunk-OIELNE6Z.js +0 -56
  94. package/dist/chunks/chunk-PZTG2C33.js +0 -7
  95. package/dist/chunks/chunk-QJJKMNZF.js +0 -2
  96. package/dist/chunks/compaction-config-BXEDHIQP.js +0 -2
  97. package/dist/chunks/dist-76PJHNSG.js +0 -2
  98. package/dist/chunks/dist-HTDJRAD6.js +0 -2
  99. package/dist/chunks/host-UAXIDZ6V.js +0 -2
  100. package/dist/chunks/paste-C33GZQV5.js +0 -2
  101. package/dist/chunks/run-manager-UCXB4G22.js +0 -2
  102. package/dist/chunks/utils-S63V5UCM.js +0 -2
@@ -1,33 +1,144 @@
1
- import { F as KodaXReasoningMode, d as KodaXCustomProviderConfig } from './types-chunks/types.d-CO_ZkmOd.js';
2
- export { k as KodaXMessage } from './types-chunks/types.d-CO_ZkmOd.js';
3
- import { X as KodaXOptions, L as KodaXEvents, a5 as KodaXResult, b0 as RuntimeContextBudgetSnapshot, b7 as RuntimeToolExposurePlan } from './types-chunks/bash-prefix-extractor.d-Dm-T865v.js';
4
- import { x as AgentExecutorFactory, p as AgentDispatchPolicy, n as AgentCredentialBroker, g as AgentArtifactPolicy, o as AgentDispatchContext, aP as KodaXImageInputArtifact, aS as KodaXInputArtifactSource, bo as KodaXVideoInputArtifact, dq as WorkflowProcessSnapshot, dj as WorkflowProcessEvent, N as AgentRegistrationService, am as DispatchableAgentQuery, ak as DispatchableAgentListing, K as AgentPreflightInput, L as AgentPreflightResult, V as AgentTaskService } from './types-chunks/types.d-D2frCRaY.js';
1
+ import { F as KodaXReasoningMode, d as KodaXCustomProviderConfig } from './types-chunks/types.d-TTvpAGWf.js';
2
+ export { k as KodaXMessage } from './types-chunks/types.d-TTvpAGWf.js';
3
+ import { Y as KodaXOptions, R as KodaXManagedTaskStatusEvent, L as KodaXEvents, a6 as KodaXResult, b5 as RuntimeContextBudgetSnapshot, bc as RuntimeToolExposurePlan, H as KodaXContextOptions, K as KodaXActivityEventMeta, aA as KodaXToolEventMeta, aH as KodaXTurnStartedEvent, aE as KodaXTurnCompletedEvent, aG as KodaXTurnFailedEvent } from './types-chunks/bash-prefix-extractor.d-BkIA8Wto.js';
4
+ import { o as AgentDispatchContext, x as AgentExecutorFactory, p as AgentDispatchPolicy, n as AgentCredentialBroker, g as AgentArtifactPolicy, aP as KodaXImageInputArtifact, aS as KodaXInputArtifactSource, bo as KodaXVideoInputArtifact, dt as WorkflowProcessSnapshot, dm as WorkflowProcessEvent, N as AgentRegistrationService, am as DispatchableAgentQuery, ak as DispatchableAgentListing, K as AgentPreflightInput, L as AgentPreflightResult, V as AgentTaskService } from './types-chunks/types.d-BtC4yLYO.js';
5
5
  import { i as SkillMetadata } from './types-chunks/types.d-vJExiRje.js';
6
6
  import { a as McpServerConfig } from './types-chunks/config.d-CJy1WENT.js';
7
- import { s as McpServerStatus, t as McpServerToolList } from './types-chunks/manager.d-Zum9cGHU.js';
8
- import { c as ManagedWorkflowSnapshot } from './types-chunks/run-manager.d-CSj7_kWk.js';
9
- import { L as LoadedExtensionDiagnostic, u as ExtensionRuntimeDiagnostics } from './types-chunks/types.d-CzscbsG0.js';
10
- import { D as saveConfig, c as CommandInfo } from './types-chunks/utils.d-DOXxnOnI.js';
11
- import { d as FullTranscriptSessionData, j as SessionTranscriptEntry, a as CompactSessionResult } from './types-chunks/public-api.d-BcKbBy1E.js';
7
+ import { s as McpServerStatus, t as McpServerToolList } from './types-chunks/manager.d-CoEuPRAo.js';
8
+ import { c as ManagedWorkflowSnapshot } from './types-chunks/run-manager.d-BaXtkryp.js';
9
+ import { L as LoadedExtensionDiagnostic, u as ExtensionRuntimeDiagnostics } from './types-chunks/types.d-C9YHEAmA.js';
10
+ import { F as saveConfig, c as CommandInfo } from './types-chunks/utils.d-BbB5jzi1.js';
11
+ import { d as FullTranscriptSessionData, j as SessionTranscriptEntry, a as CompactSessionResult } from './types-chunks/public-api.d-7G4--RZE.js';
12
12
  import 'vscode-languageserver-protocol';
13
- import './types-chunks/cost-tracker.d-CBLk1fiD.js';
13
+ import './types-chunks/cost-tracker.d-BeaenODW.js';
14
14
  import './types-chunks/capability.d-3C62G8Eq.js';
15
- import './types-chunks/base.d-C8mXDhLL.js';
16
- import './types-chunks/guardrail.d-CPDfZyJp.js';
17
- import './types-chunks/guardrail.d-D7r6zVSR.js';
15
+ import './types-chunks/base.d-CYjtB68X.js';
16
+ import './types-chunks/guardrail.d-R7AiGfrI.js';
17
+ import './types-chunks/guardrail.d-6ZDbNbHO.js';
18
18
  import 'readline';
19
19
  import 'child_process';
20
20
 
21
+ interface RuntimeUserMarkdownAgentRef {
22
+ readonly source: 'markdown:user';
23
+ readonly name: string;
24
+ }
25
+ interface RuntimeEffectiveSkillRef {
26
+ readonly name: string;
27
+ readonly source: 'workspace' | 'user' | 'plugin' | 'builtin';
28
+ readonly revision: string;
29
+ }
30
+ type RuntimeWorkspaceBinding = {
31
+ readonly mode: 'managed';
32
+ } | {
33
+ readonly mode: 'fixed';
34
+ readonly root: string;
35
+ };
36
+ interface RuntimeExecutionToolPolicy {
37
+ readonly workspace: 'none' | 'read' | 'write';
38
+ readonly process: 'deny' | 'isolated';
39
+ readonly network: {
40
+ readonly mode: 'deny';
41
+ } | {
42
+ readonly mode: 'allowlist';
43
+ readonly origins: readonly string[];
44
+ };
45
+ readonly tools: readonly string[];
46
+ readonly mcp: Readonly<Record<string, readonly string[]>>;
47
+ readonly skillScripts: Readonly<Record<string, readonly string[]>>;
48
+ readonly subagents: 'deny' | 'inherit';
49
+ }
50
+ interface RuntimeResolvedLocalAgent {
51
+ readonly ref: RuntimeUserMarkdownAgentRef;
52
+ readonly agentId: string;
53
+ readonly displayName: string;
54
+ readonly description: string;
55
+ readonly configurationRevision: string;
56
+ readonly effectiveSkills: readonly RuntimeEffectiveSkillRef[];
57
+ readonly skillSetRevision: string;
58
+ }
59
+ interface RuntimeAgentOwnerSession {
60
+ readonly ownerSessionId: string;
61
+ }
62
+ interface RuntimeBoundDefaultAgent {
63
+ readonly ownerSessionId: string;
64
+ readonly bindingId: string;
65
+ readonly executionPolicyRevision: string;
66
+ readonly toolPolicyRevision: string;
67
+ readonly workspaceBindingRevision: string;
68
+ readonly skillSetRevision: string;
69
+ readonly effectiveSkills: readonly RuntimeEffectiveSkillRef[];
70
+ readonly effectiveTools: readonly string[];
71
+ }
72
+ interface RuntimeBoundLocalAgent extends RuntimeResolvedLocalAgent {
73
+ readonly ownerSessionId: string;
74
+ readonly bindingId: string;
75
+ readonly executionPolicyRevision: string;
76
+ readonly toolPolicyRevision: string;
77
+ readonly workspaceBindingRevision: string;
78
+ readonly effectiveTools: readonly string[];
79
+ }
80
+ interface RuntimeAgentStartBase {
81
+ readonly ownerSessionId: string;
82
+ readonly bindingId: string;
83
+ readonly expectedExecutionPolicyRevision: string;
84
+ readonly sessionId: string;
85
+ readonly input: RuntimeInput | readonly RuntimeInput[];
86
+ readonly permissionBroker?: RuntimePermissionBroker;
87
+ readonly agentContext?: AgentDispatchContext;
88
+ }
89
+ interface RuntimeDefaultAgentStartInput extends RuntimeAgentStartBase {
90
+ }
91
+ interface RuntimeLocalAgentStartInput extends RuntimeAgentStartBase {
92
+ readonly expectedConfigurationRevision: string;
93
+ }
94
+ interface RuntimeAgentBindingService {
95
+ resolveLocal(input: {
96
+ readonly ref: RuntimeUserMarkdownAgentRef;
97
+ readonly workspace: RuntimeWorkspaceBinding;
98
+ }): Promise<RuntimeResolvedLocalAgent>;
99
+ openOwnerSession(): Promise<RuntimeAgentOwnerSession>;
100
+ bindDefault(input: {
101
+ readonly ownerSessionId: string;
102
+ readonly profileId?: string;
103
+ readonly workspace: RuntimeWorkspaceBinding;
104
+ readonly toolPolicy: RuntimeExecutionToolPolicy;
105
+ readonly expectedExecutionPolicyRevision?: string;
106
+ readonly workspaceByteLimit?: number;
107
+ }): Promise<RuntimeBoundDefaultAgent>;
108
+ startDefault(input: RuntimeDefaultAgentStartInput): Promise<RuntimeRunHandle>;
109
+ bindLocal(input: {
110
+ readonly ownerSessionId: string;
111
+ readonly ref: RuntimeUserMarkdownAgentRef;
112
+ readonly profileId?: string;
113
+ readonly workspace: RuntimeWorkspaceBinding;
114
+ readonly toolPolicy: RuntimeExecutionToolPolicy;
115
+ readonly expectedConfigurationRevision?: string;
116
+ readonly expectedExecutionPolicyRevision?: string;
117
+ readonly workspaceByteLimit?: number;
118
+ }): Promise<RuntimeBoundLocalAgent>;
119
+ startLocal(input: RuntimeLocalAgentStartInput): Promise<RuntimeRunHandle>;
120
+ prepareWorkspace(input: {
121
+ readonly ownerSessionId: string;
122
+ readonly bindingId: string;
123
+ readonly contextKey: string;
124
+ }): Promise<string>;
125
+ releaseBinding(input: {
126
+ readonly ownerSessionId: string;
127
+ readonly bindingId: string;
128
+ }): Promise<void>;
129
+ closeOwnerSession(ownerSessionId: string): Promise<void>;
130
+ }
131
+
21
132
  declare const KODAX_DAEMON_PROTOCOL = "kodax-runtime-daemon";
22
133
  declare const KODAX_DAEMON_PROTOCOL_VERSION = 1;
23
- type RuntimeDaemonMethod = 'initialize' | 'runtime.initialize' | 'ping' | 'runtime.identity' | 'runtime.status' | 'runtime.shutdown' | 'runtime.capabilities' | 'daemon.status' | 'daemon.stop' | 'daemon.logs' | 'session.create' | 'session.load' | 'session.list' | 'session.transcript' | 'session.fork' | 'session.notice.append' | 'session.rewind' | 'session.active_entry.set' | 'session.activeEntry.set' | 'session.compact' | 'session.archive' | 'session.unarchive' | 'session.delete' | 'session.settings.get' | 'session.settings.update' | 'run.start' | 'run.get' | 'run.list' | 'run.await' | 'run.abort' | 'run.model.set' | 'run.provider.set' | 'run.reasoning.set' | 'run.setModel' | 'run.setProvider' | 'run.setReasoning' | 'event.subscribe' | 'event.unsubscribe' | 'event.replay' | 'permission.list' | 'permission.listPending' | 'permission.request' | 'permission.respond' | 'workflow.list' | 'workflow.get' | 'workflow.subscribe' | 'workflow.unsubscribe' | 'workflow.pause' | 'workflow.resume' | 'workflow.stop' | 'config.read' | 'config.patch' | 'config.reload' | 'model.list' | 'provider.list' | 'provider.custom.list' | 'provider.custom.upsert' | 'provider.custom.remove' | 'mcp.server.list' | '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' | 'artifact.create' | 'artifact.get' | 'artifact.delete' | 'agentRegistrations.list' | 'agentRegistrations.upsert' | 'agentRegistrations.remove' | 'agents.listDispatchable' | 'agents.describe' | 'agents.preflight' | 'agentTasks.list' | 'agentTasks.start' | 'agentTasks.get' | 'agentTasks.events' | 'agentTasks.wait' | 'agentTasks.sendInput' | 'agentTasks.cancel' | 'agentTasks.reconcile' | 'context.budget.get' | 'tool.exposure.preview';
24
- type RuntimeDaemonNotificationMethod = 'event' | 'runtime.warning';
134
+ type RuntimeDaemonMethod = 'initialize' | 'runtime.initialize' | 'ping' | 'runtime.identity' | 'runtime.status' | 'runtime.shutdown' | 'runtime.capabilities' | 'daemon.status' | 'daemon.stop' | 'daemon.logs' | 'daemon.preflight' | 'operation.get' | 'session.create' | 'session.load' | 'session.list' | 'session.transcript' | 'session.observe' | 'session.fork' | 'session.notice.append' | 'session.rewind' | 'session.active_entry.set' | 'session.activeEntry.set' | 'session.compact' | 'session.archive' | 'session.unarchive' | 'session.delete' | 'session.settings.get' | 'session.settings.getVersioned' | 'session.settings.update' | 'session.settings.updateVersioned' | 'run.start' | 'run.input.submit' | 'run.get' | 'run.list' | 'run.await' | 'run.abort' | 'run.model.set' | 'run.provider.set' | 'run.reasoning.set' | 'run.setModel' | 'run.setProvider' | 'run.setReasoning' | 'event.subscribe' | 'event.unsubscribe' | 'event.replay' | 'permission.list' | 'permission.listPending' | 'permission.request' | 'permission.respond' | 'permission.grants.list' | 'permission.grants.revoke' | 'user_input.listPending' | 'user_input.respond' | 'user_input.dismiss' | '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' | 'config.read' | 'config.patch' | 'config.reload' | 'model.list' | 'provider.list' | 'provider.custom.list' | 'provider.custom.upsert' | 'provider.custom.remove' | 'mcp.server.list' | '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' | 'artifact.create' | 'artifact.get' | 'artifact.delete' | 'agentRegistrations.list' | 'agentRegistrations.upsert' | 'agentRegistrations.remove' | 'agents.listDispatchable' | 'agents.describe' | 'agents.preflight' | 'agentTasks.list' | 'agentTasks.start' | 'agentTasks.get' | 'agentTasks.events' | 'agentTasks.wait' | 'agentTasks.sendInput' | 'agentTasks.cancel' | 'agentTasks.reconcile' | 'context.budget.get' | 'tool.exposure.preview';
135
+ type RuntimeDaemonNotificationMethod = 'event' | 'credential.request' | 'host_tool.invoke' | 'runtime.warning';
25
136
  interface RuntimeDaemonError {
26
137
  readonly code: RuntimeDaemonErrorCode;
27
138
  readonly message: string;
28
139
  readonly data?: unknown;
29
140
  }
30
- type RuntimeDaemonErrorCode = 'invalid_frame' | 'invalid_request' | 'invalid_params' | 'not_initialized' | 'method_not_found' | 'unauthorized' | 'permission_denied' | 'conflict' | 'not_found' | 'cancelled' | 'overloaded' | 'internal_error';
141
+ 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' | 'operation_required' | 'operation_epoch_mismatch' | 'operation_id_reuse' | 'operation_interrupted' | 'operation_unknown' | 'control_history_untrusted' | 'credential_unavailable' | 'host_tool_unavailable' | 'host_tool_unknown' | 'internal_error';
31
142
  interface RuntimeDaemonFrameBase {
32
143
  readonly protocol: typeof KODAX_DAEMON_PROTOCOL;
33
144
  readonly version: typeof KODAX_DAEMON_PROTOCOL_VERSION;
@@ -37,6 +148,11 @@ interface RuntimeDaemonRequest extends RuntimeDaemonFrameBase {
37
148
  readonly id: string;
38
149
  readonly method: RuntimeDaemonMethod;
39
150
  readonly params?: unknown;
151
+ readonly operation?: RuntimeDaemonOperationEnvelope;
152
+ }
153
+ interface RuntimeDaemonOperationEnvelope {
154
+ readonly operationId: string;
155
+ readonly journalEpoch: string;
40
156
  }
41
157
  interface RuntimeDaemonSuccessResponse extends RuntimeDaemonFrameBase {
42
158
  readonly kind: 'response';
@@ -57,10 +173,22 @@ type RuntimeDaemonFrame = RuntimeDaemonRequest | RuntimeDaemonSuccessResponse |
57
173
  declare const RUNTIME_DAEMON_METHODS: readonly RuntimeDaemonMethod[];
58
174
 
59
175
  interface RuntimeDaemonClientTransport {
60
- request(method: RuntimeDaemonMethod, params?: unknown): Promise<unknown>;
176
+ request(method: RuntimeDaemonMethod, params?: unknown, operation?: RuntimeDaemonOperationEnvelope): Promise<unknown>;
61
177
  subscribe(listener: (notification: RuntimeDaemonNotification) => void): RuntimeSubscription;
178
+ subscribeLifecycle?(listener: (state: RuntimeDaemonTransportLifecycleState) => void): RuntimeSubscription;
62
179
  close?(): Promise<void> | void;
63
180
  }
181
+ interface RuntimeDaemonTransportLifecycleState {
182
+ readonly state: 'connected' | 'disconnected';
183
+ readonly connectionId: string;
184
+ readonly reason?: string;
185
+ readonly reconnectable: boolean;
186
+ }
187
+ declare class RuntimeTransportBoundaryError extends Error {
188
+ readonly path: string;
189
+ readonly code: "invalid_transport_value";
190
+ constructor(path: string, message: string);
191
+ }
64
192
 
65
193
  interface RuntimeWorkerResourceLimits {
66
194
  readonly maxOldGenerationSizeMb?: number;
@@ -77,6 +205,8 @@ interface RuntimeDaemonEndpoint {
77
205
  readonly path: string;
78
206
  }
79
207
 
208
+ declare function parseRuntimeEvent(value: unknown): RuntimeEventParseResult;
209
+
80
210
  type RuntimeDaemonJsonSchemaType = 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string';
81
211
  interface RuntimeDaemonJsonSchema {
82
212
  readonly type?: RuntimeDaemonJsonSchemaType | readonly RuntimeDaemonJsonSchemaType[];
@@ -139,6 +269,14 @@ declare const RUNTIME_DAEMON_METHOD_SCHEMAS: {
139
269
  params: RuntimeDaemonJsonSchema;
140
270
  result: RuntimeDaemonJsonSchema;
141
271
  };
272
+ 'daemon.preflight': {
273
+ params: RuntimeDaemonJsonSchema;
274
+ result: RuntimeDaemonJsonSchema;
275
+ };
276
+ 'operation.get': {
277
+ params: RuntimeDaemonJsonSchema;
278
+ result: RuntimeDaemonJsonSchema;
279
+ };
142
280
  'session.create': {
143
281
  params: RuntimeDaemonJsonSchema;
144
282
  result: RuntimeDaemonJsonSchema;
@@ -155,6 +293,10 @@ declare const RUNTIME_DAEMON_METHOD_SCHEMAS: {
155
293
  params: RuntimeDaemonJsonSchema;
156
294
  result: RuntimeDaemonJsonSchema;
157
295
  };
296
+ 'session.observe': {
297
+ params: RuntimeDaemonJsonSchema;
298
+ result: RuntimeDaemonJsonSchema;
299
+ };
158
300
  'session.fork': {
159
301
  params: RuntimeDaemonJsonSchema;
160
302
  result: RuntimeDaemonJsonSchema;
@@ -195,14 +337,26 @@ declare const RUNTIME_DAEMON_METHOD_SCHEMAS: {
195
337
  params: RuntimeDaemonJsonSchema;
196
338
  result: RuntimeDaemonJsonSchema;
197
339
  };
340
+ 'session.settings.getVersioned': {
341
+ params: RuntimeDaemonJsonSchema;
342
+ result: RuntimeDaemonJsonSchema;
343
+ };
198
344
  'session.settings.update': {
199
345
  params: RuntimeDaemonJsonSchema;
200
346
  result: RuntimeDaemonJsonSchema;
201
347
  };
348
+ 'session.settings.updateVersioned': {
349
+ params: RuntimeDaemonJsonSchema;
350
+ result: RuntimeDaemonJsonSchema;
351
+ };
202
352
  'run.start': {
203
353
  params: RuntimeDaemonJsonSchema;
204
354
  result: RuntimeDaemonJsonSchema;
205
355
  };
356
+ 'run.input.submit': {
357
+ params: RuntimeDaemonJsonSchema;
358
+ result: RuntimeDaemonJsonSchema;
359
+ };
206
360
  'run.get': {
207
361
  params: RuntimeDaemonJsonSchema;
208
362
  result: RuntimeDaemonJsonSchema;
@@ -271,6 +425,68 @@ declare const RUNTIME_DAEMON_METHOD_SCHEMAS: {
271
425
  params: RuntimeDaemonJsonSchema;
272
426
  result: RuntimeDaemonJsonSchema;
273
427
  };
428
+ 'permission.grants.list': {
429
+ params: RuntimeDaemonJsonSchema;
430
+ result: RuntimeDaemonJsonSchema;
431
+ };
432
+ 'permission.grants.revoke': {
433
+ params: RuntimeDaemonJsonSchema;
434
+ result: RuntimeDaemonJsonSchema;
435
+ };
436
+ 'user_input.listPending': {
437
+ params: RuntimeDaemonJsonSchema;
438
+ result: RuntimeDaemonJsonSchema;
439
+ };
440
+ 'user_input.respond': {
441
+ params: RuntimeDaemonJsonSchema;
442
+ result: RuntimeDaemonJsonSchema;
443
+ };
444
+ 'user_input.dismiss': {
445
+ params: RuntimeDaemonJsonSchema;
446
+ result: RuntimeDaemonJsonSchema;
447
+ };
448
+ 'credential.register': {
449
+ params: RuntimeDaemonJsonSchema;
450
+ result: RuntimeDaemonJsonSchema;
451
+ };
452
+ 'credential.get': {
453
+ params: RuntimeDaemonJsonSchema;
454
+ result: {
455
+ oneOf: RuntimeDaemonJsonSchema[];
456
+ };
457
+ };
458
+ 'credential.revoke': {
459
+ params: RuntimeDaemonJsonSchema;
460
+ result: RuntimeDaemonJsonSchema;
461
+ };
462
+ 'credential.supply': {
463
+ params: RuntimeDaemonJsonSchema;
464
+ result: RuntimeDaemonJsonSchema;
465
+ };
466
+ 'host_tool.register': {
467
+ params: RuntimeDaemonJsonSchema;
468
+ result: RuntimeDaemonJsonSchema;
469
+ };
470
+ 'host_tool.get': {
471
+ params: RuntimeDaemonJsonSchema;
472
+ result: {
473
+ oneOf: RuntimeDaemonJsonSchema[];
474
+ };
475
+ };
476
+ 'host_tool.invocation.get': {
477
+ params: RuntimeDaemonJsonSchema;
478
+ result: {
479
+ oneOf: RuntimeDaemonJsonSchema[];
480
+ };
481
+ };
482
+ 'host_tool.revoke': {
483
+ params: RuntimeDaemonJsonSchema;
484
+ result: RuntimeDaemonJsonSchema;
485
+ };
486
+ 'host_tool.complete': {
487
+ params: RuntimeDaemonJsonSchema;
488
+ result: RuntimeDaemonJsonSchema;
489
+ };
274
490
  'workflow.list': {
275
491
  params: RuntimeDaemonJsonSchema;
276
492
  result: RuntimeDaemonJsonSchema;
@@ -482,6 +698,8 @@ declare const RUNTIME_DAEMON_METHOD_SCHEMAS: {
482
698
  };
483
699
  declare const RUNTIME_DAEMON_NOTIFICATION_SCHEMAS: {
484
700
  event: RuntimeDaemonJsonSchema;
701
+ 'credential.request': RuntimeDaemonJsonSchema;
702
+ 'host_tool.invoke': RuntimeDaemonJsonSchema;
485
703
  'runtime.warning': RuntimeDaemonJsonSchema;
486
704
  };
487
705
  declare const RUNTIME_DAEMON_PROTOCOL_SCHEMA: RuntimeDaemonProtocolSchema;
@@ -499,6 +717,30 @@ declare function listRuntimeDaemonSchemaMethods(): readonly RuntimeDaemonMethod[
499
717
  type KodaXRuntimeMode = 'embedded' | 'daemon';
500
718
  type KodaXRuntimeIsolation = 'inline' | 'worker' | 'process';
501
719
 
720
+ interface RuntimeInlineOwnerHandle {
721
+ readonly profile: string;
722
+ readonly ownerId: string;
723
+ close(): void;
724
+ }
725
+ /**
726
+ * Reserve the Coder profile for inline rollback. Partner runtimes must not use
727
+ * this fence; they remain in their independent embedded namespace.
728
+ */
729
+ declare function acquireKodaXInlineOwner(input?: {
730
+ readonly homeDir?: string;
731
+ readonly profile?: string;
732
+ readonly enableRollback?: boolean;
733
+ }): RuntimeInlineOwnerHandle;
734
+ declare function setKodaXRuntimeOwnerMode(input: {
735
+ readonly mode: 'daemon' | 'inline';
736
+ readonly expectedRevision: number;
737
+ readonly homeDir?: string;
738
+ readonly profile?: string;
739
+ }): {
740
+ readonly mode: 'daemon' | 'inline';
741
+ readonly revision: number;
742
+ readonly updatedAt: string;
743
+ };
502
744
  type ReplRuntimeConfigPatch = Parameters<typeof saveConfig>[0];
503
745
  declare const RUNTIME_CONFIG_PATCH_KEYS: readonly ["provider", "model", "effort", "planModeEffort", "thinking", "reasoningMode", "agentMode", "permissionMode", "locale", "providerModels", "extensions", "repoIntelligenceMode", "repoIntelligenceTrace", "verifierLog", "stallLog", "fallbackProviders", "fastProvider", "fastModel", "deepProvider", "deepModel", "maxOutputTokens", "disablePromptCache", "lsp", "lspAutoDownload", "acpLogLevel", "sessionRetentionDays", "repoIntelligence", "workflow"];
504
746
  type RuntimeConfigPatchKey = typeof RUNTIME_CONFIG_PATCH_KEYS[number];
@@ -513,6 +755,10 @@ interface RuntimeIdentity {
513
755
  }
514
756
  interface RuntimeClientInfo {
515
757
  readonly name: string;
758
+ /** Stable host-generated identity used only after daemon authentication. */
759
+ readonly instanceId?: string;
760
+ /** Stable host-generated secret; persist in OS keychain to resume client-owned leases. */
761
+ readonly instanceSecret?: string;
516
762
  readonly title?: string;
517
763
  readonly version?: string;
518
764
  }
@@ -524,7 +770,9 @@ interface RuntimeClientCapabilities {
524
770
  readonly skillCatalog?: boolean;
525
771
  readonly artifactUpload?: boolean;
526
772
  readonly contextDiagnostics?: boolean;
773
+ readonly operationDeduplication?: boolean;
527
774
  }
775
+ type RuntimeGrantedScope = 'session:observe' | 'session:write' | 'run:control' | 'interaction:respond' | 'permission:respond' | 'permission:grant-admin' | 'integration:admin' | 'workflow:control' | 'artifact:write' | 'agent:control' | 'credential:register' | 'host-tool:register' | 'owner:admin' | 'daemon:admin';
528
776
  interface RuntimeExternalAgentsOptions {
529
777
  readonly factories: readonly AgentExecutorFactory[];
530
778
  readonly policy: AgentDispatchPolicy;
@@ -547,6 +795,10 @@ interface CreateKodaXRuntimeOptions {
547
795
  readonly defaultProvider?: string;
548
796
  readonly defaultModel?: string;
549
797
  readonly permissionTimeoutMs?: number;
798
+ /** Internal daemon-host switch; keeps ordinary embedded runs non-interactive by default. */
799
+ readonly sharedDaemonHost?: boolean;
800
+ /** @internal Owner-fence identity assigned before a shared daemon Runtime is constructed. */
801
+ readonly daemonHostRuntimeId?: string;
550
802
  readonly daemonStartupTimeoutMs?: number;
551
803
  readonly daemonConnectTimeoutMs?: number;
552
804
  readonly daemonTransport?: RuntimeDaemonClientTransport;
@@ -583,6 +835,47 @@ interface RuntimeCapabilityRequirements {
583
835
  readonly hardDispose?: boolean;
584
836
  /** Reject hosts that do not advertise an installed external Agent executor plane. */
585
837
  readonly externalAgents?: boolean;
838
+ readonly operationDeduplication?: 1;
839
+ readonly sessionObservation?: 1;
840
+ readonly afterTurnInput?: 1;
841
+ readonly interruptInput?: 1;
842
+ readonly askUserTransport?: 1;
843
+ readonly permissionCas?: 1;
844
+ readonly providerCredentialBroker?: 1;
845
+ readonly runBoundHostTools?: 1;
846
+ readonly coderOwnerFencing?: 1;
847
+ readonly crashOutcomeModel?: 1;
848
+ readonly coderFeatureMatrix?: 1;
849
+ readonly sessionAdmission?: 1;
850
+ readonly completeObservationSnapshot?: 1;
851
+ readonly connectionLifecycle?: 1;
852
+ readonly typedRuntimeEvents?: 1;
853
+ readonly daemonSafeRunInput?: 1;
854
+ readonly sharedSessionSettings?: 1;
855
+ readonly durableRecoveryQueries?: 1;
856
+ }
857
+ type RuntimeOperationState = 'accepted' | 'dispatched' | 'applied' | 'rejected' | 'interrupted' | 'unknown';
858
+ interface RuntimeOperationReceipt {
859
+ readonly operationId: string;
860
+ readonly journalEpoch: string;
861
+ readonly principalId: string;
862
+ readonly method: string;
863
+ readonly resourceId?: string;
864
+ readonly requestDigest: string;
865
+ readonly state: RuntimeOperationState;
866
+ /** Serialized mutation result when state is applied; exact retries return the same value. */
867
+ readonly result?: unknown;
868
+ readonly updatedAt: string;
869
+ readonly error?: {
870
+ readonly code: string;
871
+ readonly message: string;
872
+ };
873
+ }
874
+ interface RuntimeOperationService {
875
+ get(input: {
876
+ readonly operationId: string;
877
+ readonly journalEpoch: string;
878
+ }): Promise<RuntimeOperationReceipt>;
586
879
  }
587
880
  interface RuntimeDiagnosticFilter {
588
881
  readonly sessionId?: string;
@@ -592,12 +885,31 @@ interface RuntimeDiagnosticsService {
592
885
  latestContextBudget(filter?: RuntimeDiagnosticFilter): Promise<RuntimeContextBudgetSnapshot | null>;
593
886
  latestToolExposure(filter?: RuntimeDiagnosticFilter): Promise<RuntimeToolExposurePlan | null>;
594
887
  }
888
+ interface RuntimeConnectionState {
889
+ readonly state: 'connected' | 'disconnected';
890
+ readonly connectionId: string;
891
+ readonly runtimeEpoch: string;
892
+ readonly journalEpoch?: string;
893
+ readonly reason?: string;
894
+ readonly reconnectable: boolean;
895
+ }
896
+ interface RuntimeConnectionService {
897
+ current(): RuntimeConnectionState;
898
+ subscribe(listener: (state: RuntimeConnectionState) => void): RuntimeSubscription;
899
+ }
595
900
  interface KodaXRuntime {
596
901
  readonly identity: RuntimeIdentity;
902
+ /** Server-advertised facts. Authorization remains defined by grantedScopes. */
903
+ readonly capabilities?: Readonly<Record<string, unknown>>;
904
+ readonly grantedScopes?: readonly RuntimeGrantedScope[];
597
905
  readonly sessions: RuntimeSessionService;
598
906
  readonly runs: RuntimeRunService;
599
907
  readonly events: RuntimeEventService;
600
908
  readonly permissions: RuntimePermissionService;
909
+ readonly userInputs: RuntimeUserInputService;
910
+ readonly credentials: RuntimeCredentialService;
911
+ readonly hostTools: RuntimeHostToolService;
912
+ readonly operations: RuntimeOperationService;
601
913
  readonly workflows: RuntimeWorkflowService;
602
914
  readonly config: RuntimeConfigService;
603
915
  readonly catalog: RuntimeCatalogService;
@@ -605,6 +917,8 @@ interface KodaXRuntime {
605
917
  readonly artifacts: RuntimeArtifactService;
606
918
  readonly status: RuntimeStatusService;
607
919
  readonly diagnostics: RuntimeDiagnosticsService;
920
+ /** Present on daemon facades; emits disconnects without waiting for polling. */
921
+ readonly connection?: RuntimeConnectionService;
608
922
  readonly admin: RuntimeAdminService;
609
923
  readonly agents: RuntimeAgentService;
610
924
  readonly agentTasks: RuntimeAgentTaskService;
@@ -619,6 +933,8 @@ interface RuntimeAdminService {
619
933
  }
620
934
  interface RuntimeAgentService {
621
935
  readonly enabled: boolean;
936
+ /** Present when this facade owns an embedded execution substrate. */
937
+ readonly execution?: RuntimeAgentBindingService;
622
938
  listDispatchable(query: DispatchableAgentQuery): Promise<readonly DispatchableAgentListing[]>;
623
939
  describe(agentId: string, query: DispatchableAgentQuery): Promise<DispatchableAgentListing | undefined>;
624
940
  preflight(input: AgentPreflightInput): Promise<AgentPreflightResult>;
@@ -770,6 +1086,7 @@ interface RuntimeCreateSessionInput {
770
1086
  readonly surface?: string;
771
1087
  readonly profileId?: string;
772
1088
  readonly tag?: string;
1089
+ readonly operation?: RuntimeOperationOptions;
773
1090
  }
774
1091
  interface RuntimeSession {
775
1092
  readonly id: string;
@@ -780,6 +1097,15 @@ interface RuntimeSession {
780
1097
  readonly profileId?: string;
781
1098
  readonly createdAt?: string;
782
1099
  }
1100
+ /** Payload emitted when an executing run binds its provider session. */
1101
+ interface RuntimeRunSessionLoadedEventPayload {
1102
+ readonly provider: string;
1103
+ readonly sessionId: string;
1104
+ readonly turnId?: string;
1105
+ readonly iteration?: number;
1106
+ }
1107
+ /** `session.loaded` is emitted both for an explicit SDK load and a run provider session bind. */
1108
+ type RuntimeSessionLoadedEventPayload = RuntimeSession | RuntimeRunSessionLoadedEventPayload;
783
1109
  interface RuntimeSessionSummary extends RuntimeSession {
784
1110
  /** Opaque continuation token accepted by RuntimeSessionFilter.cursor. */
785
1111
  readonly cursor?: string;
@@ -813,6 +1139,8 @@ interface RuntimeSessionSettings {
813
1139
  readonly reasoningMode?: KodaXReasoningMode;
814
1140
  readonly permissionMode?: string;
815
1141
  readonly executionCwd?: string;
1142
+ readonly agentMode?: KodaXOptions['agentMode'];
1143
+ readonly autoModeEngine?: 'llm' | 'rules';
816
1144
  }
817
1145
  interface RuntimeSessionSettingsPatch {
818
1146
  readonly provider?: string | null;
@@ -822,6 +1150,8 @@ interface RuntimeSessionSettingsPatch {
822
1150
  readonly reasoningMode?: KodaXReasoningMode | null;
823
1151
  readonly permissionMode?: string | null;
824
1152
  readonly executionCwd?: string | null;
1153
+ readonly agentMode?: KodaXOptions['agentMode'] | null;
1154
+ readonly autoModeEngine?: 'llm' | 'rules' | null;
825
1155
  }
826
1156
  interface RuntimeAppendNoticeInput {
827
1157
  readonly sessionId: string;
@@ -846,14 +1176,65 @@ interface RuntimeCompactSessionInput {
846
1176
  interface RuntimeCompactSessionResult extends CompactSessionResult {
847
1177
  readonly session?: RuntimeSession;
848
1178
  }
1179
+ interface RuntimeVersionedValue<T> {
1180
+ readonly revision: number;
1181
+ readonly value: T;
1182
+ }
1183
+ interface RuntimeVersionedUpdateOptions extends RuntimeOperationOptions {
1184
+ readonly expectedRevision: number;
1185
+ }
1186
+ interface RuntimeActiveToolProjection {
1187
+ readonly key: string;
1188
+ readonly runId: string;
1189
+ readonly turnId?: string;
1190
+ readonly started: unknown;
1191
+ readonly progress?: unknown;
1192
+ }
1193
+ interface RuntimePendingUserInputProjection {
1194
+ readonly requestId: string;
1195
+ readonly runId: string;
1196
+ readonly turnId?: string;
1197
+ readonly detail: unknown;
1198
+ }
1199
+ interface RuntimeManagedTaskProjection {
1200
+ readonly runId: string;
1201
+ readonly turnId?: string;
1202
+ readonly status: KodaXManagedTaskStatusEvent;
1203
+ }
1204
+ interface RuntimeSessionLiveProjection {
1205
+ readonly assistantTextByRun: Readonly<Record<string, string>>;
1206
+ readonly thinkingTextByRun: Readonly<Record<string, string>>;
1207
+ readonly activeTools: readonly RuntimeActiveToolProjection[];
1208
+ readonly todo?: unknown;
1209
+ readonly pendingUserInputs: readonly RuntimePendingUserInputProjection[];
1210
+ readonly managedTasks: readonly RuntimeManagedTaskProjection[];
1211
+ }
1212
+ interface RuntimeSessionObservationSnapshot {
1213
+ readonly runtimeId: string;
1214
+ readonly cursor: number;
1215
+ /** Content-derived token for the transcript captured at this observation boundary. */
1216
+ readonly transcriptRevision: string;
1217
+ readonly session: RuntimeSession;
1218
+ readonly transcript: RuntimeTranscript | null;
1219
+ readonly settings: RuntimeVersionedValue<RuntimeSessionSettings>;
1220
+ readonly runs: readonly RuntimeRunStatus[];
1221
+ readonly pendingPermissions: readonly RuntimePermissionRequest[];
1222
+ readonly live: RuntimeSessionLiveProjection;
1223
+ }
1224
+ interface RuntimeSessionObservation extends RuntimeSubscription {
1225
+ readonly snapshot: RuntimeSessionObservationSnapshot;
1226
+ }
849
1227
  interface RuntimeSessionService {
850
1228
  create(input?: RuntimeCreateSessionInput): Promise<RuntimeSession>;
851
1229
  load(sessionId: string): Promise<RuntimeSession>;
852
1230
  list(filter?: RuntimeSessionFilter): Promise<readonly RuntimeSessionSummary[]>;
853
1231
  transcript(sessionId: string): Promise<RuntimeTranscript | null>;
1232
+ observe(sessionId: string, listener: RuntimeEventListener): Promise<RuntimeSessionObservation>;
854
1233
  fork(input: RuntimeForkSessionInput): Promise<RuntimeSession | null>;
855
1234
  getSettings(sessionId: string): Promise<RuntimeSessionSettings>;
1235
+ getSettingsVersioned(sessionId: string): Promise<RuntimeVersionedValue<RuntimeSessionSettings>>;
856
1236
  updateSettings(sessionId: string, patch: RuntimeSessionSettingsPatch): Promise<RuntimeSessionSettings>;
1237
+ updateSettingsVersioned(sessionId: string, patch: RuntimeSessionSettingsPatch, options: RuntimeVersionedUpdateOptions): Promise<RuntimeVersionedValue<RuntimeSessionSettings>>;
857
1238
  appendNotice(input: RuntimeAppendNoticeInput): Promise<SessionTranscriptEntry | null>;
858
1239
  rewind(input: RuntimeRewindSessionInput): Promise<RuntimeSession | null>;
859
1240
  setActiveEntry(input: RuntimeSetActiveEntryInput): Promise<RuntimeSession | null>;
@@ -908,23 +1289,122 @@ interface RuntimeStartRunInput {
908
1289
  readonly options?: RuntimeKodaXOptions;
909
1290
  /** Host-derived dispatch identity; never accepted from an LLM tool payload. */
910
1291
  readonly agentContext?: AgentDispatchContext;
1292
+ /** Daemon-issued lease binding; contains no credential material. */
1293
+ readonly credential?: {
1294
+ readonly leaseId: string;
1295
+ readonly provider: string;
1296
+ };
1297
+ /** Daemon-issued host capability binding. Unbound runs never inherit it. */
1298
+ readonly hostTools?: {
1299
+ readonly leaseId: string;
1300
+ };
1301
+ readonly operation?: RuntimeOperationOptions;
1302
+ }
1303
+ interface RuntimeSubmitInput {
1304
+ readonly sessionId: string;
1305
+ readonly afterRunId: string;
1306
+ readonly delivery: 'after_turn' | 'interrupt';
1307
+ readonly input: RuntimeInput | readonly RuntimeInput[];
1308
+ /** Continuations receive only bindings explicitly supplied for this input. */
1309
+ readonly credential?: {
1310
+ readonly leaseId: string;
1311
+ readonly provider: string;
1312
+ };
1313
+ readonly hostTools?: {
1314
+ readonly leaseId: string;
1315
+ };
1316
+ readonly operation?: RuntimeOperationOptions;
1317
+ }
1318
+ type RuntimeSubmitInputResult = {
1319
+ readonly accepted: true;
1320
+ readonly delivery: 'after_turn';
1321
+ readonly runId: string;
1322
+ readonly sessionId: string;
1323
+ readonly afterRunId: string;
1324
+ readonly sessionOrder: number;
1325
+ } | {
1326
+ readonly accepted: false;
1327
+ readonly delivery: 'after_turn' | 'interrupt';
1328
+ readonly sessionId: string;
1329
+ readonly afterRunId: string;
1330
+ readonly reason: 'stale_run' | 'unsupported_capability';
1331
+ };
1332
+ interface RuntimeOperationOptions {
1333
+ readonly operationId?: string;
1334
+ readonly journalEpoch?: string;
1335
+ readonly expectedRevision?: number;
911
1336
  }
912
1337
  type RuntimeKodaXOptions = Omit<KodaXOptions, 'provider' | 'session' | 'events'> & {
913
1338
  readonly provider?: string;
914
1339
  readonly session?: KodaXOptions['session'];
915
1340
  readonly events?: KodaXEvents;
916
1341
  };
1342
+ type RuntimeDaemonContextOptions = Pick<KodaXContextOptions, 'memoryIdentity' | 'gitRoot' | 'executionCwd' | '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'>;
1343
+ type RuntimeDaemonKodaXOptions = Pick<RuntimeKodaXOptions, 'provider' | 'model' | 'modelOverride' | 'effort' | 'thinking' | 'reasoningMode' | 'agentMode' | 'maxIter' | 'workflowRunsBaseDir' | 'modelTiers' | 'maxOutputTokens' | 'disablePromptCache' | 'lsp' | 'workflow' | 'selfManual' | 'compaction' | 'timeouts'> & {
1344
+ readonly context?: RuntimeDaemonContextOptions;
1345
+ };
1346
+ type RuntimeDaemonStartRunInput = Omit<RuntimeStartRunInput, 'options' | 'agentContext' | 'permissionBroker'> & {
1347
+ readonly options?: RuntimeDaemonKodaXOptions;
1348
+ };
1349
+ interface RuntimeDaemonRunService extends Omit<RuntimeRunService, 'start'> {
1350
+ start(input: RuntimeDaemonStartRunInput): Promise<RuntimeRunHandle>;
1351
+ }
1352
+ type KodaXDaemonRuntime = Omit<KodaXRuntime, 'runs'> & {
1353
+ readonly runs: RuntimeDaemonRunService;
1354
+ };
917
1355
  interface RuntimeRunStatus {
918
1356
  readonly runId: string;
919
1357
  readonly sessionId: string;
920
1358
  readonly turnId?: string;
921
1359
  readonly phase: RuntimeRunPhase;
922
1360
  readonly startedAt: string;
1361
+ /** Durable acceptance timestamp; equals startedAt for protocol v1. */
1362
+ readonly acceptedAt?: string;
1363
+ readonly sessionOrder?: number;
1364
+ readonly queuedAt?: string;
1365
+ readonly runningAt?: string;
1366
+ readonly executionStartedAt?: string;
923
1367
  readonly endedAt?: string;
924
1368
  readonly provider: string;
1369
+ readonly mode?: RuntimeRunMode;
1370
+ readonly origin?: {
1371
+ readonly principalId: string;
1372
+ readonly clientName?: string;
1373
+ readonly clientVersion?: string;
1374
+ readonly operationId?: string;
1375
+ };
925
1376
  readonly model?: string;
926
1377
  readonly reasoning?: KodaXReasoningMode;
927
1378
  readonly error?: string;
1379
+ readonly terminal?: RuntimeTerminalFact;
1380
+ readonly continuation?: RuntimeContinuationStatus;
1381
+ readonly requirements?: RuntimeRunRequirements;
1382
+ }
1383
+ interface RuntimeRunRequirements {
1384
+ readonly credential?: {
1385
+ readonly leaseId: string;
1386
+ readonly provider: string;
1387
+ readonly state: 'ready' | 'expired' | 'terminal';
1388
+ };
1389
+ readonly hostTools?: {
1390
+ readonly leaseId: string;
1391
+ readonly state: 'ready' | 'waiting_host' | 'expired' | 'terminal';
1392
+ };
1393
+ }
1394
+ interface RuntimeContinuationStatus {
1395
+ readonly inputId: string;
1396
+ readonly afterRunId: string;
1397
+ readonly delivery: 'after_turn';
1398
+ readonly state: 'queued' | 'delivered' | 'terminal';
1399
+ readonly contentPreview: string;
1400
+ }
1401
+ type RuntimeTerminalCode = 'completed' | 'run_failed' | 'cancelled' | 'interrupted' | 'runtime_restarted' | 'daemon_crashed' | 'credential_unavailable' | 'host_not_dispatched' | 'host_outcome_unknown' | 'control_history_untrusted';
1402
+ interface RuntimeTerminalFact {
1403
+ readonly revision: number;
1404
+ readonly kind: 'completed' | 'failed' | 'cancelled' | 'interrupted';
1405
+ readonly code: RuntimeTerminalCode;
1406
+ readonly effectOutcome: 'none' | 'known' | 'unknown';
1407
+ readonly message?: string;
928
1408
  }
929
1409
  interface RuntimeRunResult {
930
1410
  readonly runId: string;
@@ -945,6 +1425,7 @@ interface RuntimeRunFilter {
945
1425
  }
946
1426
  interface RuntimeRunService {
947
1427
  start(input: RuntimeStartRunInput): Promise<RuntimeRunHandle>;
1428
+ submitInput(input: RuntimeSubmitInput): Promise<RuntimeSubmitInputResult>;
948
1429
  await(runId: string): Promise<RuntimeRunResult>;
949
1430
  get(runId: string): Promise<RuntimeRunStatus>;
950
1431
  list(filter?: RuntimeRunFilter): Promise<readonly RuntimeRunStatus[]>;
@@ -953,7 +1434,124 @@ interface RuntimeRunService {
953
1434
  setProvider(runId: string, provider: string): Promise<void>;
954
1435
  setReasoning(runId: string, reasoning: KodaXReasoningMode | undefined): Promise<void>;
955
1436
  }
956
- 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.progress' | 'turn.started' | 'turn.completed' | 'turn.failed' | 'assistant.delta' | 'thinking.delta' | 'thinking.finished' | 'tool.started' | 'tool.progress' | 'tool.finished' | 'user_input.requested' | 'user_input.resolved' | 'permission.requested' | 'permission.resolved' | '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' | 'repo_intelligence.trace' | 'todo.updated' | 'todo.warning' | 'sidecar.message' | 'run.completed' | 'run.failed' | 'run.cancelled' | 'run.interrupted' | 'artifact.created' | 'config.effective' | 'runtime.warning';
1437
+ 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' | 'turn.started' | 'turn.completed' | 'turn.failed' | 'assistant.delta' | 'thinking.delta' | 'thinking.finished' | 'tool.started' | 'tool.progress' | 'tool.finished' | 'user_input.requested' | 'user_input.resolved' | 'permission.requested' | 'permission.resolved' | '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' | 'repo_intelligence.trace' | 'todo.updated' | 'todo.warning' | 'sidecar.message' | 'run.completed' | 'run.failed' | 'run.cancelled' | 'run.interrupted' | 'artifact.created' | 'config.effective' | 'runtime.warning';
1438
+ interface RuntimeTextDeltaEventPayload {
1439
+ readonly text: string;
1440
+ readonly meta?: KodaXActivityEventMeta;
1441
+ }
1442
+ interface RuntimeThinkingFinishedEventPayload {
1443
+ readonly thinking: string;
1444
+ readonly meta?: KodaXActivityEventMeta;
1445
+ }
1446
+ interface RuntimeToolStartedEventPayload {
1447
+ readonly tool: {
1448
+ readonly name: string;
1449
+ readonly id: string;
1450
+ readonly input?: Readonly<Record<string, unknown>>;
1451
+ };
1452
+ readonly meta?: KodaXToolEventMeta;
1453
+ }
1454
+ type RuntimeToolProgressEventPayload = {
1455
+ readonly update: {
1456
+ readonly id: string;
1457
+ readonly message: string;
1458
+ };
1459
+ readonly meta?: KodaXToolEventMeta;
1460
+ } | {
1461
+ readonly toolName: string;
1462
+ readonly partialJson: string;
1463
+ readonly meta?: KodaXToolEventMeta;
1464
+ };
1465
+ interface RuntimeToolFinishedEventPayload {
1466
+ readonly result: {
1467
+ readonly id: string;
1468
+ readonly name: string;
1469
+ readonly content: string;
1470
+ };
1471
+ readonly meta?: KodaXToolEventMeta;
1472
+ }
1473
+ type RuntimeRunProgressEventPayload = {
1474
+ readonly kind: 'managed_task_status';
1475
+ readonly status: KodaXManagedTaskStatusEvent;
1476
+ } | {
1477
+ readonly kind: 'stream_end' | 'complete';
1478
+ readonly meta?: KodaXActivityEventMeta;
1479
+ } | {
1480
+ readonly kind: 'iteration_start';
1481
+ readonly iter: number;
1482
+ readonly maxIter: number;
1483
+ readonly meta?: KodaXActivityEventMeta;
1484
+ } | {
1485
+ readonly kind: 'iteration_end';
1486
+ readonly info: Readonly<Record<string, unknown>>;
1487
+ } | {
1488
+ readonly kind: 'mid_turn_user_messages';
1489
+ readonly contents: readonly string[];
1490
+ readonly meta?: KodaXActivityEventMeta;
1491
+ };
1492
+ interface RuntimeTodoUpdatedEventPayload {
1493
+ readonly items: readonly unknown[];
1494
+ readonly meta?: KodaXActivityEventMeta;
1495
+ }
1496
+ interface RuntimeInteractionResolvedEventPayload {
1497
+ readonly requestId: string;
1498
+ readonly status?: string;
1499
+ readonly decision?: RuntimePermissionDecision;
1500
+ readonly kind?: RuntimeUserInputKind;
1501
+ }
1502
+ interface RuntimeWarningEventPayload {
1503
+ readonly message: string;
1504
+ readonly source?: string;
1505
+ readonly severity?: string;
1506
+ readonly sourceEventId?: string;
1507
+ }
1508
+ interface RuntimeSessionSettingsUpdatedEventPayload {
1509
+ readonly sessionId: string;
1510
+ readonly revision: number;
1511
+ readonly settings: RuntimeSessionSettings;
1512
+ readonly patch: RuntimeSessionSettingsPatch;
1513
+ }
1514
+ type RuntimeUserInputRequestedEventPayload = RuntimeUserInputRequest | {
1515
+ readonly requestId: string;
1516
+ readonly kind: RuntimeUserInputKind;
1517
+ readonly options: unknown;
1518
+ };
1519
+ type RuntimeEventPayloadDefaults = {
1520
+ readonly [K in RuntimeEventType]: unknown;
1521
+ };
1522
+ type RuntimeEventPayloadMap = Omit<RuntimeEventPayloadDefaults, 'session.created' | 'session.loaded' | 'run.queued' | 'run.started' | 'run.updated' | 'run.completed' | 'run.failed' | 'run.cancelled' | 'run.interrupted' | 'assistant.delta' | 'thinking.delta' | 'thinking.finished' | 'tool.started' | 'tool.progress' | 'tool.finished' | 'run.progress' | 'todo.updated' | 'user_input.requested' | 'user_input.resolved' | 'permission.requested' | 'permission.resolved' | 'session.settings.updated' | 'turn.started' | 'turn.completed' | 'turn.failed' | 'workflow.started' | 'workflow.updated' | 'workflow.finished' | 'context.budget.snapshot' | 'tool.exposure.planned' | 'runtime.warning'> & {
1523
+ readonly 'session.created': RuntimeSession;
1524
+ readonly 'session.loaded': RuntimeSessionLoadedEventPayload;
1525
+ readonly 'run.queued': RuntimeRunStatus;
1526
+ readonly 'run.started': RuntimeRunStatus;
1527
+ readonly 'run.updated': RuntimeRunStatus;
1528
+ readonly 'run.completed': RuntimeRunStatus;
1529
+ readonly 'run.failed': RuntimeRunStatus;
1530
+ readonly 'run.cancelled': RuntimeRunStatus;
1531
+ readonly 'run.interrupted': RuntimeRunStatus;
1532
+ readonly 'assistant.delta': RuntimeTextDeltaEventPayload;
1533
+ readonly 'thinking.delta': RuntimeTextDeltaEventPayload;
1534
+ readonly 'thinking.finished': RuntimeThinkingFinishedEventPayload;
1535
+ readonly 'tool.started': RuntimeToolStartedEventPayload;
1536
+ readonly 'tool.progress': RuntimeToolProgressEventPayload;
1537
+ readonly 'tool.finished': RuntimeToolFinishedEventPayload;
1538
+ readonly 'run.progress': RuntimeRunProgressEventPayload;
1539
+ readonly 'todo.updated': RuntimeTodoUpdatedEventPayload;
1540
+ readonly 'user_input.requested': RuntimeUserInputRequestedEventPayload;
1541
+ readonly 'user_input.resolved': RuntimeInteractionResolvedEventPayload;
1542
+ readonly 'permission.requested': RuntimePermissionRequest;
1543
+ readonly 'permission.resolved': RuntimeInteractionResolvedEventPayload;
1544
+ readonly 'session.settings.updated': RuntimeSessionSettingsUpdatedEventPayload;
1545
+ readonly 'turn.started': KodaXTurnStartedEvent;
1546
+ readonly 'turn.completed': KodaXTurnCompletedEvent;
1547
+ readonly 'turn.failed': KodaXTurnFailedEvent;
1548
+ readonly 'workflow.started': WorkflowProcessEvent;
1549
+ readonly 'workflow.updated': WorkflowProcessEvent;
1550
+ readonly 'workflow.finished': WorkflowProcessEvent;
1551
+ readonly 'context.budget.snapshot': RuntimeContextBudgetSnapshot;
1552
+ readonly 'tool.exposure.planned': RuntimeToolExposurePlan;
1553
+ readonly 'runtime.warning': RuntimeWarningEventPayload;
1554
+ };
957
1555
  interface RuntimeEventEnvelope<TPayload = unknown> {
958
1556
  readonly id: string;
959
1557
  readonly seq: number;
@@ -964,7 +1562,20 @@ interface RuntimeEventEnvelope<TPayload = unknown> {
964
1562
  readonly type: RuntimeEventType;
965
1563
  readonly payload: TPayload;
966
1564
  }
1565
+ type RuntimeTypedEvent<TType extends RuntimeEventType = RuntimeEventType> = {
1566
+ readonly [K in TType]: RuntimeEventEnvelope<RuntimeEventPayloadMap[K]> & {
1567
+ readonly type: K;
1568
+ };
1569
+ }[TType];
1570
+ /** Backward-compatible raw envelope; use parseRuntimeEvent for payload narrowing. */
967
1571
  type RuntimeEvent = RuntimeEventEnvelope;
1572
+ type RuntimeEventParseResult = {
1573
+ readonly ok: true;
1574
+ readonly event: RuntimeTypedEvent;
1575
+ } | {
1576
+ readonly ok: false;
1577
+ readonly error: string;
1578
+ };
968
1579
  interface RuntimeEventFilter {
969
1580
  readonly sessionId?: string;
970
1581
  readonly runId?: string;
@@ -975,6 +1586,7 @@ interface RuntimeEventReplayFilter extends RuntimeEventFilter {
975
1586
  readonly limit?: number;
976
1587
  }
977
1588
  type RuntimeEventListener = (event: RuntimeEvent) => void;
1589
+ type RuntimeTypedEventListener = (event: RuntimeTypedEvent) => void;
978
1590
  interface RuntimeSubscription {
979
1591
  close(): void;
980
1592
  }
@@ -1029,10 +1641,107 @@ interface RuntimePermissionFilter {
1029
1641
  interface RuntimePermissionRespondOptions {
1030
1642
  readonly runId?: string;
1031
1643
  }
1644
+ interface RuntimePermissionGrant {
1645
+ readonly id: string;
1646
+ readonly scope: RuntimePermissionScope;
1647
+ readonly createdAt: string;
1648
+ }
1032
1649
  interface RuntimePermissionService {
1033
1650
  request(input: RuntimePermissionRequestInput): Promise<RuntimePermissionDecision>;
1034
1651
  listPending(filter?: RuntimePermissionFilter): Promise<readonly RuntimePermissionRequest[]>;
1035
1652
  respond(requestId: string, decision: RuntimePermissionDecision, options?: RuntimePermissionRespondOptions): Promise<boolean>;
1653
+ listGrants(): Promise<RuntimeVersionedValue<readonly RuntimePermissionGrant[]>>;
1654
+ revokeGrant(grantId: string, expectedRevision: number): Promise<boolean>;
1655
+ }
1656
+ type RuntimeUserInputKind = 'askUser' | 'askUserMulti' | 'askUserInput';
1657
+ interface RuntimeUserInputRequest {
1658
+ readonly id: string;
1659
+ readonly revision: number;
1660
+ readonly sessionId: string;
1661
+ readonly runId: string;
1662
+ readonly turnId?: string;
1663
+ readonly kind: RuntimeUserInputKind;
1664
+ readonly options: unknown;
1665
+ readonly createdAt: string;
1666
+ readonly expiresAt: string;
1667
+ }
1668
+ interface RuntimeUserInputFilter {
1669
+ readonly sessionId?: string;
1670
+ readonly runId?: string;
1671
+ }
1672
+ interface RuntimeUserInputResolution {
1673
+ readonly requestId: string;
1674
+ readonly accepted: boolean;
1675
+ readonly status: 'answered' | 'dismissed' | 'already_resolved';
1676
+ }
1677
+ interface RuntimeUserInputService {
1678
+ listPending(filter?: RuntimeUserInputFilter): Promise<readonly RuntimeUserInputRequest[]>;
1679
+ respond(requestId: string, answer: unknown, options?: {
1680
+ readonly expectedRevision?: number;
1681
+ readonly runId?: string;
1682
+ }): Promise<RuntimeUserInputResolution>;
1683
+ dismiss(requestId: string, options?: {
1684
+ readonly expectedRevision?: number;
1685
+ readonly runId?: string;
1686
+ }): Promise<RuntimeUserInputResolution>;
1687
+ }
1688
+ interface RuntimeCredentialRequest {
1689
+ readonly leaseId: string;
1690
+ readonly provider: string;
1691
+ readonly sessionId: string;
1692
+ readonly runId: string;
1693
+ }
1694
+ type RuntimeCredentialBroker = (request: RuntimeCredentialRequest) => Promise<string | undefined>;
1695
+ interface RuntimeCredentialLease {
1696
+ readonly id: string;
1697
+ readonly providers: readonly string[];
1698
+ readonly expiresAt?: string;
1699
+ }
1700
+ interface RuntimeCredentialService {
1701
+ register(input: {
1702
+ readonly providers: readonly string[];
1703
+ readonly expiresAt?: string;
1704
+ }, broker: RuntimeCredentialBroker): Promise<RuntimeCredentialLease>;
1705
+ resume(leaseId: string, broker: RuntimeCredentialBroker): Promise<RuntimeCredentialLease>;
1706
+ revoke(leaseId: string): Promise<boolean>;
1707
+ }
1708
+ interface RuntimeHostToolDescriptor {
1709
+ readonly name: string;
1710
+ readonly description: string;
1711
+ readonly inputSchema: Readonly<Record<string, unknown>>;
1712
+ readonly sideEffect: 'none' | 'idempotent' | 'non_idempotent';
1713
+ }
1714
+ interface RuntimeHostToolInvocation {
1715
+ readonly invocationId: string;
1716
+ readonly leaseId: string;
1717
+ readonly toolName: string;
1718
+ readonly sessionId: string;
1719
+ readonly runId: string;
1720
+ readonly input: Readonly<Record<string, unknown>>;
1721
+ }
1722
+ interface RuntimeHostToolResult {
1723
+ readonly content: string;
1724
+ readonly structuredContent?: unknown;
1725
+ }
1726
+ type RuntimeHostToolHandler = (invocation: RuntimeHostToolInvocation) => Promise<RuntimeHostToolResult>;
1727
+ interface RuntimeHostToolLease {
1728
+ readonly id: string;
1729
+ readonly tools: readonly RuntimeHostToolDescriptor[];
1730
+ }
1731
+ interface RuntimeHostToolInvocationStatus {
1732
+ readonly invocationId: string;
1733
+ readonly leaseId: string;
1734
+ readonly toolName: string;
1735
+ readonly sessionId: string;
1736
+ readonly runId: string;
1737
+ readonly state: 'prepared' | 'dispatched' | 'completed' | 'unknown' | 'not_dispatched';
1738
+ readonly updatedAt: string;
1739
+ }
1740
+ interface RuntimeHostToolService {
1741
+ register(tools: readonly RuntimeHostToolDescriptor[], handlers: Readonly<Record<string, RuntimeHostToolHandler>>): Promise<RuntimeHostToolLease>;
1742
+ resume(leaseId: string, handlers: Readonly<Record<string, RuntimeHostToolHandler>>): Promise<RuntimeHostToolLease>;
1743
+ getInvocation(invocationId: string): Promise<RuntimeHostToolInvocationStatus | undefined>;
1744
+ revoke(leaseId: string): Promise<boolean>;
1036
1745
  }
1037
1746
  interface RuntimeWorkflowFilter {
1038
1747
  readonly runId?: string;
@@ -1060,11 +1769,25 @@ interface RuntimeStatusSnapshot {
1060
1769
  readonly pendingPermissions: readonly RuntimePermissionRequest[];
1061
1770
  readonly workflows: readonly RuntimeWorkflowSummary[];
1062
1771
  }
1772
+ interface RuntimeDaemonPreflight {
1773
+ readonly runtimeId: string;
1774
+ readonly clientCount: number;
1775
+ readonly activeRuns: readonly RuntimeRunStatus[];
1776
+ readonly queuedRuns: readonly RuntimeRunStatus[];
1777
+ readonly pendingPermissions: readonly RuntimePermissionRequest[];
1778
+ readonly pendingUserInputs: readonly RuntimeUserInputRequest[];
1779
+ readonly blockers: readonly ('connected_clients' | 'active_runs' | 'queued_runs' | 'pending_interactions')[];
1780
+ readonly canStop: boolean;
1781
+ }
1063
1782
  interface RuntimeStatusService {
1064
1783
  snapshot(): Promise<RuntimeStatusSnapshot>;
1784
+ preflight(): Promise<RuntimeDaemonPreflight>;
1065
1785
  }
1786
+ declare function createKodaXRuntime(options: CreateKodaXRuntimeOptions & {
1787
+ readonly mode: 'daemon';
1788
+ }): Promise<KodaXDaemonRuntime>;
1066
1789
  declare function createKodaXRuntime(options?: CreateKodaXRuntimeOptions): Promise<KodaXRuntime>;
1067
- declare function connectKodaXRuntime(options?: ConnectKodaXRuntimeOptions): Promise<KodaXRuntime>;
1790
+ declare function connectKodaXRuntime(options?: ConnectKodaXRuntimeOptions): Promise<KodaXDaemonRuntime>;
1068
1791
 
1069
- export { KODAX_DAEMON_PROTOCOL, KODAX_DAEMON_PROTOCOL_VERSION, KodaXEvents, KodaXResult, RUNTIME_DAEMON_METHODS, RUNTIME_DAEMON_METHOD_SCHEMAS, RUNTIME_DAEMON_NOTIFICATION_SCHEMAS, RUNTIME_DAEMON_PROTOCOL_SCHEMA, RUNTIME_DAEMON_PROTOCOL_SCHEMA_JSON, RuntimeContextBudgetSnapshot, RuntimeToolExposurePlan, SessionTranscriptEntry, connectKodaXRuntime, createKodaXRuntime, listRuntimeDaemonSchemaMethods };
1070
- export type { ConnectKodaXRuntimeOptions, CreateKodaXRuntimeOptions, KodaXRuntime, KodaXRuntimeIsolation, KodaXRuntimeMode, RuntimeAdminService, RuntimeAgentService, RuntimeAgentTaskService, RuntimeAppendNoticeInput, RuntimeArtifact, RuntimeArtifactKind, RuntimeArtifactRefInput, RuntimeArtifactService, RuntimeCapabilityRequirements, RuntimeCatalogService, RuntimeClientCapabilities, RuntimeClientInfo, RuntimeCommandInfo, RuntimeCommandResolveInput, RuntimeCompactSessionInput, RuntimeCompactSessionResult, RuntimeConfigPatch, RuntimeConfigReloadResult, RuntimeConfigService, RuntimeCreateArtifactInput, RuntimeCreateSessionInput, RuntimeDaemonClientTransport, RuntimeDaemonEndpoint, RuntimeDaemonError, RuntimeDaemonErrorCode, RuntimeDaemonFrame, RuntimeDaemonJsonSchema, RuntimeDaemonMethod, RuntimeDaemonMethodSchema, RuntimeDaemonNotification, RuntimeDaemonNotificationMethod, RuntimeDaemonProtocolSchema, RuntimeDaemonRequest, RuntimeDiagnosticFilter, RuntimeDiagnosticsService, RuntimeEvent, RuntimeEventEnvelope, RuntimeEventFilter, RuntimeEventListener, RuntimeEventReplayFilter, RuntimeEventService, RuntimeEventType, RuntimeExtensionListResult, RuntimeExtensionReloadResult, RuntimeExternalAgentsOptions, RuntimeFileInput, RuntimeForkSessionInput, RuntimeIdentity, RuntimeImageInput, RuntimeInput, RuntimeKodaXOptions, RuntimeMcpReloadResult, RuntimeMcpService, RuntimeMcpToolListFilter, RuntimeMcpValidateResult, RuntimeModelListFilter, RuntimePermissionBroker, RuntimePermissionDecision, RuntimePermissionFilter, RuntimePermissionRequest, RuntimePermissionRequestInput, RuntimePermissionRespondOptions, RuntimePermissionRisk, RuntimePermissionScope, RuntimePermissionService, RuntimeRewindSessionInput, RuntimeRunFilter, RuntimeRunHandle, RuntimeRunMode, RuntimeRunPhase, RuntimeRunResult, RuntimeRunService, RuntimeRunStatus, RuntimeSession, RuntimeSessionFilter, RuntimeSessionService, RuntimeSessionSettings, RuntimeSessionSettingsPatch, RuntimeSessionSummary, RuntimeSetActiveEntryInput, RuntimeSkillDescribeInput, RuntimeSkillDescription, RuntimeSkillFileSummary, RuntimeSkillListFilter, RuntimeSkillSummary, RuntimeStartRunInput, RuntimeStatusService, RuntimeStatusSnapshot, RuntimeSubscription, RuntimeTextInput, RuntimeTranscript, RuntimeVideoInput, RuntimeWorkerOptions, RuntimeWorkerResourceLimits, RuntimeWorkflowFilter, RuntimeWorkflowListener, RuntimeWorkflowService, RuntimeWorkflowSnapshot, RuntimeWorkflowSummary };
1792
+ export { KODAX_DAEMON_PROTOCOL, KODAX_DAEMON_PROTOCOL_VERSION, KodaXEvents, KodaXResult, RUNTIME_DAEMON_METHODS, RUNTIME_DAEMON_METHOD_SCHEMAS, RUNTIME_DAEMON_NOTIFICATION_SCHEMAS, RUNTIME_DAEMON_PROTOCOL_SCHEMA, RUNTIME_DAEMON_PROTOCOL_SCHEMA_JSON, RuntimeContextBudgetSnapshot, RuntimeToolExposurePlan, RuntimeTransportBoundaryError, SessionTranscriptEntry, acquireKodaXInlineOwner, connectKodaXRuntime, createKodaXRuntime, listRuntimeDaemonSchemaMethods, parseRuntimeEvent, setKodaXRuntimeOwnerMode };
1793
+ export type { ConnectKodaXRuntimeOptions, CreateKodaXRuntimeOptions, KodaXDaemonRuntime, KodaXRuntime, KodaXRuntimeIsolation, KodaXRuntimeMode, RuntimeActiveToolProjection, RuntimeAdminService, RuntimeAgentBindingService, RuntimeAgentOwnerSession, RuntimeAgentService, RuntimeAgentTaskService, RuntimeAppendNoticeInput, RuntimeArtifact, RuntimeArtifactKind, RuntimeArtifactRefInput, RuntimeArtifactService, RuntimeBoundDefaultAgent, RuntimeBoundLocalAgent, RuntimeCapabilityRequirements, RuntimeCatalogService, RuntimeClientCapabilities, RuntimeClientInfo, RuntimeCommandInfo, RuntimeCommandResolveInput, RuntimeCompactSessionInput, RuntimeCompactSessionResult, RuntimeConfigPatch, RuntimeConfigReloadResult, RuntimeConfigService, RuntimeConnectionService, RuntimeConnectionState, RuntimeContinuationStatus, RuntimeCreateArtifactInput, RuntimeCreateSessionInput, RuntimeCredentialBroker, RuntimeCredentialLease, RuntimeCredentialRequest, RuntimeCredentialService, RuntimeDaemonClientTransport, RuntimeDaemonContextOptions, RuntimeDaemonEndpoint, RuntimeDaemonError, RuntimeDaemonErrorCode, RuntimeDaemonFrame, RuntimeDaemonJsonSchema, RuntimeDaemonKodaXOptions, RuntimeDaemonMethod, RuntimeDaemonMethodSchema, RuntimeDaemonNotification, RuntimeDaemonNotificationMethod, RuntimeDaemonPreflight, RuntimeDaemonProtocolSchema, RuntimeDaemonRequest, RuntimeDaemonRunService, RuntimeDaemonStartRunInput, RuntimeDaemonTransportLifecycleState, RuntimeDefaultAgentStartInput, RuntimeDiagnosticFilter, RuntimeDiagnosticsService, RuntimeEffectiveSkillRef, RuntimeEvent, RuntimeEventEnvelope, RuntimeEventFilter, RuntimeEventListener, RuntimeEventParseResult, RuntimeEventPayloadMap, RuntimeEventReplayFilter, RuntimeEventService, RuntimeEventType, RuntimeExecutionToolPolicy, RuntimeExtensionListResult, RuntimeExtensionReloadResult, RuntimeExternalAgentsOptions, RuntimeFileInput, RuntimeForkSessionInput, RuntimeGrantedScope, RuntimeHostToolDescriptor, RuntimeHostToolHandler, RuntimeHostToolInvocation, RuntimeHostToolInvocationStatus, RuntimeHostToolLease, RuntimeHostToolResult, RuntimeHostToolService, RuntimeIdentity, RuntimeImageInput, RuntimeInlineOwnerHandle, RuntimeInput, RuntimeInteractionResolvedEventPayload, RuntimeKodaXOptions, RuntimeLocalAgentStartInput, RuntimeManagedTaskProjection, RuntimeMcpReloadResult, RuntimeMcpService, RuntimeMcpToolListFilter, RuntimeMcpValidateResult, RuntimeModelListFilter, RuntimeOperationOptions, RuntimeOperationReceipt, RuntimeOperationService, RuntimeOperationState, RuntimePendingUserInputProjection, RuntimePermissionBroker, RuntimePermissionDecision, RuntimePermissionFilter, RuntimePermissionGrant, RuntimePermissionRequest, RuntimePermissionRequestInput, RuntimePermissionRespondOptions, RuntimePermissionRisk, RuntimePermissionScope, RuntimePermissionService, RuntimeResolvedLocalAgent, RuntimeRewindSessionInput, RuntimeRunFilter, RuntimeRunHandle, RuntimeRunMode, RuntimeRunPhase, RuntimeRunProgressEventPayload, RuntimeRunRequirements, RuntimeRunResult, RuntimeRunService, RuntimeRunSessionLoadedEventPayload, RuntimeRunStatus, RuntimeSession, RuntimeSessionFilter, RuntimeSessionLiveProjection, RuntimeSessionLoadedEventPayload, RuntimeSessionObservation, RuntimeSessionObservationSnapshot, RuntimeSessionService, RuntimeSessionSettings, RuntimeSessionSettingsPatch, RuntimeSessionSettingsUpdatedEventPayload, RuntimeSessionSummary, RuntimeSetActiveEntryInput, RuntimeSkillDescribeInput, RuntimeSkillDescription, RuntimeSkillFileSummary, RuntimeSkillListFilter, RuntimeSkillSummary, RuntimeStartRunInput, RuntimeStatusService, RuntimeStatusSnapshot, RuntimeSubmitInput, RuntimeSubmitInputResult, RuntimeSubscription, RuntimeTerminalCode, RuntimeTerminalFact, RuntimeTextDeltaEventPayload, RuntimeTextInput, RuntimeThinkingFinishedEventPayload, RuntimeTodoUpdatedEventPayload, RuntimeToolFinishedEventPayload, RuntimeToolProgressEventPayload, RuntimeToolStartedEventPayload, RuntimeTranscript, RuntimeTypedEvent, RuntimeTypedEventListener, RuntimeUserInputFilter, RuntimeUserInputKind, RuntimeUserInputRequest, RuntimeUserInputRequestedEventPayload, RuntimeUserInputResolution, RuntimeUserInputService, RuntimeUserMarkdownAgentRef, RuntimeVersionedUpdateOptions, RuntimeVersionedValue, RuntimeVideoInput, RuntimeWarningEventPayload, RuntimeWorkerOptions, RuntimeWorkerResourceLimits, RuntimeWorkflowFilter, RuntimeWorkflowListener, RuntimeWorkflowService, RuntimeWorkflowSnapshot, RuntimeWorkflowSummary, RuntimeWorkspaceBinding };