@plurnk/plurnk-contracts 7.2.1 → 7.4.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.
- package/.env.defaults +8 -7
- package/README.md +4 -3
- package/SPEC.md +65 -73
- package/dist/schema/CapabilityDescriptor.json +3 -3
- package/dist/schema/CapabilitySelector.json +3 -3
- package/dist/schema/FunctionalityDefinitionState.json +1 -1
- package/dist/schema/MatcherBody.json +3 -3
- package/dist/schema/McpServerDefinition.json +1 -1
- package/dist/schema/Notice.json +1 -1
- package/dist/schema/PlurnkStatement.json +77 -86
- package/dist/schema/ProposalProjection.json +15 -16
- package/dist/schema/ResourceSelection.json +6 -6
- package/dist/schema/SendBody.json +1 -1
- package/dist/src/Application.d.ts +28 -6
- package/dist/src/Application.d.ts.map +1 -1
- package/dist/src/Application.js +159 -9
- package/dist/src/Application.js.map +1 -1
- package/dist/src/ApplicationNotifications.d.ts +135 -2
- package/dist/src/ApplicationNotifications.d.ts.map +1 -1
- package/dist/src/ApplicationNotifications.js +95 -1
- package/dist/src/ApplicationNotifications.js.map +1 -1
- package/dist/src/ApplicationPort.d.ts +2 -1
- package/dist/src/ApplicationPort.d.ts.map +1 -1
- package/dist/src/ApplicationPort.js.map +1 -1
- package/dist/src/ApplicationStream.d.ts +1 -3
- package/dist/src/ApplicationStream.d.ts.map +1 -1
- package/dist/src/ApplicationStream.js.map +1 -1
- package/dist/src/CapabilityAdmission.js.map +1 -1
- package/dist/src/Excerpt.js.map +1 -1
- package/dist/src/Functionality.js.map +1 -1
- package/dist/src/HttpOrigin.d.ts +27 -0
- package/dist/src/HttpOrigin.d.ts.map +1 -1
- package/dist/src/HttpOrigin.js +69 -0
- package/dist/src/HttpOrigin.js.map +1 -1
- package/dist/src/JsonDocument.js.map +1 -1
- package/dist/src/JsonResult.js.map +1 -1
- package/dist/src/LogRow.d.ts +1 -1
- package/dist/src/LogRow.d.ts.map +1 -1
- package/dist/src/LogRow.js +13 -15
- package/dist/src/LogRow.js.map +1 -1
- package/dist/src/LoopLifecycle.js.map +1 -1
- package/dist/src/MessageResource.js.map +1 -1
- package/dist/src/PathSyntax.js.map +1 -1
- package/dist/src/PlurnkParseError.js.map +1 -1
- package/dist/src/Problems.js.map +1 -1
- package/dist/src/TurnDisposition.js +1 -1
- package/dist/src/TurnDisposition.js.map +1 -1
- package/dist/src/Validator.js.map +1 -1
- package/dist/src/guards.js.map +1 -1
- package/dist/src/index.d.ts +4 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/types.d.ts +1 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.generated.d.ts +79 -79
- package/dist/src/types.generated.d.ts.map +1 -1
- package/dist/src/types.generated.js.map +1 -1
- package/dist/src/types.js +5 -7
- package/dist/src/types.js.map +1 -1
- package/package.json +3 -3
- package/plurnk.md +4 -165
- package/dist/src/TodoItems.d.ts +0 -6
- package/dist/src/TodoItems.d.ts.map +0 -1
- package/dist/src/TodoItems.js +0 -145
- package/dist/src/TodoItems.js.map +0 -1
package/.env.defaults
CHANGED
|
@@ -17,12 +17,13 @@ PLURNK_PORT=1066
|
|
|
17
17
|
# from what else is set.
|
|
18
18
|
PLURNK_AUTH=1
|
|
19
19
|
# The operator's client secret ({§auth-oauth-clients}): what the terminal client and every other
|
|
20
|
-
# tool of yours exchanges for access tokens. Unset, the daemon mints
|
|
21
|
-
#
|
|
22
|
-
# the same value in the tool's environment, for a tool on another host or under
|
|
20
|
+
# tool of yours exchanges for access tokens. Unset, the daemon mints a durable secret into the file
|
|
21
|
+
# `secret` beside its database (0600), reused across restarts where a tool running as you reads it.
|
|
22
|
+
# Set it here, and the same value in the tool's environment, for a tool on another host or under
|
|
23
|
+
# another user.
|
|
23
24
|
# PLURNK_SECRET=
|
|
24
|
-
# The operator's browser sign-in ({§auth-oauth-clients}): the password a browser signs in
|
|
25
|
-
# compared in constant time at the authorization endpoint.
|
|
26
|
-
#
|
|
27
|
-
#
|
|
25
|
+
# The operator's browser sign-in ({§auth-oauth-clients}): the password a remote browser signs in
|
|
26
|
+
# with, compared in constant time at the authorization endpoint. While it is empty, password sign-in
|
|
27
|
+
# is disabled (`503`); a browser on the same host can sign in directly through `plurnk web` (`/oauth/handoff`),
|
|
28
|
+
# and the terminal client and your other tools use PLURNK_SECRET instead.
|
|
28
29
|
PLURNK_PASS=
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The single authority for PLURNK's model-facing language contract, its AST,
|
|
4
4
|
shared schemas and types, runtime-neutral Problems, operation results,
|
|
5
|
-
Notices, and text coordinates. See SPEC {§
|
|
5
|
+
Notices, and text coordinates. See SPEC {§contract-representations}.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -24,12 +24,13 @@ Requires Node.js 26 or newer.
|
|
|
24
24
|
| Published JSON Schemas | `@plurnk/plurnk-contracts/schema/*.json` |
|
|
25
25
|
|
|
26
26
|
JSON Schema owns shared wire shapes, generated TypeScript projects those
|
|
27
|
-
shapes, and
|
|
27
|
+
shapes, and `@plurnk/plurnk-parser` owns accepted Heredoc Code Mode syntax and
|
|
28
|
+
Reflective Emission Normalization (RENO). See SPEC
|
|
28
29
|
{§contract-representations}.
|
|
29
30
|
|
|
30
31
|
## Parser
|
|
31
32
|
|
|
32
|
-
The parser that implements this language is [`@plurnk/plurnk-parser`](
|
|
33
|
+
The parser that implements this language is [`@plurnk/plurnk-parser`](https://github.com/plurnk/plurnk-service/tree/main/plurnk-parser):
|
|
33
34
|
`PlurnkParser` and `parsePath` are its exports, and it depends on this package for
|
|
34
35
|
the AST and wire types. A consumer that validates or presents the wire needs only
|
|
35
36
|
this package.
|
package/SPEC.md
CHANGED
|
@@ -20,28 +20,29 @@
|
|
|
20
20
|
|
|
21
21
|
```mermaid
|
|
22
22
|
flowchart LR
|
|
23
|
-
canon["Canonical model teaching<br/>plurnk.md"]
|
|
24
|
-
free["Other admitted input"]
|
|
25
|
-
syntax["
|
|
26
|
-
ast["
|
|
27
|
-
runtime["Runtime owners<br/>
|
|
23
|
+
canon["Canonical model teaching<br/>plurnk.md (Heredoc Code Mode)"]
|
|
24
|
+
free["Other admitted input<br/>(post-training envelopes & near-misses)"]
|
|
25
|
+
syntax["Heredoc Code Mode parser & RENO<br/>CodeMode.ts · CodeSerializer.ts"]
|
|
26
|
+
ast["Typed, serializable AST<br/>PlurnkStatement"]
|
|
27
|
+
runtime["Runtime owners<br/>execution & ops:// reflection"]
|
|
28
28
|
canon --> syntax
|
|
29
29
|
canon --> free
|
|
30
30
|
free --> syntax
|
|
31
31
|
syntax --> ast
|
|
32
32
|
ast --> runtime
|
|
33
|
+
ast -->|"PlurnkParser.stringify"| syntax
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
| Layer | Owner or artifact | Contract |
|
|
36
37
|
| --- | --- | --- |
|
|
37
38
|
| Stable current law | `SPEC.md` | Owns invariants and boundaries; forge issues retain history |
|
|
38
|
-
| Canonical model teaching | `plurnk.md` | Teaches the lean
|
|
39
|
-
| Accepted syntax | `
|
|
40
|
-
| Typed admission | `
|
|
39
|
+
| Canonical model teaching | `plurnk.md` | Teaches the lean Heredoc Code Mode call syntax and operational model the model should emit |
|
|
40
|
+
| Accepted syntax & RENO | `CodeMode.ts`, `SourceIndex.ts`, `ChunkScanner.ts`, `EnvelopeScanner.ts`, `MarkupReader.ts`, `TargetResolver.ts`, `CallExpressionParser.ts`, `OptionCoercion.ts`, `StatementLowering.ts`, `CodeSerializer.ts`, `HeredocSyntax.ts`, `MatcherSyntax.ts`, `ScopeSyntax.ts`, `TargetSyntax.ts` | Recognizes declarative `<service>.<tool>(args)` calls (and tolerated `await <service>.<tool>(args)`) with `<<<EOF` heredocs, normalizes deterministic post-training tool-call envelopes and argument near-misses on admission, and serializes canonical Heredoc Code Mode for `ops://` reflection |
|
|
41
|
+
| Typed admission | `PlurnkStatement` AST | Produces JSON-serializable unions and validates deterministic path/scope/matcher syntax |
|
|
41
42
|
| Shared wire data | `schema/*.json` | Defines runtime-neutral data shapes projected into generated TypeScript |
|
|
42
43
|
| Stateful behavior | consuming runtime | Resolves addresses, permissions, selection arithmetic, effects, and lifecycle |
|
|
43
44
|
|
|
44
|
-
- **Authoritative representations**: JSON Schema is authoritative for shared wire data shapes; TypeScript types are generated from `schema/*.json`;
|
|
45
|
+
- **Authoritative representations**: JSON Schema is authoritative for shared wire data shapes; TypeScript types are generated from `schema/*.json`; `@plurnk/plurnk-parser` is authoritative for accepted Heredoc Code Mode syntax and Reflective Emission Normalization (RENO).
|
|
45
46
|
- **ACP discovery and schema enforcement**: `AcpDiscovery` enumerates the installed ACP v2 actions (`scope`, `inputSchema`, `outputSchema`), notifications (`payloadSchema`), and `display` capabilities. Boundary validators enforce these schemas without mutating them and report structured validation `issues` in RFC 9457 Problem `detail`.
|
|
46
47
|
- **JSON result and document presentation**: `renderJsonResult` formats compact aggregate operation rows (placing top-level array items on individual lines without rewriting stored JSON coordinates). `formatJsonDocument` performs two-space whitespace-only formatting of complete strict JSON documents before representation storage.
|
|
47
48
|
|
|
@@ -66,7 +67,7 @@ flowchart LR
|
|
|
66
67
|
| `ProposalProjection` | Identity, review target, body/attrs, owner, capability selector, ACP v2 subject, stale signal, disposition | One validated projection for live delivery and reconnect |
|
|
67
68
|
|
|
68
69
|
- **Exact selector conjunction**: A capability selector matches a `CapabilityDescriptor` when every declared field equals the descriptor and every declared `trait` occurs in the descriptor's trait set. Within a policy layer, `deny` wins over `only` and `allow`; when `only` is present, at least one selector must match. An empty policy admits everything; an empty `only` list admits nothing.
|
|
69
|
-
- **Subtractive cascade**: Capability admission is purely subtractive and order-independent: a descriptor is admitted only when every active layer (`service` and `workspace`) admits it. Workspace policy cannot restore authority denied by the service. A demand is pre-approved across layers only when it is admitted across every layer and matches at least one layer's `allow` selector. Log/program control (`
|
|
70
|
+
- **Subtractive cascade**: Capability admission is purely subtractive and order-independent: a descriptor is admitted only when every active layer (`service` and `workspace`) admits it. Workspace policy cannot restore authority denied by the service. A demand is pre-approved across layers only when it is admitted across every layer and matches at least one layer's `allow` selector. Log/program control (`plurnk.kill` on `log:///...`, native dispositions `wait`/`note`, `done`, `fail`, and targetless `send`) creates no capability demand.
|
|
70
71
|
- **Proposals and session ownership**: `ProposalPolicy` (`review | accept | reject`) and `SessionOwner` (`address`, `clientTools`, `interactive`) govern stopped-world approval after capability admission succeeds.
|
|
71
72
|
- **Effort and model catalog wire**: `Effort` is `off | adaptive | low | medium | high | xhigh | max`. `ModelRoute`, `ModelCatalogPage`, and `ModelReadiness` expose provider/model identity, capabilities (including supported `efforts`), physical limits, and alternative required environment-variable name sets (names only, never values, credentials, or tuning internals).
|
|
72
73
|
|
|
@@ -87,73 +88,64 @@ flowchart LR
|
|
|
87
88
|
|
|
88
89
|
---
|
|
89
90
|
|
|
90
|
-
## §operation-fences 2. Canonical
|
|
91
|
+
## §operation-fences 2. Canonical Heredoc Code Mode statement form
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
body
|
|
95
|
-
```
|
|
93
|
+
```ts
|
|
94
|
+
plurnk.<op>({ ... }) // optional aside
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
input
|
|
96
|
+
<service>.<tool>({ ... })
|
|
99
97
|
```
|
|
100
|
-
`````
|
|
101
|
-
|
|
102
|
-
- **Backtick block boundaries**: Every canonical statement is a fenced block opened at column 0–3 by three or more backticks (`PLURNK_FENCE` is ``` ``` ```) followed on the same physical line by an operation keyword (`FIND`, `READ`, `EDIT`, `COPY`, `MOVE`, `SEND`, `DONE`, `FAIL`, `BARE`, `WORK`, `FORK`, `KILL`, `NOTE`, `TODO`, `WAIT`) or a runtime executor name.
|
|
103
|
-
- **Fence width and nesting**: The parser accepts three or more backticks and renders three; a wider outer fence encloses narrower inner fences verbatim without dispatching them. A block closes at a line with at least the opening backtick count and only horizontal whitespace (or an optional closer aside), or falls back at the next outer operation heading or end of input.
|
|
104
|
-
- **Naked operation recovery**: A column-zero line outside any block containing only a native operation name and optional `<!-- aside -->` opens that operation with a warning-severity advisory naming three backticks as the taught form.
|
|
105
98
|
|
|
106
|
-
|
|
99
|
+
- **Declarative top-level tool calls**: Every canonical Heredoc Code Mode statement is an unwrapped TypeScript/JavaScript `<service>.<tool>(args)` call (with leading `await` and trailing `;` tolerated on input and stripped in canonical serialization). `plurnk` is the built-in runtime service (`plurnk.read`, `plurnk.find`, `plurnk.edit`, `plurnk.copy`, `plurnk.move`, `plurnk.kill`, `plurnk.note`, `plurnk.work`, `plurnk.fork`, `plurnk.bare`, `plurnk.send`, `plurnk.done`, `plurnk.fail`, `plurnk.wait`, REPL tools `plurnk.sh`, `plurnk.js`, `plurnk.python3`, and Functionality tools `plurnk.env`, `plurnk.mcp`, `plurnk.members`, `plurnk.personas`, `plurnk.schedule`, `plurnk.skills`, `plurnk.question`). External MCP servers are peer top-level namespaces (`<service>.<tool>(args)`).
|
|
100
|
+
- **Bracket property access**: Non-identifier tool names use bracket notation (`gitea["issue-read"]({ ... })`).
|
|
101
|
+
- **No free JavaScript execution in the parser**: Top-level statements are parsed as declarative calls with literal arguments (`{ ... }`, `[ ... ]`, strings/backticks, `<<<EOF ... EOF` heredocs, numbers, booleans, `null`); variable declarations and control-flow constructs (`const`, `let`, `var`, `if`, `for`, `while`, `function`, `try`) invoking `plurnk` or tool calls are refused with a parser diagnostic directing JavaScript logic to `plurnk.js({ text: "..." })`, while unfenced general JavaScript snippets in model prose that do not invoke `plurnk`, a registered executor, or a literal-object tool call remain outside text.
|
|
107
102
|
|
|
108
|
-
|
|
103
|
+
### §fence-pairing Statement boundaries, RENO admission tolerances, and reflective rendering
|
|
109
104
|
|
|
110
105
|
| Rule | Contract |
|
|
111
106
|
| --- | --- |
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
| Native tool-call recovery | When a model emits provider-native tool-call markup (`<tool_call>`, `<function=...>`, JSON tool calls) instead of fenced operations, the parser recovers recognizable PLURNK operations or emits a warning receipt for unexecuted markup. |
|
|
118
|
-
| Statement rendering | `PlurnkParser.stringify` formats AST statements back into canonical three-backtick blocks (or wider when the body contains fences), normalizing empty optional bodies to `null`. |
|
|
119
|
-
|
|
120
|
-
### §slot-order Heading slot order, target groups, and metadata modifiers
|
|
107
|
+
| Balanced call boundaries & heredocs | A statement spans from its `<service>.<tool>(` head through its matching closing `)` and optional `;` and trailing `// aside` comment. In any value position, `<<<TAG\n...\nTAG` (where `TAG` matches `[A-Za-z][A-Za-z0-9_-]{0,16}`, optionally single- or double-quoted on the opener, or placed after `})` as a statement-trailing heredoc) captures raw unescaped text between its opener newline and closer line, pairing nested `<<TAG` / `<<-TAG` shell heredocs before closing the outer `TAG`. Multi-line strings and template literals (`` `...` ``) preserve embedded newlines and treat unescaped `${...}` as literal text. |
|
|
108
|
+
| Markdown fence unwrapping & `await` tolerance | Heredoc Code Mode statements require neither a Markdown fence nor `await`; if a model prefixes `await` or wraps `plurnk.<op>(...)` or a registered `<service>.<tool>(...)` (or `await <service>.<tool>(...)`) inside a balanced `ts`, `js`, or plain Markdown code fence, the parser normalizes the statement silently under RENO. |
|
|
109
|
+
| Native and markup tool-call translation | Tool-call wrapper tags (`<tool_call>`, `<tool_calls>`, `<function_call>`, `<function_calls>`, `<|DSML|function_calls>`, `<||DSML|| function_calls>`, `<\|tool_call\|>`, `<|tool▁calls▁begin|>`, `<\|tool_calls_section_begin\|>`, `<\|python_tag\|>`, `[TOOL_CALLS]`) around Code Mode statements unwrap silently, and structured XML/DSML/token-delimited (`<function=...>`, `<invoke name="...">`, `<|DSML|invoke name="...">`, `<plurnk.<op> ... />`, `<|tool▁call▁begin|>`, `<\|tool_call_begin\|>`, `<\|tool_call\|>name`, `<\|channel\|>... to=name`) or JSON tool calls targeting `plurnk` operations or `<service>.<tool>` translate silently into canonical Heredoc Code Mode statements. |
|
|
110
|
+
| Case-insensitive method recovery | Uppercase or mixed-case method names (`plurnk.READ(...)`, `plurnk.SH(...)`) recover silently to their lowercase canonical tool name. |
|
|
111
|
+
| Reflective statement rendering | `PlurnkParser.stringify` formats AST statements back into canonical `plurnk.<op>({ ... })` or `<service>.<tool>({ ... })` Heredoc Code Mode statements for `emission` / `emission-history` (`assistant` turn) reflection, normalizing empty optional bodies to `null` and rendering every `pattern` field and any string value containing `\n` (as well as the Turn 0 `Resolve all Open Work.` note seed) as an inline `<<<EOF\n...\nEOF` heredoc (stepping `EOF1`, `EOF2`, … when the string contains the delimiter). |
|
|
121
112
|
|
|
122
|
-
|
|
113
|
+
### §slot-order Argument shapes, target groups, and endpoint options
|
|
123
114
|
|
|
124
115
|
| Construct | Contract |
|
|
125
116
|
| --- | --- |
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
|
|
|
129
|
-
|
|
|
130
|
-
| Operation aside | A trailing
|
|
117
|
+
| Object and positional argument forms | Core operations accept their canonical `{ ... }` options object (`{ path, range?, pattern?, text?, ... }`) as well as concise positional string/array shorthands (`plurnk.read("a.ts")`, `plurnk.copy("a.ts", "b.ts")`, `plurnk.note("text")`). |
|
|
118
|
+
| Target groups and multi-target lists | `plurnk.read`, `plurnk.find`, and `plurnk.kill` accept `path` or `paths` as a string or array of strings; comma/pipe/whitespace-separated `scheme://` URI lists and comma/pipe-separated local path/glob lists outside brackets/braces expand into one statement per target in authored order. |
|
|
119
|
+
| `note` annotation on retrievals | Providing `note` on `plurnk.read` or `plurnk.find` emits a preceding `note` statement before the retrieval(s). |
|
|
120
|
+
| Endpoint and message options | `headers` (`Record<string, string>`) passes HTTP(S) request headers on `plurnk.read`, `plurnk.find`, `plurnk.edit`, `plurnk.send`, `plurnk.kill`, and `plurnk.copy`/`plurnk.move` (`fromHeaders`/`toHeaders`); `remote` (`boolean`) confirms remote HTTP `DELETE` on `plurnk.kill`; `attachments` (`string[]`) attaches resources to `plurnk.send`, `plurnk.done`, and `plurnk.fail`. Unknown option keys on `plurnk.<op>({ ... })` are refused with a parser diagnostic. |
|
|
121
|
+
| Operation aside | A trailing `// aside` comment after `;` or `)` on the closing line of a statement is captured into `aside` (`string` or `null`) as descriptive commentary, splitting before any glued transcript heading (`### log:///` or `**<service>: <label>**`). |
|
|
131
122
|
|
|
132
123
|
---
|
|
133
124
|
|
|
134
125
|
## §op-shapes 3. Per-operation semantics and dispositions
|
|
135
126
|
|
|
136
|
-
|
|
|
127
|
+
| Call | Target field | Scope / matcher / endpoint fields | Content / payload fields |
|
|
137
128
|
| --- | --- | --- | --- |
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
141
|
-
| `
|
|
142
|
-
|
|
|
143
|
-
| `
|
|
144
|
-
|
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
- **
|
|
129
|
+
| `plurnk.find` | required `path` / `paths` | optional `range`, `pattern`, `headers` | optional `note` normalized to preceding `note` |
|
|
130
|
+
| `plurnk.read` | required `path` / `paths` | optional `range`, `pattern`, `headers` | optional `note` normalized to preceding `note` |
|
|
131
|
+
| `plurnk.edit` | required `path` | `range` or `pattern` or `oldText`/`newText` or `edits` for existing target; `text` alone creates; optional `headers` | `text` (or tolerated `content`, `replacement`, `newText`, `body`), or `edits` array |
|
|
132
|
+
| `plurnk.copy` / `plurnk.move` | required `from` and `to` | optional `fromRange` / `toRange`, `fromHeaders` / `toHeaders` | none |
|
|
133
|
+
| `plurnk.sh` / `plurnk.js` / `plurnk.python3` | optional `script`, `cwd` | none | `text` (or tolerated `code` / `command` / `cmd` / `body` / `source` / `prompt`), optional `args` |
|
|
134
|
+
| `plurnk.<functionality>` | tool name (`env`, `mcp`, `members`, `personas`, `schedule`, `skills`, `question`) | none | JSON arguments object |
|
|
135
|
+
| `<service>.<tool>` | external MCP `<service>` and `<tool>` | optional second `{ range }` options arg | JSON arguments object or string |
|
|
136
|
+
| `plurnk.bare` | none | none | required `text` (or tolerated `prompt` / `body` / `content` / `message`) |
|
|
137
|
+
| `plurnk.work` / `plurnk.fork` | optional `target` (`session://name`) | none | required `text` (or tolerated `prompt` / `body` / `content` / `message`) |
|
|
138
|
+
| `plurnk.kill` | required `path` / `paths` | optional `range`, `pattern`, `remote`, `headers` | optional `note` distillation on `log:///` |
|
|
139
|
+
| `plurnk.send` | optional `target` recipient (caller aliases `user`/`client`/`human`/`operator`/`caller` normalize to `null`) | optional `headers`, `attachments` | required `text` message body |
|
|
140
|
+
| `plurnk.done` | optional `target` (`message://`; caller aliases normalize to `null`) | optional `attachments` | optional `text` final deliverable (`plurnk.done()` / `plurnk.done({})` resolves silently when empty) |
|
|
141
|
+
| `plurnk.fail` | optional `target` (`message://`; caller aliases normalize to `null`) | optional `attachments` | optional `text` final failure explanation (`plurnk.fail()` / `plurnk.fail({})` cancels silently when empty) |
|
|
142
|
+
| `plurnk.note` | none | none | `text` facts, ideas, and plans |
|
|
143
|
+
| `plurnk.wait` | none | optional `seconds` | none (uses trailing `// aside`; tolerated `text` normalizes to `aside`) |
|
|
144
|
+
|
|
145
|
+
- **Retrieval annotations**: Nonblank `note` options on `find` or `read` normalize into a preceding `note` statement.
|
|
146
|
+
- **Text range algebra**: `"N"` selects whole line `N` (`"0"` prepends, `"-1"` appends on mutation); `"N,M"` selects inclusive lines `N..M`; `"SL,SC,EL,EC"` selects an exact 1-based Unicode code-point region with exclusive end (three-integer ranges normalize to four).
|
|
155
147
|
- **Local path fragments**: Bare paths decompose `#channel` into `fragment` just like `scheme://` URLs so channel selectors round-trip identically.
|
|
156
|
-
- **Turn dispositions (`
|
|
148
|
+
- **Turn dispositions (`wait`, `done`, and `fail`)**: Dispositions may appear anywhere in a turn; multiple `wait` statements coalesce to the shortest `seconds` bound, and `done` (`200`) or `fail` (`499`) resolves an Open Message once all earlier operations in the turn settle.
|
|
157
149
|
|
|
158
150
|
---
|
|
159
151
|
|
|
@@ -167,28 +159,27 @@ Producers write `(target) <scope> [metadata] <!-- aside -->` separated by single
|
|
|
167
159
|
|
|
168
160
|
## §matcher-prefix-claims 5. Bulk pattern matching and scope markers
|
|
169
161
|
|
|
170
|
-
`
|
|
162
|
+
`plurnk.find`, `plurnk.read`, `plurnk.kill`, and `plurnk.edit` accept a `pattern` matcher classified by leading sigil (`glob` and `regex` may span multiple lines; `xpath`, `jsonpath`, `fts`, and `graph` are single-line):
|
|
171
163
|
|
|
172
164
|
| Prefix | Dialect | Validation & tolerance |
|
|
173
165
|
| --- | --- | --- |
|
|
174
|
-
| `//` | `xpath` | Validated with XPath 1.0 parser before regex classification |
|
|
175
|
-
| `/` or `^` | `regex` | ECMAScript `RegExp`; tolerates `\|` alternation, trailing `-flags`, and glob-shaped `/*text*/`
|
|
166
|
+
| `//` | `xpath` | Validated with XPath 1.0 parser before regex classification (also silently normalizes single-slash absolute XPath location paths such as `/root/item[@id='old']/@id` or `/root/item/text()`, regex-wrapped or trailing-slash XPath selectors such as `///item[@id='old']/`, `//item[@id='old']/`, or `/\/\/item[@id='old']/`, and vacuous `/text()` after `@attr` steps) |
|
|
167
|
+
| `/` or `^` | `regex` | ECMAScript `RegExp`; tolerates `\|` alternation, trailing `-flags`, `/~.../` mixed prefix, unbalanced unescaped `(`, `)`, or `[`, and glob-shaped `/*text*/` |
|
|
176
168
|
| `$` | `jsonpath` | Validated with RFC 9535 `json-p3` |
|
|
177
169
|
| `~` | `fulltext` | Single-line FTS5 query string |
|
|
178
170
|
| `&` | `graph` | `&symbol`, `&<symbol`, or `&>symbol` relation query |
|
|
179
|
-
| none | `glob` | Fallback shell glob or literal substring |
|
|
171
|
+
| none | `glob` | Fallback shell glob or single/multiline literal substring (`<<<EOF...EOF`) |
|
|
180
172
|
|
|
181
173
|
- **Soft matcher refusal**: An invalid matcher expression is admitted as `matcher.dialect = "unreadable"` with its diagnostic and working-form `recovery` so only that operation fails `400 grammar/matcher/unreadable-pattern` while sibling statements in the turn still execute.
|
|
182
|
-
- **
|
|
183
|
-
- **Line anchors and
|
|
174
|
+
- **Statement recovery and argument tolerances**: Statement errors recover at the next top-level call; an inline `<L,M>` range written inside `path<L,M>` is lifted silently; extra positional arguments beyond the operation's arity fail only that statement.
|
|
175
|
+
- **Line anchors and range recovery**: `TextLineMarker` accepts `@<5 Base62 chars>` line anchors (with optional `[+-]K` offsets or surrounding `<...>`) in line positions; reversed or count two-number ranges (`"M,N"` with `M > N`, `"N,+K"`) and unambiguous anchor forms (`"@hash,1"` as `"@hash"`, `"@hash,0"` as `"@hash,1,@hash,1"`, and `"@start,@end,SC[,EC]"` as `"@start,SC,@end[,EC]"`) normalize silently under RENO.
|
|
184
176
|
|
|
185
177
|
---
|
|
186
178
|
|
|
187
179
|
## §whitespace-contract 6. Parser architecture, whitespace, and public API
|
|
188
180
|
|
|
189
|
-
- **
|
|
190
|
-
- **
|
|
191
|
-
- **Tier entry points and runtime-neutral root**: `PlurnkParser.parse` (model turn) and `PlurnkParser.parseStatements` (protocol statements) are exported by `@plurnk/plurnk-parser`. The `@plurnk/plurnk-contracts` root is closed (verified by `src/index.test.ts`) and browser/DOM runtime-neutral (`tsconfig.browser.json`), with Node HTTP host types isolated in `@plurnk/plurnk-contracts/port`.
|
|
181
|
+
- **Statement scanning and outside text**: `PlurnkParser.parse` partitions a model turn into ordered `statement`, `error`, and outside `text` items (`emptyTurn` is `true` when no `statement` or `error` items are produced).
|
|
182
|
+
- **Tier entry points and runtime-neutral root**: `PlurnkParser.parse` (model turn), `PlurnkParser.parseStatements` (protocol statements), and `PlurnkParser.stringify` (canonical Code Mode rendering) are exported by `@plurnk/plurnk-parser`. The `@plurnk/plurnk-contracts` root is closed (verified by `src/index.test.ts`) and browser/DOM runtime-neutral (`tsconfig.browser.json`), with Node HTTP host types isolated in `@plurnk/plurnk-contracts/port`.
|
|
192
183
|
|
|
193
184
|
---
|
|
194
185
|
|
|
@@ -222,7 +213,9 @@ Producers write `(target) <scope> [metadata] <!-- aside -->` separated by single
|
|
|
222
213
|
|
|
223
214
|
| Projection / Helper | Contract |
|
|
224
215
|
| --- | --- |
|
|
225
|
-
| `ApplicationPort` | Transport-neutral interface in `@plurnk/plurnk-contracts/port` driving workspaces, sessions, loops (`runLoop` with causal `source`, `attachments`, `envelope`), operations, proposals, client interactions, and event subscriptions (`
|
|
216
|
+
| `ApplicationPort` | Transport-neutral interface in `@plurnk/plurnk-contracts/port` driving workspaces, sessions, loops (`runLoop` with causal `source`, `attachments`, `envelope`), operations, proposals, client interactions, and filtered event subscriptions (`subscribeToEvents(handler, filter?)`). |
|
|
217
|
+
| `DaemonNotification` / `NotificationFilter` | Closed discriminated union over the 20 `DAEMON_NOTIFICATION_EVENTS` (`{ id, event, timestamp, workspaceId, sessionId, data }`), constructed by `toDaemonNotification` and filtered at source by `matchesNotificationFilter(notification, { events?, workspaceId?, sessionId? })`. |
|
|
218
|
+
| `admitBearerRequest` | Runtime-neutral OAuth 2.1 Bearer and optional `?access_token=` admission helper over `CredentialAuthority` returning `{ ok: true, family, subject }` or `{ ok: false, problem, challenge }`. |
|
|
226
219
|
| `selectSessionLoop` | Chooses `running` before `parked` before `queued` (oldest unresolved sequence wins ties); with no live work, the latest terminal settlement wins. Maintenance-only loops do not change this projection. |
|
|
227
220
|
| `lifecycleOfLoopStatus` | Maps loop status to client lifecycle vocabulary: no loop `idle`; `100` `queued`; `102` `running`; `202` `parked`; `< 400` `completed`; `499` `cancelled`; `>= 400` `failed` (`413` budget, `429` turn ceiling, `500` fail, `504` timeout, `508` runaway). |
|
|
228
221
|
| `excerptOf` | Extracts the first non-blank line of a message truncated to at most `N` code points without splitting a character, with trailing whitespace trimmed and `continued: boolean`. |
|
|
@@ -230,7 +223,7 @@ Producers write `(target) <scope> [metadata] <!-- aside -->` separated by single
|
|
|
230
223
|
|
|
231
224
|
---
|
|
232
225
|
|
|
233
|
-
## §parse-recovery 8.
|
|
226
|
+
## §parse-recovery 8. Reflective Emission Normalization (RENO), tolerances, and error shapes
|
|
234
227
|
|
|
235
228
|
`PlurnkParseError` is a JSON-serializable `Error` carrying `{ line, column, source: "lexer" | "parser" | "visitor", severity: "error" | "warning", recovery?, attempt?, operationOmitted }`:
|
|
236
229
|
|
|
@@ -243,7 +236,6 @@ Producers write `(target) <scope> [metadata] <!-- aside -->` separated by single
|
|
|
243
236
|
|
|
244
237
|
| Mechanism | Contract |
|
|
245
238
|
| --- | --- |
|
|
246
|
-
| Working-form recovery & attempt | Every hard error (`severity: "error"`) populates `recovery` with the canonical syntax of the refused construct and `attempt` (`{ text, verb }`) with the refused statement's source text; `operationOmitted` marks unexecuted
|
|
247
|
-
| Regex and matcher tolerances | Lifts leading PCRE inline flags `(?ims)` with a warning; folds comma-separated `/pattern/` lists on `
|
|
248
|
-
|
|
|
249
|
-
| Log-heading notation recovery | Recovers copied log-heading forms with a warning advisory: `OP → path <scope>` is read as `(path)`; `· 900` / `· 320 tokens` token charges are dropped; `· note text` at the end of a heading is read as `<!-- note text -->` (or dropped when an explicit `<!-- aside -->` follows). |
|
|
239
|
+
| Working-form recovery & attempt | Every hard error (`severity: "error"`) populates `recovery` with the canonical Heredoc Code Mode syntax of the refused construct and `attempt` (`{ text, verb }`) with the refused statement's source text; `operationOmitted` marks unexecuted call fragments. Each malformed statement produces at most one hard error. |
|
|
240
|
+
| Regex and matcher tolerances | Lifts leading PCRE inline flags `(?ims)` with a warning; recognizes unslashed line-anchored regexes opening with `^` or closing with `$`; folds comma-separated `/pattern/` lists on `find` and `read` into alternation with a warning while refusing numeric/open sed ranges (`/a/,+N`, `/a/,-1`, `/a/,`) and mutating `/a/,/b/` ranges; diagnoses trailing text after `/pattern/flags`; recovers unclosed `/pattern` at EOL. |
|
|
241
|
+
| Statement & argument tolerances (RENO) | Lifts inline `<L,M>` ranges from `path<L,M>` strings with a warning; recovers bare `edit` anchors (`@abcde`), combined `42<@abcde>` ranges, trailing commas in range lists (`"17,18,"`), unbalanced angle brackets around `@hash` ranges (`"<@abcde,@fghij"`), anchor-first column tuples (`"@SL,@EL,SC[,EC]"`), and packet-header line counts (`"N lines"`); recovers extra or transposed delimiters on heredoc closers (`EOF)})`, `EOF)}`, `EOF)]`) and closing `}}` call braces; unwraps nested parameter wrappers (`params`, `parameters`, `arguments`, `args`, `input`, `options`, `properties`, `text`); transduces foreign native tool-call envelopes (`<tool_call>`, `<TOOLCALL>`, `<\|tool_call_start\|>`, `<\|python_tag\|>`, `[TOOL_CALLS]...[ARGS]`, `Action:` JSON fences, `<arg_key>`/`<arg_value>`, `<seed:think>`, `<mm:think>`); unwraps Markdown-fenced Code Mode statements and accepts redundant `await` prefixes silently; suppresses standalone `**<service>: <label>**` transcript-echo headings and trailing canonical duplicate statements in model emissions; and sets `unparsedTail` when an unclosed string, comment, parenthesis, bracket, or brace reaches end of input. |
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"operation": {
|
|
11
11
|
"description": "An operation keyword, or a runtime tag: an execution's operation is its runtime.",
|
|
12
12
|
"anyOf": [
|
|
13
|
-
{ "enum": ["
|
|
14
|
-
{ "type": "string", "pattern": "^[a-z][a-z0-9+._-]*$" }
|
|
13
|
+
{ "enum": ["find", "read", "edit", "copy", "move", "send", "bare", "work", "fork", "kill"] },
|
|
14
|
+
{ "type": "string", "pattern": "^[a-z][a-z0-9+._-]*$", "not": { "enum": ["done", "fail", "note", "wait", "extension", "error"] } }
|
|
15
15
|
],
|
|
16
|
-
"tsType": "\"
|
|
16
|
+
"tsType": "\"find\" | \"read\" | \"edit\" | \"copy\" | \"move\" | \"send\" | \"bare\" | \"work\" | \"fork\" | \"kill\" | Lowercase<string>"
|
|
17
17
|
},
|
|
18
18
|
"scheme": { "type": "string", "pattern": "^[a-z][a-z0-9+._-]*$" },
|
|
19
19
|
"runtime": { "type": "string", "pattern": "^[a-z][a-z0-9+._-]*$" },
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"operation": {
|
|
11
11
|
"description": "An operation keyword, or a runtime tag: an execution's operation is its runtime.",
|
|
12
12
|
"anyOf": [
|
|
13
|
-
{ "enum": ["
|
|
14
|
-
{ "type": "string", "pattern": "^[a-z][a-z0-9+._-]*$" }
|
|
13
|
+
{ "enum": ["find", "read", "edit", "copy", "move", "send", "bare", "work", "fork", "kill"] },
|
|
14
|
+
{ "type": "string", "pattern": "^[a-z][a-z0-9+._-]*$", "not": { "enum": ["done", "fail", "note", "wait", "extension", "error"] } }
|
|
15
15
|
],
|
|
16
|
-
"tsType": "\"
|
|
16
|
+
"tsType": "\"find\" | \"read\" | \"edit\" | \"copy\" | \"move\" | \"send\" | \"bare\" | \"work\" | \"fork\" | \"kill\" | Lowercase<string>"
|
|
17
17
|
},
|
|
18
18
|
"scheme": { "type": "string", "pattern": "^[a-z][a-z0-9+._-]*$" },
|
|
19
19
|
"runtime": { "type": "string", "pattern": "^[a-z][a-z0-9+._-]*$" },
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"$ref": "https://schemas.plurnk.xyz/v0/FunctionalityProvenance.json"
|
|
23
23
|
},
|
|
24
24
|
"inherited": {
|
|
25
|
-
"description": "The Session this entry was copied from when this Session was created (
|
|
25
|
+
"description": "The Session this entry was copied from when this Session was created (`work` or `fork`), preserved across generations until this Session changes the entry. Absent for an entry this Session set itself. Session-scoped families only.",
|
|
26
26
|
"type": "string",
|
|
27
27
|
"minLength": 1
|
|
28
28
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://schemas.plurnk.xyz/v0/MatcherBody.json",
|
|
4
4
|
"title": "MatcherBody",
|
|
5
|
-
"description": "Parsed
|
|
5
|
+
"description": "Parsed body of a matcher-bearing statement, discriminated on `dialect`. The dialect is determined by the body's leading characters (`//` xpath, `/` regex, `$` jsonpath, `~` full-text, `&` graph, else glob); a body the parser could not read in its claimed dialect is `unreadable` ({§matcher-prefix-claims}). The regex variant carries pattern and flags split out of the `/pattern/flags` literal; every variant remains JSON-serializable.",
|
|
6
6
|
"oneOf": [
|
|
7
7
|
{ "$ref": "#/$defs/XPathBody" },
|
|
8
8
|
{ "$ref": "#/$defs/RegexBody" },
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"additionalProperties": false,
|
|
33
33
|
"properties": {
|
|
34
34
|
"dialect": { "const": "regex" },
|
|
35
|
-
"raw": { "type": "string", "minLength": 2
|
|
35
|
+
"raw": { "type": "string", "minLength": 2 },
|
|
36
36
|
"pattern": { "type": "string" },
|
|
37
37
|
"flags": { "type": "string" }
|
|
38
38
|
}
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"additionalProperties": false,
|
|
92
92
|
"properties": {
|
|
93
93
|
"dialect": { "const": "glob" },
|
|
94
|
-
"raw": { "type": "string"
|
|
94
|
+
"raw": { "type": "string" }
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"$defs": {
|
|
15
15
|
"name": {
|
|
16
16
|
"title": "McpServerName",
|
|
17
|
-
"description": "The server's alias:
|
|
17
|
+
"description": "The server's alias: its runtime name (`<alias>.<tool>`) and resource scheme (`<alias>://`).",
|
|
18
18
|
"type": "string",
|
|
19
19
|
"pattern": "^[a-z][a-z0-9_-]*$"
|
|
20
20
|
},
|
package/dist/schema/Notice.json
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"op": {
|
|
66
66
|
"type": "string",
|
|
67
|
-
"description": "Optional op token (
|
|
67
|
+
"description": "Optional op token (find/read/edit/...) at the coordinate, for human-readable rendering."
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|