@jini-ai/agent-runtime 0.7.3-next.1 → 0.7.3-next.3

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 (170) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +38 -0
  3. package/dist/agent-protocol/acp/constants.d.ts +3 -0
  4. package/dist/agent-protocol/acp/constants.js +5 -0
  5. package/dist/agent-protocol/acp/models.d.ts +0 -10
  6. package/dist/agent-protocol/acp/models.js +6 -11
  7. package/dist/agent-protocol/acp/rpc.d.ts +5 -1
  8. package/dist/agent-protocol/acp/rpc.js +2 -1
  9. package/dist/agent-protocol/acp/session-permission.js +4 -3
  10. package/dist/agent-protocol/acp/session-results.d.ts +3 -3
  11. package/dist/agent-protocol/acp/session-results.js +22 -17
  12. package/dist/agent-protocol/acp/session-run.js +0 -8
  13. package/dist/agent-protocol/acp/session-types.d.ts +0 -1
  14. package/dist/agent-protocol/acp/session.js +3 -2
  15. package/dist/agent-protocol/acp/text-suppression.js +75 -71
  16. package/dist/agent-protocol/pi-rpc/events.d.ts +21 -4
  17. package/dist/agent-protocol/pi-rpc/events.js +8 -8
  18. package/dist/agent-protocol/pi-rpc/internal.d.ts +6 -2
  19. package/dist/agent-protocol/pi-rpc/internal.js +6 -4
  20. package/dist/agent-protocol/pi-rpc/session.js +4 -3
  21. package/dist/anthropic-live-models.js +0 -0
  22. package/dist/claude-code-models.d.ts +3 -1
  23. package/dist/claude-code-models.js +4 -4
  24. package/dist/cli-probe-cache.d.ts +33 -0
  25. package/dist/cli-probe-cache.js +59 -0
  26. package/dist/custom-instructions.d.ts +107 -0
  27. package/dist/custom-instructions.js +80 -0
  28. package/dist/defs/{aider.d.ts → aider/index.d.ts} +2 -1
  29. package/dist/defs/{aider.js → aider/index.js} +6 -3
  30. package/dist/defs/amr/executable-env.d.ts +2 -0
  31. package/dist/defs/amr/executable-env.js +2 -0
  32. package/dist/defs/amr/executable-resolution.d.ts +5 -1
  33. package/dist/defs/amr/executable-resolution.js +1 -1
  34. package/dist/defs/antigravity/index.d.ts +1 -0
  35. package/dist/defs/antigravity/index.js +3 -0
  36. package/dist/defs/antigravity/permissions.d.ts +26 -0
  37. package/dist/defs/antigravity/permissions.js +66 -0
  38. package/dist/defs/{auggie.d.ts → auggie/index.d.ts} +1 -1
  39. package/dist/defs/{auggie.js → auggie/index.js} +3 -3
  40. package/dist/defs/claude/config-dir.d.ts +62 -0
  41. package/dist/defs/claude/config-dir.js +133 -0
  42. package/dist/defs/claude/filesystem.d.ts +33 -0
  43. package/dist/defs/claude/filesystem.js +30 -0
  44. package/dist/defs/{claude.d.ts → claude/index.d.ts} +1 -1
  45. package/dist/defs/{claude.js → claude/index.js} +9 -9
  46. package/dist/defs/claude/mcp-config.d.ts +22 -0
  47. package/dist/defs/claude/mcp-config.js +29 -0
  48. package/dist/defs/claude/mcp-delivery.d.ts +57 -0
  49. package/dist/defs/claude/mcp-delivery.js +75 -0
  50. package/dist/defs/claude/mcp-json.d.ts +34 -0
  51. package/dist/defs/claude/mcp-json.js +38 -0
  52. package/dist/defs/claude/subagent-start.d.ts +12 -0
  53. package/dist/defs/claude/subagent-start.js +35 -0
  54. package/dist/defs/{cline.d.ts → cline/index.d.ts} +1 -1
  55. package/dist/defs/{cline.js → cline/index.js} +3 -3
  56. package/dist/defs/codex/contracts.d.ts +47 -0
  57. package/dist/defs/codex/contracts.js +6 -0
  58. package/dist/defs/codex/event-stream.d.ts +5 -1
  59. package/dist/defs/codex/event-stream.js +29 -24
  60. package/dist/defs/codex/home-config.d.ts +55 -0
  61. package/dist/defs/codex/home-config.js +224 -0
  62. package/dist/defs/codex/home-staging.d.ts +57 -0
  63. package/dist/defs/codex/home-staging.js +184 -0
  64. package/dist/defs/{codex.d.ts → codex/index.d.ts} +2 -2
  65. package/dist/defs/{codex.js → codex/index.js} +3 -3
  66. package/dist/defs/codex/isolation.d.ts +29 -0
  67. package/dist/defs/codex/isolation.js +69 -0
  68. package/dist/defs/codex/launch.d.ts +4 -1
  69. package/dist/defs/codex/launch.js +1 -1
  70. package/dist/defs/codex/mcp-delivery.d.ts +8 -0
  71. package/dist/defs/codex/mcp-delivery.js +5 -0
  72. package/dist/defs/{crush.d.ts → crush/index.d.ts} +1 -1
  73. package/dist/defs/{crush.js → crush/index.js} +3 -3
  74. package/dist/defs/cursor-agent/event-stream.d.ts +5 -1
  75. package/dist/defs/cursor-agent/event-stream.js +14 -7
  76. package/dist/defs/{cursor-agent.d.ts → cursor-agent/index.d.ts} +1 -1
  77. package/dist/defs/{cursor-agent.js → cursor-agent/index.js} +4 -4
  78. package/dist/defs/{deepseek.d.ts → deepseek/index.d.ts} +2 -1
  79. package/dist/defs/{deepseek.js → deepseek/index.js} +6 -3
  80. package/dist/defs/{devin.d.ts → devin/index.d.ts} +1 -1
  81. package/dist/defs/{devin.js → devin/index.js} +3 -3
  82. package/dist/defs/{droid.d.ts → droid/index.d.ts} +1 -1
  83. package/dist/defs/{droid.js → droid/index.js} +3 -3
  84. package/dist/defs/gemini/event-stream.d.ts +5 -1
  85. package/dist/defs/gemini/event-stream.js +15 -12
  86. package/dist/defs/gemini/tool-calls.d.ts +7 -0
  87. package/dist/defs/gemini/tool-calls.js +9 -0
  88. package/dist/defs/{goose.d.ts → goose/index.d.ts} +1 -1
  89. package/dist/defs/{goose.js → goose/index.js} +3 -3
  90. package/dist/defs/{grok-build.d.ts → grok-build/index.d.ts} +1 -1
  91. package/dist/defs/{grok-build.js → grok-build/index.js} +3 -3
  92. package/dist/defs/index.d.ts +28 -28
  93. package/dist/defs/index.js +28 -28
  94. package/dist/defs/{kilo.d.ts → kilo/index.d.ts} +1 -1
  95. package/dist/defs/{kilo.js → kilo/index.js} +3 -3
  96. package/dist/defs/kimi/event-stream.d.ts +4 -1
  97. package/dist/defs/kimi/event-stream.js +6 -5
  98. package/dist/defs/{kimi.d.ts → kimi/index.d.ts} +1 -1
  99. package/dist/defs/{kimi.js → kimi/index.js} +3 -3
  100. package/dist/defs/{kiro.d.ts → kiro/index.d.ts} +1 -1
  101. package/dist/defs/{kiro.js → kiro/index.js} +3 -3
  102. package/dist/defs/mimo/constants.d.ts +2 -0
  103. package/dist/defs/mimo/constants.js +2 -0
  104. package/dist/defs/{mimo.d.ts → mimo/index.d.ts} +1 -1
  105. package/dist/defs/{mimo.js → mimo/index.js} +3 -3
  106. package/dist/defs/opencode/constants.d.ts +2 -0
  107. package/dist/defs/opencode/constants.js +2 -0
  108. package/dist/defs/opencode/event-stream.d.ts +5 -1
  109. package/dist/defs/opencode/event-stream.js +13 -11
  110. package/dist/defs/{opencode.d.ts → opencode/index.d.ts} +2 -2
  111. package/dist/defs/{opencode.js → opencode/index.js} +5 -5
  112. package/dist/defs/opencode/mcp-config.d.ts +108 -0
  113. package/dist/defs/opencode/mcp-config.js +119 -0
  114. package/dist/defs/opencode/model-discovery.d.ts +3 -1
  115. package/dist/defs/opencode/model-discovery.js +1 -1
  116. package/dist/defs/opencode/tool-calls.d.ts +7 -0
  117. package/dist/defs/opencode/tool-calls.js +12 -0
  118. package/dist/defs/{opencode-acp.d.ts → opencode-acp/index.d.ts} +2 -2
  119. package/dist/defs/{opencode-acp.js → opencode-acp/index.js} +4 -4
  120. package/dist/defs/{pi.d.ts → pi/index.d.ts} +1 -1
  121. package/dist/defs/{pi.js → pi/index.js} +3 -3
  122. package/dist/defs/pi/model-discovery.d.ts +4 -1
  123. package/dist/defs/pi/model-discovery.js +1 -1
  124. package/dist/defs/{qoder.d.ts → qoder/index.d.ts} +1 -1
  125. package/dist/defs/{qoder.js → qoder/index.js} +3 -3
  126. package/dist/defs/{qwen.d.ts → qwen/index.d.ts} +1 -1
  127. package/dist/defs/{qwen.js → qwen/index.js} +3 -3
  128. package/dist/defs/{reasonix.d.ts → reasonix/index.d.ts} +1 -1
  129. package/dist/defs/{reasonix.js → reasonix/index.js} +3 -3
  130. package/dist/defs/{trae-cli.d.ts → trae-cli/index.d.ts} +1 -1
  131. package/dist/defs/{trae-cli.js → trae-cli/index.js} +3 -3
  132. package/dist/defs/{vibe.d.ts → vibe/index.d.ts} +1 -1
  133. package/dist/defs/{vibe.js → vibe/index.js} +3 -3
  134. package/dist/executables.js +1 -1
  135. package/dist/inventory/index.d.ts +61 -0
  136. package/dist/inventory/index.js +45 -0
  137. package/dist/json-event-stream-shared.d.ts +10 -2
  138. package/dist/json-event-stream-shared.js +21 -13
  139. package/dist/json-event-stream.js +6 -5
  140. package/dist/launch.js +1 -1
  141. package/dist/model-catalog-live-discovery.d.ts +103 -0
  142. package/dist/model-catalog-live-discovery.js +111 -0
  143. package/dist/model-discovery-adapters.d.ts +6 -1
  144. package/dist/model-discovery-adapters.js +4 -3
  145. package/dist/model-discovery-config.js +1 -1
  146. package/dist/native-permissions.d.ts +19 -0
  147. package/dist/native-permissions.js +22 -0
  148. package/dist/providers/connection-guard.js +98 -83
  149. package/dist/providers/connection-test.js +0 -5
  150. package/dist/providers/oauth-provider.d.ts +1 -23
  151. package/dist/providers/oauth-provider.js +1 -35
  152. package/dist/providers/tool-turn-types.d.ts +12 -9
  153. package/dist/providers/tool-turn.d.ts +63 -1
  154. package/dist/providers/tool-turn.js +66 -0
  155. package/dist/qoder-stream.js +66 -66
  156. package/dist/role-marker-guard.js +49 -30
  157. package/dist/runtime-def-binding.js +1 -1
  158. package/dist/runtime-port-bindings.d.ts +82 -0
  159. package/dist/runtime-port-bindings.js +4 -1
  160. package/dist/runtime-strategies.d.ts +100 -0
  161. package/dist/runtime-strategies.js +129 -0
  162. package/package.json +45 -11
  163. package/dist/defs/amp.d.ts +0 -2
  164. package/dist/defs/amp.js +0 -2
  165. package/dist/defs/amr.d.ts +0 -2
  166. package/dist/defs/amr.js +0 -2
  167. package/dist/defs/codebuddy.d.ts +0 -2
  168. package/dist/defs/codebuddy.js +0 -2
  169. package/dist/defs/hermes.d.ts +0 -2
  170. package/dist/defs/hermes.js +0 -2
@@ -0,0 +1,133 @@
1
+ import { promises as fsPromises } from 'node:fs';
2
+ import { homedir, tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { defaultReadMcpJsonFile, defaultWriteMcpJsonFile } from './mcp-json.js';
5
+ export const CLAUDE_CONFIG_DIR_ENV = 'CLAUDE_CONFIG_DIR';
6
+ function defaultMkdtempClaudeConfigDir({ prefix }) {
7
+ return fsPromises.mkdtemp(join(tmpdir(), prefix));
8
+ }
9
+ function defaultRemoveClaudeConfigDir({ path }) {
10
+ return fsPromises.rm(path, { recursive: true, force: true });
11
+ }
12
+ function resolveClaudeConfigDirSeams(options) {
13
+ return {
14
+ mkdtemp: options?.mkdtemp ?? defaultMkdtempClaudeConfigDir,
15
+ readFile: options?.readFile ?? defaultReadMcpJsonFile,
16
+ writeFile: options?.writeFile ?? defaultWriteMcpJsonFile,
17
+ removeDir: options?.removeDir ?? defaultRemoveClaudeConfigDir,
18
+ };
19
+ }
20
+ /**
21
+ * Where `claude`'s own config resolution reads the operator's REAL config from, to seed a run's
22
+ * scratch copy — never where it writes. Mirrors `resolveSourceCodexHomeDir`'s exact reasoning
23
+ * and resolution order: `CLAUDE_CONFIG_DIR` is not in `BASELINE_AGENT_ENV_KEYS`, so a spawned child
24
+ * never inherits it anyway — the whole point is finding wherever the *operator's actual* Claude Code
25
+ * install lives, a host-machine fact resolved against the daemon HOST process's own environment.
26
+ * @param hostEnv - The daemon process's own environment.
27
+ * @returns `hostEnv.CLAUDE_CONFIG_DIR` when set to a non-blank value (matching Claude Code's own
28
+ * resolution order, confirmed against installed Claude Code 2.1.263), else the CLI's documented
29
+ * default, `~/.claude`.
30
+ * @complexity O(1).
31
+ */
32
+ export function resolveSourceClaudeConfigDir({ hostEnv }) {
33
+ const override = hostEnv.CLAUDE_CONFIG_DIR;
34
+ return override !== undefined && override.trim().length > 0 ? override : join(homedir(), '.claude');
35
+ }
36
+ /**
37
+ * Stages a fresh, randomly-named `CLAUDE_CONFIG_DIR` directory (same non-determinism requirement as
38
+ * `McpJsonInjectionOptions.mkdtemp`'s own doc — `os.tmpdir()` is a shared location on a
39
+ * multi-user host, so a guessable name is a real pre-plant/symlink target).
40
+ *
41
+ * **Deliberately empty by default** — unlike `prepareCodexHomeForRun`, which copies the real
42
+ * `config.toml` wholesale (Codex has no personal-data problem in that file), this directory gets
43
+ * NOTHING written into it beyond a best-effort copy of `.credentials.json` (see below). That is the
44
+ * fix: the operator's real `skills`/`plugins`/`agents`/`memory-path index`/`settings.json` must NOT
45
+ * carry over implicitly. `claude` runs correctly against a config directory holding nothing at all —
46
+ * it falls back to its own built-in defaults, not an error.
47
+ *
48
+ * **Login preservation, verified rather than assumed** (per this task's own instruction — "prove
49
+ * login still resolves; do not assume"): confirmed live (2026-09-07, installed Claude Code 2.1.263,
50
+ * macOS) that `claude auth status` reports `loggedIn: false` against ANY `CLAUDE_CONFIG_DIR` other
51
+ * than the operator's real one — including the real `HOME` with only `CLAUDE_CONFIG_DIR` swapped —
52
+ * and confirmed against Claude Code's own docs (code.claude.com/docs/en/authentication) why: "If
53
+ * you've set the CLAUDE_CONFIG_DIR environment variable, Claude Code keeps the .credentials.json
54
+ * file under that directory instead, including the file the macOS fallback writes, and keys the
55
+ * macOS Keychain entry to that directory too, so a session with a different CLAUDE_CONFIG_DIR reads
56
+ * a different entry." So a scratch directory is never logged in by default on ANY platform, not just
57
+ * the ones with no Keychain at all. This function only closes the *portable* case: when the source
58
+ * directory holds a file-based `.credentials.json` (Linux, Windows, or a Keychain-locked macOS
59
+ * fallback — none of which this function can distinguish, and does not need to), it is copied
60
+ * best-effort into the scratch directory, exactly `prepareCodexHomeForRun`'s `auth.json` copy. When
61
+ * it does not (a normal macOS Keychain-only install, confirmed the common case on this codebase's
62
+ * own dev machine), this function does NOT attempt to read the macOS Keychain itself — that would
63
+ * mean this daemon process extracting a live OAuth secret out of an OS-managed credential store into
64
+ * a plaintext file, a materially different and larger security surface than forwarding an
65
+ * already-resolved credential the host handed it (which `credentialEnv`/`ANTHROPIC_API_KEY` already
66
+ * does, safely, today — see `AgentExecutorRunInput.credentialEnv`'s own doc). In that case this
67
+ * mirrors `prepareCodexHomeForRun`'s own accepted outcome for a missing credential file verbatim:
68
+ * "the spawned CLI runs unauthenticated" is documented, existing, precedented behavior in this file,
69
+ * not a new failure mode invented here. A host that needs the isolated child to stay logged in on
70
+ * such an install must supply a credential explicitly via `AgentExecutorRunInput.credentialEnv`
71
+ * (`ANTHROPIC_API_KEY` or `CLAUDE_CODE_OAUTH_TOKEN` — both outrank Keychain-based subscription login
72
+ * in Claude Code's own auth precedence, so the isolated child authenticates without ever needing the
73
+ * operator's personal Keychain entry at all) — see this fix's own handoff report for the operational
74
+ * consequence on a host with no such credential configured yet.
75
+ *
76
+ * **Never touches the real config directory.** `sourceConfigDir` is read-only throughout.
77
+ * @param runId - Embedded in the temp-dir prefix for traceability, same sanitization discipline as `prepareCodexHomeForRun`'s `safeRunId`.
78
+ * @param sourceConfigDir - Where to read a possible real `.credentials.json` from — see {@link resolveSourceClaudeConfigDir}.
79
+ * @param seams - Injectable mkdtemp/readFile/writeFile/removeDir, real filesystem by default.
80
+ * @throws Whatever `mkdtemp` rejects with — the caller ({@link stageClaudeConfigDir}) turns that into a pre-spawn `AGENT_SPAWN_FAILED` failure, matching `prepareCodexHomeForRun`'s own contract.
81
+ * @complexity O(1) plus one directory creation and up to one best-effort file read/write round trip.
82
+ */
83
+ async function prepareClaudeConfigDirForRun(runId, sourceConfigDir, seams) {
84
+ const safeRunId = runId.replace(/[^A-Za-z0-9_-]/g, '-').slice(0, 80) || 'run';
85
+ const dir = await seams.mkdtemp({ prefix: `jini-claude-config-${safeRunId}-` });
86
+ try {
87
+ const credentialsPath = join(sourceConfigDir, '.credentials.json');
88
+ let credentialsRaw;
89
+ try {
90
+ credentialsRaw = await seams.readFile({ path: credentialsPath });
91
+ }
92
+ catch {
93
+ // No file-based credential to copy (the common macOS-Keychain-only case) — see this
94
+ // function's own doc for why that is an accepted, documented outcome, not a failure here.
95
+ credentialsRaw = undefined;
96
+ }
97
+ if (credentialsRaw !== undefined) {
98
+ await seams.writeFile({ path: join(dir, '.credentials.json'), content: credentialsRaw });
99
+ }
100
+ }
101
+ catch (err) {
102
+ await seams.removeDir({ path: dir }).catch(() => {
103
+ // Best-effort only — the original error below is what the caller must see either way.
104
+ });
105
+ throw err;
106
+ }
107
+ return {
108
+ path: dir,
109
+ cleanup: async () => {
110
+ await seams.removeDir({ path: dir });
111
+ },
112
+ };
113
+ }
114
+ /**
115
+ * Finding 1 of SEC-assistant-env-isolation-2026-09-07's one effect — stages this run's scratch
116
+ * `CLAUDE_CONFIG_DIR` directory, returning the prepared handle the launcher's `cleanupStagedFiles` should later
117
+ * release (see {@link prepareClaudeConfigDirForRun}'s own doc for why this is unconditional for `claude` runs, unlike
118
+ * the Codex home's gate on a host-configured MCP bridge strategy).
119
+ *
120
+ * Bound only to the real `claude` CLI's own definition id (`runtime-strategies.ts`) rather than to
121
+ * `externalMcpInjection === 'claude-mcp-json'` (which `codebuddy` also declares): isolating the operator's personal
122
+ * `~/.claude` is specific to the real `claude` CLI's own config resolution, not to every def that happens to share its
123
+ * `.mcp.json` delivery shape. Matches the existing `USER`-for-claude-login special case already singled
124
+ * out by id in `BASELINE_AGENT_ENV_KEYS`'s own doc in `launch.ts`.
125
+ * @param required.hostEnv - The daemon's own environment, threaded through to {@link resolveSourceClaudeConfigDir} rather than read from a module-level `process.env`, matching the Codex home staging's identical testability reasoning.
126
+ * @param optional.seams - Injectable mkdtemp/readFile/writeFile/removeDir, real filesystem by default.
127
+ * @throws Whatever staging rejects with; the caller turns that into a pre-spawn `AGENT_SPAWN_FAILED` failure.
128
+ * @complexity O(1) plus {@link prepareClaudeConfigDirForRun}'s own cost.
129
+ */
130
+ export function stageClaudeConfigDir({ runId, hostEnv }, { seams } = {}) {
131
+ return prepareClaudeConfigDirForRun(runId, resolveSourceClaudeConfigDir({ hostEnv }), resolveClaudeConfigDirSeams(seams));
132
+ }
133
+ //# sourceMappingURL=config-dir.js.map
@@ -0,0 +1,33 @@
1
+ import type { RuntimeBuildOptions } from '@jini-ai/core/contracts/agents';
2
+ /** The launcher's mutable run input, as far as this policy touches it. */
3
+ export type ClaudeFilesystemRunInput = RuntimeBuildOptions & {
4
+ filesystemRuntimeReadPaths?: readonly string[];
5
+ filesystemRuntimeTempBase?: string;
6
+ };
7
+ /** The runtime port's filesystem policy members the supported branch reads. */
8
+ export interface ClaudeFilesystemPolicy {
9
+ runtimePaths(required: {
10
+ launchPath: string;
11
+ }): readonly string[];
12
+ settings(required: {
13
+ options: RuntimeBuildOptions;
14
+ }): string;
15
+ }
16
+ export declare const claudeFilesystemAdapter: {
17
+ prepare({ input, spawnEnv, runtimeTemps }: {
18
+ input: ClaudeFilesystemRunInput;
19
+ spawnEnv: NodeJS.ProcessEnv;
20
+ runtimeTemps: string[];
21
+ }): Promise<void> | void;
22
+ unsupported({ input }: {
23
+ input: ClaudeFilesystemRunInput;
24
+ }): void;
25
+ supported({ input, launchPath, spawnEnv }: {
26
+ input: ClaudeFilesystemRunInput;
27
+ launchPath: string;
28
+ spawnEnv: NodeJS.ProcessEnv;
29
+ }, { filesystem }: {
30
+ filesystem: ClaudeFilesystemPolicy;
31
+ }): void;
32
+ };
33
+ //# sourceMappingURL=filesystem.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { promises as fs } from 'node:fs';
2
+ async function prepareClaudeRuntimeTemp({ input, spawnEnv, runtimeTemps }) {
3
+ // Read denies also block create/unlink, so Claude's cwd files cannot live under /tmp.
4
+ // /var/tmp exists on macOS/Linux; its realpath plus /claude-<uid> must fit 44 bytes
5
+ // or the policy refuses launch instead of letting Bash fall back to shared scratch.
6
+ // mkdtemp creates a private 0700 directory; register cleanup before resolving aliases.
7
+ const runtimeTemp = await fs.mkdtemp('/var/tmp/jini-');
8
+ runtimeTemps.push(runtimeTemp);
9
+ input.filesystemRuntimeTempBase = await fs.realpath(runtimeTemp);
10
+ spawnEnv.CLAUDE_CODE_TMPDIR = input.filesystemRuntimeTempBase;
11
+ }
12
+ export const claudeFilesystemAdapter = {
13
+ prepare({ input, spawnEnv, runtimeTemps }) {
14
+ if (process.platform === 'win32')
15
+ return;
16
+ return prepareClaudeRuntimeTemp({ input, spawnEnv, runtimeTemps });
17
+ },
18
+ unsupported({ input }) {
19
+ // Personal Claude hooks/permissions stay excluded even on an unconfined CLI fallback.
20
+ input.settingSources = [];
21
+ },
22
+ supported({ input, launchPath, spawnEnv }, { filesystem }) {
23
+ input.filesystemRuntimeReadPaths = filesystem.runtimePaths({ launchPath });
24
+ // Validates host settings here so a malformed value fails cleanly; buildArgs merges again (idempotent).
25
+ input.settings = filesystem.settings({ options: input });
26
+ // A login environment can otherwise force auto-memory back on despite the host setting.
27
+ spawnEnv.CLAUDE_CODE_DISABLE_AUTO_MEMORY = '1';
28
+ },
29
+ };
30
+ //# sourceMappingURL=filesystem.js.map
@@ -73,4 +73,4 @@ export declare const claudeAgentDef: {
73
73
  deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
74
74
  }): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
75
75
  };
76
- //# sourceMappingURL=claude.d.ts.map
76
+ //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
- import { resolveNativeCapabilityDenies, resolveNativeToolDenies } from '../native-tool-policy.js';
2
- import { claudeFilesystemSettings, validateFilesystemLaunch, validateReadOnlyExtraDirs } from '../claude-filesystem-policy.js';
3
- import { createAgentModelDiscovery } from '../model-discovery-native.js';
1
+ import { resolveNativeCapabilityDenies, resolveNativeToolDenies } from '../../native-tool-policy.js';
2
+ import { claudeFilesystemSettings, validateFilesystemLaunch, validateReadOnlyExtraDirs } from '../../claude-filesystem-policy.js';
3
+ import { createAgentModelDiscovery } from '../../model-discovery-native.js';
4
4
  /**
5
5
  * Claude Code has no dedicated image-attachment flag. imageDelivery: 'prompt-path' makes the
6
6
  * executor append local image paths to the prompt and add their directories to extraAllowedDirs;
@@ -9,11 +9,11 @@ import { createAgentModelDiscovery } from '../model-discovery-native.js';
9
9
  * A filesystemRoot launch instead validates these directories and omits --add-dir entirely;
10
10
  * hosts must stage attachments inside that root (owner boundary introduced 2026-10-23).
11
11
  */
12
- import { addDirArgs, nonDefaultFlag, permissionModeArgs, resolveCapabilities, sessionArgs } from './claude-compatible-args.js';
13
- import { buildClaudeMcpConfigArgs, DEFAULT_MODEL_OPTION } from './shared.js';
14
- import { loadMmdRouteModels } from '../mmd-routes.js';
15
- import { loadAnthropicLiveModels, mergeLiveModels } from '../anthropic-live-models.js';
16
- import { loadClaudeCodeModels } from '../claude-code-models.js';
12
+ import { addDirArgs, nonDefaultFlag, permissionModeArgs, resolveCapabilities, sessionArgs } from '../claude-compatible-args.js';
13
+ import { buildClaudeMcpConfigArgs, DEFAULT_MODEL_OPTION } from '../shared.js';
14
+ import { loadMmdRouteModels } from '../../mmd-routes.js';
15
+ import { loadAnthropicLiveModels, mergeLiveModels } from '../../anthropic-live-models.js';
16
+ import { loadClaudeCodeModels } from '../../claude-code-models.js';
17
17
  /**
18
18
  * The levels `claude --effort` accepts, as the CLI itself reports them when
19
19
  * given an unknown one. Anything outside this set is dropped rather than
@@ -314,4 +314,4 @@ export const claudeAgentDef = {
314
314
  // behalf rather than this file forwarding `_imagePaths` itself.
315
315
  imageDelivery: 'prompt-path',
316
316
  };
317
- //# sourceMappingURL=claude.js.map
317
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,22 @@
1
+ /** Stage Claude's HTTP capability outside the project; only this private path enters argv.
2
+ * @returns A private config path and removal of only its owned directory.
3
+ * @throws Filesystem staging errors after removing partial output.
4
+ * @complexity O(config bytes), one project read and one private config write.
5
+ */
6
+ export declare function prepareClaudeHttpMcpConfig({ cwd, endpoint, serverName }: {
7
+ cwd: string;
8
+ endpoint: {
9
+ readonly url: string;
10
+ readonly token: string;
11
+ };
12
+ serverName: string;
13
+ }, { inheritUserMcp, readFile }?: {
14
+ inheritUserMcp?: boolean;
15
+ readFile?: (required: {
16
+ readonly path: string;
17
+ }) => Promise<string>;
18
+ }): Promise<{
19
+ path: string;
20
+ cleanup: () => Promise<void>;
21
+ }>;
22
+ //# sourceMappingURL=mcp-config.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { promises as fs } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { defaultReadMcpJsonFile, mergeMcpJsonContent } from './mcp-json.js';
5
+ /** Stage Claude's HTTP capability outside the project; only this private path enters argv.
6
+ * @returns A private config path and removal of only its owned directory.
7
+ * @throws Filesystem staging errors after removing partial output.
8
+ * @complexity O(config bytes), one project read and one private config write.
9
+ */
10
+ export async function prepareClaudeHttpMcpConfig({ cwd, endpoint, serverName }, { inheritUserMcp = true, readFile = defaultReadMcpJsonFile } = {}) {
11
+ const dir = await fs.mkdtemp(join(tmpdir(), 'jini-claude-mcp-'));
12
+ const cleanup = () => fs.rm(dir, { recursive: true, force: true });
13
+ try {
14
+ let existingRaw;
15
+ if (inheritUserMcp)
16
+ existingRaw = await readFile({ path: join(cwd, '.mcp.json') }).catch(() => undefined);
17
+ const content = mergeMcpJsonContent({ existingRaw, serverName, serverEntry: {
18
+ type: 'http', url: endpoint.url, headers: { Authorization: `Bearer ${endpoint.token}` },
19
+ } });
20
+ const path = join(dir, 'mcp.json');
21
+ await fs.writeFile(path, content, { encoding: 'utf8', mode: 0o600, flag: 'wx' });
22
+ return { path, cleanup };
23
+ }
24
+ catch (error) {
25
+ await cleanup();
26
+ throw error;
27
+ }
28
+ }
29
+ //# sourceMappingURL=mcp-config.js.map
@@ -0,0 +1,57 @@
1
+ import { type McpServerEntryLike } from './mcp-json.js';
2
+ export declare function buildClaudeMcpDelivery<Entry extends McpServerEntryLike>({ cwd, runId, serverEntry }: {
3
+ cwd: string;
4
+ runId: string;
5
+ serverEntry: Entry;
6
+ }): {
7
+ kind: 'claude-mcp-json';
8
+ mcpJsonPath: string;
9
+ serverEntry: Entry;
10
+ };
11
+ /**
12
+ * The `'claude-mcp-json'` mechanism's one effect: writes (merging, never clobbering — see
13
+ * {@link mergeMcpJsonContent}) this run's own config — the project's own servers merged with this
14
+ * run's `jini` bridge entry — to the run-scoped path ({@link mcpJsonPathForRun}) the def was already
15
+ * handed via `RuntimeContext.mcpJsonPath`, so the def's own `--strict-mcp-config --mcp-config <path>`
16
+ * argv has a real file to point at by spawn time, instead of auto-discovering `cwd/.mcp.json` (which
17
+ * needs an interactive trust prompt a headless spawn can never answer — confirmed live 2026-07-30,
18
+ * see `@jini-ai/agent-runtime`'s `defs/claude/index.ts`).
19
+ *
20
+ * Reads `cwd/.mcp.json` and writes `delivery.mcpJsonPath`: the project's file is a merge source only,
21
+ * never a write target. See {@link mcpJsonPathForRun} for why one file per run is load-bearing rather
22
+ * than cosmetic, and why the read and write paths must differ.
23
+ *
24
+ * A no-op for every other delivery mechanism, which is expressed by the caller simply not having a
25
+ * `'claude-mcp-json'` delivery to hand it rather than by a strategy re-check in here.
26
+ * @param cwd - The run's working directory, so the project's own `.mcp.json` can be read as the
27
+ * merge base — not carried on `delivery` itself, since that only describes the write target.
28
+ * @param delivery - The already-built `'claude-mcp-json'` delivery (path + entry). Both fields come
29
+ * from `buildMcpBridgeDelivery`, so the credential was resolved exactly once, for this run.
30
+ * @param options - Supplies the injectable `readFile`/`writeFile` seams.
31
+ * @throws Whatever `writeFile` rejects with — the caller (`run()`) turns that into a pre-spawn
32
+ * `AGENT_SPAWN_FAILED` failure, matching the pre-spawn filesystem guards in `launch.ts`
33
+ * (`stagePromptFile`'s own try/catch).
34
+ * @complexity O(1) plus one `readFile`/`writeFile` round trip.
35
+ * @overallScore 100/100
36
+ */
37
+ export declare function writeMcpJsonForRun({ cwd, delivery, options, serverName }: {
38
+ cwd: string;
39
+ delivery: {
40
+ readonly kind: string;
41
+ readonly mcpJsonPath?: string;
42
+ readonly serverEntry?: McpServerEntryLike;
43
+ };
44
+ options: {
45
+ readonly readFile?: (required: {
46
+ readonly path: string;
47
+ }) => Promise<string>;
48
+ readonly writeFile?: (required: {
49
+ readonly path: string;
50
+ readonly content: string;
51
+ }) => Promise<void>;
52
+ };
53
+ serverName: string;
54
+ }, { inheritUserConfig }?: {
55
+ inheritUserConfig?: boolean | undefined;
56
+ }): Promise<string>;
57
+ //# sourceMappingURL=mcp-delivery.d.ts.map
@@ -0,0 +1,75 @@
1
+ import { join } from 'node:path';
2
+ import { defaultReadMcpJsonFile, defaultWriteMcpJsonFile, mergeMcpJsonContent } from './mcp-json.js';
3
+ export function buildClaudeMcpDelivery({ cwd, runId, serverEntry }) {
4
+ return { kind: 'claude-mcp-json', mcpJsonPath: mcpJsonPathForRun(cwd, runId), serverEntry };
5
+ }
6
+ /**
7
+ * This run's own MCP config path, inside `cwd` but deliberately **not** `cwd/.mcp.json`.
8
+ *
9
+ * A shared filename cannot carry two runs' identities at once, and that is exactly what the file
10
+ * carries: `mcpServers.jini.env` holds this run's `JINI_RUN_ID` and its bearer `JINI_DAEMON_TOKEN`.
11
+ * A spawned CLI reads its MCP config when it starts its client, not synchronously at spawn — so with
12
+ * one shared file, a second run in the same directory overwrote the entry the first run's child had
13
+ * not read yet, and that child's `jini-mcp` subprocess then called back carrying the *other* run's id
14
+ * and token: run A's tool calls executing inside run B's authority context. Concurrent runs in one
15
+ * working directory are supported by design (see `McpJsonInjectionOptions.credential`'s doc on why the
16
+ * credential is a per-run resolver at all), so the resolution is one file per run, not a lock that
17
+ * refuses the second run.
18
+ *
19
+ * Naming it after the run also means the project's own `.mcp.json` is never written at all — it stays
20
+ * purely a merge source, so there is no original content to restore afterwards either.
21
+ *
22
+ * The run id is host-supplied and lands in a filename, so everything outside `[A-Za-z0-9_-]` is
23
+ * replaced (dots included — a `..` segment must not survive) and the result is length-capped. Real run
24
+ * ids are UUIDs, which pass through untouched; the cap could in principle collide two ids sharing a
25
+ * 128-character prefix, which no id shape this daemon mints can produce.
26
+ * @complexity O(n) in the run id's length.
27
+ */
28
+ function mcpJsonPathForRun(cwd, runId) {
29
+ const safeRunId = runId.replace(/[^A-Za-z0-9_-]/g, '_').slice(0, 128);
30
+ return join(cwd, `.mcp.jini-${safeRunId}.json`);
31
+ }
32
+ /**
33
+ * The `'claude-mcp-json'` mechanism's one effect: writes (merging, never clobbering — see
34
+ * {@link mergeMcpJsonContent}) this run's own config — the project's own servers merged with this
35
+ * run's `jini` bridge entry — to the run-scoped path ({@link mcpJsonPathForRun}) the def was already
36
+ * handed via `RuntimeContext.mcpJsonPath`, so the def's own `--strict-mcp-config --mcp-config <path>`
37
+ * argv has a real file to point at by spawn time, instead of auto-discovering `cwd/.mcp.json` (which
38
+ * needs an interactive trust prompt a headless spawn can never answer — confirmed live 2026-07-30,
39
+ * see `@jini-ai/agent-runtime`'s `defs/claude/index.ts`).
40
+ *
41
+ * Reads `cwd/.mcp.json` and writes `delivery.mcpJsonPath`: the project's file is a merge source only,
42
+ * never a write target. See {@link mcpJsonPathForRun} for why one file per run is load-bearing rather
43
+ * than cosmetic, and why the read and write paths must differ.
44
+ *
45
+ * A no-op for every other delivery mechanism, which is expressed by the caller simply not having a
46
+ * `'claude-mcp-json'` delivery to hand it rather than by a strategy re-check in here.
47
+ * @param cwd - The run's working directory, so the project's own `.mcp.json` can be read as the
48
+ * merge base — not carried on `delivery` itself, since that only describes the write target.
49
+ * @param delivery - The already-built `'claude-mcp-json'` delivery (path + entry). Both fields come
50
+ * from `buildMcpBridgeDelivery`, so the credential was resolved exactly once, for this run.
51
+ * @param options - Supplies the injectable `readFile`/`writeFile` seams.
52
+ * @throws Whatever `writeFile` rejects with — the caller (`run()`) turns that into a pre-spawn
53
+ * `AGENT_SPAWN_FAILED` failure, matching the pre-spawn filesystem guards in `launch.ts`
54
+ * (`stagePromptFile`'s own try/catch).
55
+ * @complexity O(1) plus one `readFile`/`writeFile` round trip.
56
+ * @overallScore 100/100
57
+ */
58
+ export async function writeMcpJsonForRun({ cwd, delivery, options, serverName }, { inheritUserConfig = true } = {}) {
59
+ if (delivery.kind !== 'claude-mcp-json' || delivery.mcpJsonPath === undefined || delivery.serverEntry === undefined)
60
+ throw new TypeError('Unexpected MCP delivery');
61
+ const readFileFn = options.readFile ?? defaultReadMcpJsonFile;
62
+ const writeFileFn = options.writeFile ?? defaultWriteMcpJsonFile;
63
+ let existingRaw;
64
+ try {
65
+ existingRaw = inheritUserConfig ? await readFileFn({ path: join(cwd, '.mcp.json') }) : undefined;
66
+ }
67
+ catch {
68
+ // No existing file (ENOENT — the common case) or unreadable for any other reason: both
69
+ // degrade to "start fresh", matching mergeMcpJsonContent's own doc.
70
+ existingRaw = undefined;
71
+ }
72
+ await writeFileFn({ path: delivery.mcpJsonPath, content: mergeMcpJsonContent({ existingRaw: existingRaw, serverEntry: delivery.serverEntry, serverName }) });
73
+ return delivery.mcpJsonPath;
74
+ }
75
+ //# sourceMappingURL=mcp-delivery.js.map
@@ -0,0 +1,34 @@
1
+ /** The `.mcp.json` `mcpServers` entry a bridge delivery carries; the daemon's richer entry type is assignable to this. */
2
+ export interface McpServerEntryLike {
3
+ readonly command: string;
4
+ readonly args: string[];
5
+ readonly env: Readonly<Record<string, string>>;
6
+ }
7
+ /**
8
+ * Merges the bridge's entry (under `serverName`) into an existing `.mcp.json`'s `mcpServers` map, preserving
9
+ * every other key and every other registered server untouched. A missing (`existingRaw ===
10
+ * undefined`), empty, or unparseable-as-a-JSON-object existing file all degrade to "start from an
11
+ * empty document" rather than throwing — an unparseable project `.mcp.json` is a pre-existing
12
+ * problem this driver did not create and cannot safely repair, so it is deliberately overwritten
13
+ * with a fresh, valid file containing just this run's bridge entry rather than left broken or
14
+ * left blocking the run. Pure — no I/O — so every branch is directly assertable.
15
+ * @complexity O(1) plus `JSON.parse`/`JSON.stringify`'s own cost on a small config file.
16
+ * @overallScore 100/100
17
+ */
18
+ export declare function mergeMcpJsonContent({ existingRaw, serverEntry, serverName }: {
19
+ readonly existingRaw: string | undefined;
20
+ readonly serverEntry: McpServerEntryLike | {
21
+ readonly type: 'http';
22
+ readonly url: string;
23
+ readonly headers: Readonly<Record<string, string>>;
24
+ };
25
+ readonly serverName: string;
26
+ }): string;
27
+ export declare function defaultReadMcpJsonFile({ path }: {
28
+ readonly path: string;
29
+ }): Promise<string>;
30
+ export declare function defaultWriteMcpJsonFile({ path, content }: {
31
+ readonly path: string;
32
+ readonly content: string;
33
+ }): Promise<void>;
34
+ //# sourceMappingURL=mcp-json.d.ts.map
@@ -0,0 +1,38 @@
1
+ import { promises as fsPromises } from 'node:fs';
2
+ function isRecord(value) {
3
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
4
+ }
5
+ /**
6
+ * Merges the bridge's entry (under `serverName`) into an existing `.mcp.json`'s `mcpServers` map, preserving
7
+ * every other key and every other registered server untouched. A missing (`existingRaw ===
8
+ * undefined`), empty, or unparseable-as-a-JSON-object existing file all degrade to "start from an
9
+ * empty document" rather than throwing — an unparseable project `.mcp.json` is a pre-existing
10
+ * problem this driver did not create and cannot safely repair, so it is deliberately overwritten
11
+ * with a fresh, valid file containing just this run's bridge entry rather than left broken or
12
+ * left blocking the run. Pure — no I/O — so every branch is directly assertable.
13
+ * @complexity O(1) plus `JSON.parse`/`JSON.stringify`'s own cost on a small config file.
14
+ * @overallScore 100/100
15
+ */
16
+ export function mergeMcpJsonContent({ existingRaw, serverEntry, serverName }) {
17
+ let doc = {};
18
+ if (existingRaw !== undefined) {
19
+ try {
20
+ const parsed = JSON.parse(existingRaw);
21
+ if (isRecord(parsed))
22
+ doc = parsed;
23
+ }
24
+ catch {
25
+ doc = {};
26
+ }
27
+ }
28
+ const existingServers = isRecord(doc.mcpServers) ? doc.mcpServers : {};
29
+ const mcpServers = { ...existingServers, [serverName]: serverEntry };
30
+ return `${JSON.stringify({ ...doc, mcpServers }, null, 2)}\n`;
31
+ }
32
+ export function defaultReadMcpJsonFile({ path }) {
33
+ return fsPromises.readFile(path, 'utf8');
34
+ }
35
+ export function defaultWriteMcpJsonFile({ path, content }) {
36
+ return fsPromises.writeFile(path, content, 'utf8');
37
+ }
38
+ //# sourceMappingURL=mcp-json.js.map
@@ -0,0 +1,12 @@
1
+ /** Give each child a short load instruction; long approved ID lists remain complete on disk. */
2
+ export declare function prepareClaudeSubagentStartSettings({ directory, context, settings }: {
3
+ directory: string;
4
+ context: {
5
+ ids: readonly string[];
6
+ instructions: string;
7
+ };
8
+ settings?: string;
9
+ }, { platform }?: {
10
+ platform?: NodeJS.Platform;
11
+ }): Promise<string>;
12
+ //# sourceMappingURL=subagent-start.d.ts.map
@@ -0,0 +1,35 @@
1
+ import { writeFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ /** Give each child a short load instruction; long approved ID lists remain complete on disk. */
4
+ export async function prepareClaudeSubagentStartSettings({ directory, context, settings }, { platform = process.platform } = {}) {
5
+ const existing = JSON.parse(settings || '{}');
6
+ const additionalContext = await subagentStartContext({ directory, context });
7
+ const path = join(directory, 'subagent-start.json');
8
+ await writeFile(path, JSON.stringify({
9
+ hookSpecificOutput: { hookEventName: 'SubagentStart', additionalContext },
10
+ }), { encoding: 'utf8', mode: 0o600, flag: 'wx' });
11
+ const hook = printFileHook({ path, platform });
12
+ return JSON.stringify({ ...existing, hooks: { ...existing.hooks,
13
+ SubagentStart: [...(existing.hooks?.SubagentStart ?? []), hook],
14
+ } });
15
+ }
16
+ /** The start context inlines the IDs, or points at a manifest file when inlining would pass 2000 characters. */
17
+ async function subagentStartContext({ directory, context }, _optional = {}) {
18
+ const ids = JSON.stringify(context.ids);
19
+ let additionalContext = `Parent plugins: ${ids}.\n${context.instructions}`;
20
+ if (additionalContext.length >= 2000) {
21
+ const manifest = join(directory, 'subagent-plugin-ids.json');
22
+ additionalContext = `Parent plugins: read ${JSON.stringify(manifest)} before continuing. Apply these instructions to every ID in that manifest.\n${context.instructions}`;
23
+ if (additionalContext.length >= 2000)
24
+ throw new Error('Subagent startup context must be shorter than 2000 characters.');
25
+ await writeFile(manifest, ids, { encoding: 'utf8', mode: 0o600, flag: 'wx' });
26
+ }
27
+ return additionalContext;
28
+ }
29
+ /** A command hook that prints the file at `path`, quoted for this platform's shell. */
30
+ function printFileHook({ path, platform }, _optional = {}) {
31
+ const quoted = platform === 'win32' ? path.replace(/['\u2018-\u201B]/g, '$&$&') : path.replaceAll("'", "'\\''");
32
+ const command = platform === 'win32' ? `Get-Content -Raw -Encoding UTF8 -LiteralPath '${quoted}'` : `cat -- '${quoted}'`;
33
+ return { hooks: [{ type: 'command', command, timeout: 5, ...(platform === 'win32' ? { shell: 'powershell' } : {}) }] };
34
+ }
35
+ //# sourceMappingURL=subagent-start.js.map
@@ -30,4 +30,4 @@ export declare const clineAgentDef: {
30
30
  deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
31
31
  }): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
32
32
  };
33
- //# sourceMappingURL=cline.d.ts.map
33
+ //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { createAgentModelDiscovery } from '../model-discovery-native.js';
1
+ import { createAgentModelDiscovery } from '../../model-discovery-native.js';
2
2
  /**
3
3
  * @module defs/cline
4
4
  *
@@ -9,7 +9,7 @@ import { createAgentModelDiscovery } from '../model-discovery-native.js';
9
9
  * sign-in failed with "Authentication required: Call authenticate before starting a session",
10
10
  * which `auth.ts`'s generic classifier already reads as a missing sign-in (fix: `cline auth`).
11
11
  */
12
- import { acpModelFetcher, DEFAULT_MODEL_OPTION } from './shared.js';
12
+ import { acpModelFetcher, DEFAULT_MODEL_OPTION } from '../shared.js';
13
13
  export const clineAgentDef = {
14
14
  // UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
15
15
  ...createAgentModelDiscovery('cline', { fallbackModels: () => clineAgentDef.fallbackModels }),
@@ -26,4 +26,4 @@ export const clineAgentDef = {
26
26
  // `acp-json-rpc` def — see `types.ts#RuntimeAgentDef.imageDelivery`'s doc.
27
27
  imageDelivery: 'native',
28
28
  };
29
- //# sourceMappingURL=cline.js.map
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,47 @@
1
+ /** A staged, run-scoped Codex `CODEX_HOME` — the directory-holding analogue of {@link PreparedPromptFile}/{@link PreparedAgentLogFile} from `@jini-ai/agent-runtime`. */
2
+ export type PreparedCodexHome = {
3
+ /** Absolute path to hand to the spawned child as its `CODEX_HOME` env var. */
4
+ readonly path: string;
5
+ /** Recursively removes the staged directory — the live `auth.json` copy it may hold makes this a confidentiality cleanup, not just tidiness. Safe to call more than once. */
6
+ readonly cleanup: () => Promise<void>;
7
+ };
8
+ /**
9
+ * The bridge server's name in the staged `config.toml`. It must equal the host's own bridge key (the daemon's
10
+ * `JINI_MCP_SERVER_KEY`, passed to the slot as `serverName`); the daemon seam test pins that the two agree.
11
+ */
12
+ export declare const JINI_MCP_SERVER_KEY = "jini";
13
+ /** The stdio bridge entry the host built, as the staged config needs it. */
14
+ export interface CodexBridgeEntry {
15
+ readonly command: string;
16
+ readonly args: readonly string[];
17
+ readonly env: Readonly<Record<string, string>>;
18
+ }
19
+ /** A private per-run HTTP listener: its URL and the bearer token that authorizes it. */
20
+ export type CodexHttpEndpoint = {
21
+ readonly url: string;
22
+ readonly token: string;
23
+ };
24
+ export type CodexToolApprovalOwner = 'host' | undefined;
25
+ /** The run-scoped filesystem seams staging uses: read/write are always supplied by the host, the rest default to the real filesystem. */
26
+ export interface CodexHomeIo {
27
+ readonly readFile: ({ path }: {
28
+ readonly path: string;
29
+ }) => Promise<string>;
30
+ readonly writeFile: ({ path, content }: {
31
+ readonly path: string;
32
+ readonly content: string;
33
+ }) => Promise<void>;
34
+ readonly mkdtemp?: ({ prefix }: {
35
+ readonly prefix: string;
36
+ }) => Promise<string>;
37
+ readonly removeDir?: ({ path }: {
38
+ readonly path: string;
39
+ }) => Promise<void>;
40
+ readonly linkSessionStore?: (required: {
41
+ runHome: string;
42
+ sourceHome: string;
43
+ }, optional?: {
44
+ inheritUserConfig?: boolean;
45
+ }) => Promise<void>;
46
+ }
47
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The bridge server's name in the staged `config.toml`. It must equal the host's own bridge key (the daemon's
3
+ * `JINI_MCP_SERVER_KEY`, passed to the slot as `serverName`); the daemon seam test pins that the two agree.
4
+ */
5
+ export const JINI_MCP_SERVER_KEY = 'jini';
6
+ //# sourceMappingURL=contracts.js.map