@tangle-network/agent-profile-materialize 1.1.4 → 1.1.6
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/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +24 -35
- package/dist/plan-types.d.ts +1 -1
- package/package.json +3 -3
package/dist/hooks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function materializeHooks(h: HarnessId, hooks: Record<string, AgentProfileHookCommand[]>, add: AddPlanFile, unsupported: (d: Unsupported["dimension"], r: string) => void, plan: WorkspacePlan): void;
|
|
2
2
|
export declare function registerClaudeSettings(plan: WorkspacePlan): void;
|
|
3
|
-
export declare function hookWrapperSource(executable: string, args: string[],
|
|
3
|
+
export declare function hookWrapperSource(executable: string, args: string[], extraEnv: Record<string, string>, envSources?: Record<string, string>): string;
|
|
4
4
|
import type { AgentProfileHookCommand } from "@tangle-network/agent-interface";
|
|
5
5
|
import type { AddPlanFile } from "./plan-json.js";
|
|
6
6
|
import type { HarnessId, Unsupported, WorkspacePlan } from "./plan-types.js";
|
package/dist/hooks.js
CHANGED
|
@@ -195,47 +195,36 @@ function materializedHookCommand(event, command, add, plan) {
|
|
|
195
195
|
setPlanEnvironment(plan, sourceName, value);
|
|
196
196
|
return [name, sourceName];
|
|
197
197
|
}));
|
|
198
|
-
add(path,
|
|
198
|
+
add(path, hookWrapperSource("/bin/sh", ["-c", command.command], {}, envSources));
|
|
199
199
|
return `node ${path}`;
|
|
200
200
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
" if (value === undefined) {",
|
|
211
|
-
' console.error("missing materialized hook environment " + source)',
|
|
212
|
-
" process.exit(127)",
|
|
213
|
-
" }",
|
|
214
|
-
" extraEnv[name] = value",
|
|
215
|
-
"}",
|
|
216
|
-
"const result = spawnSync(executable, args, {",
|
|
217
|
-
' stdio: "inherit",',
|
|
218
|
-
" env: { ...process.env, ...extraEnv },",
|
|
219
|
-
" shell: false,",
|
|
220
|
-
"})",
|
|
221
|
-
"if (result.error) {",
|
|
222
|
-
" console.error(result.error.message)",
|
|
223
|
-
" process.exit(127)",
|
|
224
|
-
"}",
|
|
225
|
-
"if (result.signal) {",
|
|
226
|
-
' console.error("hook terminated by " + result.signal)',
|
|
227
|
-
" process.exit(1)",
|
|
228
|
-
"}",
|
|
229
|
-
"process.exit(result.status ?? 1)",
|
|
230
|
-
"",
|
|
231
|
-
].join("\n");
|
|
232
|
-
}
|
|
233
|
-
export function hookWrapperSource(executable, args, env) {
|
|
201
|
+
// Classic plan env accepts string | AgentProfileConfigValue (public | secretRef)
|
|
202
|
+
// in profile-plan.ts: keep resolved secrets out of workspace files by carrying
|
|
203
|
+
// source names and resolving at runtime, failing closed with 127 when missing.
|
|
204
|
+
// candidatePublicString rejects non-public values, so candidates inline them
|
|
205
|
+
// to keep sealed bundles self-contained without a runtime environment channel.
|
|
206
|
+
export function hookWrapperSource(executable, args, extraEnv, envSources) {
|
|
207
|
+
if (envSources !== undefined && Object.keys(extraEnv).length > 0) {
|
|
208
|
+
throw new Error("Hook wrapper cannot mix inline environment values and sources");
|
|
209
|
+
}
|
|
234
210
|
return [
|
|
235
211
|
'import { spawnSync } from "node:child_process"',
|
|
236
212
|
`const executable = ${JSON.stringify(executable)}`,
|
|
237
213
|
`const args = ${JSON.stringify(args)}`,
|
|
238
|
-
|
|
214
|
+
...(envSources === undefined
|
|
215
|
+
? [`const extraEnv = ${JSON.stringify(extraEnv)}`]
|
|
216
|
+
: [
|
|
217
|
+
`const envSources = ${JSON.stringify(envSources)}`,
|
|
218
|
+
"const extraEnv = {}",
|
|
219
|
+
"for (const [name, source] of Object.entries(envSources)) {",
|
|
220
|
+
" const value = process.env[source]",
|
|
221
|
+
" if (value === undefined) {",
|
|
222
|
+
' console.error("missing materialized hook environment " + source)',
|
|
223
|
+
" process.exit(127)",
|
|
224
|
+
" }",
|
|
225
|
+
" extraEnv[name] = value",
|
|
226
|
+
"}",
|
|
227
|
+
]),
|
|
239
228
|
"const result = spawnSync(executable, args, {",
|
|
240
229
|
' stdio: "inherit",',
|
|
241
230
|
" env: { ...process.env, ...extraEnv },",
|
package/dist/plan-types.d.ts
CHANGED
|
@@ -267,7 +267,7 @@ export interface WorkspacePlanReceipt {
|
|
|
267
267
|
systemPromptBinding?: WorkspacePlanSystemPromptBinding;
|
|
268
268
|
unsupported: Unsupported[];
|
|
269
269
|
/**
|
|
270
|
-
*
|
|
270
|
+
* Workspace-root paths, for consumers that mount the workspace only.
|
|
271
271
|
* Agent-root files are available in `writtenFiles` and are never encoded as
|
|
272
272
|
* an `agent:` path because that spelling is legal in the workspace root.
|
|
273
273
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-profile-materialize",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
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": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@tangle-network/agent-interface": "^5.10.2"
|
|
36
36
|
},
|
|
37
37
|
"tangleRelease": {
|
|
38
|
-
"sourceSha": "
|
|
39
|
-
"mergedAt": "2026-10-
|
|
38
|
+
"sourceSha": "317182be2d49d5ca117256b3c807d12ad023a844",
|
|
39
|
+
"mergedAt": "2026-10-29T05:44:32-06:00"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "tsc -p tsconfig.json",
|