@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.
Files changed (280) hide show
  1. package/.env.defaults +38 -21
  2. package/INSTALL.md +38 -1
  3. package/README.md +3 -0
  4. package/SPEC.md +681 -268
  5. package/dist/build-info.json +1 -1
  6. package/dist/completions/_plurnk-service +13 -0
  7. package/dist/completions/plurnk-service.bash +19 -0
  8. package/dist/completions/plurnk-service.fish +94 -0
  9. package/dist/content/path-mimetype.d.ts.map +1 -1
  10. package/dist/content/path-mimetype.js +2 -8
  11. package/dist/content/path-mimetype.js.map +1 -1
  12. package/dist/core/AdmittedTurnExecutor.d.ts +2 -2
  13. package/dist/core/AdmittedTurnExecutor.d.ts.map +1 -1
  14. package/dist/core/AdmittedTurnExecutor.js +36 -32
  15. package/dist/core/AdmittedTurnExecutor.js.map +1 -1
  16. package/dist/core/BudgetReadout.d.ts +7 -2
  17. package/dist/core/BudgetReadout.d.ts.map +1 -1
  18. package/dist/core/BudgetReadout.js +36 -5
  19. package/dist/core/BudgetReadout.js.map +1 -1
  20. package/dist/{schemes/_derivation-use.d.ts → core/ContentUse.d.ts} +3 -3
  21. package/dist/core/ContentUse.d.ts.map +1 -0
  22. package/dist/{schemes/_derivation-use.js → core/ContentUse.js} +8 -7
  23. package/dist/core/ContentUse.js.map +1 -0
  24. package/dist/core/DataStatementRunner.d.ts.map +1 -1
  25. package/dist/core/DataStatementRunner.js +8 -20
  26. package/dist/core/DataStatementRunner.js.map +1 -1
  27. package/dist/core/Dispatcher.d.ts +11 -3
  28. package/dist/core/Dispatcher.d.ts.map +1 -1
  29. package/dist/core/Dispatcher.js +186 -109
  30. package/dist/core/Dispatcher.js.map +1 -1
  31. package/dist/core/EditMutations.js +1 -1
  32. package/dist/core/EditMutations.js.map +1 -1
  33. package/dist/core/Engine.d.ts +1 -1
  34. package/dist/core/Engine.d.ts.map +1 -1
  35. package/dist/core/Engine.js +4 -7
  36. package/dist/core/Engine.js.map +1 -1
  37. package/dist/core/EnvFlags.js +1 -1
  38. package/dist/core/EnvFlags.js.map +1 -1
  39. package/dist/core/FabricatedLog.d.ts +1 -0
  40. package/dist/core/FabricatedLog.d.ts.map +1 -1
  41. package/dist/core/FabricatedLog.js +8 -0
  42. package/dist/core/FabricatedLog.js.map +1 -1
  43. package/dist/core/FileAddress.d.ts +12 -0
  44. package/dist/core/FileAddress.d.ts.map +1 -0
  45. package/dist/core/FileAddress.js +73 -0
  46. package/dist/core/FileAddress.js.map +1 -0
  47. package/dist/core/FilePublication.d.ts +15 -0
  48. package/dist/core/FilePublication.d.ts.map +1 -0
  49. package/dist/core/FilePublication.js +143 -0
  50. package/dist/core/FilePublication.js.map +1 -0
  51. package/dist/core/FileSnapshot.d.ts +26 -0
  52. package/dist/core/FileSnapshot.d.ts.map +1 -0
  53. package/dist/core/FileSnapshot.js +179 -0
  54. package/dist/core/FileSnapshot.js.map +1 -0
  55. package/dist/core/KillHandler.d.ts.map +1 -1
  56. package/dist/core/KillHandler.js +4 -1
  57. package/dist/core/KillHandler.js.map +1 -1
  58. package/dist/core/LiveSubscription.d.ts.map +1 -1
  59. package/dist/core/LiveSubscription.js +14 -2
  60. package/dist/core/LiveSubscription.js.map +1 -1
  61. package/dist/core/LiveSubscriptions.d.ts +3 -1
  62. package/dist/core/LiveSubscriptions.d.ts.map +1 -1
  63. package/dist/core/LiveSubscriptions.js +16 -1
  64. package/dist/core/LiveSubscriptions.js.map +1 -1
  65. package/dist/core/LogBody.d.ts.map +1 -1
  66. package/dist/core/LogBody.js +3 -1
  67. package/dist/core/LogBody.js.map +1 -1
  68. package/dist/core/LoopDriver.d.ts.map +1 -1
  69. package/dist/core/LoopDriver.js +3 -0
  70. package/dist/core/LoopDriver.js.map +1 -1
  71. package/dist/core/LoopLifecycle.sql +1 -0
  72. package/dist/core/MembershipMaterialization.d.ts.map +1 -1
  73. package/dist/core/MembershipMaterialization.js +87 -143
  74. package/dist/core/MembershipMaterialization.js.map +1 -1
  75. package/dist/core/MessageResources.sql +31 -0
  76. package/dist/core/MutationEffects.d.ts +2 -1
  77. package/dist/core/MutationEffects.d.ts.map +1 -1
  78. package/dist/core/MutationEffects.js +14 -1
  79. package/dist/core/MutationEffects.js.map +1 -1
  80. package/dist/core/PacketBuilder.d.ts +2 -2
  81. package/dist/core/PacketBuilder.d.ts.map +1 -1
  82. package/dist/core/PacketBuilder.js +123 -51
  83. package/dist/core/PacketBuilder.js.map +1 -1
  84. package/dist/core/PacketBuilder.sql +21 -14
  85. package/dist/core/PathGlob.d.ts +6 -0
  86. package/dist/core/PathGlob.d.ts.map +1 -0
  87. package/dist/core/PathGlob.js +24 -0
  88. package/dist/core/PathGlob.js.map +1 -0
  89. package/dist/core/ProposalLifecycle.d.ts +2 -1
  90. package/dist/core/ProposalLifecycle.d.ts.map +1 -1
  91. package/dist/core/ProposalLifecycle.js +45 -33
  92. package/dist/core/ProposalLifecycle.js.map +1 -1
  93. package/dist/core/ProposalLifecycle.sql +4 -0
  94. package/dist/core/ReplyMetadata.d.ts +10 -0
  95. package/dist/core/ReplyMetadata.d.ts.map +1 -0
  96. package/dist/core/ReplyMetadata.js +20 -0
  97. package/dist/core/ReplyMetadata.js.map +1 -0
  98. package/dist/core/ResourceBindings.d.ts.map +1 -1
  99. package/dist/core/ResourceBindings.js +4 -3
  100. package/dist/core/ResourceBindings.js.map +1 -1
  101. package/dist/core/ResourceSelector.d.ts +1 -2
  102. package/dist/core/ResourceSelector.d.ts.map +1 -1
  103. package/dist/core/ResourceSelector.js +30 -9
  104. package/dist/core/ResourceSelector.js.map +1 -1
  105. package/dist/core/ResourceTransfers.d.ts +1 -1
  106. package/dist/core/ResourceTransfers.d.ts.map +1 -1
  107. package/dist/core/ResourceTransfers.js +26 -11
  108. package/dist/core/ResourceTransfers.js.map +1 -1
  109. package/dist/core/ServiceHelp.d.ts +6 -0
  110. package/dist/core/ServiceHelp.d.ts.map +1 -0
  111. package/dist/core/ServiceHelp.js +35 -0
  112. package/dist/core/ServiceHelp.js.map +1 -0
  113. package/dist/core/StoredPacket.d.ts +1 -0
  114. package/dist/core/StoredPacket.d.ts.map +1 -1
  115. package/dist/core/StoredPacket.js +4 -1
  116. package/dist/core/StoredPacket.js.map +1 -1
  117. package/dist/core/StrikeRail.d.ts.map +1 -1
  118. package/dist/core/StrikeRail.js +2 -2
  119. package/dist/core/StrikeRail.js.map +1 -1
  120. package/dist/core/TokenCalibration.d.ts +2 -2
  121. package/dist/core/TokenCalibration.d.ts.map +1 -1
  122. package/dist/core/TokenCalibration.js +12 -16
  123. package/dist/core/TokenCalibration.js.map +1 -1
  124. package/dist/core/TokenCalibration.sql +29 -6
  125. package/dist/core/TurnDispositionHandler.d.ts +1 -2
  126. package/dist/core/TurnDispositionHandler.d.ts.map +1 -1
  127. package/dist/core/TurnDispositionHandler.js +30 -26
  128. package/dist/core/TurnDispositionHandler.js.map +1 -1
  129. package/dist/core/TurnMaterialization.d.ts.map +1 -1
  130. package/dist/core/TurnMaterialization.js +11 -1
  131. package/dist/core/TurnMaterialization.js.map +1 -1
  132. package/dist/core/TurnOps.d.ts +5 -1
  133. package/dist/core/TurnOps.d.ts.map +1 -1
  134. package/dist/core/TurnOps.js +29 -2
  135. package/dist/core/TurnOps.js.map +1 -1
  136. package/dist/core/TurnRunner.d.ts.map +1 -1
  137. package/dist/core/TurnRunner.js +122 -56
  138. package/dist/core/TurnRunner.js.map +1 -1
  139. package/dist/core/TurnSources.sql +2 -2
  140. package/dist/core/caps/SchemeCtxImpl.d.ts +1 -0
  141. package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -1
  142. package/dist/core/caps/SchemeCtxImpl.js +5 -0
  143. package/dist/core/caps/SchemeCtxImpl.js.map +1 -1
  144. package/dist/core/git-membership.d.ts +1 -0
  145. package/dist/core/git-membership.d.ts.map +1 -1
  146. package/dist/core/git-membership.js +9 -11
  147. package/dist/core/git-membership.js.map +1 -1
  148. package/dist/core/glob_match.js +3 -3
  149. package/dist/core/glob_match.js.map +1 -1
  150. package/dist/core/mutation-types.d.ts +3 -0
  151. package/dist/core/mutation-types.d.ts.map +1 -1
  152. package/dist/core/namespace.d.ts +4 -1
  153. package/dist/core/namespace.d.ts.map +1 -1
  154. package/dist/core/namespace.js +14 -3
  155. package/dist/core/namespace.js.map +1 -1
  156. package/dist/core/packet-wire.d.ts +7 -1
  157. package/dist/core/packet-wire.d.ts.map +1 -1
  158. package/dist/core/packet-wire.js +98 -36
  159. package/dist/core/packet-wire.js.map +1 -1
  160. package/dist/core/plurnk-uri.d.ts +3 -2
  161. package/dist/core/plurnk-uri.d.ts.map +1 -1
  162. package/dist/core/plurnk-uri.js +23 -11
  163. package/dist/core/plurnk-uri.js.map +1 -1
  164. package/dist/core/recap-lines.d.ts +4 -0
  165. package/dist/core/recap-lines.d.ts.map +1 -0
  166. package/dist/core/recap-lines.js +11 -0
  167. package/dist/core/recap-lines.js.map +1 -0
  168. package/dist/core/scheme-types.d.ts +1 -0
  169. package/dist/core/scheme-types.d.ts.map +1 -1
  170. package/dist/core/sql-functions.d.ts +2 -0
  171. package/dist/core/sql-functions.d.ts.map +1 -0
  172. package/dist/core/sql-functions.js +5 -0
  173. package/dist/core/sql-functions.js.map +1 -0
  174. package/dist/core/sqlite-synchronous.d.ts +2 -0
  175. package/dist/core/sqlite-synchronous.d.ts.map +1 -0
  176. package/dist/core/sqlite-synchronous.js +4 -0
  177. package/dist/core/sqlite-synchronous.js.map +1 -0
  178. package/dist/core/turn-scheduler.d.ts.map +1 -1
  179. package/dist/core/turn-scheduler.js +1 -1
  180. package/dist/core/turn-scheduler.js.map +1 -1
  181. package/dist/evidence/EvidenceReader.d.ts.map +1 -1
  182. package/dist/evidence/EvidenceReader.js +23 -3
  183. package/dist/evidence/EvidenceReader.js.map +1 -1
  184. package/dist/evidence/digest.sql +7 -1
  185. package/dist/man/plurnk-service.1 +499 -0
  186. package/dist/schemes/Env.d.ts +26 -0
  187. package/dist/schemes/Env.d.ts.map +1 -0
  188. package/dist/schemes/Env.js +133 -0
  189. package/dist/schemes/Env.js.map +1 -0
  190. package/dist/schemes/Exec.d.ts.map +1 -1
  191. package/dist/schemes/Exec.js +15 -15
  192. package/dist/schemes/Exec.js.map +1 -1
  193. package/dist/schemes/ExecOutputScheme.d.ts +3 -2
  194. package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
  195. package/dist/schemes/ExecOutputScheme.js +9 -0
  196. package/dist/schemes/ExecOutputScheme.js.map +1 -1
  197. package/dist/schemes/File.d.ts +1 -0
  198. package/dist/schemes/File.d.ts.map +1 -1
  199. package/dist/schemes/File.js +233 -268
  200. package/dist/schemes/File.js.map +1 -1
  201. package/dist/schemes/Log.d.ts.map +1 -1
  202. package/dist/schemes/Log.js +97 -17
  203. package/dist/schemes/Log.js.map +1 -1
  204. package/dist/schemes/Log.sql +9 -0
  205. package/dist/schemes/Worker.js +1 -1
  206. package/dist/schemes/Worker.js.map +1 -1
  207. package/dist/schemes/_entry-crud.d.ts +2 -0
  208. package/dist/schemes/_entry-crud.d.ts.map +1 -1
  209. package/dist/schemes/_entry-crud.js +8 -5
  210. package/dist/schemes/_entry-crud.js.map +1 -1
  211. package/dist/schemes/_entry-crud.sql +15 -15
  212. package/dist/schemes/_entry-find.d.ts +2 -1
  213. package/dist/schemes/_entry-find.d.ts.map +1 -1
  214. package/dist/schemes/_entry-find.js +31 -19
  215. package/dist/schemes/_entry-find.js.map +1 -1
  216. package/dist/schemes/_entry-manifest.d.ts +2 -2
  217. package/dist/schemes/_entry-manifest.d.ts.map +1 -1
  218. package/dist/schemes/_entry-manifest.js +10 -8
  219. package/dist/schemes/_entry-manifest.js.map +1 -1
  220. package/dist/schemes/_entry-ops.d.ts.map +1 -1
  221. package/dist/schemes/_entry-ops.js +9 -7
  222. package/dist/schemes/_entry-ops.js.map +1 -1
  223. package/dist/schemes/_path-scope.d.ts.map +1 -1
  224. package/dist/schemes/_path-scope.js +12 -4
  225. package/dist/schemes/_path-scope.js.map +1 -1
  226. package/dist/schemes/_search-index.js +3 -3
  227. package/dist/schemes/_search-index.js.map +1 -1
  228. package/dist/schemes/exec-abort.js +2 -2
  229. package/dist/schemes/exec-abort.js.map +1 -1
  230. package/dist/schemes/exec-env.d.ts.map +1 -1
  231. package/dist/schemes/exec-env.js +7 -22
  232. package/dist/schemes/exec-env.js.map +1 -1
  233. package/dist/server/Daemon.d.ts +1 -0
  234. package/dist/server/Daemon.d.ts.map +1 -1
  235. package/dist/server/Daemon.js +45 -68
  236. package/dist/server/Daemon.js.map +1 -1
  237. package/dist/server/DrainSupervisor.d.ts +2 -3
  238. package/dist/server/DrainSupervisor.d.ts.map +1 -1
  239. package/dist/server/DrainSupervisor.js +34 -6
  240. package/dist/server/DrainSupervisor.js.map +1 -1
  241. package/dist/server/EnvFunctionality.d.ts +4 -2
  242. package/dist/server/EnvFunctionality.d.ts.map +1 -1
  243. package/dist/server/EnvFunctionality.js +23 -12
  244. package/dist/server/EnvFunctionality.js.map +1 -1
  245. package/dist/server/Functionality.d.ts.map +1 -1
  246. package/dist/server/Functionality.js +15 -8
  247. package/dist/server/Functionality.js.map +1 -1
  248. package/dist/server/FunctionalityManager.d.ts +1 -1
  249. package/dist/server/FunctionalityManager.d.ts.map +1 -1
  250. package/dist/server/FunctionalityManager.js +5 -1
  251. package/dist/server/FunctionalityManager.js.map +1 -1
  252. package/dist/server/MembersFunctionality.d.ts.map +1 -1
  253. package/dist/server/MembersFunctionality.js +12 -12
  254. package/dist/server/MembersFunctionality.js.map +1 -1
  255. package/dist/server/Retention.d.ts.map +1 -1
  256. package/dist/server/Retention.js +5 -5
  257. package/dist/server/Retention.js.map +1 -1
  258. package/dist/server/Retention.sql +49 -23
  259. package/dist/server/client-input.d.ts.map +1 -1
  260. package/dist/server/client-input.js +12 -3
  261. package/dist/server/client-input.js.map +1 -1
  262. package/dist/server/drain.sql +10 -9
  263. package/dist/server/lifecycle-recovery.sql +4 -1
  264. package/dist/service.d.ts.map +1 -1
  265. package/dist/service.js +9 -31
  266. package/dist/service.js.map +1 -1
  267. package/docs/copy-move.md +3 -0
  268. package/docs/env.md +32 -4
  269. package/docs/members.md +16 -1
  270. package/migrations/018_worker_owners.sql +1 -0
  271. package/migrations/019_interactive_owners.sql +1 -0
  272. package/migrations/020_log_projection.sql +1 -0
  273. package/migrations/021_packet_roles.sql +86 -0
  274. package/migrations/022_message_completion.sql +24 -0
  275. package/migrations/023_file_revisions.sql +54 -0
  276. package/migrations/024_proposal_decisions.sql +34 -0
  277. package/migrations/025_response_retention.sql +30 -0
  278. package/package.json +38 -34
  279. package/dist/schemes/_derivation-use.d.ts.map +0 -1
  280. 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,EAAqC,MAAM,0BAA0B,CAAC;AAM3G,OAAO,KAAK,EAAE,aAAa,EAA0D,MAAM,0BAA0B,CAAC;AAKtH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3H,MAAM,MAAM,kBAAkB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAK/I,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAoB,MAAM,0BAA0B,CAAC;AAGvE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAKlC,OAAO,KAAK,EAAE,mBAAmB,EAA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QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EACtH,UAAc,EAAE,8BAA8B,GACjD,EAAE;QACC,QAAQ,EAAE,QAAQ,CAAC;QACnB,aAAa,CAAC,EAAE,QAAQ,CAAC;QACzB,QAAQ,EAAE,WAAW,EAAE,CAAC;QAExB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QACtD,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;QAC1C,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAGzD,UAAU,CAAC,EAAE,MAAM,CAAC;QAGpB,8BAA8B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAClD,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA4C5B;IAo0CK,mBAAmB,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC,GAAG,UAAU,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC,CAEnJ;CACJ"}
@@ -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, TurnDisposition, UNKNOWN_POSITION } from "@plurnk/plurnk-contracts";
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} — an operator's own GBNF is a file path: absolute, `~`-relative, or
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
- if (value.startsWith("/") || value.startsWith(".") || value.includes("/"))
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
- : `emission truncated at the output allowance${grant === null ? "" : ` (${grant} tokens)`}`;
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
- const program = TurnOps.renderInternal(admittedInitializationStatements);
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 !== admittedInitializationStatements.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(), omitPreviousEmission: false } }),
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(), omitPreviousEmission: false } };
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 workspace paths belong to the message.
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 fileRead = {
728
+ const resourceRead = {
702
729
  op: "READ", aside: null, lineMarker: null, matcher: null,
703
- target: { kind: "local", raw },
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: fileRead, workspaceId, workerId, loopId, turnId,
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
- omitPreviousEmission: facts.projection.omitPreviousEmission,
758
+ omitEmissionHistory: facts.projection.omitEmissionHistory,
732
759
  });
733
- // {§previous-emission}: all builds, including result-admission probes, shed the optional
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, "previous-emission").length > 0 && this.#packets.windowOverflow(packet, provider) !== null) {
736
- facts.projection.omitPreviousEmission = true;
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; the row recurs on every packet that is over.
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 ({§previous-emission}), then the newest rows still carrying a body,
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.omitPreviousEmission && PacketWire.sectionContent(request.packet, "previous-emission").length > 0) {
804
- request.projection.omitPreviousEmission = true;
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
- message: `${cut}; no operations were performed`,
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
- message: `${allowanceCut}; no authored operations were performed`,
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
- message: allowanceCut,
1363
+ directive: DIRECTIVE.output,
1364
+ message: `${allowanceCut}.`,
1332
1365
  level: "warn",
1333
1366
  });
1334
1367
  }
1335
- // {§outside-text} — text outside the operations is the turn's own source, never a log row
1336
- // or a packet field; the model reads only its weight, the client reads its text once.
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.text, { modelCallId: emission.modelCallId });
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.text,
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
- finalResponse: split.finalResponse,
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
- outside.push(item.content.trim());
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 finalResponse = TurnDisposition.requestsCompletion(ops)
1575
- && !hasUnparsedTail && parseErrors.length === 0
1576
- && assistant.finishReason !== "length";
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
- finalResponse,
1659
+ completionAllowed,
1594
1660
  parseNotices,
1595
1661
  emissionValid,
1596
- outside: outside.length === 0 ? null : { text: outsideText, tokens: contentWeight(outsideText) },
1662
+ outside: outside.length === 0 ? null : outside.join("\n\n"),
1597
1663
  emissionStatements,
1598
1664
  };
1599
1665
  }