@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/schemes/Exec.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
var _a;
|
|
2
|
+
import { parsePath } from "@plurnk/plurnk-parser";
|
|
3
|
+
import { PathSyntax } from "@plurnk/plurnk-contracts";
|
|
2
4
|
import { WebFetcher, WebMaterializationError, } from "@plurnk/plurnk-schemes-http";
|
|
5
|
+
import { isWorkerBound } from "../core/ExecutorRegistry.js";
|
|
3
6
|
import EffectPolicy from "./EffectPolicy.js";
|
|
4
7
|
import EntryCrud from "./_entry-crud.js";
|
|
5
8
|
import EntryFind from "./_entry-find.js";
|
|
9
|
+
import { MetadataOptions } from "@plurnk/plurnk-schemes";
|
|
6
10
|
import ChannelWrite from "../core/ChannelWrite.js";
|
|
7
|
-
import
|
|
11
|
+
import EnvFunctionality from "../server/EnvFunctionality.js";
|
|
8
12
|
import ExecAbort from "./exec-abort.js";
|
|
13
|
+
import { LIFETIME_SYNTAX, formatLifetime, parseExecLifetime } from "./exec-lifetime.js";
|
|
9
14
|
import { entryCoordinateOf, generatedPathname, renderAddress } from "../core/plurnk-uri.js";
|
|
10
15
|
import { writeFile, unlink, stat } from "node:fs/promises";
|
|
11
16
|
import { tmpdir } from "node:os";
|
|
@@ -17,6 +22,8 @@ import { InvalidOperationResultError, NetworkAddress, ResourceNames, } from "@pl
|
|
|
17
22
|
import DbProjectionCaps from "../core/caps/DbProjectionCaps.js";
|
|
18
23
|
import WorkerControlAddress from "../core/WorkerControlAddress.js";
|
|
19
24
|
import Turn from "../core/Turn.js";
|
|
25
|
+
import AdministrativeLoop from "../core/AdministrativeLoop.js";
|
|
26
|
+
import RuntimeWorker from "../core/RuntimeWorker.js";
|
|
20
27
|
import LoopLifecycle from "../core/LoopLifecycle.js";
|
|
21
28
|
import LogEntryProjection from "../core/LogEntryProjection.js";
|
|
22
29
|
import LogBody from "../core/LogBody.js";
|
|
@@ -50,7 +57,15 @@ const resourceSourceOf = (target) => {
|
|
|
50
57
|
return null;
|
|
51
58
|
return target.raw;
|
|
52
59
|
};
|
|
53
|
-
|
|
60
|
+
class Exec extends CoreSchemeAdapterBase {
|
|
61
|
+
// The record goes on the output the spawn produces ({§execution-output-identity}) — the log row
|
|
62
|
+
// is the model's proposal and stays immutable. An output that is not there is a defect in the
|
|
63
|
+
// provenance chain, never a spawn that quietly runs unrecorded.
|
|
64
|
+
static async #recordEnv(db, entryId, record) {
|
|
65
|
+
const { changes } = await db.execution_record_env.run({ entry_id: entryId, env: JSON.stringify(record) });
|
|
66
|
+
if (changes !== 1)
|
|
67
|
+
throw new Error(`spawn output entry ${entryId} is not there to record the environment on`);
|
|
68
|
+
}
|
|
54
69
|
// The slot contract, stated when a resource source cannot be read: the resource IS the
|
|
55
70
|
// program and the body its stdin; a targetless invocation takes a command body.
|
|
56
71
|
static sourceRecovery(source, upstream) {
|
|
@@ -105,7 +120,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
105
120
|
return true;
|
|
106
121
|
return false;
|
|
107
122
|
}
|
|
108
|
-
// {§exec-
|
|
123
|
+
// {§exec-lifetime} — a detached spawn ends with the daemon: nothing else ever aborts it, so the
|
|
109
124
|
// stop sequence reaps it (bounded housekeeping) before the streaming drain barrier.
|
|
110
125
|
abortDetached() {
|
|
111
126
|
for (const { controller, detached } of this.#activeAborts.values())
|
|
@@ -122,7 +137,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
122
137
|
.map(([subscriptionId]) => {
|
|
123
138
|
const spawn = this.#activeSpawns.get(subscriptionId);
|
|
124
139
|
if (spawn === undefined) {
|
|
125
|
-
throw new Error(`Active
|
|
140
|
+
throw new Error(`Active execution subscription ${subscriptionId} has no spawn settlement promise.`);
|
|
126
141
|
}
|
|
127
142
|
return spawn;
|
|
128
143
|
});
|
|
@@ -145,7 +160,11 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
145
160
|
}
|
|
146
161
|
// {§stream-control} — active KILL routes through the live controller;
|
|
147
162
|
// terminal and missing outcomes resolve from the durable subscription.
|
|
148
|
-
async kill(
|
|
163
|
+
async kill(statement, ctx) {
|
|
164
|
+
if (statement.target?.kind !== "url")
|
|
165
|
+
throw new InvalidOperationResultError("Execution KILL requires a runtime URL.");
|
|
166
|
+
const { scheme } = statement.target;
|
|
167
|
+
const { pathname } = entryCoordinateOf(statement.target, "namespace");
|
|
149
168
|
const core = this.coreContext(ctx);
|
|
150
169
|
for (const entry of this.#activeAborts.values()) {
|
|
151
170
|
if (entry.workspaceId === core.workspaceId && entry.pathname === pathname && (scheme === "exec" || entry.runtime === scheme)) {
|
|
@@ -163,19 +182,11 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
163
182
|
if (terminal === null) {
|
|
164
183
|
return Results.failure("scheme:exec", "stream-not-found", 404, `No stream exists at ${target}.`, {}, { target });
|
|
165
184
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
retryable: false,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
return Results.failure("scheme:exec", "stream-already-terminal", 409, `${target} already concluded with status ${terminal}.`, {}, {
|
|
173
|
-
target,
|
|
174
|
-
terminalStatus: terminal,
|
|
175
|
-
retryable: false,
|
|
176
|
-
});
|
|
185
|
+
// {§stream-control} — the process is already not running, which is what KILL asks for; the
|
|
186
|
+
// receipt says how it ended instead of refusing a cleanup that raced the exit (#757).
|
|
187
|
+
return { status: 200, terminalStatus: terminal };
|
|
177
188
|
}
|
|
178
|
-
//
|
|
189
|
+
// Execution handler — the model-facing entry point per plurnk.md.
|
|
179
190
|
// Named executable fences lower to runtime-owned invocation buckets.
|
|
180
191
|
//
|
|
181
192
|
// Proposes (status=202) with attrs={runtime, cwd, body, pathname}.
|
|
@@ -192,7 +203,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
192
203
|
const runtime = route.runtime;
|
|
193
204
|
// {§exec-registry-resolves} — a non-empty tag selects exactly one registered executable
|
|
194
205
|
// tool. Unknown tags are not reinterpreted as shell command words: that would make the
|
|
195
|
-
// executed command differ from the authored body.
|
|
206
|
+
// executed command differ from the authored body.
|
|
196
207
|
const resolved = core.executors.entry(runtime, core.workspaceId);
|
|
197
208
|
if (resolved === undefined) {
|
|
198
209
|
return Results.failure("scheme:exec", "executor-not-registered", 400, `No executor or MCP service named \`${runtime}\` is registered for this worker.`, {}, {
|
|
@@ -219,7 +230,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
219
230
|
runtime,
|
|
220
231
|
availableTargetCount: availableTargets.length,
|
|
221
232
|
...(availableTargets.length === 0 ? {} : {
|
|
222
|
-
recovery: `Select a target
|
|
233
|
+
recovery: `Select a target from worker://${ToolResources.documentPath(runtime, resolved.resourcesPath)}.`,
|
|
223
234
|
}),
|
|
224
235
|
retryable: false,
|
|
225
236
|
});
|
|
@@ -248,7 +259,8 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
248
259
|
const projectRoot = workspaceRow?.project_root ?? null;
|
|
249
260
|
// The working directory is always concrete — the project root, or the shell's own
|
|
250
261
|
// cwd when the workspace has none — so every receipt can name it ({§exec-target-routing}).
|
|
251
|
-
|
|
262
|
+
const defaultCwd = projectRoot ?? process.cwd();
|
|
263
|
+
let cwd = defaultCwd;
|
|
252
264
|
let target = null;
|
|
253
265
|
let resourceSource = null;
|
|
254
266
|
const targetDecl = invocation.target;
|
|
@@ -264,7 +276,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
264
276
|
else if (targetDecl.kind === "resource" || targetDecl.kind === "script") {
|
|
265
277
|
resourceSource = resourceSourceOf(execTarget);
|
|
266
278
|
if (resourceSource === null) {
|
|
267
|
-
throw new Error(`
|
|
279
|
+
throw new Error(`'${runtime}' resource target could not be classified`);
|
|
268
280
|
}
|
|
269
281
|
}
|
|
270
282
|
else {
|
|
@@ -272,6 +284,39 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
272
284
|
}
|
|
273
285
|
}
|
|
274
286
|
}
|
|
287
|
+
// {§exec-target-near-miss} — a target in this executor's own scheme whose path can never be a
|
|
288
|
+
// stream (`sh:///daemon-env`; streams are eight hex digits) is the writer's name for the run,
|
|
289
|
+
// not a program: with a body present, the body runs as if targetless. Never taught.
|
|
290
|
+
if (resourceSource !== null && hasBody && execTarget?.kind === "url" && execTarget.scheme === runtime
|
|
291
|
+
&& !/^\/[0-9a-f]{8}(?:[/#]|$)/u.test(execTarget.pathname ?? "")) {
|
|
292
|
+
resourceSource = null;
|
|
293
|
+
}
|
|
294
|
+
// {§exec-lifetime} — the scope slot is text coordinates, and an execution has none: what a
|
|
295
|
+
// numeric scope used to mean is the metadata's one field.
|
|
296
|
+
if (statement.lineMarker !== null) {
|
|
297
|
+
return refuse("scope-unsupported", "An execution takes no scope.", `Remove the scope; how long the run may live is metadata: [{"lifetime": "30m"}], or ${LIFETIME_SYNTAX}.`);
|
|
298
|
+
}
|
|
299
|
+
// {§env-option} — the fence's own environment is the service's key: refused here by name,
|
|
300
|
+
// so the model learns why, never dropped at the spawn. The executor never sees it.
|
|
301
|
+
try {
|
|
302
|
+
EnvFunctionality.modifier(statement.metadata);
|
|
303
|
+
}
|
|
304
|
+
catch (cause) {
|
|
305
|
+
if (!(cause instanceof OperationFailureError))
|
|
306
|
+
throw cause;
|
|
307
|
+
return cause.result;
|
|
308
|
+
}
|
|
309
|
+
// {§exec-lifetime} — the service's other reserved key, read before the executor's options so
|
|
310
|
+
// an unreadable lifetime is refused by name rather than spawning under a wrong bound. A block
|
|
311
|
+
// that is not the option-array shape carries no lifetime for the service to read: it is the
|
|
312
|
+
// invoked executor's to accept or refuse ({§executor-metadata}), exactly as `env` is.
|
|
313
|
+
const read = MetadataOptions.parse(statement.metadata, "scheme:exec", { runtime });
|
|
314
|
+
const lifetime = parseExecLifetime("failure" in read ? undefined : read.lifetime);
|
|
315
|
+
if ("invalid" in lifetime) {
|
|
316
|
+
return Results.failure("scheme:exec", "lifetime-invalid", 400, lifetime.invalid, {}, {
|
|
317
|
+
runtime, recovery: `State one lifetime: ${LIFETIME_SYNTAX}.`, retryable: false,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
275
320
|
// {§executor-metadata} Options belong to the invoked executor for every source kind.
|
|
276
321
|
const executor = resolved.executor;
|
|
277
322
|
if (executor.prepare !== undefined) {
|
|
@@ -297,11 +342,17 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
297
342
|
}
|
|
298
343
|
catch (cause) {
|
|
299
344
|
if (cause?.code !== "ENOENT") {
|
|
300
|
-
console.error(`
|
|
345
|
+
console.error(`Execution target classification failed for '${inspected}':`, cause);
|
|
301
346
|
return Results.failure("scheme:exec", "target-classification-failed", 500, `${runtime} target '${target}' could not be inspected: ${ErrorDetail.preview(cause)}`, {}, { target, stage: "target-classification" });
|
|
302
347
|
}
|
|
303
348
|
}
|
|
304
|
-
|
|
349
|
+
// {§exec-target-near-miss} — a directory is never a program: with a body and no explicit
|
|
350
|
+
// cwd, it is where the body runs. Never taught.
|
|
351
|
+
if (kind === "directory" && hasBody && cwd === defaultCwd) {
|
|
352
|
+
cwd = inspected;
|
|
353
|
+
target = null;
|
|
354
|
+
}
|
|
355
|
+
else if (kind === "directory") {
|
|
305
356
|
return refuse("target-not-a-program", `${runtime} target '${target}' is a directory, not a program.`, "Run in a directory with `[{\"cwd\": \"<directory>\"}]` and put the command in the body.", { target });
|
|
306
357
|
}
|
|
307
358
|
if (kind === "missing") {
|
|
@@ -328,22 +379,12 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
328
379
|
// cwd is the workspace project_root unless target routing selected a
|
|
329
380
|
// directory override. {§exec-target-routing}, {§executor-sinks}
|
|
330
381
|
// The log writer claims the workspace output address before proposal application.
|
|
331
|
-
//
|
|
332
|
-
//
|
|
333
|
-
// -1 / absent → unbounded (loop-life bounded); 0 → turn-scoped (reaped at the next pre-turn,
|
|
334
|
-
// never surviving into the subsequent turn).
|
|
335
|
-
const marks = statement.lineMarker?.marks;
|
|
336
|
-
const timeoutSec = typeof marks?.[0] === "number" && marks[0] > 0 ? Math.floor(marks[0]) * 60 : undefined;
|
|
337
|
-
const turnScoped = typeof marks?.[0] === "number" && marks[0] === 0;
|
|
338
|
-
const detached = typeof marks?.[0] === "number" && marks[0] === -1;
|
|
339
|
-
const pollSec = typeof marks?.[1] === "number" && marks[1] >= 0 ? Math.floor(marks[1]) * 60 : undefined;
|
|
382
|
+
// {§exec-lifetime} — how long the spawn may live is the metadata's one field; the scope slot
|
|
383
|
+
// is text coordinates, which an execution has none of.
|
|
340
384
|
const attrs = {
|
|
341
385
|
runtime, cwd, body, target, pathname: "", effect,
|
|
342
386
|
...(resourceSource !== null ? { resourceSource } : {}),
|
|
343
|
-
...
|
|
344
|
-
...(turnScoped ? { turnScoped: true } : {}),
|
|
345
|
-
...(detached ? { detached: true } : {}),
|
|
346
|
-
...(pollSec !== undefined ? { pollSec } : {}),
|
|
387
|
+
...lifetime,
|
|
347
388
|
};
|
|
348
389
|
const previewInput = body !== "" ? body : execTarget?.raw ?? "";
|
|
349
390
|
const preview = runtime !== "" ? `[${runtime}] ${previewInput}` : `$ ${previewInput}`;
|
|
@@ -422,13 +463,13 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
422
463
|
let target = (typeof attrs.target === "string" && attrs.target.length > 0) ? attrs.target : null;
|
|
423
464
|
const effect = attrs.effect;
|
|
424
465
|
if (typeof pathname !== "string" || pathname.length === 0) {
|
|
425
|
-
throw new InvalidOperationResultError("The accepted
|
|
466
|
+
throw new InvalidOperationResultError("The accepted execution proposal is missing its stream pathname.");
|
|
426
467
|
}
|
|
427
468
|
if (!EffectPolicy.isEffect(effect)) {
|
|
428
|
-
throw new InvalidOperationResultError("The accepted
|
|
469
|
+
throw new InvalidOperationResultError("The accepted execution proposal is missing its canonical effect fact.");
|
|
429
470
|
}
|
|
430
471
|
const invocation = {
|
|
431
|
-
|
|
472
|
+
runtime: runtime, aside: null, metadata: null,
|
|
432
473
|
target: attrs.resourceSource ? parsePath(attrs.resourceSource) : target === null ? null : parsePath(target),
|
|
433
474
|
lineMarker: null, body, position: { line: 1, column: 1 },
|
|
434
475
|
};
|
|
@@ -438,7 +479,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
438
479
|
if (attrs.resourceSource !== undefined) {
|
|
439
480
|
const sourceTarget = parsePath(attrs.resourceSource);
|
|
440
481
|
if (sourceTarget?.kind !== "url" || sourceTarget.scheme === null || sourceTarget.scheme === "file") {
|
|
441
|
-
throw new InvalidOperationResultError("The accepted
|
|
482
|
+
throw new InvalidOperationResultError("The accepted execution proposal has an invalid scheme source address.");
|
|
442
483
|
}
|
|
443
484
|
const source = await this.readExecSource({
|
|
444
485
|
op: "READ",
|
|
@@ -452,12 +493,12 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
452
493
|
}, core);
|
|
453
494
|
const read = source.result;
|
|
454
495
|
if (read.status >= 400) {
|
|
455
|
-
// {§exec-target-routing} — the failure stays the owning READ's (#163); the
|
|
496
|
+
// {§exec-target-routing} — the failure stays the owning READ's (#163); the execution
|
|
456
497
|
// contract rides its recovery, because a stream address in the target slot is
|
|
457
498
|
// almost always a command that belonged beneath a targetless heading (#425 F4).
|
|
458
499
|
const problem = read.problem === undefined ? undefined : {
|
|
459
500
|
...read.problem,
|
|
460
|
-
recovery:
|
|
501
|
+
recovery: _a.sourceRecovery(attrs.resourceSource, read.problem.recovery),
|
|
461
502
|
};
|
|
462
503
|
return Results.assert({ ...read, outcome: "scheme_source_read_failed", ...(problem === undefined ? {} : { problem }) });
|
|
463
504
|
}
|
|
@@ -479,17 +520,17 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
479
520
|
}
|
|
480
521
|
}
|
|
481
522
|
if (body.length === 0 && target === null) {
|
|
482
|
-
throw new InvalidOperationResultError("The accepted
|
|
523
|
+
throw new InvalidOperationResultError("The accepted execution proposal has neither a body nor a realized target.");
|
|
483
524
|
}
|
|
484
525
|
// Resolve the runtime's executor from the boot registry, then seed
|
|
485
526
|
// channels from its declared topology ({§executor-channels}). Each executor declares its own
|
|
486
527
|
// shape (subprocess → stdout/stderr; search → results; etc.).
|
|
487
528
|
if (core.executors === undefined) {
|
|
488
|
-
throw new InvalidOperationResultError("An accepted
|
|
529
|
+
throw new InvalidOperationResultError("An accepted execution proposal has no executor registry.");
|
|
489
530
|
}
|
|
490
531
|
const resolved = core.executors.entry(runtime, core.workspaceId);
|
|
491
532
|
if (resolved === undefined) {
|
|
492
|
-
throw new InvalidOperationResultError(`The '${runtime}' executor disappeared after its
|
|
533
|
+
throw new InvalidOperationResultError(`The '${runtime}' executor disappeared after its proposal.`);
|
|
493
534
|
}
|
|
494
535
|
// {§executor-effect}, {§exec-hold-until-concluded}, #107: the admitted
|
|
495
536
|
// effect fact rides the hold predicate unchanged through application.
|
|
@@ -519,19 +560,19 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
519
560
|
const subscriptionId = await ChannelWrite.openSubscription(core.db, {
|
|
520
561
|
workerId: core.workerId, entryId, scheme: runtime,
|
|
521
562
|
handle: runtime !== "" ? `${runtime}: ${body !== "" ? body : target ?? ""}` : body,
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
detached: attrs.detached === true, // {§worker-obligations} — `<-1>` is nobody's obligation
|
|
563
|
+
turnScoped: attrs.turnScoped === true, // {§exec-lifetime} — "turn" is reaped at the next pre-turn
|
|
564
|
+
detached: attrs.detached === true, // {§worker-obligations} — "detached" is nobody's obligation
|
|
525
565
|
publishedChannel: resolved.executor.publishedChannel,
|
|
526
566
|
source: attrs.coordinate === undefined ? undefined
|
|
527
567
|
: `log:///${attrs.coordinate.loop_seq}/${attrs.coordinate.turn_seq}/${attrs.coordinate.sequence}/${runtime}`,
|
|
528
568
|
});
|
|
529
569
|
const controller = new AbortController();
|
|
530
570
|
let unlink = () => { };
|
|
531
|
-
// {§exec-
|
|
532
|
-
// the worker's total reap, and daemon shutdown end it.
|
|
571
|
+
// {§exec-lifetime} — a detached spawn outlives the loop: it never binds to the loop's teardown;
|
|
572
|
+
// only KILL, the worker's total reap, and daemon shutdown end it.
|
|
533
573
|
if (core.signal !== undefined && attrs.detached !== true) {
|
|
534
574
|
const parent = core.signal;
|
|
575
|
+
// {§worker-lifecycle-exec-epoch-bound}
|
|
535
576
|
// The spawn's kill binds to its loop's cancellation epoch (ctx.signal —
|
|
536
577
|
// captured here, stable for the loop). The parent only aborts on FORCEFUL loop
|
|
537
578
|
// teardown — a 202-graceful loop lets its spawns outlive, never firing this — so
|
|
@@ -539,7 +580,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
539
580
|
// then re-check `aborted`: a listener added to an already-aborted signal never
|
|
540
581
|
// fires, so a check-then-attach order LOSES an abort that lands in the gap (R1's
|
|
541
582
|
// TOCTOU leak). Attach-then-check closes it; controller.abort is idempotent, so a
|
|
542
|
-
// doubled fire is harmless. {§exec-
|
|
583
|
+
// doubled fire is harmless. {§exec-lifetime}
|
|
543
584
|
const onParentAbort = () => controller.abort(ExecAbort.teardownReason());
|
|
544
585
|
parent.addEventListener("abort", onParentAbort, { once: true });
|
|
545
586
|
unlink = () => parent.removeEventListener("abort", onParentAbort);
|
|
@@ -613,7 +654,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
613
654
|
const owner = owners[0];
|
|
614
655
|
// The tool's own document, where its family publishes it ({§tools-resource-materialization}).
|
|
615
656
|
const root = executors.entry(owner, core.workspaceId)?.resourcesPath ?? "/plurnk";
|
|
616
|
-
const contract = `worker://${generatedPathname(`${root}/${owner}/${ToolResources.targetSegment(program)}.
|
|
657
|
+
const contract = `worker://${generatedPathname(`${root}/${owner}/${ToolResources.targetSegment(program)}.json`)}`;
|
|
617
658
|
return {
|
|
618
659
|
...result,
|
|
619
660
|
problem: {
|
|
@@ -626,9 +667,12 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
626
667
|
};
|
|
627
668
|
}
|
|
628
669
|
async #runExecutor(opts) {
|
|
629
|
-
const {
|
|
670
|
+
const { runtime, body, cwd, target, metadata, ctx, pathname, entryId, subscriptionId, signal, controller, timeoutSec, tempPath, input, coordinate } = opts;
|
|
671
|
+
// {§functionality-model-projection} — a Core-owned manager acts for the invoking Worker. The
|
|
672
|
+
// framework's ExecArgs carries no Worker identity, so Core binds it here, at the operation.
|
|
673
|
+
const executor = isWorkerBound(opts.executor) ? opts.executor.forWorker(ctx.workerId) : opts.executor;
|
|
630
674
|
const db = ctx.db;
|
|
631
|
-
//
|
|
675
|
+
// an execution's `<T>` — kill the spawn after T seconds. unref'd so a pending timer never
|
|
632
676
|
// holds the process open; cleared in finally so a spawn that finishes first leaves no timer.
|
|
633
677
|
let timedOut = false;
|
|
634
678
|
const timeoutTimer = timeoutSec !== null
|
|
@@ -744,13 +788,10 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
744
788
|
}
|
|
745
789
|
throw error;
|
|
746
790
|
}
|
|
747
|
-
if (web === null)
|
|
748
|
-
throw new Error(`entry(): '${path.slice(0, 80)}' has no readable projection`);
|
|
749
|
-
if (web.body === undefined)
|
|
750
|
-
throw new Error(web.bodyOutcome.failure?.detail ?? `entry(): '${path.slice(0, 80)}' produced no readable body`);
|
|
751
791
|
channels = WebFetcher.materializedChannels(web, content === null && fetchAddress !== null ? { url: fetchAddress.url, method: "GET" } : undefined);
|
|
752
|
-
decisive = web.body.
|
|
753
|
-
|
|
792
|
+
decisive = web.readable?.content ?? (web.body.bytes === undefined
|
|
793
|
+
? web.body.content : `${web.body.mimetype}; ${web.body.bytes.byteLength} bytes`);
|
|
794
|
+
source = web.body.bytes === undefined ? web.body.content : decisive;
|
|
754
795
|
}
|
|
755
796
|
const causalSource = await resolveCallerSource();
|
|
756
797
|
const written = Results.assert(await EntryCrud.writeEntry(coordinate, { channels }, ctx, scheme, {
|
|
@@ -758,20 +799,15 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
758
799
|
output: requestedPath === null,
|
|
759
800
|
}));
|
|
760
801
|
if (narration === null) {
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
if (worker === undefined)
|
|
764
|
-
throw new Error("entry(): plurnk worker resolution returned no row");
|
|
765
|
-
const loop = await db.envelope_insert_client_loop.get({ worker_id: worker.id });
|
|
766
|
-
if (loop === undefined)
|
|
767
|
-
throw new Error("entry(): loop insert returned no row");
|
|
802
|
+
const workerId = await RuntimeWorker.ensure(db, ctx.workspaceId);
|
|
803
|
+
const loop = await AdministrativeLoop.open(db, workerId);
|
|
768
804
|
const turn = await Turn.open(db, {
|
|
769
805
|
loopId: loop.id,
|
|
770
806
|
producer: "_plurnk",
|
|
771
807
|
kind: "operation",
|
|
772
808
|
});
|
|
773
809
|
narration = {
|
|
774
|
-
workerId
|
|
810
|
+
workerId,
|
|
775
811
|
loopId: loop.id,
|
|
776
812
|
loopSeq: loop.sequence,
|
|
777
813
|
turnId: turn.id,
|
|
@@ -839,7 +875,13 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
839
875
|
const executionFailures = [];
|
|
840
876
|
const cancelled = (exitCode) => Results.failure("scheme:exec", "execution-cancelled", 499, `Execution of '${runtime}' was cancelled by the service.`, exitCode === undefined ? {} : { exitCode }, { runtime, stage: "execution", retryable: false });
|
|
841
877
|
try {
|
|
842
|
-
|
|
878
|
+
// A cancellation may land while the environment resolves; a listener added to an
|
|
879
|
+
// already-aborted signal never fires, so the run never receives a dead signal.
|
|
880
|
+
const composed = signal.aborted ? null
|
|
881
|
+
: await EnvFunctionality.resolve(db, ctx.workspaceId, ctx.workerId, EnvFunctionality.modifier(metadata));
|
|
882
|
+
if (composed !== null)
|
|
883
|
+
await _a.#recordEnv(db, entryId, composed.record);
|
|
884
|
+
if (composed === null || signal.aborted) {
|
|
843
885
|
result = cancelled();
|
|
844
886
|
}
|
|
845
887
|
else
|
|
@@ -848,13 +890,15 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
848
890
|
registerInput: (receiver) => input.register(receiver),
|
|
849
891
|
runtime, body, cwd, target, metadata, signal,
|
|
850
892
|
entry: entrySink,
|
|
851
|
-
|
|
893
|
+
// {§executor-interaction-sink} — the executor's signal narrows the execution's, never replaces it.
|
|
894
|
+
interact: (request, interactionSignal) => {
|
|
852
895
|
if (ctx.requestInteraction === undefined) {
|
|
853
|
-
throw new Error("
|
|
896
|
+
throw new Error("The execution's client interaction capability is unavailable.");
|
|
854
897
|
}
|
|
855
|
-
return ctx.requestInteraction(request, signal
|
|
898
|
+
return ctx.requestInteraction(request, interactionSignal === undefined ? signal
|
|
899
|
+
: AbortSignal.any([signal, interactionSignal]));
|
|
856
900
|
},
|
|
857
|
-
env:
|
|
901
|
+
env: composed.env, // SPEC {§exec} {§exec-env-scoped}
|
|
858
902
|
write: (channel, chunk, mimetype) => enqueue(() => ChannelWrite.appendToChannel(db, {
|
|
859
903
|
producerWorkerId: ctx.workerId,
|
|
860
904
|
entryId, channel, chunk, mimetype, notify: ctx.streamEventNotify, coordinate,
|
|
@@ -900,9 +944,10 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
900
944
|
// A timeout aborts the spawn → the executor reports 499; replace the
|
|
901
945
|
// complete result so status and Problem remain one valid truth.
|
|
902
946
|
if (timedOut) {
|
|
903
|
-
|
|
947
|
+
const lifetime = formatLifetime(timeoutSec ?? 0);
|
|
948
|
+
result = Results.failure("scheme:exec", "execution-timeout", 504, `Execution of '${runtime}' outlived its ${lifetime} lifetime.`, exitCode === null ? {} : { exitCode }, {
|
|
904
949
|
runtime,
|
|
905
|
-
|
|
950
|
+
lifetime,
|
|
906
951
|
stage: "execution",
|
|
907
952
|
retryable: false,
|
|
908
953
|
});
|
|
@@ -968,7 +1013,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
968
1013
|
// executor result, but an exceptional failure remains observable.
|
|
969
1014
|
if (tempPath !== null) {
|
|
970
1015
|
await unlink(tempPath).catch((cause) => {
|
|
971
|
-
console.error(`
|
|
1016
|
+
console.error(`Execution source temporary cleanup failed for '${tempPath}':`, cause);
|
|
972
1017
|
});
|
|
973
1018
|
}
|
|
974
1019
|
this.#activeAborts.get(subscriptionId)?.unlink();
|
|
@@ -989,32 +1034,34 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
989
1034
|
if (finalizationErrors.length === 1)
|
|
990
1035
|
throw finalizationErrors[0];
|
|
991
1036
|
if (finalizationErrors.length > 1) {
|
|
992
|
-
throw new AggregateError(finalizationErrors, `
|
|
1037
|
+
throw new AggregateError(finalizationErrors, `Execution narration ${completedNarration?.turnId ?? "unknown"} failed to settle`);
|
|
993
1038
|
}
|
|
994
1039
|
}
|
|
995
1040
|
return result;
|
|
996
1041
|
}
|
|
997
1042
|
async find(statement, ctx) {
|
|
998
1043
|
const core = this.coreContext(ctx);
|
|
999
|
-
return EntryFind.findWorkspaceEntries(statement, core,
|
|
1044
|
+
return EntryFind.findWorkspaceEntries(statement, core, _a.manifest, {});
|
|
1000
1045
|
}
|
|
1001
1046
|
async readEntry(pathname, ctx) {
|
|
1002
1047
|
const core = this.coreContext(ctx);
|
|
1003
1048
|
return "entries" in ctx
|
|
1004
1049
|
? ctx.entries.read(pathname)
|
|
1005
|
-
: EntryCrud.readEntry({ authority: "", pathname }, core,
|
|
1050
|
+
: EntryCrud.readEntry({ authority: "", pathname }, core, _a.manifest.name);
|
|
1006
1051
|
}
|
|
1007
1052
|
async writeEntry(pathname, entry, ctx) {
|
|
1008
1053
|
const core = this.coreContext(ctx);
|
|
1009
1054
|
return "entries" in ctx
|
|
1010
1055
|
? ctx.entries.write(pathname, entry)
|
|
1011
|
-
: EntryCrud.writeEntry({ authority: "", pathname }, entry, core,
|
|
1056
|
+
: EntryCrud.writeEntry({ authority: "", pathname }, entry, core, _a.manifest.name);
|
|
1012
1057
|
}
|
|
1013
1058
|
async deleteEntry(pathname, ctx) {
|
|
1014
1059
|
const core = this.coreContext(ctx);
|
|
1015
1060
|
return "entries" in ctx
|
|
1016
1061
|
? ctx.entries.delete(pathname)
|
|
1017
|
-
: EntryCrud.deleteEntry({ authority: "", pathname }, core,
|
|
1062
|
+
: EntryCrud.deleteEntry({ authority: "", pathname }, core, _a.manifest.name);
|
|
1018
1063
|
}
|
|
1019
1064
|
}
|
|
1065
|
+
_a = Exec;
|
|
1066
|
+
export default Exec;
|
|
1020
1067
|
//# sourceMappingURL=Exec.js.map
|