@plurnk/plurnk-service 4.1.0 → 4.3.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 +3 -0
- package/INSTALL.md +7 -2
- package/README.md +3 -1
- package/SPEC.md +1996 -1370
- package/dist/build-info.d.ts.map +1 -1
- package/dist/build-info.js +25 -3
- package/dist/build-info.js.map +1 -1
- package/dist/build-info.json +1 -1
- package/dist/completions/_plurnk-service +2 -2
- package/dist/completions/plurnk-service.bash +2 -2
- package/dist/completions/plurnk-service.fish +2 -0
- package/dist/content/body-preview.js.map +1 -1
- package/dist/content/byte-view.d.ts.map +1 -1
- package/dist/content/byte-view.js +3 -2
- package/dist/content/byte-view.js.map +1 -1
- package/dist/content/edit-collision.d.ts +2 -1
- package/dist/content/edit-collision.d.ts.map +1 -1
- package/dist/content/edit-collision.js.map +1 -1
- package/dist/content/edit-receipt.d.ts.map +1 -1
- package/dist/content/edit-receipt.js +28 -23
- package/dist/content/edit-receipt.js.map +1 -1
- package/dist/content/edited-span.js +1 -1
- package/dist/content/edited-span.js.map +1 -1
- package/dist/content/line-anchors.d.ts +3 -2
- package/dist/content/line-anchors.d.ts.map +1 -1
- package/dist/content/line-anchors.js +33 -19
- package/dist/content/line-anchors.js.map +1 -1
- package/dist/content/line-selection.js.map +1 -1
- package/dist/content/pattern-edits.js +1 -1
- package/dist/content/pattern-edits.js.map +1 -1
- package/dist/content/read-projector.d.ts +1 -1
- package/dist/content/read-projector.d.ts.map +1 -1
- package/dist/content/read-projector.js +10 -8
- package/dist/content/read-projector.js.map +1 -1
- package/dist/content/read-resolve.d.ts.map +1 -1
- package/dist/content/read-resolve.js +6 -5
- package/dist/content/read-resolve.js.map +1 -1
- package/dist/core/AdmittedTurnExecutor.d.ts +4 -4
- package/dist/core/AdmittedTurnExecutor.d.ts.map +1 -1
- package/dist/core/AdmittedTurnExecutor.js +20 -18
- package/dist/core/AdmittedTurnExecutor.js.map +1 -1
- package/dist/core/AmbientMembers.d.ts +18 -0
- package/dist/core/AmbientMembers.d.ts.map +1 -0
- package/dist/core/AmbientMembers.js +84 -0
- package/dist/core/AmbientMembers.js.map +1 -0
- package/dist/core/BareBatchRunner.d.ts +1 -1
- package/dist/core/BareBatchRunner.d.ts.map +1 -1
- package/dist/core/BareBatchRunner.js +2 -2
- package/dist/core/BareBatchRunner.js.map +1 -1
- package/dist/core/CapabilityPolicies.js.map +1 -1
- package/dist/core/CapabilityResolver.d.ts +1 -2
- package/dist/core/CapabilityResolver.d.ts.map +1 -1
- package/dist/core/CapabilityResolver.js +11 -7
- package/dist/core/CapabilityResolver.js.map +1 -1
- package/dist/core/ChannelWrite.d.ts +2 -2
- package/dist/core/ChannelWrite.d.ts.map +1 -1
- package/dist/core/ChannelWrite.js.map +1 -1
- package/dist/core/ChannelWrite.sql +27 -0
- package/dist/core/ClientInteractions.js.map +1 -1
- package/dist/core/ContextFit.js +1 -1
- package/dist/core/ContextFit.js.map +1 -1
- package/dist/core/CoreSchemeServices.d.ts.map +1 -1
- package/dist/core/CoreSchemeServices.js +6 -4
- package/dist/core/CoreSchemeServices.js.map +1 -1
- package/dist/core/DataStatementRunner.d.ts.map +1 -1
- package/dist/core/DataStatementRunner.js +24 -15
- package/dist/core/DataStatementRunner.js.map +1 -1
- package/dist/core/Dispatcher.d.ts +29 -5
- package/dist/core/Dispatcher.d.ts.map +1 -1
- package/dist/core/Dispatcher.js +242 -132
- package/dist/core/Dispatcher.js.map +1 -1
- package/dist/core/EditMutations.d.ts.map +1 -1
- package/dist/core/EditMutations.js +12 -6
- package/dist/core/EditMutations.js.map +1 -1
- package/dist/core/EditSequence.js.map +1 -1
- package/dist/core/Engine.d.ts +12 -6
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +29 -7
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/ExecutionOutputs.js.map +1 -1
- package/dist/core/ExecutorRegistry.d.ts +1 -2
- package/dist/core/ExecutorRegistry.d.ts.map +1 -1
- package/dist/core/ExecutorRegistry.js +2 -2
- package/dist/core/ExecutorRegistry.js.map +1 -1
- package/dist/core/FileAddress.d.ts +1 -0
- package/dist/core/FileAddress.d.ts.map +1 -1
- package/dist/core/FileAddress.js +8 -1
- package/dist/core/FileAddress.js.map +1 -1
- package/dist/core/FilePublication.d.ts.map +1 -1
- package/dist/core/FilePublication.js +6 -3
- package/dist/core/FilePublication.js.map +1 -1
- package/dist/core/FileSnapshot.d.ts.map +1 -1
- package/dist/core/FileSnapshot.js +8 -5
- package/dist/core/FileSnapshot.js.map +1 -1
- package/dist/core/KillHandler.d.ts.map +1 -1
- package/dist/core/KillHandler.js +7 -0
- package/dist/core/KillHandler.js.map +1 -1
- package/dist/core/LiveSubscription.d.ts +1 -0
- package/dist/core/LiveSubscription.d.ts.map +1 -1
- package/dist/core/LiveSubscription.js +3 -2
- package/dist/core/LiveSubscription.js.map +1 -1
- package/dist/core/LiveSubscriptions.d.ts +4 -1
- package/dist/core/LiveSubscriptions.d.ts.map +1 -1
- package/dist/core/LiveSubscriptions.js +42 -1
- package/dist/core/LiveSubscriptions.js.map +1 -1
- package/dist/core/LogBody.d.ts.map +1 -1
- package/dist/core/LogBody.js +22 -19
- package/dist/core/LogBody.js.map +1 -1
- package/dist/core/LogVisibility.d.ts +1 -1
- package/dist/core/LogVisibility.d.ts.map +1 -1
- package/dist/core/LogVisibility.js +4 -6
- package/dist/core/LogVisibility.js.map +1 -1
- package/dist/core/LogWriter.d.ts.map +1 -1
- package/dist/core/LogWriter.js +6 -9
- package/dist/core/LogWriter.js.map +1 -1
- package/dist/core/LoopDriver.d.ts +4 -4
- package/dist/core/LoopDriver.d.ts.map +1 -1
- package/dist/core/LoopDriver.js +4 -5
- package/dist/core/LoopDriver.js.map +1 -1
- package/dist/core/LoopLifecycle.d.ts +2 -0
- package/dist/core/LoopLifecycle.d.ts.map +1 -1
- package/dist/core/LoopLifecycle.js +13 -3
- package/dist/core/LoopLifecycle.js.map +1 -1
- package/dist/core/LoopLifecycle.sql +4 -4
- package/dist/core/LoopOutcome.d.ts.map +1 -1
- package/dist/core/LoopOutcome.js +2 -2
- package/dist/core/LoopOutcome.js.map +1 -1
- package/dist/core/MembershipMaterialization.d.ts.map +1 -1
- package/dist/core/MembershipMaterialization.js +29 -29
- package/dist/core/MembershipMaterialization.js.map +1 -1
- package/dist/core/MessageResources.d.ts +5 -1
- package/dist/core/MessageResources.d.ts.map +1 -1
- package/dist/core/MessageResources.js +12 -0
- package/dist/core/MessageResources.js.map +1 -1
- package/dist/core/MessageResources.sql +8 -0
- package/dist/core/MutationEffects.d.ts +1 -0
- package/dist/core/MutationEffects.d.ts.map +1 -1
- package/dist/core/MutationEffects.js +14 -10
- package/dist/core/MutationEffects.js.map +1 -1
- package/dist/core/OperationHistory.d.ts.map +1 -1
- package/dist/core/OperationHistory.js +4 -3
- package/dist/core/OperationHistory.js.map +1 -1
- package/dist/core/OperatorConfig.d.ts.map +1 -1
- package/dist/core/OperatorConfig.js +3 -2
- package/dist/core/OperatorConfig.js.map +1 -1
- package/dist/core/PacketBuilder.d.ts +1 -1
- package/dist/core/PacketBuilder.d.ts.map +1 -1
- package/dist/core/PacketBuilder.js +7 -5
- package/dist/core/PacketBuilder.js.map +1 -1
- package/dist/core/ProblemLog.d.ts +2 -5
- package/dist/core/ProblemLog.d.ts.map +1 -1
- package/dist/core/ProblemLog.js +2 -3
- package/dist/core/ProblemLog.js.map +1 -1
- package/dist/core/ProposalLifecycle.d.ts +12 -11
- package/dist/core/ProposalLifecycle.d.ts.map +1 -1
- package/dist/core/ProposalLifecycle.js +92 -84
- package/dist/core/ProposalLifecycle.js.map +1 -1
- package/dist/core/ReasoningEvent.d.ts +2 -0
- package/dist/core/ReasoningEvent.d.ts.map +1 -1
- package/dist/core/ReplyMetadata.d.ts.map +1 -1
- package/dist/core/ReplyMetadata.js +4 -3
- package/dist/core/ReplyMetadata.js.map +1 -1
- package/dist/core/ResourceBindings.d.ts +2 -2
- package/dist/core/ResourceBindings.d.ts.map +1 -1
- package/dist/core/ResourceBindings.js.map +1 -1
- package/dist/core/ResourceMutations.d.ts +1 -1
- package/dist/core/ResourceMutations.d.ts.map +1 -1
- package/dist/core/ResourceMutations.js +1 -2
- package/dist/core/ResourceMutations.js.map +1 -1
- package/dist/core/ResourceSelector.js +2 -2
- package/dist/core/ResourceSelector.js.map +1 -1
- package/dist/core/ResourceTransfers.d.ts.map +1 -1
- package/dist/core/ResourceTransfers.js +162 -120
- package/dist/core/ResourceTransfers.js.map +1 -1
- package/dist/core/SchemeRegistry.d.ts +6 -5
- package/dist/core/SchemeRegistry.d.ts.map +1 -1
- package/dist/core/SchemeRegistry.js +32 -26
- package/dist/core/SchemeRegistry.js.map +1 -1
- package/dist/core/ServiceHelp.d.ts.map +1 -1
- package/dist/core/ServiceHelp.js +2 -1
- package/dist/core/ServiceHelp.js.map +1 -1
- package/dist/core/StoredPacket.d.ts.map +1 -1
- package/dist/core/StoredPacket.js +26 -19
- package/dist/core/StoredPacket.js.map +1 -1
- package/dist/core/StrikeRail.d.ts +1 -2
- package/dist/core/StrikeRail.d.ts.map +1 -1
- package/dist/core/StrikeRail.js +4 -4
- package/dist/core/StrikeRail.js.map +1 -1
- package/dist/core/TerminalResult.d.ts +0 -2
- package/dist/core/TerminalResult.d.ts.map +1 -1
- package/dist/core/TerminalResult.js +0 -18
- package/dist/core/TerminalResult.js.map +1 -1
- package/dist/core/ToolInputSchema.d.ts.map +1 -1
- package/dist/core/ToolInputSchema.js +2 -2
- 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 +7 -6
- package/dist/core/ToolResources.js.map +1 -1
- package/dist/core/TurnDispositionHandler.d.ts +1 -1
- package/dist/core/TurnDispositionHandler.d.ts.map +1 -1
- package/dist/core/TurnDispositionHandler.js +0 -1
- package/dist/core/TurnDispositionHandler.js.map +1 -1
- package/dist/core/TurnMaterialization.d.ts.map +1 -1
- package/dist/core/TurnMaterialization.js +3 -2
- package/dist/core/TurnMaterialization.js.map +1 -1
- package/dist/core/TurnRunner.d.ts +13 -12
- package/dist/core/TurnRunner.d.ts.map +1 -1
- package/dist/core/TurnRunner.js +197 -173
- package/dist/core/TurnRunner.js.map +1 -1
- package/dist/core/TurnRunner.sql +3 -3
- package/dist/core/WorkerOwners.js.map +1 -1
- package/dist/core/caps/DbEntryCaps.js.map +1 -1
- package/dist/core/caps/DbMessageCaps.d.ts +3 -3
- package/dist/core/caps/DbMessageCaps.d.ts.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.map +1 -1
- package/dist/core/caps/DbSubscriptionCaps.js +1 -0
- package/dist/core/caps/DbSubscriptionCaps.js.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.d.ts +1 -0
- package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.js +10 -1
- package/dist/core/caps/SchemeCtxImpl.js.map +1 -1
- package/dist/core/env-catalog.js.map +1 -1
- package/dist/core/env-defaults.d.ts.map +1 -1
- package/dist/core/env-defaults.js +5 -3
- package/dist/core/env-defaults.js.map +1 -1
- package/dist/core/file-creation-policy.d.ts.map +1 -1
- package/dist/core/file-creation-policy.js +2 -1
- package/dist/core/file-creation-policy.js.map +1 -1
- package/dist/core/file-materialization.d.ts.map +1 -1
- package/dist/core/file-materialization.js +9 -11
- package/dist/core/file-materialization.js.map +1 -1
- 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 +34 -3
- package/dist/core/git-env.js.map +1 -1
- package/dist/core/git-membership.d.ts +8 -0
- package/dist/core/git-membership.d.ts.map +1 -1
- package/dist/core/git-membership.js +107 -21
- 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 +1 -0
- package/dist/core/git-state.js.map +1 -1
- package/dist/core/notifications.d.ts +5 -0
- package/dist/core/notifications.d.ts.map +1 -1
- package/dist/core/packet-wire.d.ts +26 -21
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +150 -112
- 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 +6 -5
- package/dist/core/plurnk-uri.js.map +1 -1
- package/dist/core/results.d.ts +9 -4
- package/dist/core/results.d.ts.map +1 -1
- package/dist/core/results.js +14 -1
- package/dist/core/results.js.map +1 -1
- package/dist/core/runtime-floor.d.ts +8 -0
- package/dist/core/runtime-floor.d.ts.map +1 -0
- package/dist/core/runtime-floor.js +40 -0
- package/dist/core/runtime-floor.js.map +1 -0
- package/dist/core/runtime-guard.d.ts +2 -0
- package/dist/core/runtime-guard.d.ts.map +1 -0
- package/dist/core/runtime-guard.js +5 -0
- package/dist/core/runtime-guard.js.map +1 -0
- package/dist/core/scheme-types.d.ts +20 -0
- package/dist/core/scheme-types.d.ts.map +1 -1
- package/dist/core/sqlite-synchronous.d.ts +1 -1
- package/dist/core/sqlite-synchronous.d.ts.map +1 -1
- package/dist/core/sqlite-synchronous.js.map +1 -1
- package/dist/core/statement-primary.d.ts +2 -2
- package/dist/core/statement-primary.d.ts.map +1 -1
- package/dist/core/statement-primary.js.map +1 -1
- package/dist/core/workspace-settings.js +1 -1
- package/dist/core/workspace-settings.js.map +1 -1
- package/dist/evidence/EvidenceReader.d.ts.map +1 -1
- package/dist/evidence/EvidenceReader.js +20 -6
- package/dist/evidence/EvidenceReader.js.map +1 -1
- package/dist/launch/Launch.d.ts +1 -0
- package/dist/launch/Launch.d.ts.map +1 -1
- package/dist/launch/Launch.js +28 -12
- package/dist/launch/Launch.js.map +1 -1
- package/dist/man/plurnk-service.1 +12 -2
- package/dist/schemes/EffectPolicy.js +1 -1
- package/dist/schemes/EffectPolicy.js.map +1 -1
- package/dist/schemes/Env.d.ts +1 -1
- package/dist/schemes/Env.d.ts.map +1 -1
- package/dist/schemes/Env.js +7 -1
- package/dist/schemes/Env.js.map +1 -1
- package/dist/schemes/Exec.d.ts +10 -12
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +337 -437
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/ExecOutputScheme.d.ts +4 -6
- package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
- package/dist/schemes/ExecOutputScheme.js +17 -17
- package/dist/schemes/ExecOutputScheme.js.map +1 -1
- package/dist/schemes/ExecScheduler.d.ts.map +1 -1
- package/dist/schemes/ExecScheduler.js +1 -2
- package/dist/schemes/ExecScheduler.js.map +1 -1
- package/dist/schemes/ExecutionInput.js +3 -3
- package/dist/schemes/ExecutionInput.js.map +1 -1
- package/dist/schemes/File.d.ts +3 -18
- package/dist/schemes/File.d.ts.map +1 -1
- package/dist/schemes/File.js +148 -84
- package/dist/schemes/File.js.map +1 -1
- package/dist/schemes/Log.d.ts.map +1 -1
- package/dist/schemes/Log.js +193 -161
- package/dist/schemes/Log.js.map +1 -1
- package/dist/schemes/QuestionTool.d.ts.map +1 -1
- package/dist/schemes/QuestionTool.js +6 -8
- package/dist/schemes/QuestionTool.js.map +1 -1
- package/dist/schemes/ResourceTreeScheme.d.ts.map +1 -1
- package/dist/schemes/ResourceTreeScheme.js +2 -2
- package/dist/schemes/ResourceTreeScheme.js.map +1 -1
- package/dist/schemes/TurnSource.js +3 -3
- package/dist/schemes/TurnSource.js.map +1 -1
- package/dist/schemes/Worker.js.map +1 -1
- package/dist/schemes/_entry-crud.d.ts.map +1 -1
- package/dist/schemes/_entry-crud.js +4 -2
- package/dist/schemes/_entry-crud.js.map +1 -1
- package/dist/schemes/_entry-find.d.ts +2 -1
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +241 -130
- package/dist/schemes/_entry-find.js.map +1 -1
- package/dist/schemes/_entry-manifest.js +1 -1
- package/dist/schemes/_entry-manifest.js.map +1 -1
- package/dist/schemes/_entry-ops.js.map +1 -1
- package/dist/schemes/_search-index.js.map +1 -1
- package/dist/schemes/exec-entry-sink.d.ts +30 -0
- package/dist/schemes/exec-entry-sink.d.ts.map +1 -0
- package/dist/schemes/exec-entry-sink.js +238 -0
- package/dist/schemes/exec-entry-sink.js.map +1 -0
- package/dist/schemes/exec-lifetime.d.ts.map +1 -1
- package/dist/schemes/exec-lifetime.js +5 -2
- package/dist/schemes/exec-lifetime.js.map +1 -1
- package/dist/server/ClientOperations.d.ts +45 -0
- package/dist/server/ClientOperations.d.ts.map +1 -0
- package/dist/server/ClientOperations.js +192 -0
- package/dist/server/ClientOperations.js.map +1 -0
- package/dist/server/ClientReads.d.ts +13 -5
- package/dist/server/ClientReads.d.ts.map +1 -1
- package/dist/server/ClientReads.js +108 -21
- package/dist/server/ClientReads.js.map +1 -1
- package/dist/server/Credentials.js +2 -2
- package/dist/server/Credentials.js.map +1 -1
- package/dist/server/Daemon.d.ts +40 -28
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +263 -839
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/DaemonLock.d.ts +2 -0
- package/dist/server/DaemonLock.d.ts.map +1 -1
- package/dist/server/DaemonLock.js +10 -1
- package/dist/server/DaemonLock.js.map +1 -1
- package/dist/server/DaemonModules.d.ts +39 -0
- package/dist/server/DaemonModules.d.ts.map +1 -0
- package/dist/server/DaemonModules.js +219 -0
- package/dist/server/DaemonModules.js.map +1 -0
- package/dist/server/DrainSupervisor.d.ts +4 -2
- package/dist/server/DrainSupervisor.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.js +318 -290
- package/dist/server/DrainSupervisor.js.map +1 -1
- package/dist/server/EnvFunctionality.d.ts +10 -7
- package/dist/server/EnvFunctionality.d.ts.map +1 -1
- package/dist/server/EnvFunctionality.js +7 -5
- package/dist/server/EnvFunctionality.js.map +1 -1
- package/dist/server/Functionality.d.ts +4 -5
- package/dist/server/Functionality.d.ts.map +1 -1
- package/dist/server/Functionality.js +24 -15
- package/dist/server/Functionality.js.map +1 -1
- package/dist/server/HttpListener.d.ts.map +1 -1
- package/dist/server/HttpListener.js +28 -8
- package/dist/server/HttpListener.js.map +1 -1
- package/dist/server/MembersFunctionality.d.ts +19 -7
- package/dist/server/MembersFunctionality.d.ts.map +1 -1
- package/dist/server/MembersFunctionality.js +37 -17
- package/dist/server/MembersFunctionality.js.map +1 -1
- package/dist/server/MessageDelivery.d.ts +43 -0
- package/dist/server/MessageDelivery.d.ts.map +1 -0
- package/dist/server/MessageDelivery.js +186 -0
- package/dist/server/MessageDelivery.js.map +1 -0
- package/dist/server/ModuleHost.d.ts +3 -3
- package/dist/server/ModuleHost.d.ts.map +1 -1
- package/dist/server/Places.d.ts +19 -0
- package/dist/server/Places.d.ts.map +1 -0
- package/dist/server/Places.js +76 -0
- package/dist/server/Places.js.map +1 -0
- package/dist/server/PluginSources.d.ts.map +1 -1
- package/dist/server/PluginSources.js +2 -1
- package/dist/server/PluginSources.js.map +1 -1
- package/dist/server/PlurnkSkill.d.ts.map +1 -1
- package/dist/server/PlurnkSkill.js +5 -4
- package/dist/server/PlurnkSkill.js.map +1 -1
- package/dist/server/Rollback.d.ts.map +1 -1
- package/dist/server/Rollback.js +2 -1
- package/dist/server/Rollback.js.map +1 -1
- package/dist/server/WorkerModels.d.ts +83 -0
- package/dist/server/WorkerModels.d.ts.map +1 -0
- package/dist/server/WorkerModels.js +500 -0
- package/dist/server/WorkerModels.js.map +1 -0
- package/dist/server/WorkerOverview.d.ts +22 -0
- package/dist/server/WorkerOverview.d.ts.map +1 -0
- package/dist/server/WorkerOverview.js +42 -0
- package/dist/server/WorkerOverview.js.map +1 -0
- package/dist/server/WorkspacePlugins.d.ts +1 -1
- package/dist/server/WorkspacePlugins.d.ts.map +1 -1
- package/dist/server/WorkspacePlugins.js +0 -1
- package/dist/server/WorkspacePlugins.js.map +1 -1
- package/dist/server/WorkspaceResidency.d.ts +3 -3
- package/dist/server/WorkspaceResidency.d.ts.map +1 -1
- package/dist/server/WorkspaceResidency.js.map +1 -1
- package/dist/server/client-input.d.ts +2 -2
- package/dist/server/client-input.d.ts.map +1 -1
- package/dist/server/client-input.js +19 -12
- package/dist/server/client-input.js.map +1 -1
- package/dist/server/envelope.d.ts +4 -1
- package/dist/server/envelope.d.ts.map +1 -1
- package/dist/server/envelope.js +7 -3
- package/dist/server/envelope.js.map +1 -1
- package/dist/server/envelope.sql +10 -6
- package/dist/server/logEntry.d.ts +38 -1
- package/dist/server/logEntry.d.ts.map +1 -1
- package/dist/server/logEntry.js +9 -9
- package/dist/server/logEntry.js.map +1 -1
- package/dist/server/logEntry.sql +4 -2
- package/dist/server/loopDocs.d.ts.map +1 -1
- package/dist/server/loopDocs.js +11 -2
- package/dist/server/loopDocs.js.map +1 -1
- package/dist/server/module-discovery.d.ts +2 -3
- package/dist/server/module-discovery.d.ts.map +1 -1
- package/dist/server/module-discovery.js +6 -6
- package/dist/server/module-discovery.js.map +1 -1
- package/dist/server/places.sql +83 -0
- package/dist/server/seam-loop.sql +8 -0
- package/dist/server/worker-overview.sql +50 -0
- package/dist/service.d.ts +1 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +35 -9
- package/dist/service.js.map +1 -1
- package/docs/members.md +31 -33
- package/migrations/033_hidden_places.sql +10 -0
- package/package.json +48 -57
- package/dist/observe/init.d.ts +0 -8
- package/dist/observe/init.d.ts.map +0 -1
- package/dist/observe/init.js +0 -163
- package/dist/observe/init.js.map +0 -1
- package/dist/server/WorkerModelResolver.d.ts +0 -20
- package/dist/server/WorkerModelResolver.d.ts.map +0 -1
- package/dist/server/WorkerModelResolver.js +0 -200
- package/dist/server/WorkerModelResolver.js.map +0 -1
package/dist/core/Dispatcher.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { parsePath } from "@plurnk/plurnk-parser";
|
|
2
2
|
import { ConfigurationError, Knob } from "@plurnk/plurnk-meta";
|
|
3
|
-
import
|
|
3
|
+
import AmbientMembers from "./AmbientMembers.js";
|
|
4
|
+
import { TurnDisposition, UNKNOWN_POSITION, PathSyntax, Validator, isExecution, isRecord } from "@plurnk/plurnk-contracts";
|
|
4
5
|
import Turn from "./Turn.js";
|
|
5
6
|
import { entryAddress, foldAuthorityIntoPath, renderAddress, renderAuthoredTarget, renderTarget, schemeNameOf } from "./plurnk-uri.js";
|
|
6
7
|
import WorkerName from "./WorkerName.js";
|
|
7
|
-
import { PathSyntax } from "@plurnk/plurnk-contracts";
|
|
8
8
|
import Namespace from "./namespace.js";
|
|
9
9
|
import FileAddress from "./FileAddress.js";
|
|
10
10
|
import CapabilityResolver from "./CapabilityResolver.js";
|
|
11
11
|
import SchemeCtxImpl from "./caps/SchemeCtxImpl.js";
|
|
12
|
-
import
|
|
13
|
-
import Results from "./results.js";
|
|
14
|
-
import { OperationFailureError } from "./results.js";
|
|
12
|
+
import DbMessageCaps from "./caps/DbMessageCaps.js";
|
|
13
|
+
import Results, { OperationFailureError } from "./results.js";
|
|
15
14
|
import EffectPolicy from "../schemes/EffectPolicy.js";
|
|
16
|
-
import { CoreSchemeAdapterBase } from "./CoreSchemeServices.js";
|
|
15
|
+
import { CoreSchemeAdapterBase, coreRepresentationProvider } from "./CoreSchemeServices.js";
|
|
17
16
|
import { InvalidOperationResultError, MessageAttachments } from "@plurnk/plurnk-schemes";
|
|
18
17
|
import ResourceMutations from "./ResourceMutations.js";
|
|
19
18
|
import ResourceSelector from "./ResourceSelector.js";
|
|
20
19
|
import { primaryTargetOf } from "./statement-primary.js";
|
|
21
20
|
import LogBody from "./LogBody.js";
|
|
22
21
|
import BodyPreview from "../content/body-preview.js";
|
|
22
|
+
import LineSelection from "../content/line-selection.js";
|
|
23
23
|
import ReadResolve from "../content/read-resolve.js";
|
|
24
24
|
import LogVisibility from "./LogVisibility.js";
|
|
25
25
|
import PacketWire, {} from "./packet-wire.js";
|
|
@@ -36,13 +36,16 @@ import LogEntryProjection from "./LogEntryProjection.js";
|
|
|
36
36
|
import DurableStatement from "./DurableStatement.js";
|
|
37
37
|
import DataStatementRunner from "./DataStatementRunner.js";
|
|
38
38
|
import ResourceBindings from "./ResourceBindings.js";
|
|
39
|
-
import { isExecution } from "@plurnk/plurnk-contracts";
|
|
40
39
|
// SPEC {§scheme-surface}: writer must be in target scheme's manifest.writableBy.
|
|
41
40
|
// READ/FIND are not gated — they read, never mutating an entry.
|
|
42
41
|
const MUTATING_OPS = new Set(["EDIT", "SEND", "COPY", "MOVE", "KILL", "FORK", "WORK"]);
|
|
43
42
|
// Op dispatch ({§op-methods-op-dispatch}): admission, operation-owner routing,
|
|
44
43
|
// durable log writing, and proposal lifecycle.
|
|
45
44
|
export default class Dispatcher {
|
|
45
|
+
// {§log-kill-distillation} The log scheme curates: the hook the registry's log handler publishes.
|
|
46
|
+
static #curates(handler) {
|
|
47
|
+
return "curate" in handler && typeof handler.curate === "function";
|
|
48
|
+
}
|
|
46
49
|
static #failure(code, status, detail, fields = {}, extensions = {}) {
|
|
47
50
|
return Results.failure("engine:dispatcher", code, status, detail, fields, extensions);
|
|
48
51
|
}
|
|
@@ -274,7 +277,7 @@ export default class Dispatcher {
|
|
|
274
277
|
if (schemeName === null || schemeName === "log")
|
|
275
278
|
return null;
|
|
276
279
|
const handler = this.#schemes.get(schemeName, workspaceId);
|
|
277
|
-
if (handler === undefined || typeof handler.kill === "function")
|
|
280
|
+
if (handler === undefined || ("kill" in handler && typeof handler.kill === "function"))
|
|
278
281
|
return null;
|
|
279
282
|
const edit = {
|
|
280
283
|
op: "EDIT",
|
|
@@ -296,7 +299,8 @@ export default class Dispatcher {
|
|
|
296
299
|
await this.#operationEvent(context, "settled", execution.result);
|
|
297
300
|
return execution;
|
|
298
301
|
}
|
|
299
|
-
// {§file-path-normalization} Authored operands, once, before internal fan-out
|
|
302
|
+
// {§file-path-normalization} Authored operands, once, before internal fan-out: an absolute or home spelling
|
|
303
|
+
// whose canonical address reads differently — the key inside the root, the absolute path beyond it.
|
|
300
304
|
async #noticeFilePaths({ statement, origin, workspaceId, workerId, loopId }) {
|
|
301
305
|
if (origin !== "model" || isExecution(statement) || TurnDisposition.is(statement) || statement.op === "NOTE")
|
|
302
306
|
return;
|
|
@@ -320,7 +324,7 @@ export default class Dispatcher {
|
|
|
320
324
|
if (key === null)
|
|
321
325
|
continue;
|
|
322
326
|
const address = renderTarget({ scheme: null, pathname: key }, root, target);
|
|
323
|
-
if (address
|
|
327
|
+
if (address === null || address.startsWith("file://") || address === pathname)
|
|
324
328
|
continue;
|
|
325
329
|
this.#notices.push(workspaceId, workerId, loopId, {
|
|
326
330
|
source: "scheme:file", kind: "path_normalized", level: "warn",
|
|
@@ -345,7 +349,9 @@ export default class Dispatcher {
|
|
|
345
349
|
this.#loopSignal(context.loopId)?.throwIfAborted();
|
|
346
350
|
const execution = await ResourceBindings.using(this.#schemes, this.#buildSchemeCtx(context), (ctx) => this.#dispatchOne(context, ctx, targetsResolved));
|
|
347
351
|
let { result } = execution;
|
|
348
|
-
const edit = context.statement.op === "EDIT"
|
|
352
|
+
const edit = context.statement.op === "EDIT"
|
|
353
|
+
? context.statement
|
|
354
|
+
: context.statement.op === "KILL" ? this.#scopedEntryEdits.get(context.statement) : undefined;
|
|
349
355
|
if (edit !== undefined) {
|
|
350
356
|
// {§edit-batch-merges} — a proposal's apply result replaces the projected one; the
|
|
351
357
|
// statement's merge facts ride every EDIT result, whichever route produced it.
|
|
@@ -358,13 +364,13 @@ export default class Dispatcher {
|
|
|
358
364
|
// environment is the model's to retire, never the daemon's to drop.
|
|
359
365
|
const distillation = Dispatcher.#distillationOf(context.statement);
|
|
360
366
|
if (distillation !== null) {
|
|
361
|
-
const note = { op: "NOTE", aside: null, metadata: null, target: null, lineMarker: null, body: distillation, position: context.statement.position };
|
|
362
|
-
this.#distillations.set(note,
|
|
367
|
+
const note = { op: "NOTE", aside: null, metadata: null, target: null, lineMarker: null, body: distillation.body, position: context.statement.position };
|
|
368
|
+
this.#distillations.set(note, distillation.target);
|
|
363
369
|
const noteContext = { ...context, statement: note, sequence: context.sequence + 1 };
|
|
364
370
|
delete noteContext.fanout;
|
|
365
371
|
delete noteContext.emissionIndex;
|
|
366
372
|
await ResourceBindings.using(this.#schemes, this.#buildSchemeCtx(noteContext), (ctx) => this.#dispatchOne(noteContext, ctx));
|
|
367
|
-
result = Results.assert({ ...result, rowsWritten: (result
|
|
373
|
+
result = Results.assert({ ...result, rowsWritten: Results.rowsWritten(result) + 1 });
|
|
368
374
|
}
|
|
369
375
|
return { ...execution, result };
|
|
370
376
|
}
|
|
@@ -380,9 +386,17 @@ export default class Dispatcher {
|
|
|
380
386
|
return Results.failure("grammar:matcher", "unreadable-pattern", 400, unreadable.message, {}, { stage: "matcher", recovery: unreadable.recovery, retryable: false });
|
|
381
387
|
}
|
|
382
388
|
static #distillationOf(statement) {
|
|
383
|
-
if (statement.op !== "KILL" || schemeNameOf(statement.target) !== "log" || typeof statement.body !== "string")
|
|
389
|
+
if (statement.op !== "KILL" || statement.target === null || schemeNameOf(statement.target) !== "log" || typeof statement.body !== "string")
|
|
384
390
|
return null;
|
|
385
|
-
return statement.body.trim() === "" ? null : statement.body;
|
|
391
|
+
return statement.body.trim() === "" ? null : { body: statement.body, target: statement.target.raw };
|
|
392
|
+
}
|
|
393
|
+
// {§bulk-resource-targeting} — the paths a FIND matched: each catalog item's, never a scope group's.
|
|
394
|
+
static #matchedPaths(results) {
|
|
395
|
+
const items = Array.isArray(results) ? results : [];
|
|
396
|
+
return items.flatMap((item) => {
|
|
397
|
+
const head = Array.isArray(item) ? item[0] : undefined;
|
|
398
|
+
return isRecord(head) && !("items" in head) && typeof head.path === "string" ? [head.path] : [];
|
|
399
|
+
});
|
|
386
400
|
}
|
|
387
401
|
static #globTarget(target) {
|
|
388
402
|
if (target === null)
|
|
@@ -400,7 +414,7 @@ export default class Dispatcher {
|
|
|
400
414
|
if (found.status >= 400)
|
|
401
415
|
return { result: found };
|
|
402
416
|
const paths = found.status < 300
|
|
403
|
-
? (found.results
|
|
417
|
+
? Dispatcher.#matchedPaths(found.results)
|
|
404
418
|
: [];
|
|
405
419
|
const matched = typeof found.matchingPathCount === "number" ? found.matchingPathCount : paths.length;
|
|
406
420
|
if (survey.lineMarker !== null && matched !== paths.length) {
|
|
@@ -419,7 +433,7 @@ export default class Dispatcher {
|
|
|
419
433
|
if (statement.op === "COPY" || statement.op === "MOVE") {
|
|
420
434
|
if (![statement.source, statement.destination].some(({ target }) => Dispatcher.#globTarget(target)))
|
|
421
435
|
return null;
|
|
422
|
-
|
|
436
|
+
const resolved = { ...statement };
|
|
423
437
|
for (const operand of ["source", "destination"]) {
|
|
424
438
|
const selection = statement[operand];
|
|
425
439
|
if (!Dispatcher.#globTarget(selection.target))
|
|
@@ -432,7 +446,7 @@ export default class Dispatcher {
|
|
|
432
446
|
return found;
|
|
433
447
|
if (found.targets.length !== 1)
|
|
434
448
|
return { result: Dispatcher.#failure("target-cardinality", 400, `${statement.op} ${operand} matched ${found.matched} resources; expected one.`, {}, { operand, matchingPathCount: found.matched, recovery: "Name one source and one destination per pair.", retryable: false }) };
|
|
435
|
-
resolved
|
|
449
|
+
resolved[operand] = { ...selection, target: found.targets[0] };
|
|
436
450
|
}
|
|
437
451
|
return { statements: [resolved] };
|
|
438
452
|
}
|
|
@@ -471,7 +485,7 @@ export default class Dispatcher {
|
|
|
471
485
|
...(context.fit === undefined ? {} : { fit: reserved(context.fit, admitted.length - index - 1) }),
|
|
472
486
|
}, true);
|
|
473
487
|
results.push(result);
|
|
474
|
-
rowsWritten +=
|
|
488
|
+
rowsWritten += Results.rowsWritten(result);
|
|
475
489
|
if (context.failOnOperationError && result.status >= 400 && !isContextReceipt(result))
|
|
476
490
|
break;
|
|
477
491
|
}
|
|
@@ -486,6 +500,54 @@ export default class Dispatcher {
|
|
|
486
500
|
}
|
|
487
501
|
async #dispatchOne(context, schemeCtx, targetsResolved = false) {
|
|
488
502
|
const { statement, workspaceId, workerId, loopId, turnId, sequence, origin, onDispatch, } = context;
|
|
503
|
+
const routed = await this.#route(context, schemeCtx, targetsResolved);
|
|
504
|
+
let { result } = routed;
|
|
505
|
+
const { resolved, curationPlan } = routed;
|
|
506
|
+
// Child dispatch includes persistence and proposal settlement; their failures are
|
|
507
|
+
// internal, not exceptions from a scheme handler.
|
|
508
|
+
if (resolved !== null)
|
|
509
|
+
return this.#dispatchSelection(context, resolved);
|
|
510
|
+
if (result === undefined)
|
|
511
|
+
throw new Error("Operation dispatch produced neither targets nor a result.");
|
|
512
|
+
result = await this.#fitResult(context, statement, result);
|
|
513
|
+
// {§configuration-repair-path}: decide admission before persisting a proposed row.
|
|
514
|
+
const admission = this.#proposalAdmission(statement, result, workspaceId, origin);
|
|
515
|
+
const { autoAccept } = admission;
|
|
516
|
+
result = admission.result;
|
|
517
|
+
// {§bulk-resource-targeting} — a row on behalf of a glob names the statement it came from.
|
|
518
|
+
if (context.fanout !== undefined) {
|
|
519
|
+
const attrs = isRecord(result.attrs) ? result.attrs : {};
|
|
520
|
+
result = { ...result, attrs: { ...attrs, fanout: context.fanout } };
|
|
521
|
+
}
|
|
522
|
+
// Persist log curation for forensics; packet rendering suppresses its
|
|
523
|
+
// successful receipts while the exact state effects remain durable.
|
|
524
|
+
// A running-worker READ arms this turn's blocking collect.
|
|
525
|
+
// {§join-blocking-collect}
|
|
526
|
+
const logEntryId = await this.#logWriter.writeLog({
|
|
527
|
+
statement,
|
|
528
|
+
emissionIndex: context.emissionIndex,
|
|
529
|
+
result,
|
|
530
|
+
workspaceId,
|
|
531
|
+
workerId,
|
|
532
|
+
loopId,
|
|
533
|
+
turnId,
|
|
534
|
+
sequence,
|
|
535
|
+
origin,
|
|
536
|
+
curationPlan,
|
|
537
|
+
modelCallId: null,
|
|
538
|
+
});
|
|
539
|
+
onDispatch?.(logEntryId);
|
|
540
|
+
// {§proposal-202-pauses} A 202 that proposes (a WAIT parks instead — #isProposal) settles in its own step.
|
|
541
|
+
if (Dispatcher.#isProposal(statement, result))
|
|
542
|
+
return this.#settleProposedRow(context, schemeCtx, result, logEntryId, autoAccept);
|
|
543
|
+
await this.#notifySettled(context, logEntryId);
|
|
544
|
+
return Dispatcher.#singleExecution(result);
|
|
545
|
+
}
|
|
546
|
+
// {§op-methods-op-dispatch} The operation's owner, by statement: a refusal first — an unwritable target, a denied
|
|
547
|
+
// capability, an unreadable matcher — then the one handler whose result is the row's, or the target selection a
|
|
548
|
+
// glob resolves to. A scheme handler's exception is the row's 500 ({§scheme-surface-exception-500}), never a throw.
|
|
549
|
+
async #route(context, schemeCtx, targetsResolved) {
|
|
550
|
+
const { statement, workspaceId, workerId, loopId, turnId, sequence, origin } = context;
|
|
489
551
|
let result;
|
|
490
552
|
let resolved = null;
|
|
491
553
|
let curationPlan = null;
|
|
@@ -580,17 +642,15 @@ export default class Dispatcher {
|
|
|
580
642
|
}
|
|
581
643
|
}
|
|
582
644
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
result = await this.#fitResult(context, statement, result);
|
|
590
|
-
// {§configuration-repair-path}: decide admission before persisting a proposed row.
|
|
645
|
+
return { result, resolved, curationPlan };
|
|
646
|
+
}
|
|
647
|
+
// {§configuration-repair-path} {§runtime-bookkeeping-policy} Whether a proposal settles itself under the effect
|
|
648
|
+
// policy, decided before its row is persisted: an execution or a runtime-scheme SEND must declare its effect, the
|
|
649
|
+
// runtime actor never grants itself authority, and a policy the configuration cannot read is the row's failure.
|
|
650
|
+
#proposalAdmission(statement, result, workspaceId, origin) {
|
|
591
651
|
let autoAccept = false;
|
|
592
652
|
if (Dispatcher.#isProposal(statement, result)) {
|
|
593
|
-
const effect = result.attrs
|
|
653
|
+
const effect = isRecord(result.attrs) ? result.attrs.effect : undefined;
|
|
594
654
|
const mustDeclareEffect = isExecution(statement) || (statement.op === "SEND"
|
|
595
655
|
&& this.#schemes.isRuntimeScheme(schemeNameOf(statement.target) ?? "", workspaceId));
|
|
596
656
|
if (mustDeclareEffect || effect !== undefined) {
|
|
@@ -608,80 +668,18 @@ export default class Dispatcher {
|
|
|
608
668
|
}
|
|
609
669
|
}
|
|
610
670
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
result,
|
|
624
|
-
workspaceId,
|
|
625
|
-
workerId,
|
|
626
|
-
loopId,
|
|
627
|
-
turnId,
|
|
628
|
-
sequence,
|
|
629
|
-
origin,
|
|
630
|
-
curationPlan,
|
|
631
|
-
modelCallId: null,
|
|
632
|
-
});
|
|
633
|
-
onDispatch?.(logEntryId);
|
|
634
|
-
// Proposal lifecycle (SPEC.md {§engine-rails} + {§methods-proposal-resolve}; {§proposal-202-pauses}). When a
|
|
635
|
-
// side-effecting op returns status 202 (a WAIT parks rather
|
|
636
|
-
// than proposing — #isProposal), the entry is written
|
|
637
|
-
// state='proposed'; dispatch then PAUSES on a per-entry waiter until
|
|
638
|
-
// resolution arrives via Engine.resolveProposal (from a client-interface resume,
|
|
639
|
-
// core-owned disposition, or timeout). The post-resolution status replaces 202 in the
|
|
640
|
-
// result the caller sees, so runTurn never branches on a pending state.
|
|
641
|
-
if (Dispatcher.#isProposal(statement, result)) {
|
|
642
|
-
if (autoAccept) {
|
|
643
|
-
await this.#proposals.recordDecision(logEntryId, { decision: "accept" });
|
|
644
|
-
const initialSettlement = await this.#proposals.workerApply(statement, result, { decision: "accept" }, { workspaceId, workerId, loopId, turnId, logEntryId, resources: schemeCtx.resources });
|
|
645
|
-
const effective = await this.#resourceMutations.settleProposal({
|
|
646
|
-
statement,
|
|
647
|
-
result,
|
|
648
|
-
settlement: initialSettlement,
|
|
649
|
-
ctx: schemeCtx,
|
|
650
|
-
ids: { workspaceId, workerId, loopId, turnId, logEntryId },
|
|
651
|
-
});
|
|
652
|
-
const post = await this.#proposals.applyResolution(logEntryId, effective);
|
|
653
|
-
await this.#notifySettled(context, logEntryId);
|
|
654
|
-
return Dispatcher.#singleExecution(post);
|
|
655
|
-
}
|
|
656
|
-
// Register the resolution waiter SYNCHRONOUSLY before any await
|
|
657
|
-
// yields. A same-tick resolveProposal() (e.g. from a test that
|
|
658
|
-
// awaits the onDispatch callback and immediately resolves) must
|
|
659
|
-
// find the waiter registered — adding an await between insert
|
|
660
|
-
// and waiter-registration would open a race window.
|
|
661
|
-
// Core derives one validated projection from the durable row for both
|
|
662
|
-
// this live event and reconnect discovery ({§proposal-projection}). Its
|
|
663
|
-
// disposition is also the one automatic settlement decision: policy is
|
|
664
|
-
// not an observer and cannot silently degrade into client ownership.
|
|
665
|
-
let resolutionPromise;
|
|
666
|
-
try {
|
|
667
|
-
resolutionPromise = this.#proposals.awaitResolution(logEntryId, this.#loopSignal(loopId));
|
|
668
|
-
const event = await this.#proposals.pending(logEntryId);
|
|
669
|
-
if (event !== null) {
|
|
670
|
-
this.#proposals.settleOwned(event);
|
|
671
|
-
this.#proposals.notifyPending(event);
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
catch (cause) {
|
|
675
|
-
await this.#proposals.failPreparation(logEntryId, cause);
|
|
676
|
-
await this.#notifySettled(context, logEntryId);
|
|
677
|
-
throw cause;
|
|
678
|
-
}
|
|
679
|
-
const resolution = await resolutionPromise;
|
|
680
|
-
// Run the scheme's applyResolution hook on accept (writes the
|
|
681
|
-
// file, spawns the process, etc.). Its operation result is
|
|
682
|
-
// preserved: an apply failure keeps its original status and
|
|
683
|
-
// Problem Details instead of masquerading as a client rejection.
|
|
684
|
-
const initialSettlement = await this.#proposals.workerApply(statement, result, resolution, { workspaceId, workerId, loopId, turnId, logEntryId, resources: schemeCtx.resources });
|
|
671
|
+
return { autoAccept, result };
|
|
672
|
+
}
|
|
673
|
+
// Proposal lifecycle (SPEC.md {§engine-rails} + {§methods-proposal-resolve}; {§proposal-202-pauses}). A
|
|
674
|
+
// side-effecting op that returned 202 was written state='proposed'; an automatic acceptance applies at once,
|
|
675
|
+
// otherwise dispatch PAUSES on a per-entry waiter until resolution arrives via Engine.resolveProposal (a client
|
|
676
|
+
// resume, core-owned disposition, or timeout). The post-resolution status replaces 202 in the result the caller
|
|
677
|
+
// sees, so runTurn never branches on a pending state.
|
|
678
|
+
async #settleProposedRow(context, schemeCtx, result, logEntryId, autoAccept) {
|
|
679
|
+
const { statement, workspaceId, workerId, loopId, turnId } = context;
|
|
680
|
+
if (autoAccept) {
|
|
681
|
+
await this.#proposals.recordDecision(logEntryId, { decision: "accept" });
|
|
682
|
+
const initialSettlement = await this.#applyProposal(context, schemeCtx, result, { decision: "accept" }, logEntryId);
|
|
685
683
|
const effective = await this.#resourceMutations.settleProposal({
|
|
686
684
|
statement,
|
|
687
685
|
result,
|
|
@@ -693,8 +691,45 @@ export default class Dispatcher {
|
|
|
693
691
|
await this.#notifySettled(context, logEntryId);
|
|
694
692
|
return Dispatcher.#singleExecution(post);
|
|
695
693
|
}
|
|
694
|
+
// Register the resolution waiter SYNCHRONOUSLY before any await
|
|
695
|
+
// yields. A same-tick resolveProposal() (e.g. from a test that
|
|
696
|
+
// awaits the onDispatch callback and immediately resolves) must
|
|
697
|
+
// find the waiter registered — adding an await between insert
|
|
698
|
+
// and waiter-registration would open a race window.
|
|
699
|
+
// Core derives one validated projection from the durable row for both
|
|
700
|
+
// this live event and reconnect discovery ({§proposal-projection}). Its
|
|
701
|
+
// disposition is also the one automatic settlement decision: policy is
|
|
702
|
+
// not an observer and cannot silently degrade into client ownership.
|
|
703
|
+
let resolutionPromise;
|
|
704
|
+
try {
|
|
705
|
+
resolutionPromise = this.#proposals.awaitResolution(logEntryId, this.#loopSignal(loopId));
|
|
706
|
+
const event = await this.#proposals.pending(logEntryId);
|
|
707
|
+
if (event !== null) {
|
|
708
|
+
this.#proposals.settleOwned(event);
|
|
709
|
+
this.#proposals.notifyPending(event);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
catch (cause) {
|
|
713
|
+
await this.#proposals.failPreparation(logEntryId, cause);
|
|
714
|
+
await this.#notifySettled(context, logEntryId);
|
|
715
|
+
throw cause;
|
|
716
|
+
}
|
|
717
|
+
const resolution = await resolutionPromise;
|
|
718
|
+
// Run the scheme's applyResolution hook on accept (writes the
|
|
719
|
+
// file, spawns the process, etc.). Its operation result is
|
|
720
|
+
// preserved: an apply failure keeps its original status and
|
|
721
|
+
// Problem Details instead of masquerading as a client rejection.
|
|
722
|
+
const initialSettlement = await this.#applyProposal(context, schemeCtx, result, resolution, logEntryId);
|
|
723
|
+
const effective = await this.#resourceMutations.settleProposal({
|
|
724
|
+
statement,
|
|
725
|
+
result,
|
|
726
|
+
settlement: initialSettlement,
|
|
727
|
+
ctx: schemeCtx,
|
|
728
|
+
ids: { workspaceId, workerId, loopId, turnId, logEntryId },
|
|
729
|
+
});
|
|
730
|
+
const post = await this.#proposals.applyResolution(logEntryId, effective);
|
|
696
731
|
await this.#notifySettled(context, logEntryId);
|
|
697
|
-
return Dispatcher.#singleExecution(
|
|
732
|
+
return Dispatcher.#singleExecution(post);
|
|
698
733
|
}
|
|
699
734
|
// {§context-fit} — a result the model asked for arrives whole when it fits the remaining budget;
|
|
700
735
|
// otherwise the row is its size and address — a READ of lines above the longest prefix of them that
|
|
@@ -710,15 +745,15 @@ export default class Dispatcher {
|
|
|
710
745
|
const tokens = await this.#rowTokens(context, statement, result);
|
|
711
746
|
if (tokens <= remaining)
|
|
712
747
|
return result;
|
|
713
|
-
const
|
|
714
|
-
const
|
|
748
|
+
const range = result.range === undefined ? undefined : Validator.assertRangeExtent(result.range);
|
|
749
|
+
const size = resultSize({ range, content: result.content });
|
|
715
750
|
const retained = statement.op === "READ"
|
|
716
751
|
? { content: null, mimetype: null, channel: result.channel ?? null, ...(range === undefined ? {} : { range }) }
|
|
717
752
|
: { ...(range === undefined ? {} : { range }), ...Object.fromEntries(["matchingPathCount", "matchLocationCount", "itemsWeightTotal"].flatMap((key) => key in result ? [[key, result[key]]] : [])) };
|
|
718
753
|
const receipt = (delivered) => unfitResult(retained, size, tokens, remaining, statement.op, delivered);
|
|
719
754
|
if (statement.op !== "READ" || size.unit !== "line")
|
|
720
755
|
return receipt(0);
|
|
721
|
-
const whole = result;
|
|
756
|
+
const whole = { ...result, content: result.content };
|
|
722
757
|
const withPrefix = (count) => {
|
|
723
758
|
const prefix = resultPrefix(whole, count);
|
|
724
759
|
const carried = Object.fromEntries(["content", "mimetype", "startLine", "lineAnchors", "lineNumberWidth", "lineOrdinals", "matches", "range"]
|
|
@@ -753,35 +788,81 @@ export default class Dispatcher {
|
|
|
753
788
|
await context.onSettled?.(logEntryId);
|
|
754
789
|
await this.#notify.operationSettledNotify?.(context.workspaceId, logEntryId);
|
|
755
790
|
}
|
|
791
|
+
// {§actor-boundary-catalog-preview} Whether a survey selects anything: its FIND run through the scheme context and
|
|
792
|
+
// owner its dispatch would use, writing no row. A survey the FIND refuses counts as selecting, so its dispatch reports it.
|
|
793
|
+
async selects(survey, ids) {
|
|
794
|
+
const found = await ResourceBindings.using(this.#schemes, this.#buildSchemeCtx(ids), (ctx) => this.#dataRun.run(schemeNameOf(survey.target), survey, ctx));
|
|
795
|
+
return found.status >= 300 || !Array.isArray(found.results) || found.results.length > 0;
|
|
796
|
+
}
|
|
756
797
|
capabilityProjection(workspaceId) {
|
|
757
798
|
return this.#capabilities.projection(workspaceId);
|
|
758
799
|
}
|
|
759
|
-
//
|
|
760
|
-
//
|
|
761
|
-
//
|
|
762
|
-
|
|
800
|
+
// {§client-entry-address} A client read acquires `target` as exact READ does, from the worker's perspective: the
|
|
801
|
+
// representation a core scheme computes, or a data entry. Only core's own acquisition runs for it: a core scheme's
|
|
802
|
+
// preparation, and the materialization of a message core retains, whichever module minted its address
|
|
803
|
+
// ({§message-source-scheme}); never an extension's. Null for a target no data or computing scheme claims.
|
|
804
|
+
async readClientEntry(context) {
|
|
763
805
|
const { target, workspaceId, workerId } = context;
|
|
764
|
-
const
|
|
765
|
-
|
|
766
|
-
workerId,
|
|
767
|
-
loopId: 0,
|
|
768
|
-
turnId: 0,
|
|
769
|
-
origin: "client",
|
|
770
|
-
});
|
|
771
|
-
const resolved = await this.bindEntryAddress(target, coreCtx);
|
|
772
|
-
if (resolved === null)
|
|
773
|
-
return null;
|
|
774
|
-
if (resolved.address === null)
|
|
806
|
+
const routedScheme = schemeNameOf(target);
|
|
807
|
+
if (routedScheme === null)
|
|
775
808
|
return null;
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
809
|
+
const coreCtx = this.#buildSchemeCtx({ workspaceId, workerId, loopId: 0, turnId: 0, origin: "client" });
|
|
810
|
+
return ResourceBindings.using(this.#schemes, coreCtx, async (ctx) => {
|
|
811
|
+
try {
|
|
812
|
+
const binding = await ResourceBindings.resolve(target, ctx);
|
|
813
|
+
if (binding === undefined)
|
|
814
|
+
return null;
|
|
815
|
+
const neutral = target.kind === "url"
|
|
816
|
+
? { ...target, raw: renderTarget({ ...target, fragment: null }) ?? target.raw, fragment: null }
|
|
817
|
+
: target;
|
|
818
|
+
const computing = coreRepresentationProvider(binding.handler);
|
|
819
|
+
if (computing !== null) {
|
|
820
|
+
const resolved = await computing.resolveCoreRepresentation(neutral, ctx);
|
|
821
|
+
if ("result" in resolved)
|
|
822
|
+
return resolved.result.status >= 400 ? { kind: "refused", result: resolved.result } : null;
|
|
823
|
+
return { kind: "computed", target: resolved.identity ?? renderAuthoredTarget(neutral), channels: this.#computedChannels(resolved) };
|
|
824
|
+
}
|
|
825
|
+
if (binding.manifest.category !== "data")
|
|
826
|
+
return null;
|
|
827
|
+
const handler = binding.handler;
|
|
828
|
+
const coreScheme = this.#schemes.coreOwns(routedScheme);
|
|
829
|
+
const resolved = coreScheme
|
|
830
|
+
? await this.#prepareDataRepresentation({ target, metadata: null, routedScheme, handler, manifest: binding.manifest, ctx, publishedChannel: null })
|
|
831
|
+
: await this.#resolveDataEntryAddress({ target, routedScheme, handler, manifest: binding.manifest, ctx });
|
|
832
|
+
if (resolved.result !== null && resolved.result.status >= 400)
|
|
833
|
+
return { kind: "refused", result: resolved.result };
|
|
834
|
+
if (resolved.address === null)
|
|
835
|
+
return null;
|
|
836
|
+
if (!coreScheme) {
|
|
837
|
+
const retained = await new DbMessageCaps(ctx, routedScheme).prepare(neutral.raw);
|
|
838
|
+
if (retained.status >= 400 && retained.status !== 404)
|
|
839
|
+
return { kind: "refused", result: retained };
|
|
840
|
+
}
|
|
841
|
+
const rendered = resolved.address.scheme === "file"
|
|
842
|
+
? entryAddress("file", "", resolved.address.pathname, await this.#workspaceRoot(workspaceId))
|
|
843
|
+
: renderAuthoredTarget(neutral);
|
|
844
|
+
return { kind: "stored", address: {
|
|
845
|
+
scheme: resolved.address.scheme,
|
|
846
|
+
authority: resolved.address.authority,
|
|
847
|
+
pathname: resolved.address.pathname,
|
|
848
|
+
target: rendered,
|
|
849
|
+
} };
|
|
850
|
+
}
|
|
851
|
+
catch (error) {
|
|
852
|
+
if (error instanceof OperationFailureError)
|
|
853
|
+
return { kind: "refused", result: error.result };
|
|
854
|
+
throw error;
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
// {§client-entry-address} {§log-readable-projection} A computed representation's channels as a client reads them:
|
|
859
|
+
// deliberate trimming applied, each weighed as a stored channel is.
|
|
860
|
+
#computedChannels(resolved) {
|
|
861
|
+
return Object.fromEntries(Object.entries(resolved.representation.channels).map(([name, { content, mimetype, state }]) => {
|
|
862
|
+
const retained = resolved.visibleLines?.[name];
|
|
863
|
+
const visible = retained === undefined ? content : LineSelection.retain(content, retained).content;
|
|
864
|
+
return [name, { content: visible, mimetype, state, weight: visible.length === 0 ? 0 : this.#weighContent(visible) }];
|
|
865
|
+
}));
|
|
785
866
|
}
|
|
786
867
|
async bindEntryAddress(target, ctx) {
|
|
787
868
|
const routedScheme = schemeNameOf(target);
|
|
@@ -905,6 +986,14 @@ export default class Dispatcher {
|
|
|
905
986
|
defaultChannelFor: (scheme) => this.#schemes.defaultChannelFor(scheme, context.workspaceId),
|
|
906
987
|
settleDerivations: () => this.#settleDerivations(context),
|
|
907
988
|
pushNotice: (notice) => this.#notices.push(workspaceId, workerId, loopId, notice),
|
|
989
|
+
// {§membership-auto-add} — the model's reads reach the untracked universe and admit what they read.
|
|
990
|
+
...(origin === "model" && this.#notify.admitMembers !== undefined && AmbientMembers.enabled() ? {
|
|
991
|
+
ambientMembers: AmbientMembers.seam({
|
|
992
|
+
db: this.#db, workspaceId, signal: this.#loopSignal(loopId), mimetypes: this.#mimetypes,
|
|
993
|
+
admit: (files) => this.#notify.admitMembers({ workspaceId, workerId }, files),
|
|
994
|
+
notice: (notice) => this.#notices.push(workspaceId, workerId, loopId, notice),
|
|
995
|
+
}),
|
|
996
|
+
} : {}),
|
|
908
997
|
requestInteraction: (request, signal = this.#loopSignal(loopId)) => this.#interactions.request(request, { workspaceId, workerId, loopId, turnId }, signal),
|
|
909
998
|
executors: this.#executors(),
|
|
910
999
|
};
|
|
@@ -1336,7 +1425,8 @@ export default class Dispatcher {
|
|
|
1336
1425
|
plan: null,
|
|
1337
1426
|
};
|
|
1338
1427
|
}
|
|
1339
|
-
const
|
|
1428
|
+
const registered = this.#schemes.get("log");
|
|
1429
|
+
const handler = registered !== undefined && Dispatcher.#curates(registered) ? registered : undefined;
|
|
1340
1430
|
const manifest = this.#schemes.manifestFor("log");
|
|
1341
1431
|
if (handler === undefined || manifest === undefined) {
|
|
1342
1432
|
throw new Error("the core log curation owner is not registered");
|
|
@@ -1352,6 +1442,26 @@ export default class Dispatcher {
|
|
|
1352
1442
|
return { result: Results.assert(outcome.result), plan: outcome.plan };
|
|
1353
1443
|
}
|
|
1354
1444
|
// {§proposal}/{§send} — native dispositions park; other 202 results propose.
|
|
1445
|
+
// {§proposal-accept-applies} — an accepted proposal runs its scheme's effect; an accepted admission
|
|
1446
|
+
// ({§membership-auto-add}) admits the files the read reached and runs that read or find again, and the
|
|
1447
|
+
// operation's own result is what the row records.
|
|
1448
|
+
async #applyProposal(context, schemeCtx, result, resolution, logEntryId) {
|
|
1449
|
+
const { statement, workspaceId, workerId, loopId, turnId } = context;
|
|
1450
|
+
const admission = AmbientMembers.admissionOf(result);
|
|
1451
|
+
if (admission === null || (statement.op !== "READ" && statement.op !== "FIND")) {
|
|
1452
|
+
return this.#proposals.workerApply(statement, result, resolution, { workspaceId, workerId, loopId, turnId, logEntryId, resources: schemeCtx.resources });
|
|
1453
|
+
}
|
|
1454
|
+
if (resolution.decision !== "accept")
|
|
1455
|
+
return { resolution };
|
|
1456
|
+
// What the members scope refuses stays unadmitted, and the operation run again misses it as a non-member.
|
|
1457
|
+
if (schemeCtx.ambientMembers !== undefined)
|
|
1458
|
+
await schemeCtx.ambientMembers.admit(admission);
|
|
1459
|
+
const rerun = await this.#fitResult(context, statement, await this.#dataRun.run(schemeNameOf(statement.target), statement, schemeCtx));
|
|
1460
|
+
// {§proposal-projection} — the accepted row is composed from `resolution.result`: the operation's own
|
|
1461
|
+
// payload rides there, and a failed run again is the applied result as it stands.
|
|
1462
|
+
const { status: _status, problem: _problem, error: _error, ...payload } = rerun;
|
|
1463
|
+
return { resolution: { ...resolution, result: payload }, applied: rerun };
|
|
1464
|
+
}
|
|
1355
1465
|
static #isProposal(statement, result) {
|
|
1356
1466
|
if (result.status !== 202)
|
|
1357
1467
|
return false;
|