@plurnk/plurnk-service 0.43.0 → 0.45.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 (141) hide show
  1. package/.env.example +28 -28
  2. package/README.md +37 -18
  3. package/SPEC.md +64 -35
  4. package/dist/core/ChannelWrite.d.ts +4 -0
  5. package/dist/core/ChannelWrite.d.ts.map +1 -1
  6. package/dist/core/ChannelWrite.js +9 -0
  7. package/dist/core/ChannelWrite.js.map +1 -1
  8. package/dist/core/ChannelWrite.sql +69 -0
  9. package/dist/core/Engine.d.ts.map +1 -1
  10. package/dist/core/Engine.js +115 -77
  11. package/dist/core/Engine.js.map +1 -1
  12. package/dist/core/Engine.sql +291 -0
  13. package/dist/core/ExecutorRegistry.d.ts +4 -2
  14. package/dist/core/ExecutorRegistry.d.ts.map +1 -1
  15. package/dist/core/ExecutorRegistry.js +14 -4
  16. package/dist/core/ExecutorRegistry.js.map +1 -1
  17. package/dist/core/SchemeRegistry.d.ts +1 -0
  18. package/dist/core/SchemeRegistry.d.ts.map +1 -1
  19. package/dist/core/SchemeRegistry.js +22 -21
  20. package/dist/core/SchemeRegistry.js.map +1 -1
  21. package/dist/core/fork.d.ts.map +1 -1
  22. package/dist/core/fork.js +8 -1
  23. package/dist/core/fork.js.map +1 -1
  24. package/dist/core/fork.sql +50 -0
  25. package/dist/core/plugin-attribution.d.ts +5 -0
  26. package/dist/core/plugin-attribution.d.ts.map +1 -0
  27. package/dist/core/plugin-attribution.js +39 -0
  28. package/dist/core/plugin-attribution.js.map +1 -0
  29. package/dist/core/run-ops.sql +16 -0
  30. package/dist/core/session-settings.d.ts +1 -0
  31. package/dist/core/session-settings.d.ts.map +1 -1
  32. package/dist/core/session-settings.js +2 -1
  33. package/dist/core/session-settings.js.map +1 -1
  34. package/dist/schemes/Exec.d.ts +1 -1
  35. package/dist/schemes/Exec.d.ts.map +1 -1
  36. package/dist/schemes/Exec.js +19 -6
  37. package/dist/schemes/Exec.js.map +1 -1
  38. package/dist/schemes/File.d.ts +0 -1
  39. package/dist/schemes/File.d.ts.map +1 -1
  40. package/dist/schemes/File.js +29 -4
  41. package/dist/schemes/File.js.map +1 -1
  42. package/dist/schemes/Known.d.ts +0 -1
  43. package/dist/schemes/Known.d.ts.map +1 -1
  44. package/dist/schemes/Known.js +2 -1
  45. package/dist/schemes/Known.js.map +1 -1
  46. package/dist/schemes/Log.d.ts +0 -1
  47. package/dist/schemes/Log.d.ts.map +1 -1
  48. package/dist/schemes/Log.js +2 -1
  49. package/dist/schemes/Log.js.map +1 -1
  50. package/dist/schemes/Log.sql +37 -0
  51. package/dist/schemes/Plurnk.d.ts +0 -1
  52. package/dist/schemes/Plurnk.d.ts.map +1 -1
  53. package/dist/schemes/Plurnk.js +2 -1
  54. package/dist/schemes/Plurnk.js.map +1 -1
  55. package/dist/schemes/Run.d.ts +0 -1
  56. package/dist/schemes/Run.d.ts.map +1 -1
  57. package/dist/schemes/Run.js +2 -1
  58. package/dist/schemes/Run.js.map +1 -1
  59. package/dist/schemes/Unknown.d.ts +0 -1
  60. package/dist/schemes/Unknown.d.ts.map +1 -1
  61. package/dist/schemes/Unknown.js +2 -1
  62. package/dist/schemes/Unknown.js.map +1 -1
  63. package/dist/schemes/_entry-crud.sql +88 -0
  64. package/dist/schemes/_entry-find.sql +31 -0
  65. package/dist/schemes/_entry-graph.sql +60 -0
  66. package/dist/schemes/_entry-manifest.d.ts.map +1 -1
  67. package/dist/schemes/_entry-manifest.js +4 -1
  68. package/dist/schemes/_entry-manifest.js.map +1 -1
  69. package/dist/schemes/_entry-ops.sql +20 -0
  70. package/dist/schemes/_entry-semantic.sql +64 -0
  71. package/dist/schemes/exec-env.js +1 -1
  72. package/dist/schemes/exec-env.js.map +1 -1
  73. package/dist/server/Daemon.d.ts.map +1 -1
  74. package/dist/server/Daemon.js +103 -37
  75. package/dist/server/Daemon.js.map +1 -1
  76. package/dist/server/clientTurn.sql +10 -0
  77. package/dist/server/drain.sql +82 -0
  78. package/dist/server/dsl.d.ts.map +1 -1
  79. package/dist/server/dsl.js +11 -4
  80. package/dist/server/dsl.js.map +1 -1
  81. package/dist/server/envelope.sql +75 -0
  82. package/dist/server/logEntry.sql +10 -0
  83. package/dist/server/methods/_dispatchAsClient.d.ts.map +1 -1
  84. package/dist/server/methods/_dispatchAsClient.js +11 -6
  85. package/dist/server/methods/_dispatchAsClient.js.map +1 -1
  86. package/dist/server/methods/entry_read.sql +21 -0
  87. package/dist/server/methods/log_read.sql +11 -0
  88. package/dist/server/methods/loop_run.d.ts.map +1 -1
  89. package/dist/server/methods/loop_run.js +4 -0
  90. package/dist/server/methods/loop_run.js.map +1 -1
  91. package/dist/server/methods/loop_run.sql +9 -0
  92. package/dist/server/methods/session_create.d.ts.map +1 -1
  93. package/dist/server/methods/session_create.js +10 -3
  94. package/dist/server/methods/session_create.js.map +1 -1
  95. package/dist/service.d.ts +6 -0
  96. package/dist/service.d.ts.map +1 -0
  97. package/dist/service.js +221 -0
  98. package/dist/service.js.map +1 -0
  99. package/package.json +29 -15
  100. package/requirements.md +2 -1
  101. package/bin/plurnk-service.ts +0 -176
  102. package/dist/core/ProviderRegistry.d.ts +0 -42
  103. package/dist/core/ProviderRegistry.d.ts.map +0 -1
  104. package/dist/core/ProviderRegistry.js +0 -72
  105. package/dist/core/ProviderRegistry.js.map +0 -1
  106. package/dist/core/line-marker.d.ts +0 -23
  107. package/dist/core/line-marker.d.ts.map +0 -1
  108. package/dist/core/line-marker.js +0 -321
  109. package/dist/core/line-marker.js.map +0 -1
  110. package/dist/core/matcher.d.ts +0 -12
  111. package/dist/core/matcher.d.ts.map +0 -1
  112. package/dist/core/matcher.js +0 -72
  113. package/dist/core/matcher.js.map +0 -1
  114. package/dist/core/mimetype-binary.d.ts +0 -6
  115. package/dist/core/mimetype-binary.d.ts.map +0 -1
  116. package/dist/core/mimetype-binary.js +0 -82
  117. package/dist/core/mimetype-binary.js.map +0 -1
  118. package/dist/core/path-mimetype.d.ts +0 -3
  119. package/dist/core/path-mimetype.d.ts.map +0 -1
  120. package/dist/core/path-mimetype.js +0 -47
  121. package/dist/core/path-mimetype.js.map +0 -1
  122. package/dist/core/plugin-trust.d.ts +0 -4
  123. package/dist/core/plugin-trust.d.ts.map +0 -1
  124. package/dist/core/plugin-trust.js +0 -23
  125. package/dist/core/plugin-trust.js.map +0 -1
  126. package/dist/providers/Mock.d.ts +0 -43
  127. package/dist/providers/Mock.d.ts.map +0 -1
  128. package/dist/providers/Mock.js +0 -36
  129. package/dist/providers/Mock.js.map +0 -1
  130. package/dist/server/methods/op_hide.d.ts +0 -5
  131. package/dist/server/methods/op_hide.d.ts.map +0 -1
  132. package/dist/server/methods/op_hide.js +0 -24
  133. package/dist/server/methods/op_hide.js.map +0 -1
  134. package/dist/server/methods/op_show.d.ts +0 -5
  135. package/dist/server/methods/op_show.d.ts.map +0 -1
  136. package/dist/server/methods/op_show.js +0 -24
  137. package/dist/server/methods/op_show.js.map +0 -1
  138. package/dist/server/methods/session_set_persona.d.ts +0 -5
  139. package/dist/server/methods/session_set_persona.d.ts.map +0 -1
  140. package/dist/server/methods/session_set_persona.js +0 -29
  141. package/dist/server/methods/session_set_persona.js.map +0 -1
package/.env.example CHANGED
@@ -1,10 +1,20 @@
1
- # plurnk-service environment cascade.
1
+ # plurnk-service config — the shipped legend: every knob + its default.
2
2
  #
3
- # Override order: `.env.example` < `.env` < `.env.<profile>` < shell < params.
4
- # Feature-flag bools use `=== "1"` exactly. Never `=== "true"`.
3
+ # On first run this file is copied to ~/.plurnk/.env.example, which is the cascade FLOOR.
4
+ # Edit there (or layer ~/.plurnk/.env over it). This node_modules copy is the SEED + the
5
+ # source of derived --<knob> CLI flags — it is NOT itself a runtime layer.
6
+ #
7
+ # Override order (low → high precedence):
8
+ # ~/.plurnk/.env.example (the floor — override, don't remove!)
9
+ # < ~/.plurnk/.env (your home config)
10
+ # < ./.env (per-project, current directory)
11
+ # < --env-file=… / --config=…
12
+ # < shell environment
13
+ # < --<knob> CLI flags
14
+ # Feature-flag bools use `=== "1"` exactly, never `=== "true"`. `~/` expands to your home.
5
15
 
6
16
  # --- Storage ---
7
- PLURNK_DB_PATH=./plurnk.db
17
+ PLURNK_DB_PATH=~/.plurnk/plurnk.db
8
18
 
9
19
  # --- Sqlite tuning (curated knobs passed through to sqlrite; optional) ---
10
20
  # sqlrite already sets the safe posture (WAL + synchronous=NORMAL + busy_timeout=5000ms).
@@ -23,28 +33,22 @@ PLURNK_HOST=127.0.0.1
23
33
  PLURNK_PORT=3044
24
34
 
25
35
  # --- Model aliases ---
26
- # PLURNK_MODEL is the active provider for every loop (a client may override per
27
- # loop via loop.run({alias})). Out of the box it is `plurnk` the zero-friction
28
- # default: Plurnk, Inc.'s hosted, grammar-tuned model at model.plurnk.ai, served
29
- # anonymously with no account on a throttled free tier. Change this one line to
30
- # use another model; set it empty for no default provider. Prompts on the default
31
- # route to model.plurnk.ai — see "Plurnk account" below for (optional) creds.
32
- PLURNK_MODEL=plurnk
33
-
36
+ # PLURNK_MODEL is the active provider for every loop (a client may override per loop
37
+ # via loop.run({alias})). Out of the box it is `plurnk`. Change this one line to use
38
+ # another model; set it empty for no default provider.
39
+ # PLURNK_MODEL_alias=openai/gemma (presumes PLURNK_BASE_URL set locally)
34
40
  PLURNK_MODEL_plurnk="plurnk/plurnk"
35
41
 
42
+ PLURNK_MODEL=plurnk
43
+
36
44
  # --- Plurnk account (OPTIONAL) ---
37
- # Plurnk Service is vendor-agnostic, and connects to (almost) any LLM.
38
- # Plurnk Service is MIT Licensed and owned by Plurnk Foundation, not Plurnk, Inc.
39
- # Plurnk, Inc.'s grammar-tuned plurnk.ai model is offered as an optional convenience.
40
- # You may (OPTIONALLY) obtain free PLURNK_ACCOUNT and PLURNK_KEY variables at https://plurnk.ai.
41
-
42
- # PLURNK_ACCOUNT="..."
43
- # PLURNK_KEY="..."
44
- # The hosted endpoint defaults to https://model.plurnk.ai/v1; override it to self-
45
- # host the model or point at a mirror — it speaks the llama-server API (same grammar
46
- # transport) like the local model.
47
- # PLURNK_BASE_URL="https://model.plurnk.ai/v1"
45
+ # Plurnk Service is vendor-agnostic and connects to (almost) any LLM. MIT Licensed.
46
+ # You may (OPTIONALLY) obtain a free PLURNK_API_KEY bearer token at https://plurnk.ai.
47
+
48
+ # PLURNK_API_KEY="..."
49
+ # PLURNK_BASE_URL overrides the default endpoint — self-host or point at a mirror that
50
+ # speaks the llama-server API (same grammar transport).
51
+ # PLURNK_BASE_URL="..."
48
52
 
49
53
  # --- Loop control ---
50
54
  # Operator turn ceiling. -1 (default) = no cap (loops end via SEND, budget,
@@ -119,11 +123,6 @@ PLURNK_SESSION_RUNS_MAX_ACTIVE=-1
119
123
  # adaptive / no cap, N = capped at N tokens. Provider modules translate it per model
120
124
  # family (reasoning_effort tiers, budget_tokens). Floor (gemma): 0.
121
125
  PLURNK_PROVIDERS_REASONING_BUDGET=-1
122
- #
123
- # Planning: enable the grammar's <<PLAN:...:PLAN op so the model reasons in-band before
124
- # acting. A shared universal knob (like PLURNK_FETCH_TIMEOUT below): the service advertises
125
- # the op in # Plurnk System Tools; the provider reads it too. =1 on, =0 off.
126
- PLURNK_PLAN=0
127
126
  # Service-wide fetch timeout in ms — the universal upper bound on any
128
127
  # single outbound request (provider calls, future http:// scheme reads,
129
128
  # anything that does network IO). Streamed completions can run long;
@@ -141,6 +140,7 @@ PLURNK_VERSION_POLL_TTL=3600000
141
140
  # A bare name (plurnk.gbnf) is a variant shipped by
142
141
  # @plurnk/plurnk-grammar; an absolute/relative path is your own. =0 (or empty) disables.
143
142
  # PLURNK_PROVIDERS_GBNF=plurnk.gbnf
143
+
144
144
  # Provider retry attempts (providers 0.7+): how many times generate() retries a
145
145
  # TRANSIENT failure (429 rate-limit, 5xx/network) with exponential backoff (base 2s
146
146
  # is a provider constant — the COUNT is the operator knob). REQUIRED, fail-hard if
package/README.md CHANGED
@@ -1,29 +1,48 @@
1
1
  # plurnk-service
2
2
 
3
- LLM agent runtime engine. Consumes [plurnk-grammar](https://github.com/plurnk/plurnk-grammar); exposes WebSocket JSON-RPC for clients. User-facing CLI: [plurnk](https://github.com/plurnk/plurnk).
4
- Default Provider: [plurnk.ai](https://plurnk.ai).
3
+ > Plurnk is in early-alpha public testing see https://status.plurnk.ai for current status.
5
4
 
6
- * Plurnk Service is vendor-agnostic, and connects to (almost) any LLM.
7
- * Plurnk Service is MIT Licensed and owned by Plurnk Foundation, not Plurnk, Inc.
8
- * Plurnk, Inc.'s grammar-tuned [plurnk.ai](https://plurnk.ai) model is offered as an optional convenience.
9
- * You may (OPTIONALLY) obtain free PLURNK_ACCOUNT and PLURNK_KEY variables at [plurnk.ai](https://plurnk.ai).
5
+ 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.
10
6
 
11
- ## Documentation
7
+ ## What an agent can do
12
8
 
13
- - [`SPEC.md`](./SPEC.md) canonical specification. Sections and promises share one terse-tag namespace (`§<tag>`, no digits). Anchors `{§<tag>}` bind to integration tests (`test/intg/spec-anchors.test.ts`).
14
- - [`AGENTS.md`](./AGENTS.md) — collaboration memory for agents working on this repo (gitignored).
9
+ 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.
15
10
 
16
- ## Sibling contracts
11
+ Over schemes: `file://` project files · `exec://` command output · `http(s)://` web fetch · `run://` sibling agent runs (spawn / fork / message) · `known://` scratch · `log://` own history.
17
12
 
18
- Author-facing contracts hosted in their own repos. plurnk-service is the consumer; consumption surface section noted.
13
+ ## Loop model
19
14
 
20
- | Repo | Domain | Consumption |
21
- |---|---|---|
22
- | [plurnk-providers](https://github.com/plurnk/plurnk-providers) | LLM transports + tokenomic primitives | SPEC §provider |
23
- | [plurnk-schemes](https://github.com/plurnk/plurnk-schemes) | URI scheme handlers | SPEC §scheme-surface |
24
- | [plurnk-mimetypes](https://github.com/plurnk/plurnk-mimetypes) | Content interpreters | SPEC §mimetype-surface |
25
- | [plurnk-execs](https://github.com/plurnk/plurnk-execs) | Runtime executors (EXEC dispatch) | SPEC §bundled-set |
15
+ 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.
16
+
17
+ ## Integration (WebSocket JSON-RPC)
18
+
19
+ 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.
20
+
21
+ ```
22
+ ws connect → session.create({ projectRoot }) → loop.run({ prompt })
23
+ → read log/entry notifications until loop/terminated
24
+ ```
25
+
26
+ The human CLI over this surface is [plurnk](https://github.com/plurnk/plurnk).
27
+
28
+ ## Run
29
+
30
+ ```
31
+ npm install -g @plurnk/plurnk-service
32
+ plurnk-service start # daemon (`migrate` initializes the DB)
33
+ ```
34
+
35
+ Config + state live in `~/.plurnk/` (created on first run): set `PLURNK_MODEL` and friends in `~/.plurnk/.env`; the DB defaults to `~/.plurnk/plurnk.db`. Provider-agnostic — point `PLURNK_MODEL` at any vendor. Full override cascade (`~/.plurnk` < `./.env` < `--env-file` < shell < `--flags`) is documented at the top of `.env.example`. Also exports `{ Engine, Daemon, SchemeRegistry }` for in-process embedding.
36
+
37
+ ## Contract & siblings
38
+
39
+ - [`SPEC.md`](./SPEC.md) — canonical specification. One `§<tag>` namespace; anchors `{§<tag>}` bind 1:1 to `test/intg/spec-anchors.test.ts`.
40
+ - [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.
41
+
42
+ ## Semantic search
43
+
44
+ `FIND` ranks via an optional embedder peer, `@plurnk/plurnk-mimetypes-embeddings` (heavy native deps; not installed by default). Absent → `FIND` degrades and `start` prints an `embedder inactive` notice. Enable: `npm i @plurnk/plurnk-mimetypes-embeddings`.
26
45
 
27
46
  ## Tests
28
47
 
29
- Tiers per SPEC §test-taxonomy. Scripts: `test:lint`, `test:unit`, `test:intg`, `test:live`, `test:demo`.
48
+ `test:lint`, `test:unit`, `test:intg`, `test:live`, `test:demo`; off-hot-path `test:installation`.
package/SPEC.md CHANGED
@@ -72,7 +72,7 @@ Independent axes on entries and channels. Confusion across them is a recurring s
72
72
  | Term | Meaning |
73
73
  |---|---|
74
74
  | **packet** | The turn's full exchange shape: `{system, user, assistant, assistantRaw}`. Persisted on `turns.packet`. |
75
- | **log** | `packet.system.log`. Chronological list of `log_entries` in scope this turn. |
75
+ | **log** | the `log` section. Chronological list of `log_entries` in scope this turn. |
76
76
  | **render** | The act of computing the packet from current DB state at turn boundaries. Mimetype handlers fire at render time. |
77
77
 
78
78
  ### §test-taxonomy Test taxonomy
@@ -102,7 +102,7 @@ Dependency direction (from root to leaf):
102
102
  - `plurnk-mimetypes` — handler base classes, discovery, fitting algorithm, matcher dispatch. Handler children are per-mimetype: `plurnk-mimetypes-text-{python,typescript,markdown,html,csv,plain}`, `plurnk-mimetypes-application-{json,yaml,toml,pdf}`, …
103
103
  - `plurnk-schemes` — scheme-author types (`SchemeManifest`, `WriterTier`, `LoopFlags`), result-shape contracts (`EntryResult` / `ProposalResult` / `PassthroughResult`), slicing primitives, matcher helpers, `schemeError(...)` constructor. Future scheme children: `plurnk-schemes-http`, `plurnk-schemes-git`, …
104
104
  - `plurnk-execs` — `BaseExecutor`, `SubprocessExecutor`, runtime resolver, discovery. Children declare runtimes: `plurnk-execs-sh`, future `plurnk-execs-search`, `plurnk-execs-node`, …
105
- - **`plurnk-service`** (this repo) — consumes all of the above. Implements the engine, dispatches ops through scheme handlers, hosts the in-tree set of schemes (`plurnk`, `log`, `exec`, `known`, `unknown`, `skill`, `file`), discovers installed mimetype handlers + provider vendors + executor siblings at boot, hosts the daemon (`bin/plurnk-service.ts` over WebSocket + JSON-RPC), and projects packets to the wire per `Packet.json`. Most of the substantive runtime work lives here.
105
+ - **`plurnk-service`** (this repo) — consumes all of the above. Implements the engine, dispatches ops through scheme handlers, hosts the in-tree set of schemes (`plurnk`, `log`, `exec`, `known`, `unknown`, `skill`, `file`), discovers installed mimetype handlers + provider vendors + executor siblings at boot, hosts the daemon (`src/service.ts` over WebSocket + JSON-RPC), and projects packets to the wire per `Packet.json`. Most of the substantive runtime work lives here.
106
106
  - **`plurnk`** (client) — terminal UI consuming the daemon's RPC surface. Renders `telemetry/event` notifications, subscribes to log/stream/proposal events. No engine logic of its own.
107
107
 
108
108
  The grammar is the contract. The frameworks consume the contract and add author-facing surfaces. The service consumes the frameworks and runs the engine. The client consumes the service and renders to humans. Each tier is its own published package; each tier's evolution happens in its own repo.
@@ -188,6 +188,17 @@ Beyond the three creation ops:
188
188
  - **Cap** — `PLURNK_SESSION_RUNS_MAX_ACTIVE` ceilings the *concurrent* active runs per session (a run with a non-terminal loop); a spawn or fork past it fails hard (508 — no queue, no retry), irc exempt; `-1` disables it. The fork-bomb brake, sized for sessions that live for months. {§run-scheme-cap}
189
189
  - **Collect** — a run's loop reaching a terminal status surfaces to its sisters as an ambient FOLDED delta (§env-delta): a `SEND` from `run:///<name>` carrying the loop's deliverable — the `SEND[200]` body, or for an abandonment the reason. Every death-path is stamped uniformly, so no termination is silent; collection is the shared world moving, never a verb. {§run-scheme-collect}
190
190
 
191
+ ### §run-lifecycle Run lifecycle: the drain, the reap, the passive wake
192
+
193
+ A run is a **log plus a cancellation scope** — one `AbortController` per run, reused while live and replaced only once aborted, so a cancel ends the run as a unit and a later `loop.run` is never born cancelled. A run's queued loops are advanced by a **drain**: a single per-run worker that claims loops atomically (status 100→102) and runs each under the run's scope. A loop may spawn **streams** (execs) that outlive it; each is a row in the subscription registry (§subscriptions) — the durable record of what the run holds open. Cancellation and conclusion are defined against these structures, never wall-clock timing.
194
+
195
+ - **One drain advances a run.** At most one drain is registered for a run at any instant: a `loop.run` or wake on a run with a live drain folds in (active→next-turn) or enqueues a loop that drain claims, never a second parallel drain. A drain's start and its empty-queue teardown relinquish run under one per-run lock, so the teardown's re-claim cannot race a concurrent start into a double-drain. {§run-lifecycle-single-drain}
196
+ - **A cancel reaps every stream the run holds — by the registry.** `loop.cancel` / `KILL` / shutdown abort the run scope AND iterate the run's open subscriptions, aborting each via its owning scheme; the registry is the source of truth, the in-process abort signal a fast-path optimization. A stream that is running, mid-spawn (its row written before it is killable), or spawned after the cancel is reaped alike. {§run-lifecycle-total-reap}
197
+ - **A stream's kill binds to the scope it captured at spawn.** A stream captures the run's cancellation scope as it registers and wires its kill to it, re-checking `aborted` AFTER wiring — no check-then-listen gap can drop an abort that lands mid-registration. Because the scope is replaced only once aborted, a captured-then-replaced scope is necessarily already aborted, so replacement never strands a live stream. {§run-lifecycle-exec-epoch-bound}
198
+ - **A cancelled run is not resurrected by its own torn-down work.** A stream conclusion delivered to a cancelled, idle run starts no fresh drain: an aborted (499) conclusion is skipped, and a straggler that concluded cleanly surfaces its deliverable as an environment delta (§env-delta), never a revived loop. The cancel was deliberate; only an explicit `loop.run` resumes the run. {§run-lifecycle-no-resurrection}
199
+ - **A stream conclusion always reaches its run.** When a backgrounded stream concludes, the daemon routes it through the same inject seam as any loop source (§actor-boundary-passive-wake): an active run folds the summary into its next turn; a dormant run opens a fresh loop with the summary as its prompt — a long-running result is never lost because its spawning loop ended first. {§run-lifecycle-wake-liveness}
200
+ - **A loop is never stranded by a drain's exit.** A drain relinquishes its registry slot only after a lock-held re-claim confirms the queue is empty; a loop enqueued during that teardown is either re-claimed by the exiting drain or claimed by a fresh drain that a later inject starts. The relinquish and the start are serialized, so neither the lost-loop hang nor a transient double-drain can occur. {§run-lifecycle-no-lost-loop}
201
+
191
202
  ---
192
203
 
193
204
  ## §provider Provider Contract
@@ -206,12 +217,26 @@ Plus immutable identity: `provider.contextSize` (token total, or `null` → "no
206
217
 
207
218
  ### §provider-guarantees Engine → provider guarantees
208
219
 
209
- - `messages` is a complete prompt (`system_definition`, `index`, `log`, `prompt`, `telemetry`, `system_requirements` pre-assembled). Provider does not reorder.
220
+ - `messages` is a complete prompt (the section list, pre-assembled into the system + user messages). Provider does not reorder.
210
221
  - `signal` is wired to the run's AbortController. {§provider-guarantees-signal-wired}
211
222
  - `generate` is single-call per turn. No parallel calls on the same instance. {§provider-guarantees-single-call}
212
223
  - `assistantRaw` is opaque to the engine (forensics-only). {§provider-guarantees-assistantraw-opaque}
213
224
  - `countTokens` is cheap by contract; engine calls frequently.
214
225
 
226
+ ### §attribution First-party plugin attribution
227
+
228
+ A plugin declares an opaque attribution tag in its `package.json` so the creators behind it can be credited when the plugin is active:
229
+
230
+ ```
231
+ { "plurnk": { "attribution": "@acme/widgets" } } // a string, or string[]
232
+ ```
233
+
234
+ The engine unions the declared tags of the active plugin families (schemes, execs) onto `generate({ attributions })`, deduped + stable, per turn; an empty set is omitted. The service does not interpret a tag; richer creator identities (`@plurnk/creators/<name>`) ride the same namespace later.
235
+
236
+ **The `@plurnk/` namespace is reserved.** A package may declare an `@plurnk/` tag only if it is itself `@plurnk/`-scoped (npm enforces scope ownership at publish); otherwise it fails hard. {§attribution-plurnk-namespace-reserved}
237
+
238
+ Deferred (#249): grounding the value in real per-turn value flow rather than the active-plugin placeholder, token-weighting, entry-level attribution, and the `client` id. Native surfacing of the field in each framework's `discover()` supersedes the service-side manifest read and extends collection to mimetype + provider plugins.
239
+
215
240
  ### §provider-instantiation Provider instantiation
216
241
 
217
242
  Model alias parsing (`parseAliasesFromEnv` / `resolveActiveAlias`) lives in [`@plurnk/plurnk-providers`](https://github.com/plurnk/plurnk-providers). {§provider-instantiation-alias-resolution} Dynamic provider instantiation (`instantiateProvider` / `loadActiveProvider`) lives in `src/core/ProviderInstantiate.ts` here — `import()` resolves package specifiers relative to the calling module, so the dynamic-import path stays in the consumer where the `@plurnk/plurnk-providers-<vendor>` packages are installed.
@@ -306,7 +331,7 @@ Engine → scheme guarantees:
306
331
  - `ctx.writer` reflects the actual writer at this dispatch.
307
332
  - `manifest.writableBy` checked BEFORE invocation; engine returns 403 directly on exclusion. {§scheme-surface-writableby-403}
308
333
  - `ctx.signal` is wired to the run's AbortController (§provider-guarantees-signal-wired).
309
- - Scheme exceptions become the action-entry's outcome (status 500); summary surfaces in next turn's `packet.user.telemetry.errors[]` (§telemetry). {§scheme-surface-exception-500}
334
+ - Scheme exceptions become the action-entry's outcome (status 500); summary surfaces in next turn's `errors` section (§telemetry). {§scheme-surface-exception-500}
310
335
 
311
336
  **Tokenization participation.** Schemes route writes through the shared `_entry-crud.ts` write helper (in plurnk-service today; migrates to plurnk-schemes). Helper populates `entry_channels.tokens` at write time via `ctx.provider.countTokens` (§tokenomics-tokens-stored-at-write). Raw DB writes bypass tokenization — out of API scope.
312
337
 
@@ -562,7 +587,7 @@ A side-effecting op does not execute on dispatch — it **proposes**. The scheme
562
587
 
563
588
  A caller-supplied `outcome` overrides the default, but `outcome` is **forensics-only** — never in the model-facing `rx`. So a YOLO accept, a human reject, and a timeout are indistinguishable to the model: the action **occurred** (200) or it **didn't** (400/499), nothing about how it was administratively resolved (§telemetry).
564
589
 
565
- **A proposed row is invisible until it resolves.** A `state='proposed'` / 202 row is withheld from `packet.system.log`; it surfaces only after resolution, carrying its terminal status — the model sees outcomes, never pending proposals. {§proposal-proposed-hidden}
590
+ **A proposed row is invisible until it resolves.** A `state='proposed'` / 202 row is withheld from the `log` section; it surfaces only after resolution, carrying its terminal status — the model sees outcomes, never pending proposals. {§proposal-proposed-hidden}
566
591
 
567
592
  ---
568
593
 
@@ -586,7 +611,7 @@ SSE event types, WS message types, exec stdout/stderr each map to a named channe
586
611
 
587
612
  Channels are the source of truth for chunk content. Log captures lifecycle events only: open (102), graceful close (200), cancel (499), errors (5xx), scheme-significant transitions. {§no-chunk-rows-log-captures-lifecycle-only}
588
613
 
589
- Model sees lifecycle events in `packet.system.log[]` per turn.
614
+ Model sees lifecycle events in the `log` section per turn.
590
615
 
591
616
  ### §deep-slices Deep slices on demand
592
617
 
@@ -682,7 +707,7 @@ Plugin discovery (§plugin-discovery) registers whatever's in `node_modules/@plu
682
707
  | `Unknown.ts` | `@plurnk/plurnk-schemes-unknown` | Open questions / decomposition. |
683
708
  | `Skill.ts` | `@plurnk/plurnk-schemes-skill` | Skill docs; same shape as known. |
684
709
  | `Plurnk.ts` | may stay in-tree | `plurnk:///prompt/<loop_id>` carries each loop's prompt. Model-origin writes to `plurnk:///prompt/*` rejected in-handler. |
685
- | `Log.ts` | may stay in-tree | Read-only coordinate-addressed (`log:///<L>/<T>/<S>`). Renders as JSON meta line in packet log; status ≥ 400 mirrors to `packet.user.telemetry.errors[]` (§telemetry). |
710
+ | `Log.ts` | may stay in-tree | Read-only coordinate-addressed (`log:///<L>/<T>/<S>`). Renders as a JSON meta line in the `log` section; status ≥ 400 mirrors to the `errors` section (§telemetry). |
686
711
  | `File.ts` | `@plurnk/plurnk-schemes-file` | Filesystem-backed. **Model is never trained on `file:///` and never sees it.** Bare paths are model-facing; `file:///` accepted as input, renders bare. |
687
712
  | `Exec.ts` | stays in-tree | Dispatches EXEC op to runtime executors registered via [plurnk-execs](https://github.com/plurnk/plurnk-execs). |
688
713
 
@@ -714,7 +739,7 @@ Plugin discovery (§plugin-discovery) registers whatever's in `node_modules/@plu
714
739
 
715
740
  ## §operator-config Operator Configuration
716
741
 
717
- Env-var cascade: `.env.example` < `.env` < `.env.<config>` (via `--config=`) < shell < CLI flags. `bin/plurnk-service.ts` auto-loads `.env.example`; zero-setup boot.
742
+ Env-var cascade: `.env.example` < `.env` < `.env.<config>` (via `--config=`) < shell < CLI flags. `src/service.ts` auto-loads `.env.example`; zero-setup boot.
718
743
 
719
744
  Model selection: separate alias cascade in `ProviderRegistry` (§provider-instantiation). `PLURNK_MODEL_<alias>=<provider>/<model-id>` declares; `PLURNK_MODEL=<alias>` selects. Aliases live in `.env`, not `.env.example` (operator-specific).
720
745
 
@@ -734,7 +759,6 @@ Model selection: separate alias cascade in `ProviderRegistry` (§provider-instan
734
759
  | `PLURNK_MANIFEST_ITEMS` | `0` | enforced | Turn-0 manifest preview foisted into the model's first turn. `-1` = full `plurnk:///manifest.json`; positive `N` = the first N items (jsonpath slice); `0` / unset = off (§actor-boundary-manifest-preview). |
735
760
  | `PLURNK_PROPOSAL_TIMEOUT_MS` | `300000` | enforced | ms wait for a proposed entry (status=202) to be resolved before timing out. |
736
761
  | `PLURNK_PROVIDERS_REASON_LEVEL` | `0` | enforced | Reasoning **magnitude** sent to the providers: `0` = none, positive = effort/budget the provider module translates to wire format (o-series tiers, Anthropic `budget_tokens`). The on/off is the `PLURNK_PROVIDERS_REASONING` gate. |
737
- | `PLURNK_PLAN` | `0` | enforced | Enable the grammar's `<<PLAN` op — advertised in the `# Plurnk System Tools` packet section (§tools). `1` on, `0` off. |
738
762
  | `PLURNK_FETCH_TIMEOUT` | `600000` | enforced | Service-wide ms ceiling on any outbound request (providers, future http schemes). Module-specific overrides are allowed below the ceiling. |
739
763
  | `PLURNK_DEBUG` | `0` | reserved | Schema-validation toggle. Not yet enforced. |
740
764
  | `PLURNK_LOG_LEVEL` | `info` | reserved | Stdout banner verbosity. Not yet enforced. |
@@ -754,14 +778,14 @@ Enforcement is per-use-site — no central most-restrictive pass; each ceiling i
754
778
  - `settings.mdDocs` (`[{alias, content}]`) **unions** with the server's `PLURNK_MD_*` docs, keyed by alias — a client adds its own repo docs atop the operator's systemwide policy doc. On alias collision the client wins (a deliberate shadow), but by default the policy doc rides into every session. The client sends content (it owns the file), not a path. {§operator-config-session-md-docs}
755
779
 
756
780
  *Ceilings — most-restrictive-wins (the client may only narrow, never widen):*
757
- - `settings.maxCommands` (number) **min()s** the `PLURNK_MAX_COMMANDS` per-emission cap for the session — a client tightens the runaway-op guard, never raises it past the operator's. {§operator-config-session-max-commands}
781
+ - `settings.maxCommands` (number) **min()s** the `PLURNK_MAX_COMMANDS` per-emission cap for the session — a client tightens the runaway-op guard, never raises it past the operator's. {§operator-config-session-max-commands} The cap bounds *actions* only: PLAN (reasoning) and a terminal `SEND` (signal ≥ 200, the conclusion) are never counted and always dispatch — so `0` is a valid floor (the tightest), admitting a plan and a conclusion with zero actions. {§operator-config-session-max-commands-floor}
758
782
  - `settings.git` (`false`) **denies** git for the session (`PLURNK_GIT_ALLOWED` AND session) — the client opts its session out of git membership + telemetry; it can never re-enable git past the operator's service-wide lockout. {§operator-config-session-git}
759
783
 
760
784
  Feature-flag bools use `process.env.X === "1"` exactly — never `=== "true"`.
761
785
 
762
786
  External plugins declare their own env vars in their own `.env.example`; service merges at boot via the cascade.
763
787
 
764
- **Admin CLI flag derivation.** `bin/plurnk-service.ts` auto-derives flags from `.env.example`: every `PLURNK_*` becomes `--<kebab-cased-name>` (prefix stripped, lowercased, underscores → dashes). Comment immediately above (no blank line) becomes `-h` description. Non-`PLURNK_*` vars in `.env.example` are bugs — vendor config belongs in the vendor's package namespace.
788
+ **Admin CLI flag derivation.** `src/service.ts` auto-derives flags from `.env.example`: every `PLURNK_*` becomes `--<kebab-cased-name>` (prefix stripped, lowercased, underscores → dashes). Comment immediately above (no blank line) becomes `-h` description. Non-`PLURNK_*` vars in `.env.example` are bugs — vendor config belongs in the vendor's package namespace.
765
789
 
766
790
  ---
767
791
 
@@ -998,15 +1022,15 @@ Pre-stabilization. Clients track HEAD. No semver until the interface is worth co
998
1022
 
999
1023
  Each entry: question, answer, rationale, migration path.
1000
1024
 
1001
- ### §packet-assembly Packet assembly: engine-direct, not filter-chain
1025
+ ### §packet-assembly Packet assembly: engine builds the default list, plugins transform it
1002
1026
 
1003
- **Question.** Rummy uses priority-ordered filter chains for packet assembly. Plurnk assembles directly in `Engine.#buildRequestPacket` (`#buildLog` + the materialized manifest catalog).
1027
+ **Question.** Rummy uses priority-ordered filter chains for packet assembly. Plurnk builds a default ordered section list directly in `Engine.#buildRequestPacket`, then lets trusted plugins rewrite it.
1004
1028
 
1005
- **Decision.** Engine-direct. Plugin-driven assembly is out of scope.
1029
+ **Decision.** Two stages. (1) The engine builds the default section list — the kernel sections `definition`, `tools`, `schemes`, `log` (system slot), then `prompt`, `budget`, `errors`, `git`, `requirements` (user slot). (2) `SchemeRegistry.transformSections` pipes that list through every registered scheme that implements `transformSections(sections) → sections`, in registration order, before the engine measures. A plugin returns whatever list it wants — add, remove, reorder. {§packet-plugin-transform}
1006
1030
 
1007
- **Rationale.** Channel + mimetype split already extends rendering. Filter chain would add indirection nothing exercises. Schemes-as-URI-handlers + mimetypes-as-renderers earn extensibility through different shapes than rummy's tag-per-plugin pattern.
1031
+ **Why a whole-list transform, not a per-section hook.** It is the legible, fork-avoiding seam: a plugin that can reshape the packet to its needs never has a reason to fork the engine (§ecosystem). And it is **strictly in-process and trusted** (behind `PLURNK_PLUGINS_TRUSTED_ONLY`) the client/RPC wire never reaches the packet, because handing an untrusted connection the model's entire context is exactly the actor-boundary violation the engine exists to prevent. Pure list-in/list-out; no context is handed to plugins.
1008
1032
 
1009
- **Migration path.** If a plugin needs to inject a packet section, grow a single `packet.augment` hook called after `#buildRequestPacket`; plugins return system/user augmentation objects merged into the packet. Additive engine-direct base stays.
1033
+ **Rationale.** The section list is first-class data (not two hardcoded render functions), so the transform is a few lines over the existing registry-pull pattern (the engine already pulls the scheme catalogue and the tools sheet from the registries). The grinder/fold (§grinder) stays engine-owned a closed build-time concern, never a plugin seam.
1010
1034
 
1011
1035
  ### §tokenomics Tokenomics: real provider tokens, render-weight budget, turn and entry weights
1012
1036
 
@@ -1143,35 +1167,34 @@ The CAS is the **hard backstop**, at the moment of writing, on every accept path
1143
1167
 
1144
1168
  ## §packet Packet shape
1145
1169
 
1146
- Canonical shape defined by `@plurnk/plurnk-grammar` (`schema/Packet.json`). Engine assembles in `Engine.#buildRequestPacket`; no plugin augmentation packet-assembly). This section is plurnk-service's responsibilities under that contract.
1170
+ **Service-owned.** grammar 0.67 deleted `Packet.json` the protocol scoped itself to the grammar, so the packet shape is now entirely plurnk-service's. The engine assembles it in `Engine.#buildRequestPacket` as an **ordered list of sections** that trusted plugins may rewrite (§packet-assembly).
1147
1171
 
1148
1172
  ```ts
1173
+ type PacketSection = {
1174
+ name: string; // stable id: definition, tools, schemes, log, prompt, budget, errors, git, requirements — or a plugin's own
1175
+ slot: "system" | "user"; // the prompt-cache boundary; system-slot sections build the cache-stable system message
1176
+ header: string | null; // "# Plurnk System X", or null (definition renders verbatim)
1177
+ content: string; // rendered markdown — what the model saw
1178
+ tokens: number; // measured render-weight
1179
+ };
1149
1180
  type Packet = {
1150
1181
  tokens: number;
1151
- system: {
1152
- tokens: number;
1153
- system_definition: string;
1154
- index: PacketEntry[]; // visible entries (§mimetype / §channels)
1155
- log: PacketLogRow[]; // chronological action-entries (§stream)
1156
- };
1157
- user: {
1158
- tokens: number;
1159
- prompt: string;
1160
- telemetry: { budget: string; errors: object[] }; // §telemetry
1161
- system_requirements: string; // §requirements
1162
- };
1182
+ sections: PacketSection[]; // the ordered, plugin-overridable list; the wire renders it by slot
1183
+ telemetryErrors: object[]; // structured telemetry events — the `errors` section's source; ephemeral (the packet is their only home, §telemetry)
1163
1184
  assistant: { tokens: number; content: string; ops: PlurnkStatement[]; reasoning: string | null };
1164
1185
  assistantRaw: unknown;
1165
1186
  };
1166
1187
  ```
1167
1188
 
1168
- **Prompt as a first-class entry.** Each loop's prompt is written on loop start as a plurnk-origin `EDIT` against `plurnk:///prompt/<loop_id>` (indexable, body channel, text/markdown). At render time the current loop's prompt body materializes into `packet.user.prompt`; the entry itself stays READ/FOLD-able like any other. The foisted `EDIT`'s **log row is folded by default** (`expanded=0`): the prompt body already lives in `packet.user.prompt`, so the log keeps the action for forensics while collapsing the duplicate body, re-OPENable like any fold (§open-fold). {§prompt-fold}
1189
+ The wire projection (`PacketWire.renderSlot`) groups sections by slot into the system + user ChatMessages; the digest re-renders the same stored sections byte-for-byte.
1190
+
1191
+ **Prompt as a first-class entry.** Each loop's prompt is written on loop start as a plurnk-origin `EDIT` against `plurnk:///prompt/<loop_id>` (indexable, body channel, text/markdown). At render time the current loop's prompt body materializes into the `prompt` section; the entry itself stays READ/FOLD-able like any other. The foisted `EDIT`'s **log row is folded by default** (`expanded=0`): the prompt body already lives in the `prompt` section, so the log keeps the action for forensics while collapsing the duplicate body, re-OPENable like any fold (§open-fold). {§prompt-fold}
1169
1192
 
1170
1193
  **The entry catalog.** `plurnk:///manifest.json` is a real session entry the model READs to discover what's available — rewritten every turn as a live view of the full entry set. Built in the schemes layer (`_entry-manifest`) and materialized like any entry (the engine only orchestrates the per-turn write — the same pattern as git membership), so it's READable and queryable. Body is `application/json`: a flat, **complete, unranked** array — one item per entry across all schemes, every entry listed in no relevance order, each `{ path, tags?, channels: { <name>: { mimetype, tokens, lines } } }`. `tags` is present only when the entry carries `entry_tags` — its own categorization, surfaced so the model sees it in the directory and can `FIND` by tag without a separate read. The model ranks and filters the catalog itself by querying it (task-aware); the catalog never ranks for it — the instant it did, it would be an index again. `tokens` is the provider's write-time count (budget depth), `lines` the content extent from `Mimetypes.process().totalLines`. The engine counts neither. It does not list itself. {§packet-manifest-catalog}
1171
1194
 
1172
1195
  ### §telemetry user.telemetry — model-facing runtime telemetry
1173
1196
 
1174
- Slot for telemetry the model MUST react to immediately. Rendered at the bottom of the user section. Errors are transientappear on the turn AFTER the failure, clear once seen. `packet.system.log[]` is the durable audit; `telemetry.errors[]` is the **alert**.
1197
+ Telemetry the model MUST react to immediately. Errors render in their own `errors` section (§packet-assembly unbundled them from a single telemetry block) transient, appearing on the turn AFTER the failure, clearing once seen. The `log` section is the durable audit; the `errors` section (rendered from `packet.telemetryErrors`) is the **alert**.
1175
1198
 
1176
1199
  **Grammar contract:**
1177
1200
 
@@ -1199,7 +1222,7 @@ Strike accounting, cycle detection, sudden-death thresholds, and no-ops bookkeep
1199
1222
 
1200
1223
  **No `error://` scheme.** Actionless failures route to telemetry, not a queryable scheme namespace.
1201
1224
 
1202
- **Client surface: `telemetry/event` notification.** Every event the engine pushes to the loop's telemetry buffer also broadcasts live via the `telemetry/event` WS notification. Same envelope on both sides — `{ source, kind, message?, position?, …kind-specific }` per the grammar's `TelemetryEvent` schema. The model sees the event on the NEXT packet's `telemetry.errors[]` (drains on read); the client sees it the moment it lands. Client uses cases: render parse errors in a debug panel (the `snippet` field is content the model emitted), surface strike/sudden_death as "loop is degrading" toasts, log everything to a session timeline. Scoped to the loop's session. {§telemetry-telemetry-event-notify}
1225
+ **Client surface: `telemetry/event` notification.** Every event the engine pushes to the loop's telemetry buffer also broadcasts live via the `telemetry/event` WS notification. Same envelope on both sides — `{ source, kind, message?, position?, …kind-specific }` per the grammar's `TelemetryEvent` schema. The model sees the event on the NEXT packet's `errors` section (drains on read); the client sees it the moment it lands. Client uses cases: render parse errors in a debug panel (the `snippet` field is content the model emitted), surface strike/sudden_death as "loop is degrading" toasts, log everything to a session timeline. Scoped to the loop's session. {§telemetry-telemetry-event-notify}
1203
1226
 
1204
1227
  **Content-offset snippet rendering.** When telemetry carries `position: { type: "content-offset", line, column }`, plurnk-service extracts a ±N-line slice from the model's own prior `assistant.content` and renders it as an `N:\t`-prefixed heredoc under an `error://<line>` fence, immediately following the event meta line. Without the snippet, the model gets "invalid xpath at 1:0" with no way to trace what it wrote at 1:0 — and tends to regenerate the same broken emission. With it, recovery is direct (canonical case: the edit-todo demo where a READ body starting with `//` got xpath-dispatched). The snippet field is stripped from the meta JSON so it appears once, in the body block. {§telemetry-content-offset-snippet}
1205
1228
 
@@ -1207,11 +1230,17 @@ Strike accounting, cycle detection, sudden-death thresholds, and no-ops bookkeep
1207
1230
 
1208
1231
  A `# Plurnk System Tools` section renders **above** `# Plurnk System Requirements` — a hook-populated list of the capabilities enabled this session, so the model sees what it can *do* before the rules it must follow. Each enabled capability contributes one line via `Engine.#collectTools`; the whole section is omitted when nothing is enabled. {§tools-capability-sheet}
1209
1232
 
1210
- **Contributors: the wired executor tags.** Each available executor tag injects a line describing its tag and functionality (the boot `ExecutorRegistry` probes availability per tag), retiring the model's blind `<<EXEC[sh]…`. The plan directive does **not** render here: it is a hard requirement gated by `PLURNK_PLAN`, joined to and dropped from the rules list with the flag rather than softly advertised as an optional tool (§requirements-plan-gated).
1233
+ **Contributors: the wired executor tags.** Each available executor tag injects a line describing its tag and functionality (the boot `ExecutorRegistry` probes availability per tag), retiring the model's blind `<<EXEC[sh]…`.
1234
+
1235
+ ### §schemes user.schemes — the scheme directory
1236
+
1237
+ A `# Plurnk System Schemes` section renders in the system slot **after the definition (plurnk.md — grammar + imperatives) and the tools sheet** — a terse directory of the scheme families available this session, so the model knows what URI schemes exist before it acts. Each scheme that ships a `manifest.example` contributes ONE line — its canonical usage — plus a `(docs: plurnk://docs/<scheme>.md)` pointer when it ships `manifest.documentation`. The verbose per-scheme semantics live in that pull doc (materialized like any entry, READ on demand), not the hot path — terse pushes, depth pulls, mirroring the tools sheet (§tools). A scheme with no example (provisional) is omitted. {§schemes-directory}
1238
+
1239
+ **The scheme self-doc contract.** `example` is the hot-path one-liner; `documentation` is the deep doc — the exact shape execs already use (`example` + `documentation`). `SchemeRegistry.teach()` renders the directory; `docEntries()` materializes the docs (per loop.run, alongside the operator docs). `documentation` rides a service-side `SchemeManifest` extension until plurnk-schemes#25 lands it in the contract.
1211
1240
 
1212
- ### §requirements user.system_requirements — static per-turn rules
1241
+ ### §requirements The requirements section — static per-turn rules
1213
1242
 
1214
- Rendered at the END of the user packet under `# Plurnk System Requirements` {§requirements-requirements-render-last} — closest to the assistant turn so the contract the model has to honor is the most recent text it sees. The header is omitted entirely when the requirements string is empty. {§requirements-requirements-omitted-when-empty} Contains rules the grammar block doesn't cover (canonical example: "Conclude the loop with `<<SEND[200]:answer:SEND`"). The op syntax leads the section, and when `PLURNK_PLAN=1` the plan directive *YOU MUST begin every response with `<<PLAN:...:PLAN`* joins the rules: a hard requirement dynamically added to and removed from the list with the flag, never the soft optional-tools sheet. {§requirements-plan-gated}
1243
+ Rendered at the END of the user packet under `# Plurnk System Requirements` {§requirements-requirements-render-last} — closest to the assistant turn so the contract the model has to honor is the most recent text it sees. The header is omitted entirely when the requirements string is empty. {§requirements-requirements-omitted-when-empty} Contains rules the grammar block doesn't cover (canonical example: "Conclude the loop with `<<SEND[200]:answer:SEND`"). The op syntax leads the section. PLAN is mandated unconditionally by plurnk.md §Imperatives (grammar 0.70 requires every turn to lead with `<<PLAN`), so the service injects no separate plan directive here.
1215
1244
 
1216
1245
  **Sourcing:** caller supplies the string via `runLoop({ requirements })` / `runTurn({ requirements })`. Plurnk-service exposes `PATHS.defaultRequirements` (resolves `PLURNK_REQUIREMENTS` env → in-package `requirements.md`). No DB cascade — same string every turn.
1217
1246
 
@@ -84,5 +84,9 @@ export default class ChannelWrite {
84
84
  scheme: string;
85
85
  handle: string;
86
86
  } | null>;
87
+ static findOpenSubscriptionsForRun(db: Db, runId: number): Promise<Array<{
88
+ id: number;
89
+ scheme: string;
90
+ }>>;
87
91
  }
88
92
  //# sourceMappingURL=ChannelWrite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChannelWrite.d.ts","sourceRoot":"","sources":["../../src/core/ChannelWrite.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,SAAS,CAAC;AAG9C,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAMtE,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,YAAY,CAAC;IACpB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AAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;WAUpD,2BAA2B,CACpC,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,MAAM,GACd,OAAO,CAAC,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAGpD"}
@@ -15,6 +15,7 @@ export default class ChannelWrite {
15
15
  static #openSubStmt(db) { return db.open_subscription; }
16
16
  static #closeSubStmt(db) { return db.close_subscription; }
17
17
  static #findActiveStmt(db) { return db.find_active_subscription; }
18
+ static #openSubsForRunStmt(db) { return db.find_open_subscriptions_for_run; }
18
19
  static #execTerminalStmt(db) { return db.find_exec_close_status; }
19
20
  // The entry's target URI for stream notifications (#179). A NULL scheme is
20
21
  // a filesystem entry (the file scheme stores scheme=NULL), so it decodes to
@@ -76,5 +77,13 @@ export default class ChannelWrite {
76
77
  const row = await ChannelWrite.#findActiveStmt(db).get({ run_id: runId, entry_id: entryId });
77
78
  return row ?? null;
78
79
  }
80
+ // The run's still-open subscriptions — the registry-routed reap
81
+ // (§run-lifecycle-total-reap). A cancel iterates these and aborts each via the
82
+ // owning scheme, so a backgrounded exec is reaped regardless of in-process
83
+ // AbortSignal-listener timing (R1): the registry is the source of truth, the
84
+ // signal an optimization.
85
+ static async findOpenSubscriptionsForRun(db, runId) {
86
+ return ChannelWrite.#openSubsForRunStmt(db).all({ run_id: runId });
87
+ }
79
88
  }
80
89
  //# sourceMappingURL=ChannelWrite.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChannelWrite.js","sourceRoot":"","sources":["../../src/core/ChannelWrite.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sFAAsF;AACtF,EAAE;AACF,mFAAmF;AACnF,4FAA4F;AAC5F,8EAA8E;AAC9E,2EAA2E;AAC3E,gCAAgC;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EAAE,QAAQ,EAAE,CAAC,CAAC;QACxH,OAAO,GAAG,EAAE,YAAY,IAAI,IAAI,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAC/B,EAAM,EACN,EAAE,KAAK,EAAE,OAAO,EAAsC;QAEtD,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,GAAG,CAAiD,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7I,OAAO,GAAG,IAAI,IAAI,CAAC;IACvB,CAAC;IAED,gEAAgE;IAChE,+EAA+E;IAC/E,2EAA2E;IAC3E,6EAA6E;IAC7E,0BAA0B;IAC1B,MAAM,CAAC,KAAK,CAAC,2BAA2B,CACpC,EAAM,EACN,KAAa;QAEb,OAAO,YAAY,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,GAAG,CAAiC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACvG,CAAC;CACJ"}
@@ -0,0 +1,69 @@
1
+ -- Channel-write SQL for streaming schemes. SPEC §channel-state + §subscriptions + §notifications.
2
+
3
+ -- PREP: channel_meta
4
+ SELECT e.session_id, e.scheme, e.pathname, ec.state, ec.mimetype, length(ec.content) AS contentLength
5
+ FROM entry_channels ec
6
+ JOIN entries e ON e.id = ec.entry_id
7
+ WHERE ec.entry_id = $entry_id AND ec.name = $channel;
8
+
9
+ -- PREP: append_to_channel
10
+ UPDATE entry_channels
11
+ SET content = content || $chunk
12
+ WHERE entry_id = $entry_id AND name = $channel;
13
+
14
+ -- PREP: set_channel_state
15
+ UPDATE entry_channels
16
+ SET state = $state
17
+ WHERE entry_id = $entry_id AND name = $channel;
18
+
19
+ -- PREP: set_channel_mimetype
20
+ -- A streaming scheme labels the channel with the body's per-call type (#226 —
21
+ -- http's Content-Type varies per fetch). Conditional: only writes when the type
22
+ -- actually changed, so labelling every chunk is a steady-state no-op.
23
+ UPDATE entry_channels
24
+ SET mimetype = $mimetype
25
+ WHERE entry_id = $entry_id AND name = $channel AND mimetype != $mimetype;
26
+
27
+ -- PREP: replace_channel_content
28
+ -- Full content swap for one channel (ChannelCaps.replace). Re-tokenizes at
29
+ -- write (unlike append_to_channel, which defers token count to render).
30
+ UPDATE entry_channels
31
+ SET content = $content, tokens = $tokens
32
+ WHERE entry_id = $entry_id AND name = $channel;
33
+
34
+ -- PREP: open_subscription
35
+ INSERT INTO subscriptions (run_id, entry_id, scheme, handle)
36
+ VALUES ($run_id, $entry_id, $scheme, $handle)
37
+ RETURNING id;
38
+
39
+ -- PREP: close_subscription
40
+ UPDATE subscriptions
41
+ SET closed_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
42
+ , close_status = $status
43
+ WHERE id = $subscription_id AND closed_at IS NULL;
44
+
45
+ -- PREP: find_active_subscription
46
+ SELECT id, scheme, handle
47
+ FROM subscriptions
48
+ WHERE run_id = $run_id AND entry_id = $entry_id AND closed_at IS NULL;
49
+
50
+ -- PREP: find_open_subscriptions_for_run
51
+ -- The run's still-open subscriptions — the registry-routed reap (§run-lifecycle-total-reap):
52
+ -- loop.cancel / KILL / shutdown iterate these and abort each via the owning scheme, so a
53
+ -- backgrounded exec is reaped independent of any in-process AbortSignal-listener timing.
54
+ SELECT id, scheme
55
+ FROM subscriptions
56
+ WHERE run_id = $run_id AND closed_at IS NULL;
57
+
58
+ -- PREP: find_exec_close_status
59
+ -- Terminal outcome of a finished exec stream, addressed by its coordinate
60
+ -- pathname — the KILL-on-a-non-running-exec lookup. 499 (aborted) = killed
61
+ -- earlier; any other terminal status = exited naturally; no row = unknown exec.
62
+ SELECT s.close_status
63
+ FROM entries e
64
+ JOIN subscriptions s ON s.entry_id = e.id
65
+ WHERE e.scope = 'session' AND e.session_id = $session_id
66
+ AND e.scheme = 'exec' AND e.pathname = $pathname
67
+ AND s.closed_at IS NOT NULL
68
+ ORDER BY s.closed_at DESC
69
+ LIMIT 1;
@@ -1 +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