@jini-ai/agent-runtime 0.7.3-next.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +38 -0
  3. package/dist/agent-protocol/acp/models.d.ts +0 -10
  4. package/dist/agent-protocol/acp/models.js +0 -10
  5. package/dist/agent-protocol/acp/rpc.d.ts +5 -1
  6. package/dist/agent-protocol/acp/rpc.js +2 -1
  7. package/dist/agent-protocol/acp/session-permission.js +4 -3
  8. package/dist/agent-protocol/acp/session-results.d.ts +4 -4
  9. package/dist/agent-protocol/acp/session-results.js +30 -21
  10. package/dist/agent-protocol/acp/session-run.js +0 -8
  11. package/dist/agent-protocol/acp/session-types.d.ts +0 -1
  12. package/dist/agent-protocol/acp/session-usage.d.ts +12 -0
  13. package/dist/agent-protocol/acp/session-usage.js +29 -0
  14. package/dist/agent-protocol/acp/session.d.ts +1 -1
  15. package/dist/agent-protocol/acp/session.js +10 -4
  16. package/dist/agent-protocol/acp/text-suppression.js +75 -71
  17. package/dist/agent-protocol/pi-rpc/events.d.ts +21 -4
  18. package/dist/agent-protocol/pi-rpc/events.js +9 -9
  19. package/dist/agent-protocol/pi-rpc/internal.d.ts +6 -2
  20. package/dist/agent-protocol/pi-rpc/internal.js +6 -4
  21. package/dist/agent-protocol/pi-rpc/session.js +4 -3
  22. package/dist/anthropic-live-models.js +0 -0
  23. package/dist/claude-code-models.d.ts +3 -1
  24. package/dist/claude-code-models.js +4 -4
  25. package/dist/claude-stream-frames.js +1 -1
  26. package/dist/cli-probe-cache.d.ts +33 -0
  27. package/dist/cli-probe-cache.js +59 -0
  28. package/dist/custom-instructions.d.ts +107 -0
  29. package/dist/custom-instructions.js +80 -0
  30. package/dist/defs/{aider.d.ts → aider/index.d.ts} +2 -1
  31. package/dist/defs/{aider.js → aider/index.js} +6 -3
  32. package/dist/defs/amr/executable-env.d.ts +2 -0
  33. package/dist/defs/amr/executable-env.js +2 -0
  34. package/dist/defs/amr/executable-resolution.d.ts +5 -1
  35. package/dist/defs/amr/executable-resolution.js +1 -1
  36. package/dist/defs/antigravity/index.d.ts +1 -0
  37. package/dist/defs/antigravity/index.js +3 -0
  38. package/dist/defs/antigravity/permissions.d.ts +26 -0
  39. package/dist/defs/antigravity/permissions.js +66 -0
  40. package/dist/defs/{auggie.d.ts → auggie/index.d.ts} +1 -1
  41. package/dist/defs/{auggie.js → auggie/index.js} +3 -3
  42. package/dist/defs/claude/config-dir.d.ts +62 -0
  43. package/dist/defs/claude/config-dir.js +133 -0
  44. package/dist/defs/claude/filesystem.d.ts +33 -0
  45. package/dist/defs/claude/filesystem.js +30 -0
  46. package/dist/defs/{claude.d.ts → claude/index.d.ts} +1 -1
  47. package/dist/defs/{claude.js → claude/index.js} +9 -9
  48. package/dist/defs/claude/mcp-config.d.ts +22 -0
  49. package/dist/defs/claude/mcp-config.js +29 -0
  50. package/dist/defs/claude/mcp-delivery.d.ts +57 -0
  51. package/dist/defs/claude/mcp-delivery.js +75 -0
  52. package/dist/defs/claude/mcp-json.d.ts +34 -0
  53. package/dist/defs/claude/mcp-json.js +38 -0
  54. package/dist/defs/claude/subagent-start.d.ts +12 -0
  55. package/dist/defs/claude/subagent-start.js +35 -0
  56. package/dist/defs/{cline.d.ts → cline/index.d.ts} +1 -1
  57. package/dist/defs/{cline.js → cline/index.js} +3 -3
  58. package/dist/defs/codex/contracts.d.ts +47 -0
  59. package/dist/defs/codex/contracts.js +6 -0
  60. package/dist/defs/codex/event-stream.d.ts +5 -1
  61. package/dist/defs/codex/event-stream.js +29 -24
  62. package/dist/defs/codex/home-config.d.ts +55 -0
  63. package/dist/defs/codex/home-config.js +224 -0
  64. package/dist/defs/codex/home-staging.d.ts +57 -0
  65. package/dist/defs/codex/home-staging.js +184 -0
  66. package/dist/defs/{codex.d.ts → codex/index.d.ts} +2 -2
  67. package/dist/defs/{codex.js → codex/index.js} +3 -3
  68. package/dist/defs/codex/isolation.d.ts +29 -0
  69. package/dist/defs/codex/isolation.js +69 -0
  70. package/dist/defs/codex/launch.d.ts +4 -1
  71. package/dist/defs/codex/launch.js +1 -1
  72. package/dist/defs/codex/mcp-delivery.d.ts +8 -0
  73. package/dist/defs/codex/mcp-delivery.js +5 -0
  74. package/dist/defs/{crush.d.ts → crush/index.d.ts} +1 -1
  75. package/dist/defs/{crush.js → crush/index.js} +3 -3
  76. package/dist/defs/cursor-agent/event-stream.d.ts +5 -1
  77. package/dist/defs/cursor-agent/event-stream.js +14 -7
  78. package/dist/defs/{cursor-agent.d.ts → cursor-agent/index.d.ts} +1 -1
  79. package/dist/defs/{cursor-agent.js → cursor-agent/index.js} +4 -4
  80. package/dist/defs/{deepseek.d.ts → deepseek/index.d.ts} +2 -1
  81. package/dist/defs/{deepseek.js → deepseek/index.js} +6 -3
  82. package/dist/defs/{devin.d.ts → devin/index.d.ts} +1 -1
  83. package/dist/defs/{devin.js → devin/index.js} +3 -3
  84. package/dist/defs/{droid.d.ts → droid/index.d.ts} +1 -1
  85. package/dist/defs/{droid.js → droid/index.js} +3 -3
  86. package/dist/defs/gemini/event-stream.d.ts +5 -1
  87. package/dist/defs/gemini/event-stream.js +15 -12
  88. package/dist/defs/gemini/tool-calls.d.ts +7 -0
  89. package/dist/defs/gemini/tool-calls.js +9 -0
  90. package/dist/defs/{goose.d.ts → goose/index.d.ts} +1 -1
  91. package/dist/defs/{goose.js → goose/index.js} +3 -3
  92. package/dist/defs/{grok-build.d.ts → grok-build/index.d.ts} +1 -1
  93. package/dist/defs/{grok-build.js → grok-build/index.js} +3 -3
  94. package/dist/defs/index.d.ts +28 -28
  95. package/dist/defs/index.js +28 -28
  96. package/dist/defs/{kilo.d.ts → kilo/index.d.ts} +1 -1
  97. package/dist/defs/{kilo.js → kilo/index.js} +3 -3
  98. package/dist/defs/kimi/event-stream.d.ts +4 -1
  99. package/dist/defs/kimi/event-stream.js +6 -5
  100. package/dist/defs/{kimi.d.ts → kimi/index.d.ts} +1 -1
  101. package/dist/defs/{kimi.js → kimi/index.js} +3 -3
  102. package/dist/defs/{kiro.d.ts → kiro/index.d.ts} +1 -1
  103. package/dist/defs/{kiro.js → kiro/index.js} +3 -3
  104. package/dist/defs/mimo/constants.d.ts +2 -0
  105. package/dist/defs/mimo/constants.js +2 -0
  106. package/dist/defs/{mimo.d.ts → mimo/index.d.ts} +1 -1
  107. package/dist/defs/{mimo.js → mimo/index.js} +3 -3
  108. package/dist/defs/opencode/constants.d.ts +2 -0
  109. package/dist/defs/opencode/constants.js +2 -0
  110. package/dist/defs/opencode/event-stream.d.ts +5 -1
  111. package/dist/defs/opencode/event-stream.js +13 -11
  112. package/dist/defs/{opencode.d.ts → opencode/index.d.ts} +2 -2
  113. package/dist/defs/{opencode.js → opencode/index.js} +5 -5
  114. package/dist/defs/opencode/mcp-config.d.ts +108 -0
  115. package/dist/defs/opencode/mcp-config.js +119 -0
  116. package/dist/defs/opencode/model-discovery.d.ts +3 -1
  117. package/dist/defs/opencode/model-discovery.js +1 -1
  118. package/dist/defs/opencode/tool-calls.d.ts +7 -0
  119. package/dist/defs/opencode/tool-calls.js +12 -0
  120. package/dist/defs/{opencode-acp.d.ts → opencode-acp/index.d.ts} +2 -2
  121. package/dist/defs/{opencode-acp.js → opencode-acp/index.js} +4 -4
  122. package/dist/defs/{pi.d.ts → pi/index.d.ts} +1 -1
  123. package/dist/defs/{pi.js → pi/index.js} +3 -3
  124. package/dist/defs/pi/model-discovery.d.ts +4 -1
  125. package/dist/defs/pi/model-discovery.js +1 -1
  126. package/dist/defs/{qoder.d.ts → qoder/index.d.ts} +1 -1
  127. package/dist/defs/{qoder.js → qoder/index.js} +3 -3
  128. package/dist/defs/{qwen.d.ts → qwen/index.d.ts} +1 -1
  129. package/dist/defs/{qwen.js → qwen/index.js} +3 -3
  130. package/dist/defs/{reasonix.d.ts → reasonix/index.d.ts} +1 -1
  131. package/dist/defs/{reasonix.js → reasonix/index.js} +3 -3
  132. package/dist/defs/{trae-cli.d.ts → trae-cli/index.d.ts} +1 -1
  133. package/dist/defs/{trae-cli.js → trae-cli/index.js} +3 -3
  134. package/dist/defs/{vibe.d.ts → vibe/index.d.ts} +1 -1
  135. package/dist/defs/{vibe.js → vibe/index.js} +3 -3
  136. package/dist/executables.js +1 -1
  137. package/dist/inventory/index.d.ts +61 -0
  138. package/dist/inventory/index.js +45 -0
  139. package/dist/json-event-stream-shared.d.ts +10 -2
  140. package/dist/json-event-stream-shared.js +21 -13
  141. package/dist/json-event-stream.js +6 -5
  142. package/dist/launch.js +1 -1
  143. package/dist/model-catalog-live-discovery.d.ts +103 -0
  144. package/dist/model-catalog-live-discovery.js +111 -0
  145. package/dist/model-discovery-adapters.d.ts +6 -1
  146. package/dist/model-discovery-adapters.js +4 -3
  147. package/dist/model-discovery-config.js +1 -1
  148. package/dist/native-permissions.d.ts +19 -0
  149. package/dist/native-permissions.js +22 -0
  150. package/dist/providers/anthropic-messages.js +3 -2
  151. package/dist/providers/connection-guard.js +99 -84
  152. package/dist/providers/connection-test.js +0 -5
  153. package/dist/providers/google-messages.js +1 -1
  154. package/dist/providers/oauth-provider.d.ts +1 -23
  155. package/dist/providers/oauth-provider.js +1 -35
  156. package/dist/providers/openai-chat-request.js +1 -1
  157. package/dist/providers/tool-loop-verdict.d.ts +1 -0
  158. package/dist/providers/tool-loop-verdict.js +4 -1
  159. package/dist/providers/tool-turn-types.d.ts +12 -9
  160. package/dist/providers/tool-turn.d.ts +63 -1
  161. package/dist/providers/tool-turn.js +67 -1
  162. package/dist/qoder-stream.js +66 -66
  163. package/dist/role-marker-guard.js +49 -30
  164. package/dist/runtime-def-binding.js +1 -1
  165. package/dist/runtime-port-bindings.d.ts +82 -0
  166. package/dist/runtime-port-bindings.js +4 -1
  167. package/dist/runtime-strategies.d.ts +100 -0
  168. package/dist/runtime-strategies.js +129 -0
  169. package/package.json +44 -10
  170. package/dist/defs/amp.d.ts +0 -2
  171. package/dist/defs/amp.js +0 -2
  172. package/dist/defs/amr.d.ts +0 -2
  173. package/dist/defs/amr.js +0 -2
  174. package/dist/defs/codebuddy.d.ts +0 -2
  175. package/dist/defs/codebuddy.js +0 -2
  176. package/dist/defs/hermes.d.ts +0 -2
  177. package/dist/defs/hermes.js +0 -2
@@ -160,6 +160,88 @@ export declare function createAgentRuntimeBindings({ runtime }: {
160
160
  realpath?: (path: string) => string;
161
161
  }) => string;
162
162
  };
163
+ strategies: {
164
+ for: (required: {
165
+ def: RuntimeAgentDef;
166
+ }) => {
167
+ httpMcpEnv?: typeof import("./defs/opencode/mcp-config.js").withOpenCodeHttpMcp;
168
+ mcpBridge?: {
169
+ prepare(required: {
170
+ delivery: {
171
+ readonly kind: string;
172
+ } | null;
173
+ serverName: string;
174
+ fileLock: import("@jini-ai/core/contracts/runtime").FileLockPort;
175
+ writer: import("@jini-ai/core/contracts/runtime").AtomicFileWriterPort;
176
+ }): Promise<void>;
177
+ };
178
+ filesystem: {
179
+ prepare?: ({ input, spawnEnv, runtimeTemps }: {
180
+ input: import("./defs/claude/filesystem.js").ClaudeFilesystemRunInput;
181
+ spawnEnv: NodeJS.ProcessEnv;
182
+ runtimeTemps: string[];
183
+ }) => Promise<void> | void;
184
+ unsupported?: ({ input }: {
185
+ input: import("./defs/claude/filesystem.js").ClaudeFilesystemRunInput;
186
+ }) => void;
187
+ supported: ({ input, launchPath, spawnEnv }: {
188
+ input: import("./defs/claude/filesystem.js").ClaudeFilesystemRunInput;
189
+ launchPath: string;
190
+ spawnEnv: NodeJS.ProcessEnv;
191
+ }, { filesystem }: {
192
+ filesystem: import("./defs/claude/filesystem.js").ClaudeFilesystemPolicy;
193
+ }) => void;
194
+ };
195
+ mcpConfigFile?: {
196
+ build: typeof import("./defs/claude/mcp-delivery.js").buildClaudeMcpDelivery;
197
+ write: typeof import("./defs/claude/mcp-delivery.js").writeMcpJsonForRun;
198
+ prepareHttp: typeof import("./defs/claude/mcp-config.js").prepareClaudeHttpMcpConfig;
199
+ };
200
+ subagentStart?: {
201
+ prepare: typeof import("./defs/claude/subagent-start.js").prepareClaudeSubagentStartSettings;
202
+ };
203
+ configDir?: {
204
+ readonly envKey: string;
205
+ stage: (required: {
206
+ runId: string;
207
+ hostEnv: NodeJS.ProcessEnv;
208
+ }, optional?: {
209
+ seams?: NonNullable<Parameters<typeof import("./defs/claude/config-dir.js").stageClaudeConfigDir>[1]>["seams"];
210
+ }) => ReturnType<typeof import("./defs/claude/config-dir.js").stageClaudeConfigDir>;
211
+ };
212
+ instructionsDocument?: {
213
+ merge: typeof import("./defs/opencode/mcp-config.js").mergeEnvContentInstructions;
214
+ };
215
+ mcpHome?: {
216
+ readonly envVar: string;
217
+ readonly deliveryKind: "codex-toml";
218
+ buildDelivery<E>(required: {
219
+ serverEntry: E;
220
+ }): {
221
+ readonly kind: "codex-toml";
222
+ readonly serverEntry: E;
223
+ };
224
+ withStagedHome(required: {
225
+ env: NodeJS.ProcessEnv;
226
+ homeDir: string;
227
+ }): NodeJS.ProcessEnv;
228
+ turnsOffPersonalConfig(required: {
229
+ nativeCapabilities?: Partial<import("@jini-ai/core/contracts/agents").NativeCapabilities>;
230
+ }): boolean;
231
+ stage: typeof import("./defs/codex/home-staging.js").stageCodexHome;
232
+ };
233
+ envContent?: {
234
+ mergeMcp: typeof import("./defs/opencode/mcp-config.js").mergeEnvContentMcpConfig;
235
+ };
236
+ mcpDelivery?: {
237
+ envContentVar: string;
238
+ };
239
+ mcpBridgeMechanism?: import("@jini-ai/core/contracts/agents").McpBridgeMechanism;
240
+ toolCallReceipt?: (required: {
241
+ event: Record<string, unknown>;
242
+ }) => Record<string, unknown>;
243
+ };
244
+ };
163
245
  models: {
164
246
  resolveForLaunch: (required: {
165
247
  def: RuntimeAgentDef;
@@ -17,6 +17,7 @@ import { checkPromptArgvBudget, checkWindowsCmdShimCommandLineBudget, checkWindo
17
17
  import { preparePromptFileForAgent } from './prompt-file.js';
18
18
  import { createQoderStreamHandler } from './qoder-stream.js';
19
19
  import { bindRuntimeAgentDef } from './runtime-def-binding.js';
20
+ import { RUNTIME_STRATEGY_HOST_ENV_NAMES, strategiesForDef } from './runtime-strategies.js';
20
21
  function bindDefs({ runtime }, _optional = {}) {
21
22
  const { state, codex } = runtime;
22
23
  return {
@@ -33,7 +34,7 @@ function bindLaunch({ runtime }, _optional = {}) {
33
34
  // The toolchain dirs come from this runtime's state and host env, never from the process defaults.
34
35
  applyEnv: (required, optional = {}) => applyAgentLaunchEnv(required, { appendPathDirs: userToolchainBinDirs({}, { state, env: hostEnv }), ...optional }),
35
36
  toolchainBinDirs: (_required, optional = {}) => userToolchainBinDirs({}, { env: hostEnv, ...optional, state }),
36
- hostEnvNames: () => Object.values(state.executable.envNames),
37
+ hostEnvNames: () => [...Object.values(state.executable.envNames), ...RUNTIME_STRATEGY_HOST_ENV_NAMES],
37
38
  planRun: (required) => planRun(required),
38
39
  resolveNativeToolPolicy: (required) => resolveNativeToolPolicy(required),
39
40
  promptArgvBudget: (required, optional = {}) => checkPromptArgvBudget(required, optional),
@@ -82,6 +83,8 @@ export function createAgentRuntimeBindings({ runtime }, _optional = {}) {
82
83
  defs: bindDefs({ runtime }),
83
84
  launch: bindLaunch({ runtime }),
84
85
  filesystem: bindFilesystem({}),
86
+ // Vendor behaviour chosen by what the definition declares, never by its id (see runtime-strategies.ts).
87
+ strategies: { for: (required) => strategiesForDef(required) },
85
88
  models: {
86
89
  resolveForLaunch: (required, optional = {}) => resolveModelForLaunch(required, { ...optional, deps: getRuntimeModelDiscoveryDeps({ state }) }),
87
90
  identityKind: ({ id }) => modelIdentityKind({ id }),
@@ -0,0 +1,100 @@
1
+ /** @file The vendor behaviour a runtime hands the daemon for one definition, as `AgentRuntimePort['strategies']`.
2
+ * The daemon asks for it by definition and never names a CLI: a dialect or a delivery strategy the definition already
3
+ * declares (`eventParser`, `externalMcpInjection`) selects the implementation here, in the one package that owns vendors. */
4
+ import type { McpBridgeMechanism, NativeCapabilities, RuntimeAgentDef } from '@jini-ai/core/contracts/agents';
5
+ import type { AtomicFileWriterPort, FileLockPort } from '@jini-ai/core/contracts/runtime';
6
+ import { stageCodexHome } from './defs/codex/home-staging.js';
7
+ import { stageClaudeConfigDir } from './defs/claude/config-dir.js';
8
+ import { claudeFilesystemAdapter } from './defs/claude/filesystem.js';
9
+ import { prepareClaudeHttpMcpConfig } from './defs/claude/mcp-config.js';
10
+ import { buildClaudeMcpDelivery, writeMcpJsonForRun } from './defs/claude/mcp-delivery.js';
11
+ import { prepareClaudeSubagentStartSettings } from './defs/claude/subagent-start.js';
12
+ import { mergeEnvContentInstructions, mergeEnvContentMcpConfig, withOpenCodeHttpMcp } from './defs/opencode/mcp-config.js';
13
+ /** Structurally the daemon port's `AgentRuntimeStrategies['mcpBridge']`; the host checks the binding against that port. */
14
+ type McpBridgeSlot = {
15
+ prepare(required: {
16
+ delivery: {
17
+ readonly kind: string;
18
+ } | null;
19
+ serverName: string;
20
+ fileLock: FileLockPort;
21
+ writer: AtomicFileWriterPort;
22
+ }): Promise<void>;
23
+ };
24
+ /** Structurally the daemon port's `AgentRuntimeStrategies['mcpHome']`; the host checks the binding against that port. */
25
+ type McpHomeSlot = {
26
+ readonly envVar: string;
27
+ readonly deliveryKind: 'codex-toml';
28
+ buildDelivery<E>(required: {
29
+ serverEntry: E;
30
+ }): {
31
+ readonly kind: 'codex-toml';
32
+ readonly serverEntry: E;
33
+ };
34
+ withStagedHome(required: {
35
+ env: NodeJS.ProcessEnv;
36
+ homeDir: string;
37
+ }): NodeJS.ProcessEnv;
38
+ turnsOffPersonalConfig(required: {
39
+ nativeCapabilities?: Partial<NativeCapabilities>;
40
+ }): boolean;
41
+ stage: typeof stageCodexHome;
42
+ };
43
+ type EnvContentSlot = {
44
+ mergeMcp: typeof mergeEnvContentMcpConfig;
45
+ };
46
+ type InstructionsDocumentSlot = {
47
+ merge: typeof mergeEnvContentInstructions;
48
+ };
49
+ /** Structurally the daemon port's `AgentRuntimeStrategies['filesystem' | 'configDir' | 'mcpConfigFile' | 'subagentStart']`; the host checks each binding against that port. */
50
+ type FilesystemSlot = {
51
+ prepare?: typeof claudeFilesystemAdapter.prepare;
52
+ unsupported?: typeof claudeFilesystemAdapter.unsupported;
53
+ supported: typeof claudeFilesystemAdapter.supported;
54
+ };
55
+ type ConfigDirSlot = {
56
+ readonly envKey: string;
57
+ stage: (required: {
58
+ runId: string;
59
+ hostEnv: NodeJS.ProcessEnv;
60
+ }, optional?: {
61
+ seams?: NonNullable<Parameters<typeof stageClaudeConfigDir>[1]>['seams'];
62
+ }) => ReturnType<typeof stageClaudeConfigDir>;
63
+ };
64
+ type McpConfigFileSlot = {
65
+ build: typeof buildClaudeMcpDelivery;
66
+ write: typeof writeMcpJsonForRun;
67
+ prepareHttp: typeof prepareClaudeHttpMcpConfig;
68
+ };
69
+ type SubagentStartSlot = {
70
+ prepare: typeof prepareClaudeSubagentStartSettings;
71
+ };
72
+ type ToolCallReceipt = (required: {
73
+ event: Record<string, unknown>;
74
+ }) => Record<string, unknown>;
75
+ /** Env names the launcher must copy from the host env besides the runtime state's own (`launch.hostEnvNames`).
76
+ * `CLAUDE_CONFIG_DIR` is not in the child baseline env, but the staging step reads the operator's real value from the host env. */
77
+ export declare const RUNTIME_STRATEGY_HOST_ENV_NAMES: readonly string[];
78
+ type StrategyDef = Pick<RuntimeAgentDef, 'id' | 'eventParser' | 'externalMcpInjection' | 'systemPromptDelivery' | 'subagentStartHook'>;
79
+ /** Strategies for one definition. O(1): a handful of map lookups. A definition that declares nothing gets `{}`
80
+ * (plus the shared folder-limit policy, see `idSlots`). */
81
+ export declare function strategiesForDef({ def }: {
82
+ def: StrategyDef;
83
+ }, _optional?: Record<string, never>): {
84
+ httpMcpEnv?: typeof withOpenCodeHttpMcp;
85
+ mcpBridge?: McpBridgeSlot;
86
+ filesystem: FilesystemSlot;
87
+ mcpConfigFile?: McpConfigFileSlot;
88
+ subagentStart?: SubagentStartSlot;
89
+ configDir?: ConfigDirSlot;
90
+ instructionsDocument?: InstructionsDocumentSlot;
91
+ mcpHome?: McpHomeSlot;
92
+ envContent?: EnvContentSlot;
93
+ mcpDelivery?: {
94
+ envContentVar: string;
95
+ };
96
+ mcpBridgeMechanism?: McpBridgeMechanism;
97
+ toolCallReceipt?: ToolCallReceipt;
98
+ };
99
+ export {};
100
+ //# sourceMappingURL=runtime-strategies.d.ts.map
@@ -0,0 +1,129 @@
1
+ import { ensureAntigravityMcpPermission, prepareAntigravityBridge } from './defs/antigravity/permissions.js';
2
+ import { buildCodexMcpDelivery } from './defs/codex/mcp-delivery.js';
3
+ import { CODEX_HOME_ENV, codexTurnsOffPersonalConfig, stageCodexHome, withStagedCodexHome } from './defs/codex/home-staging.js';
4
+ import { CLAUDE_CONFIG_DIR_ENV, stageClaudeConfigDir } from './defs/claude/config-dir.js';
5
+ import { claudeFilesystemAdapter } from './defs/claude/filesystem.js';
6
+ import { prepareClaudeHttpMcpConfig } from './defs/claude/mcp-config.js';
7
+ import { buildClaudeMcpDelivery, writeMcpJsonForRun } from './defs/claude/mcp-delivery.js';
8
+ import { prepareClaudeSubagentStartSettings } from './defs/claude/subagent-start.js';
9
+ import { AMR_OPENCODE_BIN_ENV } from './defs/amr/executable-env.js';
10
+ import { geminiToolCallReceipt } from './defs/gemini/tool-calls.js';
11
+ import { OPENCODE_CONFIG_ENV } from './defs/opencode/constants.js';
12
+ import { openCodeToolCallReceipt } from './defs/opencode/tool-calls.js';
13
+ import { MIMO_CONFIG_ENV } from './defs/mimo/constants.js';
14
+ import { mergeEnvContentInstructions, mergeEnvContentMcpConfig, withOpenCodeHttpMcp } from './defs/opencode/mcp-config.js';
15
+ /** Keyed by the stream dialect (`RuntimeAgentDef.eventParser`) that `json-event-stream.ts` already dispatches on. A
16
+ * dialect is not a CLI: any definition declaring it gets the receipt. */
17
+ const RECEIPT_BY_DIALECT = new Map([
18
+ ['legacy-google-stream-json', geminiToolCallReceipt],
19
+ ['opencode', openCodeToolCallReceipt],
20
+ ]);
21
+ /** Keyed by the declared MCP delivery strategy; the daemon serialises one config document into the named variable. */
22
+ const ENV_CONTENT_VAR_BY_STRATEGY = new Map([
23
+ ['opencode-env-content', OPENCODE_CONFIG_ENV],
24
+ ['mimo-env-content', MIMO_CONFIG_ENV],
25
+ ]);
26
+ /** Keyed by definition id: the bridge preparation writes the one CLI's own settings file, so a shared
27
+ * declared strategy (`env-passthrough`) is not enough to select it. */
28
+ const MCP_BRIDGE_BY_ID = new Map([
29
+ ['antigravity', { prepare: (required) => prepareAntigravityBridge(required, { ensurePermission: ensureAntigravityMcpPermission }) }],
30
+ ]);
31
+ /** Keyed by the declared `externalMcpInjection` strategy, as the delivery already is: the strategy names the staged-home mechanism. */
32
+ const MCP_HOME_BY_STRATEGY = new Map([
33
+ ['codex-toml', {
34
+ envVar: CODEX_HOME_ENV,
35
+ deliveryKind: 'codex-toml',
36
+ buildDelivery: buildCodexMcpDelivery,
37
+ withStagedHome: ({ env, homeDir }) => withStagedCodexHome({ env, codexHomeDir: homeDir }),
38
+ turnsOffPersonalConfig: codexTurnsOffPersonalConfig,
39
+ stage: stageCodexHome,
40
+ }],
41
+ ]);
42
+ /** Keyed by the declared MCP delivery strategy, like the variable above: both CLIs read one OpenCode-schema document. */
43
+ const ENV_CONTENT_BY_STRATEGY = new Map([
44
+ ['opencode-env-content', { mergeMcp: mergeEnvContentMcpConfig }],
45
+ ['mimo-env-content', { mergeMcp: mergeEnvContentMcpConfig }],
46
+ ]);
47
+ /** Keyed by the declared system-prompt delivery strategy: it is a def's own declaration, independent of how its MCP bridge is delivered. */
48
+ const INSTRUCTIONS_DOCUMENT_BY_STRATEGY = new Map([
49
+ ['config-instructions-file', { merge: mergeEnvContentInstructions }],
50
+ ]);
51
+ /** Keyed by definition id: the HTTP endpoint rides the inline document only for the CLIs that read it from there, so the
52
+ * shared delivery strategy (also declared by the Mimo definition, which does not take it) is not enough to select it. */
53
+ const HTTP_MCP_ENV_BY_ID = new Map([
54
+ ['opencode', withOpenCodeHttpMcp],
55
+ ['opencode-acp', withOpenCodeHttpMcp],
56
+ ]);
57
+ /** Claude's folder-limit policy applies to every definition whose probe reports support; its temp and degrade steps are Claude's own. */
58
+ const FILESYSTEM_BY_ID = new Map([['claude', claudeFilesystemAdapter]]);
59
+ const SHARED_FILESYSTEM_SLOT = { supported: claudeFilesystemAdapter.supported };
60
+ /** Keyed by definition id, not by the shared `claude-mcp-json` delivery: isolating the operator's own config is the real CLI's concern, not `codebuddy`'s. */
61
+ const CONFIG_DIR_BY_ID = new Map([['claude', { envKey: CLAUDE_CONFIG_DIR_ENV, stage: stageClaudeConfigDir }]]);
62
+ /** Keyed by the declared `subagentStartHook`: a definition that says its CLI fires a SubagentStart hook gets the settings that register one. */
63
+ const SUBAGENT_START = { prepare: prepareClaudeSubagentStartSettings };
64
+ /** Keyed by the declared `externalMcpInjection` strategy, which `codebuddy` shares with `claude`. */
65
+ const MCP_CONFIG_FILE_BY_STRATEGY = new Map([
66
+ ['claude-mcp-json', { build: buildClaudeMcpDelivery, write: writeMcpJsonForRun, prepareHttp: prepareClaudeHttpMcpConfig }],
67
+ ]);
68
+ const MCP_BRIDGE_MECHANISM_BY_STRATEGY = {
69
+ 'claude-mcp-json': 'config-file',
70
+ 'acp-merge': 'acp-merge',
71
+ 'opencode-env-content': 'env-content',
72
+ 'mimo-env-content': 'env-content',
73
+ 'codex-toml': 'staged-home',
74
+ 'env-passthrough': 'env-passthrough',
75
+ };
76
+ /** Env names the launcher must copy from the host env besides the runtime state's own (`launch.hostEnvNames`).
77
+ * `CLAUDE_CONFIG_DIR` is not in the child baseline env, but the staging step reads the operator's real value from the host env. */
78
+ export const RUNTIME_STRATEGY_HOST_ENV_NAMES = [AMR_OPENCODE_BIN_ENV, CLAUDE_CONFIG_DIR_ENV, CODEX_HOME_ENV];
79
+ /** The slots the declared `externalMcpInjection` strategy selects: how the MCP bridge reaches the CLI (an env-carried document, or a staged home). */
80
+ function mcpStrategySlots({ def }, _optional = {}) {
81
+ const strategy = def.externalMcpInjection;
82
+ if (strategy === undefined)
83
+ return {};
84
+ const mcpBridgeMechanism = Object.hasOwn(MCP_BRIDGE_MECHANISM_BY_STRATEGY, strategy)
85
+ ? MCP_BRIDGE_MECHANISM_BY_STRATEGY[strategy] : undefined;
86
+ const envContentVar = ENV_CONTENT_VAR_BY_STRATEGY.get(strategy);
87
+ const envContent = ENV_CONTENT_BY_STRATEGY.get(strategy);
88
+ const mcpHome = MCP_HOME_BY_STRATEGY.get(strategy);
89
+ return {
90
+ ...(mcpBridgeMechanism === undefined ? {} : { mcpBridgeMechanism }),
91
+ ...(envContentVar ? { mcpDelivery: { envContentVar } } : {}),
92
+ ...(envContent ? { envContent } : {}),
93
+ ...(mcpHome ? { mcpHome } : {}),
94
+ };
95
+ }
96
+ /** The slots a definition's own declarations select (dialect, MCP delivery strategy, system-prompt strategy). */
97
+ function declaredSlots({ def }, _optional = {}) {
98
+ const toolCallReceipt = def.eventParser === undefined ? undefined : RECEIPT_BY_DIALECT.get(def.eventParser);
99
+ const instructionsDocument = def.systemPromptDelivery === undefined ? undefined : INSTRUCTIONS_DOCUMENT_BY_STRATEGY.get(def.systemPromptDelivery.strategy);
100
+ return {
101
+ ...(toolCallReceipt ? { toolCallReceipt } : {}),
102
+ ...mcpStrategySlots({ def }),
103
+ ...(instructionsDocument ? { instructionsDocument } : {}),
104
+ };
105
+ }
106
+ /** The claude-shaped staging slots a definition is bound to; each key is present only when bound. */
107
+ function stagingSlotsForDef({ def }, _optional = {}) {
108
+ const configDir = CONFIG_DIR_BY_ID.get(def.id);
109
+ const subagentStart = def.subagentStartHook === true ? SUBAGENT_START : undefined;
110
+ const mcpConfigFile = def.externalMcpInjection === undefined ? undefined : MCP_CONFIG_FILE_BY_STRATEGY.get(def.externalMcpInjection);
111
+ return {
112
+ ...(configDir ? { configDir } : {}),
113
+ ...(subagentStart ? { subagentStart } : {}),
114
+ ...(mcpConfigFile ? { mcpConfigFile } : {}),
115
+ };
116
+ }
117
+ /** The slots bound to one CLI by definition id, where a shared declared strategy is not enough to select them.
118
+ * Except the shared folder-limit policy, which is bound for every definition (see `SHARED_FILESYSTEM_SLOT`). */
119
+ function idSlots({ def }, _optional = {}) {
120
+ const mcpBridge = MCP_BRIDGE_BY_ID.get(def.id);
121
+ const httpMcpEnv = HTTP_MCP_ENV_BY_ID.get(def.id);
122
+ return { filesystem: FILESYSTEM_BY_ID.get(def.id) ?? SHARED_FILESYSTEM_SLOT, ...(mcpBridge ? { mcpBridge } : {}), ...(httpMcpEnv ? { httpMcpEnv } : {}) };
123
+ }
124
+ /** Strategies for one definition. O(1): a handful of map lookups. A definition that declares nothing gets `{}`
125
+ * (plus the shared folder-limit policy, see `idSlots`). */
126
+ export function strategiesForDef({ def }, _optional = {}) {
127
+ return { ...declaredSlots({ def }), ...stagingSlotsForDef({ def }), ...idSlots({ def }) };
128
+ }
129
+ //# sourceMappingURL=runtime-strategies.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/agent-runtime",
3
- "version": "0.7.3-next.2",
3
+ "version": "0.7.4",
4
4
  "description": "Coding-agent runtime adapters: runtime registry, detection, launch, stream parsers, and the ACP/pi-rpc subprocess transport.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -16,12 +16,16 @@
16
16
  ".": "node",
17
17
  "./providers/tool-turn": "node",
18
18
  "./model-catalog/cache": "universal",
19
+ "./model-catalog/live-discovery": "node",
19
20
  "./providers/sse-decode": "universal",
20
21
  "./providers/credentials": "universal",
21
22
  "./model-discovery": "node",
22
23
  "./model-selection": "universal",
23
24
  "./native-tool-policy": "universal",
24
- "./native-permissions": "universal"
25
+ "./native-permissions": "universal",
26
+ "./cli-probe-cache": "node",
27
+ "./custom-instructions": "universal",
28
+ "./inventory": "universal"
25
29
  },
26
30
  "isolation": {
27
31
  "forbidden": {
@@ -67,6 +71,11 @@
67
71
  "import": "./dist/model-catalog-cache.js",
68
72
  "default": "./dist/model-catalog-cache.js"
69
73
  },
74
+ "./model-catalog/live-discovery": {
75
+ "types": "./dist/model-catalog-live-discovery.d.ts",
76
+ "import": "./dist/model-catalog-live-discovery.js",
77
+ "default": "./dist/model-catalog-live-discovery.js"
78
+ },
70
79
  "./providers/sse-decode": {
71
80
  "types": "./dist/providers/sse-decode.d.ts",
72
81
  "import": "./dist/providers/sse-decode.js",
@@ -86,6 +95,21 @@
86
95
  "types": "./dist/model-discovery.d.ts",
87
96
  "import": "./dist/model-discovery.js",
88
97
  "default": "./dist/model-discovery.js"
98
+ },
99
+ "./cli-probe-cache": {
100
+ "types": "./dist/cli-probe-cache.d.ts",
101
+ "import": "./dist/cli-probe-cache.js",
102
+ "default": "./dist/cli-probe-cache.js"
103
+ },
104
+ "./custom-instructions": {
105
+ "types": "./dist/custom-instructions.d.ts",
106
+ "import": "./dist/custom-instructions.js",
107
+ "default": "./dist/custom-instructions.js"
108
+ },
109
+ "./inventory": {
110
+ "types": "./dist/inventory/index.d.ts",
111
+ "import": "./dist/inventory/index.js",
112
+ "default": "./dist/inventory/index.js"
89
113
  }
90
114
  },
91
115
  "typesVersions": {
@@ -110,6 +134,15 @@
110
134
  ],
111
135
  "model-discovery": [
112
136
  "./dist/model-discovery.d.ts"
137
+ ],
138
+ "cli-probe-cache": [
139
+ "./dist/cli-probe-cache.d.ts"
140
+ ],
141
+ "custom-instructions": [
142
+ "./dist/custom-instructions.d.ts"
143
+ ],
144
+ "inventory": [
145
+ "./dist/inventory/index.d.ts"
113
146
  ]
114
147
  }
115
148
  },
@@ -131,16 +164,17 @@
131
164
  },
132
165
  "devDependencies": {
133
166
  "@vitest/coverage-v8": "^3.2.6",
134
- "@jini-ai/platform": "^0.7.3-next.2",
135
- "@jini-ai/integrations": "^0.7.3-next.2",
136
- "@jini-ai/core": "^0.7.3-next.2"
167
+ "@jini-ai/integrations": "^0.7.4",
168
+ "@jini-ai/platform": "^0.7.4",
169
+ "@jini-ai/core": "^0.7.4"
137
170
  },
138
171
  "dependencies": {
139
- "@jini-ai/oauth": "^0.7.3-next.2",
140
- "@jini-ai/integrations": "^0.7.3-next.2",
141
- "@jini-ai/platform": "^0.7.3-next.2",
142
- "@jini-ai/core": "^0.7.3-next.2",
143
- "@jini-ai/protocol": "^0.7.3-next.2"
172
+ "smol-toml": "1.9.1",
173
+ "@jini-ai/oauth": "^0.7.4",
174
+ "@jini-ai/protocol": "^0.7.4",
175
+ "@jini-ai/integrations": "^0.7.4",
176
+ "@jini-ai/core": "^0.7.4",
177
+ "@jini-ai/platform": "^0.7.4"
144
178
  },
145
179
  "scripts": {
146
180
  "build": "tsc -p tsconfig.json",
@@ -1,2 +0,0 @@
1
- export * from './amp/index.js';
2
- //# sourceMappingURL=amp.d.ts.map
package/dist/defs/amp.js DELETED
@@ -1,2 +0,0 @@
1
- export * from './amp/index.js';
2
- //# sourceMappingURL=amp.js.map
@@ -1,2 +0,0 @@
1
- export * from './amr/index.js';
2
- //# sourceMappingURL=amr.d.ts.map
package/dist/defs/amr.js DELETED
@@ -1,2 +0,0 @@
1
- export * from './amr/index.js';
2
- //# sourceMappingURL=amr.js.map
@@ -1,2 +0,0 @@
1
- export * from './codebuddy/index.js';
2
- //# sourceMappingURL=codebuddy.d.ts.map
@@ -1,2 +0,0 @@
1
- export * from './codebuddy/index.js';
2
- //# sourceMappingURL=codebuddy.js.map
@@ -1,2 +0,0 @@
1
- export * from './hermes/index.js';
2
- //# sourceMappingURL=hermes.d.ts.map
@@ -1,2 +0,0 @@
1
- export * from './hermes/index.js';
2
- //# sourceMappingURL=hermes.js.map