@plurnk/plurnk-service 1.4.0 → 1.6.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 (302) hide show
  1. package/.env.defaults +37 -31
  2. package/INSTALL.md +16 -11
  3. package/README.md +1 -0
  4. package/SPEC.md +631 -397
  5. package/dist/Paths.d.ts.map +1 -1
  6. package/dist/Paths.js +2 -3
  7. package/dist/Paths.js.map +1 -1
  8. package/dist/build-info.json +1 -1
  9. package/dist/content/edit-collision.d.ts +5 -0
  10. package/dist/content/edit-collision.d.ts.map +1 -0
  11. package/dist/content/edit-collision.js +14 -0
  12. package/dist/content/edit-collision.js.map +1 -0
  13. package/dist/content/edit-receipt.d.ts +3 -2
  14. package/dist/content/edit-receipt.d.ts.map +1 -1
  15. package/dist/content/edit-receipt.js +58 -13
  16. package/dist/content/edit-receipt.js.map +1 -1
  17. package/dist/content/index.d.ts +5 -1
  18. package/dist/content/index.d.ts.map +1 -1
  19. package/dist/content/index.js +4 -1
  20. package/dist/content/index.js.map +1 -1
  21. package/dist/content/line-anchors.d.ts +41 -0
  22. package/dist/content/line-anchors.d.ts.map +1 -0
  23. package/dist/content/line-anchors.js +191 -0
  24. package/dist/content/line-anchors.js.map +1 -0
  25. package/dist/content/line-marker.d.ts +7 -3
  26. package/dist/content/line-marker.d.ts.map +1 -1
  27. package/dist/content/line-marker.js +2 -1
  28. package/dist/content/line-marker.js.map +1 -1
  29. package/dist/content/matcher.d.ts +1 -1
  30. package/dist/content/matcher.d.ts.map +1 -1
  31. package/dist/content/matcher.js +2 -2
  32. package/dist/content/matcher.js.map +1 -1
  33. package/dist/content/read-projector.d.ts +20 -0
  34. package/dist/content/read-projector.d.ts.map +1 -0
  35. package/dist/content/read-projector.js +122 -0
  36. package/dist/content/read-projector.js.map +1 -0
  37. package/dist/content/read-resolve.d.ts +2 -7
  38. package/dist/content/read-resolve.d.ts.map +1 -1
  39. package/dist/content/read-resolve.js +32 -107
  40. package/dist/content/read-resolve.js.map +1 -1
  41. package/dist/core/BranchReceipt.d.ts +0 -1
  42. package/dist/core/BranchReceipt.d.ts.map +1 -1
  43. package/dist/core/BranchReceipt.js +0 -3
  44. package/dist/core/BranchReceipt.js.map +1 -1
  45. package/dist/core/BudgetReadout.d.ts.map +1 -1
  46. package/dist/core/BudgetReadout.js +9 -2
  47. package/dist/core/BudgetReadout.js.map +1 -1
  48. package/dist/core/ChannelWrite.d.ts +3 -0
  49. package/dist/core/ChannelWrite.d.ts.map +1 -1
  50. package/dist/core/ChannelWrite.js +3 -3
  51. package/dist/core/ChannelWrite.js.map +1 -1
  52. package/dist/core/ChannelWrite.sql +4 -3
  53. package/dist/core/CoreSchemeServices.d.ts +10 -2
  54. package/dist/core/CoreSchemeServices.d.ts.map +1 -1
  55. package/dist/core/CoreSchemeServices.js.map +1 -1
  56. package/dist/core/Dispatcher.d.ts +14 -8
  57. package/dist/core/Dispatcher.d.ts.map +1 -1
  58. package/dist/core/Dispatcher.js +656 -312
  59. package/dist/core/Dispatcher.js.map +1 -1
  60. package/dist/core/DurableStatement.d.ts.map +1 -1
  61. package/dist/core/DurableStatement.js +2 -0
  62. package/dist/core/DurableStatement.js.map +1 -1
  63. package/dist/core/Engine.d.ts +24 -18
  64. package/dist/core/Engine.d.ts.map +1 -1
  65. package/dist/core/Engine.js +620 -392
  66. package/dist/core/Engine.js.map +1 -1
  67. package/dist/core/Engine.sql +188 -119
  68. package/dist/core/ExecutableTools.d.ts +10 -0
  69. package/dist/core/ExecutableTools.d.ts.map +1 -0
  70. package/dist/core/ExecutableTools.js +41 -0
  71. package/dist/core/ExecutableTools.js.map +1 -0
  72. package/dist/core/ExecutorRegistry.d.ts +3 -3
  73. package/dist/core/ExecutorRegistry.d.ts.map +1 -1
  74. package/dist/core/ExecutorRegistry.js +2 -2
  75. package/dist/core/ExecutorRegistry.js.map +1 -1
  76. package/dist/core/LogBody.d.ts +4 -1
  77. package/dist/core/LogBody.d.ts.map +1 -1
  78. package/dist/core/LogBody.js +46 -2
  79. package/dist/core/LogBody.js.map +1 -1
  80. package/dist/core/LogEntryProjection.d.ts +14 -0
  81. package/dist/core/LogEntryProjection.d.ts.map +1 -0
  82. package/dist/core/LogEntryProjection.js +38 -0
  83. package/dist/core/LogEntryProjection.js.map +1 -0
  84. package/dist/core/LoopLifecycle.d.ts +1 -2
  85. package/dist/core/LoopLifecycle.d.ts.map +1 -1
  86. package/dist/core/LoopLifecycle.js +1 -4
  87. package/dist/core/LoopLifecycle.js.map +1 -1
  88. package/dist/core/LoopLifecycle.sql +1 -4
  89. package/dist/core/ModelCall.d.ts +27 -0
  90. package/dist/core/ModelCall.d.ts.map +1 -0
  91. package/dist/core/ModelCall.js +125 -0
  92. package/dist/core/ModelCall.js.map +1 -0
  93. package/dist/core/PacketBuilder.d.ts +13 -12
  94. package/dist/core/PacketBuilder.d.ts.map +1 -1
  95. package/dist/core/PacketBuilder.js +146 -118
  96. package/dist/core/PacketBuilder.js.map +1 -1
  97. package/dist/core/ProblemLog.d.ts.map +1 -1
  98. package/dist/core/ProblemLog.js +1 -0
  99. package/dist/core/ProblemLog.js.map +1 -1
  100. package/dist/core/ProposalLifecycle.d.ts.map +1 -1
  101. package/dist/core/ProposalLifecycle.js +3 -4
  102. package/dist/core/ProposalLifecycle.js.map +1 -1
  103. package/dist/core/ProviderInstantiate.d.ts.map +1 -1
  104. package/dist/core/ProviderInstantiate.js +23 -6
  105. package/dist/core/ProviderInstantiate.js.map +1 -1
  106. package/dist/core/SchemeRegistry.js +7 -7
  107. package/dist/core/SchemeRegistry.js.map +1 -1
  108. package/dist/core/StrikeRail.d.ts +5 -2
  109. package/dist/core/StrikeRail.d.ts.map +1 -1
  110. package/dist/core/StrikeRail.js +10 -7
  111. package/dist/core/StrikeRail.js.map +1 -1
  112. package/dist/core/TerminalResult.d.ts +16 -0
  113. package/dist/core/TerminalResult.d.ts.map +1 -0
  114. package/dist/core/TerminalResult.js +49 -0
  115. package/dist/core/TerminalResult.js.map +1 -0
  116. package/dist/core/caps/CapsResolve.d.ts +5 -1
  117. package/dist/core/caps/CapsResolve.d.ts.map +1 -1
  118. package/dist/core/caps/CapsResolve.js +9 -5
  119. package/dist/core/caps/CapsResolve.js.map +1 -1
  120. package/dist/core/caps/DbChannelCaps.d.ts +1 -1
  121. package/dist/core/caps/DbChannelCaps.d.ts.map +1 -1
  122. package/dist/core/caps/DbChannelCaps.js +6 -4
  123. package/dist/core/caps/DbChannelCaps.js.map +1 -1
  124. package/dist/core/caps/DbEntryCaps.d.ts +2 -1
  125. package/dist/core/caps/DbEntryCaps.d.ts.map +1 -1
  126. package/dist/core/caps/DbEntryCaps.js +21 -8
  127. package/dist/core/caps/DbEntryCaps.js.map +1 -1
  128. package/dist/core/caps/DbNotifyCaps.d.ts +1 -1
  129. package/dist/core/caps/DbNotifyCaps.d.ts.map +1 -1
  130. package/dist/core/caps/DbNotifyCaps.js +6 -4
  131. package/dist/core/caps/DbNotifyCaps.js.map +1 -1
  132. package/dist/core/caps/DbProjectionCaps.d.ts +1 -0
  133. package/dist/core/caps/DbProjectionCaps.d.ts.map +1 -1
  134. package/dist/core/caps/DbProjectionCaps.js +29 -0
  135. package/dist/core/caps/DbProjectionCaps.js.map +1 -1
  136. package/dist/core/caps/DbSubscriptionCaps.d.ts +4 -6
  137. package/dist/core/caps/DbSubscriptionCaps.d.ts.map +1 -1
  138. package/dist/core/caps/DbSubscriptionCaps.js +27 -13
  139. package/dist/core/caps/DbSubscriptionCaps.js.map +1 -1
  140. package/dist/core/caps/SchemeCtxImpl.d.ts +11 -3
  141. package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -1
  142. package/dist/core/caps/SchemeCtxImpl.js +10 -8
  143. package/dist/core/caps/SchemeCtxImpl.js.map +1 -1
  144. package/dist/core/fork.d.ts.map +1 -1
  145. package/dist/core/fork.js +23 -7
  146. package/dist/core/fork.js.map +1 -1
  147. package/dist/core/fork.sql +35 -14
  148. package/dist/core/git-iso.d.ts +3 -2
  149. package/dist/core/git-iso.d.ts.map +1 -1
  150. package/dist/core/git-iso.js +27 -12
  151. package/dist/core/git-iso.js.map +1 -1
  152. package/dist/core/git-membership.d.ts +1 -0
  153. package/dist/core/git-membership.d.ts.map +1 -1
  154. package/dist/core/git-membership.js +87 -26
  155. package/dist/core/git-membership.js.map +1 -1
  156. package/dist/core/git-state.d.ts +8 -1
  157. package/dist/core/git-state.d.ts.map +1 -1
  158. package/dist/core/git-state.js +36 -17
  159. package/dist/core/git-state.js.map +1 -1
  160. package/dist/core/namespace.d.ts +1 -0
  161. package/dist/core/namespace.d.ts.map +1 -1
  162. package/dist/core/namespace.js +20 -0
  163. package/dist/core/namespace.js.map +1 -1
  164. package/dist/core/optimistic-settlement.d.ts +2 -0
  165. package/dist/core/optimistic-settlement.d.ts.map +1 -0
  166. package/dist/core/optimistic-settlement.js +14 -0
  167. package/dist/core/optimistic-settlement.js.map +1 -0
  168. package/dist/core/packet-wire.d.ts +5 -2
  169. package/dist/core/packet-wire.d.ts.map +1 -1
  170. package/dist/core/packet-wire.js +318 -114
  171. package/dist/core/packet-wire.js.map +1 -1
  172. package/dist/core/provider-accounting.d.ts +24 -0
  173. package/dist/core/provider-accounting.d.ts.map +1 -0
  174. package/dist/core/provider-accounting.js +76 -0
  175. package/dist/core/provider-accounting.js.map +1 -0
  176. package/dist/core/results.d.ts +4 -2
  177. package/dist/core/results.d.ts.map +1 -1
  178. package/dist/core/results.js +6 -0
  179. package/dist/core/results.js.map +1 -1
  180. package/dist/core/scheme-types.d.ts +0 -12
  181. package/dist/core/scheme-types.d.ts.map +1 -1
  182. package/dist/core/scheme-types.js.map +1 -1
  183. package/dist/core/search-gate.d.ts +2 -2
  184. package/dist/core/search-gate.d.ts.map +1 -1
  185. package/dist/core/search-gate.js +8 -8
  186. package/dist/core/search-gate.js.map +1 -1
  187. package/dist/core/token-ruler.js +1 -1
  188. package/dist/core/token-ruler.js.map +1 -1
  189. package/dist/core/turn-scheduler.js +1 -1
  190. package/dist/core/turn-scheduler.js.map +1 -1
  191. package/dist/core/worker-ops.sql +4 -4
  192. package/dist/core/workspace-settings.js +1 -1
  193. package/dist/core/workspace-settings.js.map +1 -1
  194. package/dist/digest/Digest.d.ts.map +1 -1
  195. package/dist/digest/Digest.js +349 -76
  196. package/dist/digest/Digest.js.map +1 -1
  197. package/dist/digest/digest.sql +42 -16
  198. package/dist/schemes/Exec.d.ts +4 -4
  199. package/dist/schemes/Exec.d.ts.map +1 -1
  200. package/dist/schemes/Exec.js +167 -134
  201. package/dist/schemes/Exec.js.map +1 -1
  202. package/dist/schemes/ExecOutputScheme.d.ts +4 -5
  203. package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
  204. package/dist/schemes/ExecOutputScheme.js +12 -20
  205. package/dist/schemes/ExecOutputScheme.js.map +1 -1
  206. package/dist/schemes/File.d.ts +5 -6
  207. package/dist/schemes/File.d.ts.map +1 -1
  208. package/dist/schemes/File.js +35 -41
  209. package/dist/schemes/File.js.map +1 -1
  210. package/dist/schemes/Log.d.ts +16 -5
  211. package/dist/schemes/Log.d.ts.map +1 -1
  212. package/dist/schemes/Log.js +229 -262
  213. package/dist/schemes/Log.js.map +1 -1
  214. package/dist/schemes/Log.sql +50 -27
  215. package/dist/schemes/Prompt.d.ts +3 -4
  216. package/dist/schemes/Prompt.d.ts.map +1 -1
  217. package/dist/schemes/Prompt.js +5 -5
  218. package/dist/schemes/Prompt.js.map +1 -1
  219. package/dist/schemes/Skill.d.ts +4 -5
  220. package/dist/schemes/Skill.d.ts.map +1 -1
  221. package/dist/schemes/Skill.js +3 -3
  222. package/dist/schemes/Skill.js.map +1 -1
  223. package/dist/schemes/Worker.d.ts +7 -7
  224. package/dist/schemes/Worker.d.ts.map +1 -1
  225. package/dist/schemes/Worker.js +99 -84
  226. package/dist/schemes/Worker.js.map +1 -1
  227. package/dist/schemes/_entry-crud.d.ts +2 -2
  228. package/dist/schemes/_entry-crud.d.ts.map +1 -1
  229. package/dist/schemes/_entry-crud.js +29 -10
  230. package/dist/schemes/_entry-crud.js.map +1 -1
  231. package/dist/schemes/_entry-crud.sql +11 -17
  232. package/dist/schemes/_entry-find.d.ts +41 -14
  233. package/dist/schemes/_entry-find.d.ts.map +1 -1
  234. package/dist/schemes/_entry-find.js +159 -166
  235. package/dist/schemes/_entry-find.js.map +1 -1
  236. package/dist/schemes/_entry-find.sql +2 -21
  237. package/dist/schemes/_entry-graph.sql +1 -1
  238. package/dist/schemes/_entry-manifest.d.ts +5 -17
  239. package/dist/schemes/_entry-manifest.d.ts.map +1 -1
  240. package/dist/schemes/_entry-manifest.js +28 -24
  241. package/dist/schemes/_entry-manifest.js.map +1 -1
  242. package/dist/schemes/_entry-ops.d.ts +13 -8
  243. package/dist/schemes/_entry-ops.d.ts.map +1 -1
  244. package/dist/schemes/_entry-ops.js +98 -119
  245. package/dist/schemes/_entry-ops.js.map +1 -1
  246. package/dist/schemes/_entry-ops.sql +31 -6
  247. package/dist/schemes/_entry-semantic.d.ts +5 -7
  248. package/dist/schemes/_entry-semantic.d.ts.map +1 -1
  249. package/dist/schemes/_entry-semantic.js +10 -31
  250. package/dist/schemes/_entry-semantic.js.map +1 -1
  251. package/dist/schemes/_entry-semantic.sql +2 -2
  252. package/dist/schemes/_entry-send.js +4 -4
  253. package/dist/schemes/_entry-send.js.map +1 -1
  254. package/dist/schemes/_search-index.d.ts.map +1 -1
  255. package/dist/schemes/_search-index.js +16 -6
  256. package/dist/schemes/_search-index.js.map +1 -1
  257. package/dist/schemes/exec-abort.js +2 -2
  258. package/dist/schemes/exec-abort.js.map +1 -1
  259. package/dist/server/BranchBatches.d.ts +1 -0
  260. package/dist/server/BranchBatches.d.ts.map +1 -1
  261. package/dist/server/BranchBatches.js +1 -0
  262. package/dist/server/BranchBatches.js.map +1 -1
  263. package/dist/server/Daemon.d.ts +6 -8
  264. package/dist/server/Daemon.d.ts.map +1 -1
  265. package/dist/server/Daemon.js +238 -68
  266. package/dist/server/Daemon.js.map +1 -1
  267. package/dist/server/DaemonModule.d.ts +3 -3
  268. package/dist/server/DaemonModule.d.ts.map +1 -1
  269. package/dist/server/branch-batch.sql +3 -1
  270. package/dist/server/client-input.d.ts +2 -1
  271. package/dist/server/client-input.d.ts.map +1 -1
  272. package/dist/server/client-input.js +7 -1
  273. package/dist/server/client-input.js.map +1 -1
  274. package/dist/server/drain.sql +8 -7
  275. package/dist/server/envelope.d.ts +0 -2
  276. package/dist/server/envelope.d.ts.map +1 -1
  277. package/dist/server/envelope.js +0 -1
  278. package/dist/server/envelope.js.map +1 -1
  279. package/dist/server/envelope.sql +3 -4
  280. package/dist/server/lifecycle-recovery.sql +44 -1
  281. package/dist/server/logEntry.d.ts +2 -1
  282. package/dist/server/logEntry.d.ts.map +1 -1
  283. package/dist/server/logEntry.js +15 -2
  284. package/dist/server/logEntry.js.map +1 -1
  285. package/dist/server/logEntry.sql +5 -1
  286. package/dist/service.d.ts.map +1 -1
  287. package/dist/service.js +13 -1
  288. package/dist/service.js.map +1 -1
  289. package/migrations/001_schema.sql +730 -221
  290. package/package.json +53 -46
  291. package/dist/core/BudgetOverflow.d.ts +0 -23
  292. package/dist/core/BudgetOverflow.d.ts.map +0 -1
  293. package/dist/core/BudgetOverflow.js +0 -61
  294. package/dist/core/BudgetOverflow.js.map +0 -1
  295. package/dist/core/caps/DbTagCaps.d.ts +0 -10
  296. package/dist/core/caps/DbTagCaps.d.ts.map +0 -1
  297. package/dist/core/caps/DbTagCaps.js +0 -44
  298. package/dist/core/caps/DbTagCaps.js.map +0 -1
  299. package/dist/matrix/live-specimen.d.ts +0 -9
  300. package/dist/matrix/live-specimen.d.ts.map +0 -1
  301. package/dist/matrix/live-specimen.js +0 -37
  302. package/dist/matrix/live-specimen.js.map +0 -1
package/.env.defaults CHANGED
@@ -42,6 +42,9 @@ PLURNK_HOST=127.0.0.1
42
42
  PLURNK_PORT=3044
43
43
 
44
44
  # --- Loop control ---
45
+ # Optional default child-provider alias. Unset = each WORK/FORK child inherits
46
+ # its spawning loop's provider. Clients may override this per top-level loop.
47
+ # PLURNK_MODEL_CHILD=fast
45
48
  # Operator turn ceiling. -1 (default) = no cap (loops end via SEND, budget,
46
49
  # strikes, or cycle detection). A positive value is an inviolable hard cap a
47
50
  # CoreSeam runLoop({maxTurns}) request cannot exceed (min wins).
@@ -51,6 +54,8 @@ PLURNK_SERVICE_MAX_TURNS=-1
51
54
  # is an operator ceiling a client may tighten per workspace via workspace.create settings.maxCommands
52
55
  # (min wins), never raise past (#232).
53
56
  PLURNK_SERVICE_MAX_COMMANDS=-1
57
+ # Live & demo test harness story timeout (ms) — 10 minutes (600000ms).
58
+ PLURNK_SERVICE_LIVE_TIMEOUT=600000
54
59
  # Proposal resolution bound (ms). Empty = a stopped world waits for its human indefinitely;
55
60
  # a finite positive value auto-cancels unattended (outcome=timeout). Every other explicit
56
61
  # value is invalid and fails at the proposal lifecycle owner.
@@ -61,12 +66,11 @@ PLURNK_SERVICE_PROPOSAL_TIMEOUT_MS=
61
66
  # that effect class.
62
67
  PLURNK_SERVICE_EXEC_HOLD=search,images,videos,news,map,music,it,science,social,downloadable
63
68
  PLURNK_SERVICE_EXEC_HOLD_MS=300000
64
- # Post-EXEC breath: after a turn fires a non-inline EXEC whose spawn is still in
65
- # flight at the turn boundary, wait this many ms before assembling the next packet
66
- # so a fast exec's output can land in it instead of a turn later. A fixed grace
67
- # beat, NOT a wait-for-completion (slow execs proceed + surface via the wake path).
68
- # 0 = off (the model sees fast-exec output a turn late, as today).
69
- PLURNK_SERVICE_EXEC_WAIT_MS=1000
69
+ # Optimistic worker settlement: before model dispatch, allow newly started
70
+ # streams or a completion wake with live siblings this many ms to quiesce.
71
+ # Settlement ends immediately at quiescence and never extends its first
72
+ # deadline; survivors follow the monitored lifecycle. 0 = off.
73
+ PLURNK_SERVICE_OPTIMISTIC_WAIT_MS=5000
70
74
  # Exec poll backoff (#521, {§exec-poll}): a parked exec with NO explicit `<,P>` cadence is no longer
71
75
  # park-blind-forever — the loop wakes on an exponential backoff so the model regains a turn to read
72
76
  # partial output and re-park a slow long-runner or KILL a stuck one. Wake N fires at BASE·2^min(N,TURNS-1)
@@ -93,7 +97,7 @@ PLURNK_SERVICE_LOOP_TIMEOUT=86400000
93
97
  # Maximum characters retained from caught runtime diagnostics in a model-facing
94
98
  # Problem detail. Complete errors remain in daemon diagnostics.
95
99
  PLURNK_SERVICE_ERROR_DETAIL_LIMIT=512
96
- PLURNK_SERVICE_MAX_STRIKES=3
100
+ PLURNK_SERVICE_MAX_STRIKES=6
97
101
  # Completed responses that do not form a valid PLAN...SEND turn are retried
98
102
  # beneath the same engine turn and against the identical packet.
99
103
  PLURNK_SERVICE_EMISSION_ATTEMPTS=3
@@ -127,12 +131,16 @@ PLURNK_SERVICE_GIT_ISO=0
127
131
  # optional in-process reader does not use this bound.
128
132
  PLURNK_SERVICE_GIT_OUTPUT_MAX_BYTES=67108864
129
133
 
130
- # Universal OPEN-body preview bounds. Only model-origin READ/FIND results render
131
- # complete; every other log body renders at most this many lines and characters.
132
- # A truncated body carries the log URI for a deliberate full READ. Separate
133
- # bounds prevent both multiline floods and single-line bombs.
134
+ # Ordinary bounded OPEN-body projection. READ/FIND results and PLAN working
135
+ # memory render complete; prompt initialization uses its separate budget share.
136
+ # Every remaining log body renders at most these independent line and character
137
+ # bounds. A truncated body carries its canonical log URI.
134
138
  PLURNK_SERVICE_PREVIEW_LINES=16
135
- PLURNK_SERVICE_PREVIEW_CHARS=1280
139
+ PLURNK_SERVICE_PREVIEW_CHARS=2560
140
+
141
+ # Number of complete neighboring lines hashed on each side of a model-facing
142
+ # line anchor. 0 authenticates only the addressed line.
143
+ PLURNK_SERVICE_LINE_ANCHOR_CONTEXT_LINES=2
136
144
 
137
145
  # --- Reference docs (auto-READ at turn 0) ---
138
146
  # PLURNK_SERVICE_MD_<ALIAS>=<path> materializes <path>'s markdown as a
@@ -148,9 +156,9 @@ PLURNK_SERVICE_PREVIEW_CHARS=1280
148
156
  # Turn-0 catalog preview so a run opens oriented, not blank. Folder-capable schemes use
149
157
  # FIND(<scheme>:///*): direct entries plus exact dir/** summaries carrying each subtree's
150
158
  # recursive item and token counts. Curated kernel docs remain recursive, demonstrating both
151
- # navigation forms. -1 = complete shallow maps; N = first N file-map rows (other schemes remain
152
- # complete); 0 = preview off. Service-wide default; a client overrides per workspace through
153
- # workspace.create settings.filesItems (#231).
159
+ # navigation forms. -1 = each ordinary FIND's markerless first page; N = an explicit first-N
160
+ # project-file page (other schemes remain markerless); 0 = preview off. Service-wide default;
161
+ # a client overrides per workspace through workspace.create settings.filesItems (#231).
154
162
  PLURNK_SERVICE_FILES_ITEMS=-1
155
163
 
156
164
  # Number of full SHA-256 revision characters rendered on each model-facing
@@ -162,8 +170,8 @@ PLURNK_SERVICE_EDIT_RECEIPT_REVISION_CHARS=8
162
170
  # The durable batch retains complete commit ids; this is display-only.
163
171
  PLURNK_SERVICE_BRANCH_RECEIPT_REVISION_CHARS=8
164
172
 
165
- # Number of neighboring lines (or top-level JSON items) rendered on each side
166
- # of an EDIT's resulting range. The model can READ for arbitrary final content.
173
+ # Number of surrounding and landed lines shown at each boundary of an EDIT
174
+ # result. Overlapping windows coalesce; the model can READ omitted content.
167
175
  PLURNK_SERVICE_EDIT_RECEIPT_CONTEXT_LINES=2
168
176
 
169
177
  # Workspace-tier ceiling on CONCURRENT active runs (a run with a non-terminal loop)
@@ -173,16 +181,21 @@ PLURNK_SERVICE_EDIT_RECEIPT_CONTEXT_LINES=2
173
181
  PLURNK_SERVICE_WORKSPACE_WORKERS_MAX_ACTIVE=-1
174
182
 
175
183
  # --- Prompt budget and packing safety — PER ALIAS (#352) ---
176
- # Providers report physical context and response capacity. Core's natural prompt budget is the
177
- # remaining physical input room after the response envelope and SAFETY margin.
184
+ # Providers report the effective total context envelope and generation capacity. Core's natural
185
+ # prompt gauge is the remaining input room after the generation envelope and SAFETY margin.
178
186
  #
179
- # PROMPT_BUDGET is optional virtual pressure: it makes the model-facing gauge and grinder enforce
180
- # a smaller input budget without changing provider context or generation settings. Unset uses the
181
- # natural physical prompt budget; a set value can only tighten it. Both core knobs resolve per
187
+ # PROMPT_BUDGET is optional virtual pressure: it tightens the model-facing gauge and grinder
188
+ # without changing hard context admission or generation settings. Unset uses the natural prompt
189
+ # gauge; a set value can only tighten it. Both core knobs resolve per
182
190
  # alias: _<alias> wins over bare.
183
191
  # The retired PLURNK_SERVICE_{CONTEXT_WINDOW,REASONING,COMPLETION} names FAIL HARD at boot naming
184
192
  # their successors — a stale .env never silently loses its envelope.
185
193
  # PLURNK_SERVICE_PROMPT_BUDGET=128000
194
+ # Maximum aggregate share of the stable model-facing prompt gauge used by
195
+ # automatic OPEN prompt bodies. The complete prompt remains stored and
196
+ # READ/FIND-addressable; this controls projection, not prompt admission.
197
+ # Alias-scoped overrides follow the ordinary _<alias> convention.
198
+ PLURNK_SERVICE_PROMPT_PROJECTION=25%
186
199
  PLURNK_SERVICE_SAFETY=1024
187
200
  #
188
201
  # LOCAL aliases (llama-server): the window is PROBED and the reserves DERIVE from it in the
@@ -212,8 +225,8 @@ PLURNK_SERVICE_DOCS_EXCLUDE="plurnk,file,exec"
212
225
  # PLURNK_SERVICE_POLICY=
213
226
  # PLURNK_SERVICE_PROJECT — a per-project policy markdown (relative to projectRoot). Unset = <root>/AGENTS.md.
214
227
  # PLURNK_SERVICE_PROJECT=
215
- # PLURNK_SERVICE_REQUIREMENTS — override the requirements.md recency-footer path (relative to the package
216
- # root). Unset = the packaged requirements.md.
228
+ # PLURNK_SERVICE_REQUIREMENTS — Recap source override (relative to the package root).
229
+ # Unset = the packaged requirements.md.
217
230
  # PLURNK_SERVICE_REQUIREMENTS=
218
231
 
219
232
  # --- Semantic search (~query chunking) ---
@@ -221,9 +234,6 @@ PLURNK_SERVICE_DOCS_EXCLUDE="plurnk,file,exec"
221
234
  # body is fully searchable, not truncated. Chunking requires the embedder's exact
222
235
  # counter or an exact fallback tokenizer; an estimate refuses semantic derivation.
223
236
  # The chunk knobs are read only when an embedder declares its input window.
224
- # Ranked results returned by a markerless `FIND(...):~query:FIND`. A positive
225
- # integer `<K>` overrides this count; a decimal marker selects by similarity.
226
- PLURNK_SERVICE_SEMANTIC_TOP_K=10
227
237
  # Chunk budget in TOKENS. EMPTY (the default) = the installed embedder's reported
228
238
  # window — NO model-specific number is assumed, so it scales to whatever embedder you
229
239
  # install. Set a positive value ONLY to cap below the window (e.g. to sweep
@@ -246,10 +256,6 @@ PLURNK_SERVICE_SEARCH_RUNTIMES=search
246
256
  # Per-turn search flood cap: the (N+1)th search EXEC in one turn is refused 429 (dedup of
247
257
  # identical queries is unconditional and separate — it strikes and serves the prior results).
248
258
  PLURNK_SERVICE_SEARCH_MAX_PER_TURN=3
249
- # FIND match-render budget: a FIND whose match set exceeds this returns a COUNT + narrow-your-query
250
- # steer instead of enumerating every match ({§find-count-not-contents}) — a repo-scale FIND(**) over
251
- # a 19k-entry workspace grinds clean instead of overflowing the window. 0/unset = no gate.
252
- PLURNK_SERVICE_FIND_MAX_MATCHES=500
253
259
  # Comma-separated file pathname patterns omitted from search derivations. Content remains directly
254
260
  # readable. Patterns without `/` match the basename; patterns with `/` match the full pathname.
255
261
  # Uses body-matcher glob syntax; the first match is the observable exclusion reason. Empty = none.
package/INSTALL.md CHANGED
@@ -40,11 +40,14 @@ When a value is required, an unset or retired name fails boot naming the violate
40
40
 
41
41
  These are relationships *between* flags. Set them as a unit.
42
42
 
43
- - **Provider capacity and PLURNK pressure are separate.** Providers report
44
- physical context and response capacity. Core derives the natural input
45
- budget from those facts. Optional `PLURNK_SERVICE_PROMPT_BUDGET_<alias>`
43
+ - **Hard capacity and PLURNK pressure are separate.** Providers report the
44
+ effective total context envelope and generation capacity. Core derives the
45
+ natural prompt gauge from those facts. Optional `PLURNK_SERVICE_PROMPT_BUDGET_<alias>`
46
46
  only tightens the model-facing gauge and grinder; it is never sent to the
47
- provider and never changes generation settings.
47
+ provider and never changes hard admission or generation settings.
48
+ `PLURNK_SERVICE_PROMPT_PROJECTION_<alias>` assigns a stable percentage of
49
+ that gauge to automatic prompt bodies; it never limits stored prompt size
50
+ ({§prompt-projection}).
48
51
  - **Reasoning capacity is request-scoped on llama-server.**
49
52
  `PLURNK_PROVIDERS_REASONING_RESERVE_<alias>` is the adaptive cumulative
50
53
  response allowance. An explicit `PLURNK_PROVIDERS_REASONING_BUDGET_<alias>`
@@ -63,7 +66,7 @@ These are relationships *between* flags. Set them as a unit.
63
66
 
64
67
  ## Profiles (examples, not a decision tree — adapt to the real box)
65
68
 
66
- - **Local GPU (llama-server).** `PLURNK_MODEL_local="openai/<name>"`, `OPENAI_BASE_URL=http://127.0.0.1:<port>`, `PLURNK_MODEL=local`, `PLURNK_PROVIDERS_GBNF_local=plurnk.gbnf`. The provider detects llama-server, verifies its GBNF transport, and derives a request-scoped reasoning allowance from the detected window. Add `PLURNK_PROVIDERS_LLAMA_SERVER_local=1` only when the endpoint cannot be fingerprinted reliably.
69
+ - **Local GPU (llama-server).** `PLURNK_MODEL_local="openai/<name>"`, `OPENAI_BASE_URL=http://127.0.0.1:<port>`, `PLURNK_MODEL=local`, `PLURNK_PROVIDERS_GBNF_local=plurnk.qwen.gbnf` for Qwen's template-prefilled `<think>` protocol (or `plurnk.gemma.gbnf` when Gemma generates a complete Harmony channel). The provider detects llama-server, verifies its GBNF transport, and derives a request-scoped reasoning allowance from the detected window. Add `PLURNK_PROVIDERS_LLAMA_SERVER_local=1` only when the endpoint cannot be fingerprinted reliably.
67
70
  - **Cloud, bring-your-own-key.** `PLURNK_MODEL_cloud="openrouter/<model>"`, `OPENROUTER_API_KEY=…`, `PLURNK_MODEL=cloud`. No local GBNF or `LLAMA_SERVER` pin.
68
71
  - **plurnk.ai endpoint.** `PLURNK_MODEL_plurnk="plurnk/plurnk"`, `PLURNK_API_KEY=…`, `PLURNK_MODEL=plurnk`.
69
72
  - **Headless / CI / constrained container.** A CPU-only box should NOT disable semantic search — it should point derivation at a real embedder: `PLURNK_MIMETYPES_EMBED_BASE_URL` (any OpenAI-compatible `/v1/embeddings` — a host GPU turns a CPU-hours corpus grind into seconds). Weak hardware is the target workload, not a reason to shed capability; `PLURNK_SERVICE_EMBED_DISABLE=1` exists for test lanes that deterministically assert non-semantic behavior, nothing else. Consider `PLURNK_SERVICE_MAX_TURNS=<n>` as a cost cap, `PLURNK_SERVICE_GIT_ALLOWED=0` to lock out git in a sandbox.
@@ -74,21 +77,23 @@ Each mirrors a `# --- section ---` in the floor; consult the floor for exact def
74
77
 
75
78
  - **Storage** — `PLURNK_SERVICE_DB_PATH`, and the optional `PLURNK_SERVICE_SQLITE_*` passthroughs (sqlrite already sets a safe WAL posture; tune only for a hot/large DB).
76
79
  - **Daemon transport** — bare `PLURNK_HOST`/`PLURNK_PORT`: THE client surface (the AG-UI+ listener, bound by the plurnk-agui module at boot). Production is single-listener; every first-party client rides it.
77
- - **Model aliases** — bare `PLURNK_MODEL` selects the active provider; `PLURNK_MODEL_<alias>` defines one; `PLURNK_BASEURL_<alias>` overrides its endpoint. The front door — keep these bare and short.
78
- - **Loop control / engine rails** — `PLURNK_SERVICE_MAX_TURNS` (−1 = uncapped), `_MAX_COMMANDS`, `_MAX_STRIKES`, `_EMISSION_ATTEMPTS`, `_MIN_CYCLES`, `_MAX_CYCLE_PERIOD`, `_LOOP_TIMEOUT`, `_PROPOSAL_TIMEOUT_MS`, `_EXEC_HOLD`, `_EXEC_WAIT_MS`, `_EXEC_POLL_SEC`/`_TURNS`, `_EXEC_KILL_GRACE_MS`, `_WORKSPACE_WORKERS_MAX_ACTIVE`.
80
+ - **Model aliases** — bare `PLURNK_MODEL` selects the active provider; `PLURNK_MODEL_<alias>` defines one; `PLURNK_BASEURL_<alias>` overrides its endpoint. Optional `PLURNK_MODEL_CHILD=<alias>` selects WORK/FORK descendants; unset inherits the spawning loop's provider. The front door — keep these bare and short.
81
+ - **Loop control / engine rails** — `PLURNK_SERVICE_MAX_TURNS` (−1 = uncapped), `_MAX_COMMANDS`, `_MAX_STRIKES`, `_EMISSION_ATTEMPTS`, `_MIN_CYCLES`, `_MAX_CYCLE_PERIOD`, `_LOOP_TIMEOUT`, `_PROPOSAL_TIMEOUT_MS`, `_EXEC_HOLD`, `_OPTIMISTIC_WAIT_MS`, `_EXEC_POLL_SEC`/`_TURNS`, `_EXEC_KILL_GRACE_MS`, `_WORKSPACE_WORKERS_MAX_ACTIVE`.
79
82
  - **Git** — `PLURNK_SERVICE_GIT_ALLOWED` (0 = hard sandbox lockout), `_GIT_AUTO`.
80
- - **Packet / reference docs** — `PLURNK_SERVICE_FILES_ITEMS` (turn-0 shallow file-map cap), `_PREVIEW_LINES`/`_PREVIEW_CHARS`, `_EDIT_RECEIPT_REVISION_CHARS`/`_CONTEXT_LINES`, `_BRANCH_RECEIPT_REVISION_CHARS`, `_DOCS_EXCLUDE`, `_PACKET_INJECT` (operator markdown section), `_POLICY`/`_PROJECT`/`_REQUIREMENTS` (policy + footer overrides), `_MD_<alias>` (materialized reference entry).
83
+ - **Packet / reference docs** — `PLURNK_SERVICE_FILES_ITEMS` (turn-0 shallow file-map cap), `_PREVIEW_LINES`/`_PREVIEW_CHARS`, `_LINE_ANCHOR_CONTEXT_LINES`, `_EDIT_RECEIPT_REVISION_CHARS`/`_CONTEXT_LINES`, `_BRANCH_RECEIPT_REVISION_CHARS`, `_DOCS_EXCLUDE`, `_PACKET_INJECT` (operator markdown section), `_POLICY`/`_PROJECT` (policy overrides), `_REQUIREMENTS` (Recap-source override), `_MD_<alias>` (materialized reference entry).
81
84
  - **Providers** — the portable provider knobs and defaults are defined by
82
85
  `@plurnk/plurnk-providers/.env.defaults`; any provider knob may take an alias
83
86
  suffix that wins over the bare fallback.
84
87
  - **Provider capacity and prompt budget** —
85
88
  `PLURNK_PROVIDERS_CONTEXT_WINDOW`/`_REASONING_RESERVE`/`_COMPLETION_RESERVE`
86
89
  describe provider capacity. `PLURNK_SERVICE_PROMPT_BUDGET` applies optional
87
- virtual pressure; `PLURNK_SERVICE_SAFETY` is the packing margin.
90
+ virtual pressure; `PLURNK_SERVICE_PROMPT_PROJECTION` assigns the automatic
91
+ prompt-body share; `PLURNK_SERVICE_SAFETY` is the packing margin.
88
92
  - **Plugins** — bare `PLURNK_PLUGINS_TRUSTED_ONLY` (0/unset = load all installed; a value = `@plurnk/*` plus an allowlist).
89
- - **Semantic search** — `PLURNK_SERVICE_SEMANTIC_TOP_K` (markerless result count), `_SEMANTIC_CHUNK_TOKENS`/`_CHUNK_OVERLAP` (service-side chunking), `PLURNK_SERVICE_EMBED_DISABLE` (FTS-only), `PLURNK_MIMETYPES_EMBED_WORKERS` (the embedder's pool — mimetypes-owned).
90
- - **Schemes: http** — `PLURNK_SCHEMES_HTTP_FETCH_TIMEOUT`/`_SALVAGE_MIN_BODY_CHARS`/`_IDLE_TIMEOUT` (required on the HTML render path), optional Playwright/Chromium knobs.
93
+ - **Semantic search** — `PLURNK_SERVICE_SEMANTIC_CHUNK_TOKENS`/`_CHUNK_OVERLAP` (service-side chunking), `PLURNK_SERVICE_EMBED_DISABLE` (FTS-only), `PLURNK_MIMETYPES_EMBED_WORKERS` (the embedder's pool — mimetypes-owned).
94
+ - **Schemes: http** — `PLURNK_SCHEMES_HTTP_FETCH_TIMEOUT`, `_TTL_MS`, optional `# TAVILY_API_KEY=`, and `PLURNK_SCHEMES_HTTP_TAVILY_DEPTH`/`_TAVILY_TIMEOUT_MS`.
91
95
  - **Execs** - `PLURNK_EXECS_<runtime>=0` disables a runtime; `PLURNK_EXECS_SEARCH_SEARXNG_URL` enables web search (unset = search off).
96
+ - **Hooks** — `PLURNK_HOOKS_COMMAND` plus JSON `PLURNK_HOOKS_ARGS` invokes one exact no-shell command for the core events selected by `PLURNK_HOOKS_EVENTS`; see `@plurnk/plurnk-hooks/README.md`.
92
97
  - **Observability** — standard `OTEL_*` env ({§observability-boundary}):
93
98
  `OTEL_TRACES_EXPORTER`/`OTEL_METRICS_EXPORTER` (`otlp` or `console`; unset
94
99
  keeps the signal off), `OTEL_SERVICE_NAME` (default `plurnk-service`),
package/README.md CHANGED
@@ -47,6 +47,7 @@ imports `@plurnk/plurnk-service/digest`.
47
47
  - `@plurnk/plurnk-schemes` — addressable resource contract.
48
48
  - `@plurnk/plurnk-mimetypes` — content handling contract.
49
49
  - `@plurnk/plurnk-execs` — executable capability contract.
50
+ - `@plurnk/plurnk-hooks` — selected lifecycle events delivered to exact commands.
50
51
 
51
52
  ## Observability
52
53