@tangle-network/agent-profile-materialize 1.1.6 → 1.1.8

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 (95) hide show
  1. package/dist/index.d.ts +1226 -29
  2. package/dist/index.js +4987 -23
  3. package/package.json +7 -5
  4. package/dist/candidate-types.d.ts +0 -36
  5. package/dist/candidate-types.js +0 -1
  6. package/dist/candidate.d.ts +0 -9
  7. package/dist/candidate.js +0 -283
  8. package/dist/commands.d.ts +0 -2
  9. package/dist/commands.js +0 -32
  10. package/dist/control-maps.d.ts +0 -58
  11. package/dist/control-maps.js +0 -277
  12. package/dist/execution-controls.d.ts +0 -5
  13. package/dist/execution-controls.js +0 -199
  14. package/dist/harness-prompt.d.ts +0 -22
  15. package/dist/harness-prompt.js +0 -64
  16. package/dist/harness.d.ts +0 -131
  17. package/dist/harness.js +0 -416
  18. package/dist/hooks.d.ts +0 -6
  19. package/dist/hooks.js +0 -250
  20. package/dist/managed-workspace-bind.d.ts +0 -4
  21. package/dist/managed-workspace-bind.js +0 -112
  22. package/dist/managed-workspace-stage.d.ts +0 -25
  23. package/dist/managed-workspace-stage.js +0 -199
  24. package/dist/managed-workspace-types.d.ts +0 -38
  25. package/dist/managed-workspace-types.js +0 -1
  26. package/dist/managed-workspace.d.ts +0 -37
  27. package/dist/managed-workspace.js +0 -290
  28. package/dist/mcp-config-ownership.d.ts +0 -13
  29. package/dist/mcp-config-ownership.js +0 -79
  30. package/dist/mcp-opencode.d.ts +0 -25
  31. package/dist/mcp-opencode.js +0 -52
  32. package/dist/mcp-timeouts.d.ts +0 -7
  33. package/dist/mcp-timeouts.js +0 -48
  34. package/dist/mcp.d.ts +0 -4
  35. package/dist/mcp.js +0 -246
  36. package/dist/model-id.d.ts +0 -55
  37. package/dist/model-id.js +0 -67
  38. package/dist/pi-models-config.d.ts +0 -32
  39. package/dist/pi-models-config.js +0 -65
  40. package/dist/plan-application.d.ts +0 -10
  41. package/dist/plan-application.js +0 -190
  42. package/dist/plan-digest.d.ts +0 -18
  43. package/dist/plan-digest.js +0 -116
  44. package/dist/plan-json.d.ts +0 -13
  45. package/dist/plan-json.js +0 -91
  46. package/dist/plan-normalize.d.ts +0 -12
  47. package/dist/plan-normalize.js +0 -168
  48. package/dist/plan-prompt.d.ts +0 -38
  49. package/dist/plan-prompt.js +0 -49
  50. package/dist/plan-support.d.ts +0 -9
  51. package/dist/plan-support.js +0 -22
  52. package/dist/plan-types.d.ts +0 -341
  53. package/dist/plan-types.js +0 -105
  54. package/dist/prime-agent-dir.d.ts +0 -64
  55. package/dist/prime-agent-dir.js +0 -173
  56. package/dist/prime-fork.d.ts +0 -155
  57. package/dist/prime-fork.js +0 -262
  58. package/dist/prime-profile.d.ts +0 -88
  59. package/dist/prime-profile.js +0 -297
  60. package/dist/profile-bundle-cache.d.ts +0 -37
  61. package/dist/profile-bundle-cache.js +0 -320
  62. package/dist/profile-bundle-key.d.ts +0 -69
  63. package/dist/profile-bundle-key.js +0 -62
  64. package/dist/profile-bundle-lru.d.ts +0 -56
  65. package/dist/profile-bundle-lru.js +0 -220
  66. package/dist/profile-materializer.d.ts +0 -24
  67. package/dist/profile-materializer.js +0 -114
  68. package/dist/profile-plan.d.ts +0 -16
  69. package/dist/profile-plan.js +0 -90
  70. package/dist/profile-prompt.d.ts +0 -4
  71. package/dist/profile-prompt.js +0 -107
  72. package/dist/profile-support.d.ts +0 -8
  73. package/dist/profile-support.js +0 -6
  74. package/dist/resource-lowering.d.ts +0 -6
  75. package/dist/resource-lowering.js +0 -103
  76. package/dist/resource-resolution.d.ts +0 -27
  77. package/dist/resource-resolution.js +0 -265
  78. package/dist/secret-concurrent-revision.d.ts +0 -30
  79. package/dist/secret-concurrent-revision.js +0 -291
  80. package/dist/secret-session-view.d.ts +0 -36
  81. package/dist/secret-session-view.js +0 -179
  82. package/dist/subagents.d.ts +0 -6
  83. package/dist/subagents.js +0 -137
  84. package/dist/tool-bin-path.d.ts +0 -23
  85. package/dist/tool-bin-path.js +0 -61
  86. package/dist/workspace-apply-files.d.ts +0 -57
  87. package/dist/workspace-apply-files.js +0 -193
  88. package/dist/workspace-apply-publish.d.ts +0 -22
  89. package/dist/workspace-apply-publish.js +0 -178
  90. package/dist/workspace-apply.d.ts +0 -11
  91. package/dist/workspace-apply.js +0 -124
  92. package/dist/workspace-files.d.ts +0 -8
  93. package/dist/workspace-files.js +0 -46
  94. package/dist/workspace-launch.d.ts +0 -3
  95. package/dist/workspace-launch.js +0 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-profile-materialize",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Materialize an AgentProfile into the native per-harness workspace files (the one shared materializer for cli-bridge, agent-container, and VB).",
5
5
  "type": "module",
6
6
  "repository": {
@@ -28,18 +28,20 @@
28
28
  "@tangle-network/agent-interface": "5.10.2",
29
29
  "@tangle-network/agent-interface-current": "npm:@tangle-network/agent-interface@5.10.2",
30
30
  "@types/node": "25.6.0",
31
+ "tsdown": "0.21.10",
31
32
  "typescript": "^6.0.3",
32
- "vitest": "^4.1.12"
33
+ "vitest": "^4.1.12",
34
+ "@tangle-network/runtime-contracts": "0.20.0"
33
35
  },
34
36
  "peerDependencies": {
35
37
  "@tangle-network/agent-interface": "^5.10.2"
36
38
  },
37
39
  "tangleRelease": {
38
- "sourceSha": "317182be2d49d5ca117256b3c807d12ad023a844",
39
- "mergedAt": "2026-10-29T05:44:32-06:00"
40
+ "sourceSha": "5d3675ef9b9b3fc222fc3b5a8cfeedab71aa174a",
41
+ "mergedAt": "2026-10-29T17:18:52-06:00"
40
42
  },
41
43
  "scripts": {
42
- "build": "tsc -p tsconfig.json",
44
+ "build": "tsdown",
43
45
  "check-types": "node ../../scripts/tsc-native.mjs --noEmit",
44
46
  "clean": "rm -rf dist",
45
47
  "test": "pnpm run test:installed-peer && pnpm run test:current-peer",
@@ -1,36 +0,0 @@
1
- export interface AgentCandidateWorkspacePlan {
2
- sourceProfileDigest: Sha256Digest;
3
- harness: HarnessId;
4
- files: PlanFile[];
5
- env: Record<string, AgentCandidateConfigValue>;
6
- flags: AgentCandidateConfigValue[];
7
- systemPrompt?: AgentCandidateConfigValue;
8
- appendSystemPrompt?: AgentCandidateConfigValue;
9
- unsupported: Unsupported[];
10
- }
11
- export interface AgentCandidateWorkspacePlanReceipt {
12
- profileActivation: AgentCandidateProfileActivation;
13
- application: AgentCandidateProfileApplication;
14
- env: Record<string, AgentCandidateConfigValue>;
15
- flags: AgentCandidateConfigValue[];
16
- systemPrompt?: AgentCandidateConfigValue;
17
- appendSystemPrompt?: AgentCandidateConfigValue;
18
- unsupported: Unsupported[];
19
- }
20
- export interface ApplyAgentCandidateWorkspacePlanOptions {
21
- /** Absolute private agent directory required by agent-root plan files. */
22
- agentDir?: string;
23
- }
24
- export interface MaterializeCandidateProfileOptions {
25
- /** Exact text fetched from pinned resource refs, keyed by declared SHA-256. */
26
- resolvedResources?: ReadonlyMap<Sha256Digest, string>;
27
- /**
28
- * Launcher controls this caller owns and will bind itself. The declaration
29
- * is forwarded to the classic materializer so candidate execution uses the
30
- * same lowering as ordinary profile execution.
31
- */
32
- binds?: readonly BindableLaunchControl[];
33
- }
34
- import type { AgentCandidateConfigValue, AgentCandidateProfileActivation, AgentCandidateProfileApplication, Sha256Digest } from "@tangle-network/agent-interface";
35
- import type { HarnessId } from "./harness.js";
36
- import type { BindableLaunchControl, PlanFile, Unsupported } from "./plan-types.js";
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import type { AgentCandidateProfile, AgentCandidateProfileApplication } from "@tangle-network/agent-interface";
2
- import type { AgentCandidateWorkspacePlan, AgentCandidateWorkspacePlanReceipt, ApplyAgentCandidateWorkspacePlanOptions, MaterializeCandidateProfileOptions } from "./candidate-types.js";
3
- import type { HarnessId } from "./harness.js";
4
- export declare function materializeCandidateProfile(profile: AgentCandidateProfile, harness: HarnessId, opts?: MaterializeCandidateProfileOptions): AgentCandidateWorkspacePlan;
5
- /**
6
- * Apply a candidate plan and return its spawn values together with captured
7
- * canonical evidence. No caller needs to re-serialize or reinterpret the plan.
8
- */
9
- export declare function applyAgentCandidateWorkspacePlan(plan: AgentCandidateWorkspacePlan, workspaceDir: string, targetWorkspace: AgentCandidateProfileApplication["targetWorkspace"], options?: ApplyAgentCandidateWorkspacePlanOptions): AgentCandidateWorkspacePlanReceipt;
package/dist/candidate.js DELETED
@@ -1,283 +0,0 @@
1
- import { createHash } from "node:crypto";
2
- import { agentCandidateProfileActivationSchema, agentCandidateProfileSchema, canonicalCandidateDigest, } from "@tangle-network/agent-interface";
3
- import { assertMaterializerHarness } from "./harness.js";
4
- import { hookWrapperSource } from "./hooks.js";
5
- import { applyWorkspacePlan } from "./plan-application.js";
6
- import { captureAgentCandidateProfilePlan } from "./plan-digest.js";
7
- import { normalizePlanFiles } from "./plan-normalize.js";
8
- import { promptIntentFields, samePromptIntentValue } from "./plan-prompt.js";
9
- import { assertWorkspacePlanSupported } from "./plan-support.js";
10
- import { materializeProfile } from "./profile-materializer.js";
11
- import { compareStrings } from "./workspace-files.js";
12
- export function materializeCandidateProfile(profile, harness, opts = {}) {
13
- assertMaterializerHarness(harness);
14
- const candidate = agentCandidateProfileSchema.parse(profile);
15
- verifyCandidateInlineResources(candidate);
16
- const hookLowering = lowerCandidateHooks(candidate.hooks, harness);
17
- const candidateResources = candidate.resources
18
- ? candidateResourcesForClassicMaterializer(candidate.resources, opts.resolvedResources)
19
- : {};
20
- candidateResources.files = [
21
- ...(candidateResources.files ?? []),
22
- ...hookLowering.wrapperFiles,
23
- ];
24
- const classicProfile = {
25
- ...candidate,
26
- resources: candidateResources,
27
- mcp: candidateMcpRecordForClassicMaterializer(candidate.mcp),
28
- hooks: hookLowering.hooks,
29
- };
30
- const classicPlan = materializeProfile(classicProfile, harness, {
31
- binds: opts.binds,
32
- ...(harness === "pi" ? { instructionsRoot: "agent" } : {}),
33
- });
34
- // Canonical candidate evidence has no field for a launcher-addressed binding.
35
- // Refuse that shape instead of returning a candidate plan whose receipt would
36
- // omit the exact control still owed by the launcher.
37
- if (classicPlan.systemPromptBinding !== undefined) {
38
- throw new Error(`Sealed candidate evidence cannot represent a system-prompt binding to ${classicPlan.systemPromptBinding.control}`);
39
- }
40
- if (hookLowering.unsupportedReason) {
41
- classicPlan.unsupported.push({
42
- dimension: "hooks",
43
- reason: hookLowering.unsupportedReason,
44
- });
45
- }
46
- classicPlan.unsupported.sort((left, right) => compareStrings(`${left.dimension}\0${left.reason}`, `${right.dimension}\0${right.reason}`));
47
- assertWorkspacePlanSupported(classicPlan);
48
- return {
49
- sourceProfileDigest: canonicalCandidateDigest(candidate),
50
- harness: classicPlan.harness,
51
- files: classicPlan.files,
52
- env: candidatePublicRecord(classicPlan.env),
53
- flags: classicPlan.flags.map(candidatePublicArgument),
54
- ...promptIntentFields(classicPlan, candidatePublicValue),
55
- unsupported: classicPlan.unsupported,
56
- };
57
- }
58
- /**
59
- * Apply a candidate plan and return its spawn values together with captured
60
- * canonical evidence. No caller needs to re-serialize or reinterpret the plan.
61
- */
62
- export function applyAgentCandidateWorkspacePlan(plan, workspaceDir, targetWorkspace, options = {}) {
63
- assertWorkspacePlanSupported(plan);
64
- const profilePlan = captureAgentCandidateProfilePlan(plan);
65
- const activationFiles = normalizePlanFiles(plan.files).map((file) => ({
66
- path: file.relPath,
67
- mode: file.mode,
68
- content: file.content,
69
- }));
70
- const activationMaterial = {
71
- kind: "agent-candidate-profile-activation",
72
- profilePlan,
73
- files: activationFiles,
74
- };
75
- const profileActivation = agentCandidateProfileActivationSchema.parse({
76
- ...activationMaterial,
77
- digest: canonicalCandidateDigest(activationMaterial),
78
- });
79
- const applied = applyWorkspacePlan({
80
- harness: plan.harness,
81
- files: plan.files,
82
- env: Object.fromEntries(Object.entries(plan.env).map(([name, value]) => [
83
- name,
84
- candidatePublicString(value),
85
- ])),
86
- flags: plan.flags.map(candidatePublicString),
87
- ...promptIntentFields(plan, candidatePublicString),
88
- unsupported: plan.unsupported,
89
- }, workspaceDir, { agentDir: options.agentDir });
90
- return {
91
- profileActivation,
92
- application: {
93
- planDigest: profilePlan.digest,
94
- targetWorkspace,
95
- // The candidate execution-plan contract lists workspace mounts here.
96
- // Agent-root placement remains explicit in profile-plan material.files.
97
- mountPaths: applied.written,
98
- },
99
- env: { ...plan.env },
100
- flags: [...plan.flags],
101
- ...promptIntentFields(plan, samePromptIntentValue),
102
- unsupported: [...plan.unsupported],
103
- };
104
- }
105
- function lowerCandidateHooks(hooks, harness) {
106
- if (!hooks || Object.keys(hooks).length === 0)
107
- return { wrapperFiles: [] };
108
- const nativeHarness = harness;
109
- if (nativeHarness !== "codex" && nativeHarness !== "claude-code") {
110
- return {
111
- wrapperFiles: [],
112
- unsupportedReason: `${nativeHarness} hook configuration requires an unverified command-string mapping; ` +
113
- "sealed candidate hooks preserve executable, argv, and env separately",
114
- };
115
- }
116
- const wrapperFiles = [];
117
- const lowered = {};
118
- for (const [event, commands] of Object.entries(hooks)) {
119
- lowered[event] = commands.map((command, index) => {
120
- const wrapper = candidateHookWrapper(event, index, command);
121
- wrapperFiles.push({
122
- path: wrapper.path,
123
- resource: {
124
- kind: "inline",
125
- name: wrapper.path,
126
- content: wrapper.content,
127
- },
128
- });
129
- return {
130
- command: `node ${wrapper.path}`,
131
- timeoutMs: command.timeoutMs,
132
- blocking: command.blocking,
133
- matcher: command.matcher,
134
- };
135
- });
136
- }
137
- return { hooks: lowered, wrapperFiles };
138
- }
139
- function candidateHookWrapper(event, index, command) {
140
- const args = (command.args ?? []).map(candidatePublicString);
141
- const env = Object.fromEntries(Object.entries(command.env ?? {})
142
- .sort(([left], [right]) => compareStrings(left, right))
143
- .map(([name, value]) => [name, candidatePublicString(value)]));
144
- const wrapperId = canonicalCandidateDigest({
145
- event,
146
- index,
147
- executable: command.executable,
148
- args,
149
- env,
150
- timeoutMs: command.timeoutMs ?? null,
151
- blocking: command.blocking ?? null,
152
- matcher: command.matcher ?? null,
153
- }).slice("sha256:".length);
154
- const path = `.tangle/profile-hooks/${wrapperId}.mjs`;
155
- const content = hookWrapperSource(command.executable, args, env);
156
- return { path, content };
157
- }
158
- function candidateMcpRecordForClassicMaterializer(servers) {
159
- if (!servers)
160
- return undefined;
161
- return Object.fromEntries(Object.entries(servers)
162
- .filter((entry) => entry[1].enabled !== false)
163
- .map(([name, server]) => [
164
- name,
165
- candidateMcpForClassicMaterializer(server),
166
- ]));
167
- }
168
- function candidateMcpForClassicMaterializer(server) {
169
- return {
170
- command: server.command,
171
- ...(server.transport === undefined ? {} : { transport: server.transport }),
172
- ...(server.args === undefined
173
- ? {}
174
- : {
175
- args: server.args.map((value) => profilePublicValue(candidatePublicString(value))),
176
- }),
177
- ...(server.env === undefined
178
- ? {}
179
- : {
180
- env: Object.fromEntries(Object.entries(server.env).map(([name, value]) => [
181
- name,
182
- profilePublicValue(candidatePublicString(value)),
183
- ])),
184
- }),
185
- ...(server.cwd === undefined ? {} : { cwd: server.cwd }),
186
- };
187
- }
188
- function candidateResourcesForClassicMaterializer(resources, resolvedResources) {
189
- const convert = (ref) => {
190
- if (ref.kind === "inline") {
191
- return { kind: "inline", name: ref.name, content: ref.content };
192
- }
193
- const content = resolvedResources?.get(ref.sha256);
194
- if (content !== undefined) {
195
- verifyCandidateResourceBytes(ref, content, ref.name ?? ref.path);
196
- return {
197
- kind: "inline",
198
- name: ref.name ?? ref.path.split("/").at(-1) ?? "resource",
199
- content,
200
- };
201
- }
202
- return {
203
- kind: "github",
204
- repository: `${ref.repository.owner}/${ref.repository.repo}`,
205
- path: ref.path,
206
- ref: ref.commit,
207
- name: ref.name,
208
- };
209
- };
210
- return {
211
- ...resources,
212
- files: resources.files?.map((mount) => ({
213
- path: mount.path,
214
- resource: convert(mount.resource),
215
- executable: mount.executable,
216
- })),
217
- tools: resources.tools?.map(convert),
218
- skills: resources.skills?.map(convert),
219
- agents: resources.agents?.map(convert),
220
- commands: resources.commands?.map(convert),
221
- instructions: typeof resources.instructions === "string"
222
- ? resources.instructions
223
- : resources.instructions
224
- ? convert(resources.instructions)
225
- : undefined,
226
- // The candidate wrapper owns the complete unsupported check after it adds
227
- // dimensions that the classic materializer cannot represent.
228
- failOnError: false,
229
- };
230
- }
231
- function candidatePublicString(value) {
232
- if (value.kind !== "public") {
233
- throw new Error("Candidate materialization accepts public config values only");
234
- }
235
- return value.value;
236
- }
237
- function candidatePublicValue(value) {
238
- return { kind: "public", value };
239
- }
240
- function profilePublicValue(value) {
241
- return { kind: "public", value };
242
- }
243
- function candidatePublicArgument(value) {
244
- if (typeof value !== "string") {
245
- throw new Error("Candidate materialization cannot emit private launch arguments");
246
- }
247
- return candidatePublicValue(value);
248
- }
249
- function candidatePublicRecord(values) {
250
- return Object.fromEntries(Object.entries(values).map(([name, value]) => {
251
- if (typeof value !== "string") {
252
- throw new Error("Candidate materialization cannot emit private environment values");
253
- }
254
- return [name, candidatePublicValue(value)];
255
- }));
256
- }
257
- function verifyCandidateInlineResources(profile) {
258
- const resources = profile.resources;
259
- if (!resources)
260
- return;
261
- const refs = [
262
- ...(resources.files?.map((mount) => mount.resource) ?? []),
263
- ...(resources.tools ?? []),
264
- ...(resources.skills ?? []),
265
- ...(resources.agents ?? []),
266
- ...(resources.commands ?? []),
267
- ...(typeof resources.instructions === "object"
268
- ? [resources.instructions]
269
- : []),
270
- ];
271
- for (const ref of refs) {
272
- if (ref.kind !== "inline")
273
- continue;
274
- verifyCandidateResourceBytes(ref, ref.content, ref.name);
275
- }
276
- }
277
- function verifyCandidateResourceBytes(ref, content, label) {
278
- const bytes = Buffer.from(content, "utf8");
279
- const digest = `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
280
- if (bytes.byteLength !== ref.byteLength || digest !== ref.sha256) {
281
- throw new Error(`Candidate resource integrity mismatch: ${label}`);
282
- }
283
- }
@@ -1,2 +0,0 @@
1
- export declare function materializeCommand(h: HarnessId, name: string, body: string, add: (path: string, content: string, mode?: number) => void, unsupported: (d: Unsupported["dimension"], r: string) => void): void;
2
- import type { HarnessId, Unsupported } from "./plan-types.js";
package/dist/commands.js DELETED
@@ -1,32 +0,0 @@
1
- export function materializeCommand(h, name, body, add, unsupported) {
2
- switch (h) {
3
- case "claude-code":
4
- case "nanoclaw":
5
- add(`.claude/commands/${name}.md`, body.endsWith("\n") ? body : `${body}\n`);
6
- break;
7
- case "opencode":
8
- add(`.opencode/commands/${name}.md`, body.endsWith("\n") ? body : `${body}\n`);
9
- break;
10
- case "gemini":
11
- add(`.gemini/commands/${name}.toml`, `prompt = ${tomlStr(body)}\n`);
12
- break;
13
- case "pi":
14
- add(`.pi/prompts/${name}.md`, body.endsWith("\n") ? body : `${body}\n`);
15
- break;
16
- case "prime":
17
- // Auto-discovered project prompt templates: <cwd>/.prime/agent/prompts
18
- // (fork prompt-templates.ts:218 resolves CONFIG_DIR_NAME "prompts";
19
- // package-manager.ts:2176-2180 auto-adds the same projectDirs.prompts).
20
- add(`.prime/agent/prompts/${name}.md`, body.endsWith("\n") ? body : `${body}\n`);
21
- break;
22
- case "kimi-code":
23
- unsupported("commands", "kimi commands ARE skills (/skill:<name>) — provide as a skill instead");
24
- break;
25
- case "codex":
26
- unsupported("commands", "codex project commands unsupported (~/.codex/prompts is user-global only)");
27
- break;
28
- default:
29
- unsupported("commands", `${h}: no cwd command path`);
30
- }
31
- }
32
- import { tomlStr } from "./plan-json.js";
@@ -1,58 +0,0 @@
1
- export declare function normalizedControlName(name: string): string;
2
- /** Tool IDs accepted by Claude Code. */
3
- export declare const CLAUDE_CODE_NATIVE_TOOL_IDS: readonly string[];
4
- /** Permission IDs accepted by Claude Code (same as tool IDs). */
5
- export declare const CLAUDE_CODE_NATIVE_PERMISSION_IDS: readonly string[];
6
- export declare function claudeToolName(name: string): string | undefined;
7
- /** Tool IDs reported by the OpenCode binary shipped in the Sandbox image. */
8
- export declare const OPENCODE_NATIVE_TOOL_IDS: readonly ["apply_patch", "bash", "codesearch", "edit", "glob", "grep", "question", "read", "skill", "task", "todowrite", "webfetch", "websearch", "write"];
9
- /** Permission IDs accepted by OpenCode (tools except read, plus special permissions). */
10
- export declare const OPENCODE_NATIVE_PERMISSION_IDS: readonly ["apply_patch", "bash", "codesearch", "doom_loop", "edit", "external_directory", "glob", "grep", "mcp", "question", "skill", "task", "todowrite", "webfetch", "websearch", "write"];
11
- /** Resolve portable and legacy profile names to current OpenCode tool IDs. */
12
- export declare function openCodeNativeToolId(name: string): string | undefined;
13
- export declare function openCodeToolName(name: string): string | undefined;
14
- export declare function openCodePermissionName(name: string): string | undefined;
15
- /** OpenCode 1.x registers MCP tools as sanitized server + "_" + tool.
16
- * Accept exact tools and a server-wide rule only for this profile's servers.
17
- * A generic permission spelling must never become a grant to an undeclared MCP.
18
- */
19
- export declare function openCodeDeclaredMcpPermissionName(name: string, aliases: readonly string[]): string | undefined;
20
- export declare const PI_EXECUTION_CONTROL_EXTENSION_PATH = ".tangle/pi-execution-controls.ts";
21
- /**
22
- * Translate only portable spellings whose Pi equivalent differs.
23
- *
24
- * Every other exact name is resolved against Pi's live registry, keeping
25
- * extension and MCP tools profile-configurable without a static catalog.
26
- */
27
- export declare function piToolId(name: string): string | undefined;
28
- /**
29
- * Map tool switches to native ids; spellings of one tool keep its explicit off.
30
- *
31
- * Products compose profiles in layers: a shared allowlist, then a product
32
- * constraint that disables a native tool under its own spelling. Physim adds
33
- * `webfetch: false` over an allowlist holding `web_fetch: true`. Off is the
34
- * only value that honours every layer, so it wins regardless of entry order.
35
- */
36
- export declare function mapSupportedBooleanEntries(entries: [string, boolean][], mapName: (name: string) => string | undefined, onUnsupported: (name: string) => void): [string, boolean][];
37
- export declare function permissionAllowsEverything(policy: AgentProfilePermission): boolean;
38
- export declare function mapSupportedPermissionEntries(entries: [string, AgentProfilePermission][], mapName: (name: string) => string | undefined, onUnsupported: (name: string) => void, label: string): [string, AgentProfilePermission][];
39
- export declare function claudePermissionRules(entries: [string, AgentProfilePermission][]): {
40
- allow: string[];
41
- ask: string[];
42
- deny: string[];
43
- };
44
- /**
45
- * Give each Claude rule one decision. A tool switch and a permission can name
46
- * the same rule; the stricter decision wins, as deny already beats allow
47
- * inside Claude Code.
48
- */
49
- export declare function sealClaudePermissionRules(rules: {
50
- allow: string[];
51
- ask: string[];
52
- deny: string[];
53
- }): {
54
- allow: string[];
55
- ask: string[];
56
- deny: string[];
57
- };
58
- import type { AgentProfilePermission } from "@tangle-network/agent-interface";