pi-fabric 0.92.11 → 0.92.13
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/agents/constants.d.ts +4 -0
- package/dist/agents/constants.d.ts.map +1 -1
- package/dist/agents/manager.d.ts.map +1 -1
- package/dist/agents/types.d.ts +12 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents.js +2 -2
- package/dist/chunks/{chunk-YDM3MYCO.js → chunk-AYBIR4YV.js} +3 -1
- package/dist/chunks/chunk-AYBIR4YV.js.map +7 -0
- package/dist/chunks/{chunk-6IFKG3XW.js → chunk-DLYYHK6Z.js} +147 -6
- package/dist/chunks/chunk-DLYYHK6Z.js.map +7 -0
- package/dist/chunks/{chunk-RBJCUU6I.js → chunk-EZ7YLET5.js} +2 -2
- package/dist/chunks/{chunk-RBJCUU6I.js.map → chunk-EZ7YLET5.js.map} +2 -2
- package/dist/chunks/{chunk-6JXOWBFU.js → chunk-FN6Q4R4M.js} +3 -1
- package/dist/chunks/chunk-FN6Q4R4M.js.map +7 -0
- package/dist/chunks/{chunk-XXIGW2NG.js → chunk-HUCNOAKK.js} +2 -2
- package/dist/chunks/{chunk-AAXQR7SZ.js → chunk-OAXSWVOB.js} +2 -2
- package/dist/chunks/{chunk-TNPFEDWD.js → chunk-R4AZTYXC.js} +4 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +4 -4
- package/dist/index.js +2 -2
- package/dist/lifecycle/types.d.ts +1 -1
- package/dist/lifecycle/types.d.ts.map +1 -1
- package/dist/residency/host.js +4 -4
- package/dist/residency/pi-entry.js +4 -4
- package/dist/runtime/core-override-guest-types.js +2 -2
- package/dist/runtime/guest-types.d.ts +1 -1
- package/dist/runtime/guest-types.d.ts.map +1 -1
- package/dist/runtime/guest-types.js +1 -1
- package/dist/runtime/monty-runtime.js +1 -1
- package/dist/runtime/typescript-kernel.js +2 -2
- package/dist/ui/border-status-editor.d.ts +22 -0
- package/dist/ui/border-status-editor.d.ts.map +1 -0
- package/dist/ui/conversation.d.ts +3 -0
- package/dist/ui/conversation.d.ts.map +1 -1
- package/dist/ui/conversation.js +89 -24
- package/dist/ui/conversation.js.map +4 -4
- package/dist/ui/settings.js +1 -1
- package/dist/worker/options.d.ts.map +1 -1
- package/dist/worker/options.js +32 -0
- package/dist/worker/options.js.map +2 -2
- package/dist/worker/run-record.js +3 -3
- package/dist/worker/run-record.js.map +2 -2
- package/docs/agents.md +2 -2
- package/docs/certification.md +1 -1
- package/docs/configuration.md +2 -2
- package/docs/provider-component-calculus.md +1 -1
- package/package.json +5 -5
- package/skillsets/python/fabric-schema/SKILL.md +1 -1
- package/skillsets/typescript/fabric-exec/SKILL.md +1 -1
- package/skillsets/typescript/fabric-exec/references/agents.md +1 -1
- package/dist/chunks/chunk-6IFKG3XW.js.map +0 -7
- package/dist/chunks/chunk-6JXOWBFU.js.map +0 -7
- package/dist/chunks/chunk-YDM3MYCO.js.map +0 -7
- /package/dist/chunks/{chunk-XXIGW2NG.js.map → chunk-HUCNOAKK.js.map} +0 -0
- /package/dist/chunks/{chunk-AAXQR7SZ.js.map → chunk-OAXSWVOB.js.map} +0 -0
- /package/dist/chunks/{chunk-TNPFEDWD.js.map → chunk-R4AZTYXC.js.map} +0 -0
package/dist/ui/settings.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
loadFabricConfigForScope,
|
|
25
25
|
maxExecutorMemoryLimitBytes,
|
|
26
26
|
saveFabricConfig
|
|
27
|
-
} from "../chunks/chunk-
|
|
27
|
+
} from "../chunks/chunk-EZ7YLET5.js";
|
|
28
28
|
import "../chunks/chunk-OKOHRXGF.js";
|
|
29
29
|
import "../chunks/chunk-KAD7UWT2.js";
|
|
30
30
|
import "../chunks/chunk-YU62DDKK.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/worker/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/worker/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AA4DhF,eAAO,MAAM,kBAAkB,GAC7B,OAAM,SAAS,MAAM,EAAiB,KACrC,kBAgIF,CAAC"}
|
package/dist/worker/options.js
CHANGED
|
@@ -17,6 +17,27 @@ var required = (args, name) => {
|
|
|
17
17
|
return value;
|
|
18
18
|
};
|
|
19
19
|
var optional = (args, name) => args.get(name) || void 0;
|
|
20
|
+
var nonNegative = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
21
|
+
var carryOverTotals = (value) => {
|
|
22
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
23
|
+
const source = value;
|
|
24
|
+
const usage = typeof source.usage === "object" && source.usage !== null && !Array.isArray(source.usage) ? source.usage : void 0;
|
|
25
|
+
const turns = nonNegative(source.turns);
|
|
26
|
+
const toolCalls = nonNegative(source.toolCalls);
|
|
27
|
+
const input = usage ? nonNegative(usage.input) : void 0;
|
|
28
|
+
const output = usage ? nonNegative(usage.output) : void 0;
|
|
29
|
+
const cacheRead = usage ? nonNegative(usage.cacheRead) : void 0;
|
|
30
|
+
const cacheWrite = usage ? nonNegative(usage.cacheWrite) : void 0;
|
|
31
|
+
const cost = usage ? nonNegative(usage.cost) : void 0;
|
|
32
|
+
if (turns === void 0 || toolCalls === void 0 || input === void 0 || output === void 0 || cacheRead === void 0 || cacheWrite === void 0 || cost === void 0) {
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
turns: Math.floor(turns),
|
|
37
|
+
toolCalls: Math.floor(toolCalls),
|
|
38
|
+
usage: { input, output, cacheRead, cacheWrite, cost }
|
|
39
|
+
};
|
|
40
|
+
};
|
|
20
41
|
var parseWorkerOptions = (argv = process.argv) => {
|
|
21
42
|
const args = argumentMap(argv);
|
|
22
43
|
const model = optional(args, "model");
|
|
@@ -44,12 +65,22 @@ var parseWorkerOptions = (argv = process.argv) => {
|
|
|
44
65
|
const branch = optional(args, "branch");
|
|
45
66
|
const worktree = optional(args, "worktree");
|
|
46
67
|
const maxTokens = optional(args, "max-tokens");
|
|
68
|
+
const carryOverSource = optional(args, "carry-over");
|
|
47
69
|
const runnerSessionId = optional(args, "runner-session-id");
|
|
48
70
|
const inheritedSessionPinsSource = optional(args, "inherited-session-pins");
|
|
49
71
|
const inheritedSessionPins = inheritedSessionPinsSource ? JSON.parse(inheritedSessionPinsSource) : void 0;
|
|
50
72
|
if (inheritedSessionPinsSource !== void 0 && (!Array.isArray(inheritedSessionPins) || inheritedSessionPins.length === 0 || inheritedSessionPins.some((pin) => typeof pin?.pool !== "string" || pin.pool.trim() === ""))) {
|
|
51
73
|
throw new Error("Invalid worker inherited session pins");
|
|
52
74
|
}
|
|
75
|
+
let carryOver;
|
|
76
|
+
if (carryOverSource) {
|
|
77
|
+
try {
|
|
78
|
+
carryOver = carryOverTotals(JSON.parse(carryOverSource));
|
|
79
|
+
} catch {
|
|
80
|
+
carryOver = void 0;
|
|
81
|
+
}
|
|
82
|
+
if (!carryOver) throw new Error("Invalid worker carry-over");
|
|
83
|
+
}
|
|
53
84
|
const mainAgentId = optional(args, "main-agent-id");
|
|
54
85
|
const fabricSessionId = optional(args, "fabric-session-id");
|
|
55
86
|
const runner = required(args, "runner");
|
|
@@ -115,6 +146,7 @@ var parseWorkerOptions = (argv = process.argv) => {
|
|
|
115
146
|
...branch ? { branch } : {},
|
|
116
147
|
...worktree ? { worktree } : {},
|
|
117
148
|
...maxTokens ? { maxTokens: Number(maxTokens) } : {},
|
|
149
|
+
...carryOver ? { carryOver } : {},
|
|
118
150
|
...inheritedSessionPins && inheritedSessionPins.length > 0 ? { inheritedSessionPins } : {}
|
|
119
151
|
};
|
|
120
152
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/worker/options.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AgentWorkerOptions } from \"../agents/types.js\";\n\nconst argumentMap = (argv: readonly string[]): Map<string, string> => {\n const result = new Map<string, string>();\n for (let index = 2; index < argv.length; index += 2) {\n const key = argv[index];\n const value = argv[index + 1];\n if (!key?.startsWith(\"--\") || value === undefined) {\n throw new Error(`Invalid worker argument near ${key ?? \"<end>\"}`);\n }\n result.set(key.slice(2), value);\n }\n return result;\n};\n\nconst required = (args: Map<string, string>, name: string): string => {\n const value = args.get(name);\n if (!value) throw new Error(`Missing worker argument: --${name}`);\n return value;\n};\n\nconst optional = (args: Map<string, string>, name: string): string | undefined =>\n args.get(name) || undefined;\n\nexport const parseWorkerOptions = (\n argv: readonly string[] = process.argv,\n): AgentWorkerOptions => {\n const args = argumentMap(argv);\n const model = optional(args, \"model\");\n const thinking = optional(args, \"thinking\");\n const fabricExtensionPath = optional(args, \"fabric-extension\");\n const schemaFile = optional(args, \"schema-file\");\n const imagesFile = optional(args, \"images-file\");\n const systemPrompt = optional(args, \"system-prompt\");\n const sessionFile = optional(args, \"session-file\");\n const sessionExportFile = optional(args, \"session-export-file\");\n const actorId = optional(args, \"actor-id\");\n const actorName = optional(args, \"actor-name\");\n const capabilityRequirementsSource = optional(args, \"capability-requirements\");\n const capabilityDigest = optional(args, \"capability-digest\");\n const capabilityRequirements = capabilityRequirementsSource\n ? JSON.parse(capabilityRequirementsSource) as unknown\n : undefined;\n if (\n capabilityRequirements !== undefined &&\n (!Array.isArray(capabilityRequirements) ||\n capabilityRequirements.length > 128 ||\n capabilityRequirements.some((ref) => typeof ref !== \"string\" || ref.length > 256 || !ref.includes(\".\")))\n ) {\n throw new Error(\"Invalid worker capability requirements\");\n }\n const meshRoot = optional(args, \"mesh-root\");\n const projectRoot = optional(args, \"project-root\");\n const ownerHostId = optional(args, \"owner-host-id\");\n const ownerIdentityId = optional(args, \"owner-identity-id\");\n const runRoot = optional(args, \"run-root\");\n const steerFile = optional(args, \"steer-file\");\n const branch = optional(args, \"branch\");\n const worktree = optional(args, \"worktree\");\n const maxTokens = optional(args, \"max-tokens\");\n const runnerSessionId = optional(args, \"runner-session-id\");\n const inheritedSessionPinsSource = optional(args, \"inherited-session-pins\");\n const inheritedSessionPins = inheritedSessionPinsSource\n ? JSON.parse(inheritedSessionPinsSource) as AgentWorkerOptions[\"inheritedSessionPins\"]\n : undefined;\n if (\n inheritedSessionPinsSource !== undefined &&\n (!Array.isArray(inheritedSessionPins) ||\n inheritedSessionPins.length === 0 ||\n inheritedSessionPins.some((pin) => typeof pin?.pool !== \"string\" || pin.pool.trim() === \"\"))\n ) {\n throw new Error(\"Invalid worker inherited session pins\");\n }\n const mainAgentId = optional(args, \"main-agent-id\");\n const fabricSessionId = optional(args, \"fabric-session-id\");\n const runner = required(args, \"runner\");\n if (runner !== \"pi\" && runner !== \"claude\" && runner !== \"veda\") {\n throw new Error(`Unsupported Fabric agent runner: ${runner}`);\n }\n const extensions = required(args, \"extensions\") === \"true\";\n const selectedKernel = args.get(\"kernel\");\n const pythonRuntime = args.get(\"python-runtime\") ?? \"monty\";\n if (pythonRuntime !== \"cpython\" && pythonRuntime !== \"monty\") {\n throw new Error(`Invalid worker Python runtime: ${pythonRuntime}`);\n }\n if (selectedKernel !== undefined && selectedKernel !== \"typescript\" && selectedKernel !== \"python\") {\n throw new Error(`Invalid worker kernel: ${selectedKernel}`);\n }\n if (selectedKernel !== undefined && (runner !== \"pi\" || !extensions)) {\n throw new Error(\"Explicit worker kernel requires the Pi runner with Fabric extensions enabled\");\n }\n // Old launchers had no flag and always used TypeScript, regardless of ambient env.\n const kernel = runner === \"pi\" && extensions ? selectedKernel ?? \"typescript\" : undefined;\n return {\n id: required(args, \"id\"),\n runner,\n ...(kernel ? { kernel, pythonRuntime } : {}),\n name: required(args, \"name\"),\n taskFile: required(args, \"task-file\"),\n ...(imagesFile ? { imagesFile } : {}),\n statusFile: required(args, \"status-file\"),\n lifecycleFile: required(args, \"lifecycle-file\"),\n logFile: required(args, \"log-file\"),\n ...(schemaFile ? { schemaFile } : {}),\n cwd: required(args, \"cwd\"),\n piBinary: required(args, \"pi-binary\"),\n claudeBinary: required(args, \"claude-binary\"),\n vedaBinary: required(args, \"veda-binary\"),\n vedaBackend: required(args, \"veda-backend\"),\n vedaPersona: required(args, \"veda-persona\"),\n timeoutMs: Number(required(args, \"timeout-ms\")),\n depth: Number(required(args, \"depth\")),\n fullCodeMode: required(args, \"full-code-mode\") === \"true\",\n ...(mainAgentId ? { mainAgentId } : {}),\n ...(fabricSessionId ? { fabricSessionId } : {}),\n extensions,\n tools: JSON.parse(required(args, \"tools\")) as string[],\n grantedRisks: JSON.parse(required(args, \"granted-risks\")) as string[],\n transport: required(args, \"transport\") as AgentWorkerOptions[\"transport\"],\n ...(fabricExtensionPath ? { fabricExtensionPath } : {}),\n ...(model ? { model } : {}),\n ...(thinking ? { thinking } : {}),\n ...(systemPrompt ? { systemPrompt } : {}),\n ...(sessionFile ? { sessionFile } : {}),\n ...(sessionExportFile ? { sessionExportFile } : {}),\n ...(actorId ? { actorId } : {}),\n ...(actorName ? { actorName } : {}),\n ...(capabilityRequirements\n ? { capabilityRequirements: [...new Set(capabilityRequirements as string[])] }\n : {}),\n ...(capabilityDigest ? { capabilityDigest } : {}),\n ...(meshRoot ? { meshRoot } : {}),\n ...(projectRoot ? { projectRoot } : {}),\n ...(ownerHostId ? { ownerHostId } : {}),\n ...(ownerIdentityId ? { ownerIdentityId } : {}),\n ...(runnerSessionId ? { runnerSessionId } : {}),\n ...(runRoot ? { runRoot } : {}),\n ...(steerFile ? { steerFile } : {}),\n ...(branch ? { branch } : {}),\n ...(worktree ? { worktree } : {}),\n ...(maxTokens ? { maxTokens: Number(maxTokens) } : {}),\n ...(inheritedSessionPins && inheritedSessionPins.length > 0 ? { inheritedSessionPins } : {}),\n };\n};\n"],
|
|
5
|
-
"mappings": ";AAEA,IAAM,cAAc,CAAC,SAAiD;AACpE,QAAM,SAAS,oBAAI,IAAoB;AACvC,WAAS,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS,GAAG;AACnD,UAAM,MAAM,KAAK,KAAK;AACtB,UAAM,QAAQ,KAAK,QAAQ,CAAC;AAC5B,QAAI,CAAC,KAAK,WAAW,IAAI,KAAK,UAAU,QAAW;AACjD,YAAM,IAAI,MAAM,gCAAgC,OAAO,OAAO,EAAE;AAAA,IAClE;AACA,WAAO,IAAI,IAAI,MAAM,CAAC,GAAG,KAAK;AAAA,EAChC;AACA,SAAO;AACT;AAEA,IAAM,WAAW,CAAC,MAA2B,SAAyB;AACpE,QAAM,QAAQ,KAAK,IAAI,IAAI;AAC3B,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,8BAA8B,IAAI,EAAE;AAChE,SAAO;AACT;AAEA,IAAM,WAAW,CAAC,MAA2B,SAC3C,KAAK,IAAI,IAAI,KAAK;
|
|
4
|
+
"sourcesContent": ["import type { AgentRunCarryOver, AgentWorkerOptions } from \"../agents/types.js\";\n\nconst argumentMap = (argv: readonly string[]): Map<string, string> => {\n const result = new Map<string, string>();\n for (let index = 2; index < argv.length; index += 2) {\n const key = argv[index];\n const value = argv[index + 1];\n if (!key?.startsWith(\"--\") || value === undefined) {\n throw new Error(`Invalid worker argument near ${key ?? \"<end>\"}`);\n }\n result.set(key.slice(2), value);\n }\n return result;\n};\n\nconst required = (args: Map<string, string>, name: string): string => {\n const value = args.get(name);\n if (!value) throw new Error(`Missing worker argument: --${name}`);\n return value;\n};\n\nconst optional = (args: Map<string, string>, name: string): string | undefined =>\n args.get(name) || undefined;\n\nconst nonNegative = (value: unknown): number | undefined =>\n typeof value === \"number\" && Number.isFinite(value) && value >= 0 ? value : undefined;\n\n/** Cumulative totals a relaunched attempt seeds its fresh run record with. */\nconst carryOverTotals = (value: unknown): AgentRunCarryOver | undefined => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined;\n const source = value as Record<string, unknown>;\n const usage =\n typeof source.usage === \"object\" && source.usage !== null && !Array.isArray(source.usage)\n ? (source.usage as Record<string, unknown>)\n : undefined;\n const turns = nonNegative(source.turns);\n const toolCalls = nonNegative(source.toolCalls);\n const input = usage ? nonNegative(usage.input) : undefined;\n const output = usage ? nonNegative(usage.output) : undefined;\n const cacheRead = usage ? nonNegative(usage.cacheRead) : undefined;\n const cacheWrite = usage ? nonNegative(usage.cacheWrite) : undefined;\n const cost = usage ? nonNegative(usage.cost) : undefined;\n if (\n turns === undefined ||\n toolCalls === undefined ||\n input === undefined ||\n output === undefined ||\n cacheRead === undefined ||\n cacheWrite === undefined ||\n cost === undefined\n ) {\n return undefined;\n }\n return {\n turns: Math.floor(turns),\n toolCalls: Math.floor(toolCalls),\n usage: { input, output, cacheRead, cacheWrite, cost },\n };\n};\n\nexport const parseWorkerOptions = (\n argv: readonly string[] = process.argv,\n): AgentWorkerOptions => {\n const args = argumentMap(argv);\n const model = optional(args, \"model\");\n const thinking = optional(args, \"thinking\");\n const fabricExtensionPath = optional(args, \"fabric-extension\");\n const schemaFile = optional(args, \"schema-file\");\n const imagesFile = optional(args, \"images-file\");\n const systemPrompt = optional(args, \"system-prompt\");\n const sessionFile = optional(args, \"session-file\");\n const sessionExportFile = optional(args, \"session-export-file\");\n const actorId = optional(args, \"actor-id\");\n const actorName = optional(args, \"actor-name\");\n const capabilityRequirementsSource = optional(args, \"capability-requirements\");\n const capabilityDigest = optional(args, \"capability-digest\");\n const capabilityRequirements = capabilityRequirementsSource\n ? JSON.parse(capabilityRequirementsSource) as unknown\n : undefined;\n if (\n capabilityRequirements !== undefined &&\n (!Array.isArray(capabilityRequirements) ||\n capabilityRequirements.length > 128 ||\n capabilityRequirements.some((ref) => typeof ref !== \"string\" || ref.length > 256 || !ref.includes(\".\")))\n ) {\n throw new Error(\"Invalid worker capability requirements\");\n }\n const meshRoot = optional(args, \"mesh-root\");\n const projectRoot = optional(args, \"project-root\");\n const ownerHostId = optional(args, \"owner-host-id\");\n const ownerIdentityId = optional(args, \"owner-identity-id\");\n const runRoot = optional(args, \"run-root\");\n const steerFile = optional(args, \"steer-file\");\n const branch = optional(args, \"branch\");\n const worktree = optional(args, \"worktree\");\n const maxTokens = optional(args, \"max-tokens\");\n const carryOverSource = optional(args, \"carry-over\");\n const runnerSessionId = optional(args, \"runner-session-id\");\n const inheritedSessionPinsSource = optional(args, \"inherited-session-pins\");\n const inheritedSessionPins = inheritedSessionPinsSource\n ? JSON.parse(inheritedSessionPinsSource) as AgentWorkerOptions[\"inheritedSessionPins\"]\n : undefined;\n if (\n inheritedSessionPinsSource !== undefined &&\n (!Array.isArray(inheritedSessionPins) ||\n inheritedSessionPins.length === 0 ||\n inheritedSessionPins.some((pin) => typeof pin?.pool !== \"string\" || pin.pool.trim() === \"\"))\n ) {\n throw new Error(\"Invalid worker inherited session pins\");\n }\n let carryOver: AgentRunCarryOver | undefined;\n if (carryOverSource) {\n try {\n carryOver = carryOverTotals(JSON.parse(carryOverSource));\n } catch {\n carryOver = undefined;\n }\n if (!carryOver) throw new Error(\"Invalid worker carry-over\");\n }\n const mainAgentId = optional(args, \"main-agent-id\");\n const fabricSessionId = optional(args, \"fabric-session-id\");\n const runner = required(args, \"runner\");\n if (runner !== \"pi\" && runner !== \"claude\" && runner !== \"veda\") {\n throw new Error(`Unsupported Fabric agent runner: ${runner}`);\n }\n const extensions = required(args, \"extensions\") === \"true\";\n const selectedKernel = args.get(\"kernel\");\n const pythonRuntime = args.get(\"python-runtime\") ?? \"monty\";\n if (pythonRuntime !== \"cpython\" && pythonRuntime !== \"monty\") {\n throw new Error(`Invalid worker Python runtime: ${pythonRuntime}`);\n }\n if (selectedKernel !== undefined && selectedKernel !== \"typescript\" && selectedKernel !== \"python\") {\n throw new Error(`Invalid worker kernel: ${selectedKernel}`);\n }\n if (selectedKernel !== undefined && (runner !== \"pi\" || !extensions)) {\n throw new Error(\"Explicit worker kernel requires the Pi runner with Fabric extensions enabled\");\n }\n // Old launchers had no flag and always used TypeScript, regardless of ambient env.\n const kernel = runner === \"pi\" && extensions ? selectedKernel ?? \"typescript\" : undefined;\n return {\n id: required(args, \"id\"),\n runner,\n ...(kernel ? { kernel, pythonRuntime } : {}),\n name: required(args, \"name\"),\n taskFile: required(args, \"task-file\"),\n ...(imagesFile ? { imagesFile } : {}),\n statusFile: required(args, \"status-file\"),\n lifecycleFile: required(args, \"lifecycle-file\"),\n logFile: required(args, \"log-file\"),\n ...(schemaFile ? { schemaFile } : {}),\n cwd: required(args, \"cwd\"),\n piBinary: required(args, \"pi-binary\"),\n claudeBinary: required(args, \"claude-binary\"),\n vedaBinary: required(args, \"veda-binary\"),\n vedaBackend: required(args, \"veda-backend\"),\n vedaPersona: required(args, \"veda-persona\"),\n timeoutMs: Number(required(args, \"timeout-ms\")),\n depth: Number(required(args, \"depth\")),\n fullCodeMode: required(args, \"full-code-mode\") === \"true\",\n ...(mainAgentId ? { mainAgentId } : {}),\n ...(fabricSessionId ? { fabricSessionId } : {}),\n extensions,\n tools: JSON.parse(required(args, \"tools\")) as string[],\n grantedRisks: JSON.parse(required(args, \"granted-risks\")) as string[],\n transport: required(args, \"transport\") as AgentWorkerOptions[\"transport\"],\n ...(fabricExtensionPath ? { fabricExtensionPath } : {}),\n ...(model ? { model } : {}),\n ...(thinking ? { thinking } : {}),\n ...(systemPrompt ? { systemPrompt } : {}),\n ...(sessionFile ? { sessionFile } : {}),\n ...(sessionExportFile ? { sessionExportFile } : {}),\n ...(actorId ? { actorId } : {}),\n ...(actorName ? { actorName } : {}),\n ...(capabilityRequirements\n ? { capabilityRequirements: [...new Set(capabilityRequirements as string[])] }\n : {}),\n ...(capabilityDigest ? { capabilityDigest } : {}),\n ...(meshRoot ? { meshRoot } : {}),\n ...(projectRoot ? { projectRoot } : {}),\n ...(ownerHostId ? { ownerHostId } : {}),\n ...(ownerIdentityId ? { ownerIdentityId } : {}),\n ...(runnerSessionId ? { runnerSessionId } : {}),\n ...(runRoot ? { runRoot } : {}),\n ...(steerFile ? { steerFile } : {}),\n ...(branch ? { branch } : {}),\n ...(worktree ? { worktree } : {}),\n ...(maxTokens ? { maxTokens: Number(maxTokens) } : {}),\n ...(carryOver ? { carryOver } : {}),\n ...(inheritedSessionPins && inheritedSessionPins.length > 0 ? { inheritedSessionPins } : {}),\n };\n};\n"],
|
|
5
|
+
"mappings": ";AAEA,IAAM,cAAc,CAAC,SAAiD;AACpE,QAAM,SAAS,oBAAI,IAAoB;AACvC,WAAS,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS,GAAG;AACnD,UAAM,MAAM,KAAK,KAAK;AACtB,UAAM,QAAQ,KAAK,QAAQ,CAAC;AAC5B,QAAI,CAAC,KAAK,WAAW,IAAI,KAAK,UAAU,QAAW;AACjD,YAAM,IAAI,MAAM,gCAAgC,OAAO,OAAO,EAAE;AAAA,IAClE;AACA,WAAO,IAAI,IAAI,MAAM,CAAC,GAAG,KAAK;AAAA,EAChC;AACA,SAAO;AACT;AAEA,IAAM,WAAW,CAAC,MAA2B,SAAyB;AACpE,QAAM,QAAQ,KAAK,IAAI,IAAI;AAC3B,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,8BAA8B,IAAI,EAAE;AAChE,SAAO;AACT;AAEA,IAAM,WAAW,CAAC,MAA2B,SAC3C,KAAK,IAAI,IAAI,KAAK;AAEpB,IAAM,cAAc,CAAC,UACnB,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,SAAS,IAAI,QAAQ;AAG9E,IAAM,kBAAkB,CAAC,UAAkD;AACzE,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,EAAG,QAAO;AAChF,QAAM,SAAS;AACf,QAAM,QACJ,OAAO,OAAO,UAAU,YAAY,OAAO,UAAU,QAAQ,CAAC,MAAM,QAAQ,OAAO,KAAK,IACnF,OAAO,QACR;AACN,QAAM,QAAQ,YAAY,OAAO,KAAK;AACtC,QAAM,YAAY,YAAY,OAAO,SAAS;AAC9C,QAAM,QAAQ,QAAQ,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EAAE,SAAS,IAAI,CAAC;AAAA,IAC/B,GAAI,YAAY,EAAE,WAAW,OAAO,SAAS,EAAE,IAAI,CAAC;AAAA,IACpD,GAAI,YAAY,EAAE,UAAU,IAAI,CAAC;AAAA,IACjC,GAAI,wBAAwB,qBAAqB,SAAS,IAAI,EAAE,qBAAqB,IAAI,CAAC;AAAA,EAC5F;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -27,10 +27,10 @@ var createRunningRecord = (options, task, thinking, startedAt) => ({
|
|
|
27
27
|
...options.capabilityDigest ? { capabilityDigest: options.capabilityDigest } : {},
|
|
28
28
|
startedAt,
|
|
29
29
|
updatedAt: startedAt,
|
|
30
|
-
turns: 0,
|
|
31
|
-
toolCalls: 0,
|
|
30
|
+
turns: options.carryOver?.turns ?? 0,
|
|
31
|
+
toolCalls: options.carryOver?.toolCalls ?? 0,
|
|
32
32
|
text: "",
|
|
33
|
-
usage: emptyUsage(),
|
|
33
|
+
usage: options.carryOver?.usage ?? emptyUsage(),
|
|
34
34
|
logFile: options.logFile,
|
|
35
35
|
...options.branch ? { branch: options.branch } : {},
|
|
36
36
|
...options.worktree ? { worktree: options.worktree } : {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/worker/run-record.ts"],
|
|
4
|
-
"sourcesContent": ["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type {\n AgentRunRecord,\n AgentUsage,\n AgentWorkerOptions,\n} from \"../agents/types.js\";\n\nconst MAX_RUN_ERROR_CHARS = 20_000;\nconst MAX_RUN_TEXT_CHARS = 100_000;\n\nexport const emptyUsage = (): AgentUsage => ({\n input: 0,\n output: 0,\n cacheRead: 0,\n cacheWrite: 0,\n cost: 0,\n});\n\nexport const createRunningRecord = (\n options: AgentWorkerOptions,\n task: string,\n thinking: AgentRunRecord[\"thinking\"],\n startedAt: number,\n): AgentRunRecord => ({\n id: options.id,\n name: options.name,\n task,\n status: \"running\",\n runner: options.runner,\n ...(options.kernel ? { kernel: options.kernel } : {}),\n transport: options.transport,\n cwd: options.cwd,\n ...(options.model ? { model: options.model, requestedModel: options.model } : {}),\n ...(thinking ? { thinking } : {}),\n ...(options.actorId ? { actorId: options.actorId } : {}),\n ...(options.actorName ? { actorName: options.actorName } : {}),\n ...(options.capabilityRequirements\n ? { capabilityRequirements: [...options.capabilityRequirements] }\n : {}),\n ...(options.capabilityDigest ? { capabilityDigest: options.capabilityDigest } : {}),\n startedAt,\n updatedAt: startedAt,\n turns: 0,\n toolCalls: 0,\n text: \"\",\n usage: emptyUsage(),\n logFile: options.logFile,\n ...(options.branch ? { branch: options.branch } : {}),\n ...(options.worktree ? { worktree: options.worktree } : {}),\n});\n\nexport const writeRunRecord = (filePath: string, record: AgentRunRecord): void => {\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n const temporaryPath = `${filePath}.${process.pid}.tmp`;\n fs.writeFileSync(temporaryPath, JSON.stringify(record, null, 2), {\n encoding: \"utf8\",\n mode: 0o600,\n });\n renameWithRetry(temporaryPath, filePath);\n};\n\n// Windows transiently rejects rename() with EPERM/EACCES/EEXIST/EBUSY while\n// an antivirus scan or sibling reader probes the destination file \u2014\n// milliseconds of contention, not policy. Retry a bounded linear backoff\n// before surfacing.\n//\n// Self-contained on purpose: this module is dynamically imported by the\n// spawned worker through plain Node with worker.ts switching the import\n// extension, so it must not depend on ../core/atomic-write.js. Keep the shared\n// implementation for the host side and this copy for the worker boundary.\nconst RETRYABLE_RENAME_CODES = new Set([\"EPERM\", \"EACCES\", \"EEXIST\", \"EBUSY\"]);\n\nconst syncSleep = (ms: number): void => {\n try {\n const buffer = new Int32Array(new SharedArrayBuffer(4));\n Atomics.wait(buffer, 0, 0, ms);\n } catch {\n // Atomics.wait unavailable: retry immediately \u2014 correct, just busier.\n }\n};\n\nconst renameWithRetry = (source: string, target: string): void => {\n for (let attempt = 1; ; attempt++) {\n try {\n fs.renameSync(source, target);\n return;\n } catch (error) {\n const code =\n typeof error === \"object\" && error !== null && \"code\" in error\n ? String((error as { code?: unknown }).code)\n : undefined;\n if (attempt >= 8 || code === undefined || !RETRYABLE_RENAME_CODES.has(code)) {\n throw error;\n }\n syncSleep(25 * attempt);\n }\n }\n};\n\nexport const updateRunRecord = (filePath: string, record: AgentRunRecord): void => {\n record.updatedAt = Date.now();\n writeRunRecord(filePath, record);\n};\n\nexport const writeCrashRunRecord = (\n filePath: string,\n record: AgentRunRecord,\n error: unknown,\n): void => {\n const reason = error instanceof Error ? error.message : String(error);\n const crashed: AgentRunRecord = {\n ...record,\n status: \"failed\",\n error: `Worker crashed before reporting a result: ${reason}`.slice(0, MAX_RUN_ERROR_CHARS),\n finishedAt: Date.now(),\n updatedAt: Date.now(),\n };\n delete crashed.currentTool;\n writeRunRecord(filePath, crashed);\n};\n\nconst numberField = (value: unknown): number => (typeof value === \"number\" ? value : 0);\n\nexport const applyUsage = (\n record: AgentRunRecord,\n message: Record<string, unknown>,\n): void => {\n const usage = message.usage;\n if (typeof usage !== \"object\" || usage === null) return;\n const values = usage as Record<string, unknown>;\n record.usage.input += numberField(values.input);\n record.usage.output += numberField(values.output);\n record.usage.cacheRead += numberField(values.cacheRead);\n record.usage.cacheWrite += numberField(values.cacheWrite);\n const cost = values.cost;\n if (typeof cost === \"number\") record.usage.cost += cost;\n if (typeof cost === \"object\" && cost !== null) {\n record.usage.cost += numberField((cost as Record<string, unknown>).total);\n }\n};\n\n/**\n * Extract the per-message token delta a Pi assistant `message_end` contributed.\n * Unlike `applyUsage`, which mutates the run record, this returns the delta so\n * the worker can attribute a single event without re-deriving it from a\n * post-hoc cumulative diff. Cost is reported in the runner's own total units.\n */\nexport const extractUsageDelta = (\n message: Record<string, unknown>,\n): { input: number; output: number; cacheRead: number; cacheWrite: number; cost: number } | undefined => {\n const usage = message.usage;\n if (typeof usage !== \"object\" || usage === null || Array.isArray(usage)) return undefined;\n const values = usage as Record<string, unknown>;\n const cost = values.cost;\n return {\n input: numberField(values.input),\n output: numberField(values.output),\n cacheRead: numberField(values.cacheRead),\n cacheWrite: numberField(values.cacheWrite),\n cost:\n typeof cost === \"number\"\n ? cost\n : typeof cost === \"object\" && cost !== null\n ? numberField((cost as Record<string, unknown>).total)\n : 0,\n };\n};\n\nexport const latestRunText = (text: string): string =>\n Array.from(text).slice(-MAX_RUN_TEXT_CHARS).join(\"\");\n"],
|
|
5
|
-
"mappings": ";AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAOjB,IAAM,sBAAsB;AAC5B,IAAM,qBAAqB;AAEpB,IAAM,aAAa,OAAmB;AAAA,EAC3C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,MAAM;AACR;AAEO,IAAM,sBAAsB,CACjC,SACA,MACA,UACA,eACoB;AAAA,EACpB,IAAI,QAAQ;AAAA,EACZ,MAAM,QAAQ;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,EACR,QAAQ,QAAQ;AAAA,EAChB,GAAI,QAAQ,SAAS,EAAE,QAAQ,QAAQ,OAAO,IAAI,CAAC;AAAA,EACnD,WAAW,QAAQ;AAAA,EACnB,KAAK,QAAQ;AAAA,EACb,GAAI,QAAQ,QAAQ,EAAE,OAAO,QAAQ,OAAO,gBAAgB,QAAQ,MAAM,IAAI,CAAC;AAAA,EAC/E,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;AAAA,EAC/B,GAAI,QAAQ,UAAU,EAAE,SAAS,QAAQ,QAAQ,IAAI,CAAC;AAAA,EACtD,GAAI,QAAQ,YAAY,EAAE,WAAW,QAAQ,UAAU,IAAI,CAAC;AAAA,EAC5D,GAAI,QAAQ,yBACR,EAAE,wBAAwB,CAAC,GAAG,QAAQ,sBAAsB,EAAE,IAC9D,CAAC;AAAA,EACL,GAAI,QAAQ,mBAAmB,EAAE,kBAAkB,QAAQ,iBAAiB,IAAI,CAAC;AAAA,EACjF;AAAA,EACA,WAAW;AAAA,EACX,OAAO;AAAA,
|
|
4
|
+
"sourcesContent": ["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type {\n AgentRunRecord,\n AgentUsage,\n AgentWorkerOptions,\n} from \"../agents/types.js\";\n\nconst MAX_RUN_ERROR_CHARS = 20_000;\nconst MAX_RUN_TEXT_CHARS = 100_000;\n\nexport const emptyUsage = (): AgentUsage => ({\n input: 0,\n output: 0,\n cacheRead: 0,\n cacheWrite: 0,\n cost: 0,\n});\n\nexport const createRunningRecord = (\n options: AgentWorkerOptions,\n task: string,\n thinking: AgentRunRecord[\"thinking\"],\n startedAt: number,\n): AgentRunRecord => ({\n id: options.id,\n name: options.name,\n task,\n status: \"running\",\n runner: options.runner,\n ...(options.kernel ? { kernel: options.kernel } : {}),\n transport: options.transport,\n cwd: options.cwd,\n ...(options.model ? { model: options.model, requestedModel: options.model } : {}),\n ...(thinking ? { thinking } : {}),\n ...(options.actorId ? { actorId: options.actorId } : {}),\n ...(options.actorName ? { actorName: options.actorName } : {}),\n ...(options.capabilityRequirements\n ? { capabilityRequirements: [...options.capabilityRequirements] }\n : {}),\n ...(options.capabilityDigest ? { capabilityDigest: options.capabilityDigest } : {}),\n startedAt,\n updatedAt: startedAt,\n turns: options.carryOver?.turns ?? 0,\n toolCalls: options.carryOver?.toolCalls ?? 0,\n text: \"\",\n usage: options.carryOver?.usage ?? emptyUsage(),\n logFile: options.logFile,\n ...(options.branch ? { branch: options.branch } : {}),\n ...(options.worktree ? { worktree: options.worktree } : {}),\n});\n\nexport const writeRunRecord = (filePath: string, record: AgentRunRecord): void => {\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n const temporaryPath = `${filePath}.${process.pid}.tmp`;\n fs.writeFileSync(temporaryPath, JSON.stringify(record, null, 2), {\n encoding: \"utf8\",\n mode: 0o600,\n });\n renameWithRetry(temporaryPath, filePath);\n};\n\n// Windows transiently rejects rename() with EPERM/EACCES/EEXIST/EBUSY while\n// an antivirus scan or sibling reader probes the destination file \u2014\n// milliseconds of contention, not policy. Retry a bounded linear backoff\n// before surfacing.\n//\n// Self-contained on purpose: this module is dynamically imported by the\n// spawned worker through plain Node with worker.ts switching the import\n// extension, so it must not depend on ../core/atomic-write.js. Keep the shared\n// implementation for the host side and this copy for the worker boundary.\nconst RETRYABLE_RENAME_CODES = new Set([\"EPERM\", \"EACCES\", \"EEXIST\", \"EBUSY\"]);\n\nconst syncSleep = (ms: number): void => {\n try {\n const buffer = new Int32Array(new SharedArrayBuffer(4));\n Atomics.wait(buffer, 0, 0, ms);\n } catch {\n // Atomics.wait unavailable: retry immediately \u2014 correct, just busier.\n }\n};\n\nconst renameWithRetry = (source: string, target: string): void => {\n for (let attempt = 1; ; attempt++) {\n try {\n fs.renameSync(source, target);\n return;\n } catch (error) {\n const code =\n typeof error === \"object\" && error !== null && \"code\" in error\n ? String((error as { code?: unknown }).code)\n : undefined;\n if (attempt >= 8 || code === undefined || !RETRYABLE_RENAME_CODES.has(code)) {\n throw error;\n }\n syncSleep(25 * attempt);\n }\n }\n};\n\nexport const updateRunRecord = (filePath: string, record: AgentRunRecord): void => {\n record.updatedAt = Date.now();\n writeRunRecord(filePath, record);\n};\n\nexport const writeCrashRunRecord = (\n filePath: string,\n record: AgentRunRecord,\n error: unknown,\n): void => {\n const reason = error instanceof Error ? error.message : String(error);\n const crashed: AgentRunRecord = {\n ...record,\n status: \"failed\",\n error: `Worker crashed before reporting a result: ${reason}`.slice(0, MAX_RUN_ERROR_CHARS),\n finishedAt: Date.now(),\n updatedAt: Date.now(),\n };\n delete crashed.currentTool;\n writeRunRecord(filePath, crashed);\n};\n\nconst numberField = (value: unknown): number => (typeof value === \"number\" ? value : 0);\n\nexport const applyUsage = (\n record: AgentRunRecord,\n message: Record<string, unknown>,\n): void => {\n const usage = message.usage;\n if (typeof usage !== \"object\" || usage === null) return;\n const values = usage as Record<string, unknown>;\n record.usage.input += numberField(values.input);\n record.usage.output += numberField(values.output);\n record.usage.cacheRead += numberField(values.cacheRead);\n record.usage.cacheWrite += numberField(values.cacheWrite);\n const cost = values.cost;\n if (typeof cost === \"number\") record.usage.cost += cost;\n if (typeof cost === \"object\" && cost !== null) {\n record.usage.cost += numberField((cost as Record<string, unknown>).total);\n }\n};\n\n/**\n * Extract the per-message token delta a Pi assistant `message_end` contributed.\n * Unlike `applyUsage`, which mutates the run record, this returns the delta so\n * the worker can attribute a single event without re-deriving it from a\n * post-hoc cumulative diff. Cost is reported in the runner's own total units.\n */\nexport const extractUsageDelta = (\n message: Record<string, unknown>,\n): { input: number; output: number; cacheRead: number; cacheWrite: number; cost: number } | undefined => {\n const usage = message.usage;\n if (typeof usage !== \"object\" || usage === null || Array.isArray(usage)) return undefined;\n const values = usage as Record<string, unknown>;\n const cost = values.cost;\n return {\n input: numberField(values.input),\n output: numberField(values.output),\n cacheRead: numberField(values.cacheRead),\n cacheWrite: numberField(values.cacheWrite),\n cost:\n typeof cost === \"number\"\n ? cost\n : typeof cost === \"object\" && cost !== null\n ? numberField((cost as Record<string, unknown>).total)\n : 0,\n };\n};\n\nexport const latestRunText = (text: string): string =>\n Array.from(text).slice(-MAX_RUN_TEXT_CHARS).join(\"\");\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAOjB,IAAM,sBAAsB;AAC5B,IAAM,qBAAqB;AAEpB,IAAM,aAAa,OAAmB;AAAA,EAC3C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,MAAM;AACR;AAEO,IAAM,sBAAsB,CACjC,SACA,MACA,UACA,eACoB;AAAA,EACpB,IAAI,QAAQ;AAAA,EACZ,MAAM,QAAQ;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,EACR,QAAQ,QAAQ;AAAA,EAChB,GAAI,QAAQ,SAAS,EAAE,QAAQ,QAAQ,OAAO,IAAI,CAAC;AAAA,EACnD,WAAW,QAAQ;AAAA,EACnB,KAAK,QAAQ;AAAA,EACb,GAAI,QAAQ,QAAQ,EAAE,OA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AAM,OAAO,OAAO;AACpB,MAAI,OAAO,SAAS,SAAU,QAAO,MAAM,QAAQ;AACnD,MAAI,OAAO,SAAS,YAAY,SAAS,MAAM;AAC7C,WAAO,MAAM,QAAQ,YAAa,KAAiC,KAAK;AAAA,EAC1E;AACF;AAQO,IAAM,oBAAoB,CAC/B,YACuG;AACvG,QAAM,QAAQ,QAAQ;AACtB,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,EAAG,QAAO;AAChF,QAAM,SAAS;AACf,QAAM,OAAO,OAAO;AACpB,SAAO;AAAA,IACL,OAAO,YAAY,OAAO,KAAK;AAAA,IAC/B,QAAQ,YAAY,OAAO,MAAM;AAAA,IACjC,WAAW,YAAY,OAAO,SAAS;AAAA,IACvC,YAAY,YAAY,OAAO,UAAU;AAAA,IACzC,MACE,OAAO,SAAS,WACZ,OACA,OAAO,SAAS,YAAY,SAAS,OACnC,YAAa,KAAiC,KAAK,IACnD;AAAA,EACV;AACF;AAEO,IAAM,gBAAgB,CAAC,SAC5B,MAAM,KAAK,IAAI,EAAE,MAAM,CAAC,kBAAkB,EAAE,KAAK,EAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/docs/agents.md
CHANGED
|
@@ -280,7 +280,7 @@ LocalTerm provides the required primitives that match tmux: detached creation, p
|
|
|
280
280
|
localterm start
|
|
281
281
|
```
|
|
282
282
|
|
|
283
|
-
`/fabric agents` lists the children. Run `/fabric attach <id>` to show the correct attach command.
|
|
283
|
+
`/fabric agents` lists the children. Run `/fabric attach <id>` to show the correct attach command. A caller abort stops a run that never produced progress and detaches a run that already did: the child keeps working to its own terminal state and reports it, so a returned program or a cancelled tool call cannot discard a long participant's work. A worker that catches an external signal mid-run, or whose transport dies after doing work, is resumed, so an interruption the run can recover from never becomes a terminal stop. The manager relaunches the same run in the same directory, hands the child a continuation of the task, keeps the stopped attempt's turns and token usage in the run record, and emits `run.resumed`. An explicit stop, a run deadline, and the `agents.maxTokensPerChild` limit stay terminal. Three resumes bound one run, and the run deadline covers every attempt. When a program uses orchestration entry points such as `agent`/`workflow.agent`, `agents.run`/`agents.wait`/`agents.ask`, `council.run`, or `rlm.query`, Fabric increases the whole-program `executor.timeoutMs` to at least `agents.timeoutMs`. The same increase applies to `agents.*` refs called through `tools.call()` and to refs calculated at runtime. The parent deadline then cannot stop a child that remains within its own agent budget.
|
|
284
284
|
|
|
285
285
|
Set `worktree: true` to create a dedicated Git worktree and a `pi-fabric/<name>-<id>` branch from the repository containing the selected `cwd`. Fabric writes that worktree at `<repo>/.pi/fabric/worktrees/<id>` so copy-on-write cloning can keep ignored build artifacts on the same volume, and it records the path in the repository `.git/info/exclude` file. Simple `git worktree add` commands run through `pi.bash` take the same clone-first path. Fabric retains worktrees for inspection until you call `agents.cleanup()`. When the selected cwd is a repository subdirectory, Fabric uses the matching subdirectory in the generated worktree when it exists; otherwise it uses the worktree root. The reported effective cwd is the generated worktree path, and Pi evaluates that generated path as its own canonical cwd. The caller's project and mesh roots remain unchanged, so a child targeting another repository still belongs to the orchestrating Fabric topology. A recursive child in a worktree stays in the same participant directory and does not create another `.pi/fabric/mesh` inside that worktree.
|
|
286
286
|
|
|
@@ -340,7 +340,7 @@ if (peer) {
|
|
|
340
340
|
|
|
341
341
|
`agents.subscribe` accepts an exact source participant ID. You can use `"main"` for the caller's root. Supply one or more lifecycle events and an optional target, which defaults to Main. Set a `steer` or `followUp` delivery mode, an explicit `triggerTurn` policy, and the optional `once` flag. Inspect routes with `agents.subscriptions()`, and remove one with `agents.unsubscribe({ id })`. A subscription starts at the current mesh sequence and does not replay earlier events. Its delivery cursor remains durable across host restarts. Delivery is at least once when a host crashes between inserting the target message and saving the cursor. Consumers can use the lifecycle event `id` to deduplicate side effects.
|
|
342
342
|
|
|
343
|
-
Pi events use these names: `pi.input`, `pi.agent_start`, `pi.agent_end`, `pi.turn_end`, `pi.agent_settled`, `pi.tool_error`, and `pi.session_compact`. Runner-neutral terminal events use `run.completed`, `run.failed`, `run.stopped`, and `run.timed_out`. The `tokens.usage` event provides bounded usage. The `component.state` event reports supervised component transitions. Lifecycle envelopes contain source identity and bounded operational metadata. They do not contain session transcripts.
|
|
343
|
+
Pi events use these names: `pi.input`, `pi.agent_start`, `pi.agent_end`, `pi.turn_end`, `pi.agent_settled`, `pi.tool_error`, and `pi.session_compact`. Runner-neutral terminal events use `run.completed`, `run.failed`, `run.stopped`, and `run.timed_out`. Recovery events use `run.resumed` for a relaunched attempt after an unexpected stop, and `run.detached` for a run that outlived its caller's cancellation. The `tokens.usage` event provides bounded usage. The `component.state` event reports supervised component transitions. Lifecycle envelopes contain source identity and bounded operational metadata. They do not contain session transcripts.
|
|
344
344
|
|
|
345
345
|
A detached local `agents.spawn()` has a smaller convenience route. When `agents.notifyOnComplete` is enabled, terminal completion automatically sends Main a triggered follow-up. A call to `agents.wait()` makes the run foreground work and disables that detached notification.
|
|
346
346
|
|
package/docs/certification.md
CHANGED
|
@@ -7,7 +7,7 @@ The repository provides three evaluation commands:
|
|
|
7
7
|
|
|
8
8
|
- `bun run benchmark:real-resume` is an opt-in, billable Pi RPC benchmark with a safe skip as its default behavior.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
The incremental test commands stay offline and fast because they never invoke these certification or benchmark entry points.
|
|
11
11
|
|
|
12
12
|
## Entropy certification
|
|
13
13
|
|
package/docs/configuration.md
CHANGED
|
@@ -150,7 +150,7 @@ where absent values do not participate. Orchestration programs (`agents.run` / `
|
|
|
150
150
|
"maxConcurrent": 4,
|
|
151
151
|
"maxPerExecution": 100,
|
|
152
152
|
"maxDepth": 2,
|
|
153
|
-
"timeoutMs":
|
|
153
|
+
"timeoutMs": 86400000,
|
|
154
154
|
"extensions": true,
|
|
155
155
|
"defaultTools": ["read", "bash", "edit", "write", "grep", "find", "ls"],
|
|
156
156
|
"retainRuns": false,
|
|
@@ -403,7 +403,7 @@ Other agent settings:
|
|
|
403
403
|
- `maxConcurrent`: global child concurrency semaphore.
|
|
404
404
|
- `maxPerExecution`: hard cap on children per `fabric_exec` invocation.
|
|
405
405
|
- `maxDepth`: nesting bound for child agent calls, including `rlm.query()`. It accepts any non-negative safe integer. A value of `0` disables child spawning. `/fabric settings` provides free-form numeric entry.
|
|
406
|
-
- `timeoutMs`: default wall-clock budget per child and the floor for per-call overrides (
|
|
406
|
+
- `timeoutMs`: default wall-clock budget per child and the floor for per-call overrides (24 hours by default, which is also the policy ceiling). Fabric ignores lower per-call values. The default matches the ceiling on purpose: an orchestration program inherits this value as its own whole-program deadline floor, so a lower default would cut a long participant short well inside the allowed maximum. Lower it to bound a class of runs, and raise a single run with a per-call value.
|
|
407
407
|
- `extensions`: whether Claude children keep their normal Claude Code customizations.
|
|
408
408
|
- `defaultTools`: the default tool allowlist for children.
|
|
409
409
|
- `budgetUsd`: shared append-only cost ledger across a recursion tree (0 disables).
|
|
@@ -375,4 +375,4 @@ After startup, ordinary action calls use the direct `ActionRegistry` branch. Com
|
|
|
375
375
|
| `components.reload` reaches pinned fibers | loader `#loaded` map | `components-provider.test.ts` |
|
|
376
376
|
| `components.reload` reports rollback and preserves the namespace | loader reload diagnostics | `components-provider.test.ts` |
|
|
377
377
|
| Default descriptors and hashes stay fixed | `actionDescriptorHash()` | `default-path-compatibility.test.ts` |
|
|
378
|
-
|
|
|
378
|
+
| Runtime behavior in touched paths stays green | incremental gate | `bun run check:fast` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-fabric",
|
|
3
|
-
"version": "0.92.
|
|
3
|
+
"version": "0.92.13",
|
|
4
4
|
"description": "A programmable tool and agent runtime for Pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json --emitDeclarationOnly && node scripts/build.mjs && bun run assert:build-artifacts",
|
|
40
40
|
"typecheck": "tsc --noEmit",
|
|
41
|
-
"test": "
|
|
42
|
-
"test:
|
|
41
|
+
"test:changed": "node scripts/test-affected.mjs",
|
|
42
|
+
"test:affected": "node scripts/test-affected.mjs --base $PI_TEST_BASE",
|
|
43
|
+
"test:smoke": "vitest run tests/script-runtime.test.ts tests/pi-binary.test.ts tests/host-compatibility.test.ts tests/output-budget.test.ts tests/actor-mesh-monitor.test.ts tests/handoff.test.ts tests/config-migrations.test.ts tests/monty-payload-preflight.test.ts tests/bundled-binary-spawn.test.ts tests/conversation-native-reader-suspension.test.ts",
|
|
43
44
|
"test:related": "vitest related --run",
|
|
44
45
|
"check:fast": "bun run typecheck && bun run test:changed",
|
|
45
46
|
"certify:context": "bun run build && node scripts/certify-context.mjs",
|
|
@@ -49,10 +50,9 @@
|
|
|
49
50
|
"benchmark:conversation": "bun run build && node --expose-gc scripts/benchmark-conversation.mjs",
|
|
50
51
|
"benchmark:activity": "node --expose-gc scripts/benchmark-activity.mjs",
|
|
51
52
|
"lint:dead": "knip --no-gitignore",
|
|
52
|
-
"check": "bun run typecheck && bun run build && bun run assert:lazy-graph && bun run test && bun run lint:dead",
|
|
53
53
|
"assert:lazy-graph": "node scripts/assert-lazy-graph-host-free.mjs",
|
|
54
54
|
"assert:build-artifacts": "node scripts/assert-build-artifacts.mjs",
|
|
55
|
-
"prepack": "bun run
|
|
55
|
+
"prepack": "bun run typecheck && bun run build"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [
|
|
58
58
|
"pi-package",
|
|
@@ -47,7 +47,7 @@ Operations are local regular files: edit/delete require `expectedSha256`; writes
|
|
|
47
47
|
## Off-mode state discipline
|
|
48
48
|
|
|
49
49
|
```python
|
|
50
|
-
transition = await state.transition(label="claim", to="claim-stated", summary="A falsifiable delta", evidence=["
|
|
50
|
+
transition = await state.transition(label="claim", to="claim-stated", summary="A falsifiable delta", evidence=["bunx vitest run tests/focused.test.ts"])
|
|
51
51
|
verification = await state.verify()
|
|
52
52
|
return {"status": "success" if verification["certified"] else "failed", "transition": transition, "verification": verification}
|
|
53
53
|
```
|
|
@@ -123,4 +123,4 @@ Persistent actors may declare `requires: ["provider.action", { ref: "provider.op
|
|
|
123
123
|
|
|
124
124
|
Agent requests and persistent actors accept `runner: "pi" | "claude"`. Pi is the default and is required for `recursive: true`, `rlm.query()`, and actors that must call Fabric or mesh APIs themselves. Claude invokes the official `claude -p` harness; it supports mapped Claude Code tools and host-managed persistent actors, but not recursive/direct Fabric APIs. Use `agents.models({ runner: "claude" })` for runtime-enumerated `claude/<value>` model keys.
|
|
125
125
|
|
|
126
|
-
Omit `timeoutMs` for agents and actors unless requesting longer than the configured `agents.timeoutMs` (
|
|
126
|
+
Omit `timeoutMs` for agents and actors unless requesting longer than the configured `agents.timeoutMs` (24 hours by default, the policy ceiling). Per-call values below the configured default are ignored.
|
|
@@ -31,7 +31,7 @@ For Pi leaf or recursive agents, selecting `cwd` neither grants nor requires pro
|
|
|
31
31
|
- Give every autonomous coding agent a mandatory first command that verifies repo identity (exact canonical toplevel or remote URL) and a hard rule to abort with zero changes on mismatch. Guards cost one cheap round when wrong and prevent cross-repo contamination when right — four successive guards caught a wrong-repo worktree, a self-inflicted symlink mismatch, and a too-literal directory check at zero bytes of damage.
|
|
32
32
|
- Cleanup after cancelled/failed agent runs: check `agents.list({ scope: "project" })` and `agents.stop` any still-running handles first; worktree registrations live in the repo that OWNS the worktree (check `git worktree list` in every candidate repo; `.pi/fabric/worktrees/<id>` names the agent, not the repo), then `git worktree remove --force` + `git branch -D` + `git worktree prune` in each. Leave pre-existing non-agent worktrees alone; filter by the branch prefix your runs created (e.g. `pi-fabric/<name>`).
|
|
33
33
|
- `residency` is available on `agents.spawn` only: `"session"` (default) ties the run to the current Pi host; `"durable"` launches it on Fabric's hidden resident host so it can finish after Main exits. Durable handles still support `status`, `wait`, `log`, `stop`, and `cleanup` when the same root resumes. It requires a trusted project mesh and is unavailable in Schema enforce mode.
|
|
34
|
-
- Omit `timeoutMs` normally. It defaults to `agents.timeoutMs` (
|
|
34
|
+
- Omit `timeoutMs` normally. It defaults to `agents.timeoutMs` (24 hours by default, the policy ceiling), and per-call values below that configured default are ignored. Set it only to request a longer run.
|
|
35
35
|
|
|
36
36
|
```ts
|
|
37
37
|
const result = await agents.run({
|