@plurnk/plurnk-service 0.56.0 → 0.58.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 (87) hide show
  1. package/.env.example +9 -6
  2. package/SPEC.md +40 -24
  3. package/dist/content/matcher.d.ts +4 -0
  4. package/dist/content/matcher.d.ts.map +1 -1
  5. package/dist/content/matcher.js +22 -14
  6. package/dist/content/matcher.js.map +1 -1
  7. package/dist/core/ChannelWrite.d.ts +6 -1
  8. package/dist/core/ChannelWrite.d.ts.map +1 -1
  9. package/dist/core/ChannelWrite.js +8 -2
  10. package/dist/core/ChannelWrite.js.map +1 -1
  11. package/dist/core/ChannelWrite.sql +12 -2
  12. package/dist/core/Engine.d.ts +8 -0
  13. package/dist/core/Engine.d.ts.map +1 -1
  14. package/dist/core/Engine.js +263 -81
  15. package/dist/core/Engine.js.map +1 -1
  16. package/dist/core/Engine.sql +10 -4
  17. package/dist/core/SchemeRegistry.d.ts.map +1 -1
  18. package/dist/core/SchemeRegistry.js +6 -1
  19. package/dist/core/SchemeRegistry.js.map +1 -1
  20. package/dist/core/git-membership.d.ts.map +1 -1
  21. package/dist/core/git-membership.js +40 -4
  22. package/dist/core/git-membership.js.map +1 -1
  23. package/dist/core/packet-wire.d.ts.map +1 -1
  24. package/dist/core/packet-wire.js +28 -37
  25. package/dist/core/packet-wire.js.map +1 -1
  26. package/dist/core/session-settings.d.ts +1 -1
  27. package/dist/core/session-settings.d.ts.map +1 -1
  28. package/dist/core/session-settings.js +4 -4
  29. package/dist/core/session-settings.js.map +1 -1
  30. package/dist/schemes/Exec.d.ts.map +1 -1
  31. package/dist/schemes/Exec.js +11 -3
  32. package/dist/schemes/Exec.js.map +1 -1
  33. package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
  34. package/dist/schemes/ExecOutputScheme.js +2 -1
  35. package/dist/schemes/ExecOutputScheme.js.map +1 -1
  36. package/dist/schemes/File.d.ts.map +1 -1
  37. package/dist/schemes/File.js +4 -5
  38. package/dist/schemes/File.js.map +1 -1
  39. package/dist/schemes/Run.d.ts +5 -1
  40. package/dist/schemes/Run.d.ts.map +1 -1
  41. package/dist/schemes/Run.js +36 -12
  42. package/dist/schemes/Run.js.map +1 -1
  43. package/dist/schemes/_entry-find.d.ts +16 -1
  44. package/dist/schemes/_entry-find.d.ts.map +1 -1
  45. package/dist/schemes/_entry-find.js +67 -47
  46. package/dist/schemes/_entry-find.js.map +1 -1
  47. package/dist/schemes/_entry-graph.d.ts +6 -1
  48. package/dist/schemes/_entry-graph.d.ts.map +1 -1
  49. package/dist/schemes/_entry-graph.js +35 -22
  50. package/dist/schemes/_entry-graph.js.map +1 -1
  51. package/dist/schemes/_entry-graph.sql +9 -7
  52. package/dist/schemes/_entry-manifest.d.ts.map +1 -1
  53. package/dist/schemes/_entry-manifest.js +16 -3
  54. package/dist/schemes/_entry-manifest.js.map +1 -1
  55. package/dist/schemes/_entry-ops.d.ts +5 -0
  56. package/dist/schemes/_entry-ops.d.ts.map +1 -1
  57. package/dist/schemes/_entry-ops.js +14 -0
  58. package/dist/schemes/_entry-ops.js.map +1 -1
  59. package/dist/schemes/_entry-semantic.d.ts +1 -1
  60. package/dist/schemes/_entry-semantic.d.ts.map +1 -1
  61. package/dist/schemes/_entry-semantic.js +15 -12
  62. package/dist/schemes/_entry-semantic.js.map +1 -1
  63. package/dist/server/Daemon.d.ts.map +1 -1
  64. package/dist/server/Daemon.js +7 -2
  65. package/dist/server/Daemon.js.map +1 -1
  66. package/dist/server/MethodRegistry.d.ts +1 -0
  67. package/dist/server/MethodRegistry.d.ts.map +1 -1
  68. package/dist/server/dsl.d.ts +9 -1
  69. package/dist/server/dsl.d.ts.map +1 -1
  70. package/dist/server/dsl.js +33 -4
  71. package/dist/server/dsl.js.map +1 -1
  72. package/dist/server/logEntry.d.ts.map +1 -1
  73. package/dist/server/logEntry.js +3 -1
  74. package/dist/server/logEntry.js.map +1 -1
  75. package/dist/server/methods/op_look.d.ts +5 -0
  76. package/dist/server/methods/op_look.d.ts.map +1 -0
  77. package/dist/server/methods/op_look.js +30 -0
  78. package/dist/server/methods/op_look.js.map +1 -0
  79. package/dist/server/methods/op_parse.d.ts.map +1 -1
  80. package/dist/server/methods/op_parse.js +7 -2
  81. package/dist/server/methods/op_parse.js.map +1 -1
  82. package/dist/server/methods/session_constraints.js +1 -1
  83. package/dist/server/methods/session_constraints.js.map +1 -1
  84. package/dist/server/methods/session_create.js +7 -7
  85. package/dist/server/methods/session_create.js.map +1 -1
  86. package/migrations/0000-00-00.01_schema.sql +11 -1
  87. package/package.json +5 -5
package/.env.example CHANGED
@@ -106,12 +106,15 @@ PLURNK_GIT_AUTO=1
106
106
  # with these env docs, keyed by alias — the client wins a collision (#231).
107
107
  # Commented out = no docs by default.
108
108
  PLURNK_MD_POLICY=~/.plurnk/AGENTS.md
109
- # Turn-0 manifest preview: foist a READ of plurnk://manifest.json into the model's
110
- # first turn so a run opens with the session catalog, not blank. -1 = the full
111
- # manifest; N = the first N items (jsonpath slice); 0 = off. The service sets this
112
- # servicewide default; a client may override it per session via
113
- # session.create settings.manifestItems, which replaces this value (#231).
114
- PLURNK_MANIFEST_ITEMS=-1
109
+ # Turn-0 catalog preview, FIND-served (foisted as FIND(<scheme>:///**) per scheme) so a run
110
+ # opens oriented, not blank. The model's OWN surface known/unknown (memory), run (scratch),
111
+ # plurnk (docs) always foists FULL when the preview is on, never truncated: a partial view of
112
+ # the model's own memory reads as withheld. This knob's first-N cap applies ONLY to the FILE list
113
+ # (FIND(file:///**)), the one catalog that's external and arbitrarily large: -1 = the whole tree
114
+ # (everything full); N = the first N files (memory still full); 0 = preview off entirely (the model
115
+ # FINDs on demand). Servicewide default; a client overrides per session via session.create
116
+ # settings.filesItems (#231).
117
+ PLURNK_FILES_ITEMS=-1
115
118
 
116
119
  # Prompt-preview cap: the loop's prompt renders in user.prompt every turn, and a fat prompt
117
120
  # replays each turn (bloat). Show the first N CHARS of the body + a pointer to the full
package/SPEC.md CHANGED
@@ -138,7 +138,7 @@ Server posture: this package is the runtime. User-facing CLI lives in `plurnk` a
138
138
 
139
139
  **Wild west — no mutual exclusion.** Runs share the manifest without locks. Coordination is cooperative (tags + the shared workspace convention) and softly fenced (the §membership `read-only` overlay, a session policy, bounds every run's writable surface uniformly — §machine-processes); a conflict *surfaces* as a delta rather than being prevented. Inform, never override. {§actor-boundary-no-mutex}
140
140
 
141
- **Passive wake.** An idle run wakes on exactly two events, both *directed at the run*: a prompt injected into it — the **voice door** (a user/system `loop.inject`, and once `run://` lands a sibling's `SEND(run://.)`) — or a **stream-status transition** on a subscription it opened (§channel-state). Everything ambient is a delta — a sibling's edit to a shared entry, an out-of-band disk change — and a delta **never** wakes; it queues and drains at the next turn one of those two events produces (§env-delta). {§actor-boundary-passive-wake}
141
+ **Passive wake.** An idle run wakes on exactly two events, both *directed at the run*: a prompt injected into it — the **voice door** (a user/system `loop.inject`, and once `run://` lands a sibling's `SEND(run://<name>)`) — or a **stream-status transition** on a subscription it opened (§channel-state). Everything ambient is a delta — a sibling's edit to a shared entry, an out-of-band disk change — and a delta **never** wakes; it queues and drains at the next turn one of those two events produces (§env-delta). {§actor-boundary-passive-wake}
142
142
 
143
143
  **Self-hosting — the runtime is an actor, not a back channel.** Runtime-initiated work (fs reconciliation §membership, git auto-add) is an **ephemeral `plurnk` run** firing ordinary ops, seen by other runs through the environment door like any actor's — not a privileged engine pathway. The engine keeps only the irreducible kernel runs stand on (spawn, dispatch, packet assembly, the budget rails §grinder, the fs-watch); everything expressible as ops on session entries is a run doing ops, through the same `op.*` surface (§methods) the service offers clients. Dogfooding is the architecture, not a test mode. {§actor-boundary-self-hosting}
144
144
 
@@ -146,7 +146,7 @@ Server posture: this package is the runtime. User-facing CLI lives in `plurnk` a
146
146
 
147
147
  **The keystone's first use: operator reference docs.** `PLURNK_MD_<ALIAS>=<path>` (§operator-config) materializes `<path>` as a `plurnk:///<ALIAS>.md` entry — a `dispatchAsPlurnk` EDIT in the plurnk run, **not** the model's — and the model's turn-0 foists a READ of it. The model reads the doc inline while the materializing EDIT stays out of its log: idiomatic context injection, an ordinary entry + READ rather than a bespoke packet section. The same `PLURNK_MD_*` convention cascades to clients. {§actor-boundary-doc-injection}
148
148
 
149
- **Catalog preview.** `PLURNK_MANIFEST_ITEMS` foists a turn-0 `FIND(scheme:///**)` — one per scheme that holds entries — into the run's first turn, the same plurnk-origin foist as the docs, so a run opens with its catalog instead of blank. `-1` foists each scheme's whole catalog; a positive `N` caps each to its first `N` rows (FIND's `<L>`, clamped to the scheme's count so the strict marker never 416s); unset / `0` foists nothing. `log://` is absent — it is present-mode (the `# Log` section), not a catalog scheme. {§actor-boundary-manifest-preview}
149
+ **Catalog preview.** `PLURNK_FILES_ITEMS` foists a turn-0 `FIND(scheme:///**)` per scheme into the run's first turn (the same plurnk-origin foist as the docs), so a run opens with its catalog instead of blank. The model's own surface — `known`/`unknown` (memory), `run` (scratch), `plurnk` (docs) — always foists **full**; the first-`N` cap applies **only to `file`** (`FIND(file:///**)`, the external, arbitrarily-large tracked-file tree), so the model's own memory is never truncated (a partial view of memory reads as withheld). `-1` = everything full; a positive `N` = the file list capped to its first `N` (FIND's `<L>`, clamped so the strict marker never 416s; memory still full); unset / `0` = no preview (the model FINDs on demand). `log://` is absent — present-mode (the `# Log` section), not a catalog scheme. {§actor-boundary-catalog-preview}
150
150
 
151
151
  ### §machine-processes The machine and its processes: session, run, fork
152
152
 
@@ -174,21 +174,22 @@ Server posture: this package is the runtime. User-facing CLI lives in `plurnk` a
174
174
 
175
175
  ### §run-scheme The run:// scheme — control (spawn, irc, fork, terminate, cap, collect) and run-scope scratch
176
176
 
177
- The run:// scheme makes §machine-processes addressable: a `run://` target is a sister run in the session — `run://.` the current run, `run://<name>` a session-scoped sibling (`runs.name`). Same-session only; a run never addresses another session's runs (§actor-boundary). The path discriminates the two faces: **path-absent is control** on the run-as-actor — the NAME is the authority (`run://<name>`, two slashes, no path) — while **path-present is run-scope storage**: `run://<owner>/<path>` (or `run:///<path>` for self) addresses the owner's private scratch (Scratch + Perspective, below). The control ops are three, fire-and-forget — the child runs independently, lineage in `runs.parent_run_id`:
177
+ The run:// scheme makes §machine-processes addressable: a `run://` target is a sister run in the session — `run://self` the current run, `run://<name>` a session-scoped sibling (`runs.name`). `self` is the reserved current-run sentinel; empty authority (`run:///`) is invalid (400). Same-session only; a run never addresses another session's runs (§actor-boundary). The path discriminates the two faces: **path-absent is control** on the run-as-actor — the NAME is the authority (`run://<name>`, two slashes, no path) — while **path-present is run-scope storage**: `run://<owner>/<path>` (`run://self/<path>` for self) addresses the owner's private scratch (Scratch + Perspective, below). The control ops are three, fire-and-forget — the child runs independently, lineage in `runs.parent_run_id`:
178
178
 
179
179
  - **Spawn** — `EDIT(run://<name>):prompt` creates a new sister (empty log) and starts it with `prompt` on its first loop; self cannot be spawned (400). {§run-scheme-spawn}
180
180
  - **irc** — `SEND(run://<name>):msg` delivers `msg` to an existing sister, the **voice door** (§actor-boundary-two-doors): an active sister folds it into its next turn, an idle one wakes (§actor-boundary-passive-wake); a name with no run in the session is 404. {§run-scheme-irc}
181
- - **Fork** — `COPY(run://<src>):prompt` branches `src` (self is `run://.`): the source's log is deep-copied into a new sister (§machine-processes-fork-copies-the-log), which continues with `prompt`; the world is shared, never copied (§machine-processes-fork-shares-the-world). A fork ALSO inherits the source's run-scope **scratch** — its private workspace deep-copied with the owner remapped (source → branch) — so the branch opens with the parent's notes and diverges on its own edits: *fork = everything-in-common-but-name*. {§run-scheme-fork} {§run-scheme-fork-scratch}
181
+ - **Fork** — `COPY(run://<src>):prompt` branches `src` (self is `run://self`): the source's log is deep-copied into a new sister (§machine-processes-fork-copies-the-log), which continues with `prompt`; the world is shared, never copied (§machine-processes-fork-shares-the-world). A fork ALSO inherits the source's run-scope **scratch** — its private workspace deep-copied with the owner remapped (source → branch) — so the branch opens with the parent's notes and diverges on its own edits: *fork = everything-in-common-but-name*. {§run-scheme-fork} {§run-scheme-fork-scratch}
182
182
 
183
183
  All three ride one engine seam — the daemon's inject (active→fold, idle→enqueue+drain) — so the handler creates/branches/resolves the run and hands off; the daemon owns provider + system prompt. COPY's body here is the fork's seed prompt, not a destination path: the engine routes a run:// source away from the entry-copy path before parsing the body.
184
184
 
185
185
  Beyond the three creation ops:
186
186
 
187
- - **Scratch (storage)** — `run://<owner>/<path>` is run-scope entry storage (`scope='run'`, the owner is the run name folded into the path; `run:///` is self). A run EDITs only its own scratch — a cross-run write is **403** ("read a sister's notes, never write them") — but READs and FINDs any sister's by name (cross-run read is open; scratch is perspective-private, not ACL-private). {§run-scheme-scratch}
188
- - **Perspective** — a run's own scratch is catalogued in **its** manifest alone `Manifest(run) = session-scope this-run's-run-scope`, foisted as `FIND(run:///**)` at turn 0so a sibling reaches it only by explicit `FIND(run://<name>/**)` and never sees it in its own perspective; isolation is structural (`scope='run'` is excluded from every session query, the owner opted back in only on its own read paths). {§run-scheme-find-perspective}
189
- - **Terminate** — `KILL(run://<name>)` aborts a run by address (self is `run://.`): its active loop closes 499 and its subscriptions tear down; a name with no run is 404. The override to the fire-and-forget default not a parent-power, whoever holds the address may end it; a run left alone simply ends at its own `SEND[200]`. {§run-scheme-terminate}
187
+ - **Scratch (storage)** — `run://<owner>/<path>` is run-scope entry storage (`scope='run'`, the owner is the run name folded into the path; `run://self` is self). A run EDITs only its own scratch — a cross-run write is **403** ("read a sister's notes, never write them") — but READs and FINDs any sister's by name (cross-run read is open; scratch is perspective-private, not ACL-private). {§run-scheme-scratch}
188
+ - **Scratch KILL (delete)** — `KILL(run://<owner>/<path>)` with an entry **path present** deletes that scratch entry (200; 404 if absent), self-only like EDIT (a cross-run delete is **403**)the model's curation lever over its own workspace, distinct from the path-ABSENT `KILL(run://<name>)` which terminates the run (§run-scheme-terminate). The discriminator is the entry path, never the op. {§run-scheme-scratch-kill}
189
+ - **Perspective** — a run's own scratch is catalogued in **its** manifest alone — `Manifest(run) = session-scope this-run's-run-scope`, foisted as `FIND(run://self/**)` at turn 0 — so a sibling reaches it only by explicit `FIND(run://<name>/**)` and never sees it in its own perspective; isolation is structural (`scope='run'` is excluded from every session query, the owner opted back in only on its own read paths). {§run-scheme-find-perspective}
190
+ - **Terminate** — `KILL(run://<name>)` aborts a run by address (self is `run://self`): its active loop closes 499 and its subscriptions tear down; a name with no run is 404. The override to the fire-and-forget default — not a parent-power, whoever holds the address may end it; a run left alone simply ends at its own `SEND[200]`. {§run-scheme-terminate}
190
191
  - **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}
191
- - **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}
192
+ - **Collect** — a run's loop reaching a terminal status surfaces to its sisters as an ambient delta (§env-delta): a `SEND` from `run://<name>` carrying the loop's deliverable — the `SEND[200]` body, or for an abandonment the reason. A **2xx deliverable is born OPEN** (its body materialized into the parent's packet, not hidden behind a fold): a child's success must reach the parent open and awakening, never a bodyless row. An abandonment (non-2xx) surfaces folded. Every death-path is stamped uniformly, so no termination is silent; collection is the shared world moving, never a verb. {§run-scheme-collect}
192
193
 
193
194
  ### §run-lifecycle Run lifecycle: the drain, the reap, the passive wake
194
195
 
@@ -430,6 +431,8 @@ if (isBody) await EntryGraph.populateFrom(db, sessionId, r.entry_id, result.symb
430
431
 
431
432
  `hint` short-circuits detection. The service consumes `totalLines` (extent), `symbols`/`references` (the `@graph` index), and `deepJson`/`deepXml` (matcher dispatch); never a rendered preview — content reaches the model on READ. Because this pass runs every assembly over every entry, any content change — by any writer — is reflected in the next packet's index. The `@graph` index is NOT engine *ranking* (the anti-pattern): it's a complete, unranked index the model queries via `FIND @<sym`, the manifest paradigm applied to structure, uniform across schemes (`file:///` is the primary case).
432
433
 
434
+ The body channel's embedding vectors derive in the same pass (`EntrySemantic.deriveEmbeddings`): content is tiled into token-budgeted chunks, then embedded in **one data-parallel batch** (`mimetypes.embedBatch`) rather than a per-chunk loop — bit-identical vectors (no re-embed), ~6× on a multi-core box. The pump computes the changed-entry worklist up front so the corpus total is known; a multi-entry pass (the initial ingest, which otherwise looks frozen) emits a throttled `embed_progress` NOTICE (below), and a 0-1 entry steady-state turn stays silent.
435
+
433
436
  **Conformance.** Mimetype-specific behavioral tests live in each handler's own surface. plurnk-service intg covers integration: the engine routes through `Mimetypes.process` with the right hint and the catalog reflects `totalLines`; tests use auto-discovery (production handler set); a custom-handler test injects a stub `BaseHandler` via `loader + discovery`.
434
437
 
435
438
  ---
@@ -536,6 +539,12 @@ AST: `{ op: "OPEN"|"FOLD", target, body: MatcherBody | null, signal: tags | null
536
539
 
537
540
  OPEN/FOLD operate on the **log** (`log:///`) — the model's context-curation surface (§packet). FOLD collapses a log row to its path; OPEN restores its body. Non-destructive: rows and bodies persist, re-OPENable. Entries carry no visibility (§no-visibility), so OPEN/FOLD against an entry scheme returns 501.
538
541
 
542
+ ### §model-entry The model's own emission, mirrored back
543
+
544
+ A `model` log row is the model's **verbatim prior emission**, mirrored back so it can finally SEE its own behavior — and reason through its own syntax errors (the parser reports by line; the row renders line-numbered like all content). Actionless, like an `op='error'` row (§telemetry): no target, no op executed; `tx` is empty and the emission lives in `rx.content`, typed `text/vnd.plurnk`. **Born OPEN on a turn that erred** — a parse error or a content-offset NOTICE (`grammar_unenforced`) — so the model resolves the reported line against its own emission, no embedded snippet; **born FOLDED otherwise** (budget-neutral until the model OPENs it). OPEN/FOLD/KILL-able like any log row (the model curates its own history). The engine writes one at the end of each turn that produced output; a struck/empty turn mirrors nothing.
545
+
546
+ The run's **first** model row is exceptional: a born-OPEN turn-0 **exemplar** — a minimal worked example (`PLAN` → environment `FIND`s → `SEND[102]`) the model always opens on, so the grammar can stay thin (the example teaches the syntax, not a heavy grammar). {§model-entry}
547
+
539
548
  ### §copy COPY (engine-orchestrated)
540
549
 
541
550
  AST: `{ op: "COPY", target (source), body (destination), signal: tags | null, lineMarker? }`.
@@ -563,11 +572,11 @@ Log history preserved — `log_entries` stores path tuple as text, not FK to `en
563
572
 
564
573
  AST: `{ op: "FIND", target (scope), body: MatcherBody | null (predicate), signal: tags | null, lineMarker? }`.
565
574
 
566
- - Filters entries within scope (scheme + pathname prefix). {§find-scope-prefix-filter}
575
+ - Filters entries within scope. The target's GLOB-ness sets it: a **bare** path is the exact entry, a **trailing-slash folder** (incl. the scheme root `/`) or an explicit **glob** expands to a scope (the `*` is folderhood, not a blanket prefix), `#regex#` filters by pathname. Same target contract as READ — bare = the entry, folder/glob = a scope to fan out (#286). {§find-scope-prefix-filter}
567
576
  - `body` matcher operates on entry content (glob/regex/jsonpath/xpath), per grammar plurnk.md §"Body matcher dispatch"; the path-glob lives in the (target), not the body. {§find-glob-filter-on-content}
568
577
  - `signal` is a tag filter; entries match if they have ALL listed tags. {§find-tag-filter-and-semantics}
569
578
  - Session + scheme scoped — no cross-session/cross-scheme leakage. {§find-scoped-isolation}
570
- - Returns `FindResult { status, content, mimetype, results: CatalogEntry[] }`. FIND resolves to the scheme's **catalog rows** the very rows the manifest catalogsfiltered to the statement's matches and kept in match order. A **catalog row** is `{ path, seconds?, tags?, channels: { <uri>: { mimetype, tokens, lines } } }`: the addressable entry path, its per-channel `{mimetype, tokens, lines}` keyed by addressable URI (default channel → the bare path, non-default → `path#channel`), plus the entry's `tags` and a live `seconds` stream age. The matcher (glob/regex/jsonpath/xpath, `~`semantic, `@`graph) decides WHICH entries appear and in what order a content hit **includes** the entry, a miss **excludes** it; it never reshapes the row. There is no per-match extent: the match LOCATION (which line or symbol) is a `READ` concern, not a FIND field. `content` is the rows as a JSON array (`application/json`); a body-less `FIND(scheme:///**)` yields the scheme's whole catalog — the manifest's per-scheme slice. {§find-result-catalog-rows}
579
+ - Returns `FindResult { status, content, mimetype, results: MatchItem[], matches, pathnames }`. The matcher sets the unit (#286). A **body-less** FIND is the **catalog**: one item per *entry* — `{ path, seconds?, tags?, channels: { <uri>: { mimetype, tokens, lines } } }` (the addressable path, per-channel `{mimetype, tokens, lines}` keyed by URI default channel → the bare path, non-default → `path#channel` plus `tags` and a live `seconds` stream age), the manifest's per-scheme slice. A **matcher** FIND resolves to one item per *match*: the entry's catalog row plus the `matchSpan` `{lineStart, lineEnd}` it hit. **A file with N matches yields N items** — the same row repeated, one span each; there is no `matchLines` array. The unit is uniform across every dialect — glob/regex/jsonpath/xpath select line spans, `~`semantic the ranked chunk's span, `@`graph the matched symbol's span all `(file, span)`, all real content lines (the old "the extent of ~semantic/@graph is not a content line" carve-out was false: a chunk span and a symbol span are line ranges). Order is match order (rank for `~`semantic, source order otherwise); a miss contributes nothing; identical spans dedup. `content` is the items as a JSON array (`application/json`). {§find-result-catalog-rows}
571
580
 
572
581
  ### §send SEND
573
582
 
@@ -600,7 +609,7 @@ AST: `{ op: "EXEC", target (cwd), body: string | null (command), signal: string
600
609
 
601
610
  Engine routes unconditionally to `exec` scheme (path slot is `cwd`, not a URI). The runtime slot (`signal`) selects an executor, resolved against the boot-time `ExecutorRegistry` — siblings discovered and probed at startup, availability cached, default `sh`. Unknown or unavailable runtime → 501 carrying the probe `detail`. {§exec-registry-resolves}
602
611
 
603
- **Timeout and poll — `<T,P>` on the `<L>` slot (grammar 0.74.20).** EXEC repurposes the line-marker slot as `<timeout, poll>` in **seconds** (consistent with the `seconds=` stream-age render). `T` (mark[0]) caps the spawn's lifetime: at T the service aborts it (a bounded reap — polite signal then SIGKILL after `PLURNK_EXEC_KILL_GRACE_MS`) and stamps the stream **504**, distinct from a deliberate kill (499) or a clean exit (200). Absent / ≤0 → unbounded, the prior background-stream behavior. {§exec-timeout} `P` (mark[1]) is the hibernation **poll cadence**, stored on the subscription: while the loop is *parked* at `SEND[202]`, the daemon arms a per-run timer for the tightest open poll cadence and resumes the slept loop every P seconds to inspect progress (the same 202→100 resume a stream conclusion uses, §run-lifecycle). It does **nothing while the loop is active** — an active loop already gets the ambient folded stream deltas (§exec-stream), so the poll-wake matters only across hibernation. A 202 with no polled stream gets no timer (it sleeps until a conclusion wakes it). {§exec-poll}
612
+ **Timeout and poll — `<T,P>` on the `<L>` slot (grammar 0.74.20).** EXEC repurposes the line-marker slot as `<timeout, poll>` in **seconds** (consistent with the `seconds=` stream-age render). `T` (mark[0]) caps the spawn's lifetime: at `T>0` the service aborts it (a bounded reap — polite signal then SIGKILL after `PLURNK_EXEC_KILL_GRACE_MS`) and stamps the stream **504**, distinct from a deliberate kill (499) or a clean exit (200). `-1` / absent → unbounded (loop-life bounded), the background-stream behavior. **`0` → turn-scoped**: the stream is reaped at the run's *next pre-turn* (via the registry abort, before the turn's own spawns), so it never survives into the subsequent turn; its terminal output surfaces born-OPEN like any close (§exec-stream). {§exec-timeout} `P` (mark[1]) is the hibernation **poll cadence**, stored on the subscription: while the loop is *parked* at `SEND[202]`, the daemon arms a per-run timer for the tightest open poll cadence and resumes the slept loop every P seconds (floored by `PLURNK_EXEC_WAIT_MS` so it can't tick faster than a turn settles) to inspect progress (the same 202→100 resume a stream conclusion uses, §run-lifecycle). It does **nothing while the loop is active** — an active loop already gets the ambient folded stream deltas (§exec-stream), so the poll-wake matters only across hibernation. A 202 with no polled stream gets no timer (it sleeps until a conclusion wakes it). {§exec-poll}
604
613
 
605
614
  **Effect-gating.** Each executor declares an `effect` (`pure` | `read` | `host`); the service maps it to policy (`EffectPolicy`). A `host` runtime (subprocess; file-backed sqlite) mutates the host → **propose** (lifecycle §proposal): the run waits for a human gate, then spawns and writes stdout/stderr to channels of a `<runtime>:///<loop>/<turn>/<seq>` entry (the runtime tag is the URI scheme, §exec/#240; the coordinate matches the op's log-row coordinate, e.g. `sh:///1/1/2`), returning `102 Processing` immediately. Channel state transitions (`active` → `closed`/`errored`) drive what the model sees at subsequent turn boundaries (§channel-state). {§exec-host-proposes}
606
615
 
@@ -802,7 +811,7 @@ Model selection: separate alias cascade in `ProviderRegistry` (§provider-instan
802
811
  | `PLURNK_MIN_CYCLES` | `3` | enforced | Min repetitions before cycle detection fires (§engine-rails). |
803
812
  | `PLURNK_MAX_CYCLE_PERIOD` | `4` | enforced | Max period length cycle detection examines (§engine-rails). |
804
813
  | `PLURNK_MD_<ALIAS>` | (unset) | enforced | Operator reference doc: materializes `<path>` as `plurnk:///<ALIAS>.md`, auto-READ into every model run's turn 0 (§actor-boundary). `~` expands to home. |
805
- | `PLURNK_MANIFEST_ITEMS` | `0` | enforced | Turn-0 catalog preview foisted into the model's first turn, one `FIND(scheme:///**)` per active scheme. `-1` = each scheme's full catalog; positive `N` = its first N rows (`<L>` cap); `0` / unset = off (§actor-boundary-manifest-preview). |
814
+ | `PLURNK_FILES_ITEMS` | `-1` | enforced | Turn-0 catalog preview, one `FIND(scheme:///**)` per scheme. Memory/scratch/docs always full; the first-`N` cap applies **only** to the `file` list. `-1` = all full; positive `N` = file list first-N (memory still full); `0` / unset = off (§actor-boundary-catalog-preview). |
806
815
  | `PLURNK_PROPOSAL_TIMEOUT_MS` | `300000` | enforced | ms wait for a proposed entry (status=202) to be resolved before timing out. |
807
816
  | `PLURNK_PROVIDERS_REASONING_BUDGET` | `-1` | enforced | The single provider reasoning gate (REQUIRED — fail-hard if unset). `0` = native reasoning off (in-DSL PLAN does it), `-1` = adaptive / no cap, `N` = capped at N tokens; provider modules translate per model family (reasoning_effort tiers, Anthropic `budget_tokens`). Floor (gemma): `0`. |
808
817
  | `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. |
@@ -820,7 +829,7 @@ Enforcement is per-use-site — no central most-restrictive pass; each ceiling i
820
829
  **Client open-context (per session).** `session.create({settings})` carries per-session overrides, persisted on `sessions.settings` and composed against env at each knob's read-site. Two families, kept distinct so neither semantic leaks into the other; operator-arcane knobs stay env-only — this is the narrow client surface.
821
830
 
822
831
  *Defaults — explicit-wins (the client replaces/merges freely):*
823
- - `settings.manifestItems` (number) **replaces** `PLURNK_MANIFEST_ITEMS` for the session: a one-shot opens clean (`0`), a workspace full (`-1`) or capped (`N`). A single scalar — the client value wins outright. {§operator-config-session-manifest-items}
832
+ - `settings.filesItems` (number) **replaces** `PLURNK_FILES_ITEMS` for the session: a one-shot opens clean (`0`, no preview), a workspace full (`-1`), or with the file list capped (`N`, memory still full). A single scalar — the client value wins outright. {§operator-config-session-files-items}
824
833
  - `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}
825
834
 
826
835
  *Ceilings — most-restrictive-wins (the client may only narrow, never widen):*
@@ -977,9 +986,12 @@ Naming: `target` = URI the op acts on; `scope` for FIND; `source`/`destination`
977
986
  | `op.exec` | `cwd?: string`, `runtime?: string`, `command?: string` | Mirrors `<<EXEC>>`. |
978
987
  | `op.dispatch` | `statement: PlurnkStatement` | Low-level path for clients that have a parsed AST already (e.g. the TUI when the user types raw HEREDOC at the prompt). |
979
988
  | `op.parse` | `text: string` | Convenience: daemon parses raw DSL text via the grammar, dispatches each statement as actions of one turn, returns `{ results: DispatchResult[] }`. |
989
+ | `op.look` | `text: string` | Non-logging READ: resolves the target via READ's full scheme resolver and returns its content, writing **no** log entry. The client's off-run inspection primitive — forward `<<LOOK>>` with the op token rewritten `LOOK`→`READ`. READ-only. {§op-look} |
980
990
 
981
991
  All `op.*` return `{ status, ...op-specific }`. All `requiresInit: true`. None `longRunning`.
982
992
 
993
+ **`op.look` is the exception** to the "creates a turn, fires `log/entry`" rule above (§methods-op-mirror): it runs READ's full resolver (every scheme, full grammar — the client stays grammar-blind, forwarding its `<<LOOK>>` text with the op token swapped to `READ`) but mints **no turn and writes no `log_entries` row** — the read leaves no trace the model can see, the human-side counterpart to membership-gated model reads (§operator-config, "the boundary is the client's"). It resolves against the connection's client loop so run-relative coordinates (`log:///<L>/<T>/<S>`) resolve correctly. Where `entry.read`/`log.read` leave no row but are scheme-limited, and `op.read` resolves everything but logs, `op.look` resolves everything **and** doesn't log. A non-READ statement is rejected. {§op-look}
994
+
983
995
  Future: `subscription.list`, `subscription.cancel` (the latter is `op.send({status: 499, recipient})` today).
984
996
 
985
997
  ### §notifications Notifications
@@ -1073,7 +1085,7 @@ Each entry: question, answer, rationale, migration path.
1073
1085
 
1074
1086
  **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.
1075
1087
 
1076
- **Decision.** Two stages. (1) The engine builds the default section list the system-slot sections `definition`, `tools`, `schemes`, the policy sections `system-policy`/`project-policy`, and `budget` (budget is law — a privileged constraint kept in the lean system zone), then the user-slot sections `prompt`, `errors`, `log`, `git`, `requirements` (the log is short-term memory data, rendered at the action point, not a privileged rule). (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}
1088
+ **Decision.** Two stages. (1) The engine builds the default section list. `slot` is a **trust boundary**: the system slot carries only framework-authored, non-injectable sections `definition`, `tools`, `schemes`, the policy sections `system-policy`/`project-policy`, then the framework-status tail `errors` (uri+status pointers; the error item+body live in the log) and `git` (counts), with `budget` last (budget is law — a hard ceiling, the final word before the model acts). The user slot carries injectable content — `prompt` and `log` (READ results, exec output, the model's own mirror: data at the action point, never a privileged rule) — plus the `requirements` footer. Nothing that can carry attacker-reachable text rides the system 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}
1077
1089
 
1078
1090
  **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.
1079
1091
 
@@ -1237,7 +1249,7 @@ The wire projection (`PacketWire.renderSlot`) groups sections by slot into the s
1237
1249
 
1238
1250
  **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}
1239
1251
 
1240
- **The entry catalog.** The catalog is the **complete, unranked directory** of what a session holds, served by `FIND(scheme:///**)` — one per-scheme array, queried on demand, not a single materialized entry (there is no `plurnk:///manifest.json`; the per-scheme arrays replaced it). Built in the schemes layer (`_entry-manifest.catalogRowsFor`); a per-turn derivation pump (`maintainDerivations`) refreshes the deep channels the rows report. A scheme's array is **every entry it holds, in no relevance order**, each `{ path, seconds?, tags?, channels: { <uri>: { mimetype, tokens, lines } } }` — every channel keyed by the URI the model READs (the default channel by the bare path, a non-default by `path#channel`), so it reaches a channel without guessing. `tags` is present only when the entry carries `entry_tags` — its own categorization, surfaced so the model can `FIND` by tag. 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 live count recounted at render, `lines` the content extent from `Mimetypes.process().totalLines`. The catalog never lists itself. {§packet-manifest-catalog}
1252
+ **The entry catalog.** The catalog is the **complete, unranked directory** of what a session holds, served by `FIND(scheme:///**)` — one per-scheme array, queried on demand, not a single materialized entry (there is no `plurnk:///manifest.json`; the per-scheme arrays replaced it). Built in the schemes layer (`_entry-manifest.catalogRowsFor`); a per-turn derivation pump (`maintainDerivations`) refreshes the deep channels the rows report. A scheme's array is **every entry it holds, in no relevance order**, each `{ path, seconds?, tags?, channels: { <uri>: { mimetype, tokens, lines } } }` — every channel keyed by the URI the model READs (the default channel by the bare path, a non-default by `path#channel`), so it reaches a channel without guessing. `tags` is present only when the entry carries `entry_tags` — its own categorization, surfaced so the model can `FIND` by tag. 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 live count recounted at render, `lines` the content extent from `Mimetypes.process().totalLines`. The catalog never lists itself. {§packet-catalog}
1241
1253
 
1242
1254
  ### §telemetry user.telemetry — model-facing runtime telemetry
1243
1255
 
@@ -1266,15 +1278,18 @@ The `log` section is the durable audit; the `errors` section surfaces both — t
1266
1278
  | `kind` | Source | Required fields |
1267
1279
  |---|---|---|
1268
1280
  | `action_failure` | The DERIVED error pointer — any `log_entries` row with `status_rx ≥ 400` from the previous turn: a parse failure's actionless `op='error'` row, or a failed action | `kind`, `coordinate` (`<L>/<T>/<S>`), `op`, `status`, `target` (URI or null). May carry a terse `error` fact. The full message/snippet lives on the foldable log row. |
1269
- | `grammar_unenforced` | (provider, forwarded) GBNF-filter divergence — the model's bytes diverged from the transported grammar | `source: "provider:*"`, `kind`, `message`, `position` (content-offset), `snippet` |
1281
+ | `grammar_unenforced` | (provider, forwarded) GBNF-filter divergence — the model's bytes diverged from the transported grammar | `source: "provider:*"`, `kind`, `message`, `position` (content-offset) |
1270
1282
  | `max_commands_exceeded` | Single emission exceeded `PLURNK_MAX_COMMANDS` cap; overflow ops dropped without dispatch | `source: "engine:rail"`, `kind`, `emitted`, `dropped` |
1271
1283
  | `budget_overflow` | Assembled packet exceeded the budget ceiling; entries moved out of the window to fit | `source: "engine:rail"`, `kind`, `hidden` (per-scheme `[{scheme, count}]` — entries removed from the window) |
1284
+ | `embed_progress` | The derivation pump (§mimetype-surface) is embedding a multi-entry corpus pass; throttled to ~10 milestones, silent for a 0-1 entry turn | `source: "engine:derivation"`, `kind`, `completed`, `total`, `message` |
1285
+
1286
+ **Severity on the wire (`level`, required — grammar 0.74.29+).** Every `TelemetryEvent` carries `level: "error" | "warn" | "info"`, set by the **producer** at the emit site — severity is meaning the producer owns, not something the client re-derives by pattern-matching the open `kind` vocabulary. Service mappings: provider errors and `max_commands_exceeded` → `error`; engine steers (`idle_turn`, `premature_terminate`) and `budget_overflow` → `warn`; `embed_progress` → `info`. Forwarded provider/executor events carry the producer's own `level` (the service defaults it only for a producer predating the field). Clients color straight off `level`. {§telemetry-event-level}
1272
1287
 
1273
1288
  Strike accounting, cycle detection, sudden-death thresholds, and no-ops bookkeeping stay engine-internal — they drive abandonment silently per the gamification policy. Both error kinds — a failed action AND an actionless parse failure — are LOG ITEMS (`log:///<coord>`, `op='error'` for the latter, `status_rx ≥ 400`), foldable and re-OPENable, with full detail (message, snippet) on the row. The `errors` section surfaces a derived pointer to each. There is **no bespoke `error://` scheme**: errors live in the log, addressable + curatable like any row — not a separate queryable namespace. {§telemetry-no-error-scheme}
1274
1289
 
1275
- **Client surface.** Engine NOTICES broadcast live via the `telemetry/event` WS notification — same envelope as the model's drained copy (`{ source, kind, message?, position?, …kind-specific }` per the grammar's `TelemetryEvent` schema), the moment they land, scoped to the loop's session (a `grammar_unenforced` snippet in a debug panel, a session timeline). ERRORS do not broadcast on this surface: they are log rows, and the client reads them the same way the model curates them — `log.read` / the `log/entry` notification, the durable log. {§telemetry-telemetry-event-notify}
1290
+ **Client surface.** Engine NOTICES broadcast live via the `telemetry/event` WS notification — same envelope as the model's drained copy (`{ source, kind, level, message?, position?, …kind-specific }` per the grammar's `TelemetryEvent` schema), the moment they land, scoped to the loop's session (a `grammar_unenforced` snippet in a debug panel, a session timeline). ERRORS do not broadcast on this surface: they are log rows, and the client reads them the same way the model curates them — `log.read` / the `log/entry` notification, the durable log. {§telemetry-telemetry-event-notify}
1276
1291
 
1277
- **Content-offset snippet rendering.** When a NOTICE carries `position: { type: "content-offset", line, column }` (e.g. a provider's `grammar_unenforced`), 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. The snippet field is stripped from the meta JSON so it appears once, in the body block. (A parse-error LOG ROW carries the equivalent snippet in its own foldable body the same locator, durable in the log.) {§telemetry-content-offset-snippet}
1292
+ **Content-offset position.** An emission-level error carries a `position: { type: "content-offset", line, column }` into the model's own emission a parse-error LOG ROW (op='error', §model-entry) and a content-offset NOTICE (e.g. a provider's `grammar_unenforced`) both report the line, not the bytes. The model resolves it against its own emission: the turn that erred has its `model` row born OPEN (§model-entry), so the line-numbered emission sits in the log and the model reads the cited line directly. No snippet is embedded that would duplicate the emission the model already holds. {§telemetry-content-offset-pointer}
1278
1293
 
1279
1294
  ### §tools user.tools — the capability sheet
1280
1295
 
@@ -1312,7 +1327,7 @@ Body matchers and `<L>` both dispatch on entry mimetype. Body matcher: leading-c
1312
1327
 
1313
1328
  ### §matcher-dispatch Matcher dispatch (service-owned, over daughter primitives)
1314
1329
 
1315
- `Matcher.matchAgainstContent` (in-tree, `src/content/matcher.ts`) is the **service's own** dialect dispatch — `Mimetypes.query` is NOT consumed (§mimetype-methods). It switches on the matcher's dialect and calls the daughter's individual primitives: `glob → queryGlob` and `regex → queryRegex` over the raw content; `jsonpath → queryJsonpathObject` over the `deepJson` projection and `xpath → queryXpathString` over `deepXml` (both pulled from `mimetypes.process({channels})`, so a structural dialect works over any source type). `~semantic` is service-side and parked; `@graph` resolves over the service's own symbol indexes (§mimetype-methods). Each returns `QueryMatch[]`, rendered as `<source-line>:\t<value>`. Status mapping:
1330
+ `Matcher.matchAgainstContent` (in-tree, `src/content/matcher.ts`) is the **service's own** dialect dispatch — `Mimetypes.query` is NOT consumed (§mimetype-methods). It handles the **content dialects** and switches on each, calling the daughter's individual primitives: `glob → queryGlob` and `regex → queryRegex` over the raw content; `jsonpath → queryJsonpathObject` over the `deepJson` projection and `xpath → queryXpathString` over `deepXml` (both pulled from `mimetypes.process({channels})`, so a structural dialect works over any source type), returning `QueryMatch[]` rendered as `<source-line>:\t<line>`. `~semantic` and `@graph` are **relation dialects, not content matchers** FIND resolves them upstream to `(file, span)` items (`~`semantic via `rankSemantic`, `@`graph via `EntryGraph`), so they never reach `matchAgainstContent` (a fail-hard invariant guards the impossible routing). Status mapping (content dialects):
1316
1331
 
1317
1332
  | Result | HTTP status |
1318
1333
  |---|---|
@@ -1320,7 +1335,6 @@ Body matchers and `<L>` both dispatch on entry mimetype. Body matcher: leading-c
1320
1335
  | Empty match array | 204 |
1321
1336
  | Malformed matcher expression | 400 |
1322
1337
  | Source unparseable for its mimetype | 203 (soft fallback: raw content as text with `reason`) |
1323
- | `~semantic` (parked, needs vector design) | 501 |
1324
1338
 
1325
1339
  203 is HTTP-creative ("Non-Authoritative Information"). On parse failure, returns raw bytes as text primitive with `reason` so the model can fall back to regex/visual parsing or fix source. {§matcher-dispatch-203-soft-fallback}
1326
1340
 
@@ -1338,10 +1352,12 @@ The contract is the grammar's: **plurnk.md §"`<Line> / <Result>`" — "FIND ret
1338
1352
  | glob `pat` | the lines the glob matches | the lines containing TODO |
1339
1353
  | jsonpath `$.path` | the line(s) where the structural path resolves | the line defining `host` |
1340
1354
  | xpath `//sel` | the line(s) of the selected node (text/html) | the line(s) of the h1 |
1355
+ | `~`semantic `~q` | the line span of each ranked chunk (a relation, resolved by FIND) | the section about X |
1356
+ | `@`graph `@<sym` | the line span of each matched symbol occurrence (a relation, resolved by FIND) | where X is referenced |
1341
1357
 
1342
- Across a **multi-file target** (a glob over `(target)`), READ returns **one log item per file that contains a match**, each holding that file's matching lines — READ is the content retrieval over the whole matched set, the companion to FIND's survey (§find-result-catalog-rows). *(Engine-level fan-out; tagged + tested when built.)*
1358
+ **READ honors FIND.** A READ that resolves to more than the single exact entry — a glob/folder scope, OR any matcher — fans out: the engine runs the scheme's FIND, then writes **one log row per MATCH** (not per file), each delivering that match's content — READ is the content retrieval over FIND's survey (§find-result-catalog-rows). A file with N matches → N rows. It costs **one command** (the model emitted one READ) yet writes N rows, each its own concrete `(file, span)` — individually foldable/killable/re-READable. A matcher row carries the source LINES at the match's span, delivered via a **raw line-slice** so a structural mimetype's item-index `<L>` never mis-slices a span that is, by construction, source lines; a body-less folder/glob row carries the whole entry. A **bare entry, body-less** is the single direct read. Zero matches writes a single `204` row (never silence). {§read-multi-file-fanout}
1343
1359
 
1344
- > **Implementation requirement (a mimetypes-daughter need, not a contract exception):** structural dialects must report the SOURCE LINE of each hit. regex/glob match over raw content (the line is in hand); jsonpath/xpath run over the parsed `deepJson`/`deepXml` projection and today return the value the match primitive must instead carry the line span of each hit, so READ can return the line.
1360
+ > **Source-line provenance (shipped, every dialect).** Each hit carries a source-line span: regex/glob over raw content; jsonpath/xpath over the parsed `deepJson`/`deepXml` projection (the mimetypes daughter reports each hit's line span); `~`semantic the ranked chunk's span; `@`graph the symbol occurrence's span. So the per-match `(file, span)` item is well-defined for every dialect, and READ returns the line uniformly.
1345
1361
 
1346
1362
  ### §slice-semantics `<L>` semantics by source mimetype
1347
1363
 
@@ -1365,7 +1381,7 @@ Across a **multi-file target** (a glob over `(target)`), READ returns **one log
1365
1381
  - `<0>` / `<-1>` → `[]` for READ
1366
1382
  - Out-of-range → 416; malformed JSON → 400
1367
1383
 
1368
- **Killer composition.** `<<READ(log:///N/M/K)<P>::READ` picks the P-th match from a prior matcher result matcher rx is `application/json`, structural `<L>` selects the P-th element. {§slice-semantics-compose-pattern}
1384
+ **Compose by addressing the match.** Under per-match fan-out a matcher READ writes one row per match, so the **N-th match IS `log:///<l>/<t>/N`** its own addressable row, read directly. There is no `<P>`-slice of a combined blob (no blob exists). To process a match further, READ its row and apply a matcher/`<L>` to that content (the body-less compose-chain). {§slice-semantics-compose-pattern}
1369
1385
 
1370
1386
  ### §json-edit Structural EDIT on JSON
1371
1387
 
@@ -1437,7 +1453,7 @@ Carried from the contract walk; durable.
1437
1453
  - **Dialect/mimetype mismatch** → 415 (xpath on text/plain → 415; jsonpath on JSON-shapeless mimetypes → 204 because outline is empty, not 415).
1438
1454
  - **Binary entries** → 415 across the board for READ/EDIT/OPEN/FOLD.
1439
1455
  - **EDIT `<L>` on non-existent entry** → body becomes content; `<L>` is positional-only on existing content.
1440
- - **COPY `<L>`** → source range, symmetric with READ `<L>`.
1456
+ - **COPY/MOVE `<L>`** → slices the SOURCE range into the destination (every channel), symmetric with READ `<L>` but WITHOUT the `N:\t` prefix (`sliceLinesRaw`); an out-of-range marker → 416. MOVE `<L>` copies the slice, then deletes the whole source (relocation of a fragment). Binary channels can't be sliced (the binary→415 rule above). {§copy-l-source-range}
1441
1457
  - **READ rx** prefixes each line with `N:\t` per §render-rule. `sliceLinesRaw` (used by COPY) returns the lines without prefix.
1442
1458
  - **FIND body matcher** applies to entry content (all dialects), per-candidate via the in-tree `Matcher.matchAgainstContent` (§matcher-dispatch; status 200 = content hit → entry selected). Scope + tags select candidates in SQL; the path-glob is the (target).
1443
1459
  - **OPEN/FOLD** operate on the **log** (`log:///`), not entries (§open-fold) — FOLD collapses a log row to its path, OPEN restores its body. Aimed at an entry scheme they return 501.
@@ -5,6 +5,10 @@ export interface MatchResult {
5
5
  body?: string;
6
6
  matches?: number;
7
7
  lines?: number[];
8
+ spans?: {
9
+ lineStart: number;
10
+ lineEnd: number;
11
+ }[];
8
12
  error?: string;
9
13
  mimetype?: string;
10
14
  reason?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"matcher.d.ts","sourceRoot":"","sources":["../../src/content/matcher.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAiC,MAAM,0BAA0B,CAAC;AAIzF,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,OAAO,OAAO;;WAiCX,mBAAmB,CAC5B,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,SAAS,EACpB,QAAQ,GAAE,MAAU,GACrB,OAAO,CAAC,WAAW,CAAC;CA+B1B"}
1
+ {"version":3,"file":"matcher.d.ts","sourceRoot":"","sources":["../../src/content/matcher.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAiC,MAAM,0BAA0B,CAAC;AAIzF,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,OAAO,OAAO;;WAuCX,mBAAmB,CAC5B,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,SAAS,EACpB,QAAQ,GAAE,MAAU,GACrB,OAAO,CAAC,WAAW,CAAC;CA6B1B"}
@@ -24,16 +24,25 @@ export default class Matcher {
24
24
  const lines = content.split("\n");
25
25
  const offset = baseLine - 1;
26
26
  const seen = new Set();
27
+ const seenSpan = new Set();
27
28
  const rows = [];
28
29
  const sourceLines = [];
30
+ const spans = []; // one (deduped) range per match — the (file, span) unit (#286)
29
31
  for (const m of matches) {
30
- const spans = m.lines ?? [];
31
- if (spans.length === 0) {
32
+ const ranges = m.lines ?? [];
33
+ if (ranges.length === 0) {
32
34
  rows.push(Matcher.#renderValue(m.matched));
33
35
  continue;
34
36
  }
35
- for (const span of spans) {
36
- for (let ln = span.line; ln <= span.endLine; ln++) {
37
+ for (const range of ranges) {
38
+ const lineStart = range.line + offset;
39
+ const lineEnd = range.endLine + offset;
40
+ const spanKey = `${lineStart}\0${lineEnd}`;
41
+ if (!seenSpan.has(spanKey)) {
42
+ seenSpan.add(spanKey);
43
+ spans.push({ lineStart, lineEnd });
44
+ }
45
+ for (let ln = range.line; ln <= range.endLine; ln++) {
37
46
  const src = ln + offset;
38
47
  sourceLines.push(src);
39
48
  if (seen.has(src))
@@ -43,17 +52,16 @@ export default class Matcher {
43
52
  }
44
53
  }
45
54
  }
46
- return { body: rows.join("\n"), lines: sourceLines };
55
+ return { body: rows.join("\n"), lines: sourceLines, spans };
47
56
  }
48
57
  static async matchAgainstContent(body, content, mimetype, mimetypes, baseLine = 1) {
49
- if (body.dialect === "semantic") {
50
- // Semantic similarity (grammar `~query`, top-K via <L>). Service-side, parked.
51
- return { status: 501, error: "semantic matcher not yet implemented (similarity parked, needs its own embedding/vector design)" };
52
- }
53
- if (body.dialect === "graph") {
54
- // @graph is a FIND-only symbol relation (EntryGraph), not a READ content matcher.
55
- return { status: 400, error: "@graph is a FIND relation, not a READ content matcher" };
56
- }
58
+ // Invariant (#286): ~semantic and @graph resolve to (file, span) items via FIND
59
+ // (rankSemantic / EntryGraph) never the content matcher. A matcher READ fans out through
60
+ // FIND, and the per-match read carries the span with no body. So matchAgainstContent only
61
+ // ever sees content dialects; reaching here with a relation dialect is a routing bug, not a
62
+ // user error fail hard rather than silently mis-handle.
63
+ if (body.dialect === "semantic" || body.dialect === "graph")
64
+ throw new Error(`matchAgainstContent is content-only; ${body.dialect} must resolve through FIND`);
57
65
  // Hand the daughter the matcher the GRAMMAR parsed — no second parser (mimetypes#42).
58
66
  const parsedMatcher = body.dialect === "regex"
59
67
  ? { dialect: "regex", pattern: body.pattern, flags: body.flags }
@@ -77,7 +85,7 @@ export default class Matcher {
77
85
  if (matches.length === 0)
78
86
  return { status: 204, matches: 0 };
79
87
  const rendered = Matcher.#renderRows(matches, content, baseLine);
80
- return { status: 200, body: rendered.body, matches: matches.length, lines: rendered.lines };
88
+ return { status: 200, body: rendered.body, matches: matches.length, lines: rendered.lines, spans: rendered.spans };
81
89
  }
82
90
  }
83
91
  //# sourceMappingURL=matcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"matcher.js","sourceRoot":"","sources":["../../src/content/matcher.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,kFAAkF;AAClF,uFAAuF;AACvF,mFAAmF;AACnF,yFAAyF;AACzF,sEAAsE;AACtE,EAAE;AACF,sFAAsF;AACtF,yFAAyF;AACzF,kEAAkE;AAIlE,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAC7I,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAYlD,MAAM,CAAC,OAAO,OAAO,OAAO;IACxB,MAAM,CAAC,YAAY,CAAC,CAAU;QAC1B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED,qFAAqF;IACrF,yFAAyF;IACzF,sFAAsF;IACtF,uFAAuF;IACvF,wFAAwF;IACxF,4EAA4E;IAC5E,MAAM,CAAC,WAAW,CAAC,OA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;CACJ"}
@@ -62,12 +62,13 @@ export default class ChannelWrite {
62
62
  notify?: StreamEventNotify;
63
63
  coordinate?: StreamCoordinate;
64
64
  }): Promise<void>;
65
- static openSubscription(db: Db, { runId, entryId, scheme, handle, pollSeconds }: {
65
+ static openSubscription(db: Db, { runId, entryId, scheme, handle, pollSeconds, turnScoped }: {
66
66
  runId: number;
67
67
  entryId: number;
68
68
  scheme: string;
69
69
  handle: string;
70
70
  pollSeconds?: number | null;
71
+ turnScoped?: boolean;
71
72
  }): Promise<number>;
72
73
  static closeSubscription(db: Db, { subscriptionId, status }: {
73
74
  subscriptionId: number;
@@ -89,5 +90,9 @@ export default class ChannelWrite {
89
90
  id: number;
90
91
  scheme: string;
91
92
  }>>;
93
+ static findOpenTurnScopedSubscriptionsForRun(db: Db, runId: number): Promise<Array<{
94
+ id: number;
95
+ scheme: string;
96
+ }>>;
92
97
  }
93
98
  //# 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,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM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CAAA;KAAE,GACjE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;WAKZ,sBAAsB,CAC/B,EAAE,EAAE,EAAE,EACN,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GACvD,OAAO,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;WAOpC,qCAAqC,CAC9C,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"}
@@ -57,8 +57,8 @@ export default class ChannelWrite {
57
57
  }
58
58
  // The subscription registry — open/find/close — is how a stream's cancellation
59
59
  // (SEND[499] / KILL) routes to the right live subscription. §subscriptions-subscription-registry-routes-cancellation
60
- static async openSubscription(db, { runId, entryId, scheme, handle, pollSeconds }) {
61
- const row = await ChannelWrite.#openSubStmt(db).get({ run_id: runId, entry_id: entryId, scheme, handle, poll_seconds: pollSeconds ?? null });
60
+ static async openSubscription(db, { runId, entryId, scheme, handle, pollSeconds, turnScoped }) {
61
+ const row = await ChannelWrite.#openSubStmt(db).get({ run_id: runId, entry_id: entryId, scheme, handle, poll_seconds: pollSeconds ?? null, turn_scoped: turnScoped ? 1 : 0 });
62
62
  if (row === undefined)
63
63
  throw new Error("openSubscription: INSERT ... RETURNING produced no row");
64
64
  return row.id;
@@ -85,5 +85,11 @@ export default class ChannelWrite {
85
85
  static async findOpenSubscriptionsForRun(db, runId) {
86
86
  return ChannelWrite.#openSubsForRunStmt(db).all({ run_id: runId });
87
87
  }
88
+ // The run's open turn-scoped (EXEC `<0>`) subscriptions — reaped at the run's next pre-turn so a
89
+ // `<0>` stream never survives into the subsequent turn (§exec-poll). Any open turn-scoped sub at
90
+ // pre-turn is necessarily from a prior turn (the reap runs before this turn's own spawns).
91
+ static async findOpenTurnScopedSubscriptionsForRun(db, runId) {
92
+ return db.find_open_turn_scoped_subscriptions_for_run.all({ run_id: runId });
93
+ }
88
94
  }
89
95
  //# 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;AAGhC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA6FhD,MAAM,CAAC,OAAO,OAAO,YAAY;IAC7B,MAAM,CAAC,YAAY,CAAC,EAAM,IAAgB,OAAO,EAAE,CAAC,YAA0B,CAAC,CAAC,CAAC;IACjF,MAAM,CAAC,WAAW,CAAC,EAAM,IAAgB,OAAO,EAAE,CAAC,iBAA+B,CAAC,CAAC,CAAC;IACrF,MAAM,CAAC,UAAU,CAAC,EAAM,IAAgB,OAAO,EAAE,CAAC,iBAA+B,CAAC,CAAC,CAAC;IACpF,MAAM,CAAC,aAAa,CAAC,EAAM,IAAgB,OAAO,EAAE,CAAC,oBAAkC,CAAC,CAAC,CAAC;IAC1F,MAAM,CAAC,YAAY,CAAC,EAAM,IAAgB,OAAO,EAAE,CAAC,iBAA+B,CAAC,CAAC,CAAC;IACtF,MAAM,CAAC,aAAa,CAAC,EAAM,IAAgB,OAAO,EAAE,CAAC,kBAAgC,CAAC,CAAC,CAAC;IACxF,MAAM,CAAC,eAAe,CAAC,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AAC,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;IAED,iGAAiG;IACjG,iGAAiG;IACjG,2FAA2F;IAC3F,MAAM,CAAC,KAAK,CAAC,qCAAqC,CAC9C,EAAM,EACN,KAAa;QAEb,OAAQ,EAAE,CAAC,2CAA0D,CAAC,GAAG,CAAiC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACjI,CAAC;CACJ"}
@@ -32,8 +32,10 @@ SET content = $content, tokens = $tokens
32
32
  WHERE entry_id = $entry_id AND name = $channel;
33
33
 
34
34
  -- PREP: open_subscription
35
- INSERT INTO subscriptions (run_id, entry_id, scheme, handle, poll_seconds)
36
- VALUES ($run_id, $entry_id, $scheme, $handle, $poll_seconds)
35
+ -- turn_scoped COALESCEs to 0 so a caller binding the raw prep without it (an unbounded stream) is
36
+ -- a normal, non-turn-scoped subscription — the column is NOT NULL, so a missing bind would error.
37
+ INSERT INTO subscriptions (run_id, entry_id, scheme, handle, poll_seconds, turn_scoped)
38
+ VALUES ($run_id, $entry_id, $scheme, $handle, $poll_seconds, COALESCE($turn_scoped, 0))
37
39
  RETURNING id;
38
40
 
39
41
  -- PREP: close_subscription
@@ -55,6 +57,14 @@ SELECT id, scheme
55
57
  FROM subscriptions
56
58
  WHERE run_id = $run_id AND closed_at IS NULL;
57
59
 
60
+ -- PREP: find_open_turn_scoped_subscriptions_for_run
61
+ -- The run's open turn-scoped (EXEC `<0>`) subscriptions — reaped at the run's next pre-turn so a
62
+ -- `<0>` stream never survives into the subsequent turn; its terminal output surfaces born-OPEN
63
+ -- through the same conclusion-delta path as any close (§exec-poll, §exec-stream).
64
+ SELECT id, scheme
65
+ FROM subscriptions
66
+ WHERE run_id = $run_id AND closed_at IS NULL AND turn_scoped = 1;
67
+
58
68
  -- PREP: find_exec_close_status
59
69
  -- Terminal outcome of a finished exec stream, addressed by its coordinate
60
70
  -- pathname — the KILL-on-a-non-running-exec lookup. 499 (aborted) = killed
@@ -75,6 +75,7 @@ export default class Engine {
75
75
  completionTokens: number;
76
76
  costPico: number;
77
77
  contextTokens: number;
78
+ contextSize: number | null;
78
79
  meta: Record<string, unknown>;
79
80
  }>;
80
81
  runLoop({ provider, messages, requirements, sessionId, runId, loopId, maxTurns, maxStrikes, minCycles, maxCyclePeriod, origin, signal, onDispatch, }: {
@@ -123,6 +124,13 @@ export default class Engine {
123
124
  content: string;
124
125
  }>;
125
126
  dispatch(context: DispatchContext): Promise<DispatchResult>;
127
+ look(context: {
128
+ statement: PlurnkStatement;
129
+ sessionId: number;
130
+ runId: number;
131
+ loopId: number;
132
+ origin?: WriterTier;
133
+ }): Promise<DispatchResult>;
126
134
  resolveProposal(logEntryId: number, resolution: ProposalResolution): void;
127
135
  pendingProposalIds(): number[];
128
136
  hasActiveLoopForRun(runId: number): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"Engine.d.ts","sourceRoot":"","sources":["../../src/core/Engine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAA0F,MAAM,wBAAwB,CAAC;AAMtJ,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAiB,MAAM,0BAA0B,CAAC;AAC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