@e4779/pi-fabric 0.92.17-fork.3 → 0.92.24-fork.4

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 (144) hide show
  1. package/dist/agents/budget-ledger.d.ts.map +1 -1
  2. package/dist/agents/handoff-continuation.d.ts +4 -0
  3. package/dist/agents/handoff-continuation.d.ts.map +1 -0
  4. package/dist/agents/manager.d.ts.map +1 -1
  5. package/dist/agents.js +3 -3
  6. package/dist/chunks/{chunk-GXNR6NRU.js → chunk-2IAVP4O2.js} +2 -2
  7. package/dist/chunks/{chunk-2UQV52II.js → chunk-3CPWRPCE.js} +6 -6
  8. package/dist/chunks/{chunk-YK5AZ7CZ.js → chunk-3ZX76BVU.js} +3 -3
  9. package/dist/chunks/{chunk-PH7ZJ27F.js → chunk-7OH6DD3S.js} +210 -118
  10. package/dist/chunks/chunk-7OH6DD3S.js.map +7 -0
  11. package/dist/chunks/chunk-EDL4JDW7.js +184 -0
  12. package/dist/chunks/chunk-EDL4JDW7.js.map +7 -0
  13. package/dist/chunks/{chunk-RNOPHITP.js → chunk-H6DDV6E2.js} +180 -24
  14. package/dist/chunks/chunk-H6DDV6E2.js.map +7 -0
  15. package/dist/chunks/{chunk-ARLYAW2A.js → chunk-IR3PIHJM.js} +2 -1
  16. package/dist/chunks/chunk-IR3PIHJM.js.map +7 -0
  17. package/dist/chunks/{chunk-VRZNFNPB.js → chunk-IYQ5MNCW.js} +20 -17
  18. package/dist/chunks/chunk-IYQ5MNCW.js.map +7 -0
  19. package/dist/chunks/{chunk-CPSW2GW4.js → chunk-KFZYTGF5.js} +5 -5
  20. package/dist/chunks/{chunk-U6CTHPZC.js → chunk-MQG5QKGI.js} +2 -2
  21. package/dist/chunks/{chunk-CI56CW53.js → chunk-NPHCGLGH.js} +16 -10
  22. package/dist/chunks/chunk-NPHCGLGH.js.map +7 -0
  23. package/dist/chunks/{chunk-2DMJ7MEI.js → chunk-QX3TUAWO.js} +172 -141
  24. package/dist/chunks/chunk-QX3TUAWO.js.map +7 -0
  25. package/dist/chunks/chunk-RAO6TQFP.js +187 -0
  26. package/dist/chunks/chunk-RAO6TQFP.js.map +7 -0
  27. package/dist/chunks/{chunk-ZZ4LHQYJ.js → chunk-RTXZHKMS.js} +22 -13
  28. package/dist/chunks/chunk-RTXZHKMS.js.map +7 -0
  29. package/dist/chunks/{chunk-656HWVFU.js → chunk-SZUXWOO7.js} +5 -3
  30. package/dist/chunks/chunk-SZUXWOO7.js.map +7 -0
  31. package/dist/chunks/{chunk-UDFDF7IY.js → chunk-VWSXAEX6.js} +143 -54
  32. package/dist/chunks/chunk-VWSXAEX6.js.map +7 -0
  33. package/dist/chunks/{chunk-TPLMVELH.js → chunk-VYXFSUWU.js} +4 -4
  34. package/dist/chunks/{chunk-UTR3I23Z.js → chunk-W63E3WEO.js} +2 -2
  35. package/dist/chunks/{chunk-3MEHEH6B.js → chunk-X3OD47CL.js} +12 -2
  36. package/dist/chunks/chunk-X3OD47CL.js.map +7 -0
  37. package/dist/chunks/{chunk-OP2KTYQB.js → chunk-ZMIJ6AT4.js} +4 -4
  38. package/dist/compaction/hook.js +2 -2
  39. package/dist/config.d.ts.map +1 -1
  40. package/dist/core/action-registry.js +2 -2
  41. package/dist/core/auto-approval-classifier.d.ts.map +1 -1
  42. package/dist/core/shell-jobs.d.ts +7 -1
  43. package/dist/core/shell-jobs.d.ts.map +1 -1
  44. package/dist/entropy/compiler.d.ts +8 -0
  45. package/dist/entropy/compiler.d.ts.map +1 -1
  46. package/dist/entropy/index.js +9 -1
  47. package/dist/entropy/meter.d.ts +10 -0
  48. package/dist/entropy/meter.d.ts.map +1 -1
  49. package/dist/entropy/pool.d.ts +5 -0
  50. package/dist/entropy/pool.d.ts.map +1 -1
  51. package/dist/entropy/sessions.d.ts +12 -1
  52. package/dist/entropy/sessions.d.ts.map +1 -1
  53. package/dist/fabric-runtime-state.js +30 -22
  54. package/dist/fabric-runtime-state.js.map +2 -2
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +70 -38
  57. package/dist/index.js.map +3 -3
  58. package/dist/jev/browser.js +2 -2
  59. package/dist/jev/config.d.ts +2 -0
  60. package/dist/jev/config.d.ts.map +1 -1
  61. package/dist/jev/model-key.d.ts +6 -0
  62. package/dist/jev/model-key.d.ts.map +1 -0
  63. package/dist/jev/observation.js +2 -2
  64. package/dist/jev.js +7 -7
  65. package/dist/memory/file-worker.d.ts +15 -0
  66. package/dist/memory/file-worker.d.ts.map +1 -0
  67. package/dist/memory/file-worker.js +44 -0
  68. package/dist/memory/file-worker.js.map +7 -0
  69. package/dist/memory/worker-provider.d.ts +24 -0
  70. package/dist/memory/worker-provider.d.ts.map +1 -0
  71. package/dist/memory/worker-provider.js +18 -0
  72. package/dist/memory/worker-provider.js.map +7 -0
  73. package/dist/output-budget.d.ts.map +1 -1
  74. package/dist/prewalk/arm.d.ts.map +1 -1
  75. package/dist/prewalk/handoff.d.ts.map +1 -1
  76. package/dist/providers/jev-provider.js +6 -6
  77. package/dist/residency/host.js +9 -8
  78. package/dist/residency/pi-entry.js +9 -8
  79. package/dist/residency/pi-entry.js.map +1 -1
  80. package/dist/runtime/monty-runtime.js +3 -2
  81. package/dist/runtime/monty-runtime.js.map +1 -1
  82. package/dist/runtime/typescript-kernel.js +6 -6
  83. package/dist/runtime-state-builtins.d.ts.map +1 -1
  84. package/dist/speculation/stream-tap.d.ts.map +1 -1
  85. package/dist/storage/retention.d.ts +3 -1
  86. package/dist/storage/retention.d.ts.map +1 -1
  87. package/dist/storage/scratch.d.ts +33 -0
  88. package/dist/storage/scratch.d.ts.map +1 -0
  89. package/dist/ui/code-preview-shell.d.ts.map +1 -1
  90. package/dist/ui/conversation-chrome.js +2 -2
  91. package/dist/ui/conversation-native-reader.js +4 -2
  92. package/dist/ui/conversation-native-reader.js.map +2 -2
  93. package/dist/ui/conversation.js +3 -3
  94. package/dist/ui/dashboard-presentation.d.ts.map +1 -1
  95. package/dist/ui/dashboard.js +13 -9
  96. package/dist/ui/dashboard.js.map +2 -2
  97. package/dist/ui/fabric-code-parser.d.ts.map +1 -1
  98. package/dist/ui/format.d.ts +1 -0
  99. package/dist/ui/format.d.ts.map +1 -1
  100. package/dist/ui/highlight.d.ts.map +1 -1
  101. package/dist/ui/settings-rpc.d.ts.map +1 -1
  102. package/dist/ui/settings-sections-execution.d.ts.map +1 -1
  103. package/dist/ui/settings-submenus.d.ts +12 -4
  104. package/dist/ui/settings-submenus.d.ts.map +1 -1
  105. package/dist/ui/settings.js +78 -31
  106. package/dist/ui/settings.js.map +2 -2
  107. package/dist/ui/shiki-catalog.d.ts +3 -0
  108. package/dist/ui/shiki-catalog.d.ts.map +1 -0
  109. package/dist/ui/structured.d.ts.map +1 -1
  110. package/dist/ui/tool-call-timing.d.ts.map +1 -1
  111. package/dist/ui/widget.d.ts.map +1 -1
  112. package/dist/worker/model-control.d.ts.map +1 -1
  113. package/dist/worker/model-control.js +0 -1
  114. package/dist/worker/model-control.js.map +2 -2
  115. package/dist/worker.js +3 -9
  116. package/dist/worker.js.map +2 -2
  117. package/docs/agents.md +7 -3
  118. package/docs/configuration.md +19 -7
  119. package/docs/entropy.md +17 -1
  120. package/docs/jev.md +2 -2
  121. package/docs/memory-recall.md +21 -0
  122. package/package.json +5 -2
  123. package/skillsets/python/fabric-exec/references/agents.md +2 -0
  124. package/skillsets/python/fabric-jev/SKILL.md +1 -1
  125. package/skillsets/typescript/fabric-exec/references/agents.md +2 -0
  126. package/skillsets/typescript/fabric-jev/SKILL.md +1 -1
  127. package/dist/chunks/chunk-2DMJ7MEI.js.map +0 -7
  128. package/dist/chunks/chunk-3MEHEH6B.js.map +0 -7
  129. package/dist/chunks/chunk-656HWVFU.js.map +0 -7
  130. package/dist/chunks/chunk-ARLYAW2A.js.map +0 -7
  131. package/dist/chunks/chunk-CI56CW53.js.map +0 -7
  132. package/dist/chunks/chunk-PH7ZJ27F.js.map +0 -7
  133. package/dist/chunks/chunk-RNOPHITP.js.map +0 -7
  134. package/dist/chunks/chunk-UDFDF7IY.js.map +0 -7
  135. package/dist/chunks/chunk-VRZNFNPB.js.map +0 -7
  136. package/dist/chunks/chunk-ZZ4LHQYJ.js.map +0 -7
  137. /package/dist/chunks/{chunk-GXNR6NRU.js.map → chunk-2IAVP4O2.js.map} +0 -0
  138. /package/dist/chunks/{chunk-2UQV52II.js.map → chunk-3CPWRPCE.js.map} +0 -0
  139. /package/dist/chunks/{chunk-YK5AZ7CZ.js.map → chunk-3ZX76BVU.js.map} +0 -0
  140. /package/dist/chunks/{chunk-CPSW2GW4.js.map → chunk-KFZYTGF5.js.map} +0 -0
  141. /package/dist/chunks/{chunk-U6CTHPZC.js.map → chunk-MQG5QKGI.js.map} +0 -0
  142. /package/dist/chunks/{chunk-TPLMVELH.js.map → chunk-VYXFSUWU.js.map} +0 -0
  143. /package/dist/chunks/{chunk-UTR3I23Z.js.map → chunk-W63E3WEO.js.map} +0 -0
  144. /package/dist/chunks/{chunk-OP2KTYQB.js.map → chunk-ZMIJ6AT4.js.map} +0 -0
package/docs/agents.md CHANGED
@@ -30,9 +30,9 @@ You can give `fabric_exec` optional `agentBudget` and `tokenBudget` limits. Conf
30
30
 
31
31
  For Pi workers, Fabric reapplies the resolved `provider/model` over RPC **after startup extensions finish**, reapplies the requested thinking level, and independently reads `get_state` before sending the task. A successful `set_model` response alone is insufficient: it can echo the requested model even when an extension switches away during `model_select`. Thinking is reported at Pi's effective, capability-clamped level.
32
32
 
33
- Startup waits for a correlated RPC readiness response and is bounded by the run's `timeoutMs`. The 15-second model-admission deadline starts only after Pi accepts RPC commands, so slow extension/provider initialization (including multiprovider pool reconciliation) does not consume it. The overall run deadline still applies throughout.
33
+ Startup waits for a correlated RPC readiness response. Startup, model admission, and task execution share the run's configured `timeoutMs`; there is no separate 15-second admission cap. RPC readiness does not guarantee a fast `set_model`: authentication checks and async `model_select` hooks can still wait on provider initialization or shared resources during concurrent launches. A slow handshake may use the remaining run budget, but it never resets or extends the overall deadline.
34
34
 
35
- Unavailable models, rejected/malformed RPC responses, admission timeouts, or a remaining model mismatch fail the run without sending its task. Queued controls wait for admission too. Fabric does not substitute an MRU model or silently fall back. Standalone `AgentManager` callers can also supply a unique exact bare model ID; ambiguous IDs must be provider-qualified.
35
+ Unavailable models, rejected/malformed RPC responses, or a remaining model mismatch fail the run without sending its task. A startup or admission stall exhausts the overall deadline with `timed_out`, also without sending the task. Queued controls wait for admission too. Fabric does not substitute an MRU model or silently fall back. Standalone `AgentManager` callers can also supply a unique exact bare model ID; ambiguous IDs must be provider-qualified.
36
36
 
37
37
  `requestedModel` preserves launch intent in run records; `model` follows verified child state and actual assistant attribution. The manager and participant UI preserve that observed value; the launch label cannot overwrite it. If assistant attribution drifts after admission, Fabric terminates the child and reports both requested and observed models in the failure. This verifies Pi's local provider/model identity, not a remote provider's internal routing.
38
38
 
@@ -157,6 +157,10 @@ In the guest, `agents.handoff()` resolves to `{ scheduled: true, status: "deferr
157
157
 
158
158
  After an explicit handoff settles, Fabric queues one visible `pi-fabric-handoff-complete` custom message as a follow-up and wakes Main. The TUI shows the executor name, model, status, and a bounded conclusion. Main summarizes the outcome and reported checks, preserving links and other concrete identifiers without redoing the delegated work. Failed, stopped, and timed-out handoffs (including launch errors) instead prompt Main to explain what happened and propose a next step without retrying or taking over unprompted. Internal continuation instructions are included in model context but omitted by the message renderer. Prewalk keeps its existing verification continuation.
159
159
 
160
+ **Executor-local failure continuation.** If a running trajectory executor encounters a failed nested handoff (including a launch or depth-limit error), Fabric queues one hidden `pi-fabric-handoff-continuation` follow-up in that same executor. It tells the executor what failed and to finish its original assignment directly in the existing workspace, preserving completed work and running verification instead of returning only a handoff-failed report. It must not retry the handoff, spawn a replacement executor, or raise limits. Fabric cancels any local Prewalk arm so the next write cannot delegate again. The failed boundary remains failed; this is not a retry or a claim that the work succeeded.
161
+
162
+ This fallback is available once per executor run, with a persisted receipt that survives reload and worker recovery. Main, ordinary children, and actors keep their existing completion policy. Explicit stops, cancelled callers, timeouts, and token-limit termination do not trigger the fallback; the executor's original deadline, permissions, and token accounting remain in force. A genuinely blocked executor reports its blocker honestly. Fabric does not classify free-form final answers as failures or relaunch an agent merely because its answer contains failure text.
163
+
160
164
  **Trajectory compaction.** Set `compact` to give the executor a compacted transcript in place of the full raw branch. A value of `true` applies the default summary. Use `{ instructions?, preserve? }` to add compaction instructions of up to 8K characters and as many as 16 explicit preserve facts of up to 2K characters each. These limits match `compact.request`. Fabric writes the child session with a deterministic Fabric compaction entry before the boundary result. The executor context starts with the projected summary. It then contains the retained tail from the calculated cut point and the outer `fabric_exec` result. The append-only child file keeps the complete raw branch below the compaction marker. Fabric records the outcome under `compaction` in the child's `pi-fabric-handoff` custom entry. The outcome contains `applied`, sections, tokens, and cut point. If Fabric skips compaction, it gives the skip reason. Omit `compact` to keep the fork verbatim.
161
165
 
162
166
  ### Automatic Fabric-boundary prewalk
@@ -172,7 +176,7 @@ After an explicit handoff settles, Fabric queues one visible `pi-fabric-handoff-
172
176
  /fabric prewalk --enable
173
177
  ```
174
178
 
175
- When you supply a task, Fabric arms prewalk and immediately submits the task to Main. Without a task, it captures the next user input. Select the executor in `/fabric settings` under **Prewalk**. **Always re-arm** uses `prewalk.model` to arm prewalk automatically at each session start without interaction. It also arms prewalk after each completed handoff. `/fabric prewalk --off` cancels only the current session arm. `/fabric prewalk --disable` persists the master switch to the project config when trusted (global config otherwise), cancels any live arm, and keeps prewalk inert after restart; `--enable` reverses it.
179
+ When you supply a task, Fabric arms prewalk and immediately submits the task to Main. Without a task, it captures the next user input. Select the executor in `/fabric settings` under **Prewalk**. **Always re-arm** uses `prewalk.model` to arm prewalk automatically at each Main session start without interaction. It also arms prewalk after each completed handoff. Child agents and actors do not auto-arm from inherited settings, so trajectory executors finish their assigned work instead of handing it off again on their first write. Explicit arming remains available. `/fabric prewalk --off` cancels only the current session arm. `/fabric prewalk --disable` persists the master switch to the project config when trusted (global config otherwise), cancels any live arm, and keeps prewalk inert after restart; `--enable` reverses it.
176
180
 
177
181
  Host extensions that must serialize work after prewalk can use the acknowledged protocol exported from `pi-fabric/protocol`. Emit `FABRIC_PREWALK_REQUEST_EVENT` with `{ version: 1, context, claim, respond }`. Fabric calls `claim()` synchronously; the first claimant owns the request. It calls `respond({ ok: true })` only after prewalk is armed, or `respond({ ok: false, error })` after cancellation or failure. A request that is not claimed means no compatible Fabric runtime is installed. The protocol intentionally arms without submitting a task, so the caller can deliver its next queued row only after the acknowledgment.
178
182
 
@@ -239,7 +239,7 @@ Unknown definitions stay visible as waiting. They do not fail the Fabric runtime
239
239
 
240
240
  `prewalk.thinking` sets the optional reasoning effort for the trajectory child executor. Its values are `off` / `minimal` / `low` / `medium` / `high` / `xhigh` / `max`, clamped to each model's supported levels. When you leave it unset, the executor inherits `agents.thinking`. In-place mode keeps Main's session level.
241
241
 
242
- `prewalk.alwaysRearm` defaults to `false`. When enabled, prewalk returns to an armed, taskless state after each completed handoff (in-place return or trajectory completion). Every session then starts armed automatically, non-interactively from `prewalk.model`, and `/fabric reload` re-arms as well. `/fabric prewalk --off` cancels the armed state until the next session start or reload. Turns that settle without a handoff never disarm prewalk, regardless of this setting. The settings UI labels an unset model **Ask each time**. Non-interactive sessions must configure a model. In-place mode does not require child agents. Trajectory mode requires `agents.enabled`. It shows child spawn, progress, nested tools, metrics, and completion in Main's Fabric activity UI.
242
+ `prewalk.alwaysRearm` defaults to `false`. When enabled, prewalk returns to an armed, taskless state after each completed handoff (in-place return or trajectory completion). Every Main session then starts armed automatically, non-interactively from `prewalk.model`, and `/fabric reload` re-arms Main as well. Child agents and actors never auto-arm from inherited settings; explicit arming is unaffected. `/fabric prewalk --off` cancels the armed state until the next session start or reload. Turns that settle without a handoff never disarm prewalk, regardless of this setting. The settings UI labels an unset model **Ask each time**. Non-interactive sessions must configure a model. In-place mode does not require child agents. Trajectory mode requires `agents.enabled`. It shows child spawn, progress, nested tools, metrics, and completion in Main's Fabric activity UI.
243
243
 
244
244
  `prewalk.detectShellWrites` defaults to `true`. When armed, a `fabric_exec` boundary that ran a successful `pi.bash` or `pi.powershell` without an audited `pi.edit` / `pi.write` / `schema.commit` claims the handoff if file size or mtime stats drifted from the arm-time baseline. This routes shell heredocs and formatter binaries to the executor as well. The report's `trigger.files` lists the bounded drifted paths. Set it to `false` to accept audited mutations only.
245
245
 
@@ -392,7 +392,7 @@ Select **Jev (TypeSafe safety classifier)** in **Approvals → Auto model** afte
392
392
  ```json
393
393
  {
394
394
  "approvals": {
395
- "model": "jev/jev-latest",
395
+ "model": "pi-fabric/typesafe/jev-latest",
396
396
  "write": "auto",
397
397
  "execute": "auto",
398
398
  "network": "auto",
@@ -401,9 +401,11 @@ Select **Jev (TypeSafe safety classifier)** in **Approvals → Auto model** afte
401
401
  }
402
402
  ```
403
403
 
404
- Jev is an auth-only provider, not a chat model. This picker adds the configured `jev.model` only to the approvals list; `jev/<model-id>` also supports a pinned model ID. **Inherit** still means the active Pi chat model, never Jev. Selecting Jev for approvals is independent of `jev.enabled`, which controls Fabric's Jev tool provider.
404
+ Jev is an auth-only provider, not a chat model. This picker offers `pi-fabric/typesafe/jev-latest` and `pi-fabric/typesafe/jev-1.13` only in the approvals list, plus the configured `jev.model` if different. Legacy `jev/<model-id>` overrides normalize to `pi-fabric/typesafe/<model-id>` when loaded. `/login jev` credentials and raw TypeSafe request IDs (`jev-latest`, `jev-1.13`) are unchanged. **Inherit** still means the active Pi chat model, never Jev. Selecting Jev for approvals is independent of `jev.enabled`, which controls Fabric's Jev tool provider.
405
405
 
406
- The host asks one typed Noul question about whether the exact action is routine, reversible, task-aligned, and safe to run without human approval. It auto-allows only when the returned probability is **at least 0.99**. All other probabilities escalate, including benign actions when Jev is not sufficiently certain. Reasons report the numeric judgment and threshold, not generated explanations. This is a conservative policy cutoff, **not a calibrated 99% security guarantee**. Use `ask` or `deny` when a probabilistic advisor is inappropriate.
406
+ The host asks one typed Noul question about whether the exact action is routine, reversible, task-aligned, and safe to run without human approval. It auto-allows when the returned probability is **at least `jev.autoApprovalThreshold` (default 0.50)**. Selecting a Jev model reveals **Approvals → Jev minimum probability**, an editable number from 0 to 1 in both terminal and RPC settings. The setting persists in the selected global/project scope, remains saved when switching models, and applies only to Jev classification. For example, `"jev": { "autoApprovalThreshold": 0.95 }` requires a probability of at least 0.95. Missing, non-numeric, non-finite, or out-of-range configuration values use the 0.50 default; valid decimals and zero are preserved. Upgrading from the former fixed 0.99 cutoff uses 0.50 unless you explicitly configure another value.
407
+
408
+ Lower thresholds permit more actions; **0 allows every valid judgment**, while 1 requires a probability of 1. Scores below the threshold require explicit approval. Missing evidence and errors still escalate regardless of threshold. Reasons report the numeric judgment and effective threshold, not generated explanations. This is a policy cutoff, **not a calibrated security guarantee**. Use `ask` or `deny` when a probabilistic advisor is inappropriate.
407
409
 
408
410
  Jev receives the exact bounded arguments plus the **latest user message and subsequent assistant tool calls**. Earlier turns, assistant prose, thinking, images, and tool outputs are excluded. Vague follow-ups cannot borrow authority from omitted history. Missing user text, non-serializable arguments, or truncation of this evidence require explicit approval without inference (16,000 argument characters, 6,000 per user message/tool-call batch, 24,000 total evidence characters). Starting a new explicit user turn resets this evidence window.
409
411
 
@@ -415,11 +417,21 @@ Authentication uses `/login jev`, `TYPESAFE_API_KEY`, then trusted `jev.credenti
415
417
 
416
418
  Fabric clears inactive run artifacts by age. It never truncates active JSONL files. The defaults are:
417
419
 
418
- - `retention.orphanedTempRunMs`: remove a temporary run root six hours after its owner process dies. Active roots carry a heartbeat marker and are never removed.
419
- - `retention.oneShotRunMs`: retain terminal one-shot agent run artifacts for 24 hours. An explicit `agents.cleanup()` may remove them sooner. On every other path, graceful shutdown marks their temporary root closed for temporal cleanup.
420
+ - `retention.orphanedTempRunMs`: reclaim a managed temporary run root six hours after a sweep **first notices** its owner is dead, provided its contents and descendant liveness can be verified. Live owners/descendants are preserved. Closed, shutdown-confirmed incomplete runs use the same grace from close.
421
+ - `retention.oneShotRunMs`: retain terminal one-shot agent run artifacts for 24 hours. An explicit `agents.cleanup()` may remove them sooner. Graceful shutdown with `agents.retainRuns: true` marks managed roots closed; empty roots are removed immediately. `retainRuns: false` requests deletion after child transports stop, including for managed temporary roots.
420
422
  - `retention.actorRunArchiveMs`: retain terminal actor run archives for seven days. Fabric always preserves the latest run for each actor.
421
423
 
422
- Cleanup runs during active Fabric sessions and when a new top-level run manager starts. It never truncates active run logs or actor `session.jsonl` files. `/fabric settings` exposes all three values under **Retention**. Changing them requires `/fabric reload`.
424
+ Run housekeeping begins on actual agent storage use (not manager startup), continues during use, and runs best-effort on close. It never applies cache pressure to agent runs or truncates their JSONL/actor `session.jsonl` files. Caller-owned run roots retain their existing explicit-cleanup semantics. Symlink roots/markers, wrong-uid files, malformed ownership, unknown contents, and unverifiable incomplete descendants are preserved. `/fabric settings` exposes all three values under **Retention**. Changing them requires `/fabric reload`.
425
+
426
+ ### Temporary output and reader scratch
427
+
428
+ New model-output spills and shell logs use private directories with a versioned `.fabric-scratch.json` ownership marker. They expire 24 hours after completion; oldest eligible caches may be removed sooner above **128 MiB or 256 items**, pooled across these two classes. Completed output is protected for its first hour. These aggregate limits are **soft** while files are active/recent or cannot be safely attributed. Model-output artifacts remain complete (not truncated), but their links are temporary.
429
+
430
+ Shell hang tracking keeps a **1 MiB RAM tail per running command**, then releases it on finish. Completed handles are capped at **256** and expire after 24 hours on subsequent store access. Each shell log is capped at **8 MiB including notices**; it starts with the retained pre-spill tail, not necessarily the command's beginning. The returned notice and log header explicitly say this is bounded, **not a full-output archive**; reaching the disk cap appends a truncation notice. Further output continues to the normal shell consumer but not the log. PID files are retired on finish; logs remain subject to the cache policy. A disk write error also stops logging without interrupting command execution; bounded logs never promise completeness.
431
+
432
+ Reader checkpoints are lossless live state: they are **never pressure-evicted**. Dispose/finalization removes them normally. New marked scratch left by a killed host can be recovered only six hours after housekeeping first observes a dead owner; shell scratch additionally preserves a live recorded child PID. PID reuse and permission uncertainty preserve data. Sweeps are asynchronous, coalesced and throttled to once per minute on actual scratch allocation/close, with no idle startup scan. Nothing expires until a later storage use triggers housekeeping. Directory identity, file metadata and owner/child liveness are rechecked before removal; hardlinked files are excluded. `sweepScratch({ tempRoot, dryRun: true })` reports `eligible` and first-observed `orphaned` directories without deleting or updating markers.
433
+
434
+ **Conservative recovery limits:** legacy unmarked output/shell/checkpoint artifacts are not automatically deleted. Shared recursion budget ledgers lack descendant ownership leases, and temporary actor roots may contain shared/adopted work; crash orphans of those two classes are deliberately left alone, not deleted merely because a parent PID is dead or old. Normal owned-budget/ephemeral-actor close cleanup remains in place (budget initialization failures now remove their partial allocation). Persistent/caller-owned actor roots are not cache sweep targets. Unverifiable legacy incomplete runs, unknown files, malformed markers, and symlinks likewise require an operator's ownership/liveness review; do not use a broad prefix deletion.
423
435
 
424
436
  ## Agents
425
437
 
package/docs/entropy.md CHANGED
@@ -58,7 +58,23 @@ rate across a selected window, not a guaranteed downward ratchet.
58
58
  - Catalog repair rows are separate compatibility mappings and diagnostic input;
59
59
  they do not authorize schema restrictions.
60
60
 
61
- Session scans reuse bounded evidence caches and appended-file cursors. The
61
+ Session scans reuse bounded evidence caches and appended-file cursors.
62
+ Background compilation also caches per-session trace aggregates and observation
63
+ summaries: unchanged snapshots do not reprocess old operations, appends only
64
+ accumulate new evidence, and replacement/truncation rebuilds the affected cache.
65
+ Schema-derived plans are cached by the declared surface digest; schema and repair
66
+ changes still update the report. These caches are session-owned, retain at most
67
+ 16 windows, and are discarded on session start/shutdown. Cached snapshot inputs
68
+ must not be mutated by callers.
69
+
70
+ Background machine-wide discovery runs at most once per 30 seconds, with the
71
+ active session file included on every compile. Selected files are still checked
72
+ for changes each time. Explicit `/fabric entropy` inspection remains immediately
73
+ fresh. Advisory enum/overload/sequence analysis runs only on the inspection path,
74
+ not in background compilation. No normalizations or historical outcomes change.
75
+ `bun run benchmark:turn-cpu` compares cached/uncached source paths using synthetic
76
+ evidence and reports process CPU separately from wall time.
77
+ The
62
78
  machine-wide value observation pool retains per-session deltas and per-value
63
79
  multiplicity, avoiding inflation when unchanged sessions are reread. Pooling is
64
80
  **advisory only**: observations never authorize capability loss or new semantic
package/docs/jev.md CHANGED
@@ -30,9 +30,9 @@ The command uses argv, not a shell. It runs only when inference needs a key, wit
30
30
 
31
31
  ## Auto-mode tool safety
32
32
 
33
- Jev can also serve as the host's auto-approval classifier, independently of programs and observers. Choose **Approvals → Auto model → Jev (TypeSafe safety classifier)** in `/fabric settings`, or set `approvals.model` to `"jev/jev-latest"` and the relevant risk policies to `"auto"`. Authenticate with `/login jev`, `TYPESAFE_API_KEY`, or the trusted credential command above.
33
+ Jev can also serve as the host's auto-approval classifier, independently of programs and observers. Choose **Approvals → Auto model → Jev (TypeSafe safety classifier)** in `/fabric settings`, or set `approvals.model` to `"pi-fabric/typesafe/jev-latest"` (or pin `"pi-fabric/typesafe/jev-1.13"`) and the relevant risk policies to `"auto"`. Authenticate with `/login jev`, `TYPESAFE_API_KEY`, or the trusted credential command above.
34
34
 
35
- The host uses a typed Noul safety judgment, not generated text or a chat-model adapter. Only probabilities >= 0.99 auto-allow; uncertainty and errors require explicit approval. This is a probabilistic advisor, not a hard security boundary or a 99% correctness guarantee. Read [auto approval configuration](configuration.md#jev-as-the-auto-mode-classifier) for the bounded current-turn evidence, outbound data disclosure, credential behavior, timeout and usage rules. Jev remains absent from ordinary chat-model pickers.
35
+ The host uses a typed Noul safety judgment, not generated text or a chat-model adapter. Probabilities at or above `jev.autoApprovalThreshold` auto-allow (default **0.50**); lower scores and errors require explicit approval. When a Jev model is selected, **Approvals → Jev minimum probability** lets you enter any finite value from 0 to 1. Higher values are more conservative; 0 allows every valid judgment. This is a probabilistic advisor, not a hard security boundary or a correctness guarantee. Read [auto approval configuration](configuration.md#jev-as-the-auto-mode-classifier) for the bounded current-turn evidence, outbound data disclosure, credential behavior, timeout and usage rules. Jev remains absent from ordinary chat-model pickers.
36
36
 
37
37
  ## Direct judgments
38
38
 
@@ -287,6 +287,27 @@ regex result never counts as an authoritative no-match.
287
287
 
288
288
  ## Tiers, refresh, and work budgets
289
289
 
290
+ Pi's built-in filesystem memory provider runs recall, expansion, and session
291
+ listing in one lazy worker thread. Discovery, source hashing, JSON parsing,
292
+ cache maintenance, and ranking do not run on Pi's input/render thread. A
293
+ burst of calls shares a FIFO queue (at most 64 outstanding requests), rather
294
+ than spawning a CPU-heavy worker for every recall. Aborting an active call
295
+ terminates its worker; queued calls can be cancelled independently. Idle
296
+ workers are unreferenced and released after 30 seconds, and provider teardown
297
+ terminates outstanding work. A missing worker artifact is an error, not a
298
+ silent fallback to blocking execution.
299
+
300
+ Live-session branch snapshots carry entry IDs only, are taken when each
301
+ queued request starts, and are checked again before returning its result.
302
+ Navigation during retrieval rejects the request instead of returning evidence
303
+ from a different live branch. Registered host-backed adapters remain in their
304
+ authorized owning host and keep their existing cancellation contracts.
305
+
306
+ `bun run benchmark:memory-recall` exercises a burst of 13 cold-session recalls
307
+ and reports both retrieval time and host event-loop heartbeat gaps. Pass
308
+ `--inline` directly to `node scripts/benchmark-memory-recall.mjs` to compare
309
+ with the synchronous engine used internally by the worker.
310
+
290
311
  The `memory.hotSessions` most recently modified sessions stay hot. Every
291
312
  older session is cold. Once a session crosses the boundary, Fabric drops
292
313
  the old derived tier record after building the replacement. Explicit
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e4779/pi-fabric",
3
- "version": "0.92.17-fork.3",
3
+ "version": "0.92.24-fork.4",
4
4
  "description": "A programmable tool and agent runtime for Pi",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -46,15 +46,18 @@
46
46
  "test:jev:dist": "node scripts/smoke-jev.mjs",
47
47
  "test:changed": "node scripts/test-affected.mjs",
48
48
  "test:affected": "node scripts/test-affected.mjs --base $PI_TEST_BASE",
49
- "test:smoke": "vitest run tests/script-runtime.test.ts tests/pi-binary.test.ts tests/host-compatibility.test.ts tests/output-budget.test.ts tests/actor-mesh-monitor.test.ts tests/handoff.test.ts tests/config-migrations.test.ts tests/monty-payload-preflight.test.ts tests/bundled-binary-spawn.test.ts tests/conversation-native-reader-suspension.test.ts",
49
+ "test:smoke": "vitest run tests/optional-preview-startup.test.ts tests/script-runtime.test.ts tests/pi-binary.test.ts tests/host-compatibility.test.ts tests/output-budget.test.ts tests/actor-mesh-monitor.test.ts tests/handoff.test.ts tests/config-migrations.test.ts tests/monty-payload-preflight.test.ts tests/bundled-binary-spawn.test.ts tests/conversation-native-reader-suspension.test.ts",
50
50
  "test:related": "vitest related --run",
51
51
  "check:fast": "bun run typecheck && bun run test:changed",
52
52
  "certify:context": "bun run build && node scripts/certify-context.mjs",
53
53
  "certify:entropy": "bun run build && node scripts/certify-entropy.mjs",
54
54
  "benchmark:real-resume": "bun run build && node scripts/benchmark-real-resume.mjs",
55
55
  "benchmark:memory-heads": "bun run build && node scripts/benchmark-memory-heads.mjs",
56
+ "benchmark:memory-recall": "bun run build && node scripts/benchmark-memory-recall.mjs",
56
57
  "benchmark:conversation": "bun run build && node --expose-gc scripts/benchmark-conversation.mjs",
57
58
  "benchmark:activity": "node --expose-gc scripts/benchmark-activity.mjs",
59
+ "benchmark:turn-cpu": "node scripts/benchmark-turn-cpu.mjs",
60
+ "benchmark:startup": "node scripts/benchmark-startup.mjs",
58
61
  "lint:dead": "knip --no-gitignore",
59
62
  "assert:lazy-graph": "node scripts/assert-lazy-graph-host-free.mjs",
60
63
  "assert:build-artifacts": "node scripts/assert-build-artifacts.mjs",
@@ -63,3 +63,5 @@ return await agents.create(name="auth-supervisor", instructions="Watch until the
63
63
  Use `await agents.run(task="...", runner="pi", recursive=True)` only for oversized context; plain children handle bounded leaves. Host maxDepth (0 disables spawning), approvals, concurrency, and budget limits remain active. Recursion delegates agent risk only, not filesystem/network/execute permissions. Keep durable context in mesh keys or project-relative files plus digests, not whole-corpus child prompts.
64
64
 
65
65
  `agents.handoff` without a predicate schedules an explicit Pi-to-Pi trajectory handoff at the completed outer fabric_exec boundary; later calls in the program still run. It is not a subroutine result. Use host schemas and a canonical target model; no Python guest predicate callbacks. Preserve successful effects rather than retrying the original program blindly.
66
+
67
+ A running trajectory executor may receive one hidden `pi-fabric-handoff-continuation` after a failed nested handoff. Finish the original assignment directly in the same workspace, preserve completed work, and verify the remainder instead of returning only a failure report. Do not retry delegation, spawn a replacement, or raise limits. Fabric cancels the local Prewalk arm and preserves the failed boundary, original deadline, permissions, and token accounting. Explicit stops, cancellation, timeouts, and token-limit termination stay terminal. Main continues to report terminal failures and propose a next step; it does not take over unprompted.
@@ -21,7 +21,7 @@ Keep outer `fabric_exec.code` in Python. Call Jev using `await tools.call(ref="j
21
21
 
22
22
  ## Host auto-approval classifier
23
23
 
24
- For user-selected tool safety classification (not a program loop), `/fabric settings` → **Approvals → Auto model** offers Jev. Set the relevant risk policies to `auto`; the stored model key is `jev/jev-latest` (or `jev/<model-id>`). Authentication is shared, but no chat model is registered. The host sends bounded current-user-turn evidence and exact arguments to TypeSafe, auto-allows only a typed safety probability >= 0.99, and otherwise requires explicit approval. This is a probabilistic advisor, not a hard security boundary; retain `ask`/`deny` where needed. Never enable it or change approval policies without the user's permission. See the auto-mode section in `docs/jev.md` via the hard pointer above.
24
+ For user-selected tool safety classification (not a program loop), `/fabric settings` → **Approvals → Auto model** offers Jev. Set the relevant risk policies to `auto`; the stored model key is `pi-fabric/typesafe/jev-latest` (or the pinned `pi-fabric/typesafe/jev-1.13`). Legacy `jev/<model-id>` settings remain compatible. Authentication is shared, but no chat model is registered. The host sends bounded current-user-turn evidence and exact arguments to TypeSafe, auto-allows a typed safety probability at or above `jev.autoApprovalThreshold` (default 0.50, editable through **Approvals → Jev minimum probability** when Jev is selected), and otherwise requires explicit approval. This is a probabilistic advisor, not a hard security boundary; retain `ask`/`deny` where needed. Never enable it or change approval policies or the threshold without the user's permission. See the auto-mode section in `docs/jev.md` via the hard pointer above.
25
25
 
26
26
  ## Judgment and loop design
27
27
 
@@ -103,6 +103,8 @@ The guest result is `{ scheduled: true, status: "deferred", boundary: "fabric_ex
103
103
 
104
104
  After the executor settles, a visible `pi-fabric-handoff-complete` follow-up reports its identity, status, and bounded conclusion, then wakes Main. Summarize the outcome and reported checks, preserving concrete identifiers; do not redo completed work. If the handoff failed, stopped, or timed out, explain the outcome and propose the next step without retrying or taking over unprompted. This is a queued follow-up, not steering.
105
105
 
106
+ Exception for an already-running trajectory executor: a failed nested handoff can queue one hidden `pi-fabric-handoff-continuation` per executor run. On that message, finish your original assignment directly in the same workspace, preserve completed work, and verify the remainder rather than returning only the failed-handoff report. Do not retry delegation, spawn a replacement, or raise limits. Fabric cancels the local Prewalk arm, keeps the boundary marked failed, and preserves the run's deadline and token accounting. Explicit stops, cancellation, timeouts, and token-limit termination never trigger this fallback. If genuinely blocked, report the blocker honestly. Main still reports terminal failures instead of taking over unprompted.
107
+
106
108
  ## Automatic prewalk
107
109
 
108
110
  `/fabric prewalk [task]` arms one automatic continuation when a Fabric invocation contains a successful `pi.edit`, `pi.write`, or `schema.commit`. With a task it submits immediately; without one it captures the next user input. The executor comes from `prewalk.model` or an interactive choice, and its reasoning effort from `prewalk.thinking` (inheriting `agents.thinking` when unset). `prewalk.alwaysRearm` keeps the controller armed until `/fabric prewalk --off`. That command cancels only the session arm; `/fabric prewalk --disable` persists the master switch and survives restarts, while `--enable` restores it.
@@ -19,7 +19,7 @@ Code owns the workflow; Jev supplies typed judgments, not generated prose. Run t
19
19
 
20
20
  ## Host auto-approval classifier
21
21
 
22
- For user-selected tool safety classification (not a program loop), `/fabric settings` → **Approvals → Auto model** offers Jev. Set the relevant risk policies to `auto`; the stored model key is `jev/jev-latest` (or `jev/<model-id>`). Authentication is shared, but no chat model is registered. The host sends bounded current-user-turn evidence and exact arguments to TypeSafe, auto-allows only a typed safety probability >= 0.99, and otherwise requires explicit approval. This is a probabilistic advisor, not a hard security boundary; retain `ask`/`deny` where needed. Never enable it or change approval policies without the user's permission. See the auto-mode section in `docs/jev.md` via the hard pointer above.
22
+ For user-selected tool safety classification (not a program loop), `/fabric settings` → **Approvals → Auto model** offers Jev. Set the relevant risk policies to `auto`; the stored model key is `pi-fabric/typesafe/jev-latest` (or the pinned `pi-fabric/typesafe/jev-1.13`). Legacy `jev/<model-id>` settings remain compatible. Authentication is shared, but no chat model is registered. The host sends bounded current-user-turn evidence and exact arguments to TypeSafe, auto-allows a typed safety probability at or above `jev.autoApprovalThreshold` (default 0.50, editable through **Approvals → Jev minimum probability** when Jev is selected), and otherwise requires explicit approval. This is a probabilistic advisor, not a hard security boundary; retain `ask`/`deny` where needed. Never enable it or change approval policies or the threshold without the user's permission. See the auto-mode section in `docs/jev.md` via the hard pointer above.
23
23
 
24
24
  ## Design a bounded judgment loop
25
25