@e4779/pi-fabric 0.96.4-fork.10 → 0.97.0-fork.11

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 (91) hide show
  1. package/README.md +1 -0
  2. package/dist/cache/leases.d.ts +24 -0
  3. package/dist/cache/leases.d.ts.map +1 -0
  4. package/dist/cache/observations.d.ts +8 -0
  5. package/dist/cache/observations.d.ts.map +1 -0
  6. package/dist/cache/types.d.ts +68 -0
  7. package/dist/cache/types.d.ts.map +1 -0
  8. package/dist/chunks/{chunk-3CJETB4S.js → chunk-2LBC6TTP.js} +2 -2
  9. package/dist/chunks/{chunk-ZRI433JP.js → chunk-4F27LJTS.js} +2 -2
  10. package/dist/chunks/{chunk-GGETIGM5.js → chunk-5WUW727L.js} +2 -1
  11. package/dist/chunks/{chunk-GGETIGM5.js.map → chunk-5WUW727L.js.map} +2 -2
  12. package/dist/chunks/{chunk-QFKHAAZA.js → chunk-6K5SRGW6.js} +1 -1
  13. package/dist/chunks/{chunk-EBWMC3OO.js → chunk-A4XPJESK.js} +2 -2
  14. package/dist/chunks/{chunk-B2IVWASP.js → chunk-CZSX6UG6.js} +2 -2
  15. package/dist/chunks/{chunk-ZTXZ6JDO.js → chunk-D5GNTBV6.js} +2 -2
  16. package/dist/chunks/{chunk-ULQFHZJE.js → chunk-EPAFGT2M.js} +35 -1
  17. package/dist/chunks/{chunk-ULQFHZJE.js.map → chunk-EPAFGT2M.js.map} +2 -2
  18. package/dist/chunks/{chunk-F72MAIQY.js → chunk-EQIGYLVB.js} +34 -1
  19. package/dist/chunks/chunk-EQIGYLVB.js.map +7 -0
  20. package/dist/chunks/{chunk-OUAC6O5C.js → chunk-F676L43O.js} +2 -2
  21. package/dist/chunks/{chunk-YC3QQDZ3.js → chunk-IPHEM6RY.js} +2 -2
  22. package/dist/chunks/{chunk-PMSIZLV6.js → chunk-IUCEIYLV.js} +2 -1
  23. package/dist/chunks/chunk-IUCEIYLV.js.map +7 -0
  24. package/dist/chunks/{chunk-Y57UHPIK.js → chunk-KBHITFTO.js} +1 -1
  25. package/dist/chunks/chunk-KBHITFTO.js.map +7 -0
  26. package/dist/chunks/chunk-QNMMQAZ7.js +162 -0
  27. package/dist/chunks/chunk-QNMMQAZ7.js.map +7 -0
  28. package/dist/chunks/{chunk-2A2NWQ36.js → chunk-WGGUZMQ4.js} +2 -2
  29. package/dist/components/configuration.js +2 -2
  30. package/dist/components/provider-component.d.ts +1 -1
  31. package/dist/components/provider-component.d.ts.map +1 -1
  32. package/dist/config.d.ts +11 -0
  33. package/dist/config.d.ts.map +1 -1
  34. package/dist/core/action-registry.js +2 -2
  35. package/dist/fabric-runtime-state.d.ts.map +1 -1
  36. package/dist/fabric-runtime-state.js +533 -167
  37. package/dist/fabric-runtime-state.js.map +4 -4
  38. package/dist/index.js +5 -5
  39. package/dist/index.js.map +2 -2
  40. package/dist/jev.js +1 -1
  41. package/dist/memory/file-worker.js +1 -1
  42. package/dist/memory/fs-source.d.ts +12 -0
  43. package/dist/memory/fs-source.d.ts.map +1 -0
  44. package/dist/memory/worker-provider.js +2 -2
  45. package/dist/memory.d.ts +2 -0
  46. package/dist/memory.d.ts.map +1 -1
  47. package/dist/memory.js +7 -1
  48. package/dist/memory.js.map +1 -1
  49. package/dist/protocol.d.ts +1 -0
  50. package/dist/protocol.d.ts.map +1 -1
  51. package/dist/protocol.js +1 -1
  52. package/dist/providers/cache-provider.d.ts +16 -0
  53. package/dist/providers/cache-provider.d.ts.map +1 -0
  54. package/dist/providers/jev-provider.js +1 -1
  55. package/dist/providers/memory-provider.js +1 -1
  56. package/dist/residency/host.js +3 -3
  57. package/dist/residency/pi-entry.js +3 -3
  58. package/dist/runtime/core-override-guest-types.js +2 -2
  59. package/dist/runtime/cpython-runtime.js +1 -1
  60. package/dist/runtime/cpython-runtime.js.map +1 -1
  61. package/dist/runtime/guest-types.d.ts +1 -1
  62. package/dist/runtime/guest-types.d.ts.map +1 -1
  63. package/dist/runtime/guest-types.js +1 -1
  64. package/dist/runtime/monty-runtime.js +2 -2
  65. package/dist/runtime/monty-runtime.js.map +2 -2
  66. package/dist/runtime/node-process-runtime.js +2 -2
  67. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  68. package/dist/runtime/quickjs-runtime.js +1 -1
  69. package/dist/runtime/typescript-kernel.js +4 -4
  70. package/dist/runtime-state-builtins.d.ts.map +1 -1
  71. package/dist/schema/policy.d.ts.map +1 -1
  72. package/dist/ui/settings.js +1 -1
  73. package/docs/architecture.md +1 -0
  74. package/docs/components.md +3 -0
  75. package/docs/configuration.md +18 -0
  76. package/docs/memory-recall.md +21 -0
  77. package/docs/prompt-cache.md +91 -0
  78. package/package.json +1 -1
  79. package/skillsets/typescript/fabric-exec/SKILL.md +5 -0
  80. package/dist/chunks/chunk-F72MAIQY.js.map +0 -7
  81. package/dist/chunks/chunk-PMSIZLV6.js.map +0 -7
  82. package/dist/chunks/chunk-Y57UHPIK.js.map +0 -7
  83. /package/dist/chunks/{chunk-3CJETB4S.js.map → chunk-2LBC6TTP.js.map} +0 -0
  84. /package/dist/chunks/{chunk-ZRI433JP.js.map → chunk-4F27LJTS.js.map} +0 -0
  85. /package/dist/chunks/{chunk-QFKHAAZA.js.map → chunk-6K5SRGW6.js.map} +0 -0
  86. /package/dist/chunks/{chunk-EBWMC3OO.js.map → chunk-A4XPJESK.js.map} +0 -0
  87. /package/dist/chunks/{chunk-B2IVWASP.js.map → chunk-CZSX6UG6.js.map} +0 -0
  88. /package/dist/chunks/{chunk-ZTXZ6JDO.js.map → chunk-D5GNTBV6.js.map} +0 -0
  89. /package/dist/chunks/{chunk-OUAC6O5C.js.map → chunk-F676L43O.js.map} +0 -0
  90. /package/dist/chunks/{chunk-YC3QQDZ3.js.map → chunk-IPHEM6RY.js.map} +0 -0
  91. /package/dist/chunks/{chunk-2A2NWQ36.js.map → chunk-WGGUZMQ4.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-state-builtins.d.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,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EACnC,WAAW,CAAC,EAAE,iBAAiB,YAAA;IAG5C,OAAO,CAAC,SAAS,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1D,KAAK,CACT,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,YAAY,EACpB,aAAa,EAAE,mBAAmB,EAClC,KAAK,EAAE;QAAE,IAAI,EAAE,mBAAmB,CAAC;QAAC,SAAS,EAAE,MAAM,MAAM,CAAA;KAAE,GAC5D,OAAO,CAAC,IAAI,CAAC;IAiEV,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BtH,MAAM,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiC/F,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;CAgBzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/schema/policy.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,yBAAyB,GAAI,KAAK,MAAM,KAAG,OAAsC,CAAC"}
1
+ {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/schema/policy.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,yBAAyB,GAAI,KAAK,MAAM,KAAG,OAAsC,CAAC"}
@@ -28,7 +28,7 @@ import {
28
28
  loadFabricConfigForScope,
29
29
  maxExecutorMemoryLimitBytes,
30
30
  saveFabricConfig
31
- } from "../chunks/chunk-F72MAIQY.js";
31
+ } from "../chunks/chunk-EQIGYLVB.js";
32
32
  import "../chunks/chunk-OKOHRXGF.js";
33
33
  import "../chunks/chunk-KAD7UWT2.js";
34
34
  import "../chunks/chunk-A4VP7HDF.js";
@@ -19,6 +19,7 @@ ActionRegistry ◀── staged commit ── ComponentSupervisor
19
19
  ├── schema.*
20
20
  ├── memory.*
21
21
  ├── compact.*
22
+ ├── cache.* local observations + optional native warming leases
22
23
  ├── components.* kernel diagnostics and reload
23
24
  └── external providers
24
25
 
@@ -45,6 +45,7 @@ fabric.provider.mesh
45
45
  fabric.provider.state
46
46
  fabric.provider.schema
47
47
  fabric.provider.compact
48
+ fabric.provider.cache
48
49
  fabric.provider.agents
49
50
  fabric.provider.memory
50
51
  fabric.provider.jev
@@ -251,6 +252,8 @@ Append contributions are ordered by component ID and label, not activation timin
251
252
 
252
253
  ### Prompt-cache and cold-prefill behavior
253
254
 
255
+ [Prompt-cache observations and scoped warming](prompt-cache.md) expose runtime interest separately from the stable prompt projection described here.
256
+
254
257
  With an unchanged host prompt, skill catalog, model, target, Fabric mode, core-override catalog, and committed component projection, Fabric emits a byte-identical system prompt. Slot order is fixed, append entries sort by component ID and label, and no component revision, timestamp, run ID, message ID, or projection hash enters the model-visible text. Fabric appends its stable sections in this order: kernel, resolved slots, Schema notice, core-override guidance, and component appends. Turn-derived skill dependency guidance comes last. A turn that adds such guidance therefore retains the ordinary turn's complete system prompt as its cacheable prefix. Turn-derived guidance stays in a transcript message and does not mutate that system prefix.
255
258
 
256
259
  Participant task text and actor message envelopes remain user content. They are not interpolated into component guidance. Direct runs with the same role prompt, selected model, and committed guidance receive the same Fabric append-system prompt even when their tasks differ. Persistent actors keep a stable actor system prompt across mailbox activations; an actor identity or binding change intentionally creates a different prefix.
@@ -195,6 +195,12 @@ where absent values do not participate. Orchestration programs (`agents.run` / `
195
195
  "actorPollMs": 250,
196
196
  "actorQueueLimit": 32,
197
197
  "eventContextChars": 40000
198
+ },
199
+ "memory": {
200
+ "enabled": true,
201
+ "sources": [
202
+ { "id": "laptop", "kind": "fs", "root": "/home/me/pi-archive" }
203
+ ]
198
204
  }
199
205
  }
200
206
  ```
@@ -538,6 +544,18 @@ call override → session binding → project default → Fabric default
538
544
 
539
545
  Mesh topics, shared state, and the participant directory remain project-scoped. Every runtime publishes one short-lived host lease and records for the roots, agents, and actors it owns. `agents.members()` and `mesh.members()` read those records. `agents.main()` and `agents.peers()` project roots. When a lease expires, its records leave normal discovery together. `mesh.actorPollMs` controls fallback polling for actor events and owner-addressed commands when filesystem notifications are unavailable.
540
546
 
547
+ ## Memory sources
548
+
549
+ `memory.enabled` (default: true) toggles the `memory.*` provider. `memory.sources` registers portable host sources so remote or archived session trees answer source-qualified calls such as `memory.recall({ source: "laptop", ... })`; `memory.sessions` and `memory.expand` accept the same `source` argument. Without `sources`, memory behavior is unchanged: source-less calls keep their filesystem scopes and source-qualified calls fail with `source_not_found`.
550
+
551
+ Each entry has three keys:
552
+
553
+ - `id`: the `args.source` label. Lowercase letters, digits, dot, `_`, or dash; must start with a letter or digit and be unique across entries.
554
+ - `kind`: the adapter kind. Only `"fs"` exists today; anything else is a configuration error at load time.
555
+ - `root`: absolute path the `fs` adapter walks recursively for `*.jsonl` files. Native agent trees (`sessions/<encoded-cwd>/*.jsonl`) and flat archive directories both work; keys are root-relative paths, and traversal outside `root` is refused.
556
+
557
+ The `fs` adapter derives each session's `revision` from the SHA-256 of the file bytes, so mtime-only touches keep follow pointers valid while content changes invalidate them. Enumeration is bounded by `memory.maxSessions` and reported through coverage reasons (`fs_source_max_sessions`, `fs_source_scan_capped`); a capped archive is never presented as complete. Ranking, branches, and expansion follow the normal engine paths described in [memory recall](memory-recall.md#portable-host-sources).
558
+
541
559
  ## Compaction
542
560
 
543
561
  The deterministic, LLM-free compaction engine is on by default. It keeps Pi's bounded `keepRecentTokens` continuity tail. `compaction.targetContextRatio` sets a hard occupancy ceiling. Set `compaction.engine` to `"pi"` to restore pi-core compaction. When pi-vcc is also installed, Fabric takes precedence for automatic compaction. An explicit `/pi-vcc` command always uses pi-vcc's engine. See [compaction](compaction.md) for invariants, loss guarantees, sections, and limits.
@@ -67,6 +67,27 @@ never implicit filesystem discovery. Provider actions accept the same optional
67
67
  `source` argument; omitting it preserves the normal filesystem behavior.
68
68
  Source-qualified follow pointers and guest `memory.walk` retain this binding.
69
69
 
70
+ Hosts that only need a local directory of session JSONL files (a synced
71
+ laptop archive, a copied agent tree) do not have to write an adapter:
72
+ declare it in `fabric.json` and the runtime registers a built-in `fs`
73
+ source before installing the provider.
74
+
75
+ ```json
76
+ {
77
+ "memory": {
78
+ "sources": [{ "id": "laptop", "kind": "fs", "root": "/home/me/pi-archive" }]
79
+ }
80
+ }
81
+ ```
82
+
83
+ The root is walked recursively for `*.jsonl`, so native agent trees and flat
84
+ archive directories both work; session keys are root-relative paths. The
85
+ adapter satisfies the same interface as a hand-written source, including
86
+ content-hash revisions and coverage reporting, so everything below applies
87
+ to it unchanged. Key rules and validation errors are documented in
88
+ [configuration](configuration.md#memory-sources); with no `memory.sources`
89
+ entries the provider behaves exactly as before.
90
+
70
91
  Host records reuse the normal branch, normalization, ranking, structural trace,
71
92
  coverage, and lossless expansion paths. Revision/content hashes and lineage
72
93
  fingerprints reject stale follow pointers. Host shards are rebuilt within
@@ -0,0 +1,91 @@
1
+ # Prompt-cache observations and scoped warming
2
+
3
+ `cache.*` is a local prompt-cache capability, not a key/value store or a cache of tool results. It preserves Fabric's separation of workflow policy, owned effects, and native execution. The lease pattern and honest last-request telemetry are informed by [pi-fabric-pair](https://github.com/asx8678/pi-fabric-pair/tree/3760335515c24b4693a233a25c2e85744466f35d).
4
+
5
+ ## Availability and cost
6
+
7
+ Observations work on ordinary Pi sessions now. Warming requires the optional native `ctx.acquireCacheWarming("idle")` capability, returning an idempotent release function. The inspected stock Pi 0.87.0/0.87.1 SDKs do **not** expose that capability. They return `unsupported`; Fabric never simulates warming with prompts, changes global settings, or sends a replacement provider request.
8
+
9
+ No configuration switch is needed. Fabric acquires no warming interest until an explicit approved `cache.hold` or trusted component `cache.lease` acquisition. Native warming settings, including Pi's ordinary streaming policy, are unchanged. Acquisition has `agent` risk and may authorize paid native refreshes for the duration. Pi retains request snapshots, model eligibility, retention tiers, economic decisions, scheduling, and native safety windows. A lease cannot force a refresh or guarantee a cache hit.
10
+
11
+ ## Guest API
12
+
13
+ ```ts
14
+ const observation = await cache.status();
15
+ return observation;
16
+ ```
17
+
18
+ ```ts
19
+ const lease = await cache.hold({ target: "self", durationMs: 5 * 60_000 });
20
+ if (lease.status !== "held") return lease; // unsupported/unavailable, with a reason
21
+ return { id: lease.id, expiresAt: lease.expiresAt };
22
+ ```
23
+
24
+ A successful hold survives the allocating `fabric_exec`; a later execution can release it:
25
+
26
+ ```ts
27
+ return await cache.release({ id: "the-returned-lease-id" });
28
+ ```
29
+
30
+ Known calls also work in the Python kernels, for example `await cache.status(target="self")`. Generic discovery exposes `cache.status`, `cache.hold`, `cache.release`, and the host-only `cache.lease` action. Public TypeScript contracts are exported from `pi-fabric/protocol`.
31
+
32
+ - `target` defaults to `self`, the **local Pi session**, including inside a child. `main` is an alias available only in a root runtime. Arbitrary participant IDs and cross-process routing are not supported. A child cannot use `main` to control its parent's cache.
33
+ - `durationMs` is required: an integer from 1,000 to 1,800,000. At most 128 Fabric holds can coexist in one provider generation. Deadlines never auto-renew, and refreshes do not extend them.
34
+ - Optional `maxRefreshes` (integer 1–1,000) and `maxCostUsd` (positive, at most 1,000) are fail-closed requests: **the current adapter returns unsupported when either is supplied**. The proposed native lease API has no admission/receipt contract that can enforce them. Do not infer a spending cap from the deadline, usage counters, or Fabric's agent budgets.
35
+ - Releasing an unknown or previously released session hold returns `released: false`. Cleanup errors are explicit. Release cannot undo already-billed refreshes or stop another native owner's interest.
36
+ - Holds end on their deadline, cancellation during allocation, known session/model/branch/compaction boundaries, or provider close. Reload drains retained provider generations rather than instantly revoking their committed views. A successful completed invocation detaches its operation signal; its hold remains session-owned. Abrupt host death ends the in-process native warmer. Holds are never persisted or restored.
37
+ - Warming decisions and subsequent holds fence changed model, thinking, system prompt, and active tool names. Native Pi remains responsible for exact serialized-request validity, including transformations by other extensions. Failed native acquisition is not retried automatically on an unchanged binding.
38
+ - Status is read-only. It neither acquires nor releases interest, returns no prompt text, and makes no inference request. Invalidation is driven by lifecycle hooks, acquisition checks, and the native decision boundary.
39
+
40
+ The cache provider is absent in managed embedded hosts. Schema enforce permits only `cache.status`; acquiring or releasing holds remains blocked. A saved lease ID is not authority to manipulate another provider generation or a component's lease.
41
+
42
+ ## Observations are not residency
43
+
44
+ `cache.status()` returns session/model identity, native lease capability availability, bounded live lease metadata, cleanup diagnostics, and `observation`. `scheduled` is `null`: the scoped lease capability does not expose a trustworthy native schedule. `supported: true` means a native acquisition method exists, not that a model is eligible or any refresh occurred.
45
+
46
+ `observation.lastRequest` and `lastRefresh` are independent samples. Each includes its session entry ID, original `observedAt` timestamp, normalized token counters, reported cost (or `null`), and:
47
+
48
+ ```text
49
+ cacheReadShare = cacheRead / (input + cacheRead + cacheWrite)
50
+ ```
51
+
52
+ The last real assistant request is not replaced by a warming receipt. Zero-input placeholders do not erase a measurable sample or refresh its timestamp. A measured miss is zero; missing/invalid counters are unknown, never synthesized as a zero-percent miss.
53
+
54
+ The reader follows at most 256 parent links on the active branch. It does not scan session files or abandoned branches. Compaction, branch summaries, model/thinking changes, context edits, and system-prompt/tool checkpoints stop the window. `window` discloses its entry count, bound, truncation, and stopping reason. Observation age describes a past request, not the provider's cache TTL.
55
+
56
+ `maintenance` aggregates only native `usage` entries with `kind: "cache_warm"` for the current model in that window. It counts each entry once, reports known tokens/cost, and discloses unknown-token and unknown-cost receipt counts. These are **window totals**, not lifetime totals, spend admission, or per-lease attribution. Other native owners may have caused those refreshes. Fabric does not append duplicate usage entries; Pi's session accounting remains authoritative.
57
+
58
+ ## Host component ownership
59
+
60
+ A component can declare `requires: ["cache.lease"]` and acquire it through its effect scope:
61
+
62
+ ```ts
63
+ const result = await context.acquire<FabricCacheHoldResult>("cache.lease", {
64
+ durationMs: 5 * 60_000,
65
+ });
66
+ ```
67
+
68
+ Import `FabricCacheHoldResult` as a type from `pi-fabric/protocol`. Inspect its discriminant. Unsupported acquisition has a no-op disposer. Successful acquisition registers an idempotent owner-only disposer; guests cannot release it by copying its ID. Multiple Fabric interests share one native lease, and the final release relinquishes only Fabric's interest. Scope cleanup manages ownership, not reversal of incurred inference charges. Cleanup failure remains visible and can quarantine the owning component.
69
+
70
+ ## Boundaries and future work
71
+
72
+ Stable prompt construction already lives in [model-guidance components](components.md#prompt-cache-and-cold-prefill-behavior). Do not inject clocks, task state, or cache diagnostics into the stable prefix.
73
+
74
+ Persistent actor transcripts are not persistent Pi worker processes: current actor activations reuse the session file but close the Pi child after settlement. Idle actor warming needs a separately designed live-runtime retention capability; this change does not keep children alive, alter durable residency, or route cache control across participants.
75
+
76
+ A future native bounded-admission protocol would be needed before enabling refresh-count or cost-limited holds. Live-provider qualification is also separate from deterministic tests against the optional capability contract.
77
+
78
+ ## Acceptance ledger
79
+
80
+ | Contract | Evidence |
81
+ | --- | --- |
82
+ | Measured misses versus unknowns; placeholders retain timestamps; real/maintenance usage separated | `tests/cache-observations.test.ts` |
83
+ | Bounded branch traversal and explicit window coverage | `tests/cache-observations.test.ts` |
84
+ | Shared native ownership, independent release, finite deadlines, no fallback/retry loops | `tests/cache-provider.test.ts` |
85
+ | Session/model/prompt/tool fencing, cancellation, component-only disposal, cleanup failure | `tests/cache-provider.test.ts` |
86
+ | Reserved pinned provider, typed guest execution, reload, native-free unsupported path | `tests/fabric-runtime-components.test.ts` |
87
+ | Managed host exclusion and Schema read-only boundary | `tests/managed-host-runtime.test.ts`, `tests/cache-provider.test.ts` |
88
+ | Node, Monty, and CPython proxy parity | Their targeted runtime suites |
89
+ | Registration/idle stays lazy; compiled artifacts include first-use path | Startup suites, `assert:lazy-graph`, fresh build |
90
+
91
+ No live cache-hit rate, native lease deployment, or strict spend cap is claimed by these checks.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e4779/pi-fabric",
3
- "version": "0.96.4-fork.10",
3
+ "version": "0.97.0-fork.11",
4
4
  "description": "A programmable tool and agent runtime for Pi",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -93,6 +93,9 @@ All calls return promises. Fields ending in `?` are optional; `unknown` marks pr
93
93
  | `compact.request(args?)` | `{requested:true,intent:{reason?,instructions?,preserve?,requestedBy,requestedAt}}` |
94
94
  | `compact.status()` | `{pending?:CompactIntent,last?:{at,requestedBy,status,summary?,tokensBefore?,estimatedTokensAfter?,error?}}` |
95
95
  | `compact.cancel()` | `{cancelled:true}` |
96
+ | `cache.status({target?}?)` | Local session cache observations, live leases, capability/cleanup diagnostics; observations do not prove residency |
97
+ | `cache.hold({target?,durationMs,maxRefreshes?,maxCostUsd?})` | `{status:"held",id,scope,sessionId,model,expiresAt}` or an unsupported/unavailable result with a reason; paid native opt-in, no fallback; cost/count bounds currently unsupported |
98
+ | `cache.release({id})` | `{released,cleanupError}`; session-owned holds only; expiry/cleanup is not a refund |
96
99
  | `jev.evaluate(args)` | `{model,answers,usage:{input_tokens,output_tokens}}`; typed Choice/Noul/Score answers, not generated text |
97
100
  | `jev.run({program,input})` | terminal `FabricJevRun`: `{id,state,result?,error?,evaluations,toolCalls,usage,events,nextSequence,logs,...}` |
98
101
  | `jev.spawn({program,input,observe?})` | `FabricJevRun` initially `running`; session-owned, not restart-durable |
@@ -102,6 +105,8 @@ All calls return promises. Fields ending in `?` are optional; `unknown` marks pr
102
105
  | `jev.advise({id,eventId,message})` | `{delivered,reason?}`; current observed event only; explicit delivery, agent approvals, freshness and feedback gates apply |
103
106
  | `jev.stop({id})` | terminal run envelope after cancellation/cleanup; no rollback of already-issued effects |
104
107
 
108
+ `cache` targets the local Pi session (`self`); `main` is accepted only in root runtimes. Holds require a compatible native scoped-warming API, are bounded to 1–1800 seconds, and never change native settings. Current stock SDKs return unsupported. Never simulate warming with prompts. See [prompt-cache contracts](../../../docs/prompt-cache.md).
109
+
105
110
  `memory.recall` multi-term literal queries default to ranked `queryMatch: "any"` so wording differences do not hide evidence; use `"all"` to require every canonical term in one indexed entry, and `queryMode: "phrase"` when adjacency matters. Results are hard-bounded either way. Structural filters (`ref`, `provider`, `action`, `outcome`) use exact persisted trace fields. Use `tools.catalog()`/`tools.search()` only to choose a current action head—catalog descriptions are navigation metadata and never become session evidence.
106
111
 
107
112
  Recall returns one bounded flat hit stream. Every hit has the same copy-ready `{ref,args}` field: `await tools.call(hit.follow)` expands an entry or resolves a cold session. Continue any result with `await tools.call(result.next)` when `next !== null`; `total` is the retained pre-page hit count. Do not locate or parse Pi session JSONL yourself: follow calls, integrity bindings, and continuations are the supported retrieval API.
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/core/shell-limits.ts", "../../src/config.ts", "../../src/core/damaged-file.ts", "../../src/config-migrations.ts"],
4
- "sourcesContent": ["// 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 { 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 { DEFAULT_FABRIC_THINKING, isFabricThinking, type FabricThinking } 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\";\nexport type FabricAgentRunner = \"pi\" | \"claude\" | \"veda\";\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 /** TypeScript backend only; ignored by the Python kernel. */\n runtime: FabricExecutorRuntime;\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 /** 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 /** 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}\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\nexport interface FabricMcpConfig {\n enabled: boolean;\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}\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 showAgentToolPreview: boolean;\n toolDisplay: FabricToolDisplayMode;\n updateDebounceMs: number;\n}\n\ninterface FabricCompactionConfig {\n engine: FabricCompactionEngine;\n targetContextRatio: number;\n thresholds: Record<string, number>;\n tokenThresholds: Record<string, number>;\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}\n\ninterface FabricRepairsConfig {\n enabled: boolean;\n}\n\ninterface FabricEntropyConfig {\n compile: boolean;\n}\n\nexport interface FabricMemoryConfig {\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}\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 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 ui: FabricUiConfig;\n compaction: FabricCompactionConfig;\n retention: FabricRetentionConfig;\n mesh: FabricMeshConfig;\n memory: FabricMemoryConfig;\n jev: FabricJevConfig;\n entropy: FabricEntropyConfig;\n repairs: FabricRepairsConfig;\n schema: FabricSchemaConfig;\n speculation: FabricSpeculationConfig;\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 runtime: \"quickjs\",\n timeoutMs: 120_000,\n maxTimeoutMs: 900_000,\n hostCallTimeouts: {},\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 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\",\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 },\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 showAgentToolPreview: true,\n toolDisplay: \"compact\",\n updateDebounceMs: 100,\n },\n compaction: {\n engine: \"fabric\",\n targetContextRatio: 0.65,\n thresholds: {},\n tokenThresholds: {},\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 },\n models: {\n aliases: {},\n },\n memory: {\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 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 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 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\nconst runnerValue = (value: unknown, fallback: FabricAgentRunner): FabricAgentRunner =>\n value === \"pi\" || value === \"claude\" || value === \"veda\" ? 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 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\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\nexport const normalizeFabricConfig = (input: Record<string, unknown>): FabricConfig => {\n const executor = objectValue(input.executor);\n const cpython = objectValue(executor.cpython);\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 entropy = objectValue(input.entropy);\n const repairs = objectValue(input.repairs);\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 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 runtime: executorRuntime,\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 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 },\n mcp: {\n enabled: booleanValue(mcp.enabled, DEFAULT_FABRIC_CONFIG.mcp.enabled),\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 },\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 // 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 // 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 },\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 },\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 },\n models: {\n aliases: normalizeModelAliases(modelsSection.aliases),\n },\n memory: {\n enabled: booleanValue(memory.enabled, DEFAULT_FABRIC_CONFIG.memory.enabled),\n ...(memoryIndexDir ? { indexDir: memoryIndexDir } : {}),\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 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 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 return normalizeFabricConfig(merged);\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 // 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": ";;;;;;;;;;;;;;;;;;;;;;;;;;AACO,IAAM,wBAAwB;AAC9B,IAAM,oBAAoB;;;ACFjC,OAAOA,SAAQ;AAIf,OAAO,QAAQ;AACf,OAAOC,WAAU;;;ACLjB,OAAO,QAAQ;AACf,OAAO,UAAU;AAMV,IAAM,wBAAwB,CAAC,aAAyC;AAC7E,QAAM,cAAc,KAAK;AAAA,IACvB,KAAK,QAAQ,QAAQ;AAAA,IACrB,GAAG,KAAK,SAAS,QAAQ,CAA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