@e4779/pi-fabric 0.97.0-fork.13 → 0.100.0-fork.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.md +5 -4
- package/dist/agents/manager.d.ts.map +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/types.d.ts +4 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents.js +3 -3
- package/dist/chunks/{chunk-JCV54SSP.js → chunk-27ORW5EK.js} +41 -22
- package/dist/chunks/chunk-27ORW5EK.js.map +7 -0
- package/dist/chunks/{chunk-EQIGYLVB.js → chunk-3RFEMOJA.js} +9 -3
- package/dist/chunks/chunk-3RFEMOJA.js.map +7 -0
- package/dist/chunks/{chunk-D5GNTBV6.js → chunk-7HQKBGTL.js} +2 -2
- package/dist/chunks/{chunk-LNLQ2LX3.js → chunk-ASU53MOT.js} +2 -2
- package/dist/chunks/{chunk-V3PIO7QL.js → chunk-BUQZBG6O.js} +3 -43
- package/dist/chunks/chunk-BUQZBG6O.js.map +7 -0
- package/dist/chunks/{chunk-6K5SRGW6.js → chunk-C2DIKAOE.js} +4 -4
- package/dist/chunks/{chunk-FJSHRHOR.js → chunk-CPSPZGK4.js} +6 -6
- package/dist/chunks/{chunk-UBPFGMDQ.js → chunk-CXQF35XB.js} +4 -4
- package/dist/chunks/{chunk-3SIXBW6A.js → chunk-H4YYLQTX.js} +2 -2
- package/dist/chunks/{chunk-CSJSHBAT.js → chunk-I5VN6D5T.js} +48 -21
- package/dist/chunks/chunk-I5VN6D5T.js.map +7 -0
- package/dist/chunks/{chunk-VRYEGVHR.js → chunk-J7ZQERKA.js} +11 -8
- package/dist/chunks/chunk-J7ZQERKA.js.map +7 -0
- package/dist/chunks/{chunk-D4B4CCTA.js → chunk-JHQDS6YP.js} +2 -2
- package/dist/chunks/{chunk-OINADFEF.js → chunk-JWWGWUP7.js} +5 -5
- package/dist/chunks/{chunk-WXSELMFV.js → chunk-KFPUVFDS.js} +5 -5
- package/dist/chunks/{chunk-EPAFGT2M.js → chunk-LH2PGXSZ.js} +5 -1
- package/dist/chunks/{chunk-EPAFGT2M.js.map → chunk-LH2PGXSZ.js.map} +2 -2
- package/dist/chunks/{chunk-X3IRR7CV.js → chunk-M25A5R3F.js} +2 -2
- package/dist/chunks/chunk-MNTJX4U7.js +760 -0
- package/dist/chunks/chunk-MNTJX4U7.js.map +7 -0
- package/dist/chunks/{chunk-754HA6KO.js → chunk-NRLDV5R3.js} +7 -2
- package/dist/chunks/chunk-NRLDV5R3.js.map +7 -0
- package/dist/chunks/chunk-O4A5UOXU.js +44 -0
- package/dist/chunks/chunk-O4A5UOXU.js.map +7 -0
- package/dist/chunks/{chunk-4F27LJTS.js → chunk-OEJ6RFDO.js} +255 -72
- package/dist/chunks/chunk-OEJ6RFDO.js.map +7 -0
- package/dist/chunks/{chunk-VQGO4P7C.js → chunk-QIW7QMFI.js} +2 -2
- package/dist/chunks/{chunk-B4HECUJI.js → chunk-RUEKYUNR.js} +2 -2
- package/dist/chunks/{chunk-A4XPJESK.js → chunk-RZHXYLOY.js} +2 -2
- package/dist/chunks/{chunk-QNMMQAZ7.js → chunk-SDDBEBM4.js} +3 -3
- package/dist/chunks/{chunk-2LBC6TTP.js → chunk-UGMLWBVF.js} +390 -228
- package/dist/chunks/chunk-UGMLWBVF.js.map +7 -0
- package/dist/chunks/{chunk-5WUW727L.js → chunk-VGQ2IE7P.js} +19 -3
- package/dist/chunks/chunk-VGQ2IE7P.js.map +7 -0
- package/dist/chunks/{chunk-KBHITFTO.js → chunk-VRAGOMN4.js} +3 -1
- package/dist/chunks/chunk-VRAGOMN4.js.map +7 -0
- package/dist/chunks/{chunk-F676L43O.js → chunk-WK25T5ST.js} +11 -11
- package/dist/chunks/{chunk-IPHEM6RY.js → chunk-WQB6CVES.js} +2 -2
- package/dist/chunks/{chunk-CZSX6UG6.js → chunk-XYFOKDFM.js} +2 -2
- package/dist/chunks/{chunk-G2F2RDZI.js → chunk-YAPDV6LO.js} +2 -2
- package/dist/chunks/{chunk-Q5BMTL6A.js → chunk-YIEK7FH2.js} +4 -4
- package/dist/chunks/{chunk-KS44WKJJ.js → chunk-Z45SUO4B.js} +2 -2
- package/dist/commands/fabric.d.ts.map +1 -1
- package/dist/compaction/hook.js +6 -6
- package/dist/components/builtin-guidance.d.ts +4 -0
- package/dist/components/builtin-guidance.d.ts.map +1 -0
- package/dist/components/configuration.js +2 -2
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/core/action-registry.js +7 -7
- package/dist/core/file-lock.d.ts +4 -0
- package/dist/core/file-lock.d.ts.map +1 -1
- package/dist/core/provider-operations.js +162 -51
- package/dist/core/provider-operations.js.map +2 -2
- package/dist/core/shell-timing.d.ts +11 -0
- package/dist/core/shell-timing.d.ts.map +1 -0
- package/dist/entropy/index.js +12 -10
- package/dist/entropy/pool-store.d.ts +3 -1
- package/dist/entropy/pool-store.d.ts.map +1 -1
- package/dist/fabric-runtime-state.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +138 -55
- package/dist/fabric-runtime-state.js.map +4 -4
- package/dist/fabric-state.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +125 -58
- package/dist/index.js.map +3 -3
- package/dist/jev/observation.js +5 -5
- package/dist/jev.js +8 -8
- package/dist/lifecycle/broker.d.ts.map +1 -1
- package/dist/memory/digest.js +2 -2
- package/dist/memory/discovery.js +6 -6
- package/dist/memory/file-worker.js +9 -9
- package/dist/memory/normalize.js +5 -5
- package/dist/memory/search.js +7 -7
- package/dist/memory/worker-provider.js +10 -10
- package/dist/memory.js +10 -10
- package/dist/prewalk/messages.d.ts +1 -1
- package/dist/prewalk/messages.d.ts.map +1 -1
- package/dist/protocol.d.ts +12 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +3 -1
- package/dist/providers/agents-actions.d.ts.map +1 -1
- package/dist/providers/agents-message-router.d.ts.map +1 -1
- package/dist/providers/agents-provider.d.ts.map +1 -1
- package/dist/providers/jev-provider.js +8 -8
- package/dist/providers/memory-provider.js +9 -9
- package/dist/providers/prewalk-provider.d.ts +3 -3
- package/dist/providers/prewalk-provider.d.ts.map +1 -1
- package/dist/residency/host.js +9 -9
- package/dist/residency/pi-entry.js +9 -9
- package/dist/runtime/core-override-guest-types.js +2 -2
- package/dist/runtime/guest-types.d.ts +1 -1
- package/dist/runtime/guest-types.d.ts.map +1 -1
- package/dist/runtime/guest-types.js +1 -1
- package/dist/runtime/monty-runtime.js +1 -1
- package/dist/runtime/typescript-kernel.js +2 -2
- package/dist/ui/conversation.d.ts +2 -1
- package/dist/ui/conversation.d.ts.map +1 -1
- package/dist/ui/conversation.js +41 -37
- package/dist/ui/conversation.js.map +2 -2
- package/dist/ui/dashboard.js +10 -8
- package/dist/ui/dashboard.js.map +1 -1
- package/dist/ui/fabric-model-selector.d.ts +3 -0
- package/dist/ui/fabric-model-selector.d.ts.map +1 -1
- package/dist/ui/settings.d.ts.map +1 -1
- package/dist/ui/settings.js +15 -2
- package/dist/ui/settings.js.map +2 -2
- package/dist/ui/shell-tasks.d.ts +2 -1
- package/dist/ui/shell-tasks.d.ts.map +1 -1
- package/dist/ui/shell-tasks.js +169 -81
- package/dist/ui/shell-tasks.js.map +3 -3
- package/dist/ui/snapshot.d.ts.map +1 -1
- package/dist/ui/structured.d.ts.map +1 -1
- package/dist/ui/widget.d.ts.map +1 -1
- package/dist/verified/generated/authority-kernel.js +188 -81
- package/dist/verified/generated/kernel.js +547 -265
- package/dist/verified/generated/lifecycle-kernel.d.ts +1 -1
- package/dist/verified/generated/lifecycle-kernel.js +172 -125
- package/dist/verified/generated/manifest.json +11 -11
- package/dist/verified/generated/provider-kernel.js +160 -52
- package/dist/verified/generated/storage-kernel.js +238 -69
- package/dist/worker/model-control.d.ts +1 -1
- package/dist/worker/model-control.d.ts.map +1 -1
- package/dist/worker/model-control.js +6 -3
- package/dist/worker/model-control.js.map +2 -2
- package/dist/worker/options.d.ts.map +1 -1
- package/dist/worker/options.js +15 -0
- package/dist/worker/options.js.map +2 -2
- package/dist/worker.js +3 -2
- package/dist/worker.js.map +2 -2
- package/docs/agents.md +1 -1
- package/docs/background-tasks.md +33 -0
- package/docs/configuration.md +4 -2
- package/docs/entropy.md +13 -0
- package/docs/harnesses.md +1 -1
- package/docs/interface.md +2 -0
- package/docs/jev.md +1 -1
- package/docs/prompt-cache.md +3 -3
- package/docs/provider-capabilities.md +1 -1
- package/docs/verified-kernels.md +10 -6
- package/package.json +1 -1
- package/proofs/lifecycle-spec.bend +4 -4
- package/proofs/lifecycle-types.d.ts +1 -1
- package/proofs/lifecycle.bend +6 -6
- package/scripts/test-verified-kernels.mjs +3 -3
- package/scripts/verified-kernels.mjs +53 -13
- package/skillsets/typescript/fabric-exec/references/agents.md +2 -0
- package/dist/chunks/chunk-2LBC6TTP.js.map +0 -7
- package/dist/chunks/chunk-4E63LJDD.js +0 -468
- package/dist/chunks/chunk-4E63LJDD.js.map +0 -7
- package/dist/chunks/chunk-4F27LJTS.js.map +0 -7
- package/dist/chunks/chunk-5WUW727L.js.map +0 -7
- package/dist/chunks/chunk-754HA6KO.js.map +0 -7
- package/dist/chunks/chunk-CSJSHBAT.js.map +0 -7
- package/dist/chunks/chunk-EQIGYLVB.js.map +0 -7
- package/dist/chunks/chunk-JCV54SSP.js.map +0 -7
- package/dist/chunks/chunk-KBHITFTO.js.map +0 -7
- package/dist/chunks/chunk-V3PIO7QL.js.map +0 -7
- package/dist/chunks/chunk-VRYEGVHR.js.map +0 -7
- /package/dist/chunks/{chunk-D5GNTBV6.js.map → chunk-7HQKBGTL.js.map} +0 -0
- /package/dist/chunks/{chunk-LNLQ2LX3.js.map → chunk-ASU53MOT.js.map} +0 -0
- /package/dist/chunks/{chunk-6K5SRGW6.js.map → chunk-C2DIKAOE.js.map} +0 -0
- /package/dist/chunks/{chunk-FJSHRHOR.js.map → chunk-CPSPZGK4.js.map} +0 -0
- /package/dist/chunks/{chunk-UBPFGMDQ.js.map → chunk-CXQF35XB.js.map} +0 -0
- /package/dist/chunks/{chunk-3SIXBW6A.js.map → chunk-H4YYLQTX.js.map} +0 -0
- /package/dist/chunks/{chunk-D4B4CCTA.js.map → chunk-JHQDS6YP.js.map} +0 -0
- /package/dist/chunks/{chunk-OINADFEF.js.map → chunk-JWWGWUP7.js.map} +0 -0
- /package/dist/chunks/{chunk-WXSELMFV.js.map → chunk-KFPUVFDS.js.map} +0 -0
- /package/dist/chunks/{chunk-X3IRR7CV.js.map → chunk-M25A5R3F.js.map} +0 -0
- /package/dist/chunks/{chunk-VQGO4P7C.js.map → chunk-QIW7QMFI.js.map} +0 -0
- /package/dist/chunks/{chunk-B4HECUJI.js.map → chunk-RUEKYUNR.js.map} +0 -0
- /package/dist/chunks/{chunk-A4XPJESK.js.map → chunk-RZHXYLOY.js.map} +0 -0
- /package/dist/chunks/{chunk-QNMMQAZ7.js.map → chunk-SDDBEBM4.js.map} +0 -0
- /package/dist/chunks/{chunk-F676L43O.js.map → chunk-WK25T5ST.js.map} +0 -0
- /package/dist/chunks/{chunk-IPHEM6RY.js.map → chunk-WQB6CVES.js.map} +0 -0
- /package/dist/chunks/{chunk-CZSX6UG6.js.map → chunk-XYFOKDFM.js.map} +0 -0
- /package/dist/chunks/{chunk-G2F2RDZI.js.map → chunk-YAPDV6LO.js.map} +0 -0
- /package/dist/chunks/{chunk-Q5BMTL6A.js.map → chunk-YIEK7FH2.js.map} +0 -0
- /package/dist/chunks/{chunk-KS44WKJJ.js.map → chunk-Z45SUO4B.js.map} +0 -0
package/docs/jev.md
CHANGED
|
@@ -346,7 +346,7 @@ Default per-run limits: **60 seconds, 100 evaluations, 1,000 host calls, 100,000
|
|
|
346
346
|
|
|
347
347
|
Duration can be configured up to 24 hours. Evaluation slots are reserved before dispatch, including failed requests. One evaluation may be in flight per program; batch independent questions to avoid building an inference backlog. Other granted tool calls may run concurrently. Token usage is reported **after** inference: exceeding the token threshold stops the program before it can use that answer, but the final request can overshoot the threshold and still incurs charges. This is not a hard dollar-spend limit. Request-size and evaluation-count limits are the pre-dispatch bounds. Failed requests with no usage report may still have incurred upstream charges.
|
|
348
348
|
|
|
349
|
-
Every external action keeps Fabric argument validation, approvals, Schema policy, and a pinned capability generation. A restricted caller cannot widen its own capability view by spawning a program. Recursive Jev lifecycle calls are denied inside programs. Jev is unavailable in Schema enforce and managed-host modes. Other deliberately granted capabilities can be powerful: **granting `pi.bash` or an unrestricted evaluator is not a read-only sandbox** and can defeat data-isolation assumptions. Shell effects run with host privileges; QuickJS isolation does not sandbox a granted shell. Follow the harness-owned CLI/library contracts
|
|
349
|
+
Every external action keeps Fabric argument validation, approvals, Schema policy, and a pinned capability generation. A restricted caller cannot widen its own capability view by spawning a program. Recursive Jev lifecycle calls are denied inside programs. Jev is unavailable in Schema enforce and managed-host modes. Other deliberately granted capabilities can be powerful: **granting `pi.bash` or an unrestricted evaluator is not a read-only sandbox** and can defeat data-isolation assumptions. Shell effects run with host privileges; QuickJS isolation does not sandbox a granted shell. Follow the harness-owned CLI/library contracts without adding a Fabric adapter.
|
|
350
350
|
|
|
351
351
|
## Browser and desktop tools
|
|
352
352
|
|
package/docs/prompt-cache.md
CHANGED
|
@@ -33,7 +33,7 @@ Known calls also work in the Python kernels, for example `await cache.status(tar
|
|
|
33
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
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
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
|
|
36
|
+
- Holds end on their deadline, cancellation during allocation, known session/model/branch/compaction boundaries, or provider close. Reload drains retained provider generations without 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
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
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
39
|
|
|
@@ -69,9 +69,9 @@ Import `FabricCacheHoldResult` as a type from `pi-fabric/protocol`. Inspect its
|
|
|
69
69
|
|
|
70
70
|
## Boundaries and future work
|
|
71
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.
|
|
72
|
+
Stable prompt construction already lives in [model-guidance components](components.md#prompt-cache-and-cold-prefill-behavior). Built-in provider guidance depends only on configuration and resolves from the first agent start, so it stays out of activation-timing churn. Do not inject clocks, task state, or cache diagnostics into the stable prefix.
|
|
73
73
|
|
|
74
|
-
Persistent actor transcripts
|
|
74
|
+
Persistent actor transcripts differ from persistent Pi worker processes: current actor activations reuse the session file and 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
75
|
|
|
76
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
77
|
|
|
@@ -186,7 +186,7 @@ bun run benchmark:provider-dispatch
|
|
|
186
186
|
bun run benchmark:startup . ../pi-fovea ../pi-contour
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
-
The contributor toolchain pins Bend 2.0.
|
|
189
|
+
The contributor toolchain pins Bend 2.0.32. `BEND_BIN` can select a trusted
|
|
190
190
|
compiler executable. Normal builds verify artifact hashes without Bend.
|
|
191
191
|
|
|
192
192
|
The dispatch benchmark measures first use and warm full-registry read calls
|
package/docs/verified-kernels.md
CHANGED
|
@@ -204,7 +204,7 @@ author-defined observational equivalence are not claimed as Bend theorems.
|
|
|
204
204
|
|
|
205
205
|
## Reproducible bridge
|
|
206
206
|
|
|
207
|
-
The contributor toolchain pins **Bend 2.0.
|
|
207
|
+
The contributor toolchain pins **Bend 2.0.32**. Installed Fabric needs neither
|
|
208
208
|
Bend nor a Bend loader. Linux CI downloads that exact release archive and checks
|
|
209
209
|
its SHA-256 before running proofs. Windows tests execute the checked-in generated
|
|
210
210
|
JS and ABI; native Bend currently requires Linux, macOS, or WSL.
|
|
@@ -224,16 +224,20 @@ bun run proof:dist # probe the actual bundled registry/compactor and kern
|
|
|
224
224
|
`BEND_BIN` may explicitly select a trusted compiler executable. Generation sets
|
|
225
225
|
`BEND_NO_TELEMETRY=1`. It never installs or updates Bend automatically.
|
|
226
226
|
|
|
227
|
-
Bend's
|
|
228
|
-
|
|
227
|
+
Bend's `-o *.mjs` backend emits an ES module whose default export table wraps
|
|
228
|
+
every definition in Bend's own trampoline and host `Nat` (`BigInt`) marshalling.
|
|
229
|
+
The build bridge:
|
|
229
230
|
|
|
230
231
|
1. Checks the entire root proof file and its imported laws.
|
|
231
232
|
2. Refuses unsafe declarations, holes, foreign effects, remote imports, and
|
|
232
233
|
untracked local proof dependencies.
|
|
233
234
|
3. Compiles the same kernel source that those laws import.
|
|
234
|
-
4. Parses the emitted
|
|
235
|
-
|
|
236
|
-
|
|
235
|
+
4. Parses the emitted module, requires its export table as the only footer and
|
|
236
|
+
no top-level invocation statements.
|
|
237
|
+
5. Keeps only the ABI entries of that table, checking names and arities. Bend
|
|
238
|
+
tags constructors with their declaring module (`lifecycle.Life`); the bridge
|
|
239
|
+
maps them to the ABI's bare tags at the boundary and refuses generation when
|
|
240
|
+
a bare tag would be ambiguous within a kernel.
|
|
237
241
|
6. Tree-shakes unused runtime code and rejects host IO/imports before compacting
|
|
238
242
|
compiler-local identifiers and syntax. Public ABI export names stay stable.
|
|
239
243
|
7. Writes generated JS, ABI declarations, and a SHA-256 receipt over the proof
|
package/package.json
CHANGED
|
@@ -104,11 +104,11 @@ law inspect_open_complete:
|
|
|
104
104
|
|
|
105
105
|
law close_safe:
|
|
106
106
|
for +life: L.Life
|
|
107
|
-
CloseSafe(life, K.bindingStep(life, L.
|
|
107
|
+
CloseSafe(life, K.bindingStep(life, L.Shut{}))
|
|
108
108
|
|
|
109
109
|
law close_complete:
|
|
110
110
|
for +revoked: Bool
|
|
111
|
-
{K.bindingStep(L.Life{L.Retiring{}, False{}, 0n, 0n, revoked}, L.
|
|
111
|
+
{K.bindingStep(L.Life{L.Retiring{}, False{}, 0n, 0n, revoked}, L.Shut{}) == L.Outcome{L.Life{L.Closing{}, False{}, 0n, 0n, revoked}, L.StartClose{}} : L.Outcome}
|
|
112
112
|
|
|
113
113
|
law begin_complete:
|
|
114
114
|
for +owner: Bool
|
|
@@ -190,7 +190,7 @@ law quarantine_preserves_work:
|
|
|
190
190
|
for +holds: Nat
|
|
191
191
|
for +calls: Nat
|
|
192
192
|
for +revoked: Bool
|
|
193
|
-
{K.bindingStep(L.Life{L.Retiring{}, owner, holds, calls, revoked}, L.
|
|
193
|
+
{K.bindingStep(L.Life{L.Retiring{}, owner, holds, calls, revoked}, L.Abort{}) == L.Outcome{L.Life{L.Failed{}, False{}, holds, calls, True{}}, L.Granted{}} : L.Outcome}
|
|
194
194
|
|
|
195
195
|
law cleanup_after_revocation:
|
|
196
196
|
for +owner: Bool
|
|
@@ -243,7 +243,7 @@ law failure_exact:
|
|
|
243
243
|
for +holds: Nat
|
|
244
244
|
for +calls: Nat
|
|
245
245
|
for +revoked: Bool
|
|
246
|
-
{K.bindingStep(L.Life{phase, owner, holds, calls, revoked}, L.
|
|
246
|
+
{K.bindingStep(L.Life{phase, owner, holds, calls, revoked}, L.Abort{}) == Failure(phase, owner, holds, calls, revoked) : L.Outcome}
|
|
247
247
|
|
|
248
248
|
law closing_refuses_work:
|
|
249
249
|
for +owner: Bool
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type BindingPhase = { $: "Staged" | "Active" | "Retiring" | "Closing" | "Closed" | "Failed" };
|
|
2
2
|
export interface BindingLife { $: "Life"; phase: BindingPhase; owner: boolean; holds: bigint; calls: bigint; revoked: boolean }
|
|
3
|
-
export type BindingEvent = { $: "Inspect" | "Activate" | "Retire" | "DropOwner" | "Revoke" | "Release" | "End" | "
|
|
3
|
+
export type BindingEvent = { $: "Inspect" | "Activate" | "Retire" | "DropOwner" | "Revoke" | "Release" | "End" | "Shut" | "Complete" | "Abort" } | { $: "Retain" | "Begin"; cleanup: boolean };
|
|
4
4
|
export interface BindingOutcome { $: "Outcome"; next: BindingLife; command: { $: "Denied" | "Granted" | "StartClose" } }
|
package/proofs/lifecycle.bend
CHANGED
|
@@ -21,9 +21,9 @@ type BindingEvent is Data:
|
|
|
21
21
|
Release{}
|
|
22
22
|
Begin{cleanup: Bool}
|
|
23
23
|
End{}
|
|
24
|
-
|
|
24
|
+
Shut{}
|
|
25
25
|
Complete{}
|
|
26
|
-
|
|
26
|
+
Abort{}
|
|
27
27
|
|
|
28
28
|
type Command is Data:
|
|
29
29
|
Denied{}
|
|
@@ -102,17 +102,17 @@ def step(event: BindingEvent, life: Life) -> Outcome:
|
|
|
102
102
|
Outcome{life, Denied{}}
|
|
103
103
|
case End{} Life{phase, owner, holds, 1n+calls, revoked}:
|
|
104
104
|
Outcome{Life{phase, owner, holds, calls, revoked}, Granted{}}
|
|
105
|
-
case
|
|
105
|
+
case Shut{} Life{Retiring{}, False{}, 0n, 0n, revoked}:
|
|
106
106
|
Outcome{Life{Closing{}, False{}, 0n, 0n, revoked}, StartClose{}}
|
|
107
|
-
case
|
|
107
|
+
case Shut{} _:
|
|
108
108
|
Outcome{life, Denied{}}
|
|
109
109
|
case Complete{} Life{Closing{}, owner, holds, calls, revoked}:
|
|
110
110
|
Outcome{Life{Closed{}, owner, holds, calls, revoked}, Granted{}}
|
|
111
111
|
case Complete{} _:
|
|
112
112
|
Outcome{life, Denied{}}
|
|
113
|
-
case
|
|
113
|
+
case Abort{} Life{Closed{}, owner, holds, calls, revoked}:
|
|
114
114
|
Outcome{life, Denied{}}
|
|
115
|
-
case
|
|
115
|
+
case Abort{} Life{+phase, +owner, +holds, +calls, +revoked}:
|
|
116
116
|
Outcome{Life{Failed{}, False{}, holds, calls, True{}}, Granted{}}
|
|
117
117
|
|
|
118
118
|
def bindingStep(life: Life, event: BindingEvent) -> Outcome:
|
|
@@ -8,7 +8,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8
8
|
const root = fileURLToPath(new URL("../", import.meta.url));
|
|
9
9
|
const env = { ...process.env, BEND_NO_TELEMETRY: "1" };
|
|
10
10
|
const bend = process.env.BEND_BIN || "bend";
|
|
11
|
-
if (execFileSync(bend, ["version"], { encoding: "utf8", env }).trim() !== "bend 2.0.
|
|
11
|
+
if (execFileSync(bend, ["version"], { encoding: "utf8", env }).trim() !== "bend 2.0.32") throw new Error("Bend 2.0.32 required");
|
|
12
12
|
const inputs = JSON.parse(readFileSync(join(root, "src/verified/generated/manifest.json"), "utf8")).inputs;
|
|
13
13
|
const originals = Object.fromEntries(Object.keys(inputs).filter((path) => path.endsWith(".bend")).map((path) => [path, readFileSync(join(root, path), "utf8")]));
|
|
14
14
|
const mutations = [
|
|
@@ -41,8 +41,8 @@ const mutations = [
|
|
|
41
41
|
["authority wrapper widening", "proofs/authority-kernel.bend", "A.derive(parent, candidate)", "A.issue(candidate)"],
|
|
42
42
|
["authority wrapper release reuse", "proofs/authority-kernel.bend", "A.release(authority)", "authority"],
|
|
43
43
|
["lifecycle uncounted work", "proofs/lifecycle.bend", "Life{phase, owner, holds, 1n+calls, revoked}, Granted{}", "Life{phase, owner, holds, calls, revoked}, Granted{}"],
|
|
44
|
-
["lifecycle close under lease", "proofs/lifecycle.bend", "case
|
|
45
|
-
["lifecycle close under work", "proofs/lifecycle.bend", "case
|
|
44
|
+
["lifecycle close under lease", "proofs/lifecycle.bend", "case Shut{} Life{Retiring{}, False{}, 0n, 0n, revoked}:", "case Shut{} Life{Retiring{}, False{}, holds, 0n, revoked}:"],
|
|
45
|
+
["lifecycle close under work", "proofs/lifecycle.bend", "case Shut{} Life{Retiring{}, False{}, 0n, 0n, revoked}:", "case Shut{} Life{Retiring{}, False{}, 0n, calls, revoked}:"],
|
|
46
46
|
["lifecycle revocation drops work", "proofs/lifecycle.bend", "Life{retiring(phase), False{}, holds, calls, True{}}", "Life{retiring(phase), False{}, holds, 0n, True{}}"],
|
|
47
47
|
["lifecycle owner release drops holds", "proofs/lifecycle.bend", "Life{phase, False{}, holds, calls, revoked}, Granted{}", "Life{phase, False{}, 0n, calls, revoked}, Granted{}"],
|
|
48
48
|
["lifecycle close not reserved", "proofs/lifecycle.bend", "Life{Closing{}, False{}, 0n, 0n, revoked}, StartClose{}", "Life{Retiring{}, False{}, 0n, 0n, revoked}, StartClose{}"],
|
|
@@ -9,7 +9,7 @@ import { build, transform } from "esbuild";
|
|
|
9
9
|
import ts from "typescript";
|
|
10
10
|
|
|
11
11
|
const root = fileURLToPath(new URL("../", import.meta.url));
|
|
12
|
-
const version = "2.0.
|
|
12
|
+
const version = "2.0.32";
|
|
13
13
|
const targets = [
|
|
14
14
|
{ stem: "storage-kernel", source: "proofs/storage-kernel.bend", abi: "proofs/storage-abi.json", types: "proofs/storage-types.d.ts" },
|
|
15
15
|
{ stem: "authority-kernel", source: "proofs/authority-kernel.bend", abi: "proofs/authority-abi.json", types: "proofs/authority-types.d.ts" },
|
|
@@ -58,40 +58,80 @@ if (mode === "--artifact") {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
const checked = bend("PROOF.bend", "--check-only");
|
|
61
|
-
if (!checked.includes("
|
|
61
|
+
if (!checked.includes("ALL PROOFS CHECK")) throw new Error(`Bend did not confirm closed proofs: ${checked}`);
|
|
62
62
|
const temp = mkdtempSync(join(tmpdir(), "fabric-bend-"));
|
|
63
63
|
try {
|
|
64
64
|
const files = new Map();
|
|
65
65
|
let exportsCount = 0;
|
|
66
66
|
for (const target of targets) {
|
|
67
|
-
const emitted = join(temp, `${target.stem}.
|
|
67
|
+
const emitted = join(temp, `${target.stem}.mjs`);
|
|
68
68
|
bend(target.source, "-o", emitted);
|
|
69
69
|
const js = readFileSync(emitted, "utf8");
|
|
70
70
|
const ast = ts.createSourceFile("kernel.js", js, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
|
|
71
71
|
const statements = [...ast.statements];
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
|
|
72
|
+
const table = statements.at(-1);
|
|
73
|
+
if (!table || !ts.isExportAssignment(table) || !ts.isObjectLiteralExpression(table.expression) ||
|
|
74
|
+
statements.some((statement) => ts.isExpressionStatement(statement))) {
|
|
75
|
+
throw new Error("Unrecognized Bend module footer; review the compiler bridge before upgrading");
|
|
75
76
|
}
|
|
76
77
|
const defs = new Map(statements.filter(ts.isFunctionDeclaration).map((node) => [node.name?.text, node]));
|
|
78
|
+
const entries = new Map(table.expression.properties.filter(ts.isPropertyAssignment)
|
|
79
|
+
.map((property) => [property.name.getText(ast).replace(/^"|"$/g, ""), property.initializer]));
|
|
80
|
+
// Bend host tags carry the declaring module ("lifecycle.Life"); root and
|
|
81
|
+
// Base constructors stay bare. The host ABI keeps bare tags, so every
|
|
82
|
+
// namespaced tag must name exactly one constructor in this kernel.
|
|
83
|
+
const literals = new Set();
|
|
84
|
+
const collect = (node) => { if (ts.isStringLiteral(node)) literals.add(node.text); ts.forEachChild(node, collect); };
|
|
85
|
+
collect(ast);
|
|
86
|
+
const tags = new Map();
|
|
87
|
+
for (const literal of literals) {
|
|
88
|
+
const bare = /^[a-z][a-z0-9-]*\.([A-Z][A-Za-z0-9]*)$/.exec(literal)?.[1];
|
|
89
|
+
if (!bare) continue;
|
|
90
|
+
if (tags.has(bare) || literals.has(bare)) throw new Error(`Ambiguous host tag ${bare} in ${target.source}`);
|
|
91
|
+
tags.set(bare, literal);
|
|
92
|
+
}
|
|
77
93
|
const abi = JSON.parse(read(target.abi));
|
|
78
94
|
const exports = Object.entries(abi).map(([name, signature]) => {
|
|
79
95
|
const symbol = `$${name}$`;
|
|
80
96
|
const arity = signature.length - 1;
|
|
81
|
-
|
|
97
|
+
const entry = entries.get(name);
|
|
98
|
+
if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(name) || defs.get(symbol)?.parameters.length !== arity ||
|
|
99
|
+
!entry || !ts.isCallExpression(entry) || entry.expression.getText(ast) !== "run_lib" ||
|
|
100
|
+
entry.arguments[1]?.getText(ast) !== String(arity) || !ts.isArrowFunction(entry.arguments[0]) ||
|
|
101
|
+
entry.arguments[0].parameters.length !== arity || !entry.arguments[0].getText(ast).includes(`${symbol}(`)) {
|
|
82
102
|
throw new Error(`Missing or incompatible compiled definition: ${name}`);
|
|
83
103
|
}
|
|
84
|
-
|
|
104
|
+
const params = Array.from({ length: arity }, (_, index) => `a${index}`);
|
|
105
|
+
return `const $lib$${name} = /* @__PURE__ */ ${entry.getText(ast)};\n` +
|
|
106
|
+
`export const ${name} = (${params.join(", ")}) => $retag$($lib$${name}(${params.map((param) => `$retag$(${param}, $tag$)`).join(", ")}), $untag$);`;
|
|
85
107
|
});
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
|
|
108
|
+
// Keep only the ABI entries of Bend's own module table, which marshal host
|
|
109
|
+
// naturals and drain the trampoline, and rename constructor tags at the
|
|
110
|
+
// boundary. No algorithm is translated.
|
|
111
|
+
const bridge = [
|
|
112
|
+
`const $tag$ = new Map(${JSON.stringify([...tags])});`,
|
|
113
|
+
`const $untag$ = new Map(${JSON.stringify([...tags].map(([bare, full]) => [full, bare]))});`,
|
|
114
|
+
`function $retag$(value, names) {
|
|
115
|
+
const top = [value];
|
|
116
|
+
for (const stack = [[top, 0]]; stack.length > 0;) {
|
|
117
|
+
const [parent, key] = stack.pop();
|
|
118
|
+
const node = parent[key];
|
|
119
|
+
if (node === null || typeof node !== "object") continue;
|
|
120
|
+
const copy = Array.isArray(node) ? [...node] : { ...node };
|
|
121
|
+
if (typeof copy.$ === "string") copy.$ = names.get(copy.$) ?? copy.$;
|
|
122
|
+
parent[key] = copy;
|
|
123
|
+
for (const field of Object.keys(copy)) stack.push([copy, field]);
|
|
124
|
+
}
|
|
125
|
+
return top[0];
|
|
126
|
+
}`,
|
|
127
|
+
];
|
|
128
|
+
const library = js.slice(0, table.getFullStart()) + "\n" + bridge.join("\n") + "\n" + exports.join("\n");
|
|
89
129
|
const result = await build({
|
|
90
130
|
stdin: { contents: library, sourcefile: "bend-kernel.js", resolveDir: root },
|
|
91
131
|
bundle: true, write: false, format: "esm", platform: "node", packages: "external", external: ["bun:ffi"], target: "es2022",
|
|
92
132
|
minifySyntax: true,
|
|
93
133
|
legalComments: "none", treeShaking: true,
|
|
94
|
-
banner: { js: `// Generated by Bend ${version}; do not edit. See LAWS.bend and PROOF.bend.\n// Includes adapted Bend runtime/Base code, Copyright 2026 HigherOrderCO, Apache-2.0.\n//
|
|
134
|
+
banner: { js: `// Generated by Bend ${version}; do not edit. See LAWS.bend and PROOF.bend.\n// Includes adapted Bend runtime/Base code, Copyright 2026 HigherOrderCO, Apache-2.0.\n// ABI exports selected and tags adapted by Pi Fabric; see THIRD_PARTY_NOTICES.md.` },
|
|
95
135
|
});
|
|
96
136
|
const pure = result.outputFiles[0].text;
|
|
97
137
|
const generatedAst = ts.createSourceFile("generated.js", pure, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
|
|
@@ -101,7 +141,7 @@ if (mode === "--artifact") {
|
|
|
101
141
|
// Check unmangled names before compacting compiler locals. ABI exports stay stable.
|
|
102
142
|
const generated = (await transform(pure, {
|
|
103
143
|
format: "esm", target: "es2022", minifyIdentifiers: true, minifySyntax: true, legalComments: "none",
|
|
104
|
-
banner: `// Generated by Bend ${version}; do not edit. See LAWS.bend and PROOF.bend.\n// Includes adapted Bend runtime/Base code, Copyright 2026 HigherOrderCO, Apache-2.0.\n//
|
|
144
|
+
banner: `// Generated by Bend ${version}; do not edit. See LAWS.bend and PROOF.bend.\n// Includes adapted Bend runtime/Base code, Copyright 2026 HigherOrderCO, Apache-2.0.\n// ABI exports selected and tags adapted by Pi Fabric; see THIRD_PARTY_NOTICES.md.`,
|
|
105
145
|
})).code;
|
|
106
146
|
const types = `// Generated ABI declarations; see ${target.abi}.\n` + read(target.types) + "\n" +
|
|
107
147
|
Object.entries(abi).map(([name, signature]) => {
|
|
@@ -107,6 +107,8 @@ Exception for an already-running trajectory executor: a failed nested handoff ca
|
|
|
107
107
|
|
|
108
108
|
## Automatic prewalk
|
|
109
109
|
|
|
110
|
+
`prewalk.plan` is only an executor handoff checkpoint when Fabric's armed advisory or checkpoint explicitly requests one. It is not a task planner, checklist, or acceptance-ledger store. Keep ordinary acceptance checks in reasoning or concise progress notes (no tool call). Discovery exposes the action only while this session owes a plan; once recorded, it disappears until another plan is required. Do not probe `prewalk.status` as a routine planning prerequisite; it is for diagnostics.
|
|
111
|
+
|
|
110
112
|
`/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.
|
|
111
113
|
|
|
112
114
|
The default `prewalk.mode: "in-place"` switches Main to the executor model at the finalized outer boundary and sends one hidden continuation as a passive context message. It carries the captured task text, the recorded plan, and — for foreign reasoning channels — a bounded advisory thinking digest. It does not spawn or wait for a child. The outer tool does not terminate: the same run continues on the executor model. The request-context hook supplies the canonical continuation exactly once even when competing user steers arrive before the persisted message; no extra completion-only turn is queued. After that continuation settles — or if a new session still has the executor selected, or prewalk is cancelled — Fabric restores the Main model captured at the switch. A failed return drops the arm instead of re-arming, preserves the captured Main model for a later session start or `/fabric reload`, and skips auto-arm while Main is still on the executor; explicit arming overrides. This mode requires full code mode but not enabled agents. `prewalk.requirePlan` (default on) gates the boundary on a recorded plan: an armed task owes `prewalk.plan({ outcome, steps, verification, risks })` inside `fabric_exec`, and a mutation boundary reached without one is withheld while Fabric delivers a hidden plan checkpoint. Main keeps working on the frontier model, and the handoff fires at the next successful mutation with the plan delivered in the executor's continuation or task — even when the `prewalk.plan` action result is discarded or the outer output is truncated. Fabric asks at most twice per task, then hands off unplanned with a visible warning. A plan is dropped when the task changes, cancelling or reloading resets readiness, and explicit `agents.handoff()` is never gated.
|