@e4779/pi-fabric 0.117.2-fork.31 → 0.131.0-fork.32
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/README.md +12 -5
- package/THIRD_PARTY_NOTICES.md +6 -14
- package/dist/activity/store.d.ts +2 -1
- package/dist/activity/store.d.ts.map +1 -1
- package/dist/actors/binding-store.d.ts +13 -0
- package/dist/actors/binding-store.d.ts.map +1 -1
- package/dist/actors/directory.d.ts.map +1 -1
- package/dist/actors/global-registry.d.ts +8 -0
- package/dist/actors/global-registry.d.ts.map +1 -1
- package/dist/actors/host-event-payload.d.ts +14 -0
- package/dist/actors/host-event-payload.d.ts.map +1 -1
- package/dist/actors/manager.d.ts +4 -3
- package/dist/actors/manager.d.ts.map +1 -1
- package/dist/actors/mesh-monitor.d.ts +2 -0
- package/dist/actors/mesh-monitor.d.ts.map +1 -1
- package/dist/actors/name-policy.d.ts +3 -0
- package/dist/actors/name-policy.d.ts.map +1 -0
- package/dist/actors/registry-store.d.ts +14 -5
- package/dist/actors/registry-store.d.ts.map +1 -1
- package/dist/actors/store-read.d.ts +16 -0
- package/dist/actors/store-read.d.ts.map +1 -0
- package/dist/agents/agent-files.d.ts +80 -0
- package/dist/agents/agent-files.d.ts.map +1 -0
- package/dist/agents/agent-files.js +327 -0
- package/dist/agents/agent-files.js.map +7 -0
- package/dist/agents/child-skills.d.ts +60 -0
- package/dist/agents/child-skills.d.ts.map +1 -0
- package/dist/agents/child-skills.js +94 -0
- package/dist/agents/child-skills.js.map +7 -0
- package/dist/agents/clone-first-worktree.d.ts +6 -0
- package/dist/agents/clone-first-worktree.d.ts.map +1 -1
- package/dist/agents/cow-clone.d.ts.map +1 -1
- package/dist/agents/handoff.d.ts +12 -2
- package/dist/agents/handoff.d.ts.map +1 -1
- package/dist/agents/herdr-status.d.ts +26 -0
- package/dist/agents/herdr-status.d.ts.map +1 -0
- package/dist/agents/herdr-status.js +161 -0
- package/dist/agents/herdr-status.js.map +7 -0
- package/dist/agents/hosted-run.d.ts +20 -4
- package/dist/agents/hosted-run.d.ts.map +1 -1
- package/dist/agents/manager.d.ts +18 -2
- package/dist/agents/manager.d.ts.map +1 -1
- package/dist/agents/model-pin-guard.d.ts +27 -0
- package/dist/agents/model-pin-guard.d.ts.map +1 -0
- package/dist/agents/model-pin-guard.js +86 -0
- package/dist/agents/model-pin-guard.js.map +7 -0
- package/dist/agents/model-pin.d.ts +25 -0
- package/dist/agents/model-pin.d.ts.map +1 -0
- package/dist/agents/provider-bridge.d.ts +7 -6
- package/dist/agents/provider-bridge.d.ts.map +1 -1
- package/dist/agents/provider-bridge.js +33 -5
- package/dist/agents/provider-bridge.js.map +3 -3
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/result.d.ts.map +1 -1
- package/dist/agents/result.js +1 -1
- package/dist/agents/runner-notice.d.ts.map +1 -1
- package/dist/agents/runner-protocol.d.ts +8 -0
- package/dist/agents/runner-protocol.d.ts.map +1 -1
- package/dist/agents/service-schema.d.ts.map +1 -1
- package/dist/agents/transports/herdr-socket.d.ts +12 -0
- package/dist/agents/transports/herdr-socket.d.ts.map +1 -0
- package/dist/agents/transports/herdr-transport.d.ts.map +1 -1
- package/dist/agents/types.d.ts +51 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/worker-recovery.d.ts +75 -0
- package/dist/agents/worker-recovery.d.ts.map +1 -0
- package/dist/agents/worktree-manager.d.ts.map +1 -1
- package/dist/agents.js +12 -11
- package/dist/agents.js.map +2 -2
- package/dist/audit/details.d.ts +36 -1
- package/dist/audit/details.d.ts.map +1 -1
- package/dist/audit/projection.d.ts.map +1 -1
- package/dist/audit/trace-schema.d.ts +50 -0
- package/dist/audit/trace-schema.d.ts.map +1 -0
- package/dist/audit/trace.d.ts +2 -48
- package/dist/audit/trace.d.ts.map +1 -1
- package/dist/chunks/chunk-2RWNVCFD.js +483 -0
- package/dist/chunks/chunk-2RWNVCFD.js.map +7 -0
- package/dist/chunks/chunk-2SCMGO2Z.js +16 -0
- package/dist/chunks/chunk-2SCMGO2Z.js.map +7 -0
- package/dist/chunks/chunk-35EEGOH3.js +324 -0
- package/dist/chunks/chunk-35EEGOH3.js.map +7 -0
- package/dist/chunks/{chunk-3FJUP3GV.js → chunk-36XQFTEN.js} +2 -2
- package/dist/chunks/{chunk-UTOBAZ5T.js → chunk-37NIOSVU.js} +1 -1
- package/dist/chunks/chunk-37NIOSVU.js.map +7 -0
- package/dist/chunks/chunk-3IJEQBFS.js +25 -0
- package/dist/chunks/chunk-3IJEQBFS.js.map +7 -0
- package/dist/chunks/{chunk-EHQQ4KCX.js → chunk-3MOY6WIB.js} +84 -19
- package/dist/chunks/chunk-3MOY6WIB.js.map +7 -0
- package/dist/chunks/chunk-3PKZSIRA.js +1312 -0
- package/dist/chunks/chunk-3PKZSIRA.js.map +7 -0
- package/dist/chunks/chunk-3VK6UGAN.js +64 -0
- package/dist/chunks/chunk-3VK6UGAN.js.map +7 -0
- package/dist/chunks/{chunk-ROTCDDOV.js → chunk-3XT5WHSG.js} +59 -119
- package/dist/chunks/chunk-3XT5WHSG.js.map +7 -0
- package/dist/chunks/{chunk-FIDUHKMM.js → chunk-4BYS4ZLY.js} +16 -16
- package/dist/chunks/chunk-4BYS4ZLY.js.map +7 -0
- package/dist/chunks/{chunk-K7J2ABAZ.js → chunk-4KX6BIPL.js} +91 -31
- package/dist/chunks/chunk-4KX6BIPL.js.map +7 -0
- package/dist/chunks/{chunk-UOM37PE4.js → chunk-4PBW54I2.js} +162 -92
- package/dist/chunks/chunk-4PBW54I2.js.map +7 -0
- package/dist/chunks/{chunk-ZEXCKK4K.js → chunk-4WKD3YM3.js} +3 -3
- package/dist/chunks/{chunk-PK4NIJEV.js → chunk-4XMXFHAR.js} +62 -3
- package/dist/chunks/chunk-4XMXFHAR.js.map +7 -0
- package/dist/chunks/{chunk-4EW7GVUR.js → chunk-56NMRVTV.js} +589 -377
- package/dist/chunks/chunk-56NMRVTV.js.map +7 -0
- package/dist/chunks/{chunk-GIK2WNAK.js → chunk-5BOTHX47.js} +109 -20
- package/dist/chunks/chunk-5BOTHX47.js.map +7 -0
- package/dist/chunks/chunk-5QJFDKPN.js +179 -0
- package/dist/chunks/chunk-5QJFDKPN.js.map +7 -0
- package/dist/chunks/{chunk-P7CBPPHY.js → chunk-6GWDGTHC.js} +5 -5
- package/dist/chunks/{chunk-P7CBPPHY.js.map → chunk-6GWDGTHC.js.map} +1 -1
- package/dist/chunks/chunk-6HO2IUQ5.js +104 -0
- package/dist/chunks/chunk-6HO2IUQ5.js.map +7 -0
- package/dist/chunks/chunk-6OGYPHNQ.js +62 -0
- package/dist/chunks/chunk-6OGYPHNQ.js.map +7 -0
- package/dist/chunks/{chunk-GO32KSEZ.js → chunk-7CIES6X2.js} +84 -9
- package/dist/chunks/chunk-7CIES6X2.js.map +7 -0
- package/dist/chunks/{chunk-G4TLWHRS.js → chunk-7N7IC3Z2.js} +4 -3
- package/dist/chunks/{chunk-G4TLWHRS.js.map → chunk-7N7IC3Z2.js.map} +2 -2
- package/dist/chunks/{chunk-5XBYFSI5.js → chunk-7YNE4NB2.js} +2 -2
- package/dist/chunks/{chunk-NTC2MCB6.js → chunk-B5L3X3ID.js} +1 -1
- package/dist/chunks/{chunk-NTC2MCB6.js.map → chunk-B5L3X3ID.js.map} +1 -1
- package/dist/chunks/chunk-BIBRWZWQ.js +325 -0
- package/dist/chunks/chunk-BIBRWZWQ.js.map +7 -0
- package/dist/chunks/{chunk-K6QXUGS5.js → chunk-BMAEZNZ5.js} +2 -1
- package/dist/chunks/{chunk-FSB2VIRZ.js → chunk-CBIV747V.js} +14 -3
- package/dist/chunks/chunk-CBIV747V.js.map +7 -0
- package/dist/chunks/{chunk-CCHZXF6K.js → chunk-CXYJJ3HZ.js} +3 -3
- package/dist/chunks/{chunk-R2XQ6AHT.js → chunk-DGERP4VL.js} +22 -10
- package/dist/chunks/chunk-DGERP4VL.js.map +7 -0
- package/dist/chunks/chunk-F2LGSRIN.js +38 -0
- package/dist/chunks/chunk-F2LGSRIN.js.map +7 -0
- package/dist/chunks/chunk-F6A6MQ6G.js +609 -0
- package/dist/chunks/chunk-F6A6MQ6G.js.map +7 -0
- package/dist/chunks/{chunk-IR3PIHJM.js → chunk-FK73YJKV.js} +67 -2
- package/dist/chunks/chunk-FK73YJKV.js.map +7 -0
- package/dist/chunks/{chunk-VYQV5JRT.js → chunk-GJVKEHDL.js} +2 -2
- package/dist/chunks/chunk-GJVKEHDL.js.map +7 -0
- package/dist/chunks/{chunk-TIIIHPHF.js → chunk-GS67KDMV.js} +2 -2
- package/dist/chunks/{chunk-D5NYNIST.js → chunk-H57KPL3V.js} +5 -5
- package/dist/chunks/{chunk-KVYNGDGC.js → chunk-HFDJWLMS.js} +6 -6
- package/dist/chunks/{chunk-KVYNGDGC.js.map → chunk-HFDJWLMS.js.map} +1 -1
- package/dist/chunks/{chunk-INRXG4J5.js → chunk-HGD75NZY.js} +2 -2
- package/dist/chunks/{chunk-CRRUW26I.js → chunk-HRDMBGMY.js} +12 -12
- package/dist/chunks/{chunk-CRRUW26I.js.map → chunk-HRDMBGMY.js.map} +2 -2
- package/dist/chunks/{chunk-MLLYR3Y6.js → chunk-HSEZPCL5.js} +19 -78
- package/dist/chunks/chunk-HSEZPCL5.js.map +7 -0
- package/dist/chunks/{chunk-LNASO4VT.js → chunk-IOGDTIGN.js} +44 -19
- package/dist/chunks/chunk-IOGDTIGN.js.map +7 -0
- package/dist/chunks/chunk-JMUUNW2H.js +65 -0
- package/dist/chunks/chunk-JMUUNW2H.js.map +7 -0
- package/dist/chunks/{chunk-UXIBKMUM.js → chunk-KIFOEBYJ.js} +4 -4
- package/dist/chunks/{chunk-SPCJXN4K.js → chunk-LKYLD5SN.js} +298 -65
- package/dist/chunks/chunk-LKYLD5SN.js.map +7 -0
- package/dist/chunks/{chunk-FUY6XVRX.js → chunk-MPMEK3IQ.js} +2 -2
- package/dist/chunks/{chunk-HP5P7NBO.js → chunk-MSDL7U6Q.js} +4 -4
- package/dist/chunks/chunk-N7ZAK2PB.js +132 -0
- package/dist/chunks/chunk-N7ZAK2PB.js.map +7 -0
- package/dist/chunks/{chunk-VSDUSNIA.js → chunk-NBIYYMKS.js} +8 -2
- package/dist/chunks/chunk-NBIYYMKS.js.map +7 -0
- package/dist/chunks/chunk-NENQZCGW.js +45 -0
- package/dist/chunks/chunk-NENQZCGW.js.map +7 -0
- package/dist/chunks/chunk-NJHJKINP.js +47 -0
- package/dist/chunks/chunk-NJHJKINP.js.map +7 -0
- package/dist/chunks/{chunk-U366I5K2.js → chunk-NQ7IWEIF.js} +18 -6
- package/dist/chunks/chunk-NQ7IWEIF.js.map +7 -0
- package/dist/chunks/{chunk-ZQMBS5SH.js → chunk-OJ4HAALD.js} +15 -12
- package/dist/chunks/chunk-OJ4HAALD.js.map +7 -0
- package/dist/chunks/chunk-OZCJU3PZ.js +33 -0
- package/dist/chunks/chunk-OZCJU3PZ.js.map +7 -0
- package/dist/chunks/chunk-P3DCXKL3.js +40 -0
- package/dist/chunks/chunk-P3DCXKL3.js.map +7 -0
- package/dist/chunks/chunk-P7YSPKTM.js +294 -0
- package/dist/chunks/chunk-P7YSPKTM.js.map +7 -0
- package/dist/chunks/chunk-PQVUMJ5J.js +223 -0
- package/dist/chunks/chunk-PQVUMJ5J.js.map +7 -0
- package/dist/chunks/chunk-PUBHBEYO.js +84 -0
- package/dist/chunks/chunk-PUBHBEYO.js.map +7 -0
- package/dist/chunks/{chunk-P4KH4S4S.js → chunk-QGTD3LAZ.js} +5 -20
- package/dist/chunks/chunk-QGTD3LAZ.js.map +7 -0
- package/dist/chunks/{chunk-TIJ3YQXX.js → chunk-QOEOKW2X.js} +2 -2
- package/dist/chunks/{chunk-TIJ3YQXX.js.map → chunk-QOEOKW2X.js.map} +1 -1
- package/dist/chunks/{chunk-QT4W5YVB.js → chunk-RAA3FAYZ.js} +2 -2
- package/dist/chunks/{chunk-WJJXODAB.js → chunk-RLKRZXSX.js} +8 -1
- package/dist/chunks/{chunk-WJJXODAB.js.map → chunk-RLKRZXSX.js.map} +2 -2
- package/dist/chunks/chunk-RWKQ5SRW.js +129 -0
- package/dist/chunks/chunk-RWKQ5SRW.js.map +7 -0
- package/dist/chunks/chunk-SW25R47N.js +71 -0
- package/dist/chunks/chunk-SW25R47N.js.map +7 -0
- package/dist/chunks/{chunk-EFETPXU2.js → chunk-TJZYM2SP.js} +118 -237
- package/dist/chunks/chunk-TJZYM2SP.js.map +7 -0
- package/dist/chunks/{chunk-53N2I4QA.js → chunk-TXCNZCZP.js} +2 -2
- package/dist/chunks/chunk-UD7LFV43.js +28 -0
- package/dist/chunks/chunk-UD7LFV43.js.map +7 -0
- package/dist/chunks/{chunk-ASSLHWZS.js → chunk-UFMYN5TA.js} +2 -2
- package/dist/chunks/{chunk-7QKKLBHJ.js → chunk-UPMWLOKL.js} +10 -1
- package/dist/chunks/{chunk-7QKKLBHJ.js.map → chunk-UPMWLOKL.js.map} +2 -2
- package/dist/chunks/chunk-V4OW2ULC.js +422 -0
- package/dist/chunks/chunk-V4OW2ULC.js.map +7 -0
- package/dist/chunks/{chunk-FE6NOAO7.js → chunk-VNWQIGQL.js} +1820 -649
- package/dist/chunks/chunk-VNWQIGQL.js.map +7 -0
- package/dist/chunks/{chunk-PYFJW3HC.js → chunk-W5FEHVZA.js} +2 -16
- package/dist/chunks/{chunk-PYFJW3HC.js.map → chunk-W5FEHVZA.js.map} +3 -3
- package/dist/chunks/{chunk-XCEEQ5AB.js → chunk-WGMCNCP6.js} +1567 -1564
- package/dist/chunks/chunk-WGMCNCP6.js.map +7 -0
- package/dist/chunks/chunk-WKFRGICG.js +101 -0
- package/dist/chunks/chunk-WKFRGICG.js.map +7 -0
- package/dist/chunks/{chunk-3UGN25XS.js → chunk-WWTGWGH7.js} +80 -1662
- package/dist/chunks/chunk-WWTGWGH7.js.map +7 -0
- package/dist/chunks/{chunk-5UBRGTVN.js → chunk-X7QETPBC.js} +31 -15
- package/dist/chunks/chunk-X7QETPBC.js.map +7 -0
- package/dist/chunks/{chunk-LEU5CDSL.js → chunk-XFOSUGLU.js} +5 -5
- package/dist/chunks/{chunk-MZUC6LLH.js → chunk-XMYG2TKR.js} +4 -4
- package/dist/chunks/{chunk-MZUC6LLH.js.map → chunk-XMYG2TKR.js.map} +1 -1
- package/dist/chunks/chunk-YC65P7ZO.js +57 -0
- package/dist/chunks/chunk-YC65P7ZO.js.map +7 -0
- package/dist/chunks/{chunk-EKODKR6Y.js → chunk-YHFWMAQ5.js} +1 -24
- package/dist/chunks/chunk-YHFWMAQ5.js.map +7 -0
- package/dist/chunks/{chunk-C7Z6F3SO.js → chunk-ZFWICFNJ.js} +27 -20
- package/dist/chunks/{chunk-C7Z6F3SO.js.map → chunk-ZFWICFNJ.js.map} +2 -2
- package/dist/cli/decisions.d.ts.map +1 -1
- package/dist/cli/decisions.js +15 -3
- package/dist/cli/decisions.js.map +2 -2
- package/dist/cli/mesh.js +4 -3
- package/dist/cli/mesh.js.map +1 -1
- package/dist/commands/fabric-handler.d.ts +7 -0
- package/dist/commands/fabric-handler.d.ts.map +1 -0
- package/dist/commands/fabric-handler.js +916 -0
- package/dist/commands/fabric-handler.js.map +7 -0
- package/dist/commands/fabric.d.ts +11 -1
- package/dist/commands/fabric.d.ts.map +1 -1
- package/dist/compaction/claim-events.d.ts +61 -0
- package/dist/compaction/claim-events.d.ts.map +1 -0
- package/dist/compaction/claim-events.js +210 -0
- package/dist/compaction/claim-events.js.map +7 -0
- package/dist/compaction/claim.d.ts +51 -0
- package/dist/compaction/claim.d.ts.map +1 -0
- package/dist/compaction/hook.d.ts +28 -2
- package/dist/compaction/hook.d.ts.map +1 -1
- package/dist/compaction/hook.js +12 -7
- package/dist/compaction/owner.js +9 -8
- package/dist/compaction/trace-events.d.ts +1 -1
- package/dist/compaction/trace-events.d.ts.map +1 -1
- package/dist/components/configuration.js +6 -6
- package/dist/components/effect-scope.d.ts.map +1 -1
- package/dist/config.d.ts +39 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/core/action-arguments.d.ts.map +1 -1
- package/dist/core/action-policy-hooks.d.ts +69 -0
- package/dist/core/action-policy-hooks.d.ts.map +1 -0
- package/dist/core/action-registry.d.ts +31 -10
- package/dist/core/action-registry.d.ts.map +1 -1
- package/dist/core/action-registry.js +12 -9
- package/dist/core/approval-controller.d.ts +23 -3
- package/dist/core/approval-controller.d.ts.map +1 -1
- package/dist/core/atomic-write.d.ts +164 -0
- package/dist/core/atomic-write.d.ts.map +1 -1
- package/dist/core/child-tool-allowlist.d.ts +17 -1
- package/dist/core/child-tool-allowlist.d.ts.map +1 -1
- package/dist/core/compact-controller.d.ts +34 -0
- package/dist/core/compact-controller.d.ts.map +1 -1
- package/dist/core/core-override-guidance.d.ts +3 -1
- package/dist/core/core-override-guidance.d.ts.map +1 -1
- package/dist/core/file-lock.d.ts.map +1 -1
- package/dist/core/foreground-tools.d.ts +4 -1
- package/dist/core/foreground-tools.d.ts.map +1 -1
- package/dist/core/host-policy.d.ts +43 -0
- package/dist/core/host-policy.d.ts.map +1 -0
- package/dist/core/host-sdk-runtime.d.ts.map +1 -1
- package/dist/core/host-sdk.d.ts.map +1 -1
- package/dist/core/host-sdk.js +1 -1
- package/dist/core/managed-host-guidance.d.ts +5 -0
- package/dist/core/managed-host-guidance.d.ts.map +1 -0
- package/dist/core/model-aliases.d.ts +22 -0
- package/dist/core/model-aliases.d.ts.map +1 -0
- package/dist/core/model-resolution.d.ts +41 -20
- package/dist/core/model-resolution.d.ts.map +1 -1
- package/dist/core/native-tool-result.d.ts +1 -0
- package/dist/core/native-tool-result.d.ts.map +1 -1
- package/dist/core/program-tasks.d.ts +52 -0
- package/dist/core/program-tasks.d.ts.map +1 -0
- package/dist/core/prompt-guidance.d.ts +5 -0
- package/dist/core/prompt-guidance.d.ts.map +1 -0
- package/dist/core/prompt-guidance.js +159 -0
- package/dist/core/prompt-guidance.js.map +7 -0
- package/dist/core/provider-operations.d.ts.map +1 -1
- package/dist/core/provider-operations.js +60 -108
- package/dist/core/provider-operations.js.map +3 -3
- package/dist/core/shell-inbox.d.ts.map +1 -1
- package/dist/core/shell-jobs.d.ts +7 -5
- package/dist/core/shell-jobs.d.ts.map +1 -1
- package/dist/core/shell-timing.d.ts.map +1 -1
- package/dist/core/skill-prompt.d.ts +1 -1
- package/dist/core/skill-prompt.d.ts.map +1 -1
- package/dist/core/skill-references.d.ts +1 -1
- package/dist/core/skill-references.d.ts.map +1 -1
- package/dist/core/system-guidance.d.ts.map +1 -1
- package/dist/core/tool-result-proxy.d.ts.map +1 -1
- package/dist/decisions/command.d.ts +2 -1
- package/dist/decisions/command.d.ts.map +1 -1
- package/dist/decisions/command.js +40 -12
- package/dist/decisions/command.js.map +2 -2
- package/dist/decisions/events.d.ts +12 -0
- package/dist/decisions/events.d.ts.map +1 -0
- package/dist/decisions/events.js +130 -0
- package/dist/decisions/events.js.map +7 -0
- package/dist/decisions/host.d.ts +31 -3
- package/dist/decisions/host.d.ts.map +1 -1
- package/dist/decisions/render.d.ts +44 -0
- package/dist/decisions/render.d.ts.map +1 -0
- package/dist/decisions/store.d.ts +8 -0
- package/dist/decisions/store.d.ts.map +1 -1
- package/dist/durable/agent.d.ts +8 -0
- package/dist/durable/agent.d.ts.map +1 -1
- package/dist/durable/extension-load-error.d.ts +8 -0
- package/dist/durable/extension-load-error.d.ts.map +1 -0
- package/dist/durable/session.d.ts +1 -0
- package/dist/durable/session.d.ts.map +1 -1
- package/dist/durable/worker-host.d.ts +10 -1
- package/dist/durable/worker-host.d.ts.map +1 -1
- package/dist/durable/worker-host.js +10 -1181
- package/dist/durable/worker-host.js.map +4 -4
- package/dist/durable/worker-options.d.ts +3 -0
- package/dist/durable/worker-options.d.ts.map +1 -1
- package/dist/durable/worker-role-seed.d.ts +82 -0
- package/dist/durable/worker-role-seed.d.ts.map +1 -0
- package/dist/durable/worker.js +43 -4
- package/dist/durable/worker.js.map +2 -2
- package/dist/durable-controls.d.ts.map +1 -1
- package/dist/durable-extension-wasm.d.ts +8 -0
- package/dist/durable-extension-wasm.d.ts.map +1 -0
- package/dist/durable-extension-wasm.js +32 -0
- package/dist/durable-extension-wasm.js.map +7 -0
- package/dist/durable-extension.d.ts +94 -0
- package/dist/durable-extension.d.ts.map +1 -0
- package/dist/durable-extension.js +649 -0
- package/dist/durable-extension.js.map +7 -0
- package/dist/durable-host.d.ts +8 -0
- package/dist/durable-host.d.ts.map +1 -0
- package/dist/durable-host.js +20 -0
- package/dist/durable-host.js.map +7 -0
- package/dist/durable-journal.d.ts +94 -0
- package/dist/durable-journal.d.ts.map +1 -0
- package/dist/durable.d.ts.map +1 -1
- package/dist/durable.js +10 -8
- package/dist/durable.js.map +2 -2
- package/dist/entropy/index.js +12 -10
- package/dist/entropy/pool-store.d.ts.map +1 -1
- package/dist/execution-service.d.ts +14 -0
- package/dist/execution-service.d.ts.map +1 -1
- package/dist/extension-bootstrap.d.ts.map +1 -1
- package/dist/extension-bootstrap.js +28 -27
- package/dist/extension-bootstrap.js.map +2 -2
- package/dist/extension-copy.d.ts +21 -0
- package/dist/extension-copy.d.ts.map +1 -0
- package/dist/extension-copy.js +90 -0
- package/dist/extension-copy.js.map +7 -0
- package/dist/extension.d.ts +1 -1
- package/dist/extension.d.ts.map +1 -1
- package/dist/fabric-exec-arguments.d.ts.map +1 -1
- package/dist/fabric-exec-tool.d.ts +2 -1
- package/dist/fabric-exec-tool.d.ts.map +1 -1
- package/dist/fabric-runtime-state.d.ts +19 -0
- package/dist/fabric-runtime-state.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +2125 -786
- package/dist/fabric-runtime-state.js.map +4 -4
- package/dist/fabric-state.d.ts +44 -1
- package/dist/fabric-state.d.ts.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +88 -53
- package/dist/index.js.map +2 -2
- package/dist/jev/client.js +2 -2
- package/dist/jev/manager.d.ts +3 -0
- package/dist/jev/manager.d.ts.map +1 -1
- package/dist/jev/observation.d.ts +1 -1
- package/dist/jev/observation.js +6 -6
- package/dist/jev-fabric/bridge.d.ts.map +1 -1
- package/dist/jev.js +11 -12
- package/dist/managed-host.d.ts +13 -0
- package/dist/managed-host.d.ts.map +1 -1
- package/dist/memory/digest.js +2 -2
- package/dist/memory/discovery.js +6 -7
- package/dist/memory/file-worker.js +10 -11
- package/dist/memory/file-worker.js.map +1 -1
- package/dist/memory/normalize.js +5 -6
- package/dist/memory/search.js +7 -8
- package/dist/memory/worker-provider.js +11 -12
- package/dist/memory.js +11 -12
- package/dist/memory.js.map +1 -1
- package/dist/mesh/grants.d.ts +3 -3
- package/dist/mesh/grants.d.ts.map +1 -1
- package/dist/mesh/store.d.ts +8 -0
- package/dist/mesh/store.d.ts.map +1 -1
- package/dist/native-codemode.d.ts.map +1 -1
- package/dist/native-tool-catalog.d.ts.map +1 -1
- package/dist/native-tool-catalog.js +12 -3
- package/dist/native-tool-catalog.js.map +2 -2
- package/dist/programs/host.d.ts +18 -6
- package/dist/programs/host.d.ts.map +1 -1
- package/dist/programs/host.js +71 -47
- package/dist/programs/host.js.map +2 -2
- package/dist/programs/source.d.ts +11 -0
- package/dist/programs/source.d.ts.map +1 -1
- package/dist/programs/store.d.ts.map +1 -1
- package/dist/protocol.d.ts +504 -8
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +41 -11
- package/dist/provider-globals.d.ts +13 -0
- package/dist/provider-globals.d.ts.map +1 -0
- package/dist/providers/agents-actions.d.ts.map +1 -1
- package/dist/providers/agents-provider.d.ts +3 -0
- package/dist/providers/agents-provider.d.ts.map +1 -1
- package/dist/providers/captured-tools-provider.d.ts +5 -0
- package/dist/providers/captured-tools-provider.d.ts.map +1 -1
- package/dist/providers/compact-provider.d.ts +4 -1
- package/dist/providers/compact-provider.d.ts.map +1 -1
- package/dist/providers/components-provider.d.ts.map +1 -1
- package/dist/providers/decisions-provider.d.ts +9 -1
- package/dist/providers/decisions-provider.d.ts.map +1 -1
- package/dist/providers/jev-provider.d.ts +1 -1
- package/dist/providers/jev-provider.js +11 -12
- package/dist/providers/memory-provider.js +10 -11
- package/dist/providers/pi-tools-provider.d.ts +14 -0
- package/dist/providers/pi-tools-provider.d.ts.map +1 -1
- package/dist/providers/programs-provider.d.ts.map +1 -1
- package/dist/providers/sessions-provider.d.ts +7 -0
- package/dist/providers/sessions-provider.d.ts.map +1 -1
- package/dist/repeat-guard.d.ts +7 -6
- package/dist/repeat-guard.d.ts.map +1 -1
- package/dist/residency/actor-client.js +3 -3
- package/dist/residency/client.d.ts +15 -0
- package/dist/residency/client.d.ts.map +1 -1
- package/dist/residency/host.d.ts.map +1 -1
- package/dist/residency/host.js +34 -23
- package/dist/residency/launcher.js +1 -1
- package/dist/residency/pi-entry.js +34 -23
- package/dist/residency/pi-entry.js.map +1 -1
- package/dist/residency/protocol.d.ts +2 -0
- package/dist/residency/protocol.d.ts.map +1 -1
- package/dist/runners.js +11 -1
- package/dist/runners.js.map +2 -2
- package/dist/runtime/core-override-guest-types.js +2 -2
- package/dist/runtime/cpython-child-source.d.ts.map +1 -1
- package/dist/runtime/cpython-runtime.d.ts.map +1 -1
- package/dist/runtime/cpython-runtime.js +51 -21
- package/dist/runtime/cpython-runtime.js.map +2 -2
- package/dist/runtime/deadline-pause.d.ts +2 -0
- package/dist/runtime/deadline-pause.d.ts.map +1 -1
- package/dist/runtime/dynamic-guest-types.d.ts.map +1 -1
- package/dist/runtime/dynamic-guest-types.js +2 -1
- package/dist/runtime/exec-journal.d.ts +73 -0
- package/dist/runtime/exec-journal.d.ts.map +1 -0
- package/dist/runtime/exec-journal.js +335 -0
- package/dist/runtime/exec-journal.js.map +7 -0
- package/dist/runtime/guest-types.d.ts +3 -2
- package/dist/runtime/guest-types.d.ts.map +1 -1
- package/dist/runtime/guest-types.js +1 -1
- package/dist/runtime/journal-shim.d.ts +3 -0
- package/dist/runtime/journal-shim.d.ts.map +1 -0
- package/dist/runtime/kernel.d.ts +95 -1
- package/dist/runtime/kernel.d.ts.map +1 -1
- package/dist/runtime/monty-bridge.d.ts +6 -2
- package/dist/runtime/monty-bridge.d.ts.map +1 -1
- package/dist/runtime/monty-runtime.d.ts.map +1 -1
- package/dist/runtime/monty-runtime.js +27 -15
- package/dist/runtime/monty-runtime.js.map +2 -2
- package/dist/runtime/native-codemode-guest.d.ts.map +1 -1
- package/dist/runtime/node-process-runtime.d.ts.map +1 -1
- package/dist/runtime/node-process-runtime.js +7 -5
- package/dist/runtime/quickjs-runtime.d.ts +7 -1
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
- package/dist/runtime/quickjs-runtime.js +5 -4
- package/dist/runtime/sha256.d.ts +4 -0
- package/dist/runtime/sha256.d.ts.map +1 -0
- package/dist/runtime/transpile.d.ts +8 -0
- package/dist/runtime/transpile.d.ts.map +1 -0
- package/dist/runtime/type-checker.d.ts +1 -7
- package/dist/runtime/type-checker.d.ts.map +1 -1
- package/dist/runtime/type-checker.js +4 -2
- package/dist/runtime/typescript-kernel.js +13 -10
- package/dist/runtime/typescript-kernel.js.map +1 -1
- package/dist/runtime-state-builtins.d.ts.map +1 -1
- package/dist/speculation/scanner.js +1 -1
- package/dist/speculation/store.d.ts +7 -16
- package/dist/speculation/store.d.ts.map +1 -1
- package/dist/speculation/types.d.ts +1 -0
- package/dist/speculation/types.d.ts.map +1 -1
- package/dist/storage/retention.d.ts.map +1 -1
- package/dist/topology/participant-directory.d.ts +26 -1
- package/dist/topology/participant-directory.d.ts.map +1 -1
- package/dist/topology/peer-presence.d.ts.map +1 -1
- package/dist/topology/peer-settle.js +11 -0
- package/dist/topology/peer-settle.js.map +7 -0
- package/dist/topology/session-label-settings.d.ts +13 -0
- package/dist/topology/session-label-settings.d.ts.map +1 -0
- package/dist/topology/session-label.d.ts +60 -0
- package/dist/topology/session-label.d.ts.map +1 -0
- package/dist/topology/types.d.ts +27 -0
- package/dist/topology/types.d.ts.map +1 -1
- package/dist/type-error-guidance.js +1 -1
- package/dist/ui/controller.d.ts +1 -0
- package/dist/ui/controller.d.ts.map +1 -1
- package/dist/ui/conversation-chrome.d.ts.map +1 -1
- package/dist/ui/conversation-chrome.js +3 -2
- package/dist/ui/conversation-commands.d.ts +1 -1
- package/dist/ui/conversation-commands.d.ts.map +1 -1
- package/dist/ui/conversation-native-reader.js +2 -2
- package/dist/ui/conversation-selection.d.ts +4 -1
- package/dist/ui/conversation-selection.d.ts.map +1 -1
- package/dist/ui/conversation-targets.d.ts.map +1 -1
- package/dist/ui/conversation-targets.js +2 -2
- package/dist/ui/conversation.d.ts +25 -24
- package/dist/ui/conversation.d.ts.map +1 -1
- package/dist/ui/conversation.js +170 -339
- package/dist/ui/conversation.js.map +2 -2
- package/dist/ui/core-tool-render.d.ts +1 -0
- package/dist/ui/core-tool-render.d.ts.map +1 -1
- package/dist/ui/dashboard.d.ts.map +1 -1
- package/dist/ui/dashboard.js +17 -13
- package/dist/ui/dashboard.js.map +2 -2
- package/dist/ui/fabric-render.d.ts +6 -0
- package/dist/ui/fabric-render.d.ts.map +1 -1
- package/dist/ui/footer-dock.d.ts +48 -0
- package/dist/ui/footer-dock.d.ts.map +1 -0
- package/dist/ui/format.d.ts +7 -0
- package/dist/ui/format.d.ts.map +1 -1
- package/dist/ui/settings-sections-lifecycle.d.ts.map +1 -1
- package/dist/ui/settings-sections-presentation.d.ts.map +1 -1
- package/dist/ui/settings-values.d.ts +1 -0
- package/dist/ui/settings-values.d.ts.map +1 -1
- package/dist/ui/settings.js +59 -18
- package/dist/ui/settings.js.map +2 -2
- package/dist/ui/shell-hang-keys.d.ts +8 -1
- package/dist/ui/shell-hang-keys.d.ts.map +1 -1
- package/dist/ui/shell-tasks.d.ts +2 -2
- package/dist/ui/shell-tasks.d.ts.map +1 -1
- package/dist/ui/shell-tasks.js +27 -94
- package/dist/ui/shell-tasks.js.map +2 -2
- package/dist/ui/snapshot.d.ts.map +1 -1
- package/dist/ui/terminal-title.d.ts +41 -0
- package/dist/ui/terminal-title.d.ts.map +1 -0
- package/dist/ui/types.d.ts +4 -0
- package/dist/ui/types.d.ts.map +1 -1
- package/dist/ui/widget-keys.d.ts +5 -0
- package/dist/ui/widget-keys.d.ts.map +1 -0
- package/dist/ui/widget.d.ts +34 -16
- package/dist/ui/widget.d.ts.map +1 -1
- package/dist/ui/word-diff/line-emphasis.js +1603 -0
- package/dist/ui/word-diff/line-emphasis.js.map +7 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/verified/authority.d.ts +2 -2
- package/dist/verified/authority.d.ts.map +1 -1
- package/dist/verified/budget.d.ts +4 -0
- package/dist/verified/budget.d.ts.map +1 -0
- package/dist/verified/generated/actor-name.d.ts +4 -0
- package/dist/verified/generated/actor-name.js +17 -0
- package/dist/verified/generated/authority.d.ts +4 -0
- package/dist/verified/generated/authority.js +28 -0
- package/dist/verified/generated/budget.d.ts +4 -0
- package/dist/verified/generated/budget.js +17 -0
- package/dist/verified/generated/compaction.d.ts +4 -0
- package/dist/verified/generated/compaction.js +19 -0
- package/dist/verified/generated/grants.d.ts +4 -0
- package/dist/verified/generated/grants.js +17 -0
- package/dist/verified/generated/lifecycle.d.ts +4 -0
- package/dist/verified/generated/lifecycle.js +50 -0
- package/dist/verified/generated/manifest.json +137 -48
- package/dist/verified/generated/policy.d.ts +17 -0
- package/dist/verified/generated/policy.js +211 -0
- package/dist/verified/generated/provider.d.ts +4 -0
- package/dist/verified/generated/provider.js +18 -0
- package/dist/verified/generated/resources.d.ts +6 -0
- package/dist/verified/generated/resources.js +73 -0
- package/dist/verified/generated/speculation.d.ts +6 -0
- package/dist/verified/generated/speculation.js +48 -0
- package/dist/verified/generated/storage.d.ts +4 -0
- package/dist/verified/generated/storage.js +18 -0
- package/dist/verified/grants.d.ts +22 -0
- package/dist/verified/grants.d.ts.map +1 -0
- package/dist/verified/lifecycle.d.ts +31 -0
- package/dist/verified/lifecycle.d.ts.map +1 -0
- package/dist/verified/machine.d.ts +18 -0
- package/dist/verified/machine.d.ts.map +1 -0
- package/dist/verified/memory.d.ts +1 -1
- package/dist/verified/memory.d.ts.map +1 -1
- package/dist/verified/nat.d.ts +1 -1
- package/dist/verified/nat.d.ts.map +1 -1
- package/dist/verified/policy.d.ts +17 -5
- package/dist/verified/policy.d.ts.map +1 -1
- package/dist/verified/provider.d.ts +22 -0
- package/dist/verified/provider.d.ts.map +1 -0
- package/dist/verified/resources.d.ts +21 -7
- package/dist/verified/resources.d.ts.map +1 -1
- package/dist/verified/speculation.d.ts +36 -0
- package/dist/verified/speculation.d.ts.map +1 -0
- package/dist/verified/storage.d.ts.map +1 -1
- package/dist/worker/missing-install.d.ts +8 -0
- package/dist/worker/missing-install.d.ts.map +1 -0
- package/dist/worker/options.d.ts.map +1 -1
- package/dist/worker/options.js +25 -0
- package/dist/worker/options.js.map +2 -2
- package/dist/worker/prompt-lifecycle.d.ts +16 -0
- package/dist/worker/prompt-lifecycle.d.ts.map +1 -0
- package/dist/worker/prompt-lifecycle.js +90 -0
- package/dist/worker/prompt-lifecycle.js.map +7 -0
- package/dist/worker/questions.d.ts +15 -3
- package/dist/worker/questions.d.ts.map +1 -1
- package/dist/worker/questions.js +53 -8
- package/dist/worker/questions.js.map +2 -2
- package/dist/worker/recovery-watchdog.d.ts +22 -0
- package/dist/worker/recovery-watchdog.d.ts.map +1 -1
- package/dist/worker/recovery-watchdog.js +116 -1
- package/dist/worker/recovery-watchdog.js.map +2 -2
- package/dist/worker/result.js +1 -1
- package/dist/worker/result.js.map +2 -2
- package/dist/worker.js +131 -21
- package/dist/worker.js.map +2 -2
- package/docs/actor-name-policy-handoff.md +5 -0
- package/docs/agents.md +164 -17
- package/docs/architecture.md +5 -1
- package/docs/audit-trace.md +2 -1
- package/docs/background-tasks.md +102 -16
- package/docs/codemode-parity.md +2 -2
- package/docs/compaction.md +21 -5
- package/docs/components.md +1 -1
- package/docs/configuration.md +111 -66
- package/docs/decisions.md +92 -10
- package/docs/durable-extension.md +121 -0
- package/docs/durable-pi.md +306 -6
- package/docs/extractive-history.md +3 -1
- package/docs/interface.md +20 -17
- package/docs/jev.md +1 -1
- package/docs/kernels.md +1 -1
- package/{node_modules/pi-coralbricks-provider/LICENSE → docs/licenses/gdp-wired-mit.txt} +1 -1
- package/docs/managed-host-migration.md +50 -0
- package/docs/programmatic-compaction.md +216 -6
- package/docs/programs.md +23 -1
- package/docs/prompt-cache.md +4 -2
- package/docs/provider-capabilities.md +15 -14
- package/docs/providers.md +99 -3
- package/docs/shell-composition.md +15 -0
- package/docs/short-lock-protocol.md +90 -0
- package/docs/skills.md +5 -1
- package/docs/speculation.md +6 -0
- package/docs/verified-kernels.md +309 -220
- package/package.json +45 -24
- package/proofs/actor-name.ts +27 -0
- package/proofs/authority.ts +62 -0
- package/proofs/budget.ts +24 -0
- package/proofs/compaction.ts +51 -0
- package/proofs/grants.ts +39 -0
- package/proofs/index.ts +40 -0
- package/proofs/kernel.ts +44 -0
- package/proofs/lifecycle.ts +128 -0
- package/proofs/policy.ts +195 -0
- package/proofs/provider.ts +52 -0
- package/proofs/resources.ts +160 -0
- package/proofs/speculation.ts +69 -0
- package/proofs/storage.ts +66 -0
- package/scripts/verified-kernels.ts +141 -0
- package/skillsets/python/fabric-council/SKILL.md +92 -20
- package/skillsets/python/fabric-exec/SKILL.md +2 -2
- package/skillsets/python/fabric-exec/references/agents.md +10 -4
- package/skillsets/python/fabric-fusion/SKILL.md +1 -1
- package/skillsets/python/fabric-guide/SKILL.md +1 -1
- package/skillsets/typescript/fabric-council/SKILL.md +109 -22
- package/skillsets/typescript/fabric-exec/SKILL.md +7 -7
- package/skillsets/typescript/fabric-exec/references/agents.md +12 -3
- package/skillsets/typescript/fabric-fusion/SKILL.md +1 -1
- package/skillsets/typescript/fabric-guide/SKILL.md +1 -1
- package/LAWS.bend +0 -502
- package/PROOF.bend +0 -452
- package/dist/chunks/chunk-3UGN25XS.js.map +0 -7
- package/dist/chunks/chunk-4EW7GVUR.js.map +0 -7
- package/dist/chunks/chunk-5UBRGTVN.js.map +0 -7
- package/dist/chunks/chunk-BN7F52EG.js +0 -525
- package/dist/chunks/chunk-BN7F52EG.js.map +0 -7
- package/dist/chunks/chunk-DK35W6U7.js +0 -259
- package/dist/chunks/chunk-DK35W6U7.js.map +0 -7
- package/dist/chunks/chunk-EFETPXU2.js.map +0 -7
- package/dist/chunks/chunk-EHQQ4KCX.js.map +0 -7
- package/dist/chunks/chunk-EKODKR6Y.js.map +0 -7
- package/dist/chunks/chunk-FE6NOAO7.js.map +0 -7
- package/dist/chunks/chunk-FIDUHKMM.js.map +0 -7
- package/dist/chunks/chunk-FSB2VIRZ.js.map +0 -7
- package/dist/chunks/chunk-GIK2WNAK.js.map +0 -7
- package/dist/chunks/chunk-GO32KSEZ.js.map +0 -7
- package/dist/chunks/chunk-IR3PIHJM.js.map +0 -7
- package/dist/chunks/chunk-ITVLKXCI.js +0 -266
- package/dist/chunks/chunk-ITVLKXCI.js.map +0 -7
- package/dist/chunks/chunk-K7J2ABAZ.js.map +0 -7
- package/dist/chunks/chunk-KJZAOENY.js +0 -212
- package/dist/chunks/chunk-KJZAOENY.js.map +0 -7
- package/dist/chunks/chunk-LNASO4VT.js.map +0 -7
- package/dist/chunks/chunk-MLLYR3Y6.js.map +0 -7
- package/dist/chunks/chunk-P4KH4S4S.js.map +0 -7
- package/dist/chunks/chunk-PK4NIJEV.js.map +0 -7
- package/dist/chunks/chunk-Q2JQ3RYZ.js +0 -99
- package/dist/chunks/chunk-Q2JQ3RYZ.js.map +0 -7
- package/dist/chunks/chunk-R2XQ6AHT.js.map +0 -7
- package/dist/chunks/chunk-ROTCDDOV.js.map +0 -7
- package/dist/chunks/chunk-SPCJXN4K.js.map +0 -7
- package/dist/chunks/chunk-U366I5K2.js.map +0 -7
- package/dist/chunks/chunk-UKMQK5VP.js +0 -231
- package/dist/chunks/chunk-UKMQK5VP.js.map +0 -7
- package/dist/chunks/chunk-UOM37PE4.js.map +0 -7
- package/dist/chunks/chunk-UTOBAZ5T.js.map +0 -7
- package/dist/chunks/chunk-VSDUSNIA.js.map +0 -7
- package/dist/chunks/chunk-VTK2FEH7.js +0 -229
- package/dist/chunks/chunk-VTK2FEH7.js.map +0 -7
- package/dist/chunks/chunk-VYQV5JRT.js.map +0 -7
- package/dist/chunks/chunk-XCEEQ5AB.js.map +0 -7
- package/dist/chunks/chunk-ZLNJDTCN.js +0 -226
- package/dist/chunks/chunk-ZLNJDTCN.js.map +0 -7
- package/dist/chunks/chunk-ZQMBS5SH.js.map +0 -7
- package/dist/ui/conversation-shortcut.d.ts +0 -3
- package/dist/ui/conversation-shortcut.d.ts.map +0 -1
- package/dist/ui/widget-activity.d.ts +0 -21
- package/dist/ui/widget-activity.d.ts.map +0 -1
- package/dist/verified/generated/authority-kernel.d.ts +0 -10
- package/dist/verified/generated/authority-kernel.js +0 -127
- package/dist/verified/generated/kernel.d.ts +0 -31
- package/dist/verified/generated/kernel.js +0 -389
- package/dist/verified/generated/lifecycle-kernel.d.ts +0 -7
- package/dist/verified/generated/lifecycle-kernel.js +0 -164
- package/dist/verified/generated/provider-kernel.d.ts +0 -9
- package/dist/verified/generated/provider-kernel.js +0 -87
- package/dist/verified/generated/storage-kernel.d.ts +0 -11
- package/dist/verified/generated/storage-kernel.js +0 -107
- package/docs/licenses/bend-apache-2.0.txt +0 -202
- package/node_modules/pi-coralbricks-provider/README.md +0 -306
- package/node_modules/pi-coralbricks-provider/auth.ts +0 -30
- package/node_modules/pi-coralbricks-provider/custom-models.json +0 -1
- package/node_modules/pi-coralbricks-provider/deprecated-models.json +0 -1
- package/node_modules/pi-coralbricks-provider/guard.ts +0 -155
- package/node_modules/pi-coralbricks-provider/index.ts +0 -662
- package/node_modules/pi-coralbricks-provider/models.json +0 -88
- package/node_modules/pi-coralbricks-provider/package.json +0 -74
- package/node_modules/pi-coralbricks-provider/park.ts +0 -122
- package/node_modules/pi-coralbricks-provider/patch.json +0 -34
- package/node_modules/pi-coralbricks-provider/scripts/update-models.js +0 -658
- package/node_modules/pi-coralbricks-provider/settings.ts +0 -143
- package/node_modules/pi-coralbricks-provider/sync-policy.ts +0 -309
- package/proofs/abi.json +0 -308
- package/proofs/authority-abi.json +0 -7
- package/proofs/authority-kernel.bend +0 -23
- package/proofs/authority-proof.bend +0 -74
- package/proofs/authority-spec.bend +0 -30
- package/proofs/authority-state.bend +0 -43
- package/proofs/authority-types.d.ts +0 -3
- package/proofs/kernel.bend +0 -139
- package/proofs/lifecycle-abi.json +0 -3
- package/proofs/lifecycle-kernel.bend +0 -11
- package/proofs/lifecycle-proof.bend +0 -249
- package/proofs/lifecycle-spec.bend +0 -261
- package/proofs/lifecycle-types.d.ts +0 -4
- package/proofs/lifecycle.bend +0 -119
- package/proofs/provider-abi.json +0 -4
- package/proofs/provider-kernel.bend +0 -14
- package/proofs/provider-plans.bend +0 -28
- package/proofs/provider-spec.bend +0 -14
- package/proofs/provider-types.d.ts +0 -5
- package/proofs/resource-proof.bend +0 -633
- package/proofs/resource-spec.bend +0 -133
- package/proofs/resources.bend +0 -160
- package/proofs/state-kernel.bend +0 -17
- package/proofs/state-plans.bend +0 -40
- package/proofs/state-proof.bend +0 -42
- package/proofs/state-spec.bend +0 -26
- package/proofs/storage-abi.json +0 -3
- package/proofs/storage-kernel.bend +0 -11
- package/proofs/storage-plans.bend +0 -100
- package/proofs/storage-proof.bend +0 -176
- package/proofs/storage-spec.bend +0 -70
- package/proofs/storage-types.d.ts +0 -8
- package/proofs/types.d.ts +0 -7
- package/scripts/test-verified-kernels.mjs +0 -107
- package/scripts/verified-kernels.mjs +0 -176
- /package/dist/chunks/{chunk-3FJUP3GV.js.map → chunk-36XQFTEN.js.map} +0 -0
- /package/dist/chunks/{chunk-ZEXCKK4K.js.map → chunk-4WKD3YM3.js.map} +0 -0
- /package/dist/chunks/{chunk-5XBYFSI5.js.map → chunk-7YNE4NB2.js.map} +0 -0
- /package/dist/chunks/{chunk-K6QXUGS5.js.map → chunk-BMAEZNZ5.js.map} +0 -0
- /package/dist/chunks/{chunk-CCHZXF6K.js.map → chunk-CXYJJ3HZ.js.map} +0 -0
- /package/dist/chunks/{chunk-TIIIHPHF.js.map → chunk-GS67KDMV.js.map} +0 -0
- /package/dist/chunks/{chunk-D5NYNIST.js.map → chunk-H57KPL3V.js.map} +0 -0
- /package/dist/chunks/{chunk-INRXG4J5.js.map → chunk-HGD75NZY.js.map} +0 -0
- /package/dist/chunks/{chunk-UXIBKMUM.js.map → chunk-KIFOEBYJ.js.map} +0 -0
- /package/dist/chunks/{chunk-FUY6XVRX.js.map → chunk-MPMEK3IQ.js.map} +0 -0
- /package/dist/chunks/{chunk-HP5P7NBO.js.map → chunk-MSDL7U6Q.js.map} +0 -0
- /package/dist/chunks/{chunk-QT4W5YVB.js.map → chunk-RAA3FAYZ.js.map} +0 -0
- /package/dist/chunks/{chunk-53N2I4QA.js.map → chunk-TXCNZCZP.js.map} +0 -0
- /package/dist/chunks/{chunk-ASSLHWZS.js.map → chunk-UFMYN5TA.js.map} +0 -0
- /package/dist/chunks/{chunk-LEU5CDSL.js.map → chunk-XFOSUGLU.js.map} +0 -0
package/proofs/policy.ts
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// Fabric's scalar policy decisions, each a gdp-wired `fun`. The generated module
|
|
2
|
+
// ships the compiled terms of these functions; nothing here is translated by hand.
|
|
3
|
+
// Every law restates its requirement independently of the function body, and
|
|
4
|
+
// every function keeps the deliberately broken variants the prover must refuse.
|
|
5
|
+
import { all, bool, fun, nat, oneOf, when } from "gdp-wired";
|
|
6
|
+
import type { Kernel } from "./kernel.js";
|
|
7
|
+
|
|
8
|
+
export type PolicyBug =
|
|
9
|
+
| "transition ignores the epoch"
|
|
10
|
+
| "cleanup failure is disposed"
|
|
11
|
+
| "unknown conflict reads one side"
|
|
12
|
+
| "known conflict ignores ordering"
|
|
13
|
+
| "lineage admits non-members"
|
|
14
|
+
| "pointer ignores lineage"
|
|
15
|
+
| "coverage ignores truncation"
|
|
16
|
+
| "canonical arguments are rewritten"
|
|
17
|
+
| "pending head needs no marker"
|
|
18
|
+
| "marked pending head is hidden"
|
|
19
|
+
| "certificate skips its last fact"
|
|
20
|
+
| "consumption stays active"
|
|
21
|
+
| "summary ignores the byte limit"
|
|
22
|
+
| "sample loses an entry"
|
|
23
|
+
| "chunk ignores completion";
|
|
24
|
+
|
|
25
|
+
const transition = (bug?: PolicyBug) => fun("transition current")
|
|
26
|
+
.inputs({ retired: bool, sameEpoch: bool, sameOwner: bool, closed: bool })
|
|
27
|
+
.returns(({ retired, sameEpoch, sameOwner, closed }) => ({
|
|
28
|
+
ok: all(retired.not(), bug === "transition ignores the epoch" ? sameOwner : sameEpoch, sameOwner, closed.not()),
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
const cleanup = (bug?: PolicyBug) => fun("cleanup state")
|
|
32
|
+
.inputs({ failed: bool, diverted: bool })
|
|
33
|
+
.returns(({ failed, diverted }) => ({
|
|
34
|
+
state: when(failed, bug === "cleanup failure is disposed" ? 0 : 2, when(diverted, 1, 0)),
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
const unknown = (bug?: PolicyBug) => fun("unknown conflict")
|
|
38
|
+
.inputs({ lu: bool, luo: bool, lo: bool, ru: bool, ruo: bool, ro: bool })
|
|
39
|
+
.returns(({ lu, luo, lo, ru, ruo, ro }) => ({
|
|
40
|
+
conflict: bug === "unknown conflict reads one side" ? lu.and(luo.or(ro)) : lu.and(luo.or(ro)).or(ru.and(ruo.or(lo))),
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
const known = (bug?: PolicyBug) => fun("known conflict")
|
|
44
|
+
.inputs({ shared: bool, leftOrdered: bool, rightOrdered: bool })
|
|
45
|
+
.returns(({ shared, leftOrdered, rightOrdered }) => ({
|
|
46
|
+
conflict: bug === "known conflict ignores ordering" ? shared : shared.and(leftOrdered.or(rightOrdered)),
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
const lineage = (bug?: PolicyBug) => fun("lineage selected")
|
|
50
|
+
.inputs({ allBranches: bool, member: bool })
|
|
51
|
+
.returns(({ allBranches, member }) => ({
|
|
52
|
+
selected: bug === "lineage admits non-members" ? allBranches.or(member.not()) : allBranches.or(member),
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
const pointer = (bug?: PolicyBug) => fun("pointer current")
|
|
56
|
+
.inputs({ source: bool, lineage: bool })
|
|
57
|
+
.returns(({ source, lineage }) => ({ current: bug === "pointer ignores lineage" ? source : source.and(lineage) }));
|
|
58
|
+
|
|
59
|
+
const coverage = (bug?: PolicyBug) => fun("coverage complete")
|
|
60
|
+
.inputs({ sourceComplete: bool, truncated: bool })
|
|
61
|
+
.returns(({ sourceComplete, truncated }) => ({
|
|
62
|
+
complete: bug === "coverage ignores truncation" ? sourceComplete : sourceComplete.and(truncated.not()),
|
|
63
|
+
}));
|
|
64
|
+
|
|
65
|
+
const normalized = (bug?: PolicyBug) => fun("use normalized")
|
|
66
|
+
.inputs({ canonical: bool, plan: bool, changed: bool, accepted: bool })
|
|
67
|
+
.returns(({ canonical, plan, changed, accepted }) => ({
|
|
68
|
+
use: bug === "canonical arguments are rewritten" ? all(plan, changed, accepted) : all(canonical.not(), plan, changed, accepted),
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
const head = (bug?: PolicyBug) => fun("head readable")
|
|
72
|
+
.inputs({ sequence: bool, version: bool, committed: bool, pending: bool, marker: bool })
|
|
73
|
+
.returns(({ sequence, version, committed, pending, marker }) => ({
|
|
74
|
+
readable: all(sequence, version, bug === "marked pending head is hidden" ? committed : committed.or(bug === "pending head needs no marker" ? pending : pending.and(marker))),
|
|
75
|
+
}));
|
|
76
|
+
|
|
77
|
+
const FACTS = ["f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7"] as const;
|
|
78
|
+
const certificate = (bug?: PolicyBug) => fun("certificate accepted")
|
|
79
|
+
.inputs({ f0: bool, f1: bool, f2: bool, f3: bool, f4: bool, f5: bool, f6: bool, f7: bool })
|
|
80
|
+
.returns((env) => ({
|
|
81
|
+
accepted: all(...FACTS.slice(0, bug === "certificate skips its last fact" ? 7 : 8).map((name) => env[name])),
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
const consume = (bug?: PolicyBug) => fun("consume")
|
|
85
|
+
.inputs({ active: bool })
|
|
86
|
+
.returns(({ active }) => ({ released: active, active: bug === "consumption stays active" ? active : active.and(active.not()) }));
|
|
87
|
+
|
|
88
|
+
const summary = (bug?: PolicyBug) => fun("summary within")
|
|
89
|
+
.inputs({ bytes: nat, byteLimit: nat, projected: nat, target: nat })
|
|
90
|
+
.returns(({ bytes, byteLimit, projected, target }) => ({
|
|
91
|
+
within: bug === "summary ignores the byte limit" ? projected.atMost(target) : bytes.atMost(byteLimit).and(projected.atMost(target)),
|
|
92
|
+
}));
|
|
93
|
+
|
|
94
|
+
const sample = (bug?: PolicyBug) => fun("sample within")
|
|
95
|
+
.inputs({ total: nat, retained: nat, omitted: nat, limit: nat })
|
|
96
|
+
.returns(({ total, retained, omitted, limit }) => ({
|
|
97
|
+
within: (bug === "sample loses an entry" ? total.atMost(retained.plus(omitted)) : total.eq(retained.plus(omitted))).and(retained.atMost(limit)),
|
|
98
|
+
}));
|
|
99
|
+
|
|
100
|
+
const chunk = (bug?: PolicyBug) => fun("chunk accepted")
|
|
101
|
+
.inputs({ start: nat, end: nat, total: nat, expectedStart: nat, expectedTotal: nat, length: nat, complete: bool })
|
|
102
|
+
.returns(({ start, end, total, expectedStart, expectedTotal, length, complete }) => ({
|
|
103
|
+
accepted: all(
|
|
104
|
+
start.eq(expectedStart), total.eq(expectedTotal), start.atMost(end), end.atMost(total),
|
|
105
|
+
length.plus(start).eq(end),
|
|
106
|
+
bug === "chunk ignores completion" ? complete.or(complete.not()) : complete.iff(end.eq(total)),
|
|
107
|
+
complete.or(start.lt(end)),
|
|
108
|
+
),
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
// Each law names the Bend law it replaces. A soundness/completeness pair states
|
|
112
|
+
// the requirement once, so a function that drops a check or denies everything fails.
|
|
113
|
+
export const policyKernels = (bug?: PolicyBug): Kernel[] => {
|
|
114
|
+
const t = transition(bug), cl = cleanup(bug), u = unknown(bug), k = known(bug), li = lineage(bug);
|
|
115
|
+
const p = pointer(bug), co = coverage(bug), n = normalized(bug), h = head(bug), ce = certificate(bug);
|
|
116
|
+
const cs = consume(bug), su = summary(bug), sa = sample(bug), ch = chunk(bug);
|
|
117
|
+
return [
|
|
118
|
+
{ id: "transitionCurrent", fun: t, decisions: [
|
|
119
|
+
t.law("transition_sound: a current transition is unretired, same-epoch, same-owner and open", () => [], ({ ok }, e) => ok.implies(all(e.retired.not(), e.sameEpoch, e.sameOwner, e.closed.not()))),
|
|
120
|
+
t.law("transition_complete: every unretired, same-epoch, same-owner, open transition is current", () => [], ({ ok }, e) => all(e.retired.not(), e.sameEpoch, e.sameOwner, e.closed.not()).implies(ok)),
|
|
121
|
+
] },
|
|
122
|
+
{ id: "cleanupState", fun: cl, decisions: [
|
|
123
|
+
cl.law("cleanup_failure_quarantines: a cleanup failure always quarantines", ({ failed }) => failed, ({ state }) => state.eq(2)),
|
|
124
|
+
cl.law("cleanup_diverted: an unfailed diverted cleanup is diverted", ({ failed, diverted }) => [failed.not(), diverted], ({ state }) => state.eq(1)),
|
|
125
|
+
cl.law("cleanup_disposed: an unfailed undiverted cleanup is disposed", ({ failed, diverted }) => [failed.not(), diverted.not()], ({ state }) => state.eq(0)),
|
|
126
|
+
] },
|
|
127
|
+
{ id: "unknownConflict", fun: u, decisions: [
|
|
128
|
+
u.law("unknown_conflict_exact: an unknown scope conflicts exactly when it or its peer is noncommutative", () => [], ({ conflict }, e) => conflict.iff(e.lu.and(e.luo.or(e.ro)).or(e.ru.and(e.ruo.or(e.lo))))),
|
|
129
|
+
u.relate("unknown_conflict_symmetric: swapping the sides never changes the decision",
|
|
130
|
+
(a, b) => [a.lu.iff(b.ru), a.luo.iff(b.ruo), a.lo.iff(b.ro), a.ru.iff(b.lu), a.ruo.iff(b.luo), a.ro.iff(b.lo)],
|
|
131
|
+
(x, y) => x.conflict.iff(y.conflict)),
|
|
132
|
+
] },
|
|
133
|
+
{ id: "knownConflict", fun: k, decisions: [
|
|
134
|
+
k.law("known_conflict_exact: a shared resource conflicts exactly when one side is ordered", () => [], ({ conflict }, e) => conflict.iff(e.shared.and(e.leftOrdered.or(e.rightOrdered)))),
|
|
135
|
+
] },
|
|
136
|
+
{ id: "lineageSelected", fun: li, decisions: [
|
|
137
|
+
li.law("active_lineage_only: without all-branch selection only members are selected", ({ allBranches }) => allBranches.not(), ({ selected }, e) => selected.iff(e.member)),
|
|
138
|
+
li.law("explicit_all_lineages: explicit all-branch selection selects every entry", ({ allBranches }) => allBranches, ({ selected }) => selected),
|
|
139
|
+
] },
|
|
140
|
+
{ id: "pointerCurrent", fun: p, decisions: [
|
|
141
|
+
p.law("pointer_sound: a current pointer matches its source and its lineage", () => [], ({ current }, e) => current.implies(e.source.and(e.lineage))),
|
|
142
|
+
p.law("pointer_complete: a pointer matching its source and lineage is current", () => [], ({ current }, e) => e.source.and(e.lineage).implies(current)),
|
|
143
|
+
] },
|
|
144
|
+
{ id: "coverageComplete", fun: co, decisions: [
|
|
145
|
+
co.law("coverage_sound: complete coverage needs a complete source and no truncation", () => [], ({ complete }, e) => complete.implies(e.sourceComplete.and(e.truncated.not()))),
|
|
146
|
+
co.law("coverage_complete: an untruncated complete source is complete coverage", () => [], ({ complete }, e) => e.sourceComplete.and(e.truncated.not()).implies(complete)),
|
|
147
|
+
] },
|
|
148
|
+
{ id: "useNormalized", fun: n, decisions: [
|
|
149
|
+
n.law("normalization_sound: a normal form is used only for non-canonical, planned, changed, accepted arguments", () => [], ({ use }, e) => use.implies(all(e.canonical.not(), e.plan, e.changed, e.accepted))),
|
|
150
|
+
n.law("normalization_complete: every non-canonical, planned, changed, accepted normal form is used", () => [], ({ use }, e) => all(e.canonical.not(), e.plan, e.changed, e.accepted).implies(use)),
|
|
151
|
+
n.law("canonical_identity: canonical arguments stay original", ({ canonical }) => canonical, ({ use }) => use.not()),
|
|
152
|
+
] },
|
|
153
|
+
{ id: "headReadable", fun: h, decisions: [
|
|
154
|
+
h.law("head_sound: a readable head has its sequence, its version, and a commit or a marked pending write", () => [], ({ readable }, e) => readable.implies(all(e.sequence, e.version, e.committed.or(e.pending.and(e.marker))))),
|
|
155
|
+
h.law("pending_without_marker_hidden: a pending uncommitted head without its marker is hidden", ({ committed, pending, marker }) => [committed.not(), pending, marker.not()], ({ readable }) => readable.not()),
|
|
156
|
+
h.law("committed_head_visible: a committed head with its sequence and version is visible", ({ sequence, version, committed }) => [sequence, version, committed], ({ readable }) => readable),
|
|
157
|
+
h.law("pending_head_visible: a pending head with its sequence, version and commit marker is visible", ({ sequence, version, pending, marker }) => [sequence, version, pending, marker], ({ readable }) => readable),
|
|
158
|
+
] },
|
|
159
|
+
{ id: "certificateAccepted", fun: ce, decisions: [
|
|
160
|
+
ce.law("certificate_sound: an accepted certificate has every fact", () => [], ({ accepted }, e) => accepted.implies(all(...FACTS.map((name) => e[name])))),
|
|
161
|
+
ce.law("certificate_complete: a certificate with every fact is accepted", () => [], ({ accepted }, e) => all(...FACTS.map((name) => e[name])).implies(accepted)),
|
|
162
|
+
] },
|
|
163
|
+
{ id: "consume", fun: cs, decisions: [
|
|
164
|
+
cs.law("consume_once: an inactive token releases nothing", ({ active }) => active.not(), ({ released, active }) => released.not().and(active.not())),
|
|
165
|
+
cs.law("consume_retires: consumption releases an active token and leaves it inactive", () => [], ({ released, active }, e) => released.iff(e.active).and(active.not())),
|
|
166
|
+
] },
|
|
167
|
+
{ id: "summaryWithin", fun: su, decisions: [
|
|
168
|
+
su.law("summary_bounds: an accepted summary is within its byte limit and token target", () => [], ({ within }, e) => within.implies(e.bytes.atMost(e.byteLimit).and(e.projected.atMost(e.target)))),
|
|
169
|
+
su.law("summary_complete: a summary within both bounds is accepted", () => [], ({ within }, e) => e.bytes.atMost(e.byteLimit).and(e.projected.atMost(e.target)).implies(within)),
|
|
170
|
+
] },
|
|
171
|
+
{ id: "sampleWithin", fun: sa, decisions: [
|
|
172
|
+
sa.law("sample_accounting: retained plus omitted is the total, and the retained fit the limit", () => [], ({ within }, e) => within.implies(e.total.eq(e.retained.plus(e.omitted)).and(e.retained.atMost(e.limit)))),
|
|
173
|
+
sa.law("sample_complete: exact accounting within the limit is accepted", () => [], ({ within }, e) => e.total.eq(e.retained.plus(e.omitted)).and(e.retained.atMost(e.limit)).implies(within)),
|
|
174
|
+
] },
|
|
175
|
+
{ id: "chunkAccepted", fun: ch, decisions: [
|
|
176
|
+
ch.law("chunk_sound: an accepted chunk starts where expected, has the expected total, an exact length, truthful completion and progress", () => [], ({ accepted }, e) => accepted.implies(all(
|
|
177
|
+
e.start.eq(e.expectedStart), e.total.eq(e.expectedTotal), e.start.atMost(e.end), e.end.atMost(e.total),
|
|
178
|
+
e.length.eq(e.end.minus(e.start)), e.complete.iff(e.end.eq(e.total)), e.complete.or(e.start.lt(e.end)),
|
|
179
|
+
))),
|
|
180
|
+
ch.law("chunk_complete: every chunk meeting those requirements is accepted", () => [], ({ accepted }, e) => all(
|
|
181
|
+
e.start.eq(e.expectedStart), e.total.eq(e.expectedTotal), e.start.atMost(e.end), e.end.atMost(e.total),
|
|
182
|
+
e.length.eq(e.end.minus(e.start)), e.complete.iff(e.end.eq(e.total)), e.complete.or(e.start.lt(e.end)),
|
|
183
|
+
).implies(accepted)),
|
|
184
|
+
] },
|
|
185
|
+
];
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const POLICY_BUGS: PolicyBug[] = [
|
|
189
|
+
"transition ignores the epoch", "cleanup failure is disposed", "unknown conflict reads one side",
|
|
190
|
+
"known conflict ignores ordering", "lineage admits non-members", "pointer ignores lineage",
|
|
191
|
+
"coverage ignores truncation", "canonical arguments are rewritten", "pending head needs no marker", "marked pending head is hidden",
|
|
192
|
+
"certificate skips its last fact", "consumption stays active", "summary ignores the byte limit",
|
|
193
|
+
"sample loses an entry", "chunk ignores completion",
|
|
194
|
+
];
|
|
195
|
+
void oneOf;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Universal provider dispatch: a one-use ticket that plans a compare-and-swap
|
|
2
|
+
// write. Keys, revisions and payloads are interned names, compared by identity.
|
|
3
|
+
// The state is the ticket; step laws carry no invariant, so they hold for every ticket.
|
|
4
|
+
import { all, bool, nat, oneOf, rule, when } from "gdp-wired";
|
|
5
|
+
import type { Kernel } from "./kernel.js";
|
|
6
|
+
|
|
7
|
+
export const PLANS = ["Denied", "Write"] as const;
|
|
8
|
+
const [DENIED, WRITE] = [0, 1];
|
|
9
|
+
|
|
10
|
+
export type ProviderBug = "revocation keeps the ticket live" | "take ignores the key" | "stale revisions pass" | "cancellation is ignored" | "payload is swapped";
|
|
11
|
+
|
|
12
|
+
export const provider = (bug?: ProviderBug) => rule("provider ticket")
|
|
13
|
+
.inputs({ op: oneOf("take", "revoke"), key: nat, observed: nat, stopped: bool })
|
|
14
|
+
.state({ active: 1, grantKey: 0, expected: 0, payload: 0, plan: DENIED, planKey: 0, planExpected: 0, planValue: 0 })
|
|
15
|
+
.flags(({ op, key, observed, stopped, active, grantKey, expected }) => ({
|
|
16
|
+
allowed: op.is("take").and(active.eq(1), bug === "cancellation is ignored" ? active.eq(1) : stopped.not(),
|
|
17
|
+
bug === "take ignores the key" ? active.eq(1) : grantKey.eq(key), bug === "stale revisions pass" ? active.eq(1) : expected.eq(observed)),
|
|
18
|
+
}))
|
|
19
|
+
.step(({ op, key, active, expected, payload, allowed }) => ({
|
|
20
|
+
active: bug === "revocation keeps the ticket live" ? when(op.is("take"), 0, active) : 0,
|
|
21
|
+
plan: when(allowed, WRITE, DENIED),
|
|
22
|
+
planKey: when(allowed, key, 0),
|
|
23
|
+
planExpected: when(allowed, expected, 0),
|
|
24
|
+
planValue: when(allowed, bug === "payload is swapped" ? expected : payload, 0),
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
export const providerKernels = (bug?: ProviderBug): Kernel[] => {
|
|
28
|
+
const r = provider(bug);
|
|
29
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
30
|
+
// The ticket after the step keeps its grant key, revision and payload, and is no longer live.
|
|
31
|
+
const consumed = (b: any, a: any) => all(a.active.eq(0), a.grantKey.eq(b.grantKey), a.expected.eq(b.expected), a.payload.eq(b.payload));
|
|
32
|
+
return [{
|
|
33
|
+
id: "providerTicket",
|
|
34
|
+
rule: r,
|
|
35
|
+
stepLaws: [
|
|
36
|
+
r.stepLaw("provider_plan_safe: a planned write had a live grant for this key, no cancellation and the expected revision, and forwards them exactly",
|
|
37
|
+
(b, a) => a.plan.eq(WRITE).implies(all(b.active.eq(1), b.stopped.not(), b.grantKey.eq(b.key), b.expected.eq(b.observed),
|
|
38
|
+
a.planKey.eq(b.key), a.planExpected.eq(b.expected), a.planValue.eq(b.payload))), ({ op }) => op.is("take")),
|
|
39
|
+
r.stepLaw("provider_ticket_consumed: taking consumes the ticket and keeps its contents", (b, a) => consumed(b, a), ({ op }) => op.is("take")),
|
|
40
|
+
r.stepLaw("provider_revocation_consumes: revoking consumes the ticket and plans nothing", (b, a) => consumed(b, a).and(a.plan.eq(DENIED)), ({ op }) => op.is("revoke")),
|
|
41
|
+
r.stepLaw("provider_revoked_refused: a consumed ticket plans nothing", (b, a) => b.active.eq(0).implies(a.plan.eq(DENIED)), ({ op }) => op.is("take")),
|
|
42
|
+
r.stepLaw("provider_canceled_refused: a canceled take plans nothing", (_, a) => a.plan.eq(DENIED), ({ op, stopped }) => op.is("take").and(stopped)),
|
|
43
|
+
r.stepLaw("state_stale_refused: a revision other than the expected one plans nothing", (_, a) => a.plan.eq(DENIED), ({ op, expected, observed }) => op.is("take").and(expected.ne(observed))),
|
|
44
|
+
r.stepLaw("provider_admission_complete: a live ticket taken for its key at its revision plans exactly its write",
|
|
45
|
+
(b, a) => all(a.plan.eq(WRITE), a.planKey.eq(b.key), a.planExpected.eq(b.expected), a.planValue.eq(b.payload)),
|
|
46
|
+
({ op, active, stopped, grantKey, key, expected, observed }) => op.is("take").and(active.eq(1), stopped.not(), grantKey.eq(key), expected.eq(observed))),
|
|
47
|
+
r.stepsLaw("provider_replay_refused: a second take of the same ticket plans nothing", 2, (_, last) => last.plan.eq(DENIED),
|
|
48
|
+
({ op }, j) => (j === 0 ? op.is("take") : op.is("take"))),
|
|
49
|
+
],
|
|
50
|
+
}];
|
|
51
|
+
};
|
|
52
|
+
export const PROVIDER_BUGS: ProviderBug[] = ["revocation keeps the ticket live", "take ignores the key", "stale revisions pass", "cancellation is ignored", "payload is swapped"];
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// Effect resource scopes. A resource name is interned to a natural: 0 is the
|
|
2
|
+
// empty (or malformed) name, 1 is the wildcard "*", and every other string gets
|
|
3
|
+
// its own id. A scope is a set of ids; `Len` carries each name's UTF-16 length.
|
|
4
|
+
// The codec interns a proposal's names first, so ids 2..65 hold up to 64 names.
|
|
5
|
+
import { all, bool, everyKey, forall, nat, oneOf, record, rule, when, yes } from "gdp-wired";
|
|
6
|
+
import type { Kernel } from "./kernel.js";
|
|
7
|
+
|
|
8
|
+
export const EMPTY = 0, WILDCARD = 1, LIMIT = 64, NAMES = 2 + LIMIT, LENGTH = 256;
|
|
9
|
+
|
|
10
|
+
export type ResourceBug =
|
|
11
|
+
| "skips backward coverage" | "admits the wildcard" | "keeps an unknown source"
|
|
12
|
+
| "admits long names" | "ignores the bound" | "commutative effects conflict" | "unknown scopes are independent"
|
|
13
|
+
| "pairs only the diagonal" | "skips the last left effect" | "checks only the first right effect" | "checks one side against itself";
|
|
14
|
+
|
|
15
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
16
|
+
const same = (a: any, b: any) => everyKey((k) => a.at(k).eq(b.at(k)));
|
|
17
|
+
|
|
18
|
+
export const scope = (bug?: ResourceBug) => rule("resource scope")
|
|
19
|
+
.inputs({ op: oneOf("source", "normalize"), first: nat })
|
|
20
|
+
.state({ exact: 0 })
|
|
21
|
+
.maps({ Names: 0 })
|
|
22
|
+
.carries("Given", "Len")
|
|
23
|
+
.flags(({ Given, Len, Names }) => ({
|
|
24
|
+
bits: everyKey((k) => Given.at(k).atMost(1)),
|
|
25
|
+
identities: everyKey((k) => Given.has(k).implies(k.ne(EMPTY).and(bug === "admits the wildcard" ? yes : k.ne(WILDCARD)))),
|
|
26
|
+
// One condition per key: the candidate names exactly the scope, and each
|
|
27
|
+
// name is a valid identity within the 64-name window and 256 code units.
|
|
28
|
+
fits: everyKey((k) => (bug === "skips backward coverage" ? Names.has(k).implies(Given.has(k)) : Given.has(k).iff(Names.has(k)))
|
|
29
|
+
.and(Given.has(k).implies(all(k.ne(EMPTY), k.ne(WILDCARD), bug === "ignores the bound" ? yes : k.lt(NAMES), bug === "admits long names" ? yes : Len.at(k).atMost(LENGTH))))),
|
|
30
|
+
}))
|
|
31
|
+
// The specification's recheck: the proposal is the current scope, each name
|
|
32
|
+
// within 256 code units. Stated apart from `fits`; the step never reads them.
|
|
33
|
+
.flags(({ Given, Len, Names }) => ({
|
|
34
|
+
unchanged: everyKey((k) => Given.at(k).eq(Names.at(k))),
|
|
35
|
+
short: everyKey((k) => Given.has(k).implies(Len.at(k).atMost(LENGTH))),
|
|
36
|
+
}))
|
|
37
|
+
.flags(({ op, exact, first, Given, identities, fits }) => ({
|
|
38
|
+
accepted: Given.has(first).and(op.match({
|
|
39
|
+
source: () => identities,
|
|
40
|
+
normalize: () => (bug === "keeps an unknown source" ? yes : exact.eq(1)).and(fits),
|
|
41
|
+
})),
|
|
42
|
+
}))
|
|
43
|
+
.assume(({ bits }) => bits)
|
|
44
|
+
.step(({ accepted, Given, Names }) => ({
|
|
45
|
+
exact: when(accepted, 1, 0),
|
|
46
|
+
Names: Names.each((k) => when(accepted, Given.at(k), 0)),
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
export const conflict = (bug?: ResourceBug) => rule("resource conflict")
|
|
50
|
+
// `witness` names a shared resource for the completeness law; the step never reads it.
|
|
51
|
+
.inputs({ leftEffect: bool, rightEffect: bool, leftExact: bool, rightExact: bool, leftOrdered: bool, rightOrdered: bool, witness: nat })
|
|
52
|
+
.state({ conflict: 0 })
|
|
53
|
+
.carries("Left", "Right")
|
|
54
|
+
.flags(({ Left, Right }) => ({
|
|
55
|
+
bits: everyKey((k) => Left.at(k).atMost(1).and(Right.at(k).atMost(1))),
|
|
56
|
+
shared: Left.disjointFrom(Right).not(),
|
|
57
|
+
// The specification's disjointness, stated apart from `shared`; the step never reads it.
|
|
58
|
+
apart: everyKey((k) => Left.has(k).implies(Right.has(k).not())),
|
|
59
|
+
}))
|
|
60
|
+
.assume(({ bits }) => bits)
|
|
61
|
+
.step(({ leftEffect, rightEffect, leftExact, rightExact, leftOrdered, rightOrdered, shared }) => ({
|
|
62
|
+
conflict: when(all(leftEffect, rightEffect, bug === "commutative effects conflict" ? yes : leftOrdered.or(rightOrdered),
|
|
63
|
+
bug === "unknown scopes are independent" ? leftExact.and(rightExact, shared) : leftExact.and(rightExact).not().or(shared)), 1, 0),
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
// Two components' effects, decided over every pair at once. Each side is a list
|
|
67
|
+
// of effects plus rows (item, name) for its exact scopes, where `item` is the
|
|
68
|
+
// effect's position in its list: a row reads its effect at the position it
|
|
69
|
+
// names, so which name belongs to which effect is the request's own data.
|
|
70
|
+
// The codec names both sides' rows from one shared table.
|
|
71
|
+
const Effect = record({ effect: bool, ordered: bool, exact: bool });
|
|
72
|
+
const Row = record({ item: nat, name: nat });
|
|
73
|
+
export const groups = (bug?: ResourceBug) => rule("resource groups")
|
|
74
|
+
.carriesList("L", Effect).carriesList("R", Effect).carriesList("LN", Row).carriesList("RN", Row)
|
|
75
|
+
.state({ conflict: 0 })
|
|
76
|
+
.flags(({ L, R, LN, RN }) => {
|
|
77
|
+
const right = bug === "checks one side against itself" ? L : R, rightN = bug === "checks one side against itself" ? LN : RN;
|
|
78
|
+
const ordered = (l: any, r: any) => all(l.effect, r.effect, l.ordered.or(r.ordered));
|
|
79
|
+
return {
|
|
80
|
+
// Every row names an effect of its group.
|
|
81
|
+
rows: everyKey((p) => p.lt(LN.len).implies(LN.at(p).item.lt(L.len))).and(everyKey((q) => q.lt(RN.len).implies(RN.at(q).item.lt(R.len)))),
|
|
82
|
+
// No ordered pair of effects with an unknown scope.
|
|
83
|
+
known: everyKey((i, j) => all(i.lt(bug === "skips the last left effect" ? L.len.minus(1) : L.len), j.lt(bug === "checks only the first right effect" ? 1 : right.len),
|
|
84
|
+
bug === "pairs only the diagonal" ? i.eq(j) : yes)
|
|
85
|
+
.implies(all(ordered(L.at(i), right.at(j)), L.at(i).exact.and(right.at(j).exact).not()).not())),
|
|
86
|
+
// No ordered pair of effects naming one resource.
|
|
87
|
+
unshared: everyKey((p, q) => all(p.lt(LN.len), q.lt(rightN.len), LN.at(p).name.eq(rightN.at(q).name),
|
|
88
|
+
bug === "pairs only the diagonal" ? LN.at(p).item.eq(rightN.at(q).item) : yes)
|
|
89
|
+
.implies(ordered(L.at(LN.at(p).item), right.at(rightN.at(q).item)).not())),
|
|
90
|
+
};
|
|
91
|
+
})
|
|
92
|
+
.assume(({ rows }) => rows)
|
|
93
|
+
.step(({ known, unshared }) => ({ conflict: when(known.and(unshared), 0, 1) }));
|
|
94
|
+
|
|
95
|
+
export const resourceKernels = (bug?: ResourceBug): Kernel[] => {
|
|
96
|
+
const s = scope(bug), c = conflict(bug), g = groups(bug);
|
|
97
|
+
const valid = (Names: any, first: any) => Names.has(first).and(everyKey((k) => Names.has(k).implies(k.ne(EMPTY).and(k.ne(WILDCARD)))));
|
|
98
|
+
return [{
|
|
99
|
+
id: "resourceScope",
|
|
100
|
+
rule: s,
|
|
101
|
+
laws: [s.law("scope names are a set", ({ Names }) => everyKey((k) => Names.at(k).atMost(1)))],
|
|
102
|
+
stepLaws: [
|
|
103
|
+
s.stepLaw("resource_source_refinement: an exact source keeps every declared name, and only those",
|
|
104
|
+
({ Given }, a) => a.exact.eq(1).implies(same(a.Names, Given)), ({ op }) => op.is("source")),
|
|
105
|
+
s.stepLaw("resource_source_valid: an exact source is nonempty, with no empty or wildcard identity",
|
|
106
|
+
({ first }, a) => valid(a.Names, first), ({ op, accepted }) => op.is("source").and(accepted)),
|
|
107
|
+
s.stepLaw("resource_source_complete: every nonempty source of valid identities is exact",
|
|
108
|
+
({ Given }, a) => a.exact.eq(1).and(same(a.Names, Given)), ({ op, first, Given, identities }) => op.is("source").and(Given.has(first), identities)),
|
|
109
|
+
s.stepLaw("resource_refinement: normalization keeps a scope's names in both directions or widens it to unknown",
|
|
110
|
+
({ exact, Names }, a) => a.exact.eq(1).implies(exact.eq(1).and(same(a.Names, Names))), ({ op }) => op.is("normalize")),
|
|
111
|
+
s.stepLaw("resource_output_valid: an exact normal form is nonempty, at most 64 valid names of at most 256 code units",
|
|
112
|
+
({ first, Len }, a) => valid(a.Names, first).and(everyKey((k) => a.Names.has(k).implies(k.atLeast(2).and(k.lt(NAMES), Len.at(k).atMost(LENGTH))))),
|
|
113
|
+
({ op, accepted }) => op.is("normalize").and(accepted)),
|
|
114
|
+
s.stepLaw("resource_unknown: a refused scope is unknown and names nothing",
|
|
115
|
+
(_, a) => a.exact.eq(0).and(everyKey((k) => a.Names.at(k).eq(0))), ({ accepted }) => accepted.not()),
|
|
116
|
+
s.stepLaw("resource_precision: a valid bounded set-equivalent proposal is accepted as given (so the identity proposal is unchanged)",
|
|
117
|
+
({ Given }, a) => a.exact.eq(1).and(same(a.Names, Given)), ({ op, exact, first, Given, fits }) => op.is("normalize").and(exact.eq(1), Given.has(first), fits)),
|
|
118
|
+
s.stepsLaw("resource_recheck_idempotent: rechecking a normal form against itself keeps it", 2,
|
|
119
|
+
({ Given }, last) => last.exact.eq(1).and(same(last.Names, Given)),
|
|
120
|
+
({ op, accepted, first, Given, unchanged, short }, j) => (j === 0 ? op.is("normalize").and(accepted) : op.is("normalize").and(unchanged, short, Given.has(first)))),
|
|
121
|
+
],
|
|
122
|
+
}, {
|
|
123
|
+
id: "resourceConflict",
|
|
124
|
+
rule: c,
|
|
125
|
+
stepLaws: [
|
|
126
|
+
c.stepLaw("resource_pair_sound: quiet effects never conflict, nor do two commutative ones",
|
|
127
|
+
(_, a) => a.conflict.eq(0), ({ leftEffect, rightEffect, leftOrdered, rightOrdered }) => leftEffect.and(rightEffect, leftOrdered.or(rightOrdered)).not()),
|
|
128
|
+
c.stepLaw("resource_conflict_exact: exact disjoint scopes never conflict",
|
|
129
|
+
(_, a) => a.conflict.eq(0), ({ leftExact, rightExact, apart }) => all(leftExact, rightExact, apart)),
|
|
130
|
+
c.stepLaw("resource_conflict_complete: an ordered pair of effects with an unknown scope conflicts",
|
|
131
|
+
(_, a) => a.conflict.eq(1), ({ leftEffect, rightEffect, leftOrdered, rightOrdered, leftExact, rightExact }) =>
|
|
132
|
+
all(leftEffect, rightEffect, leftOrdered.or(rightOrdered), leftExact.and(rightExact).not())),
|
|
133
|
+
c.stepLaw("resource_pair_complete: an ordered pair of effects sharing a named resource conflicts",
|
|
134
|
+
(_, a) => a.conflict.eq(1), ({ leftEffect, rightEffect, leftOrdered, rightOrdered, witness, Left, Right }) =>
|
|
135
|
+
all(leftEffect, rightEffect, leftOrdered.or(rightOrdered), Left.has(witness), Right.has(witness))),
|
|
136
|
+
],
|
|
137
|
+
}, {
|
|
138
|
+
id: "resourceGroups",
|
|
139
|
+
rule: g,
|
|
140
|
+
stepLaws: [
|
|
141
|
+
g.stepLaw("resource_groups_known: independent groups have no ordered pair of effects with an unknown scope",
|
|
142
|
+
({ L, R }, a) => forall((i, j) => all(a.conflict.eq(0), i.lt(L.len), j.lt(R.len), L.at(i).effect, R.at(j).effect, L.at(i).ordered.or(R.at(j).ordered))
|
|
143
|
+
.implies(L.at(i).exact.and(R.at(j).exact)))),
|
|
144
|
+
g.stepLaw("resource_groups_unshared: independent groups have no ordered pair of effects naming one resource",
|
|
145
|
+
({ L, R, LN, RN }, a) => forall((p, q) => all(a.conflict.eq(0), p.lt(LN.len), q.lt(RN.len), LN.at(p).name.eq(RN.at(q).name), L.at(LN.at(p).item).effect, R.at(RN.at(q).item).effect)
|
|
146
|
+
.implies(L.at(LN.at(p).item).ordered.or(R.at(RN.at(q).item).ordered).not()))),
|
|
147
|
+
g.stepLaw("resource_groups_unknown_complete: an ordered pair of effects with an unknown scope makes the groups conflict",
|
|
148
|
+
({ L, R }, a) => forall((i, j) => all(i.lt(L.len), j.lt(R.len), L.at(i).effect, R.at(j).effect, L.at(i).ordered.or(R.at(j).ordered), L.at(i).exact.and(R.at(j).exact).not())
|
|
149
|
+
.implies(a.conflict.eq(1)))),
|
|
150
|
+
g.stepLaw("resource_groups_shared_complete: an ordered pair of effects naming one resource makes the groups conflict",
|
|
151
|
+
({ L, R, LN, RN }, a) => forall((p, q) => all(p.lt(LN.len), q.lt(RN.len), LN.at(p).name.eq(RN.at(q).name), L.at(LN.at(p).item).effect, R.at(RN.at(q).item).effect,
|
|
152
|
+
L.at(LN.at(p).item).ordered.or(R.at(RN.at(q).item).ordered)).implies(a.conflict.eq(1)))),
|
|
153
|
+
],
|
|
154
|
+
}];
|
|
155
|
+
};
|
|
156
|
+
export const RESOURCE_BUGS: ResourceBug[] = [
|
|
157
|
+
"skips backward coverage", "admits the wildcard", "keeps an unknown source", "admits long names",
|
|
158
|
+
"ignores the bound", "commutative effects conflict", "unknown scopes are independent",
|
|
159
|
+
"pairs only the diagonal", "skips the last left effect", "checks only the first right effect", "checks one side against itself",
|
|
160
|
+
];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Speculation's policy decisions and accounting. Promise settlement, keyed
|
|
2
|
+
// storage, freshness observations and abort delivery remain host responsibilities.
|
|
3
|
+
import { all, bool, fun, nat, oneOf, rule, when } from "gdp-wired";
|
|
4
|
+
import type { Kernel } from "./kernel.js";
|
|
5
|
+
|
|
6
|
+
export type SpeculationBug = "entry cap ignored" | "concurrency equality admitted" | "duplicates admitted" | "ended invocation admitted" | "expiry equality refused" | "epoch ignored" | "freshness ignored" | "failed result served" | "post-settlement expiry wins over abort" | "launch counted as skip" | "expiry not counted" | "epoch not advanced" | "serve counted twice";
|
|
7
|
+
const [ADMIT, SKIP, ENDED] = [0, 1, 2];
|
|
8
|
+
const [READY, ABSENT, EPOCH, FRESHNESS, FAILED] = [0, 1, 2, 3, 4];
|
|
9
|
+
|
|
10
|
+
const admission = (bug?: SpeculationBug) => fun("speculation admission")
|
|
11
|
+
.inputs({ ended: bool, duplicate: bool, entries: nat, inFlight: nat, maxEntries: nat, maxConcurrent: nat })
|
|
12
|
+
.returns((e) => ({ plan: when(bug === "ended invocation admitted" ? e.ended.and(e.ended.not()) : e.ended, ENDED, when(
|
|
13
|
+
(bug === "entry cap ignored" ? e.entries.lt(0) : e.entries.atLeast(e.maxEntries)).or(
|
|
14
|
+
bug === "concurrency equality admitted" ? e.inFlight.gt(e.maxConcurrent) : e.inFlight.atLeast(e.maxConcurrent),
|
|
15
|
+
bug === "duplicates admitted" ? e.duplicate.and(e.duplicate.not()) : e.duplicate), SKIP, ADMIT)) }));
|
|
16
|
+
|
|
17
|
+
const check = (bug?: SpeculationBug) => fun("speculation serve check")
|
|
18
|
+
.inputs({ settled: bool, aborted: bool, now: nat, createdAt: nat, ttl: nat, birthEpoch: nat, epoch: nat, fresh: bool, failed: bool })
|
|
19
|
+
.returns((e) => {
|
|
20
|
+
const elapsed = e.now.minus(e.createdAt);
|
|
21
|
+
const expired = bug === "expiry equality refused" ? elapsed.atLeast(e.ttl) : elapsed.gt(e.ttl);
|
|
22
|
+
const stale = bug === "epoch ignored" ? e.epoch.lt(0) : e.birthEpoch.ne(e.epoch).or(e.settled.and(e.aborted));
|
|
23
|
+
return { outcome: when(e.settled.and(stale, bug === "post-settlement expiry wins over abort" ? expired.not() : e.settled), EPOCH, when(expired, ABSENT, when(stale, EPOCH, when(
|
|
24
|
+
bug === "freshness ignored" ? e.fresh.and(e.fresh.not()) : e.fresh.not(), FRESHNESS, when(
|
|
25
|
+
e.settled.and(bug === "failed result served" ? e.failed.and(e.failed.not()) : e.failed), FAILED, READY))))) };
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const accounting = (bug?: SpeculationBug) => rule("speculation accounting")
|
|
29
|
+
.inputs({ event: oneOf("launched", "served", "epochInvalidated", "freshnessInvalidated", "failed", "wasted", "skipped", "bump") })
|
|
30
|
+
.state({ launched: 0, served: 0, epochInvalidated: 0, freshnessInvalidated: 0, failed: 0, wasted: 0, skipped: 0, epoch: 0 })
|
|
31
|
+
.step((e) => ({
|
|
32
|
+
launched: e.launched.plus(when(e.event.is(bug === "launch counted as skip" ? "skipped" : "launched"), 1, 0)),
|
|
33
|
+
served: e.served.plus(when(e.event.is("served"), bug === "serve counted twice" ? 2 : 1, 0)),
|
|
34
|
+
epochInvalidated: e.epochInvalidated.plus(when(e.event.is("epochInvalidated"), 1, 0)),
|
|
35
|
+
freshnessInvalidated: e.freshnessInvalidated.plus(when(e.event.is("freshnessInvalidated"), 1, 0)),
|
|
36
|
+
failed: e.failed.plus(when(e.event.is("failed"), 1, 0)),
|
|
37
|
+
wasted: e.wasted.plus(when(e.event.is("wasted"), bug === "expiry not counted" ? 0 : 1, 0)),
|
|
38
|
+
skipped: e.skipped.plus(when(e.event.is("skipped"), 1, 0)),
|
|
39
|
+
epoch: e.epoch.plus(when(e.event.is("bump"), bug === "epoch not advanced" ? 0 : 1, 0)),
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
export const speculationKernels = (bug?: SpeculationBug): Kernel[] => {
|
|
43
|
+
const a = admission(bug), c = check(bug), r = accounting(bug);
|
|
44
|
+
return [
|
|
45
|
+
{ id: "speculationAdmission", fun: a, decisions: [
|
|
46
|
+
a.law("speculation_admission_exact: only a new live entry below both caps is admitted", () => [], (o, e) => o.plan.eq(ADMIT).iff(all(e.ended.not(), e.duplicate.not(), e.entries.lt(e.maxEntries), e.inFlight.lt(e.maxConcurrent)))),
|
|
47
|
+
a.law("speculation_ended: ended invocations are refused without counting a skip", () => [], (o, e) => o.plan.eq(ENDED).iff(e.ended)),
|
|
48
|
+
a.law("speculation_skipped: a live duplicate or full store counts a skip", () => [], (o, e) => o.plan.eq(SKIP).iff(e.ended.not().and(e.duplicate.or(e.entries.atLeast(e.maxEntries), e.inFlight.atLeast(e.maxConcurrent))))),
|
|
49
|
+
] },
|
|
50
|
+
{ id: "speculationCheck", fun: c, decisions: [
|
|
51
|
+
c.law("speculation_ready_exact: readiness requires a fresh, unexpired current entry and, after settlement, no abort or failure", () => [], (o, e) => o.outcome.eq(READY).iff(all(e.now.minus(e.createdAt).atMost(e.ttl), e.birthEpoch.eq(e.epoch), e.fresh, e.settled.not().or(e.aborted.not().and(e.failed.not()))))),
|
|
52
|
+
c.law("speculation_expiry_exact: expiry precedes other pre-settlement failures, but not a post-settlement abort or epoch change", () => [], (o, e) => o.outcome.eq(ABSENT).iff(e.now.minus(e.createdAt).gt(e.ttl).and(e.settled.not().or(e.aborted.not().and(e.birthEpoch.eq(e.epoch)))))),
|
|
53
|
+
c.law("speculation_epoch_exact: an epoch change or settled abort wins unless a pre-settlement entry has expired", () => [], (o, e) => o.outcome.eq(EPOCH).iff(e.birthEpoch.ne(e.epoch).or(e.settled.and(e.aborted)).and(e.settled.or(e.now.minus(e.createdAt).atMost(e.ttl))))),
|
|
54
|
+
c.law("speculation_freshness_exact: a current unexpired entry with failed freshness is refused", () => [], (o, e) => o.outcome.eq(FRESHNESS).iff(all(e.now.minus(e.createdAt).atMost(e.ttl), e.birthEpoch.eq(e.epoch), e.settled.not().or(e.aborted.not()), e.fresh.not()))),
|
|
55
|
+
c.law("speculation_failure_exact: provider failure is checked only after settlement, following epoch, expiry and freshness", () => [], (o, e) => o.outcome.eq(FAILED).iff(all(e.settled, e.aborted.not(), e.now.minus(e.createdAt).atMost(e.ttl), e.birthEpoch.eq(e.epoch), e.fresh, e.failed))),
|
|
56
|
+
] },
|
|
57
|
+
{ id: "speculationAccounting", rule: r, stepLaws: [
|
|
58
|
+
r.stepLaw("speculation_launch_count: launch adds exactly one, other events preserve launches", (e, o) => o.launched.eq(e.launched.plus(when(e.event.is("launched"), 1, 0)))),
|
|
59
|
+
r.stepLaw("speculation_serve_count: service adds exactly one, other events preserve services", (e, o) => o.served.eq(e.served.plus(when(e.event.is("served"), 1, 0)))),
|
|
60
|
+
r.stepLaw("speculation_epoch_count: epoch invalidation adds exactly one only for its event", (e, o) => o.epochInvalidated.eq(e.epochInvalidated.plus(when(e.event.is("epochInvalidated"), 1, 0)))),
|
|
61
|
+
r.stepLaw("speculation_freshness_count: freshness invalidation adds exactly one only for its event", (e, o) => o.freshnessInvalidated.eq(e.freshnessInvalidated.plus(when(e.event.is("freshnessInvalidated"), 1, 0)))),
|
|
62
|
+
r.stepLaw("speculation_failure_count: failure adds exactly one only for its event", (e, o) => o.failed.eq(e.failed.plus(when(e.event.is("failed"), 1, 0)))),
|
|
63
|
+
r.stepLaw("speculation_waste_count: discarded work adds exactly one only for its event", (e, o) => o.wasted.eq(e.wasted.plus(when(e.event.is("wasted"), 1, 0)))),
|
|
64
|
+
r.stepLaw("speculation_skip_count: skipped admission adds exactly one only for its event", (e, o) => o.skipped.eq(e.skipped.plus(when(e.event.is("skipped"), 1, 0)))),
|
|
65
|
+
r.stepLaw("speculation_epoch_successor: a bump advances the epoch exactly once and preserves it on every other event", (e, o) => o.epoch.eq(e.epoch.plus(when(e.event.is("bump"), 1, 0)))),
|
|
66
|
+
] },
|
|
67
|
+
];
|
|
68
|
+
};
|
|
69
|
+
export const SPECULATION_BUGS: SpeculationBug[] = ["entry cap ignored", "concurrency equality admitted", "duplicates admitted", "ended invocation admitted", "expiry equality refused", "epoch ignored", "freshness ignored", "failed result served", "post-settlement expiry wins over abort", "launch counted as skip", "expiry not counted", "epoch not advanced", "serve counted twice"];
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Mesh storage compare-and-swap. Keys, values and identities are interned
|
|
2
|
+
// names: the reducer forwards them, and the laws prove the forwarding exact.
|
|
3
|
+
// Revisions are naturals below 2^53, the bound the compiled runtime enforces.
|
|
4
|
+
import { all, bool, fun, nat, when } from "gdp-wired";
|
|
5
|
+
import type { Kernel } from "./kernel.js";
|
|
6
|
+
|
|
7
|
+
/** The largest revision: a revision below it still has a successor. */
|
|
8
|
+
export const REVISION_MAX = Number.MAX_SAFE_INTEGER;
|
|
9
|
+
export const PLANS = ["Conflict", "Exhausted", "Unchanged", "PutNext", "DeleteNext"] as const;
|
|
10
|
+
const [CONFLICT, EXHAUSTED, UNCHANGED, PUT_NEXT, DELETE_NEXT] = [0, 1, 2, 3, 4];
|
|
11
|
+
|
|
12
|
+
export type StorageBug = "stale writes pass" | "absent puts restart at zero" | "deletes skip the clock" | "overflow wraps" | "value is not forwarded";
|
|
13
|
+
|
|
14
|
+
export const storage = (bug?: StorageBug) => fun("storage transition")
|
|
15
|
+
.inputs({
|
|
16
|
+
key: nat, any: bool, expected: nat, put: bool, value: nat, identity: nat,
|
|
17
|
+
present: bool, version: nat, highWater: nat,
|
|
18
|
+
})
|
|
19
|
+
.returns(({ key, any, expected, put, value, identity, present, version, highWater }) => {
|
|
20
|
+
const matches = bug === "stale writes pass" ? any.or(any.not()) : any.or(expected.eq(version));
|
|
21
|
+
const base = when(present, version, bug === "absent puts restart at zero" ? 0 : highWater);
|
|
22
|
+
const before = when(put, base, version);
|
|
23
|
+
const room = bug === "overflow wraps" ? before.atMost(REVISION_MAX) : before.lt(REVISION_MAX).and(highWater.lt(REVISION_MAX));
|
|
24
|
+
const unchanged = put.not().and(present.not());
|
|
25
|
+
const plan = when(matches.not(), CONFLICT, when(unchanged, UNCHANGED, when(room.not(), EXHAUSTED, when(put, PUT_NEXT, DELETE_NEXT))));
|
|
26
|
+
const moved = matches.and(unchanged.not(), room);
|
|
27
|
+
return {
|
|
28
|
+
plan,
|
|
29
|
+
key: when(moved, key, 0),
|
|
30
|
+
value: when(moved.and(put), bug === "value is not forwarded" ? identity : value, 0),
|
|
31
|
+
identity: when(moved.and(put), identity, 0),
|
|
32
|
+
version: when(moved, before.plus(1), 0),
|
|
33
|
+
highWater: when(moved, bug === "deletes skip the clock" ? when(put, highWater.plus(1), highWater) : highWater.plus(1), 0),
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const storageKernels = (bug?: StorageBug): Kernel[] => {
|
|
38
|
+
const f = storage(bug);
|
|
39
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
40
|
+
const CAS = (e: any) => e.any.or(e.expected.eq(e.version));
|
|
41
|
+
const Room = (v: any) => v.lt(REVISION_MAX);
|
|
42
|
+
const Base = (e: any) => when(e.present, e.version, e.highWater);
|
|
43
|
+
return [{
|
|
44
|
+
id: "storageTransition",
|
|
45
|
+
fun: f,
|
|
46
|
+
decisions: [
|
|
47
|
+
f.law("storage_safe: an unchanged plan is an admitted delete of an absent key", () => [], (o, e) =>
|
|
48
|
+
o.plan.eq(UNCHANGED).implies(all(CAS(e), e.put.not(), e.present.not()))),
|
|
49
|
+
f.law("storage_safe: a put forwards its key, value and identity exactly, at the successors of its base and of the clock", () => [], (o, e) =>
|
|
50
|
+
o.plan.eq(PUT_NEXT).implies(all(CAS(e), e.put, Room(Base(e)), Room(e.highWater), o.key.eq(e.key), o.value.eq(e.value), o.identity.eq(e.identity),
|
|
51
|
+
o.version.eq(Base(e).plus(1)), o.highWater.eq(e.highWater.plus(1))))),
|
|
52
|
+
f.law("storage_safe: a delete forwards its key from a present slot, at the successors of its version and of the clock", () => [], (o, e) =>
|
|
53
|
+
o.plan.eq(DELETE_NEXT).implies(all(CAS(e), e.put.not(), e.present, Room(e.version), Room(e.highWater), o.key.eq(e.key),
|
|
54
|
+
o.version.eq(e.version.plus(1)), o.highWater.eq(e.highWater.plus(1))))),
|
|
55
|
+
f.law("storage_put_complete: an admitted put with room is written", (e) => [CAS(e), e.put, Room(Base(e)), Room(e.highWater)], (o, e) =>
|
|
56
|
+
all(o.plan.eq(PUT_NEXT), o.key.eq(e.key), o.value.eq(e.value), o.identity.eq(e.identity), o.version.eq(Base(e).plus(1)), o.highWater.eq(e.highWater.plus(1)))),
|
|
57
|
+
f.law("storage_delete_complete: an admitted delete of a present key with room is applied", (e) => [CAS(e), e.put.not(), e.present, Room(e.version), Room(e.highWater)], (o, e) =>
|
|
58
|
+
all(o.plan.eq(DELETE_NEXT), o.key.eq(e.key), o.version.eq(e.version.plus(1)), o.highWater.eq(e.highWater.plus(1)))),
|
|
59
|
+
f.law("storage_absent_delete_complete: an admitted delete of an absent key changes nothing", (e) => [CAS(e), e.put.not(), e.present.not()], (o) => o.plan.eq(UNCHANGED)),
|
|
60
|
+
f.law("storage_stale_refused: an expected revision other than the actual one is a conflict", (e) => [e.any.not(), e.expected.ne(e.version)], (o) => o.plan.eq(CONFLICT)),
|
|
61
|
+
f.law("storage_put_overflow: an admitted put without room is exhausted", (e) => [CAS(e), e.put, Room(Base(e)).and(Room(e.highWater)).not()], (o) => o.plan.eq(EXHAUSTED)),
|
|
62
|
+
f.law("storage_delete_overflow: an admitted delete of a present key without room is exhausted", (e) => [CAS(e), e.put.not(), e.present, Room(e.version).and(Room(e.highWater)).not()], (o) => o.plan.eq(EXHAUSTED)),
|
|
63
|
+
],
|
|
64
|
+
}];
|
|
65
|
+
};
|
|
66
|
+
export const STORAGE_BUGS: StorageBug[] = ["stale writes pass", "absent puts restart at zero", "deletes skip the clock", "overflow wraps", "value is not forwarded"];
|