@plurnk/plurnk-service 1.10.0 → 1.11.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 (288) hide show
  1. package/.env.defaults +41 -17
  2. package/INSTALL.md +1 -1
  3. package/README.md +1 -1
  4. package/SPEC.md +487 -233
  5. package/digest-sql/curation/curation.sql +1 -0
  6. package/dist/Paths.d.ts +3 -3
  7. package/dist/Paths.d.ts.map +1 -1
  8. package/dist/Paths.js +9 -9
  9. package/dist/Paths.js.map +1 -1
  10. package/dist/build-info.json +1 -1
  11. package/dist/content/edit-collision.js +3 -3
  12. package/dist/content/edit-collision.js.map +1 -1
  13. package/dist/content/edit-receipt.d.ts +6 -5
  14. package/dist/content/edit-receipt.d.ts.map +1 -1
  15. package/dist/content/edit-receipt.js +13 -2
  16. package/dist/content/edit-receipt.js.map +1 -1
  17. package/dist/content/index.d.ts +2 -2
  18. package/dist/content/index.d.ts.map +1 -1
  19. package/dist/content/index.js +1 -1
  20. package/dist/content/index.js.map +1 -1
  21. package/dist/content/line-anchors.d.ts +2 -0
  22. package/dist/content/line-anchors.d.ts.map +1 -1
  23. package/dist/content/line-anchors.js +2 -0
  24. package/dist/content/line-anchors.js.map +1 -1
  25. package/dist/content/matcher.d.ts.map +1 -1
  26. package/dist/content/matcher.js +3 -2
  27. package/dist/content/matcher.js.map +1 -1
  28. package/dist/content/read-projector.js +3 -3
  29. package/dist/content/read-projector.js.map +1 -1
  30. package/dist/core/BudgetReadout.d.ts +6 -1
  31. package/dist/core/BudgetReadout.d.ts.map +1 -1
  32. package/dist/core/BudgetReadout.js +38 -2
  33. package/dist/core/BudgetReadout.js.map +1 -1
  34. package/dist/core/CapabilityPolicies.d.ts +15 -0
  35. package/dist/core/CapabilityPolicies.d.ts.map +1 -0
  36. package/dist/core/CapabilityPolicies.js +60 -0
  37. package/dist/core/CapabilityPolicies.js.map +1 -0
  38. package/dist/core/CapabilityResolver.d.ts +24 -0
  39. package/dist/core/CapabilityResolver.d.ts.map +1 -0
  40. package/dist/core/CapabilityResolver.js +180 -0
  41. package/dist/core/CapabilityResolver.js.map +1 -0
  42. package/dist/core/ChannelWrite.d.ts +4 -3
  43. package/dist/core/ChannelWrite.d.ts.map +1 -1
  44. package/dist/core/CoreSchemeServices.d.ts +1 -1
  45. package/dist/core/CoreSchemeServices.d.ts.map +1 -1
  46. package/dist/core/CoreSchemeServices.js +1 -1
  47. package/dist/core/CoreSchemeServices.js.map +1 -1
  48. package/dist/core/Dispatcher.d.ts +3 -1
  49. package/dist/core/Dispatcher.d.ts.map +1 -1
  50. package/dist/core/Dispatcher.js +148 -160
  51. package/dist/core/Dispatcher.js.map +1 -1
  52. package/dist/core/DurableStatement.d.ts.map +1 -1
  53. package/dist/core/DurableStatement.js +19 -15
  54. package/dist/core/DurableStatement.js.map +1 -1
  55. package/dist/core/Engine.d.ts +6 -4
  56. package/dist/core/Engine.d.ts.map +1 -1
  57. package/dist/core/Engine.js +18 -7
  58. package/dist/core/Engine.js.map +1 -1
  59. package/dist/core/Engine.sql +30 -25
  60. package/dist/core/ExecutorRegistry.d.ts +3 -3
  61. package/dist/core/ExecutorRegistry.d.ts.map +1 -1
  62. package/dist/core/ExecutorRegistry.js +10 -6
  63. package/dist/core/ExecutorRegistry.js.map +1 -1
  64. package/dist/core/GitBranch.d.ts +4 -1
  65. package/dist/core/GitBranch.d.ts.map +1 -1
  66. package/dist/core/GitBranch.js +12 -2
  67. package/dist/core/GitBranch.js.map +1 -1
  68. package/dist/core/LogEntryProjection.d.ts +1 -0
  69. package/dist/core/LogEntryProjection.d.ts.map +1 -1
  70. package/dist/core/LogEntryProjection.js +12 -4
  71. package/dist/core/LogEntryProjection.js.map +1 -1
  72. package/dist/core/LoopPolicyReader.d.ts +7 -0
  73. package/dist/core/LoopPolicyReader.d.ts.map +1 -0
  74. package/dist/core/LoopPolicyReader.js +33 -0
  75. package/dist/core/LoopPolicyReader.js.map +1 -0
  76. package/dist/core/ModelCall.d.ts +1 -0
  77. package/dist/core/ModelCall.d.ts.map +1 -1
  78. package/dist/core/ModelCall.js +3 -0
  79. package/dist/core/ModelCall.js.map +1 -1
  80. package/dist/core/NoticeChannel.d.ts +2 -2
  81. package/dist/core/NoticeChannel.d.ts.map +1 -1
  82. package/dist/core/NoticeChannel.js +18 -9
  83. package/dist/core/NoticeChannel.js.map +1 -1
  84. package/dist/core/OperatorConfig.d.ts.map +1 -1
  85. package/dist/core/OperatorConfig.js +4 -0
  86. package/dist/core/OperatorConfig.js.map +1 -1
  87. package/dist/core/OverflowTurn.d.ts.map +1 -1
  88. package/dist/core/OverflowTurn.js +4 -3
  89. package/dist/core/OverflowTurn.js.map +1 -1
  90. package/dist/core/Owner.js +5 -5
  91. package/dist/core/Owner.js.map +1 -1
  92. package/dist/core/PacketBuilder.d.ts +2 -2
  93. package/dist/core/PacketBuilder.d.ts.map +1 -1
  94. package/dist/core/PacketBuilder.js +53 -35
  95. package/dist/core/PacketBuilder.js.map +1 -1
  96. package/dist/core/ProblemLog.d.ts.map +1 -1
  97. package/dist/core/ProblemLog.js +1 -0
  98. package/dist/core/ProblemLog.js.map +1 -1
  99. package/dist/core/ProposalLifecycle.d.ts.map +1 -1
  100. package/dist/core/ProposalLifecycle.js +16 -13
  101. package/dist/core/ProposalLifecycle.js.map +1 -1
  102. package/dist/core/ReasoningEvent.d.ts +1 -0
  103. package/dist/core/ReasoningEvent.d.ts.map +1 -1
  104. package/dist/core/ResourceMutations.d.ts +5 -4
  105. package/dist/core/ResourceMutations.d.ts.map +1 -1
  106. package/dist/core/ResourceMutations.js +71 -48
  107. package/dist/core/ResourceMutations.js.map +1 -1
  108. package/dist/core/SchemeRegistry.d.ts +6 -3
  109. package/dist/core/SchemeRegistry.d.ts.map +1 -1
  110. package/dist/core/SchemeRegistry.js +14 -17
  111. package/dist/core/SchemeRegistry.js.map +1 -1
  112. package/dist/core/ServiceTeardown.d.ts +1 -1
  113. package/dist/core/ServiceTeardown.d.ts.map +1 -1
  114. package/dist/core/ServiceTeardown.js +4 -8
  115. package/dist/core/ServiceTeardown.js.map +1 -1
  116. package/dist/core/StrikeRail.js +1 -1
  117. package/dist/core/StrikeRail.js.map +1 -1
  118. package/dist/core/ToolResources.d.ts +2 -2
  119. package/dist/core/ToolResources.d.ts.map +1 -1
  120. package/dist/core/ToolResources.js +18 -8
  121. package/dist/core/ToolResources.js.map +1 -1
  122. package/dist/core/TurnOps.d.ts.map +1 -1
  123. package/dist/core/TurnOps.js +22 -8
  124. package/dist/core/TurnOps.js.map +1 -1
  125. package/dist/core/TurnRunner.d.ts +7 -3
  126. package/dist/core/TurnRunner.d.ts.map +1 -1
  127. package/dist/core/TurnRunner.js +315 -71
  128. package/dist/core/TurnRunner.js.map +1 -1
  129. package/dist/core/WorkerControlAddress.d.ts.map +1 -1
  130. package/dist/core/WorkerControlAddress.js +1 -2
  131. package/dist/core/WorkerControlAddress.js.map +1 -1
  132. package/dist/core/WorkerName.d.ts +2 -0
  133. package/dist/core/WorkerName.d.ts.map +1 -1
  134. package/dist/core/WorkerName.js +3 -2
  135. package/dist/core/WorkerName.js.map +1 -1
  136. package/dist/core/WorkerName.sql +2 -1
  137. package/dist/core/caps/DbProjectionCaps.d.ts +2 -1
  138. package/dist/core/caps/DbProjectionCaps.d.ts.map +1 -1
  139. package/dist/core/caps/DbProjectionCaps.js +12 -1
  140. package/dist/core/caps/DbProjectionCaps.js.map +1 -1
  141. package/dist/core/file-materialization.d.ts +22 -0
  142. package/dist/core/file-materialization.d.ts.map +1 -0
  143. package/dist/core/file-materialization.js +77 -0
  144. package/dist/core/file-materialization.js.map +1 -0
  145. package/dist/core/fork.d.ts +2 -1
  146. package/dist/core/fork.d.ts.map +1 -1
  147. package/dist/core/fork.js +13 -4
  148. package/dist/core/fork.js.map +1 -1
  149. package/dist/core/fork.sql +27 -11
  150. package/dist/core/git-membership.d.ts +25 -14
  151. package/dist/core/git-membership.d.ts.map +1 -1
  152. package/dist/core/git-membership.js +260 -164
  153. package/dist/core/git-membership.js.map +1 -1
  154. package/dist/core/git-state.d.ts +2 -0
  155. package/dist/core/git-state.d.ts.map +1 -1
  156. package/dist/core/git-state.js +27 -1
  157. package/dist/core/git-state.js.map +1 -1
  158. package/dist/core/operation-target-groups.d.ts.map +1 -1
  159. package/dist/core/operation-target-groups.js +8 -7
  160. package/dist/core/operation-target-groups.js.map +1 -1
  161. package/dist/core/owner.sql +7 -10
  162. package/dist/core/packet-wire.d.ts +10 -0
  163. package/dist/core/packet-wire.d.ts.map +1 -1
  164. package/dist/core/packet-wire.js +78 -29
  165. package/dist/core/packet-wire.js.map +1 -1
  166. package/dist/core/scheme-types.d.ts +2 -2
  167. package/dist/core/scheme-types.d.ts.map +1 -1
  168. package/dist/core/scheme-types.js +1 -1
  169. package/dist/core/scheme-types.js.map +1 -1
  170. package/dist/core/types.d.ts +3 -2
  171. package/dist/core/types.d.ts.map +1 -1
  172. package/dist/core/types.js +1 -1
  173. package/dist/core/types.js.map +1 -1
  174. package/dist/core/worker-settings.d.ts +4 -3
  175. package/dist/core/worker-settings.d.ts.map +1 -1
  176. package/dist/core/worker-settings.js +40 -19
  177. package/dist/core/worker-settings.js.map +1 -1
  178. package/dist/core/workspace-settings.d.ts +3 -1
  179. package/dist/core/workspace-settings.d.ts.map +1 -1
  180. package/dist/core/workspace-settings.js +6 -2
  181. package/dist/core/workspace-settings.js.map +1 -1
  182. package/dist/digest/Digest.d.ts.map +1 -1
  183. package/dist/digest/Digest.js +93 -26
  184. package/dist/digest/Digest.js.map +1 -1
  185. package/dist/digest/digest.sql +13 -3
  186. package/dist/index.js +1 -1
  187. package/dist/index.js.map +1 -1
  188. package/dist/schemes/Exec.d.ts +3 -5
  189. package/dist/schemes/Exec.d.ts.map +1 -1
  190. package/dist/schemes/Exec.js +98 -94
  191. package/dist/schemes/Exec.js.map +1 -1
  192. package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
  193. package/dist/schemes/ExecOutputScheme.js +24 -6
  194. package/dist/schemes/ExecOutputScheme.js.map +1 -1
  195. package/dist/schemes/ExecScheduler.d.ts +15 -0
  196. package/dist/schemes/ExecScheduler.d.ts.map +1 -0
  197. package/dist/schemes/ExecScheduler.js +95 -0
  198. package/dist/schemes/ExecScheduler.js.map +1 -0
  199. package/dist/schemes/File.d.ts.map +1 -1
  200. package/dist/schemes/File.js +16 -15
  201. package/dist/schemes/File.js.map +1 -1
  202. package/dist/schemes/Log.d.ts +6 -4
  203. package/dist/schemes/Log.d.ts.map +1 -1
  204. package/dist/schemes/Log.js +131 -38
  205. package/dist/schemes/Log.js.map +1 -1
  206. package/dist/schemes/Log.sql +23 -18
  207. package/dist/schemes/QuestionTool.d.ts +17 -4
  208. package/dist/schemes/QuestionTool.d.ts.map +1 -1
  209. package/dist/schemes/QuestionTool.js +2 -4
  210. package/dist/schemes/QuestionTool.js.map +1 -1
  211. package/dist/schemes/Worker.d.ts.map +1 -1
  212. package/dist/schemes/Worker.js +20 -20
  213. package/dist/schemes/Worker.js.map +1 -1
  214. package/dist/schemes/_entry-chunk.js +1 -1
  215. package/dist/schemes/_entry-chunk.js.map +1 -1
  216. package/dist/schemes/_entry-crud.sql +18 -17
  217. package/dist/schemes/_entry-find.d.ts.map +1 -1
  218. package/dist/schemes/_entry-find.js +7 -9
  219. package/dist/schemes/_entry-find.js.map +1 -1
  220. package/dist/schemes/_entry-graph.js +12 -12
  221. package/dist/schemes/_entry-graph.js.map +1 -1
  222. package/dist/schemes/_entry-graph.sql +5 -5
  223. package/dist/schemes/_entry-ops.d.ts.map +1 -1
  224. package/dist/schemes/_entry-ops.js +3 -3
  225. package/dist/schemes/_entry-ops.js.map +1 -1
  226. package/dist/schemes/_entry-semantic.js +1 -1
  227. package/dist/schemes/_entry-semantic.js.map +1 -1
  228. package/dist/server/BranchBatches.d.ts +3 -3
  229. package/dist/server/BranchBatches.d.ts.map +1 -1
  230. package/dist/server/BranchBatches.js +9 -2
  231. package/dist/server/BranchBatches.js.map +1 -1
  232. package/dist/server/Daemon.d.ts +12 -41
  233. package/dist/server/Daemon.d.ts.map +1 -1
  234. package/dist/server/Daemon.js +59 -93
  235. package/dist/server/Daemon.js.map +1 -1
  236. package/dist/server/DaemonModule.d.ts +10 -1
  237. package/dist/server/DaemonModule.d.ts.map +1 -1
  238. package/dist/server/DrainSupervisor.d.ts +6 -5
  239. package/dist/server/DrainSupervisor.d.ts.map +1 -1
  240. package/dist/server/DrainSupervisor.js +14 -11
  241. package/dist/server/DrainSupervisor.js.map +1 -1
  242. package/dist/server/Functionality.d.ts +2 -2
  243. package/dist/server/Functionality.d.ts.map +1 -1
  244. package/dist/server/Functionality.js +8 -5
  245. package/dist/server/Functionality.js.map +1 -1
  246. package/dist/server/FunctionalityManager.d.ts +13 -1
  247. package/dist/server/FunctionalityManager.d.ts.map +1 -1
  248. package/dist/server/FunctionalityManager.js +82 -17
  249. package/dist/server/FunctionalityManager.js.map +1 -1
  250. package/dist/server/MembersFunctionality.d.ts +56 -0
  251. package/dist/server/MembersFunctionality.d.ts.map +1 -0
  252. package/dist/server/MembersFunctionality.js +350 -0
  253. package/dist/server/MembersFunctionality.js.map +1 -0
  254. package/dist/server/SkillsFunctionality.d.ts +12 -1
  255. package/dist/server/SkillsFunctionality.d.ts.map +1 -1
  256. package/dist/server/SkillsFunctionality.js +6 -1
  257. package/dist/server/SkillsFunctionality.js.map +1 -1
  258. package/dist/server/client-input.d.ts +5 -8
  259. package/dist/server/client-input.d.ts.map +1 -1
  260. package/dist/server/client-input.js +49 -108
  261. package/dist/server/client-input.js.map +1 -1
  262. package/dist/server/dispatch-as-plurnk.d.ts.map +1 -1
  263. package/dist/server/dispatch-as-plurnk.js +3 -0
  264. package/dist/server/dispatch-as-plurnk.js.map +1 -1
  265. package/dist/server/drain.sql +4 -4
  266. package/dist/server/envelope.d.ts +1 -1
  267. package/dist/server/envelope.d.ts.map +1 -1
  268. package/dist/server/envelope.js +11 -10
  269. package/dist/server/envelope.js.map +1 -1
  270. package/dist/server/envelope.sql +1 -1
  271. package/dist/server/loopDocs.d.ts.map +1 -1
  272. package/dist/server/loopDocs.js +12 -5
  273. package/dist/server/loopDocs.js.map +1 -1
  274. package/dist/server/seam-proposal-list.sql +2 -2
  275. package/dist/server/worker-capabilities.sql +9 -0
  276. package/dist/service.d.ts.map +1 -1
  277. package/dist/service.js +16 -21
  278. package/dist/service.js.map +1 -1
  279. package/migrations/001_schema.sql +217 -64
  280. package/package.json +30 -32
  281. package/dist/core/LoopFlagsReader.d.ts +0 -7
  282. package/dist/core/LoopFlagsReader.d.ts.map +0 -1
  283. package/dist/core/LoopFlagsReader.js +0 -33
  284. package/dist/core/LoopFlagsReader.js.map +0 -1
  285. package/dist/core/resolveForLoop.d.ts +0 -5
  286. package/dist/core/resolveForLoop.d.ts.map +0 -1
  287. package/dist/core/resolveForLoop.js +0 -12
  288. package/dist/core/resolveForLoop.js.map +0 -1
@@ -65,6 +65,9 @@ CREATE TABLE IF NOT EXISTS workers (
65
65
  -- validated at the client-input boundary (closed known-key set; unknown keys
66
66
  -- never persist).
67
67
  settings TEXT NOT NULL DEFAULT '{}' CHECK (json_valid(settings)),
68
+ -- Parent-derived capability ceiling, copied by value at child creation.
69
+ -- Root workers have the unrestricted empty policy.
70
+ capability_bound TEXT NOT NULL DEFAULT '{}' CHECK (json_valid(capability_bound)),
68
71
  -- {§env-delta-log-pull}: monotonic observation progress, not a private world snapshot.
69
72
  -- Creation captures the workspace high-water; a fork instead copies its
70
73
  -- parent's cursor and records the closed event boundary of its snapshot.
@@ -224,10 +227,8 @@ BEGIN
224
227
  END;
225
228
 
226
229
  -- loops
227
- -- flags: per-loop runtime flags (auto, noProposals, noWeb, noInteraction,
228
- -- mode). JSON column, merged over DEFAULT_LOOP_FLAGS in code so missing
229
- -- keys read as their defaults. SchemeRegistry.resolveForLoop gates schemes
230
- -- by manifest affinity (excludedInAsk / requiresWeb / requiresInteraction).
230
+ -- policy: complete immutable per-loop capability attenuation and proposal
231
+ -- disposition ({§loop-policy-effective-read}).
231
232
  CREATE TABLE IF NOT EXISTS loops (
232
233
  id INTEGER NOT NULL PRIMARY KEY,
233
234
  version INTEGER NOT NULL DEFAULT 0 CHECK (version >= 0),
@@ -238,7 +239,7 @@ CREATE TABLE IF NOT EXISTS loops (
238
239
  -- {§prompt-causal-source}: canonical actor address for the initial prompt;
239
240
  -- NULL means the owning worker itself.
240
241
  prompt_source TEXT CHECK (prompt_source IS NULL OR length(prompt_source) > 0),
241
- flags TEXT NOT NULL DEFAULT '{}' CHECK (json_valid(flags)),
242
+ policy TEXT NOT NULL DEFAULT '{"capabilities":{},"proposals":"review"}' CHECK (json_valid(policy)),
242
243
  -- {§worker-model-selection}: immutable loop snapshots of the resolved model route and the
243
244
  -- effective spawn route (was provider_spec/child_provider_spec JSON).
244
245
  model_route_id INTEGER REFERENCES model_routes(id),
@@ -338,11 +339,18 @@ BEGIN
338
339
  FROM workers w
339
340
  WHERE w.id = NEW.worker_id
340
341
  AND w.parent_worker_id IS NOT NULL
341
- AND EXISTS (
342
- SELECT 1
343
- FROM turns t
344
- WHERE t.loop_id = NEW.id
345
- AND NOT (t.producer = '_plurnk' AND t.kind = 'operation')
342
+ -- A loop whose only turns are client-driven operation turns is not the parent's
343
+ -- business (#323). A loop that never got a turn at all — a spawn refused before it
344
+ -- ran, e.g. a branch batch failing git-preflight — is, or the parent waits on a
345
+ -- ghost that vanished from Active Child Workers without a word (#385).
346
+ AND (
347
+ NOT EXISTS (SELECT 1 FROM turns t WHERE t.loop_id = NEW.id)
348
+ OR EXISTS (
349
+ SELECT 1
350
+ FROM turns t
351
+ WHERE t.loop_id = NEW.id
352
+ AND NOT (t.producer = '_plurnk' AND t.kind = 'operation')
353
+ )
346
354
  );
347
355
  END;
348
356
 
@@ -872,7 +880,7 @@ BEGIN
872
880
  END;
873
881
 
874
882
  -- symbol_defs
875
- -- @graph NODES ({§relation-indexed-dialects}). Code symbol definitions, populated
883
+ -- &graph NODES ({§relation-indexed-dialects}). Code symbol definitions, populated
876
884
  -- once per content-addressed derivation from mimetypes'
877
885
  -- `symbols` channel. Qualified path = container ? container || '.' || name : name.
878
886
  CREATE TABLE IF NOT EXISTS symbol_defs (
@@ -889,9 +897,9 @@ CREATE TABLE IF NOT EXISTS symbol_defs (
889
897
  CREATE INDEX IF NOT EXISTS symbol_defs_name ON symbol_defs (name);
890
898
 
891
899
  -- symbol_refs
892
- -- @graph EDGES ({§relation-indexed-dialects}), from mimetypes' `references` channel.
900
+ -- &graph EDGES ({§relation-indexed-dialects}), from mimetypes' `references` channel.
893
901
  -- name = edge TARGET; container = the SOURCE def's full qualified path (the
894
- -- @> join key; module-level → NULL); kind ∈ import|call|instantiate|inherit|
902
+ -- &> join key; module-level → NULL); kind ∈ import|call|instantiate|inherit|
895
903
  -- type|use (frozen, edge metadata only — traversal is kind-agnostic).
896
904
  CREATE TABLE IF NOT EXISTS symbol_refs (
897
905
  id INTEGER NOT NULL PRIMARY KEY,
@@ -942,8 +950,9 @@ CREATE TABLE IF NOT EXISTS derivation_embeddings (
942
950
  -- status⊥state: status is the HTTP outcome, state is where in the
943
951
  -- lifecycle the entry sits. Most rows write 'resolved' directly;
944
952
  -- proposing schemes transition 'proposed' → resolved/failed/cancelled.
945
- -- folded: canonical hidden log-body line intervals for OPEN/FOLD. [] is
946
- -- wholly open and [[1,-1]] is wholly folded.
953
+ -- initial_folded is the immutable visibility with which the event entered the
954
+ -- log. Current model-facing membership and folded intervals belong to
955
+ -- log_entry_projections below; curation never rewrites or removes this event.
947
956
  CREATE TABLE IF NOT EXISTS log_entries (
948
957
  id INTEGER NOT NULL PRIMARY KEY,
949
958
  version INTEGER NOT NULL DEFAULT 0 CHECK (version >= 0),
@@ -954,8 +963,9 @@ CREATE TABLE IF NOT EXISTS log_entries (
954
963
  sequence INTEGER NOT NULL CHECK (sequence >= 1),
955
964
  at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
956
965
  origin TEXT NOT NULL CHECK (origin IN ('model', 'client', '_plurnk', 'plugin')),
957
- -- {§env-delta-attribution}: a worker:// name or stable subsystem token ('file');
958
- -- NULL = the owning worker itself, rendered without causal attribution.
966
+ -- {§env-delta-attribution}: a causal worker:// identity, log:/// operation
967
+ -- address, or stable subsystem token ('file'); NULL = the owning worker
968
+ -- itself, rendered without causal attribution.
959
969
  source TEXT,
960
970
  -- Engine-owned occurrence identity. Source rows are stamped NULL→id by the
961
971
  -- journal trigger; observer and fork copies carry it at insertion.
@@ -1015,8 +1025,8 @@ CREATE TABLE IF NOT EXISTS log_entries (
1015
1025
  outcome TEXT,
1016
1026
  attrs TEXT NOT NULL DEFAULT '{}' CHECK (json_valid(attrs)),
1017
1027
 
1018
- folded TEXT NOT NULL DEFAULT '[]'
1019
- CHECK (json_valid(folded) AND json_type(folded) = 'array'),
1028
+ initial_folded TEXT NOT NULL DEFAULT '[]'
1029
+ CHECK (json_valid(initial_folded) AND json_type(initial_folded) = 'array'),
1020
1030
 
1021
1031
  CHECK (
1022
1032
  (op IS NULL) = COALESCE(
@@ -1045,6 +1055,52 @@ CREATE UNIQUE INDEX IF NOT EXISTS log_entries_worker_ambient_event
1045
1055
  ON log_entries (worker_id, ambient_event_id)
1046
1056
  WHERE ambient_event_id IS NOT NULL;
1047
1057
 
1058
+ -- {§log-history-projection} — log_entries is append-only execution evidence;
1059
+ -- this one-to-one row is the current model-facing projection of that evidence.
1060
+ -- KILL is a terminal active→inactive transition. OPEN/FOLD mutate only folded
1061
+ -- intervals while active. The initial state is created in the same statement as
1062
+ -- its event so no durable row can exist without one projection state.
1063
+ CREATE TABLE IF NOT EXISTS log_entry_projections (
1064
+ log_entry_id INTEGER NOT NULL PRIMARY KEY,
1065
+ active INTEGER NOT NULL DEFAULT 1 CHECK (active IN (0, 1)),
1066
+ folded TEXT NOT NULL DEFAULT '[]'
1067
+ CHECK (json_valid(folded) AND json_type(folded) = 'array'),
1068
+ FOREIGN KEY (log_entry_id) REFERENCES log_entries(id) ON DELETE CASCADE
1069
+ ) STRICT, WITHOUT ROWID;
1070
+
1071
+ -- The ordinary operation surface reads this view. Forensic and lifecycle
1072
+ -- machinery names log_entries directly and therefore retains complete history.
1073
+ CREATE VIEW IF NOT EXISTS active_log_entries AS
1074
+ SELECT le.*, projection.folded
1075
+ FROM log_entries le
1076
+ JOIN log_entry_projections projection ON projection.log_entry_id = le.id
1077
+ WHERE projection.active = 1;
1078
+
1079
+ CREATE TRIGGER IF NOT EXISTS log_entries_initialize_projection
1080
+ AFTER INSERT ON log_entries
1081
+ BEGIN
1082
+ INSERT INTO log_entry_projections (log_entry_id, active, folded)
1083
+ VALUES (NEW.id, 1, NEW.initial_folded);
1084
+ END;
1085
+
1086
+ -- Individual execution events are append-only. Containing-history teardown is
1087
+ -- the one removal owner: a cascading delete has already removed at least one
1088
+ -- ancestor in the workspace→worker→loop→turn chain. A direct row delete while
1089
+ -- that complete owner chain remains would fabricate chronology and is rejected.
1090
+ CREATE TRIGGER IF NOT EXISTS log_entries_delete_with_owner_only
1091
+ BEFORE DELETE ON log_entries
1092
+ WHEN EXISTS (
1093
+ SELECT 1
1094
+ FROM turns
1095
+ JOIN loops ON loops.id = turns.loop_id
1096
+ JOIN workers ON workers.id = loops.worker_id
1097
+ JOIN workspaces ON workspaces.id = workers.workspace_id
1098
+ WHERE turns.id = OLD.turn_id
1099
+ )
1100
+ BEGIN
1101
+ SELECT RAISE(ABORT, 'log entries can only be removed with their containing history');
1102
+ END;
1103
+
1048
1104
  -- A log row belongs to one exact worker/loop/turn chain. Its writer is either
1049
1105
  -- that turn's producer or `_plurnk` observing the turn. Primitive absence,
1050
1106
  -- enum, and foreign-key failures remain owned by their column constraints.
@@ -1091,8 +1147,8 @@ END;
1091
1147
  -- A folded interval is an inclusive [start,end] pair. Ranges are positive,
1092
1148
  -- sorted, disjoint, and non-adjacent; -1 is the final open-ended endpoint.
1093
1149
  -- Canonical intervals make visibility equality and curation effects exact.
1094
- CREATE TRIGGER IF NOT EXISTS log_entries_folded_valid_insert
1095
- BEFORE INSERT ON log_entries
1150
+ CREATE TRIGGER IF NOT EXISTS log_entry_projections_folded_valid_insert
1151
+ BEFORE INSERT ON log_entry_projections
1096
1152
  WHEN EXISTS (
1097
1153
  SELECT 1
1098
1154
  FROM json_each(NEW.folded) range
@@ -1116,11 +1172,11 @@ WHEN EXISTS (
1116
1172
  )
1117
1173
  )
1118
1174
  BEGIN
1119
- SELECT RAISE(ABORT, 'log entry folded ranges are invalid');
1175
+ SELECT RAISE(ABORT, 'log entry projection folded ranges are invalid');
1120
1176
  END;
1121
1177
 
1122
- CREATE TRIGGER IF NOT EXISTS log_entries_folded_valid_update
1123
- BEFORE UPDATE OF folded ON log_entries
1178
+ CREATE TRIGGER IF NOT EXISTS log_entry_projections_folded_valid_update
1179
+ BEFORE UPDATE OF folded ON log_entry_projections
1124
1180
  WHEN EXISTS (
1125
1181
  SELECT 1
1126
1182
  FROM json_each(NEW.folded) range
@@ -1144,7 +1200,21 @@ WHEN EXISTS (
1144
1200
  )
1145
1201
  )
1146
1202
  BEGIN
1147
- SELECT RAISE(ABORT, 'log entry folded ranges are invalid');
1203
+ SELECT RAISE(ABORT, 'log entry projection folded ranges are invalid');
1204
+ END;
1205
+
1206
+ CREATE TRIGGER IF NOT EXISTS log_entry_projections_kill_terminal
1207
+ BEFORE UPDATE OF active ON log_entry_projections
1208
+ WHEN OLD.active = 0 AND NEW.active != 0
1209
+ BEGIN
1210
+ SELECT RAISE(ABORT, 'a killed log entry cannot re-enter the active projection');
1211
+ END;
1212
+
1213
+ CREATE TRIGGER IF NOT EXISTS log_entry_projections_delete_with_event_only
1214
+ BEFORE DELETE ON log_entry_projections
1215
+ WHEN EXISTS (SELECT 1 FROM log_entries WHERE id = OLD.log_entry_id)
1216
+ BEGIN
1217
+ SELECT RAISE(ABORT, 'a durable log event must retain its projection');
1148
1218
  END;
1149
1219
 
1150
1220
  CREATE TRIGGER IF NOT EXISTS log_entries_model_call_valid
@@ -1170,7 +1240,8 @@ BEGIN
1170
1240
  END;
1171
1241
 
1172
1242
  -- {§log-item-tags} — log classification plus OPEN/FOLD selection and mutation.
1173
- -- CASCADE erases the classification with its row.
1243
+ -- A containing-history teardown cascades its classifications; log KILL leaves
1244
+ -- both the event and its forensic classifications intact.
1174
1245
  CREATE TABLE IF NOT EXISTS log_tags (
1175
1246
  log_entry_id INTEGER NOT NULL,
1176
1247
  tag TEXT NOT NULL,
@@ -1336,13 +1407,15 @@ BEGIN
1336
1407
  );
1337
1408
  END;
1338
1409
 
1339
- -- Successful OPEN/FOLD rows are durable curation events even though their
1340
- -- ordinary packet projection is suppressed ({§fold-open-meta-operations}).
1341
- -- Preserve the exact selected set and each target's before/after visibility so a
1342
- -- broad selector never collapses into the lossy fact `matched: N`.
1410
+ -- Successful OPEN/FOLD/log-KILL rows are durable curation events even though
1411
+ -- their ordinary packet projection is suppressed. Preserve the exact selected
1412
+ -- set and each target's before/after projection so a broad selector never
1413
+ -- collapses into the lossy fact `matched: N`.
1343
1414
  CREATE TABLE IF NOT EXISTS log_curation_effects (
1344
1415
  operation_log_entry_id INTEGER NOT NULL,
1345
1416
  target_log_entry_id INTEGER NOT NULL,
1417
+ active_before INTEGER NOT NULL CHECK (active_before IN (0, 1)),
1418
+ active_after INTEGER NOT NULL CHECK (active_after IN (0, 1)),
1346
1419
  folded_before TEXT NOT NULL
1347
1420
  CHECK (json_valid(folded_before) AND json_type(folded_before) = 'array'),
1348
1421
  folded_after TEXT NOT NULL
@@ -1360,9 +1433,30 @@ CREATE TABLE IF NOT EXISTS log_curation_effects (
1360
1433
  CREATE INDEX IF NOT EXISTS log_curation_effects_target
1361
1434
  ON log_curation_effects (target_log_entry_id);
1362
1435
 
1436
+ -- Curation effects are append-only execution evidence. They may disappear
1437
+ -- only when either referenced event is already being removed with its
1438
+ -- containing history; direct mutation while both events survive is forbidden.
1439
+ CREATE TRIGGER IF NOT EXISTS log_curation_effects_immutable
1440
+ BEFORE UPDATE ON log_curation_effects
1441
+ BEGIN
1442
+ SELECT RAISE(ABORT, 'log curation effects are immutable execution evidence');
1443
+ END;
1444
+
1445
+ CREATE TRIGGER IF NOT EXISTS log_curation_effects_delete_with_history_only
1446
+ BEFORE DELETE ON log_curation_effects
1447
+ WHEN EXISTS (
1448
+ SELECT 1 FROM log_entries WHERE id = OLD.operation_log_entry_id
1449
+ )
1450
+ AND EXISTS (
1451
+ SELECT 1 FROM log_entries WHERE id = OLD.target_log_entry_id
1452
+ )
1453
+ BEGIN
1454
+ SELECT RAISE(ABORT, 'log curation effects can only be removed with their containing history');
1455
+ END;
1456
+
1363
1457
  -- Make an invalid curation record structurally unavailable: the event must be
1364
- -- one successful OPEN/FOLD row, both rows must belong to the same worker, and
1365
- -- both exact delta sets must contain only unique canonical tag identities.
1458
+ -- one successful OPEN/FOLD/log-KILL row, both rows must belong to the same
1459
+ -- worker, and its state transition and exact tag deltas must match that op.
1366
1460
  CREATE TRIGGER IF NOT EXISTS log_curation_effects_valid
1367
1461
  BEFORE INSERT ON log_curation_effects
1368
1462
  BEGIN
@@ -1372,10 +1466,31 @@ BEGIN
1372
1466
  FROM log_entries operation
1373
1467
  JOIN log_entries target ON target.id = NEW.target_log_entry_id
1374
1468
  WHERE operation.id = NEW.operation_log_entry_id
1375
- AND operation.op IN ('OPEN', 'FOLD')
1469
+ AND operation.op IN ('OPEN', 'FOLD', 'KILL')
1376
1470
  AND operation.status_rx < 400
1377
1471
  AND operation.worker_id = target.worker_id
1378
1472
  )
1473
+ OR NOT EXISTS (
1474
+ SELECT 1
1475
+ FROM log_entries operation
1476
+ WHERE operation.id = NEW.operation_log_entry_id
1477
+ AND (
1478
+ (
1479
+ operation.op IN ('OPEN', 'FOLD')
1480
+ AND NEW.active_before = 1
1481
+ AND NEW.active_after = 1
1482
+ )
1483
+ OR (
1484
+ operation.op = 'KILL'
1485
+ AND operation.scheme = 'log'
1486
+ AND NEW.active_before = 1
1487
+ AND NEW.active_after = 0
1488
+ AND json(NEW.folded_before) = json(NEW.folded_after)
1489
+ AND json_array_length(NEW.tags_added) = 0
1490
+ AND json_array_length(NEW.tags_removed) = 0
1491
+ )
1492
+ )
1493
+ )
1379
1494
  OR EXISTS (
1380
1495
  SELECT 1
1381
1496
  FROM (
@@ -1450,27 +1565,29 @@ BEGIN
1450
1565
  END;
1451
1566
 
1452
1567
  -- The dispatcher binds an exact, transient curation plan into attrs on the
1453
- -- successful OPEN/FOLD row. No other row may carry that private payload.
1568
+ -- successful OPEN/FOLD/log-KILL row. No other row may carry that payload.
1454
1569
  CREATE TRIGGER IF NOT EXISTS log_entries_curation_payload_valid
1455
1570
  BEFORE INSERT ON log_entries
1456
1571
  WHEN json_type(NEW.attrs, '$.__plurnk_curation') IS NOT NULL
1457
1572
  AND NOT (
1458
- NEW.op IN ('OPEN', 'FOLD')
1573
+ NEW.op IN ('OPEN', 'FOLD', 'KILL')
1459
1574
  AND NEW.status_rx < 400
1575
+ AND (NEW.op != 'KILL' OR NEW.scheme = 'log')
1460
1576
  AND json_type(NEW.attrs, '$.__plurnk_curation') = 'object'
1461
1577
  )
1462
1578
  BEGIN
1463
- SELECT RAISE(ABORT, 'private log curation payload requires a successful OPEN/FOLD row');
1579
+ SELECT RAISE(ABORT, 'private log curation payload requires a successful log curation row');
1464
1580
  END;
1465
1581
 
1466
1582
  -- One outer INSERT owns the whole landed curation event: exact selected rows,
1467
- -- their before/after visibility and tag deltas, and the
1468
- -- resulting classifications. Trigger failure rolls the operation row and all
1469
- -- effects back together. The private plan is erased before INSERT returns.
1583
+ -- their before/after projection and tag deltas, and the resulting current
1584
+ -- state. Trigger failure rolls the operation row and all effects back together.
1585
+ -- The private plan is erased before INSERT returns.
1470
1586
  CREATE TRIGGER IF NOT EXISTS log_entries_apply_curation
1471
1587
  AFTER INSERT ON log_entries
1472
- WHEN NEW.op IN ('OPEN', 'FOLD')
1588
+ WHEN NEW.op IN ('OPEN', 'FOLD', 'KILL')
1473
1589
  AND NEW.status_rx < 400
1590
+ AND (NEW.op != 'KILL' OR NEW.scheme = 'log')
1474
1591
  AND json_type(NEW.attrs, '$.__plurnk_curation') = 'object'
1475
1592
  BEGIN
1476
1593
  SELECT CASE WHEN
@@ -1484,20 +1601,24 @@ BEGIN
1484
1601
  WHERE selected.type != 'object'
1485
1602
  OR COALESCE(json_type(selected.value, '$.id'), '') != 'integer'
1486
1603
  OR json_extract(selected.value, '$.id') <= 0
1487
- OR COALESCE(json_type(selected.value, '$.before'), '') != 'array'
1488
- OR COALESCE(json_type(selected.value, '$.after'), '') != 'array'
1604
+ OR COALESCE(json_type(selected.value, '$.activeBefore'), '') != 'integer'
1605
+ OR json_extract(selected.value, '$.activeBefore') NOT IN (0, 1)
1606
+ OR COALESCE(json_type(selected.value, '$.activeAfter'), '') != 'integer'
1607
+ OR json_extract(selected.value, '$.activeAfter') NOT IN (0, 1)
1608
+ OR COALESCE(json_type(selected.value, '$.foldedBefore'), '') != 'array'
1609
+ OR COALESCE(json_type(selected.value, '$.foldedAfter'), '') != 'array'
1489
1610
  OR EXISTS (
1490
1611
  SELECT 1 FROM json_each(selected.value) field
1491
- WHERE field.key NOT IN ('id', 'before', 'after')
1612
+ WHERE field.key NOT IN ('id', 'activeBefore', 'activeAfter', 'foldedBefore', 'foldedAfter')
1492
1613
  )
1493
1614
  OR EXISTS (
1494
1615
  SELECT 1
1495
1616
  FROM (
1496
1617
  SELECT 'before' AS side, range.key, range.value, range.type
1497
- FROM json_each(json_extract(selected.value, '$.before')) range
1618
+ FROM json_each(json_extract(selected.value, '$.foldedBefore')) range
1498
1619
  UNION ALL
1499
1620
  SELECT 'after' AS side, range.key, range.value, range.type
1500
- FROM json_each(json_extract(selected.value, '$.after')) range
1621
+ FROM json_each(json_extract(selected.value, '$.foldedAfter')) range
1501
1622
  ) range
1502
1623
  WHERE range.type != 'array'
1503
1624
  OR json_array_length(range.value) != 2
@@ -1512,8 +1633,8 @@ BEGIN
1512
1633
  SELECT 1
1513
1634
  FROM json_each(
1514
1635
  CASE range.side
1515
- WHEN 'before' THEN json_extract(selected.value, '$.before')
1516
- ELSE json_extract(selected.value, '$.after')
1636
+ WHEN 'before' THEN json_extract(selected.value, '$.foldedBefore')
1637
+ ELSE json_extract(selected.value, '$.foldedAfter')
1517
1638
  END
1518
1639
  ) previous
1519
1640
  WHERE previous.key = range.key - 1
@@ -1534,10 +1655,28 @@ BEGIN
1534
1655
  SELECT 1
1535
1656
  FROM json_each(NEW.attrs, '$.__plurnk_curation.targets') selected
1536
1657
  LEFT JOIN log_entries target ON target.id = json_extract(selected.value, '$.id')
1658
+ LEFT JOIN log_entry_projections projection ON projection.log_entry_id = target.id
1537
1659
  WHERE target.id IS NULL
1660
+ OR projection.log_entry_id IS NULL
1538
1661
  OR target.worker_id != NEW.worker_id
1539
1662
  OR target.id = NEW.id
1540
- OR json(target.folded) != json(json_extract(selected.value, '$.before'))
1663
+ OR projection.active != json_extract(selected.value, '$.activeBefore')
1664
+ OR json(projection.folded) != json(json_extract(selected.value, '$.foldedBefore'))
1665
+ OR (
1666
+ NEW.op IN ('OPEN', 'FOLD')
1667
+ AND NOT (
1668
+ json_extract(selected.value, '$.activeBefore') = 1
1669
+ AND json_extract(selected.value, '$.activeAfter') = 1
1670
+ )
1671
+ )
1672
+ OR (
1673
+ NEW.op = 'KILL'
1674
+ AND NOT (
1675
+ json_extract(selected.value, '$.activeBefore') = 1
1676
+ AND json_extract(selected.value, '$.activeAfter') = 0
1677
+ AND json(json_extract(selected.value, '$.foldedBefore')) = json(json_extract(selected.value, '$.foldedAfter'))
1678
+ )
1679
+ )
1541
1680
  )
1542
1681
  OR EXISTS (
1543
1682
  SELECT 1
@@ -1588,6 +1727,8 @@ BEGIN
1588
1727
  INSERT INTO log_curation_effects (
1589
1728
  operation_log_entry_id,
1590
1729
  target_log_entry_id,
1730
+ active_before,
1731
+ active_after,
1591
1732
  folded_before,
1592
1733
  folded_after,
1593
1734
  tags_added,
@@ -1596,8 +1737,10 @@ BEGIN
1596
1737
  SELECT
1597
1738
  NEW.id,
1598
1739
  target.id,
1599
- json_extract(selected.value, '$.before'),
1600
- json_extract(selected.value, '$.after'),
1740
+ json_extract(selected.value, '$.activeBefore'),
1741
+ json_extract(selected.value, '$.activeAfter'),
1742
+ json_extract(selected.value, '$.foldedBefore'),
1743
+ json_extract(selected.value, '$.foldedAfter'),
1601
1744
  COALESCE((
1602
1745
  SELECT json_group_array(ordered.tag)
1603
1746
  FROM (
@@ -1625,13 +1768,18 @@ BEGIN
1625
1768
  FROM json_each(NEW.attrs, '$.__plurnk_curation.targets') selected
1626
1769
  JOIN log_entries target ON target.id = json_extract(selected.value, '$.id');
1627
1770
 
1628
- UPDATE log_entries
1629
- SET folded = (
1630
- SELECT json_extract(selected.value, '$.after')
1771
+ UPDATE log_entry_projections
1772
+ SET active = (
1773
+ SELECT json_extract(selected.value, '$.activeAfter')
1631
1774
  FROM json_each(NEW.attrs, '$.__plurnk_curation.targets') selected
1632
- WHERE json_extract(selected.value, '$.id') = log_entries.id
1775
+ WHERE json_extract(selected.value, '$.id') = log_entry_projections.log_entry_id
1776
+ ),
1777
+ folded = (
1778
+ SELECT json_extract(selected.value, '$.foldedAfter')
1779
+ FROM json_each(NEW.attrs, '$.__plurnk_curation.targets') selected
1780
+ WHERE json_extract(selected.value, '$.id') = log_entry_projections.log_entry_id
1633
1781
  )
1634
- WHERE id IN (
1782
+ WHERE log_entry_id IN (
1635
1783
  SELECT json_extract(value, '$.id')
1636
1784
  FROM json_each(NEW.attrs, '$.__plurnk_curation.targets')
1637
1785
  );
@@ -1655,20 +1803,20 @@ BEGIN
1655
1803
  WHERE id = NEW.id;
1656
1804
  END;
1657
1805
 
1658
- -- Column-scoped immutability: the original action's identity and target never
1659
- -- change; the proposal lifecycle is allowed to mutate state, outcome,
1660
- -- status_rx, rx, folded. Keep attrs separate so the curation trigger's one
1661
- -- private-payload removal cannot exempt changes to any other core column.
1806
+ -- Column-scoped immutability: the original action's identity, target, and
1807
+ -- initial projection never change. Proposal lifecycle may mutate its outcome;
1808
+ -- curation state lives outside the event row. Keep attrs separate so the
1809
+ -- curation trigger's private-payload removal cannot exempt other columns.
1662
1810
  CREATE TRIGGER IF NOT EXISTS log_entries_immutable_core
1663
1811
  BEFORE UPDATE OF
1664
1812
  worker_id, loop_id, turn_id, sequence, at, origin, source, inherited_history, model_call_id,
1665
1813
  op, delimiter, signal,
1666
1814
  scheme, username, password, hostname,
1667
1815
  port, pathname, query, fragment,
1668
- lineMarker, tx, mimetype_tx, mimetype_rx
1816
+ lineMarker, tx, mimetype_tx, mimetype_rx, initial_folded
1669
1817
  ON log_entries
1670
1818
  BEGIN
1671
- SELECT RAISE(ABORT, 'log_entries core fields are immutable; only state/outcome/status_rx/rx/folded may change');
1819
+ SELECT RAISE(ABORT, 'log_entries core fields are immutable; only lifecycle outcome and derived attachments may change');
1672
1820
  END;
1673
1821
 
1674
1822
  CREATE TRIGGER IF NOT EXISTS log_entries_immutable_attrs
@@ -2098,10 +2246,15 @@ END;
2098
2246
  -- source. Composed at membership resolution; node:path.matchesGlob.
2099
2247
  CREATE TABLE IF NOT EXISTS workspace_constraints (
2100
2248
  workspace_id INTEGER NOT NULL,
2101
- effect TEXT NOT NULL CHECK (effect IN ('pick', 'hide', 'view')),
2249
+ -- include admits files git misses; exclude removes members — the members family's lexicon
2250
+ -- ({§members-projection}). An inclusion is a pattern scan; a creation record is one exact path.
2251
+ effect TEXT NOT NULL CHECK (effect IN ('include', 'exclude')),
2102
2252
  glob TEXT NOT NULL,
2103
- source TEXT NOT NULL CHECK (source IN ('explicit', 'create')),
2104
- CHECK (source = 'explicit' OR effect = 'pick'),
2253
+ -- create: the exact record of a file Plurnk wrote ({§fs-create-record}); members: a
2254
+ -- human-authored definition projected by the members family; model: a definition the model
2255
+ -- proposed under the members scope — never admitted past the repository's ignore rules.
2256
+ source TEXT NOT NULL CHECK (source IN ('create', 'members', 'model')),
2257
+ CHECK (source IN ('members', 'model') OR effect = 'include'),
2105
2258
  PRIMARY KEY (workspace_id, effect, glob),
2106
2259
  FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE
2107
2260
  ) STRICT, WITHOUT ROWID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plurnk/plurnk-service",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Plurnk agent runtime — the server / engine / core. Implements the @plurnk/plurnk-contracts contract.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -87,43 +87,41 @@
87
87
  "@opentelemetry/resources": "^2.10.0",
88
88
  "@opentelemetry/sdk-metrics": "^2.10.0",
89
89
  "@opentelemetry/sdk-trace-base": "^2.10.0",
90
- "@plurnk/gbnf": "1.10.0",
91
- "@plurnk/plurnk-a2a": "1.10.0",
92
- "@plurnk/plurnk-agui": "1.10.0",
93
- "@plurnk/plurnk-contracts": "1.10.0",
94
- "@plurnk/plurnk-execs": "1.10.0",
95
- "@plurnk/plurnk-execs-common": "1.10.0",
96
- "@plurnk/plurnk-execs-git": "1.10.0",
97
- "@plurnk/plurnk-execs-jq": "1.10.0",
98
- "@plurnk/plurnk-execs-sqlite": "1.10.0",
99
- "@plurnk/plurnk-execs-wasm": "1.10.0",
100
- "@plurnk/plurnk-hooks": "1.10.0",
101
- "@plurnk/plurnk-mcp": "1.10.0",
102
- "@plurnk/plurnk-meta": "1.10.0",
103
- "@plurnk/plurnk-mimetypes": "1.10.0",
104
- "@plurnk/plurnk-mimetypes-application-ipynb": "1.10.0",
105
- "@plurnk/plurnk-mimetypes-application-json": "1.10.0",
106
- "@plurnk/plurnk-mimetypes-application-jsonl": "1.10.0",
107
- "@plurnk/plurnk-mimetypes-application-xml": "1.10.0",
108
- "@plurnk/plurnk-mimetypes-embeddings": "1.10.0",
109
- "@plurnk/plurnk-mimetypes-text-csv": "1.10.0",
110
- "@plurnk/plurnk-mimetypes-text-diff": "1.10.0",
111
- "@plurnk/plurnk-mimetypes-text-dotenv": "1.10.0",
112
- "@plurnk/plurnk-mimetypes-text-html": "1.10.0",
113
- "@plurnk/plurnk-mimetypes-text-ini": "1.10.0",
114
- "@plurnk/plurnk-mimetypes-text-markdown": "1.10.0",
115
- "@plurnk/plurnk-mimetypes-text-plain": "1.10.0",
116
- "@plurnk/plurnk-models": "1.10.0",
117
- "@plurnk/plurnk-providers": "1.10.0",
118
- "@plurnk/plurnk-schemes": "1.10.0",
119
- "@plurnk/plurnk-schemes-http": "1.10.0",
90
+ "@plurnk/gbnf": "1.11.0",
91
+ "@plurnk/plurnk-a2a": "1.11.0",
92
+ "@plurnk/plurnk-agui": "1.11.0",
93
+ "@plurnk/plurnk-contracts": "1.11.0",
94
+ "@plurnk/plurnk-execs": "1.11.0",
95
+ "@plurnk/plurnk-execs-common": "1.11.0",
96
+ "@plurnk/plurnk-execs-jq": "1.11.0",
97
+ "@plurnk/plurnk-execs-sqlite": "1.11.0",
98
+ "@plurnk/plurnk-hooks": "1.11.0",
99
+ "@plurnk/plurnk-mcp": "1.11.0",
100
+ "@plurnk/plurnk-meta": "1.11.0",
101
+ "@plurnk/plurnk-mimetypes": "1.11.0",
102
+ "@plurnk/plurnk-mimetypes-application-ipynb": "1.11.0",
103
+ "@plurnk/plurnk-mimetypes-application-json": "1.11.0",
104
+ "@plurnk/plurnk-mimetypes-application-jsonl": "1.11.0",
105
+ "@plurnk/plurnk-mimetypes-application-xml": "1.11.0",
106
+ "@plurnk/plurnk-mimetypes-embeddings": "1.11.0",
107
+ "@plurnk/plurnk-mimetypes-text-csv": "1.11.0",
108
+ "@plurnk/plurnk-mimetypes-text-diff": "1.11.0",
109
+ "@plurnk/plurnk-mimetypes-text-dotenv": "1.11.0",
110
+ "@plurnk/plurnk-mimetypes-text-html": "1.11.0",
111
+ "@plurnk/plurnk-mimetypes-text-ini": "1.11.0",
112
+ "@plurnk/plurnk-mimetypes-text-markdown": "1.11.0",
113
+ "@plurnk/plurnk-mimetypes-text-plain": "1.11.0",
114
+ "@plurnk/plurnk-models": "1.11.0",
115
+ "@plurnk/plurnk-providers": "1.11.0",
116
+ "@plurnk/plurnk-schemes": "1.11.0",
117
+ "@plurnk/plurnk-schemes-http": "1.11.0",
120
118
  "@possumtech/sqlrite": "^6.5.2",
121
119
  "diff": "^9.0.0",
122
120
  "yaml": "^2.9.0"
123
121
  },
124
122
  "devDependencies": {
125
123
  "@opentelemetry/core": "^2.10.0",
126
- "@plurnk/plurnk-mimetypes-tokenizers": "1.10.0",
124
+ "@plurnk/plurnk-mimetypes-tokenizers": "1.11.0",
127
125
  "@types/diff": "^7.0.2"
128
126
  },
129
127
  "homepage": "https://github.com/plurnk/plurnk-service/tree/main/plurnk-core#readme",
@@ -1,7 +0,0 @@
1
- import { type LoopFlags } from "@plurnk/plurnk-contracts";
2
- import type { Db } from "./Db.ts";
3
- export default class LoopFlagsReader {
4
- static parse(raw: string, loopId: number): LoopFlags;
5
- static read(db: Db, loopId: number): Promise<LoopFlags>;
6
- }
7
- //# sourceMappingURL=LoopFlagsReader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoopFlagsReader.d.ts","sourceRoot":"","sources":["../../src/core/LoopFlagsReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,SAAS,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAIlC,MAAM,CAAC,OAAO,OAAO,eAAe;IAChC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAmBnD;IAED,OAAa,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAM5D;CACJ"}
@@ -1,33 +0,0 @@
1
- import { DEFAULT_LOOP_FLAGS, Validator, } from "@plurnk/plurnk-contracts";
2
- // {§loop-flags-effective-read} — persistence may contain a partial object, but
3
- // runtime policy is always the complete contracts-owned shape.
4
- export default class LoopFlagsReader {
5
- static parse(raw, loopId) {
6
- let partial;
7
- try {
8
- partial = JSON.parse(raw);
9
- }
10
- catch (cause) {
11
- throw new Error(`Loop ${loopId} has invalid persisted flags JSON.`, { cause });
12
- }
13
- if (partial === null || typeof partial !== "object" || Array.isArray(partial)) {
14
- throw new Error(`Loop ${loopId} has invalid persisted flags.`, {
15
- cause: new TypeError("Persisted loop flags must be a JSON object."),
16
- });
17
- }
18
- try {
19
- return Validator.assertLoopFlags({ ...DEFAULT_LOOP_FLAGS, ...partial });
20
- }
21
- catch (cause) {
22
- throw new Error(`Loop ${loopId} has invalid persisted flags.`, { cause });
23
- }
24
- }
25
- static async read(db, loopId) {
26
- const row = await db.engine_get_loop_flags.get({ loop_id: loopId });
27
- if (row === undefined) {
28
- throw new Error(`Loop ${loopId} does not exist while reading its persisted flags.`);
29
- }
30
- return LoopFlagsReader.parse(row.flags, loopId);
31
- }
32
- }
33
- //# sourceMappingURL=LoopFlagsReader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoopFlagsReader.js","sourceRoot":"","sources":["../../src/core/LoopFlagsReader.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,kBAAkB,EAClB,SAAS,GAEZ,MAAM,0BAA0B,CAAC;AAGlC,+EAA+E;AAC/E,+DAA+D;AAC/D,MAAM,CAAC,OAAO,OAAO,eAAe;IAChC,MAAM,CAAC,KAAK,CAAC,GAAW,EAAE,MAAc;QACpC,IAAI,OAAgB,CAAC;QACrB,IAAI,CAAC;YACD,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,QAAQ,MAAM,oCAAoC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACnF,CAAC;QAED,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5E,MAAM,IAAI,KAAK,CAAC,QAAQ,MAAM,+BAA+B,EAAE;gBAC3D,KAAK,EAAE,IAAI,SAAS,CAAC,6CAA6C,CAAC;aACtE,CAAC,CAAC;QACP,CAAC;QAED,IAAI,CAAC;YACD,OAAO,SAAS,CAAC,eAAe,CAAC,EAAE,GAAG,kBAAkB,EAAE,GAAG,OAAO,EAAe,CAAC,CAAC;QACzF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,QAAQ,MAAM,+BAA+B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9E,CAAC;IACL,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAM,EAAE,MAAc;QACpC,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,qBAAqB,CAAC,GAAG,CAAoB,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACvF,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,QAAQ,MAAM,oDAAoD,CAAC,CAAC;QACxF,CAAC;QACD,OAAO,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;CACJ"}
@@ -1,5 +0,0 @@
1
- import type { LoopFlags } from "./types.ts";
2
- export default class ResolveForLoop {
3
- static resolveForLoop(handlers: ReadonlyMap<string, object>, flags: LoopFlags): Set<string>;
4
- }
5
- //# sourceMappingURL=resolveForLoop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveForLoop.d.ts","sourceRoot":"","sources":["../../src/core/resolveForLoop.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,OAAO,OAAO,cAAc;IAC/B,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,CAE1F;CACJ"}