@plurnk/plurnk-service 1.3.12 → 1.4.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 +84 -77
- package/INSTALL.md +50 -25
- package/README.md +24 -10
- package/SPEC.md +2311 -928
- package/dist/Paths.d.ts +4 -1
- package/dist/Paths.d.ts.map +1 -1
- package/dist/Paths.js +23 -21
- package/dist/Paths.js.map +1 -1
- package/dist/build-info.json +1 -1
- package/dist/content/edit-receipt.d.ts +13 -28
- package/dist/content/edit-receipt.d.ts.map +1 -1
- package/dist/content/edit-receipt.js +285 -104
- package/dist/content/edit-receipt.js.map +1 -1
- package/dist/content/edited-span.d.ts.map +1 -1
- package/dist/content/edited-span.js +2 -5
- package/dist/content/edited-span.js.map +1 -1
- package/dist/content/index.d.ts +3 -3
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/index.js +1 -1
- package/dist/content/index.js.map +1 -1
- package/dist/content/line-marker.d.ts +6 -9
- package/dist/content/line-marker.d.ts.map +1 -1
- package/dist/content/line-marker.js +7 -11
- package/dist/content/line-marker.js.map +1 -1
- package/dist/content/matcher.d.ts +14 -25
- package/dist/content/matcher.d.ts.map +1 -1
- package/dist/content/matcher.js +77 -107
- package/dist/content/matcher.js.map +1 -1
- package/dist/content/mimetype-binary.d.ts +2 -2
- package/dist/content/mimetype-binary.d.ts.map +1 -1
- package/dist/content/mimetype-binary.js +10 -10
- package/dist/content/mimetype-binary.js.map +1 -1
- package/dist/content/path-mimetype.js +3 -3
- package/dist/content/path-mimetype.js.map +1 -1
- package/dist/content/read-resolve.d.ts +8 -4
- package/dist/content/read-resolve.d.ts.map +1 -1
- package/dist/content/read-resolve.js +101 -49
- package/dist/content/read-resolve.js.map +1 -1
- package/dist/core/BranchReceipt.d.ts +7 -0
- package/dist/core/BranchReceipt.d.ts.map +1 -0
- package/dist/core/BranchReceipt.js +27 -0
- package/dist/core/BranchReceipt.js.map +1 -0
- package/dist/core/BudgetOverflow.d.ts +23 -0
- package/dist/core/BudgetOverflow.d.ts.map +1 -0
- package/dist/core/BudgetOverflow.js +61 -0
- package/dist/core/BudgetOverflow.js.map +1 -0
- package/dist/core/BudgetReadout.d.ts +8 -0
- package/dist/core/BudgetReadout.d.ts.map +1 -0
- package/dist/core/BudgetReadout.js +79 -0
- package/dist/core/BudgetReadout.js.map +1 -0
- package/dist/core/ChannelWrite.d.ts +28 -9
- package/dist/core/ChannelWrite.d.ts.map +1 -1
- package/dist/core/ChannelWrite.js +28 -21
- package/dist/core/ChannelWrite.js.map +1 -1
- package/dist/core/ChannelWrite.sql +11 -10
- package/dist/core/CoreSchemeServices.d.ts +10 -4
- package/dist/core/CoreSchemeServices.d.ts.map +1 -1
- package/dist/core/CoreSchemeServices.js +7 -1
- package/dist/core/CoreSchemeServices.js.map +1 -1
- package/dist/core/Dispatcher.d.ts +29 -20
- package/dist/core/Dispatcher.d.ts.map +1 -1
- package/dist/core/Dispatcher.js +1488 -599
- package/dist/core/Dispatcher.js.map +1 -1
- package/dist/core/DurableStatement.d.ts +6 -0
- package/dist/core/DurableStatement.d.ts.map +1 -0
- package/dist/core/DurableStatement.js +51 -0
- package/dist/core/DurableStatement.js.map +1 -0
- package/dist/core/Engine.d.ts +48 -20
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +1208 -789
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Engine.sql +309 -217
- package/dist/core/EnvFlags.js +1 -1
- package/dist/core/EnvFlags.js.map +1 -1
- package/dist/core/ErrorDetail.d.ts +6 -0
- package/dist/core/ErrorDetail.d.ts.map +1 -0
- package/dist/core/ErrorDetail.js +20 -0
- package/dist/core/ErrorDetail.js.map +1 -0
- package/dist/core/ExecutorRegistry.d.ts +14 -3
- package/dist/core/ExecutorRegistry.d.ts.map +1 -1
- package/dist/core/ExecutorRegistry.js +56 -30
- package/dist/core/ExecutorRegistry.js.map +1 -1
- package/dist/core/GitBranch.d.ts +20 -0
- package/dist/core/GitBranch.d.ts.map +1 -0
- package/dist/core/GitBranch.js +110 -0
- package/dist/core/GitBranch.js.map +1 -0
- package/dist/core/JournalTurn.d.ts +9 -0
- package/dist/core/JournalTurn.d.ts.map +1 -0
- package/dist/core/JournalTurn.js +14 -0
- package/dist/core/JournalTurn.js.map +1 -0
- package/dist/core/JournalTurn.sql +10 -0
- package/dist/core/LogBody.d.ts +17 -0
- package/dist/core/LogBody.d.ts.map +1 -0
- package/dist/core/LogBody.js +148 -0
- package/dist/core/LogBody.js.map +1 -0
- package/dist/core/LoopFlagsReader.d.ts +7 -0
- package/dist/core/LoopFlagsReader.d.ts.map +1 -0
- package/dist/core/LoopFlagsReader.js +33 -0
- package/dist/core/LoopFlagsReader.js.map +1 -0
- package/dist/core/LoopLifecycle.d.ts +8 -1
- package/dist/core/LoopLifecycle.d.ts.map +1 -1
- package/dist/core/LoopLifecycle.js +55 -9
- package/dist/core/LoopLifecycle.js.map +1 -1
- package/dist/core/LoopLifecycle.sql +9 -3
- package/dist/core/NoticeChannel.d.ts +13 -0
- package/dist/core/NoticeChannel.d.ts.map +1 -0
- package/dist/core/NoticeChannel.js +40 -0
- package/dist/core/NoticeChannel.js.map +1 -0
- package/dist/core/Owner.d.ts +0 -1
- package/dist/core/Owner.d.ts.map +1 -1
- package/dist/core/Owner.js +2 -5
- package/dist/core/Owner.js.map +1 -1
- package/dist/core/PacketBuilder.d.ts +25 -24
- package/dist/core/PacketBuilder.d.ts.map +1 -1
- package/dist/core/PacketBuilder.js +313 -375
- package/dist/core/PacketBuilder.js.map +1 -1
- package/dist/core/ProblemLog.d.ts +26 -0
- package/dist/core/ProblemLog.d.ts.map +1 -0
- package/dist/core/ProblemLog.js +58 -0
- package/dist/core/ProblemLog.js.map +1 -0
- package/dist/core/ProposalLifecycle.d.ts +15 -21
- package/dist/core/ProposalLifecycle.d.ts.map +1 -1
- package/dist/core/ProposalLifecycle.js +291 -78
- package/dist/core/ProposalLifecycle.js.map +1 -1
- package/dist/core/ProviderInstantiate.d.ts.map +1 -1
- package/dist/core/ProviderInstantiate.js +51 -48
- package/dist/core/ProviderInstantiate.js.map +1 -1
- package/dist/core/SchemeRegistry.d.ts +14 -8
- package/dist/core/SchemeRegistry.d.ts.map +1 -1
- package/dist/core/SchemeRegistry.js +189 -114
- package/dist/core/SchemeRegistry.js.map +1 -1
- package/dist/core/ServiceTeardown.d.ts +11 -0
- package/dist/core/ServiceTeardown.d.ts.map +1 -0
- package/dist/core/ServiceTeardown.js +70 -0
- package/dist/core/ServiceTeardown.js.map +1 -0
- package/dist/core/StoredPacket.d.ts +29 -0
- package/dist/core/StoredPacket.d.ts.map +1 -0
- package/dist/core/StoredPacket.js +147 -0
- package/dist/core/StoredPacket.js.map +1 -0
- package/dist/core/StrikeRail.d.ts +1 -2
- package/dist/core/StrikeRail.d.ts.map +1 -1
- package/dist/core/StrikeRail.js +25 -55
- package/dist/core/StrikeRail.js.map +1 -1
- package/dist/core/WorkerControlAddress.d.ts +17 -0
- package/dist/core/WorkerControlAddress.d.ts.map +1 -0
- package/dist/core/WorkerControlAddress.js +44 -0
- package/dist/core/WorkerControlAddress.js.map +1 -0
- package/dist/core/WorkerName.d.ts +31 -0
- package/dist/core/WorkerName.d.ts.map +1 -0
- package/dist/core/WorkerName.js +95 -0
- package/dist/core/WorkerName.js.map +1 -0
- package/dist/core/WorkerName.sql +36 -0
- package/dist/core/WorkspaceGate.d.ts +14 -0
- package/dist/core/WorkspaceGate.d.ts.map +1 -0
- package/dist/core/WorkspaceGate.js +155 -0
- package/dist/core/WorkspaceGate.js.map +1 -0
- package/dist/core/caps/CapsResolve.d.ts +1 -1
- package/dist/core/caps/CapsResolve.d.ts.map +1 -1
- package/dist/core/caps/CapsResolve.js.map +1 -1
- package/dist/core/caps/DbChannelCaps.d.ts +5 -11
- package/dist/core/caps/DbChannelCaps.d.ts.map +1 -1
- package/dist/core/caps/DbChannelCaps.js +24 -8
- package/dist/core/caps/DbChannelCaps.js.map +1 -1
- package/dist/core/caps/DbEntryCaps.d.ts +4 -13
- package/dist/core/caps/DbEntryCaps.d.ts.map +1 -1
- package/dist/core/caps/DbEntryCaps.js +15 -6
- 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 +12 -11
- package/dist/core/caps/DbNotifyCaps.js.map +1 -1
- package/dist/core/caps/DbProjectionCaps.d.ts +5 -5
- package/dist/core/caps/DbProjectionCaps.d.ts.map +1 -1
- package/dist/core/caps/DbProjectionCaps.js +21 -4
- package/dist/core/caps/DbProjectionCaps.js.map +1 -1
- package/dist/core/caps/DbSubscriptionCaps.d.ts +4 -4
- package/dist/core/caps/DbSubscriptionCaps.d.ts.map +1 -1
- package/dist/core/caps/DbSubscriptionCaps.js +57 -62
- package/dist/core/caps/DbSubscriptionCaps.js.map +1 -1
- package/dist/core/caps/DbTagCaps.d.ts +5 -12
- package/dist/core/caps/DbTagCaps.d.ts.map +1 -1
- package/dist/core/caps/DbTagCaps.js +14 -7
- package/dist/core/caps/DbTagCaps.js.map +1 -1
- package/dist/core/content-hash.js +1 -1
- package/dist/core/content-hash.js.map +1 -1
- package/dist/core/env-defaults.d.ts.map +1 -1
- package/dist/core/env-defaults.js.map +1 -1
- package/dist/core/fork.d.ts.map +1 -1
- package/dist/core/fork.js +55 -30
- package/dist/core/fork.js.map +1 -1
- package/dist/core/fork.sql +41 -27
- package/dist/core/git-env.d.ts +2 -0
- package/dist/core/git-env.d.ts.map +1 -1
- package/dist/core/git-env.js +13 -18
- package/dist/core/git-env.js.map +1 -1
- package/dist/core/git-iso.d.ts.map +1 -1
- package/dist/core/git-iso.js +9 -15
- package/dist/core/git-iso.js.map +1 -1
- package/dist/core/git-membership.d.ts +1 -1
- package/dist/core/git-membership.d.ts.map +1 -1
- package/dist/core/git-membership.js +198 -146
- 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 +10 -11
- package/dist/core/git-state.js.map +1 -1
- package/dist/core/owner.sql +1 -1
- package/dist/core/packet-inject.d.ts.map +1 -1
- package/dist/core/packet-inject.js +7 -11
- package/dist/core/packet-inject.js.map +1 -1
- package/dist/core/packet-wire.d.ts +2 -20
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +242 -368
- package/dist/core/packet-wire.js.map +1 -1
- package/dist/core/plurnk-uri.d.ts +12 -1
- package/dist/core/plurnk-uri.d.ts.map +1 -1
- package/dist/core/plurnk-uri.js +49 -29
- package/dist/core/plurnk-uri.js.map +1 -1
- package/dist/core/results.d.ts +16 -5
- package/dist/core/results.d.ts.map +1 -1
- package/dist/core/results.js +27 -18
- package/dist/core/results.js.map +1 -1
- package/dist/core/ruler_count.d.ts +4 -0
- package/dist/core/ruler_count.d.ts.map +1 -0
- package/dist/core/ruler_count.js +7 -0
- package/dist/core/ruler_count.js.map +1 -0
- package/dist/core/scheme-types.d.ts +9 -11
- package/dist/core/scheme-types.d.ts.map +1 -1
- package/dist/core/scheme-types.js.map +1 -1
- package/dist/core/search-gate.d.ts.map +1 -1
- package/dist/core/search-gate.js +3 -11
- package/dist/core/search-gate.js.map +1 -1
- package/dist/core/teaching-corpus.d.ts +6 -0
- package/dist/core/teaching-corpus.d.ts.map +1 -0
- package/dist/core/teaching-corpus.js +23 -0
- package/dist/core/teaching-corpus.js.map +1 -0
- package/dist/core/teaching.d.ts +0 -1
- package/dist/core/teaching.d.ts.map +1 -1
- package/dist/core/teaching.js +2 -8
- package/dist/core/teaching.js.map +1 -1
- package/dist/core/token-ruler.d.ts.map +1 -1
- package/dist/core/token-ruler.js +3 -16
- package/dist/core/token-ruler.js.map +1 -1
- package/dist/core/turn-scheduler.d.ts +1 -1
- package/dist/core/turn-scheduler.d.ts.map +1 -1
- package/dist/core/turn-scheduler.js +1 -1
- package/dist/core/turn-scheduler.js.map +1 -1
- package/dist/core/worker-cap.d.ts +2 -4
- package/dist/core/worker-cap.d.ts.map +1 -1
- package/dist/core/worker-cap.js +13 -4
- package/dist/core/worker-cap.js.map +1 -1
- package/dist/core/{run-ops.sql → worker-ops.sql} +11 -11
- package/dist/core/workspace-settings.d.ts.map +1 -1
- package/dist/core/workspace-settings.js +17 -9
- package/dist/core/workspace-settings.js.map +1 -1
- package/dist/digest/Digest.d.ts +2 -1
- package/dist/digest/Digest.d.ts.map +1 -1
- package/dist/digest/Digest.js +337 -138
- package/dist/digest/Digest.js.map +1 -1
- package/dist/digest/digest.sql +19 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/matrix/live-specimen.d.ts +9 -0
- package/dist/matrix/live-specimen.d.ts.map +1 -0
- package/dist/matrix/live-specimen.js +37 -0
- package/dist/matrix/live-specimen.js.map +1 -0
- package/dist/observe/api.d.ts +6 -0
- package/dist/observe/api.d.ts.map +1 -0
- package/dist/observe/api.js +11 -0
- package/dist/observe/api.js.map +1 -0
- package/dist/observe/init.d.ts +7 -0
- package/dist/observe/init.d.ts.map +1 -0
- package/dist/observe/init.js +159 -0
- package/dist/observe/init.js.map +1 -0
- package/dist/observe/metrics.d.ts +6 -0
- package/dist/observe/metrics.d.ts.map +1 -0
- package/dist/observe/metrics.js +15 -0
- package/dist/observe/metrics.js.map +1 -0
- package/dist/observe/spans.d.ts +4 -0
- package/dist/observe/spans.d.ts.map +1 -0
- package/dist/observe/spans.js +51 -0
- package/dist/observe/spans.js.map +1 -0
- package/dist/schemes/EffectPolicy.d.ts +1 -0
- package/dist/schemes/EffectPolicy.d.ts.map +1 -1
- package/dist/schemes/EffectPolicy.js +5 -2
- package/dist/schemes/EffectPolicy.js.map +1 -1
- package/dist/schemes/Exec.d.ts +6 -11
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +364 -247
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/ExecOutputScheme.d.ts +8 -7
- package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
- package/dist/schemes/ExecOutputScheme.js +48 -9
- package/dist/schemes/ExecOutputScheme.js.map +1 -1
- package/dist/schemes/File.d.ts +7 -11
- package/dist/schemes/File.d.ts.map +1 -1
- package/dist/schemes/File.js +279 -142
- package/dist/schemes/File.js.map +1 -1
- package/dist/schemes/Log.d.ts +4 -8
- package/dist/schemes/Log.d.ts.map +1 -1
- package/dist/schemes/Log.js +475 -208
- package/dist/schemes/Log.js.map +1 -1
- package/dist/schemes/Log.sql +62 -30
- package/dist/schemes/Prompt.d.ts +3 -2
- package/dist/schemes/Prompt.d.ts.map +1 -1
- package/dist/schemes/Prompt.js +9 -6
- package/dist/schemes/Prompt.js.map +1 -1
- package/dist/schemes/Skill.d.ts +1 -1
- package/dist/schemes/Skill.d.ts.map +1 -1
- package/dist/schemes/Skill.js +2 -3
- package/dist/schemes/Skill.js.map +1 -1
- package/dist/schemes/Worker.d.ts +8 -16
- package/dist/schemes/Worker.d.ts.map +1 -1
- package/dist/schemes/Worker.js +179 -69
- package/dist/schemes/Worker.js.map +1 -1
- package/dist/schemes/_entry-chunk.d.ts.map +1 -1
- package/dist/schemes/_entry-chunk.js +12 -5
- package/dist/schemes/_entry-chunk.js.map +1 -1
- package/dist/schemes/_entry-crud.d.ts +10 -9
- package/dist/schemes/_entry-crud.d.ts.map +1 -1
- package/dist/schemes/_entry-crud.js +59 -13
- package/dist/schemes/_entry-crud.js.map +1 -1
- package/dist/schemes/_entry-crud.sql +20 -8
- package/dist/schemes/_entry-find.d.ts +20 -15
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +339 -174
- package/dist/schemes/_entry-find.js.map +1 -1
- package/dist/schemes/_entry-find.sql +20 -8
- package/dist/schemes/_entry-graph.d.ts +4 -2
- package/dist/schemes/_entry-graph.d.ts.map +1 -1
- package/dist/schemes/_entry-graph.js +55 -31
- package/dist/schemes/_entry-graph.js.map +1 -1
- package/dist/schemes/_entry-graph.sql +37 -22
- package/dist/schemes/_entry-manifest.d.ts +10 -15
- package/dist/schemes/_entry-manifest.d.ts.map +1 -1
- package/dist/schemes/_entry-manifest.js +50 -268
- package/dist/schemes/_entry-manifest.js.map +1 -1
- package/dist/schemes/_entry-ops.d.ts +9 -14
- package/dist/schemes/_entry-ops.d.ts.map +1 -1
- package/dist/schemes/_entry-ops.js +149 -77
- package/dist/schemes/_entry-ops.js.map +1 -1
- package/dist/schemes/_entry-ops.sql +1 -1
- package/dist/schemes/_entry-semantic.d.ts +23 -8
- package/dist/schemes/_entry-semantic.d.ts.map +1 -1
- package/dist/schemes/_entry-semantic.js +141 -60
- package/dist/schemes/_entry-semantic.js.map +1 -1
- package/dist/schemes/_entry-semantic.sql +63 -45
- package/dist/schemes/_entry-send.d.ts +3 -4
- package/dist/schemes/_entry-send.d.ts.map +1 -1
- package/dist/schemes/_entry-send.js +48 -23
- package/dist/schemes/_entry-send.js.map +1 -1
- package/dist/schemes/_path-scope.d.ts +23 -0
- package/dist/schemes/_path-scope.d.ts.map +1 -0
- package/dist/schemes/_path-scope.js +61 -0
- package/dist/schemes/_path-scope.js.map +1 -0
- package/dist/schemes/_search-candidate.d.ts +20 -0
- package/dist/schemes/_search-candidate.d.ts.map +1 -0
- package/dist/schemes/_search-candidate.js +19 -0
- package/dist/schemes/_search-candidate.js.map +1 -0
- package/dist/schemes/_search-exclusion.d.ts +7 -0
- package/dist/schemes/_search-exclusion.d.ts.map +1 -0
- package/dist/schemes/_search-exclusion.js +23 -0
- package/dist/schemes/_search-exclusion.js.map +1 -0
- package/dist/schemes/_search-index.d.ts +6 -0
- package/dist/schemes/_search-index.d.ts.map +1 -0
- package/dist/schemes/_search-index.js +326 -0
- package/dist/schemes/_search-index.js.map +1 -0
- package/dist/schemes/cosine.js +1 -1
- package/dist/schemes/cosine.js.map +1 -1
- package/dist/schemes/exec-abort.js +3 -3
- package/dist/schemes/exec-abort.js.map +1 -1
- package/dist/schemes/exec-env.js +3 -3
- package/dist/schemes/exec-env.js.map +1 -1
- package/dist/server/BranchBatches.d.ts +48 -0
- package/dist/server/BranchBatches.d.ts.map +1 -0
- package/dist/server/BranchBatches.js +591 -0
- package/dist/server/BranchBatches.js.map +1 -0
- package/dist/server/Daemon.d.ts +36 -66
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +920 -446
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/DaemonModule.d.ts +31 -0
- package/dist/server/DaemonModule.d.ts.map +1 -0
- package/dist/server/DaemonModule.js +2 -0
- package/dist/server/DaemonModule.js.map +1 -0
- package/dist/server/branch-batch.sql +152 -0
- package/dist/server/client-input.d.ts +12 -0
- package/dist/server/client-input.d.ts.map +1 -1
- package/dist/server/client-input.js +262 -57
- package/dist/server/client-input.js.map +1 -1
- package/dist/server/dispatch-as-plurnk.d.ts +1 -1
- package/dist/server/dispatch-as-plurnk.d.ts.map +1 -1
- package/dist/server/dispatch-as-plurnk.js +15 -7
- package/dist/server/dispatch-as-plurnk.js.map +1 -1
- package/dist/server/drain.sql +92 -62
- package/dist/server/envelope.d.ts +2 -5
- package/dist/server/envelope.d.ts.map +1 -1
- package/dist/server/envelope.js +119 -95
- package/dist/server/envelope.js.map +1 -1
- package/dist/server/envelope.sql +19 -23
- package/dist/server/exec-poll-backoff.js +1 -1
- package/dist/server/exec-poll-backoff.js.map +1 -1
- package/dist/server/lifecycle-recovery.sql +79 -2
- package/dist/server/logEntry.d.ts +3 -1
- package/dist/server/logEntry.d.ts.map +1 -1
- package/dist/server/logEntry.js +4 -2
- package/dist/server/logEntry.js.map +1 -1
- package/dist/server/logEntry.sql +1 -1
- package/dist/server/loop-model.d.ts.map +1 -1
- package/dist/server/loop-model.js +22 -9
- package/dist/server/loop-model.js.map +1 -1
- package/dist/server/loopDocs.d.ts.map +1 -1
- package/dist/server/loopDocs.js +5 -4
- package/dist/server/loopDocs.js.map +1 -1
- package/dist/server/seam-entry-read.sql +15 -10
- package/dist/server/seam-log-read.sql +2 -2
- package/dist/server/seam-loop.sql +1 -1
- package/dist/server/seam-proposal-list.sql +17 -7
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +66 -60
- package/dist/service.js.map +1 -1
- package/migrations/001_schema.sql +897 -0
- package/package.json +57 -26
- package/dist/core/PluginLoader.d.ts +0 -20
- package/dist/core/PluginLoader.d.ts.map +0 -1
- package/dist/core/PluginLoader.js +0 -142
- package/dist/core/PluginLoader.js.map +0 -1
- package/dist/core/TelemetryChannel.d.ts +0 -37
- package/dist/core/TelemetryChannel.d.ts.map +0 -1
- package/dist/core/TelemetryChannel.js +0 -80
- package/dist/core/TelemetryChannel.js.map +0 -1
- package/dist/core/path-decode.d.ts +0 -3
- package/dist/core/path-decode.d.ts.map +0 -1
- package/dist/core/path-decode.js +0 -9
- package/dist/core/path-decode.js.map +0 -1
- package/dist/core/plugin-attribution.d.ts +0 -5
- package/dist/core/plugin-attribution.d.ts.map +0 -1
- package/dist/core/plugin-attribution.js +0 -39
- package/dist/core/plugin-attribution.js.map +0 -1
- package/dist/core/world-state.d.ts +0 -10
- package/dist/core/world-state.d.ts.map +0 -1
- package/dist/core/world-state.js +0 -35
- package/dist/core/world-state.js.map +0 -1
- package/dist/core/world-state.sql +0 -35
- package/dist/core/zero-pin.d.ts +0 -3
- package/dist/core/zero-pin.d.ts.map +0 -1
- package/dist/core/zero-pin.js +0 -16
- package/dist/core/zero-pin.js.map +0 -1
- package/dist/server/auto.d.ts +0 -6
- package/dist/server/auto.d.ts.map +0 -1
- package/dist/server/auto.js +0 -63
- package/dist/server/auto.js.map +0 -1
- package/dist/server/clientTurn.d.ts +0 -6
- package/dist/server/clientTurn.d.ts.map +0 -1
- package/dist/server/clientTurn.js +0 -22
- package/dist/server/clientTurn.js.map +0 -1
- package/dist/server/clientTurn.sql +0 -10
- package/dist/server/noProposals.d.ts +0 -6
- package/dist/server/noProposals.d.ts.map +0 -1
- package/dist/server/noProposals.js +0 -37
- package/dist/server/noProposals.js.map +0 -1
- package/dist/server/version-info.d.ts +0 -14
- package/dist/server/version-info.d.ts.map +0 -1
- package/dist/server/version-info.js +0 -69
- package/dist/server/version-info.js.map +0 -1
- package/migrations/0000-00-00.01_schema.sql +0 -536
- package/migrations/0004_loop-provider.sql +0 -3
- package/migrations/0005_subscription-published-channel.sql +0 -3
- package/migrations/0006_loop-max-turns.sql +0 -3
package/dist/Paths.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { type TeachingCorpusSource } from "@plurnk/plurnk-meta";
|
|
1
2
|
export default class Paths {
|
|
2
3
|
#private;
|
|
4
|
+
static readonly teachingRoot: string;
|
|
3
5
|
static migrations: string;
|
|
4
6
|
static instructionsSystem: string;
|
|
5
7
|
static personality: string;
|
|
6
|
-
static schemeDocs: string;
|
|
7
8
|
static defaultRequirements: string;
|
|
9
|
+
static defaultRequirementsTeachingSource: TeachingCorpusSource | null;
|
|
10
|
+
static teachingSource(source: TeachingCorpusSource): string;
|
|
8
11
|
static docs(): Array<{
|
|
9
12
|
entryName: string;
|
|
10
13
|
path: string;
|
package/dist/Paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paths.d.ts","sourceRoot":"","sources":["../src/Paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Paths.d.ts","sourceRoot":"","sources":["../src/Paths.ts"],"names":[],"mappings":"AAYA,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,CAAC,OAAO,OAAO,KAAK;;IAKtB,MAAM,CAAC,QAAQ,CAAC,YAAY,SAAmF;IAE/G,MAAM,CAAC,UAAU,SAA8C;IAC/D,MAAM,CAAC,kBAAkB,SAA+C;IAExE,MAAM,CAAC,WAAW,SAAqD;IAGvE,MAAM,CAAC,mBAAmB,SAAoC;IAC9D,MAAM,CAAC,iCAAiC,8BAAsC;IAE9E,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAE1D;IAqBD,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAUxD;CACJ"}
|
package/dist/Paths.js
CHANGED
|
@@ -1,45 +1,47 @@
|
|
|
1
1
|
// Package-relative paths to non-code artifacts.
|
|
2
2
|
//
|
|
3
3
|
// `migrations` ships in this package's tarball.
|
|
4
|
-
// `instructionsSystem` resolves to
|
|
5
|
-
//
|
|
6
|
-
// the grammar agent owns the prose.
|
|
4
|
+
// `instructionsSystem` resolves to the canonical model reference in the
|
|
5
|
+
// contracts package. Plurnk-service does not carry a second copy.
|
|
7
6
|
//
|
|
8
7
|
// Lives at src/ (one level above the package root, like the index barrel that
|
|
9
8
|
// re-exports it) so `..` resolves to PACKAGE_ROOT.
|
|
10
9
|
import { fileURLToPath } from "node:url";
|
|
11
10
|
import { dirname, resolve } from "node:path";
|
|
12
11
|
import { homedir } from "node:os";
|
|
12
|
+
import { TEACHING_CORPUS } from "@plurnk/plurnk-meta";
|
|
13
13
|
export default class Paths {
|
|
14
14
|
static #PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
15
|
-
static #
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
static #DOCS_ROOT = dirname(fileURLToPath(import.meta.resolve("@plurnk/plurnk-meta/package.json")));
|
|
15
|
+
static #CONTRACTS_ROOT = dirname(fileURLToPath(import.meta.resolve("@plurnk/plurnk-contracts/package.json")));
|
|
16
|
+
// {§teaching-corpus} — core consumes the teaching sources owned by
|
|
17
|
+
// @plurnk/plurnk-meta; admission and projection remain core-owned.
|
|
18
|
+
static teachingRoot = dirname(fileURLToPath(import.meta.resolve("@plurnk/plurnk-meta/package.json")));
|
|
20
19
|
static migrations = resolve(Paths.#PACKAGE_ROOT, "migrations");
|
|
21
|
-
static instructionsSystem = resolve(Paths.#
|
|
22
|
-
// The
|
|
23
|
-
static personality =
|
|
24
|
-
static
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
static instructionsSystem = resolve(Paths.#CONTRACTS_ROOT, "plurnk.md");
|
|
21
|
+
// The first-run policy seed and built-in/conditional pull-doc sources.
|
|
22
|
+
static personality = Paths.teachingSource(TEACHING_CORPUS.personality);
|
|
23
|
+
// {§requirements} — static recap appended at the end of the user slot.
|
|
24
|
+
static #DEFAULT_REQUIREMENTS = Paths.#resolveDefaultRequirements();
|
|
25
|
+
static defaultRequirements = Paths.#DEFAULT_REQUIREMENTS.path;
|
|
26
|
+
static defaultRequirementsTeachingSource = Paths.#DEFAULT_REQUIREMENTS.source;
|
|
27
|
+
static teachingSource(source) {
|
|
28
|
+
return resolve(Paths.teachingRoot, source);
|
|
29
|
+
}
|
|
31
30
|
// Resolve the default requirements file: `PLURNK_SERVICE_REQUIREMENTS` env (absolute
|
|
32
31
|
// or relative-to-package-root) overrides the docs package's `requirements.md`.
|
|
33
32
|
static #resolveDefaultRequirements() {
|
|
34
33
|
const env = process.env.PLURNK_SERVICE_REQUIREMENTS;
|
|
35
34
|
if (typeof env === "string" && env.length > 0) {
|
|
36
|
-
return resolve(Paths.#PACKAGE_ROOT, env);
|
|
35
|
+
return { path: resolve(Paths.#PACKAGE_ROOT, env), source: null };
|
|
37
36
|
}
|
|
38
|
-
return
|
|
37
|
+
return {
|
|
38
|
+
path: Paths.teachingSource(TEACHING_CORPUS.requirements),
|
|
39
|
+
source: TEACHING_CORPUS.requirements,
|
|
40
|
+
};
|
|
39
41
|
}
|
|
40
42
|
// Operator reference docs auto-READ into every model worker at turn 0.
|
|
41
43
|
// `PLURNK_SERVICE_MD_<ALIAS>=<path>` materializes <path>'s markdown as a
|
|
42
|
-
// `plurnk
|
|
44
|
+
// `worker://plurnk/<ALIAS>.md` entry the model READs — an idiomatic way
|
|
43
45
|
// to inject standing context (an ordinary entry + READ op, not a bespoke
|
|
44
46
|
// packet section). `~` expands to home; relative paths resolve
|
|
45
47
|
// against the package root. Resolved fresh each call so it tracks the env.
|
package/dist/Paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paths.js","sourceRoot":"","sources":["../src/Paths.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,gDAAgD;AAChD
|
|
1
|
+
{"version":3,"file":"Paths.js","sourceRoot":"","sources":["../src/Paths.ts"],"names":[],"mappings":"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"}
|
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"package":"@plurnk/plurnk-service","version":"1.
|
|
1
|
+
{"package":"@plurnk/plurnk-service","version":"1.4.0","revision":"36be3503f6eed553ace1f7990d1e42625c31b989","dirty":false}
|
|
@@ -1,35 +1,20 @@
|
|
|
1
|
-
import type { LineMarker } from "@plurnk/plurnk-
|
|
1
|
+
import type { LineMarker } from "@plurnk/plurnk-contracts";
|
|
2
|
+
import type { AppliedEditBatchReceipt, EditBatchReceipt, EditReceipt, ReviewerReplacementEditBatchReceipt } from "@plurnk/plurnk-schemes";
|
|
2
3
|
export interface ReceiptEdit {
|
|
3
4
|
readonly marker: LineMarker;
|
|
4
5
|
readonly body: string;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
export type { AppliedEditBatchReceipt, EditBatchReceipt, EditEffectReceipt, EditReceipt, EditReceiptUnit, ReviewerReplacementEditBatchReceipt, } from "@plurnk/plurnk-schemes";
|
|
8
|
+
export type ResourceEffectAction = "create" | "update" | "delete";
|
|
9
|
+
export interface ResourceEffect {
|
|
10
|
+
readonly target: string;
|
|
11
|
+
readonly action: ResourceEffectAction;
|
|
12
|
+
readonly receipt?: EditReceipt;
|
|
8
13
|
}
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
readonly result: string;
|
|
13
|
-
readonly removed: number;
|
|
14
|
-
readonly inserted: number;
|
|
15
|
-
readonly context: string;
|
|
16
|
-
}
|
|
17
|
-
export interface EditBatchReceipt {
|
|
18
|
-
readonly revision: string;
|
|
19
|
-
readonly unit: "lines" | "items";
|
|
20
|
-
readonly before: number;
|
|
21
|
-
readonly after: number;
|
|
22
|
-
readonly effects: readonly EditEffectReceipt[];
|
|
23
|
-
}
|
|
24
|
-
export interface EditReceipt {
|
|
25
|
-
readonly revision: string;
|
|
26
|
-
readonly unit: "lines" | "items";
|
|
27
|
-
readonly before: number;
|
|
28
|
-
readonly after: number;
|
|
29
|
-
readonly effect: EditEffectReceipt;
|
|
30
|
-
}
|
|
31
|
-
export declare const editReceiptUnit: (structuralJson: boolean, original: string, updated: string) => "lines" | "items";
|
|
14
|
+
export declare const assertEditReceipt: (value: unknown) => EditReceipt;
|
|
15
|
+
export declare const assertEditBatchReceipt: (value: unknown) => EditBatchReceipt;
|
|
16
|
+
export declare const assertResourceEffects: (value: unknown) => readonly ResourceEffect[];
|
|
32
17
|
export declare const projectEditReceipt: (receipt: EditBatchReceipt, index: number) => EditReceipt;
|
|
33
|
-
export declare const editReceipt: (original: string, updated: string, edits: readonly ReceiptEdit[]
|
|
34
|
-
export
|
|
18
|
+
export declare const editReceipt: (original: string, updated: string, edits: readonly ReceiptEdit[]) => AppliedEditBatchReceipt;
|
|
19
|
+
export declare const reviewerReplacementReceipt: (original: string, updated: string, authored: EditBatchReceipt) => ReviewerReplacementEditBatchReceipt;
|
|
35
20
|
//# sourceMappingURL=edit-receipt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-receipt.d.ts","sourceRoot":"","sources":["../../src/content/edit-receipt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edit-receipt.d.ts","sourceRoot":"","sources":["../../src/content/edit-receipt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EACR,uBAAuB,EACvB,gBAAgB,EAEhB,WAAW,EAEX,mCAAmC,EACtC,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAED,YAAY,EACR,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,mCAAmC,GACtC,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElE,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC;CAClC;AA2ED,eAAO,MAAM,iBAAiB,UAAW,OAAO,KAAG,WAuBlD,CAAC;AAEF,eAAO,MAAM,sBAAsB,UAAW,OAAO,KAAG,gBA4BvD,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAAW,OAAO,KAAG,SAAS,cAAc,EAqC7E,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAAa,gBAAgB,SAAS,MAAM,KAAG,WAwB7E,CAAC;AAiMF,eAAO,MAAM,WAAW,aACV,MAAM,WACP,MAAM,SACR,SAAS,WAAW,EAAE,KAC9B,uBAkBF,CAAC;AAEF,eAAO,MAAM,0BAA0B,aACzB,MAAM,WACP,MAAM,YACL,gBAAgB,KAC3B,mCAyBF,CAAC"}
|
|
@@ -1,40 +1,158 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
JSON.parse(original);
|
|
8
|
-
if (updated.length > 0)
|
|
9
|
-
JSON.parse(updated);
|
|
10
|
-
return "items";
|
|
2
|
+
import { InvalidOperationResultError } from "@plurnk/plurnk-contracts";
|
|
3
|
+
import LineMarkerOps from "./line-marker.js";
|
|
4
|
+
const receiptRecord = (value, label) => {
|
|
5
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
6
|
+
throw new InvalidOperationResultError(`${label} must be an object.`);
|
|
11
7
|
}
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
return value;
|
|
9
|
+
};
|
|
10
|
+
const exactFields = (record, fields, label) => {
|
|
11
|
+
const allowed = new Set(fields);
|
|
12
|
+
const unexpected = Object.keys(record).find((field) => !allowed.has(field));
|
|
13
|
+
if (unexpected !== undefined) {
|
|
14
|
+
throw new InvalidOperationResultError(`${label} contains unexpected field ${JSON.stringify(unexpected)}.`);
|
|
15
|
+
}
|
|
16
|
+
const missing = fields.find((field) => !Object.hasOwn(record, field));
|
|
17
|
+
if (missing !== undefined) {
|
|
18
|
+
throw new InvalidOperationResultError(`${label} is missing field ${JSON.stringify(missing)}.`);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const assertExtent = (value, field) => {
|
|
22
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
23
|
+
throw new InvalidOperationResultError(`EDIT receipt ${field} must be a non-negative safe integer.`);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const assertEffectReceipt = (value) => {
|
|
27
|
+
const effect = receiptRecord(value, "EDIT effect receipt");
|
|
28
|
+
exactFields(effect, ["requested", "source", "result", "removed", "inserted", "context"], "EDIT effect receipt");
|
|
29
|
+
for (const field of ["requested", "source", "result", "context"]) {
|
|
30
|
+
if (typeof effect[field] !== "string") {
|
|
31
|
+
throw new InvalidOperationResultError(`EDIT effect receipt ${field} must be a string.`);
|
|
32
|
+
}
|
|
14
33
|
}
|
|
34
|
+
assertExtent(effect.removed, "removed");
|
|
35
|
+
assertExtent(effect.inserted, "inserted");
|
|
36
|
+
return value;
|
|
37
|
+
};
|
|
38
|
+
const assertReceiptHead = (receipt, label) => {
|
|
39
|
+
if (typeof receipt.revision !== "string" || !/^[a-f0-9]{64}$/.test(receipt.revision)) {
|
|
40
|
+
throw new InvalidOperationResultError(`${label} revision must be a lowercase SHA-256 digest.`);
|
|
41
|
+
}
|
|
42
|
+
if (receipt.unit !== "lines" && receipt.unit !== "codePoints") {
|
|
43
|
+
throw new InvalidOperationResultError(`${label} unit must be 'lines' or 'codePoints'.`);
|
|
44
|
+
}
|
|
45
|
+
assertExtent(receipt.before, "before");
|
|
46
|
+
assertExtent(receipt.after, "after");
|
|
47
|
+
};
|
|
48
|
+
export const assertEditReceipt = (value) => {
|
|
49
|
+
const receipt = receiptRecord(value, "EDIT receipt");
|
|
50
|
+
if (receipt.disposition === "superseded") {
|
|
51
|
+
exactFields(receipt, Object.hasOwn(receipt, "replacement")
|
|
52
|
+
? ["revision", "unit", "before", "after", "disposition", "requested", "replacement"]
|
|
53
|
+
: ["revision", "unit", "before", "after", "disposition", "requested"], "EDIT receipt");
|
|
54
|
+
assertReceiptHead(receipt, "EDIT receipt");
|
|
55
|
+
if (typeof receipt.requested !== "string" || receipt.requested.length === 0) {
|
|
56
|
+
throw new InvalidOperationResultError("A superseded EDIT receipt requested marker must be a non-empty string.");
|
|
57
|
+
}
|
|
58
|
+
if (Object.hasOwn(receipt, "replacement"))
|
|
59
|
+
assertEffectReceipt(receipt.replacement);
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
exactFields(receipt, ["revision", "unit", "before", "after", "effect"], "EDIT receipt");
|
|
63
|
+
assertReceiptHead(receipt, "EDIT receipt");
|
|
64
|
+
assertEffectReceipt(receipt.effect);
|
|
65
|
+
return value;
|
|
66
|
+
};
|
|
67
|
+
export const assertEditBatchReceipt = (value) => {
|
|
68
|
+
const receipt = receiptRecord(value, "EDIT batch receipt");
|
|
69
|
+
if (receipt.disposition === "reviewer-replaced") {
|
|
70
|
+
exactFields(receipt, ["revision", "unit", "before", "after", "disposition", "superseded", "replacement"], "EDIT batch receipt");
|
|
71
|
+
assertReceiptHead(receipt, "EDIT batch receipt");
|
|
72
|
+
if (!Array.isArray(receipt.superseded)
|
|
73
|
+
|| receipt.superseded.length === 0
|
|
74
|
+
|| receipt.superseded.some((requested) => typeof requested !== "string" || requested.length === 0)) {
|
|
75
|
+
throw new InvalidOperationResultError("A reviewer-replaced EDIT batch receipt superseded list must contain non-empty requested markers.");
|
|
76
|
+
}
|
|
77
|
+
assertEffectReceipt(receipt.replacement);
|
|
78
|
+
return value;
|
|
79
|
+
}
|
|
80
|
+
exactFields(receipt, ["revision", "unit", "before", "after", "effects"], "EDIT batch receipt");
|
|
81
|
+
assertReceiptHead(receipt, "EDIT batch receipt");
|
|
82
|
+
if (!Array.isArray(receipt.effects) || receipt.effects.length === 0) {
|
|
83
|
+
throw new InvalidOperationResultError("EDIT batch receipt effects must be a non-empty array.");
|
|
84
|
+
}
|
|
85
|
+
for (const effect of receipt.effects)
|
|
86
|
+
assertEffectReceipt(effect);
|
|
87
|
+
return value;
|
|
88
|
+
};
|
|
89
|
+
export const assertResourceEffects = (value) => {
|
|
90
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
91
|
+
throw new InvalidOperationResultError("Resource effects must be a non-empty array.");
|
|
92
|
+
}
|
|
93
|
+
for (const candidate of value) {
|
|
94
|
+
const effect = receiptRecord(candidate, "Resource effect");
|
|
95
|
+
const fields = Object.hasOwn(effect, "receipt")
|
|
96
|
+
? ["target", "action", "receipt"]
|
|
97
|
+
: ["target", "action"];
|
|
98
|
+
exactFields(effect, fields, "Resource effect");
|
|
99
|
+
if (typeof effect.target !== "string" || effect.target.length === 0) {
|
|
100
|
+
throw new InvalidOperationResultError("Resource effect target must be a non-empty string.");
|
|
101
|
+
}
|
|
102
|
+
if (effect.action !== "create"
|
|
103
|
+
&& effect.action !== "update"
|
|
104
|
+
&& effect.action !== "delete") {
|
|
105
|
+
throw new InvalidOperationResultError("Resource effect action must be 'create', 'update', or 'delete'.");
|
|
106
|
+
}
|
|
107
|
+
if (Object.hasOwn(effect, "receipt")) {
|
|
108
|
+
if (effect.action === "delete") {
|
|
109
|
+
throw new InvalidOperationResultError("Only a created or updated resource effect may carry a text receipt.");
|
|
110
|
+
}
|
|
111
|
+
const receipt = assertEditReceipt(effect.receipt);
|
|
112
|
+
if (effect.action === "create" && receipt.before !== 0) {
|
|
113
|
+
throw new InvalidOperationResultError("A created resource effect receipt must have a before extent of zero.");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return value;
|
|
15
118
|
};
|
|
16
119
|
export const projectEditReceipt = (receipt, index) => {
|
|
17
|
-
const
|
|
120
|
+
const exact = assertEditBatchReceipt(receipt);
|
|
121
|
+
if ("disposition" in exact) {
|
|
122
|
+
const requested = exact.superseded[index];
|
|
123
|
+
if (requested === undefined)
|
|
124
|
+
throw new Error(`EDIT receipt has no superseded request at index ${index}`);
|
|
125
|
+
return {
|
|
126
|
+
revision: exact.revision,
|
|
127
|
+
unit: exact.unit,
|
|
128
|
+
before: exact.before,
|
|
129
|
+
after: exact.after,
|
|
130
|
+
disposition: "superseded",
|
|
131
|
+
requested,
|
|
132
|
+
...(index === 0 ? { replacement: exact.replacement } : {}),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const effect = exact.effects[index];
|
|
18
136
|
if (effect === undefined)
|
|
19
137
|
throw new Error(`EDIT receipt has no effect at index ${index}`);
|
|
20
138
|
return {
|
|
21
|
-
revision:
|
|
22
|
-
unit:
|
|
23
|
-
before:
|
|
24
|
-
after:
|
|
139
|
+
revision: exact.revision,
|
|
140
|
+
unit: exact.unit,
|
|
141
|
+
before: exact.before,
|
|
142
|
+
after: exact.after,
|
|
25
143
|
effect,
|
|
26
144
|
};
|
|
27
145
|
};
|
|
28
146
|
const splitLines = (content) => {
|
|
29
147
|
if (content.length === 0)
|
|
30
148
|
return [];
|
|
31
|
-
const lines = content.split(
|
|
32
|
-
if (
|
|
149
|
+
const lines = content.split(/\r\n|\r|\n/);
|
|
150
|
+
if (/[\r\n]$/.test(content))
|
|
33
151
|
lines.pop();
|
|
34
152
|
return lines;
|
|
35
153
|
};
|
|
36
154
|
const markerText = ({ marks }) => `<${marks.join(",")}>`;
|
|
37
|
-
const
|
|
155
|
+
const sourceLineRange = (marker, total) => {
|
|
38
156
|
const first = marker.marks[0];
|
|
39
157
|
const last = marker.marks[1];
|
|
40
158
|
if (last !== undefined) {
|
|
@@ -46,113 +164,176 @@ const sourceRange = (marker, total) => {
|
|
|
46
164
|
return { start: 1, end: 0, removed: 0 };
|
|
47
165
|
if (first === -1)
|
|
48
166
|
return { start: total + 1, end: total, removed: 0 };
|
|
49
|
-
if (!Number.isInteger(first))
|
|
50
|
-
|
|
51
|
-
return { start, end: start - 1, removed: 0 };
|
|
52
|
-
}
|
|
167
|
+
if (!Number.isInteger(first))
|
|
168
|
+
throw new Error("Whole-line EDIT receipts require integer coordinates.");
|
|
53
169
|
return { start: first, end: first, removed: 1 };
|
|
54
170
|
};
|
|
55
|
-
|
|
56
|
-
const { unit = "lines" } = options;
|
|
171
|
+
const lineEffects = (original, edits) => {
|
|
57
172
|
const before = splitLines(original);
|
|
58
|
-
const after = splitLines(updated);
|
|
59
|
-
let sourceShape = "scalar";
|
|
60
|
-
const itemCount = (content) => {
|
|
61
|
-
if (content.length === 0)
|
|
62
|
-
return 0;
|
|
63
|
-
const parsed = JSON.parse(content);
|
|
64
|
-
if (Array.isArray(parsed))
|
|
65
|
-
return parsed.length;
|
|
66
|
-
if (parsed !== null && typeof parsed === "object")
|
|
67
|
-
return Object.keys(parsed).length;
|
|
68
|
-
return 1;
|
|
69
|
-
};
|
|
70
|
-
if (unit === "items" && (original.length > 0 || updated.length > 0)) {
|
|
71
|
-
const parsed = JSON.parse(original.length > 0 ? original : updated);
|
|
72
|
-
sourceShape = Array.isArray(parsed) ? "array" : parsed !== null && typeof parsed === "object" ? "object" : "scalar";
|
|
73
|
-
}
|
|
74
|
-
const countBody = (body) => {
|
|
75
|
-
if (unit === "lines")
|
|
76
|
-
return splitLines(body).length;
|
|
77
|
-
if (body.length === 0)
|
|
78
|
-
return 0;
|
|
79
|
-
const parsed = JSON.parse(body);
|
|
80
|
-
if (sourceShape === "array")
|
|
81
|
-
return Array.isArray(parsed) ? parsed.length : 1;
|
|
82
|
-
if (sourceShape === "object") {
|
|
83
|
-
const values = Array.isArray(parsed) ? parsed : [parsed];
|
|
84
|
-
return values.reduce((count, value) => count + (value !== null && typeof value === "object" && !Array.isArray(value) ? Object.keys(value).length : 0), 0);
|
|
85
|
-
}
|
|
86
|
-
return Array.isArray(parsed) ? parsed.length : 1;
|
|
87
|
-
};
|
|
88
|
-
const beforeExtent = unit === "lines" ? before.length : itemCount(original);
|
|
89
|
-
const afterExtent = unit === "lines" ? after.length : itemCount(updated);
|
|
90
173
|
let offset = 0;
|
|
91
|
-
const
|
|
174
|
+
const effects = new Array(edits.length);
|
|
92
175
|
edits
|
|
93
|
-
.map((edit, index) => ({
|
|
94
|
-
|
|
176
|
+
.map((edit, index) => ({
|
|
177
|
+
edit,
|
|
178
|
+
index,
|
|
179
|
+
source: sourceLineRange(edit.marker, before.length),
|
|
180
|
+
}))
|
|
181
|
+
.sort((left, right) => left.source.start - right.source.start)
|
|
95
182
|
.forEach(({ edit, index, source }) => {
|
|
96
|
-
const inserted =
|
|
183
|
+
const inserted = splitLines(edit.body).length;
|
|
97
184
|
const resultStart = source.start + offset;
|
|
98
|
-
const resultEnd = inserted === 0
|
|
185
|
+
const resultEnd = inserted === 0
|
|
186
|
+
? resultStart - 1
|
|
187
|
+
: resultStart + inserted - 1;
|
|
99
188
|
offset += inserted - source.removed;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
source
|
|
189
|
+
effects[index] = {
|
|
190
|
+
requested: markerText(edit.marker),
|
|
191
|
+
source: source.removed === 0
|
|
192
|
+
? `${source.start}^`
|
|
193
|
+
: source.start === source.end
|
|
194
|
+
? `${source.start}`
|
|
195
|
+
: `${source.start}-${source.end}`,
|
|
196
|
+
result: resultEnd < resultStart
|
|
197
|
+
? `${resultStart}^`
|
|
198
|
+
: resultStart === resultEnd
|
|
199
|
+
? `${resultStart}`
|
|
200
|
+
: `${resultStart}-${resultEnd}`,
|
|
201
|
+
removed: source.removed,
|
|
103
202
|
inserted,
|
|
104
|
-
|
|
105
|
-
|
|
203
|
+
context: "",
|
|
204
|
+
resultStartLine: resultStart,
|
|
205
|
+
resultEndLine: Math.max(resultStart, resultEnd),
|
|
106
206
|
};
|
|
107
207
|
});
|
|
108
|
-
|
|
208
|
+
return effects.map((effect, index) => {
|
|
109
209
|
if (effect === undefined)
|
|
110
210
|
throw new Error(`EDIT receipt calculation omitted effect ${index}`);
|
|
111
211
|
return effect;
|
|
112
212
|
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
for (let line = Math.max(1, join - joinRadius); line <= Math.min(contextItems.length, end + joinRadius); line += 1) {
|
|
135
|
-
visible.add(line);
|
|
213
|
+
};
|
|
214
|
+
const codePointCount = (content) => [...content].length;
|
|
215
|
+
const codePointOffset = (content, jsOffset) => codePointCount(content.slice(0, jsOffset));
|
|
216
|
+
const jsOffsetFromCodePoints = (content, offset) => [...content].slice(0, offset).join("").length;
|
|
217
|
+
const coordinateAt = (content, codePoints) => {
|
|
218
|
+
const prefix = content.slice(0, jsOffsetFromCodePoints(content, codePoints));
|
|
219
|
+
const lines = prefix.split(/\r\n|\r|\n/);
|
|
220
|
+
return {
|
|
221
|
+
line: lines.length,
|
|
222
|
+
column: codePointCount(lines.at(-1) ?? "") + 1,
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
const coordinateText = ({ line, column }) => `${line}:${column}`;
|
|
226
|
+
const codePointEffects = (original, updated, edits) => {
|
|
227
|
+
const effects = new Array(edits.length);
|
|
228
|
+
let offset = 0;
|
|
229
|
+
edits
|
|
230
|
+
.map((edit, index) => {
|
|
231
|
+
const replacement = LineMarkerOps.textReplacement(original, edit.marker, edit.body);
|
|
232
|
+
if ("error" in replacement) {
|
|
233
|
+
throw new Error(`EDIT receipt could not resolve ${markerText(edit.marker)}: ${replacement.error}`);
|
|
136
234
|
}
|
|
137
|
-
const contextRows = [...visible].sort((a, b) => a - b).map((line) => `${line}:${contextItems[line - 1]}`);
|
|
138
|
-
const sourceText = effect.source.removed === 0 ? `${effect.source.start}^` : effect.source.start === effect.source.end ? `${effect.source.start}` : `${effect.source.start}-${effect.source.end}`;
|
|
139
|
-
const resultText = effect.resultEnd < effect.resultStart ? `${effect.resultStart}^` : effect.resultStart === effect.resultEnd ? `${effect.resultStart}` : `${effect.resultStart}-${effect.resultEnd}`;
|
|
140
235
|
return {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
236
|
+
edit,
|
|
237
|
+
index,
|
|
238
|
+
replacement,
|
|
239
|
+
sourceStart: codePointOffset(original, replacement.start),
|
|
240
|
+
sourceEnd: codePointOffset(original, replacement.end),
|
|
241
|
+
inserted: codePointCount(replacement.body),
|
|
242
|
+
};
|
|
243
|
+
})
|
|
244
|
+
.sort((left, right) => left.sourceStart - right.sourceStart)
|
|
245
|
+
.forEach((effect) => {
|
|
246
|
+
const removed = effect.sourceEnd - effect.sourceStart;
|
|
247
|
+
const resultStart = effect.sourceStart + offset;
|
|
248
|
+
const resultEnd = resultStart + effect.inserted;
|
|
249
|
+
offset += effect.inserted - removed;
|
|
250
|
+
const sourceStart = coordinateAt(original, effect.sourceStart);
|
|
251
|
+
const sourceEnd = coordinateAt(original, effect.sourceEnd);
|
|
252
|
+
const updatedStart = coordinateAt(updated, resultStart);
|
|
253
|
+
const updatedEnd = coordinateAt(updated, resultEnd);
|
|
254
|
+
effects[effect.index] = {
|
|
255
|
+
requested: markerText(effect.edit.marker),
|
|
256
|
+
source: removed === 0
|
|
257
|
+
? `${coordinateText(sourceStart)}^`
|
|
258
|
+
: `${coordinateText(sourceStart)}-${coordinateText(sourceEnd)}`,
|
|
259
|
+
result: effect.inserted === 0
|
|
260
|
+
? `${coordinateText(updatedStart)}^`
|
|
261
|
+
: `${coordinateText(updatedStart)}-${coordinateText(updatedEnd)}`,
|
|
262
|
+
removed,
|
|
145
263
|
inserted: effect.inserted,
|
|
146
|
-
context:
|
|
264
|
+
context: "",
|
|
265
|
+
resultStartLine: updatedStart.line,
|
|
266
|
+
resultEndLine: updatedEnd.line,
|
|
147
267
|
};
|
|
148
268
|
});
|
|
149
|
-
|
|
269
|
+
return effects.map((effect, index) => {
|
|
270
|
+
if (effect === undefined)
|
|
271
|
+
throw new Error(`EDIT receipt calculation omitted effect ${index}`);
|
|
272
|
+
return effect;
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
const contextRadius = () => {
|
|
276
|
+
const raw = process.env.PLURNK_SERVICE_EDIT_RECEIPT_CONTEXT_LINES;
|
|
277
|
+
const value = Number(raw);
|
|
278
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
279
|
+
throw new Error(`PLURNK_SERVICE_EDIT_RECEIPT_CONTEXT_LINES must be a non-negative safe integer, got ${JSON.stringify(raw)}`);
|
|
280
|
+
}
|
|
281
|
+
return value;
|
|
282
|
+
};
|
|
283
|
+
const addContext = (effects, updated) => {
|
|
284
|
+
const lines = splitLines(updated);
|
|
285
|
+
const radius = contextRadius();
|
|
286
|
+
return effects.map((effect) => {
|
|
287
|
+
const first = Math.max(1, effect.resultStartLine - radius);
|
|
288
|
+
const last = Math.min(lines.length, Math.max(effect.resultStartLine, effect.resultEndLine) + radius);
|
|
289
|
+
const context = [];
|
|
290
|
+
for (let line = first; line <= last; line += 1) {
|
|
291
|
+
context.push(`${line}:${lines[line - 1]}`);
|
|
292
|
+
}
|
|
293
|
+
const { resultStartLine: _resultStartLine, resultEndLine: _resultEndLine, ...receipt } = effect;
|
|
294
|
+
return {
|
|
295
|
+
...receipt,
|
|
296
|
+
context: context.join("\n"),
|
|
297
|
+
};
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
export const editReceipt = (original, updated, edits) => {
|
|
301
|
+
const unit = edits.some(({ marker }) => marker.marks.length === 4)
|
|
302
|
+
? "codePoints"
|
|
303
|
+
: "lines";
|
|
304
|
+
const effects = unit === "codePoints"
|
|
305
|
+
? codePointEffects(original, updated, edits)
|
|
306
|
+
: lineEffects(original, edits);
|
|
150
307
|
return {
|
|
151
|
-
revision,
|
|
308
|
+
revision: createHash("sha256").update(updated).digest("hex"),
|
|
152
309
|
unit,
|
|
153
|
-
before:
|
|
154
|
-
|
|
155
|
-
|
|
310
|
+
before: unit === "codePoints"
|
|
311
|
+
? codePointCount(original)
|
|
312
|
+
: splitLines(original).length,
|
|
313
|
+
after: unit === "codePoints"
|
|
314
|
+
? codePointCount(updated)
|
|
315
|
+
: splitLines(updated).length,
|
|
316
|
+
effects: addContext(effects, updated),
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
export const reviewerReplacementReceipt = (original, updated, authored) => {
|
|
320
|
+
const exact = assertEditBatchReceipt(authored);
|
|
321
|
+
if ("disposition" in exact) {
|
|
322
|
+
throw new InvalidOperationResultError("A reviewer replacement cannot supersede an already replaced EDIT batch receipt.");
|
|
323
|
+
}
|
|
324
|
+
const landed = editReceipt(original, updated, [{ marker: { marks: [1, -1] }, body: updated }]);
|
|
325
|
+
const replacement = landed.effects[0];
|
|
326
|
+
if (replacement === undefined) {
|
|
327
|
+
throw new Error("Reviewer replacement receipt omitted its landed effect.");
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
revision: landed.revision,
|
|
331
|
+
unit: landed.unit,
|
|
332
|
+
before: landed.before,
|
|
333
|
+
after: landed.after,
|
|
334
|
+
disposition: "reviewer-replaced",
|
|
335
|
+
superseded: exact.effects.map(({ requested }) => requested),
|
|
336
|
+
replacement,
|
|
156
337
|
};
|
|
157
338
|
};
|
|
158
339
|
//# sourceMappingURL=edit-receipt.js.map
|