@e4779/pi-fabric 0.102.0-fork.16 → 0.105.0-fork.22
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 +44 -13
- package/THIRD_PARTY_NOTICES.md +10 -2
- package/dist/activity/store.d.ts +3 -0
- package/dist/activity/store.d.ts.map +1 -1
- package/dist/activity/workflow-items.d.ts +33 -0
- package/dist/activity/workflow-items.d.ts.map +1 -0
- package/dist/actors/binding-store.d.ts.map +1 -1
- package/dist/actors/manager.d.ts +6 -0
- package/dist/actors/manager.d.ts.map +1 -1
- package/dist/actors/mesh-monitor.d.ts +2 -2
- package/dist/actors/mesh-monitor.d.ts.map +1 -1
- package/dist/actors/registry-store.d.ts.map +1 -1
- package/dist/actors/types.d.ts +11 -0
- package/dist/actors/types.d.ts.map +1 -1
- package/dist/agents/child-env.d.ts +29 -0
- package/dist/agents/child-env.d.ts.map +1 -0
- package/dist/agents/fork-seed.d.ts +21 -0
- package/dist/agents/fork-seed.d.ts.map +1 -0
- package/dist/agents/handoff.d.ts +7 -1
- package/dist/agents/handoff.d.ts.map +1 -1
- package/dist/agents/hosted-run.d.ts +63 -0
- package/dist/agents/hosted-run.d.ts.map +1 -0
- package/dist/agents/manager.d.ts +21 -1
- package/dist/agents/manager.d.ts.map +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/runner-notice.d.ts +7 -0
- package/dist/agents/runner-notice.d.ts.map +1 -0
- package/dist/agents/runner-protocol.d.ts +158 -0
- package/dist/agents/runner-protocol.d.ts.map +1 -0
- package/dist/agents/runner-registry.d.ts +223 -0
- package/dist/agents/runner-registry.d.ts.map +1 -0
- package/dist/agents/transports/process-transport.d.ts.map +1 -1
- package/dist/agents/transports/process-utils.d.ts +4 -1
- package/dist/agents/transports/process-utils.d.ts.map +1 -1
- package/dist/agents/types.d.ts +89 -4
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/worktree-manager.d.ts +21 -0
- package/dist/agents/worktree-manager.d.ts.map +1 -1
- package/dist/agents/write-guard.d.ts +16 -0
- package/dist/agents/write-guard.d.ts.map +1 -0
- package/dist/agents/write-guard.js +13 -0
- package/dist/agents/write-guard.js.map +7 -0
- package/dist/agents.js +13 -12
- package/dist/agents.js.map +1 -1
- package/dist/assessment.d.ts +3 -0
- package/dist/assessment.d.ts.map +1 -0
- package/dist/assessment.js +15 -0
- package/dist/assessment.js.map +7 -0
- package/dist/audit/assessment.d.ts +74 -0
- package/dist/audit/assessment.d.ts.map +1 -0
- package/dist/audit/details.d.ts +4 -0
- package/dist/audit/details.d.ts.map +1 -1
- package/dist/audit/index.d.ts +1 -0
- package/dist/audit/index.d.ts.map +1 -1
- package/dist/audit/projection.d.ts +2 -1
- package/dist/audit/projection.d.ts.map +1 -1
- package/dist/audit/trace.d.ts +16 -1
- package/dist/audit/trace.d.ts.map +1 -1
- package/dist/cache/leases.d.ts +2 -1
- package/dist/cache/leases.d.ts.map +1 -1
- package/dist/capture/interceptor.d.ts.map +1 -1
- package/dist/chunks/chunk-2USMWEE6.js +81 -0
- package/dist/chunks/chunk-2USMWEE6.js.map +7 -0
- package/dist/chunks/chunk-2Y24ML7H.js +115 -0
- package/dist/chunks/chunk-2Y24ML7H.js.map +7 -0
- package/dist/chunks/chunk-3GJJG2FV.js +1329 -0
- package/dist/chunks/chunk-3GJJG2FV.js.map +7 -0
- package/dist/chunks/{chunk-5VTBHJN3.js → chunk-3KDUMDPZ.js} +153 -29
- package/dist/chunks/chunk-3KDUMDPZ.js.map +7 -0
- package/dist/chunks/chunk-4RTHQGES.js +189 -0
- package/dist/chunks/chunk-4RTHQGES.js.map +7 -0
- package/dist/chunks/{chunk-ZZ66L3W5.js → chunk-5MNLVHF5.js} +30 -7
- package/dist/chunks/chunk-5MNLVHF5.js.map +7 -0
- package/dist/chunks/{chunk-RAO6TQFP.js → chunk-5XBYFSI5.js} +26 -6
- package/dist/chunks/chunk-5XBYFSI5.js.map +7 -0
- package/dist/chunks/{chunk-J2HV2URQ.js → chunk-7EYJE4TW.js} +1 -1
- package/dist/chunks/{chunk-J2HV2URQ.js.map → chunk-7EYJE4TW.js.map} +2 -2
- package/dist/chunks/{chunk-57CMH4SW.js → chunk-7JU7Z4XQ.js} +2 -2
- package/dist/chunks/chunk-7QKKLBHJ.js +33 -0
- package/dist/chunks/chunk-7QKKLBHJ.js.map +7 -0
- package/dist/chunks/chunk-7XRUMDV7.js +235 -0
- package/dist/chunks/chunk-7XRUMDV7.js.map +7 -0
- package/dist/chunks/{chunk-DUJ46TIP.js → chunk-ABJCSNZO.js} +4 -4
- package/dist/chunks/chunk-B2Y4364O.js +78 -0
- package/dist/chunks/chunk-B2Y4364O.js.map +7 -0
- package/dist/chunks/{chunk-4TKPBEPB.js → chunk-BVJBYFHD.js} +9 -3
- package/dist/chunks/{chunk-4TKPBEPB.js.map → chunk-BVJBYFHD.js.map} +2 -2
- package/dist/chunks/{chunk-KP4ANT6L.js → chunk-C7EEG6SM.js} +2 -2
- package/dist/chunks/{chunk-NHMICIEU.js → chunk-CCHZXF6K.js} +3 -3
- package/dist/chunks/{chunk-W63E3WEO.js → chunk-CXTTLBUV.js} +3 -2
- package/dist/chunks/chunk-CXTTLBUV.js.map +7 -0
- package/dist/chunks/{chunk-HOX6VW45.js → chunk-CYMDX3XP.js} +1 -1
- package/dist/chunks/{chunk-HOX6VW45.js.map → chunk-CYMDX3XP.js.map} +1 -1
- package/dist/chunks/chunk-DK35W6U7.js +259 -0
- package/dist/chunks/chunk-DK35W6U7.js.map +7 -0
- package/dist/chunks/{chunk-5JN5AWNV.js → chunk-DZ4WN5XJ.js} +3 -3
- package/dist/chunks/chunk-EXWS4ZS3.js +6490 -0
- package/dist/chunks/chunk-EXWS4ZS3.js.map +7 -0
- package/dist/chunks/{chunk-QHYBSIIO.js → chunk-FB24AOIJ.js} +39 -37
- package/dist/chunks/{chunk-QHYBSIIO.js.map → chunk-FB24AOIJ.js.map} +1 -1
- package/dist/chunks/chunk-FSB2VIRZ.js +435 -0
- package/dist/chunks/chunk-FSB2VIRZ.js.map +7 -0
- package/dist/chunks/{chunk-PNDYFU64.js → chunk-GJVPP3NN.js} +81 -11
- package/dist/chunks/chunk-GJVPP3NN.js.map +7 -0
- package/dist/chunks/{chunk-B5D6GA77.js → chunk-GYPDGW27.js} +100 -92
- package/dist/chunks/chunk-GYPDGW27.js.map +7 -0
- package/dist/chunks/{chunk-LEFBW2GK.js → chunk-IAFI4A2I.js} +44 -2
- package/dist/chunks/{chunk-LEFBW2GK.js.map → chunk-IAFI4A2I.js.map} +3 -3
- package/dist/chunks/{chunk-PWS2OXLV.js → chunk-IIPKG52D.js} +1 -1
- package/dist/chunks/chunk-IIPKG52D.js.map +7 -0
- package/dist/chunks/chunk-ITVLKXCI.js +266 -0
- package/dist/chunks/chunk-ITVLKXCI.js.map +7 -0
- package/dist/chunks/chunk-JKQARSWR.js +265 -0
- package/dist/chunks/chunk-JKQARSWR.js.map +7 -0
- package/dist/chunks/{chunk-AYBIR4YV.js → chunk-KJZAOENY.js} +6 -4
- package/dist/chunks/chunk-KJZAOENY.js.map +7 -0
- package/dist/chunks/{chunk-74BA4VSX.js → chunk-KQ6R5EWR.js} +1462 -1405
- package/dist/chunks/chunk-KQ6R5EWR.js.map +7 -0
- package/dist/chunks/chunk-L22K5BWU.js +180 -0
- package/dist/chunks/chunk-L22K5BWU.js.map +7 -0
- package/dist/chunks/{chunk-7XJB2USB.js → chunk-LOLCTWJF.js} +4 -4
- package/dist/chunks/{chunk-QETG2GVX.js → chunk-M5IN6DMF.js} +34 -31
- package/dist/chunks/chunk-M5IN6DMF.js.map +7 -0
- package/dist/chunks/{chunk-64O5L7EW.js → chunk-M6IRQ3QT.js} +2 -2
- package/dist/chunks/{chunk-TX6E5W7H.js → chunk-NTC2MCB6.js} +1 -1
- package/dist/chunks/chunk-NTC2MCB6.js.map +7 -0
- package/dist/chunks/{chunk-EPYLZWJV.js → chunk-OVBKQCYL.js} +2 -2
- package/dist/chunks/{chunk-YV2PHCDB.js → chunk-PYFJW3HC.js} +16 -2
- package/dist/chunks/{chunk-YV2PHCDB.js.map → chunk-PYFJW3HC.js.map} +3 -3
- package/dist/chunks/{chunk-Z5Y65YBX.js → chunk-PYQM7KPL.js} +3 -2
- package/dist/chunks/{chunk-BEJF2JX2.js → chunk-QLFDPXK7.js} +33 -2
- package/dist/chunks/chunk-QLFDPXK7.js.map +7 -0
- package/dist/chunks/chunk-QUWC6YCN.js +125 -0
- package/dist/chunks/chunk-QUWC6YCN.js.map +7 -0
- package/dist/chunks/{chunk-DKVJREDI.js → chunk-QY7YK7M6.js} +2 -2
- package/dist/chunks/{chunk-WMJ2AVQQ.js → chunk-R5F6CHW2.js} +34 -18
- package/dist/chunks/chunk-R5F6CHW2.js.map +7 -0
- package/dist/chunks/chunk-S3IRPDSO.js +57 -0
- package/dist/chunks/chunk-S3IRPDSO.js.map +7 -0
- package/dist/chunks/{chunk-7BG5COXB.js → chunk-SVDHQUTM.js} +21 -4
- package/dist/chunks/chunk-SVDHQUTM.js.map +7 -0
- package/dist/chunks/{chunk-HG4DMARW.js → chunk-T5CU2GPZ.js} +116 -26
- package/dist/chunks/chunk-T5CU2GPZ.js.map +7 -0
- package/dist/chunks/{chunk-RIFG4HS6.js → chunk-TFFZVLR2.js} +141 -9
- package/dist/chunks/chunk-TFFZVLR2.js.map +7 -0
- package/dist/chunks/{chunk-BUQZBG6O.js → chunk-U2UBUKNQ.js} +136 -136
- package/dist/chunks/chunk-U2UBUKNQ.js.map +7 -0
- package/dist/chunks/chunk-U366I5K2.js +363 -0
- package/dist/chunks/chunk-U366I5K2.js.map +7 -0
- package/dist/chunks/{chunk-4NF3S3NM.js → chunk-UTOBAZ5T.js} +1 -1
- package/dist/chunks/chunk-UTOBAZ5T.js.map +7 -0
- package/dist/chunks/chunk-V73NIH6B.js +127 -0
- package/dist/chunks/chunk-V73NIH6B.js.map +7 -0
- package/dist/chunks/{chunk-PN4EKNRE.js → chunk-VON4TSO3.js} +132 -12
- package/dist/chunks/chunk-VON4TSO3.js.map +7 -0
- package/dist/chunks/{chunk-5ZJV4LAX.js → chunk-VPRJOD4Y.js} +4 -4
- package/dist/chunks/{chunk-FDIEQEXS.js → chunk-VSDUSNIA.js} +4 -4
- package/dist/chunks/chunk-VSDUSNIA.js.map +7 -0
- package/dist/chunks/{chunk-RG22JKIC.js → chunk-W7X4XEQU.js} +2 -2
- package/dist/chunks/{chunk-LV4IT75S.js → chunk-WLLXKS6I.js} +2 -2
- package/dist/chunks/chunk-WOLUDZVR.js +197 -0
- package/dist/chunks/chunk-WOLUDZVR.js.map +7 -0
- package/dist/chunks/{chunk-YVDBHS4C.js → chunk-WREA4RNR.js} +3 -3
- package/dist/chunks/{chunk-QE2JFB7F.js → chunk-WYUV6WL3.js} +16 -6
- package/dist/chunks/chunk-WYUV6WL3.js.map +7 -0
- package/dist/chunks/{chunk-NGGI6LDC.js → chunk-X2TRSE7D.js} +2 -2
- package/dist/chunks/{chunk-VRAGOMN4.js → chunk-YRDCJZZW.js} +34 -1
- package/dist/chunks/chunk-YRDCJZZW.js.map +7 -0
- package/dist/chunks/{chunk-CC63CY6R.js → chunk-YYSZBD7S.js} +17 -261
- package/dist/chunks/chunk-YYSZBD7S.js.map +7 -0
- package/dist/chunks/{chunk-A4VP7HDF.js → chunk-ZLNJDTCN.js} +2 -2
- package/dist/chunks/{chunk-G4CSXNBT.js → chunk-ZXKYU6CH.js} +42 -5
- package/dist/chunks/chunk-ZXKYU6CH.js.map +7 -0
- package/dist/cli/decisions.d.ts +8 -0
- package/dist/cli/decisions.d.ts.map +1 -0
- package/dist/cli/decisions.js +131 -0
- package/dist/cli/decisions.js.map +7 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +56 -0
- package/dist/cli/index.js.map +7 -0
- package/dist/cli/mesh.d.ts +3 -0
- package/dist/cli/mesh.d.ts.map +1 -0
- package/dist/cli/mesh.js +126 -0
- package/dist/cli/mesh.js.map +7 -0
- package/dist/commands/fabric.d.ts.map +1 -1
- package/dist/compaction/carry.d.ts +23 -0
- package/dist/compaction/carry.d.ts.map +1 -0
- package/dist/compaction/hook.d.ts +9 -0
- package/dist/compaction/hook.d.ts.map +1 -1
- package/dist/compaction/hook.js +6 -6
- package/dist/compaction/orphan-repair.d.ts +11 -0
- package/dist/compaction/orphan-repair.d.ts.map +1 -0
- package/dist/compaction/orphan-repair.js +75 -0
- package/dist/compaction/orphan-repair.js.map +7 -0
- package/dist/compaction/owner.d.ts +26 -0
- package/dist/compaction/owner.d.ts.map +1 -0
- package/dist/compaction/owner.js +26 -0
- package/dist/compaction/owner.js.map +7 -0
- package/dist/compaction/pressure.d.ts +19 -0
- package/dist/compaction/pressure.d.ts.map +1 -0
- package/dist/compaction/render.d.ts +4 -0
- package/dist/compaction/render.d.ts.map +1 -1
- package/dist/compaction/threshold.d.ts +6 -1
- package/dist/compaction/threshold.d.ts.map +1 -1
- package/dist/components/configuration.js +6 -6
- package/dist/components/provider-component.d.ts +1 -1
- package/dist/components/provider-component.d.ts.map +1 -1
- package/dist/config.d.ts +45 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/core/action-registry.d.ts +5 -1
- package/dist/core/action-registry.d.ts.map +1 -1
- package/dist/core/action-registry.js +8 -8
- package/dist/core/approval-controller.d.ts +5 -1
- package/dist/core/approval-controller.d.ts.map +1 -1
- package/dist/core/approval-overrides.d.ts +11 -0
- package/dist/core/approval-overrides.d.ts.map +1 -0
- package/dist/core/atomic-write.d.ts +77 -0
- package/dist/core/atomic-write.d.ts.map +1 -1
- package/dist/core/compact-controller.d.ts +8 -0
- package/dist/core/compact-controller.d.ts.map +1 -1
- package/dist/core/file-lock.d.ts.map +1 -1
- package/dist/core/foreground-tools.d.ts +45 -0
- package/dist/core/foreground-tools.d.ts.map +1 -0
- package/dist/core/provider-bindings.d.ts +10 -1
- package/dist/core/provider-bindings.d.ts.map +1 -1
- package/dist/core/provider-operations.js.map +1 -1
- package/dist/core/tool-ownership.d.ts +18 -2
- package/dist/core/tool-ownership.d.ts.map +1 -1
- package/dist/decisions/command.d.ts +5 -0
- package/dist/decisions/command.d.ts.map +1 -0
- package/dist/decisions/command.js +74 -0
- package/dist/decisions/command.js.map +7 -0
- package/dist/decisions/host.d.ts +24 -0
- package/dist/decisions/host.d.ts.map +1 -0
- package/dist/decisions/store.d.ts +147 -0
- package/dist/decisions/store.d.ts.map +1 -0
- package/dist/durable.d.ts +38 -0
- package/dist/durable.d.ts.map +1 -0
- package/dist/durable.js +274 -0
- package/dist/durable.js.map +7 -0
- package/dist/entropy/index.js +10 -9
- package/dist/execution-service.d.ts +41 -1
- package/dist/execution-service.d.ts.map +1 -1
- package/dist/extension-bootstrap.d.ts +7 -0
- package/dist/extension-bootstrap.d.ts.map +1 -0
- package/dist/extension-bootstrap.js +51 -0
- package/dist/extension-bootstrap.js.map +7 -0
- package/dist/extension.d.ts +8 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/fabric-exec-tool.d.ts.map +1 -1
- package/dist/fabric-runtime-state.d.ts +8 -0
- package/dist/fabric-runtime-state.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +2432 -346
- package/dist/fabric-runtime-state.js.map +4 -4
- package/dist/fabric-state.d.ts +22 -0
- package/dist/fabric-state.d.ts.map +1 -1
- package/dist/host-compatibility.d.ts +1 -1
- package/dist/host-compatibility.d.ts.map +1 -1
- package/dist/index.d.ts +5 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +68 -6250
- package/dist/index.js.map +4 -4
- package/dist/jev/observation.js +5 -5
- package/dist/jev-fabric/bridge.d.ts +15 -0
- package/dist/jev-fabric/bridge.d.ts.map +1 -1
- package/dist/jev-fabric/client.js +1 -1
- package/dist/jev-fabric/client.js.map +2 -2
- package/dist/jev-fabric/operations.d.ts +2 -0
- package/dist/jev-fabric/operations.d.ts.map +1 -1
- package/dist/jev-fabric/operations.js +1 -1
- package/dist/jev-fabric/operations.js.map +2 -2
- package/dist/jev-fabric/resolve.js +1 -1
- package/dist/jev-fabric/resolve.js.map +2 -2
- package/dist/jev.js +9 -9
- package/dist/lifecycle/types.d.ts.map +1 -1
- package/dist/memory/client.d.ts +3 -0
- package/dist/memory/client.d.ts.map +1 -1
- package/dist/memory/digest.js +2 -2
- package/dist/memory/discovery.js +6 -6
- package/dist/memory/expand-service.d.ts.map +1 -1
- package/dist/memory/file-worker.d.ts.map +1 -1
- package/dist/memory/file-worker.js +10 -9
- package/dist/memory/file-worker.js.map +2 -2
- package/dist/memory/host-source.d.ts +2 -1
- package/dist/memory/host-source.d.ts.map +1 -1
- package/dist/memory/normalize.js +5 -5
- package/dist/memory/portable.d.ts +3 -1
- package/dist/memory/portable.d.ts.map +1 -1
- package/dist/memory/request-cache.d.ts +4 -2
- package/dist/memory/request-cache.d.ts.map +1 -1
- package/dist/memory/request-context.d.ts +3 -0
- package/dist/memory/request-context.d.ts.map +1 -1
- package/dist/memory/search.js +7 -7
- package/dist/memory/worker-provider.d.ts.map +1 -1
- package/dist/memory/worker-provider.js +10 -10
- package/dist/memory.js +14 -13
- package/dist/memory.js.map +2 -2
- package/dist/mesh/grants.d.ts +86 -0
- package/dist/mesh/grants.d.ts.map +1 -0
- package/dist/mesh/store.d.ts +89 -0
- package/dist/mesh/store.d.ts.map +1 -1
- package/dist/programs/host.d.ts +22 -0
- package/dist/programs/host.d.ts.map +1 -0
- package/dist/programs/host.js +171 -0
- package/dist/programs/host.js.map +7 -0
- package/dist/programs/source.d.ts +16 -0
- package/dist/programs/source.d.ts.map +1 -0
- package/dist/programs/store.d.ts +81 -0
- package/dist/programs/store.d.ts.map +1 -0
- package/dist/protocol.d.ts +153 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +15 -1
- package/dist/providers/agents-actions.d.ts.map +1 -1
- package/dist/providers/agents-message-router.d.ts.map +1 -1
- package/dist/providers/agents-progress.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/cache-provider.d.ts +1 -1
- package/dist/providers/cache-provider.d.ts.map +1 -1
- package/dist/providers/compact-provider.d.ts +13 -1
- package/dist/providers/compact-provider.d.ts.map +1 -1
- package/dist/providers/decisions-provider.d.ts +17 -0
- package/dist/providers/decisions-provider.d.ts.map +1 -0
- package/dist/providers/jev-provider.js +9 -9
- package/dist/providers/memory-provider.d.ts.map +1 -1
- package/dist/providers/memory-provider.js +9 -9
- package/dist/providers/mesh-provider.d.ts +4 -0
- package/dist/providers/mesh-provider.d.ts.map +1 -1
- package/dist/providers/pi-native-mcp.d.ts.map +1 -1
- package/dist/providers/pi-tools-provider.d.ts.map +1 -1
- package/dist/providers/programs-provider.d.ts +18 -0
- package/dist/providers/programs-provider.d.ts.map +1 -0
- package/dist/providers/state-provider.d.ts +4 -1
- package/dist/providers/state-provider.d.ts.map +1 -1
- package/dist/providers/thinking-provider.d.ts +15 -0
- package/dist/providers/thinking-provider.d.ts.map +1 -0
- package/dist/residency/actor-client.js +3 -3
- package/dist/residency/client.d.ts.map +1 -1
- package/dist/residency/host.d.ts +21 -0
- package/dist/residency/host.d.ts.map +1 -1
- package/dist/residency/host.js +28 -22
- package/dist/residency/launcher-owner.d.ts +2 -0
- package/dist/residency/launcher-owner.d.ts.map +1 -1
- package/dist/residency/launcher.js +35 -20
- package/dist/residency/launcher.js.map +3 -3
- package/dist/residency/pi-entry.js +26 -22
- package/dist/residency/pi-entry.js.map +1 -1
- package/dist/residency/protocol.d.ts +12 -2
- package/dist/residency/protocol.d.ts.map +1 -1
- package/dist/runners.d.ts +9 -0
- package/dist/runners.d.ts.map +1 -0
- package/dist/runners.js +182 -0
- package/dist/runners.js.map +7 -0
- 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 +35 -7
- package/dist/runtime/cpython-runtime.js.map +2 -2
- package/dist/runtime/deadline-pause.d.ts +26 -0
- package/dist/runtime/deadline-pause.d.ts.map +1 -0
- package/dist/runtime/guest-types.d.ts +1 -1
- package/dist/runtime/guest-types.d.ts.map +1 -1
- package/dist/runtime/guest-types.js +1 -1
- package/dist/runtime/kernel.d.ts +3 -0
- package/dist/runtime/kernel.d.ts.map +1 -1
- package/dist/runtime/monty-runtime.d.ts.map +1 -1
- package/dist/runtime/monty-runtime.js +33 -12
- package/dist/runtime/monty-runtime.js.map +2 -2
- package/dist/runtime/node-process-runtime.d.ts.map +1 -1
- package/dist/runtime/node-process-runtime.js +4 -3
- package/dist/runtime/orchestration.d.ts.map +1 -1
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
- package/dist/runtime/quickjs-runtime.js +2 -1
- package/dist/runtime/typescript-kernel.js +8 -7
- package/dist/runtime/typescript-kernel.js.map +1 -1
- package/dist/runtime-state-builtins.d.ts.map +1 -1
- package/dist/schema/controller.d.ts.map +1 -1
- package/dist/schema/policy.d.ts.map +1 -1
- package/dist/scope.d.ts +69 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +37 -0
- package/dist/scope.js.map +7 -0
- package/dist/speculation/eligibility.d.ts.map +1 -1
- package/dist/speculation/python-scanner.js +1 -1
- package/dist/speculation/python-scanner.js.map +2 -2
- package/dist/speculation/scanner.js +1 -1
- package/dist/speculation/scanner.js.map +2 -2
- package/dist/state/binding.d.ts +17 -0
- package/dist/state/binding.d.ts.map +1 -0
- package/dist/state/store.d.ts +8 -2
- package/dist/state/store.d.ts.map +1 -1
- package/dist/state/types.d.ts +23 -2
- package/dist/state/types.d.ts.map +1 -1
- package/dist/storage/retention.d.ts +7 -0
- package/dist/storage/retention.d.ts.map +1 -1
- package/dist/storage/scratch.d.ts.map +1 -1
- package/dist/thinking-control.d.ts +64 -0
- package/dist/thinking-control.d.ts.map +1 -0
- package/dist/thinking-control.js +15 -0
- package/dist/thinking-control.js.map +7 -0
- package/dist/thinking.d.ts +61 -0
- package/dist/thinking.d.ts.map +1 -1
- package/dist/topology/control-plane.d.ts +13 -0
- package/dist/topology/control-plane.d.ts.map +1 -1
- package/dist/topology/participant-directory.d.ts +2 -0
- package/dist/topology/participant-directory.d.ts.map +1 -1
- package/dist/topology/provider-participants.d.ts +72 -0
- package/dist/topology/provider-participants.d.ts.map +1 -0
- package/dist/topology/records.d.ts.map +1 -1
- package/dist/topology/types.d.ts +13 -3
- package/dist/topology/types.d.ts.map +1 -1
- package/dist/type-error-guidance.js +170 -0
- package/dist/type-error-guidance.js.map +7 -0
- package/dist/ui/controller.d.ts.map +1 -1
- package/dist/ui/conversation-chrome.d.ts +2 -0
- package/dist/ui/conversation-chrome.d.ts.map +1 -1
- package/dist/ui/conversation-chrome.js +1 -1
- package/dist/ui/conversation-latest.d.ts +10 -0
- package/dist/ui/conversation-latest.d.ts.map +1 -0
- package/dist/ui/conversation-native-reader.js +2 -1
- package/dist/ui/conversation-native-reader.js.map +1 -1
- package/dist/ui/conversation-render.d.ts +2 -1
- package/dist/ui/conversation-render.d.ts.map +1 -1
- package/dist/ui/conversation-scrollbar.d.ts +22 -0
- package/dist/ui/conversation-scrollbar.d.ts.map +1 -0
- package/dist/ui/conversation-selection.d.ts +2 -2
- 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 +3 -0
- package/dist/ui/conversation.d.ts.map +1 -1
- package/dist/ui/conversation.js +253 -34
- package/dist/ui/conversation.js.map +4 -4
- package/dist/ui/dashboard-fabric-graph.d.ts.map +1 -1
- package/dist/ui/dashboard.js +14 -15
- package/dist/ui/dashboard.js.map +2 -2
- package/dist/ui/image-overlays.d.ts +16 -0
- package/dist/ui/image-overlays.d.ts.map +1 -0
- package/dist/ui/image-overlays.js +10 -0
- package/dist/ui/image-overlays.js.map +7 -0
- package/dist/ui/kitty-viewport.d.ts +24 -0
- package/dist/ui/kitty-viewport.d.ts.map +1 -0
- package/dist/ui/retention.d.ts +14 -0
- package/dist/ui/retention.d.ts.map +1 -0
- package/dist/ui/settings-sections-execution.d.ts.map +1 -1
- package/dist/ui/settings.d.ts.map +1 -1
- package/dist/ui/settings.js +27 -16
- package/dist/ui/settings.js.map +2 -2
- package/dist/ui/transcript.d.ts +2 -1
- package/dist/ui/transcript.d.ts.map +1 -1
- package/dist/ui/types.d.ts +2 -1
- package/dist/ui/types.d.ts.map +1 -1
- package/dist/ui/widget.d.ts +4 -2
- package/dist/ui/widget.d.ts.map +1 -1
- package/dist/verified/generated/authority-kernel.js +1 -1
- package/dist/verified/generated/kernel.js +1 -1
- package/dist/verified/generated/lifecycle-kernel.js +1 -1
- package/dist/verified/generated/manifest.json +7 -7
- package/dist/verified/generated/provider-kernel.js +1 -1
- package/dist/verified/generated/storage-kernel.js +1 -1
- package/dist/worker/options.d.ts.map +1 -1
- package/dist/worker/options.js +14 -0
- package/dist/worker/options.js.map +2 -2
- package/dist/worker/questions.d.ts +46 -0
- package/dist/worker/questions.d.ts.map +1 -0
- package/dist/worker/questions.js +87 -0
- package/dist/worker/questions.js.map +7 -0
- package/dist/worker/result.d.ts +3 -0
- package/dist/worker/result.d.ts.map +1 -0
- package/dist/worker/result.js +7493 -0
- package/dist/worker/result.js.map +7 -0
- package/dist/worker/run-record.js +10 -113
- package/dist/worker/run-record.js.map +3 -3
- package/dist/worker/startup.d.ts +8 -0
- package/dist/worker/startup.d.ts.map +1 -0
- package/dist/worker.js +111 -22
- package/dist/worker.js.map +4 -4
- package/docs/agents.md +197 -3
- package/docs/architecture.md +8 -1
- package/docs/audit-trace.md +36 -1
- package/docs/background-tasks.md +25 -1
- package/docs/certification.md +1 -1
- package/docs/compaction.md +64 -0
- package/docs/components.md +1 -0
- package/docs/configuration.md +105 -10
- package/docs/decisions.md +144 -0
- package/docs/durable-pi.md +186 -0
- package/docs/interface.md +10 -1
- package/docs/kitty-images.md +89 -0
- package/docs/licenses/typebox-mit.txt +23 -0
- package/docs/memory-recall.md +5 -3
- package/docs/programmatic-compaction.md +67 -11
- package/docs/programs.md +137 -0
- package/docs/provider-capabilities.md +23 -1
- package/docs/providers.md +158 -0
- package/docs/residency-runtime.md +64 -0
- package/docs/schema-enforcement.md +5 -3
- package/docs/shell-composition.md +6 -6
- package/docs/skills.md +2 -1
- package/docs/speculation.md +2 -1
- package/docs/state-layer.md +26 -4
- package/docs/thinking.md +48 -0
- package/docs/verified-kernels.md +1 -1
- package/package.json +48 -12
- package/scripts/test-verified-kernels.mjs +1 -1
- package/scripts/verified-kernels.mjs +1 -1
- package/skillsets/python/fabric-exec/SKILL.md +2 -2
- package/skillsets/python/fabric-exec/references/agents.md +9 -4
- package/skillsets/python/fabric-exec/references/mesh.md +9 -0
- package/skillsets/python/fabric-graph/SKILL.md +109 -0
- package/skillsets/python/fabric-guide/SKILL.md +2 -1
- package/skillsets/typescript/fabric-exec/SKILL.md +20 -2
- package/skillsets/typescript/fabric-exec/references/agents.md +10 -4
- package/skillsets/typescript/fabric-exec/references/mesh.md +10 -0
- package/skillsets/typescript/fabric-graph/SKILL.md +112 -0
- package/skillsets/typescript/fabric-guide/SKILL.md +2 -1
- package/skillsets/typescript/fabric-workflow/SKILL.md +1 -1
- package/dist/chunks/chunk-4NF3S3NM.js.map +0 -7
- package/dist/chunks/chunk-5VTBHJN3.js.map +0 -7
- package/dist/chunks/chunk-74BA4VSX.js.map +0 -7
- package/dist/chunks/chunk-7BG5COXB.js.map +0 -7
- package/dist/chunks/chunk-AYBIR4YV.js.map +0 -7
- package/dist/chunks/chunk-B5D6GA77.js.map +0 -7
- package/dist/chunks/chunk-BEJF2JX2.js.map +0 -7
- package/dist/chunks/chunk-BUQZBG6O.js.map +0 -7
- package/dist/chunks/chunk-CC63CY6R.js.map +0 -7
- package/dist/chunks/chunk-FDIEQEXS.js.map +0 -7
- package/dist/chunks/chunk-G4CSXNBT.js.map +0 -7
- package/dist/chunks/chunk-HG4DMARW.js.map +0 -7
- package/dist/chunks/chunk-KAD7UWT2.js +0 -99
- package/dist/chunks/chunk-KAD7UWT2.js.map +0 -7
- package/dist/chunks/chunk-MGWQOKBV.js +0 -30
- package/dist/chunks/chunk-MGWQOKBV.js.map +0 -7
- package/dist/chunks/chunk-PN4EKNRE.js.map +0 -7
- package/dist/chunks/chunk-PNDYFU64.js.map +0 -7
- package/dist/chunks/chunk-PWS2OXLV.js.map +0 -7
- package/dist/chunks/chunk-QE2JFB7F.js.map +0 -7
- package/dist/chunks/chunk-QETG2GVX.js.map +0 -7
- package/dist/chunks/chunk-RAO6TQFP.js.map +0 -7
- package/dist/chunks/chunk-RIFG4HS6.js.map +0 -7
- package/dist/chunks/chunk-TX6E5W7H.js.map +0 -7
- package/dist/chunks/chunk-VRAGOMN4.js.map +0 -7
- package/dist/chunks/chunk-W63E3WEO.js.map +0 -7
- package/dist/chunks/chunk-WMJ2AVQQ.js.map +0 -7
- package/dist/chunks/chunk-ZZ66L3W5.js.map +0 -7
- /package/dist/chunks/{chunk-57CMH4SW.js.map → chunk-7JU7Z4XQ.js.map} +0 -0
- /package/dist/chunks/{chunk-DUJ46TIP.js.map → chunk-ABJCSNZO.js.map} +0 -0
- /package/dist/chunks/{chunk-KP4ANT6L.js.map → chunk-C7EEG6SM.js.map} +0 -0
- /package/dist/chunks/{chunk-NHMICIEU.js.map → chunk-CCHZXF6K.js.map} +0 -0
- /package/dist/chunks/{chunk-5JN5AWNV.js.map → chunk-DZ4WN5XJ.js.map} +0 -0
- /package/dist/chunks/{chunk-7XJB2USB.js.map → chunk-LOLCTWJF.js.map} +0 -0
- /package/dist/chunks/{chunk-64O5L7EW.js.map → chunk-M6IRQ3QT.js.map} +0 -0
- /package/dist/chunks/{chunk-EPYLZWJV.js.map → chunk-OVBKQCYL.js.map} +0 -0
- /package/dist/chunks/{chunk-Z5Y65YBX.js.map → chunk-PYQM7KPL.js.map} +0 -0
- /package/dist/chunks/{chunk-DKVJREDI.js.map → chunk-QY7YK7M6.js.map} +0 -0
- /package/dist/chunks/{chunk-5ZJV4LAX.js.map → chunk-VPRJOD4Y.js.map} +0 -0
- /package/dist/chunks/{chunk-RG22JKIC.js.map → chunk-W7X4XEQU.js.map} +0 -0
- /package/dist/chunks/{chunk-LV4IT75S.js.map → chunk-WLLXKS6I.js.map} +0 -0
- /package/dist/chunks/{chunk-YVDBHS4C.js.map → chunk-WREA4RNR.js.map} +0 -0
- /package/dist/chunks/{chunk-NGGI6LDC.js.map → chunk-X2TRSE7D.js.map} +0 -0
- /package/dist/chunks/{chunk-A4VP7HDF.js.map → chunk-ZLNJDTCN.js.map} +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FABRIC_THINKING_ENTRY_TYPE,
|
|
3
|
+
clampThinkingToBounds,
|
|
4
|
+
isFabricThinking,
|
|
5
|
+
modelThinkingLevels,
|
|
6
|
+
selectThinkingLevel,
|
|
7
|
+
thinkingLevelsWithin
|
|
8
|
+
} from "./chunk-V73NIH6B.js";
|
|
9
|
+
|
|
10
|
+
// src/thinking-control.ts
|
|
11
|
+
var MAX_THINKING_OVERRIDE_TURNS = 20;
|
|
12
|
+
var MAX_THINKING_REASON_CHARS = 256;
|
|
13
|
+
var SCOPES = ["turn", "turns", "session"];
|
|
14
|
+
var persistedOverride = (value) => {
|
|
15
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
16
|
+
const entry = value;
|
|
17
|
+
if (entry.version !== 1) return void 0;
|
|
18
|
+
if (entry.override === null) return null;
|
|
19
|
+
if (typeof entry.override !== "object" || Array.isArray(entry.override)) return void 0;
|
|
20
|
+
const data = entry.override;
|
|
21
|
+
if (!isFabricThinking(data.level) || !isFabricThinking(data.baseline)) return void 0;
|
|
22
|
+
if (!SCOPES.includes(data.scope)) return void 0;
|
|
23
|
+
if (typeof data.setAt !== "number" || !Number.isFinite(data.setAt)) return void 0;
|
|
24
|
+
const remaining = data.remainingTurns;
|
|
25
|
+
if (data.scope === "turns" && !(Number.isInteger(remaining) && remaining >= 1 && remaining <= MAX_THINKING_OVERRIDE_TURNS)) return void 0;
|
|
26
|
+
return {
|
|
27
|
+
level: data.level,
|
|
28
|
+
baseline: data.baseline,
|
|
29
|
+
scope: data.scope,
|
|
30
|
+
setAt: data.setAt,
|
|
31
|
+
...data.scope === "turns" ? { remainingTurns: remaining } : {},
|
|
32
|
+
...typeof data.reason === "string" ? { reason: data.reason.slice(0, MAX_THINKING_REASON_CHARS) } : {}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
var FabricThinkingController = class {
|
|
36
|
+
constructor(host, bounds) {
|
|
37
|
+
this.host = host;
|
|
38
|
+
this.bounds = bounds;
|
|
39
|
+
}
|
|
40
|
+
#override;
|
|
41
|
+
/** Session id whose branch has been replayed; undefined forces a replay. */
|
|
42
|
+
#restoredFor;
|
|
43
|
+
/** Session switch or tree navigation: replay the branch on next use. */
|
|
44
|
+
invalidate() {
|
|
45
|
+
this.#override = void 0;
|
|
46
|
+
this.#restoredFor = void 0;
|
|
47
|
+
}
|
|
48
|
+
status(context) {
|
|
49
|
+
this.#restore(context);
|
|
50
|
+
const level = this.#level();
|
|
51
|
+
const bounds = this.bounds();
|
|
52
|
+
const supported = modelThinkingLevels(context.model);
|
|
53
|
+
const available = thinkingLevelsWithin(bounds, supported);
|
|
54
|
+
const override = this.#override;
|
|
55
|
+
return {
|
|
56
|
+
level,
|
|
57
|
+
available,
|
|
58
|
+
bounds: {
|
|
59
|
+
min: bounds.min ?? supported[0] ?? "off",
|
|
60
|
+
max: bounds.max ?? supported.at(-1) ?? "off"
|
|
61
|
+
},
|
|
62
|
+
baseline: override?.baseline ?? level,
|
|
63
|
+
...override ? { override: publicOverride(override) } : {}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
set(input, context) {
|
|
67
|
+
if (!isFabricThinking(input.level)) throw new Error(`Unknown thinking level: ${String(input.level)}`);
|
|
68
|
+
const scope = input.scope ?? "turn";
|
|
69
|
+
if (!SCOPES.includes(scope)) throw new Error(`Unknown thinking scope: ${String(scope)}`);
|
|
70
|
+
if (scope === "turns") {
|
|
71
|
+
if (!Number.isInteger(input.turns) || input.turns < 1 || input.turns > MAX_THINKING_OVERRIDE_TURNS) {
|
|
72
|
+
throw new Error(`thinking.set scope "turns" requires turns between 1 and ${MAX_THINKING_OVERRIDE_TURNS}`);
|
|
73
|
+
}
|
|
74
|
+
} else if (input.turns !== void 0) {
|
|
75
|
+
throw new Error('thinking.set turns is only valid with scope "turns"');
|
|
76
|
+
}
|
|
77
|
+
if (input.reason !== void 0 && input.reason.length > MAX_THINKING_REASON_CHARS) {
|
|
78
|
+
throw new Error(`thinking.set reason must be at most ${MAX_THINKING_REASON_CHARS} characters`);
|
|
79
|
+
}
|
|
80
|
+
this.#restore(context);
|
|
81
|
+
const bounds = this.bounds();
|
|
82
|
+
const allowed = thinkingLevelsWithin(bounds, modelThinkingLevels(context.model));
|
|
83
|
+
const target = selectThinkingLevel(clampThinkingToBounds(input.level, bounds), allowed);
|
|
84
|
+
if (!target) {
|
|
85
|
+
throw new Error(
|
|
86
|
+
`No thinking level supported by the active model lies within the configured bounds (${bounds.min ?? "off"}..${bounds.max ?? "max"})`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
const baseline = this.#override?.baseline ?? this.#level();
|
|
90
|
+
this.host.setThinkingLevel(target);
|
|
91
|
+
const applied = this.#level();
|
|
92
|
+
this.#override = {
|
|
93
|
+
level: applied,
|
|
94
|
+
baseline,
|
|
95
|
+
scope,
|
|
96
|
+
setAt: Date.now(),
|
|
97
|
+
...scope === "turns" ? { remainingTurns: input.turns } : {},
|
|
98
|
+
...input.reason !== void 0 ? { reason: input.reason } : {}
|
|
99
|
+
};
|
|
100
|
+
this.#persist();
|
|
101
|
+
return {
|
|
102
|
+
...this.status(context),
|
|
103
|
+
...applied !== input.level ? { clamped: true, requested: input.level } : {}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
reset(context) {
|
|
107
|
+
this.#restore(context);
|
|
108
|
+
const override = this.#override;
|
|
109
|
+
if (override) {
|
|
110
|
+
this.#override = void 0;
|
|
111
|
+
this.host.setThinkingLevel(override.baseline);
|
|
112
|
+
this.#persist();
|
|
113
|
+
}
|
|
114
|
+
return this.status(context);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* agent_end boundary: count down `turns`, end `turn`. If someone else changed
|
|
118
|
+
* the level since Fabric applied it (user, another extension), the override
|
|
119
|
+
* ends without restoring the baseline: Fabric never fights for the setting.
|
|
120
|
+
*/
|
|
121
|
+
agentEnded(context) {
|
|
122
|
+
this.#restore(context);
|
|
123
|
+
const override = this.#override;
|
|
124
|
+
if (!override || override.scope === "session") return;
|
|
125
|
+
if (override.scope === "turns" && (override.remainingTurns ?? 1) > 1) {
|
|
126
|
+
this.#override = { ...override, remainingTurns: (override.remainingTurns ?? 1) - 1 };
|
|
127
|
+
this.#persist();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
this.#override = void 0;
|
|
131
|
+
if (this.#level() === override.level) this.host.setThinkingLevel(override.baseline);
|
|
132
|
+
this.#persist();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Child sessions: move a level that lies outside the inherited bounds back
|
|
136
|
+
* inside them. Pi's own model clamp may otherwise overshoot a parent's max.
|
|
137
|
+
*/
|
|
138
|
+
enforceBounds(context) {
|
|
139
|
+
const bounds = this.bounds();
|
|
140
|
+
if (!bounds.min && !bounds.max) return;
|
|
141
|
+
const level = this.#level();
|
|
142
|
+
const allowed = thinkingLevelsWithin(bounds, modelThinkingLevels(context.model));
|
|
143
|
+
if (allowed.includes(level)) return;
|
|
144
|
+
const target = selectThinkingLevel(clampThinkingToBounds(level, bounds), allowed);
|
|
145
|
+
if (target && target !== level) this.host.setThinkingLevel(target);
|
|
146
|
+
}
|
|
147
|
+
#level() {
|
|
148
|
+
const level = this.host.getThinkingLevel();
|
|
149
|
+
return isFabricThinking(level) ? level : "off";
|
|
150
|
+
}
|
|
151
|
+
#persist() {
|
|
152
|
+
const entry = { version: 1, override: this.#override ?? null };
|
|
153
|
+
this.host.appendEntry(FABRIC_THINKING_ENTRY_TYPE, entry);
|
|
154
|
+
}
|
|
155
|
+
#restore(context) {
|
|
156
|
+
const sessionId = context.sessionManager.getSessionId();
|
|
157
|
+
if (this.#restoredFor === sessionId) return;
|
|
158
|
+
this.#restoredFor = sessionId;
|
|
159
|
+
this.#override = void 0;
|
|
160
|
+
const branch = context.sessionManager.getBranch();
|
|
161
|
+
for (let index = branch.length - 1; index >= 0; index -= 1) {
|
|
162
|
+
const entry = branch[index];
|
|
163
|
+
if (entry?.type !== "custom" || entry.customType !== FABRIC_THINKING_ENTRY_TYPE) continue;
|
|
164
|
+
const restored = persistedOverride(entry.data);
|
|
165
|
+
this.#override = restored ?? void 0;
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
var publicOverride = (override) => {
|
|
171
|
+
const { baseline: _baseline, ...visible } = override;
|
|
172
|
+
return visible;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export {
|
|
176
|
+
MAX_THINKING_OVERRIDE_TURNS,
|
|
177
|
+
MAX_THINKING_REASON_CHARS,
|
|
178
|
+
FabricThinkingController
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=chunk-L22K5BWU.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/thinking-control.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionAPI, ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport {\n clampThinkingToBounds,\n FABRIC_THINKING_ENTRY_TYPE,\n isFabricThinking,\n modelThinkingLevels,\n selectThinkingLevel,\n thinkingLevelsWithin,\n type FabricThinking,\n type FabricThinkingBounds,\n type FabricThinkingModel,\n} from \"./thinking.js\";\n\n// Host-session thinking control. The model can raise or lower the main\n// session's reasoning effort for a bounded scope; Fabric applies it through\n// Pi's own setThinkingLevel and reverts at agent_end. Overrides persist as a\n// session custom entry so a reload restores the pending revert. FabricState\n// loads this module on first need (see FabricThinkingHost), keeping it off the\n// startup graph.\n\nexport { FABRIC_THINKING_ENTRY_TYPE };\n\nexport const MAX_THINKING_OVERRIDE_TURNS = 20;\nexport const MAX_THINKING_REASON_CHARS = 256;\n\nexport type FabricThinkingScope = \"turn\" | \"turns\" | \"session\";\n\nexport interface FabricThinkingOverride {\n level: FabricThinking;\n scope: FabricThinkingScope;\n /** `turns` scope only: agent_end events left before reverting. */\n remainingTurns?: number;\n reason?: string;\n setAt: number;\n}\n\nexport interface FabricThinkingStatus {\n level: FabricThinking;\n /** Model-supported levels inside the effective bounds. */\n available: FabricThinking[];\n /** Effective inclusive bounds; unbounded ends resolve to the model's levels. */\n bounds: { min: FabricThinking; max: FabricThinking };\n /** Level restored when the override ends (the current level without one). */\n baseline: FabricThinking;\n override?: FabricThinkingOverride;\n}\n\nexport interface FabricThinkingSetResult extends FabricThinkingStatus {\n clamped?: true;\n requested?: FabricThinking;\n}\n\nexport interface FabricThinkingSetInput {\n level: FabricThinking;\n scope?: FabricThinkingScope;\n turns?: number;\n reason?: string;\n}\n\ninterface PersistedOverride extends FabricThinkingOverride {\n baseline: FabricThinking;\n}\n\ninterface FabricThinkingEntry {\n version: 1;\n override: PersistedOverride | null;\n}\n\ntype ThinkingHost = Pick<ExtensionAPI, \"getThinkingLevel\" | \"setThinkingLevel\" | \"appendEntry\">;\ntype ThinkingContext = Pick<ExtensionContext, \"sessionManager\"> & { model?: FabricThinkingModel | undefined };\n\nconst SCOPES: readonly FabricThinkingScope[] = [\"turn\", \"turns\", \"session\"];\n\nconst persistedOverride = (value: unknown): PersistedOverride | null | undefined => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined;\n const entry = value as Record<string, unknown>;\n if (entry.version !== 1) return undefined;\n if (entry.override === null) return null;\n if (typeof entry.override !== \"object\" || Array.isArray(entry.override)) return undefined;\n const data = entry.override as Record<string, unknown>;\n if (!isFabricThinking(data.level) || !isFabricThinking(data.baseline)) return undefined;\n if (!SCOPES.includes(data.scope as FabricThinkingScope)) return undefined;\n if (typeof data.setAt !== \"number\" || !Number.isFinite(data.setAt)) return undefined;\n const remaining = data.remainingTurns;\n if (data.scope === \"turns\" && !(Number.isInteger(remaining) &&\n (remaining as number) >= 1 && (remaining as number) <= MAX_THINKING_OVERRIDE_TURNS)) return undefined;\n return {\n level: data.level,\n baseline: data.baseline,\n scope: data.scope as FabricThinkingScope,\n setAt: data.setAt,\n ...(data.scope === \"turns\" ? { remainingTurns: remaining as number } : {}),\n ...(typeof data.reason === \"string\" ? { reason: data.reason.slice(0, MAX_THINKING_REASON_CHARS) } : {}),\n };\n};\n\nexport class FabricThinkingController {\n #override: PersistedOverride | undefined;\n /** Session id whose branch has been replayed; undefined forces a replay. */\n #restoredFor: string | undefined;\n\n constructor(\n private readonly host: ThinkingHost,\n private readonly bounds: () => FabricThinkingBounds,\n ) {}\n\n /** Session switch or tree navigation: replay the branch on next use. */\n invalidate(): void {\n this.#override = undefined;\n this.#restoredFor = undefined;\n }\n\n status(context: ThinkingContext): FabricThinkingStatus {\n this.#restore(context);\n const level = this.#level();\n const bounds = this.bounds();\n const supported = modelThinkingLevels(context.model);\n const available = thinkingLevelsWithin(bounds, supported);\n const override = this.#override;\n return {\n level,\n available,\n bounds: {\n min: bounds.min ?? supported[0] ?? \"off\",\n max: bounds.max ?? supported.at(-1) ?? \"off\",\n },\n baseline: override?.baseline ?? level,\n ...(override ? { override: publicOverride(override) } : {}),\n };\n }\n\n set(input: FabricThinkingSetInput, context: ThinkingContext): FabricThinkingSetResult {\n if (!isFabricThinking(input.level)) throw new Error(`Unknown thinking level: ${String(input.level)}`);\n const scope = input.scope ?? \"turn\";\n if (!SCOPES.includes(scope)) throw new Error(`Unknown thinking scope: ${String(scope)}`);\n if (scope === \"turns\") {\n if (!Number.isInteger(input.turns) || input.turns! < 1 || input.turns! > MAX_THINKING_OVERRIDE_TURNS) {\n throw new Error(`thinking.set scope \"turns\" requires turns between 1 and ${MAX_THINKING_OVERRIDE_TURNS}`);\n }\n } else if (input.turns !== undefined) {\n throw new Error('thinking.set turns is only valid with scope \"turns\"');\n }\n if (input.reason !== undefined && input.reason.length > MAX_THINKING_REASON_CHARS) {\n throw new Error(`thinking.set reason must be at most ${MAX_THINKING_REASON_CHARS} characters`);\n }\n this.#restore(context);\n const bounds = this.bounds();\n const allowed = thinkingLevelsWithin(bounds, modelThinkingLevels(context.model));\n const target = selectThinkingLevel(clampThinkingToBounds(input.level, bounds), allowed);\n if (!target) {\n throw new Error(\n `No thinking level supported by the active model lies within the configured bounds (${\n bounds.min ?? \"off\"}..${bounds.max ?? \"max\"})`,\n );\n }\n const baseline = this.#override?.baseline ?? this.#level();\n this.host.setThinkingLevel(target);\n // Pi clamps again to model capabilities; report what actually applies.\n const applied = this.#level();\n this.#override = {\n level: applied,\n baseline,\n scope,\n setAt: Date.now(),\n ...(scope === \"turns\" ? { remainingTurns: input.turns! } : {}),\n ...(input.reason !== undefined ? { reason: input.reason } : {}),\n };\n this.#persist();\n return {\n ...this.status(context),\n ...(applied !== input.level ? { clamped: true as const, requested: input.level } : {}),\n };\n }\n\n reset(context: ThinkingContext): FabricThinkingStatus {\n this.#restore(context);\n const override = this.#override;\n if (override) {\n this.#override = undefined;\n this.host.setThinkingLevel(override.baseline);\n this.#persist();\n }\n return this.status(context);\n }\n\n /**\n * agent_end boundary: count down `turns`, end `turn`. If someone else changed\n * the level since Fabric applied it (user, another extension), the override\n * ends without restoring the baseline: Fabric never fights for the setting.\n */\n agentEnded(context: ThinkingContext): void {\n this.#restore(context);\n const override = this.#override;\n if (!override || override.scope === \"session\") return;\n if (override.scope === \"turns\" && (override.remainingTurns ?? 1) > 1) {\n this.#override = { ...override, remainingTurns: (override.remainingTurns ?? 1) - 1 };\n this.#persist();\n return;\n }\n this.#override = undefined;\n if (this.#level() === override.level) this.host.setThinkingLevel(override.baseline);\n this.#persist();\n }\n\n /**\n * Child sessions: move a level that lies outside the inherited bounds back\n * inside them. Pi's own model clamp may otherwise overshoot a parent's max.\n */\n enforceBounds(context: ThinkingContext): void {\n const bounds = this.bounds();\n if (!bounds.min && !bounds.max) return;\n const level = this.#level();\n const allowed = thinkingLevelsWithin(bounds, modelThinkingLevels(context.model));\n if (allowed.includes(level)) return;\n const target = selectThinkingLevel(clampThinkingToBounds(level, bounds), allowed);\n if (target && target !== level) this.host.setThinkingLevel(target);\n }\n\n #level(): FabricThinking {\n const level = this.host.getThinkingLevel();\n return isFabricThinking(level) ? level : \"off\";\n }\n\n #persist(): void {\n const entry: FabricThinkingEntry = { version: 1, override: this.#override ?? null };\n this.host.appendEntry(FABRIC_THINKING_ENTRY_TYPE, entry);\n }\n\n #restore(context: ThinkingContext): void {\n const sessionId = context.sessionManager.getSessionId();\n if (this.#restoredFor === sessionId) return;\n this.#restoredFor = sessionId;\n this.#override = undefined;\n const branch = context.sessionManager.getBranch();\n for (let index = branch.length - 1; index >= 0; index -= 1) {\n const entry = branch[index];\n if (entry?.type !== \"custom\" || entry.customType !== FABRIC_THINKING_ENTRY_TYPE) continue;\n const restored = persistedOverride(entry.data);\n // A malformed latest entry ends the override rather than resurrecting an older one.\n this.#override = restored ?? undefined;\n return;\n }\n }\n}\n\nconst publicOverride = (override: PersistedOverride): FabricThinkingOverride => {\n const { baseline: _baseline, ...visible } = override;\n return visible;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;AAsBO,IAAM,8BAA8B;AACpC,IAAM,4BAA4B;AAgDzC,IAAM,SAAyC,CAAC,QAAQ,SAAS,SAAS;AAE1E,IAAM,oBAAoB,CAAC,UAAyD;AAClF,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,EAAG,QAAO;AAChF,QAAM,QAAQ;AACd,MAAI,MAAM,YAAY,EAAG,QAAO;AAChC,MAAI,MAAM,aAAa,KAAM,QAAO;AACpC,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VACY,
|
|
11
11
|
normalizeSession
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WREA4RNR.js";
|
|
13
13
|
import {
|
|
14
14
|
st
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CYMDX3XP.js";
|
|
16
16
|
|
|
17
17
|
// src/memory/index.ts
|
|
18
18
|
import crypto2 from "node:crypto";
|
|
@@ -1242,4 +1242,4 @@ export {
|
|
|
1242
1242
|
searchMemoryIndex,
|
|
1243
1243
|
searchShards
|
|
1244
1244
|
};
|
|
1245
|
-
//# sourceMappingURL=chunk-
|
|
1245
|
+
//# sourceMappingURL=chunk-LOLCTWJF.js.map
|
|
@@ -14,31 +14,31 @@ import {
|
|
|
14
14
|
reconstructSessionLineage,
|
|
15
15
|
searchMemoryIndex,
|
|
16
16
|
shardPolicy
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LOLCTWJF.js";
|
|
18
18
|
import {
|
|
19
19
|
compareLexical,
|
|
20
20
|
foldSessionDigest,
|
|
21
21
|
normalizeMemoryPhrase,
|
|
22
22
|
tokenizeLexical
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-7JU7Z4XQ.js";
|
|
24
24
|
import {
|
|
25
25
|
AmbiguousSessionError,
|
|
26
26
|
enumerateAllSessions,
|
|
27
27
|
resolveScope,
|
|
28
28
|
resolveSessionTarget
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-M6IRQ3QT.js";
|
|
30
30
|
import {
|
|
31
31
|
expandSessionEntriesChecked,
|
|
32
32
|
normalizeRecords,
|
|
33
33
|
normalizeSession
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-WREA4RNR.js";
|
|
35
35
|
import {
|
|
36
36
|
actionArgNormalizer
|
|
37
37
|
} from "./chunk-NQOEHX62.js";
|
|
38
38
|
import {
|
|
39
39
|
acceptMemoryChunk,
|
|
40
40
|
rt
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-CYMDX3XP.js";
|
|
42
42
|
|
|
43
43
|
// src/memory/context.ts
|
|
44
44
|
var RECALL_DEFAULT_PAGE_SIZE = 10;
|
|
@@ -390,7 +390,8 @@ var sameSourceObservations = (left, right) => left.length === right.length && le
|
|
|
390
390
|
var CONTINUATION_CACHE_TTL_MS = 5 * 6e4;
|
|
391
391
|
var EXPANSION_SNAPSHOT_LIMIT = 2;
|
|
392
392
|
var EXPANSION_SELECTION_LIMIT = 16;
|
|
393
|
-
var recallContinuationKey = (args) => JSON.stringify([
|
|
393
|
+
var recallContinuationKey = (args, scopeDigest) => JSON.stringify([
|
|
394
|
+
scopeDigest ?? null,
|
|
394
395
|
args.query ?? null,
|
|
395
396
|
args.queryMode ?? "literal",
|
|
396
397
|
args.queryMatch ?? null,
|
|
@@ -410,7 +411,7 @@ var recallContinuationKey = (args) => JSON.stringify([
|
|
|
410
411
|
args.until ?? null,
|
|
411
412
|
args.entryRange ? [args.entryRange.first, args.entryRange.last] : null
|
|
412
413
|
]);
|
|
413
|
-
var expansionSnapshotKey = (file, branches) => `${path3.resolve(file)}\0${branches}`;
|
|
414
|
+
var expansionSnapshotKey = (file, branches, scopeDigest) => `${path3.resolve(file)}\0${branches}\0${scopeDigest ?? ""}`;
|
|
414
415
|
var expansionSelectionKey = (selection) => JSON.stringify([
|
|
415
416
|
selection.indices ?? null,
|
|
416
417
|
selection.entryIds ?? null,
|
|
@@ -438,8 +439,8 @@ var MemoryRequestCache = class {
|
|
|
438
439
|
forgetRecallContinuation(cached) {
|
|
439
440
|
if (this.recallContinuation === cached) this.recallContinuation = void 0;
|
|
440
441
|
}
|
|
441
|
-
cachedExpansionSnapshot(file, branches, observation) {
|
|
442
|
-
const key = expansionSnapshotKey(file, branches);
|
|
442
|
+
cachedExpansionSnapshot(file, branches, observation, scopeDigest) {
|
|
443
|
+
const key = expansionSnapshotKey(file, branches, scopeDigest);
|
|
443
444
|
const cached = this.expansionSnapshots.get(key);
|
|
444
445
|
if (!cached) return void 0;
|
|
445
446
|
if (!observation || Date.now() - cached.touchedAt > CONTINUATION_CACHE_TTL_MS || !sameSourceObservation(cached.observation, observation)) {
|
|
@@ -452,7 +453,7 @@ var MemoryRequestCache = class {
|
|
|
452
453
|
return cached;
|
|
453
454
|
}
|
|
454
455
|
rememberExpansionSnapshot(snapshot) {
|
|
455
|
-
const key = expansionSnapshotKey(snapshot.file, snapshot.branches);
|
|
456
|
+
const key = expansionSnapshotKey(snapshot.file, snapshot.branches, snapshot.scopeDigest);
|
|
456
457
|
this.expansionSnapshots.delete(key);
|
|
457
458
|
this.expansionSnapshots.set(key, snapshot);
|
|
458
459
|
while (this.expansionSnapshots.size > EXPANSION_SNAPSHOT_LIMIT) {
|
|
@@ -473,7 +474,7 @@ var MemoryRequestCache = class {
|
|
|
473
474
|
}
|
|
474
475
|
}
|
|
475
476
|
forgetExpansionSnapshot(snapshot) {
|
|
476
|
-
const key = expansionSnapshotKey(snapshot.file, snapshot.branches);
|
|
477
|
+
const key = expansionSnapshotKey(snapshot.file, snapshot.branches, snapshot.scopeDigest);
|
|
477
478
|
if (this.expansionSnapshots.get(key) === snapshot) this.expansionSnapshots.delete(key);
|
|
478
479
|
}
|
|
479
480
|
};
|
|
@@ -547,11 +548,11 @@ var memorySourceFailure = (error) => error instanceof MemorySourceError ? { code
|
|
|
547
548
|
var checkAbort = (signal) => {
|
|
548
549
|
if (signal?.aborted) throw new MemorySourceError("aborted", "Memory source call was aborted.");
|
|
549
550
|
};
|
|
550
|
-
var assertAuthorized = async (source, action, sessionKey) => {
|
|
551
|
+
var assertAuthorized = async (source, action, sessionKey, scope) => {
|
|
551
552
|
if (!source.authorize) return;
|
|
552
553
|
let allowed;
|
|
553
554
|
try {
|
|
554
|
-
allowed = await source.authorize(action, sessionKey);
|
|
555
|
+
allowed = await (scope ? source.authorize(action, sessionKey, scope) : source.authorize(action, sessionKey));
|
|
555
556
|
} catch {
|
|
556
557
|
throw new MemorySourceError("source_unauthorized", "Memory source authorization failed.");
|
|
557
558
|
}
|
|
@@ -566,12 +567,12 @@ var coverageReasons = (coverage) => {
|
|
|
566
567
|
};
|
|
567
568
|
var asSessionKey = (value) => typeof value === "string" && value.length > 0 ? value : "";
|
|
568
569
|
var normalizeListResponse = (response) => Array.isArray(response) ? { sessions: response, coverageReasons: [] } : { sessions: response.sessions, coverageReasons: coverageReasons(response.coverage) };
|
|
569
|
-
var loadHostSnapshot = async (source, sessionKey, action, signal) => {
|
|
570
|
+
var loadHostSnapshot = async (source, sessionKey, action, signal, scope) => {
|
|
570
571
|
checkAbort(signal);
|
|
571
|
-
await assertAuthorized(source, action, sessionKey);
|
|
572
|
+
await assertAuthorized(source, action, sessionKey, scope);
|
|
572
573
|
const response = await source.loadSession(sessionKey, signal === void 0 ? {} : { signal });
|
|
573
574
|
checkAbort(signal);
|
|
574
|
-
await assertAuthorized(source, action, sessionKey);
|
|
575
|
+
await assertAuthorized(source, action, sessionKey, scope);
|
|
575
576
|
if (response === null || response === void 0) return null;
|
|
576
577
|
const key = asSessionKey(response.sessionKey);
|
|
577
578
|
const revision = asSessionKey(response.revision);
|
|
@@ -605,9 +606,9 @@ var loadHostSnapshot = async (source, sessionKey, action, signal) => {
|
|
|
605
606
|
coverageReasons: coverageReasons(response.coverage)
|
|
606
607
|
};
|
|
607
608
|
};
|
|
608
|
-
var listHostSnapshots = async (source, limit, action, signal) => {
|
|
609
|
+
var listHostSnapshots = async (source, limit, action, signal, scope) => {
|
|
609
610
|
checkAbort(signal);
|
|
610
|
-
await assertAuthorized(source, action, null);
|
|
611
|
+
await assertAuthorized(source, action, null, scope);
|
|
611
612
|
const boundedLimit = Math.max(0, Math.floor(limit));
|
|
612
613
|
const listed = normalizeListResponse(
|
|
613
614
|
await source.listSessions(signal === void 0 ? { limit: boundedLimit } : { limit: boundedLimit, signal })
|
|
@@ -625,7 +626,7 @@ var listHostSnapshots = async (source, limit, action, signal) => {
|
|
|
625
626
|
coverageReasons2.add("invalid_source_response");
|
|
626
627
|
continue;
|
|
627
628
|
}
|
|
628
|
-
const snapshot = await loadHostSnapshot(source, key, action, signal);
|
|
629
|
+
const snapshot = await loadHostSnapshot(source, key, action, signal, scope);
|
|
629
630
|
if (!snapshot) {
|
|
630
631
|
coverageReasons2.add("source_unavailable");
|
|
631
632
|
continue;
|
|
@@ -634,7 +635,7 @@ var listHostSnapshots = async (source, limit, action, signal) => {
|
|
|
634
635
|
snapshots.push(snapshot);
|
|
635
636
|
}
|
|
636
637
|
if (snapshots.length === 0) {
|
|
637
|
-
await assertAuthorized(source, action, null);
|
|
638
|
+
await assertAuthorized(source, action, null, scope);
|
|
638
639
|
}
|
|
639
640
|
return { snapshots, coverageReasons: [...coverageReasons2] };
|
|
640
641
|
};
|
|
@@ -816,9 +817,9 @@ var fileRecallPlan = (refs, context) => {
|
|
|
816
817
|
};
|
|
817
818
|
var hostRecallPlan = async (source, sourceId, sessionKey, context, signal) => {
|
|
818
819
|
const loaded = sessionKey !== null ? await (async () => {
|
|
819
|
-
const snapshot = await loadHostSnapshot(source, sessionKey, "recall", signal);
|
|
820
|
+
const snapshot = await loadHostSnapshot(source, sessionKey, "recall", signal, context.fabricScope);
|
|
820
821
|
return snapshot ? { snapshots: [snapshot], coverageReasons: [] } : null;
|
|
821
|
-
})() : await listHostSnapshots(source, context.config.maxSessions, "recall", signal);
|
|
822
|
+
})() : await listHostSnapshots(source, context.config.maxSessions, "recall", signal, context.fabricScope);
|
|
822
823
|
if (!loaded) throw new MemorySourceError("session_not_found", `Session not found in source ${sourceId}: ${sessionKey}`);
|
|
823
824
|
const snapshots = loaded.snapshots;
|
|
824
825
|
const refs = snapshots.map(hostRef);
|
|
@@ -869,7 +870,7 @@ var fileExpansionAccess = (session, context) => {
|
|
|
869
870
|
var hostExpansionAccess = async (sourceId, session, context, signal) => {
|
|
870
871
|
const source = resolveRegisteredSource(context.sources, sourceId);
|
|
871
872
|
const sessionKey = hostSessionKey(sourceId, session);
|
|
872
|
-
const snapshot = await loadHostSnapshot(source, sessionKey, "expand", signal);
|
|
873
|
+
const snapshot = await loadHostSnapshot(source, sessionKey, "expand", signal, context.fabricScope);
|
|
873
874
|
if (!snapshot) {
|
|
874
875
|
throw new MemorySourceError("session_not_found", `Session not found in source ${sourceId}: ${sessionKey}`);
|
|
875
876
|
}
|
|
@@ -1017,7 +1018,7 @@ async function processMemoryRecall(args, invocationContext, context, cache) {
|
|
|
1017
1018
|
};
|
|
1018
1019
|
const observationsBefore = await plan.observeAll(branches);
|
|
1019
1020
|
const cached = offset === void 0 ? void 0 : cache.cachedRecallContinuation(
|
|
1020
|
-
recallContinuationKey(baseRequestArgs),
|
|
1021
|
+
recallContinuationKey(baseRequestArgs, context.fabricScope?.digest),
|
|
1021
1022
|
observationsBefore
|
|
1022
1023
|
);
|
|
1023
1024
|
if (cached) {
|
|
@@ -1121,7 +1122,7 @@ async function processMemoryRecall(args, invocationContext, context, cache) {
|
|
|
1121
1122
|
const observationsAfter = await plan.observeAll(branches);
|
|
1122
1123
|
if (response.next !== null && observationsBefore && observationsAfter && sameSourceObservations(observationsBefore, observationsAfter)) {
|
|
1123
1124
|
cache.rememberRecallContinuation({
|
|
1124
|
-
key: recallContinuationKey(requestArgs),
|
|
1125
|
+
key: recallContinuationKey(requestArgs, context.fabricScope?.digest),
|
|
1125
1126
|
result,
|
|
1126
1127
|
coverage,
|
|
1127
1128
|
requestArgs,
|
|
@@ -1215,7 +1216,7 @@ async function processMemoryExpand(args, context, cache, signal) {
|
|
|
1215
1216
|
}
|
|
1216
1217
|
const ref = access.ref;
|
|
1217
1218
|
const observedSource = access.observe(branches);
|
|
1218
|
-
let snapshot = cache.cachedExpansionSnapshot(ref.file, branches, observedSource);
|
|
1219
|
+
let snapshot = cache.cachedExpansionSnapshot(ref.file, branches, observedSource, context.fabricScope?.digest);
|
|
1219
1220
|
if (snapshot) {
|
|
1220
1221
|
const sourceChanged = expectedSourceHash !== void 0 && snapshot.sourceHash !== expectedSourceHash;
|
|
1221
1222
|
const lineageChanged = expectedLineageFingerprint !== void 0 && snapshot.lineageFingerprint !== expectedLineageFingerprint;
|
|
@@ -1298,6 +1299,7 @@ async function processMemoryExpand(args, context, cache, signal) {
|
|
|
1298
1299
|
snapshot = {
|
|
1299
1300
|
file: ref.file,
|
|
1300
1301
|
branches,
|
|
1302
|
+
...context.fabricScope ? { scopeDigest: context.fabricScope.digest } : {},
|
|
1301
1303
|
sourceHash: finalState2.sourceHash,
|
|
1302
1304
|
lineageFingerprint: finalLineage2.fingerprint,
|
|
1303
1305
|
observation: finalObservation,
|
|
@@ -1610,7 +1612,7 @@ async function processMemorySessions(args, context, signal) {
|
|
|
1610
1612
|
if (sourceId !== void 0) {
|
|
1611
1613
|
try {
|
|
1612
1614
|
const source = resolveRegisteredSource(context.sources, sourceId);
|
|
1613
|
-
const { snapshots, coverageReasons: coverageReasons2 } = await listHostSnapshots(source, limit, "list", signal);
|
|
1615
|
+
const { snapshots, coverageReasons: coverageReasons2 } = await listHostSnapshots(source, limit, "list", signal, context.fabricScope);
|
|
1614
1616
|
const options2 = resolveIndexOptions(context.config, context.agentDir, branches);
|
|
1615
1617
|
const index2 = loadHostTieredIndex(snapshots, options2, false, void 0, coverageReasons2);
|
|
1616
1618
|
const shards2 = new Map(index2.shards.map((shard) => [shard.sessionFile, shard]));
|
|
@@ -2163,14 +2165,15 @@ var MemoryProvider = class {
|
|
|
2163
2165
|
return normalizeMemoryArgs(actionName, args);
|
|
2164
2166
|
}
|
|
2165
2167
|
async invoke(actionName, args, invocationContext) {
|
|
2168
|
+
const context = invocationContext.scope ? { ...this.context, fabricScope: invocationContext.scope } : this.context;
|
|
2166
2169
|
try {
|
|
2167
2170
|
switch (actionName) {
|
|
2168
2171
|
case "recall":
|
|
2169
|
-
return await processMemoryRecall(args, invocationContext,
|
|
2172
|
+
return await processMemoryRecall(args, invocationContext, context, this.cache);
|
|
2170
2173
|
case "expand":
|
|
2171
|
-
return await processMemoryExpand(args,
|
|
2174
|
+
return await processMemoryExpand(args, context, this.cache, invocationContext.signal);
|
|
2172
2175
|
case "sessions":
|
|
2173
|
-
return await processMemorySessions(args,
|
|
2176
|
+
return await processMemorySessions(args, context, invocationContext.signal);
|
|
2174
2177
|
default:
|
|
2175
2178
|
throw new Error(`Unknown memory action: ${actionName}`);
|
|
2176
2179
|
}
|
|
@@ -2205,4 +2208,4 @@ export {
|
|
|
2205
2208
|
memoryActionSchemas,
|
|
2206
2209
|
MemoryProvider
|
|
2207
2210
|
};
|
|
2208
|
-
//# sourceMappingURL=chunk-
|
|
2211
|
+
//# sourceMappingURL=chunk-M5IN6DMF.js.map
|