@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/schemes/Log.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PathSyntax, } from "@plurnk/plurnk-contracts";
|
|
1
|
+
import { isRecord, PathSyntax, } from "@plurnk/plurnk-contracts";
|
|
2
2
|
import Matcher from "../content/matcher.js";
|
|
3
3
|
import { emptyFindFields, projectFindResult } from "./_entry-find.js";
|
|
4
4
|
import { CoreSchemeAdapterBase } from "../core/CoreSchemeServices.js";
|
|
@@ -252,12 +252,15 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
252
252
|
mimetypeRx: row.mimetype_rx,
|
|
253
253
|
});
|
|
254
254
|
const trimmed = LogVisibility.parse(row.folded);
|
|
255
|
-
const
|
|
256
|
-
const
|
|
257
|
-
const
|
|
255
|
+
const attrs = JSON.parse(row.attrs);
|
|
256
|
+
const stream = isRecord(attrs) ? attrs.stream : undefined;
|
|
257
|
+
const parsed = row.mimetype_rx === "application/json" ? JSON.parse(row.rx) : {};
|
|
258
|
+
const result = isRecord(parsed) ? parsed : {};
|
|
259
|
+
const mediaValue = result.image ?? result.document ?? result.audio;
|
|
260
|
+
const media = isRecord(mediaValue) ? mediaValue : undefined;
|
|
258
261
|
const attributes = {
|
|
259
262
|
...(typeof stream === "string" ? { stream } : {}),
|
|
260
|
-
...(typeof result.nativeContentHash === "string" && media?.mimetype
|
|
263
|
+
...(typeof result.nativeContentHash === "string" && typeof media?.mimetype === "string"
|
|
261
264
|
? { nativeContentHash: result.nativeContentHash, sourceProjection: { mimetype: media.mimetype, facts: media } }
|
|
262
265
|
: {}),
|
|
263
266
|
};
|
|
@@ -297,18 +300,59 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
297
300
|
return this.#find(statement, core, false, null);
|
|
298
301
|
}
|
|
299
302
|
async #find(statement, core, allowTargetless = false, maxLogEntryId = null) {
|
|
300
|
-
const { db, workerId
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
303
|
+
const { db, workerId } = core;
|
|
304
|
+
const found = await this.#findScope(statement, core, allowTargetless, maxLogEntryId);
|
|
305
|
+
if ("status" in found)
|
|
306
|
+
return found;
|
|
307
|
+
const { scope, glob } = found;
|
|
308
|
+
const selected = await Log.#selectLogCandidates(db, workerId, scope, glob, maxLogEntryId);
|
|
309
|
+
if ("status" in selected)
|
|
310
|
+
return selected;
|
|
311
|
+
const { candidateRows, rows } = selected;
|
|
312
|
+
const candidateByCanonicalCoord = new Map(candidateRows.map((row) => [LogEntryProjection.base(row.coordinate), row]));
|
|
313
|
+
const projectedByCoordinate = new Map(candidateRows.map((r) => [r.coordinate, {
|
|
314
|
+
key: r.coordinate,
|
|
315
|
+
...LogBody.readable({
|
|
316
|
+
op: r.op,
|
|
317
|
+
attrs: r.attrs,
|
|
318
|
+
tx: r.tx,
|
|
319
|
+
rx: r.rx,
|
|
320
|
+
mimetypeTx: r.mimetype_tx,
|
|
321
|
+
mimetypeRx: r.mimetype_rx,
|
|
322
|
+
}, LogVisibility.parse(r.folded)),
|
|
323
|
+
}]));
|
|
324
|
+
const projected = rows.map((row) => projectedByCoordinate.get(row.coordinate));
|
|
325
|
+
const weigh = core.weigh ?? contentWeight;
|
|
326
|
+
const settled = await Log.#settleIndexedCandidates(statement, core, rows, scope, maxLogEntryId);
|
|
327
|
+
const matches = await Log.#selectLogMatches(statement, core, settled, projected, maxLogEntryId);
|
|
328
|
+
if ("status" in matches)
|
|
329
|
+
return matches;
|
|
330
|
+
return Log.#projectLogFind(statement, scope, matches, { candidateRows, projectedByCoordinate, candidateByCanonicalCoord }, weigh);
|
|
331
|
+
}
|
|
332
|
+
// A FIND result with no items: the status alone, or the failure a status of 400 and above must explain.
|
|
333
|
+
static #emptyFind(status, detail, extensions = {}) {
|
|
334
|
+
const fields = emptyFindFields();
|
|
335
|
+
if (status >= 400 && detail === undefined) {
|
|
336
|
+
throw new Error(`Log.find: selection returned status ${status} without Problem Details or a diagnostic`);
|
|
337
|
+
}
|
|
338
|
+
return status >= 400
|
|
339
|
+
? Results.failure("scheme:log", status === 404 ? "entry-not-found" : status === 416 ? "range-not-satisfiable" : status === 501 ? "matcher-not-implemented" : "find-failed", status, detail, fields, extensions)
|
|
340
|
+
: { status, ...fields };
|
|
341
|
+
}
|
|
342
|
+
// {§relation-indexed-dialects} An indexed dialect over rows the index does not yet cover.
|
|
343
|
+
static #incompleteIndex(search, what) {
|
|
344
|
+
return Log.#emptyFind(503, `The persistent search index covers ${search.indexed} of ${search.total} ${what}.`, {
|
|
345
|
+
search,
|
|
346
|
+
stage: "search-index",
|
|
347
|
+
recovery: "Wait for search indexing to complete before repeating the search.",
|
|
348
|
+
retryable: false,
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
// {§log-coordinate-hierarchy} The scope the target names: a coordinate, a prefix or a glob, refused when
|
|
352
|
+
// malformed; an exact coordinate that names no row is the miss with its near miss.
|
|
353
|
+
async #findScope(statement, core, allowTargetless, maxLogEntryId) {
|
|
310
354
|
if (statement.target === null && !allowTargetless) {
|
|
311
|
-
return
|
|
355
|
+
return Log.#emptyFind(400, "FIND requires a log target.", {
|
|
312
356
|
recovery: "Provide a log coordinate, prefix, or glob.",
|
|
313
357
|
retryable: false,
|
|
314
358
|
});
|
|
@@ -318,7 +362,7 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
318
362
|
: (statement.target.kind === "url" ? statement.target.pathname : statement.target.raw).replace(/^\//, "");
|
|
319
363
|
const glob = coordinateGlob(normalizeLogTarget(pathname));
|
|
320
364
|
if (glob === null) {
|
|
321
|
-
return
|
|
365
|
+
return Log.#emptyFind(400, `The log target '${pathname}' is malformed.`, {
|
|
322
366
|
target: pathname,
|
|
323
367
|
recovery: LOG_TARGET_SHAPE,
|
|
324
368
|
retryable: false,
|
|
@@ -331,9 +375,14 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
331
375
|
throw new Error(`Exact log scope has a malformed coordinate ${JSON.stringify(scope.pathname)}`);
|
|
332
376
|
if (await this.#resolveExactId(coordinate, core, maxLogEntryId) === null) {
|
|
333
377
|
const recovery = await nearMissRecovery(coordinate, core, maxLogEntryId);
|
|
334
|
-
return
|
|
378
|
+
return Log.#emptyFind(404, `No log entry exists at ${statement.target?.raw ?? `log:///${scope.pathname}`}.`, { target: statement.target?.raw ?? `log:///${scope.pathname}`, ...(recovery === undefined ? {} : { recovery }) });
|
|
335
379
|
}
|
|
336
380
|
}
|
|
381
|
+
return { scope, glob };
|
|
382
|
+
}
|
|
383
|
+
// The candidate rows under the scope: the coordinate-scoped superset, then the shell-glob truth over it,
|
|
384
|
+
// which refuses a malformed glob by name.
|
|
385
|
+
static async #selectLogCandidates(db, workerId, scope, glob, maxLogEntryId) {
|
|
337
386
|
const storedCandidateRows = await db.log_find_candidates.all({
|
|
338
387
|
worker_id: workerId,
|
|
339
388
|
scope_prefix: coordinateCandidatePrefix(scope.candidatePrefix),
|
|
@@ -345,26 +394,18 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
345
394
|
rows = candidateRows.filter((row) => coordinateScopeMatches(scope, row.coordinate));
|
|
346
395
|
}
|
|
347
396
|
catch {
|
|
348
|
-
return
|
|
397
|
+
return Log.#emptyFind(400, `The log glob '${glob}' is malformed.`, {
|
|
349
398
|
target: glob,
|
|
350
399
|
recovery: "Correct the log glob.",
|
|
351
400
|
retryable: false,
|
|
352
401
|
});
|
|
353
402
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
tx: r.tx,
|
|
361
|
-
rx: r.rx,
|
|
362
|
-
mimetypeTx: r.mimetype_tx,
|
|
363
|
-
mimetypeRx: r.mimetype_rx,
|
|
364
|
-
}, LogVisibility.parse(r.folded)),
|
|
365
|
-
}]));
|
|
366
|
-
const projected = rows.map((row) => projectedByCoordinate.get(row.coordinate));
|
|
367
|
-
const weigh = core.weigh ?? contentWeight;
|
|
403
|
+
return { candidateRows, rows };
|
|
404
|
+
}
|
|
405
|
+
// {§relation-indexed-dialects} The rows an indexed dialect reads, their derivation settled once when the
|
|
406
|
+
// pass has not covered them yet.
|
|
407
|
+
static async #settleIndexedCandidates(statement, core, rows, scope, maxLogEntryId) {
|
|
408
|
+
const { db, workerId } = core;
|
|
368
409
|
// {§relation-indexed-dialects} — an index-backed dialect (~, &) holds the program until the pass
|
|
369
410
|
// covers its candidates: settle once, then re-read the attachments it produced. The 503s
|
|
370
411
|
// below remain the truth when coverage is still incomplete afterwards.
|
|
@@ -378,19 +419,20 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
378
419
|
max_id: maxLogEntryId,
|
|
379
420
|
}));
|
|
380
421
|
const hashes = new Map(refreshed.map((row) => [row.coordinate, row.deep_hash]));
|
|
381
|
-
|
|
422
|
+
return rows.map((row) => ({ ...row, deep_hash: hashes.get(row.coordinate) ?? row.deep_hash }));
|
|
382
423
|
}
|
|
383
424
|
}
|
|
425
|
+
return rows;
|
|
426
|
+
}
|
|
427
|
+
// Every dialect resolves to one selection per row: rank for ~full-text, the relation index for &graph, every
|
|
428
|
+
// row for a bare listing, and the content matcher otherwise ({§find-source-agnostic}).
|
|
429
|
+
static async #selectLogMatches(statement, core, rows, projected, maxLogEntryId) {
|
|
430
|
+
const { db, workerId, mimetypes } = core;
|
|
384
431
|
let matches;
|
|
385
432
|
if (statement.matcher?.dialect === "fts") {
|
|
386
433
|
const candidateSet = resolveSearchCandidates(rows.map(({ coordinate, deep_hash }) => ({ key: coordinate, deepHash: deep_hash })));
|
|
387
434
|
if (candidateSet.state === "incomplete")
|
|
388
|
-
return
|
|
389
|
-
search: candidateSet,
|
|
390
|
-
stage: "search-index",
|
|
391
|
-
recovery: "Wait for search indexing to complete before repeating the search.",
|
|
392
|
-
retryable: false,
|
|
393
|
-
});
|
|
435
|
+
return Log.#incompleteIndex(candidateSet, "selected log results");
|
|
394
436
|
const ranked = await EntryFts.rankCandidates(db, candidateSet.candidates, statement.matcher.raw.slice(1), core.signal);
|
|
395
437
|
if (ranked.status !== 200) {
|
|
396
438
|
return Results.assert({ status: ranked.status, problem: ranked.problem, ...emptyFindFields() });
|
|
@@ -400,12 +442,7 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
400
442
|
else if (statement.matcher?.dialect === "graph") {
|
|
401
443
|
const candidateSet = resolveSearchCandidates(rows.map(({ coordinate, deep_hash }) => ({ key: coordinate, deepHash: deep_hash })));
|
|
402
444
|
if (candidateSet.state === "incomplete")
|
|
403
|
-
return
|
|
404
|
-
search: candidateSet,
|
|
405
|
-
stage: "search-index",
|
|
406
|
-
recovery: "Wait for search indexing to complete before repeating the search.",
|
|
407
|
-
retryable: false,
|
|
408
|
-
});
|
|
445
|
+
return Log.#incompleteIndex(candidateSet, "selected log results");
|
|
409
446
|
const universeRows = projectedCoordinateRows(await db.log_find_candidates.all({
|
|
410
447
|
worker_id: workerId,
|
|
411
448
|
scope_prefix: null,
|
|
@@ -413,12 +450,7 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
413
450
|
}));
|
|
414
451
|
const universe = resolveSearchCandidates(universeRows.map(({ coordinate, deep_hash }) => ({ key: coordinate, deepHash: deep_hash })));
|
|
415
452
|
if (universe.state === "incomplete")
|
|
416
|
-
return
|
|
417
|
-
search: universe,
|
|
418
|
-
stage: "search-index",
|
|
419
|
-
recovery: "Wait for search indexing to complete before repeating the search.",
|
|
420
|
-
retryable: false,
|
|
421
|
-
});
|
|
453
|
+
return Log.#incompleteIndex(universe, "log results in the relationship universe");
|
|
422
454
|
const graph = await EntryGraph.matchCandidates(db, universe.candidates, candidateSet.candidates, statement.matcher.raw);
|
|
423
455
|
if (graph.status !== 200)
|
|
424
456
|
return { ...graph, ...emptyFindFields() };
|
|
@@ -429,7 +461,7 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
429
461
|
}
|
|
430
462
|
else {
|
|
431
463
|
if (mimetypes === undefined) {
|
|
432
|
-
return
|
|
464
|
+
return Log.#emptyFind(501, "Content matching requires the mimetypes capability.", {
|
|
433
465
|
stage: "matcher",
|
|
434
466
|
dialect: statement.matcher.dialect,
|
|
435
467
|
retryable: false,
|
|
@@ -448,6 +480,12 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
448
480
|
}
|
|
449
481
|
matches = r.matches.map(({ key, matches: ranges }) => ({ pathname: key, matches: ranges }));
|
|
450
482
|
}
|
|
483
|
+
return matches;
|
|
484
|
+
}
|
|
485
|
+
// {§find-result-projection} The matches as catalog resources and the listing's folder scopes, weighed as the
|
|
486
|
+
// packet would weigh them.
|
|
487
|
+
static #projectLogFind(statement, scope, matches, selection, weigh) {
|
|
488
|
+
const { candidateRows, projectedByCoordinate, candidateByCanonicalCoord } = selection;
|
|
451
489
|
const folderSummaries = statement.matcher === null
|
|
452
490
|
? pathFolderSummaries(scope, candidateRows.map((row) => LogEntryProjection.base(row.coordinate)))
|
|
453
491
|
: [];
|
|
@@ -624,83 +662,6 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
624
662
|
// {§log-kill-scope} — a scoped KILL suppresses the selected lines from the
|
|
625
663
|
// packet projection; the durable row keeps its canonical body.
|
|
626
664
|
async #planScoped(statement, ctx, maxLogEntryId) {
|
|
627
|
-
const planned = async (ids, exact) => {
|
|
628
|
-
const rows = await ctx.db.log_curation_targets.all({ ids: JSON.stringify(ids), turn_id: ctx.turnId });
|
|
629
|
-
if (rows.length !== ids.length) {
|
|
630
|
-
throw new Error("Log curation selection changed before its visibility plan was resolved.");
|
|
631
|
-
}
|
|
632
|
-
const targets = [];
|
|
633
|
-
for (const row of rows) {
|
|
634
|
-
if (row.native_active === 1) {
|
|
635
|
-
const folded = LogVisibility.parse(row.folded);
|
|
636
|
-
targets.push({ id: row.id, activeBefore: 1, activeAfter: 0, foldedBefore: folded, foldedAfter: folded });
|
|
637
|
-
continue;
|
|
638
|
-
}
|
|
639
|
-
const body = LogBody.resolve({
|
|
640
|
-
op: row.op,
|
|
641
|
-
attrs: row.attrs,
|
|
642
|
-
tx: row.tx,
|
|
643
|
-
rx: row.rx,
|
|
644
|
-
mimetypeTx: row.mimetype_tx,
|
|
645
|
-
mimetypeRx: row.mimetype_rx,
|
|
646
|
-
});
|
|
647
|
-
const identity = `log:///${LogEntryProjection.coordinate(row.coordinate, row)}`;
|
|
648
|
-
const result = row.mimetype_rx === "application/json"
|
|
649
|
-
? JSON.parse(row.rx)
|
|
650
|
-
: null;
|
|
651
|
-
const rawAnchors = LogEntryProjection.op(row) === "READ"
|
|
652
|
-
&& result !== null
|
|
653
|
-
&& typeof result === "object"
|
|
654
|
-
&& Object.hasOwn(result, "lineAnchors")
|
|
655
|
-
? result.lineAnchors
|
|
656
|
-
: [];
|
|
657
|
-
if (!Array.isArray(rawAnchors)) {
|
|
658
|
-
throw new TypeError("A READ log body carries malformed published line anchors.");
|
|
659
|
-
}
|
|
660
|
-
const scope = LogVisibility.resolveScope(statement.lineMarker, identity, body.content, rawAnchors);
|
|
661
|
-
if (!scope.ok) {
|
|
662
|
-
return {
|
|
663
|
-
result: Results.failure("scheme:log", scope.code, scope.status, scope.detail, {}, {
|
|
664
|
-
target: identity,
|
|
665
|
-
recovery: scope.recovery,
|
|
666
|
-
retryable: false,
|
|
667
|
-
}),
|
|
668
|
-
plan: null,
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
const before = LogVisibility.parse(row.folded);
|
|
672
|
-
// {§emission-row}: source announcements are curated whole; ordinary rows own their bodies.
|
|
673
|
-
if (LogEntryProjection.isEmission(row)) {
|
|
674
|
-
if (exact) {
|
|
675
|
-
return {
|
|
676
|
-
result: Results.failure("scheme:log", "emission-curated-whole", 422, `${identity} is an emission; curate it without a line scope.`, {}, {
|
|
677
|
-
target: identity,
|
|
678
|
-
recovery: `KILL (${identity}) retires it.`,
|
|
679
|
-
retryable: false,
|
|
680
|
-
}),
|
|
681
|
-
plan: null,
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
targets.push({ id: row.id, activeBefore: 1, activeAfter: 1, foldedBefore: before, foldedAfter: before });
|
|
685
|
-
continue;
|
|
686
|
-
}
|
|
687
|
-
targets.push({
|
|
688
|
-
id: row.id,
|
|
689
|
-
activeBefore: 1,
|
|
690
|
-
activeAfter: 1,
|
|
691
|
-
foldedBefore: before,
|
|
692
|
-
foldedAfter: LogVisibility.apply(before, scope.range, TextCoordinates.lineCount(body.content)),
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
return {
|
|
696
|
-
result: { status: 200, matched: ids.length },
|
|
697
|
-
plan: {
|
|
698
|
-
targets,
|
|
699
|
-
add: [],
|
|
700
|
-
remove: [],
|
|
701
|
-
},
|
|
702
|
-
};
|
|
703
|
-
};
|
|
704
665
|
if (statement.matcher !== null) {
|
|
705
666
|
const matched = await this.#resolveByMatcher(statement, ctx, maxLogEntryId);
|
|
706
667
|
if (matched.status === 204)
|
|
@@ -717,7 +678,7 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
717
678
|
plan: null,
|
|
718
679
|
};
|
|
719
680
|
}
|
|
720
|
-
return
|
|
681
|
+
return Log.#scopedPlan(statement, ctx, matched.ids, false);
|
|
721
682
|
}
|
|
722
683
|
if (statement.target === null) {
|
|
723
684
|
return {
|
|
@@ -732,24 +693,110 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
732
693
|
const selected = await this.#resolveIds(pathname, ctx, maxLogEntryId);
|
|
733
694
|
if (selected.status === 204)
|
|
734
695
|
return { result: { status: 204, matched: 0 }, plan: null };
|
|
735
|
-
if (selected.status !== 200)
|
|
736
|
-
|
|
737
|
-
|
|
696
|
+
if (selected.status !== 200)
|
|
697
|
+
return Log.#selectionFailure(selected, pathname, ctx, maxLogEntryId, "curation-failed");
|
|
698
|
+
return Log.#scopedPlan(statement, ctx, selected.ids, parseCoordinate(pathname) !== null);
|
|
699
|
+
}
|
|
700
|
+
// {§log-kill-scope} The visibility plan for the selected rows: each row's own target, or the first row's refusal.
|
|
701
|
+
static async #scopedPlan(statement, ctx, ids, exact) {
|
|
702
|
+
const rows = await ctx.db.log_curation_targets.all({ ids: JSON.stringify(ids), turn_id: ctx.turnId });
|
|
703
|
+
if (rows.length !== ids.length) {
|
|
704
|
+
throw new Error("Log curation selection changed before its visibility plan was resolved.");
|
|
705
|
+
}
|
|
706
|
+
const targets = [];
|
|
707
|
+
for (const row of rows) {
|
|
708
|
+
const target = Log.#scopedRowTarget(statement, row, exact);
|
|
709
|
+
if ("plan" in target)
|
|
710
|
+
return target;
|
|
711
|
+
targets.push(target);
|
|
712
|
+
}
|
|
713
|
+
return {
|
|
714
|
+
result: { status: 200, matched: ids.length },
|
|
715
|
+
plan: {
|
|
716
|
+
targets,
|
|
717
|
+
add: [],
|
|
718
|
+
remove: [],
|
|
719
|
+
},
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
// One row under a scoped KILL: a natively active row retires whole; an emission is curated whole
|
|
723
|
+
// ({§emission-row}) and refused under an exact scope; any other row folds the resolved line range out of its
|
|
724
|
+
// visibility, or refuses with the scope's own Problem.
|
|
725
|
+
static #scopedRowTarget(statement, row, exact) {
|
|
726
|
+
if (row.native_active === 1) {
|
|
727
|
+
const folded = LogVisibility.parse(row.folded);
|
|
728
|
+
return { id: row.id, activeBefore: 1, activeAfter: 0, foldedBefore: folded, foldedAfter: folded };
|
|
729
|
+
}
|
|
730
|
+
const body = LogBody.resolve({
|
|
731
|
+
op: row.op,
|
|
732
|
+
attrs: row.attrs,
|
|
733
|
+
tx: row.tx,
|
|
734
|
+
rx: row.rx,
|
|
735
|
+
mimetypeTx: row.mimetype_tx,
|
|
736
|
+
mimetypeRx: row.mimetype_rx,
|
|
737
|
+
});
|
|
738
|
+
const identity = `log:///${LogEntryProjection.coordinate(row.coordinate, row)}`;
|
|
739
|
+
const result = row.mimetype_rx === "application/json"
|
|
740
|
+
? JSON.parse(row.rx)
|
|
741
|
+
: null;
|
|
742
|
+
const rawAnchors = LogEntryProjection.op(row) === "READ" && isRecord(result) && Object.hasOwn(result, "lineAnchors")
|
|
743
|
+
? result.lineAnchors
|
|
744
|
+
: [];
|
|
745
|
+
if (!Array.isArray(rawAnchors)) {
|
|
746
|
+
throw new TypeError("A READ log body carries malformed published line anchors.");
|
|
747
|
+
}
|
|
748
|
+
const scope = LogVisibility.resolveScope(statement.lineMarker, identity, body.content, rawAnchors);
|
|
749
|
+
if (!scope.ok) {
|
|
738
750
|
return {
|
|
739
|
-
result: Results.failure("scheme:log",
|
|
740
|
-
target:
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
? {
|
|
744
|
-
recovery: LOG_TARGET_SHAPE,
|
|
745
|
-
retryable: false,
|
|
746
|
-
}
|
|
747
|
-
: {}),
|
|
751
|
+
result: Results.failure("scheme:log", scope.code, scope.status, scope.detail, {}, {
|
|
752
|
+
target: identity,
|
|
753
|
+
recovery: scope.recovery,
|
|
754
|
+
retryable: false,
|
|
748
755
|
}),
|
|
749
756
|
plan: null,
|
|
750
757
|
};
|
|
751
758
|
}
|
|
752
|
-
|
|
759
|
+
const before = LogVisibility.parse(row.folded);
|
|
760
|
+
// {§emission-row}: source announcements are curated whole; ordinary rows own their bodies.
|
|
761
|
+
if (LogEntryProjection.isEmission(row)) {
|
|
762
|
+
if (exact) {
|
|
763
|
+
return {
|
|
764
|
+
result: Results.failure("scheme:log", "emission-curated-whole", 422, `${identity} is an emission; curate it without a line scope.`, {}, {
|
|
765
|
+
target: identity,
|
|
766
|
+
recovery: `KILL (${identity}) retires it.`,
|
|
767
|
+
retryable: false,
|
|
768
|
+
}),
|
|
769
|
+
plan: null,
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
return { id: row.id, activeBefore: 1, activeAfter: 1, foldedBefore: before, foldedAfter: before };
|
|
773
|
+
}
|
|
774
|
+
return {
|
|
775
|
+
id: row.id,
|
|
776
|
+
activeBefore: 1,
|
|
777
|
+
activeAfter: 1,
|
|
778
|
+
foldedBefore: before,
|
|
779
|
+
foldedAfter: LogVisibility.apply(before, scope.range, TextCoordinates.lineCount(body.content)),
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
// {§log-target-tolerances} A selection that found nothing or could not be read, named as what it was: an exact
|
|
783
|
+
// coordinate's miss carries its near miss, a malformed target the working form.
|
|
784
|
+
static async #selectionFailure(selected, pathname, ctx, maxLogEntryId, code) {
|
|
785
|
+
const exact = selected.status === 404 ? parseCoordinate(pathname) : null;
|
|
786
|
+
const nearMiss = exact === null ? undefined : await nearMissRecovery(exact, ctx, maxLogEntryId);
|
|
787
|
+
return {
|
|
788
|
+
result: Results.failure("scheme:log", selected.status === 404 ? "entry-not-found" : code, selected.status, selected.error ?? `No log entry matches '${pathname}'.`, {}, {
|
|
789
|
+
target: pathname,
|
|
790
|
+
...(nearMiss === undefined ? {} : { recovery: nearMiss }),
|
|
791
|
+
...(selected.status === 400
|
|
792
|
+
? {
|
|
793
|
+
recovery: LOG_TARGET_SHAPE,
|
|
794
|
+
retryable: false,
|
|
795
|
+
}
|
|
796
|
+
: {}),
|
|
797
|
+
}),
|
|
798
|
+
plan: null,
|
|
799
|
+
};
|
|
753
800
|
}
|
|
754
801
|
// {§log-curation-set-selection} — the target and an optional pattern select the rows by
|
|
755
802
|
// intersection, exactly as they do for a scoped KILL; a scope only decides what happens to them.
|
|
@@ -762,23 +809,8 @@ export default class Log extends CoreSchemeAdapterBase {
|
|
|
762
809
|
if (selected.problem !== undefined) {
|
|
763
810
|
return { result: Results.assert({ status: selected.status, problem: selected.problem }), plan: null };
|
|
764
811
|
}
|
|
765
|
-
if (selected.status !== 200)
|
|
766
|
-
|
|
767
|
-
const nearMiss = exact === null ? undefined : await nearMissRecovery(exact, ctx, maxLogEntryId);
|
|
768
|
-
return {
|
|
769
|
-
result: Results.failure("scheme:log", selected.status === 404 ? "entry-not-found" : "kill-failed", selected.status, selected.error ?? `No log entry matches '${pathname}'.`, {}, {
|
|
770
|
-
target: pathname,
|
|
771
|
-
...(nearMiss === undefined ? {} : { recovery: nearMiss }),
|
|
772
|
-
...(selected.status === 400
|
|
773
|
-
? {
|
|
774
|
-
recovery: LOG_TARGET_SHAPE,
|
|
775
|
-
retryable: false,
|
|
776
|
-
}
|
|
777
|
-
: {}),
|
|
778
|
-
}),
|
|
779
|
-
plan: null,
|
|
780
|
-
};
|
|
781
|
-
}
|
|
812
|
+
if (selected.status !== 200)
|
|
813
|
+
return Log.#selectionFailure(selected, pathname, ctx, maxLogEntryId, "kill-failed");
|
|
782
814
|
const rows = await ctx.db.log_curation_targets.all({
|
|
783
815
|
ids: JSON.stringify(selected.ids),
|
|
784
816
|
turn_id: ctx.turnId,
|