pi-fabric 0.126.0 → 0.127.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +2 -0
  2. package/dist/chunks/{chunk-S3IHVG32.js → chunk-3Y7PS34H.js} +12 -3
  3. package/dist/chunks/chunk-3Y7PS34H.js.map +7 -0
  4. package/dist/chunks/{chunk-AI2AR5V3.js → chunk-5TG5BBFH.js} +49 -15
  5. package/dist/chunks/chunk-5TG5BBFH.js.map +7 -0
  6. package/dist/chunks/{chunk-2N2NS4ZR.js → chunk-6QF4DOT3.js} +3 -3
  7. package/dist/chunks/{chunk-4VRBBCH6.js → chunk-D3LJDO2Y.js} +2 -2
  8. package/dist/chunks/{chunk-3DXRQK44.js → chunk-IPQPFQE3.js} +2 -2
  9. package/dist/chunks/{chunk-PBLNG5YF.js → chunk-L2UA3EE4.js} +64 -31
  10. package/dist/chunks/chunk-L2UA3EE4.js.map +7 -0
  11. package/dist/chunks/{chunk-RXFUXMXS.js → chunk-LIAMZBOP.js} +3 -2
  12. package/dist/chunks/{chunk-RXFUXMXS.js.map → chunk-LIAMZBOP.js.map} +2 -2
  13. package/dist/chunks/chunk-OCHGOESS.js +16 -0
  14. package/dist/chunks/chunk-OCHGOESS.js.map +7 -0
  15. package/dist/chunks/{chunk-JK4RDEZS.js → chunk-WVKV6JLJ.js} +2 -2
  16. package/dist/chunks/{chunk-4Y2LMAF2.js → chunk-XB3OQO4N.js} +2 -2
  17. package/dist/chunks/{chunk-OJ4LIEDL.js → chunk-ZWML3HKF.js} +2 -2
  18. package/dist/commands/fabric-handler.js +1 -1
  19. package/dist/components/configuration.js +2 -2
  20. package/dist/config.d.ts +2 -0
  21. package/dist/config.d.ts.map +1 -1
  22. package/dist/core/action-arguments.d.ts.map +1 -1
  23. package/dist/core/action-registry.js +2 -2
  24. package/dist/core/foreground-tools.d.ts +1 -0
  25. package/dist/core/foreground-tools.d.ts.map +1 -1
  26. package/dist/core/managed-host-guidance.d.ts +5 -0
  27. package/dist/core/managed-host-guidance.d.ts.map +1 -0
  28. package/dist/core/prompt-guidance.d.ts +1 -0
  29. package/dist/core/prompt-guidance.d.ts.map +1 -1
  30. package/dist/core/prompt-guidance.js +10 -3
  31. package/dist/core/prompt-guidance.js.map +2 -2
  32. package/dist/core/skill-prompt.d.ts +1 -1
  33. package/dist/core/skill-prompt.d.ts.map +1 -1
  34. package/dist/core/skill-references.d.ts +1 -1
  35. package/dist/core/skill-references.d.ts.map +1 -1
  36. package/dist/execution-service.d.ts.map +1 -1
  37. package/dist/extension-bootstrap.js +3 -2
  38. package/dist/extension-bootstrap.js.map +1 -1
  39. package/dist/extension.d.ts +1 -1
  40. package/dist/extension.d.ts.map +1 -1
  41. package/dist/fabric-exec-tool.d.ts.map +1 -1
  42. package/dist/fabric-runtime-state.js +19 -7
  43. package/dist/fabric-runtime-state.js.map +2 -2
  44. package/dist/fabric-state.d.ts +1 -0
  45. package/dist/fabric-state.d.ts.map +1 -1
  46. package/dist/index.js +3 -2
  47. package/dist/index.js.map +1 -1
  48. package/dist/jev/observation.js +2 -2
  49. package/dist/jev.js +3 -3
  50. package/dist/managed-host.d.ts +13 -0
  51. package/dist/managed-host.d.ts.map +1 -1
  52. package/dist/native-codemode.d.ts.map +1 -1
  53. package/dist/native-tool-catalog.d.ts.map +1 -1
  54. package/dist/native-tool-catalog.js +4 -1
  55. package/dist/native-tool-catalog.js.map +2 -2
  56. package/dist/providers/jev-provider.js +3 -3
  57. package/dist/residency/host.js +3 -3
  58. package/dist/residency/pi-entry.js +3 -3
  59. package/dist/runtime/dynamic-guest-types.d.ts.map +1 -1
  60. package/dist/runtime/dynamic-guest-types.js +1 -1
  61. package/dist/runtime/monty-runtime.js +1 -1
  62. package/dist/runtime/typescript-kernel.js +1 -1
  63. package/dist/ui/settings.js +1 -1
  64. package/docs/codemode-parity.md +1 -1
  65. package/docs/configuration.md +4 -2
  66. package/docs/managed-host-migration.md +38 -0
  67. package/docs/providers.md +23 -2
  68. package/docs/skills.md +4 -0
  69. package/package.json +1 -1
  70. package/dist/chunks/chunk-AI2AR5V3.js.map +0 -7
  71. package/dist/chunks/chunk-PBLNG5YF.js.map +0 -7
  72. package/dist/chunks/chunk-S3IHVG32.js.map +0 -7
  73. /package/dist/chunks/{chunk-2N2NS4ZR.js.map → chunk-6QF4DOT3.js.map} +0 -0
  74. /package/dist/chunks/{chunk-4VRBBCH6.js.map → chunk-D3LJDO2Y.js.map} +0 -0
  75. /package/dist/chunks/{chunk-3DXRQK44.js.map → chunk-IPQPFQE3.js.map} +0 -0
  76. /package/dist/chunks/{chunk-JK4RDEZS.js.map → chunk-WVKV6JLJ.js.map} +0 -0
  77. /package/dist/chunks/{chunk-4Y2LMAF2.js.map → chunk-XB3OQO4N.js.map} +0 -0
  78. /package/dist/chunks/{chunk-OJ4LIEDL.js.map → chunk-ZWML3HKF.js.map} +0 -0
package/README.md CHANGED
@@ -78,6 +78,8 @@ Pi's native MCP can optionally supply selected servers beneath the same Fabric A
78
78
 
79
79
  Requires Node.js 24+ and Pi 1.0.0+. Monty's optional native package installs on supported platforms; only the explicit CPython escape hatch requires CPython 3.10+. Fabric warns when a detectable host is older than the required native loadout and nested-execution contracts.
80
80
 
81
+ **0.126.1: quieter background optimization.** Automatic entropy improvement notices no longer interrupt the conversation. Background compilation, saved plans, and activation continue unchanged; use `/fabric entropy` to inspect entropy on demand.
82
+
81
83
  **0.126.0: idle warming for background work.** With Pi's `cacheWarming: "idle"` enabled, wake-capable spilled shell jobs re-price idle cache refreshes at certain continuation while preserving Pi's savings threshold and 30-minute idle horizon. UI-only monitors, interruption, provider errors, and abandoned branches are excluded; refreshes remain paid native `cache_warm` usage. The fullscreen dock now preserves other extensions' status rows. Policy verification also covers mesh grants, speculation, and budget admission, with 27 registered kernels and 75 counterexample-backed broken variants.
82
84
 
83
85
  **0.125.2: arbitrary-state policy proofs.** The dev-only gdp-wired prover is pinned to 0.30.1. Policy proof runs use `{from: 'any'}` and accept only `proven && checked && !assumes`, with counterexample-backed refusals for all 50 broken variants. Generated kernel bodies are unchanged, and default certificates need no environment override. Windows offline continuation tests use a platform-sized cold-start budget.
@@ -59,9 +59,9 @@ var foregroundConfigValue = (value) => {
59
59
  };
60
60
  var NO_FOREGROUND = { tools: [], refused: [] };
61
61
  var resolveForegroundTools = (input) => {
62
- const { policy } = input;
62
+ const policy = input.managedHost && input.managedForeground !== void 0 ? { tools: input.managedForeground.map((name) => ({ name })), maxTools: MAX_FOREGROUND_TOOLS } : input.policy;
63
63
  if (policy.tools.length === 0 || input.mode === "orchestration") return NO_FOREGROUND;
64
- const blanket = input.mode === "enforce" ? "enforce" : input.managedHost ? "managed-host" : void 0;
64
+ const blanket = input.mode === "enforce" ? "enforce" : input.managedHost && input.managedForeground === void 0 ? "managed-host" : void 0;
65
65
  if (blanket) return { tools: [], refused: policy.tools.map(({ name }) => ({ name, reason: blanket })) };
66
66
  const registered = new Map(input.registered.map((tool) => [tool.name, tool]));
67
67
  const tools = [];
@@ -281,6 +281,7 @@ var DEFAULT_FABRIC_CONFIG = {
281
281
  codemodeProfile: "additive",
282
282
  timeoutMs: 12e4,
283
283
  maxTimeoutMs: 9e5,
284
+ maxCpuSliceMs: 0,
284
285
  hostCallTimeouts: {},
285
286
  humanWaitRefs: ["extensions.ask", "decisions.wait"],
286
287
  shellHangMs: DEFAULT_SHELL_HANG_MS,
@@ -687,6 +688,12 @@ var normalizeFabricConfig = (input) => {
687
688
  ).map(([ref, value]) => [ref, boundedInteger(value, 1e3, 1e3, executorMaxTimeoutMs)])
688
689
  ),
689
690
  humanWaitRefs: humanWaitRefsValue(executor.humanWaitRefs),
691
+ maxCpuSliceMs: boundedInteger(
692
+ executor.maxCpuSliceMs,
693
+ DEFAULT_FABRIC_CONFIG.executor.maxCpuSliceMs,
694
+ 0,
695
+ Number.MAX_SAFE_INTEGER
696
+ ),
690
697
  timeoutMs: boundedInteger(
691
698
  executor.timeoutMs,
692
699
  DEFAULT_FABRIC_CONFIG.executor.timeoutMs,
@@ -1358,6 +1365,8 @@ var saveFabricConfig = (options, partial) => {
1358
1365
  };
1359
1366
 
1360
1367
  export {
1368
+ MAX_FOREGROUND_TOOLS,
1369
+ foregroundConfigValue,
1361
1370
  NO_FOREGROUND,
1362
1371
  resolveForegroundTools,
1363
1372
  formatForeground,
@@ -1381,4 +1390,4 @@ export {
1381
1390
  loadFabricConfig,
1382
1391
  saveFabricConfig
1383
1392
  };
1384
- //# sourceMappingURL=chunk-S3IHVG32.js.map
1393
+ //# sourceMappingURL=chunk-3Y7PS34H.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/core/foreground-tools.ts", "../../src/core/shell-limits.ts", "../../src/config.ts", "../../src/core/damaged-file.ts", "../../src/config-migrations.ts"],
4
+ "sourcesContent": ["import { PI_CORE_TOOL_NAME_SET } from \"./pi-tools.js\";\n\n/**\n * Foreground policy: registered tools full code mode keeps declared to the\n * model beside fabric_exec. It changes visibility only; a direct call takes\n * the same tool_call hooks and approval risk as `extensions.<name>`.\n */\nexport type FabricForegroundReason = \"turn-steering\" | \"human-input\" | \"context-control\" | \"skill-loading\";\nexport interface FabricForegroundTool { name: string; owner: string; reason: FabricForegroundReason }\nexport interface FabricForegroundConfig { tools: FabricForegroundTool[]; maxTools: number }\nexport type FabricForegroundRefusalReason =\n | \"enforce\" | \"managed-host\" | \"core\" | \"builtin\" | \"unknown\" | \"inactive\" | \"not-allowed\" | \"duplicate\" | \"cap\";\nexport interface FabricForegroundResolution {\n tools: readonly string[];\n refused: readonly { name: string; reason: FabricForegroundRefusalReason }[];\n}\n\nexport const MAX_FOREGROUND_TOOLS = 8;\nconst MAX_FOREGROUND_ENTRIES = 64;\nconst REASONS = new Set([\"turn-steering\", \"human-input\", \"context-control\", \"skill-loading\"]);\nconst NAME = /^[^\\s]{1,128}$/;\nconst isText = (value: unknown): value is string => typeof value === \"string\" && NAME.test(value);\n\n/** Parse `foreground`. Malformed entries are hard config errors, never dropped. */\nexport const foregroundConfigValue = (value: unknown): FabricForegroundConfig => {\n const input = typeof value === \"object\" && value !== null && !Array.isArray(value) ? value as Record<string, unknown> : {};\n const tools = input.tools ?? [];\n if (!Array.isArray(tools) || tools.length > MAX_FOREGROUND_ENTRIES) {\n throw new Error(`foreground.tools must be an array of at most ${MAX_FOREGROUND_ENTRIES} entries`);\n }\n const maxTools = input.maxTools ?? 4;\n if (!Number.isInteger(maxTools) || (maxTools as number) < 0 || (maxTools as number) > MAX_FOREGROUND_TOOLS) {\n throw new Error(`foreground.maxTools must be an integer from 0 to ${MAX_FOREGROUND_TOOLS}`);\n }\n return {\n maxTools: maxTools as number,\n tools: tools.map((entry: unknown, index) => {\n const { name, owner, reason } = (entry ?? {}) as Record<string, unknown>;\n if (!isText(name) || name === \"fabric_exec\" || !isText(owner) || !REASONS.has(reason as string)) {\n throw new Error(\n `Invalid foreground.tools[${index}]: expected { name, owner, reason: ${[...REASONS].join(\" | \")} }`,\n );\n }\n return { name, owner, reason: reason as FabricForegroundReason };\n }),\n };\n};\n\nexport const NO_FOREGROUND: FabricForegroundResolution = { tools: [], refused: [] };\n\n/** Resolve the declared set in policy order; every skipped entry is reported. */\nexport const resolveForegroundTools = (input: {\n policy: FabricForegroundConfig;\n mode: \"full-code\" | \"enforce\" | \"orchestration\";\n managedHost?: boolean;\n managedForeground?: readonly string[] | undefined;\n registered: readonly { name: string; exposure?: string; sourceInfo?: { source: string } }[];\n active: ReadonlySet<string>;\n allowlist?: { has(name: string): boolean } | undefined;\n}): FabricForegroundResolution => {\n const policy = input.managedHost && input.managedForeground !== undefined\n ? { tools: input.managedForeground.map(name => ({ name })), maxTools: MAX_FOREGROUND_TOOLS }\n : input.policy;\n // Orchestration already declares Pi's active set; the policy has nothing to add.\n if (policy.tools.length === 0 || input.mode === \"orchestration\") return NO_FOREGROUND;\n const blanket = input.mode === \"enforce\" ? \"enforce\" : input.managedHost && input.managedForeground === undefined ? \"managed-host\" : undefined;\n if (blanket) return { tools: [], refused: policy.tools.map(({ name }) => ({ name, reason: blanket })) };\n const registered = new Map(input.registered.map((tool) => [tool.name, tool]));\n const tools: string[] = [];\n const refused: { name: string; reason: FabricForegroundRefusalReason }[] = [];\n const seen = new Set<string>();\n for (const { name } of policy.tools) {\n const tool = registered.get(name);\n const reason: FabricForegroundRefusalReason | undefined =\n PI_CORE_TOOL_NAME_SET.has(name) ? \"core\"\n : seen.has(name) ? \"duplicate\"\n : !tool || tool.exposure === \"hidden\" ? \"unknown\"\n : tool.sourceInfo?.source === \"builtin\" ? \"builtin\"\n : input.allowlist && !input.allowlist.has(name) ? \"not-allowed\"\n : !input.active.has(name) ? \"inactive\"\n : tools.length >= policy.maxTools ? \"cap\"\n : undefined;\n seen.add(name);\n if (reason) refused.push({ name, reason });\n else tools.push(name);\n }\n return { tools, refused };\n};\n\n/** One line for the session notice and `/fabric status`. */\nexport const formatForeground = ({ tools, refused }: FabricForegroundResolution): string =>\n (refused.length > 0 ? `refused ${refused.map(({ name, reason }) => `${name} (${reason})`).join(\", \")}; ` : \"\") +\n `declared ${tools.length > 0 ? tools.join(\", \") : \"fabric_exec only\"}`;\n", "// Configuration reads must not import the process store or monitor engine.\nexport const DEFAULT_SHELL_HANG_MS = 120_000;\nexport const SHELL_HANG_MAX_MS = 600_000;\n", "import fs from \"node:fs\";\nimport { DEFAULT_JEV_CONFIG, normalizeJevConfig, type FabricJevConfig } from \"./jev/config.js\";\nimport { normalizeJevApprovalModel } from \"./jev/model-key.js\";\nexport type { FabricJevConfig } from \"./jev/config.js\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { renameAtomic } from \"./core/atomic-write.js\";\nimport { approvalActionOverridesValue, type FabricActionApprovalMode } from \"./core/approval-overrides.js\";\nimport { foregroundConfigValue, type FabricForegroundConfig } from \"./core/foreground-tools.js\";\nimport { quarantineDamagedFile } from \"./core/damaged-file.js\";\nimport { normalizeModelAliases, type FabricModelAliases } from \"./core/model-resolution.js\";\nimport { PI_CORE_TOOL_NAME_SET } from \"./core/pi-tools.js\";\nimport { DEFAULT_SHELL_HANG_MS, SHELL_HANG_MAX_MS } from \"./core/shell-limits.js\";\nimport {\n CURRENT_FABRIC_CONFIG_VERSION,\n migrateFabricConfigDocument,\n} from \"./config-migrations.js\";\nimport type { FabricComponentEntry } from \"./components/types.js\";\nimport type { FabricRisk } from \"./protocol.js\";\nimport type { FabricKernel } from \"./runtime/kernel.js\";\nimport {\n DEFAULT_FABRIC_THINKING,\n FABRIC_THINKING_BOUNDS_ENV,\n inheritedThinkingBounds,\n intersectThinkingBounds,\n isFabricThinking,\n normalizeThinkingBounds,\n type FabricThinking,\n type FabricThinkingBounds,\n} from \"./thinking.js\";\nimport {\n defaultCodePreviewSettings,\n normalizeCodePreviewSettings,\n type CodePreviewSettings,\n} from \"./ui/code-preview.js\";\n\ntype FabricApprovalMode = \"allow\" | \"ask\" | \"auto\" | \"deny\";\nexport type FabricAgentTransport =\n | \"auto\"\n | \"process\"\n | \"tmux\"\n | \"screen\"\n | \"localterm\"\n | \"herdr\";\n/** Built-in runner ids, or a runner registered through pi-fabric/runners. */\nexport type FabricAgentRunner = \"pi-durable\" | \"pi\" | \"claude\" | \"veda\" | (string & {});\n\n/** How a child run's reported model is checked against the requested key.\n * Strict fails the run on a mismatch. Permissive records the reported\n * attribution instead, so virtual provider keys can resolve to a concrete\n * backend at stream time. */\nexport type FabricModelAdmission = \"strict\" | \"permissive\";\nexport type FabricUiWidgetMode = \"auto\" | \"always\" | \"hidden\";\ntype FabricToolDisplayMode = \"full\" | \"compact\";\nexport type FabricResultFormat = \"auto\" | \"yaml\" | \"json\" | \"text\";\nexport type FabricPrewalkMode = \"in-place\" | \"trajectory\";\nexport type FabricExecutorRuntime = \"quickjs\" | \"node-process\" | \"bun-process\";\nexport type FabricConfigScope = \"global\" | \"project\";\ntype FabricCompactionEngine = \"pi\" | \"fabric\";\ntype FabricActorScope = \"project\" | \"session\";\n\nexport type FabricPythonRuntime = \"cpython\" | \"monty\";\n\ninterface FabricExecutorConfig {\n kernel: FabricKernel;\n pythonRuntime: FabricPythonRuntime;\n cpython: { binary: string };\n /** Optional jev-fabric backend for durable tasks and sessions (macOS/Linux).\n * `binary` empty or \"auto\" picks the user's compatible install outside the\n * workspace, then the bundled package; an explicit path never falls back.\n * `home` empty means JEV_FABRIC_HOME, else `<cwd>/.jev-fabric-native`, the\n * same store other harnesses share. `timeoutMs` is the default job lifetime. */\n jevFabric: { binary: string; home: string; timeoutMs: number };\n /** TypeScript backend only; ignored by the Python kernel. */\n runtime: FabricExecutorRuntime;\n /** Add native tool aliases, or opt into Pi's script-level naming/result ergonomics. */\n codemodeProfile: \"additive\" | \"native\";\n timeoutMs: number;\n /** Policy maximum for any executor deadline, including per-invocation\n * requests and per-ref floors. Values above this are visibly normalized. */\n maxTimeoutMs: number;\n /** Maximum uninterrupted guest CPU slice in ms; 0 disables the limit (Infinity). */\n maxCpuSliceMs: number;\n /** Exact-ref deadline floors (ms) for known long-running host calls, e.g.\n * \"extensions.subagent\". Keys are exact refs; no wildcard matching. */\n hostCallTimeouts: Record<string, number>;\n /** Exact host-call refs that wait for a person, e.g. \"extensions.ask\" or\n * \"decisions.wait\".\n * While such a call is in flight the program deadline is paused, so a\n * foreground question can wait indefinitely. Cancellation still applies. */\n humanWaitRefs: string[];\n /** Wait budget for nested pi.bash / pi.powershell (default 2m, max 10m).\n * 0 disables auto-spill. After this, the await settles successfully with a\n * live output path while the process keeps running. `background: true`\n * detaches immediately. Explicit shell timeout remains a hard cap. */\n shellHangMs: number;\n memoryLimitBytes: number;\n maxOutputChars: number;\n maxNestedResultChars: number;\n resultFormat: FabricResultFormat;\n}\n\nexport interface FabricApprovalConfig {\n read: FabricApprovalMode;\n write: FabricApprovalMode;\n execute: FabricApprovalMode;\n network: FabricApprovalMode;\n agent: FabricApprovalMode;\n model?: string;\n /** Exact `provider.action` or `provider.*` \u2192 allow | ask | deny; exact beats wildcard beats risk mode. */\n actions?: Record<string, FabricActionApprovalMode>;\n /** No-UI approvals: \"deny\" (absent, fail closed) or \"decision\" (await a durable user decision). */\n headless?: \"deny\" | \"decision\";\n /** Headless approval decision deadline; absent means 5 minutes. */\n headlessTimeoutMs?: number;\n}\n\n/** Session-start background revalidation scope for the MCP descriptor cache:\n * \"changed\" lists only added/reconfigured servers, \"all\" re-lists every known\n * server, \"off\" never spawns servers in the background. */\ntype FabricMcpRevalidatePolicy = \"changed\" | \"all\" | \"off\";\n\ninterface FabricMcpCacheConfig {\n /** Serve MCP tool metadata from the on-disk descriptor cache instead of\n * connecting to every configured server on first discovery each session. */\n enabled: boolean;\n revalidate: FabricMcpRevalidatePolicy;\n /** Wall-clock budget for one session-start background revalidation pass. */\n revalidateBudgetMs: number;\n}\n\nexport interface FabricMcpJevConfig {\n /** Opt-in Jev ranking for tools.search({ searchMode: \"semantic\" }). */\n semanticSearch: boolean;\n /** MCP servers whose tool metadata must not be sent to Jev. Empty allows every server, including ones not yet cached. */\n blockedServers: string[];\n semanticCandidateLimit: number;\n semanticMinProbability: number;\n}\n\nconst nativeMcpServersValue = (value: unknown): string[] => {\n if (value === undefined) return [];\n if (!Array.isArray(value) || value.length > 256 || value.some(name =>\n typeof name !== \"string\" || !/^[A-Za-z0-9_-]+$/.test(name.trim()))) {\n throw new Error(\"mcp.nativeServers must be an array of at most 256 exact Pi MCP server names (letters, digits, _ and -)\");\n }\n return [...new Set(value.map((name: string) => name.trim()))];\n};\n\nexport interface FabricMcpConfig {\n enabled: boolean;\n /** Opt-in exact server names owned by Pi, never mcporter fallback targets. */\n nativeServers?: string[];\n configPath?: string;\n disableOAuth: boolean;\n allowDynamicServers: boolean;\n callTimeoutMs: number;\n cache: FabricMcpCacheConfig;\n jev: FabricMcpJevConfig;\n}\n\ninterface FabricClaudeRunnerConfig {\n binary: string;\n model?: string;\n}\n\n/** Veda CLI options for the `veda` agent runner. The Veda CLI wraps external\n * backends (agy, codex, claude-code, droid, pi, and any backend registered by\n * the installed Veda build); the backend is selected here and the persona\n * controls read-only vs write-capable behavior. */\ninterface FabricVedaRunnerConfig {\n binary: string;\n /** Veda backend to drive. Defaults to the Antigravity CLI (agy). */\n backend: string;\n /** Optional backend-specific model or Veda model alias. */\n model?: string;\n /** Veda persona: navigator-plan, navigator-chat, reviewer, or worker. */\n persona: string;\n}\n\ninterface FabricPrewalkConfig {\n // Master switch, persisted by /fabric prewalk --disable|--enable or the\n // settings UI (absent means enabled). Manual arming, session auto-arm, and\n // boundary claims all gate on it.\n enabled?: boolean;\n mode: FabricPrewalkMode;\n model?: string;\n alwaysRearm: boolean;\n // Compact with the configured engine just before restoring Main's boundary\n // model after an in-place continuation settles.\n compactOnReturn: boolean;\n // Frontier-first planning: the mutation boundary that would hand off instead\n // asks Main to record its plan, and the handoff fires at the next mutation with\n // that plan in the transcript. Upstream prewalk nudges the plan on turn one,\n // before any discovery; this lands on the boundary, after it.\n requirePlan: boolean;\n // Filesystem fallback trigger: when an armed boundary ran a successful\n // pi.bash or pi.powershell without an audited mutation, claim on stat-manifest drift so\n // shell heredocs / sed -i / formatter writes also hand off.\n detectShellWrites: boolean;\n // Reasoning effort for the trajectory executor; unset inherits agents.thinking.\n thinking?: FabricThinking;\n}\n\nexport interface FabricAgentConfig {\n enabled: boolean;\n runner: FabricAgentRunner;\n transport: FabricAgentTransport;\n model?: string;\n claude: FabricClaudeRunnerConfig;\n veda: FabricVedaRunnerConfig;\n thinking: FabricThinking;\n maxConcurrent: number;\n maxPerExecution: number;\n maxDepth: number;\n timeoutMs: number;\n extensions: boolean;\n defaultTools: string[];\n retainRuns: boolean;\n notifyOnComplete: boolean;\n budgetUsd: number;\n maxTokensPerChild: number;\n /** Write usage-only pi-format session files per agent run for external trackers. */\n sessionExport: boolean;\n /** Export store root override; PI_FABRIC_AGENT_DIR wins. Empty = ~/.pi-fabric/agent. */\n sessionExportDir: string;\n /** Admission policy for the model a child process actually reports. */\n modelAdmission: FabricModelAdmission;\n /** Shell command run in each new agent worktree before the child starts. */\n worktree?: { setup?: string };\n /** Child UI dialogs: \"cancel\" (absent) or \"route\" to the parent UI or a decision. */\n childQuestions?: \"cancel\" | \"route\";\n /** Routed child question deadline; absent means 10 minutes. */\n childQuestionTimeoutMs?: number;\n /** Tools a routed Pi child gets for asking questions; absent means [\"ask\"], [] grants none. */\n childQuestionTools?: string[];\n}\n\nexport interface FabricToolCaptureConfig {\n enabled: boolean;\n hideFromModel: boolean;\n keepVisible: string[];\n defaultRisk: FabricRisk;\n risks: Record<string, FabricRisk>;\n}\n\nexport type FabricSchemaMode = \"off\" | \"audit\" | \"enforce\";\n\nexport interface FabricSchemaTrustedCommand {\n command: string;\n args: string[];\n shell: boolean;\n timeoutMs: number;\n}\n\nexport interface FabricSchemaConfig {\n mode: FabricSchemaMode;\n certificateTtlMs: number;\n maxFiles: number;\n maxBytes: number;\n trustedCommands: Record<string, FabricSchemaTrustedCommand>;\n}\n\ninterface FabricUiConfig {\n enabled: boolean;\n widget: FabricUiWidgetMode;\n maxRows: number;\n refreshMs: number;\n eventHistory: number;\n haltOnEscape: boolean;\n /** Tell Herdr about running agents in an interactive root session. */\n herdrStatus: boolean;\n showAgentToolPreview: boolean;\n toolDisplay: FabricToolDisplayMode;\n /** Lend the window title to the latest nested call while fabric_exec runs. */\n terminalTitle: boolean;\n updateDebounceMs: number;\n /**\n * Raw `ui.sessionLabel`, passed through unchecked: sessionLabelSettings() in\n * topology/session-label-settings.ts checks it at first use, which keeps the\n * check out of the startup graph.\n */\n sessionLabel?: unknown;\n}\n\nexport interface FabricCompactionPressureBands {\n warn: number;\n urgent: number;\n}\n\ninterface FabricCompactionConfig {\n engine: FabricCompactionEngine;\n targetContextRatio: number;\n thresholds: Record<string, number>;\n tokenThresholds: Record<string, number>;\n /** Occupancy fractions reported by `compact.pressure()`; 0 < warn < urgent < 1. */\n pressureBands: FabricCompactionPressureBands;\n /** Compact at a settled boundary when window headroom drops below this; 0 disables. */\n outputReserveTokens: number;\n /** Drop orphaned tool results and fill missing ones in outgoing context. */\n repairOrphans: boolean;\n}\n\nexport const MIN_COMPACTION_TOKEN_THRESHOLD = 1_000;\nexport const MAX_COMPACTION_TOKEN_THRESHOLD = 100_000_000;\nexport const MIN_COMPACTION_RATIO_THRESHOLD = 0.25;\nexport const MAX_COMPACTION_RATIO_THRESHOLD = 0.95;\n\nexport const clampCompactionTokenThreshold = (value: number): number =>\n Math.min(\n MAX_COMPACTION_TOKEN_THRESHOLD,\n Math.max(MIN_COMPACTION_TOKEN_THRESHOLD, Math.round(value)),\n );\n\nexport const clampCompactionRatioThreshold = (value: number): number =>\n Math.min(\n MAX_COMPACTION_RATIO_THRESHOLD,\n Math.max(MIN_COMPACTION_RATIO_THRESHOLD, value),\n );\n\nexport interface FabricRetentionConfig {\n orphanedTempRunMs: number;\n oneShotRunMs: number;\n actorRunArchiveMs: number;\n}\n\nexport interface FabricMeshConfig {\n enabled: boolean;\n root?: string;\n actorScope: FabricActorScope;\n maxEventBytes: number;\n maxReadEvents: number;\n actorPollMs: number;\n actorQueueLimit: number;\n eventContextChars: number;\n actorContextEntries: number;\n /** Tell a root session's model when other root sessions join or leave the project. */\n peerNotices: boolean;\n}\n\ninterface FabricRepairsConfig {\n enabled: boolean;\n}\n\ninterface FabricEntropyConfig {\n compile: boolean;\n}\n\ninterface FabricTraceConfig {\n /** Persist the opt-in FabricAssessmentTraceV1 (timings, usage) beside the execution trace. */\n assessment: boolean;\n}\n\n/** One configured portable memory source (see docs/memory-recall.md). */\nexport interface FabricMemorySourceConfig {\n /** Registry id used as `args.source` in source-qualified memory calls. */\n id: string;\n /** Adapter kind; `\"fs\"` walks a local directory of session JSONL files. */\n kind: \"fs\";\n /** Absolute directory the `fs` adapter enumerates recursively. */\n root: string;\n}\n\nexport interface FabricExtractiveConfig {\n enabled: boolean;\n provider: string;\n model: string;\n maxViewBytes: number;\n maxCandidates: number;\n maxSourceChars: number;\n /** Zero selects deterministic-only operation. V1 issues at most one batch. */\n maxEvaluationsPerTurn: number;\n timeoutMs: number;\n}\n\nexport const DEFAULT_EXTRACTIVE_CONFIG: FabricExtractiveConfig = {\n enabled: false, provider: \"typesafe\", model: \"jev-latest\",\n maxViewBytes: 8192, maxCandidates: 128, maxSourceChars: 24000,\n maxEvaluationsPerTurn: 1, timeoutMs: 3000,\n};\n\nexport interface FabricMemoryConfig {\n extractive?: FabricExtractiveConfig;\n enabled: boolean;\n indexDir?: string;\n maxSessions: number;\n maxEntryChars: number;\n indexThinking: boolean;\n indexToolOutput: boolean;\n hotSessions?: number;\n digestTerms?: number;\n maxColdVocabularyBytes?: number;\n maxColdCacheBytes?: number;\n maxSyncSessions?: number;\n maxSyncSourceBytes?: number;\n maxCacheCleanupFiles?: number;\n regexMaxPatternBytes?: number;\n regexMaxHaystackTerms?: number;\n regexMaxHaystackBytes?: number;\n regexTimeoutMs?: number;\n /** Configured portable sources; present enables source-qualified calls. */\n sources?: FabricMemorySourceConfig[];\n}\n\nexport interface FabricSpeculationConfig {\n /** Master switch for speculative programmatic tool calling during streaming. */\n enabled: boolean;\n /** Maximum simultaneously in-flight speculative calls; excess candidates are dropped. */\n maxConcurrent: number;\n /** Maximum retained unserved speculation entries per turn. */\n maxEntries: number;\n /** Per-stream cap on buffered partial tool-call arguments while extracting the `code` field. */\n maxBufferBytes: number;\n /** Unserved speculation entries older than this are aborted and discarded. */\n entryTtlMs: number;\n /**\n * Tier B: MCP tools that may be speculated despite risk \"network\". Entries\n * are `server.tool` or `server.*` and match the ref after the `mcp.` prefix.\n * Only enable for tools the operator knows are read-only; cached MCP\n * annotations with destructiveHint=true always refuse.\n */\n mcpAllowlist: string[];\n}\n\n\nexport interface FabricModelsConfig {\n /** Alias name \u2192 ordered provider/model fallback chain plus an optional default thinking level. */\n aliases: FabricModelAliases;\n}\n\nexport interface FabricThinkingConfig {\n /** Inclusive host/child thinking bounds; empty means the model's levels. */\n bounds: FabricThinkingBounds;\n}\n\nexport interface FabricConfig {\n fullCodeMode: boolean;\n executor: FabricExecutorConfig;\n approvals: FabricApprovalConfig;\n mcp: FabricMcpConfig;\n prewalk: FabricPrewalkConfig;\n agents: FabricAgentConfig;\n models: FabricModelsConfig;\n components: FabricComponentEntry[];\n capture: FabricToolCaptureConfig;\n /** Registered tools full code mode keeps declared beside fabric_exec. */\n foreground: FabricForegroundConfig;\n ui: FabricUiConfig;\n compaction: FabricCompactionConfig;\n retention: FabricRetentionConfig;\n mesh: FabricMeshConfig;\n memory: FabricMemoryConfig;\n jev: FabricJevConfig;\n entropy: FabricEntropyConfig;\n repairs: FabricRepairsConfig;\n trace: FabricTraceConfig;\n schema: FabricSchemaConfig;\n speculation: FabricSpeculationConfig;\n thinking: FabricThinkingConfig;\n codePreview: CodePreviewSettings;\n}\n\n/** Hard implementation maximum for any executor deadline. Policy ceilings\n * (executor.maxTimeoutMs) may be raised up to this value by administrators. */\nexport const MAX_EXECUTOR_TIMEOUT_MS = 24 * 3_600_000;\n\nexport const MIN_AGENT_TIMEOUT_MS = 1_000;\nexport const MAX_AGENT_TIMEOUT_MS = 24 * 3_600_000;\n/** Default per-run wall-clock budget. It equals the policy ceiling on purpose:\n * an orchestration program inherits agents.timeoutMs as its own whole-program\n * deadline floor, so any lower default truncates long participants at a\n * fraction of the maximum the policy already allows. Narrow one run by setting\n * agents.timeoutMs explicitly; per-call values can only raise it. */\nconst DEFAULT_AGENT_TIMEOUT_MS = MAX_AGENT_TIMEOUT_MS;\nexport const QUICKJS_MAX_MEMORY_LIMIT_BYTES = 0xffff_ffff;\nexport const MAX_EXECUTOR_MEMORY_LIMIT_BYTES = Math.max(\n 8 * 1024 * 1024,\n Math.min(Number.MAX_SAFE_INTEGER, Math.floor(os.totalmem())),\n);\n\nexport const maxExecutorMemoryLimitBytes = (\n runtime: FabricExecutorRuntime,\n kernel: FabricKernel = \"typescript\",\n): number =>\n kernel === \"typescript\" && runtime === \"quickjs\"\n ? Math.min(QUICKJS_MAX_MEMORY_LIMIT_BYTES, MAX_EXECUTOR_MEMORY_LIMIT_BYTES)\n : MAX_EXECUTOR_MEMORY_LIMIT_BYTES;\n\nexport const DEFAULT_FABRIC_CONFIG: FabricConfig = {\n fullCodeMode: true,\n executor: {\n kernel: \"typescript\",\n pythonRuntime: \"monty\",\n cpython: { binary: \"python3\" },\n jevFabric: { binary: \"\", home: \"\", timeoutMs: 3_600_000 },\n runtime: \"quickjs\",\n codemodeProfile: \"additive\",\n timeoutMs: 120_000,\n maxTimeoutMs: 900_000,\n maxCpuSliceMs: 0,\n hostCallTimeouts: {},\n humanWaitRefs: [\"extensions.ask\", \"decisions.wait\"],\n shellHangMs: DEFAULT_SHELL_HANG_MS,\n memoryLimitBytes: 64 * 1024 * 1024,\n maxOutputChars: 50_000,\n maxNestedResultChars: 2_000_000,\n resultFormat: \"auto\",\n },\n approvals: {\n read: \"allow\",\n write: \"allow\",\n execute: \"allow\",\n network: \"allow\",\n agent: \"allow\",\n },\n mcp: {\n enabled: true,\n nativeServers: [],\n disableOAuth: true,\n allowDynamicServers: true,\n callTimeoutMs: 120_000,\n cache: {\n enabled: true,\n revalidate: \"changed\",\n revalidateBudgetMs: 60_000,\n },\n jev: {\n semanticSearch: false,\n blockedServers: [],\n semanticCandidateLimit: 127,\n semanticMinProbability: 0.2,\n },\n },\n prewalk: {\n mode: \"in-place\",\n alwaysRearm: false,\n compactOnReturn: true,\n detectShellWrites: true,\n requirePlan: true,\n },\n agents: {\n enabled: true,\n runner: \"pi-durable\",\n transport: \"process\",\n claude: { binary: \"claude\" },\n veda: { binary: \"veda\", backend: \"agy\", persona: \"navigator-chat\" },\n thinking: DEFAULT_FABRIC_THINKING,\n maxConcurrent: 4,\n maxPerExecution: 100,\n maxDepth: 2,\n timeoutMs: DEFAULT_AGENT_TIMEOUT_MS,\n extensions: true,\n defaultTools: [\"read\", \"bash\", \"edit\", \"write\", \"grep\", \"find\", \"ls\"],\n retainRuns: false,\n notifyOnComplete: true,\n budgetUsd: 0,\n maxTokensPerChild: 0,\n sessionExport: true,\n sessionExportDir: \"\",\n modelAdmission: \"strict\",\n },\n jev: { ...DEFAULT_JEV_CONFIG, credentialCommand: [] },\n components: [],\n capture: {\n enabled: true,\n hideFromModel: true,\n keepVisible: [\"fabric_exec\"],\n defaultRisk: \"execute\",\n risks: {\n read: \"read\",\n grep: \"read\",\n find: \"read\",\n ls: \"read\",\n edit: \"write\",\n write: \"write\",\n bash: \"execute\",\n fovea_sketch: \"read\",\n fovea_focus: \"read\",\n fovea_dwell: \"read\",\n fovea_impact: \"read\",\n },\n },\n ui: {\n enabled: true,\n widget: \"auto\",\n maxRows: 6,\n refreshMs: 500,\n eventHistory: 80,\n haltOnEscape: true,\n herdrStatus: true,\n showAgentToolPreview: true,\n toolDisplay: \"compact\",\n terminalTitle: true,\n updateDebounceMs: 100,\n },\n compaction: {\n engine: \"fabric\",\n targetContextRatio: 0.65,\n thresholds: {},\n tokenThresholds: {},\n pressureBands: { warn: 0.6, urgent: 0.8 },\n outputReserveTokens: 0,\n repairOrphans: true,\n },\n retention: {\n orphanedTempRunMs: 6 * 60 * 60 * 1_000,\n oneShotRunMs: 24 * 60 * 60 * 1_000,\n actorRunArchiveMs: 7 * 24 * 60 * 60 * 1_000,\n },\n mesh: {\n enabled: true,\n actorScope: \"project\",\n maxEventBytes: 256 * 1024,\n maxReadEvents: 500,\n actorPollMs: 250,\n actorQueueLimit: 32,\n eventContextChars: 40_000,\n actorContextEntries: 14,\n peerNotices: true,\n },\n models: {\n aliases: {},\n },\n memory: {\n extractive: { ...DEFAULT_EXTRACTIVE_CONFIG },\n enabled: true,\n maxSessions: 500,\n maxEntryChars: 2_000,\n indexThinking: false,\n indexToolOutput: true,\n hotSessions: 50,\n digestTerms: 200,\n maxColdVocabularyBytes: 512 * 1024,\n maxColdCacheBytes: 1024 * 1024,\n maxSyncSessions: 10_000,\n maxSyncSourceBytes: 512 * 1024 * 1024,\n maxCacheCleanupFiles: 100_000,\n regexMaxPatternBytes: 1_024,\n regexMaxHaystackTerms: 20_000,\n regexMaxHaystackBytes: 2 * 1024 * 1024,\n regexTimeoutMs: 250,\n },\n entropy: {\n compile: true,\n },\n repairs: {\n enabled: true,\n },\n trace: {\n assessment: false,\n },\n schema: {\n mode: \"off\",\n certificateTtlMs: 30_000,\n maxFiles: 100,\n maxBytes: 10 * 1024 * 1024,\n trustedCommands: {},\n },\n speculation: {\n enabled: true,\n maxConcurrent: 4,\n maxEntries: 64,\n maxBufferBytes: 2 * 1024 * 1024,\n entryTtlMs: 180_000,\n mcpAllowlist: [],\n },\n thinking: { bounds: {} },\n foreground: { tools: [], maxTools: 4 },\n codePreview: defaultCodePreviewSettings(),\n};\n\ninterface JsonObjectFile {\n document: Record<string, unknown>;\n source: string;\n}\n\nconst readJsonObjectFile = (filePath: string): JsonObjectFile | undefined => {\n let source: string;\n try {\n source = fs.readFileSync(filePath, \"utf8\");\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\") return undefined;\n // Unreadable settings must not take down extension load.\n return undefined;\n }\n if (!source.trim()) return { document: {}, source };\n try {\n const parsed: unknown = JSON.parse(source);\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n quarantineDamagedFile(filePath);\n return undefined;\n }\n return { document: parsed as Record<string, unknown>, source };\n } catch {\n quarantineDamagedFile(filePath);\n return undefined;\n }\n};\n\nconst readJsonObject = (filePath: string): Record<string, unknown> | undefined =>\n readJsonObjectFile(filePath)?.document;\n\nconst mergeObjects = (\n base: Record<string, unknown>,\n override: Record<string, unknown>,\n): Record<string, unknown> => {\n const merged = { ...base };\n for (const [key, value] of Object.entries(override)) {\n const baseValue = merged[key];\n // Routing documents replace atomically: never splice one provider's route/options\n // into another provider across trusted global/project layers or UI updates.\n if (key === \"decisionProfiles\") {\n merged[key] = structuredClone(value);\n } else if (\n typeof baseValue === \"object\" &&\n baseValue !== null &&\n !Array.isArray(baseValue) &&\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value)\n ) {\n merged[key] = mergeObjects(\n baseValue as Record<string, unknown>,\n value as Record<string, unknown>,\n );\n } else {\n merged[key] = value;\n }\n }\n return merged;\n};\n\nconst approvalMode = (value: unknown, fallback: FabricApprovalMode): FabricApprovalMode =>\n value === \"allow\" || value === \"ask\" || value === \"auto\" || value === \"deny\"\n ? value\n : fallback;\n\nconst booleanValue = (value: unknown, fallback: boolean): boolean =>\n typeof value === \"boolean\" ? value : fallback;\n\nconst boundedInteger = (value: unknown, fallback: number, min: number, max: number): number =>\n typeof value === \"number\" && Number.isFinite(value)\n ? Math.max(min, Math.min(max, Math.floor(value)))\n : fallback;\n\nconst boundedFloat = (value: unknown, fallback: number, min: number, max: number): number =>\n typeof value === \"number\" && Number.isFinite(value)\n ? Math.max(min, Math.min(max, value))\n : fallback;\n\nconst stringValue = (value: unknown): string | undefined =>\n typeof value === \"string\" && value.trim() ? value : undefined;\n\n// Inlined copy of RUNNER_ID_PATTERN (src/agents/runner-registry.ts) so config\n// never loads the runner registry; tests/runner-registry-graph.test.ts keeps it in sync.\nconst RUNNER_ID_PATTERN = /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/;\n\n// A registered runner may load after config; launch fails closed if it never does.\nconst runnerValue = (value: unknown, fallback: FabricAgentRunner): FabricAgentRunner =>\n typeof value === \"string\" && value.length <= 64 && RUNNER_ID_PATTERN.test(value) ? value : fallback;\n\nconst modelAdmissionValue = (\n value: unknown,\n fallback: FabricModelAdmission,\n): FabricModelAdmission =>\n value === \"strict\" || value === \"permissive\" ? value : fallback;\n\nconst prewalkModeValue = (\n value: unknown,\n fallback: FabricPrewalkMode,\n): FabricPrewalkMode =>\n value === \"in-place\" || value === \"trajectory\" ? value : fallback;\n\nconst transportValue = (\n value: unknown,\n fallback: FabricAgentTransport,\n): FabricAgentTransport =>\n value === \"auto\" ||\n value === \"process\" ||\n value === \"tmux\" ||\n value === \"screen\" ||\n value === \"localterm\" ||\n value === \"herdr\"\n ? value\n : fallback;\n\nconst thinkingValue = (value: unknown, fallback: FabricThinking): FabricThinking =>\n isFabricThinking(value) ? value : fallback;\n\nconst humanWaitRefsValue = (value: unknown): string[] =>\n Array.isArray(value)\n ? [...new Set(value\n .filter((ref): ref is string => typeof ref === \"string\")\n .map((ref) => ref.trim())\n .filter((ref) => ref.length > 0 && ref.length <= 512))].slice(0, 256)\n : [...DEFAULT_FABRIC_CONFIG.executor.humanWaitRefs];\n\nconst objectValue = (value: unknown): Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : {};\n\nconst widgetModeValue = (value: unknown, fallback: FabricUiWidgetMode): FabricUiWidgetMode =>\n value === \"auto\" || value === \"always\" || value === \"hidden\" ? value : fallback;\n\nconst toolDisplayModeValue = (\n value: unknown,\n fallback: FabricToolDisplayMode,\n): FabricToolDisplayMode => value === \"full\" || value === \"compact\" ? value : fallback;\n\nconst executorKernelValue = (value: unknown, fallback: FabricKernel): FabricKernel =>\n value === \"typescript\" || value === \"python\" ? value : fallback;\n\nconst executorRuntimeValue = (\n value: unknown,\n fallback: FabricExecutorRuntime,\n): FabricExecutorRuntime =>\n value === \"quickjs\" || value === \"node-process\" || value === \"bun-process\" ? value : fallback;\n\nconst resultFormatValue = (\n value: unknown,\n fallback: FabricResultFormat,\n): FabricResultFormat =>\n value === \"auto\" || value === \"yaml\" || value === \"json\" || value === \"text\"\n ? value\n : fallback;\n\nconst compactionEngineValue = (\n value: unknown,\n fallback: FabricCompactionEngine,\n): FabricCompactionEngine =>\n value === \"pi\" || value === \"fabric\" ? value : fallback;\n\n// Bands are validated as a pair: any non-finite value or an ordering other\n// than 0 < warn < urgent < 1 falls back to the defaults as a whole.\nconst compactionPressureBandsValue = (\n value: unknown,\n fallback: FabricCompactionPressureBands,\n): FabricCompactionPressureBands => {\n const bands = objectValue(value);\n const warn = bands.warn === undefined ? fallback.warn : bands.warn;\n const urgent = bands.urgent === undefined ? fallback.urgent : bands.urgent;\n return typeof warn === \"number\"\n && typeof urgent === \"number\"\n && Number.isFinite(warn)\n && Number.isFinite(urgent)\n && warn > 0\n && warn < urgent\n && urgent < 1\n ? { warn, urgent }\n : { ...fallback };\n};\n\nconst actorScopeValue = (value: unknown, fallback: FabricActorScope): FabricActorScope =>\n value === \"project\" || value === \"session\" ? value : fallback;\n\nconst schemaModeValue = (value: unknown, fallback: FabricSchemaMode): FabricSchemaMode =>\n value === \"off\" || value === \"audit\" || value === \"enforce\" ? value : fallback;\n\nconst mcpRevalidatePolicyValue = (\n value: unknown,\n fallback: FabricMcpRevalidatePolicy,\n): FabricMcpRevalidatePolicy =>\n value === \"changed\" || value === \"all\" || value === \"off\" ? value : fallback;\n\nconst riskValue = (value: unknown, fallback: FabricRisk): FabricRisk =>\n value === \"read\" ||\n value === \"write\" ||\n value === \"execute\" ||\n value === \"network\" ||\n value === \"agent\"\n ? value\n : fallback;\n\nconst MEMORY_SOURCE_ID_PATTERN = /^[a-z0-9][a-z0-9_.-]{0,127}$/;\n\n/**\n * Parse `memory.sources`. A wrong-typed value stays absent like every other\n * memory key, but a present array with malformed entries is a hard config\n * error: a silently dropped source would surface only as a confusing\n * `source_not_found` at call time. The id charset is the portable registry's\n * SOURCE_ID_PATTERN restricted to lowercase.\n */\nconst memorySourcesValue = (value: unknown): FabricMemorySourceConfig[] | undefined => {\n if (!Array.isArray(value)) return undefined;\n const sources: FabricMemorySourceConfig[] = [];\n const seen = new Set<string>();\n value.forEach((raw, index) => {\n const entry = objectValue(raw);\n const where = `memory.sources[${index}]`;\n const id = stringValue(entry.id);\n if (!id || !MEMORY_SOURCE_ID_PATTERN.test(id)) {\n throw new Error(\n `Invalid ${where}: id must be 1-128 chars of lowercase letters, digits, dot, underscore, or dash, starting with a letter or digit`,\n );\n }\n if (entry.kind !== \"fs\") {\n throw new Error(\n `Invalid ${where}: unknown kind ${JSON.stringify(entry.kind ?? null)}; expected \"fs\"`,\n );\n }\n const root = stringValue(entry.root);\n if (!root || !path.isAbsolute(root)) {\n throw new Error(`Invalid ${where}: root must be an absolute directory path`);\n }\n if (seen.has(id)) {\n throw new Error(`Invalid ${where}: duplicate source id ${JSON.stringify(id)}`);\n }\n seen.add(id);\n sources.push({ id, kind: \"fs\", root });\n });\n return sources.length > 0 ? sources : undefined;\n};\n\nexport const normalizeFabricConfig = (input: Record<string, unknown>): FabricConfig => {\n const executor = objectValue(input.executor);\n const cpython = objectValue(executor.cpython);\n const jevFabric = objectValue(executor.jevFabric);\n const executorKernel = executorKernelValue(executor.kernel, DEFAULT_FABRIC_CONFIG.executor.kernel);\n const executorMaxTimeoutMs = boundedInteger(\n executor.maxTimeoutMs,\n DEFAULT_FABRIC_CONFIG.executor.maxTimeoutMs,\n 1_000,\n MAX_EXECUTOR_TIMEOUT_MS,\n );\n const approvals = objectValue(input.approvals);\n const mcp = objectValue(input.mcp);\n const mcpCache = objectValue(mcp.cache);\n const mcpJev = objectValue(mcp.jev);\n const prewalk = objectValue(input.prewalk);\n const agents = objectValue(input.agents);\n const claude = objectValue(agents.claude);\n const veda = objectValue(agents.veda);\n const capture = objectValue(input.capture);\n const ui = objectValue(input.ui);\n const compaction = objectValue(input.compaction);\n const retention = objectValue(input.retention);\n const mesh = objectValue(input.mesh);\n const memory = objectValue(input.memory);\n const extractive = objectValue(memory.extractive);\n const memorySources = memorySourcesValue(memory.sources);\n const entropy = objectValue(input.entropy);\n const repairs = objectValue(input.repairs);\n const trace = objectValue(input.trace);\n const modelsSection = objectValue(input.models);\n const schema = objectValue(input.schema);\n const schemaMode = schemaModeValue(schema.mode, DEFAULT_FABRIC_CONFIG.schema.mode);\n const speculation = objectValue(input.speculation);\n const configuredExecutorRuntime = executorRuntimeValue(\n executor.runtime,\n DEFAULT_FABRIC_CONFIG.executor.runtime,\n );\n const executorRuntime = schemaMode === \"enforce\" && executorKernel === \"typescript\"\n ? \"quickjs\"\n : configuredExecutorRuntime;\n const configuredTools = Array.isArray(agents.defaultTools)\n ? agents.defaultTools.filter(\n (tool): tool is string => typeof tool === \"string\" && Boolean(tool),\n )\n : DEFAULT_FABRIC_CONFIG.agents.defaultTools;\n const approvalModel = normalizeJevApprovalModel(stringValue(approvals.model));\n const approvalActions = approvalActionOverridesValue(approvals.actions);\n const configPath = stringValue(mcp.configPath);\n const meshRoot = stringValue(mesh.root);\n const memoryIndexDir = stringValue(memory.indexDir);\n const compactionThresholds = Object.fromEntries(\n Object.entries(objectValue(compaction.thresholds))\n .filter(([model, threshold]) =>\n model.includes(\"/\")\n && typeof threshold === \"number\"\n && Number.isFinite(threshold),\n )\n .map(([model, threshold]) => [\n model,\n clampCompactionRatioThreshold(threshold as number),\n ]),\n );\n const compactionTokenThresholds = Object.fromEntries(\n Object.entries(objectValue(compaction.tokenThresholds))\n .filter(([model, tokens]) =>\n model.includes(\"/\")\n && typeof tokens === \"number\"\n && Number.isFinite(tokens),\n )\n .map(([model, tokens]) => [\n model,\n clampCompactionTokenThreshold(tokens as number),\n ]),\n );\n const prewalkModel = stringValue(prewalk.model);\n const prewalkThinking = isFabricThinking(prewalk.thinking) ? prewalk.thinking : undefined;\n const agentModel = stringValue(agents.model);\n const claudeBinary = stringValue(claude.binary);\n const claudeModel = stringValue(claude.model);\n const vedaBinary = stringValue(veda.binary);\n const vedaBackend = stringValue(veda.backend);\n const vedaModel = stringValue(veda.model);\n const vedaPersona = stringValue(veda.persona);\n const agentThinking = thinkingValue(agents.thinking, DEFAULT_FABRIC_CONFIG.agents.thinking);\n const configuredComponents: FabricComponentEntry[] = Array.isArray(input.components)\n ? input.components.flatMap((raw) => {\n const componentEntry = objectValue(raw);\n const id = stringValue(componentEntry.id);\n const component = stringValue(componentEntry.component);\n if (!id || !component) return [];\n return [{\n id,\n component,\n ...(Object.prototype.hasOwnProperty.call(componentEntry, \"config\")\n ? { config: componentEntry.config }\n : {}),\n ...(typeof componentEntry.disabled === \"boolean\"\n ? { disabled: componentEntry.disabled }\n : {}),\n }];\n }).slice(0, 256)\n : DEFAULT_FABRIC_CONFIG.components;\n const configuredVisible = Array.isArray(capture.keepVisible)\n ? capture.keepVisible.filter(\n (name): name is string => typeof name === \"string\" && Boolean(name.trim()),\n )\n : DEFAULT_FABRIC_CONFIG.capture.keepVisible;\n const configuredRisks = {\n ...DEFAULT_FABRIC_CONFIG.capture.risks,\n ...objectValue(capture.risks),\n };\n const trustedCommands = Object.fromEntries(\n Object.entries(objectValue(schema.trustedCommands)).flatMap(([name, raw]) => {\n if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/.test(name)) return [];\n const command = objectValue(raw);\n const executable = stringValue(command.command);\n if (!executable) return [];\n const shell = booleanValue(command.shell, false);\n const args = !shell && Array.isArray(command.args)\n ? command.args.filter((arg): arg is string => typeof arg === \"string\").slice(0, 64)\n : [];\n return [[name, {\n command: executable,\n args,\n shell,\n timeoutMs: boundedInteger(command.timeoutMs, 30_000, 1, 300_000),\n } satisfies FabricSchemaTrustedCommand]];\n }),\n );\n const risks = Object.fromEntries(\n Object.entries(configuredRisks)\n .filter(([name]) => Boolean(name.trim()))\n .map(([name, risk]) => [name, riskValue(risk, DEFAULT_FABRIC_CONFIG.capture.defaultRisk)]),\n );\n\n return {\n fullCodeMode: booleanValue(input.fullCodeMode, DEFAULT_FABRIC_CONFIG.fullCodeMode),\n executor: {\n kernel: executorKernel,\n pythonRuntime: executor.pythonRuntime === \"cpython\" ? \"cpython\" : \"monty\",\n cpython: {\n binary: stringValue(cpython.binary)?.trim() ?? DEFAULT_FABRIC_CONFIG.executor.cpython.binary,\n },\n jevFabric: {\n binary: stringValue(jevFabric.binary)?.trim() ?? DEFAULT_FABRIC_CONFIG.executor.jevFabric.binary,\n home: stringValue(jevFabric.home)?.trim() ?? \"\",\n timeoutMs: boundedInteger(jevFabric.timeoutMs, DEFAULT_FABRIC_CONFIG.executor.jevFabric.timeoutMs, 1_000, MAX_EXECUTOR_TIMEOUT_MS),\n },\n runtime: executorRuntime,\n codemodeProfile: executor.codemodeProfile === \"native\" ? \"native\" : \"additive\",\n maxTimeoutMs: boundedInteger(\n executor.maxTimeoutMs,\n DEFAULT_FABRIC_CONFIG.executor.maxTimeoutMs,\n 1_000,\n MAX_EXECUTOR_TIMEOUT_MS,\n ),\n hostCallTimeouts: Object.fromEntries(\n Object.entries(objectValue(executor.hostCallTimeouts))\n .filter(([ref, value]) =>\n typeof ref === \"string\" &&\n Boolean(ref.trim()) &&\n typeof value === \"number\" &&\n Number.isFinite(value) &&\n value >= 1,\n )\n .map(([ref, value]) => [ref, boundedInteger(value, 1_000, 1_000, executorMaxTimeoutMs)]),\n ),\n humanWaitRefs: humanWaitRefsValue(executor.humanWaitRefs),\n maxCpuSliceMs: boundedInteger(\n executor.maxCpuSliceMs,\n DEFAULT_FABRIC_CONFIG.executor.maxCpuSliceMs,\n 0,\n Number.MAX_SAFE_INTEGER,\n ),\n timeoutMs: boundedInteger(\n executor.timeoutMs,\n DEFAULT_FABRIC_CONFIG.executor.timeoutMs,\n 1_000,\n executorMaxTimeoutMs,\n ),\n shellHangMs: boundedInteger(\n executor.shellHangMs,\n DEFAULT_FABRIC_CONFIG.executor.shellHangMs,\n 0,\n Math.min(executorMaxTimeoutMs, SHELL_HANG_MAX_MS),\n ),\n memoryLimitBytes: boundedInteger(\n executor.memoryLimitBytes,\n DEFAULT_FABRIC_CONFIG.executor.memoryLimitBytes,\n 8 * 1024 * 1024,\n maxExecutorMemoryLimitBytes(executorRuntime, executorKernel),\n ),\n maxOutputChars: boundedInteger(\n executor.maxOutputChars,\n DEFAULT_FABRIC_CONFIG.executor.maxOutputChars,\n 1_000,\n 1_000_000,\n ),\n maxNestedResultChars: boundedInteger(\n executor.maxNestedResultChars,\n DEFAULT_FABRIC_CONFIG.executor.maxNestedResultChars,\n 10_000,\n 20_000_000,\n ),\n resultFormat: resultFormatValue(\n executor.resultFormat,\n DEFAULT_FABRIC_CONFIG.executor.resultFormat,\n ),\n },\n approvals: {\n read: approvalMode(approvals.read, DEFAULT_FABRIC_CONFIG.approvals.read),\n write: approvalMode(approvals.write, DEFAULT_FABRIC_CONFIG.approvals.write),\n execute: approvalMode(approvals.execute, DEFAULT_FABRIC_CONFIG.approvals.execute),\n network: approvalMode(approvals.network, DEFAULT_FABRIC_CONFIG.approvals.network),\n agent: approvalMode(approvals.agent, DEFAULT_FABRIC_CONFIG.approvals.agent),\n ...(approvalModel ? { model: approvalModel } : {}),\n ...(approvalActions ? { actions: approvalActions } : {}),\n ...(approvals.headless === \"decision\" ? { headless: \"decision\" as const } : {}),\n ...(approvals.headlessTimeoutMs === undefined ? {} : {\n headlessTimeoutMs: boundedInteger(approvals.headlessTimeoutMs, 300_000, 1_000, 86_400_000),\n }),\n },\n mcp: {\n enabled: booleanValue(mcp.enabled, DEFAULT_FABRIC_CONFIG.mcp.enabled),\n nativeServers: nativeMcpServersValue(mcp.nativeServers),\n ...(configPath ? { configPath } : {}),\n disableOAuth: booleanValue(mcp.disableOAuth, DEFAULT_FABRIC_CONFIG.mcp.disableOAuth),\n allowDynamicServers: booleanValue(\n mcp.allowDynamicServers,\n DEFAULT_FABRIC_CONFIG.mcp.allowDynamicServers,\n ),\n callTimeoutMs: boundedInteger(\n mcp.callTimeoutMs,\n DEFAULT_FABRIC_CONFIG.mcp.callTimeoutMs,\n 1_000,\n 900_000,\n ),\n cache: {\n enabled: booleanValue(mcpCache.enabled, DEFAULT_FABRIC_CONFIG.mcp.cache.enabled),\n revalidate: mcpRevalidatePolicyValue(\n mcpCache.revalidate,\n DEFAULT_FABRIC_CONFIG.mcp.cache.revalidate,\n ),\n revalidateBudgetMs: boundedInteger(\n mcpCache.revalidateBudgetMs,\n DEFAULT_FABRIC_CONFIG.mcp.cache.revalidateBudgetMs,\n 1_000,\n 600_000,\n ),\n },\n jev: {\n semanticSearch: booleanValue(\n mcpJev.semanticSearch,\n DEFAULT_FABRIC_CONFIG.mcp.jev.semanticSearch,\n ),\n blockedServers: Array.isArray(mcpJev.blockedServers)\n ? [...new Set(\n mcpJev.blockedServers.flatMap((name) => {\n if (typeof name !== \"string\") return [];\n const trimmed = name.trim();\n return trimmed.length > 0 && trimmed.length <= 128 ? [trimmed] : [];\n }),\n )].slice(0, 256)\n : [...DEFAULT_FABRIC_CONFIG.mcp.jev.blockedServers],\n semanticCandidateLimit: boundedInteger(\n mcpJev.semanticCandidateLimit,\n DEFAULT_FABRIC_CONFIG.mcp.jev.semanticCandidateLimit,\n 2,\n 127,\n ),\n semanticMinProbability:\n typeof mcpJev.semanticMinProbability === \"number\" &&\n Number.isFinite(mcpJev.semanticMinProbability) &&\n mcpJev.semanticMinProbability >= 0 &&\n mcpJev.semanticMinProbability <= 1\n ? mcpJev.semanticMinProbability\n : DEFAULT_FABRIC_CONFIG.mcp.jev.semanticMinProbability,\n },\n },\n prewalk: {\n ...(prewalk.enabled === false ? { enabled: false } : {}),\n mode: prewalkModeValue(prewalk.mode, DEFAULT_FABRIC_CONFIG.prewalk.mode),\n ...(prewalkModel ? { model: prewalkModel } : {}),\n ...(prewalkThinking ? { thinking: prewalkThinking } : {}),\n alwaysRearm: booleanValue(\n prewalk.alwaysRearm,\n DEFAULT_FABRIC_CONFIG.prewalk.alwaysRearm,\n ),\n compactOnReturn: booleanValue(\n prewalk.compactOnReturn,\n DEFAULT_FABRIC_CONFIG.prewalk.compactOnReturn,\n ),\n detectShellWrites: booleanValue(\n prewalk.detectShellWrites,\n DEFAULT_FABRIC_CONFIG.prewalk.detectShellWrites,\n ),\n requirePlan: booleanValue(\n prewalk.requirePlan,\n DEFAULT_FABRIC_CONFIG.prewalk.requirePlan,\n ),\n },\n agents: {\n enabled: booleanValue(agents.enabled, DEFAULT_FABRIC_CONFIG.agents.enabled),\n runner: runnerValue(agents.runner, DEFAULT_FABRIC_CONFIG.agents.runner),\n transport: transportValue(agents.transport, DEFAULT_FABRIC_CONFIG.agents.transport),\n ...(agentModel ? { model: agentModel } : {}),\n claude: {\n binary: claudeBinary ?? DEFAULT_FABRIC_CONFIG.agents.claude.binary,\n ...(claudeModel ? { model: claudeModel } : {}),\n },\n veda: {\n binary: vedaBinary ?? DEFAULT_FABRIC_CONFIG.agents.veda.binary,\n backend: vedaBackend ?? DEFAULT_FABRIC_CONFIG.agents.veda.backend,\n ...(vedaModel ? { model: vedaModel } : {}),\n persona: vedaPersona ?? DEFAULT_FABRIC_CONFIG.agents.veda.persona,\n },\n thinking: agentThinking,\n maxConcurrent: boundedInteger(\n agents.maxConcurrent,\n DEFAULT_FABRIC_CONFIG.agents.maxConcurrent,\n 1,\n 32,\n ),\n maxPerExecution: boundedInteger(\n agents.maxPerExecution,\n DEFAULT_FABRIC_CONFIG.agents.maxPerExecution,\n 1,\n 1_000,\n ),\n maxDepth: boundedInteger(\n agents.maxDepth,\n DEFAULT_FABRIC_CONFIG.agents.maxDepth,\n 0,\n Number.MAX_SAFE_INTEGER,\n ),\n timeoutMs: boundedInteger(\n agents.timeoutMs,\n DEFAULT_FABRIC_CONFIG.agents.timeoutMs,\n MIN_AGENT_TIMEOUT_MS,\n MAX_AGENT_TIMEOUT_MS,\n ),\n extensions: booleanValue(agents.extensions, DEFAULT_FABRIC_CONFIG.agents.extensions),\n defaultTools: configuredTools,\n retainRuns: booleanValue(agents.retainRuns, DEFAULT_FABRIC_CONFIG.agents.retainRuns),\n notifyOnComplete: booleanValue(\n agents.notifyOnComplete,\n DEFAULT_FABRIC_CONFIG.agents.notifyOnComplete,\n ),\n budgetUsd: boundedFloat(\n agents.budgetUsd,\n DEFAULT_FABRIC_CONFIG.agents.budgetUsd,\n 0,\n 1_000_000,\n ),\n maxTokensPerChild: boundedInteger(\n agents.maxTokensPerChild,\n DEFAULT_FABRIC_CONFIG.agents.maxTokensPerChild,\n 0,\n 100_000_000,\n ),\n sessionExport: booleanValue(\n agents.sessionExport,\n DEFAULT_FABRIC_CONFIG.agents.sessionExport,\n ),\n sessionExportDir:\n typeof agents.sessionExportDir === \"string\"\n ? agents.sessionExportDir\n : DEFAULT_FABRIC_CONFIG.agents.sessionExportDir,\n modelAdmission: modelAdmissionValue(\n agents.modelAdmission,\n DEFAULT_FABRIC_CONFIG.agents.modelAdmission,\n ),\n ...(stringValue(objectValue(agents.worktree).setup)\n ? { worktree: { setup: String(objectValue(agents.worktree).setup).trim() } }\n : {}),\n ...(agents.childQuestions === \"route\" ? { childQuestions: \"route\" as const } : {}),\n ...(agents.childQuestionTimeoutMs === undefined ? {} : {\n childQuestionTimeoutMs: boundedInteger(agents.childQuestionTimeoutMs, 600_000, 1_000, 86_400_000),\n }),\n // Exact tool names only: a +name/-name modifier would make the child's\n // Pi tool list invalid, and a * pattern would grant more than one tool.\n ...(Array.isArray(agents.childQuestionTools) ? {\n childQuestionTools: [...new Set(agents.childQuestionTools.flatMap((tool) => {\n const name = typeof tool === \"string\" ? tool.trim() : \"\";\n return name && name !== \"fabric_exec\" && !/^[+-]/.test(name) && !name.includes(\"*\") ? [name] : [];\n }))],\n } : {}),\n },\n jev: normalizeJevConfig(input.jev),\n components: configuredComponents.map((entry) => structuredClone(entry)),\n capture: {\n enabled: booleanValue(capture.enabled, DEFAULT_FABRIC_CONFIG.capture.enabled),\n hideFromModel: booleanValue(\n capture.hideFromModel,\n DEFAULT_FABRIC_CONFIG.capture.hideFromModel,\n ),\n keepVisible: [...new Set(configuredVisible)],\n defaultRisk: riskValue(capture.defaultRisk, DEFAULT_FABRIC_CONFIG.capture.defaultRisk),\n risks,\n },\n ui: {\n enabled: booleanValue(ui.enabled, DEFAULT_FABRIC_CONFIG.ui.enabled),\n widget: widgetModeValue(ui.widget, DEFAULT_FABRIC_CONFIG.ui.widget),\n maxRows: boundedInteger(ui.maxRows, DEFAULT_FABRIC_CONFIG.ui.maxRows, 1, 20),\n refreshMs: boundedInteger(ui.refreshMs, DEFAULT_FABRIC_CONFIG.ui.refreshMs, 100, 10_000),\n eventHistory: boundedInteger(\n ui.eventHistory,\n DEFAULT_FABRIC_CONFIG.ui.eventHistory,\n 1,\n 500,\n ),\n haltOnEscape: booleanValue(ui.haltOnEscape, DEFAULT_FABRIC_CONFIG.ui.haltOnEscape),\n herdrStatus: booleanValue(ui.herdrStatus, DEFAULT_FABRIC_CONFIG.ui.herdrStatus),\n // Renamed from ui.showNestedToolCalls; the v2 migration rewrites persisted\n // files, and this fallback covers configs normalized without migration.\n showAgentToolPreview: booleanValue(\n ui.showAgentToolPreview ?? ui.showNestedToolCalls,\n DEFAULT_FABRIC_CONFIG.ui.showAgentToolPreview,\n ),\n toolDisplay: toolDisplayModeValue(\n ui.toolDisplay,\n DEFAULT_FABRIC_CONFIG.ui.toolDisplay,\n ),\n terminalTitle: booleanValue(ui.terminalTitle, DEFAULT_FABRIC_CONFIG.ui.terminalTitle),\n // Renamed from ui.nestedToolDebounceMs (v3): the window coalesces every\n // live fabric_exec card update \u2014 nested calls, progress, agent previews.\n updateDebounceMs: boundedInteger(\n ui.updateDebounceMs ?? ui.nestedToolDebounceMs,\n DEFAULT_FABRIC_CONFIG.ui.updateDebounceMs,\n 0,\n 2_000,\n ),\n sessionLabel: ui.sessionLabel,\n },\n compaction: {\n engine: compactionEngineValue(compaction.engine, DEFAULT_FABRIC_CONFIG.compaction.engine),\n targetContextRatio: boundedFloat(\n compaction.targetContextRatio,\n DEFAULT_FABRIC_CONFIG.compaction.targetContextRatio,\n 0.25,\n 0.85,\n ),\n thresholds: compactionThresholds,\n tokenThresholds: compactionTokenThresholds,\n pressureBands: compactionPressureBandsValue(\n compaction.pressureBands,\n DEFAULT_FABRIC_CONFIG.compaction.pressureBands,\n ),\n outputReserveTokens: boundedInteger(\n compaction.outputReserveTokens,\n DEFAULT_FABRIC_CONFIG.compaction.outputReserveTokens,\n 0,\n MAX_COMPACTION_TOKEN_THRESHOLD,\n ),\n repairOrphans: booleanValue(\n compaction.repairOrphans,\n DEFAULT_FABRIC_CONFIG.compaction.repairOrphans,\n ),\n },\n retention: {\n orphanedTempRunMs: boundedInteger(\n retention.orphanedTempRunMs,\n DEFAULT_FABRIC_CONFIG.retention.orphanedTempRunMs,\n 60 * 60 * 1_000,\n 365 * 24 * 60 * 60 * 1_000,\n ),\n oneShotRunMs: boundedInteger(\n retention.oneShotRunMs,\n DEFAULT_FABRIC_CONFIG.retention.oneShotRunMs,\n 60 * 60 * 1_000,\n 365 * 24 * 60 * 60 * 1_000,\n ),\n actorRunArchiveMs: boundedInteger(\n retention.actorRunArchiveMs,\n DEFAULT_FABRIC_CONFIG.retention.actorRunArchiveMs,\n 60 * 60 * 1_000,\n 365 * 24 * 60 * 60 * 1_000,\n ),\n },\n mesh: {\n enabled: booleanValue(mesh.enabled, DEFAULT_FABRIC_CONFIG.mesh.enabled),\n ...(meshRoot ? { root: meshRoot } : {}),\n actorScope: actorScopeValue(mesh.actorScope, DEFAULT_FABRIC_CONFIG.mesh.actorScope),\n maxEventBytes: boundedInteger(\n mesh.maxEventBytes,\n DEFAULT_FABRIC_CONFIG.mesh.maxEventBytes,\n 1_024,\n 4 * 1024 * 1024,\n ),\n maxReadEvents: boundedInteger(\n mesh.maxReadEvents,\n DEFAULT_FABRIC_CONFIG.mesh.maxReadEvents,\n 1,\n 10_000,\n ),\n actorPollMs: boundedInteger(\n mesh.actorPollMs,\n DEFAULT_FABRIC_CONFIG.mesh.actorPollMs,\n 50,\n 10_000,\n ),\n actorQueueLimit: boundedInteger(\n mesh.actorQueueLimit,\n DEFAULT_FABRIC_CONFIG.mesh.actorQueueLimit,\n 1,\n 1_000,\n ),\n eventContextChars: boundedInteger(\n mesh.eventContextChars,\n DEFAULT_FABRIC_CONFIG.mesh.eventContextChars,\n 1_000,\n 1_000_000,\n ),\n actorContextEntries: boundedInteger(\n mesh.actorContextEntries,\n DEFAULT_FABRIC_CONFIG.mesh.actorContextEntries,\n 1,\n 100,\n ),\n peerNotices: booleanValue(mesh.peerNotices, DEFAULT_FABRIC_CONFIG.mesh.peerNotices),\n },\n models: {\n aliases: normalizeModelAliases(modelsSection.aliases),\n },\n memory: {\n extractive: {\n enabled: booleanValue(extractive.enabled, false),\n provider: stringValue(extractive.provider) || DEFAULT_EXTRACTIVE_CONFIG.provider,\n model: stringValue(extractive.model) || DEFAULT_EXTRACTIVE_CONFIG.model,\n maxViewBytes: boundedInteger(extractive.maxViewBytes, 8192, 1024, 32768),\n maxCandidates: boundedInteger(extractive.maxCandidates, 128, 1, 256),\n maxSourceChars: boundedInteger(extractive.maxSourceChars, 24000, 256, 100000),\n maxEvaluationsPerTurn: boundedInteger(extractive.maxEvaluationsPerTurn, 1, 0, 1),\n timeoutMs: boundedInteger(extractive.timeoutMs, 3000, 100, 10000),\n },\n enabled: booleanValue(memory.enabled, DEFAULT_FABRIC_CONFIG.memory.enabled),\n ...(memoryIndexDir ? { indexDir: memoryIndexDir } : {}),\n ...(memorySources ? { sources: memorySources } : {}),\n maxSessions: boundedInteger(\n memory.maxSessions,\n DEFAULT_FABRIC_CONFIG.memory.maxSessions,\n 1,\n 100_000,\n ),\n maxEntryChars: boundedInteger(\n memory.maxEntryChars,\n DEFAULT_FABRIC_CONFIG.memory.maxEntryChars,\n 100,\n 1_000_000,\n ),\n indexThinking: booleanValue(\n memory.indexThinking,\n DEFAULT_FABRIC_CONFIG.memory.indexThinking ?? false,\n ),\n indexToolOutput: booleanValue(\n memory.indexToolOutput,\n DEFAULT_FABRIC_CONFIG.memory.indexToolOutput ?? true,\n ),\n hotSessions: boundedInteger(\n memory.hotSessions,\n DEFAULT_FABRIC_CONFIG.memory.hotSessions ?? 50,\n 0,\n 100_000,\n ),\n digestTerms: boundedInteger(\n memory.digestTerms,\n DEFAULT_FABRIC_CONFIG.memory.digestTerms ?? 200,\n 1,\n 10_000,\n ),\n maxColdVocabularyBytes: boundedInteger(\n memory.maxColdVocabularyBytes,\n DEFAULT_FABRIC_CONFIG.memory.maxColdVocabularyBytes ?? 512 * 1024,\n 2,\n 64 * 1024 * 1024,\n ),\n maxColdCacheBytes: boundedInteger(\n memory.maxColdCacheBytes,\n DEFAULT_FABRIC_CONFIG.memory.maxColdCacheBytes ?? 1024 * 1024,\n 512,\n 128 * 1024 * 1024,\n ),\n maxSyncSessions: boundedInteger(\n memory.maxSyncSessions,\n DEFAULT_FABRIC_CONFIG.memory.maxSyncSessions ?? 10_000,\n 1,\n 1_000_000,\n ),\n maxSyncSourceBytes: boundedInteger(\n memory.maxSyncSourceBytes,\n DEFAULT_FABRIC_CONFIG.memory.maxSyncSourceBytes ?? 512 * 1024 * 1024,\n 1_024,\n 8 * 1024 * 1024 * 1024,\n ),\n maxCacheCleanupFiles: boundedInteger(\n memory.maxCacheCleanupFiles,\n DEFAULT_FABRIC_CONFIG.memory.maxCacheCleanupFiles ?? 100_000,\n 1,\n 1_000_000,\n ),\n regexMaxPatternBytes: boundedInteger(\n memory.regexMaxPatternBytes,\n DEFAULT_FABRIC_CONFIG.memory.regexMaxPatternBytes ?? 1_024,\n 1,\n 64 * 1024,\n ),\n regexMaxHaystackTerms: boundedInteger(\n memory.regexMaxHaystackTerms,\n DEFAULT_FABRIC_CONFIG.memory.regexMaxHaystackTerms ?? 20_000,\n 1,\n 1_000_000,\n ),\n regexMaxHaystackBytes: boundedInteger(\n memory.regexMaxHaystackBytes,\n DEFAULT_FABRIC_CONFIG.memory.regexMaxHaystackBytes ?? 2 * 1024 * 1024,\n 1_024,\n 128 * 1024 * 1024,\n ),\n regexTimeoutMs: boundedInteger(\n memory.regexTimeoutMs,\n DEFAULT_FABRIC_CONFIG.memory.regexTimeoutMs ?? 250,\n 10,\n 10_000,\n ),\n },\n entropy: {\n compile: booleanValue(entropy.compile, DEFAULT_FABRIC_CONFIG.entropy.compile),\n },\n repairs: {\n enabled: booleanValue(repairs.enabled, DEFAULT_FABRIC_CONFIG.repairs.enabled),\n },\n trace: {\n assessment: booleanValue(trace.assessment, DEFAULT_FABRIC_CONFIG.trace.assessment),\n },\n schema: {\n mode: schemaMode,\n certificateTtlMs: boundedInteger(\n schema.certificateTtlMs,\n DEFAULT_FABRIC_CONFIG.schema.certificateTtlMs,\n 1_000,\n 10 * 60_000,\n ),\n maxFiles: boundedInteger(\n schema.maxFiles,\n DEFAULT_FABRIC_CONFIG.schema.maxFiles,\n 1,\n 1_000,\n ),\n maxBytes: boundedInteger(\n schema.maxBytes,\n DEFAULT_FABRIC_CONFIG.schema.maxBytes,\n 1_024,\n 100 * 1024 * 1024,\n ),\n trustedCommands,\n },\n speculation: {\n enabled: booleanValue(\n speculation.enabled,\n DEFAULT_FABRIC_CONFIG.speculation.enabled,\n ),\n maxConcurrent: boundedInteger(\n speculation.maxConcurrent,\n DEFAULT_FABRIC_CONFIG.speculation.maxConcurrent,\n 1,\n 32,\n ),\n maxEntries: boundedInteger(\n speculation.maxEntries,\n DEFAULT_FABRIC_CONFIG.speculation.maxEntries,\n 1,\n 1_024,\n ),\n maxBufferBytes: boundedInteger(\n speculation.maxBufferBytes,\n DEFAULT_FABRIC_CONFIG.speculation.maxBufferBytes,\n 64 * 1024,\n 64 * 1024 * 1024,\n ),\n entryTtlMs: boundedInteger(\n speculation.entryTtlMs,\n DEFAULT_FABRIC_CONFIG.speculation.entryTtlMs,\n 5_000,\n 30 * 60_000,\n ),\n mcpAllowlist: [\n ...new Set(\n (Array.isArray(speculation.mcpAllowlist) ? speculation.mcpAllowlist : [])\n .filter(\n (entry): entry is string =>\n typeof entry === \"string\" && entry.trim().length > 0,\n )\n .map((entry) => entry.trim().slice(0, 256)),\n ),\n ].slice(0, 256),\n },\n thinking: {\n // Bounds are a ceiling policy: malformed values fail closed.\n bounds: normalizeThinkingBounds(objectValue(input.thinking).bounds, \"thinking.bounds\"),\n },\n // Malformed entries fail config loading; semantic refusals report at runtime.\n foreground: foregroundConfigValue(input.foreground),\n codePreview: normalizeCodePreviewSettings(input.codePreview),\n };\n};\n\nexport const effectiveToolCaptureConfig = (\n config: Pick<FabricConfig, \"fullCodeMode\" | \"capture\"> & Partial<Pick<FabricConfig, \"schema\">>,\n): FabricToolCaptureConfig =>\n config.schema?.mode === \"enforce\"\n ? {\n ...config.capture,\n enabled: true,\n hideFromModel: true,\n keepVisible: [\"fabric_exec\"],\n risks: { ...config.capture.risks },\n }\n : config.fullCodeMode\n ? {\n ...config.capture,\n keepVisible: config.capture.keepVisible.filter(\n (name) => !PI_CORE_TOOL_NAME_SET.has(name),\n ),\n risks: { ...config.capture.risks },\n }\n : {\n ...config.capture,\n enabled: false,\n hideFromModel: false,\n keepVisible: [...config.capture.keepVisible],\n risks: { ...config.capture.risks },\n };\n\ninterface FabricConfigFilePlan {\n path: string;\n document: Record<string, unknown>;\n source: string;\n changed: boolean;\n}\n\nconst planConfigFile = (filePath: string): FabricConfigFilePlan | undefined => {\n const input = readJsonObjectFile(filePath);\n if (!input) return undefined;\n const migration = migrateFabricConfigDocument(input.document);\n return {\n path: filePath,\n document: migration.document,\n source: input.source,\n changed: migration.changed,\n };\n};\n\nexport const writeJsonAtomic = (\n filePath: string,\n document: Record<string, unknown>,\n expectedSource: string | null,\n): void => {\n const resolvedPath = fs.existsSync(filePath) ? fs.realpathSync(filePath) : filePath;\n const directory = path.dirname(resolvedPath);\n if (!fs.existsSync(directory)) fs.mkdirSync(directory, { recursive: true });\n const mode = fs.existsSync(resolvedPath) ? fs.statSync(resolvedPath).mode & 0o777 : 0o600;\n const temporaryPath = path.join(\n directory,\n `.${path.basename(resolvedPath)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`,\n );\n let descriptor: number | undefined;\n try {\n descriptor = fs.openSync(temporaryPath, \"wx\", mode);\n fs.writeFileSync(descriptor, `${JSON.stringify(document, null, 2)}\\n`, \"utf8\");\n fs.fsyncSync(descriptor);\n fs.closeSync(descriptor);\n descriptor = undefined;\n if (expectedSource === null) {\n if (fs.existsSync(resolvedPath)) {\n throw new Error(`Fabric configuration changed while updating ${filePath}`);\n }\n } else {\n let currentSource: string;\n try {\n currentSource = fs.readFileSync(resolvedPath, \"utf8\");\n } catch (error) {\n throw new Error(`Fabric configuration changed while updating ${filePath}`, { cause: error });\n }\n if (currentSource !== expectedSource) {\n throw new Error(`Fabric configuration changed while updating ${filePath}`);\n }\n }\n renameAtomic(temporaryPath, resolvedPath);\n try {\n const directoryDescriptor = fs.openSync(directory, \"r\");\n try {\n fs.fsyncSync(directoryDescriptor);\n } finally {\n fs.closeSync(directoryDescriptor);\n }\n } catch (error) {\n const code = error instanceof Error && \"code\" in error ? error.code : undefined;\n if (code !== \"EINVAL\" && code !== \"ENOTSUP\" && code !== \"EISDIR\" && code !== \"EPERM\") throw error;\n }\n } catch (error) {\n if (descriptor !== undefined) fs.closeSync(descriptor);\n fs.rmSync(temporaryPath, { force: true });\n throw error;\n }\n};\n\nconst resolveFabricConfig = (\n options: {\n cwd: string;\n agentDir: string;\n },\n includeProject: boolean,\n applyEnvironmentOverrides: boolean,\n): FabricConfig => {\n let merged = structuredClone(DEFAULT_FABRIC_CONFIG) as unknown as Record<string, unknown>;\n const plans = [\n planConfigFile(path.join(options.agentDir, \"fabric.json\")),\n ...(includeProject\n ? [planConfigFile(path.join(options.cwd, \".pi\", \"fabric.json\"))]\n : []),\n ].filter((plan): plan is FabricConfigFilePlan => plan !== undefined);\n for (const plan of plans) {\n if (plan.changed) writeJsonAtomic(plan.path, plan.document, plan.source);\n merged = mergeObjects(merged, plan.document);\n }\n const inheritedKernel = process.env.PI_FABRIC_KERNEL;\n if (applyEnvironmentOverrides && inheritedKernel !== undefined) {\n // This can select trusted native execution: never repair an unsafe selector.\n if (inheritedKernel !== \"typescript\" && inheritedKernel !== \"python\") {\n throw new Error(`Invalid PI_FABRIC_KERNEL: ${inheritedKernel}; expected typescript or python`);\n }\n merged.executor = { ...objectValue(merged.executor), kernel: inheritedKernel };\n }\n const inheritedPythonRuntime = process.env.PI_FABRIC_PYTHON_RUNTIME;\n if (applyEnvironmentOverrides && inheritedPythonRuntime !== undefined) {\n if (inheritedPythonRuntime !== \"cpython\" && inheritedPythonRuntime !== \"monty\") {\n throw new Error(`Invalid PI_FABRIC_PYTHON_RUNTIME: ${inheritedPythonRuntime}; expected cpython or monty`);\n }\n merged.executor = { ...objectValue(merged.executor), pythonRuntime: inheritedPythonRuntime };\n }\n const inheritedFullCodeMode = process.env.PI_FABRIC_FULL_CODE_MODE;\n if (\n applyEnvironmentOverrides &&\n (inheritedFullCodeMode === \"true\" || inheritedFullCodeMode === \"false\")\n ) {\n merged.fullCodeMode = inheritedFullCodeMode === \"true\";\n }\n const normalized = normalizeFabricConfig(merged);\n if (applyEnvironmentOverrides && process.env[FABRIC_THINKING_BOUNDS_ENV] !== undefined) {\n // A child only narrows its own bounds by the parent's; never widens them.\n const inherited = inheritedThinkingBounds();\n if (inherited) {\n normalized.thinking.bounds = intersectThinkingBounds(inherited, normalized.thinking.bounds);\n }\n }\n return normalized;\n};\n\nexport const loadFabricConfigForScope = (\n options: {\n cwd: string;\n agentDir: string;\n projectTrusted: boolean;\n },\n scope: FabricConfigScope,\n): FabricConfig => {\n if (scope === \"project\" && !options.projectTrusted) {\n throw new Error(\"Cannot load project Fabric configuration for an untrusted project\");\n }\n return resolveFabricConfig(options, scope === \"project\", false);\n};\n\nexport const loadFabricConfig = (options: {\n cwd: string;\n agentDir: string;\n projectTrusted: boolean;\n}): FabricConfig => {\n const config = resolveFabricConfig(options, options.projectTrusted, true);\n if (config.compaction.engine === \"fabric\") {\n process.env.PI_FABRIC_COMPACTION_ENGINE = \"fabric\";\n } else {\n delete process.env.PI_FABRIC_COMPACTION_ENGINE;\n }\n return config;\n};\n\nexport const saveFabricConfig = (\n options: {\n cwd: string;\n agentDir: string;\n projectTrusted: boolean;\n scope?: FabricConfigScope;\n },\n partial: Record<string, unknown>,\n): { scope: FabricConfigScope; path: string } => {\n const scope = options.scope ?? (options.projectTrusted ? \"project\" : \"global\");\n if (scope === \"project\" && !options.projectTrusted) {\n throw new Error(\"Cannot save project Fabric configuration for an untrusted project\");\n }\n const targetPath = scope === \"project\"\n ? path.join(options.cwd, \".pi\", \"fabric.json\")\n : path.join(options.agentDir, \"fabric.json\");\n if (Object.hasOwn(partial, \"configVersion\") || Object.hasOwn(partial, \"subagents\")) {\n throw new Error(\"Fabric configuration updates must use the current schema\");\n }\n const input = readJsonObjectFile(targetPath);\n const existing = migrateFabricConfigDocument(input?.document ?? {}).document;\n const merged = mergeObjects(existing, partial) as Record<string, unknown>;\n // Reject invalid ownership before the settings UI replaces a working file.\n // Do not normalize the whole document: saved layers must remain sparse.\n nativeMcpServersValue(objectValue(merged.mcp).nativeServers);\n approvalActionOverridesValue(objectValue(merged.approvals).actions);\n foregroundConfigValue(merged.foreground);\n // Never stamp down: preserve version markers written by newer builds.\n merged.configVersion = Math.max(\n typeof merged.configVersion === \"number\" ? merged.configVersion : 0,\n CURRENT_FABRIC_CONFIG_VERSION,\n );\n writeJsonAtomic(targetPath, merged, input?.source ?? null);\n return { scope, path: targetPath };\n};\n", "import fs from \"node:fs\";\nimport path from \"node:path\";\n\n/**\n * Move an unreadable JSON document aside so the original path can be\n * recreated, without deleting evidence the operator may still want.\n */\nexport const quarantineDamagedFile = (filePath: string): string | undefined => {\n const destination = path.join(\n path.dirname(filePath),\n `${path.basename(filePath)}.damaged.${process.pid}.${Date.now()}`,\n );\n try {\n fs.renameSync(filePath, destination);\n return destination;\n } catch {\n return undefined;\n }\n};\n", "export const CURRENT_FABRIC_CONFIG_VERSION = 4;\n\nexport interface FabricConfigMigrationResult {\n document: Record<string, unknown>;\n fromVersion: number;\n toVersion: number;\n appliedVersions: number[];\n changed: boolean;\n // True when the document was written by a newer pi-fabric build. The document\n // is accepted as-is (newer builds only add semantics older builds can safely\n // ignore) and is never rewritten or version-stamped down.\n forwardCompatible: boolean;\n}\n\ninterface FabricConfigMigration {\n from: number;\n to: number;\n migrate(document: Readonly<Record<string, unknown>>): Record<string, unknown>;\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst mergeObjects = (\n base: Record<string, unknown>,\n override: Record<string, unknown>,\n): Record<string, unknown> => {\n const merged = { ...base };\n for (const [key, value] of Object.entries(override)) {\n const current = merged[key];\n merged[key] = isObject(current) && isObject(value) ? mergeObjects(current, value) : value;\n }\n return merged;\n};\n\nconst migrations: readonly FabricConfigMigration[] = [\n {\n from: 0,\n to: 1,\n migrate(document) {\n const migrated = { ...document };\n const legacy = migrated.subagents;\n const canonical = migrated.agents;\n if (legacy !== undefined) {\n if (canonical !== undefined && isObject(legacy) !== isObject(canonical)) {\n throw new Error(\n \"Fabric configuration cannot merge legacy subagents with a malformed agents section\",\n );\n }\n migrated.agents = isObject(legacy) && isObject(canonical)\n ? mergeObjects(legacy, canonical)\n : canonical ?? legacy;\n }\n delete migrated.subagents;\n return migrated;\n },\n },\n {\n from: 1,\n to: 2,\n migrate(document) {\n const migrated = { ...document };\n const ui = migrated.ui;\n if (isObject(ui) && Object.hasOwn(ui, \"showNestedToolCalls\")) {\n const renamed = { ...ui };\n if (!Object.hasOwn(renamed, \"showAgentToolPreview\")) {\n renamed.showAgentToolPreview = renamed.showNestedToolCalls;\n }\n delete renamed.showNestedToolCalls;\n migrated.ui = renamed;\n }\n return migrated;\n },\n },\n {\n from: 2,\n to: 3,\n migrate(document) {\n const migrated = { ...document };\n const ui = migrated.ui;\n if (isObject(ui) && Object.hasOwn(ui, \"nestedToolDebounceMs\")) {\n const renamed = { ...ui };\n if (!Object.hasOwn(renamed, \"updateDebounceMs\")) {\n renamed.updateDebounceMs = renamed.nestedToolDebounceMs;\n }\n delete renamed.nestedToolDebounceMs;\n migrated.ui = renamed;\n }\n return migrated;\n },\n },\n {\n from: 3,\n to: 4,\n migrate(document) {\n const migrated = { ...document };\n const prewalk = migrated.prewalk;\n if (\n isObject(prewalk) &&\n (prewalk.enabled === \"true\" || prewalk.enabled === \"false\")\n ) {\n migrated.prewalk = {\n ...prewalk,\n enabled: prewalk.enabled === \"true\",\n };\n }\n return migrated;\n },\n },\n];\n\nconst configVersion = (document: Readonly<Record<string, unknown>>): number => {\n const value = document.configVersion;\n if (value === undefined) return 0;\n if (typeof value !== \"number\" || !Number.isInteger(value) || value < 0) {\n throw new Error(\"Fabric configuration configVersion must be a non-negative integer\");\n }\n return value;\n};\n\nexport const migrateFabricConfigDocument = (\n input: Readonly<Record<string, unknown>>,\n): FabricConfigMigrationResult => {\n const fromVersion = configVersion(input);\n if (fromVersion > CURRENT_FABRIC_CONFIG_VERSION) {\n // Written by a newer build: accept as-is instead of bricking the\n // extension. Legacy-shape checks (e.g. the removed subagents key) apply to\n // supported versions only \u2014 newer semantics are unknown here.\n return {\n document: structuredClone(input) as Record<string, unknown>,\n fromVersion,\n toVersion: fromVersion,\n appliedVersions: [],\n changed: false,\n forwardCompatible: true,\n };\n }\n let version = fromVersion;\n let document = structuredClone(input) as Record<string, unknown>;\n const appliedVersions: number[] = [];\n\n while (version < CURRENT_FABRIC_CONFIG_VERSION) {\n const migration = migrations.find((candidate) => candidate.from === version);\n if (!migration || migration.to !== version + 1) {\n throw new Error(`No Fabric configuration migration exists for version ${version}`);\n }\n document = migration.migrate(document);\n version = migration.to;\n document.configVersion = version;\n appliedVersions.push(version);\n }\n\n if (Object.hasOwn(document, \"subagents\")) {\n throw new Error(\"Current Fabric configuration contains removed key subagents\");\n }\n\n return {\n document,\n fromVersion,\n toVersion: version,\n appliedVersions,\n changed: appliedVersions.length > 0,\n forwardCompatible: false,\n };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,IAAM,uBAAuB;AACpC,IAAM,yBAAyB;AAC/B,IAAM,UAAU,oBAAI,IAAI,CAAC,iBAAiB,eAAe,mBAAmB,eAAe,CAAC;AAC5F,IAAM,OAAO;AACb,IAAM,SAAS,CAAC,UAAoC,OAAO,UAAU,YAAY,KAAK,KAAK,KAAK;AAGzF,IAAM,wBAAwB,CAAC,UAA2C;AAC/E,QAAM,QAAQ,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,IAAI,QAAmC,CAAC;AACzH,QAAM,QAAQ,MAAM,SAAS,CAAC;AAC9B,MAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS,wBAAwB;AAClE,UAAM,IAAI,MAAM,gDAAgD,sBAAsB,UAAU;AAAA,EAClG;AACA,QAAM,WAAW,MAAM,YAAY;AACnC,MAAI,CAAC,OAAO,UAAU,QAAQ,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AW_SCHEMA_GUIDANCE = "exact raw inputSchema: fabric.tools.describe";
10
+ var truncation = (reason) => `/* truncated: ${reason}; ${RAW_SCHEMA_GUIDANCE} */`;
11
+ var truncatedUnknown = (reason) => `unknown ${truncation(reason)}`;
9
12
  var MAX_DEPTH = 6;
10
13
  var MAX_UNION_MEMBERS = 12;
11
14
  var MAX_SCHEMA_SOURCE_CHARS = 4096;
@@ -58,26 +61,37 @@ var objectType = (schema, depth) => {
58
61
  return `{ ${members.join("; ")} }`;
59
62
  };
60
63
  var schemaType = (schema, depth) => {
61
- if (depth > MAX_DEPTH) return "unknown";
64
+ if (depth > MAX_DEPTH) return truncatedUnknown("depth limit");
62
65
  if (schema === true || schema === void 0) return "unknown";
63
66
  if (schema === false) return "never";
64
67
  if (!isRecord(schema)) return "unknown";
65
68
  if ("const" in schema) return literalType(schema.const);
66
69
  if (Array.isArray(schema.enum) && schema.enum.length > 0) {
67
- return unionType(schema.enum.slice(0, MAX_UNION_MEMBERS).map(literalType));
70
+ const parts = schema.enum.slice(0, MAX_UNION_MEMBERS).map(literalType);
71
+ if (schema.enum.length > MAX_UNION_MEMBERS) {
72
+ parts.push(truncatedUnknown(`${schema.enum.length - MAX_UNION_MEMBERS} enum values omitted`));
73
+ }
74
+ return unionType(parts);
68
75
  }
69
76
  const alternates = Array.isArray(schema.anyOf) ? schema.anyOf : Array.isArray(schema.oneOf) ? schema.oneOf : void 0;
70
77
  if (alternates) {
71
78
  if (alternates.length === 0) return "unknown";
72
- return unionType(
73
- alternates.slice(0, MAX_UNION_MEMBERS).map((entry) => schemaType(entry, depth + 1))
74
- );
79
+ const parts = alternates.slice(0, MAX_UNION_MEMBERS).map((entry) => schemaType(entry, depth + 1));
80
+ if (alternates.length > MAX_UNION_MEMBERS) {
81
+ const keyword = Array.isArray(schema.anyOf) ? "anyOf" : "oneOf";
82
+ parts.push(truncatedUnknown(`${alternates.length - MAX_UNION_MEMBERS} ${keyword} alternatives omitted`));
83
+ }
84
+ return unionType(parts);
75
85
  }
76
86
  if (Array.isArray(schema.allOf) && schema.allOf.length > 0) {
77
- return schema.allOf.slice(0, MAX_UNION_MEMBERS).map((entry) => {
87
+ const parts = schema.allOf.slice(0, MAX_UNION_MEMBERS).map((entry) => {
78
88
  const rendered = schemaType(entry, depth + 1);
79
89
  return rendered.includes(" | ") ? `(${rendered})` : rendered;
80
- }).join(" & ");
90
+ });
91
+ if (schema.allOf.length > MAX_UNION_MEMBERS) {
92
+ parts.push(truncatedUnknown(`${schema.allOf.length - MAX_UNION_MEMBERS} allOf members omitted`));
93
+ }
94
+ return parts.join(" & ");
81
95
  }
82
96
  const types = typeList(schema.type);
83
97
  if (types.length > 1) {
@@ -94,12 +108,24 @@ var schemaType = (schema, depth) => {
94
108
  if (type === "array") {
95
109
  const items = schema.items;
96
110
  if (Array.isArray(items)) {
97
- return `[${items.slice(0, MAX_UNION_MEMBERS).map((entry) => schemaType(entry, depth + 1)).join(", ")}]`;
111
+ const parts = items.slice(0, MAX_UNION_MEMBERS).map((entry) => schemaType(entry, depth + 1));
112
+ if (items.length > MAX_UNION_MEMBERS) {
113
+ parts.push(`...unknown[] ${truncation(`${items.length - MAX_UNION_MEMBERS} tuple items omitted`)}`);
114
+ }
115
+ return `[${parts.join(", ")}]`;
98
116
  }
99
117
  return isRecord(items) || items === true ? `Array<${schemaType(items, depth + 1)}>` : "unknown[]";
100
118
  }
101
119
  return "unknown";
102
120
  };
121
+ var boundedSchemaType = (schema) => {
122
+ const json = JSON.stringify(schema);
123
+ if (json && json.length > MAX_SCHEMA_SOURCE_CHARS) {
124
+ return truncatedUnknown("schema source size limit (properties/members may be omitted)");
125
+ }
126
+ const rendered = schemaType(schema, 0);
127
+ return rendered.length > MAX_MEMBER_TYPE_CHARS ? truncatedUnknown("type size limit (properties/members may be omitted)") : rendered;
128
+ };
103
129
  var spend = (budget, text) => {
104
130
  if (budget.chars < text.length) return false;
105
131
  budget.chars -= text.length;
@@ -109,9 +135,13 @@ var hasRequiredArgs = (source) => Array.isArray(source.inputSchema.required) &&
109
135
  var renderMember = (name, source, resultType) => {
110
136
  const loose = `${propertyKey(name)}(args?: Record<string, unknown>): ${resultType};`;
111
137
  const schemaJson = JSON.stringify(source.inputSchema);
112
- if (!schemaJson || schemaJson.length > MAX_SCHEMA_SOURCE_CHARS) return loose;
138
+ if (!schemaJson || schemaJson.length > MAX_SCHEMA_SOURCE_CHARS) {
139
+ return `${truncation("schema source size limit (properties/members may be omitted)")} ${loose}`;
140
+ }
113
141
  const rendered = schemaType(source.inputSchema, 0);
114
- if (rendered.length > MAX_MEMBER_TYPE_CHARS) return loose;
142
+ if (rendered.length > MAX_MEMBER_TYPE_CHARS) {
143
+ return `${truncation("type size limit (properties/members may be omitted)")} ${loose}`;
144
+ }
115
145
  return `${propertyKey(name)}(args${hasRequiredArgs(source) ? "" : "?"}: ${rendered}): ${resultType};`;
116
146
  };
117
147
  var renderMemberBlock = (sources, resultType, limit, budget) => {
@@ -192,6 +222,7 @@ ${memberBlock.lines.join("\n")}
192
222
  if (droppedTools > 0) notes.push(`${droppedTools} tool(s) untyped`);
193
223
  const note = notes.length > 0 ? `// Omitted from this surface (${notes.join(", ")}); those calls compile
194
224
  // as the loose fallback would and still validate at dispatch.
225
+ // ${RAW_SCHEMA_GUIDANCE}.
195
226
  ` : "";
196
227
  return "// Generated from the live MCP descriptor cache for this execution. Known\n// servers and tools carry their schemas so argument-shape mistakes fail\n// type-check before the sandbox runs, like pi.* calls do; anything absent\n// (cold cache, ambiguous sanitized names) compiles as it would with the\n// loose declarations and is validated by the registry at dispatch.\n" + note + interfaces.join("\n") + (interfaces.length > 0 ? "\n" : "") + `declare const mcp: {
197
228
  ${mapEntries.join("\n")}
@@ -208,6 +239,7 @@ var renderExtensionsDeclaration = (sources) => {
208
239
  );
209
240
  const note = memberBlock.dropped > 0 ? `// Omitted ${memberBlock.dropped} tool(s) from this surface; those calls
210
241
  // compile as the loose fallback would and still validate at dispatch.
242
+ // ${RAW_SCHEMA_GUIDANCE}.
211
243
  ` : "";
212
244
  return "// Generated from the captured extension tool catalog for this execution,\n// with the same advisory semantics as the generated mcp surface above.\n" + note + `interface FabricExtensionsApiDynamic {
213
245
  ${memberBlock.lines.join("\n")}
@@ -243,7 +275,7 @@ declare const ${name}: ${interfaceName} & FabricProviderGlobal;
243
275
  line = ` ${renderMember(action.name, action, "Promise<any>")}
244
276
  `;
245
277
  } catch {
246
- line = ` ${propertyKey(action.name)}(args?: Record<string, unknown>): Promise<any>;
278
+ line = ` ${truncation("schema could not be rendered")} ${propertyKey(action.name)}(args?: Record<string, unknown>): Promise<any>;
247
279
  `;
248
280
  }
249
281
  if (used + line.length + frame > budget.chars) {
@@ -254,11 +286,13 @@ declare const ${name}: ${interfaceName} & FabricProviderGlobal;
254
286
  members.push(line);
255
287
  }
256
288
  if (members.length === 0) {
257
- blocks.push(`declare const ${name}: FabricProviderGlobal;
289
+ blocks.push(`${omitted > 0 ? `// Omitted ${omitted} action(s); ${RAW_SCHEMA_GUIDANCE}.
290
+ ` : ""}declare const ${name}: FabricProviderGlobal;
258
291
  `);
259
292
  continue;
260
293
  }
261
- const block = `interface ${interfaceName} {
294
+ const block = (omitted > 0 ? `// Omitted ${omitted} action(s); ${RAW_SCHEMA_GUIDANCE}.
295
+ ` : "") + `interface ${interfaceName} {
262
296
  ${members.join("")}}
263
297
  declare const ${name}: ${interfaceName}${omitted > 0 ? " & FabricProviderGlobal" : ""};
264
298
  `;
@@ -267,7 +301,7 @@ declare const ${name}: ${interfaceName}${omitted > 0 ? " & FabricProviderGlobal"
267
301
  }
268
302
  return '// Generated from the providers other extensions registered for this\n// execution. Each global calls tools.call({ ref: "<provider>.<action>", args }),\n// so the registry still validates, approves and audits every call.\n' + blocks.join("");
269
303
  };
270
- var describeFabricActionDeclaration = (name, inputSchema, outputSchema) => `${JSON.stringify(name)}: (args: ${schemaType(inputSchema, 0)}) => Promise<${outputSchema ? schemaType(outputSchema, 0) : "unknown"}>`;
304
+ var describeFabricActionDeclaration = (name, inputSchema, outputSchema) => `${JSON.stringify(name)}: (args: ${boundedSchemaType(inputSchema)}) => Promise<${outputSchema ? boundedSchemaType(outputSchema) : "unknown"}>`;
271
305
  var buildDynamicGuestDeclarations = (sources) => {
272
306
  const dynamic = {};
273
307
  if (sources.mcpServers && sources.mcpServers.length > 0) {
@@ -287,4 +321,4 @@ export {
287
321
  describeFabricActionDeclaration,
288
322
  buildDynamicGuestDeclarations
289
323
  };
290
- //# sourceMappingURL=chunk-AI2AR5V3.js.map
324
+ //# sourceMappingURL=chunk-5TG5BBFH.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runtime/dynamic-guest-types.ts"],
4
+ "sourcesContent": ["import { providerGlobalNames } from \"../provider-globals.js\";\nimport { sanitizeMcpRefPart } from \"../ref-names.js\";\nimport type {\n FabricDynamicGuestDeclarations,\n FabricGuestTypeSources,\n FabricNamedActionTypeSource,\n FabricProviderTypeSource,\n} from \"../protocol.js\";\n\n// Renders guest .d.ts fragments for the dynamic call surfaces\n// (mcp.<server>.<tool> and extensions.<tool>) from live provider descriptors,\n// closing the type-check gap those globals had as Record<string, unknown>\n// callables: argument-shape mistakes surfaced only at dispatch time. The\n// generated surface stays advisory \u2014 the registry still validates every\n// call's args against the action's own inputSchema before invoke, so drift\n// between these declarations and a live server fails at the usual validate\n// stage rather than silently.\n\n// Every lossy rendering points back to the unmodified schema, not the preview.\nconst RAW_SCHEMA_GUIDANCE = \"exact raw inputSchema: fabric.tools.describe\";\nconst truncation = (reason: string): string =>\n `/* truncated: ${reason}; ${RAW_SCHEMA_GUIDANCE} */`;\nconst truncatedUnknown = (reason: string): string => `unknown ${truncation(reason)}`;\n\nconst MAX_DEPTH = 6;\nconst MAX_UNION_MEMBERS = 12;\nconst MAX_SCHEMA_SOURCE_CHARS = 4_096;\nconst MAX_MEMBER_TYPE_CHARS = 2_500;\nconst MAX_SECTION_CHARS = 60_000;\nconst MAX_MCP_SERVERS = 64;\nconst MAX_TOOLS_PER_SERVER = 128;\nconst MAX_EXTENSION_TOOLS = 256;\nconst MAX_ACTIONS_PER_PROVIDER = 128;\n// The provider-global proxy answers these with undefined (no thenable, no\n// JSON hook), so declaring them as actions would promise a call that never runs.\nconst UNCALLABLE_PROVIDER_MEMBERS = new Set([\"then\", \"toJSON\"]);\n\nconst IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst propertyKey = (name: string): string =>\n IDENTIFIER.test(name) ? name : JSON.stringify(name);\n\nconst literalType = (value: unknown): string => {\n if (value === null) return \"null\";\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"number\" && Number.isFinite(value)) return JSON.stringify(value);\n if (typeof value === \"boolean\") return value ? \"true\" : \"false\";\n return \"unknown\";\n};\n\nconst unionType = (parts: string[]): string => {\n const unique = [...new Set(parts)];\n if (unique.length === 0) return \"unknown\";\n return unique.length === 1 ? unique[0]! : unique.join(\" | \");\n};\n\nconst typeList = (value: unknown): string[] => {\n if (typeof value === \"string\") return [value];\n if (Array.isArray(value)) {\n return value.filter((entry): entry is string => typeof entry === \"string\");\n }\n return [];\n};\n\nconst objectType = (schema: Record<string, unknown>, depth: number): string => {\n const properties = isRecord(schema.properties) ? schema.properties : {};\n const required = new Set(\n Array.isArray(schema.required)\n ? schema.required.filter((entry): entry is string => typeof entry === \"string\")\n : [],\n );\n const members: string[] = [];\n for (const key of Object.keys(properties).sort()) {\n members.push(\n `${propertyKey(key)}${required.has(key) ? \"\" : \"?\"}: ${schemaType(properties[key], depth + 1)}`,\n );\n }\n const additional = schema.additionalProperties;\n if (additional !== false) {\n members.push(\n isRecord(additional)\n ? `[key: string]: ${schemaType(additional, depth + 1)}`\n : \"[key: string]: unknown\",\n );\n }\n return `{ ${members.join(\"; \")} }`;\n};\n\nconst schemaType = (schema: unknown, depth: number): string => {\n if (depth > MAX_DEPTH) return truncatedUnknown(\"depth limit\");\n if (schema === true || schema === undefined) return \"unknown\";\n if (schema === false) return \"never\";\n if (!isRecord(schema)) return \"unknown\";\n if (\"const\" in schema) return literalType(schema.const);\n if (Array.isArray(schema.enum) && schema.enum.length > 0) {\n const parts = schema.enum.slice(0, MAX_UNION_MEMBERS).map(literalType);\n if (schema.enum.length > MAX_UNION_MEMBERS) {\n parts.push(truncatedUnknown(`${schema.enum.length - MAX_UNION_MEMBERS} enum values omitted`));\n }\n return unionType(parts);\n }\n const alternates = Array.isArray(schema.anyOf)\n ? schema.anyOf\n : Array.isArray(schema.oneOf)\n ? schema.oneOf\n : undefined;\n if (alternates) {\n if (alternates.length === 0) return \"unknown\";\n const parts = alternates.slice(0, MAX_UNION_MEMBERS).map((entry) => schemaType(entry, depth + 1));\n if (alternates.length > MAX_UNION_MEMBERS) {\n const keyword = Array.isArray(schema.anyOf) ? \"anyOf\" : \"oneOf\";\n parts.push(truncatedUnknown(`${alternates.length - MAX_UNION_MEMBERS} ${keyword} alternatives omitted`));\n }\n return unionType(parts);\n }\n if (Array.isArray(schema.allOf) && schema.allOf.length > 0) {\n const parts = schema.allOf\n .slice(0, MAX_UNION_MEMBERS)\n .map((entry) => {\n const rendered = schemaType(entry, depth + 1);\n return rendered.includes(\" | \") ? `(${rendered})` : rendered;\n });\n if (schema.allOf.length > MAX_UNION_MEMBERS) {\n parts.push(truncatedUnknown(`${schema.allOf.length - MAX_UNION_MEMBERS} allOf members omitted`));\n }\n return parts.join(\" & \");\n }\n const types = typeList(schema.type);\n if (types.length > 1) {\n return unionType(types.map((type) => schemaType({ ...schema, type }, depth + 1)));\n }\n const type = types[0];\n if (type === \"object\" || (!type && isRecord(schema.properties))) {\n return objectType(schema, depth);\n }\n if (type === \"string\") return \"string\";\n if (type === \"number\" || type === \"integer\") return \"number\";\n if (type === \"boolean\") return \"boolean\";\n if (type === \"null\") return \"null\";\n if (type === \"array\") {\n const items = schema.items;\n if (Array.isArray(items)) {\n const parts = items.slice(0, MAX_UNION_MEMBERS).map((entry) => schemaType(entry, depth + 1));\n if (items.length > MAX_UNION_MEMBERS) {\n parts.push(`...unknown[] ${truncation(`${items.length - MAX_UNION_MEMBERS} tuple items omitted`)}`);\n }\n return `[${parts.join(\", \")}]`;\n }\n return isRecord(items) || items === true\n ? `Array<${schemaType(items, depth + 1)}>`\n : \"unknown[]\";\n }\n return \"unknown\";\n};\n\n// Bound both guest declarations and standalone describeTool previews. Never\n// slice generated TypeScript: that can leave an invalid type or hide properties.\nconst boundedSchemaType = (schema: unknown): string => {\n const json = JSON.stringify(schema);\n if (json && json.length > MAX_SCHEMA_SOURCE_CHARS) {\n return truncatedUnknown(\"schema source size limit (properties/members may be omitted)\");\n }\n const rendered = schemaType(schema, 0);\n return rendered.length > MAX_MEMBER_TYPE_CHARS\n ? truncatedUnknown(\"type size limit (properties/members may be omitted)\")\n : rendered;\n};\n\ninterface FabricRenderBudget {\n chars: number;\n}\n\nconst spend = (budget: FabricRenderBudget, text: string): boolean => {\n if (budget.chars < text.length) return false;\n budget.chars -= text.length;\n return true;\n};\n\nconst hasRequiredArgs = (source: FabricNamedActionTypeSource): boolean =>\n Array.isArray(source.inputSchema.required) &&\n source.inputSchema.required.length > 0 &&\n isRecord(source.inputSchema.properties);\n\nconst renderMember = (\n name: string,\n source: FabricNamedActionTypeSource,\n resultType: string,\n): string => {\n const loose = `${propertyKey(name)}(args?: Record<string, unknown>): ${resultType};`;\n const schemaJson = JSON.stringify(source.inputSchema);\n if (!schemaJson || schemaJson.length > MAX_SCHEMA_SOURCE_CHARS) {\n return `${truncation(\"schema source size limit (properties/members may be omitted)\")} ${loose}`;\n }\n const rendered = schemaType(source.inputSchema, 0);\n if (rendered.length > MAX_MEMBER_TYPE_CHARS) {\n return `${truncation(\"type size limit (properties/members may be omitted)\")} ${loose}`;\n }\n return `${propertyKey(name)}(args${hasRequiredArgs(source) ? \"\" : \"?\"}: ${rendered}): ${resultType};`;\n};\n\n// Name collisions after sanitization are ambiguous: the MCP provider refuses\n// ambiguous sanitized server names and resolves colliding tools to the first\n// match, so mirrored members would promise a shape dispatch does not\n// guarantee. Unique names render in up to two forms \u2014 the sanitized\n// identifier the model types and a quoted raw alias for bracket access\n// (mcp[\"my-server\"]) \u2014 and ambiguous groups render nothing. A raw alias can\n// never collide with a sanitized member: aliases always contain a character\n// the sanitizer would replace or a leading digit it would prefix.\nconst renderMemberBlock = (\n sources: FabricNamedActionTypeSource[],\n resultType: string,\n limit: number,\n budget: FabricRenderBudget,\n): { lines: string[]; dropped: number } => {\n const bySanitized = new Map<string, FabricNamedActionTypeSource[]>();\n for (const source of sources.slice(0, limit)) {\n const key = sanitizeMcpRefPart(source.name);\n const group = bySanitized.get(key);\n if (group) group.push(source);\n else bySanitized.set(key, [source]);\n }\n const lines: string[] = [];\n let dropped = Math.max(0, sources.length - limit);\n const sortedGroups = [...bySanitized.entries()].sort(([a], [b]) => a.localeCompare(b));\n for (const [sanitized, group] of sortedGroups) {\n if (group.length > 1) {\n dropped += group.length;\n continue;\n }\n const source = group[0]!;\n const text =\n source.name === sanitized\n ? ` ${renderMember(sanitized, source, resultType)}`\n : ` ${renderMember(sanitized, source, resultType)}\\n ${renderMember(source.name, source, resultType)}`;\n if (!spend(budget, text)) {\n dropped += 1;\n continue;\n }\n lines.push(text);\n }\n return { lines, dropped };\n};\n\nconst renderMcpDeclaration = (\n sources: NonNullable<FabricGuestTypeSources[\"mcpServers\"]>,\n): string => {\n const bySanitized = new Map<string, typeof sources>();\n const rawNames = new Set<string>();\n for (const source of sources.slice(0, MAX_MCP_SERVERS)) {\n if (rawNames.has(source.server)) continue;\n rawNames.add(source.server);\n const key = sanitizeMcpRefPart(source.server);\n const group = bySanitized.get(key);\n if (group) group.push(source);\n else bySanitized.set(key, [source]);\n }\n const budget: FabricRenderBudget = { chars: MAX_SECTION_CHARS };\n const interfaces: string[] = [];\n const mapEntries: string[] = [];\n let droppedServers = Math.max(0, sources.length - rawNames.size);\n let droppedTools = 0;\n const sortedGroups = [...bySanitized.entries()].sort(([a], [b]) => a.localeCompare(b));\n for (const [sanitized, group] of sortedGroups) {\n if (group.length > 1) {\n droppedServers += group.length;\n droppedTools += group.reduce((total, entry) => total + entry.tools.length, 0);\n continue;\n }\n const source = group[0]!;\n const interfaceName = `FabricMcpServer_${sanitized}`;\n const memberBlock = renderMemberBlock(\n source.tools,\n \"Promise<FabricMcpResult | unknown>\",\n MAX_TOOLS_PER_SERVER,\n budget,\n );\n droppedTools += memberBlock.dropped;\n const header = `interface ${interfaceName} {\\n${memberBlock.lines.join(\"\\n\")}\\n}`;\n if (!spend(budget, header)) {\n droppedServers += 1;\n droppedTools += source.tools.length;\n break;\n }\n interfaces.push(header);\n mapEntries.push(` ${sanitized}: ${interfaceName};`);\n if (source.server !== sanitized) {\n mapEntries.push(` ${propertyKey(source.server)}: ${interfaceName};`);\n }\n }\n const notes: string[] = [];\n if (droppedServers > 0) notes.push(`${droppedServers} server(s) untyped`);\n if (droppedTools > 0) notes.push(`${droppedTools} tool(s) untyped`);\n const note =\n notes.length > 0\n ? `// Omitted from this surface (${notes.join(\", \")}); those calls compile\\n// as the loose fallback would and still validate at dispatch.\\n// ${RAW_SCHEMA_GUIDANCE}.\\n`\n : \"\";\n return (\n \"// Generated from the live MCP descriptor cache for this execution. Known\\n\" +\n \"// servers and tools carry their schemas so argument-shape mistakes fail\\n\" +\n \"// type-check before the sandbox runs, like pi.* calls do; anything absent\\n\" +\n \"// (cold cache, ambiguous sanitized names) compiles as it would with the\\n\" +\n \"// loose declarations and is validated by the registry at dispatch.\\n\" +\n note +\n interfaces.join(\"\\n\") +\n (interfaces.length > 0 ? \"\\n\" : \"\") +\n `declare const mcp: {\\n${mapEntries.join(\"\\n\")}\\n} & FabricMcpManagement;\\n`\n );\n};\n\nconst renderExtensionsDeclaration = (\n sources: NonNullable<FabricGuestTypeSources[\"extensionTools\"]>,\n): string => {\n const budget: FabricRenderBudget = { chars: MAX_SECTION_CHARS };\n const memberBlock = renderMemberBlock(\n sources,\n \"Promise<FabricCapturedToolResult>\",\n MAX_EXTENSION_TOOLS,\n budget,\n );\n const note =\n memberBlock.dropped > 0\n ? `// Omitted ${memberBlock.dropped} tool(s) from this surface; those calls\\n// compile as the loose fallback would and still validate at dispatch.\\n// ${RAW_SCHEMA_GUIDANCE}.\\n`\n : \"\";\n return (\n \"// Generated from the captured extension tool catalog for this execution,\\n\" +\n \"// with the same advisory semantics as the generated mcp surface above.\\n\" +\n note +\n `interface FabricExtensionsApiDynamic {\\n${memberBlock.lines.join(\"\\n\")}\\n}\\n` +\n \"declare const extensions: FabricExtensionsApiDynamic;\\n\"\n );\n};\n\n// One global per eligible provider (src/provider-globals.ts), in the same\n// order and under the same cap as the globals the kernels install, so the\n// type gate and the runtime always agree on which names exist. Typed members\n// come from each action's input schema; a provider with no typed actions, or\n// one rendered after the section budget ran out, gets the loose\n// FabricProviderGlobal shape. When only some actions fit, the rest stay\n// callable through an intersection with that loose shape. Calls return\n// Promise<any>, as permissive as tools.call, so moving a call from tools.call\n// to the global never adds a result-type error.\nconst renderProviderDeclarations = (\n sources: NonNullable<FabricGuestTypeSources[\"providers\"]>,\n): string | undefined => {\n const byName = new Map<string, FabricProviderTypeSource>();\n for (const source of sources) {\n if (typeof source?.provider === \"string\" && !byName.has(source.provider)) byName.set(source.provider, source);\n }\n const names = providerGlobalNames(byName.keys());\n if (names.length === 0) return undefined;\n const budget: FabricRenderBudget = { chars: MAX_SECTION_CHARS };\n const blocks: string[] = [];\n for (const name of names) {\n const interfaceName = `FabricProviderGlobal_${name}`;\n const frame = `interface ${interfaceName} {\\n}\\ndeclare const ${name}: ${interfaceName} & FabricProviderGlobal;\\n`.length;\n const actions = Array.isArray(byName.get(name)!.actions) ? byName.get(name)!.actions : [];\n const seen = new Set<string>();\n const members: string[] = [];\n let used = 0;\n let omitted = Math.max(0, actions.length - MAX_ACTIONS_PER_PROVIDER);\n for (const action of actions.slice(0, MAX_ACTIONS_PER_PROVIDER)) {\n if (typeof action?.name !== \"string\" || seen.has(action.name) || UNCALLABLE_PROVIDER_MEMBERS.has(action.name)) continue;\n seen.add(action.name);\n let line: string;\n try {\n line = ` ${renderMember(action.name, action, \"Promise<any>\")}\\n`;\n } catch {\n line = ` ${truncation(\"schema could not be rendered\")} ${propertyKey(action.name)}(args?: Record<string, unknown>): Promise<any>;\\n`;\n }\n if (used + line.length + frame > budget.chars) {\n omitted += 1;\n continue;\n }\n used += line.length;\n members.push(line);\n }\n if (members.length === 0) {\n blocks.push(`${omitted > 0 ? `// Omitted ${omitted} action(s); ${RAW_SCHEMA_GUIDANCE}.\\n` : \"\"}declare const ${name}: FabricProviderGlobal;\\n`);\n continue;\n }\n const block =\n (omitted > 0 ? `// Omitted ${omitted} action(s); ${RAW_SCHEMA_GUIDANCE}.\\n` : \"\") +\n `interface ${interfaceName} {\\n${members.join(\"\")}}\\n` +\n `declare const ${name}: ${interfaceName}${omitted > 0 ? \" & FabricProviderGlobal\" : \"\"};\\n`;\n budget.chars -= block.length;\n blocks.push(block);\n }\n return (\n \"// Generated from the providers other extensions registered for this\\n\" +\n \"// execution. Each global calls tools.call({ ref: \\\"<provider>.<action>\\\", args }),\\n\" +\n \"// so the registry still validates, approves and audits every call.\\n\" +\n blocks.join(\"\")\n );\n};\n\n// Renders replacement `declare const mcp` / `declare const extensions` blocks\n// for guestTypeDeclarations(). Missing or empty sections return undefined so\n// the loose static lines survive, matching cold-cache behavior.\n/** Bounded advisory declaration for native describeTool compatibility. */\nexport const describeFabricActionDeclaration = (name: string, inputSchema: Record<string, unknown>, outputSchema?: Record<string, unknown>): string =>\n `${JSON.stringify(name)}: (args: ${boundedSchemaType(inputSchema)}) => Promise<${outputSchema ? boundedSchemaType(outputSchema) : \"unknown\"}>`;\n\nexport const buildDynamicGuestDeclarations = (\n sources: FabricGuestTypeSources,\n): FabricDynamicGuestDeclarations => {\n const dynamic: FabricDynamicGuestDeclarations = {};\n if (sources.mcpServers && sources.mcpServers.length > 0) {\n dynamic.mcp = renderMcpDeclaration(sources.mcpServers);\n }\n if (sources.extensionTools && sources.extensionTools.length > 0) {\n dynamic.extensions = renderExtensionsDeclaration(sources.extensionTools);\n }\n if (sources.providers && sources.providers.length > 0) {\n const providers = renderProviderDeclarations(sources.providers);\n if (providers) dynamic.providers = providers;\n }\n return dynamic;\n};\n"],
5
+ "mappings": ";;;;;;;;AAmBA,IAAM,sBAAsB;AAC5B,IAAM,aAAa,CAAC,WAClB,iBAAiB,MAAM,KAAK,mBAAmB;AACjD,IAAM,mBAAmB,CAAC,WAA2B,WAAW,WAAW,MAAM,CAAC;AAElF,IAAM,YAAY;AAClB,IAAM,oBAAoB;AAC1B,IAAM,0BAA0B;AAChC,IAAM,wBAAwB;AAC9B,IAAM,oBAAoB;AAC1B,IAAM,kBAAkB;AACxB,IAAM,uBAAuB;AAC7B,IAAM,sBAAsB;AAC5B,IAAM,2BAA2B;AAGjC,IAAM,8BAA8B,oBAAI,IAAI,CAAC,QAAQ,QAAQ,CAAC;AAE9D,IAAM,aAAa;AAEnB,IAAM,WAAW,CAAC,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,IAAM,cAAc,CAAC,SACnB,WAAW,KAAK,IAAI,IAAI,OAAO,KAAK,UAAU,IAAI;AAEpD,IAAM,cAAc,CAAC,UAA2B;AAC9C,MAAI,UAAU,KAAM,QAAO;AAC3B,MAAI,OAAO,UAAU,SAAU,QAAO,KAAK,UAAU,KAAK;AAC1D,MAAI,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,EAAG,QAAO,KAAK,UAAU,KAAK;AACpF,MAAI,OAAO,UAAU,UAAW,QAAO,QAAQ,SAAS;AACxD,SAAO;AACT;AAEA,IAAM,YAAY,CAAC,UAA4B;AAC7C,QAAM,SAAS,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC;AACjC,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,SAAO,OAAO,WAAW,IAAI,OAAO,CAAC,IAAK,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IACnB;AACA,QAAI,QAAQ,WAAW,GAAG;AACxB,aAAO,KAAK,GAAG,UAAU,IAAI,cAAc,OAAO,eAAe,mBAAmB;AAAA,IAAQ,EAAE,iBAAiB,IAAI;AAAA,CAA2B;AAC9I;AAAA,IACF;AACA,UAAM,SACH,UAAU,IAAI,cAAc,OAAO,eAAe,mBAAmB;AAAA,IAAQ,MAC9E,aAAa,aAAa;AAAA,EAAO,QAAQ,KAAK,EAAE,CAAC;AAAA,gBAChC,IAAI,KAAK,aAAa,GAAG,UAAU,IAAI,4BAA4B,EAAE;AAAA;AACxF,WAAO,SAAS,MAAM;AACtB,WAAO,KAAK,KAAK;AAAA,EACnB;AACA,SACE,mOAGA,OAAO,KAAK,EAAE;AAElB;AAMO,IAAM,kCAAkC,CAAC,MAAc,aAAsC,iBAClG,GAAG,KAAK,UAAU,IAAI,CAAC,YAAY,kBAAkB,WAAW,CAAC,gBAAgB,eAAe,kBAAkB,YAAY,IAAI,SAAS;AAEtI,IAAM,gCAAgC,CAC3C,YACmC;AACnC,QAAM,UAA0C,CAAC;AACjD,MAAI,QAAQ,cAAc,QAAQ,WAAW,SAAS,GAAG;AACvD,YAAQ,MAAM,qBAAqB,QAAQ,UAAU;AAAA,EACvD;AACA,MAAI,QAAQ,kBAAkB,QAAQ,eAAe,SAAS,GAAG;AAC/D,YAAQ,aAAa,4BAA4B,QAAQ,cAAc;AAAA,EACzE;AACA,MAAI,QAAQ,aAAa,QAAQ,UAAU,SAAS,GAAG;AACrD,UAAM,YAAY,2BAA2B,QAAQ,SAAS;AAC9D,QAAI,UAAW,SAAQ,YAAY;AAAA,EACrC;AACA,SAAO;AACT;",
6
+ "names": ["type"]
7
+ }
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  checkObserve,
7
7
  jevObserveSchema
8
- } from "./chunk-4Y2LMAF2.js";
8
+ } from "./chunk-XB3OQO4N.js";
9
9
  import {
10
10
  JevBilledError,
11
11
  checkSchema,
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-FSYAGCGA.js";
16
16
  import {
17
17
  validationMessage
18
- } from "./chunk-RXFUXMXS.js";
18
+ } from "./chunk-LIAMZBOP.js";
19
19
  import {
20
20
  runAbortable
21
21
  } from "./chunk-7TB7NXSL.js";
@@ -854,4 +854,4 @@ export {
854
854
  JEV_ACTION_DESCRIPTORS,
855
855
  JevProvider
856
856
  };
857
- //# sourceMappingURL=chunk-2N2NS4ZR.js.map
857
+ //# sourceMappingURL=chunk-6QF4DOT3.js.map
@@ -56,7 +56,7 @@ import {
56
56
  DEFAULT_FABRIC_CONFIG,
57
57
  MAX_AGENT_TIMEOUT_MS,
58
58
  MIN_AGENT_TIMEOUT_MS
59
- } from "./chunk-S3IHVG32.js";
59
+ } from "./chunk-3Y7PS34H.js";
60
60
  import {
61
61
  readJsonlPage
62
62
  } from "./chunk-CGPK5WHX.js";
@@ -8017,4 +8017,4 @@ export {
8017
8017
  agentParticipantRecords,
8018
8018
  actorParticipantRecord
8019
8019
  };
8020
- //# sourceMappingURL=chunk-4VRBBCH6.js.map
8020
+ //# sourceMappingURL=chunk-D3LJDO2Y.js.map