@plurnk/plurnk-service 1.17.0 → 1.19.0
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/.env.defaults +95 -14
- package/README.md +5 -3
- package/SPEC.md +1756 -1442
- package/dist/Paths.js +3 -3
- package/dist/build-info.json +1 -1
- package/dist/content/body-preview.d.ts +1 -0
- package/dist/content/body-preview.d.ts.map +1 -1
- package/dist/content/body-preview.js +8 -10
- package/dist/content/body-preview.js.map +1 -1
- package/dist/content/edit-receipt.d.ts.map +1 -1
- package/dist/content/edit-receipt.js +30 -29
- package/dist/content/edit-receipt.js.map +1 -1
- package/dist/content/line-anchors.d.ts.map +1 -1
- package/dist/content/line-anchors.js +17 -5
- package/dist/content/line-anchors.js.map +1 -1
- package/dist/content/read-projector.d.ts +2 -2
- package/dist/content/read-projector.d.ts.map +1 -1
- package/dist/content/read-projector.js +81 -39
- package/dist/content/read-projector.js.map +1 -1
- package/dist/content/read-resolve.d.ts +1 -0
- package/dist/content/read-resolve.d.ts.map +1 -1
- package/dist/content/read-resolve.js +13 -10
- package/dist/content/read-resolve.js.map +1 -1
- package/dist/content/scope-format.d.ts +9 -0
- package/dist/content/scope-format.d.ts.map +1 -0
- package/dist/content/scope-format.js +28 -0
- package/dist/content/scope-format.js.map +1 -0
- package/dist/core/AdministrativeLoop.d.ts +8 -0
- package/dist/core/AdministrativeLoop.d.ts.map +1 -0
- package/dist/core/AdministrativeLoop.js +16 -0
- package/dist/core/AdministrativeLoop.js.map +1 -0
- package/dist/core/AdmittedTurnExecutor.d.ts +2 -2
- package/dist/core/AdmittedTurnExecutor.d.ts.map +1 -1
- package/dist/core/AdmittedTurnExecutor.js +26 -26
- package/dist/core/AdmittedTurnExecutor.js.map +1 -1
- package/dist/core/BareBatchRunner.d.ts +1 -2
- package/dist/core/BareBatchRunner.d.ts.map +1 -1
- package/dist/core/BareBatchRunner.js +7 -12
- package/dist/core/BareBatchRunner.js.map +1 -1
- package/dist/core/BudgetReadout.d.ts.map +1 -1
- package/dist/core/BudgetReadout.js +3 -4
- package/dist/core/BudgetReadout.js.map +1 -1
- package/dist/core/CapabilityPolicies.d.ts +4 -2
- package/dist/core/CapabilityPolicies.d.ts.map +1 -1
- package/dist/core/CapabilityPolicies.js +23 -2
- package/dist/core/CapabilityPolicies.js.map +1 -1
- package/dist/core/CapabilityResolver.d.ts +2 -2
- package/dist/core/CapabilityResolver.d.ts.map +1 -1
- package/dist/core/CapabilityResolver.js +46 -36
- package/dist/core/CapabilityResolver.js.map +1 -1
- package/dist/core/ChannelWrite.d.ts +4 -6
- package/dist/core/ChannelWrite.d.ts.map +1 -1
- package/dist/core/ChannelWrite.js +8 -8
- package/dist/core/ChannelWrite.js.map +1 -1
- package/dist/core/ChannelWrite.sql +17 -11
- package/dist/core/ClientInteractions.d.ts +11 -1
- package/dist/core/ClientInteractions.d.ts.map +1 -1
- package/dist/core/ClientInteractions.js +26 -2
- package/dist/core/ClientInteractions.js.map +1 -1
- package/dist/core/CoreSchemeServices.d.ts.map +1 -1
- package/dist/core/CoreSchemeServices.js +1 -0
- package/dist/core/CoreSchemeServices.js.map +1 -1
- package/dist/core/DataStatementRunner.d.ts.map +1 -1
- package/dist/core/DataStatementRunner.js +198 -148
- package/dist/core/DataStatementRunner.js.map +1 -1
- package/dist/core/Dispatcher.d.ts +18 -5
- package/dist/core/Dispatcher.d.ts.map +1 -1
- package/dist/core/Dispatcher.js +135 -114
- package/dist/core/Dispatcher.js.map +1 -1
- package/dist/core/Dispatcher.sql +11 -26
- package/dist/core/DurableStatement.d.ts +4 -1
- package/dist/core/DurableStatement.d.ts.map +1 -1
- package/dist/core/DurableStatement.js +4 -4
- package/dist/core/DurableStatement.js.map +1 -1
- package/dist/core/EditMutations.d.ts.map +1 -1
- package/dist/core/EditMutations.js +5 -2
- package/dist/core/EditMutations.js.map +1 -1
- package/dist/core/Engine.d.ts +11 -9
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +27 -65
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Engine.sql +2 -22
- package/dist/core/EnvFlags.d.ts.map +1 -1
- package/dist/core/EnvFlags.js +4 -2
- package/dist/core/EnvFlags.js.map +1 -1
- package/dist/core/ExecutionOutputs.sql +8 -0
- package/dist/core/ExecutorRegistry.d.ts +4 -0
- package/dist/core/ExecutorRegistry.d.ts.map +1 -1
- package/dist/core/ExecutorRegistry.js +3 -1
- package/dist/core/ExecutorRegistry.js.map +1 -1
- package/dist/core/KillHandler.d.ts.map +1 -1
- package/dist/core/KillHandler.js +7 -12
- package/dist/core/KillHandler.js.map +1 -1
- package/dist/core/Knob.d.ts +9 -0
- package/dist/core/Knob.d.ts.map +1 -0
- package/dist/core/Knob.js +50 -0
- package/dist/core/Knob.js.map +1 -0
- package/dist/core/LogBody.d.ts.map +1 -1
- package/dist/core/LogBody.js +8 -36
- package/dist/core/LogBody.js.map +1 -1
- package/dist/core/LogEntryProjection.d.ts.map +1 -1
- package/dist/core/LogEntryProjection.js +8 -10
- package/dist/core/LogEntryProjection.js.map +1 -1
- package/dist/core/LogVisibility.d.ts.map +1 -1
- package/dist/core/LogVisibility.js +2 -1
- package/dist/core/LogVisibility.js.map +1 -1
- package/dist/core/LogWriter.d.ts.map +1 -1
- package/dist/core/LogWriter.js +11 -9
- package/dist/core/LogWriter.js.map +1 -1
- package/dist/core/LoopDriver.d.ts +1 -1
- package/dist/core/LoopDriver.d.ts.map +1 -1
- package/dist/core/LoopDriver.js +24 -32
- package/dist/core/LoopDriver.js.map +1 -1
- package/dist/core/LoopLifecycle.d.ts +4 -17
- package/dist/core/LoopLifecycle.d.ts.map +1 -1
- package/dist/core/LoopLifecycle.js +20 -22
- package/dist/core/LoopLifecycle.js.map +1 -1
- package/dist/core/LoopLifecycle.sql +36 -49
- package/dist/core/LoopOutcome.d.ts +10 -0
- package/dist/core/LoopOutcome.d.ts.map +1 -0
- package/dist/core/LoopOutcome.js +28 -0
- package/dist/core/LoopOutcome.js.map +1 -0
- package/dist/core/LoopPolicies.d.ts +7 -0
- package/dist/core/LoopPolicies.d.ts.map +1 -0
- package/dist/core/LoopPolicies.js +37 -0
- package/dist/core/LoopPolicies.js.map +1 -0
- package/dist/core/MessageResources.d.ts +15 -0
- package/dist/core/MessageResources.d.ts.map +1 -0
- package/dist/core/MessageResources.js +46 -0
- package/dist/core/MessageResources.js.map +1 -0
- package/dist/core/MessageResources.sql +36 -0
- package/dist/core/ModelCall.d.ts.map +1 -1
- package/dist/core/ModelCall.js +2 -6
- package/dist/core/ModelCall.js.map +1 -1
- package/dist/core/ModelCall.sql +7 -36
- package/dist/core/OperatorConfig.d.ts +2 -1
- package/dist/core/OperatorConfig.d.ts.map +1 -1
- package/dist/core/OperatorConfig.js +14 -6
- package/dist/core/OperatorConfig.js.map +1 -1
- package/dist/core/PacketBuilder.d.ts.map +1 -1
- package/dist/core/PacketBuilder.js +20 -35
- package/dist/core/PacketBuilder.js.map +1 -1
- package/dist/core/PacketBuilder.sql +24 -6
- package/dist/core/PatternSelection.d.ts +1 -1
- package/dist/core/PatternSelection.d.ts.map +1 -1
- package/dist/core/ProposalLifecycle.d.ts +3 -1
- package/dist/core/ProposalLifecycle.d.ts.map +1 -1
- package/dist/core/ProposalLifecycle.js +93 -28
- package/dist/core/ProposalLifecycle.js.map +1 -1
- package/dist/core/ProviderInstantiate.d.ts +1 -0
- package/dist/core/ProviderInstantiate.d.ts.map +1 -1
- package/dist/core/ProviderInstantiate.js +12 -7
- package/dist/core/ProviderInstantiate.js.map +1 -1
- package/dist/core/ReasoningView.d.ts +1 -2
- package/dist/core/ReasoningView.d.ts.map +1 -1
- package/dist/core/ReasoningView.js +9 -20
- package/dist/core/ReasoningView.js.map +1 -1
- package/dist/core/ResourceBindings.d.ts.map +1 -1
- package/dist/core/ResourceBindings.js +5 -4
- package/dist/core/ResourceBindings.js.map +1 -1
- package/dist/core/ResourceMutations.d.ts +4 -4
- package/dist/core/ResourceMutations.d.ts.map +1 -1
- package/dist/core/ResourceMutations.js +2 -3
- package/dist/core/ResourceMutations.js.map +1 -1
- package/dist/core/ResourceSelector.d.ts +10 -3
- package/dist/core/ResourceSelector.d.ts.map +1 -1
- package/dist/core/ResourceSelector.js +52 -13
- package/dist/core/ResourceSelector.js.map +1 -1
- package/dist/core/ResourceTransfers.d.ts.map +1 -1
- package/dist/core/ResourceTransfers.js +4 -2
- package/dist/core/ResourceTransfers.js.map +1 -1
- package/dist/core/RuntimeWorker.d.ts.map +1 -1
- package/dist/core/RuntimeWorker.js +6 -1
- package/dist/core/RuntimeWorker.js.map +1 -1
- package/dist/core/RuntimeWorker.sql +7 -1
- package/dist/core/SchemeRegistry.d.ts +2 -0
- package/dist/core/SchemeRegistry.d.ts.map +1 -1
- package/dist/core/SchemeRegistry.js +12 -6
- package/dist/core/SchemeRegistry.js.map +1 -1
- package/dist/core/StoredPacket.d.ts +3 -1
- package/dist/core/StoredPacket.d.ts.map +1 -1
- package/dist/core/StoredPacket.js +7 -3
- package/dist/core/StoredPacket.js.map +1 -1
- package/dist/core/StrikeRail.d.ts +2 -2
- package/dist/core/StrikeRail.d.ts.map +1 -1
- package/dist/core/StrikeRail.js +15 -7
- package/dist/core/StrikeRail.js.map +1 -1
- package/dist/core/TerminalResult.d.ts +2 -2
- package/dist/core/TerminalResult.d.ts.map +1 -1
- package/dist/core/TerminalResult.js +15 -8
- package/dist/core/TerminalResult.js.map +1 -1
- package/dist/core/ToolInputSchema.d.ts.map +1 -1
- package/dist/core/ToolInputSchema.js +24 -8
- package/dist/core/ToolInputSchema.js.map +1 -1
- package/dist/core/ToolResources.d.ts +1 -0
- package/dist/core/ToolResources.d.ts.map +1 -1
- package/dist/core/ToolResources.js +50 -26
- package/dist/core/ToolResources.js.map +1 -1
- package/dist/core/Turn.d.ts +3 -1
- package/dist/core/Turn.d.ts.map +1 -1
- package/dist/core/Turn.js +4 -1
- package/dist/core/Turn.js.map +1 -1
- package/dist/core/Turn.sql +14 -2
- package/dist/core/TurnDispositionHandler.d.ts +13 -23
- package/dist/core/TurnDispositionHandler.d.ts.map +1 -1
- package/dist/core/TurnDispositionHandler.js +30 -180
- package/dist/core/TurnDispositionHandler.js.map +1 -1
- package/dist/core/TurnMaterialization.d.ts +9 -7
- package/dist/core/TurnMaterialization.d.ts.map +1 -1
- package/dist/core/TurnMaterialization.js +66 -46
- package/dist/core/TurnMaterialization.js.map +1 -1
- package/dist/core/TurnMaterialization.sql +23 -6
- package/dist/core/TurnOps.d.ts.map +1 -1
- package/dist/core/TurnOps.js +2 -2
- package/dist/core/TurnOps.js.map +1 -1
- package/dist/core/TurnRunner.d.ts +2 -8
- package/dist/core/TurnRunner.d.ts.map +1 -1
- package/dist/core/TurnRunner.js +1116 -1123
- package/dist/core/TurnRunner.js.map +1 -1
- package/dist/core/TurnRunner.sql +1 -24
- package/dist/core/TurnSources.sql +42 -11
- package/dist/core/WorkerControlHandler.d.ts.map +1 -1
- package/dist/core/WorkerControlHandler.js +23 -0
- package/dist/core/WorkerControlHandler.js.map +1 -1
- package/dist/core/WorkerName.d.ts +3 -6
- package/dist/core/WorkerName.d.ts.map +1 -1
- package/dist/core/WorkerName.js +10 -26
- package/dist/core/WorkerName.js.map +1 -1
- package/dist/core/WorkspaceGate.js +4 -4
- package/dist/core/WorkspaceGate.js.map +1 -1
- package/dist/core/ambient.sql +45 -19
- package/dist/core/attachments.d.ts +3 -1
- package/dist/core/attachments.d.ts.map +1 -1
- package/dist/core/attachments.js +4 -0
- package/dist/core/attachments.js.map +1 -1
- package/dist/core/caps/CoreInteractionCaps.d.ts +1 -1
- package/dist/core/caps/CoreInteractionCaps.d.ts.map +1 -1
- package/dist/core/caps/CoreInteractionCaps.js +4 -2
- package/dist/core/caps/CoreInteractionCaps.js.map +1 -1
- package/dist/core/caps/DbChannelCaps.js +6 -6
- package/dist/core/caps/DbChannelCaps.js.map +1 -1
- package/dist/core/caps/DbEntryCaps.js +1 -1
- package/dist/core/caps/DbEntryCaps.js.map +1 -1
- package/dist/core/caps/DbMessageCaps.d.ts +10 -0
- package/dist/core/caps/DbMessageCaps.d.ts.map +1 -0
- package/dist/core/caps/DbMessageCaps.js +39 -0
- package/dist/core/caps/DbMessageCaps.js.map +1 -0
- package/dist/core/caps/DbProjectionCaps.d.ts +2 -2
- package/dist/core/caps/DbProjectionCaps.d.ts.map +1 -1
- package/dist/core/caps/DbProjectionCaps.js +10 -4
- package/dist/core/caps/DbProjectionCaps.js.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.d.ts +3 -1
- package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.js +11 -0
- package/dist/core/caps/SchemeCtxImpl.js.map +1 -1
- package/dist/core/env-catalog.d.ts +28 -0
- package/dist/core/env-catalog.d.ts.map +1 -0
- package/dist/core/env-catalog.js +99 -0
- package/dist/core/env-catalog.js.map +1 -0
- package/dist/core/file-materialization.js +1 -1
- package/dist/core/file-materialization.js.map +1 -1
- package/dist/core/fork.sql +7 -6
- package/dist/core/git-state.d.ts +3 -2
- package/dist/core/git-state.d.ts.map +1 -1
- package/dist/core/git-state.js +38 -21
- package/dist/core/git-state.js.map +1 -1
- package/dist/core/operation-target-groups.d.ts.map +1 -1
- package/dist/core/operation-target-groups.js +2 -1
- package/dist/core/operation-target-groups.js.map +1 -1
- package/dist/core/packet-inject.js +1 -1
- package/dist/core/packet-wire.d.ts +11 -0
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +382 -333
- package/dist/core/packet-wire.js.map +1 -1
- package/dist/core/plurnk-uri.d.ts +4 -5
- package/dist/core/plurnk-uri.d.ts.map +1 -1
- package/dist/core/plurnk-uri.js +10 -31
- package/dist/core/plurnk-uri.js.map +1 -1
- package/dist/core/scheme-types.d.ts +3 -1
- package/dist/core/scheme-types.d.ts.map +1 -1
- package/dist/core/scheme-types.js +1 -1
- package/dist/core/scheme-types.js.map +1 -1
- package/dist/core/teaching.d.ts.map +1 -1
- package/dist/core/teaching.js +2 -1
- package/dist/core/teaching.js.map +1 -1
- package/dist/core/types.d.ts +1 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/worker-ops.sql +3 -8
- package/dist/digest/Digest.d.ts.map +1 -1
- package/dist/digest/Digest.js +37 -30
- package/dist/digest/Digest.js.map +1 -1
- package/dist/digest/DigestRender.d.ts +2 -0
- package/dist/digest/DigestRender.d.ts.map +1 -1
- package/dist/digest/DigestRender.js +97 -9
- package/dist/digest/DigestRender.js.map +1 -1
- package/dist/digest/DigestRequiem.d.ts.map +1 -1
- package/dist/digest/DigestRequiem.js +13 -15
- package/dist/digest/DigestRequiem.js.map +1 -1
- package/dist/digest/digest-db.d.ts +3 -0
- package/dist/digest/digest-db.d.ts.map +1 -0
- package/dist/digest/digest-db.js +68 -0
- package/dist/digest/digest-db.js.map +1 -0
- package/dist/digest/digest-paths.d.ts +6 -0
- package/dist/digest/digest-paths.d.ts.map +1 -0
- package/dist/digest/digest-paths.js +23 -0
- package/dist/digest/digest-paths.js.map +1 -0
- package/dist/digest/digest-rows.d.ts +21 -0
- package/dist/digest/digest-rows.d.ts.map +1 -1
- package/dist/digest/digest.sql +24 -5
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/observe/genai.d.ts +2 -2
- package/dist/observe/genai.d.ts.map +1 -1
- package/dist/observe/genai.js +15 -5
- package/dist/observe/genai.js.map +1 -1
- package/dist/schemes/EffectPolicy.d.ts +0 -2
- package/dist/schemes/EffectPolicy.d.ts.map +1 -1
- package/dist/schemes/EffectPolicy.js +25 -36
- package/dist/schemes/EffectPolicy.js.map +1 -1
- package/dist/schemes/Exec.d.ts +4 -5
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +129 -82
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/ExecOutputScheme.d.ts +6 -5
- package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
- package/dist/schemes/ExecOutputScheme.js +49 -16
- package/dist/schemes/ExecOutputScheme.js.map +1 -1
- package/dist/schemes/ExecScheduler.js +2 -2
- package/dist/schemes/ExecScheduler.js.map +1 -1
- package/dist/schemes/File.d.ts.map +1 -1
- package/dist/schemes/File.js +30 -21
- package/dist/schemes/File.js.map +1 -1
- package/dist/schemes/Log.d.ts +4 -4
- package/dist/schemes/Log.d.ts.map +1 -1
- package/dist/schemes/Log.js +30 -10
- package/dist/schemes/Log.js.map +1 -1
- package/dist/schemes/QuestionTool.d.ts.map +1 -1
- package/dist/schemes/QuestionTool.js +15 -2
- package/dist/schemes/QuestionTool.js.map +1 -1
- package/dist/schemes/TurnSource.d.ts +3 -2
- package/dist/schemes/TurnSource.d.ts.map +1 -1
- package/dist/schemes/TurnSource.js +87 -41
- package/dist/schemes/TurnSource.js.map +1 -1
- package/dist/schemes/Worker.d.ts.map +1 -1
- package/dist/schemes/Worker.js +22 -56
- package/dist/schemes/Worker.js.map +1 -1
- package/dist/schemes/_entry-crud.js +6 -6
- package/dist/schemes/_entry-crud.js.map +1 -1
- package/dist/schemes/_entry-crud.sql +37 -17
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +6 -5
- package/dist/schemes/_entry-find.js.map +1 -1
- package/dist/schemes/_entry-fts.d.ts.map +1 -1
- package/dist/schemes/_entry-fts.js +6 -3
- package/dist/schemes/_entry-fts.js.map +1 -1
- package/dist/schemes/_entry-fts.sql +25 -6
- package/dist/schemes/_entry-manifest.d.ts +1 -1
- package/dist/schemes/_entry-manifest.d.ts.map +1 -1
- package/dist/schemes/_entry-manifest.js +10 -17
- package/dist/schemes/_entry-manifest.js.map +1 -1
- package/dist/schemes/_entry-manifest.sql +1 -1
- package/dist/schemes/_entry-ops.js +4 -4
- package/dist/schemes/_entry-ops.js.map +1 -1
- package/dist/schemes/_entry-ops.sql +2 -2
- package/dist/schemes/_entry-readable.d.ts.map +1 -1
- package/dist/schemes/_entry-readable.js +5 -4
- package/dist/schemes/_entry-readable.js.map +1 -1
- package/dist/schemes/_entry-send.js +2 -2
- package/dist/schemes/_entry-send.js.map +1 -1
- package/dist/schemes/_search-exclusion.d.ts +1 -0
- package/dist/schemes/_search-exclusion.d.ts.map +1 -1
- package/dist/schemes/_search-exclusion.js +12 -0
- package/dist/schemes/_search-exclusion.js.map +1 -1
- package/dist/schemes/_search-index.d.ts +5 -1
- package/dist/schemes/_search-index.d.ts.map +1 -1
- package/dist/schemes/_search-index.js +99 -59
- package/dist/schemes/_search-index.js.map +1 -1
- package/dist/schemes/_search-index.sql +17 -0
- package/dist/schemes/exec-abort.d.ts.map +1 -1
- package/dist/schemes/exec-abort.js +5 -4
- package/dist/schemes/exec-abort.js.map +1 -1
- package/dist/schemes/exec-env.d.ts +3 -0
- package/dist/schemes/exec-env.d.ts.map +1 -1
- package/dist/schemes/exec-env.js +66 -15
- package/dist/schemes/exec-env.js.map +1 -1
- package/dist/schemes/exec-lifetime.d.ts +11 -0
- package/dist/schemes/exec-lifetime.d.ts.map +1 -0
- package/dist/schemes/exec-lifetime.js +29 -0
- package/dist/schemes/exec-lifetime.js.map +1 -0
- package/dist/schemes/exec-runtime.d.ts +1 -1
- package/dist/schemes/exec-runtime.d.ts.map +1 -1
- package/dist/schemes/exec-runtime.js +1 -1
- package/dist/schemes/exec-runtime.js.map +1 -1
- package/dist/server/ClientReads.d.ts.map +1 -1
- package/dist/server/ClientReads.js +5 -2
- package/dist/server/ClientReads.js.map +1 -1
- package/dist/server/Daemon.d.ts +31 -7
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +137 -60
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/DaemonModule.d.ts +25 -6
- package/dist/server/DaemonModule.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.d.ts +13 -11
- package/dist/server/DrainSupervisor.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.js +87 -98
- package/dist/server/DrainSupervisor.js.map +1 -1
- package/dist/server/EnvFunctionality.d.ts +52 -0
- package/dist/server/EnvFunctionality.d.ts.map +1 -0
- package/dist/server/EnvFunctionality.js +199 -0
- package/dist/server/EnvFunctionality.js.map +1 -0
- package/dist/server/Functionality.d.ts +4 -2
- package/dist/server/Functionality.d.ts.map +1 -1
- package/dist/server/Functionality.js +250 -106
- package/dist/server/Functionality.js.map +1 -1
- package/dist/server/FunctionalityManager.d.ts +5 -1
- package/dist/server/FunctionalityManager.d.ts.map +1 -1
- package/dist/server/FunctionalityManager.js +24 -8
- package/dist/server/FunctionalityManager.js.map +1 -1
- package/dist/server/HttpListener.d.ts +16 -0
- package/dist/server/HttpListener.d.ts.map +1 -0
- package/dist/server/HttpListener.js +81 -0
- package/dist/server/HttpListener.js.map +1 -0
- package/dist/server/MembersFunctionality.d.ts.map +1 -1
- package/dist/server/MembersFunctionality.js +12 -17
- package/dist/server/MembersFunctionality.js.map +1 -1
- package/dist/server/PlurnkSkill.d.ts.map +1 -1
- package/dist/server/PlurnkSkill.js +1 -0
- package/dist/server/PlurnkSkill.js.map +1 -1
- package/dist/server/Retention.d.ts +14 -0
- package/dist/server/Retention.d.ts.map +1 -1
- package/dist/server/Retention.js +52 -4
- package/dist/server/Retention.js.map +1 -1
- package/dist/server/Retention.sql +55 -1
- package/dist/server/ServiceModules.d.ts.map +1 -1
- package/dist/server/ServiceModules.js +2 -0
- package/dist/server/ServiceModules.js.map +1 -1
- package/dist/server/SkillsFunctionality.d.ts +2 -0
- package/dist/server/SkillsFunctionality.d.ts.map +1 -1
- package/dist/server/SkillsFunctionality.js +27 -17
- package/dist/server/SkillsFunctionality.js.map +1 -1
- package/dist/server/WorkspaceCapabilities.d.ts.map +1 -1
- package/dist/server/WorkspaceCapabilities.js +1 -0
- package/dist/server/WorkspaceCapabilities.js.map +1 -1
- package/dist/server/WorkspaceResidency.d.ts +2 -0
- package/dist/server/WorkspaceResidency.d.ts.map +1 -1
- package/dist/server/WorkspaceResidency.js +27 -0
- package/dist/server/WorkspaceResidency.js.map +1 -1
- package/dist/server/WorkspaceStorage.d.ts +8 -0
- package/dist/server/WorkspaceStorage.d.ts.map +1 -0
- package/dist/server/WorkspaceStorage.js +26 -0
- package/dist/server/WorkspaceStorage.js.map +1 -0
- package/dist/server/client-input.d.ts +4 -3
- package/dist/server/client-input.d.ts.map +1 -1
- package/dist/server/client-input.js +25 -27
- package/dist/server/client-input.js.map +1 -1
- package/dist/server/dispatch-as-plurnk.js +2 -2
- package/dist/server/dispatch-as-plurnk.js.map +1 -1
- package/dist/server/drain.sql +69 -132
- package/dist/server/envelope.d.ts +2 -3
- package/dist/server/envelope.d.ts.map +1 -1
- package/dist/server/envelope.js +7 -21
- package/dist/server/envelope.js.map +1 -1
- package/dist/server/envelope.sql +10 -6
- package/dist/server/exec-poll-backoff.js +3 -3
- package/dist/server/exec-poll-backoff.js.map +1 -1
- package/dist/server/lifecycle-recovery.sql +12 -38
- package/dist/server/logEntry.sql +2 -2
- package/dist/server/loopDocs.js +3 -3
- package/dist/server/loopDocs.sql +4 -2
- package/dist/server/model-catalog.d.ts.map +1 -1
- package/dist/server/model-catalog.js +2 -2
- package/dist/server/model-catalog.js.map +1 -1
- package/dist/server/seam-loop.sql +0 -1
- package/dist/server/workspace-capabilities.sql +45 -0
- package/dist/server/workspace-storage.sql +8 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +37 -11
- package/dist/service.js.map +1 -1
- package/docs/copy-move.md +31 -0
- package/docs/env.md +67 -0
- package/docs/members.md +4 -4
- package/docs/skills.md +2 -2
- package/migrations/002_workers.sql +41 -17
- package/migrations/003_loops.sql +82 -28
- package/migrations/004_inference.sql +53 -12
- package/migrations/005_entries.sql +135 -14
- package/migrations/006_log.sql +79 -24
- package/migrations/007_subscriptions.sql +10 -15
- package/package.json +45 -36
- package/dist/core/PromptFrames.d.ts +0 -12
- package/dist/core/PromptFrames.d.ts.map +0 -1
- package/dist/core/PromptFrames.js +0 -28
- package/dist/core/PromptFrames.js.map +0 -1
- package/dist/schemes/Prompt.d.ts +0 -8
- package/dist/schemes/Prompt.d.ts.map +0 -1
- package/dist/schemes/Prompt.js +0 -25
- package/dist/schemes/Prompt.js.map +0 -1
package/dist/core/Dispatcher.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import { PlurnkParser,
|
|
3
|
-
import {
|
|
2
|
+
import { PlurnkParser, parsePath } from "@plurnk/plurnk-parser";
|
|
3
|
+
import { TurnDisposition } from "@plurnk/plurnk-contracts";
|
|
4
|
+
import Turn from "./Turn.js";
|
|
5
|
+
import { foldAuthorityIntoPath, renderAddress, renderTarget, schemeNameOf } from "./plurnk-uri.js";
|
|
6
|
+
import WorkerName from "./WorkerName.js";
|
|
4
7
|
import { PathSyntax } from "@plurnk/plurnk-contracts";
|
|
5
8
|
import Namespace from "./namespace.js";
|
|
6
9
|
import CapabilityResolver from "./CapabilityResolver.js";
|
|
10
|
+
import CapabilityPolicies from "./CapabilityPolicies.js";
|
|
7
11
|
import LoopPolicyReader from "./LoopPolicyReader.js";
|
|
8
12
|
import SchemeCtxImpl from "./caps/SchemeCtxImpl.js";
|
|
9
13
|
import Results from "./results.js";
|
|
10
14
|
import { OperationFailureError } from "./results.js";
|
|
11
15
|
import EffectPolicy from "../schemes/EffectPolicy.js";
|
|
12
16
|
import { CoreSchemeAdapterBase } from "./CoreSchemeServices.js";
|
|
13
|
-
import { InvalidOperationResultError } from "@plurnk/plurnk-schemes";
|
|
17
|
+
import { InvalidOperationResultError, MessageAttachments } from "@plurnk/plurnk-schemes";
|
|
14
18
|
import ResourceMutations from "./ResourceMutations.js";
|
|
19
|
+
import ResourceSelector from "./ResourceSelector.js";
|
|
15
20
|
import { primaryTargetOf } from "./statement-primary.js";
|
|
16
21
|
import LogBody from "./LogBody.js";
|
|
17
22
|
import LogVisibility from "./LogVisibility.js";
|
|
@@ -24,20 +29,16 @@ import LogWriter from "./LogWriter.js";
|
|
|
24
29
|
import LogEntryProjection from "./LogEntryProjection.js";
|
|
25
30
|
import DataStatementRunner from "./DataStatementRunner.js";
|
|
26
31
|
import ResourceBindings from "./ResourceBindings.js";
|
|
32
|
+
import { isExecution } from "@plurnk/plurnk-contracts";
|
|
27
33
|
// SPEC {§scheme-surface}: writer must be in target scheme's manifest.writableBy.
|
|
28
34
|
// READ/FIND are not gated — they read, never mutating an entry.
|
|
29
|
-
const MUTATING_OPS = new Set(["EDIT", "SEND", "COPY", "MOVE", "
|
|
35
|
+
const MUTATING_OPS = new Set(["EDIT", "SEND", "COPY", "MOVE", "KILL", "FORK", "WORK"]);
|
|
30
36
|
// Op dispatch ({§op-methods-op-dispatch}): admission, operation-owner routing,
|
|
31
37
|
// durable log writing, and proposal lifecycle.
|
|
32
38
|
class Dispatcher {
|
|
33
39
|
static #failure(code, status, detail, fields = {}, extensions = {}) {
|
|
34
40
|
return Results.failure("engine:dispatcher", code, status, detail, fields, extensions);
|
|
35
41
|
}
|
|
36
|
-
static #statusResult(status, code, detail, fields = {}) {
|
|
37
|
-
return status >= 400
|
|
38
|
-
? _a.#failure(code, status, detail, fields, { retryable: false })
|
|
39
|
-
: { ...fields, status };
|
|
40
|
-
}
|
|
41
42
|
#db;
|
|
42
43
|
#schemes;
|
|
43
44
|
#mimetypes;
|
|
@@ -56,11 +57,12 @@ class Dispatcher {
|
|
|
56
57
|
#wakeWorkerNotify;
|
|
57
58
|
#injectWorker;
|
|
58
59
|
#cancelWorker;
|
|
59
|
-
#
|
|
60
|
+
#operationSettledNotify;
|
|
60
61
|
// Per-turn running-worker READ obligations. {§join-blocking-collect}
|
|
61
62
|
#liveSubscriptions;
|
|
62
63
|
#lifecycle;
|
|
63
64
|
#resourceMutations;
|
|
65
|
+
#resourceSelector;
|
|
64
66
|
#entryAddresses;
|
|
65
67
|
#capabilities;
|
|
66
68
|
#workerControl;
|
|
@@ -68,7 +70,7 @@ class Dispatcher {
|
|
|
68
70
|
#disposition;
|
|
69
71
|
#logWriter;
|
|
70
72
|
#dataRun;
|
|
71
|
-
constructor({ db, lifecycle, schemes, mimetypes, weigh, notices, proposals, interactions, executors, loopSignal, settleDerivations, streamEventNotify, wakeWorkerNotify, injectWorker, cancelWorker,
|
|
73
|
+
constructor({ db, lifecycle, schemes, mimetypes, weigh, notices, proposals, interactions, executors, loopSignal, settleDerivations, streamEventNotify, wakeWorkerNotify, injectWorker, cancelWorker, operationSettledNotify, liveSubscriptions, entryAddresses }) {
|
|
72
74
|
this.#db = db;
|
|
73
75
|
this.#schemes = schemes;
|
|
74
76
|
this.#mimetypes = mimetypes;
|
|
@@ -83,11 +85,20 @@ class Dispatcher {
|
|
|
83
85
|
this.#wakeWorkerNotify = wakeWorkerNotify;
|
|
84
86
|
this.#injectWorker = injectWorker;
|
|
85
87
|
this.#cancelWorker = cancelWorker;
|
|
86
|
-
this.#
|
|
88
|
+
this.#operationSettledNotify = operationSettledNotify;
|
|
87
89
|
this.#liveSubscriptions = liveSubscriptions;
|
|
88
90
|
this.#entryAddresses = entryAddresses;
|
|
89
91
|
this.#capabilities = new CapabilityResolver(db, schemes, executors);
|
|
90
92
|
this.#lifecycle = lifecycle;
|
|
93
|
+
this.#resourceSelector = new ResourceSelector({
|
|
94
|
+
schemes,
|
|
95
|
+
admitRead: (statement, ctx) => this.#checkCapabilities(statement, ctx),
|
|
96
|
+
canonicalFilePath: (pathname, workspaceId) => this.#canonicalFilePath(pathname, workspaceId),
|
|
97
|
+
prepareDataRepresentation: (args) => this.#prepareDataRepresentation({
|
|
98
|
+
...args,
|
|
99
|
+
handler: args.handler,
|
|
100
|
+
}),
|
|
101
|
+
});
|
|
91
102
|
this.#resourceMutations = new ResourceMutations({
|
|
92
103
|
schemes,
|
|
93
104
|
liveSubscriptions,
|
|
@@ -95,11 +106,7 @@ class Dispatcher {
|
|
|
95
106
|
checkWritable: (statement, origin, workspaceId) => this.#checkWritable(statement, origin, workspaceId),
|
|
96
107
|
checkCapabilities: (statement, ctx) => this.#checkCapabilities(statement, ctx),
|
|
97
108
|
editTargetIdentity: (statement, workspaceId, workerId) => this.#editTargetIdentity(statement, workspaceId, workerId),
|
|
98
|
-
|
|
99
|
-
prepareDataRepresentation: (args) => this.#prepareDataRepresentation({
|
|
100
|
-
...args,
|
|
101
|
-
handler: args.handler,
|
|
102
|
-
}),
|
|
109
|
+
selection: this.#resourceSelector,
|
|
103
110
|
resolveDataEntryAddress: (args) => this.#entryAddresses.resolve(args),
|
|
104
111
|
readEntry: (scheme, address, ctx) => this.#readEntry(scheme, address, ctx),
|
|
105
112
|
writeEntry: (scheme, address, entry, ctx) => this.#writeEntry(scheme, address, entry, ctx),
|
|
@@ -108,7 +115,7 @@ class Dispatcher {
|
|
|
108
115
|
});
|
|
109
116
|
this.#workerControl = new WorkerControlHandler({ db: this.#db, failure: _a.#failure });
|
|
110
117
|
this.#kill = new KillHandler({ db: this.#db, schemes: this.#schemes, liveSubscriptions: this.#liveSubscriptions, cancelWorker: this.#cancelWorker, resolveDataEntryAddress: this.#resolveDataEntryAddress.bind(this), boundEntryContext: this.#boundEntryContext.bind(this), handlerContext: this.#handlerContext.bind(this), deleteEntry: this.#deleteEntry.bind(this), failure: _a.#failure });
|
|
111
|
-
this.#disposition = new TurnDispositionHandler({ db: this.#db,
|
|
118
|
+
this.#disposition = new TurnDispositionHandler({ db: this.#db, lifecycle: this.#lifecycle, unobservedFailureCount: this.#unobservedFailureCount.bind(this), pendingSet: this.#pendingSet.bind(this), hasLiveWork: this.hasLiveWork.bind(this) });
|
|
112
119
|
this.#logWriter = new LogWriter({ db: this.#db, weighContent: this.#weighContent, extractTarget: this.#extractTarget.bind(this), canonColumns: this.#canonColumns.bind(this), signalToJson: this.#signalToJson.bind(this), isProposal: _a.#isProposal });
|
|
113
120
|
this.#dataRun = new DataStatementRunner({ schemes: this.#schemes, liveSubscriptions: this.#liveSubscriptions, resolveDataEntryAddress: this.#resolveDataEntryAddress.bind(this), prepareDataRepresentation: this.#prepareDataRepresentation.bind(this), failure: _a.#failure });
|
|
114
121
|
}
|
|
@@ -332,16 +339,18 @@ class Dispatcher {
|
|
|
332
339
|
turnId: context.turnId, sequence: context.sequence, origin: context.origin, curationPlan: null, modelCallId: null,
|
|
333
340
|
});
|
|
334
341
|
context.onDispatch?.(logEntryId);
|
|
342
|
+
await this.#notifySettled(context, logEntryId);
|
|
335
343
|
return result;
|
|
336
344
|
}
|
|
345
|
+
const matchingPathCount = typeof found.matchingPathCount === "number" ? found.matchingPathCount : paths.length;
|
|
337
346
|
const results = [];
|
|
338
347
|
for (const [index, path] of paths.entries()) {
|
|
339
348
|
const target = parsePath(path);
|
|
340
349
|
if (target === null)
|
|
341
350
|
throw new InvalidOperationResultError(`FIND named an unparseable path: ${path}`);
|
|
342
|
-
|
|
351
|
+
const fanout = { target: statement.target.raw, matched: matchingPathCount, index, count: paths.length };
|
|
352
|
+
results.push(await this.dispatch({ ...context, statement: { ...statement, target }, sequence: context.sequence + index, fanout }));
|
|
343
353
|
}
|
|
344
|
-
const matchingPathCount = typeof found.matchingPathCount === "number" ? found.matchingPathCount : paths.length;
|
|
345
354
|
if (matchingPathCount > paths.length) {
|
|
346
355
|
this.#notices.push(context.workspaceId, context.workerId, context.loopId, {
|
|
347
356
|
source: "engine:dispatcher",
|
|
@@ -353,14 +362,11 @@ class Dispatcher {
|
|
|
353
362
|
return Results.assert({ ...(results.find(({ status }) => status >= 400) ?? results[results.length - 1]), rowsWritten: results.length });
|
|
354
363
|
}
|
|
355
364
|
async #dispatchOne(context, schemeCtx) {
|
|
356
|
-
const { statement, workspaceId, workerId, loopId, turnId, sequence, origin, onDispatch,
|
|
365
|
+
const { statement, workspaceId, workerId, loopId, turnId, sequence, origin, onDispatch, } = context;
|
|
357
366
|
let result;
|
|
358
367
|
let curationPlan = null;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
const ownPrompt = statement.op === "SEND" && origin === "model" && await this.#isOwnPromptAddress(statement.target, workerId, loopId);
|
|
362
|
-
const denial = ownPrompt ? null : (this.#checkWritable(statement, origin, workspaceId)
|
|
363
|
-
?? await this.#checkCapabilities(statement, schemeCtx));
|
|
368
|
+
const denial = this.#checkWritable(statement, origin, workspaceId)
|
|
369
|
+
?? await this.#checkCapabilities(statement, schemeCtx);
|
|
364
370
|
if (denial !== null) {
|
|
365
371
|
result = denial;
|
|
366
372
|
}
|
|
@@ -374,19 +380,23 @@ class Dispatcher {
|
|
|
374
380
|
if (statement.op === "EDIT") {
|
|
375
381
|
result = await this.#resourceMutations.edit(statement, schemeCtx, context.editSequence);
|
|
376
382
|
}
|
|
377
|
-
else if (statement.op === "SEND" &&
|
|
383
|
+
else if (statement.op === "SEND" && statement.target === null) {
|
|
378
384
|
result = await this.#respond(statement, schemeCtx, origin, workerId, loopId);
|
|
385
|
+
if (context.proseAnswer === true && result.status === 200)
|
|
386
|
+
result = await this.#answered(result, workerId, loopId);
|
|
387
|
+
}
|
|
388
|
+
else if (statement.op === "NOTE") {
|
|
389
|
+
await Turn.recordSource(this.#db, turnId, "note", statement.body ?? "", { sequence });
|
|
390
|
+
const coordinate = await this.#db.engine_loop_turn_seqs.get({ loop_id: loopId, turn_id: turnId });
|
|
391
|
+
if (coordinate === undefined)
|
|
392
|
+
throw new Error(`NOTE has no turn coordinate for ${turnId}`);
|
|
393
|
+
const workerName = await WorkerName.forId(this.#db, workerId);
|
|
394
|
+
result = { status: 200, resource: renderAddress({ scheme: "note", authority: workerName, pathname: `/${coordinate.loop_seq}/${coordinate.turn_seq}/${sequence}` }) };
|
|
379
395
|
}
|
|
380
396
|
else if (TurnDisposition.is(statement)) {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
loopId,
|
|
385
|
-
turnId,
|
|
386
|
-
sequence,
|
|
387
|
-
origin,
|
|
388
|
-
allowUnobservedRetrievalCompletion: context.allowUnobservedRetrievalCompletion,
|
|
389
|
-
});
|
|
397
|
+
// {§turn-disposition} — WAIT is the park; whatever it names is its label in the
|
|
398
|
+
// row, never a join: the next wake is a message, a child's end, a stream's close.
|
|
399
|
+
result = await this.#disposition.handle({ workerId, loopId, turnId, origin });
|
|
390
400
|
}
|
|
391
401
|
else if (statement.op === "KILL" && schemeNameOf(statement.target) === "log") {
|
|
392
402
|
const curation = await this.#runLogCuration(statement, schemeCtx, context.logSelectionMaxId);
|
|
@@ -410,8 +420,8 @@ class Dispatcher {
|
|
|
410
420
|
else if (statement.op === "KILL") {
|
|
411
421
|
result = await this.#kill.handleKill(statement, schemeCtx);
|
|
412
422
|
}
|
|
413
|
-
else if (statement
|
|
414
|
-
//
|
|
423
|
+
else if (isExecution(statement)) {
|
|
424
|
+
// An execution routes unconditionally to its operation owner after
|
|
415
425
|
// the shared capability resolver admits its runtime/tool.
|
|
416
426
|
result = await this.#dataRun.run("exec", statement, schemeCtx);
|
|
417
427
|
}
|
|
@@ -436,6 +446,11 @@ class Dispatcher {
|
|
|
436
446
|
}
|
|
437
447
|
}
|
|
438
448
|
}
|
|
449
|
+
// {§read-fan-out} — a row read on behalf of a glob names the statement it came from.
|
|
450
|
+
if (context.fanout !== undefined) {
|
|
451
|
+
const attrs = typeof result.attrs === "object" && result.attrs !== null ? result.attrs : {};
|
|
452
|
+
result = { ...result, attrs: { ...attrs, fanout: context.fanout } };
|
|
453
|
+
}
|
|
439
454
|
// Persist log curation for forensics; packet rendering suppresses its
|
|
440
455
|
// successful receipts while the exact state effects remain durable.
|
|
441
456
|
// A running-worker READ arms this turn's blocking collect.
|
|
@@ -454,7 +469,7 @@ class Dispatcher {
|
|
|
454
469
|
});
|
|
455
470
|
onDispatch?.(logEntryId);
|
|
456
471
|
// Proposal lifecycle (SPEC.md {§engine-rails} + {§methods-proposal-resolve}; {§proposal-202-pauses}). When a
|
|
457
|
-
// side-effecting op returns status 202 (a
|
|
472
|
+
// side-effecting op returns status 202 (a WAIT parks rather
|
|
458
473
|
// than proposing — #isProposal), the entry is written
|
|
459
474
|
// state='proposed'; dispatch then PAUSES on a per-entry waiter until
|
|
460
475
|
// resolution arrives via Engine.resolveProposal (from a client-interface resume,
|
|
@@ -462,19 +477,23 @@ class Dispatcher {
|
|
|
462
477
|
// result the caller sees, so runTurn never branches on a pending state.
|
|
463
478
|
if (_a.#isProposal(statement, result)) {
|
|
464
479
|
// Effect-gated auto-run (read/pure runtimes, {§exec-readpure-ungated}):
|
|
465
|
-
//
|
|
480
|
+
// An execution stores its one canonical effect fact before admission. Reuse
|
|
466
481
|
// that exact fact here; no human gate or loop/proposal notification.
|
|
482
|
+
// {§exec-host-proposes} — the rule is the effect, not the op: an execution and a
|
|
483
|
+
// runtime SEND MUST declare one, and any other proposal that declares one (an
|
|
484
|
+
// outbound HTTP mutation, {§http-outbound-proposes}) is mapped by the same panel.
|
|
467
485
|
const effect = result.attrs?.effect;
|
|
468
486
|
let autoAccept = false;
|
|
469
|
-
|
|
470
|
-
&& this.#schemes.isRuntimeScheme(schemeNameOf(statement.target) ?? "", workspaceId))
|
|
487
|
+
const mustDeclareEffect = isExecution(statement) || (statement.op === "SEND"
|
|
488
|
+
&& this.#schemes.isRuntimeScheme(schemeNameOf(statement.target) ?? "", workspaceId));
|
|
489
|
+
if (mustDeclareEffect || effect !== undefined) {
|
|
471
490
|
if (!EffectPolicy.isEffect(effect)) {
|
|
472
491
|
throw new InvalidOperationResultError("Execution proposal omitted its canonical effect fact.");
|
|
473
492
|
}
|
|
474
493
|
autoAccept = EffectPolicy.decide(effect) === "auto";
|
|
475
494
|
}
|
|
476
495
|
if (autoAccept) {
|
|
477
|
-
const initialSettlement = await this.#proposals.workerApply(statement, result, { decision: "accept" }, { workspaceId, workerId, loopId, turnId });
|
|
496
|
+
const initialSettlement = await this.#proposals.workerApply(statement, result, { decision: "accept" }, { workspaceId, workerId, loopId, turnId, resources: schemeCtx.resources });
|
|
478
497
|
const effective = await this.#resourceMutations.settleProposal({
|
|
479
498
|
statement,
|
|
480
499
|
result,
|
|
@@ -483,7 +502,7 @@ class Dispatcher {
|
|
|
483
502
|
ids: { workspaceId, workerId, loopId, turnId },
|
|
484
503
|
});
|
|
485
504
|
const post = await this.#proposals.applyResolution(logEntryId, effective);
|
|
486
|
-
await
|
|
505
|
+
await this.#notifySettled(context, logEntryId);
|
|
487
506
|
return post;
|
|
488
507
|
}
|
|
489
508
|
// Register the resolution waiter SYNCHRONOUSLY before any await
|
|
@@ -497,14 +516,14 @@ class Dispatcher {
|
|
|
497
516
|
// not an observer and cannot silently degrade into client ownership.
|
|
498
517
|
let resolutionPromise;
|
|
499
518
|
try {
|
|
500
|
-
resolutionPromise = this.#proposals.awaitResolution(logEntryId);
|
|
519
|
+
resolutionPromise = this.#proposals.awaitResolution(logEntryId, this.#loopSignal(loopId));
|
|
501
520
|
const event = await this.#proposals.pending(logEntryId);
|
|
502
521
|
this.#proposals.settleOwned(event);
|
|
503
522
|
this.#proposals.notifyPending(event);
|
|
504
523
|
}
|
|
505
524
|
catch (cause) {
|
|
506
525
|
await this.#proposals.failPreparation(logEntryId, cause);
|
|
507
|
-
await
|
|
526
|
+
await this.#notifySettled(context, logEntryId);
|
|
508
527
|
throw cause;
|
|
509
528
|
}
|
|
510
529
|
const resolution = await resolutionPromise;
|
|
@@ -512,7 +531,7 @@ class Dispatcher {
|
|
|
512
531
|
// file, spawns the process, etc.). Its operation result is
|
|
513
532
|
// preserved: an apply failure keeps its original status and
|
|
514
533
|
// Problem Details instead of masquerading as a client rejection.
|
|
515
|
-
const initialSettlement = await this.#proposals.workerApply(statement, result, resolution, { workspaceId, workerId, loopId, turnId });
|
|
534
|
+
const initialSettlement = await this.#proposals.workerApply(statement, result, resolution, { workspaceId, workerId, loopId, turnId, resources: schemeCtx.resources });
|
|
516
535
|
const effective = await this.#resourceMutations.settleProposal({
|
|
517
536
|
statement,
|
|
518
537
|
result,
|
|
@@ -521,12 +540,16 @@ class Dispatcher {
|
|
|
521
540
|
ids: { workspaceId, workerId, loopId, turnId },
|
|
522
541
|
});
|
|
523
542
|
const post = await this.#proposals.applyResolution(logEntryId, effective);
|
|
524
|
-
await
|
|
543
|
+
await this.#notifySettled(context, logEntryId);
|
|
525
544
|
return post;
|
|
526
545
|
}
|
|
527
|
-
await
|
|
546
|
+
await this.#notifySettled(context, logEntryId);
|
|
528
547
|
return result;
|
|
529
548
|
}
|
|
549
|
+
async #notifySettled(context, logEntryId) {
|
|
550
|
+
await context.onSettled?.(logEntryId);
|
|
551
|
+
await this.#operationSettledNotify?.(context.workspaceId, logEntryId);
|
|
552
|
+
}
|
|
530
553
|
// {§op-look}: resolve a READ and return its content without writing a
|
|
531
554
|
// log_entries row: the client's out-of-band inspection primitive (LOOK → READ,
|
|
532
555
|
// invisible to the model). READ never mutates and never proposes, so this is
|
|
@@ -611,7 +634,7 @@ class Dispatcher {
|
|
|
611
634
|
if (metadata !== null && manifest.metadataModifier !== true) {
|
|
612
635
|
return {
|
|
613
636
|
address: null,
|
|
614
|
-
result: _a.#failure("scheme-metadata-unsupported", 400, `
|
|
637
|
+
result: _a.#failure("scheme-metadata-unsupported", 400, `Resource acquisition from '${routedScheme}' does not accept the [metadata] modifier.`, {}, { scheme: routedScheme, retryable: false }),
|
|
615
638
|
};
|
|
616
639
|
}
|
|
617
640
|
const resolved = priorResolution ?? await this.#resolveDataEntryAddress({
|
|
@@ -645,7 +668,7 @@ class Dispatcher {
|
|
|
645
668
|
result: prepared.status === 200 ? null : prepared,
|
|
646
669
|
};
|
|
647
670
|
}
|
|
648
|
-
// An accepted
|
|
671
|
+
// An accepted execution reads a non-file source through the same registered
|
|
649
672
|
// handler and addressed context as an authored READ. {§exec-target-routing}
|
|
650
673
|
async readExecSource(statement, ctx) {
|
|
651
674
|
return ResourceBindings.using(this.#schemes, ctx, (boundCtx) => this.#readExecSource(statement, boundCtx));
|
|
@@ -655,7 +678,7 @@ class Dispatcher {
|
|
|
655
678
|
const binding = await ResourceBindings.resolve(statement.target, ctx);
|
|
656
679
|
const manifest = binding?.manifest;
|
|
657
680
|
if (manifest !== undefined && manifest.category !== "data") {
|
|
658
|
-
return { nativePath: null, result: _a.#failure("exec-source-not-data", 501, `Scheme '${schemeName}' is not a data source for
|
|
681
|
+
return { nativePath: null, result: _a.#failure("exec-source-not-data", 501, `Scheme '${schemeName}' is not a data source for an execution.`, {}, {
|
|
659
682
|
scheme: schemeName,
|
|
660
683
|
category: manifest.category,
|
|
661
684
|
retryable: false,
|
|
@@ -677,7 +700,7 @@ class Dispatcher {
|
|
|
677
700
|
return { result, nativePath: null };
|
|
678
701
|
const nativePath = await source.nativePath();
|
|
679
702
|
if (nativePath === null)
|
|
680
|
-
return { nativePath: null, result: _a.#failure("entry-not-found", 404, "The
|
|
703
|
+
return { nativePath: null, result: _a.#failure("entry-not-found", 404, "The execution's source file no longer exists.", {}, { target: target.raw }) };
|
|
681
704
|
return { result, nativePath };
|
|
682
705
|
}
|
|
683
706
|
// The one place per-dispatch coordinates are built; a caller that carries no
|
|
@@ -690,6 +713,8 @@ class Dispatcher {
|
|
|
690
713
|
db: this.#db,
|
|
691
714
|
workspaceId, workerId, loopId, turnId,
|
|
692
715
|
writer: origin,
|
|
716
|
+
resources: { capture: (targets) => ResourceBindings.using(this.#schemes, context, (bound) => this.#resourceSelector.capture(targets, bound)) },
|
|
717
|
+
replyToMessage: (statement) => this.#respond(statement, context, origin, workerId, loopId),
|
|
693
718
|
signal: this.#loopSignal(loopId),
|
|
694
719
|
streamEventNotify: this.#streamEventNotify,
|
|
695
720
|
wakeWorkerNotify: this.#wakeWorkerNotify,
|
|
@@ -713,13 +738,13 @@ class Dispatcher {
|
|
|
713
738
|
// - COPY: dst scheme writableBy applies.
|
|
714
739
|
// - MOVE: both src (delete) and dst (write) schemes' writableBy apply.
|
|
715
740
|
#checkWritable(statement, origin, workspaceId) {
|
|
716
|
-
if (!MUTATING_OPS.has(statement.op))
|
|
741
|
+
if (!isExecution(statement) && !MUTATING_OPS.has(statement.op))
|
|
717
742
|
return null;
|
|
718
743
|
if (TurnDisposition.is(statement) || statement.op === "SEND" && statement.target === null)
|
|
719
744
|
return null;
|
|
720
|
-
//
|
|
745
|
+
// An execution's operation authority always belongs to the exec scheme;
|
|
721
746
|
// runtime-specific resource authority is gated separately below.
|
|
722
|
-
if (statement
|
|
747
|
+
if (isExecution(statement)) {
|
|
723
748
|
return this.#denyIfDisallowed("exec", origin, workspaceId);
|
|
724
749
|
}
|
|
725
750
|
// {§stream-control}, {§exec-input}: process control is not a write to
|
|
@@ -759,7 +784,7 @@ class Dispatcher {
|
|
|
759
784
|
return _a.#failure("send-target-not-a-recipient", 400, "The addressed scheme is not a SEND recipient.", {}, {
|
|
760
785
|
target: statement.target?.raw ?? String(target),
|
|
761
786
|
stage: "dispatch",
|
|
762
|
-
recovery: "A targetless SEND answers the
|
|
787
|
+
recovery: "A targetless SEND answers the open messages; a directed SEND requires a recipient that implements SEND.",
|
|
763
788
|
retryable: false,
|
|
764
789
|
});
|
|
765
790
|
}
|
|
@@ -788,7 +813,7 @@ class Dispatcher {
|
|
|
788
813
|
// owner; a known policy denial is one factual, non-presumptuous 403.
|
|
789
814
|
async #checkCapabilities(statement, ctx) {
|
|
790
815
|
await LoopPolicyReader.read(this.#db, ctx.loopId);
|
|
791
|
-
const denied = await this.#capabilities.denial(statement, ctx.workspaceId, ctx.writer, async (target) => (await ResourceBindings.resolve(target, ctx))?.manifest);
|
|
816
|
+
const denied = await this.#capabilities.denial(statement, ctx.workspaceId, ctx.writer, async (target) => (await ResourceBindings.resolve(target, ctx))?.manifest, ctx.loopId);
|
|
792
817
|
if (denied === null)
|
|
793
818
|
return null;
|
|
794
819
|
const { descriptor, scope } = denied;
|
|
@@ -801,6 +826,10 @@ class Dispatcher {
|
|
|
801
826
|
return _a.#failure("capability-denied", 403, `Capability '${route}' is denied by ${scope} policy.`, {}, {
|
|
802
827
|
...descriptor,
|
|
803
828
|
policyScope: scope,
|
|
829
|
+
// {§loop-attendance} — the innermost ring subtracts for a reason the model can act
|
|
830
|
+
// on, so it says it. Every other scope is the operator's configuration and speaks
|
|
831
|
+
// for itself.
|
|
832
|
+
...(scope === "loop" ? { recovery: CapabilityPolicies.UNATTENDED_RECOVERY } : {}),
|
|
804
833
|
retryable: false,
|
|
805
834
|
});
|
|
806
835
|
}
|
|
@@ -918,20 +947,22 @@ class Dispatcher {
|
|
|
918
947
|
modelCallId,
|
|
919
948
|
});
|
|
920
949
|
context.onDispatch?.(logEntryId);
|
|
921
|
-
await context
|
|
950
|
+
await this.#notifySettled(context, logEntryId);
|
|
922
951
|
return result;
|
|
923
952
|
}
|
|
924
|
-
// {§
|
|
925
|
-
//
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
953
|
+
// {§loop-answer} a prose answer's row names where the answer lives, ops://<worker>/<loop>, and
|
|
954
|
+
// renders under its own leaf ({§log-coordinate-hierarchy}) rather than as a SEND.
|
|
955
|
+
async #answered(result, workerId, loopId) {
|
|
956
|
+
const loop = await this.#db.engine_loop_sequence.get({ loop_id: loopId });
|
|
957
|
+
if (loop === undefined)
|
|
958
|
+
throw new Error(`prose answer has no loop sequence for loop ${loopId}`);
|
|
959
|
+
const resource = renderAddress({ scheme: "ops", authority: await WorkerName.forId(this.#db, workerId), pathname: `/${loop.sequence}` });
|
|
960
|
+
return { ...result, resource, attrs: { ...(result.attrs ?? {}), answer: "prose" } };
|
|
961
|
+
}
|
|
962
|
+
// {§send-response-receipt} {§send-looks-like-operation}
|
|
932
963
|
async #respond(statement, schemeCtx, origin, workerId, loopId) {
|
|
933
964
|
if (origin === "model") {
|
|
934
|
-
const heading = this.#operationHeading(statement.body?.raw ?? "", schemeCtx);
|
|
965
|
+
const heading = this.#operationHeading(typeof statement.body === "string" ? statement.body : statement.body?.raw ?? "", schemeCtx);
|
|
935
966
|
if (heading !== null) {
|
|
936
967
|
return _a.#failure("send-looks-like-operation", 400, `The response begins with the operation heading \`${heading}\`; nothing ran and nothing was delivered.`, {}, {
|
|
937
968
|
heading,
|
|
@@ -941,7 +972,24 @@ class Dispatcher {
|
|
|
941
972
|
});
|
|
942
973
|
}
|
|
943
974
|
}
|
|
944
|
-
|
|
975
|
+
const captured = await MessageAttachments.capture(statement.metadata, schemeCtx.resources, "message:reply");
|
|
976
|
+
if ("failure" in captured)
|
|
977
|
+
return captured.failure;
|
|
978
|
+
const target = statement.target;
|
|
979
|
+
let answers;
|
|
980
|
+
if (target === null) {
|
|
981
|
+
answers = await this.#openMessages(loopId);
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
const message = await this.#db.message_source_by_address.get({
|
|
985
|
+
workspace_id: schemeCtx.workspaceId, path: target.raw,
|
|
986
|
+
});
|
|
987
|
+
if (message === undefined)
|
|
988
|
+
return _a.#failure("message-not-found", 404, `No accepted message exists at ${target.raw}.`, {}, { retryable: false });
|
|
989
|
+
answers = [message.path];
|
|
990
|
+
}
|
|
991
|
+
return { status: 200, answers,
|
|
992
|
+
...(captured.attachments.length === 0 ? {} : { attachments: MessageAttachments.receipts(captured.attachments) }) };
|
|
945
993
|
}
|
|
946
994
|
// The first non-blank line, when it parses alone as one clean heading naming an operation
|
|
947
995
|
// this worker could perform: a Plurnk operation, or a registered executor or MCP service.
|
|
@@ -959,45 +1007,27 @@ class Dispatcher {
|
|
|
959
1007
|
// on a reply's first line a multi-word literal is prose, not a mis-fenced operation.
|
|
960
1008
|
if ("matcher" in statement && statement.matcher?.dialect === "glob" && /\s/u.test(statement.matcher.raw))
|
|
961
1009
|
return null;
|
|
962
|
-
if (statement
|
|
1010
|
+
if (!isExecution(statement))
|
|
963
1011
|
return line;
|
|
964
|
-
|
|
965
|
-
if (executor === null || schemeCtx.executors?.entry(executor, schemeCtx.workspaceId) === undefined)
|
|
1012
|
+
if (schemeCtx.executors?.entry(statement.runtime, schemeCtx.workspaceId) === undefined)
|
|
966
1013
|
return null;
|
|
967
1014
|
return line;
|
|
968
1015
|
}
|
|
969
|
-
//
|
|
970
|
-
async #
|
|
971
|
-
const
|
|
972
|
-
|
|
973
|
-
throw new Error(`worker ${workerId} does not exist`);
|
|
974
|
-
const loopSeq = (await this.#db.engine_loop_sequence.get({ loop_id: loopId }))?.sequence ?? loopId;
|
|
975
|
-
const prefix = promptLoopPrefix(loopSeq);
|
|
976
|
-
const rows = await this.#db.drain_get_all_prompt_bodies_for_loop.all({
|
|
977
|
-
worker_id: workerId,
|
|
978
|
-
pattern: `${prefix}%`,
|
|
979
|
-
prefix_len: prefix.length,
|
|
980
|
-
});
|
|
981
|
-
return rows.map((row) => `prompt://${worker.name}${row.pathname}`);
|
|
1016
|
+
// {§send-response-receipt}: published unanswered source addresses, oldest first.
|
|
1017
|
+
async #openMessages(loopId) {
|
|
1018
|
+
const rows = await this.#db.engine_open_messages.all({ loop_id: loopId });
|
|
1019
|
+
return rows.map((row) => row.path);
|
|
982
1020
|
}
|
|
983
|
-
async
|
|
984
|
-
|
|
985
|
-
return false;
|
|
986
|
-
const worker = await this.#db.worker_get.get({ id: workerId });
|
|
987
|
-
if (worker === undefined || target.hostname !== worker.name)
|
|
988
|
-
return false;
|
|
989
|
-
const loopSeq = (await this.#db.engine_loop_sequence.get({ loop_id: loopId }))?.sequence ?? loopId;
|
|
990
|
-
return target.pathname.startsWith(promptLoopPrefix(loopSeq));
|
|
1021
|
+
async settleProgram(ctx, wait) {
|
|
1022
|
+
return this.#disposition.settle(ctx, wait);
|
|
991
1023
|
}
|
|
992
|
-
// {§send-premature-terminate}
|
|
993
|
-
|
|
994
|
-
// requires a new packet, independently of its result or log visibility.
|
|
995
|
-
async #pendingSet(workerId, turnId) {
|
|
1024
|
+
// {§send-premature-terminate}: judge observation boundaries after the whole program settles.
|
|
1025
|
+
async #pendingSet(workerId, turnId, loopId) {
|
|
996
1026
|
const pending = [];
|
|
997
|
-
// {§worker-obligations} —
|
|
998
|
-
const held = await this.#db.
|
|
1027
|
+
// {§worker-obligations} — all held work shares one durable projection.
|
|
1028
|
+
const held = await this.#db.loop_live_obligations.get({ loop_id: loopId });
|
|
999
1029
|
if (held === undefined)
|
|
1000
|
-
throw new Error(`
|
|
1030
|
+
throw new Error(`loop ${loopId} does not exist`);
|
|
1001
1031
|
if (held.streams === 1)
|
|
1002
1032
|
pending.push("streams");
|
|
1003
1033
|
if (held.workers === 1)
|
|
@@ -1010,7 +1040,7 @@ class Dispatcher {
|
|
|
1010
1040
|
receipts.push("stream completion");
|
|
1011
1041
|
if (receipts.length > 0)
|
|
1012
1042
|
pending.push("receipts");
|
|
1013
|
-
//
|
|
1043
|
+
// A failed stream result is still owed to the model before ordinary completion.
|
|
1014
1044
|
if (boundaries.streamTerminations.some(({ closeStatus }) => closeStatus >= 400))
|
|
1015
1045
|
pending.push("failed-stream-results");
|
|
1016
1046
|
if (boundaries.childTerminations)
|
|
@@ -1040,18 +1070,9 @@ class Dispatcher {
|
|
|
1040
1070
|
const failedRows = await this.#db.engine_turn_failures.all({ turn_id: turnId });
|
|
1041
1071
|
return failedRows.length;
|
|
1042
1072
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
stage: "completion",
|
|
1047
|
-
retryable: true,
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
// A live obligation to wait on: a spawned child or an open stream (not retrievals, which land
|
|
1051
|
-
// next turn regardless). The wait-side twin of #pendingSet's stream+child legs ({§wait-obligation-matrix}).
|
|
1052
|
-
async hasLiveWork(workerId) {
|
|
1053
|
-
// {§worker-obligations} — one durable row answers both legs.
|
|
1054
|
-
const held = await this.#db.worker_live_obligations.get({ worker_id: workerId });
|
|
1073
|
+
// {§wait-obligation-matrix}: retrievals land next turn; only held work permits parking.
|
|
1074
|
+
async hasLiveWork(loopId) {
|
|
1075
|
+
const held = await this.#db.loop_live_obligations.get({ loop_id: loopId });
|
|
1055
1076
|
return held !== undefined && (held.streams === 1 || held.workers === 1);
|
|
1056
1077
|
}
|
|
1057
1078
|
async #runLogCuration(statement, ctx, admittedMaxId) {
|
|
@@ -1104,7 +1125,7 @@ class Dispatcher {
|
|
|
1104
1125
|
const routedScheme = schemeNameOf(path);
|
|
1105
1126
|
const manifest = routedScheme === null
|
|
1106
1127
|
? undefined
|
|
1107
|
-
: this.#schemes.
|
|
1128
|
+
: this.#schemes.manifestAt(routedScheme, path, workspaceId);
|
|
1108
1129
|
const foldNs = scheme !== null
|
|
1109
1130
|
&& manifest !== undefined
|
|
1110
1131
|
&& (manifest.authority ?? "namespace") === "namespace";
|