@parcha/agentrun-serve 0.1.0-beta.52 → 0.1.0-beta.53
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 +122 -1
- package/README.md +213 -24
- package/dist/agent-delete.d.ts +5 -6
- package/dist/agent-delete.js +30 -67
- package/dist/agent-package.d.ts +71 -0
- package/dist/agent-package.js +345 -0
- package/dist/agents-store.d.ts +26 -20
- package/dist/agents-store.js +41 -33
- package/dist/api-only.d.ts +26 -6
- package/dist/api-only.js +35 -13
- package/dist/claude-login.d.ts +1 -0
- package/dist/claude-login.js +1 -1
- package/dist/cli-learning/cli.d.ts +3 -0
- package/dist/cli-learning/cli.js +17 -3
- package/dist/cli-learning/connections.js +3 -2
- package/dist/cli-learning/schema.js +2 -1
- package/dist/cli.js +70 -7
- package/dist/composio-preset.d.ts +2 -1
- package/dist/composio-preset.js +4 -3
- package/dist/composio-triggers.d.ts +4 -0
- package/dist/composio-triggers.js +4 -1
- package/dist/computer-needs.d.ts +32 -0
- package/dist/computer-needs.js +80 -0
- package/dist/computer-setting.d.ts +1 -0
- package/dist/computer-setting.js +8 -1
- package/dist/console/assets/index-BFgyZzF_.js +734 -0
- package/dist/console/assets/index-DbilxljH.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +1 -0
- package/dist/console-links.js +2 -0
- package/dist/env-switch.d.ts +14 -0
- package/dist/env-switch.js +23 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +3 -0
- package/dist/eval-previous.js +4 -3
- package/dist/fal-price.js +10 -13
- package/dist/handed-secret.d.ts +4 -0
- package/dist/handed-secret.js +10 -0
- package/dist/harness-archive.d.ts +15 -5
- package/dist/harness-archive.js +71 -34
- package/dist/harness-check.d.ts +2 -1
- package/dist/harness-check.js +36 -95
- package/dist/harness-egress.d.ts +23 -0
- package/dist/harness-egress.js +69 -0
- package/dist/harness-recipe-entry.d.ts +71 -0
- package/dist/harness-recipe-entry.js +184 -0
- package/dist/harness-recipe.d.ts +73 -6
- package/dist/harness-recipe.js +185 -31
- package/dist/harness-sign-in.d.ts +29 -0
- package/dist/harness-sign-in.js +122 -0
- package/dist/harness-table.d.ts +21 -0
- package/dist/harness-table.js +58 -3
- package/dist/harness-zip.d.ts +6 -0
- package/dist/harness-zip.js +203 -0
- package/dist/ids.d.ts +11 -0
- package/dist/ids.js +36 -0
- package/dist/learn/commit.d.ts +14 -1
- package/dist/learn/commit.js +156 -1
- package/dist/learn/compile.js +22 -8
- package/dist/learn/folder.d.ts +5 -0
- package/dist/learn/folder.js +10 -1
- package/dist/learn/learning.sh +15 -3
- package/dist/learn/promote.d.ts +2 -2
- package/dist/learn/secrets.js +30 -7
- package/dist/learning-routes.d.ts +23 -11
- package/dist/learning-routes.js +110 -20
- package/dist/learning.d.ts +9 -6
- package/dist/learning.js +9 -4
- package/dist/mcp-gateway.js +15 -2
- package/dist/mcp-probe.d.ts +3 -0
- package/dist/mcp-probe.js +7 -2
- package/dist/mcp-resources.d.ts +44 -0
- package/dist/mcp-resources.js +100 -0
- package/dist/mcp-servers-store.d.ts +16 -12
- package/dist/model.d.ts +4 -4
- package/dist/model.js +6 -6
- package/dist/native/cli.js +9 -2
- package/dist/native/connection.d.ts +2 -2
- package/dist/native/connection.js +5 -2
- package/dist/native/discovery.d.ts +2 -0
- package/dist/native/discovery.js +10 -6
- package/dist/native/remote-worker-bridge.js +36 -4
- package/dist/native/remote.d.ts +18 -1
- package/dist/native/remote.js +126 -37
- package/dist/native/schema.d.ts +6 -0
- package/dist/native/schema.js +31 -6
- package/dist/native/source-account.d.ts +13 -0
- package/dist/native/source-account.js +114 -0
- package/dist/native/source-capture-hooks.d.ts +5 -0
- package/dist/native/source-capture-hooks.js +102 -0
- package/dist/native/source-mcp-selection.d.ts +13 -0
- package/dist/native/source-mcp-selection.js +72 -0
- package/dist/native/source-runtime-tools.d.ts +19 -0
- package/dist/native/source-runtime-tools.js +103 -0
- package/dist/native/source-snapshot-types.d.ts +138 -0
- package/dist/native/source-snapshot-types.js +12 -0
- package/dist/native/source-snapshot.d.ts +8 -0
- package/dist/native/source-snapshot.js +1201 -0
- package/dist/observation/learning.js +3 -2
- package/dist/openapi.js +167 -36
- package/dist/print.js +1 -1
- package/dist/purged-workflow.d.ts +12 -0
- package/dist/purged-workflow.js +43 -0
- package/dist/run-keys.d.ts +46 -0
- package/dist/run-keys.js +109 -0
- package/dist/run-launch.d.ts +16 -1
- package/dist/run-launch.js +30 -1
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-model-key.d.ts +2 -2
- package/dist/run-model-key.js +5 -5
- package/dist/run-secrets.d.ts +2 -0
- package/dist/run-secrets.js +7 -4
- package/dist/run-view.d.ts +17 -0
- package/dist/run-view.js +25 -1
- package/dist/runner/adapter-loop.d.ts +11 -3
- package/dist/runner/adapter-loop.js +138 -22
- package/dist/runner/adapter-run-spec.js +25 -12
- package/dist/runner/audit.d.ts +2 -0
- package/dist/runner/audit.js +9 -1
- package/dist/runner/beside.js +2 -1
- package/dist/runner/claim-secrets.d.ts +29 -3
- package/dist/runner/claim-secrets.js +38 -4
- package/dist/runner/cli-run-spec.js +23 -12
- package/dist/runner/harness-loops.d.ts +6 -0
- package/dist/runner/harness-loops.js +11 -1
- package/dist/runner/held.d.ts +4 -0
- package/dist/runner/journal-kinds.d.ts +2 -0
- package/dist/runner/learned-first.d.ts +2 -0
- package/dist/runner/learned-first.js +1 -1
- package/dist/runner/learning-end.d.ts +7 -2
- package/dist/runner/learning-end.js +22 -10
- package/dist/runner/learning-seed.d.ts +9 -3
- package/dist/runner/learning-seed.js +2 -2
- package/dist/runner/main.d.ts +1 -0
- package/dist/runner/main.js +20 -13
- package/dist/runner/mcp-claim.js +6 -1
- package/dist/runner/mcp-run.d.ts +10 -7
- package/dist/runner/mcp-run.js +3 -5
- package/dist/runner/monid-run.js +9 -11
- package/dist/runner/project-checkpoint.d.ts +35 -0
- package/dist/runner/project-checkpoint.js +116 -0
- package/dist/runner/project-drain.d.ts +8 -0
- package/dist/runner/project-drain.js +25 -0
- package/dist/runner/project-host.d.ts +10 -0
- package/dist/runner/project-host.js +52 -0
- package/dist/runner/promotion.d.ts +14 -6
- package/dist/runner/promotion.js +98 -41
- package/dist/runner/redact.d.ts +13 -0
- package/dist/runner/redact.js +67 -1
- package/dist/runner/run-channel.d.ts +9 -0
- package/dist/runner/run-channel.js +15 -2
- package/dist/runner/run-child-host.d.ts +8 -4
- package/dist/runner/run-child-host.js +171 -41
- package/dist/runner/run-errors.js +2 -2
- package/dist/runner/runner-check.js +5 -2
- package/dist/runner/runner.js +26 -9
- package/dist/runner/store-secrets.js +7 -3
- package/dist/runner/workflow-first.d.ts +4 -0
- package/dist/runner/workflow-first.js +13 -0
- package/dist/runner/workflow-loop.d.ts +2 -1
- package/dist/runner/workflow-loop.js +2 -1
- package/dist/runner/workflow-spec.js +1 -1
- package/dist/runs-over-store.d.ts +34 -6
- package/dist/runs-over-store.js +133 -25
- package/dist/sdk/runs.d.ts +11 -1
- package/dist/sdk/runs.js +117 -26
- package/dist/sdk/schema.js +12 -2
- package/dist/sdk/workflows.d.ts +1 -1
- package/dist/server.d.ts +68 -32
- package/dist/server.js +600 -110
- package/dist/skills/agentrun-serve/SKILL.md +2 -1
- package/dist/source-sync/adoption.d.ts +15 -0
- package/dist/source-sync/adoption.js +36 -0
- package/dist/source-sync/auxiliary.d.ts +23 -0
- package/dist/source-sync/auxiliary.js +64 -0
- package/dist/source-sync/capture-git.d.ts +5 -0
- package/dist/source-sync/capture-git.js +272 -0
- package/dist/source-sync/capture-project.d.ts +53 -0
- package/dist/source-sync/capture-project.js +206 -0
- package/dist/source-sync/capture-refusal.d.ts +7 -0
- package/dist/source-sync/capture-refusal.js +16 -0
- package/dist/source-sync/capture.d.ts +11 -0
- package/dist/source-sync/capture.js +22 -0
- package/dist/source-sync/checkpoint-gate.d.ts +21 -0
- package/dist/source-sync/checkpoint-gate.js +52 -0
- package/dist/source-sync/checkpoints.d.ts +66 -0
- package/dist/source-sync/checkpoints.js +168 -0
- package/dist/source-sync/claim.d.ts +11 -0
- package/dist/source-sync/claim.js +48 -0
- package/dist/source-sync/destination.d.ts +47 -0
- package/dist/source-sync/destination.js +239 -0
- package/dist/source-sync/io.d.ts +15 -0
- package/dist/source-sync/io.js +52 -0
- package/dist/source-sync/local.d.ts +43 -0
- package/dist/source-sync/local.js +229 -0
- package/dist/source-sync/prepare.d.ts +59 -0
- package/dist/source-sync/prepare.js +93 -0
- package/dist/source-sync/projects.d.ts +61 -0
- package/dist/source-sync/projects.js +130 -0
- package/dist/source-sync/registry.d.ts +95 -0
- package/dist/source-sync/registry.js +226 -0
- package/dist/source-sync/service.d.ts +33 -0
- package/dist/source-sync/service.js +118 -0
- package/dist/source-sync/skill-edits.d.ts +12 -0
- package/dist/source-sync/skill-edits.js +122 -0
- package/dist/source-sync/snapshots.d.ts +48 -0
- package/dist/source-sync/snapshots.js +448 -0
- package/dist/source-sync/types.d.ts +9 -0
- package/dist/source-sync/types.js +14 -0
- package/dist/source-sync/workspace.d.ts +66 -0
- package/dist/source-sync/workspace.js +273 -0
- package/dist/store/agent-body.d.ts +4 -0
- package/dist/store/agent-body.js +16 -5
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +2 -1
- package/dist/store/seal.d.ts +5 -1
- package/dist/store/seal.js +12 -3
- package/dist/store/sqlite/project-checkpoints.d.ts +11 -0
- package/dist/store/sqlite/project-checkpoints.js +70 -0
- package/dist/store/sqlite/run-launch.d.ts +4 -12
- package/dist/store/sqlite/run-launch.js +5 -19
- package/dist/store/sqlite/store.js +224 -170
- package/dist/store/store.d.ts +116 -39
- package/dist/store/store.js +14 -1
- package/dist/store-reads/learning.d.ts +2 -2
- package/dist/store-view.d.ts +3 -1
- package/dist/store-view.js +17 -5
- package/dist/template-import.d.ts +10 -2
- package/dist/template-import.js +116 -13
- package/dist/templates.d.ts +26 -5
- package/dist/templates.js +62 -10
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +5 -0
- package/dist/timeline/timeline.js +8 -0
- package/dist/tool-plane.d.ts +12 -12
- package/dist/tools.d.ts +8 -8
- package/dist/trigger-launch-hook.d.ts +47 -0
- package/dist/trigger-launch-hook.js +90 -0
- package/dist/trigger-targets.d.ts +14 -1
- package/dist/trigger-targets.js +20 -0
- package/dist/triggers.d.ts +54 -5
- package/dist/triggers.js +143 -8
- package/dist/uploads-archil.js +1 -1
- package/dist/uploads.js +1 -1
- package/dist/validate.js +1 -2
- package/dist/workspace/computer-for-claim.d.ts +2 -0
- package/dist/workspace/computer-for-claim.js +43 -0
- package/dist/workspace/paths.d.ts +6 -0
- package/dist/workspace/paths.js +6 -0
- package/dist/workspace/resolve-computer.d.ts +1 -0
- package/dist/workspace/run-tools.d.ts +2 -0
- package/dist/workspace/run-tools.js +8 -0
- package/launcher/agentrun-serve +1 -1
- package/package.json +10 -10
- package/skills/agentrun-serve/SKILL.md +2 -1
- package/templates/README.md +5 -2
- package/dist/console/assets/index-B-D0EM3j.js +0 -733
- package/dist/console/assets/index-DlQepP2J.css +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Native MCP selection without contacting a server or opening credentials. Codex 0.171.0's
|
|
2
|
+
* ToolFilter uses exact names. Claude 2.1.322's agent selectors use qualified mcp__ names;
|
|
3
|
+
* keeping the whole name avoids confusing a server containing __ with another server's tool. */
|
|
4
|
+
import type { SourceMcpSelection } from "./source-snapshot-types.js";
|
|
5
|
+
export declare const claudeMcpSelector: (value: unknown) => value is string;
|
|
6
|
+
export declare function sourceMcpSelection(value: unknown): value is SourceMcpSelection;
|
|
7
|
+
export declare function selectedMcpTool(selection: SourceMcpSelection, server: string, tool: string): boolean;
|
|
8
|
+
/** Whether a server can contribute a selected tool, before its destination catalog is opened. */
|
|
9
|
+
export declare function selectedMcpServer(selection: SourceMcpSelection, server: string): boolean;
|
|
10
|
+
/** Exact, positively selected names must exist. Wildcards mean the available pool, possibly empty;
|
|
11
|
+
* a deny always wins, including an exact name present in both lists. */
|
|
12
|
+
export declare function missingMcpTools(selection: SourceMcpSelection, server: string, available: readonly string[]): string[];
|
|
13
|
+
export declare const nativeToolNames: (value: unknown) => string[] | undefined;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const text = (value) => typeof value === "string" && value.length > 0 && value.length <= 512 && !/[\s\x00-\x1f\x7f]/.test(value);
|
|
2
|
+
export const claudeMcpSelector = (value) => text(value) && value.startsWith("mcp__") && value.length > 5 && !/[()\[\]{}?\\]/.test(value);
|
|
3
|
+
export function sourceMcpSelection(value) {
|
|
4
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
5
|
+
return false;
|
|
6
|
+
const v = value;
|
|
7
|
+
if (Object.keys(v).some(key => !["dialect", "allow", "deny"].includes(key)) || !["exact", "claude"].includes(v.dialect))
|
|
8
|
+
return false;
|
|
9
|
+
const names = (items) => Array.isArray(items) && items.length <= 1000 && items.every(v.dialect === "claude" ? claudeMcpSelector : text) && new Set(items).size === items.length;
|
|
10
|
+
return (v.allow === null || names(v.allow)) && names(v.deny);
|
|
11
|
+
}
|
|
12
|
+
/** Literal chunks and * only. Each search advances through the name; no regexp backtracking on an upstream name. */
|
|
13
|
+
const glob = (pattern, value) => {
|
|
14
|
+
const parts = pattern.split("*");
|
|
15
|
+
if (parts.length === 1)
|
|
16
|
+
return pattern === value;
|
|
17
|
+
const first = parts[0], last = parts.at(-1);
|
|
18
|
+
if (!value.startsWith(first) || !value.endsWith(last))
|
|
19
|
+
return false;
|
|
20
|
+
const end = value.length - last.length;
|
|
21
|
+
let at = first.length;
|
|
22
|
+
for (const part of parts.slice(1, -1)) {
|
|
23
|
+
if (!part)
|
|
24
|
+
continue;
|
|
25
|
+
const found = value.indexOf(part, at);
|
|
26
|
+
if (found < 0)
|
|
27
|
+
return false;
|
|
28
|
+
at = found + part.length;
|
|
29
|
+
if (at > end)
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return at <= end;
|
|
33
|
+
};
|
|
34
|
+
function claudeMatches(pattern, qualified, deny = false) {
|
|
35
|
+
if (glob(pattern, qualified))
|
|
36
|
+
return true;
|
|
37
|
+
// A bare server deny is a prefix in Claude; a server named reports__v2 is consequently
|
|
38
|
+
// excluded by mcp__reports as documented. Allow entries do not get this implicit wildcard.
|
|
39
|
+
return deny && !pattern.includes("*") && !pattern.slice(5).includes("__") && qualified.startsWith(`${pattern}__`);
|
|
40
|
+
}
|
|
41
|
+
export function selectedMcpTool(selection, server, tool) {
|
|
42
|
+
if (selection.dialect === "exact")
|
|
43
|
+
return (selection.allow === null || selection.allow.includes(tool)) && !selection.deny.includes(tool);
|
|
44
|
+
const qualified = `mcp__${server}__${tool}`;
|
|
45
|
+
return (selection.allow === null || selection.allow.some(pattern => claudeMatches(pattern, qualified))) && !selection.deny.some(pattern => claudeMatches(pattern, qualified, true));
|
|
46
|
+
}
|
|
47
|
+
/** Whether a server can contribute a selected tool, before its destination catalog is opened. */
|
|
48
|
+
export function selectedMcpServer(selection, server) {
|
|
49
|
+
if (selection.dialect === "exact")
|
|
50
|
+
return selection.allow === null || selection.allow.some(name => !selection.deny.includes(name));
|
|
51
|
+
const prefix = `mcp__${server}__`;
|
|
52
|
+
if (selection.deny.some(pattern => pattern === "mcp__*" || pattern === `${prefix}*`
|
|
53
|
+
|| !pattern.includes("*") && !pattern.slice(5).includes("__") && prefix.startsWith(`${pattern}__`)))
|
|
54
|
+
return false;
|
|
55
|
+
return selection.allow === null || selection.allow.some(pattern => {
|
|
56
|
+
const fixed = pattern.split("*", 1)[0];
|
|
57
|
+
return fixed.startsWith(prefix) || pattern.includes("*") && prefix.startsWith(fixed);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** Exact, positively selected names must exist. Wildcards mean the available pool, possibly empty;
|
|
61
|
+
* a deny always wins, including an exact name present in both lists. */
|
|
62
|
+
export function missingMcpTools(selection, server, available) {
|
|
63
|
+
if (selection.allow === null)
|
|
64
|
+
return [];
|
|
65
|
+
if (selection.dialect === "exact")
|
|
66
|
+
return selection.allow.filter(name => !selection.deny.includes(name) && !available.includes(name));
|
|
67
|
+
const prefix = `mcp__${server}__`;
|
|
68
|
+
return selection.allow.filter(name => !name.includes("*") && name.startsWith(prefix)
|
|
69
|
+
&& !selection.deny.some(pattern => claudeMatches(pattern, name, true)) && !available.includes(name.slice(prefix.length)));
|
|
70
|
+
}
|
|
71
|
+
export const nativeToolNames = (value) => Array.isArray(value) && value.every(item => typeof item === "string") ? value
|
|
72
|
+
: typeof value === "string" ? value.split(/[,\s]+/).filter(Boolean) : undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NativeRuntime } from "./types.js";
|
|
2
|
+
import { type SourceNativeTools, type SourceSnapshotBlocker } from "./source-snapshot-types.js";
|
|
3
|
+
/** Only these non-credential environment selectors affect the supported snapshot resolver. Consent hashes
|
|
4
|
+
* their exact source values; neither the consent wire nor a saved grant contains the values themselves. */
|
|
5
|
+
export declare const SOURCE_NATIVE_ENV_KEYS: readonly ["HOME", "PATH", "CODEX_HOME", "CLAUDE_CONFIG_DIR", "ANTHROPIC_MODEL", "ANTHROPIC_DEFAULT_MODEL", "ANTHROPIC_DEFAULT_OPUS_MODEL", "ANTHROPIC_DEFAULT_SONNET_MODEL", "ANTHROPIC_DEFAULT_HAIKU_MODEL", "ANTHROPIC_BASE_URL", "OPENAI_BASE_URL", "CLAUDE_CODE_USE_BEDROCK", "CLAUDE_CODE_USE_VERTEX", "CLAUDE_CODE_USE_FOUNDRY", "CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST", "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS", "CLAUDE_CODE_SUBAGENT_MODEL", "CLAUDE_CODE_ENABLE_TASKS"];
|
|
6
|
+
export declare function sourceNativeEnvironmentFacts(environment: Readonly<Record<string, string | undefined>>): Record<string, string | null>;
|
|
7
|
+
export declare const SOURCE_CODEX_FEATURES: readonly ["shell_tool", "view_image", "multi_agent", "apps", "plugins", "image_generation", "tool_suggest", "goals", "memories", "current_time_reminder", "sleep_tool", "token_budget"];
|
|
8
|
+
export declare function sourceNativeTools(input: {
|
|
9
|
+
runtime: NativeRuntime;
|
|
10
|
+
version: string | null;
|
|
11
|
+
model: string | null;
|
|
12
|
+
config: Record<string, any>;
|
|
13
|
+
permissions: Record<string, unknown>;
|
|
14
|
+
mcp: boolean;
|
|
15
|
+
modelCache?: unknown;
|
|
16
|
+
}): {
|
|
17
|
+
tools: SourceNativeTools;
|
|
18
|
+
blockers: SourceSnapshotBlocker[];
|
|
19
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** Read-only native capability evidence. This resolver never starts a session, runs hooks or connects MCP.
|
|
2
|
+
* Codex facts: openai/codex rust-v0.171.0, core/src/tools/spec_plan.rs, features/src/lib.rs,
|
|
3
|
+
* models-manager/models.json and app-server/src/extensions.rs. Claude 2.1.322's explicit agent tool
|
|
4
|
+
* list is documented in code.claude.com/docs/en/{sub-agents,tools-reference,cli-reference}.
|
|
5
|
+
* Default/account catalogs remain prerequisites unless their enabled closure is established. */
|
|
6
|
+
import { NATIVE_RUNTIME_FACTS } from "./runtimes.js";
|
|
7
|
+
import { claudeMcpSelector, nativeToolNames } from "./source-mcp-selection.js";
|
|
8
|
+
import { SOURCE_NATIVE_CAPABILITIES } from "./source-snapshot-types.js";
|
|
9
|
+
/** Only these non-credential environment selectors affect the supported snapshot resolver. Consent hashes
|
|
10
|
+
* their exact source values; neither the consent wire nor a saved grant contains the values themselves. */
|
|
11
|
+
export const SOURCE_NATIVE_ENV_KEYS = ["HOME", "PATH", "CODEX_HOME", "CLAUDE_CONFIG_DIR", "ANTHROPIC_MODEL", "ANTHROPIC_DEFAULT_MODEL", "ANTHROPIC_DEFAULT_OPUS_MODEL", "ANTHROPIC_DEFAULT_SONNET_MODEL", "ANTHROPIC_DEFAULT_HAIKU_MODEL", "ANTHROPIC_BASE_URL", "OPENAI_BASE_URL", "CLAUDE_CODE_USE_BEDROCK", "CLAUDE_CODE_USE_VERTEX", "CLAUDE_CODE_USE_FOUNDRY", "CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST", "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS", "CLAUDE_CODE_SUBAGENT_MODEL", "CLAUDE_CODE_ENABLE_TASKS"];
|
|
12
|
+
export function sourceNativeEnvironmentFacts(environment) {
|
|
13
|
+
return Object.fromEntries(SOURCE_NATIVE_ENV_KEYS.map(name => [name, environment[name] ?? null]));
|
|
14
|
+
}
|
|
15
|
+
const object = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
16
|
+
const CLAUDE_TOOLS = {
|
|
17
|
+
Bash: ["shell", "file_read", "file_write", "file_edit", "file_search"], Read: ["file_read", "image_read"], Write: ["file_write"], Edit: ["file_edit"], Glob: ["file_search"], Grep: ["file_search"],
|
|
18
|
+
WebSearch: ["web_search"], WebFetch: ["web_fetch"], Agent: ["subagents"], Task: ["subagents"], NotebookEdit: ["notebook_edit"],
|
|
19
|
+
AskUserQuestion: ["user_input"], EnterPlanMode: ["planning"], ExitPlanMode: ["planning"], EndConversation: ["session_end"],
|
|
20
|
+
Skill: ["skills"], ListMcpResourcesTool: ["mcp_resources"], ReadMcpResourceTool: ["mcp_resources"],
|
|
21
|
+
TaskCreate: ["task_tracking"], TaskUpdate: ["task_tracking"], TaskGet: ["task_tracking"], TaskList: ["task_tracking"], TaskStop: ["task_tracking"],
|
|
22
|
+
EnterWorktree: ["worktree"], ExitWorktree: ["worktree"], SendMessage: ["session_messaging"], ListAgents: ["session_messaging"],
|
|
23
|
+
PushNotification: ["notifications"], SendFeedback: ["feedback"], Artifact: ["artifact_publish"], RemoteTrigger: ["remote_tasks"], SendUserFile: ["remote_files"],
|
|
24
|
+
};
|
|
25
|
+
const CODEX_MODELS = Object.fromEntries([
|
|
26
|
+
...["gpt-6.2-sol", "gpt-6.2-astra"].map(name => [name, { agent: "v2", clock: true, async: ["request_user_input_async", "send_message_to_user_async"], lite: true, extra: ["literature_search_query"] }]),
|
|
27
|
+
...["gpt-6-astra", "gpt-6.1-sol", "gpt-6.1-terra", "gpt-6-sol", "gpt-6-luna"].map(name => [name, { agent: "v2", clock: true, async: ["send_user_message_async"], lite: true, extra: [] }]),
|
|
28
|
+
...["gpt-5.6-sol", "gpt-5.6-terra"].map(name => [name, { agent: "v2", clock: false, async: [], lite: true, extra: [] }]),
|
|
29
|
+
["gpt-5.6-luna", { agent: "v1", clock: false, async: [], lite: true, extra: [] }],
|
|
30
|
+
["gpt-5.5", { agent: null, clock: false, async: [], lite: false, extra: [] }],
|
|
31
|
+
]);
|
|
32
|
+
export const SOURCE_CODEX_FEATURES = ["shell_tool", "view_image", "multi_agent", "apps", "plugins", "image_generation", "tool_suggest", "goals", "memories", "current_time_reminder", "sleep_tool", "token_budget"];
|
|
33
|
+
export function sourceNativeTools(input) {
|
|
34
|
+
const enabled = new Set(), disabled = new Set(), blockers = [];
|
|
35
|
+
const block = (code, message) => blockers.push({ code, message, path: "configuration/native_tools" });
|
|
36
|
+
const set = (capability, on) => (on ? enabled : disabled).add(capability);
|
|
37
|
+
const tools = { version: input.version, complete: false, source: "versioned-runtime", capabilities: [], disabled: [] };
|
|
38
|
+
if (NATIVE_RUNTIME_FACTS[input.runtime].protocol === "codex-json") {
|
|
39
|
+
if (input.version !== "0.171.0")
|
|
40
|
+
block("native_version", "This Codex version needs a verified native capability resolver before Move.");
|
|
41
|
+
const features = object(input.config.features), on = (name, fallback) => typeof features[name] === "boolean" ? features[name] : fallback;
|
|
42
|
+
const model = input.model ? CODEX_MODELS[input.model] : undefined;
|
|
43
|
+
if (!model)
|
|
44
|
+
block("native_model_tools", "Choose an exact source model with verified builtin tool metadata before Move.");
|
|
45
|
+
// A cache with different tool facts could be active under the source account. Never infer its auth identity.
|
|
46
|
+
const cache = object(input.modelCache), cached = Array.isArray(cache.models) ? cache.models.find((row) => row?.slug === input.model) : undefined;
|
|
47
|
+
if (cache.client_version === input.version && cache.identity && cached && model) {
|
|
48
|
+
const expectedExtras = [...model.async, ...(model.clock ? ["clock"] : [])];
|
|
49
|
+
const actualExtras = (Array.isArray(cached.experimental_supported_tools) ? cached.experimental_supported_tools : []).filter((name) => name !== "multi_agent_v2_in_code_mode").sort();
|
|
50
|
+
if (cached.shell_type !== "shell_command" || cached.apply_patch_tool_type !== "freeform" || (cached.multi_agent_version ?? null) !== model.agent || cached.use_responses_lite !== model.lite || (cached.tool_mode ?? null) !== (model.lite ? "code_mode_only" : null) || JSON.stringify(actualExtras) !== JSON.stringify([...expectedExtras, ...model.extra].sort()))
|
|
51
|
+
block("native_model_catalog", "The source model cache has different builtin tools; resolve its active catalog before Move.");
|
|
52
|
+
}
|
|
53
|
+
set("shell", on("shell_tool", true));
|
|
54
|
+
for (const name of ["file_read", "file_write", "file_edit", "file_search"])
|
|
55
|
+
set(name, on("shell_tool", true) || name === "file_edit");
|
|
56
|
+
set("image_read", on("view_image", true));
|
|
57
|
+
set("subagents", object(input.config.agents).enabled !== false && (model?.agent !== null && model?.agent !== undefined || on("multi_agent", true)));
|
|
58
|
+
set("web_search", input.permissions.web_search !== "disabled");
|
|
59
|
+
set("mcp_resources", input.mcp || model?.lite === true);
|
|
60
|
+
set("user_input", object(object(input.config.tools).experimental_request_user_input).enabled !== false || model?.async.includes("send_message_to_user_async") === true);
|
|
61
|
+
set("planning", object(object(input.config.tools).update_plan).enabled === true);
|
|
62
|
+
set("clock", on("current_time_reminder", false) || model?.clock === true);
|
|
63
|
+
set("sleep", on("sleep_tool", true) && enabled.has("clock"));
|
|
64
|
+
set("task_tracking", on("goals", true));
|
|
65
|
+
set("context_management", on("token_budget", false));
|
|
66
|
+
set("skills", true);
|
|
67
|
+
for (const [name, capability] of [["apps", "apps"], ["plugins", "plugins"], ["image_generation", "image_generate"]]) {
|
|
68
|
+
set(capability, on(name, true));
|
|
69
|
+
if (on(name, true))
|
|
70
|
+
block(`native_${name}`, "An enabled source account integration needs its exact destination capability and account before Move.");
|
|
71
|
+
}
|
|
72
|
+
if (object(object(input.config.cloud).skills).enabled !== false)
|
|
73
|
+
block("native_cloud_skills", "Source account skills need a verified export or explicit source disable before Move.");
|
|
74
|
+
if (on("memories", false))
|
|
75
|
+
block("native_memory", "Source native memory tools need an explicit destination equivalent before Move.");
|
|
76
|
+
if (model?.extra.length && enabled.has("web_search"))
|
|
77
|
+
block("native_model_tools", "This model enables additional native tools without a verified destination equivalent.");
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
if (input.version !== "2.1.322")
|
|
81
|
+
block("native_version", "This Claude Code version needs a verified native capability resolver before Move.");
|
|
82
|
+
const selected = input.permissions.tools, denied = input.permissions.disallowedTools;
|
|
83
|
+
const list = nativeToolNames(selected), exclusions = nativeToolNames(denied) ?? [];
|
|
84
|
+
if (!list || list.some(name => !Object.hasOwn(CLAUDE_TOOLS, name) && !claudeMcpSelector(name)))
|
|
85
|
+
block("native_tool_list", "Select an explicit supported Claude agent tool list; default and account tools are not yet fully resolved.");
|
|
86
|
+
if (denied !== undefined && !nativeToolNames(denied) || exclusions.some(name => !Object.hasOwn(CLAUDE_TOOLS, name) && !claudeMcpSelector(name)))
|
|
87
|
+
block("native_tool_restriction", "A source tool restriction needs exact native tool resolution before Move.");
|
|
88
|
+
for (const name of list ?? [])
|
|
89
|
+
if (typeof name === "string" && !exclusions.includes(name))
|
|
90
|
+
for (const capability of CLAUDE_TOOLS[name] ?? [])
|
|
91
|
+
enabled.add(capability);
|
|
92
|
+
// Claude 2.1.322 keeps EndConversation even when an explicit nonempty tool list omits it.
|
|
93
|
+
if (list?.length || input.mcp)
|
|
94
|
+
enabled.add("session_end");
|
|
95
|
+
for (const capability of SOURCE_NATIVE_CAPABILITIES)
|
|
96
|
+
if (!enabled.has(capability))
|
|
97
|
+
disabled.add(capability);
|
|
98
|
+
}
|
|
99
|
+
tools.capabilities = [...enabled].sort();
|
|
100
|
+
tools.disabled = [...disabled].filter(name => !enabled.has(name)).sort();
|
|
101
|
+
tools.complete = blockers.length === 0;
|
|
102
|
+
return { tools, blockers };
|
|
103
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { NativeSelector, NativeTarget } from "./types.js";
|
|
2
|
+
export type SourceSnapshotBlocker = {
|
|
3
|
+
code: string;
|
|
4
|
+
path?: string;
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
export type SourceSnapshotEntry = {
|
|
8
|
+
path: string;
|
|
9
|
+
role: "project" | "instruction" | "skill";
|
|
10
|
+
type: "file" | "directory";
|
|
11
|
+
mode: number;
|
|
12
|
+
bytes: number;
|
|
13
|
+
sha256?: string;
|
|
14
|
+
};
|
|
15
|
+
export type SourceMcpSelection = {
|
|
16
|
+
dialect: "exact" | "claude";
|
|
17
|
+
allow: string[] | null;
|
|
18
|
+
deny: string[];
|
|
19
|
+
};
|
|
20
|
+
export type SourceMcpResource = "list" | "templates" | "read";
|
|
21
|
+
export type SourceNativeAccount = {
|
|
22
|
+
source: "codex-auth-file";
|
|
23
|
+
mode: "none" | "apikey" | "chatgpt" | "unknown";
|
|
24
|
+
plan: "ordinary" | "managed" | "unknown" | null;
|
|
25
|
+
};
|
|
26
|
+
export type SourceSnapshotTool = {
|
|
27
|
+
name: string;
|
|
28
|
+
transport: "http" | "stdio";
|
|
29
|
+
url?: string;
|
|
30
|
+
/** Names only. Source credential values are never part of a snapshot. */
|
|
31
|
+
credentials: string[];
|
|
32
|
+
/** Absent on older snapshots; Move requires a freshly resolved selection. Empty means no tools. */
|
|
33
|
+
selection?: SourceMcpSelection;
|
|
34
|
+
/** Resource access is independent of the MCP tool allow/deny list. */
|
|
35
|
+
resources?: SourceMcpResource[];
|
|
36
|
+
};
|
|
37
|
+
export declare const SOURCE_NATIVE_CAPABILITIES: readonly ["shell", "file_read", "file_write", "file_edit", "file_search", "web_search", "web_fetch", "subagents", "image_read", "image_generate", "planning", "user_input", "mcp_resources", "skills", "clock", "sleep", "task_tracking", "notebook_edit", "worktree", "notifications", "session_messaging", "context_management", "session_end", "feedback", "artifact_publish", "remote_tasks", "remote_files", "plugins", "apps"];
|
|
38
|
+
export type SourceNativeCapability = typeof SOURCE_NATIVE_CAPABILITIES[number];
|
|
39
|
+
export type SourceNativeTools = {
|
|
40
|
+
version: string | null;
|
|
41
|
+
complete: boolean;
|
|
42
|
+
source: "versioned-runtime" | "native-resolved";
|
|
43
|
+
capabilities: SourceNativeCapability[];
|
|
44
|
+
disabled: SourceNativeCapability[];
|
|
45
|
+
};
|
|
46
|
+
export type SourceSnapshotTransform = {
|
|
47
|
+
kind: "agentrun-capture-hooks";
|
|
48
|
+
path: string;
|
|
49
|
+
original_sha256: string;
|
|
50
|
+
original_bytes: number;
|
|
51
|
+
destination_sha256: string;
|
|
52
|
+
destination_bytes: number;
|
|
53
|
+
receipt: {
|
|
54
|
+
path: string;
|
|
55
|
+
sha256: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export type SourceSnapshot = {
|
|
59
|
+
version: 1;
|
|
60
|
+
digest: string;
|
|
61
|
+
complete: boolean;
|
|
62
|
+
source: {
|
|
63
|
+
runtime: NativeTarget["runtime"];
|
|
64
|
+
machine_id: string;
|
|
65
|
+
project: string;
|
|
66
|
+
selector: NativeSelector;
|
|
67
|
+
};
|
|
68
|
+
entries: SourceSnapshotEntry[];
|
|
69
|
+
/** sha256 -> exact bytes, base64 encoded. Shared content has one blob. */
|
|
70
|
+
blobs: Record<string, string>;
|
|
71
|
+
instructions: {
|
|
72
|
+
text: string;
|
|
73
|
+
layers: {
|
|
74
|
+
path: string;
|
|
75
|
+
precedence: number;
|
|
76
|
+
source: string;
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
skills: {
|
|
80
|
+
name: string;
|
|
81
|
+
path: string;
|
|
82
|
+
source: string;
|
|
83
|
+
}[];
|
|
84
|
+
configuration: {
|
|
85
|
+
model: string | null;
|
|
86
|
+
tools: SourceSnapshotTool[];
|
|
87
|
+
permissions: Record<string, unknown>;
|
|
88
|
+
credentials: string[];
|
|
89
|
+
native_tools?: SourceNativeTools;
|
|
90
|
+
native_account?: SourceNativeAccount;
|
|
91
|
+
};
|
|
92
|
+
project: {
|
|
93
|
+
git: null | {
|
|
94
|
+
head: string | null;
|
|
95
|
+
branch: string | null;
|
|
96
|
+
dirty: boolean;
|
|
97
|
+
deleted: string[];
|
|
98
|
+
bundle?: {
|
|
99
|
+
sha256: string;
|
|
100
|
+
bytes: number;
|
|
101
|
+
};
|
|
102
|
+
history: "complete" | "unavailable";
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
blockers: SourceSnapshotBlocker[];
|
|
106
|
+
/** Explicit operational hook removal. Original bytes/provenance remain independently verifiable. */
|
|
107
|
+
transforms?: SourceSnapshotTransform[];
|
|
108
|
+
};
|
|
109
|
+
export type SourceSnapshotOptions = {
|
|
110
|
+
target: NativeTarget;
|
|
111
|
+
/** Explicit source-side content grant. Fixed native system-policy paths receive presence-only
|
|
112
|
+
* metadata checks so unmanaged configuration cannot silently override a required policy. */
|
|
113
|
+
authorizedRoots: string[];
|
|
114
|
+
/** Private consent binding, never part of the manifest. Decimal identities preserve bigint precision. */
|
|
115
|
+
expectedRoots?: readonly {
|
|
116
|
+
readonly path: string;
|
|
117
|
+
readonly device: string;
|
|
118
|
+
readonly inode: string;
|
|
119
|
+
}[];
|
|
120
|
+
home: string;
|
|
121
|
+
codexHome?: string;
|
|
122
|
+
claudeHome?: string;
|
|
123
|
+
/** Source process metadata only; values are never serialized wholesale. */
|
|
124
|
+
environment?: Readonly<Record<string, string | undefined>>;
|
|
125
|
+
limits?: {
|
|
126
|
+
files?: number;
|
|
127
|
+
bytes?: number;
|
|
128
|
+
fileBytes?: number;
|
|
129
|
+
gitBytes?: number;
|
|
130
|
+
timeoutMs?: number;
|
|
131
|
+
};
|
|
132
|
+
/** Held values supplied by the source's credential boundary, for refusal rather than redaction. */
|
|
133
|
+
secretValues?: readonly string[];
|
|
134
|
+
signal?: AbortSignal;
|
|
135
|
+
};
|
|
136
|
+
/** Shared wire digest only; no source filesystem, environment or native-runtime dependencies.
|
|
137
|
+
* Consumers separately verify each blob's digest/size before accepting the complete manifest. */
|
|
138
|
+
export declare function sourceSnapshotDigest(snapshot: Omit<SourceSnapshot, "digest"> | SourceSnapshot): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
export const SOURCE_NATIVE_CAPABILITIES = ["shell", "file_read", "file_write", "file_edit", "file_search", "web_search", "web_fetch", "subagents", "image_read", "image_generate", "planning", "user_input", "mcp_resources", "skills", "clock", "sleep", "task_tracking", "notebook_edit", "worktree", "notifications", "session_messaging", "context_management", "session_end", "feedback", "artifact_publish", "remote_tasks", "remote_files", "plugins", "apps"];
|
|
3
|
+
/** Shared wire digest only; no source filesystem, environment or native-runtime dependencies.
|
|
4
|
+
* Consumers separately verify each blob's digest/size before accepting the complete manifest. */
|
|
5
|
+
export function sourceSnapshotDigest(snapshot) {
|
|
6
|
+
const { digest: _digest, ...body } = snapshot;
|
|
7
|
+
const canonical = JSON.stringify({ ...body, blobs: Object.keys(body.blobs).sort() }, function (_key, item) {
|
|
8
|
+
return item && typeof item === "object" && !Array.isArray(item)
|
|
9
|
+
? Object.fromEntries(Object.keys(item).sort().map(key => [key, item[key]])) : item;
|
|
10
|
+
});
|
|
11
|
+
return createHash("sha256").update(canonical).digest("hex");
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SourceSnapshot, SourceSnapshotOptions } from "./source-snapshot-types.js";
|
|
2
|
+
export type * from "./source-snapshot-types.js";
|
|
3
|
+
export { sourceSnapshotDigest } from "./source-snapshot-types.js";
|
|
4
|
+
export declare class SourceSnapshotError extends Error {
|
|
5
|
+
readonly code: "source_changed" | "source_unavailable" | "unsupported_platform" | "limit";
|
|
6
|
+
constructor(code: "source_changed" | "source_unavailable" | "unsupported_platform" | "limit", message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare function exportSourceSnapshot(options: SourceSnapshotOptions): Promise<SourceSnapshot>;
|