@plurnk/plurnk-service 1.16.5 → 1.18.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 +140 -246
- package/INSTALL.md +84 -138
- package/README.md +10 -6
- package/SPEC.md +2468 -1694
- package/dist/Paths.d.ts +2 -0
- package/dist/Paths.d.ts.map +1 -1
- package/dist/Paths.js +2 -0
- package/dist/Paths.js.map +1 -1
- package/dist/build-info.d.ts.map +1 -1
- package/dist/build-info.js +7 -1
- package/dist/build-info.js.map +1 -1
- package/dist/build-info.json +1 -1
- package/dist/content/body-preview.d.ts +8 -0
- package/dist/content/body-preview.d.ts.map +1 -0
- package/dist/content/body-preview.js +39 -0
- package/dist/content/body-preview.js.map +1 -0
- package/dist/content/byte-view.d.ts +1 -4
- package/dist/content/byte-view.d.ts.map +1 -1
- package/dist/content/byte-view.js.map +1 -1
- package/dist/content/edit-collision.d.ts.map +1 -1
- package/dist/content/edit-collision.js +3 -4
- package/dist/content/edit-collision.js.map +1 -1
- package/dist/content/line-anchors.d.ts +2 -2
- package/dist/content/line-anchors.d.ts.map +1 -1
- package/dist/content/line-anchors.js +4 -3
- package/dist/content/line-anchors.js.map +1 -1
- package/dist/content/line-selection.d.ts +9 -0
- package/dist/content/line-selection.d.ts.map +1 -0
- package/dist/content/line-selection.js +29 -0
- package/dist/content/line-selection.js.map +1 -0
- package/dist/content/matcher.d.ts +0 -1
- package/dist/content/matcher.d.ts.map +1 -1
- package/dist/content/matcher.js +2 -3
- package/dist/content/matcher.js.map +1 -1
- package/dist/content/pattern-edits.d.ts +39 -0
- package/dist/content/pattern-edits.d.ts.map +1 -0
- package/dist/content/pattern-edits.js +121 -0
- package/dist/content/pattern-edits.js.map +1 -0
- package/dist/content/read-projector.d.ts +18 -9
- package/dist/content/read-projector.d.ts.map +1 -1
- package/dist/content/read-projector.js +132 -35
- package/dist/content/read-projector.js.map +1 -1
- package/dist/content/read-resolve.d.ts +4 -1
- package/dist/content/read-resolve.d.ts.map +1 -1
- package/dist/content/read-resolve.js +42 -7
- package/dist/content/read-resolve.js.map +1 -1
- package/dist/core/AdmittedTurnExecutor.d.ts +2 -5
- package/dist/core/AdmittedTurnExecutor.d.ts.map +1 -1
- package/dist/core/AdmittedTurnExecutor.js +96 -88
- package/dist/core/AdmittedTurnExecutor.js.map +1 -1
- package/dist/core/BareBatchRunner.d.ts +6 -1
- package/dist/core/BareBatchRunner.d.ts.map +1 -1
- package/dist/core/BareBatchRunner.js +20 -5
- package/dist/core/BareBatchRunner.js.map +1 -1
- package/dist/core/BudgetReadout.d.ts +2 -3
- package/dist/core/BudgetReadout.d.ts.map +1 -1
- package/dist/core/BudgetReadout.js +23 -32
- package/dist/core/BudgetReadout.js.map +1 -1
- package/dist/core/CapabilityPolicies.d.ts +3 -8
- package/dist/core/CapabilityPolicies.d.ts.map +1 -1
- package/dist/core/CapabilityPolicies.js +2 -28
- package/dist/core/CapabilityPolicies.js.map +1 -1
- package/dist/core/CapabilityResolver.d.ts +10 -10
- package/dist/core/CapabilityResolver.d.ts.map +1 -1
- package/dist/core/CapabilityResolver.js +122 -93
- package/dist/core/CapabilityResolver.js.map +1 -1
- package/dist/core/ChannelWrite.d.ts +15 -11
- package/dist/core/ChannelWrite.d.ts.map +1 -1
- package/dist/core/ChannelWrite.js +12 -13
- package/dist/core/ChannelWrite.js.map +1 -1
- package/dist/core/ChannelWrite.sql +99 -9
- package/dist/core/ClientInteractions.d.ts.map +1 -1
- package/dist/core/ClientInteractions.js +7 -0
- package/dist/core/ClientInteractions.js.map +1 -1
- package/dist/core/CoreSchemeServices.d.ts +13 -10
- package/dist/core/CoreSchemeServices.d.ts.map +1 -1
- package/dist/core/CoreSchemeServices.js +13 -5
- package/dist/core/CoreSchemeServices.js.map +1 -1
- package/dist/core/DataStatementRunner.d.ts +2 -2
- package/dist/core/DataStatementRunner.d.ts.map +1 -1
- package/dist/core/DataStatementRunner.js +208 -161
- package/dist/core/DataStatementRunner.js.map +1 -1
- package/dist/core/Dispatcher.d.ts +24 -26
- package/dist/core/Dispatcher.d.ts.map +1 -1
- package/dist/core/Dispatcher.js +381 -232
- package/dist/core/Dispatcher.js.map +1 -1
- package/dist/core/Dispatcher.sql +66 -0
- package/dist/core/DurableStatement.d.ts.map +1 -1
- package/dist/core/DurableStatement.js +2 -1
- package/dist/core/DurableStatement.js.map +1 -1
- package/dist/core/EditMutations.d.ts +14 -18
- package/dist/core/EditMutations.d.ts.map +1 -1
- package/dist/core/EditMutations.js +211 -280
- package/dist/core/EditMutations.js.map +1 -1
- package/dist/core/EditMutations.sql +15 -0
- package/dist/core/EditSequence.d.ts +13 -0
- package/dist/core/EditSequence.d.ts.map +1 -0
- package/dist/core/EditSequence.js +73 -0
- package/dist/core/EditSequence.js.map +1 -0
- package/dist/core/Engine.d.ts +17 -23
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +74 -164
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Engine.sql +0 -724
- package/dist/core/EntryAddressBinding.d.ts +7 -17
- package/dist/core/EntryAddressBinding.d.ts.map +1 -1
- package/dist/core/EntryAddressBinding.js +12 -72
- package/dist/core/EntryAddressBinding.js.map +1 -1
- package/dist/core/ExecutionOutputs.d.ts +9 -0
- package/dist/core/ExecutionOutputs.d.ts.map +1 -0
- package/dist/core/ExecutionOutputs.js +36 -0
- package/dist/core/ExecutionOutputs.js.map +1 -0
- package/dist/core/ExecutionOutputs.sql +21 -0
- package/dist/core/ExecutorRegistry.d.ts +11 -5
- package/dist/core/ExecutorRegistry.d.ts.map +1 -1
- package/dist/core/ExecutorRegistry.js +37 -32
- package/dist/core/ExecutorRegistry.js.map +1 -1
- package/dist/core/HostPaths.d.ts +1 -0
- package/dist/core/HostPaths.d.ts.map +1 -1
- package/dist/core/HostPaths.js +4 -0
- package/dist/core/HostPaths.js.map +1 -1
- package/dist/core/InferenceCall.d.ts.map +1 -1
- package/dist/core/InferenceCall.js +1 -2
- package/dist/core/InferenceCall.js.map +1 -1
- package/dist/core/InferenceCall.sql +29 -0
- package/dist/core/KillHandler.d.ts +1 -0
- package/dist/core/KillHandler.d.ts.map +1 -1
- package/dist/core/KillHandler.js +24 -21
- package/dist/core/KillHandler.js.map +1 -1
- package/dist/core/LogBody.d.ts +8 -1
- package/dist/core/LogBody.d.ts.map +1 -1
- package/dist/core/LogBody.js +44 -12
- package/dist/core/LogBody.js.map +1 -1
- package/dist/core/LogEntryProjection.d.ts +1 -0
- package/dist/core/LogEntryProjection.d.ts.map +1 -1
- package/dist/core/LogEntryProjection.js +12 -10
- package/dist/core/LogEntryProjection.js.map +1 -1
- package/dist/core/LogVisibility.d.ts +1 -0
- package/dist/core/LogVisibility.d.ts.map +1 -1
- package/dist/core/LogVisibility.js +3 -0
- package/dist/core/LogVisibility.js.map +1 -1
- package/dist/core/LogWriter.d.ts +2 -3
- package/dist/core/LogWriter.d.ts.map +1 -1
- package/dist/core/LogWriter.js +31 -36
- package/dist/core/LogWriter.js.map +1 -1
- package/dist/core/LogWriter.sql +23 -0
- package/dist/core/LoopDriver.d.ts +11 -8
- package/dist/core/LoopDriver.d.ts.map +1 -1
- package/dist/core/LoopDriver.js +161 -189
- package/dist/core/LoopDriver.js.map +1 -1
- package/dist/core/LoopDriver.sql +11 -0
- package/dist/core/LoopLifecycle.d.ts +32 -2
- package/dist/core/LoopLifecycle.d.ts.map +1 -1
- package/dist/core/LoopLifecycle.js +88 -4
- package/dist/core/LoopLifecycle.js.map +1 -1
- package/dist/core/LoopLifecycle.sql +145 -28
- package/dist/core/LoopPolicyReader.sql +6 -0
- package/dist/core/MembershipMaterialization.d.ts.map +1 -1
- package/dist/core/MembershipMaterialization.js +6 -28
- package/dist/core/MembershipMaterialization.js.map +1 -1
- 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 +41 -0
- package/dist/core/MutationEffects.d.ts +5 -3
- package/dist/core/MutationEffects.d.ts.map +1 -1
- package/dist/core/MutationEffects.js +10 -28
- package/dist/core/MutationEffects.js.map +1 -1
- package/dist/core/NativeContent.d.ts +6 -0
- package/dist/core/NativeContent.d.ts.map +1 -0
- package/dist/core/NativeContent.js +16 -0
- package/dist/core/NativeContent.js.map +1 -0
- package/dist/core/NativeContent.sql +6 -0
- package/dist/core/NoticeChannel.js +1 -1
- package/dist/core/NoticeChannel.js.map +1 -1
- package/dist/core/OperatorConfig.js +5 -5
- package/dist/core/OperatorConfig.js.map +1 -1
- package/dist/core/PacketBuilder.d.ts +8 -5
- package/dist/core/PacketBuilder.d.ts.map +1 -1
- package/dist/core/PacketBuilder.js +117 -81
- package/dist/core/PacketBuilder.js.map +1 -1
- package/dist/core/PacketBuilder.sql +146 -0
- package/dist/core/PatternSelection.d.ts +28 -0
- package/dist/core/PatternSelection.d.ts.map +1 -0
- package/dist/core/PatternSelection.js +42 -0
- package/dist/core/PatternSelection.js.map +1 -0
- package/dist/core/ProblemLog.d.ts.map +1 -1
- package/dist/core/ProblemLog.js +0 -1
- package/dist/core/ProblemLog.js.map +1 -1
- package/dist/core/PromptFrames.d.ts +12 -0
- package/dist/core/PromptFrames.d.ts.map +1 -0
- package/dist/core/PromptFrames.js +28 -0
- package/dist/core/PromptFrames.js.map +1 -0
- package/dist/core/ProposalLifecycle.d.ts +0 -1
- package/dist/core/ProposalLifecycle.d.ts.map +1 -1
- package/dist/core/ProposalLifecycle.js +26 -23
- package/dist/core/ProposalLifecycle.js.map +1 -1
- package/dist/core/ProposalLifecycle.sql +33 -0
- package/dist/core/ProviderInstantiate.d.ts +1 -1
- package/dist/core/ProviderInstantiate.d.ts.map +1 -1
- package/dist/core/ProviderInstantiate.js +7 -14
- package/dist/core/ProviderInstantiate.js.map +1 -1
- package/dist/core/ReasoningView.d.ts +9 -0
- package/dist/core/ReasoningView.d.ts.map +1 -0
- package/dist/core/ReasoningView.js +47 -0
- package/dist/core/ReasoningView.js.map +1 -0
- package/dist/core/ResourceBindings.d.ts +16 -0
- package/dist/core/ResourceBindings.d.ts.map +1 -0
- package/dist/core/ResourceBindings.js +45 -0
- package/dist/core/ResourceBindings.js.map +1 -0
- package/dist/core/ResourceMutations.d.ts +5 -8
- package/dist/core/ResourceMutations.d.ts.map +1 -1
- package/dist/core/ResourceMutations.js +6 -7
- package/dist/core/ResourceMutations.js.map +1 -1
- package/dist/core/ResourceSelector.d.ts +2 -2
- package/dist/core/ResourceSelector.d.ts.map +1 -1
- package/dist/core/ResourceSelector.js +122 -62
- package/dist/core/ResourceSelector.js.map +1 -1
- package/dist/core/ResourceTransfers.d.ts +4 -2
- package/dist/core/ResourceTransfers.d.ts.map +1 -1
- package/dist/core/ResourceTransfers.js +95 -26
- package/dist/core/ResourceTransfers.js.map +1 -1
- package/dist/core/RuntimeWorker.d.ts +5 -0
- package/dist/core/RuntimeWorker.d.ts.map +1 -0
- package/dist/core/RuntimeWorker.js +15 -0
- package/dist/core/RuntimeWorker.js.map +1 -0
- package/dist/core/RuntimeWorker.sql +11 -0
- package/dist/core/SchemeRegistry.d.ts +12 -16
- package/dist/core/SchemeRegistry.d.ts.map +1 -1
- package/dist/core/SchemeRegistry.js +59 -85
- package/dist/core/SchemeRegistry.js.map +1 -1
- package/dist/core/StoredPacket.d.ts +6 -1
- package/dist/core/StoredPacket.d.ts.map +1 -1
- package/dist/core/StoredPacket.js +30 -10
- package/dist/core/StoredPacket.js.map +1 -1
- package/dist/core/StrikeRail.d.ts +11 -8
- package/dist/core/StrikeRail.d.ts.map +1 -1
- package/dist/core/StrikeRail.js +63 -114
- package/dist/core/StrikeRail.js.map +1 -1
- package/dist/core/StrikeRail.sql +12 -0
- package/dist/core/TerminalResult.d.ts +1 -1
- package/dist/core/TerminalResult.d.ts.map +1 -1
- package/dist/core/TerminalResult.js +2 -2
- package/dist/core/TerminalResult.js.map +1 -1
- package/dist/core/TokenCalibration.d.ts +1 -6
- package/dist/core/TokenCalibration.d.ts.map +1 -1
- package/dist/core/TokenCalibration.js +13 -9
- package/dist/core/TokenCalibration.js.map +1 -1
- package/dist/core/TokenCalibration.sql +15 -0
- package/dist/core/ToolInputSchema.d.ts +6 -0
- package/dist/core/ToolInputSchema.d.ts.map +1 -0
- package/dist/core/ToolInputSchema.js +43 -0
- package/dist/core/ToolInputSchema.js.map +1 -0
- package/dist/core/ToolResources.d.ts.map +1 -1
- package/dist/core/ToolResources.js +77 -51
- package/dist/core/ToolResources.js.map +1 -1
- package/dist/core/Turn.d.ts +5 -2
- package/dist/core/Turn.d.ts.map +1 -1
- package/dist/core/Turn.js +13 -11
- package/dist/core/Turn.js.map +1 -1
- package/dist/core/Turn.sql +25 -39
- package/dist/core/{SendBroadcastHandler.d.ts → TurnDispositionHandler.d.ts} +24 -18
- package/dist/core/TurnDispositionHandler.d.ts.map +1 -0
- package/dist/core/TurnDispositionHandler.js +206 -0
- package/dist/core/TurnDispositionHandler.js.map +1 -0
- package/dist/core/TurnMaterialization.d.ts +2 -3
- package/dist/core/TurnMaterialization.d.ts.map +1 -1
- package/dist/core/TurnMaterialization.js +47 -24
- package/dist/core/TurnMaterialization.js.map +1 -1
- package/dist/core/TurnMaterialization.sql +44 -0
- package/dist/core/TurnOps.d.ts.map +1 -1
- package/dist/core/TurnOps.js +8 -64
- package/dist/core/TurnOps.js.map +1 -1
- package/dist/core/TurnRunner.d.ts +8 -15
- package/dist/core/TurnRunner.d.ts.map +1 -1
- package/dist/core/TurnRunner.js +1175 -1317
- package/dist/core/TurnRunner.js.map +1 -1
- package/dist/core/TurnRunner.sql +74 -0
- package/dist/core/TurnSources.sql +39 -0
- package/dist/core/WorkerControlAddress.d.ts +1 -0
- package/dist/core/WorkerControlAddress.d.ts.map +1 -1
- package/dist/core/WorkerControlAddress.js +5 -0
- package/dist/core/WorkerControlAddress.js.map +1 -1
- package/dist/core/WorkerControlHandler.d.ts +1 -3
- package/dist/core/WorkerControlHandler.d.ts.map +1 -1
- package/dist/core/WorkerControlHandler.js +64 -48
- package/dist/core/WorkerControlHandler.js.map +1 -1
- package/dist/core/WorkerName.d.ts +11 -12
- package/dist/core/WorkerName.d.ts.map +1 -1
- package/dist/core/WorkerName.js +40 -47
- package/dist/core/WorkerName.js.map +1 -1
- package/dist/core/WorkerName.sql +7 -10
- package/dist/core/WorkspaceGate.d.ts +1 -1
- package/dist/core/WorkspaceGate.d.ts.map +1 -1
- package/dist/core/WorkspaceGate.js +33 -10
- package/dist/core/WorkspaceGate.js.map +1 -1
- package/dist/core/ambient.sql +236 -0
- package/dist/core/attachments.d.ts +2 -1
- package/dist/core/attachments.d.ts.map +1 -1
- package/dist/core/attachments.js +5 -4
- package/dist/core/attachments.js.map +1 -1
- package/dist/core/caps/CapsResolve.d.ts +2 -3
- package/dist/core/caps/CapsResolve.d.ts.map +1 -1
- package/dist/core/caps/CapsResolve.js +5 -5
- package/dist/core/caps/CapsResolve.js.map +1 -1
- package/dist/core/caps/DbChannelCaps.d.ts +1 -1
- package/dist/core/caps/DbChannelCaps.d.ts.map +1 -1
- package/dist/core/caps/DbChannelCaps.js +4 -6
- package/dist/core/caps/DbChannelCaps.js.map +1 -1
- package/dist/core/caps/DbEntryCaps.d.ts +2 -1
- package/dist/core/caps/DbEntryCaps.d.ts.map +1 -1
- package/dist/core/caps/DbEntryCaps.js +11 -17
- package/dist/core/caps/DbEntryCaps.js.map +1 -1
- package/dist/core/caps/DbNotifyCaps.d.ts +1 -1
- package/dist/core/caps/DbNotifyCaps.d.ts.map +1 -1
- package/dist/core/caps/DbNotifyCaps.js +3 -5
- package/dist/core/caps/DbNotifyCaps.js.map +1 -1
- package/dist/core/caps/DbProjectionCaps.js +1 -1
- package/dist/core/caps/DbProjectionCaps.js.map +1 -1
- package/dist/core/caps/DbSubscriptionCaps.d.ts +1 -1
- package/dist/core/caps/DbSubscriptionCaps.d.ts.map +1 -1
- package/dist/core/caps/DbSubscriptionCaps.js +5 -7
- package/dist/core/caps/DbSubscriptionCaps.js.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.d.ts +0 -2
- package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.js +4 -20
- 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/env-defaults.d.ts.map +1 -1
- package/dist/core/env-defaults.js +4 -2
- package/dist/core/env-defaults.js.map +1 -1
- package/dist/core/file-materialization.d.ts +4 -1
- package/dist/core/file-materialization.d.ts.map +1 -1
- package/dist/core/file-materialization.js +15 -1
- package/dist/core/file-materialization.js.map +1 -1
- package/dist/core/fork.d.ts +1 -6
- package/dist/core/fork.d.ts.map +1 -1
- package/dist/core/fork.js +9 -153
- package/dist/core/fork.js.map +1 -1
- package/dist/core/fork.sql +162 -185
- package/dist/core/git-env.d.ts +1 -0
- package/dist/core/git-env.d.ts.map +1 -1
- package/dist/core/git-env.js +39 -2
- package/dist/core/git-env.js.map +1 -1
- package/dist/core/git-membership.d.ts.map +1 -1
- package/dist/core/git-membership.js +64 -48
- package/dist/core/git-membership.js.map +1 -1
- package/dist/core/git-state.d.ts.map +1 -1
- package/dist/core/git-state.js +26 -20
- package/dist/core/git-state.js.map +1 -1
- package/dist/core/glob_match.d.ts +4 -0
- package/dist/core/glob_match.d.ts.map +1 -0
- package/dist/core/glob_match.js +7 -0
- package/dist/core/glob_match.js.map +1 -0
- package/dist/core/maintenance.sql +6 -0
- package/dist/core/mutation-types.d.ts +7 -28
- package/dist/core/mutation-types.d.ts.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.d.ts.map +1 -1
- package/dist/core/packet-inject.js +2 -3
- package/dist/core/packet-inject.js.map +1 -1
- package/dist/core/packet-wire.d.ts +8 -6
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +381 -388
- package/dist/core/packet-wire.js.map +1 -1
- package/dist/core/plurnk-uri.d.ts +1 -1
- package/dist/core/plurnk-uri.d.ts.map +1 -1
- package/dist/core/plurnk-uri.js +5 -12
- package/dist/core/plurnk-uri.js.map +1 -1
- package/dist/core/scheme-types.d.ts +3 -3
- package/dist/core/scheme-types.d.ts.map +1 -1
- package/dist/core/scheme-types.js.map +1 -1
- package/dist/core/sha256.d.ts +4 -0
- package/dist/core/sha256.d.ts.map +1 -0
- package/dist/core/sha256.js +6 -0
- package/dist/core/sha256.js.map +1 -0
- package/dist/core/teaching.js +1 -1
- package/dist/core/teaching.js.map +1 -1
- package/dist/core/turn-scheduler.d.ts.map +1 -1
- package/dist/core/turn-scheduler.js +5 -18
- package/dist/core/turn-scheduler.js.map +1 -1
- package/dist/core/turn-signals.d.ts +0 -6
- package/dist/core/turn-signals.d.ts.map +1 -1
- package/dist/core/turn-signals.js +1 -7
- package/dist/core/turn-signals.js.map +1 -1
- package/dist/core/worker-ops.sql +15 -22
- package/dist/core/workspace-settings.d.ts.map +1 -1
- package/dist/core/workspace-settings.js +18 -2
- package/dist/core/workspace-settings.js.map +1 -1
- package/dist/core/workspace-settings.sql +6 -0
- package/dist/digest/Digest.d.ts.map +1 -1
- package/dist/digest/Digest.js +30 -91
- package/dist/digest/Digest.js.map +1 -1
- package/dist/digest/DigestRender.d.ts +1 -0
- package/dist/digest/DigestRender.d.ts.map +1 -1
- package/dist/digest/DigestRender.js +58 -62
- package/dist/digest/DigestRender.js.map +1 -1
- package/dist/digest/digest-rows.d.ts +16 -32
- package/dist/digest/digest-rows.d.ts.map +1 -1
- package/dist/digest/digest.sql +54 -20
- package/dist/schemes/Exec.d.ts +6 -12
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +318 -215
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/ExecOutputScheme.d.ts +8 -6
- package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
- package/dist/schemes/ExecOutputScheme.js +33 -61
- 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/ExecutionInput.d.ts +12 -0
- package/dist/schemes/ExecutionInput.d.ts.map +1 -0
- package/dist/schemes/ExecutionInput.js +94 -0
- package/dist/schemes/ExecutionInput.js.map +1 -0
- package/dist/schemes/File.d.ts +5 -2
- package/dist/schemes/File.d.ts.map +1 -1
- package/dist/schemes/File.js +62 -91
- package/dist/schemes/File.js.map +1 -1
- package/dist/schemes/Log.d.ts.map +1 -1
- package/dist/schemes/Log.js +84 -79
- package/dist/schemes/Log.js.map +1 -1
- package/dist/schemes/Log.sql +183 -15
- package/dist/schemes/Prompt.d.ts.map +1 -1
- package/dist/schemes/Prompt.js +3 -12
- package/dist/schemes/Prompt.js.map +1 -1
- package/dist/schemes/QuestionTool.d.ts +5 -0
- package/dist/schemes/QuestionTool.d.ts.map +1 -1
- package/dist/schemes/QuestionTool.js +7 -15
- package/dist/schemes/QuestionTool.js.map +1 -1
- package/dist/schemes/Skill.d.ts +12 -7
- package/dist/schemes/Skill.d.ts.map +1 -1
- package/dist/schemes/Skill.js +149 -21
- package/dist/schemes/Skill.js.map +1 -1
- package/dist/schemes/TurnSource.d.ts +12 -0
- package/dist/schemes/TurnSource.d.ts.map +1 -0
- package/dist/schemes/TurnSource.js +117 -0
- package/dist/schemes/TurnSource.js.map +1 -0
- package/dist/schemes/Worker.d.ts +3 -3
- package/dist/schemes/Worker.d.ts.map +1 -1
- package/dist/schemes/Worker.js +61 -208
- package/dist/schemes/Worker.js.map +1 -1
- package/dist/schemes/_entry-crud.d.ts +12 -15
- package/dist/schemes/_entry-crud.d.ts.map +1 -1
- package/dist/schemes/_entry-crud.js +63 -63
- package/dist/schemes/_entry-crud.js.map +1 -1
- package/dist/schemes/_entry-crud.sql +159 -45
- package/dist/schemes/_entry-find.d.ts +1 -3
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +111 -112
- package/dist/schemes/_entry-find.js.map +1 -1
- package/dist/schemes/_entry-find.sql +22 -14
- package/dist/schemes/_entry-fts.d.ts +14 -0
- package/dist/schemes/_entry-fts.d.ts.map +1 -0
- package/dist/schemes/_entry-fts.js +82 -0
- package/dist/schemes/_entry-fts.js.map +1 -0
- package/dist/schemes/_entry-fts.sql +31 -0
- package/dist/schemes/_entry-graph.d.ts.map +1 -1
- package/dist/schemes/_entry-graph.js +6 -14
- package/dist/schemes/_entry-graph.js.map +1 -1
- package/dist/schemes/_entry-graph.sql +29 -44
- package/dist/schemes/_entry-manifest.d.ts +2 -1
- package/dist/schemes/_entry-manifest.d.ts.map +1 -1
- package/dist/schemes/_entry-manifest.js +20 -26
- package/dist/schemes/_entry-manifest.js.map +1 -1
- package/dist/schemes/_entry-manifest.sql +26 -0
- package/dist/schemes/_entry-ops.d.ts +3 -5
- package/dist/schemes/_entry-ops.d.ts.map +1 -1
- package/dist/schemes/_entry-ops.js +30 -43
- package/dist/schemes/_entry-ops.js.map +1 -1
- package/dist/schemes/_entry-ops.sql +5 -6
- package/dist/schemes/_entry-readable.d.ts +8 -0
- package/dist/schemes/_entry-readable.d.ts.map +1 -0
- package/dist/schemes/_entry-readable.js +38 -0
- package/dist/schemes/_entry-readable.js.map +1 -0
- package/dist/schemes/_entry-send.d.ts +1 -1
- package/dist/schemes/_entry-send.d.ts.map +1 -1
- package/dist/schemes/_entry-send.js +3 -3
- package/dist/schemes/_entry-send.js.map +1 -1
- package/dist/schemes/_search-index.d.ts +5 -3
- package/dist/schemes/_search-index.d.ts.map +1 -1
- package/dist/schemes/_search-index.js +169 -160
- package/dist/schemes/_search-index.js.map +1 -1
- package/dist/schemes/_search-index.sql +47 -0
- package/dist/schemes/exec-abort.js +1 -1
- 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-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 +2 -2
- package/dist/server/ClientReads.d.ts.map +1 -1
- package/dist/server/ClientReads.js +7 -9
- package/dist/server/ClientReads.js.map +1 -1
- package/dist/server/Daemon.d.ts +15 -21
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +165 -168
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/DaemonModule.d.ts +29 -22
- package/dist/server/DaemonModule.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.d.ts +8 -21
- package/dist/server/DrainSupervisor.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.js +278 -306
- package/dist/server/DrainSupervisor.js.map +1 -1
- package/dist/server/EnvFunctionality.d.ts +43 -0
- package/dist/server/EnvFunctionality.d.ts.map +1 -0
- package/dist/server/EnvFunctionality.js +194 -0
- package/dist/server/EnvFunctionality.js.map +1 -0
- package/dist/server/Functionality.d.ts +12 -11
- package/dist/server/Functionality.d.ts.map +1 -1
- package/dist/server/Functionality.js +279 -142
- package/dist/server/Functionality.js.map +1 -1
- package/dist/server/FunctionalityManager.d.ts +5 -5
- package/dist/server/FunctionalityManager.d.ts.map +1 -1
- package/dist/server/FunctionalityManager.js +29 -57
- package/dist/server/FunctionalityManager.js.map +1 -1
- package/dist/server/MembersFunctionality.d.ts +5 -4
- package/dist/server/MembersFunctionality.d.ts.map +1 -1
- package/dist/server/MembersFunctionality.js +24 -38
- package/dist/server/MembersFunctionality.js.map +1 -1
- package/dist/server/PlurnkSkill.d.ts +11 -0
- package/dist/server/PlurnkSkill.d.ts.map +1 -0
- package/dist/server/PlurnkSkill.js +41 -0
- package/dist/server/PlurnkSkill.js.map +1 -0
- package/dist/server/Retention.d.ts +25 -0
- package/dist/server/Retention.d.ts.map +1 -0
- package/dist/server/Retention.js +57 -0
- package/dist/server/Retention.js.map +1 -0
- package/dist/server/Retention.sql +59 -0
- package/dist/server/ServiceModules.d.ts +5 -0
- package/dist/server/ServiceModules.d.ts.map +1 -0
- package/dist/server/ServiceModules.js +10 -0
- package/dist/server/ServiceModules.js.map +1 -0
- package/dist/server/SkillsFunctionality.d.ts +14 -19
- package/dist/server/SkillsFunctionality.d.ts.map +1 -1
- package/dist/server/SkillsFunctionality.js +102 -106
- package/dist/server/SkillsFunctionality.js.map +1 -1
- package/dist/server/WorkerModelResolver.d.ts +4 -0
- package/dist/server/WorkerModelResolver.d.ts.map +1 -1
- package/dist/server/WorkerModelResolver.js +72 -39
- package/dist/server/WorkerModelResolver.js.map +1 -1
- package/dist/server/WorkspaceCapabilities.d.ts +21 -0
- package/dist/server/WorkspaceCapabilities.d.ts.map +1 -0
- package/dist/server/{WorkerCapabilities.js → WorkspaceCapabilities.js} +40 -40
- package/dist/server/WorkspaceCapabilities.js.map +1 -0
- package/dist/server/WorkspaceResidency.d.ts +38 -0
- package/dist/server/WorkspaceResidency.d.ts.map +1 -0
- package/dist/server/WorkspaceResidency.js +226 -0
- package/dist/server/WorkspaceResidency.js.map +1 -0
- package/dist/server/client-input.d.ts +1 -4
- package/dist/server/client-input.d.ts.map +1 -1
- package/dist/server/client-input.js +5 -46
- package/dist/server/client-input.js.map +1 -1
- package/dist/server/dispatch-as-plurnk.d.ts.map +1 -1
- package/dist/server/dispatch-as-plurnk.js +4 -22
- package/dist/server/dispatch-as-plurnk.js.map +1 -1
- package/dist/server/drain.sql +66 -43
- package/dist/server/envelope.d.ts +8 -1
- package/dist/server/envelope.d.ts.map +1 -1
- package/dist/server/envelope.js +9 -19
- package/dist/server/envelope.js.map +1 -1
- package/dist/server/envelope.sql +49 -13
- package/dist/server/lifecycle-recovery.sql +18 -20
- package/dist/server/logEntry.d.ts +1 -1
- package/dist/server/logEntry.d.ts.map +1 -1
- package/dist/server/logEntry.js +4 -1
- package/dist/server/logEntry.js.map +1 -1
- package/dist/server/logEntry.sql +25 -1
- package/dist/server/loopDocs.d.ts +2 -2
- package/dist/server/loopDocs.d.ts.map +1 -1
- package/dist/server/loopDocs.js +38 -31
- package/dist/server/loopDocs.js.map +1 -1
- package/dist/server/loopDocs.sql +1 -3
- package/dist/server/model-catalog.d.ts.map +1 -1
- package/dist/server/model-catalog.js +2 -1
- package/dist/server/model-catalog.js.map +1 -1
- package/dist/server/model-route.d.ts +1 -1
- package/dist/server/model-route.d.ts.map +1 -1
- package/dist/server/model-route.js +4 -2
- package/dist/server/model-route.js.map +1 -1
- package/dist/server/seam-entry-read.sql +3 -4
- package/dist/server/seam-loop.sql +2 -9
- package/dist/server/workspace-capabilities.sql +64 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +21 -18
- package/dist/service.js.map +1 -1
- package/docs/env.md +55 -0
- package/docs/members.md +83 -0
- package/docs/skills.md +50 -0
- package/migrations/001_workspaces.sql +53 -0
- package/migrations/002_workers.sql +198 -0
- package/migrations/003_loops.sql +326 -0
- package/migrations/004_inference.sql +401 -0
- package/migrations/005_entries.sql +215 -0
- package/migrations/006_log.sql +581 -0
- package/migrations/007_subscriptions.sql +175 -0
- package/migrations/008_interactions.sql +29 -0
- package/package.json +44 -41
- package/digest-sql/channel-dispositions/dispositions.sql +0 -15
- package/digest-sql/channel-state/state.sql +0 -6
- package/digest-sql/curation/curation.sql +0 -6
- package/digest-sql/derivations/derivations.sql +0 -4
- package/digest-sql/embeddings/embeddings.sql +0 -4
- package/digest-sql/entry-dispositions/dispositions.sql +0 -15
- package/digest-sql/entry-state/state.sql +0 -6
- package/digest-sql/token-counts/token-counts.sql +0 -2
- package/dist/core/EmbeddingCall.d.ts +0 -23
- package/dist/core/EmbeddingCall.d.ts.map +0 -1
- package/dist/core/EmbeddingCall.js +0 -149
- package/dist/core/EmbeddingCall.js.map +0 -1
- package/dist/core/OverflowTurn.d.ts +0 -11
- package/dist/core/OverflowTurn.d.ts.map +0 -1
- package/dist/core/OverflowTurn.js +0 -80
- package/dist/core/OverflowTurn.js.map +0 -1
- package/dist/core/Owner.d.ts +0 -8
- package/dist/core/Owner.d.ts.map +0 -1
- package/dist/core/Owner.js +0 -46
- package/dist/core/Owner.js.map +0 -1
- package/dist/core/SendBroadcastHandler.d.ts.map +0 -1
- package/dist/core/SendBroadcastHandler.js +0 -159
- package/dist/core/SendBroadcastHandler.js.map +0 -1
- package/dist/core/VectorPump.d.ts +0 -28
- package/dist/core/VectorPump.d.ts.map +0 -1
- package/dist/core/VectorPump.js +0 -130
- package/dist/core/VectorPump.js.map +0 -1
- package/dist/core/owner.sql +0 -11
- package/dist/core/worker-settings.d.ts +0 -10
- package/dist/core/worker-settings.d.ts.map +0 -1
- package/dist/core/worker-settings.js +0 -53
- package/dist/core/worker-settings.js.map +0 -1
- package/dist/schemes/_entry-chunk.d.ts +0 -14
- package/dist/schemes/_entry-chunk.d.ts.map +0 -1
- package/dist/schemes/_entry-chunk.js +0 -165
- package/dist/schemes/_entry-chunk.js.map +0 -1
- package/dist/schemes/_entry-semantic.d.ts +0 -63
- package/dist/schemes/_entry-semantic.d.ts.map +0 -1
- package/dist/schemes/_entry-semantic.js +0 -299
- package/dist/schemes/_entry-semantic.js.map +0 -1
- package/dist/schemes/_entry-semantic.sql +0 -99
- package/dist/schemes/cosine.d.ts +0 -4
- package/dist/schemes/cosine.d.ts.map +0 -1
- package/dist/schemes/cosine.js +0 -9
- package/dist/schemes/cosine.js.map +0 -1
- package/dist/server/WorkerCapabilities.d.ts +0 -21
- package/dist/server/WorkerCapabilities.d.ts.map +0 -1
- package/dist/server/WorkerCapabilities.js.map +0 -1
- package/dist/server/WorkerResidency.d.ts +0 -40
- package/dist/server/WorkerResidency.d.ts.map +0 -1
- package/dist/server/WorkerResidency.js +0 -283
- package/dist/server/WorkerResidency.js.map +0 -1
- package/dist/server/seam-log-read.sql +0 -21
- package/dist/server/worker-capabilities.sql +0 -28
- package/migrations/001_schema.sql +0 -2207
package/dist/schemes/Exec.js
CHANGED
|
@@ -1,28 +1,34 @@
|
|
|
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
|
-
import Owner from "../core/Owner.js";
|
|
6
8
|
import EntryFind from "./_entry-find.js";
|
|
7
9
|
import ChannelWrite from "../core/ChannelWrite.js";
|
|
8
10
|
import ExecEnv from "./exec-env.js";
|
|
11
|
+
import EnvFunctionality, { ENV_OWNER } from "../server/EnvFunctionality.js";
|
|
9
12
|
import ExecAbort from "./exec-abort.js";
|
|
10
|
-
import { renderAddress } from "../core/plurnk-uri.js";
|
|
13
|
+
import { entryCoordinateOf, generatedPathname, renderAddress } from "../core/plurnk-uri.js";
|
|
11
14
|
import { writeFile, unlink, stat } from "node:fs/promises";
|
|
12
15
|
import { tmpdir } from "node:os";
|
|
13
|
-
import { isAbsolute, join, resolve } from "node:path";
|
|
16
|
+
import { extname, isAbsolute, join, resolve } from "node:path";
|
|
14
17
|
import { CoreSchemeAdapterBase } from "../core/CoreSchemeServices.js";
|
|
15
18
|
import ErrorDetail from "../core/ErrorDetail.js";
|
|
16
19
|
import Results, { OperationFailureError } from "../core/results.js";
|
|
17
|
-
import { InvalidOperationResultError, NetworkAddress, } from "@plurnk/plurnk-schemes";
|
|
20
|
+
import { InvalidOperationResultError, NetworkAddress, ResourceNames, } from "@plurnk/plurnk-schemes";
|
|
18
21
|
import DbProjectionCaps from "../core/caps/DbProjectionCaps.js";
|
|
19
22
|
import WorkerControlAddress from "../core/WorkerControlAddress.js";
|
|
20
23
|
import Turn from "../core/Turn.js";
|
|
24
|
+
import RuntimeWorker from "../core/RuntimeWorker.js";
|
|
21
25
|
import LoopLifecycle from "../core/LoopLifecycle.js";
|
|
22
26
|
import LogEntryProjection from "../core/LogEntryProjection.js";
|
|
23
27
|
import LogBody from "../core/LogBody.js";
|
|
28
|
+
import ToolResources from "../core/ToolResources.js";
|
|
24
29
|
import { setTimeout as delay } from "node:timers/promises";
|
|
25
30
|
import ExecScheduler from "./ExecScheduler.js";
|
|
31
|
+
import ExecutionInput from "./ExecutionInput.js";
|
|
26
32
|
import { execRouteOf } from "./exec-runtime.js";
|
|
27
33
|
// Executors are discovered + probed at boot into ExecutorRegistry and reach
|
|
28
34
|
// the scheme through ctx.executors ({§exec-registry-resolves}). Each runtime tag
|
|
@@ -49,68 +55,50 @@ const resourceSourceOf = (target) => {
|
|
|
49
55
|
return null;
|
|
50
56
|
return target.raw;
|
|
51
57
|
};
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
// {§stream-owner-scoped} — resolve a stream statement's authority to the owning worker and hand
|
|
70
|
-
// back the statement authority-stripped (the storage path is the bare loop coordinate; the owner
|
|
71
|
-
// rides the owner_id column, never the pathname). Empty authority = the CALLING worker — your own
|
|
72
|
-
// streams need no qualifier, so a fan-out sibling's identical coordinate can never be yours
|
|
73
|
-
// ({§stream-owner-scoped}).
|
|
74
|
-
// A named authority = that worker's streams, any worker of the workspace (#394); an unknown
|
|
75
|
-
// name resolves null → the face 404s.
|
|
76
|
-
export const resolveStreamStatement = async (statement, ctx) => {
|
|
77
|
-
const t = statement.target;
|
|
78
|
-
const hostname = t !== null && t.kind === "url" ? t.hostname : null;
|
|
79
|
-
const ownerId = await Owner.resolveStreamOwner(hostname, ctx);
|
|
80
|
-
if (ownerId === null)
|
|
81
|
-
return null;
|
|
82
|
-
if (hostname === null || t === null || t.kind !== "url")
|
|
83
|
-
return { statement, ownerId };
|
|
84
|
-
return { statement: { ...statement, target: { ...t, hostname: null } }, ownerId };
|
|
85
|
-
};
|
|
86
|
-
export default class Exec extends CoreSchemeAdapterBase {
|
|
58
|
+
class Exec extends CoreSchemeAdapterBase {
|
|
59
|
+
// {§exec-env-scoped} — the environment one spawn receives: the ambient ceiling, then the Worker's
|
|
60
|
+
// own `env` state over it ({§env-functionality}), read here rather than held anywhere. No row is
|
|
61
|
+
// the ordinary case: a Worker that never set anything.
|
|
62
|
+
static async #composedEnv(db, workerId, modifier) {
|
|
63
|
+
const ambient = ExecEnv.scoped();
|
|
64
|
+
const row = await db.worker_module_state_get.get({ worker_id: workerId, namespace_owner: ENV_OWNER });
|
|
65
|
+
return EnvFunctionality.compose(ambient, row === undefined ? { version: 1, definitions: {} } : JSON.parse(row.state), modifier);
|
|
66
|
+
}
|
|
67
|
+
// The record goes on the output the spawn produces ({§execution-output-identity}) — the log row
|
|
68
|
+
// is the model's proposal and stays immutable. An output that is not there is a defect in the
|
|
69
|
+
// provenance chain, never a spawn that quietly runs unrecorded.
|
|
70
|
+
static async #recordEnv(db, entryId, record) {
|
|
71
|
+
const { changes } = await db.execution_record_env.run({ entry_id: entryId, env: JSON.stringify(record) });
|
|
72
|
+
if (changes !== 1)
|
|
73
|
+
throw new Error(`spawn output entry ${entryId} is not there to record the environment on`);
|
|
74
|
+
}
|
|
87
75
|
// The slot contract, stated when a resource source cannot be read: the resource IS the
|
|
88
|
-
// program and the body its stdin; a
|
|
76
|
+
// program and the body its stdin; a targetless invocation takes a command body.
|
|
89
77
|
static sourceRecovery(source, upstream) {
|
|
90
|
-
const contract =
|
|
78
|
+
const contract = `The target \`${source}\` names the program resource; the body is its stdin. Without a target, the body is the command.`;
|
|
91
79
|
return typeof upstream === "string" && upstream.length > 0 ? `${contract} ${upstream}` : contract;
|
|
92
80
|
}
|
|
93
81
|
static manifest = {
|
|
94
82
|
name: "exec",
|
|
95
|
-
authority: "
|
|
83
|
+
authority: "namespace",
|
|
96
84
|
channels: { stdout: "text/stream", stderr: "text/stream" },
|
|
97
85
|
defaultChannel: "stdout",
|
|
98
86
|
category: "data",
|
|
99
|
-
entryOwner: "worker",
|
|
100
|
-
inherit: "none",
|
|
101
87
|
writableBy: ["model", "client"],
|
|
102
88
|
volatile: true,
|
|
103
89
|
modelVisible: true,
|
|
104
90
|
metadataModifier: true,
|
|
105
|
-
documentation: "
|
|
91
|
+
documentation: "The opening fence names a registered executor or MCP service; its target, body, metadata, and timing follow that tool's invocation contract. Output streams into the workspace's `<executor>:///<id>` entry on that tool's own channels. A host-effecting invocation proposes for review before it runs; a read-only or pure one runs ungated. While it runs, the packet's `## Delegation` streams list reports channel size and growth and READ can inspect any range; when it finishes, one terminal READ becomes visible automatically.",
|
|
106
92
|
};
|
|
107
93
|
// The web-fetch the entry sink calls on content:null ({§exec-entry-sink}).
|
|
108
94
|
// Default = schemes-http's checked WebFetcher; injectable for tests.
|
|
109
95
|
#fetchWeb;
|
|
110
96
|
#scheduler;
|
|
97
|
+
#inputTimeoutMs;
|
|
111
98
|
constructor(fetchWeb) {
|
|
112
99
|
super();
|
|
113
100
|
this.#scheduler = new ExecScheduler();
|
|
101
|
+
this.#inputTimeoutMs = ExecutionInput.configuredTimeout();
|
|
114
102
|
if (fetchWeb === undefined) {
|
|
115
103
|
const webFetcher = new WebFetcher();
|
|
116
104
|
this.#fetchWeb = (url, opts) => webFetcher.fetch(url, opts);
|
|
@@ -138,11 +126,6 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
138
126
|
return true;
|
|
139
127
|
return false;
|
|
140
128
|
}
|
|
141
|
-
// {§exec-timeout} — a `<-1>` spawn is nobody's obligation: terminals, joins, and optimistic
|
|
142
|
-
// settlement look past it.
|
|
143
|
-
isDetachedSpawn(subscriptionId) {
|
|
144
|
-
return this.#activeAborts.get(subscriptionId)?.detached === true;
|
|
145
|
-
}
|
|
146
129
|
// {§exec-timeout} — a `<-1>` spawn ends with the daemon: nothing else ever aborts it, so the
|
|
147
130
|
// stop sequence reaps it (bounded housekeeping) before the streaming drain barrier.
|
|
148
131
|
abortDetached() {
|
|
@@ -160,7 +143,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
160
143
|
.map(([subscriptionId]) => {
|
|
161
144
|
const spawn = this.#activeSpawns.get(subscriptionId);
|
|
162
145
|
if (spawn === undefined) {
|
|
163
|
-
throw new Error(`Active
|
|
146
|
+
throw new Error(`Active execution subscription ${subscriptionId} has no spawn settlement promise.`);
|
|
164
147
|
}
|
|
165
148
|
return spawn;
|
|
166
149
|
});
|
|
@@ -186,18 +169,13 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
186
169
|
async kill(pathname, scope, ctx, scheme = "exec") {
|
|
187
170
|
const core = this.coreContext(ctx);
|
|
188
171
|
for (const entry of this.#activeAborts.values()) {
|
|
189
|
-
if (entry.
|
|
172
|
+
if (entry.workspaceId === core.workspaceId && entry.pathname === pathname && (scheme === "exec" || entry.runtime === scheme)) {
|
|
190
173
|
entry.controller.abort(ExecAbort.killReason(null));
|
|
191
174
|
return { status: 200 };
|
|
192
175
|
}
|
|
193
176
|
}
|
|
194
|
-
// Not running — settle the outcome from the closed subscription's status, scoped to the
|
|
195
|
-
// caller's own subscription (coordinates duplicate across workers, {§stream-owner-scoped}).
|
|
196
|
-
// The error answers in the model's OWN runtime-tag address (sh:///…), never the retired
|
|
197
|
-
// internal `exec` machinery ({§fs-answer-in-canon}) — the model KILLs what it addressed.
|
|
198
177
|
const terminal = await ChannelWrite.execTerminalStatus(core.db, {
|
|
199
178
|
workspaceId: core.workspaceId,
|
|
200
|
-
workerId: core.workerId,
|
|
201
179
|
scheme,
|
|
202
180
|
authority: "",
|
|
203
181
|
pathname,
|
|
@@ -218,29 +196,29 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
218
196
|
retryable: false,
|
|
219
197
|
});
|
|
220
198
|
}
|
|
221
|
-
//
|
|
222
|
-
//
|
|
199
|
+
// Execution handler — the model-facing entry point per plurnk.md.
|
|
200
|
+
// Named executable fences lower to runtime-owned invocation buckets.
|
|
223
201
|
//
|
|
224
202
|
// Proposes (status=202) with attrs={runtime, cwd, body, pathname}.
|
|
225
203
|
// applyResolution spawns the subprocess; output streams into the
|
|
226
204
|
// coordinate-stamped <runtime>:///<pathname> entry's stdout/stderr channels
|
|
227
|
-
// (e.g. sh:///1/1/2/
|
|
205
|
+
// (e.g. sh:///1/1/2/sh, {§exec}). The model READs that entry on a subsequent turn.
|
|
228
206
|
async exec(statement, ctx) {
|
|
229
207
|
const core = this.coreContext(ctx);
|
|
230
208
|
const body = statement.body ?? "";
|
|
231
209
|
if (core.executors === undefined)
|
|
232
210
|
throw new Error("exec dispatched without an executor registry");
|
|
233
|
-
// {§exec-executor-slot}: the
|
|
211
|
+
// {§exec-executor-slot}: the fence names the executor; the path is its program.
|
|
234
212
|
const route = execRouteOf(statement);
|
|
235
213
|
const runtime = route.runtime;
|
|
236
214
|
// {§exec-registry-resolves} — a non-empty tag selects exactly one registered executable
|
|
237
215
|
// tool. Unknown tags are not reinterpreted as shell command words: that would make the
|
|
238
|
-
// executed command differ from the authored body.
|
|
239
|
-
const resolved = core.executors.entry(runtime, core.
|
|
216
|
+
// executed command differ from the authored body.
|
|
217
|
+
const resolved = core.executors.entry(runtime, core.workspaceId);
|
|
240
218
|
if (resolved === undefined) {
|
|
241
|
-
return Results.failure("scheme:exec", "executor-not-registered", 400,
|
|
219
|
+
return Results.failure("scheme:exec", "executor-not-registered", 400, `No executor or MCP service named \`${runtime}\` is registered for this worker.`, {}, {
|
|
242
220
|
requestedRuntime: runtime,
|
|
243
|
-
executors: core.executors.availableRuntimes(core.
|
|
221
|
+
executors: core.executors.availableRuntimes(core.workspaceId),
|
|
244
222
|
retryable: false,
|
|
245
223
|
});
|
|
246
224
|
}
|
|
@@ -251,7 +229,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
251
229
|
retryable: false,
|
|
252
230
|
});
|
|
253
231
|
}
|
|
254
|
-
const registry = core.executors.toolRegistry(runtime, core.
|
|
232
|
+
const registry = core.executors.toolRegistry(runtime, core.workspaceId);
|
|
255
233
|
const exactTarget = route.target === null ? null : route.target.raw;
|
|
256
234
|
const registeredTool = registry?.tools.find((tool) => tool.target === exactTarget);
|
|
257
235
|
if (registry !== null && registeredTool === undefined) {
|
|
@@ -262,7 +240,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
262
240
|
runtime,
|
|
263
241
|
availableTargetCount: availableTargets.length,
|
|
264
242
|
...(availableTargets.length === 0 ? {} : {
|
|
265
|
-
recovery: `Select a target documented under worker
|
|
243
|
+
recovery: `Select a target documented under worker:///_plurnk/tools/${runtime}/.`,
|
|
266
244
|
}),
|
|
267
245
|
retryable: false,
|
|
268
246
|
});
|
|
@@ -273,7 +251,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
273
251
|
const hasTarget = execTarget !== null;
|
|
274
252
|
const refuse = (code, detail, recovery, extensions = {}) => Results.failure("scheme:exec", code, 400, detail, {}, { runtime, recovery, retryable: false, ...extensions });
|
|
275
253
|
if (invocation.body.required && !hasBody) {
|
|
276
|
-
return refuse("body-required", `Executable tool '${runtime}' requires a ${invocation.body.role} body.`, `Provide the ${invocation.body.role} in the
|
|
254
|
+
return refuse("body-required", `Executable tool '${runtime}' requires a ${invocation.body.role} body.`, `Provide the ${invocation.body.role} in the ${runtime} body.`);
|
|
277
255
|
}
|
|
278
256
|
if (invocation.target === undefined && hasTarget) {
|
|
279
257
|
return refuse("target-not-supported", `Executable tool '${runtime}' does not accept a target.`, `Remove the target and provide the ${invocation.body.role} in the body.`);
|
|
@@ -307,7 +285,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
307
285
|
else if (targetDecl.kind === "resource" || targetDecl.kind === "script") {
|
|
308
286
|
resourceSource = resourceSourceOf(execTarget);
|
|
309
287
|
if (resourceSource === null) {
|
|
310
|
-
throw new Error(`
|
|
288
|
+
throw new Error(`'${runtime}' resource target could not be classified`);
|
|
311
289
|
}
|
|
312
290
|
}
|
|
313
291
|
else {
|
|
@@ -315,46 +293,47 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
315
293
|
}
|
|
316
294
|
}
|
|
317
295
|
}
|
|
318
|
-
// {§
|
|
319
|
-
//
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (!isDirectory) {
|
|
339
|
-
return refuse("cwd-not-found", `EXEC working directory '${named[1]}' is not an existing directory.`, "Name an existing directory in `{cwd=…}`.", { cwd: named[1] });
|
|
296
|
+
// {§env-option} — the fence's own environment is the service's key: refused here by name,
|
|
297
|
+
// so the model learns why, never dropped at the spawn. The executor never sees it.
|
|
298
|
+
try {
|
|
299
|
+
EnvFunctionality.modifier(statement.metadata);
|
|
300
|
+
}
|
|
301
|
+
catch (cause) {
|
|
302
|
+
if (!(cause instanceof OperationFailureError))
|
|
303
|
+
throw cause;
|
|
304
|
+
return cause.result;
|
|
305
|
+
}
|
|
306
|
+
// {§executor-metadata} Options belong to the invoked executor for every source kind.
|
|
307
|
+
const executor = resolved.executor;
|
|
308
|
+
if (executor.prepare !== undefined) {
|
|
309
|
+
const prepared = Results.assert(await executor.prepare({
|
|
310
|
+
runtime, body, target: resourceSource ?? target, cwd, metadata: statement.metadata,
|
|
311
|
+
}));
|
|
312
|
+
if (prepared.status >= 400)
|
|
313
|
+
return prepared;
|
|
314
|
+
if (prepared.status !== 200 || (prepared.cwd !== null && (typeof prepared.cwd !== "string" || !isAbsolute(prepared.cwd)))) {
|
|
315
|
+
throw new InvalidOperationResultError(`Executable tool '${runtime}' returned invalid invocation preparation.`);
|
|
340
316
|
}
|
|
341
|
-
cwd =
|
|
317
|
+
cwd = prepared.cwd;
|
|
318
|
+
}
|
|
319
|
+
else if ((statement.metadata?.length ?? 0) > 0) {
|
|
320
|
+
return Results.failure("scheme:exec", "metadata-unsupported", 400, `Executable tool '${runtime}' does not accept metadata.`, {}, { runtime, retryable: false });
|
|
342
321
|
}
|
|
343
322
|
// A `script` target must be an existing file; other kinds pass through as declared.
|
|
344
323
|
if (target !== null && targetDecl?.kind === "script") {
|
|
345
|
-
const inspected = isAbsolute(target) ? target : resolve(cwd, target);
|
|
324
|
+
const inspected = isAbsolute(target) ? target : resolve(cwd ?? process.cwd(), target);
|
|
346
325
|
let kind = "missing";
|
|
347
326
|
try {
|
|
348
327
|
kind = (await stat(inspected)).isDirectory() ? "directory" : "file";
|
|
349
328
|
}
|
|
350
329
|
catch (cause) {
|
|
351
330
|
if (cause?.code !== "ENOENT") {
|
|
352
|
-
console.error(`
|
|
353
|
-
return Results.failure("scheme:exec", "target-classification-failed", 500,
|
|
331
|
+
console.error(`Execution target classification failed for '${inspected}':`, cause);
|
|
332
|
+
return Results.failure("scheme:exec", "target-classification-failed", 500, `${runtime} target '${target}' could not be inspected: ${ErrorDetail.preview(cause)}`, {}, { target, stage: "target-classification" });
|
|
354
333
|
}
|
|
355
334
|
}
|
|
356
335
|
if (kind === "directory") {
|
|
357
|
-
return refuse("target-not-a-program",
|
|
336
|
+
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 });
|
|
358
337
|
}
|
|
359
338
|
if (kind === "missing") {
|
|
360
339
|
// The target is not a script here, but it may be a registered tool of another
|
|
@@ -362,12 +341,12 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
362
341
|
const executors = core.executors;
|
|
363
342
|
const ownerRuntimes = executors === undefined
|
|
364
343
|
? []
|
|
365
|
-
: executors.availableRuntimes(core.
|
|
366
|
-
.filter((tag) => executors.toolRegistry(tag, core.
|
|
344
|
+
: executors.availableRuntimes(core.workspaceId)
|
|
345
|
+
.filter((tag) => executors.toolRegistry(tag, core.workspaceId)?.tools.some((tool) => tool.target === target) === true);
|
|
367
346
|
const recovery = ownerRuntimes.length === 0
|
|
368
|
-
?
|
|
369
|
-
: `
|
|
370
|
-
return refuse("target-not-found",
|
|
347
|
+
? `The target must name an existing program resource. A targetless ${runtime} takes the command in its body.`
|
|
348
|
+
: `The tool \`${target}\` is registered under executor \`${ownerRuntimes[0]}\`; use that name on the opening fence.`;
|
|
349
|
+
return refuse("target-not-found", `The ${runtime} program does not resolve as a script or a registered tool for this executor.`, recovery, { target, ...(ownerRuntimes.length === 0 ? {} : { toolRuntimes: ownerRuntimes }) });
|
|
371
350
|
}
|
|
372
351
|
}
|
|
373
352
|
if (!hasBody && target === null && resourceSource === null) {
|
|
@@ -379,11 +358,8 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
379
358
|
const effect = resolved.executor.effect(effectTarget);
|
|
380
359
|
// cwd is the workspace project_root unless target routing selected a
|
|
381
360
|
// directory override. {§exec-target-routing}, {§executor-sinks}
|
|
382
|
-
//
|
|
383
|
-
//
|
|
384
|
-
// `pathname` is stamped into attrs at log-write time; applyResolution
|
|
385
|
-
// reads it back here.
|
|
386
|
-
// EXEC repurposes the `<L>` slot as `<timeout, poll>` (MINUTES, held in seconds): mark[0] caps the spawn's
|
|
361
|
+
// The log writer claims the workspace output address before proposal application.
|
|
362
|
+
// An execution repurposes the `<L>` slot as `<timeout, poll>` (MINUTES, held in seconds): mark[0] caps the spawn's
|
|
387
363
|
// lifetime, mark[1] sets the hibernation poll-wake cadence ({§exec-poll}). N>0 → deadline (504);
|
|
388
364
|
// -1 / absent → unbounded (loop-life bounded); 0 → turn-scoped (reaped at the next pre-turn,
|
|
389
365
|
// never surviving into the subsequent turn).
|
|
@@ -404,6 +380,69 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
404
380
|
const preview = runtime !== "" ? `[${runtime}] ${previewInput}` : `$ ${previewInput}`;
|
|
405
381
|
return { status: 202, body: preview, attrs }; // host runtime proposes with 202 — {§exec-host-proposes}
|
|
406
382
|
}
|
|
383
|
+
async #inputRecipient(statement, ctx, runtime) {
|
|
384
|
+
const core = this.coreContext(ctx);
|
|
385
|
+
const target = statement.target;
|
|
386
|
+
const failure = (code, status, detail) => ({
|
|
387
|
+
failure: Results.failure("scheme:exec", code, status, detail, {}, { retryable: false }),
|
|
388
|
+
});
|
|
389
|
+
if (target?.kind !== "url" || target.scheme !== runtime || target.fragment !== null
|
|
390
|
+
|| target.query !== null || statement.lineMarker !== null) {
|
|
391
|
+
return failure("invalid-input-target", 400, "SEND input addresses an execution, without a channel or scope.");
|
|
392
|
+
}
|
|
393
|
+
const coordinate = entryCoordinateOf(target, "namespace");
|
|
394
|
+
const found = [...this.#activeAborts.entries()].find(([, entry]) => entry.workspaceId === core.workspaceId && entry.runtime === runtime && entry.pathname === coordinate.pathname);
|
|
395
|
+
if (found !== undefined) {
|
|
396
|
+
if (core.executors?.entry(runtime, core.workspaceId)?.executor !== found[1].executor) {
|
|
397
|
+
return failure("input-unavailable", 409, "This execution's input receiver is no longer enabled.");
|
|
398
|
+
}
|
|
399
|
+
return { found };
|
|
400
|
+
}
|
|
401
|
+
const terminal = await ChannelWrite.execTerminalStatus(core.db, {
|
|
402
|
+
workspaceId: core.workspaceId, scheme: runtime, ...coordinate,
|
|
403
|
+
});
|
|
404
|
+
return terminal === null
|
|
405
|
+
? failure("stream-not-found", 404, "No execution exists at the requested address.")
|
|
406
|
+
: failure("input-closed", 410, "Execution input is closed.");
|
|
407
|
+
}
|
|
408
|
+
async sendInput(statement, ctx, runtime) {
|
|
409
|
+
const recipient = await this.#inputRecipient(statement, ctx, runtime);
|
|
410
|
+
if ("failure" in recipient)
|
|
411
|
+
return recipient.failure;
|
|
412
|
+
const [subscriptionId, entry] = recipient.found;
|
|
413
|
+
const unavailable = entry.input.unavailable();
|
|
414
|
+
if (unavailable !== null)
|
|
415
|
+
return unavailable;
|
|
416
|
+
const denied = await this.capabilityDenial(entry.invocation, ctx);
|
|
417
|
+
if (denied !== null)
|
|
418
|
+
return denied;
|
|
419
|
+
return {
|
|
420
|
+
status: 202,
|
|
421
|
+
attrs: { inputSubscription: subscriptionId, inputBody: statement.body?.raw ?? "", inputTarget: statement.target.raw, effect: entry.effect },
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
async applyInput(args, ctx, runtime) {
|
|
425
|
+
const attrs = args.attrs;
|
|
426
|
+
if (typeof attrs.inputSubscription !== "number" || typeof attrs.inputBody !== "string" || typeof attrs.inputTarget !== "string") {
|
|
427
|
+
throw new InvalidOperationResultError("Execution input proposal is missing its invocation or body.");
|
|
428
|
+
}
|
|
429
|
+
const body = args.body ?? attrs.inputBody;
|
|
430
|
+
const statement = {
|
|
431
|
+
op: "SEND", aside: null, metadata: args.metadata === null ? null : [...args.metadata],
|
|
432
|
+
target: parsePath(attrs.inputTarget), lineMarker: null, body: { raw: body, json: null }, position: { line: 1, column: 1 },
|
|
433
|
+
};
|
|
434
|
+
const recipient = await this.#inputRecipient(statement, ctx, runtime);
|
|
435
|
+
if ("failure" in recipient)
|
|
436
|
+
return recipient.failure;
|
|
437
|
+
const [subscriptionId, entry] = recipient.found;
|
|
438
|
+
if (subscriptionId !== attrs.inputSubscription) {
|
|
439
|
+
return Results.failure("scheme:exec", "input-closed", 410, "The proposed execution input is no longer live.", {}, { retryable: false });
|
|
440
|
+
}
|
|
441
|
+
const denied = await this.capabilityDenial(statement, ctx) ?? await this.capabilityDenial(entry.invocation, ctx);
|
|
442
|
+
if (denied !== null)
|
|
443
|
+
return denied;
|
|
444
|
+
return entry.input.deliver(body, args.metadata, ctx.signal);
|
|
445
|
+
}
|
|
407
446
|
async applyResolution(args, ctx) {
|
|
408
447
|
const core = this.coreContext(ctx);
|
|
409
448
|
const attrs = args.attrs;
|
|
@@ -414,63 +453,74 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
414
453
|
let target = (typeof attrs.target === "string" && attrs.target.length > 0) ? attrs.target : null;
|
|
415
454
|
const effect = attrs.effect;
|
|
416
455
|
if (typeof pathname !== "string" || pathname.length === 0) {
|
|
417
|
-
throw new InvalidOperationResultError("The accepted
|
|
456
|
+
throw new InvalidOperationResultError("The accepted execution proposal is missing its stream pathname.");
|
|
418
457
|
}
|
|
419
458
|
if (!EffectPolicy.isEffect(effect)) {
|
|
420
|
-
throw new InvalidOperationResultError("The accepted
|
|
459
|
+
throw new InvalidOperationResultError("The accepted execution proposal is missing its canonical effect fact.");
|
|
421
460
|
}
|
|
422
|
-
|
|
423
|
-
|
|
461
|
+
const invocation = {
|
|
462
|
+
runtime: runtime, aside: null, metadata: null,
|
|
463
|
+
target: attrs.resourceSource ? parsePath(attrs.resourceSource) : target === null ? null : parsePath(target),
|
|
464
|
+
lineMarker: null, body, position: { line: 1, column: 1 },
|
|
465
|
+
};
|
|
466
|
+
// {§exec-source-temporary} Admission precedes source realization. Native
|
|
467
|
+
// files retain their environment; only standalone sources need a copy.
|
|
424
468
|
let tempPath = null;
|
|
425
469
|
if (attrs.resourceSource !== undefined) {
|
|
426
470
|
const sourceTarget = parsePath(attrs.resourceSource);
|
|
427
471
|
if (sourceTarget?.kind !== "url" || sourceTarget.scheme === null || sourceTarget.scheme === "file") {
|
|
428
|
-
throw new InvalidOperationResultError("The accepted
|
|
472
|
+
throw new InvalidOperationResultError("The accepted execution proposal has an invalid scheme source address.");
|
|
429
473
|
}
|
|
430
|
-
const
|
|
474
|
+
const source = await this.readExecSource({
|
|
431
475
|
op: "READ",
|
|
432
|
-
|
|
433
|
-
annotation: null,
|
|
476
|
+
aside: null,
|
|
434
477
|
target: sourceTarget,
|
|
435
|
-
metadata:
|
|
478
|
+
metadata: null,
|
|
436
479
|
lineMarker: { marks: [1, -1] },
|
|
480
|
+
matcher: null,
|
|
437
481
|
body: null,
|
|
438
482
|
position: { line: 0, column: 0 },
|
|
439
483
|
}, core);
|
|
484
|
+
const read = source.result;
|
|
440
485
|
if (read.status >= 400) {
|
|
441
|
-
// {§exec-target-routing} — the failure stays the owning READ's (#163); the
|
|
486
|
+
// {§exec-target-routing} — the failure stays the owning READ's (#163); the execution
|
|
442
487
|
// contract rides its recovery, because a stream address in the target slot is
|
|
443
488
|
// almost always a command that belonged beneath a targetless heading (#425 F4).
|
|
444
489
|
const problem = read.problem === undefined ? undefined : {
|
|
445
490
|
...read.problem,
|
|
446
|
-
recovery:
|
|
491
|
+
recovery: _a.sourceRecovery(attrs.resourceSource, read.problem.recovery),
|
|
447
492
|
};
|
|
448
493
|
return Results.assert({ ...read, outcome: "scheme_source_read_failed", ...(problem === undefined ? {} : { problem }) });
|
|
449
494
|
}
|
|
450
495
|
const content = read.content;
|
|
451
496
|
if (typeof content !== "string") {
|
|
452
|
-
return Results.failure("scheme:exec", "source-content-unavailable", 422, `Scheme '${sourceTarget.scheme}' did not supply content for the
|
|
497
|
+
return Results.failure("scheme:exec", "source-content-unavailable", 422, `Scheme '${sourceTarget.scheme}' did not supply content for the ${runtime} source.`, { outcome: "scheme_source_content_unavailable" }, {
|
|
453
498
|
scheme: sourceTarget.scheme,
|
|
454
499
|
sourceStatus: read.status,
|
|
455
500
|
retryable: false,
|
|
456
501
|
});
|
|
457
502
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
503
|
+
if (source.nativePath !== null) {
|
|
504
|
+
target = source.nativePath;
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
tempPath = join(tmpdir(), `plurnk-exec-${crypto.randomUUID()}${extname(sourceTarget.pathname)}`);
|
|
508
|
+
await writeFile(tempPath, content, { encoding: "utf8", flag: "wx", mode: 0o600 });
|
|
509
|
+
target = tempPath;
|
|
510
|
+
}
|
|
461
511
|
}
|
|
462
512
|
if (body.length === 0 && target === null) {
|
|
463
|
-
throw new InvalidOperationResultError("The accepted
|
|
513
|
+
throw new InvalidOperationResultError("The accepted execution proposal has neither a body nor a realized target.");
|
|
464
514
|
}
|
|
465
515
|
// Resolve the runtime's executor from the boot registry, then seed
|
|
466
516
|
// channels from its declared topology ({§executor-channels}). Each executor declares its own
|
|
467
517
|
// shape (subprocess → stdout/stderr; search → results; etc.).
|
|
468
518
|
if (core.executors === undefined) {
|
|
469
|
-
throw new InvalidOperationResultError("An accepted
|
|
519
|
+
throw new InvalidOperationResultError("An accepted execution proposal has no executor registry.");
|
|
470
520
|
}
|
|
471
|
-
const resolved = core.executors.entry(runtime, core.
|
|
521
|
+
const resolved = core.executors.entry(runtime, core.workspaceId);
|
|
472
522
|
if (resolved === undefined) {
|
|
473
|
-
throw new InvalidOperationResultError(`The '${runtime}' executor disappeared after its
|
|
523
|
+
throw new InvalidOperationResultError(`The '${runtime}' executor disappeared after its proposal.`);
|
|
474
524
|
}
|
|
475
525
|
// {§executor-effect}, {§exec-hold-until-concluded}, #107: the admitted
|
|
476
526
|
// effect fact rides the hold predicate unchanged through application.
|
|
@@ -485,7 +535,9 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
485
535
|
const seed = { channels: seedChannels };
|
|
486
536
|
// {§exec} — the stream entry's scheme IS the runtime tag (sh/node), so it addresses by
|
|
487
537
|
// tag authority (sh:///l/t/s). The engine registers each runtime tag → this handler.
|
|
488
|
-
const { entryId } = await EntryCrud.writeEntry({ authority: "", pathname }, seed, core, runtime,
|
|
538
|
+
const { entryId } = await EntryCrud.writeEntry({ authority: "", pathname }, seed, core, runtime, {
|
|
539
|
+
defaultChannel: resolved.executor.defaultChannel, output: true,
|
|
540
|
+
});
|
|
489
541
|
if (entryId === null) {
|
|
490
542
|
return Results.failure("scheme:exec", "stream-entry-write-failed", 500, `The ${runtime} stream entry could not be created.`, {
|
|
491
543
|
outcome: "entry_write_failed",
|
|
@@ -500,6 +552,10 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
500
552
|
handle: runtime !== "" ? `${runtime}: ${body !== "" ? body : target ?? ""}` : body,
|
|
501
553
|
pollSeconds: typeof attrs.pollSec === "number" ? attrs.pollSec : null, // {§exec-poll} — hibernation wake cadence
|
|
502
554
|
turnScoped: attrs.turnScoped === true, // {§exec-poll} — `<0>` reaped at the next pre-turn
|
|
555
|
+
detached: attrs.detached === true, // {§worker-obligations} — `<-1>` is nobody's obligation
|
|
556
|
+
publishedChannel: resolved.executor.publishedChannel,
|
|
557
|
+
source: attrs.coordinate === undefined ? undefined
|
|
558
|
+
: `log:///${attrs.coordinate.loop_seq}/${attrs.coordinate.turn_seq}/${attrs.coordinate.sequence}/${runtime}`,
|
|
503
559
|
});
|
|
504
560
|
const controller = new AbortController();
|
|
505
561
|
let unlink = () => { };
|
|
@@ -521,7 +577,8 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
521
577
|
if (parent.aborted)
|
|
522
578
|
controller.abort(ExecAbort.teardownReason());
|
|
523
579
|
}
|
|
524
|
-
|
|
580
|
+
const input = new ExecutionInput(controller.signal, this.#inputTimeoutMs);
|
|
581
|
+
this.#activeAborts.set(subscriptionId, { workspaceId: core.workspaceId, workerId: core.workerId, turnId: core.turnId, pathname, runtime, effect, controller, unlink, detached: attrs.detached === true, input, invocation, executor: resolved.executor });
|
|
525
582
|
this.liveSubscriptions().register(subscriptionId, {
|
|
526
583
|
cancel: () => controller.abort(ExecAbort.teardownReason()),
|
|
527
584
|
});
|
|
@@ -530,8 +587,8 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
530
587
|
try {
|
|
531
588
|
return await this.#runExecutor({
|
|
532
589
|
executor: resolved.executor,
|
|
533
|
-
runtime, body, cwd, target, ctx: core, pathname,
|
|
534
|
-
entryId, subscriptionId, signal: controller.signal, controller, tempPath,
|
|
590
|
+
runtime, body, cwd, target, metadata: args.metadata, ctx: core, pathname, coordinate: attrs.coordinate,
|
|
591
|
+
entryId, subscriptionId, signal: controller.signal, controller, tempPath, input,
|
|
535
592
|
timeoutSec: typeof attrs.timeoutSec === "number" ? attrs.timeoutSec : null,
|
|
536
593
|
});
|
|
537
594
|
}
|
|
@@ -567,11 +624,45 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
567
624
|
// a setState("closed") that races a prior write() can flip the
|
|
568
625
|
// notify's reported state to "closed" before the chunk event fires
|
|
569
626
|
// as "active." Chain through a single promise queue to serialize.
|
|
627
|
+
// {§exec-tool-fall-through} — a bare shell command whose program is really the name of a tool
|
|
628
|
+
// of an enabled runtime (`brave_web_search {…}` under the default shell) dies with the shell's
|
|
629
|
+
// exit 127. The failure receipt states that fact at the failure site, with the invocation the
|
|
630
|
+
// registry actually publishes, so the model recovers in one turn instead of by rereading docs.
|
|
631
|
+
#namedToolFallThrough(result, runtime, body, ctx) {
|
|
632
|
+
const core = this.coreContext(ctx);
|
|
633
|
+
const executors = core.executors;
|
|
634
|
+
if (executors === undefined || result.problem === undefined)
|
|
635
|
+
return result;
|
|
636
|
+
const program = body.trim().split(/\s+/u, 1)[0] ?? "";
|
|
637
|
+
if (program.length === 0)
|
|
638
|
+
return result;
|
|
639
|
+
const owners = executors.availableRuntimes(core.workspaceId)
|
|
640
|
+
.filter((tag) => tag !== runtime
|
|
641
|
+
&& executors.toolRegistry(tag, core.workspaceId)?.tools.some((tool) => tool.target === program) === true);
|
|
642
|
+
if (owners.length === 0)
|
|
643
|
+
return result;
|
|
644
|
+
const owner = owners[0];
|
|
645
|
+
// The tool's own document, where its family publishes it ({§tools-resource-materialization}).
|
|
646
|
+
const root = executors.entry(owner, core.workspaceId)?.resourcesPath ?? "/plurnk";
|
|
647
|
+
const contract = `worker://${generatedPathname(`${root}/${owner}/${ToolResources.targetSegment(program)}.md`)}`;
|
|
648
|
+
return {
|
|
649
|
+
...result,
|
|
650
|
+
problem: {
|
|
651
|
+
...result.problem,
|
|
652
|
+
detail: `'${runtime}' exited with code 127; \`${program}\` is a registered tool of \`${owner}\`.`,
|
|
653
|
+
recovery: `Use the \`${owner}\` fence with target \`(${program})\` and JSON input in the body; contract: ${contract}.`,
|
|
654
|
+
toolRuntimes: owners,
|
|
655
|
+
tool: program,
|
|
656
|
+
},
|
|
657
|
+
};
|
|
658
|
+
}
|
|
570
659
|
async #runExecutor(opts) {
|
|
571
|
-
const {
|
|
660
|
+
const { runtime, body, cwd, target, metadata, ctx, pathname, entryId, subscriptionId, signal, controller, timeoutSec, tempPath, input, coordinate } = opts;
|
|
661
|
+
// {§functionality-model-projection} — a Core-owned manager acts for the invoking Worker. The
|
|
662
|
+
// framework's ExecArgs carries no Worker identity, so Core binds it here, at the operation.
|
|
663
|
+
const executor = isWorkerBound(opts.executor) ? opts.executor.forWorker(ctx.workerId) : opts.executor;
|
|
572
664
|
const db = ctx.db;
|
|
573
|
-
|
|
574
|
-
// grammar 0.74.20 EXEC `<T>` — kill the spawn after T seconds. unref'd so a pending timer never
|
|
665
|
+
// an execution's `<T>` — kill the spawn after T seconds. unref'd so a pending timer never
|
|
575
666
|
// holds the process open; cleared in finally so a spawn that finishes first leaves no timer.
|
|
576
667
|
let timedOut = false;
|
|
577
668
|
const timeoutTimer = timeoutSec !== null
|
|
@@ -607,7 +698,14 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
607
698
|
callerSource = WorkerControlAddress.render(caller.name);
|
|
608
699
|
return callerSource;
|
|
609
700
|
};
|
|
610
|
-
const
|
|
701
|
+
const publishedNames = new ResourceNames();
|
|
702
|
+
const entrySink = (requestedPath, content, opts) => {
|
|
703
|
+
let path = requestedPath;
|
|
704
|
+
if (path === null) {
|
|
705
|
+
if (content === null)
|
|
706
|
+
return Promise.reject(new Error("entry(): an invocation resource requires supplied content"));
|
|
707
|
+
path = renderAddress({ scheme: runtime, authority: "", pathname: `${pathname}/resources/${publishedNames.allocate(opts.name)}` });
|
|
708
|
+
}
|
|
611
709
|
const parsed = parsePath(path);
|
|
612
710
|
if (parsed === null || parsed.kind !== "url")
|
|
613
711
|
return Promise.reject(new Error(`entry(): '${path.slice(0, 80)}' is not a URL`));
|
|
@@ -619,7 +717,9 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
619
717
|
const fetchAddress = address !== null && (address.scheme === "http" || address.scheme === "https")
|
|
620
718
|
? address
|
|
621
719
|
: null;
|
|
622
|
-
const binding =
|
|
720
|
+
const binding = requestedPath === null
|
|
721
|
+
? Promise.resolve({ address: { scheme: runtime, authority: "", pathname: parsed.pathname }, result: null })
|
|
722
|
+
: this.bindEntryAddress(parsed, ctx);
|
|
623
723
|
// {§exec-entry-sink}/{§web-search-retrieval} — start content:null
|
|
624
724
|
// acquisition before the write chain so fetches run in parallel;
|
|
625
725
|
// only durable entry writes serialize. A null result rejects the sink.
|
|
@@ -629,12 +729,12 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
629
729
|
return Promise.reject(new Error("entry(): content:null requires an http(s):// URL"));
|
|
630
730
|
materialized = this.#fetchWeb(fetchAddress.url, { signal });
|
|
631
731
|
}
|
|
632
|
-
else {
|
|
732
|
+
else if (typeof content === "string" && requestedPath !== null) {
|
|
633
733
|
materialized = Promise.resolve({
|
|
634
734
|
url: fetchAddress?.url ?? "http://localhost",
|
|
635
735
|
body: content,
|
|
636
736
|
mimetype: opts.mimetype,
|
|
637
|
-
|
|
737
|
+
allowConfiguredMaterializer: false,
|
|
638
738
|
});
|
|
639
739
|
}
|
|
640
740
|
const op = async () => {
|
|
@@ -647,42 +747,53 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
647
747
|
if (resolved.address === null) {
|
|
648
748
|
throw new Error(`entry(): '${path.slice(0, 80)}' did not resolve to an entry address`);
|
|
649
749
|
}
|
|
650
|
-
const { authority, pathname, scheme
|
|
750
|
+
const { authority, pathname, scheme } = resolved.address;
|
|
651
751
|
const coordinate = { authority, pathname };
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
752
|
+
let channels;
|
|
753
|
+
let decisive;
|
|
754
|
+
let source;
|
|
755
|
+
if (materialized === undefined) {
|
|
756
|
+
if (content === null)
|
|
757
|
+
throw new Error("entry(): missing supplied content");
|
|
758
|
+
const body = typeof content === "string" ? { content, mimetype: opts.mimetype }
|
|
759
|
+
: { content: "", bytes: content, mimetype: opts.mimetype };
|
|
760
|
+
const channel = requestedPath === null ? executor.defaultChannel : ctx.defaultChannelFor?.(scheme);
|
|
761
|
+
if (channel === undefined)
|
|
762
|
+
throw new Error(`entry(): no default channel for '${scheme}'`);
|
|
763
|
+
channels = { [channel]: body };
|
|
764
|
+
decisive = typeof content === "string" ? content : `${opts.mimetype}; ${content.byteLength} bytes`;
|
|
765
|
+
source = decisive;
|
|
658
766
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
767
|
+
else {
|
|
768
|
+
const fetched = await materialized;
|
|
769
|
+
if (fetched === null)
|
|
770
|
+
throw new Error(`entry(): '${path.slice(0, 80)}' is dead`);
|
|
771
|
+
let web;
|
|
772
|
+
try {
|
|
773
|
+
web = await WebFetcher.materialize(fetched, new DbProjectionCaps(ctx));
|
|
662
774
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
775
|
+
catch (error) {
|
|
776
|
+
if (!signal.aborted && error instanceof WebMaterializationError) {
|
|
777
|
+
console.error("entry() web materialization failed", { path, error });
|
|
778
|
+
}
|
|
779
|
+
throw error;
|
|
780
|
+
}
|
|
781
|
+
if (web === null)
|
|
782
|
+
throw new Error(`entry(): '${path.slice(0, 80)}' has no readable projection`);
|
|
783
|
+
if (web.body === undefined)
|
|
784
|
+
throw new Error(web.bodyOutcome.failure?.detail ?? `entry(): '${path.slice(0, 80)}' produced no readable body`);
|
|
785
|
+
channels = WebFetcher.materializedChannels(web, content === null && fetchAddress !== null ? { url: fetchAddress.url, method: "GET" } : undefined);
|
|
786
|
+
decisive = web.body.content;
|
|
787
|
+
source = web.html?.content ?? decisive;
|
|
670
788
|
}
|
|
671
|
-
// {§exec-entry-sink}/{§html-materialization} The shared
|
|
672
|
-
// materializer owns the decisive projection and its provenance.
|
|
673
|
-
const channels = WebFetcher.materializedChannels(web, content === null && fetchAddress !== null
|
|
674
|
-
? { url: fetchAddress.url, method: "GET" }
|
|
675
|
-
: undefined);
|
|
676
|
-
const decisive = web.body.content;
|
|
677
|
-
const source = web.html?.content ?? decisive;
|
|
678
789
|
const causalSource = await resolveCallerSource();
|
|
679
|
-
const written = Results.assert(await EntryCrud.writeEntry(coordinate, { channels }, ctx, scheme,
|
|
790
|
+
const written = Results.assert(await EntryCrud.writeEntry(coordinate, { channels }, ctx, scheme, {
|
|
791
|
+
defaultChannel: requestedPath === null ? executor.defaultChannel : ctx.defaultChannelFor?.(scheme),
|
|
792
|
+
output: requestedPath === null,
|
|
793
|
+
}));
|
|
680
794
|
if (narration === null) {
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
if (worker === undefined)
|
|
684
|
-
throw new Error("entry(): plurnk worker resolution returned no row");
|
|
685
|
-
const loop = await db.envelope_insert_client_loop.get({ worker_id: worker.id });
|
|
795
|
+
const workerId = await RuntimeWorker.ensure(db, ctx.workspaceId);
|
|
796
|
+
const loop = await db.envelope_insert_client_loop.get({ worker_id: workerId });
|
|
686
797
|
if (loop === undefined)
|
|
687
798
|
throw new Error("entry(): loop insert returned no row");
|
|
688
799
|
const turn = await Turn.open(db, {
|
|
@@ -691,7 +802,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
691
802
|
kind: "operation",
|
|
692
803
|
});
|
|
693
804
|
narration = {
|
|
694
|
-
workerId
|
|
805
|
+
workerId,
|
|
695
806
|
loopId: loop.id,
|
|
696
807
|
loopSeq: loop.sequence,
|
|
697
808
|
turnId: turn.id,
|
|
@@ -721,7 +832,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
721
832
|
const logRow = await db.engine_insert_log_entry.get({
|
|
722
833
|
worker_id: narration.workerId, loop_id: narration.loopId, turn_id: narration.turnId, sequence,
|
|
723
834
|
origin: "_plurnk", source: causalSource, model_call_id: null,
|
|
724
|
-
op: "EDIT",
|
|
835
|
+
op: "EDIT", signal: null,
|
|
725
836
|
scheme, username: null, password: null,
|
|
726
837
|
hostname: address === null ? null : parsed.hostname,
|
|
727
838
|
port: address === null ? null : parsed.port,
|
|
@@ -757,34 +868,37 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
757
868
|
return run;
|
|
758
869
|
};
|
|
759
870
|
const executionFailures = [];
|
|
871
|
+
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 });
|
|
760
872
|
try {
|
|
761
873
|
if (signal.aborted) {
|
|
762
|
-
result =
|
|
763
|
-
runtime,
|
|
764
|
-
stage: "execution",
|
|
765
|
-
retryable: false,
|
|
766
|
-
});
|
|
874
|
+
result = cancelled();
|
|
767
875
|
}
|
|
768
876
|
else
|
|
769
877
|
try {
|
|
878
|
+
const composed = await _a.#composedEnv(db, ctx.workerId, EnvFunctionality.modifier(metadata));
|
|
879
|
+
await _a.#recordEnv(db, entryId, composed.record);
|
|
770
880
|
const reported = await executor.run({
|
|
771
|
-
|
|
881
|
+
registerInput: (receiver) => input.register(receiver),
|
|
882
|
+
runtime, body, cwd, target, metadata, signal,
|
|
772
883
|
entry: entrySink,
|
|
773
884
|
interact: (request) => {
|
|
774
885
|
if (ctx.requestInteraction === undefined) {
|
|
775
|
-
throw new Error("
|
|
886
|
+
throw new Error("The execution's client interaction capability is unavailable.");
|
|
776
887
|
}
|
|
777
|
-
return ctx.requestInteraction(request);
|
|
888
|
+
return ctx.requestInteraction(request, signal);
|
|
778
889
|
},
|
|
779
|
-
env:
|
|
890
|
+
env: composed.env, // SPEC {§exec} {§exec-env-scoped}
|
|
780
891
|
write: (channel, chunk, mimetype) => enqueue(() => ChannelWrite.appendToChannel(db, {
|
|
892
|
+
producerWorkerId: ctx.workerId,
|
|
781
893
|
entryId, channel, chunk, mimetype, notify: ctx.streamEventNotify, coordinate,
|
|
782
894
|
})),
|
|
783
895
|
setState: (channel, state) => enqueue(() => ChannelWrite.setChannelState(db, {
|
|
896
|
+
producerWorkerId: ctx.workerId,
|
|
784
897
|
entryId, channel, state, notify: ctx.streamEventNotify, coordinate,
|
|
785
898
|
})),
|
|
786
899
|
emit: (event) => ctx.pushNotice?.(event),
|
|
787
900
|
});
|
|
901
|
+
input.close();
|
|
788
902
|
// Drain the queue so the subscription doesn't close before
|
|
789
903
|
// final chunk events / state transitions have committed.
|
|
790
904
|
await queue;
|
|
@@ -801,14 +915,19 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
801
915
|
}
|
|
802
916
|
}
|
|
803
917
|
catch (cause) {
|
|
804
|
-
|
|
805
|
-
//
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
918
|
+
input.close();
|
|
919
|
+
// {§executor-results} — an abort rejection is not an executor crash.
|
|
920
|
+
if (signal.aborted && (cause === signal.reason || (cause instanceof Error && cause.name === "AbortError"))) {
|
|
921
|
+
result = cancelled();
|
|
922
|
+
}
|
|
923
|
+
else {
|
|
924
|
+
console.error(`Executor '${runtime}' threw outside its operation result contract:`, cause);
|
|
925
|
+
result = Results.failure("scheme:exec", "executor-threw", 500, `The '${runtime}' executor failed outside its operation result contract.`, {}, {
|
|
926
|
+
runtime,
|
|
927
|
+
stage: "execution",
|
|
928
|
+
retryable: false,
|
|
929
|
+
});
|
|
930
|
+
}
|
|
812
931
|
}
|
|
813
932
|
const exitCode = typeof result.exitCode === "number" ? result.exitCode : null;
|
|
814
933
|
// A timeout aborts the spawn → the executor reports 499; replace the
|
|
@@ -824,11 +943,10 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
824
943
|
// spawn we reaped did not succeed, whatever it resolved under abort.
|
|
825
944
|
}
|
|
826
945
|
else if (signal.aborted && result.status < 400) {
|
|
827
|
-
result =
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
});
|
|
946
|
+
result = cancelled(exitCode ?? undefined);
|
|
947
|
+
}
|
|
948
|
+
else if (result.status >= 400 && exitCode === 127 && target === null) {
|
|
949
|
+
result = this.#namedToolFallThrough(result, runtime, body, ctx);
|
|
832
950
|
}
|
|
833
951
|
exitLabel = timedOut
|
|
834
952
|
? `timed out after ${(timeoutSec ?? 0) / 60}m`
|
|
@@ -883,7 +1001,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
883
1001
|
// executor result, but an exceptional failure remains observable.
|
|
884
1002
|
if (tempPath !== null) {
|
|
885
1003
|
await unlink(tempPath).catch((cause) => {
|
|
886
|
-
console.error(`
|
|
1004
|
+
console.error(`Execution source temporary cleanup failed for '${tempPath}':`, cause);
|
|
887
1005
|
});
|
|
888
1006
|
}
|
|
889
1007
|
this.#activeAborts.get(subscriptionId)?.unlink();
|
|
@@ -895,7 +1013,7 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
895
1013
|
if (ctx.wakeWorkerNotify !== undefined) {
|
|
896
1014
|
ctx.wakeWorkerNotify({
|
|
897
1015
|
workspaceId: ctx.workspaceId, workerId: ctx.workerId,
|
|
898
|
-
|
|
1016
|
+
entryId, target: `${runtime}://${pathname}`, subscriptionId, result,
|
|
899
1017
|
scheme: runtime,
|
|
900
1018
|
summary: `${runtime}://${pathname} completed (${exitLabel}); stdout=${stdoutLength} bytes, stderr=${stderrLength} bytes`,
|
|
901
1019
|
...coordinate,
|
|
@@ -904,49 +1022,34 @@ export default class Exec extends CoreSchemeAdapterBase {
|
|
|
904
1022
|
if (finalizationErrors.length === 1)
|
|
905
1023
|
throw finalizationErrors[0];
|
|
906
1024
|
if (finalizationErrors.length > 1) {
|
|
907
|
-
throw new AggregateError(finalizationErrors, `
|
|
1025
|
+
throw new AggregateError(finalizationErrors, `Execution narration ${completedNarration?.turnId ?? "unknown"} failed to settle`);
|
|
908
1026
|
}
|
|
909
1027
|
}
|
|
910
1028
|
return result;
|
|
911
1029
|
}
|
|
912
|
-
async resolveEntryAddress(target, ctx) {
|
|
913
|
-
if (target.kind !== "url")
|
|
914
|
-
return null;
|
|
915
|
-
const ownerId = await Owner.resolveStreamOwner(target.hostname, this.coreContext(ctx));
|
|
916
|
-
return ownerId === null
|
|
917
|
-
? Results.failure("scheme:exec", "stream-not-found", 404, "No visible stream exists at the requested address.")
|
|
918
|
-
: ownerId === ctx.workerId
|
|
919
|
-
? { authority: "", pathname: target.pathname }
|
|
920
|
-
: Results.failure("scheme:exec", "stream-not-found", 404, "The internal exec surface does not address another Worker's stream; use its runtime scheme.");
|
|
921
|
-
}
|
|
922
1030
|
async find(statement, ctx) {
|
|
923
1031
|
const core = this.coreContext(ctx);
|
|
924
|
-
|
|
925
|
-
if (owner === null) {
|
|
926
|
-
return Results.failure("scheme:exec", "stream-not-found", 404, "No visible stream exists at the requested address.", {
|
|
927
|
-
content: null, mimetype: null, results: [], itemsWeightTotal: 0, returnedItemsWeightTotal: 0,
|
|
928
|
-
matchingPathCount: 0, matchLocationCount: 0,
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
|
-
return EntryFind.findWorkspaceEntries(owner.statement, core, Exec.manifest, { ownerId: owner.ownerId });
|
|
1032
|
+
return EntryFind.findWorkspaceEntries(statement, core, _a.manifest, {});
|
|
932
1033
|
}
|
|
933
1034
|
async readEntry(pathname, ctx) {
|
|
934
1035
|
const core = this.coreContext(ctx);
|
|
935
1036
|
return "entries" in ctx
|
|
936
1037
|
? ctx.entries.read(pathname)
|
|
937
|
-
: EntryCrud.readEntry({ authority: "", pathname }, core,
|
|
1038
|
+
: EntryCrud.readEntry({ authority: "", pathname }, core, _a.manifest.name);
|
|
938
1039
|
}
|
|
939
1040
|
async writeEntry(pathname, entry, ctx) {
|
|
940
1041
|
const core = this.coreContext(ctx);
|
|
941
1042
|
return "entries" in ctx
|
|
942
1043
|
? ctx.entries.write(pathname, entry)
|
|
943
|
-
: EntryCrud.writeEntry({ authority: "", pathname }, entry, core,
|
|
1044
|
+
: EntryCrud.writeEntry({ authority: "", pathname }, entry, core, _a.manifest.name);
|
|
944
1045
|
}
|
|
945
1046
|
async deleteEntry(pathname, ctx) {
|
|
946
1047
|
const core = this.coreContext(ctx);
|
|
947
1048
|
return "entries" in ctx
|
|
948
1049
|
? ctx.entries.delete(pathname)
|
|
949
|
-
: EntryCrud.deleteEntry({ authority: "", pathname }, core,
|
|
1050
|
+
: EntryCrud.deleteEntry({ authority: "", pathname }, core, _a.manifest.name);
|
|
950
1051
|
}
|
|
951
1052
|
}
|
|
1053
|
+
_a = Exec;
|
|
1054
|
+
export default Exec;
|
|
952
1055
|
//# sourceMappingURL=Exec.js.map
|