pi-fabric 0.92.37 → 0.92.38
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/completion-inbox.d.ts.map +1 -1
- package/dist/agents/transports/process-utils.d.ts.map +1 -1
- package/dist/capture/interceptor.d.ts.map +1 -1
- package/dist/chunks/{chunk-XL5NI6KH.js → chunk-45QTPCE7.js} +2 -2
- package/dist/chunks/{chunk-IZSVDLWG.js → chunk-5NZ4EZ47.js} +1 -1
- package/dist/chunks/{chunk-X7G62ZGH.js → chunk-7BG5COXB.js} +8 -3
- package/dist/chunks/{chunk-X7G62ZGH.js.map → chunk-7BG5COXB.js.map} +2 -2
- package/dist/chunks/{chunk-RDJDJJET.js → chunk-7VAZ4N43.js} +2 -2
- package/dist/chunks/{chunk-JJZFNBB7.js → chunk-MQG5QKGI.js} +2 -2
- package/dist/chunks/{chunk-NTKI5NUE.js → chunk-RR6RARD5.js} +3 -3
- package/dist/chunks/{chunk-2462VF6I.js → chunk-SZUXWOO7.js} +1 -1
- package/dist/chunks/chunk-SZUXWOO7.js.map +7 -0
- package/dist/chunks/{chunk-CIODQX77.js → chunk-WIC446CZ.js} +2 -2
- package/dist/chunks/{chunk-OPEOIVF6.js → chunk-XKRZHYH3.js} +2 -2
- package/dist/chunks/{chunk-3ALJY5MG.js → chunk-Y66NZ2S7.js} +2 -2
- package/dist/compaction/hook.js +2 -2
- package/dist/fabric-exec-tool.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +45 -42
- package/dist/fabric-runtime-state.js.map +2 -2
- package/dist/index.js +71 -16
- package/dist/index.js.map +3 -3
- package/dist/jev.js +1 -1
- package/dist/providers/jev-provider.js +1 -1
- package/dist/repeat-guard.d.ts +29 -0
- package/dist/repeat-guard.d.ts.map +1 -0
- package/dist/residency/host.js +6 -6
- package/dist/residency/pi-entry.js +6 -6
- package/dist/runtime/node-process-runtime.js +2 -2
- package/dist/runtime/typescript-kernel.js +2 -2
- package/dist/ui/dashboard.js +2 -2
- package/dist/ui/fabric-code-parser.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-2462VF6I.js.map +0 -7
- /package/dist/chunks/{chunk-XL5NI6KH.js.map → chunk-45QTPCE7.js.map} +0 -0
- /package/dist/chunks/{chunk-IZSVDLWG.js.map → chunk-5NZ4EZ47.js.map} +0 -0
- /package/dist/chunks/{chunk-RDJDJJET.js.map → chunk-7VAZ4N43.js.map} +0 -0
- /package/dist/chunks/{chunk-JJZFNBB7.js.map → chunk-MQG5QKGI.js.map} +0 -0
- /package/dist/chunks/{chunk-NTKI5NUE.js.map → chunk-RR6RARD5.js.map} +0 -0
- /package/dist/chunks/{chunk-CIODQX77.js.map → chunk-WIC446CZ.js.map} +0 -0
- /package/dist/chunks/{chunk-OPEOIVF6.js.map → chunk-XKRZHYH3.js.map} +0 -0
- /package/dist/chunks/{chunk-3ALJY5MG.js.map → chunk-Y66NZ2S7.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion-inbox.d.ts","sourceRoot":"","sources":["../../src/agents/completion-inbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,6BAA6B,6BAA6B,CAAC;AAKxE,KAAK,UAAU,GAAG,IAAI,CAAC,cAAc,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,YAAY,CAAC,CAAC;AAQjH,0FAA0F;AAC1F,qBAAa,oBAAoB;;IASnB,QAAQ,CAAC,EAAE,EAAE,YAAY;gBAAhB,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"completion-inbox.d.ts","sourceRoot":"","sources":["../../src/agents/completion-inbox.ts"],"names":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AAI,UAAS,oBAAyB,KAAG,MAS7E,CAAC;AAaF,eAAO,MAAM,eAAe,GAC1B,YAAY,MAAM,EAClB,iBAAiB,SAAS,MAAM,EAAE,EAClC,UAAU,oBAAoB,KAC7B,OAAO,CAAC,MAAM,EAAE,CAGlB,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,YAAY,MAAM,EAClB,iBAAiB,MAAM,EAAE,KACxB,OAAO,CAAC,MAAM,CAC+D,CAAC;AAEjF,eAAO,MAAM,aAAa,GACxB,YAAY,MAAM,EAClB,iBAAiB,MAAM,EAAE,EACzB,KAAK,MAAM,KACV,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAqB7E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../../src/capture/interceptor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../../src/capture/interceptor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,eAAe,EAEf,cAAc,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAyB,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAQnD,MAAM,WAAW,+BAA+B;IAC9C,SAAS,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACjD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,4BAA4B;IAC3C,gBAAgB,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC;IAC7B,aAAa,CAAC,EAAE,uBAAuB,CAAC;IAOxC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAyBD,KAAK,0BAA0B,GAAG;IAChC,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC;AAaF,eAAO,MAAM,iCAAiC,GAC5C,WAAW,MAAM,KAChB,OAAO,CAAC,0BAA0B,EAAE,CAuBtC,CAAC;AAyHF,eAAO,MAAM,4BAA4B,GACvC,SAAS,4BAA4B,KACpC,OAAO,CAAC,+BAA+B,CAuCzC,CAAC"}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
buildThinkingDigest,
|
|
11
11
|
snapshotHandoffSession,
|
|
12
12
|
thinkingTransferPolicy
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-XKRZHYH3.js";
|
|
14
14
|
import {
|
|
15
15
|
isFabricThinking
|
|
16
16
|
} from "./chunk-MGWQOKBV.js";
|
|
@@ -2012,4 +2012,4 @@ export {
|
|
|
2012
2012
|
PrewalkController,
|
|
2013
2013
|
PrewalkDriftTracker
|
|
2014
2014
|
};
|
|
2015
|
-
//# sourceMappingURL=chunk-
|
|
2015
|
+
//# sourceMappingURL=chunk-45QTPCE7.js.map
|
|
@@ -109,13 +109,18 @@ var resolveScriptRuntimeSync = (options = {}) => {
|
|
|
109
109
|
if (override) return override;
|
|
110
110
|
throw missingRuntimeError(execPath, requireNode, requireBun);
|
|
111
111
|
};
|
|
112
|
+
var typescriptWorker = (workerPath) => /.[cm]?tsx?$/i.test(path.extname(workerPath));
|
|
113
|
+
var runtimeOptionsForWorker = (workerPath, options) => {
|
|
114
|
+
if (!typescriptWorker(workerPath) || options?.requireNode || options?.requireBun) return options;
|
|
115
|
+
return { ...options, requireBun: true };
|
|
116
|
+
};
|
|
112
117
|
var scriptSpawnArgs = async (workerPath, workerArguments, options) => {
|
|
113
|
-
const runtime = await resolveScriptRuntime(options);
|
|
118
|
+
const runtime = await resolveScriptRuntime(runtimeOptionsForWorker(workerPath, options));
|
|
114
119
|
return [runtime, workerPath, ...workerArguments];
|
|
115
120
|
};
|
|
116
121
|
var workerCommand = async (workerPath, workerArguments) => (await scriptSpawnArgs(workerPath, workerArguments)).map(shellQuote).join(" ");
|
|
117
122
|
var spawnDetached = async (workerPath, workerArguments, cwd) => {
|
|
118
|
-
const runtime = await resolveScriptRuntime();
|
|
123
|
+
const runtime = await resolveScriptRuntime(runtimeOptionsForWorker(workerPath));
|
|
119
124
|
const child = spawn(runtime, [workerPath, ...workerArguments], {
|
|
120
125
|
cwd,
|
|
121
126
|
detached: process.platform !== "win32",
|
|
@@ -148,4 +153,4 @@ export {
|
|
|
148
153
|
workerCommand,
|
|
149
154
|
spawnDetached
|
|
150
155
|
};
|
|
151
|
-
//# sourceMappingURL=chunk-
|
|
156
|
+
//# sourceMappingURL=chunk-7BG5COXB.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/agents/transports/process-utils.ts"],
|
|
4
|
-
"sourcesContent": ["import { execFile, spawn } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nexport interface ExecFileResult {\n stdout: string;\n stderr: string;\n}\n\nexport const executeFile = (\n command: string,\n args: string[],\n options: { cwd?: string; timeoutMs?: number } = {},\n): Promise<ExecFileResult> =>\n new Promise((resolve, reject) => {\n execFile(\n command,\n args,\n {\n encoding: \"utf8\",\n maxBuffer: 10 * 1024 * 1024,\n ...(options.cwd ? { cwd: options.cwd } : {}),\n ...(options.timeoutMs ? { timeout: options.timeoutMs } : {}),\n },\n (error, stdout, stderr) => {\n if (error) {\n Object.assign(error, { stdout, stderr });\n reject(error);\n return;\n }\n resolve({ stdout, stderr });\n },\n );\n });\n\n/** Windows resolves bare names through PATHEXT; POSIX needs the execute bit. */\nconst executableNames = (command: string, env: NodeJS.ProcessEnv): string[] => {\n if (process.platform !== \"win32\" || path.extname(command) !== \"\") return [command];\n const extensions = (env.PATHEXT ?? \".COM;.EXE;.BAT;.CMD\")\n .split(\";\")\n .map((extension) => extension.trim().toLowerCase())\n .filter((extension) => extension !== \"\");\n return [command, ...extensions.map((extension) => command + extension)];\n};\n\nconst unquotePathEntry = (entry: string): string => {\n const trimmed = entry.trim();\n return trimmed.length > 1 && trimmed.startsWith('\"') && trimmed.endsWith('\"')\n ? trimmed.slice(1, -1)\n : trimmed;\n};\n\nconst isExecutableFile = async (candidate: string): Promise<boolean> => {\n try {\n const stats = await fs.promises.stat(candidate);\n if (!stats.isFile()) return false;\n // Windows has no execute bit; PATHEXT already narrowed the candidate name.\n return process.platform === \"win32\" || (stats.mode & 0o111) !== 0;\n } catch {\n return false;\n }\n};\n\n/**\n * PATH lookup that never shells out: Windows runners reach this code with no\n * `sh` on PATH, and a login shell may rewrite PATH behind the caller's back.\n */\nexport const commandAvailable = async (\n command: string,\n env: NodeJS.ProcessEnv = process.env,\n): Promise<boolean> => {\n const names = executableNames(command, env);\n for (const entry of (env.PATH ?? \"\").split(path.delimiter)) {\n const directory = unquotePathEntry(entry);\n if (directory === \"\") continue;\n for (const name of names) {\n if (await isExecutableFile(path.join(directory, name))) return true;\n }\n }\n return false;\n};\n\nconst shellQuote = (value: string): string => `'${value.replaceAll(\"'\", `'\"'\"'`)}'`;\n\nexport const processIsAlive = (pid: number): boolean => {\n if (!Number.isSafeInteger(pid) || pid <= 0) return false;\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n // On Windows, EPERM means the process exists but cannot be opened for\n // signaling; only ESRCH (or other errors) mean it is gone.\n return error instanceof Error && \"code\" in error && (error as NodeJS.ErrnoException).code === \"EPERM\";\n }\n};\n\nconst GENERIC_RUNTIME = /^(node|bun)(\\.exe)?$/;\n\nexport interface ScriptRuntimeOptions {\n execPath?: string;\n env?: NodeJS.ProcessEnv;\n /** Require Node.js specifically; used by the Node-process executor whose\n * `--eval`/`--input-type=module` flags are Node-only. */\n requireNode?: boolean;\n /** Require Bun specifically; used by the Bun-process executor. */\n requireBun?: boolean;\n}\n\nconst runtimeOverride = (env: NodeJS.ProcessEnv): string | undefined => {\n const value = env.PI_FABRIC_NODE_BINARY;\n return typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n};\n\nconst isGenericRuntime = (execPath: string, requireNode: boolean, requireBun = false): boolean => {\n const name = path.basename(execPath).toLowerCase();\n return GENERIC_RUNTIME.test(name)\n && (!requireNode || name.startsWith(\"node\"))\n && (!requireBun || name.startsWith(\"bun\"));\n};\n\nconst missingRuntimeError = (execPath: string, requireNode: boolean, requireBun = false): Error => {\n const required = requireNode\n ? \"a Node.js runtime\"\n : requireBun\n ? \"a Bun runtime\"\n : \"a Node.js or Bun runtime\";\n const shape = requireNode ? \"(not node)\" : requireBun ? \"(not bun)\" : \"(not node/bun)\";\n return new Error(\n `Fabric requires ${required} to launch a JavaScript worker, but ` +\n `process.execPath is ${execPath} ${shape} and PI_FABRIC_NODE_BINARY is unset. ` +\n \"Install Node.js or Bun, or set PI_FABRIC_NODE_BINARY to the runtime binary.\",\n );\n};\n\n// Transports launch the worker (a .js module) as `<runtime> worker.js args`.\n// Under the new Bun-compiled pi binary, process.execPath is the pi executable,\n// not node/bun, so it cannot run an arbitrary script. Resolve a real runtime\n// before spawning: reuse process.execPath when it IS node/bun, else fall back\n// to PI_FABRIC_NODE_BINARY, then the first node/bun on PATH.\nconst resolveScriptRuntimeUncached = async (options: ScriptRuntimeOptions = {}): Promise<string> => {\n const execPath = options.execPath ?? process.execPath;\n const env = options.env ?? process.env;\n const requireNode = options.requireNode === true;\n const requireBun = options.requireBun === true;\n if (isGenericRuntime(execPath, requireNode, requireBun)) return execPath;\n const override = runtimeOverride(env);\n if (override) return override;\n for (const candidate of requireNode ? [\"node\"] : requireBun ? [\"bun\"] : [\"node\", \"bun\"]) {\n if (await commandAvailable(candidate)) return candidate;\n }\n throw missingRuntimeError(execPath, requireNode, requireBun);\n};\n\nlet cachedDefaultRuntime: string | undefined;\nexport const resolveScriptRuntime = async (options?: ScriptRuntimeOptions): Promise<string> => {\n if (\n options &&\n (options.execPath !== undefined ||\n options.env !== undefined ||\n options.requireNode !== undefined ||\n options.requireBun !== undefined)\n ) {\n return resolveScriptRuntimeUncached(options);\n }\n if (cachedDefaultRuntime) return cachedDefaultRuntime;\n cachedDefaultRuntime = await resolveScriptRuntimeUncached();\n return cachedDefaultRuntime;\n};\n\n// Synchronous variant for callers that already run under a real runtime (e.g.\n// the worker, which a transport always launches via the resolved runtime). No\n// PATH lookup; throws if the current process is the bundled binary with no\n// override set.\nexport const resolveScriptRuntimeSync = (options: ScriptRuntimeOptions = {}): string => {\n const execPath = options.execPath ?? process.execPath;\n const env = options.env ?? process.env;\n const requireNode = options.requireNode === true;\n const requireBun = options.requireBun === true;\n if (isGenericRuntime(execPath, requireNode, requireBun)) return execPath;\n const override = runtimeOverride(env);\n if (override) return override;\n throw missingRuntimeError(execPath, requireNode, requireBun);\n};\n\nexport const scriptSpawnArgs = async (\n workerPath: string,\n workerArguments: readonly string[],\n options?: ScriptRuntimeOptions,\n): Promise<string[]> => {\n const runtime = await resolveScriptRuntime(options);\n return [runtime, workerPath, ...workerArguments];\n};\n\nexport const workerCommand = async (\n workerPath: string,\n workerArguments: string[],\n): Promise<string> =>\n (await scriptSpawnArgs(workerPath, workerArguments)).map(shellQuote).join(\" \");\n\nexport const spawnDetached = async (\n workerPath: string,\n workerArguments: string[],\n cwd: string,\n): Promise<{ pid: number; stop(): Promise<void>; isAlive(): Promise<boolean> }> => {\n const runtime = await resolveScriptRuntime();\n const child = spawn(runtime, [workerPath, ...workerArguments], {\n cwd,\n detached: process.platform !== \"win32\",\n stdio: \"ignore\",\n });\n if (!child.pid) throw new Error(\"Failed to launch Fabric worker process\");\n const pid = child.pid;\n child.unref();\n return {\n pid,\n async stop() {\n try {\n process.kill(process.platform === \"win32\" ? pid : -pid, \"SIGTERM\");\n } catch { /* process group already exited */ }\n },\n async isAlive() {\n return processIsAlive(pid);\n },\n };\n};\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,UAAU,aAAa;AAChC,OAAO,QAAQ;AACf,OAAO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M,qBAAqB,OAAO;
|
|
4
|
+
"sourcesContent": ["import { execFile, spawn } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nexport interface ExecFileResult {\n stdout: string;\n stderr: string;\n}\n\nexport const executeFile = (\n command: string,\n args: string[],\n options: { cwd?: string; timeoutMs?: number } = {},\n): Promise<ExecFileResult> =>\n new Promise((resolve, reject) => {\n execFile(\n command,\n args,\n {\n encoding: \"utf8\",\n maxBuffer: 10 * 1024 * 1024,\n ...(options.cwd ? { cwd: options.cwd } : {}),\n ...(options.timeoutMs ? { timeout: options.timeoutMs } : {}),\n },\n (error, stdout, stderr) => {\n if (error) {\n Object.assign(error, { stdout, stderr });\n reject(error);\n return;\n }\n resolve({ stdout, stderr });\n },\n );\n });\n\n/** Windows resolves bare names through PATHEXT; POSIX needs the execute bit. */\nconst executableNames = (command: string, env: NodeJS.ProcessEnv): string[] => {\n if (process.platform !== \"win32\" || path.extname(command) !== \"\") return [command];\n const extensions = (env.PATHEXT ?? \".COM;.EXE;.BAT;.CMD\")\n .split(\";\")\n .map((extension) => extension.trim().toLowerCase())\n .filter((extension) => extension !== \"\");\n return [command, ...extensions.map((extension) => command + extension)];\n};\n\nconst unquotePathEntry = (entry: string): string => {\n const trimmed = entry.trim();\n return trimmed.length > 1 && trimmed.startsWith('\"') && trimmed.endsWith('\"')\n ? trimmed.slice(1, -1)\n : trimmed;\n};\n\nconst isExecutableFile = async (candidate: string): Promise<boolean> => {\n try {\n const stats = await fs.promises.stat(candidate);\n if (!stats.isFile()) return false;\n // Windows has no execute bit; PATHEXT already narrowed the candidate name.\n return process.platform === \"win32\" || (stats.mode & 0o111) !== 0;\n } catch {\n return false;\n }\n};\n\n/**\n * PATH lookup that never shells out: Windows runners reach this code with no\n * `sh` on PATH, and a login shell may rewrite PATH behind the caller's back.\n */\nexport const commandAvailable = async (\n command: string,\n env: NodeJS.ProcessEnv = process.env,\n): Promise<boolean> => {\n const names = executableNames(command, env);\n for (const entry of (env.PATH ?? \"\").split(path.delimiter)) {\n const directory = unquotePathEntry(entry);\n if (directory === \"\") continue;\n for (const name of names) {\n if (await isExecutableFile(path.join(directory, name))) return true;\n }\n }\n return false;\n};\n\nconst shellQuote = (value: string): string => `'${value.replaceAll(\"'\", `'\"'\"'`)}'`;\n\nexport const processIsAlive = (pid: number): boolean => {\n if (!Number.isSafeInteger(pid) || pid <= 0) return false;\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n // On Windows, EPERM means the process exists but cannot be opened for\n // signaling; only ESRCH (or other errors) mean it is gone.\n return error instanceof Error && \"code\" in error && (error as NodeJS.ErrnoException).code === \"EPERM\";\n }\n};\n\nconst GENERIC_RUNTIME = /^(node|bun)(\\.exe)?$/;\n\nexport interface ScriptRuntimeOptions {\n execPath?: string;\n env?: NodeJS.ProcessEnv;\n /** Require Node.js specifically; used by the Node-process executor whose\n * `--eval`/`--input-type=module` flags are Node-only. */\n requireNode?: boolean;\n /** Require Bun specifically; used by the Bun-process executor. */\n requireBun?: boolean;\n}\n\nconst runtimeOverride = (env: NodeJS.ProcessEnv): string | undefined => {\n const value = env.PI_FABRIC_NODE_BINARY;\n return typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n};\n\nconst isGenericRuntime = (execPath: string, requireNode: boolean, requireBun = false): boolean => {\n const name = path.basename(execPath).toLowerCase();\n return GENERIC_RUNTIME.test(name)\n && (!requireNode || name.startsWith(\"node\"))\n && (!requireBun || name.startsWith(\"bun\"));\n};\n\nconst missingRuntimeError = (execPath: string, requireNode: boolean, requireBun = false): Error => {\n const required = requireNode\n ? \"a Node.js runtime\"\n : requireBun\n ? \"a Bun runtime\"\n : \"a Node.js or Bun runtime\";\n const shape = requireNode ? \"(not node)\" : requireBun ? \"(not bun)\" : \"(not node/bun)\";\n return new Error(\n `Fabric requires ${required} to launch a JavaScript worker, but ` +\n `process.execPath is ${execPath} ${shape} and PI_FABRIC_NODE_BINARY is unset. ` +\n \"Install Node.js or Bun, or set PI_FABRIC_NODE_BINARY to the runtime binary.\",\n );\n};\n\n// Transports launch the worker (a .js module) as `<runtime> worker.js args`.\n// Under the new Bun-compiled pi binary, process.execPath is the pi executable,\n// not node/bun, so it cannot run an arbitrary script. Resolve a real runtime\n// before spawning: reuse process.execPath when it IS node/bun, else fall back\n// to PI_FABRIC_NODE_BINARY, then the first node/bun on PATH.\nconst resolveScriptRuntimeUncached = async (options: ScriptRuntimeOptions = {}): Promise<string> => {\n const execPath = options.execPath ?? process.execPath;\n const env = options.env ?? process.env;\n const requireNode = options.requireNode === true;\n const requireBun = options.requireBun === true;\n if (isGenericRuntime(execPath, requireNode, requireBun)) return execPath;\n const override = runtimeOverride(env);\n if (override) return override;\n for (const candidate of requireNode ? [\"node\"] : requireBun ? [\"bun\"] : [\"node\", \"bun\"]) {\n if (await commandAvailable(candidate)) return candidate;\n }\n throw missingRuntimeError(execPath, requireNode, requireBun);\n};\n\nlet cachedDefaultRuntime: string | undefined;\nexport const resolveScriptRuntime = async (options?: ScriptRuntimeOptions): Promise<string> => {\n if (\n options &&\n (options.execPath !== undefined ||\n options.env !== undefined ||\n options.requireNode !== undefined ||\n options.requireBun !== undefined)\n ) {\n return resolveScriptRuntimeUncached(options);\n }\n if (cachedDefaultRuntime) return cachedDefaultRuntime;\n cachedDefaultRuntime = await resolveScriptRuntimeUncached();\n return cachedDefaultRuntime;\n};\n\n// Synchronous variant for callers that already run under a real runtime (e.g.\n// the worker, which a transport always launches via the resolved runtime). No\n// PATH lookup; throws if the current process is the bundled binary with no\n// override set.\nexport const resolveScriptRuntimeSync = (options: ScriptRuntimeOptions = {}): string => {\n const execPath = options.execPath ?? process.execPath;\n const env = options.env ?? process.env;\n const requireNode = options.requireNode === true;\n const requireBun = options.requireBun === true;\n if (isGenericRuntime(execPath, requireNode, requireBun)) return execPath;\n const override = runtimeOverride(env);\n if (override) return override;\n throw missingRuntimeError(execPath, requireNode, requireBun);\n};\n\nconst typescriptWorker = (workerPath: string): boolean =>\n /.[cm]?tsx?$/i.test(path.extname(workerPath));\n\nconst runtimeOptionsForWorker = (\n workerPath: string,\n options?: ScriptRuntimeOptions,\n): ScriptRuntimeOptions | undefined => {\n if (!typescriptWorker(workerPath) || options?.requireNode || options?.requireBun) return options;\n return { ...options, requireBun: true };\n};\n\nexport const scriptSpawnArgs = async (\n workerPath: string,\n workerArguments: readonly string[],\n options?: ScriptRuntimeOptions,\n): Promise<string[]> => {\n const runtime = await resolveScriptRuntime(runtimeOptionsForWorker(workerPath, options));\n return [runtime, workerPath, ...workerArguments];\n};\n\nexport const workerCommand = async (\n workerPath: string,\n workerArguments: string[],\n): Promise<string> =>\n (await scriptSpawnArgs(workerPath, workerArguments)).map(shellQuote).join(\" \");\n\nexport const spawnDetached = async (\n workerPath: string,\n workerArguments: string[],\n cwd: string,\n): Promise<{ pid: number; stop(): Promise<void>; isAlive(): Promise<boolean> }> => {\n const runtime = await resolveScriptRuntime(runtimeOptionsForWorker(workerPath));\n const child = spawn(runtime, [workerPath, ...workerArguments], {\n cwd,\n detached: process.platform !== \"win32\",\n stdio: \"ignore\",\n });\n if (!child.pid) throw new Error(\"Failed to launch Fabric worker process\");\n const pid = child.pid;\n child.unref();\n return {\n pid,\n async stop() {\n try {\n process.kill(process.platform === \"win32\" ? pid : -pid, \"SIGTERM\");\n } catch { /* process group already exited */ }\n },\n async isAlive() {\n return processIsAlive(pid);\n },\n };\n};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU,aAAa;AAChC,OAAO,QAAQ;AACf,OAAO,UAAU;AAOV,IAAM,cAAc,CACzB,SACA,MACA,UAAgD,CAAC,MAEjD,IAAI,QAAQ,CAAC,SAAS,WAAW;AAC/B;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,MACE,UAAU;AAAA,MACV,WAAW,KAAK,OAAO;AAAA,MACvB,GAAI,QAAQ,MAAM,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC;AAAA,MAC1C,GAAI,QAAQ,YAAY,EAAE,SAAS,QAAQ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G,eAAe;AACjD;AAEO,IAAM,gBAAgB,OAC3B,YACA,qBAEC,MAAM,gBAAgB,YAAY,eAAe,GAAG,IAAI,UAAU,EAAE,KAAK,GAAG;AAExE,IAAM,gBAAgB,OAC3B,YACA,iBACA,QACiF;AACjF,QAAM,UAAU,MAAM,qBAAqB,wBAAwB,UAAU,CAAC;AAC9E,QAAM,QAAQ,MAAM,SAAS,CAAC,YAAY,GAAG,eAAe,GAAG;AAAA,IAC7D;AAAA,IACA,UAAU,QAAQ,aAAa;AAAA,IAC/B,OAAO;AAAA,EACT,CAAC;AACD,MAAI,CAAC,MAAM,IAAK,OAAM,IAAI,MAAM,wCAAwC;AACxE,QAAM,MAAM,MAAM;AAClB,QAAM,MAAM;AACZ,SAAO;AAAA,IACL;AAAA,IACA,MAAM,OAAO;AACX,UAAI;AACF,gBAAQ,KAAK,QAAQ,aAAa,UAAU,MAAM,CAAC,KAAK,SAAS;AAAA,MACnE,QAAQ;AAAA,MAAqC;AAAA,IAC/C;AAAA,IACA,MAAM,UAAU;AACd,aAAO,eAAe,GAAG;AAAA,IAC3B;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-J2HV2URQ.js";
|
|
21
21
|
import {
|
|
22
22
|
fabricStringLiterals
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-SZUXWOO7.js";
|
|
24
24
|
|
|
25
25
|
// src/ui/structured.ts
|
|
26
26
|
import { createRequire } from "node:module";
|
|
@@ -4236,4 +4236,4 @@ export {
|
|
|
4236
4236
|
formatJsonAsYaml,
|
|
4237
4237
|
formatFabricValue
|
|
4238
4238
|
};
|
|
4239
|
-
//# sourceMappingURL=chunk-
|
|
4239
|
+
//# sourceMappingURL=chunk-7VAZ4N43.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fabricExecTitleHint
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SZUXWOO7.js";
|
|
4
4
|
import {
|
|
5
5
|
FABRIC_BRANCH_RUN_DESCRIPTION_MAX_BYTES,
|
|
6
6
|
FABRIC_BRANCH_RUN_NAME_MAX_BYTES,
|
|
@@ -1921,4 +1921,4 @@ export {
|
|
|
1921
1921
|
compileFabricSummary,
|
|
1922
1922
|
registerCompactionHook
|
|
1923
1923
|
};
|
|
1924
|
-
//# sourceMappingURL=chunk-
|
|
1924
|
+
//# sourceMappingURL=chunk-MQG5QKGI.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
scriptSpawnArgs,
|
|
6
6
|
spawnDetached,
|
|
7
7
|
workerCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7BG5COXB.js";
|
|
9
9
|
import {
|
|
10
10
|
mapVedaTools,
|
|
11
11
|
normalizeVedaModel
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
peerLabelPrefix,
|
|
20
20
|
writeHandoffSession
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-XKRZHYH3.js";
|
|
22
22
|
import {
|
|
23
23
|
resolveAgentDir
|
|
24
24
|
} from "./chunk-PXAICAUT.js";
|
|
@@ -6979,4 +6979,4 @@ export {
|
|
|
6979
6979
|
agentParticipantRecords,
|
|
6980
6980
|
actorParticipantRecord
|
|
6981
6981
|
};
|
|
6982
|
-
//# sourceMappingURL=chunk-
|
|
6982
|
+
//# sourceMappingURL=chunk-RR6RARD5.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ui/fabric-code-parser.ts"],
|
|
4
|
+
"sourcesContent": ["import { createRequire } from \"node:module\";\nimport type { SyntaxNodeRef } from \"@lezer/common\";\nimport type { FabricKernel } from \"../runtime/kernel.js\";\n\nconst require = createRequire(import.meta.url);\nlet pythonParser: typeof import(\"@lezer/python\")[\"parser\"] | undefined;\n\nexport interface FabricWriteBinding {\n path: string;\n stringKey: string;\n}\n\ntype Token = { kind: \"identifier\" | \"string\" | \"punctuation\"; text: string };\n\nconst identifierStart = (char: string): boolean => /[A-Za-z_$\u03C0]/u.test(char);\nconst identifierPart = (char: string): boolean => /[A-Za-z0-9_$\u03C0]/u.test(char);\n\nconst readEscape = (source: string, index: number): { value: string; next: number } => {\n const char = source[index];\n if (char === undefined) return { value: \"\", next: index };\n const simple: Record<string, string> = {\n n: \"\\n\", r: \"\\r\", t: \"\\t\", b: \"\\b\", f: \"\\f\", v: \"\\v\", 0: \"\\0\",\n };\n if (char in simple) return { value: simple[char]!, next: index + 1 };\n if (char === \"\\n\") return { value: \"\", next: index + 1 };\n if (char === \"\\r\") return { value: \"\", next: source[index + 1] === \"\\n\" ? index + 2 : index + 1 };\n if (char === \"x\") {\n const digits = source.slice(index + 1, index + 3);\n if (/^[0-9a-f]{2}$/i.test(digits)) return { value: String.fromCharCode(Number.parseInt(digits, 16)), next: index + 3 };\n }\n if (char === \"u\") {\n if (source[index + 1] === \"{\") {\n const end = source.indexOf(\"}\", index + 2);\n const digits = end < 0 ? \"\" : source.slice(index + 2, end);\n if (/^[0-9a-f]{1,6}$/i.test(digits)) {\n return { value: String.fromCodePoint(Number.parseInt(digits, 16)), next: end + 1 };\n }\n }\n const digits = source.slice(index + 1, index + 5);\n if (/^[0-9a-f]{4}$/i.test(digits)) return { value: String.fromCharCode(Number.parseInt(digits, 16)), next: index + 5 };\n }\n return { value: char, next: index + 1 };\n};\n\n// Use the Python grammar so comments, docstrings and interpolated strings\n// cannot masquerade as capability calls. Normalize keyword arguments to the\n// same token shape as object/dictionary fields for the shared title renderer.\nconst tokenizePython = (source: string): Token[] => {\n const tokens: Token[] = [];\n (pythonParser ??= (require(\"@lezer/python\") as typeof import(\"@lezer/python\")).parser).parse(source).iterate({\n enter(node: SyntaxNodeRef) {\n if (node.name === \"Comment\" || node.name === \"FormatString\") return false;\n const text = source.slice(node.from, node.to);\n if (node.name === \"String\") {\n const match = /^(r|u)?('''|\"\"\"|'|\")/i.exec(text);\n if (!match) return false;\n const quote = match[2]!;\n if (!text.endsWith(quote) || text.length < match[0].length + quote.length) return false;\n const body = text.slice(match[0].length, -quote.length);\n let value = \"\";\n for (let index = 0; index < body.length;) {\n if (body[index] === \"\\\\\" && match[1]?.toLowerCase() !== \"r\") {\n const escape = body[index + 1] ?? \"\";\n const width = escape === \"x\" ? 2 : escape === \"u\" ? 4 : escape === \"U\" ? 8 : 0;\n if (width) {\n const digits = body.slice(index + 2, index + 2 + width);\n if (digits.length !== width || !/^[0-9a-f]+$/i.test(digits)) return false;\n const point = Number.parseInt(digits, 16);\n if (point > 0x10ffff) return false;\n value += String.fromCodePoint(point);\n index += width + 2;\n } else if (/[0-7]/.test(escape)) {\n const digits = /^[0-7]{1,3}/.exec(body.slice(index + 1))![0];\n value += String.fromCharCode(Number.parseInt(digits, 8));\n index += digits.length + 1;\n } else if (escape === \"a\") {\n value += \"\\x07\";\n index += 2;\n } else if (/[\\\\'\"nrtbfv\\n\\r]/.test(escape)) {\n const escaped = readEscape(body, index + 1);\n value += escaped.value;\n index = escaped.next;\n } else if (escape === \"N\") {\n // Unicode-name lookup needs Python's database; stay conservative.\n return false;\n } else {\n // Unknown Python escapes remain literal, unlike JavaScript.\n value += body.slice(index, index + 2);\n index += 2;\n }\n } else value += body[index++]!;\n }\n tokens.push({ kind: \"string\", text: value });\n return false;\n }\n if (node.node.firstChild) return;\n if (node.name === \"VariableName\" || node.name === \"PropertyName\") {\n tokens.push({ kind: \"identifier\", text });\n } else tokens.push({ kind: \"punctuation\", text: text === \"=\" ? \":\" : text });\n },\n });\n return tokens;\n};\n\nconst tokenize = (source: string): Token[] => {\n const tokens: Token[] = [];\n let index = 0;\n while (index < source.length) {\n const char = source[index]!;\n if (/\\s/u.test(char)) { index++; continue; }\n if (char === \"/\" && source[index + 1] === \"/\") {\n index = source.indexOf(\"\\n\", index + 2);\n if (index < 0) break;\n continue;\n }\n if (char === \"/\" && source[index + 1] === \"*\") {\n const end = source.indexOf(\"*/\", index + 2);\n index = end < 0 ? source.length : end + 2;\n continue;\n }\n if (char === \"'\" || char === '\"' || char === \"`\") {\n const quote = char;\n let value = \"\";\n let dynamicTemplate = false;\n index++;\n while (index < source.length) {\n const current = source[index]!;\n if (current === quote) { index++; break; }\n if (quote === \"`\" && current === \"$\" && source[index + 1] === \"{\") dynamicTemplate = true;\n if (current === \"\\\\\") {\n const escaped = readEscape(source, index + 1);\n value += escaped.value;\n index = escaped.next;\n continue;\n }\n value += current;\n index++;\n }\n if (!dynamicTemplate) tokens.push({ kind: \"string\", text: value });\n continue;\n }\n if (identifierStart(char)) {\n const start = index++;\n while (index < source.length && identifierPart(source[index]!)) index++;\n tokens.push({ kind: \"identifier\", text: source.slice(start, index) });\n continue;\n }\n tokens.push({ kind: \"punctuation\", text: char });\n index++;\n }\n return tokens;\n};\n\nexport const fabricStringLiterals = (code: string): string[] =>\n tokenize(code).filter((token) => token.kind === \"string\").map((token) => token.text);\n\nconst propertyName = (token: Token | undefined): string | undefined =>\n token?.kind === \"identifier\" || token?.kind === \"string\" ? token.text : undefined;\n\nconst namedStringKey = (tokens: Token[], start: number, end: number): string | undefined => {\n if (tokens[start]?.text !== \"\u03C0\") return undefined;\n if (tokens[start + 1]?.text === \".\" && tokens[start + 2]?.kind === \"identifier\" && start + 3 === end) {\n return tokens[start + 2]!.text;\n }\n if (tokens[start + 1]?.text === \"[\" && tokens[start + 2]?.kind === \"string\" && tokens[start + 3]?.text === \"]\" && start + 4 === end) {\n return tokens[start + 2]!.text;\n }\n return undefined;\n};\n\nconst objectBinding = (tokens: Token[], start: number): { binding?: FabricWriteBinding; next: number } => {\n let depth = 1;\n let index = start + 1;\n let path: string | undefined;\n let stringKey: string | undefined;\n while (index < tokens.length && depth > 0) {\n if (tokens[index]?.text === \"{\") { depth++; index++; continue; }\n if (tokens[index]?.text === \"}\") { depth--; index++; continue; }\n if (depth !== 1) { index++; continue; }\n const name = propertyName(tokens[index]);\n if (!name || tokens[index + 1]?.text !== \":\") { index++; continue; }\n const valueStart = index + 2;\n let valueEnd = valueStart;\n let nested = 0;\n while (valueEnd < tokens.length) {\n const text = tokens[valueEnd]!.text;\n if (nested === 0 && (text === \",\" || text === \"}\")) break;\n if (text === \"(\" || text === \"[\" || text === \"{\") nested++;\n else if (text === \")\" || text === \"]\" || text === \"}\") nested--;\n valueEnd++;\n }\n if ([\"path\", \"file\", \"file_path\"].includes(name) && valueEnd === valueStart + 1 && tokens[valueStart]?.kind === \"string\") {\n path = tokens[valueStart]!.text;\n } else if ([\"content\", \"text\", \"contents\"].includes(name)) {\n stringKey = namedStringKey(tokens, valueStart, valueEnd);\n }\n index = valueEnd;\n }\n return path !== undefined && stringKey !== undefined\n ? { binding: { path, stringKey }, next: index }\n : { next: index };\n};\n\nexport const fabricWriteBindings = (code: string): FabricWriteBinding[] => {\n const tokens = tokenize(code);\n const bindings: FabricWriteBinding[] = [];\n for (let index = 0; index < tokens.length - 5; index++) {\n if (tokens[index]?.text !== \"pi\" || tokens[index + 1]?.text !== \".\" || tokens[index + 2]?.text !== \"write\" || tokens[index + 3]?.text !== \"(\" || tokens[index + 4]?.text !== \"{\") continue;\n const parsed = objectBinding(tokens, index + 4);\n if (parsed.binding) bindings.push(parsed.binding);\n index = parsed.next - 1;\n }\n return bindings;\n};\n\nconst TITLE_MAX_CHARS = 80;\nconst TITLE_MAX_ANCHOR_CHARS = 40;\nconst TITLE_MAX_COMMAND_CHARS = 30;\nconst TITLE_MAX_TASK_CHARS = 40;\nconst TITLE_MAX_PATTERN_CHARS = 24;\nconst TITLE_MAX_KEY_CHARS = 24;\nconst TITLE_MAX_WINDOW_TOKENS = 96;\nconst TITLE_SAFE_ANCHOR = /^[A-Za-z0-9_./~@*+,-]+$/;\nconst TITLE_FILE_LIKE = /\\.[A-Za-z0-9]{1,8}$/;\n\nconst PI_VERB_LABELS: Record<string, string> = {\n read: \"Read\",\n bash: \"Shell\",\n edit: \"Edit\",\n write: \"Write\",\n grep: \"Search\",\n find: \"Search\",\n ls: \"Search\",\n};\n\nconst ROOT_VERB_LABELS: Record<string, string> = {\n agents: \"Agent\",\n memory: \"Memory\",\n state: \"State\",\n schema: \"Schema\",\n compact: \"Compact\",\n mesh: \"Mesh\",\n tools: \"Tools\",\n};\n\nconst TITLE_PATH_KEYS = new Set([\"path\", \"file\", \"file_path\"]);\n\nconst humanizeIdentifier = (value: string): string =>\n value\n .replace(/[_-]+/g, \" \")\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/^./, (char) => char.toUpperCase());\n\nconst titleAnchorPathLike = (value: string): boolean =>\n value.length > 0 &&\n value.length <= 64 &&\n TITLE_SAFE_ANCHOR.test(value) &&\n (value.includes(\"/\") || TITLE_FILE_LIKE.test(value) || value.includes(\"*\"));\n\nconst titleBasename = (value: string): string =>\n value.split(\"/\").filter(Boolean).pop() ?? value;\n\nconst titleClip = (value: string, maxChars: number): string =>\n value.length > maxChars ? `${value.slice(0, maxChars - 1)}\u2026` : value;\n\nconst clipWords = (value: string, maxChars: number): string => {\n if (value.length <= maxChars) return value;\n const cut = value.slice(0, maxChars - 1);\n const space = cut.lastIndexOf(\" \");\n return `${space > 0 ? cut.slice(0, space) : cut}\u2026`;\n};\n\n// Token range of one call's argument list: from just after the opening paren\n// to the depth-matched close, capped so a malformed call cannot smear across\n// the rest of the program.\nconst callWindow = (tokens: Token[], openIndex: number): { start: number; end: number } => {\n let depth = 0;\n let end = openIndex;\n while (end < tokens.length && end - openIndex < TITLE_MAX_WINDOW_TOKENS) {\n const text = tokens[end]!.text;\n if (text === \"(\" || text === \"[\" || text === \"{\") depth++;\n else if (text === \")\" || text === \"]\" || text === \"}\") {\n depth--;\n if (depth <= 0) break;\n }\n end++;\n }\n return { start: openIndex + 1, end };\n};\n\nconst isNamedStringToken = (tokens: Token[], index: number): boolean =>\n tokens[index]?.kind === \"string\" && tokens[index - 1]?.text === \"[\" && tokens[index - 2]?.text === \"\u03C0\";\n\nconst windowKeyedString = (\n tokens: Token[],\n start: number,\n end: number,\n keys: Set<string> | string,\n): string | undefined => {\n for (let index = start; index < end; index++) {\n if (tokens[index]?.kind !== \"string\" || isNamedStringToken(tokens, index)) continue;\n if (tokens[index - 1]?.text !== \":\") continue;\n const key = propertyName(tokens[index - 2]);\n if (key === undefined || !(typeof keys === \"string\" ? key === keys : keys.has(key))) continue;\n return tokens[index]!.text;\n }\n return undefined;\n};\n\nconst windowFirstString = (tokens: Token[], start: number, end: number): string | undefined => {\n for (let index = start; index < end; index++) {\n if (tokens[index]?.kind === \"string\" && !isNamedStringToken(tokens, index)) return tokens[index]!.text;\n }\n return undefined;\n};\n\nconst windowPathLike = (tokens: Token[], start: number, end: number): string | undefined => {\n for (let index = start; index < end; index++) {\n if (tokens[index]?.kind === \"string\" && !isNamedStringToken(tokens, index) && titleAnchorPathLike(tokens[index]!.text)) {\n return tokens[index]!.text;\n }\n }\n return undefined;\n};\n\nconst dirQualifier = (value: string): string | undefined =>\n TITLE_FILE_LIKE.test(titleBasename(value))\n ? titleClip(titleBasename(value), TITLE_MAX_ANCHOR_CHARS)\n : TITLE_SAFE_ANCHOR.test(value) && value !== \".\" && value.length <= TITLE_MAX_ANCHOR_CHARS\n ? value\n : undefined;\n\nconst searchTarget = (tokens: Token[], start: number, end: number): string | undefined => {\n const pattern = windowKeyedString(tokens, start, end, \"pattern\");\n let head: string | undefined;\n if (pattern !== undefined) {\n if (titleAnchorPathLike(pattern)) head = titleClip(titleBasename(pattern), TITLE_MAX_ANCHOR_CHARS);\n else if (TITLE_SAFE_ANCHOR.test(pattern) && pattern.length <= TITLE_MAX_PATTERN_CHARS) head = `\"${pattern}\"`;\n }\n const pathValue = windowKeyedString(tokens, start, end, TITLE_PATH_KEYS);\n let tail: string | undefined = pathValue !== undefined ? dirQualifier(pathValue) : undefined;\n if (tail === undefined && pathValue === undefined) {\n // ls-style positional: the first bare string argument.\n const positional = windowFirstString(tokens, start, end);\n if (positional !== undefined && TITLE_SAFE_ANCHOR.test(positional) && positional.length <= TITLE_MAX_ANCHOR_CHARS) {\n tail = titleAnchorPathLike(positional) ? titleClip(titleBasename(positional), TITLE_MAX_ANCHOR_CHARS) : positional;\n }\n }\n if (head !== undefined && tail !== undefined) return `${head} in ${tail}`;\n return head ?? tail;\n};\n\nconst pathTarget = (tokens: Token[], start: number, end: number): string | undefined => {\n const keyed = windowKeyedString(tokens, start, end, TITLE_PATH_KEYS);\n if (keyed !== undefined && TITLE_FILE_LIKE.test(titleBasename(keyed))) {\n return titleClip(titleBasename(keyed), TITLE_MAX_ANCHOR_CHARS);\n }\n const loose = windowPathLike(tokens, start, end);\n if (loose !== undefined) return titleClip(titleBasename(loose), TITLE_MAX_ANCHOR_CHARS);\n return keyed !== undefined ? dirQualifier(keyed) : undefined;\n};\n\nconst piCallTarget = (\n label: string,\n tokens: Token[],\n start: number,\n end: number,\n): string | undefined => {\n if (label === \"Shell\") {\n const command = windowFirstString(tokens, start, end);\n return command !== undefined ? titleClip(command.split(\"\\n\")[0]!, TITLE_MAX_COMMAND_CHARS) : undefined;\n }\n if (label === \"Search\") return searchTarget(tokens, start, end);\n return pathTarget(tokens, start, end);\n};\n\n// Deterministic lexical title for a fabric_exec program, derived without\n// executing it. Every recognized call contributes \"Verb target\" \u2014 target is\n// a basename, glob, quoted literal search head, command head, mcp ref, or\n// task/key clip \u2014 and segments join in first-occurrence order under a char\n// budget. \u03C0 payload keys are skipped so named strings never surface in\n// titles. Returns undefined when the program holds no recognizable Fabric\n// call, letting callers keep a neutral fallback.\nexport const fabricExecTitleHint = (code: string, kernel: FabricKernel = \"typescript\"): string | undefined => {\n const tokens = kernel === \"python\" ? tokenizePython(code) : tokenize(code);\n const groups = new Map<string, (string | undefined)[]>();\n const record = (verb: string, target: string | undefined): void => {\n const list = groups.get(verb);\n if (list) list.push(target);\n else groups.set(verb, [target]);\n };\n for (let index = 0; index < tokens.length; index++) {\n const token = tokens[index]!;\n if (token.kind !== \"identifier\") continue;\n if ((token.text === \"agents\" || token.text === \"compact\") && tokens[index + 1]?.text === \"(\") {\n const window = callWindow(tokens, index + 1);\n const target = token.text === \"agents\"\n ? (() => {\n const task = windowKeyedString(tokens, window.start, window.end, \"task\");\n return task !== undefined ? clipWords(task.split(\"\\n\")[0]!, TITLE_MAX_TASK_CHARS) : undefined;\n })()\n : undefined;\n record(ROOT_VERB_LABELS[token.text]!, target);\n continue;\n }\n const dot = tokens[index + 1];\n const leaf = tokens[index + 2];\n if (dot?.text !== \".\" || leaf?.kind !== \"identifier\") continue;\n if (token.text === \"pi\" && tokens[index + 3]?.text === \"(\") {\n const label = PI_VERB_LABELS[leaf.text] ?? humanizeIdentifier(leaf.text);\n const window = callWindow(tokens, index + 3);\n record(label, piCallTarget(label, tokens, window.start, window.end));\n continue;\n }\n if (\n token.text === \"mcp\" &&\n tokens[index + 3]?.text === \".\" &&\n tokens[index + 4]?.kind === \"identifier\" &&\n tokens[index + 5]?.text === \"(\"\n ) {\n record(\"Mcp\", `${leaf.text}.${tokens[index + 4]!.text}`);\n continue;\n }\n if (tokens[index + 3]?.text === \"(\") {\n const label = ROOT_VERB_LABELS[token.text];\n if (!label) continue;\n if (token.text === \"memory\" || token.text === \"state\") {\n const window = callWindow(tokens, index + 3);\n const key = windowKeyedString(tokens, window.start, window.end, \"key\");\n record(label, key !== undefined ? clipWords(key.split(\"\\n\")[0]!, TITLE_MAX_KEY_CHARS) : undefined);\n } else {\n record(label, undefined);\n }\n }\n }\n if (groups.size === 0) return undefined;\n const segments: string[] = [];\n for (const [verb, targets] of groups) {\n const first = targets.find((target) => target !== undefined);\n let segment = verb;\n if (first !== undefined) {\n segment = `${verb} ${first}`;\n if (targets.length > 1) {\n segment += targets.every((target) => target === first) ? ` \u00D7${targets.length}` : ` +${targets.length - 1}`;\n }\n } else if (targets.length > 1) {\n segment += ` \u00D7${targets.length}`;\n }\n segments.push(segment);\n }\n let title: string | undefined;\n let overflow = false;\n for (const segment of segments) {\n if (title === undefined) {\n title = segment.length <= TITLE_MAX_CHARS ? segment : clipWords(segment, TITLE_MAX_CHARS);\n continue;\n }\n const candidate = `${title} + ${segment}`;\n if (candidate.length <= TITLE_MAX_CHARS) {\n title = candidate;\n continue;\n }\n overflow = true;\n break;\n }\n if (overflow && title !== undefined && title.length + 3 <= TITLE_MAX_CHARS) title = `${title} +\u2026`;\n return title;\n};"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,qBAAqB;AAI9B,IAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAI;AASJ,IAAM,kBAAkB,CAAC,SAA0B,eAAe,KAAK,IAAI;AAC3E,IAAM,iBAAiB,CAAC,SAA0B,kBAAkB,KAAK,IAAI;AAE7E,IAAM,aAAa,CAAC,QAAgB,UAAmD;AACrF,QAAM,OAAO,OAAO,KAAK;AACzB,MAAI,SAAS,OAAW,QAAO,EAAE,OAAO,IAAI,MAAM,MAAM;AACxD,QAAM,SAAiC;AAAA,IACrC,GAAG;AAAA,IAAM,GAAG;AAAA,IAAM,GAAG;AAAA,IAAM,GAAG;AAAA,IAAM,GAAG;AAAA,IAAM,GAAG;AAAA,IAAM,GAAG;AAAA,EAC3D;AACA,MAAI,QAAQ,OAAQ,QAAO,EAAE,OAAO,OAAO,IAAI,GAAI,MAAM,QAAQ,EAAE;AACnE,MAAI,SAAS,KAAM,QAAO,EAAE,OAAO,IAAI,MAAM,QAAQ,EAAE;AACvD,MAAI,SAAS,KAAM,QAAO,EAAE,OAAO,IAAI,MAAM,OAAO,QAAQ,CAAC,MAAM,OAAO,QAAQ,IAAI,QAAQ,EAAE;AAChG,MAAI,SAAS,KAAK;AAChB,UAAM,SAAS,OAAO,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAChD,QAAI,iBAAiB,KAAK,MAAM,EAAG,QAAO,EAAE,OAAO,OAAO,aAAa,OAAO,SAAS,QAAQ,EAAE,CAAC,GAAG,MAAM,QAAQ,EAAE;AAAA,EACvH;AACA,MAAI,S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,EAAE,CAAC,GAAI,mBAAmB,IAAI,MAAS;AAAA,MACnG,OAAO;AACL,eAAO,OAAO,MAAS;AAAA,MACzB;AAAA,IACF;AAAA,EACF;AACA,MAAI,OAAO,SAAS,EAAG,QAAO;AAC9B,QAAM,WAAqB,CAAC;AAC5B,aAAW,CAAC,MAAM,OAAO,KAAK,QAAQ;AACpC,UAAM,QAAQ,QAAQ,KAAK,CAAC,WAAW,WAAW,MAAS;AAC3D,QAAI,UAAU;AACd,QAAI,UAAU,QAAW;AACvB,gBAAU,GAAG,IAAI,IAAI,KAAK;AAC1B,UAAI,QAAQ,SAAS,GAAG;AACtB,mBAAW,QAAQ,MAAM,CAAC,WAAW,WAAW,KAAK,IAAI,QAAK,QAAQ,MAAM,KAAK,KAAK,QAAQ,SAAS,CAAC;AAAA,MAC1G;AAAA,IACF,WAAW,QAAQ,SAAS,GAAG;AAC7B,iBAAW,QAAK,QAAQ,MAAM;AAAA,IAChC;AACA,aAAS,KAAK,OAAO;AAAA,EACvB;AACA,MAAI;AACJ,MAAI,WAAW;AACf,aAAW,WAAW,UAAU;AAC9B,QAAI,UAAU,QAAW;AACvB,cAAQ,QAAQ,UAAU,kBAAkB,UAAU,UAAU,SAAS,eAAe;AACxF;AAAA,IACF;AACA,UAAM,YAAY,GAAG,KAAK,MAAM,OAAO;AACvC,QAAI,UAAU,UAAU,iBAAiB;AACvC,cAAQ;AACR;AAAA,IACF;AACA,eAAW;AACX;AAAA,EACF;AACA,MAAI,YAAY,UAAU,UAAa,MAAM,SAAS,KAAK,gBAAiB,SAAQ,GAAG,KAAK;AAC5F,SAAO;AACT;",
|
|
6
|
+
"names": ["require", "digits"]
|
|
7
|
+
}
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
resolveScriptRuntime,
|
|
18
18
|
resolveScriptRuntimeSync
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-7BG5COXB.js";
|
|
20
20
|
import {
|
|
21
21
|
isPiShellRef
|
|
22
22
|
} from "./chunk-YU62DDKK.js";
|
|
@@ -364,4 +364,4 @@ export {
|
|
|
364
364
|
NodeProcessRuntime,
|
|
365
365
|
BunProcessRuntime
|
|
366
366
|
};
|
|
367
|
-
//# sourceMappingURL=chunk-
|
|
367
|
+
//# sourceMappingURL=chunk-WIC446CZ.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compileFabricSummary,
|
|
3
3
|
rawContextTokens
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MQG5QKGI.js";
|
|
5
5
|
import {
|
|
6
6
|
compactionRequestBoundsError,
|
|
7
7
|
encodeCompactionRequest
|
|
@@ -444,4 +444,4 @@ export {
|
|
|
444
444
|
buildPeerCards,
|
|
445
445
|
awaitPeerSettle
|
|
446
446
|
};
|
|
447
|
-
//# sourceMappingURL=chunk-
|
|
447
|
+
//# sourceMappingURL=chunk-XKRZHYH3.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
agentParticipantRecords,
|
|
10
10
|
loadModelUsage,
|
|
11
11
|
useBudgetLedger
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-RR6RARD5.js";
|
|
13
13
|
import {
|
|
14
14
|
RESIDENT_HOST_FORMAT,
|
|
15
15
|
residentDeliveryPrefix,
|
|
@@ -691,4 +691,4 @@ if (isMain) {
|
|
|
691
691
|
export {
|
|
692
692
|
runResidentHostFromConfigPath
|
|
693
693
|
};
|
|
694
|
-
//# sourceMappingURL=chunk-
|
|
694
|
+
//# sourceMappingURL=chunk-Y66NZ2S7.js.map
|
package/dist/compaction/hook.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
fabricCompactionVersion,
|
|
5
5
|
rawContextTokens,
|
|
6
6
|
registerCompactionHook
|
|
7
|
-
} from "../chunks/chunk-
|
|
8
|
-
import "../chunks/chunk-
|
|
7
|
+
} from "../chunks/chunk-MQG5QKGI.js";
|
|
8
|
+
import "../chunks/chunk-SZUXWOO7.js";
|
|
9
9
|
import "../chunks/chunk-ZDNGXLEC.js";
|
|
10
10
|
import "../chunks/chunk-3H7SDWZI.js";
|
|
11
11
|
import "../chunks/chunk-D5WKZONW.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fabric-exec-tool.d.ts","sourceRoot":"","sources":["../src/fabric-exec-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAa7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,4BAA4B,CAAC;AAQpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"fabric-exec-tool.d.ts","sourceRoot":"","sources":["../src/fabric-exec-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAa7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,4BAA4B,CAAC;AAQpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgBrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AA6CjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAqDxE,eAAO,MAAM,oBAAoB,GAC/B,OAAO,WAAW,EAClB,qBAAqB,mBAAmB,EACxC,iBAAiB,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAClD,gBAAe,wBAA+C,EAC9D,cAAc,2BAA2B,KACxC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CA83B9B,CAAC"}
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
expandSkillDirMarkersForRead,
|
|
34
34
|
resolveFabricIdentity,
|
|
35
35
|
runFabricHandoffAtBoundary
|
|
36
|
-
} from "./chunks/chunk-
|
|
36
|
+
} from "./chunks/chunk-45QTPCE7.js";
|
|
37
37
|
import {
|
|
38
38
|
AgentTranscriptReader,
|
|
39
39
|
MAX_WRITE_DIFF_BYTES,
|
|
@@ -130,12 +130,12 @@ import {
|
|
|
130
130
|
resolveInheritedSessionPins,
|
|
131
131
|
resolvePiBinary,
|
|
132
132
|
withInheritedSessionPins
|
|
133
|
-
} from "./chunks/chunk-
|
|
133
|
+
} from "./chunks/chunk-RR6RARD5.js";
|
|
134
134
|
import {
|
|
135
135
|
executeFile,
|
|
136
136
|
processIsAlive,
|
|
137
137
|
spawnDetached
|
|
138
|
-
} from "./chunks/chunk-
|
|
138
|
+
} from "./chunks/chunk-7BG5COXB.js";
|
|
139
139
|
import "./chunks/chunk-VPPIJRNZ.js";
|
|
140
140
|
import "./chunks/chunk-PM5I335G.js";
|
|
141
141
|
import {
|
|
@@ -148,7 +148,7 @@ import {
|
|
|
148
148
|
} from "./chunks/chunk-TX6E5W7H.js";
|
|
149
149
|
import {
|
|
150
150
|
checkedHandoffCompaction
|
|
151
|
-
} from "./chunks/chunk-
|
|
151
|
+
} from "./chunks/chunk-XKRZHYH3.js";
|
|
152
152
|
import {
|
|
153
153
|
resolveAgentDir
|
|
154
154
|
} from "./chunks/chunk-PXAICAUT.js";
|
|
@@ -171,8 +171,8 @@ import "./chunks/chunk-OKOHRXGF.js";
|
|
|
171
171
|
import "./chunks/chunk-RAO6TQFP.js";
|
|
172
172
|
import {
|
|
173
173
|
fabricExecTitleHintCached
|
|
174
|
-
} from "./chunks/chunk-
|
|
175
|
-
import "./chunks/chunk-
|
|
174
|
+
} from "./chunks/chunk-MQG5QKGI.js";
|
|
175
|
+
import "./chunks/chunk-SZUXWOO7.js";
|
|
176
176
|
import {
|
|
177
177
|
writeJsonAtomic,
|
|
178
178
|
writeJsonAtomicAsync
|
|
@@ -11464,42 +11464,45 @@ var AgentCompletionInbox = class {
|
|
|
11464
11464
|
constructor(pi, context) {
|
|
11465
11465
|
this.pi = pi;
|
|
11466
11466
|
this.#context = context;
|
|
11467
|
-
|
|
11468
|
-
pi.on
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11467
|
+
const subscribe = (event, handler) => {
|
|
11468
|
+
if (typeof pi.on !== "function") return;
|
|
11469
|
+
const unsubscribe = pi.on(event, handler);
|
|
11470
|
+
if (typeof unsubscribe === "function") this.#unsubscribe.push(unsubscribe);
|
|
11471
|
+
};
|
|
11472
|
+
subscribe("turn_end", (event, ctx) => {
|
|
11473
|
+
this.#context = ctx;
|
|
11474
|
+
const stopReason = event.message?.role === "assistant" ? event.message.stopReason : void 0;
|
|
11475
|
+
if (ctx.signal?.aborted || stopReason === "aborted" || stopReason === "error") {
|
|
11476
|
+
this.#suspended = true;
|
|
11477
|
+
return;
|
|
11478
|
+
}
|
|
11479
|
+
this.#flush();
|
|
11480
|
+
});
|
|
11481
|
+
subscribe("before_agent_start", (_event, ctx) => {
|
|
11482
|
+
this.#context = ctx;
|
|
11483
|
+
let message2;
|
|
11484
|
+
this.#flush((value) => {
|
|
11485
|
+
message2 = value;
|
|
11486
|
+
});
|
|
11487
|
+
return message2 ? { message: message2 } : void 0;
|
|
11488
|
+
});
|
|
11489
|
+
subscribe("agent_settled", (_event, ctx) => {
|
|
11490
|
+
if (this.#context.signal?.aborted || ctx.signal?.aborted) this.#suspended = true;
|
|
11491
|
+
this.#context = ctx;
|
|
11492
|
+
this.#schedule();
|
|
11493
|
+
});
|
|
11494
|
+
subscribe("input", (_event, ctx) => {
|
|
11495
|
+
this.#context = ctx;
|
|
11496
|
+
this.#suspended = false;
|
|
11497
|
+
});
|
|
11498
|
+
subscribe("session_tree", (_event, ctx) => {
|
|
11499
|
+
this.#context = ctx;
|
|
11500
|
+
for (const { result, delivered } of this.#pending.values()) {
|
|
11501
|
+
this.#acknowledged.add(result.id);
|
|
11502
|
+
this.#confirmDelivery(delivered);
|
|
11503
|
+
}
|
|
11504
|
+
this.#pending.clear();
|
|
11505
|
+
});
|
|
11503
11506
|
}
|
|
11504
11507
|
#pending = /* @__PURE__ */ new Map();
|
|
11505
11508
|
#acknowledged = /* @__PURE__ */ new Set();
|