@plurnk/plurnk-service 1.16.4 → 1.17.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 +122 -246
- package/INSTALL.md +84 -138
- package/README.md +9 -5
- package/SPEC.md +1710 -1015
- package/dist/Paths.d.ts +2 -0
- package/dist/Paths.d.ts.map +1 -1
- package/dist/Paths.js +2 -0
- package/dist/Paths.js.map +1 -1
- package/dist/build-info.d.ts.map +1 -1
- package/dist/build-info.js +7 -1
- package/dist/build-info.js.map +1 -1
- package/dist/build-info.json +1 -1
- package/dist/content/body-preview.d.ts +8 -0
- package/dist/content/body-preview.d.ts.map +1 -0
- package/dist/content/body-preview.js +39 -0
- package/dist/content/body-preview.js.map +1 -0
- package/dist/content/byte-view.d.ts +1 -4
- package/dist/content/byte-view.d.ts.map +1 -1
- package/dist/content/byte-view.js.map +1 -1
- package/dist/content/edit-collision.d.ts.map +1 -1
- package/dist/content/edit-collision.js +3 -4
- package/dist/content/edit-collision.js.map +1 -1
- package/dist/content/line-anchors.d.ts +2 -2
- package/dist/content/line-anchors.d.ts.map +1 -1
- package/dist/content/line-anchors.js +4 -3
- package/dist/content/line-anchors.js.map +1 -1
- package/dist/content/line-selection.d.ts +9 -0
- package/dist/content/line-selection.d.ts.map +1 -0
- package/dist/content/line-selection.js +29 -0
- package/dist/content/line-selection.js.map +1 -0
- package/dist/content/matcher.d.ts +0 -1
- package/dist/content/matcher.d.ts.map +1 -1
- package/dist/content/matcher.js +2 -3
- package/dist/content/matcher.js.map +1 -1
- package/dist/content/pattern-edits.d.ts +39 -0
- package/dist/content/pattern-edits.d.ts.map +1 -0
- package/dist/content/pattern-edits.js +121 -0
- package/dist/content/pattern-edits.js.map +1 -0
- package/dist/content/read-projector.d.ts +18 -9
- package/dist/content/read-projector.d.ts.map +1 -1
- package/dist/content/read-projector.js +132 -35
- package/dist/content/read-projector.js.map +1 -1
- package/dist/content/read-resolve.d.ts +3 -1
- package/dist/content/read-resolve.d.ts.map +1 -1
- package/dist/content/read-resolve.js +39 -7
- package/dist/content/read-resolve.js.map +1 -1
- package/dist/core/AdmittedTurnExecutor.d.ts +3 -5
- package/dist/core/AdmittedTurnExecutor.d.ts.map +1 -1
- package/dist/core/AdmittedTurnExecutor.js +91 -83
- package/dist/core/AdmittedTurnExecutor.js.map +1 -1
- package/dist/core/BareBatchRunner.d.ts +6 -1
- package/dist/core/BareBatchRunner.d.ts.map +1 -1
- package/dist/core/BareBatchRunner.js +20 -5
- package/dist/core/BareBatchRunner.js.map +1 -1
- package/dist/core/BudgetReadout.d.ts +2 -3
- package/dist/core/BudgetReadout.d.ts.map +1 -1
- package/dist/core/BudgetReadout.js +23 -32
- package/dist/core/BudgetReadout.js.map +1 -1
- package/dist/core/CapabilityPolicies.d.ts +3 -8
- package/dist/core/CapabilityPolicies.d.ts.map +1 -1
- package/dist/core/CapabilityPolicies.js +2 -28
- package/dist/core/CapabilityPolicies.js.map +1 -1
- package/dist/core/CapabilityResolver.d.ts +10 -10
- package/dist/core/CapabilityResolver.d.ts.map +1 -1
- package/dist/core/CapabilityResolver.js +87 -65
- package/dist/core/CapabilityResolver.js.map +1 -1
- package/dist/core/ChannelWrite.d.ts +14 -11
- package/dist/core/ChannelWrite.d.ts.map +1 -1
- package/dist/core/ChannelWrite.js +11 -12
- package/dist/core/ChannelWrite.js.map +1 -1
- package/dist/core/ChannelWrite.sql +99 -9
- package/dist/core/ClientInteractions.d.ts.map +1 -1
- package/dist/core/ClientInteractions.js +7 -0
- package/dist/core/ClientInteractions.js.map +1 -1
- package/dist/core/CoreSchemeServices.d.ts +13 -10
- package/dist/core/CoreSchemeServices.d.ts.map +1 -1
- package/dist/core/CoreSchemeServices.js +13 -5
- package/dist/core/CoreSchemeServices.js.map +1 -1
- package/dist/core/DataStatementRunner.d.ts +2 -2
- package/dist/core/DataStatementRunner.d.ts.map +1 -1
- package/dist/core/DataStatementRunner.js +36 -39
- package/dist/core/DataStatementRunner.js.map +1 -1
- package/dist/core/Dispatcher.d.ts +19 -26
- package/dist/core/Dispatcher.d.ts.map +1 -1
- package/dist/core/Dispatcher.js +369 -219
- package/dist/core/Dispatcher.js.map +1 -1
- package/dist/core/Dispatcher.sql +66 -0
- package/dist/core/DurableStatement.d.ts.map +1 -1
- package/dist/core/DurableStatement.js +2 -1
- package/dist/core/DurableStatement.js.map +1 -1
- package/dist/core/EditMutations.d.ts +14 -18
- package/dist/core/EditMutations.d.ts.map +1 -1
- package/dist/core/EditMutations.js +211 -280
- package/dist/core/EditMutations.js.map +1 -1
- package/dist/core/EditMutations.sql +15 -0
- package/dist/core/EditSequence.d.ts +13 -0
- package/dist/core/EditSequence.d.ts.map +1 -0
- package/dist/core/EditSequence.js +73 -0
- package/dist/core/EditSequence.js.map +1 -0
- package/dist/core/Engine.d.ts +17 -23
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +73 -163
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Engine.sql +0 -724
- package/dist/core/EntryAddressBinding.d.ts +7 -17
- package/dist/core/EntryAddressBinding.d.ts.map +1 -1
- package/dist/core/EntryAddressBinding.js +12 -72
- package/dist/core/EntryAddressBinding.js.map +1 -1
- package/dist/core/ExecutionOutputs.d.ts +9 -0
- package/dist/core/ExecutionOutputs.d.ts.map +1 -0
- package/dist/core/ExecutionOutputs.js +36 -0
- package/dist/core/ExecutionOutputs.js.map +1 -0
- package/dist/core/ExecutionOutputs.sql +13 -0
- package/dist/core/ExecutorRegistry.d.ts +7 -5
- package/dist/core/ExecutorRegistry.d.ts.map +1 -1
- package/dist/core/ExecutorRegistry.js +36 -32
- package/dist/core/ExecutorRegistry.js.map +1 -1
- package/dist/core/HostPaths.d.ts +1 -0
- package/dist/core/HostPaths.d.ts.map +1 -1
- package/dist/core/HostPaths.js +4 -0
- package/dist/core/HostPaths.js.map +1 -1
- package/dist/core/InferenceCall.d.ts.map +1 -1
- package/dist/core/InferenceCall.js +1 -2
- package/dist/core/InferenceCall.js.map +1 -1
- package/dist/core/InferenceCall.sql +29 -0
- package/dist/core/KillHandler.d.ts +1 -0
- package/dist/core/KillHandler.d.ts.map +1 -1
- package/dist/core/KillHandler.js +24 -21
- package/dist/core/KillHandler.js.map +1 -1
- package/dist/core/LogBody.d.ts +8 -1
- package/dist/core/LogBody.d.ts.map +1 -1
- package/dist/core/LogBody.js +42 -11
- package/dist/core/LogBody.js.map +1 -1
- package/dist/core/LogEntryProjection.d.ts +1 -0
- package/dist/core/LogEntryProjection.d.ts.map +1 -1
- package/dist/core/LogEntryProjection.js +18 -10
- package/dist/core/LogEntryProjection.js.map +1 -1
- package/dist/core/LogVisibility.d.ts +1 -0
- package/dist/core/LogVisibility.d.ts.map +1 -1
- package/dist/core/LogVisibility.js +3 -0
- package/dist/core/LogVisibility.js.map +1 -1
- package/dist/core/LogWriter.d.ts +2 -3
- package/dist/core/LogWriter.d.ts.map +1 -1
- package/dist/core/LogWriter.js +25 -32
- package/dist/core/LogWriter.js.map +1 -1
- package/dist/core/LogWriter.sql +23 -0
- package/dist/core/LoopDriver.d.ts +11 -8
- package/dist/core/LoopDriver.d.ts.map +1 -1
- package/dist/core/LoopDriver.js +163 -189
- package/dist/core/LoopDriver.js.map +1 -1
- package/dist/core/LoopDriver.sql +11 -0
- package/dist/core/LoopLifecycle.d.ts +32 -2
- package/dist/core/LoopLifecycle.d.ts.map +1 -1
- package/dist/core/LoopLifecycle.js +88 -4
- package/dist/core/LoopLifecycle.js.map +1 -1
- package/dist/core/LoopLifecycle.sql +145 -28
- package/dist/core/LoopPolicyReader.sql +6 -0
- package/dist/core/MembershipMaterialization.d.ts.map +1 -1
- package/dist/core/MembershipMaterialization.js +6 -28
- package/dist/core/MembershipMaterialization.js.map +1 -1
- package/dist/core/ModelCall.sql +70 -0
- package/dist/core/MutationEffects.d.ts +5 -3
- package/dist/core/MutationEffects.d.ts.map +1 -1
- package/dist/core/MutationEffects.js +10 -28
- package/dist/core/MutationEffects.js.map +1 -1
- package/dist/core/NativeContent.d.ts +6 -0
- package/dist/core/NativeContent.d.ts.map +1 -0
- package/dist/core/NativeContent.js +16 -0
- package/dist/core/NativeContent.js.map +1 -0
- package/dist/core/NativeContent.sql +6 -0
- package/dist/core/NoticeChannel.js +1 -1
- package/dist/core/NoticeChannel.js.map +1 -1
- package/dist/core/OperatorConfig.js +5 -5
- package/dist/core/OperatorConfig.js.map +1 -1
- package/dist/core/PacketBuilder.d.ts +8 -5
- package/dist/core/PacketBuilder.d.ts.map +1 -1
- package/dist/core/PacketBuilder.js +117 -81
- package/dist/core/PacketBuilder.js.map +1 -1
- package/dist/core/PacketBuilder.sql +146 -0
- package/dist/core/PatternSelection.d.ts +28 -0
- package/dist/core/PatternSelection.d.ts.map +1 -0
- package/dist/core/PatternSelection.js +42 -0
- package/dist/core/PatternSelection.js.map +1 -0
- package/dist/core/ProblemLog.d.ts.map +1 -1
- package/dist/core/ProblemLog.js +0 -1
- package/dist/core/ProblemLog.js.map +1 -1
- package/dist/core/PromptFrames.d.ts +12 -0
- package/dist/core/PromptFrames.d.ts.map +1 -0
- package/dist/core/PromptFrames.js +28 -0
- package/dist/core/PromptFrames.js.map +1 -0
- package/dist/core/ProposalLifecycle.d.ts +0 -1
- package/dist/core/ProposalLifecycle.d.ts.map +1 -1
- package/dist/core/ProposalLifecycle.js +20 -19
- package/dist/core/ProposalLifecycle.js.map +1 -1
- package/dist/core/ProposalLifecycle.sql +33 -0
- package/dist/core/ProviderInstantiate.d.ts +1 -1
- package/dist/core/ProviderInstantiate.d.ts.map +1 -1
- package/dist/core/ProviderInstantiate.js +7 -14
- package/dist/core/ProviderInstantiate.js.map +1 -1
- package/dist/core/ReasoningView.d.ts +9 -0
- package/dist/core/ReasoningView.d.ts.map +1 -0
- package/dist/core/ReasoningView.js +47 -0
- package/dist/core/ReasoningView.js.map +1 -0
- package/dist/core/ResourceBindings.d.ts +16 -0
- package/dist/core/ResourceBindings.d.ts.map +1 -0
- package/dist/core/ResourceBindings.js +45 -0
- package/dist/core/ResourceBindings.js.map +1 -0
- package/dist/core/ResourceMutations.d.ts +5 -8
- package/dist/core/ResourceMutations.d.ts.map +1 -1
- package/dist/core/ResourceMutations.js +6 -7
- package/dist/core/ResourceMutations.js.map +1 -1
- package/dist/core/ResourceSelector.d.ts +2 -2
- package/dist/core/ResourceSelector.d.ts.map +1 -1
- package/dist/core/ResourceSelector.js +122 -62
- package/dist/core/ResourceSelector.js.map +1 -1
- package/dist/core/ResourceTransfers.d.ts +4 -2
- package/dist/core/ResourceTransfers.d.ts.map +1 -1
- package/dist/core/ResourceTransfers.js +95 -26
- package/dist/core/ResourceTransfers.js.map +1 -1
- package/dist/core/RuntimeWorker.d.ts +5 -0
- package/dist/core/RuntimeWorker.d.ts.map +1 -0
- package/dist/core/RuntimeWorker.js +10 -0
- package/dist/core/RuntimeWorker.js.map +1 -0
- package/dist/core/RuntimeWorker.sql +5 -0
- package/dist/core/SchemeRegistry.d.ts +12 -16
- package/dist/core/SchemeRegistry.d.ts.map +1 -1
- package/dist/core/SchemeRegistry.js +58 -84
- package/dist/core/SchemeRegistry.js.map +1 -1
- package/dist/core/StoredPacket.d.ts +6 -1
- package/dist/core/StoredPacket.d.ts.map +1 -1
- package/dist/core/StoredPacket.js +30 -10
- package/dist/core/StoredPacket.js.map +1 -1
- package/dist/core/StrikeRail.d.ts +9 -6
- package/dist/core/StrikeRail.d.ts.map +1 -1
- package/dist/core/StrikeRail.js +60 -113
- package/dist/core/StrikeRail.js.map +1 -1
- package/dist/core/StrikeRail.sql +12 -0
- package/dist/core/TerminalResult.d.ts +1 -1
- package/dist/core/TerminalResult.d.ts.map +1 -1
- package/dist/core/TerminalResult.js +2 -2
- package/dist/core/TerminalResult.js.map +1 -1
- package/dist/core/TokenCalibration.d.ts +1 -6
- package/dist/core/TokenCalibration.d.ts.map +1 -1
- package/dist/core/TokenCalibration.js +13 -9
- package/dist/core/TokenCalibration.js.map +1 -1
- package/dist/core/TokenCalibration.sql +15 -0
- package/dist/core/ToolInputSchema.d.ts +6 -0
- package/dist/core/ToolInputSchema.d.ts.map +1 -0
- package/dist/core/ToolInputSchema.js +43 -0
- package/dist/core/ToolInputSchema.js.map +1 -0
- package/dist/core/ToolResources.d.ts.map +1 -1
- package/dist/core/ToolResources.js +76 -52
- package/dist/core/ToolResources.js.map +1 -1
- package/dist/core/Turn.d.ts +5 -2
- package/dist/core/Turn.d.ts.map +1 -1
- package/dist/core/Turn.js +13 -11
- package/dist/core/Turn.js.map +1 -1
- package/dist/core/Turn.sql +25 -39
- package/dist/core/{SendBroadcastHandler.d.ts → TurnDispositionHandler.d.ts} +25 -17
- package/dist/core/TurnDispositionHandler.d.ts.map +1 -0
- package/dist/core/TurnDispositionHandler.js +198 -0
- package/dist/core/TurnDispositionHandler.js.map +1 -0
- package/dist/core/TurnMaterialization.d.ts +2 -3
- package/dist/core/TurnMaterialization.d.ts.map +1 -1
- package/dist/core/TurnMaterialization.js +40 -15
- package/dist/core/TurnMaterialization.js.map +1 -1
- package/dist/core/TurnMaterialization.sql +44 -0
- package/dist/core/TurnOps.d.ts.map +1 -1
- package/dist/core/TurnOps.js +8 -64
- package/dist/core/TurnOps.js.map +1 -1
- package/dist/core/TurnRunner.d.ts +9 -12
- package/dist/core/TurnRunner.d.ts.map +1 -1
- package/dist/core/TurnRunner.js +232 -408
- package/dist/core/TurnRunner.js.map +1 -1
- package/dist/core/TurnRunner.sql +74 -0
- package/dist/core/TurnSources.sql +39 -0
- package/dist/core/WorkerControlAddress.d.ts +1 -0
- package/dist/core/WorkerControlAddress.d.ts.map +1 -1
- package/dist/core/WorkerControlAddress.js +5 -0
- package/dist/core/WorkerControlAddress.js.map +1 -1
- package/dist/core/WorkerControlHandler.d.ts +1 -3
- package/dist/core/WorkerControlHandler.d.ts.map +1 -1
- package/dist/core/WorkerControlHandler.js +41 -48
- package/dist/core/WorkerControlHandler.js.map +1 -1
- package/dist/core/WorkerName.d.ts +8 -6
- package/dist/core/WorkerName.d.ts.map +1 -1
- package/dist/core/WorkerName.js +33 -24
- package/dist/core/WorkerName.js.map +1 -1
- package/dist/core/WorkerName.sql +7 -10
- package/dist/core/WorkspaceGate.d.ts +1 -1
- package/dist/core/WorkspaceGate.d.ts.map +1 -1
- package/dist/core/WorkspaceGate.js +29 -6
- package/dist/core/WorkspaceGate.js.map +1 -1
- package/dist/core/ambient.sql +236 -0
- package/dist/core/attachments.d.ts +2 -1
- package/dist/core/attachments.d.ts.map +1 -1
- package/dist/core/attachments.js +5 -4
- package/dist/core/attachments.js.map +1 -1
- package/dist/core/caps/CapsResolve.d.ts +2 -3
- package/dist/core/caps/CapsResolve.d.ts.map +1 -1
- package/dist/core/caps/CapsResolve.js +5 -5
- package/dist/core/caps/CapsResolve.js.map +1 -1
- package/dist/core/caps/DbChannelCaps.d.ts +1 -1
- package/dist/core/caps/DbChannelCaps.d.ts.map +1 -1
- package/dist/core/caps/DbChannelCaps.js +4 -6
- package/dist/core/caps/DbChannelCaps.js.map +1 -1
- package/dist/core/caps/DbEntryCaps.d.ts +2 -1
- package/dist/core/caps/DbEntryCaps.d.ts.map +1 -1
- package/dist/core/caps/DbEntryCaps.js +11 -17
- package/dist/core/caps/DbEntryCaps.js.map +1 -1
- package/dist/core/caps/DbNotifyCaps.d.ts +1 -1
- package/dist/core/caps/DbNotifyCaps.d.ts.map +1 -1
- package/dist/core/caps/DbNotifyCaps.js +3 -5
- package/dist/core/caps/DbNotifyCaps.js.map +1 -1
- package/dist/core/caps/DbProjectionCaps.js +1 -1
- package/dist/core/caps/DbProjectionCaps.js.map +1 -1
- package/dist/core/caps/DbSubscriptionCaps.d.ts +1 -1
- package/dist/core/caps/DbSubscriptionCaps.d.ts.map +1 -1
- package/dist/core/caps/DbSubscriptionCaps.js +5 -7
- package/dist/core/caps/DbSubscriptionCaps.js.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.d.ts +0 -2
- package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.js +4 -20
- package/dist/core/caps/SchemeCtxImpl.js.map +1 -1
- package/dist/core/env-defaults.d.ts.map +1 -1
- package/dist/core/env-defaults.js +4 -2
- package/dist/core/env-defaults.js.map +1 -1
- package/dist/core/file-materialization.d.ts +4 -1
- package/dist/core/file-materialization.d.ts.map +1 -1
- package/dist/core/file-materialization.js +14 -0
- package/dist/core/file-materialization.js.map +1 -1
- package/dist/core/fork.d.ts +1 -6
- package/dist/core/fork.d.ts.map +1 -1
- package/dist/core/fork.js +9 -153
- package/dist/core/fork.js.map +1 -1
- package/dist/core/fork.sql +162 -185
- package/dist/core/git-env.d.ts +1 -0
- package/dist/core/git-env.d.ts.map +1 -1
- package/dist/core/git-env.js +39 -2
- package/dist/core/git-env.js.map +1 -1
- package/dist/core/git-membership.d.ts.map +1 -1
- package/dist/core/git-membership.js +64 -48
- package/dist/core/git-membership.js.map +1 -1
- package/dist/core/git-state.d.ts.map +1 -1
- package/dist/core/git-state.js +25 -19
- package/dist/core/git-state.js.map +1 -1
- package/dist/core/glob_match.d.ts +4 -0
- package/dist/core/glob_match.d.ts.map +1 -0
- package/dist/core/glob_match.js +7 -0
- package/dist/core/glob_match.js.map +1 -0
- package/dist/core/maintenance.sql +6 -0
- package/dist/core/mutation-types.d.ts +7 -28
- package/dist/core/mutation-types.d.ts.map +1 -1
- package/dist/core/packet-inject.d.ts.map +1 -1
- package/dist/core/packet-inject.js +2 -3
- package/dist/core/packet-inject.js.map +1 -1
- package/dist/core/packet-wire.d.ts +8 -6
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +131 -163
- package/dist/core/packet-wire.js.map +1 -1
- package/dist/core/plurnk-uri.d.ts +1 -1
- package/dist/core/plurnk-uri.d.ts.map +1 -1
- package/dist/core/plurnk-uri.js +5 -12
- package/dist/core/plurnk-uri.js.map +1 -1
- package/dist/core/scheme-types.d.ts +3 -3
- package/dist/core/scheme-types.d.ts.map +1 -1
- package/dist/core/scheme-types.js.map +1 -1
- package/dist/core/sha256.d.ts +4 -0
- package/dist/core/sha256.d.ts.map +1 -0
- package/dist/core/sha256.js +6 -0
- package/dist/core/sha256.js.map +1 -0
- package/dist/core/teaching.js +1 -1
- package/dist/core/teaching.js.map +1 -1
- package/dist/core/turn-scheduler.d.ts.map +1 -1
- package/dist/core/turn-scheduler.js +5 -18
- package/dist/core/turn-scheduler.js.map +1 -1
- package/dist/core/turn-signals.d.ts +0 -6
- package/dist/core/turn-signals.d.ts.map +1 -1
- package/dist/core/turn-signals.js +1 -7
- package/dist/core/turn-signals.js.map +1 -1
- package/dist/core/worker-ops.sql +15 -22
- package/dist/core/workspace-settings.d.ts.map +1 -1
- package/dist/core/workspace-settings.js +18 -2
- package/dist/core/workspace-settings.js.map +1 -1
- package/dist/core/workspace-settings.sql +6 -0
- package/dist/digest/Digest.d.ts.map +1 -1
- package/dist/digest/Digest.js +27 -90
- package/dist/digest/Digest.js.map +1 -1
- package/dist/digest/DigestRender.d.ts.map +1 -1
- package/dist/digest/DigestRender.js +14 -54
- package/dist/digest/DigestRender.js.map +1 -1
- package/dist/digest/digest-rows.d.ts +10 -32
- package/dist/digest/digest-rows.d.ts.map +1 -1
- package/dist/digest/digest.sql +43 -18
- package/dist/schemes/Exec.d.ts +6 -12
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +256 -188
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/ExecOutputScheme.d.ts +8 -6
- package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
- package/dist/schemes/ExecOutputScheme.js +33 -61
- package/dist/schemes/ExecOutputScheme.js.map +1 -1
- package/dist/schemes/ExecutionInput.d.ts +12 -0
- package/dist/schemes/ExecutionInput.d.ts.map +1 -0
- package/dist/schemes/ExecutionInput.js +94 -0
- package/dist/schemes/ExecutionInput.js.map +1 -0
- package/dist/schemes/File.d.ts +5 -2
- package/dist/schemes/File.d.ts.map +1 -1
- package/dist/schemes/File.js +62 -92
- package/dist/schemes/File.js.map +1 -1
- package/dist/schemes/Log.d.ts.map +1 -1
- package/dist/schemes/Log.js +84 -79
- package/dist/schemes/Log.js.map +1 -1
- package/dist/schemes/Log.sql +183 -15
- package/dist/schemes/Prompt.d.ts.map +1 -1
- package/dist/schemes/Prompt.js +3 -12
- package/dist/schemes/Prompt.js.map +1 -1
- package/dist/schemes/QuestionTool.d.ts +5 -0
- package/dist/schemes/QuestionTool.d.ts.map +1 -1
- package/dist/schemes/QuestionTool.js +6 -14
- package/dist/schemes/QuestionTool.js.map +1 -1
- package/dist/schemes/Skill.d.ts +12 -7
- package/dist/schemes/Skill.d.ts.map +1 -1
- package/dist/schemes/Skill.js +149 -21
- package/dist/schemes/Skill.js.map +1 -1
- package/dist/schemes/TurnSource.d.ts +12 -0
- package/dist/schemes/TurnSource.d.ts.map +1 -0
- package/dist/schemes/TurnSource.js +116 -0
- package/dist/schemes/TurnSource.js.map +1 -0
- package/dist/schemes/Worker.d.ts +3 -3
- package/dist/schemes/Worker.d.ts.map +1 -1
- package/dist/schemes/Worker.js +61 -208
- package/dist/schemes/Worker.js.map +1 -1
- package/dist/schemes/_entry-crud.d.ts +12 -15
- package/dist/schemes/_entry-crud.d.ts.map +1 -1
- package/dist/schemes/_entry-crud.js +63 -63
- package/dist/schemes/_entry-crud.js.map +1 -1
- package/dist/schemes/_entry-crud.sql +142 -46
- package/dist/schemes/_entry-find.d.ts +1 -3
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +111 -112
- package/dist/schemes/_entry-find.js.map +1 -1
- package/dist/schemes/_entry-find.sql +22 -14
- package/dist/schemes/_entry-fts.d.ts +14 -0
- package/dist/schemes/_entry-fts.d.ts.map +1 -0
- package/dist/schemes/_entry-fts.js +82 -0
- package/dist/schemes/_entry-fts.js.map +1 -0
- package/dist/schemes/_entry-fts.sql +31 -0
- package/dist/schemes/_entry-graph.d.ts.map +1 -1
- package/dist/schemes/_entry-graph.js +6 -14
- package/dist/schemes/_entry-graph.js.map +1 -1
- package/dist/schemes/_entry-graph.sql +29 -44
- package/dist/schemes/_entry-manifest.d.ts +2 -1
- package/dist/schemes/_entry-manifest.d.ts.map +1 -1
- package/dist/schemes/_entry-manifest.js +15 -12
- package/dist/schemes/_entry-manifest.js.map +1 -1
- package/dist/schemes/_entry-manifest.sql +26 -0
- package/dist/schemes/_entry-ops.d.ts +3 -5
- package/dist/schemes/_entry-ops.d.ts.map +1 -1
- package/dist/schemes/_entry-ops.js +30 -43
- package/dist/schemes/_entry-ops.js.map +1 -1
- package/dist/schemes/_entry-ops.sql +5 -6
- package/dist/schemes/_entry-readable.d.ts +8 -0
- package/dist/schemes/_entry-readable.d.ts.map +1 -0
- package/dist/schemes/_entry-readable.js +38 -0
- package/dist/schemes/_entry-readable.js.map +1 -0
- package/dist/schemes/_entry-send.d.ts +1 -1
- package/dist/schemes/_entry-send.d.ts.map +1 -1
- package/dist/schemes/_entry-send.js +3 -3
- package/dist/schemes/_entry-send.js.map +1 -1
- package/dist/schemes/_search-index.d.ts +1 -3
- package/dist/schemes/_search-index.d.ts.map +1 -1
- package/dist/schemes/_search-index.js +79 -110
- package/dist/schemes/_search-index.js.map +1 -1
- package/dist/schemes/_search-index.sql +30 -0
- package/dist/schemes/exec-runtime.d.ts +1 -1
- package/dist/schemes/exec-runtime.d.ts.map +1 -1
- package/dist/schemes/exec-runtime.js.map +1 -1
- package/dist/server/ClientReads.d.ts +2 -2
- package/dist/server/ClientReads.d.ts.map +1 -1
- package/dist/server/ClientReads.js +5 -8
- package/dist/server/ClientReads.js.map +1 -1
- package/dist/server/Daemon.d.ts +14 -21
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +135 -156
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/DaemonModule.d.ts +23 -21
- package/dist/server/DaemonModule.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.d.ts +8 -21
- package/dist/server/DrainSupervisor.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.js +278 -306
- package/dist/server/DrainSupervisor.js.map +1 -1
- package/dist/server/Functionality.d.ts +11 -12
- package/dist/server/Functionality.d.ts.map +1 -1
- package/dist/server/Functionality.js +129 -101
- package/dist/server/Functionality.js.map +1 -1
- package/dist/server/FunctionalityManager.d.ts +3 -5
- package/dist/server/FunctionalityManager.d.ts.map +1 -1
- package/dist/server/FunctionalityManager.js +20 -58
- package/dist/server/FunctionalityManager.js.map +1 -1
- package/dist/server/MembersFunctionality.d.ts +5 -4
- package/dist/server/MembersFunctionality.d.ts.map +1 -1
- package/dist/server/MembersFunctionality.js +24 -37
- package/dist/server/MembersFunctionality.js.map +1 -1
- package/dist/server/PlurnkSkill.d.ts +11 -0
- package/dist/server/PlurnkSkill.d.ts.map +1 -0
- package/dist/server/PlurnkSkill.js +41 -0
- package/dist/server/PlurnkSkill.js.map +1 -0
- package/dist/server/Retention.d.ts +22 -0
- package/dist/server/Retention.d.ts.map +1 -0
- package/dist/server/Retention.js +54 -0
- package/dist/server/Retention.js.map +1 -0
- package/dist/server/Retention.sql +36 -0
- package/dist/server/ServiceModules.d.ts +5 -0
- package/dist/server/ServiceModules.d.ts.map +1 -0
- package/dist/server/ServiceModules.js +10 -0
- package/dist/server/ServiceModules.js.map +1 -0
- package/dist/server/SkillsFunctionality.d.ts +14 -19
- package/dist/server/SkillsFunctionality.d.ts.map +1 -1
- package/dist/server/SkillsFunctionality.js +97 -104
- package/dist/server/SkillsFunctionality.js.map +1 -1
- package/dist/server/WorkerModelResolver.d.ts +4 -0
- package/dist/server/WorkerModelResolver.d.ts.map +1 -1
- package/dist/server/WorkerModelResolver.js +72 -39
- package/dist/server/WorkerModelResolver.js.map +1 -1
- package/dist/server/WorkspaceCapabilities.d.ts +21 -0
- package/dist/server/WorkspaceCapabilities.d.ts.map +1 -0
- package/dist/server/{WorkerCapabilities.js → WorkspaceCapabilities.js} +40 -40
- package/dist/server/WorkspaceCapabilities.js.map +1 -0
- package/dist/server/WorkspaceResidency.d.ts +36 -0
- package/dist/server/WorkspaceResidency.d.ts.map +1 -0
- package/dist/server/WorkspaceResidency.js +199 -0
- package/dist/server/WorkspaceResidency.js.map +1 -0
- package/dist/server/client-input.d.ts +1 -4
- package/dist/server/client-input.d.ts.map +1 -1
- package/dist/server/client-input.js +4 -45
- package/dist/server/client-input.js.map +1 -1
- package/dist/server/dispatch-as-plurnk.d.ts.map +1 -1
- package/dist/server/dispatch-as-plurnk.js +4 -22
- package/dist/server/dispatch-as-plurnk.js.map +1 -1
- package/dist/server/drain.sql +65 -42
- package/dist/server/envelope.d.ts +8 -0
- package/dist/server/envelope.d.ts.map +1 -1
- package/dist/server/envelope.js +9 -7
- package/dist/server/envelope.js.map +1 -1
- package/dist/server/envelope.sql +49 -13
- package/dist/server/lifecycle-recovery.sql +14 -17
- package/dist/server/logEntry.d.ts +1 -1
- package/dist/server/logEntry.d.ts.map +1 -1
- package/dist/server/logEntry.js +4 -1
- package/dist/server/logEntry.js.map +1 -1
- package/dist/server/logEntry.sql +25 -1
- package/dist/server/loopDocs.d.ts +2 -2
- package/dist/server/loopDocs.d.ts.map +1 -1
- package/dist/server/loopDocs.js +38 -31
- package/dist/server/loopDocs.js.map +1 -1
- package/dist/server/loopDocs.sql +1 -3
- package/dist/server/model-catalog.d.ts.map +1 -1
- package/dist/server/model-catalog.js +2 -1
- package/dist/server/model-catalog.js.map +1 -1
- package/dist/server/model-route.d.ts +1 -1
- package/dist/server/model-route.d.ts.map +1 -1
- package/dist/server/model-route.js +4 -2
- package/dist/server/model-route.js.map +1 -1
- package/dist/server/seam-entry-read.sql +3 -4
- package/dist/server/seam-loop.sql +2 -9
- package/dist/server/workspace-capabilities.sql +19 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +5 -17
- package/dist/service.js.map +1 -1
- package/docs/members.md +83 -0
- package/docs/skills.md +50 -0
- package/migrations/001_workspaces.sql +53 -0
- package/migrations/002_workers.sql +183 -0
- package/migrations/003_loops.sql +326 -0
- package/migrations/004_inference.sql +360 -0
- package/migrations/005_entries.sql +207 -0
- package/migrations/006_log.sql +578 -0
- package/migrations/007_subscriptions.sql +175 -0
- package/migrations/008_interactions.sql +29 -0
- package/package.json +33 -40
- package/digest-sql/channel-dispositions/dispositions.sql +0 -15
- package/digest-sql/channel-state/state.sql +0 -6
- package/digest-sql/curation/curation.sql +0 -6
- package/digest-sql/derivations/derivations.sql +0 -4
- package/digest-sql/embeddings/embeddings.sql +0 -4
- package/digest-sql/entry-dispositions/dispositions.sql +0 -15
- package/digest-sql/entry-state/state.sql +0 -6
- package/digest-sql/token-counts/token-counts.sql +0 -2
- package/dist/core/EmbeddingCall.d.ts +0 -23
- package/dist/core/EmbeddingCall.d.ts.map +0 -1
- package/dist/core/EmbeddingCall.js +0 -149
- package/dist/core/EmbeddingCall.js.map +0 -1
- package/dist/core/OverflowTurn.d.ts +0 -11
- package/dist/core/OverflowTurn.d.ts.map +0 -1
- package/dist/core/OverflowTurn.js +0 -80
- package/dist/core/OverflowTurn.js.map +0 -1
- package/dist/core/Owner.d.ts +0 -8
- package/dist/core/Owner.d.ts.map +0 -1
- package/dist/core/Owner.js +0 -46
- package/dist/core/Owner.js.map +0 -1
- package/dist/core/SendBroadcastHandler.d.ts.map +0 -1
- package/dist/core/SendBroadcastHandler.js +0 -159
- package/dist/core/SendBroadcastHandler.js.map +0 -1
- package/dist/core/VectorPump.d.ts +0 -28
- package/dist/core/VectorPump.d.ts.map +0 -1
- package/dist/core/VectorPump.js +0 -130
- package/dist/core/VectorPump.js.map +0 -1
- package/dist/core/owner.sql +0 -11
- package/dist/core/worker-settings.d.ts +0 -10
- package/dist/core/worker-settings.d.ts.map +0 -1
- package/dist/core/worker-settings.js +0 -53
- package/dist/core/worker-settings.js.map +0 -1
- package/dist/schemes/_entry-chunk.d.ts +0 -14
- package/dist/schemes/_entry-chunk.d.ts.map +0 -1
- package/dist/schemes/_entry-chunk.js +0 -165
- package/dist/schemes/_entry-chunk.js.map +0 -1
- package/dist/schemes/_entry-semantic.d.ts +0 -63
- package/dist/schemes/_entry-semantic.d.ts.map +0 -1
- package/dist/schemes/_entry-semantic.js +0 -299
- package/dist/schemes/_entry-semantic.js.map +0 -1
- package/dist/schemes/_entry-semantic.sql +0 -99
- package/dist/schemes/cosine.d.ts +0 -4
- package/dist/schemes/cosine.d.ts.map +0 -1
- package/dist/schemes/cosine.js +0 -9
- package/dist/schemes/cosine.js.map +0 -1
- package/dist/server/WorkerCapabilities.d.ts +0 -21
- package/dist/server/WorkerCapabilities.d.ts.map +0 -1
- package/dist/server/WorkerCapabilities.js.map +0 -1
- package/dist/server/WorkerResidency.d.ts +0 -40
- package/dist/server/WorkerResidency.d.ts.map +0 -1
- package/dist/server/WorkerResidency.js +0 -283
- package/dist/server/WorkerResidency.js.map +0 -1
- package/dist/server/seam-log-read.sql +0 -21
- package/dist/server/worker-capabilities.sql +0 -28
- package/migrations/001_schema.sql +0 -2207
|
@@ -16,15 +16,17 @@ interface RenderLogOptions {
|
|
|
16
16
|
readonly acceptedAttachmentKinds?: ReadonlySet<PacketAttachment["kind"]>;
|
|
17
17
|
readonly projectRoot?: string | null;
|
|
18
18
|
}
|
|
19
|
-
interface
|
|
19
|
+
interface ReclaimableLogItem {
|
|
20
20
|
readonly path: string;
|
|
21
|
-
readonly
|
|
22
|
-
readonly tokensActive: number;
|
|
21
|
+
readonly logTokens: number;
|
|
23
22
|
}
|
|
24
23
|
export interface RenderedLog {
|
|
25
24
|
readonly content: string;
|
|
26
|
-
readonly
|
|
25
|
+
readonly records: readonly string[];
|
|
26
|
+
readonly curationTargets: readonly ReclaimableLogItem[];
|
|
27
27
|
readonly attachments: readonly PacketAttachment[];
|
|
28
|
+
readonly unadmittedOutput: readonly number[];
|
|
29
|
+
readonly newOverflow: boolean;
|
|
28
30
|
}
|
|
29
31
|
import { imageWeight, pdfWeight } from "./attachments.ts";
|
|
30
32
|
export { imageWeight, pdfWeight };
|
|
@@ -34,7 +36,7 @@ export default class PacketWire {
|
|
|
34
36
|
static renderSection(s: SectionView): string;
|
|
35
37
|
static renderFailurePointers(failures: unknown): string;
|
|
36
38
|
static renderNotices(notices: unknown): string;
|
|
37
|
-
static
|
|
39
|
+
static renderDelegation(workers: unknown, streams: unknown): string;
|
|
38
40
|
static renderGit(git: unknown): string;
|
|
39
41
|
static renderLog(entries: unknown, weighContent: WeighContent, options?: RenderLogOptions): string;
|
|
40
42
|
static renderLogWithAccounting(entries: unknown, weighContent: WeighContent, options?: RenderLogOptions): RenderedLog;
|
|
@@ -43,6 +45,6 @@ export default class PacketWire {
|
|
|
43
45
|
role: string;
|
|
44
46
|
content: string;
|
|
45
47
|
}>;
|
|
46
|
-
static wireMessages(packet: RequestPacket, bytesOf: (attachment: PacketAttachment) => Promise<Uint8Array
|
|
48
|
+
static wireMessages(packet: RequestPacket, bytesOf: (attachment: PacketAttachment) => Promise<Uint8Array>, accepts?: (kind: PacketAttachment["kind"]) => boolean): Promise<ChatMessage[]>;
|
|
47
49
|
}
|
|
48
50
|
//# sourceMappingURL=packet-wire.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packet-wire.d.ts","sourceRoot":"","sources":["../../src/core/packet-wire.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"packet-wire.d.ts","sourceRoot":"","sources":["../../src/core/packet-wire.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AA6F7E,UAAU,WAAW;IAAG,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE;AAC/G,UAAU,MAAM;IAAG,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAA;CAAE;AAC7C,KAAK,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAC7C,UAAU,gBAAgB;IACtB,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IAGzE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC;AAED,UAAU,kBAAkB;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAExD,QAAQ,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAClD,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CACjC;AAED,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AAoBlC,MAAM,CAAC,OAAO,OAAO,UAAU;;IAK3B,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAM1E;IAKD,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAK3C;IAKD,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAMtD;IAKD,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAe7C;IAOD,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAElE;IAaD,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAGrC;IAKD,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAErG;IAID,MAAM,CAAC,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,GAAE,gBAAqB,GAAG,WAAW,CAcxH;IAKD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAG1D;IAKD,MAAM,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAMpF;IA4yBD,OAAa,YAAY,CACrB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,OAAO,CAAC,UAAU,CAAC,EAC9D,OAAO,GAAE,CAAC,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,KAAK,OAAoB,GAClE,OAAO,CAAC,WAAW,EAAE,CAAC,CASxB;CAkEJ"}
|
package/dist/core/packet-wire.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
// Packet's ordered list of sections renders to ChatMessage.content
|
|
3
|
-
// strings the LLM receives. Engine imports this for the wire payload; the
|
|
4
|
-
// digest tool imports it to write byte-identical packetNNN.{system,user}.md
|
|
5
|
-
// files. No second implementation, no drift.
|
|
6
|
-
//
|
|
7
|
-
// Format and omission rules are owned by {§packet-markdown}. Section producers
|
|
8
|
-
// supply names and typed content; this projection preserves their ordered evidence.
|
|
1
|
+
import { TurnDisposition } from "@plurnk/plurnk-contracts";
|
|
9
2
|
import { relative, sep } from "node:path";
|
|
10
3
|
import { Problems, Validator } from "@plurnk/plurnk-contracts";
|
|
11
4
|
import { TextCoordinates } from "@plurnk/plurnk-mimetypes";
|
|
@@ -13,35 +6,15 @@ import { renderTarget } from "./plurnk-uri.js";
|
|
|
13
6
|
import LogBody from "./LogBody.js";
|
|
14
7
|
import LogEntryProjection from "./LogEntryProjection.js";
|
|
15
8
|
import LogVisibility from "./LogVisibility.js";
|
|
9
|
+
import BodyPreview from "../content/body-preview.js";
|
|
16
10
|
import { assertEditReceipt, assertResourceEffects, LineAnchors, } from "../content/index.js";
|
|
17
|
-
const editReceiptRevisionChars = () => {
|
|
18
|
-
const raw = process.env.PLURNK_SERVICE_EDIT_RECEIPT_REVISION_CHARS;
|
|
19
|
-
const value = Number(raw);
|
|
20
|
-
if (!Number.isSafeInteger(value) || value < 1 || value > 64) {
|
|
21
|
-
throw new Error(`PLURNK_SERVICE_EDIT_RECEIPT_REVISION_CHARS must be a safe integer from 1 through 64, got ${JSON.stringify(raw)}`);
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
};
|
|
25
|
-
const previewBounds = () => {
|
|
26
|
-
const rawLines = process.env.PLURNK_SERVICE_PREVIEW_LINES;
|
|
27
|
-
const rawChars = process.env.PLURNK_SERVICE_PREVIEW_CHARS;
|
|
28
|
-
const lines = Number(rawLines);
|
|
29
|
-
const chars = Number(rawChars);
|
|
30
|
-
if (!Number.isSafeInteger(lines) || lines < 1) {
|
|
31
|
-
throw new Error(`PLURNK_SERVICE_PREVIEW_LINES must be a positive safe integer, got ${JSON.stringify(rawLines)}`);
|
|
32
|
-
}
|
|
33
|
-
if (!Number.isSafeInteger(chars) || chars < 1) {
|
|
34
|
-
throw new Error(`PLURNK_SERVICE_PREVIEW_CHARS must be a positive safe integer, got ${JSON.stringify(rawChars)}`);
|
|
35
|
-
}
|
|
36
|
-
return { lines, chars };
|
|
37
|
-
};
|
|
38
11
|
// {§packet-attachment-parts} — the attachment kinds and their readout weights live in one table.
|
|
39
12
|
import { imageWeight, pdfWeight } from "./attachments.js";
|
|
40
13
|
export { imageWeight, pdfWeight };
|
|
41
14
|
export default class PacketWire {
|
|
42
15
|
// {§packet-markdown} Render the sections in `slot` to one ChatMessage.content
|
|
43
16
|
// string. Sections render in list order; empties are omitted (no empty headers on the wire);
|
|
44
|
-
//
|
|
17
|
+
// JSON follows its H2 directly; other content has one blank line (null header is bare),
|
|
45
18
|
// trailing newlines stripped, joined with a blank line.
|
|
46
19
|
static renderSlot(sections, slot) {
|
|
47
20
|
return sections
|
|
@@ -50,15 +23,15 @@ export default class PacketWire {
|
|
|
50
23
|
.filter((p) => p.length > 0)
|
|
51
24
|
.join("\n\n");
|
|
52
25
|
}
|
|
53
|
-
// One section → its markdown block
|
|
54
|
-
// content when header is null/empty), trailing newlines stripped. Empty
|
|
26
|
+
// One section → its markdown block, trailing newlines stripped. Empty
|
|
55
27
|
// content renders to "" so renderSlot drops it. This is the unit the
|
|
56
28
|
// per-section `weight` is measured over.
|
|
57
29
|
static renderSection(s) {
|
|
58
30
|
if (typeof s.content !== "string" || s.content.length === 0)
|
|
59
31
|
return "";
|
|
60
32
|
const header = typeof s.header === "string" && s.header.length > 0 ? s.header : null;
|
|
61
|
-
|
|
33
|
+
const separator = s.content.startsWith("{") || s.content.startsWith("[") ? "\n" : "\n\n";
|
|
34
|
+
return (header ? `## ${header}${separator}${s.content}` : s.content).replace(/\n+$/, "");
|
|
62
35
|
}
|
|
63
36
|
// Durable operation failures render as `{status, path}` JSON pointers to the log rows that
|
|
64
37
|
// own their exact RFC 9457 results.
|
|
@@ -88,23 +61,27 @@ export default class PacketWire {
|
|
|
88
61
|
return `* ${kind}${message.length > 0 ? `: ${message}` : ""}${position}`;
|
|
89
62
|
}).join("\n");
|
|
90
63
|
}
|
|
91
|
-
// The
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
|
|
64
|
+
// The Delegation section ({§child-orientation}) — the OPPOSITE of advice: terse `{status, path}`
|
|
65
|
+
// JSON pointers (same shape as the errors section) to the live things the worker holds, under the
|
|
66
|
+
// word the teaching uses for handing work out: its unconcluded workers and its open streams. The
|
|
67
|
+
// model SEES them each turn and reasons for itself (READ / SEND / KILL via the path). Orienting
|
|
68
|
+
// state, never an instruction; both lists render every turn, `[]` when empty ({§packet-empty-sections}).
|
|
69
|
+
static renderDelegation(workers, streams) {
|
|
70
|
+
return `{"workers":${PacketWire.#pointers(workers)},\n"streams":${PacketWire.#pointers(streams)}}`;
|
|
71
|
+
}
|
|
72
|
+
static #pointers(rows) {
|
|
96
73
|
const items = Array.isArray(rows) ? rows : [];
|
|
97
74
|
const pointers = items.map((r) => JSON.stringify({
|
|
98
75
|
status: r.status,
|
|
99
76
|
path: r.path,
|
|
100
77
|
...(typeof r.detail === "string" && r.detail.length > 0 ? { detail: r.detail } : {}),
|
|
101
78
|
}));
|
|
102
|
-
return pointers.length === 0 ? "" : `[${pointers.join(",\n")}]`;
|
|
79
|
+
return pointers.length === 0 ? "[]" : `[${pointers.join(",\n")}]`;
|
|
103
80
|
}
|
|
104
81
|
// The git section content: the working-tree summary. "" when absent.
|
|
105
82
|
static renderGit(git) {
|
|
106
83
|
const status = git === null || git === undefined ? "" : PacketWire.#renderGitState(git);
|
|
107
|
-
return status
|
|
84
|
+
return status.length === 0 ? "" : `> [!NOTE]\n${status.split("\n").map((line) => `> ${line}`).join("\n")}`;
|
|
108
85
|
}
|
|
109
86
|
// The log section's content: the model's curated rows as Markdown-framed records ({§log-wire-format}).
|
|
110
87
|
// Data only — no prose leads the records (the log carries rules for no one). Empty log → ""
|
|
@@ -117,12 +94,16 @@ export default class PacketWire {
|
|
|
117
94
|
static renderLogWithAccounting(entries, weighContent, options = {}) {
|
|
118
95
|
const log = Array.isArray(entries) ? entries : [];
|
|
119
96
|
if (log.length === 0)
|
|
120
|
-
return { content: "",
|
|
97
|
+
return { content: "", records: [], curationTargets: [], attachments: [], unadmittedOutput: [], newOverflow: false };
|
|
121
98
|
const rows = PacketWire.#renderLogEntries(log, weighContent, options);
|
|
99
|
+
const records = rows.map(({ content }) => content);
|
|
122
100
|
return {
|
|
123
|
-
content:
|
|
124
|
-
|
|
101
|
+
content: records.join("\n\n"),
|
|
102
|
+
records,
|
|
103
|
+
curationTargets: rows.flatMap(({ curationTarget }) => curationTarget === null ? [] : [curationTarget]),
|
|
125
104
|
attachments: rows.flatMap(({ attachment }) => attachment === null ? [] : [attachment]),
|
|
105
|
+
unadmittedOutput: rows.flatMap(({ unadmittedOutput }) => unadmittedOutput === null ? [] : [unadmittedOutput]),
|
|
106
|
+
newOverflow: rows.some(({ newOverflow }) => newOverflow),
|
|
126
107
|
};
|
|
127
108
|
}
|
|
128
109
|
// Read one section's content by name off a packet (Engine's or re-parsed).
|
|
@@ -144,7 +125,7 @@ export default class PacketWire {
|
|
|
144
125
|
}
|
|
145
126
|
// Number a non-READ body line as `<N>:<line>` — `N:` followed by NO separator whitespace
|
|
146
127
|
// ({§render-rule-line-navigable-prefix}): the leading digit prevents column-zero fence collisions and gives
|
|
147
|
-
// the model line refs for free (
|
|
128
|
+
// the model line refs for free (`READ (...) <42-46>`), while the absence of any separator means a
|
|
148
129
|
// reproduced line has nothing between `N:` and the content to copy — the hard-tab separator used
|
|
149
130
|
// to leak into edit bodies and corrupt indentation. The content's OWN leading whitespace is
|
|
150
131
|
// content, preserved verbatim. `N` is left-padded to the body's line-range width so every body
|
|
@@ -159,12 +140,12 @@ export default class PacketWire {
|
|
|
159
140
|
const prefix = () => `${String(line++).padStart(width, " ")}:`;
|
|
160
141
|
return `${prefix()}${body.replace(/(\r\n|\r(?!\n)|\n)(?=[\s\S])/g, (separator) => `${separator}${prefix()}`)}`;
|
|
161
142
|
}
|
|
162
|
-
static #numberSelectedLines(body, ordinals, startLine, lineAnchors, lineNumberWidth, numericLineNumberWidth) {
|
|
143
|
+
static #numberSelectedLines(body, ordinals, startLine, lineAnchors, lineNumberWidth, numericLineNumberWidth, sourceLineNumbers) {
|
|
163
144
|
const lines = TextCoordinates.logicalLines(body);
|
|
164
145
|
if (lines.length !== ordinals.length) {
|
|
165
146
|
throw new TypeError("A sparse log-body projection requires one source ordinal per rendered line.");
|
|
166
147
|
}
|
|
167
|
-
const displayed = ordinals.map((ordinal) => startLine + ordinal - 1);
|
|
148
|
+
const displayed = ordinals.map((ordinal) => sourceLineNumbers === null ? startLine + ordinal - 1 : sourceLineNumbers[ordinal - 1]);
|
|
168
149
|
const width = lineAnchors === null
|
|
169
150
|
? numericLineNumberWidth > 0
|
|
170
151
|
? numericLineNumberWidth
|
|
@@ -192,14 +173,14 @@ export default class PacketWire {
|
|
|
192
173
|
// Exact READ content receives source-width-aligned `@hash N:`; other textual bodies receive `N:`.
|
|
193
174
|
// Matchers consume canonical content before this presentation projection.
|
|
194
175
|
// Empty content produces no body.
|
|
195
|
-
static #renderContentBody(content, startLine = 1, lineAnchors = null, lineNumberWidth = null, numericLineNumberWidth = 0, lineOrdinals = null) {
|
|
176
|
+
static #renderContentBody(content, startLine = 1, lineAnchors = null, lineNumberWidth = null, numericLineNumberWidth = 0, lineOrdinals = null, sourceLineNumbers = null) {
|
|
196
177
|
if (content.length === 0)
|
|
197
178
|
return "";
|
|
198
179
|
// `startLine === null` means the producer already supplied numbered
|
|
199
180
|
// content; re-numbering would duplicate its coordinates.
|
|
200
181
|
const rendered = startLine !== null
|
|
201
182
|
? lineOrdinals !== null
|
|
202
|
-
? PacketWire.#numberSelectedLines(content, lineOrdinals, startLine, lineAnchors, lineNumberWidth, numericLineNumberWidth)
|
|
183
|
+
? PacketWire.#numberSelectedLines(content, lineOrdinals, startLine, lineAnchors, lineNumberWidth, numericLineNumberWidth, sourceLineNumbers)
|
|
203
184
|
: lineAnchors === null
|
|
204
185
|
? PacketWire.#numberLines(content, startLine, numericLineNumberWidth)
|
|
205
186
|
: LineAnchors.render(content, startLine, lineAnchors, lineNumberWidth ?? 0)
|
|
@@ -216,19 +197,23 @@ export default class PacketWire {
|
|
|
216
197
|
return null;
|
|
217
198
|
}
|
|
218
199
|
}
|
|
219
|
-
//
|
|
220
|
-
// line across turns — prefix-cache friendly. The preceding H3 owns identity.
|
|
200
|
+
// {§log-wire-format} Orientation precedes telemetry on every receipt.
|
|
221
201
|
static #canonicalJson(obj) {
|
|
222
202
|
const keys = Object.keys(obj).sort();
|
|
223
203
|
const sorted = {};
|
|
204
|
+
for (const key of ["target", "aside"]) {
|
|
205
|
+
if (Object.hasOwn(obj, key))
|
|
206
|
+
sorted[key] = obj[key];
|
|
207
|
+
}
|
|
224
208
|
for (const k of keys)
|
|
225
209
|
sorted[k] = obj[k];
|
|
226
210
|
return JSON.stringify(sorted);
|
|
227
211
|
}
|
|
228
212
|
static #receiptMeta(value) {
|
|
229
213
|
const receipt = assertEditReceipt(value);
|
|
214
|
+
// The durable receipt keeps the full revision for forensics; the model gets no token it
|
|
215
|
+
// cannot use (operator, 2026-09-13: "ditch rev").
|
|
230
216
|
const head = {
|
|
231
|
-
rev: receipt.revision.slice(0, editReceiptRevisionChars()),
|
|
232
217
|
extent: `${receipt.unit} ${receipt.before}->${receipt.after}`,
|
|
233
218
|
...(receipt.parseIssues === undefined
|
|
234
219
|
? {}
|
|
@@ -287,41 +272,14 @@ export default class PacketWire {
|
|
|
287
272
|
throw new TypeError("A packet log row requires an addressable coordinate.");
|
|
288
273
|
return `log:///${coordinate}/${leaf}`;
|
|
289
274
|
}
|
|
290
|
-
static #offsetAfterCharacters(text, count) {
|
|
291
|
-
let offset = 0;
|
|
292
|
-
let consumed = 0;
|
|
293
|
-
while (offset < text.length && consumed < count) {
|
|
294
|
-
if (text.startsWith("\r\n", offset)) {
|
|
295
|
-
offset += 2;
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
const codePoint = text.codePointAt(offset);
|
|
299
|
-
if (codePoint === undefined)
|
|
300
|
-
break;
|
|
301
|
-
offset += String.fromCodePoint(codePoint).length;
|
|
302
|
-
}
|
|
303
|
-
consumed++;
|
|
304
|
-
}
|
|
305
|
-
return offset;
|
|
306
|
-
}
|
|
307
275
|
// One preview function for every bounded model-facing projection. Lines
|
|
308
276
|
// protect ordinary documents and Unicode characters protect a single-line
|
|
309
277
|
// bomb. Once a physical line is complete, a character cut retreats to that
|
|
310
278
|
// line boundary rather than exposing a partial coordinate prefix.
|
|
311
279
|
static #preview(text) {
|
|
312
|
-
const { lines: maxLines, chars: maxChars } = previewBounds();
|
|
313
280
|
const coordinates = new TextCoordinates(text);
|
|
314
281
|
const physicalLines = coordinates.logicalLines();
|
|
315
|
-
const
|
|
316
|
-
? physicalLines[maxLines - 1].end
|
|
317
|
-
: text.length;
|
|
318
|
-
const characterEnd = PacketWire.#offsetAfterCharacters(text, maxChars);
|
|
319
|
-
let end = Math.min(lineEnd, characterEnd);
|
|
320
|
-
if (characterEnd < text.length && characterEnd <= lineEnd) {
|
|
321
|
-
const completeLine = physicalLines.findLast((line) => line.separator.length > 0 && line.end <= characterEnd);
|
|
322
|
-
if (completeLine !== undefined)
|
|
323
|
-
end = completeLine.end;
|
|
324
|
-
}
|
|
282
|
+
const { end } = BodyPreview.select(text);
|
|
325
283
|
const cut = end < text.length;
|
|
326
284
|
return {
|
|
327
285
|
text: text.slice(0, end),
|
|
@@ -446,17 +404,22 @@ export default class PacketWire {
|
|
|
446
404
|
};
|
|
447
405
|
}
|
|
448
406
|
static #visibleBody(entry, body) {
|
|
449
|
-
const
|
|
407
|
+
const trimmed = LogVisibility.parse(entry.folded ?? LogVisibility.OPEN);
|
|
408
|
+
const folded = LogVisibility.combine(LogVisibility.parse(entry.initial_folded ?? LogVisibility.OPEN), trimmed);
|
|
450
409
|
const lines = TextCoordinates.logicalLines(body.content);
|
|
451
410
|
const totalLines = lines.length;
|
|
452
411
|
const clipped = LogVisibility.clipped(folded, totalLines);
|
|
453
412
|
const ordinals = LogVisibility.visibleLineOrdinals(clipped, totalLines);
|
|
413
|
+
const readableOrdinals = LogVisibility.visibleLineOrdinals(trimmed, totalLines);
|
|
414
|
+
const select = (selected) => selected.map((ordinal) => {
|
|
415
|
+
const line = lines[ordinal - 1];
|
|
416
|
+
return body.content.slice(line.start, line.end);
|
|
417
|
+
}).join("");
|
|
454
418
|
return {
|
|
455
|
-
content: ordinals
|
|
456
|
-
const line = lines[ordinal - 1];
|
|
457
|
-
return body.content.slice(line.start, line.end);
|
|
458
|
-
}).join(""),
|
|
419
|
+
content: select(ordinals),
|
|
459
420
|
ordinals,
|
|
421
|
+
readableContent: select(readableOrdinals),
|
|
422
|
+
readableOrdinals,
|
|
460
423
|
folded: clipped,
|
|
461
424
|
totalLines,
|
|
462
425
|
fullyFolded: LogVisibility.fullyFolded(clipped, totalLines),
|
|
@@ -538,16 +501,14 @@ export default class PacketWire {
|
|
|
538
501
|
}
|
|
539
502
|
meta.git = git;
|
|
540
503
|
}
|
|
541
|
-
//
|
|
542
|
-
//
|
|
543
|
-
//
|
|
544
|
-
|
|
545
|
-
// and every non-200 stays explicit (#338).
|
|
546
|
-
if (typeof e.status === "number" && (op === "SEND" || op === "KILL" || e.status !== 200))
|
|
504
|
+
// SEND, TASK, destructive KILL, and non-200 statuses stay explicit.
|
|
505
|
+
// Successful log-KILL rows never reach this projection
|
|
506
|
+
// ({§log-kill-meta-operation}).
|
|
507
|
+
if (typeof e.status === "number" && (op === "SEND" || op === "KILL" || typeof op === "string" && TurnDisposition.isOp(op) || e.status !== 200))
|
|
547
508
|
meta.status = e.status;
|
|
548
509
|
const tx = (typeof e.tx === "string" ? PacketWire.#safeParse(e.tx) : e.tx);
|
|
549
|
-
if (typeof tx?.
|
|
550
|
-
meta.
|
|
510
|
+
if (typeof tx?.aside === "string")
|
|
511
|
+
meta.aside = tx.aside;
|
|
551
512
|
const target = PacketWire.#renderActionTarget(e.target);
|
|
552
513
|
// {§exec-stream}: a terminal stream observation's address is the stream it observed,
|
|
553
514
|
// rendered under `stream` like the invocation's own link — never a `target`, which
|
|
@@ -572,6 +533,11 @@ export default class PacketWire {
|
|
|
572
533
|
else if (target !== null) {
|
|
573
534
|
meta[terminalStream ? "stream" : "target"] = target;
|
|
574
535
|
}
|
|
536
|
+
// {§worker-auto-name} The created identity is an outcome, not an authored target.
|
|
537
|
+
if ((op === "WORK" || op === "FORK") && e.attrs !== null && typeof e.attrs === "object"
|
|
538
|
+
&& typeof e.attrs.worker === "string") {
|
|
539
|
+
meta.worker = e.attrs.worker;
|
|
540
|
+
}
|
|
575
541
|
// EXEC's output is a separate stream entry ({§exec-stream}); its address rides in a
|
|
576
542
|
// `stream` link, distinct from the runtime-owned invocation target.
|
|
577
543
|
// {§exec-target-routing} {§fs-namespace} — the receipt names the working directory only
|
|
@@ -621,19 +587,23 @@ export default class PacketWire {
|
|
|
621
587
|
// {§retrieval-packet-metadata}: one extent/coordinate owner plus
|
|
622
588
|
// only FIND aggregates that add information beyond that extent.
|
|
623
589
|
let findItems = null;
|
|
590
|
+
// {§matcher-option} — a pattern rides the heading; the row shows it as `matcher`.
|
|
591
|
+
const patterned = tx !== null && tx !== undefined && typeof tx === "object" && tx.matcher !== null && typeof tx.matcher === "object" && typeof tx.matcher.raw === "string";
|
|
592
|
+
if (patterned) {
|
|
593
|
+
meta.matcher = tx.matcher.raw;
|
|
594
|
+
if (op !== "FIND" && rx !== null && typeof rx === "object" && typeof rx.matched === "number")
|
|
595
|
+
meta.matched = rx.matched;
|
|
596
|
+
}
|
|
597
|
+
// {§channel-selection-visibility} — a READ names the resource's other channels with their
|
|
598
|
+
// tokens, so the row itself shows the choice a FIND listing would.
|
|
599
|
+
if (op === "READ" && rx !== null && typeof rx === "object" && rx.channels !== null && typeof rx.channels === "object") {
|
|
600
|
+
meta.channels = rx.channels;
|
|
601
|
+
}
|
|
602
|
+
// {§send-response-receipt} — a reply's row names the prompts it answered.
|
|
603
|
+
if (op === "SEND" && rx !== null && typeof rx === "object" && Array.isArray(rx.recipients)) {
|
|
604
|
+
meta.recipients = rx.recipients;
|
|
605
|
+
}
|
|
624
606
|
if (op === "READ" || op === "FIND") {
|
|
625
|
-
const findMatcher = op === "FIND"
|
|
626
|
-
&& tx !== null
|
|
627
|
-
&& tx !== undefined
|
|
628
|
-
&& typeof tx === "object"
|
|
629
|
-
&& tx.body !== null
|
|
630
|
-
&& typeof tx.body === "object";
|
|
631
|
-
if (findMatcher) {
|
|
632
|
-
const body = tx?.body;
|
|
633
|
-
if (body !== null && typeof body === "object" && typeof body.raw === "string") {
|
|
634
|
-
meta.matcher = body.raw;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
607
|
if (op === "FIND" && rx !== null && typeof rx === "object" && typeof rx.content === "string") {
|
|
638
608
|
const parsed = PacketWire.#safeParse(rx.content);
|
|
639
609
|
if (Array.isArray(parsed))
|
|
@@ -669,7 +639,8 @@ export default class PacketWire {
|
|
|
669
639
|
&& rx.returnedItemsWeightTotal !== rx.itemsWeightTotal) {
|
|
670
640
|
meta.returnedItemsTokenTotal = rx.returnedItemsWeightTotal;
|
|
671
641
|
}
|
|
672
|
-
if (
|
|
642
|
+
if (op === "FIND"
|
|
643
|
+
&& patterned
|
|
673
644
|
&& range !== null
|
|
674
645
|
&& typeof range === "object"
|
|
675
646
|
&& range.unit === "resource"
|
|
@@ -681,11 +652,10 @@ export default class PacketWire {
|
|
|
681
652
|
}
|
|
682
653
|
}
|
|
683
654
|
// {§edit-result-receipt-projection} {§edit-result-copy-move-effects}
|
|
684
|
-
//
|
|
685
|
-
// one receipt; COPY/MOVE own ordered resource effects whose
|
|
655
|
+
// EDIT/scoped entry KILL own one receipt; COPY/MOVE own resource effects whose
|
|
686
656
|
// optional receipts describe scoped textual materializations.
|
|
687
657
|
let structuredMutationReceipt = false;
|
|
688
|
-
if (op === "EDIT" && rx !== null && typeof rx === "object" && Object.hasOwn(rx, "receipt")) {
|
|
658
|
+
if ((op === "EDIT" || op === "KILL") && rx !== null && typeof rx === "object" && Object.hasOwn(rx, "receipt")) {
|
|
689
659
|
Object.assign(meta, PacketWire.#receiptMeta(rx.receipt));
|
|
690
660
|
structuredMutationReceipt = true;
|
|
691
661
|
}
|
|
@@ -704,19 +674,21 @@ export default class PacketWire {
|
|
|
704
674
|
structuredMutationReceipt = effects.some((effect) => effect.receipt !== undefined);
|
|
705
675
|
}
|
|
706
676
|
// The canonical full body is shared with log READ, log FIND,
|
|
707
|
-
// and search derivation. READ/FIND own selection bounds,
|
|
708
|
-
//
|
|
677
|
+
// and search derivation. READ/FIND own selection bounds, TASK and
|
|
678
|
+
// admitted programs remain complete, and prompt rows share their packet
|
|
709
679
|
// allowance. Structured mutation receipts own their join bound;
|
|
710
680
|
// every remaining body uses the ordinary fixed preview.
|
|
711
681
|
const fullBody = bodies[index];
|
|
712
682
|
const bodyVisibility = visibility[index];
|
|
713
|
-
const projectedBody =
|
|
714
|
-
|
|
715
|
-
:
|
|
683
|
+
const projectedBody = {
|
|
684
|
+
...fullBody,
|
|
685
|
+
content: bodyVisibility.fullyFolded ? bodyVisibility.readableContent : bodyVisibility.content,
|
|
686
|
+
};
|
|
716
687
|
const emptyFind = op === "FIND" && e.status === 200 && findItems === 0;
|
|
717
688
|
const previewExempt = op === "READ"
|
|
718
689
|
|| op === "FIND"
|
|
719
|
-
|| op === "
|
|
690
|
+
|| op === "TASK"
|
|
691
|
+
|| (op === null && renderedLeaf === "ops")
|
|
720
692
|
|| structuredMutationReceipt;
|
|
721
693
|
const lineAnchors = op === "READ" ? e.lineAnchors ?? null : null;
|
|
722
694
|
const lineNumberWidth = op === "READ" ? e.lineNumberWidth ?? null : null;
|
|
@@ -730,11 +702,10 @@ export default class PacketWire {
|
|
|
730
702
|
const numericLineNumberWidth = findRange === null
|
|
731
703
|
? bodyStartLine === null || bodyVisibility.totalLines === 0
|
|
732
704
|
? 0
|
|
733
|
-
: String(bodyStartLine + bodyVisibility.totalLines - 1).length
|
|
705
|
+
: String(fullBody.lineOrdinals?.at(-1) ?? bodyStartLine + bodyVisibility.totalLines - 1).length
|
|
734
706
|
: String(findRange.total).length;
|
|
735
|
-
const allOrdinals = Array.from({ length: bodyVisibility.totalLines }, (_, ordinal) => ordinal + 1);
|
|
736
707
|
const sourceOrdinals = bodyVisibility.fullyFolded
|
|
737
|
-
?
|
|
708
|
+
? bodyVisibility.readableOrdinals
|
|
738
709
|
: bodyVisibility.ordinals;
|
|
739
710
|
const promptProjectionWeight = promptProjectionWeights.get(index);
|
|
740
711
|
const projection = promptProjectionWeight !== undefined
|
|
@@ -748,15 +719,7 @@ export default class PacketWire {
|
|
|
748
719
|
const projectedOrdinals = sourceOrdinals.slice(0, projectedLineCount);
|
|
749
720
|
const body = emptyFind || projection.text.length === 0
|
|
750
721
|
? ""
|
|
751
|
-
: PacketWire.#renderContentBody(projection.text, bodyStartLine, lineAnchors, lineNumberWidth, numericLineNumberWidth, bodyStartLine === null ? null : projectedOrdinals);
|
|
752
|
-
// {§packet-token-accounting} — tokensBody reports the projected body's weight even
|
|
753
|
-
// when that body is withheld. Active accounting happens only after every field and
|
|
754
|
-
// the final row framing are known below.
|
|
755
|
-
const renderedBodyWeight = body.length > 0 ? weighContent(body) : 0;
|
|
756
|
-
// Never tokensBody:0 — a zero-weight visible body is field absence, and
|
|
757
|
-
// tokensBody presence is what marks the folded state (#338).
|
|
758
|
-
if (fullBody.content.length > 0 && renderedBodyWeight > 0)
|
|
759
|
-
meta.tokensBody = renderedBodyWeight;
|
|
722
|
+
: PacketWire.#renderContentBody(projection.text, bodyStartLine, lineAnchors, lineNumberWidth, numericLineNumberWidth, bodyStartLine === null ? null : projectedOrdinals, fullBody.lineOrdinals ?? null);
|
|
760
723
|
// lines beside tokens on a non-retrieval row with a navigable body — the count of
|
|
761
724
|
// `N:`-numbered lines (fences and unnumbered prose don't count), so the model can plan
|
|
762
725
|
// a <start,end> slice before paying for a READ. READ/FIND own typed extents instead.
|
|
@@ -766,12 +729,9 @@ export default class PacketWire {
|
|
|
766
729
|
if (bodyVisibility.folded.length > 0 && !bodyVisibility.fullyFolded) {
|
|
767
730
|
meta.folded = LogVisibility.format(bodyVisibility.folded);
|
|
768
731
|
}
|
|
769
|
-
|
|
770
|
-
// coordinate lines ⇒ visible, `tokensBody` without lines ⇒ suppressed,
|
|
771
|
-
// neither ⇒ no canonical body.
|
|
772
|
-
const display = fullBody.content.length === 0
|
|
732
|
+
const display = bodyVisibility.readableContent.length === 0
|
|
773
733
|
? "none"
|
|
774
|
-
: bodyVisibility.fullyFolded
|
|
734
|
+
: bodyVisibility.fullyFolded || e.output_withheld === true
|
|
775
735
|
? "folded"
|
|
776
736
|
: body.length === 0
|
|
777
737
|
? "none"
|
|
@@ -783,6 +743,18 @@ export default class PacketWire {
|
|
|
783
743
|
: projection.chunk;
|
|
784
744
|
if (display === "open" && projectedChunk !== null)
|
|
785
745
|
meta.chunk = projectedChunk;
|
|
746
|
+
const nativeCandidate = op === "READ" && typeof e.status === "number" && e.status >= 200 && e.status < 300
|
|
747
|
+
? PacketWire.#attachmentOf(e.rx, e.target, coordinate, target) : null;
|
|
748
|
+
const native = nativeCandidate !== null && (options.acceptedAttachmentKinds?.has(nativeCandidate.kind) ?? true)
|
|
749
|
+
? nativeCandidate : null;
|
|
750
|
+
const outputWithheld = e.output_withheld === true
|
|
751
|
+
&& ((!bodyVisibility.fullyFolded && body.length > 0) || native !== null);
|
|
752
|
+
if (outputWithheld) {
|
|
753
|
+
const omitted = body.length > 0
|
|
754
|
+
? `${projectedLineCount} output lines${native === null ? "" : " and native content"}`
|
|
755
|
+
: "native content";
|
|
756
|
+
meta.overflow = `${omitted} not shown; logTokensTotal exceeds logTokensMax`;
|
|
757
|
+
}
|
|
786
758
|
const renderRow = () => {
|
|
787
759
|
const metadata = PacketWire.#canonicalJson(meta);
|
|
788
760
|
return display === "open"
|
|
@@ -791,42 +763,40 @@ export default class PacketWire {
|
|
|
791
763
|
};
|
|
792
764
|
// The accounting field participates in the row it measures. Iterate
|
|
793
765
|
// until its decimal width and therefore the rendered row's curation
|
|
794
|
-
// weight are stable.
|
|
795
|
-
//
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
const candidate = display === "open"
|
|
800
|
-
&& op === "READ"
|
|
801
|
-
&& (e.native_delivered_at === null || e.native_delivered_at === undefined)
|
|
802
|
-
? PacketWire.#attachmentOf(e.rx, e.target, coordinate, target)
|
|
803
|
-
: null;
|
|
804
|
-
const attachment = candidate !== null
|
|
805
|
-
&& (options.acceptedAttachmentKinds?.has(candidate.kind) ?? true)
|
|
806
|
-
? candidate
|
|
766
|
+
// weight are stable. {§packet-token-accounting}
|
|
767
|
+
// {§packet-attachment-parts}: retained native content shares the row's curation lifetime.
|
|
768
|
+
const attachment = e.output_withheld !== true
|
|
769
|
+
&& !(bodyVisibility.totalLines > 0 && bodyVisibility.fullyFolded)
|
|
770
|
+
? native
|
|
807
771
|
: null;
|
|
808
772
|
if (attachment !== null)
|
|
809
773
|
meta.tokensAttachment = attachment.weight;
|
|
810
|
-
meta.
|
|
774
|
+
meta.logTokens = 0;
|
|
811
775
|
for (let pass = 0; pass < 8; pass += 1) {
|
|
812
|
-
const
|
|
813
|
-
if (meta.
|
|
814
|
-
const tokensBody = typeof meta.tokensBody === "number" ? meta.tokensBody : 0;
|
|
776
|
+
const logTokens = weighContent(renderRow()) + (attachment?.weight ?? 0);
|
|
777
|
+
if (meta.logTokens === logTokens) {
|
|
815
778
|
return {
|
|
816
779
|
content: renderRow(),
|
|
817
|
-
|
|
818
|
-
? { path, tokensBody, tokensActive }
|
|
819
|
-
: null,
|
|
780
|
+
curationTarget: { path, logTokens },
|
|
820
781
|
attachment,
|
|
782
|
+
unadmittedOutput: (display === "open" || attachment !== null)
|
|
783
|
+
&& fullBody.provenance === "returned"
|
|
784
|
+
&& e.output_admission_turn_id == null
|
|
785
|
+
&& typeof e.id === "number"
|
|
786
|
+
? e.id : null,
|
|
787
|
+
newOverflow: outputWithheld && e.newOverflow === true,
|
|
821
788
|
};
|
|
822
789
|
}
|
|
823
|
-
meta.
|
|
790
|
+
meta.logTokens = logTokens;
|
|
824
791
|
}
|
|
825
792
|
throw new Error("packet log row accounting did not converge");
|
|
826
793
|
});
|
|
827
794
|
}
|
|
828
795
|
static #attachmentOf(rx, target, coordinate, path) {
|
|
829
796
|
const view = rx;
|
|
797
|
+
const contentHash = rx?.nativeContentHash;
|
|
798
|
+
if (typeof contentHash !== "string")
|
|
799
|
+
return null;
|
|
830
800
|
const pathname = typeof target?.pathname === "string" && target.pathname.length > 0
|
|
831
801
|
? target.pathname
|
|
832
802
|
: typeof target?.raw === "string" ? target.raw : null;
|
|
@@ -837,17 +807,21 @@ export default class PacketWire {
|
|
|
837
807
|
if (image !== undefined && typeof image.mimetype === "string" && Number.isSafeInteger(image.width) && Number.isSafeInteger(image.height)) {
|
|
838
808
|
const width = image.width;
|
|
839
809
|
const height = image.height;
|
|
840
|
-
return { coordinate, path, scheme, pathname, mimetype: image.mimetype, kind: "image", width, height, weight: imageWeight(width, height) };
|
|
810
|
+
return { contentHash, coordinate, path, scheme, pathname, mimetype: image.mimetype, kind: "image", width, height, weight: imageWeight(width, height) };
|
|
841
811
|
}
|
|
842
812
|
const document = view?.document;
|
|
843
|
-
if (document !== undefined && typeof document.mimetype === "string" && Number.isSafeInteger(document.
|
|
844
|
-
const pages = document.pages;
|
|
845
|
-
return {
|
|
813
|
+
if (document !== undefined && typeof document.mimetype === "string" && Number.isSafeInteger(document.bytes)) {
|
|
814
|
+
const pages = Number.isSafeInteger(document.pages) ? document.pages : null;
|
|
815
|
+
return {
|
|
816
|
+
contentHash, coordinate, path, scheme, pathname, mimetype: document.mimetype, kind: "pdf",
|
|
817
|
+
...(pages === null ? {} : { pages }),
|
|
818
|
+
weight: pdfWeight(pages, document.bytes),
|
|
819
|
+
};
|
|
846
820
|
}
|
|
847
821
|
return null;
|
|
848
822
|
}
|
|
849
823
|
// {§packet-attachment-parts} — the wire form with native parts: user text first, then each accepted
|
|
850
|
-
//
|
|
824
|
+
// retained native part in observation order.
|
|
851
825
|
static async wireMessages(packet, bytesOf, accepts = () => true) {
|
|
852
826
|
const [system, user] = PacketWire.packetToWireMessages(packet);
|
|
853
827
|
const parts = [{ type: "text", text: user.content }];
|
|
@@ -855,13 +829,7 @@ export default class PacketWire {
|
|
|
855
829
|
if (!accepts(attachment.kind))
|
|
856
830
|
continue;
|
|
857
831
|
const bytes = await bytesOf(attachment);
|
|
858
|
-
if (bytes === null)
|
|
859
|
-
continue;
|
|
860
832
|
parts.push({ type: "file", data: bytes, mediaType: attachment.mimetype });
|
|
861
|
-
parts.push({
|
|
862
|
-
type: "text",
|
|
863
|
-
text: `${attachment.path} has been ejected from context. It must be READ again to retain it in context.`,
|
|
864
|
-
});
|
|
865
833
|
}
|
|
866
834
|
return parts.length === 1 ? [system, user] : [system, { role: "user", content: parts }];
|
|
867
835
|
}
|