@plurnk/plurnk-service 4.2.1 → 4.3.1
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/INSTALL.md +7 -2
- package/README.md +3 -1
- package/SPEC.md +1988 -1408
- 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 +1 -1
- package/dist/completions/plurnk-service.bash +1 -1
- package/dist/completions/plurnk-service.fish +1 -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 +1 -1
- package/dist/core/AmbientMembers.d.ts.map +1 -1
- package/dist/core/AmbientMembers.js +5 -2
- package/dist/core/AmbientMembers.js.map +1 -1
- 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 +4 -4
- package/dist/core/CoreSchemeServices.js.map +1 -1
- package/dist/core/DataStatementRunner.d.ts.map +1 -1
- package/dist/core/DataStatementRunner.js +15 -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 +210 -130
- 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 +15 -7
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +32 -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.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 +26 -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 +3 -7
- package/dist/core/PacketBuilder.d.ts.map +1 -1
- package/dist/core/PacketBuilder.js +40 -31
- package/dist/core/PacketBuilder.js.map +1 -1
- package/dist/core/PacketBuilder.sql +11 -0
- 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/TokenCalibration.d.ts +4 -2
- package/dist/core/TokenCalibration.d.ts.map +1 -1
- package/dist/core/TokenCalibration.js +30 -13
- package/dist/core/TokenCalibration.js.map +1 -1
- package/dist/core/TokenCalibration.sql +7 -17
- package/dist/core/ToolResources.d.ts +2 -1
- package/dist/core/ToolResources.d.ts.map +1 -1
- package/dist/core/ToolResources.js +10 -34
- 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 +7 -3
- 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 +198 -230
- 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.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.js +4 -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 +5 -0
- package/dist/core/git-membership.d.ts.map +1 -1
- package/dist/core/git-membership.js +55 -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/packet-wire.d.ts +26 -27
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +154 -132
- package/dist/core/packet-wire.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/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 +6 -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 +136 -79
- 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.map +1 -1
- package/dist/schemes/_entry-find.js +187 -139
- 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 +255 -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 +6 -5
- package/dist/server/EnvFunctionality.js.map +1 -1
- package/dist/server/Functionality.d.ts +8 -6
- package/dist/server/Functionality.d.ts.map +1 -1
- package/dist/server/Functionality.js +110 -32
- package/dist/server/Functionality.js.map +1 -1
- package/dist/server/FunctionalityManager.d.ts.map +1 -1
- package/dist/server/FunctionalityManager.js +16 -2
- package/dist/server/FunctionalityManager.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 +30 -16
- 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 +87 -0
- package/dist/server/WorkerModels.d.ts.map +1 -0
- package/dist/server/WorkerModels.js +540 -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 +57 -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 +11 -21
- package/migrations/033_hidden_places.sql +10 -0
- package/package.json +52 -61
- package/dist/core/ToolInputSchema.d.ts +0 -7
- package/dist/core/ToolInputSchema.d.ts.map +0 -1
- package/dist/core/ToolInputSchema.js +0 -65
- package/dist/core/ToolInputSchema.js.map +0 -1
- 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/TurnRunner.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import StoredPacket, {} from "./StoredPacket.js";
|
|
1
2
|
import NativeContent from "./NativeContent.js";
|
|
2
3
|
import { PlurnkParser, parsePath } from "@plurnk/plurnk-parser";
|
|
3
|
-
import { PathSyntax, PlurnkParseError, UNKNOWN_POSITION } from "@plurnk/plurnk-contracts";
|
|
4
|
+
import { PathSyntax, PlurnkParseError, UNKNOWN_POSITION, Validator } from "@plurnk/plurnk-contracts";
|
|
4
5
|
import WorkerOwners from "./WorkerOwners.js";
|
|
5
6
|
import { setTimeout as delay } from "node:timers/promises";
|
|
6
|
-
import { aggregateProviderAccounting } from "@plurnk/plurnk-providers";
|
|
7
|
+
import { aggregateProviderAccounting, ProviderError, scopeEnvToAlias, } from "@plurnk/plurnk-providers";
|
|
7
8
|
const comparePosition = (a, b) => a.line - b.line || a.column - b.column;
|
|
8
|
-
import { Mimetypes } from "@plurnk/plurnk-mimetypes";
|
|
9
9
|
import FabricatedLog from "./FabricatedLog.js";
|
|
10
10
|
import Meta, { Knob } from "@plurnk/plurnk-meta";
|
|
11
11
|
import GitMembership from "./git-membership.js";
|
|
@@ -14,7 +14,6 @@ import GitState, {} from "./git-state.js";
|
|
|
14
14
|
import WorkspaceSettings from "./workspace-settings.js";
|
|
15
15
|
import { generatedPathname } from "./plurnk-uri.js";
|
|
16
16
|
import { contentWeight } from "./content-weight.js";
|
|
17
|
-
import LiveSubscriptions from "./LiveSubscriptions.js";
|
|
18
17
|
import { readFile } from "node:fs/promises";
|
|
19
18
|
import { resolve as resolvePath } from "node:path";
|
|
20
19
|
import { homedir } from "node:os";
|
|
@@ -31,16 +30,9 @@ import PacketWire from "./packet-wire.js";
|
|
|
31
30
|
import { RECEIPT_RESERVE, reserved } from "./ContextFit.js";
|
|
32
31
|
import Results, { OperationFailureError } from "./results.js";
|
|
33
32
|
import Turn, {} from "./Turn.js";
|
|
34
|
-
// TurnRunner owns one inference cycle and any initialization turn
|
|
35
|
-
// that precedes provider admission; Engine retains the surrounding loop
|
|
36
|
-
// lifecycle and public facade.
|
|
37
|
-
import NoticeChannel from "./NoticeChannel.js";
|
|
38
33
|
import ProviderRecovery from "./ProviderRecovery.js";
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import PacketBuilder, {} from "./PacketBuilder.js";
|
|
42
|
-
import StoredPacket, {} from "./StoredPacket.js";
|
|
43
|
-
import Dispatcher from "./Dispatcher.js";
|
|
34
|
+
import {} from "./StrikeRail.js";
|
|
35
|
+
import {} from "./PacketBuilder.js";
|
|
44
36
|
import { observed, observedSync } from "../observe/spans.js";
|
|
45
37
|
import { genAiRequestName, genAiRequestOptions, settleGenAiResponse } from "../observe/genai.js";
|
|
46
38
|
import { PROVIDER_CALLS, recordCounter } from "../observe/metrics.js";
|
|
@@ -65,7 +57,7 @@ const workerCatalogTarget = (namespace) => {
|
|
|
65
57
|
};
|
|
66
58
|
};
|
|
67
59
|
const assertOpenPaths = (value, source) => {
|
|
68
|
-
if (!Array.isArray(value) || value.
|
|
60
|
+
if (!Array.isArray(value) || !value.every((path) => typeof path === "string" && path.length > 0)) {
|
|
69
61
|
throw new TypeError(`${source}: expected an array of non-empty strings`);
|
|
70
62
|
}
|
|
71
63
|
return value;
|
|
@@ -93,14 +85,14 @@ const readFilesItems = () => {
|
|
|
93
85
|
return null;
|
|
94
86
|
return normalizeFilesItems(Number.parseInt(raw, 10));
|
|
95
87
|
};
|
|
96
|
-
|
|
88
|
+
// Provider contract owned by @plurnk/plurnk-providers; engine is the consumer.
|
|
97
89
|
import ProviderInstantiate from "./ProviderInstantiate.js";
|
|
98
90
|
import TurnMaterialization from "./TurnMaterialization.js";
|
|
99
91
|
import BareBatchRunner from "./BareBatchRunner.js";
|
|
100
|
-
import {
|
|
92
|
+
import { TURN_STATUS_IMPLICIT_CONTINUE, outputAllowance } from "./turn-signals.js";
|
|
101
93
|
import AdmittedTurnExecutor from "./AdmittedTurnExecutor.js";
|
|
102
|
-
// {§context-wall} — the window's one terminal: the packet
|
|
103
|
-
const WINDOW_OVERFLOW_DETAIL = "Context window overflow: the packet
|
|
94
|
+
// {§context-wall} — the window's one terminal: the packet exceeds the model's window.
|
|
95
|
+
const WINDOW_OVERFLOW_DETAIL = "Context window overflow: the packet exceeds the model's window.";
|
|
104
96
|
const windowOverflowFailure = (overflow) => Results.failure("engine:context", "window-overflow", 413, WINDOW_OVERFLOW_DETAIL, {}, { tokens: overflow.tokens, budget: overflow.budget, wall: overflow.wall, excess: overflow.excess });
|
|
105
97
|
// {§context-over-budget-row} — over budget is a row and a request: the row is how the model hears it.
|
|
106
98
|
// {§context-over-budget-row} — the row is the mandate; the gauge is the one home for the numbers
|
|
@@ -110,16 +102,12 @@ const OVER_BUDGET_DETAIL = "Context exceeds budget. YOU MUST ONLY KILL, MOVE or
|
|
|
110
102
|
// labelled as the card's own plan example is: the worker's plan in steps, then its next step.
|
|
111
103
|
const INITIALIZATION_NOTE = {
|
|
112
104
|
op: "NOTE", aside: "plan", metadata: null, target: null, lineMarker: null,
|
|
113
|
-
body: [
|
|
114
|
-
"1. Survey the tooling, documentation, extended context, and project root: what exists decides what can be done.",
|
|
115
|
-
"2. Read the Open Message and restate what it asks for and what will show it is done.",
|
|
116
|
-
"3. Do the work, saving all new facts, ideas, and plans in NOTEs for later turns.",
|
|
117
|
-
].join("\n"),
|
|
105
|
+
body: ["1. Survey the environment.", "2. Evaluate and react to the Open Message."].join("\n"),
|
|
118
106
|
position: UNKNOWN_POSITION,
|
|
119
107
|
};
|
|
120
108
|
const INITIALIZATION_CLOSING_NOTE = {
|
|
121
109
|
op: "NOTE", aside: "plan", metadata: null, target: null, lineMarker: null,
|
|
122
|
-
body: "
|
|
110
|
+
body: "Evaluate and react to the Open Message.", position: UNKNOWN_POSITION,
|
|
123
111
|
};
|
|
124
112
|
// {§continued-without-note} — said once, in the next packet, of a continuing turn that carried no NOTE.
|
|
125
113
|
const CONTINUED_WITHOUT_NOTE = "The turn continued without a NOTE.";
|
|
@@ -168,7 +156,6 @@ export default class TurnRunner {
|
|
|
168
156
|
#weighContent;
|
|
169
157
|
#notices;
|
|
170
158
|
#problems;
|
|
171
|
-
#strikes;
|
|
172
159
|
#packets;
|
|
173
160
|
#dispatcher;
|
|
174
161
|
#liveSubscriptions;
|
|
@@ -180,19 +167,19 @@ export default class TurnRunner {
|
|
|
180
167
|
#warmWorkspace;
|
|
181
168
|
#dispatch;
|
|
182
169
|
#resolveWorkerProviderIdentity;
|
|
170
|
+
#loopGauge;
|
|
183
171
|
// {§operator-grammar} — one read per path per daemon; the file is the operator's and static.
|
|
184
172
|
#grammarCache = new Map();
|
|
185
173
|
#materialization;
|
|
186
174
|
#bareBatch;
|
|
187
175
|
#admitted;
|
|
188
|
-
constructor({ db, schemes, mimetypes, weigh, notices, problems,
|
|
176
|
+
constructor({ db, schemes, mimetypes, weigh, notices, problems, packets, dispatcher, liveSubscriptions, notify, executors, loopSignal, interactions, warmWorkspace, dispatch, resolveWorkerProviderIdentity, loopGauge, }) {
|
|
189
177
|
this.#db = db;
|
|
190
178
|
this.#schemes = schemes;
|
|
191
179
|
this.#mimetypes = mimetypes;
|
|
192
180
|
this.#weighContent = weigh;
|
|
193
181
|
this.#notices = notices;
|
|
194
182
|
this.#problems = problems;
|
|
195
|
-
this.#strikes = strikes;
|
|
196
183
|
this.#packets = packets;
|
|
197
184
|
this.#dispatcher = dispatcher;
|
|
198
185
|
this.#liveSubscriptions = liveSubscriptions;
|
|
@@ -204,6 +191,7 @@ export default class TurnRunner {
|
|
|
204
191
|
this.#warmWorkspace = warmWorkspace;
|
|
205
192
|
this.#dispatch = dispatch;
|
|
206
193
|
this.#resolveWorkerProviderIdentity = resolveWorkerProviderIdentity;
|
|
194
|
+
this.#loopGauge = loopGauge;
|
|
207
195
|
this.#materialization = new TurnMaterialization({ db: this.#db, weighContent: this.#weighContent, mimetypes: this.#mimetypes });
|
|
208
196
|
this.#bareBatch = new BareBatchRunner({ db: this.#db, providerAttributions: this.#providerAttributions.bind(this), providerFailure: TurnRunner.#providerFailure });
|
|
209
197
|
this.#admitted = new AdmittedTurnExecutor({ db: this.#db, schemes: this.#schemes, notices: this.#notices, problems: this.#problems, dispatcher: this.#dispatcher, bareBatch: this.#bareBatch });
|
|
@@ -215,10 +203,14 @@ export default class TurnRunner {
|
|
|
215
203
|
const packetCount = await this.#db.engine_loop_packet_count.get({ loop_id: args.loopId });
|
|
216
204
|
if (packetCount === undefined)
|
|
217
205
|
throw new Error(`loop ${args.loopId}: packet count row missing`);
|
|
206
|
+
// {§tokenomics-client-gauge} The turn's inference is recorded: its packet and its call are the gauge now.
|
|
207
|
+
const gauge = await this.#loopGauge(args.loopId);
|
|
218
208
|
this.#notify.loopPacketNotify(args.workspaceId, {
|
|
219
209
|
workerId: args.workerId,
|
|
220
210
|
loopId: args.loopId,
|
|
211
|
+
loopSeq: packetCount.sequence,
|
|
221
212
|
packetCount: packetCount.count,
|
|
213
|
+
gauge,
|
|
222
214
|
});
|
|
223
215
|
}
|
|
224
216
|
// {§operator-grammar} — the operator's grammar text for this provider, or undefined when
|
|
@@ -417,28 +409,26 @@ export default class TurnRunner {
|
|
|
417
409
|
const initializationStatements = [];
|
|
418
410
|
// {§worker-initialization-entry} — the worker's first turn is the worked
|
|
419
411
|
// example itself: the actual orienting operations.
|
|
420
|
-
// {§turn0-agents-stunt} — the project AGENTS.md
|
|
421
|
-
// worker:///_plurnk/
|
|
422
|
-
//
|
|
423
|
-
// stays in the system prompt; nothing else is force-read.
|
|
412
|
+
// {§turn0-agents-stunt} {§turn0-local-instructions} — the project AGENTS.md, then its AGENTS.local.md (materialized
|
|
413
|
+
// by LoopDocs under worker:///_plurnk/), each get one foisted READ on the worker's first loop, so local repo
|
|
414
|
+
// guidance is visible turn-0 content. Global policy stays in the system prompt; nothing else is force-read.
|
|
424
415
|
if (initializationTurn !== null) {
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
const
|
|
433
|
-
kind: "url", raw:
|
|
416
|
+
for (const name of ["/AGENTS.md", "/AGENTS.local.md"]) {
|
|
417
|
+
const pathname = generatedPathname(name);
|
|
418
|
+
const entry = await this.#db.crud_find_workspace_entry.get({
|
|
419
|
+
workspace_id: workspaceId, scheme: "worker", authority: "", pathname,
|
|
420
|
+
});
|
|
421
|
+
if (entry === undefined)
|
|
422
|
+
continue;
|
|
423
|
+
const target = {
|
|
424
|
+
kind: "url", raw: `worker://${pathname}`, scheme: "worker",
|
|
434
425
|
username: null, password: null, hostname: null, port: null,
|
|
435
|
-
pathname
|
|
426
|
+
pathname, query: null, fragment: null,
|
|
436
427
|
};
|
|
437
|
-
|
|
438
|
-
op: "READ", aside: null, target
|
|
428
|
+
initializationStatements.push({
|
|
429
|
+
op: "READ", aside: null, target,
|
|
439
430
|
metadata: null, lineMarker: null, matcher: null, body: null, position: UNKNOWN_POSITION,
|
|
440
|
-
};
|
|
441
|
-
initializationStatements.push(agentsRead);
|
|
431
|
+
});
|
|
442
432
|
}
|
|
443
433
|
}
|
|
444
434
|
return {
|
|
@@ -513,7 +503,17 @@ export default class TurnRunner {
|
|
|
513
503
|
// {§emission-row} — a `_plurnk` turn has receipts, never a fabricated assistant emission.
|
|
514
504
|
// {§message-arrival} — the message reaches the model as an inbound SEND in the first
|
|
515
505
|
// model turn; initialization does not READ it a second time.
|
|
516
|
-
const admittedInitializationStatements =
|
|
506
|
+
const admittedInitializationStatements = [];
|
|
507
|
+
for (const statement of initializationStatements) {
|
|
508
|
+
if (!this.#capabilities.allowsAcross(statement, workspaceId, initializationPolicies))
|
|
509
|
+
continue;
|
|
510
|
+
// {§actor-boundary-catalog-preview} — a survey that would select nothing is left out of the program.
|
|
511
|
+
if (statement.op === "FIND" && !await this.#dispatcher.selects(statement, {
|
|
512
|
+
workspaceId, workerId, loopId, turnId: initializationTurn.id, origin: "_plurnk",
|
|
513
|
+
}))
|
|
514
|
+
continue;
|
|
515
|
+
admittedInitializationStatements.push(statement);
|
|
516
|
+
}
|
|
517
517
|
if (admittedInitializationStatements.length === 0) {
|
|
518
518
|
// Nothing to survey (the preview off, no project guidance): the turn opens and completes empty.
|
|
519
519
|
await Turn.complete(this.#db, initializationTurn.id, 200);
|
|
@@ -541,7 +541,7 @@ export default class TurnRunner {
|
|
|
541
541
|
turnId: initializationTurn.id,
|
|
542
542
|
fromSequence: 1,
|
|
543
543
|
failOnOperationError: true,
|
|
544
|
-
fit: this.#fitFor(args, { turnId: initializationTurn.id, seq: initializationTurn.sequence, gitStatus, notices: [], transientOpenLogEntryId: container.transientOpenLogEntryId
|
|
544
|
+
fit: this.#fitFor(args, { turnId: initializationTurn.id, seq: initializationTurn.sequence, gitStatus, notices: [], transientOpenLogEntryId: container.transientOpenLogEntryId }),
|
|
545
545
|
signal: this.#loopSignal(loopId),
|
|
546
546
|
onDispatch,
|
|
547
547
|
onSettled,
|
|
@@ -553,18 +553,11 @@ export default class TurnRunner {
|
|
|
553
553
|
// {§actor-boundary-catalog-preview} — the opening surveys, each admitted only when
|
|
554
554
|
// its scheme is registered for the workspace. A positive filesItems caps the
|
|
555
555
|
// project rows.
|
|
556
|
-
async #catalogSurveys({ workspaceId }, { workerName, initializationPolicies
|
|
556
|
+
async #catalogSurveys({ workspaceId }, { workerName, initializationPolicies }, filesItems) {
|
|
557
557
|
const catalogSchemes = await this.#db.engine_scheme_catalog_summary.all({ workspace_id: workspaceId });
|
|
558
558
|
const fileItems = catalogSchemes.find(({ scheme }) => scheme === "file")?.shallow_items ?? 0;
|
|
559
559
|
const fileCap = filesItems > 0 && fileItems > 0 ? Math.min(filesItems, fileItems) : null;
|
|
560
560
|
const surveys = [
|
|
561
|
-
{
|
|
562
|
-
// Trial (#1073): the survey reads its own program, so the log carries one program verbatim
|
|
563
|
-
// and shows that every ops:// turn is readable.
|
|
564
|
-
op: "READ", aside: "this program",
|
|
565
|
-
target: { kind: "url", raw: `ops://${workerName}/${loopSequence}/1`, scheme: "ops", username: null, password: null, hostname: workerName, port: null, pathname: `/${loopSequence}/1`, query: null, fragment: null },
|
|
566
|
-
metadata: null, lineMarker: null, matcher: null, body: null, position: UNKNOWN_POSITION,
|
|
567
|
-
},
|
|
568
561
|
{
|
|
569
562
|
op: "FIND", aside: null,
|
|
570
563
|
target: { kind: "url", raw: "skill://*/SKILL.md", scheme: "skill", username: null, password: null, hostname: "*", port: null, pathname: "/SKILL.md", query: null, fragment: null },
|
|
@@ -674,7 +667,7 @@ export default class TurnRunner {
|
|
|
674
667
|
const systemCtx = this.#schemeContext(args, turnId);
|
|
675
668
|
// {§context-fit} — one measure for everything this turn lands: the budget less the packet as it
|
|
676
669
|
// would render now. The drained notices join the same facts below.
|
|
677
|
-
const facts = { turnId, seq, gitStatus, notices: [], transientOpenLogEntryId: container.transientOpenLogEntryId
|
|
670
|
+
const facts = { turnId, seq, gitStatus, notices: [], transientOpenLogEntryId: container.transientOpenLogEntryId };
|
|
678
671
|
const fit = this.#fitFor(args, facts);
|
|
679
672
|
const messages = await this.#publishMessages(args, turnId, fit);
|
|
680
673
|
let nextActionIndex = await this.#readOpenPaths(args, turnId, messages.openPaths, messages.nextActionIndex, fit);
|
|
@@ -758,7 +751,7 @@ export default class TurnRunner {
|
|
|
758
751
|
}
|
|
759
752
|
async #buildPacket(args, facts) {
|
|
760
753
|
const { messages, recap, workspaceId, workerId, loopId, provider } = args;
|
|
761
|
-
|
|
754
|
+
return this.#packets.buildRequestPacket({
|
|
762
755
|
initialMessages: messages,
|
|
763
756
|
recap,
|
|
764
757
|
workspaceId,
|
|
@@ -770,16 +763,7 @@ export default class TurnRunner {
|
|
|
770
763
|
notices: facts.notices,
|
|
771
764
|
transientOpenLogEntryId: facts.transientOpenLogEntryId,
|
|
772
765
|
turnId: facts.turnId,
|
|
773
|
-
bodiless: facts.projection.bodiless,
|
|
774
|
-
omitEmissionHistory: facts.projection.omitEmissionHistory,
|
|
775
766
|
});
|
|
776
|
-
// {§emission-history}: all builds, including result-admission probes, shed the optional
|
|
777
|
-
// replay before taking result bodies. Share the decision across this request's rebuilds.
|
|
778
|
-
if (PacketWire.sectionContent(packet, "emission-history").length > 0 && this.#packets.windowOverflow(packet, provider) !== null) {
|
|
779
|
-
facts.projection.omitEmissionHistory = true;
|
|
780
|
-
return this.#buildPacket(args, facts);
|
|
781
|
-
}
|
|
782
|
-
return packet;
|
|
783
767
|
}
|
|
784
768
|
// {§context-fit} — the budget left for one more row, measured by building the packet as it would
|
|
785
769
|
// render now: every row landed so far, every KILL already honoured. Null without a budget.
|
|
@@ -806,63 +790,30 @@ export default class TurnRunner {
|
|
|
806
790
|
const packet = await this.#buildPacket(args, request);
|
|
807
791
|
return { ...request, nextActionIndex: request.nextActionIndex + 1, packet };
|
|
808
792
|
}
|
|
809
|
-
// {§context-admission} — one request through the room: over the wall by the estimate, it
|
|
810
|
-
// budget, it carries one row whose own weight takes the same wall ({§context-over-budget-row});
|
|
811
|
-
// provider assesses the exact wire request, and an exact refusal
|
|
812
|
-
// ({§context-wall-measure}).
|
|
793
|
+
// {§context-admission} — one request through the room: over the wall by the estimate, it ends the loop;
|
|
794
|
+
// over budget, it carries one row whose own weight takes the same wall ({§context-over-budget-row});
|
|
795
|
+
// then the provider assesses the exact wire request, and an exact refusal ends the loop
|
|
796
|
+
// ({§context-wall-measure}). The daemon never hides, folds, or strips stored rows.
|
|
813
797
|
async #admitPacket(args, request) {
|
|
814
798
|
const { provider, loopId, signal } = args;
|
|
815
799
|
let current = request;
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
current
|
|
824
|
-
continue;
|
|
825
|
-
}
|
|
826
|
-
if (!noted && this.#packets.curationOverflow(current.packet) !== null) {
|
|
827
|
-
current = await this.#noteOverBudget(args, current);
|
|
828
|
-
noted = true;
|
|
829
|
-
continue;
|
|
830
|
-
}
|
|
831
|
-
const wire = await this.#wireMessages(current.packet, current.systemCtx, provider);
|
|
832
|
-
const capacity = await provider.assessRequestCapacity(wire.messages, undefined, this.#loopSignal(loopId) ?? signal);
|
|
833
|
-
const refused = this.#packets.exactOverflow(current.packet, capacity);
|
|
834
|
-
if (refused === null)
|
|
835
|
-
return { request: current, wire, overflow: null };
|
|
836
|
-
const shed = await this.#shed(args, current, refused);
|
|
837
|
-
if (shed === null)
|
|
838
|
-
return { request: current, wire: null, overflow: refused };
|
|
839
|
-
current = shed;
|
|
800
|
+
const estimated = this.#packets.windowOverflow(current.packet, provider);
|
|
801
|
+
if (estimated !== null)
|
|
802
|
+
return { request: current, wire: null, overflow: estimated };
|
|
803
|
+
if (this.#packets.curationOverflow(current.packet) !== null) {
|
|
804
|
+
current = await this.#noteOverBudget(args, current);
|
|
805
|
+
const afterNote = this.#packets.windowOverflow(current.packet, provider);
|
|
806
|
+
if (afterNote !== null)
|
|
807
|
+
return { request: current, wire: null, overflow: afterNote };
|
|
840
808
|
}
|
|
809
|
+
const wire = await this.#wireMessages(current.packet, current.systemCtx, provider);
|
|
810
|
+
const capacity = await provider.assessRequestCapacity(wire.messages, undefined, this.#loopSignal(loopId) ?? signal);
|
|
811
|
+
const refused = this.#packets.exactOverflow(current.packet, capacity);
|
|
812
|
+
if (refused !== null)
|
|
813
|
+
return { request: current, wire: null, overflow: refused };
|
|
814
|
+
return { request: current, wire, overflow: null };
|
|
841
815
|
}
|
|
842
|
-
// {§context-
|
|
843
|
-
// previous program goes whole first ({§emission-history}), then the newest rows still carrying a body,
|
|
844
|
-
// enough of them by their rendered tokens to shed the excess; every body stays stored. Null when nothing
|
|
845
|
-
// is left to take.
|
|
846
|
-
async #shed(args, request, overflow) {
|
|
847
|
-
if (!request.projection.omitEmissionHistory && PacketWire.sectionContent(request.packet, "emission-history").length > 0) {
|
|
848
|
-
request.projection.omitEmissionHistory = true;
|
|
849
|
-
}
|
|
850
|
-
else {
|
|
851
|
-
let shed = 0;
|
|
852
|
-
let taken = 0;
|
|
853
|
-
for (const { id, tokens } of this.#packets.bodiedRowsOf(request.packet).toReversed()) {
|
|
854
|
-
if (shed >= overflow.excessWeight)
|
|
855
|
-
break;
|
|
856
|
-
request.projection.bodiless.add(id);
|
|
857
|
-
shed += tokens;
|
|
858
|
-
taken += 1;
|
|
859
|
-
}
|
|
860
|
-
if (taken === 0)
|
|
861
|
-
return null;
|
|
862
|
-
}
|
|
863
|
-
return { ...request, packet: await this.#buildPacket(args, request) };
|
|
864
|
-
}
|
|
865
|
-
// {§context-wall} — the packet cannot fit the window even as receipts: the turn completes on the
|
|
816
|
+
// {§context-wall} — the packet exceeds the model's window: the turn completes on the
|
|
866
817
|
// overflow and the loop rules the terminal; no provider I/O.
|
|
867
818
|
async #failCuration(request, overflow) {
|
|
868
819
|
const curationFailure = windowOverflowFailure(overflow);
|
|
@@ -913,9 +864,8 @@ export default class TurnRunner {
|
|
|
913
864
|
attempts.railGrammar = await this.#operatorGrammar(provider);
|
|
914
865
|
attempts.wellFormed = await this.#bodyChecks(workspaceId);
|
|
915
866
|
const attemptLimit = readEmissionAttempts();
|
|
916
|
-
const strikeStreak = await this.#strikes.streak(loopId);
|
|
917
867
|
for (let attempt = 1; attempt <= attemptLimit;) {
|
|
918
|
-
const verdict = await this.#issueProviderCall(args, request, attempts, attempt
|
|
868
|
+
const verdict = await this.#issueProviderCall(args, request, attempts, attempt);
|
|
919
869
|
if (verdict === "admitted")
|
|
920
870
|
break;
|
|
921
871
|
if (verdict === "rejected")
|
|
@@ -966,7 +916,7 @@ export default class TurnRunner {
|
|
|
966
916
|
// under the reasoning observer, and its classification. {§provider-recovery}
|
|
967
917
|
// re-issues the same emission attempt; the parser's admission is the one verdict
|
|
968
918
|
// on a completed exchange.
|
|
969
|
-
async #issueProviderCall(args, request, attempts, attempt
|
|
919
|
+
async #issueProviderCall(args, request, attempts, attempt) {
|
|
970
920
|
const { provider, workspaceId, workerId, loopId } = args;
|
|
971
921
|
// A recovery re-issue does not consume a grammar-emission attempt. Every
|
|
972
922
|
// logical provider call still receives its own durable sequence and accounting.
|
|
@@ -996,10 +946,10 @@ export default class TurnRunner {
|
|
|
996
946
|
}
|
|
997
947
|
attempts.attemptId = attemptRow.id;
|
|
998
948
|
attempts.callInFlight = true;
|
|
999
|
-
const reasoning = this.#reasoningObserver(args, request
|
|
949
|
+
const reasoning = this.#reasoningObserver(args, request, modelCall);
|
|
1000
950
|
let completedResponse;
|
|
1001
951
|
try {
|
|
1002
|
-
completedResponse = await this.#generate(args, request, attempts, modelCall, reasoning
|
|
952
|
+
completedResponse = await this.#generate(args, request, attempts, modelCall, reasoning);
|
|
1003
953
|
}
|
|
1004
954
|
catch (error) {
|
|
1005
955
|
if (error instanceof ProviderError
|
|
@@ -1037,7 +987,7 @@ export default class TurnRunner {
|
|
|
1037
987
|
// {§notifications-reasoning-event} — only the parent emission is observed;
|
|
1038
988
|
// BARE has no observer on its isolated calls. Reasoning deltas cite the physical
|
|
1039
989
|
// request they stream in; a new request or the call's end closes the open span.
|
|
1040
|
-
#reasoningObserver({ workspaceId, workerId, loopId }, turnId, modelCall) {
|
|
990
|
+
#reasoningObserver({ workspaceId, workerId, loopId }, { turnId, loopSeq, seq: turnSeq }, modelCall) {
|
|
1041
991
|
let reasoningStarted = false;
|
|
1042
992
|
let reasoningRequestSequence = 0;
|
|
1043
993
|
const end = () => {
|
|
@@ -1047,6 +997,8 @@ export default class TurnRunner {
|
|
|
1047
997
|
workerId,
|
|
1048
998
|
loopId,
|
|
1049
999
|
turnId,
|
|
1000
|
+
loopSeq,
|
|
1001
|
+
turnSeq,
|
|
1050
1002
|
modelCallId: modelCall.id,
|
|
1051
1003
|
requestSequence: reasoningRequestSequence,
|
|
1052
1004
|
phase: "end",
|
|
@@ -1071,6 +1023,8 @@ export default class TurnRunner {
|
|
|
1071
1023
|
workerId,
|
|
1072
1024
|
loopId,
|
|
1073
1025
|
turnId,
|
|
1026
|
+
loopSeq,
|
|
1027
|
+
turnSeq,
|
|
1074
1028
|
modelCallId: modelCall.id,
|
|
1075
1029
|
requestSequence: reasoningRequestSequence,
|
|
1076
1030
|
phase: "start",
|
|
@@ -1080,6 +1034,8 @@ export default class TurnRunner {
|
|
|
1080
1034
|
workerId,
|
|
1081
1035
|
loopId,
|
|
1082
1036
|
turnId,
|
|
1037
|
+
loopSeq,
|
|
1038
|
+
turnSeq,
|
|
1083
1039
|
modelCallId: modelCall.id,
|
|
1084
1040
|
requestSequence: reasoningRequestSequence,
|
|
1085
1041
|
phase: "content",
|
|
@@ -1091,7 +1047,7 @@ export default class TurnRunner {
|
|
|
1091
1047
|
// The exchange under its GenAI span: the packet's observations are recorded, the
|
|
1092
1048
|
// provider generates against the wire request, and the call's accounting is
|
|
1093
1049
|
// asserted whether it resolved or failed.
|
|
1094
|
-
async #generate({ provider, workspaceId }, request, attempts, modelCall, reasoning
|
|
1050
|
+
async #generate({ provider, workspaceId }, request, attempts, modelCall, reasoning) {
|
|
1095
1051
|
return await observed(// {§observability-boundary}
|
|
1096
1052
|
genAiRequestName(provider.model), { model: provider.model, attempt: attempts.modelCallSequence }, async (span) => {
|
|
1097
1053
|
try {
|
|
@@ -1413,7 +1369,7 @@ export default class TurnRunner {
|
|
|
1413
1369
|
model: callMetadata.model,
|
|
1414
1370
|
// Opaque provider metadata plus the grammar transport key.
|
|
1415
1371
|
// {§meta-passthrough}, {§operator-grammar}
|
|
1416
|
-
meta: JSON.stringify({ ...
|
|
1372
|
+
meta: JSON.stringify({ ...response.meta, ...railKeys }),
|
|
1417
1373
|
},
|
|
1418
1374
|
});
|
|
1419
1375
|
}
|
|
@@ -1526,111 +1482,14 @@ export default class TurnRunner {
|
|
|
1526
1482
|
}
|
|
1527
1483
|
#splitResponse(response, executors = [], wellFormed) {
|
|
1528
1484
|
const { assistant } = response;
|
|
1529
|
-
|
|
1530
|
-
const
|
|
1531
|
-
const parseErrors =
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
const fabrications = [];
|
|
1537
|
-
const outside = [];
|
|
1538
|
-
if (preParsedOps !== undefined) {
|
|
1539
|
-
ops.push(...preParsedOps);
|
|
1540
|
-
contentStatementCount = preParsedOps.length;
|
|
1541
|
-
}
|
|
1542
|
-
else {
|
|
1543
|
-
// {§observability-boundary} — the parse is observed without its input;
|
|
1544
|
-
// only the resulting statement count is attributable.
|
|
1545
|
-
const parsed = observedSync("contracts.parse", {}, (span) => {
|
|
1546
|
-
// {§executor-heading}: explicit invocations parse without registration; available names
|
|
1547
|
-
// also admit slotless headings. Dispatch resolves the then-current workspace registry.
|
|
1548
|
-
const result = PlurnkParser.parse(assistant.content, { executors, ...(wellFormed === undefined ? {} : { wellFormed }) });
|
|
1549
|
-
span.setAttribute("statements", result.items.filter((item) => item.kind === "statement").length);
|
|
1550
|
-
return result;
|
|
1551
|
-
});
|
|
1552
|
-
// {§outside-text}: beside a fenced operation, the text between two operations is one NOTE at its
|
|
1553
|
-
// position, annotation the model wrote without its fence; a turn that fenced no operation keeps
|
|
1554
|
-
// its text as its outside source and stays an empty turn ({§empty-turn}). Echoed emission
|
|
1555
|
-
// headings are announcements, not annotation, and are dropped ({§fabricated-log-entry}).
|
|
1556
|
-
const fenced = parsed.items.filter((item) => item.kind === "statement").length;
|
|
1557
|
-
let span = null;
|
|
1558
|
-
const flushSpan = () => {
|
|
1559
|
-
if (span === null)
|
|
1560
|
-
return;
|
|
1561
|
-
const body = span.body.join("\n\n");
|
|
1562
|
-
if (body.length > 0) {
|
|
1563
|
-
if (fenced > 0) {
|
|
1564
|
-
ops.push({ op: "NOTE", aside: null, metadata: null, target: null, lineMarker: null, body, position: span.position });
|
|
1565
|
-
contentStatementCount += 1;
|
|
1566
|
-
}
|
|
1567
|
-
else
|
|
1568
|
-
outside.push(body);
|
|
1569
|
-
}
|
|
1570
|
-
span = null;
|
|
1485
|
+
// A scripted provider's pre-parsed statements, each proven against the statement schema.
|
|
1486
|
+
const preParsedOps = "ops" in assistant && Array.isArray(assistant.ops) ? assistant.ops.map((op) => Validator.assertPlurnkStatement(op)) : undefined;
|
|
1487
|
+
const { ops, contentStatementCount, parseErrors, parseNotices, fabrications, outside, hasUnparsedTail, operationOmitted } = preParsedOps === undefined
|
|
1488
|
+
? TurnRunner.#parseContent(assistant.content, executors, wellFormed)
|
|
1489
|
+
: {
|
|
1490
|
+
ops: [...preParsedOps], contentStatementCount: preParsedOps.length, parseErrors: [], parseNotices: [], fabrications: [],
|
|
1491
|
+
outside: [], hasUnparsedTail: false, operationOmitted: false,
|
|
1571
1492
|
};
|
|
1572
|
-
for (const item of parsed.items) {
|
|
1573
|
-
if (item.kind !== "text")
|
|
1574
|
-
flushSpan();
|
|
1575
|
-
if (item.kind === "statement") {
|
|
1576
|
-
ops.push(item.statement);
|
|
1577
|
-
contentStatementCount += 1;
|
|
1578
|
-
}
|
|
1579
|
-
else if (item.kind === "text") {
|
|
1580
|
-
// {§fabricated-log-entry}: a log-entry heading in outside text rejects the attempt.
|
|
1581
|
-
const fabricated = FabricatedLog.find(item.content);
|
|
1582
|
-
if (fabricated !== null) {
|
|
1583
|
-
fabrications.push({ message: FabricatedLog.message(fabricated.heading), line: item.position.line + fabricated.line, column: 1, source: "harness" });
|
|
1584
|
-
continue;
|
|
1585
|
-
}
|
|
1586
|
-
const body = FabricatedLog.stripEchoes(item.content);
|
|
1587
|
-
if (body.length === 0)
|
|
1588
|
-
continue;
|
|
1589
|
-
span ??= { body: [], position: item.position };
|
|
1590
|
-
span.body.push(body);
|
|
1591
|
-
}
|
|
1592
|
-
else if (item.kind === "error") {
|
|
1593
|
-
const err = item.error;
|
|
1594
|
-
if (err instanceof PlurnkParseError) {
|
|
1595
|
-
operationOmitted ||= err.operationOmitted;
|
|
1596
|
-
if (err.severity === "warning") {
|
|
1597
|
-
parseNotices.push({
|
|
1598
|
-
source: "grammar",
|
|
1599
|
-
kind: "parse_advisory",
|
|
1600
|
-
level: "warn",
|
|
1601
|
-
directive: DIRECTIVE.advisory,
|
|
1602
|
-
message: err.message,
|
|
1603
|
-
position: {
|
|
1604
|
-
type: "content-offset",
|
|
1605
|
-
line: err.line,
|
|
1606
|
-
column: err.column,
|
|
1607
|
-
},
|
|
1608
|
-
parserSource: err.source,
|
|
1609
|
-
});
|
|
1610
|
-
}
|
|
1611
|
-
else {
|
|
1612
|
-
parseErrors.push({ message: err.message, line: err.line, column: err.column, source: err.source,
|
|
1613
|
-
...(err.recovery === undefined ? {} : { recovery: err.recovery }),
|
|
1614
|
-
...(item.attempt === undefined ? {} : { attempt: item.attempt }) });
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
1617
|
-
else {
|
|
1618
|
-
const msg = err?.message ?? "parse error";
|
|
1619
|
-
parseErrors.push({ message: msg, line: 0, column: 0, source: "parser" });
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
flushSpan();
|
|
1624
|
-
// {§unparsed-tail-boundary} — the lexer's one boundary fact: from `unparsedTail.from` on,
|
|
1625
|
-
// nothing was read. The statements that closed before it are ordinary facts and run; the
|
|
1626
|
-
// loss itself is one more hard diagnostic, a failed row the model sees. An emission that
|
|
1627
|
-
// lost its boundary before any statement closed has nothing admissible and is resampled.
|
|
1628
|
-
const tail = parsed.unparsedTail;
|
|
1629
|
-
if (tail !== undefined) {
|
|
1630
|
-
hasUnparsedTail = true;
|
|
1631
|
-
parseErrors.push({ message: tail.reason, line: tail.from.line, column: tail.from.column, source: "grammar" });
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
1493
|
const reasoning = assistant.reasoning ?? null;
|
|
1635
1494
|
const reasoningOps = reasoning === null ? [] : PlurnkParser.parseReasoningOperations(reasoning, (warning) => {
|
|
1636
1495
|
parseNotices.push({
|
|
@@ -1679,6 +1538,115 @@ export default class TurnRunner {
|
|
|
1679
1538
|
emissionStatements,
|
|
1680
1539
|
};
|
|
1681
1540
|
}
|
|
1541
|
+
// {§outside-text} {§fabricated-log-entry} {§unparsed-tail-boundary} An emission's content parsed into its
|
|
1542
|
+
// statements and what sat beside them: outside text as NOTEs or the empty turn's source, a fabricated log
|
|
1543
|
+
// heading as the rejection it is, each parse error by its severity, and the lexer's one boundary fact.
|
|
1544
|
+
static #parseContent(content, executors, wellFormed) {
|
|
1545
|
+
const ops = [];
|
|
1546
|
+
const parseErrors = [];
|
|
1547
|
+
let contentStatementCount = 0;
|
|
1548
|
+
let hasUnparsedTail = false;
|
|
1549
|
+
let operationOmitted = false;
|
|
1550
|
+
const parseNotices = [];
|
|
1551
|
+
const fabrications = [];
|
|
1552
|
+
const outside = [];
|
|
1553
|
+
// {§observability-boundary} — the parse is observed without its input;
|
|
1554
|
+
// only the resulting statement count is attributable.
|
|
1555
|
+
const parsed = observedSync("contracts.parse", {}, (span) => {
|
|
1556
|
+
// {§executor-heading}: explicit invocations parse without registration; available names
|
|
1557
|
+
// also admit slotless headings. Dispatch resolves the then-current workspace registry.
|
|
1558
|
+
const result = PlurnkParser.parse(content, { executors, ...(wellFormed === undefined ? {} : { wellFormed }) });
|
|
1559
|
+
span.setAttribute("statements", result.items.filter((item) => item.kind === "statement").length);
|
|
1560
|
+
return result;
|
|
1561
|
+
});
|
|
1562
|
+
// {§outside-text}: beside a fenced operation, the text between two operations is one NOTE at its
|
|
1563
|
+
// position, annotation the model wrote without its fence; a turn that fenced no operation keeps
|
|
1564
|
+
// its text as its outside source and stays an empty turn ({§empty-turn}). Echoed emission
|
|
1565
|
+
// headings are announcements, not annotation, and are dropped ({§fabricated-log-entry}).
|
|
1566
|
+
const fenced = parsed.items.filter((item) => item.kind === "statement").length;
|
|
1567
|
+
let span = null;
|
|
1568
|
+
const flushSpan = () => {
|
|
1569
|
+
if (span === null)
|
|
1570
|
+
return;
|
|
1571
|
+
const body = span.body.join("\n\n");
|
|
1572
|
+
if (body.length > 0) {
|
|
1573
|
+
if (fenced > 0) {
|
|
1574
|
+
ops.push({ op: "NOTE", aside: null, metadata: null, target: null, lineMarker: null, body, position: span.position });
|
|
1575
|
+
contentStatementCount += 1;
|
|
1576
|
+
}
|
|
1577
|
+
else
|
|
1578
|
+
outside.push(body);
|
|
1579
|
+
}
|
|
1580
|
+
span = null;
|
|
1581
|
+
};
|
|
1582
|
+
for (const item of parsed.items) {
|
|
1583
|
+
if (item.kind !== "text")
|
|
1584
|
+
flushSpan();
|
|
1585
|
+
if (item.kind === "statement") {
|
|
1586
|
+
ops.push(item.statement);
|
|
1587
|
+
contentStatementCount += 1;
|
|
1588
|
+
}
|
|
1589
|
+
else if (item.kind === "text") {
|
|
1590
|
+
// {§fabricated-log-entry}: a log-entry heading in outside text rejects the attempt.
|
|
1591
|
+
const fabricated = FabricatedLog.find(item.content);
|
|
1592
|
+
if (fabricated !== null) {
|
|
1593
|
+
fabrications.push({ message: FabricatedLog.message(fabricated.heading), line: item.position.line + fabricated.line, column: 1, source: "harness" });
|
|
1594
|
+
continue;
|
|
1595
|
+
}
|
|
1596
|
+
const body = FabricatedLog.stripEchoes(item.content);
|
|
1597
|
+
if (body.length === 0)
|
|
1598
|
+
continue;
|
|
1599
|
+
span ??= { body: [], position: item.position };
|
|
1600
|
+
span.body.push(body);
|
|
1601
|
+
}
|
|
1602
|
+
else if (item.kind === "error") {
|
|
1603
|
+
operationOmitted ||= TurnRunner.#admitParseError(item, parseErrors, parseNotices);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
flushSpan();
|
|
1607
|
+
// {§unparsed-tail-boundary} — the lexer's one boundary fact: from `unparsedTail.from` on,
|
|
1608
|
+
// nothing was read. The statements that closed before it are ordinary facts and run; the
|
|
1609
|
+
// loss itself is one more hard diagnostic, a failed row the model sees. An emission that
|
|
1610
|
+
// lost its boundary before any statement closed has nothing admissible and is resampled.
|
|
1611
|
+
const tail = parsed.unparsedTail;
|
|
1612
|
+
if (tail !== undefined) {
|
|
1613
|
+
hasUnparsedTail = true;
|
|
1614
|
+
parseErrors.push({ message: tail.reason, line: tail.from.line, column: tail.from.column, source: "grammar" });
|
|
1615
|
+
}
|
|
1616
|
+
return { ops, contentStatementCount, parseErrors, parseNotices, fabrications, outside, hasUnparsedTail, operationOmitted };
|
|
1617
|
+
}
|
|
1618
|
+
// One parse error by its severity: an advisory is a grammar Notice beside the turn; an error is a diagnostic
|
|
1619
|
+
// the model sees, with its recovery and the attempt it came from. Returns whether an operation was omitted.
|
|
1620
|
+
static #admitParseError(item, parseErrors, parseNotices) {
|
|
1621
|
+
const err = item.error;
|
|
1622
|
+
if (err instanceof PlurnkParseError) {
|
|
1623
|
+
if (err.severity === "warning") {
|
|
1624
|
+
parseNotices.push({
|
|
1625
|
+
source: "grammar",
|
|
1626
|
+
kind: "parse_advisory",
|
|
1627
|
+
level: "warn",
|
|
1628
|
+
directive: DIRECTIVE.advisory,
|
|
1629
|
+
message: err.message,
|
|
1630
|
+
position: {
|
|
1631
|
+
type: "content-offset",
|
|
1632
|
+
line: err.line,
|
|
1633
|
+
column: err.column,
|
|
1634
|
+
},
|
|
1635
|
+
parserSource: err.source,
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
else {
|
|
1639
|
+
parseErrors.push({ message: err.message, line: err.line, column: err.column, source: err.source,
|
|
1640
|
+
...(err.recovery === undefined ? {} : { recovery: err.recovery }),
|
|
1641
|
+
...(item.attempt === undefined ? {} : { attempt: item.attempt }) });
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
else {
|
|
1645
|
+
const msg = err?.message ?? "parse error";
|
|
1646
|
+
parseErrors.push({ message: msg, line: 0, column: 0, source: "parser" });
|
|
1647
|
+
}
|
|
1648
|
+
return err instanceof PlurnkParseError && err.operationOmitted;
|
|
1649
|
+
}
|
|
1682
1650
|
// #note12 — extension reference docs are materialized beneath
|
|
1683
1651
|
// worker:///_plurnk/plurnk/ by LoopDocs.
|
|
1684
1652
|
// {§exec-lifetime} — a `"turn"` lifetime: abort the worker's open turn-scoped streams via their
|