@jini-ai/agent-runtime 0.6.10 → 0.6.11
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.
- package/CHANGELOG.md +12 -0
- package/dist/claude-filesystem-policy.d.ts +46 -0
- package/dist/claude-filesystem-policy.js +121 -0
- package/dist/defs/claude.d.ts +2 -2
- package/dist/defs/claude.js +26 -2
- package/dist/defs/shared.d.ts +12 -8
- package/dist/defs/shared.js +14 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types.d.ts +8 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 0.6.11
|
|
2
|
+
|
|
3
|
+
### Patch Changes
|
|
4
|
+
|
|
5
|
+
- Site agents are confined to the site folder: Claude file tools are bounded to the site root and private temp dir, and attachments are staged inside the site (`stageAttachmentClaim`).
|
|
6
|
+
- Updated dependencies
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @jini-ai/core@0.6.11
|
|
10
|
+
- @jini-ai/oauth@0.6.11
|
|
11
|
+
- @jini-ai/protocol@0.6.11
|
|
12
|
+
|
|
1
13
|
## 0.6.10
|
|
2
14
|
|
|
3
15
|
### Patch Changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { execAgentFile } from './invocation.js';
|
|
2
|
+
import type { RuntimeBuildOptions } from './types.js';
|
|
3
|
+
/** Canonical host directory and attachment grants, checked again after image augmentation.
|
|
4
|
+
* Throws before spawn on missing/non-directory roots, conflicting cwd, traversal or symlinks.
|
|
5
|
+
* Reuses the platform reader's containment owner; O(n) filesystem checks for n supplied paths.
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateFilesystemLaunch(required: {
|
|
8
|
+
filesystemRoot: string;
|
|
9
|
+
cwd: string;
|
|
10
|
+
extraAllowedDirs?: readonly string[];
|
|
11
|
+
imagePaths?: readonly string[];
|
|
12
|
+
}, _optional?: {}): string;
|
|
13
|
+
/** Probe official CLI enforcement, retrying uncertain evidence once without logging its values.
|
|
14
|
+
* The 2.1.285 floor covers native read blocking and admin-required sandbox locks.
|
|
15
|
+
* https://code.claude.com/docs/en/sandboxing#repository-settings-under-an-admin-required-sandbox
|
|
16
|
+
* True means supported, false means known unsupported, undefined means apply settings optimistically.
|
|
17
|
+
* O(1) metadata I/O and at most two bounded subprocesses per CLI path/mtime.
|
|
18
|
+
*/
|
|
19
|
+
export declare function assertClaudeFilesystemSupport(required: {
|
|
20
|
+
agentId: string;
|
|
21
|
+
launchPath: string;
|
|
22
|
+
env: NodeJS.ProcessEnv;
|
|
23
|
+
}, { probe }?: {
|
|
24
|
+
probe?: typeof execAgentFile;
|
|
25
|
+
}): Promise<boolean | void>;
|
|
26
|
+
/** Runtime assets under a denied home remain readable, never writable. Native installs need the
|
|
27
|
+
* binary; npm installs also need their adjacent package resources. O(1), canonical filesystem I/O.
|
|
28
|
+
*/
|
|
29
|
+
export declare function claudeFilesystemRuntimePaths(required: {
|
|
30
|
+
launchPath: string;
|
|
31
|
+
}, _optional?: {}): readonly string[];
|
|
32
|
+
/** Host settings override widening fields even when a Full CLI grant is enabled.
|
|
33
|
+
* Personal/project layers are excluded separately. Preserve host hooks and secret denies.
|
|
34
|
+
* Phase 1 leaves network policy unconfigured; the CLI's sandbox network defaults still apply.
|
|
35
|
+
* https://code.claude.com/docs/en/permissions#working-directories
|
|
36
|
+
* O(s + r) serialization for s host settings bytes and r runtime exception paths. Pure with
|
|
37
|
+
* injectable host facts; errors reject malformed/file-based settings rather than dropping policy.
|
|
38
|
+
*/
|
|
39
|
+
export declare function claudeFilesystemSettings(required: {
|
|
40
|
+
options: RuntimeBuildOptions;
|
|
41
|
+
}, { platform, homeDir, tempDir, }?: {
|
|
42
|
+
platform?: NodeJS.Platform;
|
|
43
|
+
homeDir?: string;
|
|
44
|
+
tempDir?: string;
|
|
45
|
+
}): string;
|
|
46
|
+
//# sourceMappingURL=claude-filesystem-policy.d.ts.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { realpathSync, statSync } from 'node:fs';
|
|
2
|
+
import { homedir, tmpdir } from 'node:os';
|
|
3
|
+
import { basename, dirname, isAbsolute, relative, resolve } from 'node:path';
|
|
4
|
+
import { createGuardedFileReader, createNodeGuardedReaderFilesystem } from '@jini-ai/platform/fs/guarded-reader';
|
|
5
|
+
import { execAgentFile } from './invocation.js';
|
|
6
|
+
/** Canonical host directory and attachment grants, checked again after image augmentation.
|
|
7
|
+
* Throws before spawn on missing/non-directory roots, conflicting cwd, traversal or symlinks.
|
|
8
|
+
* Reuses the platform reader's containment owner; O(n) filesystem checks for n supplied paths.
|
|
9
|
+
*/
|
|
10
|
+
export function validateFilesystemLaunch(required, _optional = {}) {
|
|
11
|
+
if (!isAbsolute(required.filesystemRoot))
|
|
12
|
+
throw new Error('filesystemRoot must be an absolute directory');
|
|
13
|
+
const root = realpathSync(required.filesystemRoot);
|
|
14
|
+
if (!statSync(root).isDirectory())
|
|
15
|
+
throw new Error('filesystemRoot must be a directory');
|
|
16
|
+
if (realpathSync(required.cwd) !== root)
|
|
17
|
+
throw new Error('Working directory must equal filesystemRoot');
|
|
18
|
+
const reader = createGuardedFileReader({ rootPath: root, filesystem: createNodeGuardedReaderFilesystem({}),
|
|
19
|
+
denyRules: { segments: new Set(), filenamePatterns: [] },
|
|
20
|
+
limits: { maxFileBytes: 1, binarySniffBytes: 1, maxListedFiles: 1, maxWalkDepth: 32, maxWalkEntries: 1 },
|
|
21
|
+
});
|
|
22
|
+
for (const path of [...(required.extraAllowedDirs ?? []), ...(required.imagePaths ?? [])]) {
|
|
23
|
+
// Canonicalize first: root is a realpath, so a symlinked component such as macOS /var would
|
|
24
|
+
// otherwise make every in-site path look outside. A broken link throws here and is refused.
|
|
25
|
+
reader.resolve({ relativePath: relative(root, realpathSync(resolve(required.cwd, path))) || '.' });
|
|
26
|
+
}
|
|
27
|
+
return root;
|
|
28
|
+
}
|
|
29
|
+
// Cache concurrent and subsequent launches by executable identity for the process lifetime.
|
|
30
|
+
const filesystemSupport = new Map();
|
|
31
|
+
/** Probe official CLI enforcement, retrying uncertain evidence once without logging its values.
|
|
32
|
+
* The 2.1.285 floor covers native read blocking and admin-required sandbox locks.
|
|
33
|
+
* https://code.claude.com/docs/en/sandboxing#repository-settings-under-an-admin-required-sandbox
|
|
34
|
+
* True means supported, false means known unsupported, undefined means apply settings optimistically.
|
|
35
|
+
* O(1) metadata I/O and at most two bounded subprocesses per CLI path/mtime.
|
|
36
|
+
*/
|
|
37
|
+
export async function assertClaudeFilesystemSupport(required, { probe = execAgentFile } = {}) {
|
|
38
|
+
if (required.agentId !== 'claude' || /^openclaude(?:\.|$)/i.test(basename(required.launchPath)))
|
|
39
|
+
return false;
|
|
40
|
+
let key;
|
|
41
|
+
try {
|
|
42
|
+
key = `${realpathSync(required.launchPath)}:${statSync(required.launchPath).mtimeMs}`;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
let pending = filesystemSupport.get(key);
|
|
48
|
+
if (!pending) {
|
|
49
|
+
pending = probeFilesystemSupport({ ...required, probe }, {});
|
|
50
|
+
filesystemSupport.set(key, pending);
|
|
51
|
+
}
|
|
52
|
+
return pending;
|
|
53
|
+
}
|
|
54
|
+
/** Unknown/failed evidence is retried with a longer budget; no diagnostic includes CLI output.
|
|
55
|
+
* O(1), at most 20 seconds across both probes; no subprocess output escapes this boundary.
|
|
56
|
+
*/
|
|
57
|
+
async function probeFilesystemSupport(required, _optional = {}) {
|
|
58
|
+
for (const timeout of [5000, 15000]) {
|
|
59
|
+
try {
|
|
60
|
+
const { stdout } = await required.probe({ command: required.launchPath, args: ['--version'] }, {
|
|
61
|
+
options: { env: required.env, timeout },
|
|
62
|
+
});
|
|
63
|
+
const version = /^(\d+)\.(\d+)\.(\d+)\s+\(Claude Code\)\s*$/.exec(String(stdout).trim());
|
|
64
|
+
if (version)
|
|
65
|
+
return supportedClaudeVersion({ version }, {});
|
|
66
|
+
}
|
|
67
|
+
catch { /* Retry once; uncertainty must not remove the owner's ability to launch. */ }
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
/** Compare the already parsed official version tuple against the enforcement floor. Pure, O(1). */
|
|
72
|
+
function supportedClaudeVersion({ version }, _optional = {}) {
|
|
73
|
+
const major = Number(version[1]), minor = Number(version[2]), patch = Number(version[3]);
|
|
74
|
+
if (major !== 2)
|
|
75
|
+
return major > 2;
|
|
76
|
+
if (minor !== 1)
|
|
77
|
+
return minor > 1;
|
|
78
|
+
return patch >= 285;
|
|
79
|
+
}
|
|
80
|
+
/** Runtime assets under a denied home remain readable, never writable. Native installs need the
|
|
81
|
+
* binary; npm installs also need their adjacent package resources. O(1), canonical filesystem I/O.
|
|
82
|
+
*/
|
|
83
|
+
export function claudeFilesystemRuntimePaths(required, _optional = {}) {
|
|
84
|
+
const executable = realpathSync(required.launchPath);
|
|
85
|
+
const assets = /\.[cm]?js$/.test(executable) ? dirname(executable) : executable;
|
|
86
|
+
return [...new Set([resolve(required.launchPath), assets, realpathSync(process.execPath)])];
|
|
87
|
+
}
|
|
88
|
+
/** Host settings override widening fields even when a Full CLI grant is enabled.
|
|
89
|
+
* Personal/project layers are excluded separately. Preserve host hooks and secret denies.
|
|
90
|
+
* Phase 1 leaves network policy unconfigured; the CLI's sandbox network defaults still apply.
|
|
91
|
+
* https://code.claude.com/docs/en/permissions#working-directories
|
|
92
|
+
* O(s + r) serialization for s host settings bytes and r runtime exception paths. Pure with
|
|
93
|
+
* injectable host facts; errors reject malformed/file-based settings rather than dropping policy.
|
|
94
|
+
*/
|
|
95
|
+
export function claudeFilesystemSettings(required, { platform = process.platform, homeDir = homedir(), tempDir = tmpdir(), } = {}) {
|
|
96
|
+
const { options } = required;
|
|
97
|
+
const settings = options.settings ? JSON.parse(options.settings) : {};
|
|
98
|
+
if (!settings || typeof settings !== 'object' || Array.isArray(settings))
|
|
99
|
+
throw new Error('Host settings must be a JSON object');
|
|
100
|
+
const permissions = settings.permissions;
|
|
101
|
+
return JSON.stringify({ ...settings, autoMemoryEnabled: false,
|
|
102
|
+
permissions: { ...permissions, blockReadsOutsideWorkingDirectories: true, additionalDirectories: [] },
|
|
103
|
+
sandbox: { enabled: platform !== 'win32', failIfUnavailable: platform !== 'win32',
|
|
104
|
+
allowUnsandboxedCommands: platform === 'win32', excludedCommands: [],
|
|
105
|
+
filesystem: filesystemSandboxPaths({ options, homeDir, tempDir }, {}),
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/** Build explicit filesystem exceptions; shared temp and the rest of home remain denied.
|
|
110
|
+
* Pure, O(r + t) for r runtime paths and t shared temp roots; no filesystem access.
|
|
111
|
+
*/
|
|
112
|
+
function filesystemSandboxPaths({ options, homeDir, tempDir }, _optional = {}) {
|
|
113
|
+
const privateTemp = options.filesystemTempDir ?? resolve(options.filesystemRoot, '.agent-runtime', 'tmp');
|
|
114
|
+
const sharedTempRoots = [...new Set(['/tmp', '/private/tmp', tempDir, ...(options.filesystemSharedTempRoots ?? [])])];
|
|
115
|
+
return { denyRead: [homeDir, ...sharedTempRoots],
|
|
116
|
+
// Owner 2026-10-23: git config is a read-only infrastructure exception, never all of home.
|
|
117
|
+
allowRead: [options.filesystemRoot, privateTemp, resolve(homeDir, '.gitconfig'),
|
|
118
|
+
resolve(homeDir, '.config/git/config'), ...(options.filesystemRuntimeReadPaths ?? [])],
|
|
119
|
+
allowWrite: [options.filesystemRoot, privateTemp] };
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=claude-filesystem-policy.js.map
|
package/dist/defs/claude.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimeBuildOptions } from '../types.js';
|
|
1
|
+
import type { RuntimeBuildOptions, RuntimeContext } from '../types.js';
|
|
2
2
|
export declare const claudeAgentDef: {
|
|
3
3
|
id: string;
|
|
4
4
|
supportsNativeToolAccess: true;
|
|
@@ -37,7 +37,7 @@ export declare const claudeAgentDef: {
|
|
|
37
37
|
}, { extraAllowedDirs, options, runtimeContext }?: {
|
|
38
38
|
extraAllowedDirs?: string[];
|
|
39
39
|
options?: RuntimeBuildOptions;
|
|
40
|
-
runtimeContext?:
|
|
40
|
+
runtimeContext?: RuntimeContext;
|
|
41
41
|
} | undefined) => string[];
|
|
42
42
|
promptViaStdin: true;
|
|
43
43
|
promptInputFormat: "stream-json";
|
package/dist/defs/claude.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { resolveNativeCapabilityDenies, resolveNativeToolDenies } from '../native-tool-policy.js';
|
|
2
|
+
import { claudeFilesystemSettings, validateFilesystemLaunch } from '../claude-filesystem-policy.js';
|
|
2
3
|
import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
3
4
|
/**
|
|
4
5
|
* Claude Code has no dedicated image-attachment flag. imageDelivery: 'prompt-path' makes the
|
|
5
6
|
* executor append local image paths to the prompt and add their directories to extraAllowedDirs;
|
|
6
7
|
* buildArgs then grants --add-dir access so the CLI can read them itself. Native-delivery defs
|
|
7
8
|
* must not also receive this augmentation; see RuntimeAgentDef.imageDelivery for that contract.
|
|
9
|
+
* A filesystemRoot launch instead validates these directories and omits --add-dir entirely;
|
|
10
|
+
* hosts must stage attachments inside that root (owner boundary introduced 2026-10-23).
|
|
8
11
|
*/
|
|
9
12
|
import { addDirArgs, nonDefaultFlag, permissionModeArgs, resolveCapabilities, sessionArgs } from './claude-compatible-args.js';
|
|
10
13
|
import { buildClaudeMcpConfigArgs, DEFAULT_MODEL_OPTION } from './shared.js';
|
|
@@ -103,6 +106,9 @@ function claudeSettingSourcesArgs({ options, caps }) {
|
|
|
103
106
|
// This is an explicit restriction, not an optional enhancement: do not probe it away.
|
|
104
107
|
return ['--setting-sources', '', '--disable-slash-commands'];
|
|
105
108
|
}
|
|
109
|
+
// An explicit empty source list is a host isolation policy, not an optional enhancement.
|
|
110
|
+
if (options.filesystemRoot || options.settingSources?.length === 0)
|
|
111
|
+
return ['--setting-sources', ''];
|
|
106
112
|
if (options.settingSources !== undefined && caps.settingSources) {
|
|
107
113
|
return ['--setting-sources', options.settingSources.join(',')];
|
|
108
114
|
}
|
|
@@ -116,6 +122,19 @@ function claudeChromeArgs({ options, caps }) {
|
|
|
116
122
|
return [];
|
|
117
123
|
return [options.chromeIntegration ? '--chrome' : '--no-chrome'];
|
|
118
124
|
}
|
|
125
|
+
/** Resolve the mandatory filesystem settings as one launch fragment, independently of parity.
|
|
126
|
+
* Native file reads keep today's tool set; outside attachment grants fail before argv exists.
|
|
127
|
+
* O(n) containment checks for n attachment paths, plus host-settings serialization.
|
|
128
|
+
*/
|
|
129
|
+
function claudeLaunchPolicy({ options, caps, extraAllowedDirs, imagePaths, runtimeContext }, _optional = {}) {
|
|
130
|
+
if (options.filesystemRoot !== undefined) {
|
|
131
|
+
validateFilesystemLaunch({ filesystemRoot: options.filesystemRoot, cwd: runtimeContext.cwd ?? options.filesystemRoot,
|
|
132
|
+
extraAllowedDirs, imagePaths }, {});
|
|
133
|
+
return { directoryArgs: [], settingsArgs: ['--settings', claudeFilesystemSettings({ options }, {})] };
|
|
134
|
+
}
|
|
135
|
+
return { directoryArgs: addDirArgs({ extraAllowedDirs, caps }),
|
|
136
|
+
settingsArgs: options.settings ? ['--settings', options.settings] : [] };
|
|
137
|
+
}
|
|
119
138
|
export const claudeAgentDef = {
|
|
120
139
|
...createAgentModelDiscovery('claude', { fallbackModels: () => claudeAgentDef.fallbackModels }),
|
|
121
140
|
id: 'claude',
|
|
@@ -212,6 +231,7 @@ export const claudeAgentDef = {
|
|
|
212
231
|
// cursor/qwen entries below.
|
|
213
232
|
buildArgs: (_requiredArgs, { extraAllowedDirs = [], options = {}, runtimeContext = {} } = {}) => {
|
|
214
233
|
const caps = resolveCapabilities({ agentId: 'claude', options });
|
|
234
|
+
const policy = claudeLaunchPolicy({ options, caps, extraAllowedDirs, imagePaths: _requiredArgs.imagePaths, runtimeContext }, {});
|
|
215
235
|
return [
|
|
216
236
|
// `--input-format stream-json` lets the daemon stream multiple JSONL
|
|
217
237
|
// messages into stdin instead of closing it after the initial prompt,
|
|
@@ -227,7 +247,7 @@ export const claudeAgentDef = {
|
|
|
227
247
|
...claudeEffortArgs({ options, caps }),
|
|
228
248
|
// `--add-dir` is older but still gate it for symmetry — old/forked
|
|
229
249
|
// builds may lack it.
|
|
230
|
-
...
|
|
250
|
+
...policy.directoryArgs,
|
|
231
251
|
// `--append-system-prompt` delivery now lives outside this function — see
|
|
232
252
|
// `systemPromptDelivery` below and `@jini-ai/daemon`'s `resolveSystemPromptOverlayDelivery`
|
|
233
253
|
// (the single dispatch point for every def, not just this one). The probe-gate reasoning
|
|
@@ -237,6 +257,10 @@ export const claudeAgentDef = {
|
|
|
237
257
|
// itself.
|
|
238
258
|
// Continue Claude's own CLI session across turns (see `sessionArgs`).
|
|
239
259
|
...sessionArgs(runtimeContext),
|
|
260
|
+
// The permission mode is unchanged for folder-limited runs: blockReadsOutsideWorkingDirectories
|
|
261
|
+
// and the Bash sandbox hold in every mode, including bypassPermissions (verified live on
|
|
262
|
+
// 2.1.309, 2026-10-23). dontAsk would deny Edit/Write and every MCP tool, because the CLI skips
|
|
263
|
+
// an unanchored `--allowedTools '*'` (permissions docs, "Tool name wildcards").
|
|
240
264
|
...permissionModeArgs(options),
|
|
241
265
|
// Explicit `--strict-mcp-config --mcp-config <path>` instead of relying on Claude Code's
|
|
242
266
|
// auto-discovery of `.mcp.json` from cwd. Shared with every other `'claude-mcp-json'` def —
|
|
@@ -247,7 +271,7 @@ export const claudeAgentDef = {
|
|
|
247
271
|
...claudeToolPolicyArgs(options),
|
|
248
272
|
...claudeSettingSourcesArgs({ options, caps }),
|
|
249
273
|
// See `RuntimeBuildOptions.settings`. Not probe-gated: `--settings` long predates `--setting-sources`.
|
|
250
|
-
...
|
|
274
|
+
...policy.settingsArgs,
|
|
251
275
|
...claudeChromeArgs({ options, caps }),
|
|
252
276
|
];
|
|
253
277
|
},
|
package/dist/defs/shared.d.ts
CHANGED
|
@@ -14,6 +14,15 @@ import { execAgentFile } from '../invocation.js';
|
|
|
14
14
|
import { DEFAULT_MODEL_OPTION } from '../models.js';
|
|
15
15
|
import type { RuntimeContext, RuntimeModelOption } from '../types.js';
|
|
16
16
|
export { detectAcpModels, parsePiModels, execAgentFile, DEFAULT_MODEL_OPTION };
|
|
17
|
+
type ClaudeMcpOptions = {
|
|
18
|
+
filesystemRoot?: string;
|
|
19
|
+
cliParity?: boolean;
|
|
20
|
+
permissionMode?: string;
|
|
21
|
+
nativeToolAccess?: boolean;
|
|
22
|
+
nativeCapabilities?: {
|
|
23
|
+
userMcp?: boolean;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
17
26
|
/**
|
|
18
27
|
* The argv every `externalMcpInjection: 'claude-mcp-json'` def appends so the caller-staged
|
|
19
28
|
* `.mcp.json` is loaded *explicitly* rather than auto-discovered from cwd.
|
|
@@ -39,19 +48,14 @@ export { detectAcpModels, parsePiModels, execAgentFile, DEFAULT_MODEL_OPTION };
|
|
|
39
48
|
* it is present only when the caller is actually staging that file for this run (see
|
|
40
49
|
* `RuntimeContext.mcpJsonPath`'s own doc), so an unconfigured host gets `[]` and no argv change.
|
|
41
50
|
* Trusted bypass parity omits strict isolation so user MCP/Chrome settings remain available.
|
|
51
|
+
* Owner 2026-10-23: filesystemRoot keeps the explicit personal-MCP opt-in; those servers are
|
|
52
|
+
* outside the folder boundary. OFF still stays strict (the default grant).
|
|
42
53
|
* Explicit --mcp-config still avoids a headless trust prompt. A locked run without a staged
|
|
43
54
|
* config gets --strict-mcp-config alone, exposing no auto-discovered MCP servers.
|
|
44
55
|
* @complexity O(1).
|
|
45
56
|
* @overallScore 100/100
|
|
46
57
|
*/
|
|
47
|
-
export declare function buildClaudeMcpConfigArgs(runtimeContext: RuntimeContext, options?:
|
|
48
|
-
cliParity?: boolean;
|
|
49
|
-
permissionMode?: string;
|
|
50
|
-
nativeToolAccess?: boolean;
|
|
51
|
-
nativeCapabilities?: {
|
|
52
|
-
userMcp?: boolean;
|
|
53
|
-
};
|
|
54
|
-
}): string[];
|
|
58
|
+
export declare function buildClaudeMcpConfigArgs(runtimeContext: RuntimeContext, options?: ClaudeMcpOptions): string[];
|
|
55
59
|
export declare function clampCodexReasoning(modelId: string | null | undefined, effort: string | null | undefined): string | null | undefined;
|
|
56
60
|
export declare function parseLineSeparatedModels({ stdout }: {
|
|
57
61
|
stdout: string;
|
package/dist/defs/shared.js
CHANGED
|
@@ -13,6 +13,10 @@ import { parsePiModels } from '../pi-models.js';
|
|
|
13
13
|
import { execAgentFile } from '../invocation.js';
|
|
14
14
|
import { DEFAULT_MODEL_OPTION } from '../models.js';
|
|
15
15
|
export { detectAcpModels, parsePiModels, execAgentFile, DEFAULT_MODEL_OPTION };
|
|
16
|
+
/** User MCP inheritance requires the explicit MCP grant or legacy trusted bypass, without a tool lock. */
|
|
17
|
+
function trustedMcpBypass({ options, userMcpLocked }, _optional = {}) {
|
|
18
|
+
return (options.nativeCapabilities?.userMcp === true || Boolean(options.cliParity) && options.permissionMode === 'bypass') && !userMcpLocked;
|
|
19
|
+
}
|
|
16
20
|
/**
|
|
17
21
|
* The argv every `externalMcpInjection: 'claude-mcp-json'` def appends so the caller-staged
|
|
18
22
|
* `.mcp.json` is loaded *explicitly* rather than auto-discovered from cwd.
|
|
@@ -38,6 +42,8 @@ export { detectAcpModels, parsePiModels, execAgentFile, DEFAULT_MODEL_OPTION };
|
|
|
38
42
|
* it is present only when the caller is actually staging that file for this run (see
|
|
39
43
|
* `RuntimeContext.mcpJsonPath`'s own doc), so an unconfigured host gets `[]` and no argv change.
|
|
40
44
|
* Trusted bypass parity omits strict isolation so user MCP/Chrome settings remain available.
|
|
45
|
+
* Owner 2026-10-23: filesystemRoot keeps the explicit personal-MCP opt-in; those servers are
|
|
46
|
+
* outside the folder boundary. OFF still stays strict (the default grant).
|
|
41
47
|
* Explicit --mcp-config still avoids a headless trust prompt. A locked run without a staged
|
|
42
48
|
* config gets --strict-mcp-config alone, exposing no auto-discovered MCP servers.
|
|
43
49
|
* @complexity O(1).
|
|
@@ -45,13 +51,18 @@ export { detectAcpModels, parsePiModels, execAgentFile, DEFAULT_MODEL_OPTION };
|
|
|
45
51
|
*/
|
|
46
52
|
export function buildClaudeMcpConfigArgs(runtimeContext, options = {}) {
|
|
47
53
|
const mcpJsonPath = runtimeContext.mcpJsonPath;
|
|
48
|
-
const userMcpLocked =
|
|
54
|
+
const userMcpLocked = claudeUserMcpLocked({ options }, {});
|
|
49
55
|
if (typeof mcpJsonPath !== 'string' || mcpJsonPath.length === 0)
|
|
50
56
|
return userMcpLocked ? ['--strict-mcp-config'] : [];
|
|
51
|
-
// Explicit config still avoids headless trust prompts.
|
|
52
|
-
const trustedBypass =
|
|
57
|
+
// Explicit config still avoids headless trust prompts. An explicit MCP grant or trusted legacy bypass run inherits MCP.
|
|
58
|
+
const trustedBypass = trustedMcpBypass({ options, userMcpLocked }, {});
|
|
53
59
|
return [...(trustedBypass ? [] : ['--strict-mcp-config']), '--mcp-config', mcpJsonPath];
|
|
54
60
|
}
|
|
61
|
+
/** Keep site MCP off by default; an explicit ON grant retains the owner's servers. Pure, O(1). */
|
|
62
|
+
function claudeUserMcpLocked({ options }, _optional = {}) {
|
|
63
|
+
return options.nativeToolAccess === false || options.nativeCapabilities?.userMcp === false ||
|
|
64
|
+
(options.filesystemRoot !== undefined && options.nativeCapabilities?.userMcp !== true);
|
|
65
|
+
}
|
|
55
66
|
/** Model-id prefixes of the late gpt-5.x family, which rejects `minimal` effort. */
|
|
56
67
|
const GPT5_LATE_FAMILY_PREFIXES = ['gpt-5.2', 'gpt-5.3', 'gpt-5.4', 'gpt-5.5'];
|
|
57
68
|
/** True for the empty/`default` id (the CLI's own default model) or a late gpt-5.x id. */
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// Core contract and diagnostic types.
|
|
12
12
|
export * from './types.js';
|
|
13
13
|
export * from './native-tool-policy.js';
|
|
14
|
+
export * from './claude-filesystem-policy.js';
|
|
14
15
|
// Generic supporting modules.
|
|
15
16
|
export * from './paths.js';
|
|
16
17
|
export * from './models.js';
|
package/dist/types.d.ts
CHANGED
|
@@ -75,6 +75,14 @@ export type RuntimeReasoningInModelId = {
|
|
|
75
75
|
levels: readonly RuntimeReasoningOption[];
|
|
76
76
|
};
|
|
77
77
|
export type RuntimeBuildOptions = {
|
|
78
|
+
/** Host folder boundary, independent of native grants; unsupported providers disclose the exception. */
|
|
79
|
+
filesystemRoot?: string;
|
|
80
|
+
/** Executor-created private temporary directory inside the host root; never a shared temp root. */
|
|
81
|
+
filesystemTempDir?: string;
|
|
82
|
+
/** Shared host/login temp roots denied even when child TMPDIR is replaced. */
|
|
83
|
+
filesystemSharedTempRoots?: readonly string[];
|
|
84
|
+
/** Executor-resolved CLI/runtime files; read-only exceptions for sandboxed commands. */
|
|
85
|
+
filesystemRuntimeReadPaths?: readonly string[];
|
|
78
86
|
/** Host-verified per-run overrides; false dimensions must be enforced or launch refused. */
|
|
79
87
|
nativeCapabilities?: Partial<import('./native-tool-policy.js').NativeCapabilities>;
|
|
80
88
|
/** Explicit host grant for shell/direct edits. false must be enforced or launch refused.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/agent-runtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.11",
|
|
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": {
|
|
@@ -107,14 +107,14 @@
|
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@vitest/coverage-v8": "^2.1.9",
|
|
110
|
-
"@jini-ai/core": "^0.6.
|
|
111
|
-
"@jini-ai/
|
|
112
|
-
"@jini-ai/
|
|
110
|
+
"@jini-ai/core": "^0.6.11",
|
|
111
|
+
"@jini-ai/platform": "^0.6.11",
|
|
112
|
+
"@jini-ai/integrations": "^0.6.11"
|
|
113
113
|
},
|
|
114
114
|
"dependencies": {
|
|
115
|
-
"@jini-ai/
|
|
116
|
-
"@jini-ai/
|
|
117
|
-
"@jini-ai/protocol": "^0.6.
|
|
115
|
+
"@jini-ai/oauth": "^0.6.11",
|
|
116
|
+
"@jini-ai/core": "^0.6.11",
|
|
117
|
+
"@jini-ai/protocol": "^0.6.11"
|
|
118
118
|
},
|
|
119
119
|
"peerDependencies": {
|
|
120
120
|
"@jini-ai/integrations": "^0.6.10",
|