@plurnk/plurnk-service 1.8.0 → 1.9.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 +20 -0
- package/INSTALL.md +14 -16
- package/README.md +1 -1
- package/SPEC.md +635 -296
- package/digest-sql/channel-dispositions/dispositions.sql +2 -2
- package/digest-sql/entry-dispositions/dispositions.sql +2 -2
- package/dist/Paths.d.ts +1 -2
- package/dist/Paths.d.ts.map +1 -1
- package/dist/Paths.js +1 -9
- package/dist/Paths.js.map +1 -1
- package/dist/build-info.json +1 -1
- package/dist/core/ChannelWrite.d.ts +8 -3
- package/dist/core/ChannelWrite.d.ts.map +1 -1
- package/dist/core/ChannelWrite.js +40 -8
- package/dist/core/ChannelWrite.js.map +1 -1
- package/dist/core/ChannelWrite.sql +17 -4
- package/dist/core/CoreSchemeServices.d.ts +7 -3
- package/dist/core/CoreSchemeServices.d.ts.map +1 -1
- package/dist/core/CoreSchemeServices.js +8 -1
- package/dist/core/CoreSchemeServices.js.map +1 -1
- package/dist/core/Dispatcher.d.ts +9 -1
- package/dist/core/Dispatcher.d.ts.map +1 -1
- package/dist/core/Dispatcher.js +321 -221
- package/dist/core/Dispatcher.js.map +1 -1
- package/dist/core/Engine.d.ts +13 -4
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +44 -22
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Engine.sql +101 -81
- package/dist/core/EntryAddressBinding.d.ts +32 -0
- package/dist/core/EntryAddressBinding.d.ts.map +1 -0
- package/dist/core/EntryAddressBinding.js +93 -0
- package/dist/core/EntryAddressBinding.js.map +1 -0
- package/dist/core/ExecutorRegistry.d.ts +4 -4
- package/dist/core/ExecutorRegistry.d.ts.map +1 -1
- package/dist/core/ExecutorRegistry.js +28 -28
- package/dist/core/ExecutorRegistry.js.map +1 -1
- package/dist/core/LogBody.d.ts.map +1 -1
- package/dist/core/LogBody.js +19 -1
- package/dist/core/LogBody.js.map +1 -1
- package/dist/core/OperatorConfig.d.ts.map +1 -1
- package/dist/core/OperatorConfig.js +5 -2
- package/dist/core/OperatorConfig.js.map +1 -1
- package/dist/core/OverflowTurn.d.ts.map +1 -1
- package/dist/core/OverflowTurn.js +5 -1
- package/dist/core/OverflowTurn.js.map +1 -1
- package/dist/core/Owner.js +1 -1
- package/dist/core/Owner.js.map +1 -1
- package/dist/core/PacketBuilder.d.ts +5 -1
- package/dist/core/PacketBuilder.d.ts.map +1 -1
- package/dist/core/PacketBuilder.js +21 -11
- package/dist/core/PacketBuilder.js.map +1 -1
- package/dist/core/ProposalLifecycle.d.ts +4 -1
- package/dist/core/ProposalLifecycle.d.ts.map +1 -1
- package/dist/core/ProposalLifecycle.js +85 -26
- package/dist/core/ProposalLifecycle.js.map +1 -1
- package/dist/core/ReasoningEvent.d.ts +13 -0
- package/dist/core/ReasoningEvent.d.ts.map +1 -0
- package/dist/core/ReasoningEvent.js +6 -0
- package/dist/core/ReasoningEvent.js.map +1 -0
- package/dist/core/ResourceMutations.d.ts +15 -19
- package/dist/core/ResourceMutations.d.ts.map +1 -1
- package/dist/core/ResourceMutations.js +113 -38
- package/dist/core/ResourceMutations.js.map +1 -1
- package/dist/core/SchemeRegistry.d.ts +12 -11
- package/dist/core/SchemeRegistry.d.ts.map +1 -1
- package/dist/core/SchemeRegistry.js +52 -47
- package/dist/core/SchemeRegistry.js.map +1 -1
- package/dist/core/ToolResources.d.ts.map +1 -1
- package/dist/core/ToolResources.js +20 -19
- package/dist/core/ToolResources.js.map +1 -1
- package/dist/core/Turn.d.ts +1 -1
- package/dist/core/Turn.d.ts.map +1 -1
- package/dist/core/TurnOps.d.ts +2 -2
- package/dist/core/TurnOps.d.ts.map +1 -1
- package/dist/core/TurnOps.js +14 -4
- package/dist/core/TurnOps.js.map +1 -1
- package/dist/core/TurnRunner.d.ts +46 -3
- package/dist/core/TurnRunner.d.ts.map +1 -1
- package/dist/core/TurnRunner.js +165 -78
- package/dist/core/TurnRunner.js.map +1 -1
- package/dist/core/WorkerName.d.ts +1 -0
- package/dist/core/WorkerName.d.ts.map +1 -1
- package/dist/core/WorkerName.js +2 -1
- package/dist/core/WorkerName.js.map +1 -1
- package/dist/core/WorkerName.sql +17 -2
- package/dist/core/WorkspaceGate.js +1 -1
- package/dist/core/WorkspaceGate.js.map +1 -1
- package/dist/core/caps/CapsResolve.d.ts +2 -2
- package/dist/core/caps/CapsResolve.d.ts.map +1 -1
- package/dist/core/caps/CapsResolve.js +5 -7
- package/dist/core/caps/CapsResolve.js.map +1 -1
- package/dist/core/caps/DbChannelCaps.d.ts +1 -1
- package/dist/core/caps/DbChannelCaps.d.ts.map +1 -1
- package/dist/core/caps/DbChannelCaps.js +13 -11
- package/dist/core/caps/DbChannelCaps.js.map +1 -1
- package/dist/core/caps/DbEntryCaps.d.ts +5 -5
- package/dist/core/caps/DbEntryCaps.d.ts.map +1 -1
- package/dist/core/caps/DbEntryCaps.js +27 -30
- 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 +5 -3
- package/dist/core/caps/DbNotifyCaps.js.map +1 -1
- package/dist/core/caps/DbSubscriptionCaps.d.ts +3 -3
- package/dist/core/caps/DbSubscriptionCaps.d.ts.map +1 -1
- package/dist/core/caps/DbSubscriptionCaps.js +16 -26
- package/dist/core/caps/DbSubscriptionCaps.js.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.d.ts +6 -4
- package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.js +37 -5
- package/dist/core/caps/SchemeCtxImpl.js.map +1 -1
- package/dist/core/file-creation-policy.d.ts +9 -0
- package/dist/core/file-creation-policy.d.ts.map +1 -0
- package/dist/core/file-creation-policy.js +25 -0
- package/dist/core/file-creation-policy.js.map +1 -0
- package/dist/core/fork.d.ts +4 -1
- package/dist/core/fork.d.ts.map +1 -1
- package/dist/core/fork.js +27 -15
- package/dist/core/fork.js.map +1 -1
- package/dist/core/fork.sql +35 -22
- package/dist/core/git-membership.d.ts +19 -1
- package/dist/core/git-membership.d.ts.map +1 -1
- package/dist/core/git-membership.js +225 -50
- package/dist/core/git-membership.js.map +1 -1
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +28 -19
- package/dist/core/packet-wire.js.map +1 -1
- package/dist/core/plurnk-uri.d.ts +13 -2
- package/dist/core/plurnk-uri.d.ts.map +1 -1
- package/dist/core/plurnk-uri.js +59 -21
- package/dist/core/plurnk-uri.js.map +1 -1
- package/dist/core/scheme-types.d.ts +1 -0
- package/dist/core/scheme-types.d.ts.map +1 -1
- package/dist/core/worker-ops.sql +10 -6
- package/dist/core/worker-settings.d.ts +1 -0
- package/dist/core/worker-settings.d.ts.map +1 -1
- package/dist/core/worker-settings.js +7 -0
- package/dist/core/worker-settings.js.map +1 -1
- package/dist/core/workspace-settings.d.ts +2 -0
- package/dist/core/workspace-settings.d.ts.map +1 -1
- package/dist/core/workspace-settings.js +5 -1
- package/dist/core/workspace-settings.js.map +1 -1
- package/dist/digest/Digest.d.ts.map +1 -1
- package/dist/digest/Digest.js +1 -1
- package/dist/digest/Digest.js.map +1 -1
- package/dist/digest/digest.sql +1 -1
- package/dist/schemes/Exec.d.ts +3 -2
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +55 -22
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
- package/dist/schemes/ExecOutputScheme.js +5 -4
- package/dist/schemes/ExecOutputScheme.js.map +1 -1
- package/dist/schemes/File.d.ts.map +1 -1
- package/dist/schemes/File.js +170 -80
- package/dist/schemes/File.js.map +1 -1
- package/dist/schemes/Prompt.d.ts +2 -3
- package/dist/schemes/Prompt.d.ts.map +1 -1
- package/dist/schemes/Prompt.js +4 -7
- package/dist/schemes/Prompt.js.map +1 -1
- package/dist/schemes/Skill.d.ts.map +1 -1
- package/dist/schemes/Skill.js +3 -1
- package/dist/schemes/Skill.js.map +1 -1
- package/dist/schemes/Worker.d.ts.map +1 -1
- package/dist/schemes/Worker.js +95 -49
- package/dist/schemes/Worker.js.map +1 -1
- package/dist/schemes/_entry-crud.d.ts +5 -5
- package/dist/schemes/_entry-crud.d.ts.map +1 -1
- package/dist/schemes/_entry-crud.js +22 -17
- package/dist/schemes/_entry-crud.js.map +1 -1
- package/dist/schemes/_entry-crud.sql +58 -23
- package/dist/schemes/_entry-find.d.ts +3 -2
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +26 -25
- package/dist/schemes/_entry-find.js.map +1 -1
- package/dist/schemes/_entry-find.sql +10 -7
- package/dist/schemes/_entry-manifest.d.ts +2 -2
- package/dist/schemes/_entry-manifest.d.ts.map +1 -1
- package/dist/schemes/_entry-manifest.js +6 -5
- package/dist/schemes/_entry-manifest.js.map +1 -1
- package/dist/schemes/_entry-ops.d.ts +6 -5
- package/dist/schemes/_entry-ops.d.ts.map +1 -1
- package/dist/schemes/_entry-ops.js +39 -46
- package/dist/schemes/_entry-ops.js.map +1 -1
- package/dist/schemes/_entry-ops.sql +9 -6
- package/dist/schemes/_entry-send.d.ts +2 -2
- package/dist/schemes/_entry-send.d.ts.map +1 -1
- package/dist/schemes/_entry-send.js +16 -14
- package/dist/schemes/_entry-send.js.map +1 -1
- package/dist/schemes/_search-index.d.ts.map +1 -1
- package/dist/schemes/_search-index.js +2 -0
- package/dist/schemes/_search-index.js.map +1 -1
- package/dist/server/Daemon.d.ts +42 -10
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +326 -248
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/DaemonModule.d.ts +84 -19
- package/dist/server/DaemonModule.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.d.ts +3 -1
- package/dist/server/DrainSupervisor.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.js +11 -9
- package/dist/server/DrainSupervisor.js.map +1 -1
- package/dist/server/Functionality.d.ts +44 -0
- package/dist/server/Functionality.d.ts.map +1 -0
- package/dist/server/Functionality.js +422 -0
- package/dist/server/Functionality.js.map +1 -0
- package/dist/server/FunctionalityManager.d.ts +22 -0
- package/dist/server/FunctionalityManager.d.ts.map +1 -0
- package/dist/server/FunctionalityManager.js +121 -0
- package/dist/server/FunctionalityManager.js.map +1 -0
- package/dist/server/SkillsFunctionality.d.ts +61 -0
- package/dist/server/SkillsFunctionality.d.ts.map +1 -0
- package/dist/server/SkillsFunctionality.js +449 -0
- package/dist/server/SkillsFunctionality.js.map +1 -0
- package/dist/server/WorkerCapabilities.d.ts +21 -0
- package/dist/server/WorkerCapabilities.d.ts.map +1 -0
- package/dist/server/WorkerCapabilities.js +214 -0
- package/dist/server/WorkerCapabilities.js.map +1 -0
- package/dist/server/WorkerResidency.d.ts +40 -0
- package/dist/server/WorkerResidency.d.ts.map +1 -0
- package/dist/server/WorkerResidency.js +283 -0
- package/dist/server/WorkerResidency.js.map +1 -0
- package/dist/server/client-input.d.ts +1 -0
- package/dist/server/client-input.d.ts.map +1 -1
- package/dist/server/client-input.js +22 -1
- package/dist/server/client-input.js.map +1 -1
- package/dist/server/dispatch-as-plurnk.d.ts +2 -2
- package/dist/server/dispatch-as-plurnk.d.ts.map +1 -1
- package/dist/server/dispatch-as-plurnk.js +89 -25
- package/dist/server/dispatch-as-plurnk.js.map +1 -1
- package/dist/server/drain.sql +11 -6
- package/dist/server/envelope.d.ts +6 -1
- package/dist/server/envelope.d.ts.map +1 -1
- package/dist/server/envelope.js +8 -2
- package/dist/server/envelope.js.map +1 -1
- package/dist/server/envelope.sql +11 -3
- package/dist/server/lifecycle-recovery.sql +13 -16
- package/dist/server/loopDocs.d.ts +2 -1
- package/dist/server/loopDocs.d.ts.map +1 -1
- package/dist/server/loopDocs.js +67 -51
- package/dist/server/loopDocs.js.map +1 -1
- package/dist/server/loopDocs.sql +14 -10
- package/dist/server/module-discovery.d.ts +2 -2
- package/dist/server/module-discovery.d.ts.map +1 -1
- package/dist/server/module-discovery.js +27 -2
- package/dist/server/module-discovery.js.map +1 -1
- package/dist/server/seam-entry-read.sql +9 -7
- package/dist/server/seam-log-read.sql +1 -1
- package/dist/server/seam-loop.sql +10 -1
- package/dist/server/seam-proposal-list.sql +4 -2
- package/dist/server/worker-capabilities.sql +19 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +11 -1
- package/dist/service.js.map +1 -1
- package/migrations/001_schema.sql +486 -136
- package/package.json +34 -32
- package/dist/server/skillDocs.d.ts +0 -9
- package/dist/server/skillDocs.d.ts.map +0 -1
- package/dist/server/skillDocs.js +0 -212
- package/dist/server/skillDocs.js.map +0 -1
- package/dist/server/skillDocs.sql +0 -14
- package/dist/server/workspace-capabilities.sql +0 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TurnRunner.d.ts","sourceRoot":"","sources":["../../src/core/TurnRunner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TurnRunner.d.ts","sourceRoot":"","sources":["../../src/core/TurnRunner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,eAAe,EAAsF,MAAM,0BAA0B,CAAC;AAKnK,KAAK,cAAc,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAMxF,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAMlC,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AA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AAC;KAClD,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA07B5B;CAugBJ"}
|
package/dist/core/TurnRunner.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import { PlurnkParser, PlurnkParseError, UNKNOWN_POSITION } from "@plurnk/plurnk-contracts";
|
|
3
|
-
import Owner from "./Owner.js";
|
|
2
|
+
import { PathSyntax, PlurnkParser, PlurnkParseError, UNKNOWN_POSITION } from "@plurnk/plurnk-contracts";
|
|
4
3
|
const TERMINAL_SEND_SIGNALS = new Set([102, 200, 202, 499]);
|
|
5
4
|
const comparePosition = (a, b) => a.line - b.line || a.column - b.column;
|
|
6
5
|
import Meta from "@plurnk/plurnk-meta";
|
|
@@ -9,7 +8,7 @@ import GitMembership from "./git-membership.js";
|
|
|
9
8
|
import GitState from "./git-state.js";
|
|
10
9
|
import WorkspaceSettings from "./workspace-settings.js";
|
|
11
10
|
import { editedSpan } from "../content/index.js";
|
|
12
|
-
import { promptPathname, promptLoopPrefix,
|
|
11
|
+
import { authorityParts, generatedPathname, promptPathname, promptLoopPrefix, renderAddress } from "./plurnk-uri.js";
|
|
13
12
|
import { readFile } from "node:fs/promises";
|
|
14
13
|
// {§grammar-rail-registration} — bare names are the built-in rail namespace;
|
|
15
14
|
// everything else is an import specifier resolved through the Node chain.
|
|
@@ -92,6 +91,15 @@ const parsePromptAttributes = (encoded, source) => {
|
|
|
92
91
|
}
|
|
93
92
|
return attributes;
|
|
94
93
|
};
|
|
94
|
+
const promptSourceFromAttributes = (attributes, source) => {
|
|
95
|
+
const value = attributes.source;
|
|
96
|
+
if (value === undefined)
|
|
97
|
+
return null;
|
|
98
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
99
|
+
throw new TypeError(`${source}: source must be a non-empty string when present`);
|
|
100
|
+
}
|
|
101
|
+
return value;
|
|
102
|
+
};
|
|
95
103
|
// Per-emission action ceiling — OFF by default. `-1` (or unset/non-positive) = no cap:
|
|
96
104
|
// every generated op dispatches. Runaway degeneration is a sampler concern (repetition penalty),
|
|
97
105
|
// not grounds to drop already-generated work. A positive value is an operator ceiling a
|
|
@@ -173,6 +181,7 @@ class TurnRunner {
|
|
|
173
181
|
#dispatcher;
|
|
174
182
|
#liveSubscriptions;
|
|
175
183
|
#streamEventNotify;
|
|
184
|
+
#reasoningEventNotify;
|
|
176
185
|
#wakeWorkerNotify;
|
|
177
186
|
#executors;
|
|
178
187
|
#loopSignal;
|
|
@@ -181,7 +190,7 @@ class TurnRunner {
|
|
|
181
190
|
#dispatch;
|
|
182
191
|
#resolveWorkerProviderIdentity;
|
|
183
192
|
#gbnfCache = new Map();
|
|
184
|
-
constructor({ db, schemes, mimetypes, weigh, notices, problems, strikes, packets, dispatcher, liveSubscriptions, streamEventNotify, wakeWorkerNotify, executors, loopSignal, interactions, warmWorkspace, dispatch, resolveWorkerProviderIdentity, }) {
|
|
193
|
+
constructor({ db, schemes, mimetypes, weigh, notices, problems, strikes, packets, dispatcher, liveSubscriptions, streamEventNotify, reasoningEventNotify, wakeWorkerNotify, executors, loopSignal, interactions, warmWorkspace, dispatch, resolveWorkerProviderIdentity, }) {
|
|
185
194
|
this.#db = db;
|
|
186
195
|
this.#schemes = schemes;
|
|
187
196
|
this.#mimetypes = mimetypes;
|
|
@@ -193,6 +202,7 @@ class TurnRunner {
|
|
|
193
202
|
this.#dispatcher = dispatcher;
|
|
194
203
|
this.#liveSubscriptions = liveSubscriptions;
|
|
195
204
|
this.#streamEventNotify = streamEventNotify;
|
|
205
|
+
this.#reasoningEventNotify = reasoningEventNotify;
|
|
196
206
|
this.#wakeWorkerNotify = wakeWorkerNotify;
|
|
197
207
|
this.#executors = executors;
|
|
198
208
|
this.#loopSignal = loopSignal;
|
|
@@ -390,7 +400,7 @@ class TurnRunner {
|
|
|
390
400
|
// Every admitted producer program is scheduled, dispatched, recorded, and
|
|
391
401
|
// completed here; inference is only the model-specific way one program is
|
|
392
402
|
// acquired and supplied with BARE capability.
|
|
393
|
-
async
|
|
403
|
+
async executeAdmittedTurn({ statements, source, sourceFolded, sourceModelCallId = null, sourceReasoningItems, origin, workspaceId, workerId, loopId, turnId, fromSequence, maxCommands = Number.POSITIVE_INFINITY, enforceIdle = false, failOnOperationError = false, recoverableParseErrors = [], bare, signal, onDispatch, }) {
|
|
394
404
|
const plan = statements[0];
|
|
395
405
|
const finalOp = statements.at(-1);
|
|
396
406
|
if (finalOp?.op !== "SEND") {
|
|
@@ -594,20 +604,24 @@ class TurnRunner {
|
|
|
594
604
|
const initialSequence = await this.#db.engine_next_turn_sequence.get({ loop_id: loopId });
|
|
595
605
|
if (initialSequence === undefined)
|
|
596
606
|
throw new Error("Engine.runTurn: next turn sequence is unavailable");
|
|
597
|
-
//
|
|
598
|
-
//
|
|
599
|
-
//
|
|
607
|
+
// Turn-0 foists that belong to the Worker (catalog preview, AGENTS) gate
|
|
608
|
+
// on its first inference history, not on loop sequence: honest client or
|
|
609
|
+
// runtime administrative turns may precede the first provider exchange.
|
|
610
|
+
// Per-loop foists such as
|
|
600
611
|
// {§prompt-entry} still fires once per loop. Durable publication state,
|
|
601
612
|
// rather than the model-turn ordinal, prevents an overflow diversion
|
|
602
613
|
// from replaying the prompt and its automatic path READs.
|
|
603
614
|
const loopRow = await this.#db.engine_get_loop_prompt.get({ loop_id: loopId });
|
|
604
|
-
const
|
|
615
|
+
const priorInference = await this.#db.engine_worker_has_inference_history.get({
|
|
616
|
+
worker_id: workerId,
|
|
617
|
+
});
|
|
618
|
+
const workerFirstInference = priorInference?.present === 0;
|
|
605
619
|
const createdTurnIds = [];
|
|
606
620
|
try {
|
|
607
621
|
// {§worker-initialization-entry} — turn zero is an ordinary `_plurnk`
|
|
608
622
|
// operation turn. Its model-facing zero is a phase label; durable turn
|
|
609
623
|
// coordinates remain one-based.
|
|
610
|
-
const initializationTurn = initialSequence.next === 1 &&
|
|
624
|
+
const initializationTurn = initialSequence.next === 1 && workerFirstInference
|
|
611
625
|
? await Turn.open(this.#db, { loopId, producer: "_plurnk", kind: "initialization" })
|
|
612
626
|
: null;
|
|
613
627
|
if (initializationTurn !== null)
|
|
@@ -617,24 +631,24 @@ class TurnRunner {
|
|
|
617
631
|
: null;
|
|
618
632
|
if (modelTurn !== null)
|
|
619
633
|
createdTurnIds.push(modelTurn.id);
|
|
620
|
-
// {§env-delta-log-pull} —
|
|
621
|
-
// baseline
|
|
622
|
-
//
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
634
|
+
// {§env-delta-log-pull} — creation atomically owns the ordinary worker
|
|
635
|
+
// baseline or fork snapshot. Packet assembly consumes, never invents,
|
|
636
|
+
// that durable observation boundary.
|
|
637
|
+
const ambientCursor = await this.#db.engine_initialize_ambient_cursor.get({ workspace_id: workspaceId, worker_id: workerId });
|
|
638
|
+
if (ambientCursor?.ambient_event_cursor === null || ambientCursor === undefined) {
|
|
639
|
+
throw new Error(`worker ${workerId} has no durable ambient observation boundary`);
|
|
640
|
+
}
|
|
627
641
|
// Threaded per turn, never engine state, so concurrent loops on
|
|
628
642
|
// different providers each read their own honest tokenizer values.
|
|
629
643
|
const systemContext = (contextTurnId) => ({
|
|
630
|
-
db: this.#db, workspaceId, workerId, loopId, turnId: contextTurnId,
|
|
644
|
+
db: this.#db, workspaceId, workerId, functionalityWorkerId: workerId, loopId, turnId: contextTurnId,
|
|
631
645
|
writer: "_plurnk",
|
|
632
646
|
signal: this.#loopSignal(loopId),
|
|
633
647
|
streamEventNotify: this.#streamEventNotify,
|
|
634
648
|
wakeWorkerNotify: this.#wakeWorkerNotify,
|
|
635
649
|
weigh: this.#weighContent,
|
|
636
650
|
mimetypes: this.#mimetypes,
|
|
637
|
-
defaultChannelFor: (s) => this.#schemes.defaultChannelFor(s,
|
|
651
|
+
defaultChannelFor: (s) => this.#schemes.defaultChannelFor(s, workerId),
|
|
638
652
|
pushNotice: (notice) => this.#notices.push(workspaceId, loopId, notice),
|
|
639
653
|
requestInteraction: (request) => this.#interactions.request(request, { workspaceId, workerId, loopId, turnId: contextTurnId }, this.#loopSignal(loopId)),
|
|
640
654
|
});
|
|
@@ -647,27 +661,31 @@ class TurnRunner {
|
|
|
647
661
|
const plan = {
|
|
648
662
|
op: "PLAN", delimiter: "", annotation: null,
|
|
649
663
|
signal: null, target: null, lineMarker: null,
|
|
650
|
-
body:
|
|
664
|
+
body: [{
|
|
665
|
+
content: "Discover the tooling available and survey the workspace file root.",
|
|
666
|
+
priority: "medium",
|
|
667
|
+
status: "in_progress",
|
|
668
|
+
}],
|
|
651
669
|
position: UNKNOWN_POSITION,
|
|
652
670
|
};
|
|
653
671
|
initializationStatements.push(plan);
|
|
654
672
|
// {§turn0-agents-stunt} — the project AGENTS.md (materialized by LoopDocs as
|
|
655
|
-
// worker
|
|
673
|
+
// worker://~/_plurnk/agents.md) gets one foisted READ on the worker's first
|
|
656
674
|
// loop, so local repo guidance is visible turn-0 content. Global policy
|
|
657
675
|
// stays in the system prompt; nothing else is force-read.
|
|
658
|
-
if (
|
|
659
|
-
const kernelId = await Owner.kernelId(this.#db, workspaceId);
|
|
676
|
+
if (workerFirstInference) {
|
|
660
677
|
const agentsEntry = await this.#db.crud_find_workspace_entry.get({
|
|
661
678
|
workspace_id: workspaceId,
|
|
662
|
-
owner_id:
|
|
679
|
+
owner_id: workerId,
|
|
663
680
|
scheme: "worker",
|
|
664
|
-
|
|
681
|
+
authority: "",
|
|
682
|
+
pathname: generatedPathname("/agents.md"),
|
|
665
683
|
});
|
|
666
684
|
if (agentsEntry !== undefined) {
|
|
667
685
|
const agentsTarget = {
|
|
668
|
-
kind: "url", raw: "worker
|
|
669
|
-
username: null, password: null, hostname: "
|
|
670
|
-
pathname: "/agents.md", query: null, fragment: null,
|
|
686
|
+
kind: "url", raw: "worker://~/_plurnk/agents.md", scheme: "worker",
|
|
687
|
+
username: null, password: null, hostname: "~", port: null,
|
|
688
|
+
pathname: generatedPathname("/agents.md"), query: null, fragment: null,
|
|
671
689
|
};
|
|
672
690
|
const agentsRead = {
|
|
673
691
|
op: "READ", delimiter: "", annotation: null, signal: ["+_plurnk", "+init", "+policy"], target: agentsTarget,
|
|
@@ -691,8 +709,9 @@ class TurnRunner {
|
|
|
691
709
|
// (disk → body channel) so they appear in the catalog. No-ops
|
|
692
710
|
// on headless / non-git workspaces. Runs BEFORE the derivation pump so
|
|
693
711
|
// this turn's packet reflects them.
|
|
694
|
-
//
|
|
695
|
-
//
|
|
712
|
+
// Joining here is the correctness boundary: passive workspace creation and
|
|
713
|
+
// attachment spend nothing, while the model never runs against partial
|
|
714
|
+
// graph/vector coverage.
|
|
696
715
|
await this.#warmWorkspace(systemCtx, false);
|
|
697
716
|
// The warm materialized membership before deriving. This second pass is the
|
|
698
717
|
// ordinary cheap change detector and captures any drift that landed meanwhile.
|
|
@@ -707,31 +726,33 @@ class TurnRunner {
|
|
|
707
726
|
// consume the filesystem divergences a second time.
|
|
708
727
|
await this.#warmWorkspace(systemCtx, true, false);
|
|
709
728
|
// Turn-0 catalog preview (PLURNK_SERVICE_FILES_ITEMS, {§actor-boundary-catalog-preview}):
|
|
710
|
-
//
|
|
711
|
-
// (authored and Plurnk-generated families), attached tools tree, project, commons, and
|
|
712
|
-
// surfaces in that order.
|
|
729
|
+
// Seven bodyless FIND surveys in the worker's packetless initialization turn establish the skills tree
|
|
730
|
+
// (authored and Plurnk-generated families), attached tools tree, enabled agents, project, commons, and
|
|
731
|
+
// private surfaces in that order.
|
|
713
732
|
// Their `init` classification lets the model curate this opening survey as one log set.
|
|
714
733
|
if (initializationTurn !== null) {
|
|
715
734
|
// {§operator-config-workspace-files-items} — workspace filesItems replaces the env default.
|
|
716
735
|
const { filesItems: workspaceMI } = await WorkspaceSettings.read(this.#db, workspaceId);
|
|
717
736
|
const filesItems = workspaceMI !== null ? normalizeFilesItems(workspaceMI) : readFilesItems();
|
|
718
|
-
if (filesItems !== null &&
|
|
737
|
+
if (filesItems !== null && workerFirstInference) { // {§actor-boundary-catalog-preview} — once per worker
|
|
719
738
|
const catalogSchemes = await this.#db.engine_scheme_catalog_summary.all({ workspace_id: workspaceId });
|
|
720
739
|
const fileItems = catalogSchemes.find(({ scheme }) => scheme === "file")?.shallow_items ?? 0;
|
|
721
740
|
const fileCap = filesItems > 0 && fileItems > 0 ? Math.min(filesItems, fileItems) : null;
|
|
722
741
|
// {§tools-resource-materialization} — PLURNK_MCP_EXPANDED servers
|
|
723
|
-
// contribute one complete
|
|
724
|
-
// family survey, so turn 0 names every tool they
|
|
742
|
+
// contribute one complete family-document READ each, directly
|
|
743
|
+
// after the family survey, so turn 0 names every tool they
|
|
744
|
+
// expose in order. (The family document is the whole tool
|
|
745
|
+
// teaching — per-target child documents do not exist.)
|
|
725
746
|
const registry = this.#executors();
|
|
726
747
|
const toolExpansions = [];
|
|
727
|
-
for (const tag of registry?.availableRuntimes(
|
|
728
|
-
const entry = registry?.entry(tag,
|
|
748
|
+
for (const tag of registry?.availableRuntimes(workerId) ?? []) {
|
|
749
|
+
const entry = registry?.entry(tag, workerId);
|
|
729
750
|
if (entry?.resourcesPath !== "/tools" || entry.expandTools !== true)
|
|
730
751
|
continue;
|
|
731
752
|
toolExpansions.push({
|
|
732
753
|
statement: {
|
|
733
|
-
op: "
|
|
734
|
-
target: { kind: "url", raw: `worker
|
|
754
|
+
op: "READ", delimiter: "", annotation: `enabled tools: ${tag}`, signal: ["+_plurnk", "+init", "+tools"],
|
|
755
|
+
target: { kind: "url", raw: `worker://~/_plurnk/tools/${tag}.md`, scheme: "worker", username: null, password: null, hostname: "~", port: null, pathname: generatedPathname(`/tools/${tag}.md`), query: null, fragment: null },
|
|
735
756
|
body: null, lineMarker: { marks: [1, -1] }, position: UNKNOWN_POSITION,
|
|
736
757
|
},
|
|
737
758
|
});
|
|
@@ -740,14 +761,14 @@ class TurnRunner {
|
|
|
740
761
|
{
|
|
741
762
|
statement: {
|
|
742
763
|
op: "FIND", delimiter: "", annotation: null, signal: ["+_plurnk", "+init", "+skills"],
|
|
743
|
-
target: { kind: "url", raw: "worker
|
|
764
|
+
target: { kind: "url", raw: "worker://~/_plurnk/skills/*.md", scheme: "worker", username: null, password: null, hostname: "~", port: null, pathname: generatedPathname("/skills/*.md"), query: null, fragment: null },
|
|
744
765
|
body: null, lineMarker: { marks: [1, -1] }, position: UNKNOWN_POSITION,
|
|
745
766
|
},
|
|
746
767
|
},
|
|
747
768
|
{
|
|
748
769
|
statement: {
|
|
749
770
|
op: "FIND", delimiter: "", annotation: null, signal: ["+_plurnk", "+init", "+skills"],
|
|
750
|
-
target: { kind: "url", raw: "worker
|
|
771
|
+
target: { kind: "url", raw: "worker://~/_plurnk/skills/plurnk/*.md", scheme: "worker", username: null, password: null, hostname: "~", port: null, pathname: generatedPathname("/skills/plurnk/*.md"), query: null, fragment: null },
|
|
751
772
|
body: null, lineMarker: { marks: [1, -1] }, position: UNKNOWN_POSITION,
|
|
752
773
|
},
|
|
753
774
|
},
|
|
@@ -760,11 +781,21 @@ class TurnRunner {
|
|
|
760
781
|
// tool tree.
|
|
761
782
|
statement: {
|
|
762
783
|
op: "FIND", delimiter: "", annotation: "enabled tools", signal: ["+_plurnk", "+init", "+tools"],
|
|
763
|
-
target: { kind: "url", raw: "worker
|
|
784
|
+
target: { kind: "url", raw: "worker://~/_plurnk/tools/*.md", scheme: "worker", username: null, password: null, hostname: "~", port: null, pathname: generatedPathname("/tools/*.md"), query: null, fragment: null },
|
|
764
785
|
body: null, lineMarker: { marks: [1, -1] }, position: UNKNOWN_POSITION,
|
|
765
786
|
},
|
|
766
787
|
},
|
|
767
788
|
...toolExpansions,
|
|
789
|
+
{
|
|
790
|
+
// {§a2a-agents-catalog} — enabled outbound agents survey at
|
|
791
|
+
// alias level; each row's summary is the agent's identity line,
|
|
792
|
+
// the exact card stays pullable through READ a2a://<alias>.
|
|
793
|
+
statement: {
|
|
794
|
+
op: "FIND", delimiter: "", annotation: "enabled agents", signal: ["+_plurnk", "+init", "+agents"],
|
|
795
|
+
target: { kind: "url", raw: "worker://~/_plurnk/agents/*.md", scheme: "worker", username: null, password: null, hostname: "~", port: null, pathname: generatedPathname("/agents/*.md"), query: null, fragment: null },
|
|
796
|
+
body: null, lineMarker: { marks: [1, -1] }, position: UNKNOWN_POSITION,
|
|
797
|
+
},
|
|
798
|
+
},
|
|
768
799
|
{
|
|
769
800
|
statement: {
|
|
770
801
|
op: "FIND", delimiter: "", annotation: "workspace files", signal: ["+_plurnk", "+init"],
|
|
@@ -800,7 +831,7 @@ class TurnRunner {
|
|
|
800
831
|
initializationStatements.push(send);
|
|
801
832
|
const source = TurnOps.renderInternal(initializationStatements);
|
|
802
833
|
const admitted = TurnOps.parseInternal(source);
|
|
803
|
-
const result = await this
|
|
834
|
+
const result = await this.executeAdmittedTurn({
|
|
804
835
|
statements: admitted,
|
|
805
836
|
source,
|
|
806
837
|
sourceFolded: false,
|
|
@@ -841,9 +872,12 @@ class TurnRunner {
|
|
|
841
872
|
const promptPath = promptTarget(promptLoopSeq, 1);
|
|
842
873
|
const entry = {
|
|
843
874
|
channels: { body: { content: promptRow.prompt, mimetype: "text/markdown" } },
|
|
844
|
-
attributes: {
|
|
875
|
+
attributes: {
|
|
876
|
+
openPaths,
|
|
877
|
+
...(promptRow.prompt_source === null ? {} : { source: promptRow.prompt_source }),
|
|
878
|
+
},
|
|
845
879
|
};
|
|
846
|
-
await EntryCrud.writeEntry(promptPath.pathname, entry, systemCtx, "prompt", workerId);
|
|
880
|
+
await EntryCrud.writeEntry({ authority: "", pathname: promptPath.pathname }, entry, systemCtx, "prompt", workerId);
|
|
847
881
|
turnOpenPaths.push(...openPaths);
|
|
848
882
|
const promptLogId = await this.#writePromptLog({
|
|
849
883
|
workerId,
|
|
@@ -852,6 +886,7 @@ class TurnRunner {
|
|
|
852
886
|
sequence: nextActionIndex++,
|
|
853
887
|
target: promptPath,
|
|
854
888
|
content: promptRow.prompt,
|
|
889
|
+
source: promptRow.prompt_source,
|
|
855
890
|
});
|
|
856
891
|
onDispatch?.(promptLogId);
|
|
857
892
|
}
|
|
@@ -882,6 +917,7 @@ class TurnRunner {
|
|
|
882
917
|
sequence: nextActionIndex++,
|
|
883
918
|
target: promptTarget(loopSeq, ordinal),
|
|
884
919
|
content: injectedRow.content,
|
|
920
|
+
source: promptSourceFromAttributes(attributes, `Prompt ${injectedRow.pathname} attributes`),
|
|
885
921
|
});
|
|
886
922
|
onDispatch?.(promptLogId);
|
|
887
923
|
}
|
|
@@ -914,7 +950,7 @@ class TurnRunner {
|
|
|
914
950
|
// the subsequent turn. The terminal output then surfaces born-OPEN via the stream-delta path.
|
|
915
951
|
await this.#reapTurnScopedStreams(workerId);
|
|
916
952
|
nextActionIndex += await this.#materializeEnvironmentDeltas({ workspaceId, workerId, loopId, turnId, fromSequence: nextActionIndex });
|
|
917
|
-
nextActionIndex += await this.#materializeStreamDeltas({
|
|
953
|
+
nextActionIndex += await this.#materializeStreamDeltas({ workerId, loopId, turnId, fromSequence: nextActionIndex });
|
|
918
954
|
// The post-reconciliation Git snapshot above is threaded into the packet
|
|
919
955
|
// and every budget rebuild; overflow never shells again.
|
|
920
956
|
// Notices are non-terminal observations, never operation-failure truth.
|
|
@@ -954,7 +990,7 @@ class TurnRunner {
|
|
|
954
990
|
];
|
|
955
991
|
const source = TurnOps.renderInternal(internalStatements);
|
|
956
992
|
const admitted = TurnOps.parseInternal(source);
|
|
957
|
-
const executed = await this
|
|
993
|
+
const executed = await this.executeAdmittedTurn({
|
|
958
994
|
statements: admitted,
|
|
959
995
|
source,
|
|
960
996
|
sourceFolded: true,
|
|
@@ -1081,6 +1117,31 @@ class TurnRunner {
|
|
|
1081
1117
|
providerAttemptId = attemptRow.id;
|
|
1082
1118
|
providerCallInFlight = true;
|
|
1083
1119
|
const currentModelCall = providerModelCall;
|
|
1120
|
+
let reasoningStarted = false;
|
|
1121
|
+
// {§notifications-reasoning-event} Only the parent emission is
|
|
1122
|
+
// conversational; BARE has no observer on its isolated calls.
|
|
1123
|
+
const observeReasoning = this.#reasoningEventNotify === undefined
|
|
1124
|
+
? undefined
|
|
1125
|
+
: (delta) => {
|
|
1126
|
+
if (!reasoningStarted) {
|
|
1127
|
+
reasoningStarted = true;
|
|
1128
|
+
this.#reasoningEventNotify(workspaceId, {
|
|
1129
|
+
workerId,
|
|
1130
|
+
loopId,
|
|
1131
|
+
turnId,
|
|
1132
|
+
modelCallId: currentModelCall.id,
|
|
1133
|
+
phase: "start",
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
this.#reasoningEventNotify(workspaceId, {
|
|
1137
|
+
workerId,
|
|
1138
|
+
loopId,
|
|
1139
|
+
turnId,
|
|
1140
|
+
modelCallId: currentModelCall.id,
|
|
1141
|
+
phase: "content",
|
|
1142
|
+
delta,
|
|
1143
|
+
});
|
|
1144
|
+
};
|
|
1084
1145
|
let completedResponse;
|
|
1085
1146
|
try {
|
|
1086
1147
|
completedResponse = await observed(// {§observability-boundary}
|
|
@@ -1101,6 +1162,7 @@ class TurnRunner {
|
|
|
1101
1162
|
loop: loopSeq,
|
|
1102
1163
|
turn: seq,
|
|
1103
1164
|
observeRequest: currentModelCall.observeRequest,
|
|
1165
|
+
observeReasoning,
|
|
1104
1166
|
callKind: "emission",
|
|
1105
1167
|
}); // {§provider-surface-generate} {§provider-guarantees-signal-wired} {§provider-guarantees-serial-attempts} {§attribution} {§client-metadata}
|
|
1106
1168
|
currentModelCall.assertAccounting(generated.accounting);
|
|
@@ -1147,6 +1209,17 @@ class TurnRunner {
|
|
|
1147
1209
|
modelMessages = PacketWire.packetToWireMessages(requestPacket);
|
|
1148
1210
|
continue;
|
|
1149
1211
|
}
|
|
1212
|
+
finally {
|
|
1213
|
+
if (reasoningStarted) {
|
|
1214
|
+
this.#reasoningEventNotify(workspaceId, {
|
|
1215
|
+
workerId,
|
|
1216
|
+
loopId,
|
|
1217
|
+
turnId,
|
|
1218
|
+
modelCallId: currentModelCall.id,
|
|
1219
|
+
phase: "end",
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1150
1223
|
response = completedResponse;
|
|
1151
1224
|
await currentModelCall.observeResponse(completedResponse);
|
|
1152
1225
|
railEvidence = railGrammar === undefined
|
|
@@ -1379,7 +1452,7 @@ class TurnRunner {
|
|
|
1379
1452
|
const reasoningItems = response.assistant.reasoningEncrypted?.length
|
|
1380
1453
|
? response.assistant.reasoningEncrypted
|
|
1381
1454
|
: undefined;
|
|
1382
|
-
const executed = await this
|
|
1455
|
+
const executed = await this.executeAdmittedTurn({
|
|
1383
1456
|
statements: packetAssistant.ops,
|
|
1384
1457
|
source: splitResponse.sourceBacked ? packetAssistant.content : null,
|
|
1385
1458
|
sourceFolded: true,
|
|
@@ -1542,7 +1615,7 @@ class TurnRunner {
|
|
|
1542
1615
|
};
|
|
1543
1616
|
}
|
|
1544
1617
|
// #note12 — plugin reference docs are materialized beneath
|
|
1545
|
-
// worker
|
|
1618
|
+
// worker://~/_plurnk/skills/plurnk/ by LoopDocs.
|
|
1546
1619
|
async #materializeEnvironmentDeltas(args) {
|
|
1547
1620
|
const { workspaceId, workerId, loopId, turnId, fromSequence } = args;
|
|
1548
1621
|
const rows = await this.#db.engine_pull_ambient_events.all({ workspace_id: workspaceId, worker_id: workerId });
|
|
@@ -1552,11 +1625,10 @@ class TurnRunner {
|
|
|
1552
1625
|
let written = 0;
|
|
1553
1626
|
for (const r of rows) {
|
|
1554
1627
|
if (r.event_id === null || r.producer_worker_id === null || r.producer_worker_name === null || r.kind === null
|
|
1555
|
-
|| r.op === null || r.
|
|
1628
|
+
|| r.at === null || r.op === null || r.delimiter === null || r.tx === null || r.mimetype_tx === null
|
|
1629
|
+
|| r.rx === null || r.mimetype_rx === null || r.status_rx === null || r.state === null)
|
|
1556
1630
|
continue;
|
|
1557
1631
|
const termination = r.kind === "loop_termination";
|
|
1558
|
-
if (r.rx === null)
|
|
1559
|
-
throw new Error(`ambient event ${r.event_id} has no materializable result`);
|
|
1560
1632
|
const terminal = termination
|
|
1561
1633
|
? TerminalResult.parse(r.rx, `ambient loop-termination event ${r.event_id}`)
|
|
1562
1634
|
: null;
|
|
@@ -1587,23 +1659,36 @@ class TurnRunner {
|
|
|
1587
1659
|
}
|
|
1588
1660
|
const inserted = await this.#db.engine_insert_ambient_delta.get({
|
|
1589
1661
|
worker_id: workerId, loop_id: loopId, turn_id: turnId, sequence: fromSequence + written,
|
|
1662
|
+
at: r.at,
|
|
1590
1663
|
event_id: r.event_id,
|
|
1591
|
-
source:
|
|
1664
|
+
source: WorkerControlAddress.render(r.producer_worker_name),
|
|
1592
1665
|
op: r.op,
|
|
1666
|
+
delimiter: r.delimiter,
|
|
1667
|
+
signal: r.signal,
|
|
1593
1668
|
scheme: r.scheme,
|
|
1669
|
+
username: r.username,
|
|
1670
|
+
password: r.password,
|
|
1594
1671
|
hostname: r.hostname,
|
|
1672
|
+
port: r.port,
|
|
1595
1673
|
pathname: r.pathname,
|
|
1674
|
+
query: r.query,
|
|
1675
|
+
fragment: r.fragment,
|
|
1676
|
+
line_marker: r.line_marker,
|
|
1677
|
+
tx: r.tx,
|
|
1678
|
+
mimetype_tx: r.mimetype_tx,
|
|
1596
1679
|
rx: r.rx,
|
|
1597
|
-
mimetype_rx:
|
|
1680
|
+
mimetype_rx: r.mimetype_rx,
|
|
1598
1681
|
status: r.status_rx,
|
|
1599
1682
|
weight: LogBody.weight({
|
|
1600
1683
|
op: r.op,
|
|
1601
1684
|
attrs,
|
|
1602
|
-
tx:
|
|
1685
|
+
tx: r.tx,
|
|
1603
1686
|
rx: r.rx,
|
|
1604
|
-
mimetypeTx:
|
|
1605
|
-
mimetypeRx:
|
|
1687
|
+
mimetypeTx: r.mimetype_tx,
|
|
1688
|
+
mimetypeRx: r.mimetype_rx,
|
|
1606
1689
|
}, this.#weighContent),
|
|
1690
|
+
state: r.state,
|
|
1691
|
+
outcome: r.outcome,
|
|
1607
1692
|
folded: LogVisibility.serialize(terminal !== null && terminal.status >= 200 && terminal.status < 300
|
|
1608
1693
|
? LogVisibility.OPEN
|
|
1609
1694
|
: LogVisibility.FOLDED),
|
|
@@ -1639,7 +1724,7 @@ class TurnRunner {
|
|
|
1639
1724
|
await Promise.all(open.map(({ id }) => this.#liveSubscriptions.cancel(id)));
|
|
1640
1725
|
}
|
|
1641
1726
|
async #materializeStreamDeltas(args) {
|
|
1642
|
-
const {
|
|
1727
|
+
const { workerId, loopId, turnId, fromSequence } = args;
|
|
1643
1728
|
const channels = await this.#db.engine_worker_stream_channels.all({ worker_id: workerId });
|
|
1644
1729
|
let written = 0;
|
|
1645
1730
|
for (const ch of channels) {
|
|
@@ -1648,17 +1733,22 @@ class TurnRunner {
|
|
|
1648
1733
|
// ordinary address to the model; only an explicitly non-default
|
|
1649
1734
|
// channel earns a fragment in the log.
|
|
1650
1735
|
const visibleFragment = ch.published_channel !== null
|
|
1651
|
-
&& ch.channel === this.#schemes.defaultChannelFor(ch.runtime,
|
|
1736
|
+
&& ch.channel === this.#schemes.defaultChannelFor(ch.runtime, workerId)
|
|
1652
1737
|
? null
|
|
1653
1738
|
: ch.channel;
|
|
1654
|
-
const
|
|
1655
|
-
|
|
1739
|
+
const streamBase = renderAddress({
|
|
1740
|
+
scheme: ch.runtime,
|
|
1741
|
+
authority: ch.authority,
|
|
1742
|
+
pathname: ch.coord,
|
|
1656
1743
|
});
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1744
|
+
const streamTarget = visibleFragment === null
|
|
1745
|
+
? streamBase
|
|
1746
|
+
: `${streamBase}#${PathSyntax.escapeTarget(visibleFragment)}`;
|
|
1747
|
+
const targetParts = authorityParts(ch.authority);
|
|
1748
|
+
const cursor = ch.published_end;
|
|
1659
1749
|
const closed = ch.state === "closed" || ch.state === "errored";
|
|
1660
1750
|
const terminal = closed
|
|
1661
|
-
? Results.assert(JSON.parse(ch.
|
|
1751
|
+
? Results.assert(JSON.parse(ch.producer_result ?? "null"))
|
|
1662
1752
|
: null;
|
|
1663
1753
|
const terminalResult = async (fields, sequence) => {
|
|
1664
1754
|
if (terminal === null)
|
|
@@ -1689,17 +1779,10 @@ class TurnRunner {
|
|
|
1689
1779
|
// completion is information independently of payload. A text stream that delivered
|
|
1690
1780
|
// content retains its terse revisit marker; an empty text stream and every structured
|
|
1691
1781
|
// channel emit a bodyless typed conclusion.
|
|
1692
|
-
if (
|
|
1693
|
-
const streamTarget = renderTarget({
|
|
1694
|
-
scheme: ch.runtime,
|
|
1695
|
-
pathname: ch.coord,
|
|
1696
|
-
fragment: visibleFragment,
|
|
1697
|
-
});
|
|
1698
|
-
if (streamTarget === null)
|
|
1699
|
-
throw new Error(`stream ${ch.subscription_id} has no renderable address`);
|
|
1782
|
+
if (terminal !== null) {
|
|
1700
1783
|
const sequence = fromSequence + written;
|
|
1701
1784
|
const content = cursor > 0 && baseMimetype(ch.mimetype).startsWith("text/")
|
|
1702
|
-
? `[ stream closed (${
|
|
1785
|
+
? `[ stream closed (${terminal.status}) - full output already delivered above; READ ${streamTarget} to revisit ]`
|
|
1703
1786
|
: "";
|
|
1704
1787
|
const rx = JSON.stringify(await terminalResult({
|
|
1705
1788
|
content,
|
|
@@ -1707,7 +1790,9 @@ class TurnRunner {
|
|
|
1707
1790
|
}, sequence));
|
|
1708
1791
|
await this.#db.engine_insert_stream_delta.run({
|
|
1709
1792
|
worker_id: workerId, loop_id: loopId, turn_id: turnId, sequence,
|
|
1710
|
-
|
|
1793
|
+
subscription_publication_id: ch.publication_id,
|
|
1794
|
+
scheme: ch.runtime, hostname: targetParts.hostname, port: targetParts.port,
|
|
1795
|
+
pathname: ch.coord, fragment: visibleFragment,
|
|
1711
1796
|
rx,
|
|
1712
1797
|
weight: LogBody.weight({
|
|
1713
1798
|
op: "READ",
|
|
@@ -1738,7 +1823,9 @@ class TurnRunner {
|
|
|
1738
1823
|
const rx = JSON.stringify(result);
|
|
1739
1824
|
await this.#db.engine_insert_stream_delta.run({
|
|
1740
1825
|
worker_id: workerId, loop_id: loopId, turn_id: turnId, sequence,
|
|
1741
|
-
|
|
1826
|
+
subscription_publication_id: ch.publication_id,
|
|
1827
|
+
scheme: ch.runtime, hostname: targetParts.hostname, port: targetParts.port,
|
|
1828
|
+
pathname: ch.coord, fragment: visibleFragment,
|
|
1742
1829
|
rx,
|
|
1743
1830
|
weight: LogBody.weight({
|
|
1744
1831
|
op: "READ",
|
|
@@ -1831,7 +1918,7 @@ class TurnRunner {
|
|
|
1831
1918
|
throw cause;
|
|
1832
1919
|
}
|
|
1833
1920
|
}
|
|
1834
|
-
async #writePromptLog({ workerId, loopId, turnId, sequence, target, content, }) {
|
|
1921
|
+
async #writePromptLog({ workerId, loopId, turnId, sequence, target, content, source, }) {
|
|
1835
1922
|
const rx = JSON.stringify({ content, mimetype: "text/markdown" });
|
|
1836
1923
|
const row = await this.#db.engine_insert_log_entry.get({
|
|
1837
1924
|
worker_id: workerId,
|
|
@@ -1839,7 +1926,7 @@ class TurnRunner {
|
|
|
1839
1926
|
turn_id: turnId,
|
|
1840
1927
|
sequence,
|
|
1841
1928
|
origin: "_plurnk",
|
|
1842
|
-
source
|
|
1929
|
+
source,
|
|
1843
1930
|
model_call_id: null,
|
|
1844
1931
|
op: "prompt",
|
|
1845
1932
|
delimiter: "",
|