@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
|
@@ -1,662 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CoralBricks Provider Extension
|
|
3
|
-
*
|
|
4
|
-
* Registers CoralBricks with Chat Completions (default) or opt-in Responses,
|
|
5
|
-
* optionally parking Responses turns with previous_response_id (park.ts).
|
|
6
|
-
* Base URL: https://inference.coralbricks.ai/v1
|
|
7
|
-
*
|
|
8
|
-
* Model resolution strategy: Stale-While-Revalidate
|
|
9
|
-
* 1. Serve stale immediately: disk cache → embedded models.json (zero-latency)
|
|
10
|
-
* 2. Revalidate in background once a key resolves: authenticated /v1/models
|
|
11
|
-
* (authoritative enabled set + per-million USD pricing)
|
|
12
|
-
* → merge with embedded → cache → hot-swap. Without a key nothing is
|
|
13
|
-
* fetched; the stale catalog serves until /login or a key appears.
|
|
14
|
-
* Quiet startup sync (sync-policy.ts): only when the disk cache is older
|
|
15
|
-
* than the TTL (1h, PI_PROVIDER_SYNC_TTL_MS), missing, or fetched with a
|
|
16
|
-
* different key, or Pi forces it (after /login), and only one pi process
|
|
17
|
-
* at a time (lock file next to the cache).
|
|
18
|
-
* 3. patch.json + custom-models.json applied on top of whichever source won
|
|
19
|
-
*
|
|
20
|
-
* When several copies of this package load into one Pi runtime (a standalone
|
|
21
|
-
* install plus a copy bundled in another package), only the newest registers
|
|
22
|
-
* the provider and syncs models (guard.ts).
|
|
23
|
-
*
|
|
24
|
-
* Merge order: [live|cache|embedded] → apply patch.json → merge custom-models.json
|
|
25
|
-
*
|
|
26
|
-
* Usage:
|
|
27
|
-
* # Option 1: /login coralbricks inside pi (stores the key in auth.json), or
|
|
28
|
-
* # add to ~/.pi/agent/auth.json yourself:
|
|
29
|
-
* # "coralbricks": { "type": "api_key", "key": "cb_your-key" }
|
|
30
|
-
*
|
|
31
|
-
* # Option 2: Set as environment variable
|
|
32
|
-
* # (localterm: `localterm secret set coralbricks_api_key` exposes CORALBRICKS_API_KEY)
|
|
33
|
-
* export CORALBRICKS_API_KEY=cb_your-key
|
|
34
|
-
*
|
|
35
|
-
* # Run pi with the extension
|
|
36
|
-
* pi -e /path/to/pi-coralbricks-provider
|
|
37
|
-
*
|
|
38
|
-
* Then use /model to select from available models
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
import { getAgentDir, type ExtensionAPI, type ModelRegistry } from "@earendil-works/pi-coding-agent";
|
|
42
|
-
import { lazyStream, type Api, type Credential, type Model, type RefreshModelsContext } from "@earendil-works/pi-ai";
|
|
43
|
-
import type { AssistantMessageEventStream, SimpleStreamOptions } from "@earendil-works/pi-ai/compat";
|
|
44
|
-
import { clampThinkingLevel, streamOpenAICompletions, streamOpenAIResponses } from "@earendil-works/pi-ai/compat";
|
|
45
|
-
import { createSettingsCommand, loadConfig, SETTINGS_COMMAND } from "./settings";
|
|
46
|
-
import { claimRuntime, type CoralCopy } from "./guard";
|
|
47
|
-
import { park, planPark, withParkFallback, type ParkPlan } from "./park";
|
|
48
|
-
import { coralApiKeyAuth, CORALBRICKS_ENV_VAR } from "./auth";
|
|
49
|
-
import { acquireModelSync, cacheChangedSinceLoad, markCacheLoaded, writeFileAtomic } from "./sync-policy";
|
|
50
|
-
import modelsData from "./models.json" with { type: "json" };
|
|
51
|
-
import customModelsData from "./custom-models.json" with { type: "json" };
|
|
52
|
-
import patchData from "./patch.json" with { type: "json" };
|
|
53
|
-
import deprecatedData from "./deprecated-models.json" with { type: "json" };
|
|
54
|
-
import packageData from "./package.json" with { type: "json" };
|
|
55
|
-
import fs from "fs";
|
|
56
|
-
import path from "path";
|
|
57
|
-
|
|
58
|
-
// Types
|
|
59
|
-
|
|
60
|
-
interface JsonModel {
|
|
61
|
-
id: string;
|
|
62
|
-
name: string;
|
|
63
|
-
reasoning: boolean;
|
|
64
|
-
input: ("text" | "image")[];
|
|
65
|
-
cost: {
|
|
66
|
-
input: number;
|
|
67
|
-
output: number;
|
|
68
|
-
cacheRead: number;
|
|
69
|
-
cacheWrite: number;
|
|
70
|
-
};
|
|
71
|
-
contextWindow: number;
|
|
72
|
-
maxTokens: number;
|
|
73
|
-
thinkingLevelMap?: {
|
|
74
|
-
off?: string | null;
|
|
75
|
-
minimal?: string | null;
|
|
76
|
-
low?: string | null;
|
|
77
|
-
medium?: string | null;
|
|
78
|
-
high?: string | null;
|
|
79
|
-
xhigh?: string | null;
|
|
80
|
-
max?: string | null;
|
|
81
|
-
};
|
|
82
|
-
compat?: {
|
|
83
|
-
supportsDeveloperRole?: boolean;
|
|
84
|
-
supportsStore?: boolean;
|
|
85
|
-
supportsReasoningEffort?: boolean;
|
|
86
|
-
maxTokensField?: "max_completion_tokens" | "max_tokens";
|
|
87
|
-
thinkingFormat?: "openai" | "zai";
|
|
88
|
-
supportsStrictMode?: boolean;
|
|
89
|
-
requiresReasoningContentOnAssistantMessages?: boolean;
|
|
90
|
-
};
|
|
91
|
-
/** Curation-only (patch.json): keep a served model out of the catalog. */
|
|
92
|
-
hidden?: boolean;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
interface PatchEntry {
|
|
96
|
-
name?: string;
|
|
97
|
-
hidden?: boolean;
|
|
98
|
-
reasoning?: boolean;
|
|
99
|
-
input?: ("text" | "image")[];
|
|
100
|
-
cost?: {
|
|
101
|
-
input?: number;
|
|
102
|
-
output?: number;
|
|
103
|
-
cacheRead?: number;
|
|
104
|
-
cacheWrite?: number;
|
|
105
|
-
};
|
|
106
|
-
contextWindow?: number;
|
|
107
|
-
maxTokens?: number;
|
|
108
|
-
thinkingLevelMap?: Record<string, string | null>;
|
|
109
|
-
compat?: Record<string, unknown>;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
type PatchData = Record<string, PatchEntry>;
|
|
113
|
-
|
|
114
|
-
// Patch Application
|
|
115
|
-
|
|
116
|
-
function applyPatch(model: JsonModel, patch: PatchEntry): JsonModel {
|
|
117
|
-
// Deep-copy nested objects: the delete branches below must not mutate the
|
|
118
|
-
// caller's (embedded or cached) source data through shared references.
|
|
119
|
-
const result: JsonModel = {
|
|
120
|
-
...model,
|
|
121
|
-
cost: { ...model.cost },
|
|
122
|
-
compat: model.compat ? { ...model.compat } : undefined,
|
|
123
|
-
thinkingLevelMap: model.thinkingLevelMap ? { ...model.thinkingLevelMap } : undefined,
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
if (patch.name !== undefined) result.name = patch.name;
|
|
127
|
-
if (patch.hidden !== undefined) result.hidden = patch.hidden;
|
|
128
|
-
if (patch.reasoning !== undefined) result.reasoning = patch.reasoning;
|
|
129
|
-
if (patch.input !== undefined) result.input = patch.input;
|
|
130
|
-
if (patch.contextWindow !== undefined) result.contextWindow = patch.contextWindow;
|
|
131
|
-
if (patch.maxTokens !== undefined) result.maxTokens = patch.maxTokens;
|
|
132
|
-
if (patch.thinkingLevelMap !== undefined) result.thinkingLevelMap = patch.thinkingLevelMap as JsonModel["thinkingLevelMap"];
|
|
133
|
-
|
|
134
|
-
if (patch.cost) {
|
|
135
|
-
result.cost = {
|
|
136
|
-
input: patch.cost.input ?? result.cost.input,
|
|
137
|
-
output: patch.cost.output ?? result.cost.output,
|
|
138
|
-
cacheRead: patch.cost.cacheRead ?? result.cost.cacheRead,
|
|
139
|
-
cacheWrite: patch.cost.cacheWrite ?? result.cost.cacheWrite,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
if (patch.compat) {
|
|
143
|
-
result.compat = { ...(result.compat || {}), ...patch.compat };
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (!result.reasoning && result.compat?.thinkingFormat) {
|
|
147
|
-
delete result.compat.thinkingFormat;
|
|
148
|
-
}
|
|
149
|
-
if (!result.reasoning && result.thinkingLevelMap) {
|
|
150
|
-
delete result.thinkingLevelMap;
|
|
151
|
-
}
|
|
152
|
-
if (result.compat && Object.keys(result.compat).length === 0) {
|
|
153
|
-
delete result.compat;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return result;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/** Full pipeline: base models → patch → custom → result */
|
|
160
|
-
function buildModels(base: JsonModel[], custom: JsonModel[], patch: PatchData): JsonModel[] {
|
|
161
|
-
const modelMap = new Map<string, JsonModel>();
|
|
162
|
-
|
|
163
|
-
for (const model of withDeprecated(base)) {
|
|
164
|
-
modelMap.set(model.id, model);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
for (const [id, patchEntry] of Object.entries(patch)) {
|
|
168
|
-
const existing = modelMap.get(id);
|
|
169
|
-
if (existing) {
|
|
170
|
-
modelMap.set(id, applyPatch(existing, patchEntry));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
for (const model of custom) {
|
|
175
|
-
const existing = modelMap.get(model.id);
|
|
176
|
-
const patchEntry = patch[model.id];
|
|
177
|
-
if (existing && patchEntry) {
|
|
178
|
-
modelMap.set(model.id, applyPatch(model, patchEntry));
|
|
179
|
-
} else if (existing) {
|
|
180
|
-
modelMap.set(model.id, model);
|
|
181
|
-
} else if (patchEntry) {
|
|
182
|
-
modelMap.set(model.id, applyPatch(model, patchEntry));
|
|
183
|
-
} else {
|
|
184
|
-
modelMap.set(model.id, model);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Hidden models stay out of the registered catalog — and therefore out of
|
|
189
|
-
// `/model` — while `models.json` keeps mirroring what Coral serves for the key.
|
|
190
|
-
return Array.from(modelMap.values())
|
|
191
|
-
.filter((m) => !m.hidden)
|
|
192
|
-
.map(({ hidden: _hidden, ...model }) => model);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// Stale-While-Revalidate Model Sync
|
|
196
|
-
|
|
197
|
-
const PROVIDER_ID = "coralbricks";
|
|
198
|
-
const PROVIDER_NAME = "CoralBricks";
|
|
199
|
-
const BASE_URL = "https://inference.coralbricks.ai/v1";
|
|
200
|
-
const MODELS_URL = `${BASE_URL}/models`;
|
|
201
|
-
const PACKAGE_VERSION: string = packageData.version;
|
|
202
|
-
const CACHE_DIR = path.join(getAgentDir(), "cache");
|
|
203
|
-
const CACHE_PATH = path.join(CACHE_DIR, `${PROVIDER_ID}-models.json`);
|
|
204
|
-
const LIVE_FETCH_TIMEOUT_MS = 8000;
|
|
205
|
-
|
|
206
|
-
// Output-token fallbacks for models whose API rows do not report a limit.
|
|
207
|
-
// Empty today: every served model reports max_output_tokens. Keyed by model id
|
|
208
|
-
// when one does not.
|
|
209
|
-
const DEFAULT_MAX_TOKENS: Record<string, number> = {};
|
|
210
|
-
const FALLBACK_MAX_TOKENS = 32768;
|
|
211
|
-
|
|
212
|
-
function toNumber(value: unknown): number {
|
|
213
|
-
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Full price of a written prompt token. Since 2026-10-08 Coral states the cache write ON TOP
|
|
218
|
-
* of input (/v1/models cache_write_per_m, catalog cacheWritePerM), and a written token is
|
|
219
|
-
* billed input + that. pi prices a written token at cacheWrite alone, so add the two. 0 when
|
|
220
|
-
* the row carries no cache-write rate. Rounded so 1.12 + 0.56 is 1.68, not 1.6800000000000002.
|
|
221
|
-
*/
|
|
222
|
-
function writtenTokenCost(input: number, cacheWriteOnTop: unknown): number {
|
|
223
|
-
if (typeof cacheWriteOnTop !== "number" || !Number.isFinite(cacheWriteOnTop)) return 0;
|
|
224
|
-
return Math.round((input + cacheWriteOnTop) * 1e6) / 1e6;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function displayName(id: string): string {
|
|
228
|
-
return id
|
|
229
|
-
.split(/[-_/]/)
|
|
230
|
-
.filter(Boolean)
|
|
231
|
-
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
232
|
-
.join(" ");
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/** Parse "1M" / "128K" / "1048576" / 1048576 into a token count. */
|
|
236
|
-
function parseContextWindow(value: unknown, fallback = 131072): number {
|
|
237
|
-
if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
|
|
238
|
-
if (typeof value === "string") {
|
|
239
|
-
const match = value.trim().match(/^([\d.]+)\s*([KkMm])$/);
|
|
240
|
-
if (match) {
|
|
241
|
-
const n = parseFloat(match[1]);
|
|
242
|
-
if (Number.isFinite(n) && n > 0) {
|
|
243
|
-
return Math.round(n * (match[2].toUpperCase() === "M" ? 1024 * 1024 : 1024));
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
const n = parseInt(value, 10);
|
|
247
|
-
if (Number.isFinite(n) && n > 0) return n;
|
|
248
|
-
}
|
|
249
|
-
return fallback;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function baseCompat() {
|
|
253
|
-
return {
|
|
254
|
-
supportsStore: false,
|
|
255
|
-
supportsDeveloperRole: false,
|
|
256
|
-
maxTokensField: "max_tokens" as const,
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Transform a Coral /v1/models row. Coral reports per-million USD pricing
|
|
262
|
-
* (input_per_m / output_per_m / cached_input_per_m — cached reads are $0 on
|
|
263
|
-
* every model — and cache_write_per_m, the cache write ON TOP of input for a
|
|
264
|
-
* prompt token written to the cache), context_length, and supports_image_input.
|
|
265
|
-
* pi's cacheWrite is the full price of a written token: input + cache_write_per_m.
|
|
266
|
-
*/
|
|
267
|
-
function transformApiModel(apiModel: any): JsonModel | null {
|
|
268
|
-
if (!apiModel?.id) return null;
|
|
269
|
-
const pricing = apiModel.pricing || {};
|
|
270
|
-
const model: JsonModel = {
|
|
271
|
-
id: apiModel.id,
|
|
272
|
-
name: typeof apiModel.name === "string" && apiModel.name ? apiModel.name : displayName(apiModel.id),
|
|
273
|
-
reasoning: false,
|
|
274
|
-
input: apiModel.supports_image_input ? ["text", "image"] : ["text"],
|
|
275
|
-
cost: {
|
|
276
|
-
input: toNumber(pricing.input_per_m),
|
|
277
|
-
output: toNumber(pricing.output_per_m),
|
|
278
|
-
cacheRead: toNumber(pricing.cached_input_per_m),
|
|
279
|
-
cacheWrite: writtenTokenCost(toNumber(pricing.input_per_m), pricing.cache_write_per_m),
|
|
280
|
-
},
|
|
281
|
-
contextWindow: parseContextWindow(apiModel.context_length),
|
|
282
|
-
maxTokens: DEFAULT_MAX_TOKENS[apiModel.id] ?? FALLBACK_MAX_TOKENS,
|
|
283
|
-
};
|
|
284
|
-
model.compat = baseCompat();
|
|
285
|
-
return model;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
async function fetchV1Models(apiKey: string, signal?: AbortSignal): Promise<JsonModel[] | null> {
|
|
289
|
-
try {
|
|
290
|
-
const response = await fetch(MODELS_URL, {
|
|
291
|
-
headers: { Authorization: `Bearer ${apiKey}` },
|
|
292
|
-
signal: signal ? AbortSignal.any([AbortSignal.timeout(LIVE_FETCH_TIMEOUT_MS), signal]) : AbortSignal.timeout(LIVE_FETCH_TIMEOUT_MS),
|
|
293
|
-
});
|
|
294
|
-
if (!response.ok) return null;
|
|
295
|
-
const data = await response.json();
|
|
296
|
-
const apiModels = Array.isArray(data) ? data : (data.data || []);
|
|
297
|
-
if (!Array.isArray(apiModels) || apiModels.length === 0) return null;
|
|
298
|
-
return apiModels.map(transformApiModel).filter((m): m is JsonModel => m !== null);
|
|
299
|
-
} catch {
|
|
300
|
-
return null;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Live model fetch from the authenticated /v1/models, the exact per-key enabled
|
|
306
|
-
* set. Without a key there is no request: the disk cache, then the embedded
|
|
307
|
-
* models.json, serve until a key resolves (/login, auth.json, the environment).
|
|
308
|
-
*/
|
|
309
|
-
async function fetchLiveModels(apiKey: string | undefined, signal?: AbortSignal): Promise<JsonModel[] | null> {
|
|
310
|
-
if (!apiKey) return null;
|
|
311
|
-
return fetchV1Models(apiKey, signal);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
function loadCachedModels(): JsonModel[] | null {
|
|
315
|
-
try {
|
|
316
|
-
const data = JSON.parse(fs.readFileSync(CACHE_PATH, "utf8"));
|
|
317
|
-
return Array.isArray(data) ? data : null;
|
|
318
|
-
} catch {
|
|
319
|
-
return null;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
function cacheModels(models: JsonModel[]): void {
|
|
324
|
-
try {
|
|
325
|
-
fs.mkdirSync(CACHE_DIR, { recursive: true });
|
|
326
|
-
// Atomic (tmp + rename): other pi processes may be reading the cache right now.
|
|
327
|
-
writeFileAtomic(CACHE_PATH, JSON.stringify(models, null, 2) + "\n");
|
|
328
|
-
} catch {
|
|
329
|
-
// Cache write failure is non-fatal
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
function mergeWithEmbedded(liveModels: JsonModel[], embeddedModels: JsonModel[]): JsonModel[] {
|
|
334
|
-
const embeddedMap = new Map(embeddedModels.map((m) => [m.id, m]));
|
|
335
|
-
const seen = new Set<string>();
|
|
336
|
-
const result: JsonModel[] = [];
|
|
337
|
-
for (const liveModel of liveModels) {
|
|
338
|
-
const embedded = embeddedMap.get(liveModel.id);
|
|
339
|
-
seen.add(liveModel.id);
|
|
340
|
-
if (embedded) {
|
|
341
|
-
// Self-heal: live API pricing is authoritative field-by-field. Prefer the
|
|
342
|
-
// live cost when the API reports it (non-zero); fall back to embedded when
|
|
343
|
-
// the API is silent (0). Coral reports cached_input_per_m as 0 because
|
|
344
|
-
// cached reads are free, which matches the curated cacheRead: 0. A row
|
|
345
|
-
// without a cache-write rate reports 0, which keeps the embedded one.
|
|
346
|
-
// Curation (reasoning/input/compat/name/thinkingLevelMap/maxTokens) still wins via ...embedded.
|
|
347
|
-
result.push({
|
|
348
|
-
...liveModel,
|
|
349
|
-
...embedded,
|
|
350
|
-
cost: {
|
|
351
|
-
input: liveModel.cost.input || embedded.cost.input,
|
|
352
|
-
output: liveModel.cost.output || embedded.cost.output,
|
|
353
|
-
cacheRead: liveModel.cost.cacheRead || embedded.cost.cacheRead,
|
|
354
|
-
cacheWrite: liveModel.cost.cacheWrite || embedded.cost.cacheWrite,
|
|
355
|
-
},
|
|
356
|
-
contextWindow: liveModel.contextWindow || embedded.contextWindow,
|
|
357
|
-
});
|
|
358
|
-
} else {
|
|
359
|
-
result.push(liveModel);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
// Append any embedded models that the live API didn't return
|
|
363
|
-
for (const em of embeddedModels) {
|
|
364
|
-
if (!seen.has(em.id)) {
|
|
365
|
-
result.push(em);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return result;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// Grace period for delisted models. When the provider API stops listing a
|
|
372
|
-
// model, update-models.js moves its last-known definition into
|
|
373
|
-
// deprecated-models.json (stamped with deprecatedAt) instead of dropping it.
|
|
374
|
-
// For 14 days the model keeps working here so in-flight sessions and saved
|
|
375
|
-
// model settings do not break; afterwards it is evicted permanently.
|
|
376
|
-
const DEPRECATED_MODEL_TTL_MS = 14 * 24 * 60 * 60 * 1000;
|
|
377
|
-
|
|
378
|
-
// Grace-period deprecated models with deprecation metadata stripped.
|
|
379
|
-
function activeDeprecatedModels(entries: Record<string, JsonModel & { deprecatedAt?: string }> = deprecatedData as Record<string, JsonModel & { deprecatedAt?: string }>): JsonModel[] {
|
|
380
|
-
const now = Date.now();
|
|
381
|
-
const result: JsonModel[] = [];
|
|
382
|
-
for (const entry of Object.values(entries)) {
|
|
383
|
-
if (!entry?.id) continue;
|
|
384
|
-
const removedAt = Date.parse(entry.deprecatedAt ?? "");
|
|
385
|
-
if (Number.isNaN(removedAt) || now - removedAt > DEPRECATED_MODEL_TTL_MS) continue;
|
|
386
|
-
const model = { ...entry } as JsonModel & { deprecatedAt?: string };
|
|
387
|
-
delete model.deprecatedAt;
|
|
388
|
-
result.push(model);
|
|
389
|
-
}
|
|
390
|
-
return result;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
// Append grace-period deprecated models the list does not already have (live data wins).
|
|
394
|
-
function withDeprecated(models: JsonModel[]): JsonModel[] {
|
|
395
|
-
const seen = new Set(models.map((m) => m.id));
|
|
396
|
-
const extras = activeDeprecatedModels().filter((m) => !seen.has(m.id));
|
|
397
|
-
return extras.length > 0 ? [...models, ...extras] : models;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
function loadStaleModels(embeddedModels: JsonModel[]): JsonModel[] {
|
|
401
|
-
markCacheLoaded(CACHE_PATH); // stat before read: lets a skipped sync spot newer caches
|
|
402
|
-
const cached = loadCachedModels();
|
|
403
|
-
if (!cached || cached.length === 0) return embeddedModels;
|
|
404
|
-
|
|
405
|
-
// Merge embedded models that are missing from cache (newly added models)
|
|
406
|
-
const cachedMap = new Map(cached.map((m) => [m.id, m]));
|
|
407
|
-
for (const em of embeddedModels) {
|
|
408
|
-
if (!cachedMap.has(em.id)) {
|
|
409
|
-
cached.push(em);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
return cached;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Background revalidation, gated by the quiet startup sync policy
|
|
417
|
-
* (sync-policy.ts): no key → no fetch; fresh cache (TTL) → no fetch; another
|
|
418
|
-
* process already fetching → no fetch. When skipped, a cache that another
|
|
419
|
-
* process refreshed since we loaded it is adopted from disk instead.
|
|
420
|
-
* `force` bypasses the TTL (Pi sets it after /login); it is still single-flight.
|
|
421
|
-
*/
|
|
422
|
-
async function revalidateModels(apiKey: string | undefined, embeddedModels: JsonModel[], signal?: AbortSignal, force = false): Promise<JsonModel[] | null> {
|
|
423
|
-
const lease = acquireModelSync({ cachePath: CACHE_PATH, apiKey, force });
|
|
424
|
-
if (!lease) return cacheChangedSinceLoad(CACHE_PATH) ? loadStaleModels(embeddedModels) : null;
|
|
425
|
-
let merged: JsonModel[] | null = null;
|
|
426
|
-
try {
|
|
427
|
-
const liveModels = await fetchLiveModels(apiKey, signal);
|
|
428
|
-
if (!liveModels || liveModels.length === 0) return null;
|
|
429
|
-
merged = mergeWithEmbedded(liveModels, embeddedModels);
|
|
430
|
-
cacheModels(merged);
|
|
431
|
-
return merged;
|
|
432
|
-
} finally {
|
|
433
|
-
lease.release(merged ? "fetched" : signal?.aborted ? "aborted" : "failed");
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
/** pi-ai's clampOpenAIPromptCacheKey, inlined: Coral accepts the same field. */
|
|
438
|
-
function clampPromptCacheKey(key: string | undefined): string | undefined {
|
|
439
|
-
if (key === undefined) return undefined;
|
|
440
|
-
const chars = Array.from(key);
|
|
441
|
-
return chars.length <= 64 ? key : chars.slice(0, 64).join("");
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
export function streamCoral(
|
|
445
|
-
model: any,
|
|
446
|
-
context: any,
|
|
447
|
-
options?: SimpleStreamOptions,
|
|
448
|
-
settings: { park?: boolean } = {},
|
|
449
|
-
): AssistantMessageEventStream {
|
|
450
|
-
const apiKey = options?.apiKey || cachedApiKey || "";
|
|
451
|
-
if (!apiKey) {
|
|
452
|
-
throw new Error(
|
|
453
|
-
`No API key for CoralBricks. Run /login coralbricks, add it to ` +
|
|
454
|
-
`~/.pi/agent/auth.json ("coralbricks"), set CORALBRICKS_API_KEY, or use --api-key.`,
|
|
455
|
-
);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
// pi hands the user's thinking selection to streamSimple providers as
|
|
459
|
-
// options.reasoning (a raw ThinkingLevel); streamOpenAICompletions reads
|
|
460
|
-
// options.reasoningEffort, so replicate pi-ai's clamp+convert here.
|
|
461
|
-
const clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;
|
|
462
|
-
const reasoningEffort = clampedReasoning === "off" ? undefined : clampedReasoning;
|
|
463
|
-
const { reasoning: _reasoning, ...streamOptions } = options ?? {};
|
|
464
|
-
|
|
465
|
-
// Coral groups a conversation's turns by the first session id it finds: a
|
|
466
|
-
// session header, else the body's prompt_cache_key. pi-ai only sends the id as
|
|
467
|
-
// x-session-affinity on Chat Completions when a model opts in (forced below),
|
|
468
|
-
// and omits prompt_cache_key there for every base URL but api.openai.com, so
|
|
469
|
-
// send Coral's own header on both surfaces and the body key on Completions.
|
|
470
|
-
const sessionId = (streamOptions as any).sessionId as string | undefined;
|
|
471
|
-
const sessionHeaders = sessionId
|
|
472
|
-
? { "x-coral-session": sessionId, ...((streamOptions as any).headers ?? {}) }
|
|
473
|
-
: (streamOptions as any).headers;
|
|
474
|
-
const promptCacheKey = (streamOptions as any).cacheRetention === "none" ? undefined : clampPromptCacheKey(sessionId);
|
|
475
|
-
const withPromptCacheKey = (params: any) => {
|
|
476
|
-
if (!promptCacheKey || params?.prompt_cache_key !== undefined) return params;
|
|
477
|
-
return { ...params, prompt_cache_key: promptCacheKey };
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
const compat = { ...model.compat, sendSessionAffinityHeaders: true };
|
|
481
|
-
const streamModel = { ...model, compat };
|
|
482
|
-
|
|
483
|
-
if (streamModel.api !== "openai-responses") {
|
|
484
|
-
const onPayload = (streamOptions as any).onPayload;
|
|
485
|
-
return streamOpenAICompletions(streamModel, context, {
|
|
486
|
-
...streamOptions,
|
|
487
|
-
headers: sessionHeaders,
|
|
488
|
-
reasoningEffort,
|
|
489
|
-
apiKey,
|
|
490
|
-
onPayload: async (params: any, payloadModel: any) => withPromptCacheKey((await onPayload?.(params, payloadModel)) ?? params),
|
|
491
|
-
} as any);
|
|
492
|
-
}
|
|
493
|
-
if (!settings.park) {
|
|
494
|
-
return streamOpenAIResponses(streamModel, context, { ...streamOptions, headers: sessionHeaders, reasoningEffort, apiKey } as any);
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
let plan: ParkPlan | undefined;
|
|
498
|
-
const baseFetch = (streamOptions as any).fetch ?? ((input: any, init?: any) => globalThis.fetch(input, init));
|
|
499
|
-
const stream = streamOpenAIResponses(streamModel, context, {
|
|
500
|
-
...streamOptions,
|
|
501
|
-
headers: sessionHeaders,
|
|
502
|
-
reasoningEffort,
|
|
503
|
-
apiKey,
|
|
504
|
-
fetch: withParkFallback(baseFetch, () => plan),
|
|
505
|
-
onPayload: async (params: any, payloadModel: any) => {
|
|
506
|
-
const replaced = await options?.onPayload?.(params, payloadModel);
|
|
507
|
-
plan = planPark(withPromptCacheKey(replaced ?? params), context?.messages, model);
|
|
508
|
-
return plan.params;
|
|
509
|
-
},
|
|
510
|
-
} as any);
|
|
511
|
-
void stream.result().then((message: any) => {
|
|
512
|
-
if (plan && message?.responseId && message.stopReason !== "error" && message.stopReason !== "aborted") {
|
|
513
|
-
park(message.responseId, model.id, plan.input);
|
|
514
|
-
}
|
|
515
|
-
}, () => {});
|
|
516
|
-
return stream;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
// API Key Resolution (via ModelRegistry)
|
|
520
|
-
|
|
521
|
-
let cachedApiKey: string | undefined;
|
|
522
|
-
|
|
523
|
-
async function resolveApiKey(modelRegistry: ModelRegistry): Promise<void> {
|
|
524
|
-
cachedApiKey = (await modelRegistry.getApiKeyForProvider(PROVIDER_ID)) ?? undefined;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* The chat models Pi composes from a `pi.registerProvider(name, config)` catalog:
|
|
529
|
-
* each row bound to this provider's id, endpoint and selected API. The native
|
|
530
|
-
* registration below serves exactly these, so ids, pricing, thinking maps and
|
|
531
|
-
* compat flags reach Pi unchanged.
|
|
532
|
-
*/
|
|
533
|
-
function toProviderModels(models: JsonModel[], api: Api): Model<Api>[] {
|
|
534
|
-
return models.map((model) => ({ ...model, api, provider: PROVIDER_ID, baseUrl: BASE_URL, headers: undefined }) as unknown as Model<Api>);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
/** The key a refresh should fetch with: Pi's own resolution when a session exposed it. */
|
|
538
|
-
async function refreshApiKey(modelRegistry: ModelRegistry | undefined, credential: Credential | undefined): Promise<string | undefined> {
|
|
539
|
-
if (modelRegistry) return (await modelRegistry.getApiKeyForProvider(PROVIDER_ID)) ?? undefined;
|
|
540
|
-
if (credential?.type === "api_key" && credential.key) return credential.key;
|
|
541
|
-
return process.env[CORALBRICKS_ENV_VAR] || undefined;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
// Extension Entry Point
|
|
545
|
-
|
|
546
|
-
export default function (pi: ExtensionAPI) {
|
|
547
|
-
const embeddedModels = modelsData as JsonModel[];
|
|
548
|
-
const customModels = customModelsData as JsonModel[];
|
|
549
|
-
const patches = patchData as PatchData;
|
|
550
|
-
|
|
551
|
-
let revalidateAbort: AbortController | null = null;
|
|
552
|
-
let settingsCommand: ReturnType<typeof createSettingsCommand> | undefined;
|
|
553
|
-
const copy: CoralCopy = {
|
|
554
|
-
version: PACKAGE_VERSION,
|
|
555
|
-
// A newer copy took this runtime over while extensions loaded; Pi serves its
|
|
556
|
-
// registration instead of ours, and our hooks below go inert.
|
|
557
|
-
resign: () => revalidateAbort?.abort(),
|
|
558
|
-
settings: async (args, ctx) => settingsCommand?.handler(args, ctx as any),
|
|
559
|
-
};
|
|
560
|
-
const claim = claimRuntime(pi, copy);
|
|
561
|
-
// A newer copy, or an equal one that loaded first, already serves this runtime.
|
|
562
|
-
if (!claim.owns()) return;
|
|
563
|
-
|
|
564
|
-
let config = loadConfig();
|
|
565
|
-
let currentModels = buildModels(loadStaleModels(embeddedModels), customModels, patches);
|
|
566
|
-
const selectedApi = () => config.api === "responses" ? "openai-responses" : "openai-completions";
|
|
567
|
-
let providerModels = toProviderModels(currentModels, selectedApi());
|
|
568
|
-
|
|
569
|
-
// The key the catalog was last revalidated with (null: not yet this process).
|
|
570
|
-
// Pi refreshes catalogs on startup, on /model and after /login; only a changed
|
|
571
|
-
// key (a fresh /login, --api-key) or a forced refresh re-fetches /v1/models,
|
|
572
|
-
// so session-start revalidation stays the one routine fetch.
|
|
573
|
-
let revalidatedKey: string | undefined | null = null;
|
|
574
|
-
let keySync: Promise<void> = Promise.resolve();
|
|
575
|
-
// The in-flight session-start revalidation; it never rejects.
|
|
576
|
-
let sessionSync: Promise<void> = Promise.resolve();
|
|
577
|
-
let modelRegistry: ModelRegistry | undefined;
|
|
578
|
-
|
|
579
|
-
async function refreshModels(context: RefreshModelsContext): Promise<void> {
|
|
580
|
-
if (!context.allowNetwork || !claim.owns()) return;
|
|
581
|
-
await keySync;
|
|
582
|
-
const apiKey = await refreshApiKey(modelRegistry, context.credential);
|
|
583
|
-
if (context.signal.aborted || (!context.force && apiKey === revalidatedKey)) return;
|
|
584
|
-
revalidatedKey = apiKey;
|
|
585
|
-
cachedApiKey = apiKey;
|
|
586
|
-
revalidateAbort?.abort(); // a newer credential supersedes an in-flight session revalidation
|
|
587
|
-
await sessionSync; // ...and must release its sync lock first, or this refresh would skip as "locked"
|
|
588
|
-
if (context.signal.aborted) return;
|
|
589
|
-
// Through the quiet-sync lease: a forced refresh (after /login) or a new key
|
|
590
|
-
// skips the TTL; otherwise a fresh disk cache from another process serves.
|
|
591
|
-
const freshBase = claim.owns() ? await revalidateModels(apiKey, embeddedModels, context.signal, context.force) : null;
|
|
592
|
-
if (!freshBase || context.signal.aborted) return;
|
|
593
|
-
const next = buildModels(freshBase, customModels, patches);
|
|
594
|
-
await context.publish({
|
|
595
|
-
update: () => {
|
|
596
|
-
currentModels = next;
|
|
597
|
-
providerModels = toProviderModels(next, selectedApi());
|
|
598
|
-
},
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
function registerProvider() {
|
|
603
|
-
if (!claim.owns()) return;
|
|
604
|
-
providerModels = toProviderModels(currentModels, selectedApi());
|
|
605
|
-
// An already-selected model may still carry the previous API. Snapshot
|
|
606
|
-
// the current selection per request, without mutating that model/history.
|
|
607
|
-
const stream = (model: Model<any>, context: any, options?: any) =>
|
|
608
|
-
lazyStream(model, async () => streamCoral({ ...model, api: selectedApi() }, context, options, { park: config.park }));
|
|
609
|
-
// Native provider (pi-ai `Provider`): the same catalog and stream as the
|
|
610
|
-
// config form, plus API-key auth with a `/login coralbricks` flow.
|
|
611
|
-
pi.registerProvider({
|
|
612
|
-
id: PROVIDER_ID,
|
|
613
|
-
name: PROVIDER_NAME,
|
|
614
|
-
baseUrl: BASE_URL,
|
|
615
|
-
auth: { apiKey: coralApiKeyAuth() },
|
|
616
|
-
getModels: () => providerModels,
|
|
617
|
-
refreshModels,
|
|
618
|
-
stream,
|
|
619
|
-
streamSimple: stream,
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
registerProvider();
|
|
623
|
-
settingsCommand = createSettingsCommand(() => config, (next) => {
|
|
624
|
-
config = next;
|
|
625
|
-
registerProvider();
|
|
626
|
-
});
|
|
627
|
-
// One command per runtime, served by whichever copy owns it when invoked.
|
|
628
|
-
if (claim.first) {
|
|
629
|
-
pi.registerCommand(SETTINGS_COMMAND, {
|
|
630
|
-
description: settingsCommand.description,
|
|
631
|
-
handler: (args, ctx) => (claim.owner() ?? copy).settings(args, ctx),
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
pi.on("session_start", async (_event, ctx) => {
|
|
636
|
-
if (!claim.owns()) return;
|
|
637
|
-
modelRegistry = ctx.modelRegistry;
|
|
638
|
-
revalidateAbort?.abort();
|
|
639
|
-
revalidateAbort = new AbortController();
|
|
640
|
-
const signal = revalidateAbort.signal;
|
|
641
|
-
const resolved = resolveApiKey(ctx.modelRegistry);
|
|
642
|
-
keySync = resolved.then(() => { revalidatedKey = cachedApiKey; }, () => {});
|
|
643
|
-
// Fire-and-forget: startup never waits on the network. Only the owning copy
|
|
644
|
-
// reaches the sync lease (and so the lock file and /v1/models).
|
|
645
|
-
sessionSync = resolved
|
|
646
|
-
.then(() => (claim.owns() && !signal.aborted ? revalidateModels(cachedApiKey, embeddedModels, signal) : null))
|
|
647
|
-
.then((freshBase) => {
|
|
648
|
-
if (freshBase && !signal.aborted) {
|
|
649
|
-
currentModels = buildModels(freshBase, customModels, patches);
|
|
650
|
-
registerProvider();
|
|
651
|
-
}
|
|
652
|
-
})
|
|
653
|
-
.catch(() => { /* Keep the stale catalog if credential resolution fails. */ });
|
|
654
|
-
});
|
|
655
|
-
|
|
656
|
-
pi.on("session_shutdown", () => {
|
|
657
|
-
revalidateAbort?.abort();
|
|
658
|
-
claim.release();
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
export { applyPatch, buildModels, mergeWithEmbedded, transformApiModel, activeDeprecatedModels, withDeprecated, parseContextWindow, PROVIDER_ID, BASE_URL };
|