@plurnk/plurnk-service 1.0.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 (343) hide show
  1. package/.env.defaults +208 -0
  2. package/INSTALL.md +69 -0
  3. package/LICENSE +21 -0
  4. package/README.md +46 -0
  5. package/SPEC.md +1511 -0
  6. package/dist/Paths.d.ts +13 -0
  7. package/dist/Paths.d.ts.map +1 -0
  8. package/dist/Paths.js +60 -0
  9. package/dist/Paths.js.map +1 -0
  10. package/dist/content/edited-span.d.ts +2 -0
  11. package/dist/content/edited-span.d.ts.map +1 -0
  12. package/dist/content/edited-span.js +33 -0
  13. package/dist/content/edited-span.js.map +1 -0
  14. package/dist/content/index.d.ts +10 -0
  15. package/dist/content/index.d.ts.map +1 -0
  16. package/dist/content/index.js +11 -0
  17. package/dist/content/index.js.map +1 -0
  18. package/dist/content/line-marker.d.ts +15 -0
  19. package/dist/content/line-marker.d.ts.map +1 -0
  20. package/dist/content/line-marker.js +21 -0
  21. package/dist/content/line-marker.js.map +1 -0
  22. package/dist/content/matcher.d.ts +44 -0
  23. package/dist/content/matcher.d.ts.map +1 -0
  24. package/dist/content/matcher.js +126 -0
  25. package/dist/content/matcher.js.map +1 -0
  26. package/dist/content/mimetype-binary.d.ts +8 -0
  27. package/dist/content/mimetype-binary.d.ts.map +1 -0
  28. package/dist/content/mimetype-binary.js +17 -0
  29. package/dist/content/mimetype-binary.js.map +1 -0
  30. package/dist/content/path-mimetype.d.ts +5 -0
  31. package/dist/content/path-mimetype.d.ts.map +1 -0
  32. package/dist/content/path-mimetype.js +15 -0
  33. package/dist/content/path-mimetype.js.map +1 -0
  34. package/dist/content/read-resolve.d.ts +20 -0
  35. package/dist/content/read-resolve.d.ts.map +1 -0
  36. package/dist/content/read-resolve.js +68 -0
  37. package/dist/content/read-resolve.js.map +1 -0
  38. package/dist/core/ChannelWrite.d.ts +100 -0
  39. package/dist/core/ChannelWrite.d.ts.map +1 -0
  40. package/dist/core/ChannelWrite.js +112 -0
  41. package/dist/core/ChannelWrite.js.map +1 -0
  42. package/dist/core/ChannelWrite.sql +84 -0
  43. package/dist/core/Db.d.ts +14 -0
  44. package/dist/core/Db.d.ts.map +1 -0
  45. package/dist/core/Db.js +7 -0
  46. package/dist/core/Db.js.map +1 -0
  47. package/dist/core/Dispatcher.d.ts +67 -0
  48. package/dist/core/Dispatcher.d.ts.map +1 -0
  49. package/dist/core/Dispatcher.js +1021 -0
  50. package/dist/core/Dispatcher.js.map +1 -0
  51. package/dist/core/Engine.d.ts +113 -0
  52. package/dist/core/Engine.d.ts.map +1 -0
  53. package/dist/core/Engine.js +1410 -0
  54. package/dist/core/Engine.js.map +1 -0
  55. package/dist/core/Engine.sql +538 -0
  56. package/dist/core/EnvFlags.d.ts +13 -0
  57. package/dist/core/EnvFlags.d.ts.map +1 -0
  58. package/dist/core/EnvFlags.js +84 -0
  59. package/dist/core/EnvFlags.js.map +1 -0
  60. package/dist/core/ExecutorRegistry.d.ts +45 -0
  61. package/dist/core/ExecutorRegistry.d.ts.map +1 -0
  62. package/dist/core/ExecutorRegistry.js +128 -0
  63. package/dist/core/ExecutorRegistry.js.map +1 -0
  64. package/dist/core/PacketBuilder.d.ts +67 -0
  65. package/dist/core/PacketBuilder.d.ts.map +1 -0
  66. package/dist/core/PacketBuilder.js +524 -0
  67. package/dist/core/PacketBuilder.js.map +1 -0
  68. package/dist/core/PluginLoader.d.ts +17 -0
  69. package/dist/core/PluginLoader.d.ts.map +1 -0
  70. package/dist/core/PluginLoader.js +97 -0
  71. package/dist/core/PluginLoader.js.map +1 -0
  72. package/dist/core/ProposalLifecycle.d.ts +59 -0
  73. package/dist/core/ProposalLifecycle.d.ts.map +1 -0
  74. package/dist/core/ProposalLifecycle.js +215 -0
  75. package/dist/core/ProposalLifecycle.js.map +1 -0
  76. package/dist/core/ProviderInstantiate.d.ts +9 -0
  77. package/dist/core/ProviderInstantiate.d.ts.map +1 -0
  78. package/dist/core/ProviderInstantiate.js +156 -0
  79. package/dist/core/ProviderInstantiate.js.map +1 -0
  80. package/dist/core/SchemeRegistry.d.ts +26 -0
  81. package/dist/core/SchemeRegistry.d.ts.map +1 -0
  82. package/dist/core/SchemeRegistry.js +205 -0
  83. package/dist/core/SchemeRegistry.js.map +1 -0
  84. package/dist/core/StrikeRail.d.ts +28 -0
  85. package/dist/core/StrikeRail.d.ts.map +1 -0
  86. package/dist/core/StrikeRail.js +165 -0
  87. package/dist/core/StrikeRail.js.map +1 -0
  88. package/dist/core/TelemetryChannel.d.ts +37 -0
  89. package/dist/core/TelemetryChannel.d.ts.map +1 -0
  90. package/dist/core/TelemetryChannel.js +77 -0
  91. package/dist/core/TelemetryChannel.js.map +1 -0
  92. package/dist/core/TokenGauge.d.ts +16 -0
  93. package/dist/core/TokenGauge.d.ts.map +1 -0
  94. package/dist/core/TokenGauge.js +58 -0
  95. package/dist/core/TokenGauge.js.map +1 -0
  96. package/dist/core/caps/CapsResolve.d.ts +5 -0
  97. package/dist/core/caps/CapsResolve.d.ts.map +1 -0
  98. package/dist/core/caps/CapsResolve.js +13 -0
  99. package/dist/core/caps/CapsResolve.js.map +1 -0
  100. package/dist/core/caps/DbChannelCaps.d.ts +16 -0
  101. package/dist/core/caps/DbChannelCaps.d.ts.map +1 -0
  102. package/dist/core/caps/DbChannelCaps.js +41 -0
  103. package/dist/core/caps/DbChannelCaps.js.map +1 -0
  104. package/dist/core/caps/DbEntryCaps.d.ts +19 -0
  105. package/dist/core/caps/DbEntryCaps.d.ts.map +1 -0
  106. package/dist/core/caps/DbEntryCaps.js +28 -0
  107. package/dist/core/caps/DbEntryCaps.js.map +1 -0
  108. package/dist/core/caps/DbNotifyCaps.d.ts +8 -0
  109. package/dist/core/caps/DbNotifyCaps.d.ts.map +1 -0
  110. package/dist/core/caps/DbNotifyCaps.js +35 -0
  111. package/dist/core/caps/DbNotifyCaps.js.map +1 -0
  112. package/dist/core/caps/DbSubscriptionCaps.d.ts +10 -0
  113. package/dist/core/caps/DbSubscriptionCaps.d.ts.map +1 -0
  114. package/dist/core/caps/DbSubscriptionCaps.js +86 -0
  115. package/dist/core/caps/DbSubscriptionCaps.js.map +1 -0
  116. package/dist/core/caps/DbTagCaps.d.ts +17 -0
  117. package/dist/core/caps/DbTagCaps.d.ts.map +1 -0
  118. package/dist/core/caps/DbTagCaps.js +37 -0
  119. package/dist/core/caps/DbTagCaps.js.map +1 -0
  120. package/dist/core/caps/SchemeCtxImpl.d.ts +18 -0
  121. package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -0
  122. package/dist/core/caps/SchemeCtxImpl.js +42 -0
  123. package/dist/core/caps/SchemeCtxImpl.js.map +1 -0
  124. package/dist/core/env-defaults.d.ts +19 -0
  125. package/dist/core/env-defaults.d.ts.map +1 -0
  126. package/dist/core/env-defaults.js +89 -0
  127. package/dist/core/env-defaults.js.map +1 -0
  128. package/dist/core/fork.d.ts +6 -0
  129. package/dist/core/fork.d.ts.map +1 -0
  130. package/dist/core/fork.js +84 -0
  131. package/dist/core/fork.js.map +1 -0
  132. package/dist/core/fork.sql +85 -0
  133. package/dist/core/git-membership.d.ts +23 -0
  134. package/dist/core/git-membership.d.ts.map +1 -0
  135. package/dist/core/git-membership.js +366 -0
  136. package/dist/core/git-membership.js.map +1 -0
  137. package/dist/core/git-state.d.ts +15 -0
  138. package/dist/core/git-state.d.ts.map +1 -0
  139. package/dist/core/git-state.js +67 -0
  140. package/dist/core/git-state.js.map +1 -0
  141. package/dist/core/packet-inject.d.ts +5 -0
  142. package/dist/core/packet-inject.d.ts.map +1 -0
  143. package/dist/core/packet-inject.js +48 -0
  144. package/dist/core/packet-inject.js.map +1 -0
  145. package/dist/core/packet-wire.d.ts +46 -0
  146. package/dist/core/packet-wire.d.ts.map +1 -0
  147. package/dist/core/packet-wire.js +453 -0
  148. package/dist/core/packet-wire.js.map +1 -0
  149. package/dist/core/path-decode.d.ts +2 -0
  150. package/dist/core/path-decode.d.ts.map +1 -0
  151. package/dist/core/path-decode.js +8 -0
  152. package/dist/core/path-decode.js.map +1 -0
  153. package/dist/core/plugin-attribution.d.ts +5 -0
  154. package/dist/core/plugin-attribution.d.ts.map +1 -0
  155. package/dist/core/plugin-attribution.js +39 -0
  156. package/dist/core/plugin-attribution.js.map +1 -0
  157. package/dist/core/plurnk-uri.d.ts +7 -0
  158. package/dist/core/plurnk-uri.d.ts.map +1 -0
  159. package/dist/core/plurnk-uri.js +52 -0
  160. package/dist/core/plurnk-uri.js.map +1 -0
  161. package/dist/core/resolveForLoop.d.ts +5 -0
  162. package/dist/core/resolveForLoop.d.ts.map +1 -0
  163. package/dist/core/resolveForLoop.js +12 -0
  164. package/dist/core/resolveForLoop.js.map +1 -0
  165. package/dist/core/results.d.ts +12 -0
  166. package/dist/core/results.d.ts.map +1 -0
  167. package/dist/core/results.js +27 -0
  168. package/dist/core/results.js.map +1 -0
  169. package/dist/core/run-cap.d.ts +8 -0
  170. package/dist/core/run-cap.d.ts.map +1 -0
  171. package/dist/core/run-cap.js +20 -0
  172. package/dist/core/run-cap.js.map +1 -0
  173. package/dist/core/run-ops.sql +43 -0
  174. package/dist/core/scheme-types.d.ts +45 -0
  175. package/dist/core/scheme-types.d.ts.map +1 -0
  176. package/dist/core/scheme-types.js +6 -0
  177. package/dist/core/scheme-types.js.map +1 -0
  178. package/dist/core/session-settings.d.ts +23 -0
  179. package/dist/core/session-settings.d.ts.map +1 -0
  180. package/dist/core/session-settings.js +55 -0
  181. package/dist/core/session-settings.js.map +1 -0
  182. package/dist/core/teaching.d.ts +3 -0
  183. package/dist/core/teaching.d.ts.map +1 -0
  184. package/dist/core/teaching.js +13 -0
  185. package/dist/core/teaching.js.map +1 -0
  186. package/dist/core/types.d.ts +3 -0
  187. package/dist/core/types.d.ts.map +1 -0
  188. package/dist/core/types.js +2 -0
  189. package/dist/core/types.js.map +1 -0
  190. package/dist/digest/Digest.d.ts +20 -0
  191. package/dist/digest/Digest.d.ts.map +1 -0
  192. package/dist/digest/Digest.js +451 -0
  193. package/dist/digest/Digest.js.map +1 -0
  194. package/dist/digest/Digest.sql +1 -0
  195. package/dist/digest/digest.sql +55 -0
  196. package/dist/index.d.ts +18 -0
  197. package/dist/index.d.ts.map +1 -0
  198. package/dist/index.js +28 -0
  199. package/dist/index.js.map +1 -0
  200. package/dist/schemes/EffectPolicy.d.ts +6 -0
  201. package/dist/schemes/EffectPolicy.d.ts.map +1 -0
  202. package/dist/schemes/EffectPolicy.js +18 -0
  203. package/dist/schemes/EffectPolicy.js.map +1 -0
  204. package/dist/schemes/Exec.d.ts +39 -0
  205. package/dist/schemes/Exec.d.ts.map +1 -0
  206. package/dist/schemes/Exec.js +510 -0
  207. package/dist/schemes/Exec.js.map +1 -0
  208. package/dist/schemes/ExecOutputScheme.d.ts +20 -0
  209. package/dist/schemes/ExecOutputScheme.d.ts.map +1 -0
  210. package/dist/schemes/ExecOutputScheme.js +39 -0
  211. package/dist/schemes/ExecOutputScheme.js.map +1 -0
  212. package/dist/schemes/File.d.ts +42 -0
  213. package/dist/schemes/File.d.ts.map +1 -0
  214. package/dist/schemes/File.js +356 -0
  215. package/dist/schemes/File.js.map +1 -0
  216. package/dist/schemes/Known.d.ts +17 -0
  217. package/dist/schemes/Known.d.ts.map +1 -0
  218. package/dist/schemes/Known.js +40 -0
  219. package/dist/schemes/Known.js.map +1 -0
  220. package/dist/schemes/Log.d.ts +22 -0
  221. package/dist/schemes/Log.d.ts.map +1 -0
  222. package/dist/schemes/Log.js +269 -0
  223. package/dist/schemes/Log.js.map +1 -0
  224. package/dist/schemes/Log.sql +59 -0
  225. package/dist/schemes/Plurnk.d.ts +17 -0
  226. package/dist/schemes/Plurnk.d.ts.map +1 -0
  227. package/dist/schemes/Plurnk.js +46 -0
  228. package/dist/schemes/Plurnk.js.map +1 -0
  229. package/dist/schemes/Run.d.ts +25 -0
  230. package/dist/schemes/Run.d.ts.map +1 -0
  231. package/dist/schemes/Run.js +172 -0
  232. package/dist/schemes/Run.js.map +1 -0
  233. package/dist/schemes/Skill.d.ts +17 -0
  234. package/dist/schemes/Skill.d.ts.map +1 -0
  235. package/dist/schemes/Skill.js +40 -0
  236. package/dist/schemes/Skill.js.map +1 -0
  237. package/dist/schemes/Unknown.d.ts +17 -0
  238. package/dist/schemes/Unknown.d.ts.map +1 -0
  239. package/dist/schemes/Unknown.js +39 -0
  240. package/dist/schemes/Unknown.js.map +1 -0
  241. package/dist/schemes/_entry-chunk.d.ts +11 -0
  242. package/dist/schemes/_entry-chunk.d.ts.map +1 -0
  243. package/dist/schemes/_entry-chunk.js +100 -0
  244. package/dist/schemes/_entry-chunk.js.map +1 -0
  245. package/dist/schemes/_entry-crud.d.ts +31 -0
  246. package/dist/schemes/_entry-crud.d.ts.map +1 -0
  247. package/dist/schemes/_entry-crud.js +77 -0
  248. package/dist/schemes/_entry-crud.js.map +1 -0
  249. package/dist/schemes/_entry-crud.sql +101 -0
  250. package/dist/schemes/_entry-find.d.ts +32 -0
  251. package/dist/schemes/_entry-find.d.ts.map +1 -0
  252. package/dist/schemes/_entry-find.js +226 -0
  253. package/dist/schemes/_entry-find.js.map +1 -0
  254. package/dist/schemes/_entry-find.sql +54 -0
  255. package/dist/schemes/_entry-graph.d.ts +16 -0
  256. package/dist/schemes/_entry-graph.d.ts.map +1 -0
  257. package/dist/schemes/_entry-graph.js +94 -0
  258. package/dist/schemes/_entry-graph.js.map +1 -0
  259. package/dist/schemes/_entry-graph.sql +52 -0
  260. package/dist/schemes/_entry-manifest.d.ts +25 -0
  261. package/dist/schemes/_entry-manifest.d.ts.map +1 -0
  262. package/dist/schemes/_entry-manifest.js +266 -0
  263. package/dist/schemes/_entry-manifest.js.map +1 -0
  264. package/dist/schemes/_entry-ops.d.ts +32 -0
  265. package/dist/schemes/_entry-ops.d.ts.map +1 -0
  266. package/dist/schemes/_entry-ops.js +216 -0
  267. package/dist/schemes/_entry-ops.js.map +1 -0
  268. package/dist/schemes/_entry-ops.sql +31 -0
  269. package/dist/schemes/_entry-semantic.d.ts +38 -0
  270. package/dist/schemes/_entry-semantic.d.ts.map +1 -0
  271. package/dist/schemes/_entry-semantic.js +202 -0
  272. package/dist/schemes/_entry-semantic.js.map +1 -0
  273. package/dist/schemes/_entry-semantic.sql +95 -0
  274. package/dist/schemes/_entry-send.d.ts +11 -0
  275. package/dist/schemes/_entry-send.d.ts.map +1 -0
  276. package/dist/schemes/_entry-send.js +66 -0
  277. package/dist/schemes/_entry-send.js.map +1 -0
  278. package/dist/schemes/cosine.d.ts +4 -0
  279. package/dist/schemes/cosine.d.ts.map +1 -0
  280. package/dist/schemes/cosine.js +9 -0
  281. package/dist/schemes/cosine.js.map +1 -0
  282. package/dist/schemes/exec-abort.d.ts +15 -0
  283. package/dist/schemes/exec-abort.d.ts.map +1 -0
  284. package/dist/schemes/exec-abort.js +29 -0
  285. package/dist/schemes/exec-abort.js.map +1 -0
  286. package/dist/schemes/exec-env.d.ts +5 -0
  287. package/dist/schemes/exec-env.d.ts.map +1 -0
  288. package/dist/schemes/exec-env.js +34 -0
  289. package/dist/schemes/exec-env.js.map +1 -0
  290. package/dist/server/Daemon.d.ts +244 -0
  291. package/dist/server/Daemon.d.ts.map +1 -0
  292. package/dist/server/Daemon.js +1119 -0
  293. package/dist/server/Daemon.js.map +1 -0
  294. package/dist/server/client-input.d.ts +11 -0
  295. package/dist/server/client-input.d.ts.map +1 -0
  296. package/dist/server/client-input.js +145 -0
  297. package/dist/server/client-input.js.map +1 -0
  298. package/dist/server/clientTurn.d.ts +6 -0
  299. package/dist/server/clientTurn.d.ts.map +1 -0
  300. package/dist/server/clientTurn.js +23 -0
  301. package/dist/server/clientTurn.js.map +1 -0
  302. package/dist/server/clientTurn.sql +10 -0
  303. package/dist/server/dispatch-as-plurnk.d.ts +7 -0
  304. package/dist/server/dispatch-as-plurnk.d.ts.map +1 -0
  305. package/dist/server/dispatch-as-plurnk.js +23 -0
  306. package/dist/server/dispatch-as-plurnk.js.map +1 -0
  307. package/dist/server/drain.sql +124 -0
  308. package/dist/server/envelope.d.ts +53 -0
  309. package/dist/server/envelope.d.ts.map +1 -0
  310. package/dist/server/envelope.js +172 -0
  311. package/dist/server/envelope.js.map +1 -0
  312. package/dist/server/envelope.sql +76 -0
  313. package/dist/server/logEntry.d.ts +35 -0
  314. package/dist/server/logEntry.d.ts.map +1 -0
  315. package/dist/server/logEntry.js +49 -0
  316. package/dist/server/logEntry.js.map +1 -0
  317. package/dist/server/logEntry.sql +10 -0
  318. package/dist/server/loopDocs.d.ts +6 -0
  319. package/dist/server/loopDocs.d.ts.map +1 -0
  320. package/dist/server/loopDocs.js +22 -0
  321. package/dist/server/loopDocs.js.map +1 -0
  322. package/dist/server/noProposals.d.ts +6 -0
  323. package/dist/server/noProposals.d.ts.map +1 -0
  324. package/dist/server/noProposals.js +37 -0
  325. package/dist/server/noProposals.js.map +1 -0
  326. package/dist/server/seam-entry-read.sql +21 -0
  327. package/dist/server/seam-log-read.sql +21 -0
  328. package/dist/server/seam-loop.sql +9 -0
  329. package/dist/server/seam-proposal-list.sql +13 -0
  330. package/dist/server/version-info.d.ts +14 -0
  331. package/dist/server/version-info.d.ts.map +1 -0
  332. package/dist/server/version-info.js +69 -0
  333. package/dist/server/version-info.js.map +1 -0
  334. package/dist/server/yolo.d.ts +6 -0
  335. package/dist/server/yolo.d.ts.map +1 -0
  336. package/dist/server/yolo.js +64 -0
  337. package/dist/server/yolo.js.map +1 -0
  338. package/dist/service.d.ts +6 -0
  339. package/dist/service.d.ts.map +1 -0
  340. package/dist/service.js +309 -0
  341. package/dist/service.js.map +1 -0
  342. package/migrations/0000-00-00.01_schema.sql +500 -0
  343. package/package.json +86 -0
package/.env.defaults ADDED
@@ -0,0 +1,208 @@
1
+ # ⚠ REFERENCE — this is @plurnk/plurnk-service's shipped .env.defaults: the operative floor
2
+ # for its knobs and the source of the derived --<knob> CLI flags (INSTALL.md is the agent-facing
3
+ # breakdown). ~/.plurnk/.env.defaults is the ASSEMBLED catalog (every installed package's file),
4
+ # machine-owned and regenerated each boot — do NOT edit either. Put YOUR config in ~/.plurnk/.env
5
+ # (yours, seeded once, never touched) or ./.env.
6
+ #
7
+ # THE STANDARD (every plurnk package, third-party included): ship a `.env.defaults` at your
8
+ # package root declaring YOUR knobs (prefix = your package's name); the file IS the documentation.
9
+ # The daemon assembles every installed member's file into one floor. ONE LAW: a key claimed by
10
+ # two packages crashes boot naming both. Reader declares: every knob your code reads appears in
11
+ # your file — the floor guarantees it set, so code carries no inline fallback.
12
+ #
13
+ # Cascade (low → high precedence — last writer wins):
14
+ # assembled .env.defaults floor (this file + every installed member's, uniqueness-checked)
15
+ # < ~/.plurnk/.env (your home config — seeded once, yours to keep)
16
+ # < ./.env (per-project, current directory)
17
+ # < --env-file=… / --config=…
18
+ # < shell environment
19
+ # < --<knob> CLI flags (the 1:1 mirror: --service-max-turns <-> PLURNK_SERVICE_MAX_TURNS)
20
+ # Feature-flag bools use `=== "1"` exactly, never `=== "true"`. `~/` expands to your home.
21
+
22
+ # --- Storage ---
23
+ PLURNK_SERVICE_DB_PATH=~/.plurnk/plurnk.db
24
+
25
+ # --- Sqlite tuning (curated knobs passed through to sqlrite; optional) ---
26
+ # sqlrite already sets the safe posture (WAL + synchronous=NORMAL + busy_timeout=5000ms).
27
+ # These are operator overrides — integers; unset = sqlrite/sqlite default. Uncomment to tune.
28
+ # busy_timeout (ms): how long a writer waits on a lock before SQLITE_BUSY. 0 = immediate.
29
+ # PLURNK_SERVICE_SQLITE_TIMEOUT=5000
30
+ # cache_size: positive = pages, negative = KiB of memory. Bigger = fewer disk reads on a hot db.
31
+ # PLURNK_SERVICE_SQLITE_CACHE_SIZE=-16000
32
+ # mmap_size: bytes of memory-mapped I/O (read perf on large file-backed dbs). 0 disables.
33
+ # PLURNK_SERVICE_SQLITE_MMAP_SIZE=268435456
34
+ # max_page_count: hard db-size ceiling in PAGES — a write past it errors (disk-fill guard).
35
+ # PLURNK_SERVICE_SQLITE_MAX_PAGE_COUNT=524288
36
+
37
+ # --- Daemon transport ---
38
+ PLURNK_HOST=127.0.0.1
39
+ # THE client surface — the AG-UI+ listener (the plurnk-agui daughter module binds it at boot).
40
+ # Production is single-listener: every first-party client rides this surface.
41
+ PLURNK_PORT=3044
42
+
43
+ # --- Loop control ---
44
+ # Operator turn ceiling. -1 (default) = no cap (loops end via SEND, budget,
45
+ # strikes, or cycle detection). A positive value is an inviolable hard cap a
46
+ # per-call loop.run({maxTurns}) cannot exceed (min wins).
47
+ PLURNK_SERVICE_MAX_TURNS=-1
48
+ # Per-emission op cap (runaway-loop guard). A client may tighten it per session via
49
+ # session.create settings.maxCommands (min wins); never raise it past this (#232).
50
+ PLURNK_SERVICE_MAX_COMMANDS=99
51
+ # Proposal resolution bound (ms). Empty = a stopped world waits for its human indefinitely;
52
+ # set to auto-cancel unattended (resolves cancel, outcome=timeout).
53
+ PLURNK_SERVICE_PROPOSAL_TIMEOUT_MS=
54
+ # Turn-hold runtimes: while a listed runtime's stream is in flight the cycle pauses (no next
55
+ # turn) until it concludes. Bounded by _HOLD_MS, fail-open at the cap. Empty = no holds.
56
+ PLURNK_SERVICE_EXEC_HOLD=search,images,videos,news,map,music,it,science,social,downloadable
57
+ PLURNK_SERVICE_EXEC_HOLD_MS=300000
58
+ # Post-EXEC breath: after a turn fires a non-inline EXEC whose spawn is still in
59
+ # flight at the turn boundary, wait this many ms before assembling the next packet
60
+ # so a fast exec's output can land in it instead of a turn later. A fixed grace
61
+ # beat, NOT a wait-for-completion (slow execs proceed + surface via the wake path).
62
+ # 0 = off (the model sees fast-exec output a turn late, as today).
63
+ PLURNK_SERVICE_EXEC_WAIT_MS=1000
64
+ # Teardown reap grace: when a loop/run tears down a background exec, the spawn gets a polite
65
+ # signal first (SIGHUP, or the model's KILL[code]); a stream that IGNORES it is hard-killed
66
+ # (SIGKILL, to the whole process group) this many ms later — so the reap can't wedge on a
67
+ # signal-ignoring child. plurnk-execs refuses to bake this number; the consumer owns it.
68
+ PLURNK_SERVICE_EXEC_KILL_GRACE_MS=2000
69
+ PLURNK_SERVICE_LOOP_TIMEOUT=86400000
70
+
71
+ # Operator questions (SEND[300] — ask-the-user multiple choice / open question). Three states:
72
+ # unset (shipped) = ALLOWED but not enabled — a client must affirmatively pass its own
73
+ # PLURNK_QUESTIONS=1 (rides session.create settings.questions) to enable its sessions;
74
+ # uncomment =0 to DENY servicewide (a ceiling the client cannot override). Enabled sessions
75
+ # get the questions.md teaching injected automatically (the same conditional-doc mechanism as
76
+ # the EXEC plugin docs) — an un-enabled session is never taught the op it can't use, and an
77
+ # emitted [300] is refused with a self-decide steer instead of parking into the void.
78
+ # PLURNK_QUESTIONS=0
79
+
80
+ # --- Engine rails ---
81
+ PLURNK_SERVICE_MAX_STRIKES=3
82
+ PLURNK_SERVICE_MIN_CYCLES=3
83
+ PLURNK_SERVICE_MAX_CYCLE_PERIOD=4
84
+
85
+ # --- Schemes ---
86
+ # (Workspace root for file ops is per-session — supplied at
87
+ # session.create({projectRoot}) or never (headless is forever);
88
+ # stored on sessions.project_root. No env-level default.)
89
+
90
+ # --- Git integration ---
91
+ # PLURNK_SERVICE_GIT_ALLOWED — hard ceiling for git membership + integration (repo telemetry,
92
+ # EXEC[git]). =1 permits it (then declared repos + per-session config decide; a client
93
+ # may deny its own session via session.create settings.git:false, #232); =0 flatly
94
+ # denies it service-wide, un-re-enableable (the sandbox/benchmark lockout).
95
+ PLURNK_SERVICE_GIT_ALLOWED=1
96
+ # PLURNK_SERVICE_GIT_AUTO — default repo declaration. =1 auto-declares an implicit `repo` at
97
+ # project_root (no-op when it isn't a git tree); =0 declares nothing — clients add
98
+ # repos explicitly via the `repo` overlay. SPEC §membership forest.
99
+ PLURNK_SERVICE_GIT_AUTO=1
100
+
101
+ # --- Reference docs (auto-READ at turn 1) ---
102
+ # PLURNK_SERVICE_MD_<ALIAS>=<path> materializes <path>'s markdown as a plurnk://<ALIAS>.md
103
+ # entry the model READs at turn 0 — an idiomatic way to inject standing context
104
+ # (an ordinary entry + READ op, not a bespoke packet section). ~ expands to home;
105
+ # relative paths resolve against the package root. A client may add its own docs
106
+ # per session via session.create settings.mdDocs (content, not a path); those UNION
107
+ # with these env docs, keyed by alias — the client wins a collision (#231).
108
+ # Commented out = no docs by default. (The operating policy is NOT a doc: readSystemPolicy
109
+ # already renders ~/.plurnk/AGENTS.md as the ## Plurnk Service Policy section — pointing a
110
+ # PLURNK_SERVICE_MD_* alias at it injects the same file twice.)
111
+ # Turn-0 catalog preview, FIND-served (foisted as FIND(<scheme>:///**) per scheme) so a run
112
+ # opens oriented, not blank. The model's OWN surface — known/unknown (memory), run (scratch),
113
+ # plurnk (docs) — always foists FULL when the preview is on, never truncated: a partial view of
114
+ # the model's own memory reads as withheld. This knob's first-N cap applies ONLY to the FILE list
115
+ # (FIND(file:///**)), the one catalog that's external and arbitrarily large: -1 = the whole tree
116
+ # (everything full); N = the first N files (memory still full); 0 = preview off entirely (the model
117
+ # FINDs on demand). Servicewide default; a client overrides per session via session.create
118
+ # settings.filesItems (#231).
119
+ PLURNK_SERVICE_FILES_ITEMS=-1
120
+
121
+ # Session-tier ceiling on CONCURRENT active runs (a run with a non-terminal loop)
122
+ # — the fork-bomb / destabilization brake. -1 = no cap (default); only concurrency
123
+ # is bounded, never lifetime, since sessions persist for months. A spawn/fork past
124
+ # the ceiling fails hard (508 — no queue, no retry); the acting run counts itself.
125
+ PLURNK_SERVICE_SESSION_RUNS_MAX_ACTIVE=-1
126
+
127
+ # --- The window partition (§tokenomics-window-partition) — PER ALIAS (#352) ---
128
+ # The window splits WITHOUT remainder: promptBudget = min(CTX, real window) − REASONING −
129
+ # ASSISTANT − SAFETY is what the service may send; REASONING+ASSISTANT is the generation
130
+ # envelope (max_tokens on every call — no decode is unbounded); SAFETY covers chat-template
131
+ # overhead. The prompt ceiling is DERIVED, never set directly.
132
+ #
133
+ # Each knob resolves PER ALIAS: PLURNK_SERVICE_<KNOB>_<alias> wins over the bare fallback.
134
+ # The BARE defaults are CLOUD-GENEROUS — a large envelope the backend self-clamps to its true
135
+ # output limit (cloud backends accept 65536, silently clamp an absurd ask; no models-API exposes
136
+ # a max-output field, so "send generous, let the backend clamp" is the honest cloud posture).
137
+ # This makes connecting a cloud reasoner a zero-config on-ramp: a DeepSeek-V4 that burns ~16k on
138
+ # reasoning alone gets the headroom to finish its DSL instead of dying at finish=length (#351).
139
+ PLURNK_SERVICE_CTX=163840
140
+ PLURNK_SERVICE_REASONING=16384
141
+ PLURNK_SERVICE_ASSISTANT=49152
142
+ PLURNK_SERVICE_SAFETY=1024
143
+ #
144
+ # LOCAL aliases (llama-server) MUST keep a MEASURED envelope: llama-server honors n_predict to
145
+ # the context wall, and an unbounded decode wall-runs into 30k+ junk tokens (providers#10 — the
146
+ # reason the cap doctrine exists). The tinkerer with a graphics card UNCOMMENTS a block keyed to
147
+ # their alias and their model's real n_ctx (example alias name 'myalias'; a local model
148
+ # run under the bare cloud-generous defaults fails HARD at build with a remedy naming these knobs):
149
+ # PLURNK_SERVICE_CTX_myalias=78848
150
+ # PLURNK_SERVICE_REASONING_myalias=4096
151
+ # PLURNK_SERVICE_ASSISTANT_myalias=8192
152
+ # PLURNK_SERVICE_SAFETY_myalias=1024
153
+ # COUPLING (F7): per-request numeric reasoning budgets are IGNORED by llama-server — a local
154
+ # thinking model's serving box MUST clamp via --reasoning-budget = its PLURNK_SERVICE_REASONING_<alias>,
155
+ # or the reserve is fiction. The service warns at boot. A local alias whose partition contradicts
156
+ # its real window fails HARD at build time, naming the per-alias knobs to set.
157
+
158
+ # PLURNK_SERVICE_VERSION_POLL_TTL — how long (ms) discover caches its npm-registry version poll
159
+ # (service + client `latest`) before a background refresh. Best-effort; the poll never
160
+ # blocks discover, and offline/registry-down omits `latest`. ~hourly is plenty. #235
161
+ PLURNK_SERVICE_VERSION_POLL_TTL=3600000
162
+ # Grammar-constrained sampling: SELECTS the GBNF variant the provider constrains every
163
+ # generate() to, so capable backends can only sample valid plurnk DSL. A bare name
164
+ # (plurnk.gbnf) is a variant shipped by @plurnk/plurnk-grammar; a path is your own; =0
165
+ # (or empty) disables.
166
+ #
167
+
168
+
169
+ # --- Plugins (third-party trust) ---
170
+ # (PLURNK_PLUGINS_TRUSTED_ONLY moved to @plurnk/plurnk-plugins — reader-declares: the
171
+ # trust rule's one implementation lives there and so does its knob.)
172
+
173
+ # PLURNK_SERVICE_DOCS_EXCLUDE — comma list of scheme/exec names dropped from BOTH the teaching oneliner
174
+ # and the materialized pull-doc on load. The self-evident (plurnk/file) + retired (exec) names the
175
+ # model needs no doc for. Empty → exclude nothing. Unknown names are inert (a filter, not a contract).
176
+ PLURNK_SERVICE_DOCS_EXCLUDE="plurnk,file,exec"
177
+
178
+ # PLURNK_SERVICE_PACKET_INJECT — an operator markdown file injected as a section right after the teaching
179
+ # (the cached prefix). Read per-turn (live edits); a set-but-unreadable path fails the turn HARD.
180
+ # `~/` expands to home. Unset → no section. The pressure valve for "improve the packet" without a fork.
181
+ # PLURNK_SERVICE_PACKET_INJECT="~/injection.md"
182
+
183
+ # PLURNK_SERVICE_POLICY — the operating-policy markdown, rendered as the ## Plurnk Service Policy
184
+ # section. Unset = the seeded ~/.plurnk/AGENTS.md; a path = that file; EXPLICITLY empty = policy off.
185
+ # PLURNK_SERVICE_POLICY=
186
+ # PLURNK_SERVICE_PROJECT — a per-project policy markdown (relative to projectRoot). Unset = <root>/AGENTS.md.
187
+ # PLURNK_SERVICE_PROJECT=
188
+ # PLURNK_SERVICE_REQUIREMENTS — override the requirements.md recency-footer path (relative to the package
189
+ # root). Unset = the packaged requirements.md.
190
+ # PLURNK_SERVICE_REQUIREMENTS=
191
+
192
+ # --- Semantic search (~query chunking) ---
193
+ # Project Semantics tiles each entry into <=window chunks so a large body is fully
194
+ # searchable, not truncated. ACTIVE only when the installed embedder reports its
195
+ # tokenizer; otherwise one whole-entry chunk (today's behavior). Both knobs are read
196
+ # only when chunking is active.
197
+ # Chunk budget in TOKENS. EMPTY (the default) = the installed embedder's reported
198
+ # window — NO model-specific number is assumed, so it scales to whatever embedder you
199
+ # install. Set a positive value ONLY to cap below the window (e.g. to sweep
200
+ # granularity); it is clamped to the window either way.
201
+ PLURNK_SERVICE_SEMANTIC_CHUNK_TOKENS=
202
+ # Overlap fraction [0,1): trailing context re-covered at each chunk boundary so a
203
+ # concept split across a cut still matches in both. ~0.15 is a standard RAG default.
204
+ PLURNK_SERVICE_SEMANTIC_CHUNK_OVERLAP=0.15
205
+ # =1 forces the FTS-only path even with the embeddings package installed — the ~query
206
+ # degrades to keyword ranking and no vectors are derived (no MiniLM pool spun up). For
207
+ # hosts/runs that don't want vector search; the fast test lane sets it in .env.test.
208
+ PLURNK_SERVICE_EMBED_DISABLE=0
package/INSTALL.md ADDED
@@ -0,0 +1,69 @@
1
+ # Configuring plurnk-service
2
+
3
+ Agent guide. Read this, then generate a `~/.plurnk/.env` fit to the user's box and intent. `.env.defaults` is the terse machine floor — the authoritative flag list and defaults (the ASSEMBLED catalog of every installed package's file lands at `~/.plurnk/.env.defaults`); this is its reasoning layer. Every claimed coupling below is enforced by a `test/intg` check, so it is current with the installed version.
4
+
5
+ ## Install
6
+
7
+ ```
8
+ npm install -g @plurnk/plurnk-service
9
+ plurnk-service start # `migrate` first if the DB is uninitialized
10
+ ```
11
+
12
+ First run creates `~/.plurnk/`: `.env` (yours, seeded once with a model picker — **edit this**), `AGENTS.md` (the operating policy, yours), `.env.defaults` + `INSTALL.md` (package-owned references, **refreshed every boot** — never edit them). No model ships active; a fresh daemon runs until `PLURNK_MODEL` is set.
13
+
14
+ Optional vector search: `npm i @plurnk/plurnk-mimetypes-embeddings` (heavy native deps). Absent → `~query` degrades to FTS keyword ranking.
15
+
16
+ ## The cascade (where a value actually comes from)
17
+
18
+ Lowest precedence first; the last writer wins:
19
+
20
+ 1. **the assembled `.env.defaults` floor** — every installed package's shipped file, one owner per key (a collision crashes boot naming both), evolves with the installed versions.
21
+ 2. **`~/.plurnk/.env.defaults`** — the readable assembled legend, regenerated each boot (a reference, not a place to edit).
22
+ 3. **`~/.plurnk/.env`** — the user's home config, seeded once, theirs to keep. **Write generated config here.**
23
+ 4. **`./.env`** — per-project, current working directory.
24
+ 5. **`--env-file=<path>` / `--config=<path>`** — explicit layers.
25
+ 6. **shell environment** — beats every file.
26
+ 7. **`--<flag>` CLI args** — top layer, overrides all.
27
+
28
+ CLI flags are the **1:1 mirror** of the env vars: strip `PLURNK_`, lowercase, `_`→`-`. `PLURNK_SERVICE_MAX_TURNS` ↔ `--service-max-turns`; `PLURNK_MODEL` ↔ `--model`. The flag surface and `--help` are generated from the service's `.env.defaults`, so a var and its flag never diverge. Feature-flag bools are `=== "1"` exactly (never `"true"`); `~/` expands to home.
29
+
30
+ ## The prefix law (who owns a flag)
31
+
32
+ The prefix is the **owning package**: `PLURNK_SERVICE_*` (this daemon), `PLURNK_PROVIDERS_*`, `PLURNK_MIMETYPES_*`, `PLURNK_EXECS_*`, `PLURNK_SCHEMES_HTTP_*`, `PLURNK_AGUI_*` (the AG-UI module's own knobs), `PLURNK_CLIENT_*` (the CLI). **Bare `PLURNK_*` is reserved** for the front-door + cross-package set no single package owns: `PLURNK_MODEL[_*]`, `PLURNK_BASEURL_*`, `PLURNK_HOST`/`PLURNK_PORT` (the connection rendezvous), and `PLURNK_PLUGINS_TRUSTED_ONLY` (the cross-family plugin gate). Vendor keys (`OPENAI_API_KEY`, `FIREWORKS_API_KEY`…) are vendor conventions — untouched.
33
+
34
+ A bare flag is a signal: more than one component depends on it. A prefixed one is single-owner. When a flag is `REQUIRED`, an unset or old-named value **fails the boot loudly** naming the var — never a silent default.
35
+
36
+ ## Couplings (the edges an agent gets wrong)
37
+
38
+ These are relationships *between* flags. Set them as a unit.
39
+
40
+ - **The window partition is exact.** `promptBudget = min(PLURNK_SERVICE_CTX, real window) − REASONING − ASSISTANT − SAFETY`; `REASONING + ASSISTANT` is the per-call `max_tokens`. Shipped invariant: any window ≥ 77Ki partitions to **exactly 65536** prompt tokens (`78848 − 4096 − 8192 − 1024`). Reserves exceeding the window fail the boot. *(Pinned: `Engine.budget` / `shipped-defaults`.)*
41
+ - **Reasoning capacity is one number in three places.** `PLURNK_SERVICE_REASONING` (the partition's reserve) **must equal** `PLURNK_PROVIDERS_THINKING_CAPACITY` (the provider's thinking cap) **must equal** the serving box's `--reasoning-budget` launch flag. llama-server ignores per-request numeric budgets, so only the launch flag clamps it; a mismatch makes the reserve fiction. The daemon warns at boot when thinking is on. *(Pinned: `shipped-defaults` asserts the first equality.)*
42
+ - **Grammar rails ship on, gated on the provider's claim (#336).** A backend that doesn't enforce grammars drops it cleanly — the daemon boots with a notice, unconstrained on that alias. A backend that CLAIMS enforcement (`constrainsOutput`) is **verified end-to-end at boot** and fails hard if it returns unconstrained output. Daemon-global — not alias-scoped (one backend per daemon). For a known llama-server alias, pin `PLURNK_PROVIDERS_LLAMA_SERVER_<alias>=1` — it transports the grammar deterministically instead of probing `/v1/models` (a probe race once silently disabled the rails). *(Pinned: `grammar-enforcement-verify`.)*
43
+ - **A think-trained model must think somewhere.** `PLURNK_PROVIDERS_THINKING=off` reroutes a reasoning model's thought into the grammar's legal free zone as prose. Keep it `on` with a capacity; providers auto-clamp thinking on in-band grammar backends, so one setting is right everywhere.
44
+
45
+ ## Profiles (examples, not a decision tree — adapt to the real box)
46
+
47
+ - **Local GPU (llama-server).** `PLURNK_MODEL_local="openai/<name>"`, `OPENAI_BASE_URL=http://127.0.0.1:<port>`, `PLURNK_MODEL=local`, `PLURNK_PROVIDERS_LLAMA_SERVER_local=1`, thinking `on`/`4096` **with the box launched `--reasoning-budget 4096`**. Full rails, exact tokenization.
48
+ - **Cloud, bring-your-own-key.** `PLURNK_MODEL_cloud="openrouter/<model>"`, `OPENROUTER_API_KEY=…`, `PLURNK_MODEL=cloud`. No `LLAMA_SERVER` pin (not llama-server); a `response_format`-grammar backend auto-clamps thinking to none.
49
+ - **plurnk.ai endpoint.** `PLURNK_MODEL_plurnk="plurnk/plurnk"`, `PLURNK_API_KEY=…`, `PLURNK_MODEL=plurnk`.
50
+ - **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.
51
+
52
+ ## Flag sections (breakdown of the service's `.env.defaults`)
53
+
54
+ Each mirrors a `# --- section ---` in the floor; consult the floor for exact defaults.
55
+
56
+ - **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).
57
+ - **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.
58
+ - **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.
59
+ - **Loop control / Engine rails** — `PLURNK_SERVICE_MAX_TURNS` (−1 = uncapped), `_MAX_COMMANDS`, `_MAX_STRIKES`, `_MIN_CYCLES`, `_MAX_CYCLE_PERIOD`, `_RPC_TIMEOUT`, `_LOOP_TIMEOUT`, `_PROPOSAL_TIMEOUT_MS`, `_EXEC_WAIT_MS`, `_EXEC_KILL_GRACE_MS`, `_SESSION_RUNS_MAX_ACTIVE`. Guardrails; the shipped values are sane.
60
+ - **Git** — `PLURNK_SERVICE_GIT_ALLOWED` (0 = hard sandbox lockout), `_GIT_AUTO`.
61
+ - **Packet / reference docs** — `PLURNK_SERVICE_FILES_ITEMS` (turn-1 file catalog cap), `_PROMPT_PREVIEW_CHARS`, `_DOCS_EXCLUDE`, `_PACKET_INJECT` (operator markdown section), `_POLICY`/`_PROJECT`/`_REQUIREMENTS` (policy + footer overrides; unset = the seeded/packaged defaults), `_MD_<alias>` (inject a markdown doc as a turn-0 entry).
62
+ - **Providers** — `PLURNK_PROVIDERS_THINKING`/`_THINKING_CAPACITY`, `_TEMPERATURE`, `_REPEAT_PENALTY`, `_FETCH_TIMEOUT`, `_RETRY_ATTEMPTS`/`_RETRY_DELAY`, `_PROBE_ATTEMPTS`/`_PROBE_DELAY`, `_GBNF` (grammar variant), `_LLAMA_SERVER_<alias>`, `_CONTEXT_SIZE`, `_GBNF_DEBUG`. Alias-scopable: any knob takes a `_<alias>` suffix that wins over the bare fallback.
63
+ - **The window partition** — `PLURNK_SERVICE_CTX`/`_REASONING`/`_ASSISTANT`/`_SAFETY` (see Couplings).
64
+ - **Plugins** — bare `PLURNK_PLUGINS_TRUSTED_ONLY` (0/unset = load all installed; a value = `@plurnk/*` plus an allowlist).
65
+ - **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).
66
+ - **Schemes: http** — `PLURNK_SCHEMES_HTTP_FETCH_TIMEOUT`/`_SALVAGE_MIN_BODY_CHARS`/`_IDLE_TIMEOUT` (required on the HTML render path), optional Playwright/Chromium knobs.
67
+ - **Execs** — `PLURNK_EXECS_<runtime>=0` disables a runtime; `PLURNK_EXECS_MCP_<server>` bridges an MCP server; `PLURNK_EXECS_SEARCH_SEARXNG_URL` enables web search (unset = search off).
68
+
69
+ The client's own knobs live under `PLURNK_CLIENT_*` (`--session`, `--run`, `--yolo`, `--json`…) — see `plurnk --help`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 plurnk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # plurnk-service
2
+
3
+ LLM agent runtime engine. Consumes [plurnk-grammar](https://github.com/plurnk/plurnk-grammar); exposes WebSocket JSON-RPC. User-facing CLI: [plurnk](https://github.com/plurnk/plurnk). Provider-agnostic, MIT — no vendor or model lock-in.
4
+
5
+ ## What an agent can do
6
+
7
+ Grammar ops: `PLAN` reason · `READ`/`EDIT` files · `FIND` search · `EXEC` run shell/code · `SEND` message or conclude · `COPY`/`MOVE`/`KILL` manage · `OPEN`/`FOLD` curate its own context.
8
+
9
+ Over schemes: `file://` project files · `exec://` command output · `http(s)://` web fetch · `run://` sibling agent runs (spawn / fork / message) · `known://` scratch · `log://` own history.
10
+
11
+ ## Loop model
12
+
13
+ Session = the shared world (one filesystem + membership overlay). Run = one agent's private log. Loop = one `prompt → ops → SEND[terminal]` cycle; every turn leads with `PLAN`. Runs fork and message each other — many clients, many runs, one session.
14
+
15
+ ## Integration (WebSocket JSON-RPC)
16
+
17
+ Methods: `session.*` (create / attach / constrain / list…) · `loop.run` / `loop.inject` / `loop.resolve` · `op.*` (read / edit / find / exec / send…) · `log.read` · `run.fork`. Streams: `log/entry` → … → `loop/terminated`, plus `loop/proposal`, `telemetry/event`. Full live catalog: the `discover` RPC.
18
+
19
+ ```
20
+ ws connect → session.create({ projectRoot }) → loop.run({ prompt })
21
+ → read log/entry notifications until loop/terminated
22
+ ```
23
+
24
+ The human CLI over this surface is [plurnk](https://github.com/plurnk/plurnk).
25
+
26
+ ## Run
27
+
28
+ ```
29
+ npm install -g @plurnk/plurnk-service
30
+ plurnk-service start # daemon (`migrate` initializes the DB)
31
+ ```
32
+
33
+ Config + state live in `~/.plurnk/` (created on first run): put your config in `~/.plurnk/.env` (yours, seeded once); the DB defaults to `~/.plurnk/plurnk.db`. Provider-agnostic — point `PLURNK_MODEL` at any vendor. **[`INSTALL.md`](./INSTALL.md) is the config guide** — the cascade, the prefix taxonomy, the coupling matrix, and profiles for common deployments; `.env.defaults` is the terse machine floor it breaks down (per-package, assembled at boot). Also exports `{ Engine, Daemon, SchemeRegistry }` for in-process embedding.
34
+
35
+ ## Contract & siblings
36
+
37
+ - [`SPEC.md`](./SPEC.md) — canonical specification. One `§<tag>` namespace; anchors `{§<tag>}` bind 1:1 to `test/intg/spec-anchors.test.ts`.
38
+ - [plurnk-providers](https://github.com/plurnk/plurnk-providers) §provider · [plurnk-schemes](https://github.com/plurnk/plurnk-schemes) §scheme-surface · [plurnk-mimetypes](https://github.com/plurnk/plurnk-mimetypes) §mimetype-surface · [plurnk-execs](https://github.com/plurnk/plurnk-execs) §bundled-set.
39
+
40
+ ## Semantic search
41
+
42
+ `FIND`'s `~query` ranks semantically via an optional embedder peer, `@plurnk/plurnk-mimetypes-embeddings` (heavy native deps; not installed by default). Absent → `~query` falls back to FTS keyword ranking and `start` prints an `embedder inactive` notice. Enable vector search: `npm i @plurnk/plurnk-mimetypes-embeddings`.
43
+
44
+ ## Tests
45
+
46
+ `test:lint`, `test:unit`, `test:intg`, `test:live`, `test:demo`; off-hot-path `test:installation`.