@plurnk/plurnk-service 1.6.1 → 1.8.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 +29 -42
- package/INSTALL.md +49 -10
- package/README.md +11 -1
- package/SPEC.md +702 -287
- package/digest-sql/channel-dispositions/dispositions.sql +15 -0
- package/digest-sql/channel-state/state.sql +6 -0
- package/digest-sql/curation/curation.sql +5 -0
- package/digest-sql/derivations/derivations.sql +4 -0
- package/digest-sql/embeddings/embeddings.sql +4 -0
- package/digest-sql/entry-dispositions/dispositions.sql +15 -0
- package/digest-sql/entry-state/state.sql +6 -0
- package/digest-sql/token-counts/token-counts.sql +2 -0
- package/dist/Paths.d.ts +2 -5
- package/dist/Paths.d.ts.map +1 -1
- package/dist/Paths.js +9 -21
- package/dist/Paths.js.map +1 -1
- package/dist/build-info.json +1 -1
- package/dist/content/read-projector.d.ts.map +1 -1
- package/dist/content/read-projector.js +4 -3
- package/dist/content/read-projector.js.map +1 -1
- package/dist/core/BudgetReadout.d.ts.map +1 -1
- package/dist/core/BudgetReadout.js +12 -22
- package/dist/core/BudgetReadout.js.map +1 -1
- package/dist/core/ChannelWrite.d.ts.map +1 -1
- package/dist/core/ChannelWrite.js.map +1 -1
- package/dist/core/ChannelWrite.sql +2 -1
- package/dist/core/ClientInteractions.d.ts +19 -0
- package/dist/core/ClientInteractions.d.ts.map +1 -0
- package/dist/core/ClientInteractions.js +124 -0
- package/dist/core/ClientInteractions.js.map +1 -0
- package/dist/core/ClientInteractions.sql +34 -0
- package/dist/core/CoreSchemeServices.d.ts +8 -2
- 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 +9 -6
- package/dist/core/Dispatcher.d.ts.map +1 -1
- package/dist/core/Dispatcher.js +74 -125
- package/dist/core/Dispatcher.js.map +1 -1
- package/dist/core/Engine.d.ts +26 -9
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +125 -44
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Engine.sql +112 -107
- package/dist/core/ExecutorRegistry.d.ts +19 -5
- package/dist/core/ExecutorRegistry.d.ts.map +1 -1
- package/dist/core/ExecutorRegistry.js +144 -18
- package/dist/core/ExecutorRegistry.js.map +1 -1
- package/dist/core/HostPaths.d.ts +29 -0
- package/dist/core/HostPaths.d.ts.map +1 -0
- package/dist/core/HostPaths.js +74 -0
- package/dist/core/HostPaths.js.map +1 -0
- package/dist/core/LegacyHome.d.ts +10 -0
- package/dist/core/LegacyHome.d.ts.map +1 -0
- package/dist/core/LegacyHome.js +170 -0
- package/dist/core/LegacyHome.js.map +1 -0
- package/dist/core/LogBody.d.ts +1 -1
- package/dist/core/LogBody.d.ts.map +1 -1
- package/dist/core/LogBody.js +2 -2
- package/dist/core/LogBody.js.map +1 -1
- package/dist/core/LogEntryProjection.js +1 -1
- package/dist/core/LogEntryProjection.js.map +1 -1
- package/dist/core/LogVisibility.d.ts +28 -0
- package/dist/core/LogVisibility.d.ts.map +1 -0
- package/dist/core/LogVisibility.js +215 -0
- package/dist/core/LogVisibility.js.map +1 -0
- package/dist/core/LoopLifecycle.d.ts +1 -0
- package/dist/core/LoopLifecycle.d.ts.map +1 -1
- package/dist/core/LoopLifecycle.js +8 -0
- package/dist/core/LoopLifecycle.js.map +1 -1
- package/dist/core/LoopLifecycle.sql +10 -0
- package/dist/core/OperatorConfig.d.ts +6 -0
- package/dist/core/OperatorConfig.d.ts.map +1 -0
- package/dist/core/OperatorConfig.js +92 -0
- package/dist/core/OperatorConfig.js.map +1 -0
- package/dist/core/OverflowTurn.d.ts +11 -0
- package/dist/core/OverflowTurn.d.ts.map +1 -0
- package/dist/core/OverflowTurn.js +77 -0
- package/dist/core/OverflowTurn.js.map +1 -0
- package/dist/core/Owner.js +2 -2
- package/dist/core/Owner.js.map +1 -1
- package/dist/core/PacketBuilder.d.ts +3 -15
- package/dist/core/PacketBuilder.d.ts.map +1 -1
- package/dist/core/PacketBuilder.js +52 -113
- package/dist/core/PacketBuilder.js.map +1 -1
- package/dist/core/ProblemLog.js +1 -1
- package/dist/core/ProblemLog.js.map +1 -1
- package/dist/core/ProposalLifecycle.d.ts +3 -1
- package/dist/core/ProposalLifecycle.d.ts.map +1 -1
- package/dist/core/ProposalLifecycle.js +9 -26
- package/dist/core/ProposalLifecycle.js.map +1 -1
- package/dist/core/ProviderInstantiate.d.ts +9 -5
- package/dist/core/ProviderInstantiate.d.ts.map +1 -1
- package/dist/core/ProviderInstantiate.js +99 -104
- package/dist/core/ProviderInstantiate.js.map +1 -1
- package/dist/core/ResourceMutations.d.ts +2 -2
- package/dist/core/ResourceMutations.d.ts.map +1 -1
- package/dist/core/ResourceMutations.js +13 -11
- package/dist/core/ResourceMutations.js.map +1 -1
- package/dist/core/SchemeRegistry.d.ts +18 -11
- package/dist/core/SchemeRegistry.d.ts.map +1 -1
- package/dist/core/SchemeRegistry.js +201 -53
- package/dist/core/SchemeRegistry.js.map +1 -1
- package/dist/core/ToolResources.d.ts +19 -0
- package/dist/core/ToolResources.d.ts.map +1 -0
- package/dist/core/ToolResources.js +122 -0
- package/dist/core/ToolResources.js.map +1 -0
- package/dist/core/Turn.d.ts +27 -0
- package/dist/core/Turn.d.ts.map +1 -0
- package/dist/core/Turn.js +43 -0
- package/dist/core/Turn.js.map +1 -0
- package/dist/core/Turn.sql +72 -0
- package/dist/core/TurnOps.d.ts +7 -0
- package/dist/core/TurnOps.d.ts.map +1 -0
- package/dist/core/TurnOps.js +63 -0
- package/dist/core/TurnOps.js.map +1 -0
- package/dist/core/TurnRunner.d.ts +15 -5
- package/dist/core/TurnRunner.d.ts.map +1 -1
- package/dist/core/TurnRunner.js +1050 -900
- package/dist/core/TurnRunner.js.map +1 -1
- package/dist/core/WorkerName.d.ts +1 -1
- package/dist/core/WorkerName.d.ts.map +1 -1
- package/dist/core/WorkspaceGate.d.ts +1 -0
- package/dist/core/WorkspaceGate.d.ts.map +1 -1
- package/dist/core/WorkspaceGate.js +39 -0
- package/dist/core/WorkspaceGate.js.map +1 -1
- package/dist/core/caps/CoreInteractionCaps.d.ts +9 -0
- package/dist/core/caps/CoreInteractionCaps.d.ts.map +1 -0
- package/dist/core/caps/CoreInteractionCaps.js +14 -0
- package/dist/core/caps/CoreInteractionCaps.js.map +1 -0
- package/dist/core/caps/SchemeCtxImpl.d.ts +2 -1
- package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.js +3 -0
- 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 +7 -5
- package/dist/core/env-defaults.js.map +1 -1
- package/dist/core/fork.d.ts.map +1 -1
- package/dist/core/fork.js +15 -4
- package/dist/core/fork.js.map +1 -1
- package/dist/core/fork.sql +57 -27
- package/dist/core/git-env.d.ts +0 -1
- package/dist/core/git-env.d.ts.map +1 -1
- package/dist/core/git-env.js +0 -3
- 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 +10 -26
- 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 +13 -14
- package/dist/core/git-state.js.map +1 -1
- package/dist/core/operation-target-groups.d.ts +3 -0
- package/dist/core/operation-target-groups.d.ts.map +1 -0
- package/dist/core/operation-target-groups.js +53 -0
- package/dist/core/operation-target-groups.js.map +1 -0
- package/dist/core/packet-inject.d.ts +0 -1
- package/dist/core/packet-inject.d.ts.map +1 -1
- package/dist/core/packet-inject.js +6 -13
- package/dist/core/packet-inject.js.map +1 -1
- package/dist/core/packet-wire.d.ts +4 -0
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +208 -44
- 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 +3 -3
- package/dist/core/plurnk-uri.js.map +1 -1
- package/dist/core/scheme-types.d.ts +2 -1
- package/dist/core/scheme-types.d.ts.map +1 -1
- package/dist/core/scheme-types.js.map +1 -1
- package/dist/core/teaching.d.ts.map +1 -1
- package/dist/core/teaching.js +4 -5
- package/dist/core/teaching.js.map +1 -1
- package/dist/core/worker-settings.d.ts +9 -0
- package/dist/core/worker-settings.d.ts.map +1 -0
- package/dist/core/worker-settings.js +25 -0
- package/dist/core/worker-settings.js.map +1 -0
- package/dist/core/workspace-settings.d.ts +0 -11
- package/dist/core/workspace-settings.d.ts.map +1 -1
- package/dist/core/workspace-settings.js +3 -47
- package/dist/core/workspace-settings.js.map +1 -1
- package/dist/digest/Digest.d.ts.map +1 -1
- package/dist/digest/Digest.js +164 -92
- package/dist/digest/Digest.js.map +1 -1
- package/dist/digest/digest.sql +8 -2
- package/dist/observe/genai.d.ts +9 -0
- package/dist/observe/genai.d.ts.map +1 -0
- package/dist/observe/genai.js +31 -0
- package/dist/observe/genai.js.map +1 -0
- package/dist/observe/spans.d.ts +3 -3
- package/dist/observe/spans.d.ts.map +1 -1
- package/dist/observe/spans.js +20 -5
- package/dist/observe/spans.js.map +1 -1
- package/dist/schemes/EffectPolicy.d.ts +3 -0
- package/dist/schemes/EffectPolicy.d.ts.map +1 -1
- package/dist/schemes/EffectPolicy.js +38 -6
- package/dist/schemes/EffectPolicy.js.map +1 -1
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +82 -18
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/Log.d.ts +6 -2
- package/dist/schemes/Log.d.ts.map +1 -1
- package/dist/schemes/Log.js +73 -22
- package/dist/schemes/Log.js.map +1 -1
- package/dist/schemes/Log.sql +25 -7
- package/dist/schemes/Prompt.d.ts.map +1 -1
- package/dist/schemes/Prompt.js +1 -2
- package/dist/schemes/Prompt.js.map +1 -1
- package/dist/schemes/QuestionTool.d.ts +10 -0
- package/dist/schemes/QuestionTool.d.ts.map +1 -0
- package/dist/schemes/QuestionTool.js +81 -0
- package/dist/schemes/QuestionTool.js.map +1 -0
- package/dist/schemes/Skill.d.ts.map +1 -1
- package/dist/schemes/Skill.js +4 -1
- package/dist/schemes/Skill.js.map +1 -1
- package/dist/schemes/Worker.d.ts.map +1 -1
- package/dist/schemes/Worker.js +20 -3
- package/dist/schemes/Worker.js.map +1 -1
- package/dist/schemes/_entry-crud.sql +19 -1
- package/dist/schemes/_entry-find.d.ts +5 -3
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +102 -22
- package/dist/schemes/_entry-find.js.map +1 -1
- package/dist/schemes/_entry-find.sql +8 -6
- package/dist/schemes/_entry-graph.sql +2 -6
- package/dist/schemes/_entry-manifest.d.ts.map +1 -1
- package/dist/schemes/_entry-manifest.js +12 -1
- package/dist/schemes/_entry-manifest.js.map +1 -1
- package/dist/schemes/_search-index.d.ts.map +1 -1
- package/dist/schemes/_search-index.js +37 -25
- package/dist/schemes/_search-index.js.map +1 -1
- package/dist/server/Daemon.d.ts +69 -12
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +737 -133
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/DaemonModule.d.ts +31 -3
- package/dist/server/DaemonModule.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.d.ts +12 -9
- package/dist/server/DrainSupervisor.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.js +59 -10
- package/dist/server/DrainSupervisor.js.map +1 -1
- package/dist/server/client-input.d.ts +7 -2
- package/dist/server/client-input.d.ts.map +1 -1
- package/dist/server/client-input.js +65 -34
- 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 +28 -6
- package/dist/server/dispatch-as-plurnk.js.map +1 -1
- package/dist/server/drain.sql +26 -11
- package/dist/server/envelope.d.ts +1 -1
- package/dist/server/envelope.d.ts.map +1 -1
- package/dist/server/envelope.js +4 -4
- package/dist/server/envelope.js.map +1 -1
- package/dist/server/envelope.sql +25 -1
- package/dist/server/lifecycle-recovery.sql +17 -1
- package/dist/server/logEntry.d.ts +2 -1
- package/dist/server/logEntry.d.ts.map +1 -1
- package/dist/server/logEntry.js +3 -2
- package/dist/server/logEntry.js.map +1 -1
- package/dist/server/logEntry.sql +7 -0
- package/dist/server/loop-model.d.ts +2 -2
- package/dist/server/loop-model.d.ts.map +1 -1
- package/dist/server/loop-model.js +23 -33
- package/dist/server/loop-model.js.map +1 -1
- package/dist/server/loopDocs.d.ts +1 -0
- package/dist/server/loopDocs.d.ts.map +1 -1
- package/dist/server/loopDocs.js +94 -14
- package/dist/server/loopDocs.js.map +1 -1
- package/dist/server/loopDocs.sql +12 -0
- package/dist/server/model-catalog.d.ts +3 -0
- package/dist/server/model-catalog.d.ts.map +1 -0
- package/dist/server/model-catalog.js +83 -0
- package/dist/server/model-catalog.js.map +1 -0
- package/dist/server/model-route.d.ts +7 -0
- package/dist/server/model-route.d.ts.map +1 -0
- package/dist/server/model-route.js +47 -0
- package/dist/server/model-route.js.map +1 -0
- package/dist/server/module-discovery.d.ts +13 -0
- package/dist/server/module-discovery.d.ts.map +1 -0
- package/dist/server/module-discovery.js +78 -0
- package/dist/server/module-discovery.js.map +1 -0
- package/dist/server/skillDocs.d.ts +9 -0
- package/dist/server/skillDocs.d.ts.map +1 -0
- package/dist/server/skillDocs.js +212 -0
- package/dist/server/skillDocs.js.map +1 -0
- package/dist/server/skillDocs.sql +14 -0
- package/dist/server/workspace-capabilities.sql +19 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +182 -123
- package/dist/service.js.map +1 -1
- package/migrations/001_schema.sql +455 -65
- package/package.json +38 -37
- package/dist/core/ExecutableTools.d.ts +0 -10
- package/dist/core/ExecutableTools.d.ts.map +0 -1
- package/dist/core/ExecutableTools.js +0 -41
- package/dist/core/ExecutableTools.js.map +0 -1
- package/dist/core/JournalTurn.d.ts +0 -9
- package/dist/core/JournalTurn.d.ts.map +0 -1
- package/dist/core/JournalTurn.js +0 -14
- package/dist/core/JournalTurn.js.map +0 -1
- package/dist/core/JournalTurn.sql +0 -10
- package/dist/core/git-iso.d.ts +0 -13
- package/dist/core/git-iso.d.ts.map +0 -1
- package/dist/core/git-iso.js +0 -267
- package/dist/core/git-iso.js.map +0 -1
- package/dist/core/search-gate.d.ts +0 -17
- package/dist/core/search-gate.d.ts.map +0 -1
- package/dist/core/search-gate.js +0 -77
- package/dist/core/search-gate.js.map +0 -1
- package/dist/digest/Digest.sql +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreSchemeServices.d.ts","sourceRoot":"","sources":["../../src/core/CoreSchemeServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"CoreSchemeServices.d.ts","sourceRoot":"","sources":["../../src/core/CoreSchemeServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,KAAK,EACR,wBAAwB,EACxB,2BAA2B,EAC3B,MAAM,EACN,UAAU,EACV,aAAa,EAChB,MAAM,0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AA2B,CAAC,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;CACjD;AAED,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAChD;AAID,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC5B;AAKD,MAAM,MAAM,4BAA4B,GAClC;IAAE,QAAQ,CAAC,cAAc,EAAE,eAAe,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;CAAE,CAAC;AAExC,MAAM,WAAW,0BAA0B;IACvC,yBAAyB,CACrB,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,GAAG,EAAE,qBAAqB,GAC3B,OAAO,CAAC,4BAA4B,CAAC,CAAC;CAC5C;AAMD,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,mBAAmB,CAAC;AAEpE,8BAAsB,qBAAsB,YAAW,iBAAiB;;IAGpE,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAE3C;IAED,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,qBAAqB,GAAG,mBAAmB,CA2BrE;IAED,SAAS,CAAC,iBAAiB,IAAI,iBAAiB,CAI/C;IAED,SAAS,CAAC,cAAc,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,YAAY,CAAC,CAIpG;CACJ"}
|
|
@@ -23,8 +23,14 @@ export class CoreSchemeAdapterBase {
|
|
|
23
23
|
mimetypes: services.mimetypes,
|
|
24
24
|
executors: services.executors(),
|
|
25
25
|
weigh: services.weigh,
|
|
26
|
-
defaultChannelFor: services.defaultChannelFor,
|
|
26
|
+
defaultChannelFor: (scheme) => services.defaultChannelFor(scheme, ctx.workspaceId),
|
|
27
27
|
pushNotice: (notice) => services.pushNotice(ctx.workspaceId, ctx.loopId, notice),
|
|
28
|
+
requestInteraction: (request) => services.requestInteraction(request, {
|
|
29
|
+
workspaceId: ctx.workspaceId,
|
|
30
|
+
workerId: ctx.workerId,
|
|
31
|
+
loopId: ctx.loopId,
|
|
32
|
+
turnId: ctx.turnId,
|
|
33
|
+
}, ctx.signal),
|
|
28
34
|
};
|
|
29
35
|
}
|
|
30
36
|
liveSubscriptions() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreSchemeServices.js","sourceRoot":"","sources":["../../src/core/CoreSchemeServices.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoreSchemeServices.js","sourceRoot":"","sources":["../../src/core/CoreSchemeServices.ts"],"names":[],"mappings":"AAiEA,MAAM,OAAgB,qBAAqB;IACvC,SAAS,CAAiC;IAE1C,QAAQ,CAAC,QAA4B;QACjC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAES,WAAW,CAAC,GAA0B;QAC5C,IAAI,IAAI,IAAI,GAAG;YAAE,OAAO,GAAG,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,QAAQ,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,+BAA+B,CAAC,CAAC;QACrG,OAAO;YACH,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB;YAC7C,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;YAC3C,YAAY,EAAE,QAAQ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ACJ"}
|
|
@@ -5,6 +5,7 @@ import type SchemeRegistry from "./SchemeRegistry.ts";
|
|
|
5
5
|
import type ExecutorRegistry from "./ExecutorRegistry.ts";
|
|
6
6
|
import type NoticeChannel from "./NoticeChannel.ts";
|
|
7
7
|
import type ProposalLifecycle from "./ProposalLifecycle.ts";
|
|
8
|
+
import type ClientInteractions from "./ClientInteractions.ts";
|
|
8
9
|
import type { WriterTier, PlurnkSchemeContext } from "./scheme-types.ts";
|
|
9
10
|
import { type StreamEventNotify, type WakeWorkerNotify, type InjectWorkerNotify, type BranchWorkerNotify, type BranchCompletionGate, type CancelWorkerNotify, type CancelDescendantsNotify } from "./ChannelWrite.ts";
|
|
10
11
|
import type LiveSubscriptions from "./LiveSubscriptions.ts";
|
|
@@ -29,13 +30,14 @@ export interface ResolvedClientEntryAddress {
|
|
|
29
30
|
}
|
|
30
31
|
export default class Dispatcher {
|
|
31
32
|
#private;
|
|
32
|
-
constructor({ db, schemes, mimetypes, weigh, notices, proposals, executors, loopSignal, streamEventNotify, wakeWorkerNotify, injectWorker, branchWorker, branchCompletionGate, cancelWorker, cancelDescendants,
|
|
33
|
+
constructor({ db, schemes, mimetypes, weigh, notices, proposals, interactions, executors, loopSignal, streamEventNotify, wakeWorkerNotify, injectWorker, branchWorker, branchCompletionGate, cancelWorker, cancelDescendants, parkDeadlines, joinTargets, liveSubscriptions }: {
|
|
33
34
|
db: Db;
|
|
34
35
|
schemes: SchemeRegistry;
|
|
35
36
|
mimetypes: Mimetypes;
|
|
36
37
|
weigh: (text: string) => number;
|
|
37
38
|
notices: NoticeChannel;
|
|
38
39
|
proposals: ProposalLifecycle;
|
|
40
|
+
interactions: ClientInteractions;
|
|
39
41
|
executors: () => ExecutorRegistry | undefined;
|
|
40
42
|
loopSignal: (loopId: number) => AbortSignal | undefined;
|
|
41
43
|
streamEventNotify?: StreamEventNotify;
|
|
@@ -46,7 +48,6 @@ export default class Dispatcher {
|
|
|
46
48
|
cancelWorker?: CancelWorkerNotify;
|
|
47
49
|
cancelDescendants?: CancelDescendantsNotify;
|
|
48
50
|
parkDeadlines?: Map<number, number>;
|
|
49
|
-
searchGate?: import("./search-gate.ts").default;
|
|
50
51
|
joinTargets?: Set<number>;
|
|
51
52
|
liveSubscriptions: LiveSubscriptions;
|
|
52
53
|
});
|
|
@@ -65,22 +66,24 @@ export default class Dispatcher {
|
|
|
65
66
|
workerId: number;
|
|
66
67
|
}): Promise<ResolvedClientEntryAddress | null>;
|
|
67
68
|
readExecSource(statement: ReadStatement, ctx: PlurnkSchemeContext): Promise<DispatchResult>;
|
|
68
|
-
|
|
69
|
+
writeTurnOps({ verbatim, workerId, loopId, turnId, sequence, origin, folded, modelCallId, reasoningItems }: {
|
|
69
70
|
verbatim: string;
|
|
70
71
|
workerId: number;
|
|
71
72
|
loopId: number;
|
|
72
73
|
turnId: number;
|
|
73
74
|
sequence: number;
|
|
75
|
+
origin: WriterTier;
|
|
76
|
+
folded: boolean;
|
|
77
|
+
modelCallId?: number | null;
|
|
78
|
+
reasoningItems?: ReadonlyArray<ProviderEncryptedReasoningItem>;
|
|
74
79
|
}): Promise<number>;
|
|
75
|
-
|
|
80
|
+
writeEmissionAttempt({ verbatim, workerId, loopId, turnId, sequence, modelCallId, reasoningItems }: {
|
|
76
81
|
verbatim: string;
|
|
77
82
|
workerId: number;
|
|
78
83
|
loopId: number;
|
|
79
84
|
turnId: number;
|
|
80
85
|
sequence: number;
|
|
81
|
-
folded: boolean;
|
|
82
86
|
modelCallId: number;
|
|
83
|
-
admission?: "accepted" | "rejected";
|
|
84
87
|
reasoningItems?: ReadonlyArray<ProviderEncryptedReasoningItem>;
|
|
85
88
|
}): Promise<number>;
|
|
86
89
|
recordBareResult(context: Omit<DispatchContext, "statement"> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dispatcher.d.ts","sourceRoot":"","sources":["../../src/core/Dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,aAAa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@ -11,15 +11,14 @@ import LoopFlagsReader from "./LoopFlagsReader.js";
|
|
|
11
11
|
import ChannelWrite from "./ChannelWrite.js";
|
|
12
12
|
import { ReadProjector } from "../content/index.js";
|
|
13
13
|
import SchemeCtxImpl from "./caps/SchemeCtxImpl.js";
|
|
14
|
-
import EntryCrud from "../schemes/_entry-crud.js";
|
|
15
14
|
import EntryOps from "../schemes/_entry-ops.js";
|
|
16
15
|
import EntryFind from "../schemes/_entry-find.js";
|
|
17
|
-
import WorkspaceSettings from "./workspace-settings.js";
|
|
18
16
|
import LoopLifecycle from "./LoopLifecycle.js";
|
|
19
17
|
import TerminalResult from "./TerminalResult.js";
|
|
20
18
|
import Results from "./results.js";
|
|
21
19
|
import { OperationFailureError } from "./results.js";
|
|
22
20
|
import EffectPolicy from "../schemes/EffectPolicy.js";
|
|
21
|
+
import WorkerSettingsReader from "./worker-settings.js";
|
|
23
22
|
import { CoreSchemeAdapterBase, } from "./CoreSchemeServices.js";
|
|
24
23
|
import { InvalidOperationResultError, NetworkAddress, } from "@plurnk/plurnk-schemes";
|
|
25
24
|
import DurableStatement from "./DurableStatement.js";
|
|
@@ -55,6 +54,7 @@ class Dispatcher {
|
|
|
55
54
|
#weighContent;
|
|
56
55
|
#notices;
|
|
57
56
|
#proposals;
|
|
57
|
+
#interactions;
|
|
58
58
|
// Boot-discovered runtime executors, late-injected on Engine — thunked.
|
|
59
59
|
#executors;
|
|
60
60
|
// Per-loop abort signal, owned by Engine.runLoop — thunked.
|
|
@@ -69,19 +69,19 @@ class Dispatcher {
|
|
|
69
69
|
// {§send-premature-terminate}/SEND signal 202 with scope — the engine-owned park-deadline registry (loopId → seconds;
|
|
70
70
|
// -1 = indefinite). The dispatcher WRITES at park; the daemon's drain park-exit consumes.
|
|
71
71
|
#parkDeadlines;
|
|
72
|
-
#searchGate;
|
|
73
72
|
// Per-turn running-worker READ obligations. {§join-blocking-collect}
|
|
74
73
|
#joinTargets;
|
|
75
74
|
#liveSubscriptions;
|
|
76
75
|
#lifecycle;
|
|
77
76
|
#resourceMutations;
|
|
78
|
-
constructor({ db, schemes, mimetypes, weigh, notices, proposals, executors, loopSignal, streamEventNotify, wakeWorkerNotify, injectWorker, branchWorker, branchCompletionGate, cancelWorker, cancelDescendants,
|
|
77
|
+
constructor({ db, schemes, mimetypes, weigh, notices, proposals, interactions, executors, loopSignal, streamEventNotify, wakeWorkerNotify, injectWorker, branchWorker, branchCompletionGate, cancelWorker, cancelDescendants, parkDeadlines, joinTargets, liveSubscriptions }) {
|
|
79
78
|
this.#db = db;
|
|
80
79
|
this.#schemes = schemes;
|
|
81
80
|
this.#mimetypes = mimetypes;
|
|
82
81
|
this.#weighContent = weigh;
|
|
83
82
|
this.#notices = notices;
|
|
84
83
|
this.#proposals = proposals;
|
|
84
|
+
this.#interactions = interactions;
|
|
85
85
|
this.#executors = executors;
|
|
86
86
|
this.#loopSignal = loopSignal;
|
|
87
87
|
this.#streamEventNotify = streamEventNotify;
|
|
@@ -92,7 +92,6 @@ class Dispatcher {
|
|
|
92
92
|
this.#cancelWorker = cancelWorker;
|
|
93
93
|
this.#cancelDescendants = cancelDescendants;
|
|
94
94
|
this.#parkDeadlines = parkDeadlines ?? new Map();
|
|
95
|
-
this.#searchGate = searchGate;
|
|
96
95
|
this.#joinTargets = joinTargets ?? new Set();
|
|
97
96
|
this.#liveSubscriptions = liveSubscriptions;
|
|
98
97
|
this.#lifecycle = new LoopLifecycle(db);
|
|
@@ -100,8 +99,8 @@ class Dispatcher {
|
|
|
100
99
|
schemes,
|
|
101
100
|
liveSubscriptions,
|
|
102
101
|
run: (schemeName, statement, ctx) => this.#run(schemeName, statement, ctx),
|
|
103
|
-
checkWritable: (statement, origin) => this.#checkWritable(statement, origin),
|
|
104
|
-
checkFlagsGate: (statement, loopId) => this.#checkFlagsGate(statement, loopId),
|
|
102
|
+
checkWritable: (statement, origin, workspaceId) => this.#checkWritable(statement, origin, workspaceId),
|
|
103
|
+
checkFlagsGate: (statement, loopId, workspaceId) => this.#checkFlagsGate(statement, loopId, workspaceId),
|
|
105
104
|
editTargetIdentity: (statement, workspaceId) => this.#editTargetIdentity(statement, workspaceId),
|
|
106
105
|
canonicalFilePath: (pathname, workspaceId) => this.#canonicalFilePath(pathname, workspaceId),
|
|
107
106
|
prepareDataRepresentation: (args) => this.#prepareDataRepresentation({
|
|
@@ -118,21 +117,21 @@ class Dispatcher {
|
|
|
118
117
|
// workspace creation, so a process-lifetime cache can never go stale.
|
|
119
118
|
#rootCache = new Map();
|
|
120
119
|
#handlerContext(scheme, ctx) {
|
|
121
|
-
const manifest = this.#schemes.manifestFor(scheme);
|
|
120
|
+
const manifest = this.#schemes.manifestFor(scheme, ctx.workspaceId);
|
|
122
121
|
return manifest === undefined ? null : new SchemeCtxImpl(ctx, scheme, manifest, this.#liveSubscriptions);
|
|
123
122
|
}
|
|
124
123
|
#entryContext(scheme, ctx) {
|
|
125
124
|
const handlerCtx = this.#handlerContext(scheme, ctx);
|
|
126
|
-
return this.#schemes.manifestFor(scheme)?.category === "data" ? handlerCtx : null;
|
|
125
|
+
return this.#schemes.manifestFor(scheme, ctx.workspaceId)?.category === "data" ? handlerCtx : null;
|
|
127
126
|
}
|
|
128
|
-
#coreCrud(scheme) {
|
|
129
|
-
const handler = this.#schemes.get(scheme);
|
|
127
|
+
#coreCrud(scheme, workspaceId) {
|
|
128
|
+
const handler = this.#schemes.get(scheme, workspaceId);
|
|
130
129
|
return handler instanceof CoreSchemeAdapterBase
|
|
131
130
|
? handler
|
|
132
131
|
: undefined;
|
|
133
132
|
}
|
|
134
133
|
async #readEntry(scheme, pathname, ctx) {
|
|
135
|
-
const handler = this.#coreCrud(scheme);
|
|
134
|
+
const handler = this.#coreCrud(scheme, ctx.workspaceId);
|
|
136
135
|
const handlerCtx = this.#entryContext(scheme, ctx);
|
|
137
136
|
if (typeof handler?.readEntry === "function" && handlerCtx !== null) {
|
|
138
137
|
return Results.assert(await handler.readEntry(pathname, handlerCtx));
|
|
@@ -161,7 +160,7 @@ class Dispatcher {
|
|
|
161
160
|
});
|
|
162
161
|
}
|
|
163
162
|
async #writeEntry(scheme, pathname, entry, ctx) {
|
|
164
|
-
const handler = this.#coreCrud(scheme);
|
|
163
|
+
const handler = this.#coreCrud(scheme, ctx.workspaceId);
|
|
165
164
|
const handlerCtx = this.#entryContext(scheme, ctx);
|
|
166
165
|
if (typeof handler?.writeEntry === "function" && handlerCtx !== null) {
|
|
167
166
|
return Results.assert(await handler.writeEntry(pathname, entry, handlerCtx));
|
|
@@ -178,7 +177,7 @@ class Dispatcher {
|
|
|
178
177
|
return Results.assert(await caps.write(pathname, entry, scheme === "prompt" ? "worker" : "commons"));
|
|
179
178
|
}
|
|
180
179
|
async #deleteEntry(scheme, pathname, ctx) {
|
|
181
|
-
const handler = this.#coreCrud(scheme);
|
|
180
|
+
const handler = this.#coreCrud(scheme, ctx.workspaceId);
|
|
182
181
|
const handlerCtx = this.#entryContext(scheme, ctx);
|
|
183
182
|
if (typeof handler?.deleteEntry === "function" && handlerCtx !== null) {
|
|
184
183
|
return Results.assert(await handler.deleteEntry(pathname, handlerCtx));
|
|
@@ -195,7 +194,7 @@ class Dispatcher {
|
|
|
195
194
|
return Results.assert(await caps.delete(pathname, scheme === "prompt" ? "worker" : "commons"));
|
|
196
195
|
}
|
|
197
196
|
async #deleteChannel(scheme, pathname, channel, ctx) {
|
|
198
|
-
const handler = this.#coreCrud(scheme);
|
|
197
|
+
const handler = this.#coreCrud(scheme, ctx.workspaceId);
|
|
199
198
|
const handlerCtx = this.#entryContext(scheme, ctx);
|
|
200
199
|
if (typeof handler?.deleteChannel === "function" && handlerCtx !== null) {
|
|
201
200
|
return Results.assert(await handler.deleteChannel(pathname, channel, handlerCtx));
|
|
@@ -234,7 +233,7 @@ class Dispatcher {
|
|
|
234
233
|
return Namespace.canonicalizeSpelling(pathname, await this.#workspaceRoot(workspaceId));
|
|
235
234
|
}
|
|
236
235
|
async #editTargetIdentity(statement, workspaceId) {
|
|
237
|
-
const target = this.#extractTarget(statement.target);
|
|
236
|
+
const target = this.#extractTarget(statement.target, workspaceId);
|
|
238
237
|
await this.#canonColumns(target, workspaceId);
|
|
239
238
|
return {
|
|
240
239
|
key: JSON.stringify([
|
|
@@ -267,9 +266,9 @@ class Dispatcher {
|
|
|
267
266
|
const schemeCtx = this.#buildSchemeCtx({ workspaceId, workerId, loopId, turnId, origin });
|
|
268
267
|
let result;
|
|
269
268
|
let curationPlan = null;
|
|
270
|
-
let denial = this.#checkWritable(statement, origin);
|
|
269
|
+
let denial = this.#checkWritable(statement, origin, workspaceId);
|
|
271
270
|
if (denial === null)
|
|
272
|
-
denial = await this.#checkFlagsGate(statement, loopId);
|
|
271
|
+
denial = await this.#checkFlagsGate(statement, loopId, workspaceId);
|
|
273
272
|
if (denial !== null) {
|
|
274
273
|
result = denial;
|
|
275
274
|
}
|
|
@@ -307,9 +306,22 @@ class Dispatcher {
|
|
|
307
306
|
result = this.#handlePlan(statement);
|
|
308
307
|
}
|
|
309
308
|
else if (statement.op === "EXEC") {
|
|
310
|
-
//
|
|
311
|
-
//
|
|
312
|
-
|
|
309
|
+
// {§worker-tool-admission} — the question runtime is admitted
|
|
310
|
+
// per worker: a worker whose own rules don't request user input
|
|
311
|
+
// gets the explicit not-available outcome, never a parked loop.
|
|
312
|
+
if (("signal" in statement && statement.signal === "question")
|
|
313
|
+
&& !(await WorkerSettingsReader.requestUserInputEnabled(this.#db, schemeCtx.workerId))) {
|
|
314
|
+
result = _a.#failure("question-tool-unavailable", 404, "The question tool is not available to this worker.", {}, {
|
|
315
|
+
stage: "tool-admission",
|
|
316
|
+
recovery: "This worker does not request user input; continue from the available evidence.",
|
|
317
|
+
retryable: false,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
// EXEC routes unconditionally to its operation owner. The
|
|
322
|
+
// resolved runtime declaration owns body/target semantics.
|
|
323
|
+
result = await this.#run("exec", statement, schemeCtx);
|
|
324
|
+
}
|
|
313
325
|
}
|
|
314
326
|
else {
|
|
315
327
|
result = await this.#run(schemeNameOf(statement.target), statement, schemeCtx); // {§op-methods-op-dispatch}
|
|
@@ -347,15 +359,6 @@ class Dispatcher {
|
|
|
347
359
|
curationPlan,
|
|
348
360
|
modelCallId: null,
|
|
349
361
|
});
|
|
350
|
-
// {§search-gate} — register successful searches AFTER #writeLog stamps the runtime
|
|
351
|
-
// entry's coordinate onto result.attrs.pathname (the gate's dedup serves from it).
|
|
352
|
-
if (statement.op === "EXEC" && result.status < 400) {
|
|
353
|
-
const rt = ("signal" in statement && typeof statement.signal === "string" && statement.signal.length > 0) ? statement.signal : "sh";
|
|
354
|
-
const body = ("body" in statement && typeof statement.body === "string") ? statement.body : "";
|
|
355
|
-
const attrPath = result.attrs?.pathname;
|
|
356
|
-
if (typeof attrPath === "string")
|
|
357
|
-
this.#searchGate?.registerPending(loopId, turnId, rt, body, attrPath);
|
|
358
|
-
}
|
|
359
362
|
onDispatch?.(logEntryId);
|
|
360
363
|
// Proposal lifecycle (SPEC.md {§engine-rails} + {§methods-proposal-resolve}; {§proposal-202-pauses}). When a
|
|
361
364
|
// side-effecting op returns status 202 (a broadcast SEND signal 202 park is model
|
|
@@ -436,7 +439,7 @@ class Dispatcher {
|
|
|
436
439
|
throw new Error(`look resolves READ only; got ${statement.op}`);
|
|
437
440
|
// turnId is a write-time FK only — a look writes no row, so 0 (no turn) is inert.
|
|
438
441
|
const schemeCtx = this.#buildSchemeCtx({ workspaceId, workerId, loopId, turnId: 0, origin });
|
|
439
|
-
const denial = await this.#checkFlagsGate(statement, loopId);
|
|
442
|
+
const denial = await this.#checkFlagsGate(statement, loopId, workspaceId);
|
|
440
443
|
if (denial !== null)
|
|
441
444
|
return denial;
|
|
442
445
|
return this.#run(schemeNameOf(statement.target), statement, schemeCtx);
|
|
@@ -449,8 +452,8 @@ class Dispatcher {
|
|
|
449
452
|
const routedScheme = schemeNameOf(target);
|
|
450
453
|
if (routedScheme === null)
|
|
451
454
|
return null;
|
|
452
|
-
const handler = this.#schemes.get(routedScheme);
|
|
453
|
-
const manifest = this.#schemes.manifestFor(routedScheme);
|
|
455
|
+
const handler = this.#schemes.get(routedScheme, workspaceId);
|
|
456
|
+
const manifest = this.#schemes.manifestFor(routedScheme, workspaceId);
|
|
454
457
|
if (handler === undefined || manifest?.category !== "data")
|
|
455
458
|
return null;
|
|
456
459
|
const addressedScheme = target.kind === "url" ? target.scheme : routedScheme;
|
|
@@ -575,7 +578,7 @@ class Dispatcher {
|
|
|
575
578
|
// handler and addressed context as an authored READ. {§exec-target-routing}
|
|
576
579
|
async readExecSource(statement, ctx) {
|
|
577
580
|
const schemeName = schemeNameOf(statement.target);
|
|
578
|
-
const manifest = schemeName === null ? undefined : this.#schemes.manifestFor(schemeName);
|
|
581
|
+
const manifest = schemeName === null ? undefined : this.#schemes.manifestFor(schemeName, ctx.workspaceId);
|
|
579
582
|
if (manifest !== undefined && manifest.category !== "data") {
|
|
580
583
|
return _a.#failure("exec-source-not-data", 501, `Scheme '${schemeName}' is not a data source for EXEC.`, {}, {
|
|
581
584
|
scheme: schemeName,
|
|
@@ -598,6 +601,7 @@ class Dispatcher {
|
|
|
598
601
|
mimetypes: this.#mimetypes,
|
|
599
602
|
weigh: this.#weighContent,
|
|
600
603
|
pushNotice: (notice) => this.#notices.push(workspaceId, loopId, notice),
|
|
604
|
+
requestInteraction: (request) => this.#interactions.request(request, { workspaceId, workerId, loopId, turnId }, this.#loopSignal(loopId)),
|
|
601
605
|
executors: this.#executors(),
|
|
602
606
|
};
|
|
603
607
|
}
|
|
@@ -607,7 +611,7 @@ class Dispatcher {
|
|
|
607
611
|
// - SEND broadcast (path=null) has no target scheme; not gated.
|
|
608
612
|
// - COPY: dst scheme writableBy applies.
|
|
609
613
|
// - MOVE: both src (delete) and dst (write) schemes' writableBy apply.
|
|
610
|
-
#checkWritable(statement, origin) {
|
|
614
|
+
#checkWritable(statement, origin, workspaceId) {
|
|
611
615
|
if (!MUTATING_OPS.has(statement.op))
|
|
612
616
|
return null;
|
|
613
617
|
if (statement.op === "SEND" && statement.target === null)
|
|
@@ -615,23 +619,23 @@ class Dispatcher {
|
|
|
615
619
|
// EXEC's operation authority always belongs to the exec scheme;
|
|
616
620
|
// runtime-specific resource authority is gated separately below.
|
|
617
621
|
if (statement.op === "EXEC") {
|
|
618
|
-
return this.#denyIfDisallowed("exec", origin);
|
|
622
|
+
return this.#denyIfDisallowed("exec", origin, workspaceId);
|
|
619
623
|
}
|
|
620
624
|
// Worker control (FORK/WORK → worker://<name>, spawn or fork) is gated by worker://'s writableBy — its
|
|
621
625
|
// body is a seed prompt, not a dst path, so the entry-COPY dst-parse below doesn't apply.
|
|
622
626
|
// {§machine-processes}
|
|
623
627
|
if (this.#isWorkerControl(statement))
|
|
624
|
-
return this.#denyIfDisallowed("worker", origin);
|
|
628
|
+
return this.#denyIfDisallowed("worker", origin, workspaceId);
|
|
625
629
|
if (statement.op === "COPY" || statement.op === "MOVE") {
|
|
626
630
|
const dst = statement.body?.target ?? null;
|
|
627
631
|
const dstScheme = schemeNameOf(dst);
|
|
628
|
-
const dstDenial = this.#denyIfDisallowed(dstScheme, origin);
|
|
632
|
+
const dstDenial = this.#denyIfDisallowed(dstScheme, origin, workspaceId);
|
|
629
633
|
if (dstDenial !== null)
|
|
630
634
|
return dstDenial;
|
|
631
635
|
if (statement.op === "MOVE") {
|
|
632
636
|
const srcScheme = schemeNameOf(statement.target);
|
|
633
637
|
if (srcScheme !== dstScheme) {
|
|
634
|
-
const srcDenial = this.#denyIfDisallowed(srcScheme, origin);
|
|
638
|
+
const srcDenial = this.#denyIfDisallowed(srcScheme, origin, workspaceId);
|
|
635
639
|
if (srcDenial !== null)
|
|
636
640
|
return srcDenial;
|
|
637
641
|
}
|
|
@@ -639,45 +643,15 @@ class Dispatcher {
|
|
|
639
643
|
return null;
|
|
640
644
|
}
|
|
641
645
|
const target = schemeNameOf(statement.target);
|
|
642
|
-
return this.#denyIfDisallowed(target, origin);
|
|
643
|
-
}
|
|
644
|
-
// {§search-gate} — gate only configured search runtimes; duplicates serve
|
|
645
|
-
// the prior durable digest and the per-turn cap refuses without execution.
|
|
646
|
-
async #gatedExec(statement, ctx, loopId, turnId) {
|
|
647
|
-
const runtime = ("signal" in statement && typeof statement.signal === "string" && statement.signal.length > 0) ? statement.signal : "sh";
|
|
648
|
-
const body = ("body" in statement && typeof statement.body === "string") ? statement.body : "";
|
|
649
|
-
const verdict = this.#searchGate?.check(loopId, turnId, runtime, body) ?? { verdict: "pass" };
|
|
650
|
-
if (verdict.verdict === "capped") {
|
|
651
|
-
return _a.#failure("search-limit-reached", 429, `This turn already used its ${verdict.cap} permitted searches.`, {}, {
|
|
652
|
-
searchLimit: verdict.cap,
|
|
653
|
-
stage: "search-admission",
|
|
654
|
-
recovery: "Continue without another search in this turn.",
|
|
655
|
-
retryable: false,
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
if (verdict.verdict === "duplicate") {
|
|
659
|
-
// {§stream-owner-scoped} — the prior ranked digest is the CALLER's own stream entry.
|
|
660
|
-
const prior = await EntryCrud.readEntry(verdict.priorPathname, ctx, runtime, ctx.workerId);
|
|
661
|
-
const raw = prior.entry?.channels["#results"]?.content ?? "";
|
|
662
|
-
let results = raw;
|
|
663
|
-
try {
|
|
664
|
-
results = JSON.parse(raw);
|
|
665
|
-
}
|
|
666
|
-
catch { /* non-JSON results serve verbatim */ }
|
|
667
|
-
return _a.#failure("duplicate-search", 409, "This search already ran in the current loop; the prior results are attached.", { results }, {
|
|
668
|
-
recovery: "Use the attached prior results.",
|
|
669
|
-
retryable: false,
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
return this.#run("exec", statement, ctx);
|
|
646
|
+
return this.#denyIfDisallowed(target, origin, workspaceId);
|
|
673
647
|
}
|
|
674
|
-
#denyIfDisallowed(schemeName, origin) {
|
|
648
|
+
#denyIfDisallowed(schemeName, origin, workspaceId) {
|
|
675
649
|
if (schemeName === null)
|
|
676
650
|
return null;
|
|
677
|
-
const handler = this.#schemes.get(schemeName);
|
|
651
|
+
const handler = this.#schemes.get(schemeName, workspaceId);
|
|
678
652
|
if (handler === undefined)
|
|
679
653
|
return null;
|
|
680
|
-
const manifest = this.#schemes.manifestFor(schemeName);
|
|
654
|
+
const manifest = this.#schemes.manifestFor(schemeName, workspaceId);
|
|
681
655
|
if (manifest === undefined)
|
|
682
656
|
throw new Error(`registered scheme '${schemeName}' has no manifest`);
|
|
683
657
|
if (manifest.writableBy.includes(origin))
|
|
@@ -695,7 +669,7 @@ class Dispatcher {
|
|
|
695
669
|
// active set under the loop's persisted flags. A registered scheme outside
|
|
696
670
|
// that set returns 403; unknown names continue to their operation owner for
|
|
697
671
|
// the ordinary registration failure. Action-entry-as-outcome carries either.
|
|
698
|
-
async #checkFlagsGate(statement, loopId) {
|
|
672
|
+
async #checkFlagsGate(statement, loopId, workspaceId) {
|
|
699
673
|
// Broadcast SEND has no scheme to gate.
|
|
700
674
|
if (statement.op === "SEND" && statement.target === null)
|
|
701
675
|
return null;
|
|
@@ -729,15 +703,15 @@ class Dispatcher {
|
|
|
729
703
|
});
|
|
730
704
|
}
|
|
731
705
|
}
|
|
732
|
-
const active = this.#schemes.resolveForLoop(flags);
|
|
733
|
-
// {§
|
|
706
|
+
const active = this.#schemes.resolveForLoop(flags, workspaceId);
|
|
707
|
+
// {§mode-ask-read-only}: name the non-retryable restriction so the model changes course.
|
|
734
708
|
const restriction = flags.mode === "ask"
|
|
735
709
|
? "this is an ask-mode (read-only) loop — you cannot run commands or take host actions here"
|
|
736
710
|
: flags.noWeb && flags.noInteraction ? "web and interaction are disabled for this loop"
|
|
737
711
|
: flags.noWeb ? "web access is disabled for this loop"
|
|
738
712
|
: "interaction is disabled for this loop";
|
|
739
713
|
const checkScheme = (scheme) => {
|
|
740
|
-
if (scheme === null || !this.#schemes.has(scheme))
|
|
714
|
+
if (scheme === null || !this.#schemes.has(scheme, workspaceId))
|
|
741
715
|
return null;
|
|
742
716
|
if (active.has(scheme))
|
|
743
717
|
return null;
|
|
@@ -761,7 +735,7 @@ class Dispatcher {
|
|
|
761
735
|
return operationDenial;
|
|
762
736
|
const requested = typeof statement.signal === "string" ? statement.signal : "";
|
|
763
737
|
const runtime = requested === "" ? "sh" : requested;
|
|
764
|
-
const targetKind = this.#executors()?.entry(runtime)?.invocation.target?.kind;
|
|
738
|
+
const targetKind = this.#executors()?.entry(runtime, workspaceId)?.invocation.target?.kind;
|
|
765
739
|
if (targetKind !== "resource")
|
|
766
740
|
return null;
|
|
767
741
|
const sourceScheme = schemeNameOf(statement.target);
|
|
@@ -861,11 +835,11 @@ class Dispatcher {
|
|
|
861
835
|
return _a.#failure("kill-target-scheme-required", 400, "KILL target requires a scheme.", {}, { retryable: false });
|
|
862
836
|
}
|
|
863
837
|
// Log targets use the same killable dispatch as streams; erasure is their
|
|
864
|
-
// permanent curation operation. {§
|
|
838
|
+
// permanent curation operation. {§turn-ops-log-curation}
|
|
865
839
|
// Process-KILL: any scheme whose handler exposes kill() aborts a live stream — the
|
|
866
840
|
// exec handler, registered as "exec" + under every runtime tag (sh/node), so a tag-
|
|
867
841
|
// addressed stream (sh:///l/t/s) routes here, not to deleteEntry. {§exec}
|
|
868
|
-
const killable = this.#schemes.get(schemeName);
|
|
842
|
+
const killable = this.#schemes.get(schemeName, ctx.workspaceId);
|
|
869
843
|
if (killable !== undefined && typeof killable.kill === "function") {
|
|
870
844
|
// Pass the model's OWN scheme so a stream-KILL error answers in the runtime tag the
|
|
871
845
|
// model addressed (sh:///…), not the internal `exec` ({§fs-answer-in-canon}).
|
|
@@ -909,7 +883,7 @@ class Dispatcher {
|
|
|
909
883
|
await this.#cancelWorker(workerId, "killed via worker:// KILL");
|
|
910
884
|
return { status: 200 };
|
|
911
885
|
}
|
|
912
|
-
if (!this.#schemes.has(schemeName)) {
|
|
886
|
+
if (!this.#schemes.has(schemeName, ctx.workspaceId)) {
|
|
913
887
|
return _a.#failure("scheme-not-found", 501, `Scheme '${schemeName}' is not registered.`, {}, { scheme: schemeName, retryable: false });
|
|
914
888
|
}
|
|
915
889
|
// A host-effecting delete (file) returns 202 to PROPOSE — pass its attrs through so the proposal
|
|
@@ -922,7 +896,7 @@ class Dispatcher {
|
|
|
922
896
|
const row = await this.#db.engine_insert_log_entry.get({
|
|
923
897
|
worker_id: workerId, loop_id: loopId, turn_id: turnId, sequence,
|
|
924
898
|
origin, source: null, model_call_id: modelCallId,
|
|
925
|
-
op: null,
|
|
899
|
+
op: null, delimiter: "", signal: null,
|
|
926
900
|
scheme: null, username: null, password: null, hostname: null, port: null,
|
|
927
901
|
pathname: null, query: null, fragment: null, lineMarker: null,
|
|
928
902
|
tx: "", mimetype_tx: "text/vnd.plurnk",
|
|
@@ -946,25 +920,24 @@ class Dispatcher {
|
|
|
946
920
|
await this.#db.engine_fold_log_entry.run({ id: row.id });
|
|
947
921
|
return row.id;
|
|
948
922
|
}
|
|
949
|
-
// {§
|
|
950
|
-
//
|
|
951
|
-
async
|
|
923
|
+
// {§turn-ops-entry} — preserve exact admitted source beside, never instead
|
|
924
|
+
// of, the ordinary operation-result rows produced by dispatch.
|
|
925
|
+
async writeTurnOps({ verbatim, workerId, loopId, turnId, sequence, origin, folded, modelCallId = null, reasoningItems }) {
|
|
952
926
|
return this.#writeActionlessEntry({
|
|
953
927
|
verbatim, workerId, loopId, turnId, sequence,
|
|
954
|
-
origin
|
|
928
|
+
origin, kind: "turnOps", folded, modelCallId,
|
|
929
|
+
attrs: {
|
|
930
|
+
...(reasoningItems !== undefined && reasoningItems.length > 0 ? { reasoning: reasoningItems } : {}),
|
|
931
|
+
},
|
|
955
932
|
});
|
|
956
933
|
}
|
|
957
|
-
// {§
|
|
958
|
-
//
|
|
959
|
-
|
|
960
|
-
// born-open rejected item under {§invalid-emission-attempts} and labels
|
|
961
|
-
// that admission fact structurally.
|
|
962
|
-
async writeModelEntry({ verbatim, workerId, loopId, turnId, sequence, folded, modelCallId, admission = "accepted", reasoningItems }) {
|
|
934
|
+
// {§rejected-emission-entry} — provider bytes that fail admission are an
|
|
935
|
+
// attempt artifact, never a turn program.
|
|
936
|
+
async writeEmissionAttempt({ verbatim, workerId, loopId, turnId, sequence, modelCallId, reasoningItems }) {
|
|
963
937
|
return this.#writeActionlessEntry({
|
|
964
938
|
verbatim, workerId, loopId, turnId, sequence,
|
|
965
|
-
origin: "model", kind: "
|
|
939
|
+
origin: "model", kind: "emissionAttempt", folded: true, modelCallId,
|
|
966
940
|
attrs: {
|
|
967
|
-
...(admission === "rejected" ? { admission } : {}),
|
|
968
941
|
...(reasoningItems !== undefined && reasoningItems.length > 0 ? { reasoning: reasoningItems } : {}),
|
|
969
942
|
},
|
|
970
943
|
});
|
|
@@ -1132,26 +1105,6 @@ class Dispatcher {
|
|
|
1132
1105
|
attrs: { joined: true, pending: 0 },
|
|
1133
1106
|
};
|
|
1134
1107
|
}
|
|
1135
|
-
// {§send-300-choices} — ask the operator and park (the answer returns via loop.inject).
|
|
1136
|
-
// The three-state cascade (owner design): PLURNK_QUESTIONS unset = ALLOWED (not enabled);
|
|
1137
|
-
// =0 = DENIED servicewide (a ceiling the client cannot override); ENABLED requires the
|
|
1138
|
-
// client to affirmatively pass it per workspace (settings.questions — the interactive client
|
|
1139
|
-
// with a human enables its own workspaces; headless/bench never asks). Enabled workspaces ALSO
|
|
1140
|
-
// get the questions.md teaching injected (docEntries) — capability and teaching gate as one.
|
|
1141
|
-
// Disabled → refused with a self-decide steer, never a park into the void.
|
|
1142
|
-
if (status === 300) {
|
|
1143
|
-
if (!(await WorkspaceSettings.questionsEnabled(this.#db, ctx.workspaceId))) {
|
|
1144
|
-
return _a.#failure("operator-questions-disabled", 409, "Operator questions are disabled in this workspace.", {}, {
|
|
1145
|
-
recovery: "Decide from the available evidence and continue or conclude.",
|
|
1146
|
-
retryable: false,
|
|
1147
|
-
});
|
|
1148
|
-
}
|
|
1149
|
-
// {§send-300-choices} — return a proposal whose accepted body becomes
|
|
1150
|
-
// the answer; zero choices denotes an open question.
|
|
1151
|
-
const parts = raw.split(";").map((x) => x.trim()).filter((x) => x.length > 0);
|
|
1152
|
-
const [question = "", ...choices] = parts;
|
|
1153
|
-
return { status: 202, attrs: choices.length > 0 ? { question, choices } : { question } };
|
|
1154
|
-
}
|
|
1155
1108
|
// [200] — terminate, gated by the pending set (post-batch). The row records the refused
|
|
1156
1109
|
// attempt faithfully (status_rx=409, never erased); the loop stays a continue; the strike
|
|
1157
1110
|
// couples in runTurn. [499] abandons and cancels the descendant scope.
|
|
@@ -1249,14 +1202,14 @@ class Dispatcher {
|
|
|
1249
1202
|
}
|
|
1250
1203
|
}
|
|
1251
1204
|
}
|
|
1252
|
-
const handler = this.#schemes.get(schemeName);
|
|
1205
|
+
const handler = this.#schemes.get(schemeName, ctx.workspaceId);
|
|
1253
1206
|
if (handler === undefined) {
|
|
1254
1207
|
return _a.#failure("scheme-not-found", 501, `Scheme '${schemeName}' is not registered.`, {}, { scheme: schemeName, retryable: false });
|
|
1255
1208
|
}
|
|
1256
1209
|
const methodName = statement.op.toLowerCase();
|
|
1257
1210
|
const method = handler[methodName];
|
|
1258
1211
|
const addressedScheme = statement.target?.kind === "url" ? statement.target.scheme : null;
|
|
1259
|
-
const manifest = this.#schemes.manifestFor(schemeName);
|
|
1212
|
+
const manifest = this.#schemes.manifestFor(schemeName, ctx.workspaceId);
|
|
1260
1213
|
if (manifest === undefined)
|
|
1261
1214
|
throw new Error(`scheme '${schemeName}' has no manifest`);
|
|
1262
1215
|
const publishedChannel = statement.target?.kind === "url"
|
|
@@ -1413,16 +1366,13 @@ class Dispatcher {
|
|
|
1413
1366
|
// {§proposal}/{§send} — status 202 is a proposal except for broadcast
|
|
1414
1367
|
// SEND signal 202, which parks the loop. The operation disambiguates the status.
|
|
1415
1368
|
static #isProposal(statement, result) {
|
|
1416
|
-
// {§send-300-choices} — SEND signal 300 is the proposal exception.
|
|
1417
1369
|
if (result.status !== 202)
|
|
1418
1370
|
return false;
|
|
1419
|
-
if (statement.op === "SEND" && statement.signal === 300)
|
|
1420
|
-
return true;
|
|
1421
1371
|
return !(statement.op === "SEND" && statement.target === null);
|
|
1422
1372
|
}
|
|
1423
1373
|
async #writeLog({ statement, result, workspaceId, workerId, loopId, turnId, sequence, origin, curationPlan, modelCallId, }) {
|
|
1424
1374
|
const durableStatement = DurableStatement.project(statement);
|
|
1425
|
-
const target = this.#extractTarget(durableStatement.target);
|
|
1375
|
+
const target = this.#extractTarget(durableStatement.target, workspaceId);
|
|
1426
1376
|
await this.#canonColumns(target, workspaceId); // {§fs-answer-in-canon}
|
|
1427
1377
|
const lineMarkerJson = "lineMarker" in durableStatement && durableStatement.lineMarker !== null
|
|
1428
1378
|
? JSON.stringify(durableStatement.lineMarker)
|
|
@@ -1441,8 +1391,7 @@ class Dispatcher {
|
|
|
1441
1391
|
throw new Error("Dispatcher.#writeLog: result attrs collide with private log curation state");
|
|
1442
1392
|
}
|
|
1443
1393
|
attrsObj.__plurnk_curation = {
|
|
1444
|
-
|
|
1445
|
-
expanded: curationPlan.expanded,
|
|
1394
|
+
targets: curationPlan.targets,
|
|
1446
1395
|
add: curationPlan.add,
|
|
1447
1396
|
remove: curationPlan.remove,
|
|
1448
1397
|
};
|
|
@@ -1499,7 +1448,7 @@ class Dispatcher {
|
|
|
1499
1448
|
source: null, // dispatch entries are self-authored; {§env-delta} deltas set this
|
|
1500
1449
|
model_call_id: modelCallId,
|
|
1501
1450
|
op: durableStatement.op,
|
|
1502
|
-
|
|
1451
|
+
delimiter: durableStatement.delimiter,
|
|
1503
1452
|
signal: this.#signalToJson(durableStatement.signal),
|
|
1504
1453
|
scheme: target.scheme,
|
|
1505
1454
|
username: target.username,
|
|
@@ -1535,7 +1484,7 @@ class Dispatcher {
|
|
|
1535
1484
|
// inputs collapse to scheme=null in log target metadata because both render
|
|
1536
1485
|
// as bare paths. Addressable file entries separately persist under the
|
|
1537
1486
|
// reserved `file` identity scheme ({§entry-identity-no-null}).
|
|
1538
|
-
#extractTarget(path) {
|
|
1487
|
+
#extractTarget(path, workspaceId) {
|
|
1539
1488
|
if (path === null)
|
|
1540
1489
|
return { scheme: null, username: null, password: null, hostname: null, port: null, pathname: null, query: null, fragment: null };
|
|
1541
1490
|
// `local` (bare path) carries no URL parts — store the raw text as the pathname for the log record, scheme=null.
|
|
@@ -1548,7 +1497,7 @@ class Dispatcher {
|
|
|
1548
1497
|
const foldNs = scheme !== null
|
|
1549
1498
|
&& scheme !== "worker"
|
|
1550
1499
|
&& !NetworkAddress.supports(scheme)
|
|
1551
|
-
&& this.#schemes.has(scheme);
|
|
1500
|
+
&& this.#schemes.has(scheme, workspaceId);
|
|
1552
1501
|
return {
|
|
1553
1502
|
scheme, username: path.username, password: path.password,
|
|
1554
1503
|
hostname: foldNs ? null : path.hostname, port: path.port,
|