@plurnk/plurnk-contracts 8.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SPEC.md +10 -24
- package/dist/schema/DaemonNotificationEnvelope.json +555 -0
- package/dist/schema/McpServerDefinition.json +1 -1
- package/dist/schema/PlurnkStatement.json +24 -0
- package/dist/schema/ProposalProjection.json +0 -4
- package/dist/src/Application.d.ts +22 -1
- package/dist/src/Application.d.ts.map +1 -1
- package/dist/src/Application.js +480 -15
- package/dist/src/Application.js.map +1 -1
- package/dist/src/ApplicationNotifications.d.ts +59 -19
- package/dist/src/ApplicationNotifications.d.ts.map +1 -1
- package/dist/src/ApplicationNotifications.js +40 -7
- package/dist/src/ApplicationNotifications.js.map +1 -1
- package/dist/src/ApplicationPort.d.ts +26 -7
- package/dist/src/ApplicationPort.d.ts.map +1 -1
- package/dist/src/ApplicationPort.js.map +1 -1
- package/dist/src/LogRow.d.ts +1 -1
- package/dist/src/LogRow.js +1 -1
- package/dist/src/LogRow.js.map +1 -1
- package/dist/src/Validator.d.ts +3 -3
- package/dist/src/Validator.d.ts.map +1 -1
- package/dist/src/Validator.js +8 -16
- package/dist/src/Validator.js.map +1 -1
- package/dist/src/index.d.ts +2 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/types.generated.d.ts +820 -636
- package/dist/src/types.generated.d.ts.map +1 -1
- package/dist/src/types.generated.js.map +1 -1
- package/dist/src/types.js +1 -1
- package/dist/src/types.js.map +1 -1
- package/package.json +2 -2
- package/dist/schema/ApplicationOperationEvent.json +0 -27
- package/dist/schema/CapabilityDescriptor.json +0 -28
- package/dist/schema/CapabilityPolicy.json +0 -22
- package/dist/schema/CapabilityProjection.json +0 -14
- package/dist/schema/CapabilitySelector.json +0 -29
- package/dist/src/CapabilityAdmission.d.ts +0 -11
- package/dist/src/CapabilityAdmission.d.ts.map +0 -1
- package/dist/src/CapabilityAdmission.js +0 -108
- package/dist/src/CapabilityAdmission.js.map +0 -1
package/SPEC.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
| Surface | Canonical export or artifact |
|
|
8
8
|
| --- | --- |
|
|
9
9
|
| AST, validators, Problems, results, Notices, text regions and extents | `@plurnk/plurnk-contracts` |
|
|
10
|
-
|
|
|
10
|
+
| Approval ownership and proposal policies | `SessionOwner`, `ProposalPolicy`, `PROPOSAL_POLICIES` |
|
|
11
11
|
| Durable effort and model catalog discovery | `Effort`, `EFFORTS`, `ModelRoute`, `ModelCatalogQuery`, `ModelCatalogPage`, `ModelReadiness` |
|
|
12
12
|
| Stopped-world proposals and client interactions | `ProposalDisposition`, `ProposalProjection`, `ClientInteractionRequest`, `ClientInteractionProjection`, `ClientInteractionResolution` |
|
|
13
13
|
| Client capability presentation | `ClientDisplayCapabilities` |
|
|
@@ -46,29 +46,15 @@ flowchart LR
|
|
|
46
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`.
|
|
47
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.
|
|
48
48
|
|
|
49
|
-
### §
|
|
50
|
-
|
|
51
|
-
```mermaid
|
|
52
|
-
flowchart LR
|
|
53
|
-
S["Service CapabilityPolicy"] & W["Workspace CapabilityPolicy"] --> E["Effective intersection (deny > only > allow)"]
|
|
54
|
-
E --> D{"Admitted?"}
|
|
55
|
-
D -->|no| R["403 capability-denied"]
|
|
56
|
-
D -->|yes, allow match| A["Auto-accepted execution"]
|
|
57
|
-
D -->|yes, gated| P["ProposalDisposition (review | accept | reject)"]
|
|
58
|
-
```
|
|
49
|
+
### §proposal-and-model-contracts Proposals, effort, and model catalog
|
|
59
50
|
|
|
60
51
|
| Contract | Shape invariant | Runtime responsibility |
|
|
61
52
|
| --- | --- | --- |
|
|
62
|
-
| `
|
|
63
|
-
| `CapabilityPolicy` | Exact `allow`/`only`/`deny` selectors; omitted `only` is unrestricted, present empty `only` denies all, and `allow` pre-approves admitted proposals | Intersect service and workspace policies |
|
|
64
|
-
| `CapabilityProjection` | Durable `service`, client-mutable `workspace`, and normalized `effective` policies | Expose effective authority without storing session/loop policy copies |
|
|
65
|
-
| `ProposalPolicy` | `review`, `accept`, or `reject` (`PROPOSAL_POLICIES`) | Read the server's disposition knob at the proposal boundary |
|
|
53
|
+
| `ProposalPolicy` | `review`, `accept`, or `reject` (`PROPOSAL_POLICIES`) | Read the server or workspace approval disposition at the proposal boundary |
|
|
66
54
|
| `ProposalDisposition` | Review, or automatic accept/reject with optional outcome | Select once for the pending gate |
|
|
67
|
-
| `ProposalProjection` | Identity, review target, body/attrs, owner,
|
|
55
|
+
| `ProposalProjection` | Identity, review target, body/attrs, owner, ACP v2 subject, stale signal, disposition | One validated projection for live delivery and reconnect |
|
|
68
56
|
|
|
69
|
-
- **
|
|
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 (`kill` on `log:///...`, native dispositions `wait`/`note`, `done`, `fail`, and targetless `send`) creates no capability demand.
|
|
71
|
-
- **Proposals and session ownership**: `ProposalPolicy` (`review | accept | reject`) and `SessionOwner` (`address`, `clientTools`, `interactive`) govern stopped-world approval after capability admission succeeds.
|
|
57
|
+
- **Proposals and session ownership**: `ProposalPolicy` (`review | accept | reject`) and `SessionOwner` (`address`, `tools`, `interactive`) govern stopped-world approval and standing `allow_always` / `reject_always` permission decisions.
|
|
72
58
|
- **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).
|
|
73
59
|
|
|
74
60
|
### §provider-request-accounting Client interactions and provider request accounting
|
|
@@ -137,13 +123,13 @@ flowchart LR
|
|
|
137
123
|
| --- | --- | --- | --- |
|
|
138
124
|
| `plurnk` / `find` | required `path` / `paths` | optional `range`, `pattern`, `headers` | optional `note` normalized to preceding `note` |
|
|
139
125
|
| `plurnk` / `read` | required `path` / `paths` | optional `range`, `pattern`, `headers` | optional `note` normalized to preceding `note` |
|
|
140
|
-
| `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 |
|
|
126
|
+
| `plurnk` / `edit` | required `path` | `range` or `pattern` or `oldText`/`newText` (`old`/`new`, `find`/`replace`, `original`) or `edits` for existing target; `text` alone creates; optional `headers` | `text` (or tolerated `content`, `replacement`, `replace`, `newText`, `new`, `body`), or `edits` array |
|
|
141
127
|
| `plurnk` / `copy`, `move` | required `from` and `to` | optional `fromRange` / `toRange`, `fromHeaders` / `toHeaders` | none |
|
|
142
128
|
| `plurnk` / `sh`, `js`, `python3` | optional `script`, `cwd` | none | `text` (or tolerated `code` / `command` / `cmd` / `body` / `source` / `prompt`), optional `args` |
|
|
143
129
|
| `plurnk` / `<functionality>` | tool name (`env`, `mcp`, `members`, `personas`, `schedule`, `skills`, `question`) | none | JSON arguments object |
|
|
144
130
|
| `<server>` / `<tool>` | external MCP `<server>` and `<tool>` | optional `range` | JSON arguments object |
|
|
145
131
|
| `plurnk` / `bare` | none | none | required `text` (or tolerated `prompt` / `body` / `content` / `message`) |
|
|
146
|
-
| `plurnk` / `work`, `fork` | optional `target` (`session://name`) |
|
|
132
|
+
| `plurnk` / `work`, `fork` | optional `target` (`session://name`) | optional `persona`, `model`, `effort` | required `text` (or tolerated `prompt` / `body` / `content` / `message`) |
|
|
147
133
|
| `plurnk` / `kill` | required `path` / `paths` | optional `range`, `pattern`, `remote`, `headers` | optional `note` distillation on `log:///` |
|
|
148
134
|
| `plurnk` / `send` | optional `target` recipient (caller aliases `user`/`client`/`human`/`operator`/`caller` normalize to `null`) | optional `headers`, `attachments` | required `text` message body |
|
|
149
135
|
| `plurnk` / `done` | optional `target` (`message://`; caller aliases normalize to `null`) | optional `attachments` | `text` final deliverable (required in tool schema; parser tolerates empty to resolve silently) |
|
|
@@ -222,8 +208,8 @@ flowchart LR
|
|
|
222
208
|
|
|
223
209
|
| Projection / Helper | Contract |
|
|
224
210
|
| --- | --- |
|
|
225
|
-
| `ApplicationPort` | Transport-neutral interface in `@plurnk/plurnk-contracts/port` driving workspaces, sessions, loops (`runLoop` with causal `source`, `attachments`, `envelope`), operations, proposals, client interactions,
|
|
226
|
-
| `DaemonNotification` / `NotificationFilter` | Closed discriminated union over the
|
|
211
|
+
| `ApplicationPort` | Transport-neutral interface in `@plurnk/plurnk-contracts/port` driving workspaces, sessions, loops (`runLoop` with causal `source`, `attachments`, `envelope`), operations, proposals, client interactions, filtered discrete event subscriptions (`subscribeToEvents(handler, filter?)` and `replayNotifications({ lastEventId, filter? })` under `notificationEpoch`), and in-process sub-turn runtime streaming (`subscribeToRuntimeStream(handler)` over `APPLICATION_RUNTIME_STREAM_EVENTS`). |
|
|
212
|
+
| `DaemonNotification` / `NotificationFilter` | Closed discriminated union over the 16 discrete `DAEMON_NOTIFICATION_EVENTS` (`{ id, event, timestamp, workspaceId, sessionId, data }`, validated by `Validator.assertDaemonNotification` against `DaemonNotificationEnvelope.json`), constructed by `toDaemonNotification` and filtered at source by `matchesNotificationFilter(notification, { events?, workspaceId?, sessionId? })`. `isRuntimeTelemetryNotice` separates internal turn/lifecycle/derivation telemetry onto `runtime/telemetry`. |
|
|
227
213
|
| `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 }`. |
|
|
228
214
|
| `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. |
|
|
229
215
|
| `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). |
|
|
@@ -247,4 +233,4 @@ flowchart LR
|
|
|
247
233
|
| --- | --- |
|
|
248
234
|
| Working-form recovery & attempt | Every hard error (`severity: "error"`) populates `recovery` with the working `mcp({ server, tool, arguments })` form of the refused construct and `attempt` (`{ text, verb }`) with the refused call's source text; `operationOmitted` marks unexecuted calls. Each malformed call produces at most one hard error. |
|
|
249
235
|
| 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- or pipe-separated `/pattern/` lists (including `/branch1\|/branch2/` where each top-level alternation prefixes `/`) on `find` and `read` into alternation while refusing numeric/open sed ranges (`/a/,+N`, `/a/,-1`, `/a/,`) and mutating `/a/,/b/` ranges; escapes unescaped interior `/` inside closed `/pattern/flags` matchers on `find` and `read`; diagnoses trailing text after `/pattern/flags`; recovers unclosed `/pattern` at EOL; and on `edit`, normalizes unreadable single-line literal code patterns starting with `//`, `$`, `&`, or `/` (when an interior `/` is followed by non-flag literal text rather than `/pattern/flags`) into exact literal matchers. |
|
|
250
|
-
| Argument tolerances | Deterministically canonicalizes near-miss wire tool names (`mcp__<server>__<tool>`, `<server>.<tool>`, `<server>__<tool>`, or bare `plurnk` tool/builtin-executor names), `mcp` payloads with dotted `tool: "<server>.<tool>"` or omitted `server: "plurnk"`, nested tool calls routed through `plurnk.mcp` (`{ server\|name\|alias, tool\|function, arguments? }` without MCP server configuration keys), DSML
|
|
236
|
+
| Argument tolerances | Deterministically canonicalizes near-miss wire tool names (`mcp__<server>__<tool>`, `<server>.<tool>`, `<server>__<tool>`, or bare `plurnk` tool/builtin-executor names), `mcp` payloads with dotted `tool: "<server>.<tool>"` or omitted `server: "plurnk"`, nested tool calls routed through `plurnk.mcp` (`{ server\|name\|alias, tool\|function, arguments? }` without MCP server configuration keys), DSML `<|DSML|parameter name="...">` and XML `<parameter=...>` / `<tool_call><function=...>` / trailing-`>` invoke-boundary leaks inside `server` or `tool`, echoed `tool`/`function` or benign metadata keys (`tags`, `keep`, `kind`, `status`, `budget`, `maxLines`, `max_lines`, `context`) on the model tier, fallback `id` targets when canonical target keys are absent on model-tier `read`/`find`/`edit`/`kill`, `session`/`stream`/`process` target aliases on `kill`, `old`/`find`/`original` and `new`/`replace` literal replacement aliases on `edit`, `note` body fallback on `done`/`fail`, singular `line` range aliases, `wait` `stream` and `timeoutMs`/`timeout_ms`/`ms` options, pattern-shaped `range` strings when `pattern` is omitted or empty, `#<channel>`-shaped `range` strings (`/^#[A-Za-z][A-Za-z0-9_.-]*$/u`) when `channel` is omitted or empty on the model tier, and separate `channel: "#<name>" \| "<name>"` options on resource-targeting operations (folded onto fragmentless target paths as `path#channel`); lifts inline `<L,M>` ranges from `path<L,M>` strings with a warning; recovers bare `edit` anchors (`@abcde`), combined `42<@abcde>` ranges, quoted range strings (`"\"-1,1,-1,1\""`), `L<N>` / `L<N>-L<M>` and `#<N>,<M>` line markers, numeric ranges with a stray trailing `@` (`"1240,1242@"`), `@hash,hash` pairs missing the second `@` (`"@qAVg2,qAVg2"`), 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"`) while refusing ambiguous `line:col` ranges with explicit 4-coordinate `startLine,startCol,endLine,endCol` (`endCol` exclusive) recovery; and unwraps nested parameter wrappers (`params`, `parameters`, `arguments`, `args`, `input`, `options`, `properties`). |
|