@plurnk/plurnk-service 3.0.0 → 3.2.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 +38 -21
- package/INSTALL.md +38 -1
- package/README.md +3 -0
- package/SPEC.md +681 -268
- package/dist/build-info.json +1 -1
- package/dist/completions/_plurnk-service +13 -0
- package/dist/completions/plurnk-service.bash +19 -0
- package/dist/completions/plurnk-service.fish +94 -0
- package/dist/content/path-mimetype.d.ts.map +1 -1
- package/dist/content/path-mimetype.js +2 -8
- package/dist/content/path-mimetype.js.map +1 -1
- package/dist/core/AdmittedTurnExecutor.d.ts +2 -2
- package/dist/core/AdmittedTurnExecutor.d.ts.map +1 -1
- package/dist/core/AdmittedTurnExecutor.js +36 -32
- package/dist/core/AdmittedTurnExecutor.js.map +1 -1
- package/dist/core/BudgetReadout.d.ts +7 -2
- package/dist/core/BudgetReadout.d.ts.map +1 -1
- package/dist/core/BudgetReadout.js +36 -5
- package/dist/core/BudgetReadout.js.map +1 -1
- package/dist/{schemes/_derivation-use.d.ts → core/ContentUse.d.ts} +3 -3
- package/dist/core/ContentUse.d.ts.map +1 -0
- package/dist/{schemes/_derivation-use.js → core/ContentUse.js} +8 -7
- package/dist/core/ContentUse.js.map +1 -0
- package/dist/core/DataStatementRunner.d.ts.map +1 -1
- package/dist/core/DataStatementRunner.js +8 -20
- package/dist/core/DataStatementRunner.js.map +1 -1
- package/dist/core/Dispatcher.d.ts +11 -3
- package/dist/core/Dispatcher.d.ts.map +1 -1
- package/dist/core/Dispatcher.js +186 -109
- package/dist/core/Dispatcher.js.map +1 -1
- package/dist/core/EditMutations.js +1 -1
- package/dist/core/EditMutations.js.map +1 -1
- package/dist/core/Engine.d.ts +1 -1
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +4 -7
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/EnvFlags.js +1 -1
- package/dist/core/EnvFlags.js.map +1 -1
- package/dist/core/FabricatedLog.d.ts +1 -0
- package/dist/core/FabricatedLog.d.ts.map +1 -1
- package/dist/core/FabricatedLog.js +8 -0
- package/dist/core/FabricatedLog.js.map +1 -1
- package/dist/core/FileAddress.d.ts +12 -0
- package/dist/core/FileAddress.d.ts.map +1 -0
- package/dist/core/FileAddress.js +73 -0
- package/dist/core/FileAddress.js.map +1 -0
- package/dist/core/FilePublication.d.ts +15 -0
- package/dist/core/FilePublication.d.ts.map +1 -0
- package/dist/core/FilePublication.js +143 -0
- package/dist/core/FilePublication.js.map +1 -0
- package/dist/core/FileSnapshot.d.ts +26 -0
- package/dist/core/FileSnapshot.d.ts.map +1 -0
- package/dist/core/FileSnapshot.js +179 -0
- package/dist/core/FileSnapshot.js.map +1 -0
- package/dist/core/KillHandler.d.ts.map +1 -1
- package/dist/core/KillHandler.js +4 -1
- package/dist/core/KillHandler.js.map +1 -1
- package/dist/core/LiveSubscription.d.ts.map +1 -1
- package/dist/core/LiveSubscription.js +14 -2
- package/dist/core/LiveSubscription.js.map +1 -1
- package/dist/core/LiveSubscriptions.d.ts +3 -1
- package/dist/core/LiveSubscriptions.d.ts.map +1 -1
- package/dist/core/LiveSubscriptions.js +16 -1
- package/dist/core/LiveSubscriptions.js.map +1 -1
- package/dist/core/LogBody.d.ts.map +1 -1
- package/dist/core/LogBody.js +3 -1
- package/dist/core/LogBody.js.map +1 -1
- package/dist/core/LoopDriver.d.ts.map +1 -1
- package/dist/core/LoopDriver.js +3 -0
- package/dist/core/LoopDriver.js.map +1 -1
- package/dist/core/LoopLifecycle.sql +1 -0
- package/dist/core/MembershipMaterialization.d.ts.map +1 -1
- package/dist/core/MembershipMaterialization.js +87 -143
- package/dist/core/MembershipMaterialization.js.map +1 -1
- package/dist/core/MessageResources.sql +31 -0
- package/dist/core/MutationEffects.d.ts +2 -1
- package/dist/core/MutationEffects.d.ts.map +1 -1
- package/dist/core/MutationEffects.js +14 -1
- package/dist/core/MutationEffects.js.map +1 -1
- package/dist/core/PacketBuilder.d.ts +2 -2
- package/dist/core/PacketBuilder.d.ts.map +1 -1
- package/dist/core/PacketBuilder.js +123 -51
- package/dist/core/PacketBuilder.js.map +1 -1
- package/dist/core/PacketBuilder.sql +21 -14
- package/dist/core/PathGlob.d.ts +6 -0
- package/dist/core/PathGlob.d.ts.map +1 -0
- package/dist/core/PathGlob.js +24 -0
- package/dist/core/PathGlob.js.map +1 -0
- package/dist/core/ProposalLifecycle.d.ts +2 -1
- package/dist/core/ProposalLifecycle.d.ts.map +1 -1
- package/dist/core/ProposalLifecycle.js +45 -33
- package/dist/core/ProposalLifecycle.js.map +1 -1
- package/dist/core/ProposalLifecycle.sql +4 -0
- package/dist/core/ReplyMetadata.d.ts +10 -0
- package/dist/core/ReplyMetadata.d.ts.map +1 -0
- package/dist/core/ReplyMetadata.js +20 -0
- package/dist/core/ReplyMetadata.js.map +1 -0
- package/dist/core/ResourceBindings.d.ts.map +1 -1
- package/dist/core/ResourceBindings.js +4 -3
- package/dist/core/ResourceBindings.js.map +1 -1
- package/dist/core/ResourceSelector.d.ts +1 -2
- package/dist/core/ResourceSelector.d.ts.map +1 -1
- package/dist/core/ResourceSelector.js +30 -9
- package/dist/core/ResourceSelector.js.map +1 -1
- package/dist/core/ResourceTransfers.d.ts +1 -1
- package/dist/core/ResourceTransfers.d.ts.map +1 -1
- package/dist/core/ResourceTransfers.js +26 -11
- package/dist/core/ResourceTransfers.js.map +1 -1
- package/dist/core/ServiceHelp.d.ts +6 -0
- package/dist/core/ServiceHelp.d.ts.map +1 -0
- package/dist/core/ServiceHelp.js +35 -0
- package/dist/core/ServiceHelp.js.map +1 -0
- package/dist/core/StoredPacket.d.ts +1 -0
- package/dist/core/StoredPacket.d.ts.map +1 -1
- package/dist/core/StoredPacket.js +4 -1
- package/dist/core/StoredPacket.js.map +1 -1
- package/dist/core/StrikeRail.d.ts.map +1 -1
- package/dist/core/StrikeRail.js +2 -2
- package/dist/core/StrikeRail.js.map +1 -1
- package/dist/core/TokenCalibration.d.ts +2 -2
- package/dist/core/TokenCalibration.d.ts.map +1 -1
- package/dist/core/TokenCalibration.js +12 -16
- package/dist/core/TokenCalibration.js.map +1 -1
- package/dist/core/TokenCalibration.sql +29 -6
- package/dist/core/TurnDispositionHandler.d.ts +1 -2
- package/dist/core/TurnDispositionHandler.d.ts.map +1 -1
- package/dist/core/TurnDispositionHandler.js +30 -26
- package/dist/core/TurnDispositionHandler.js.map +1 -1
- package/dist/core/TurnMaterialization.d.ts.map +1 -1
- package/dist/core/TurnMaterialization.js +11 -1
- package/dist/core/TurnMaterialization.js.map +1 -1
- package/dist/core/TurnOps.d.ts +5 -1
- package/dist/core/TurnOps.d.ts.map +1 -1
- package/dist/core/TurnOps.js +29 -2
- package/dist/core/TurnOps.js.map +1 -1
- package/dist/core/TurnRunner.d.ts.map +1 -1
- package/dist/core/TurnRunner.js +122 -56
- package/dist/core/TurnRunner.js.map +1 -1
- package/dist/core/TurnSources.sql +2 -2
- package/dist/core/caps/SchemeCtxImpl.d.ts +1 -0
- package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.js +5 -0
- package/dist/core/caps/SchemeCtxImpl.js.map +1 -1
- package/dist/core/git-membership.d.ts +1 -0
- package/dist/core/git-membership.d.ts.map +1 -1
- package/dist/core/git-membership.js +9 -11
- package/dist/core/git-membership.js.map +1 -1
- package/dist/core/glob_match.js +3 -3
- package/dist/core/glob_match.js.map +1 -1
- package/dist/core/mutation-types.d.ts +3 -0
- package/dist/core/mutation-types.d.ts.map +1 -1
- package/dist/core/namespace.d.ts +4 -1
- package/dist/core/namespace.d.ts.map +1 -1
- package/dist/core/namespace.js +14 -3
- package/dist/core/namespace.js.map +1 -1
- package/dist/core/packet-wire.d.ts +7 -1
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +98 -36
- package/dist/core/packet-wire.js.map +1 -1
- package/dist/core/plurnk-uri.d.ts +3 -2
- package/dist/core/plurnk-uri.d.ts.map +1 -1
- package/dist/core/plurnk-uri.js +23 -11
- package/dist/core/plurnk-uri.js.map +1 -1
- package/dist/core/recap-lines.d.ts +4 -0
- package/dist/core/recap-lines.d.ts.map +1 -0
- package/dist/core/recap-lines.js +11 -0
- package/dist/core/recap-lines.js.map +1 -0
- package/dist/core/scheme-types.d.ts +1 -0
- package/dist/core/scheme-types.d.ts.map +1 -1
- package/dist/core/sql-functions.d.ts +2 -0
- package/dist/core/sql-functions.d.ts.map +1 -0
- package/dist/core/sql-functions.js +5 -0
- package/dist/core/sql-functions.js.map +1 -0
- package/dist/core/sqlite-synchronous.d.ts +2 -0
- package/dist/core/sqlite-synchronous.d.ts.map +1 -0
- package/dist/core/sqlite-synchronous.js +4 -0
- package/dist/core/sqlite-synchronous.js.map +1 -0
- package/dist/core/turn-scheduler.d.ts.map +1 -1
- package/dist/core/turn-scheduler.js +1 -1
- package/dist/core/turn-scheduler.js.map +1 -1
- package/dist/evidence/EvidenceReader.d.ts.map +1 -1
- package/dist/evidence/EvidenceReader.js +23 -3
- package/dist/evidence/EvidenceReader.js.map +1 -1
- package/dist/evidence/digest.sql +7 -1
- package/dist/man/plurnk-service.1 +499 -0
- package/dist/schemes/Env.d.ts +26 -0
- package/dist/schemes/Env.d.ts.map +1 -0
- package/dist/schemes/Env.js +133 -0
- package/dist/schemes/Env.js.map +1 -0
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +15 -15
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/ExecOutputScheme.d.ts +3 -2
- package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
- package/dist/schemes/ExecOutputScheme.js +9 -0
- package/dist/schemes/ExecOutputScheme.js.map +1 -1
- package/dist/schemes/File.d.ts +1 -0
- package/dist/schemes/File.d.ts.map +1 -1
- package/dist/schemes/File.js +233 -268
- package/dist/schemes/File.js.map +1 -1
- package/dist/schemes/Log.d.ts.map +1 -1
- package/dist/schemes/Log.js +97 -17
- package/dist/schemes/Log.js.map +1 -1
- package/dist/schemes/Log.sql +9 -0
- package/dist/schemes/Worker.js +1 -1
- package/dist/schemes/Worker.js.map +1 -1
- package/dist/schemes/_entry-crud.d.ts +2 -0
- package/dist/schemes/_entry-crud.d.ts.map +1 -1
- package/dist/schemes/_entry-crud.js +8 -5
- package/dist/schemes/_entry-crud.js.map +1 -1
- package/dist/schemes/_entry-crud.sql +15 -15
- package/dist/schemes/_entry-find.d.ts +2 -1
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +31 -19
- package/dist/schemes/_entry-find.js.map +1 -1
- 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 +10 -8
- package/dist/schemes/_entry-manifest.js.map +1 -1
- package/dist/schemes/_entry-ops.d.ts.map +1 -1
- package/dist/schemes/_entry-ops.js +9 -7
- package/dist/schemes/_entry-ops.js.map +1 -1
- package/dist/schemes/_path-scope.d.ts.map +1 -1
- package/dist/schemes/_path-scope.js +12 -4
- package/dist/schemes/_path-scope.js.map +1 -1
- package/dist/schemes/_search-index.js +3 -3
- package/dist/schemes/_search-index.js.map +1 -1
- package/dist/schemes/exec-abort.js +2 -2
- package/dist/schemes/exec-abort.js.map +1 -1
- package/dist/schemes/exec-env.d.ts.map +1 -1
- package/dist/schemes/exec-env.js +7 -22
- package/dist/schemes/exec-env.js.map +1 -1
- package/dist/server/Daemon.d.ts +1 -0
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +45 -68
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/DrainSupervisor.d.ts +2 -3
- package/dist/server/DrainSupervisor.d.ts.map +1 -1
- package/dist/server/DrainSupervisor.js +34 -6
- package/dist/server/DrainSupervisor.js.map +1 -1
- package/dist/server/EnvFunctionality.d.ts +4 -2
- package/dist/server/EnvFunctionality.d.ts.map +1 -1
- package/dist/server/EnvFunctionality.js +23 -12
- package/dist/server/EnvFunctionality.js.map +1 -1
- package/dist/server/Functionality.d.ts.map +1 -1
- package/dist/server/Functionality.js +15 -8
- package/dist/server/Functionality.js.map +1 -1
- package/dist/server/FunctionalityManager.d.ts +1 -1
- package/dist/server/FunctionalityManager.d.ts.map +1 -1
- package/dist/server/FunctionalityManager.js +5 -1
- package/dist/server/FunctionalityManager.js.map +1 -1
- package/dist/server/MembersFunctionality.d.ts.map +1 -1
- package/dist/server/MembersFunctionality.js +12 -12
- package/dist/server/MembersFunctionality.js.map +1 -1
- package/dist/server/Retention.d.ts.map +1 -1
- package/dist/server/Retention.js +5 -5
- package/dist/server/Retention.js.map +1 -1
- package/dist/server/Retention.sql +49 -23
- package/dist/server/client-input.d.ts.map +1 -1
- package/dist/server/client-input.js +12 -3
- package/dist/server/client-input.js.map +1 -1
- package/dist/server/drain.sql +10 -9
- package/dist/server/lifecycle-recovery.sql +4 -1
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +9 -31
- package/dist/service.js.map +1 -1
- package/docs/copy-move.md +3 -0
- package/docs/env.md +32 -4
- package/docs/members.md +16 -1
- package/migrations/018_worker_owners.sql +1 -0
- package/migrations/019_interactive_owners.sql +1 -0
- package/migrations/020_log_projection.sql +1 -0
- package/migrations/021_packet_roles.sql +86 -0
- package/migrations/022_message_completion.sql +24 -0
- package/migrations/023_file_revisions.sql +54 -0
- package/migrations/024_proposal_decisions.sql +34 -0
- package/migrations/025_response_retention.sql +30 -0
- package/package.json +38 -34
- package/dist/schemes/_derivation-use.d.ts.map +0 -1
- package/dist/schemes/_derivation-use.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TurnRunner.d.ts","sourceRoot":"","sources":["../../src/core/TurnRunner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,gBAAgB,
|
|
1
|
+
{"version":3,"file":"TurnRunner.d.ts","sourceRoot":"","sources":["../../src/core/TurnRunner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,gBAAgB,EA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CAAC,GAAG,UAAU,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC,CAEnJ;CACJ"}
|
package/dist/core/TurnRunner.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import NativeContent from "./NativeContent.js";
|
|
3
|
-
import { PlurnkParser } from "@plurnk/plurnk-parser";
|
|
4
|
-
import { PathSyntax, PlurnkParseError,
|
|
3
|
+
import { PlurnkParser, parsePath } from "@plurnk/plurnk-parser";
|
|
4
|
+
import { PathSyntax, PlurnkParseError, UNKNOWN_POSITION } from "@plurnk/plurnk-contracts";
|
|
5
5
|
import WorkerOwners from "./WorkerOwners.js";
|
|
6
6
|
import { setTimeout as delay } from "node:timers/promises";
|
|
7
7
|
import { aggregateProviderAccounting } from "@plurnk/plurnk-providers";
|
|
@@ -12,20 +12,16 @@ import GitMembership from "./git-membership.js";
|
|
|
12
12
|
import { acceptedKinds } from "./attachments.js";
|
|
13
13
|
import GitState from "./git-state.js";
|
|
14
14
|
import WorkspaceSettings from "./workspace-settings.js";
|
|
15
|
-
import { contentWeight } from "./content-weight.js";
|
|
16
15
|
import { generatedPathname } from "./plurnk-uri.js";
|
|
16
|
+
import { contentWeight } from "./content-weight.js";
|
|
17
17
|
import { readFile } from "node:fs/promises";
|
|
18
18
|
import { resolve as resolvePath } from "node:path";
|
|
19
19
|
import { homedir } from "node:os";
|
|
20
|
-
// {§operator-grammar}
|
|
21
|
-
// relative to the daemon's working directory. The service ships no grammar profile, so a bare
|
|
22
|
-
// name (no separator) is refused by name rather than resolved against anything.
|
|
20
|
+
// {§operator-grammar}
|
|
23
21
|
export const resolveOperatorGrammarPath = (value) => {
|
|
24
22
|
if (value === "~" || value.startsWith("~/"))
|
|
25
23
|
return resolvePath(homedir(), value.slice(2));
|
|
26
|
-
|
|
27
|
-
return resolvePath(value);
|
|
28
|
-
throw new Error(`PLURNK_PROVIDERS_GBNF=${value} names a bundled grammar profile; the service ships none (#588). Give the path of a grammar file you wrote.`);
|
|
24
|
+
return resolvePath(value);
|
|
29
25
|
};
|
|
30
26
|
// Shared module imported by both Engine and the digest, so wire
|
|
31
27
|
// projection and digest projection are structurally one function — no
|
|
@@ -101,6 +97,25 @@ const windowOverflowFailure = (overflow) => Results.failure("engine:context", "w
|
|
|
101
97
|
// {§context-over-budget-row} — the row is the mandate; the gauge is the one home for the numbers
|
|
102
98
|
// ({§context-gauge}), which the row's own charge would otherwise put out of agreement.
|
|
103
99
|
const OVER_BUDGET_DETAIL = "Context exceeds budget. YOU MUST ONLY KILL, MOVE or NOTE this turn.";
|
|
100
|
+
// {§worker-initialization-entry} — the one NOTE that leads the initialization surveys, labelled as the
|
|
101
|
+
// card's own first NOTE example is.
|
|
102
|
+
const INITIALIZATION_NOTE = {
|
|
103
|
+
op: "NOTE", aside: "summary", metadata: null, target: null, lineMarker: null,
|
|
104
|
+
body: "Surveyed tooling, documentation, extended context, and project root.", position: UNKNOWN_POSITION,
|
|
105
|
+
};
|
|
106
|
+
// {§continued-without-note} — said once, in the next packet, of a continuing turn that carried no NOTE.
|
|
107
|
+
const CONTINUED_WITHOUT_NOTE = "The turn continued without a NOTE.";
|
|
108
|
+
// Trial (#1073): a continuing turn that carried NOTEs and no other operation is told so under the same
|
|
109
|
+
// per-turn rule; it is a notice, never a strike.
|
|
110
|
+
const NOTED_WITHOUT_OPERATION = "The turn carried NOTEs and no other operation.";
|
|
111
|
+
// {§notice-directive} — what each notice of the model's own output asks of it: MUST where the card says MUST
|
|
112
|
+
// or the output was refused, SHOULD where a near-miss was accepted.
|
|
113
|
+
const DIRECTIVE = Object.freeze({
|
|
114
|
+
note: "YOU MUST record at least one NOTE along with other operations.",
|
|
115
|
+
emission: "YOU MUST ONLY emit fenced operations; with the parameters, pattern, and terse aside on the fenced Operation line.",
|
|
116
|
+
advisory: "YOU SHOULD write the canonical form.",
|
|
117
|
+
output: "YOU SHOULD emit fewer or shorter operations per turn.",
|
|
118
|
+
});
|
|
104
119
|
const overBudgetFailure = () => Results.failure("engine:context", "packet-exceeds-budget", 413, OVER_BUDGET_DETAIL);
|
|
105
120
|
const INVALID_EMISSION_RECOVERY_MESSAGE = "Response rejected before dispatch; no operations were performed.";
|
|
106
121
|
// {§output-allowance-notice} — THE single derivation of a ceiling cut: a
|
|
@@ -109,7 +124,7 @@ const INVALID_EMISSION_RECOVERY_MESSAGE = "Response rejected before dispatch; no
|
|
|
109
124
|
// path. Null means the emission was not cut by the allowance.
|
|
110
125
|
const allowanceCutMessage = (finishReason, grant) => finishReason !== "length"
|
|
111
126
|
? null
|
|
112
|
-
: `
|
|
127
|
+
: `Emission truncated at the output allowance${grant === null ? "" : ` (${grant} tokens)`}`;
|
|
113
128
|
const readEmissionAttempts = () => Knob.integer("PLURNK_SERVICE_EMISSION_ATTEMPTS", 1);
|
|
114
129
|
// The wall's abort reason — runLoop branches a mid-turn teardown to the 504 terminal on it.
|
|
115
130
|
export const LOOP_TIMEOUT_REASON = "loop_timeout";
|
|
@@ -488,9 +503,14 @@ class TurnRunner {
|
|
|
488
503
|
await Turn.complete(this.#db, initializationTurn.id, 200);
|
|
489
504
|
return;
|
|
490
505
|
}
|
|
491
|
-
|
|
506
|
+
// {§worker-initialization-entry} — the example turn keeps the NOTE contract the card teaches:
|
|
507
|
+
// when the surveys run, one NOTE leads them.
|
|
508
|
+
const programStatements = admittedInitializationStatements.some((statement) => statement.op === "FIND")
|
|
509
|
+
? [INITIALIZATION_NOTE, ...admittedInitializationStatements]
|
|
510
|
+
: admittedInitializationStatements;
|
|
511
|
+
const program = TurnOps.renderInternal(programStatements);
|
|
492
512
|
const admitted = PlurnkParser.parseStatements(program).items.flatMap((item) => item.kind === "statement" ? [item.statement] : []);
|
|
493
|
-
if (admitted.length !==
|
|
513
|
+
if (admitted.length !== programStatements.length) {
|
|
494
514
|
throw new Error("initialization program did not preserve every authored operation");
|
|
495
515
|
}
|
|
496
516
|
await Turn.recordSource(this.#db, initializationTurn.id, "ops", program);
|
|
@@ -505,7 +525,7 @@ class TurnRunner {
|
|
|
505
525
|
turnId: initializationTurn.id,
|
|
506
526
|
fromSequence: 1,
|
|
507
527
|
failOnOperationError: true,
|
|
508
|
-
fit: this.#fitFor(args, { turnId: initializationTurn.id, seq: initializationTurn.sequence, gitStatus, notices: [], transientOpenLogEntryId: container.transientOpenLogEntryId, projection: { bodiless: new Set(),
|
|
528
|
+
fit: this.#fitFor(args, { turnId: initializationTurn.id, seq: initializationTurn.sequence, gitStatus, notices: [], transientOpenLogEntryId: container.transientOpenLogEntryId, projection: { bodiless: new Set(), omitEmissionHistory: false } }),
|
|
509
529
|
signal: this.#loopSignal(loopId),
|
|
510
530
|
onDispatch,
|
|
511
531
|
onSettled,
|
|
@@ -517,11 +537,18 @@ class TurnRunner {
|
|
|
517
537
|
// {§actor-boundary-catalog-preview} — the opening surveys, each admitted only when
|
|
518
538
|
// its scheme is registered for the workspace. A positive filesItems caps the
|
|
519
539
|
// project rows.
|
|
520
|
-
async #catalogSurveys({ workspaceId }, { workerName, initializationPolicies }, filesItems) {
|
|
540
|
+
async #catalogSurveys({ workspaceId }, { workerName, initializationPolicies, loopSequence }, filesItems) {
|
|
521
541
|
const catalogSchemes = await this.#db.engine_scheme_catalog_summary.all({ workspace_id: workspaceId });
|
|
522
542
|
const fileItems = catalogSchemes.find(({ scheme }) => scheme === "file")?.shallow_items ?? 0;
|
|
523
543
|
const fileCap = filesItems > 0 && fileItems > 0 ? Math.min(filesItems, fileItems) : null;
|
|
524
544
|
const surveys = [
|
|
545
|
+
{
|
|
546
|
+
// Trial (#1073): the survey reads its own program, so the log carries one program verbatim
|
|
547
|
+
// and shows that every ops:// turn is readable.
|
|
548
|
+
op: "READ", aside: "this program",
|
|
549
|
+
target: { kind: "url", raw: `ops://${workerName}/${loopSequence}/1`, scheme: "ops", username: null, password: null, hostname: workerName, port: null, pathname: `/${loopSequence}/1`, query: null, fragment: null },
|
|
550
|
+
metadata: null, lineMarker: null, matcher: null, body: null, position: UNKNOWN_POSITION,
|
|
551
|
+
},
|
|
525
552
|
{
|
|
526
553
|
op: "FIND", aside: null,
|
|
527
554
|
target: { kind: "url", raw: "skill://*/SKILL.md", scheme: "skill", username: null, password: null, hostname: "*", port: null, pathname: "/SKILL.md", query: null, fragment: null },
|
|
@@ -631,7 +658,7 @@ class TurnRunner {
|
|
|
631
658
|
const systemCtx = this.#schemeContext(args, turnId);
|
|
632
659
|
// {§context-fit} — one measure for everything this turn lands: the budget less the packet as it
|
|
633
660
|
// would render now. The drained notices join the same facts below.
|
|
634
|
-
const facts = { turnId, seq, gitStatus, notices: [], transientOpenLogEntryId: container.transientOpenLogEntryId, projection: { bodiless: new Set(),
|
|
661
|
+
const facts = { turnId, seq, gitStatus, notices: [], transientOpenLogEntryId: container.transientOpenLogEntryId, projection: { bodiless: new Set(), omitEmissionHistory: false } };
|
|
635
662
|
const fit = this.#fitFor(args, facts);
|
|
636
663
|
const messages = await this.#publishMessages(args, turnId, fit);
|
|
637
664
|
let nextActionIndex = await this.#readOpenPaths(args, turnId, messages.openPaths, messages.nextActionIndex, fit);
|
|
@@ -692,20 +719,20 @@ class TurnRunner {
|
|
|
692
719
|
}
|
|
693
720
|
return { nextActionIndex, openPaths };
|
|
694
721
|
}
|
|
695
|
-
// {§methods-loop-run-open-paths}: selected
|
|
722
|
+
// {§methods-loop-run-open-paths}: selected resources belong to the message.
|
|
696
723
|
// Publish it, then dispatch ordinary core READs in that same turn;
|
|
697
724
|
// missing/non-member paths retain their normal 4xx. Returns the next action index.
|
|
698
725
|
async #readOpenPaths({ workspaceId, workerId, loopId, onDispatch, onSettled }, turnId, openPaths, fromSequence, fit) {
|
|
699
726
|
let nextActionIndex = fromSequence;
|
|
700
727
|
for (const [index, raw] of openPaths.entries()) {
|
|
701
|
-
const
|
|
728
|
+
const resourceRead = {
|
|
702
729
|
op: "READ", aside: null, lineMarker: null, matcher: null,
|
|
703
|
-
target:
|
|
730
|
+
target: parsePath(PathSyntax.escapeTarget(raw)),
|
|
704
731
|
metadata: null,
|
|
705
732
|
body: null, position: UNKNOWN_POSITION,
|
|
706
733
|
};
|
|
707
734
|
await this.#dispatch({
|
|
708
|
-
statement:
|
|
735
|
+
statement: resourceRead, workspaceId, workerId, loopId, turnId,
|
|
709
736
|
sequence: nextActionIndex, origin: "_plurnk", onDispatch, onSettled,
|
|
710
737
|
fit: reserved(fit, openPaths.length - index - 1),
|
|
711
738
|
});
|
|
@@ -728,12 +755,12 @@ class TurnRunner {
|
|
|
728
755
|
transientOpenLogEntryId: facts.transientOpenLogEntryId,
|
|
729
756
|
turnId: facts.turnId,
|
|
730
757
|
bodiless: facts.projection.bodiless,
|
|
731
|
-
|
|
758
|
+
omitEmissionHistory: facts.projection.omitEmissionHistory,
|
|
732
759
|
});
|
|
733
|
-
// {§
|
|
760
|
+
// {§emission-history}: all builds, including result-admission probes, shed the optional
|
|
734
761
|
// replay before taking result bodies. Share the decision across this request's rebuilds.
|
|
735
|
-
if (PacketWire.sectionContent(packet, "
|
|
736
|
-
facts.projection.
|
|
762
|
+
if (PacketWire.sectionContent(packet, "emission-history").length > 0 && this.#packets.windowOverflow(packet, provider) !== null) {
|
|
763
|
+
facts.projection.omitEmissionHistory = true;
|
|
737
764
|
return this.#buildPacket(args, facts);
|
|
738
765
|
}
|
|
739
766
|
return packet;
|
|
@@ -750,7 +777,8 @@ class TurnRunner {
|
|
|
750
777
|
};
|
|
751
778
|
}
|
|
752
779
|
// {§context-over-budget-row} — one `_plurnk` error row at the head of the turn's own rows, then the
|
|
753
|
-
// packet as it renders with it
|
|
780
|
+
// packet as it renders with it. The row is shown in this packet alone and retired from later ones
|
|
781
|
+
// by the packet query (#1097); a later packet that is over mints its own.
|
|
754
782
|
async #noteOverBudget(args, request) {
|
|
755
783
|
const { workerId, loopId, onDispatch, onSettled } = args;
|
|
756
784
|
const minted = await this.#problems.record({
|
|
@@ -796,12 +824,12 @@ class TurnRunner {
|
|
|
796
824
|
}
|
|
797
825
|
}
|
|
798
826
|
// {§context-own-rows-fit} — one shedding step for whichever measure found the request over the wall: the
|
|
799
|
-
// previous program goes whole first ({§
|
|
827
|
+
// previous program goes whole first ({§emission-history}), then the newest rows still carrying a body,
|
|
800
828
|
// enough of them by their rendered tokens to shed the excess; every body stays stored. Null when nothing
|
|
801
829
|
// is left to take.
|
|
802
830
|
async #shed(args, request, overflow) {
|
|
803
|
-
if (!request.projection.
|
|
804
|
-
request.projection.
|
|
831
|
+
if (!request.projection.omitEmissionHistory && PacketWire.sectionContent(request.packet, "emission-history").length > 0) {
|
|
832
|
+
request.projection.omitEmissionHistory = true;
|
|
805
833
|
}
|
|
806
834
|
else {
|
|
807
835
|
let shed = 0;
|
|
@@ -1260,7 +1288,8 @@ class TurnRunner {
|
|
|
1260
1288
|
source: "engine:capacity",
|
|
1261
1289
|
kind: "output_truncated",
|
|
1262
1290
|
level: "error",
|
|
1263
|
-
|
|
1291
|
+
directive: DIRECTIVE.output,
|
|
1292
|
+
message: `${cut}; no operations were performed.`,
|
|
1264
1293
|
});
|
|
1265
1294
|
}
|
|
1266
1295
|
else {
|
|
@@ -1268,6 +1297,7 @@ class TurnRunner {
|
|
|
1268
1297
|
source: "engine:grammar",
|
|
1269
1298
|
kind: "invalid_emission",
|
|
1270
1299
|
level: "error",
|
|
1300
|
+
directive: DIRECTIVE.emission,
|
|
1271
1301
|
message: diagnostic === undefined
|
|
1272
1302
|
? INVALID_EMISSION_RECOVERY_MESSAGE
|
|
1273
1303
|
: `${INVALID_EMISSION_RECOVERY_MESSAGE} Parser: ${diagnostic.message}`,
|
|
@@ -1303,7 +1333,8 @@ class TurnRunner {
|
|
|
1303
1333
|
source: "engine:turn",
|
|
1304
1334
|
kind: "output_truncated",
|
|
1305
1335
|
level: "warn",
|
|
1306
|
-
|
|
1336
|
+
directive: DIRECTIVE.output,
|
|
1337
|
+
message: `${allowanceCut}; no authored operations were performed.`,
|
|
1307
1338
|
});
|
|
1308
1339
|
}
|
|
1309
1340
|
// Non-fatal provider transport notices on an accepted turn. Forward each
|
|
@@ -1317,6 +1348,7 @@ class TurnRunner {
|
|
|
1317
1348
|
this.#notices.push(workspaceId, workerId, loopId, {
|
|
1318
1349
|
source: notice.source,
|
|
1319
1350
|
kind: notice.kind,
|
|
1351
|
+
...(notice.directive === undefined ? {} : { directive: notice.directive }),
|
|
1320
1352
|
message: notice.message ?? "",
|
|
1321
1353
|
level: notice.level,
|
|
1322
1354
|
...(located !== null
|
|
@@ -1328,27 +1360,19 @@ class TurnRunner {
|
|
|
1328
1360
|
this.#notices.push(workspaceId, workerId, loopId, {
|
|
1329
1361
|
source: "engine:capacity",
|
|
1330
1362
|
kind: "output_truncated",
|
|
1331
|
-
|
|
1363
|
+
directive: DIRECTIVE.output,
|
|
1364
|
+
message: `${allowanceCut}.`,
|
|
1332
1365
|
level: "warn",
|
|
1333
1366
|
});
|
|
1334
1367
|
}
|
|
1335
|
-
// {§outside-text} —
|
|
1336
|
-
//
|
|
1368
|
+
// {§outside-text} — a turn that fenced no operation keeps its text as its outside source: the
|
|
1369
|
+
// evidence behind the empty turn's strike and a terminal's citation; no row, notice or NOTE.
|
|
1337
1370
|
if (split.outside !== null) {
|
|
1338
|
-
await Turn.recordSource(this.#db, request.turnId, "outside", split.outside
|
|
1339
|
-
this.#notices.push(workspaceId, workerId, loopId, {
|
|
1340
|
-
source: "engine:turn",
|
|
1341
|
-
kind: "outside_text",
|
|
1342
|
-
level: "warn",
|
|
1343
|
-
message: `${split.outside.tokens} tokens emitted outside OPs. Discarded.`,
|
|
1344
|
-
});
|
|
1371
|
+
await Turn.recordSource(this.#db, request.turnId, "outside", split.outside, { modelCallId: emission.modelCallId });
|
|
1345
1372
|
this.#notify.outsideEventNotify?.(workspaceId, {
|
|
1346
|
-
workerId,
|
|
1347
|
-
loopId,
|
|
1348
|
-
turnId: request.turnId,
|
|
1373
|
+
workerId, loopId, turnId: request.turnId,
|
|
1349
1374
|
coordinate: `${request.workerName}-${request.loopSeq}-${request.seq}`,
|
|
1350
|
-
text: split.outside.
|
|
1351
|
-
tokens: split.outside.tokens,
|
|
1375
|
+
text: split.outside, tokens: contentWeight(split.outside),
|
|
1352
1376
|
});
|
|
1353
1377
|
}
|
|
1354
1378
|
// {§operator-grammar} — transport evidence only: the turn records whether the operator's
|
|
@@ -1404,7 +1428,7 @@ class TurnRunner {
|
|
|
1404
1428
|
fit: request.fit,
|
|
1405
1429
|
recoverableParseErrors: split.recoverableParseErrors,
|
|
1406
1430
|
emptyTurn: split.emptyTurn,
|
|
1407
|
-
|
|
1431
|
+
completionAllowed: split.completionAllowed,
|
|
1408
1432
|
bare: {
|
|
1409
1433
|
provider: childProvider,
|
|
1410
1434
|
loopSequence: request.loopSeq,
|
|
@@ -1415,6 +1439,22 @@ class TurnRunner {
|
|
|
1415
1439
|
onDispatch,
|
|
1416
1440
|
onSettled,
|
|
1417
1441
|
});
|
|
1442
|
+
// {§continued-without-note} — a turn the loop continues past or parks on, having carried no NOTE
|
|
1443
|
+
// forward in its program or from its reasoning, is told so in the next packet. An empty turn has
|
|
1444
|
+
// its own no-operation row instead.
|
|
1445
|
+
const ops = split.packetAssistant.ops;
|
|
1446
|
+
if ((executed.status === 102 || executed.status === 202) && ops.length > 0
|
|
1447
|
+
&& !ops.some((statement) => "op" in statement && statement.op === "NOTE")) {
|
|
1448
|
+
this.#notices.push(workspaceId, workerId, loopId, {
|
|
1449
|
+
source: "engine:turn", kind: "continued_without_note", level: "warn", directive: DIRECTIVE.note, message: CONTINUED_WITHOUT_NOTE,
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
const annotationOnly = ops.length > 0 && ops.every((statement) => "op" in statement && statement.op === "NOTE");
|
|
1453
|
+
if ((executed.status === 102 || executed.status === 202) && annotationOnly) {
|
|
1454
|
+
this.#notices.push(workspaceId, workerId, loopId, {
|
|
1455
|
+
source: "engine:turn", kind: "noted_without_operation", level: "warn", directive: DIRECTIVE.note, message: NOTED_WITHOUT_OPERATION,
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1418
1458
|
return turnResult(request, executed.status, {
|
|
1419
1459
|
outcomes: executed.outcomes,
|
|
1420
1460
|
progressed: executed.progressed,
|
|
@@ -1477,10 +1517,9 @@ class TurnRunner {
|
|
|
1477
1517
|
const parseErrors = [];
|
|
1478
1518
|
let contentStatementCount = 0;
|
|
1479
1519
|
let hasUnparsedTail = false;
|
|
1520
|
+
let operationOmitted = false;
|
|
1480
1521
|
const parseNotices = [];
|
|
1481
1522
|
const fabrications = [];
|
|
1482
|
-
// {§outside-text}: every span outside an operation, verbatim and in source order; never an
|
|
1483
|
-
// operation of its own, so a repetitive or length-cut response stays one source.
|
|
1484
1523
|
const outside = [];
|
|
1485
1524
|
if (preParsedOps !== undefined) {
|
|
1486
1525
|
ops.push(...preParsedOps);
|
|
@@ -1496,13 +1535,33 @@ class TurnRunner {
|
|
|
1496
1535
|
span.setAttribute("statements", result.items.filter((item) => item.kind === "statement").length);
|
|
1497
1536
|
return result;
|
|
1498
1537
|
});
|
|
1538
|
+
// {§outside-text}: beside a fenced operation, the text between two operations is one NOTE at its
|
|
1539
|
+
// position, annotation the model wrote without its fence; a turn that fenced no operation keeps
|
|
1540
|
+
// its text as its outside source and stays an empty turn ({§empty-turn}). Echoed emission
|
|
1541
|
+
// headings are announcements, not annotation, and are dropped ({§fabricated-log-entry}).
|
|
1542
|
+
const fenced = parsed.items.filter((item) => item.kind === "statement").length;
|
|
1543
|
+
let span = null;
|
|
1544
|
+
const flushSpan = () => {
|
|
1545
|
+
if (span === null)
|
|
1546
|
+
return;
|
|
1547
|
+
const body = span.body.join("\n\n");
|
|
1548
|
+
if (body.length > 0) {
|
|
1549
|
+
if (fenced > 0) {
|
|
1550
|
+
ops.push({ op: "NOTE", aside: null, metadata: null, target: null, lineMarker: null, body, position: span.position });
|
|
1551
|
+
contentStatementCount += 1;
|
|
1552
|
+
}
|
|
1553
|
+
else
|
|
1554
|
+
outside.push(body);
|
|
1555
|
+
}
|
|
1556
|
+
span = null;
|
|
1557
|
+
};
|
|
1499
1558
|
for (const item of parsed.items) {
|
|
1559
|
+
if (item.kind !== "text")
|
|
1560
|
+
flushSpan();
|
|
1500
1561
|
if (item.kind === "statement") {
|
|
1501
1562
|
ops.push(item.statement);
|
|
1502
1563
|
contentStatementCount += 1;
|
|
1503
1564
|
}
|
|
1504
|
-
// Operation boundaries stay the parser's responsibility; what falls outside them is
|
|
1505
|
-
// stored as the turn's outside source and counted as nothing.
|
|
1506
1565
|
else if (item.kind === "text") {
|
|
1507
1566
|
// {§fabricated-log-entry}: a log-entry heading in outside text rejects the attempt.
|
|
1508
1567
|
const fabricated = FabricatedLog.find(item.content);
|
|
@@ -1510,16 +1569,22 @@ class TurnRunner {
|
|
|
1510
1569
|
fabrications.push({ message: FabricatedLog.message(fabricated.heading), line: item.position.line + fabricated.line, column: 1, source: "harness" });
|
|
1511
1570
|
continue;
|
|
1512
1571
|
}
|
|
1513
|
-
|
|
1572
|
+
const body = FabricatedLog.stripEchoes(item.content);
|
|
1573
|
+
if (body.length === 0)
|
|
1574
|
+
continue;
|
|
1575
|
+
span ??= { body: [], position: item.position };
|
|
1576
|
+
span.body.push(body);
|
|
1514
1577
|
}
|
|
1515
1578
|
else if (item.kind === "error") {
|
|
1516
1579
|
const err = item.error;
|
|
1517
1580
|
if (err instanceof PlurnkParseError) {
|
|
1581
|
+
operationOmitted ||= err.operationOmitted;
|
|
1518
1582
|
if (err.severity === "warning") {
|
|
1519
1583
|
parseNotices.push({
|
|
1520
1584
|
source: "grammar",
|
|
1521
1585
|
kind: "parse_advisory",
|
|
1522
1586
|
level: "warn",
|
|
1587
|
+
directive: DIRECTIVE.advisory,
|
|
1523
1588
|
message: err.message,
|
|
1524
1589
|
position: {
|
|
1525
1590
|
type: "content-offset",
|
|
@@ -1539,6 +1604,7 @@ class TurnRunner {
|
|
|
1539
1604
|
}
|
|
1540
1605
|
}
|
|
1541
1606
|
}
|
|
1607
|
+
flushSpan();
|
|
1542
1608
|
// {§unparsed-tail-boundary} — the lexer's one boundary fact: from `unparsedTail.from` on,
|
|
1543
1609
|
// nothing was read. The statements that closed before it are ordinary facts and run; the
|
|
1544
1610
|
// loss itself is one more hard diagnostic, a failed row the model sees. An emission that
|
|
@@ -1555,6 +1621,7 @@ class TurnRunner {
|
|
|
1555
1621
|
source: "grammar:reasoning",
|
|
1556
1622
|
kind: "parse_advisory",
|
|
1557
1623
|
level: "warn",
|
|
1624
|
+
directive: DIRECTIVE.advisory,
|
|
1558
1625
|
message: warning.message,
|
|
1559
1626
|
parserSource: warning.source,
|
|
1560
1627
|
});
|
|
@@ -1571,9 +1638,9 @@ class TurnRunner {
|
|
|
1571
1638
|
parseErrors.unshift(...fabrications.slice(0, 1));
|
|
1572
1639
|
const emissionStatements = preParsedOps === undefined && contentStatementCount > 0 ? [...ops] : null;
|
|
1573
1640
|
ops.unshift(...reasoningOps);
|
|
1574
|
-
const
|
|
1575
|
-
&&
|
|
1576
|
-
&& assistant.finishReason
|
|
1641
|
+
const completionAllowed = !hasUnparsedTail && !operationOmitted && !assistant.nativeToolCalls
|
|
1642
|
+
&& parseErrors.every((error) => error.message === PlurnkParser.NO_VALID_OPERATION)
|
|
1643
|
+
&& !["length", "content_filter", "tool_calls"].includes(assistant.finishReason ?? "");
|
|
1577
1644
|
const emptyTurn = preParsedOps === undefined && operationCount === 0 && !hasUnparsedTail;
|
|
1578
1645
|
// {§unparsed-tail-boundary}: outside text is not operational work.
|
|
1579
1646
|
const emissionValid = fabrications.length === 0 && (preParsedOps !== undefined
|
|
@@ -1582,7 +1649,6 @@ class TurnRunner {
|
|
|
1582
1649
|
const recoverableParseErrors = parseErrors
|
|
1583
1650
|
.filter((error) => error.message !== PlurnkParser.NO_VALID_OPERATION)
|
|
1584
1651
|
.toSorted(comparePosition);
|
|
1585
|
-
const outsideText = outside.join("\n\n");
|
|
1586
1652
|
return {
|
|
1587
1653
|
packetAssistant: { content: assistant.content, ops, reasoning },
|
|
1588
1654
|
sourceBacked: preParsedOps === undefined,
|
|
@@ -1590,10 +1656,10 @@ class TurnRunner {
|
|
|
1590
1656
|
parseErrors,
|
|
1591
1657
|
recoverableParseErrors: emissionValid ? recoverableParseErrors : [],
|
|
1592
1658
|
emptyTurn,
|
|
1593
|
-
|
|
1659
|
+
completionAllowed,
|
|
1594
1660
|
parseNotices,
|
|
1595
1661
|
emissionValid,
|
|
1596
|
-
outside: outside.length === 0 ? null :
|
|
1662
|
+
outside: outside.length === 0 ? null : outside.join("\n\n"),
|
|
1597
1663
|
emissionStatements,
|
|
1598
1664
|
};
|
|
1599
1665
|
}
|