@plurnk/plurnk-contracts 9.0.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/.env.defaults +1 -19
  2. package/README.md +5 -6
  3. package/SPEC.md +93 -44
  4. package/dist/schema/DaemonNotificationEnvelope.json +77 -30
  5. package/dist/schema/FunctionalityCandidate.json +4 -0
  6. package/dist/schema/FunctionalityDiscoverQuery.json +12 -0
  7. package/dist/schema/FunctionalityDiscoverResult.json +10 -0
  8. package/dist/schema/FunctionalityListQuery.json +33 -0
  9. package/dist/schema/FunctionalityListResult.json +16 -1
  10. package/dist/schema/ModelCatalogPage.json +9 -0
  11. package/dist/schema/PlurnkStatement.json +18 -2
  12. package/dist/schema/ProviderAccounting.json +3 -3
  13. package/dist/schema/ProviderCost.json +1 -1
  14. package/dist/schema/ProviderRequestAccounting.json +3 -3
  15. package/dist/schema/ProviderUsage.json +1 -1
  16. package/dist/src/ActorIdentity.d.ts +26 -0
  17. package/dist/src/ActorIdentity.d.ts.map +1 -0
  18. package/dist/src/ActorIdentity.js +179 -0
  19. package/dist/src/ActorIdentity.js.map +1 -0
  20. package/dist/src/Application.d.ts +38 -126
  21. package/dist/src/Application.d.ts.map +1 -1
  22. package/dist/src/Application.js +47 -220
  23. package/dist/src/Application.js.map +1 -1
  24. package/dist/src/ApplicationNotifications.d.ts +19 -6
  25. package/dist/src/ApplicationNotifications.d.ts.map +1 -1
  26. package/dist/src/ApplicationNotifications.js +6 -3
  27. package/dist/src/ApplicationNotifications.js.map +1 -1
  28. package/dist/src/ApplicationPort.d.ts +27 -6
  29. package/dist/src/ApplicationPort.d.ts.map +1 -1
  30. package/dist/src/ApplicationPort.js +1 -1
  31. package/dist/src/ApplicationPort.js.map +1 -1
  32. package/dist/src/ApplicationStream.d.ts +2 -2
  33. package/dist/src/ApplicationStream.d.ts.map +1 -1
  34. package/dist/src/ApplicationStream.js.map +1 -1
  35. package/dist/src/CollectionCommand.d.ts +33 -0
  36. package/dist/src/CollectionCommand.d.ts.map +1 -0
  37. package/dist/src/CollectionCommand.js +277 -0
  38. package/dist/src/CollectionCommand.js.map +1 -0
  39. package/dist/src/Functionality.d.ts +7 -2
  40. package/dist/src/Functionality.d.ts.map +1 -1
  41. package/dist/src/Functionality.js.map +1 -1
  42. package/dist/src/HttpOrigin.d.ts +79 -10
  43. package/dist/src/HttpOrigin.d.ts.map +1 -1
  44. package/dist/src/HttpOrigin.js +286 -44
  45. package/dist/src/HttpOrigin.js.map +1 -1
  46. package/dist/src/HttpPort.d.ts +35 -0
  47. package/dist/src/HttpPort.d.ts.map +1 -0
  48. package/dist/src/HttpPort.js +106 -0
  49. package/dist/src/HttpPort.js.map +1 -0
  50. package/dist/src/InteractiveCommands.d.ts +96 -0
  51. package/dist/src/InteractiveCommands.d.ts.map +1 -0
  52. package/dist/src/InteractiveCommands.js +409 -0
  53. package/dist/src/InteractiveCommands.js.map +1 -0
  54. package/dist/src/McpWireTool.d.ts +27 -0
  55. package/dist/src/McpWireTool.d.ts.map +1 -0
  56. package/dist/src/McpWireTool.js +30 -0
  57. package/dist/src/McpWireTool.js.map +1 -0
  58. package/dist/src/OAuthClient.d.ts +64 -0
  59. package/dist/src/OAuthClient.d.ts.map +1 -0
  60. package/dist/src/OAuthClient.js +226 -0
  61. package/dist/src/OAuthClient.js.map +1 -0
  62. package/dist/src/ScheduleCommand.d.ts +60 -0
  63. package/dist/src/ScheduleCommand.d.ts.map +1 -0
  64. package/dist/src/ScheduleCommand.js +677 -0
  65. package/dist/src/ScheduleCommand.js.map +1 -0
  66. package/dist/src/SessionProjection.d.ts +91 -0
  67. package/dist/src/SessionProjection.d.ts.map +1 -0
  68. package/dist/src/SessionProjection.js +223 -0
  69. package/dist/src/SessionProjection.js.map +1 -0
  70. package/dist/src/Validator.d.ts +2 -1
  71. package/dist/src/Validator.d.ts.map +1 -1
  72. package/dist/src/Validator.js +19 -1
  73. package/dist/src/Validator.js.map +1 -1
  74. package/dist/src/index.d.ts +10 -3
  75. package/dist/src/index.d.ts.map +1 -1
  76. package/dist/src/index.js +7 -1
  77. package/dist/src/index.js.map +1 -1
  78. package/dist/src/types.generated.d.ts +85 -21
  79. package/dist/src/types.generated.d.ts.map +1 -1
  80. package/dist/src/types.generated.js.map +1 -1
  81. package/package.json +3 -2
package/.env.defaults CHANGED
@@ -7,23 +7,5 @@ PLURNK_HOST=127.0.0.1
7
7
  # The daemon's TCP port, shared by all client interfaces.
8
8
  PLURNK_PORT=1066
9
9
  # The whole URL a client dials instead: a remote portal, or a daemon bound to an address no
10
- # client can dial (0.0.0.0). Unset = http://$PLURNK_HOST:$PLURNK_PORT/acp.
10
+ # client can dial (0.0.0.0). Unset = http://$PLURNK_HOST:$PLURNK_PORT/acp (or same-origin /acp in plurnk-web).
11
11
  # PLURNK_ACP_URL=
12
-
13
- # Whether the daemon authenticates ({§credential-authority}): 1 = every request to the client
14
- # interface and to the hosted agent presents a credential this daemon issued, and the daemon serves
15
- # the authorization server that issues them; 0 = no credential exists and every request is
16
- # anonymous, for a harness driving a daemon of its own. The posture is this value, never inferred
17
- # from what else is set.
18
- PLURNK_AUTH=1
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 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.
24
- # PLURNK_SECRET=
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.
29
- PLURNK_PASS=
package/README.md CHANGED
@@ -30,10 +30,9 @@ parsing, and canonical serialization. See SPEC {§contract-representations}.
30
30
 
31
31
  ## Parser
32
32
 
33
- The parser that implements this language is [`@plurnk/plurnk-parser`](https://github.com/plurnk/plurnk-service/tree/main/plurnk-parser):
34
- `PlurnkParser` and `parsePath` are its exports, and it depends on this package for
35
- the AST and wire types. A consumer that validates or presents the wire needs only
36
- this package.
33
+ [`@plurnk/plurnk-parser`](https://github.com/plurnk/plurnk-service/tree/main/plurnk-parser) exports
34
+ `PlurnkParser` and `parsePath` and depends on this package for the AST and wire types. A consumer that
35
+ validates or presents the wire needs only `@plurnk/plurnk-contracts`.
37
36
 
38
37
  ## Wire validation
39
38
 
@@ -65,8 +64,8 @@ npm run test:installation
65
64
  ```
66
65
 
67
66
  Generated schema-type and distribution artifacts are rebuilt by `npm run build`.
68
- Change the owning schema rather than editing generated output directly; the
69
- MCP expression parser lives in `@plurnk/plurnk-parser`.
67
+ Change the owning schema rather than editing generated output directly; `mcp`
68
+ tool-call lowering and statement parsing live in `@plurnk/plurnk-parser`.
70
69
 
71
70
  ## License
72
71
 
package/SPEC.md CHANGED
@@ -11,16 +11,18 @@
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` |
14
+ | Exterior actor parsing and attribution | `parseExteriorActor`, `extractActor`, `actorsMatch`, `isDefaultExteriorActor`, `ExteriorActor` |
14
15
  | Daemon module application port (package dependency-direction seam) | `ApplicationPort`, from `@plurnk/plurnk-contracts/port` |
15
16
  | Workspace MCP and Agent Skills definitions | `McpServerDefinition`, `McpOAuth`, `SkillDefinition` |
16
17
  | Session Functionality lifecycle projections | `FunctionalityProvenance`, `FunctionalityCandidate`, `FunctionalityDiscoverQuery`, `FunctionalityDiscoverResult`, `FunctionalityDefinitionState`, `FunctionalityListResult`, `FunctionalityMutationResult` |
18
+ | Interactive client contracts ({§client-interactive-commands}) | `INTERACTIVE_COMMANDS`, `FAMILY_SUBCOMMANDS_BY_FAMILY`, `SCHEDULE_ADD_FLAGS`, `SCHEDULE_USAGE`, `completeInteractiveCommand`, `longestCommonPrefix`, `classifyComposerInput`, `buildPromptBlocks`, `tokenizeSlashArgs`, `parseFamilyCommand`, `formatFamilyRows`, `formatFamilyResult`, `formatScheduleInspect`, `formatScheduleStepReceipts`, `extractScheduleProblem`, `expandLearnCommand`, `SingleFlightRefresh`, `discoverProtectedResourceMetadata`, `discoverAuthorizationServerMetadata`, `generatePkcePair`, `resolveTokenExpiresAt`, `parseSessionConfigOptions`, `rankModelChoices`, `projectSessionStatus`, `formatProblemSummary`, `summarizeOperation` |
17
19
  | ACP discovery manifest | `AcpDiscovery` |
18
20
  | JSON Schemas and JSON rendering | `@plurnk/plurnk-contracts/schema/*.json`, `renderJsonResult`, `formatJsonDocument` |
19
21
  | Session operating card | `plurnk.md` in the package |
20
22
 
21
23
  ```mermaid
22
24
  flowchart LR
23
- wire["Wire mcp tool calls<br/>{ server, tool, arguments, aside? }"]
25
+ wire["Wire mcp tool calls<br/>{ server, tool, aside, arguments }"]
24
26
  stmtSrc["Protocol & ops:// statements<br/>&lt;server&gt;.&lt;tool&gt;({ ... })"]
25
27
  parser["Lowering & serialization<br/>McpExpressions.ts · ExpressionSerializer.ts"]
26
28
  ast["Typed, serializable AST<br/>PlurnkStatement"]
@@ -37,7 +39,7 @@ flowchart LR
37
39
  | --- | --- | --- |
38
40
  | Stable current law | `SPEC.md` | Owns invariants and boundaries; forge issues retain history |
39
41
  | Session operating card | `plurnk.md` | Minimal operating guidance injected into `definition` |
40
- | Lowering & serialization | `McpExpressions.ts`, `CallExpressionParser.ts`, `OptionCoercion.ts`, `StatementLowering.ts`, `ExpressionSerializer.ts`, `MatcherSyntax.ts`, `ScopeSyntax.ts`, `TargetSyntax.ts` | Lowers wire `mcp` tool calls (`lowerMcpCall`), inbound `/mcp` tool calls (`lowerToolCall`), and client/internal MCP statement blocks (`parseStatements`) into `PlurnkStatement` ASTs, projects statements to `McpToolCallPayload` (`toMcpCall`), and renders canonical MCP expressions for `ops://` (`stringify`) |
42
+ | Lowering & serialization | `@plurnk/plurnk-parser` ({§parser-boundary}, {§parser-lowering}) | Lowers wire `mcp` tool calls (`lowerMcpCall`), inbound `/mcp` tool calls (`lowerToolCall`), and client/internal MCP statement blocks (`parseStatements`) into `PlurnkStatement` ASTs, projects statements to `McpToolCallPayload` (`toMcpCall`), and renders canonical MCP expressions for `ops://` (`stringify`) |
41
43
  | Typed admission | `PlurnkStatement` AST | Produces JSON-serializable unions and validates deterministic path/scope/matcher syntax |
42
44
  | Shared wire data | `schema/*.json` | Defines runtime-neutral data shapes projected into generated TypeScript |
43
45
  | Stateful behavior | consuming runtime | Resolves addresses, permissions, selection arithmetic, effects, and lifecycle |
@@ -81,39 +83,20 @@ flowchart LR
81
83
  "name": "mcp",
82
84
  "parameters": {
83
85
  "type": "object",
84
- "required": ["server", "tool", "arguments"],
86
+ "required": ["server", "tool", "aside", "arguments"],
85
87
  "properties": {
86
88
  "server": { "type": "string" },
87
89
  "tool": { "type": "string" },
88
- "arguments": { "type": "object", "additionalProperties": true },
89
- "aside": { "type": "string", "description": "Optional terse intent note." }
90
+ "aside": { "type": "string", "description": "Terse intent note." },
91
+ "arguments": { "type": "object", "additionalProperties": true }
90
92
  },
91
93
  "additionalProperties": false
92
94
  }
93
95
  }
94
96
  ```
95
97
 
96
- - **Universal `mcp` wire tool**: Every emission-capable model turn exposes a single native wire tool named `mcp` taking `{ server, tool, arguments, aside? }`. `plurnk` is the built-in MCP server (`read`, `find`, `edit`, `copy`, `move`, `kill`, `note`, `work`, `fork`, `bare`, `send`, `done`, `fail`, `wait`, runtime tools `sh`, `js`, `python3`, and Functionality tools `env`, `mcp`, `members`, `personas`, `schedule`, `skills`, `question`). External MCP servers are peer `server` names (`server: "<mcp>"`, `tool: "<tool>"`).
97
- - **Statement protocol and `ops://` representation**: Client-authored `/script` blocks and `ops://` turn-source archives use `<server>.<tool>({ ... }) // aside` statement syntax (`gitea["issue-read"]({ ... })` for non-identifier tool names), parsed by `PlurnkParser.parseStatements` and rendered by `PlurnkParser.stringify`.
98
-
99
- ### §expression-boundaries Wire tool lowering, standalone runtime routing, and replay projection
100
-
101
- | Rule | Contract |
102
- | --- | --- |
103
- | `lowerMcpCall` envelope lowering | `PlurnkParser.lowerMcpCall({ name, arguments }, options)` requires `name === "mcp"`, decodes object or JSON-stringified `arguments`, resolves `server` and `tool` (tolerating `function` for `tool` and `args`/`params` or hoisted sibling keys for `arguments`), and dispatches to `lowerToolCall` on the `"model"` tier. |
104
- | Standalone runtime default tool | Passing `server: "sh" \| "js" \| "python3"` (or a built-in alias `bash`/`shell` $\to$ `sh`, `ts`/`javascript`/`typescript`/`node` $\to$ `js`, `python`/`py` $\to$ `python3` when not shadowed by an explicit executor) routes any non-path `tool` name directly to that standalone runtime (`text` / `command` / `code`), while path-shaped `tool` names (`*.py`, `dir/script.sh`) bind `script`. |
105
- | Case-insensitive method recovery | Uppercase or mixed-case core/runtime tool names recover silently to their lowercase canonical tool name. |
106
- | Structured replay & `ops://` serialization | `PlurnkParser.toMcpCall(statement)` projects any `PlurnkStatement` to `{ server, tool, arguments, aside? }` for structured `assistant` `toolCalls` replay; `PlurnkParser.stringify(statements)` renders JSON-escaped canonical `<server>.<tool>({ ... }) // aside` lines for `ops://` storage. |
107
-
108
- ### §slot-order Argument shapes, target groups, and endpoint options
109
-
110
- | Construct | Contract |
111
- | --- | --- |
112
- | Object and positional argument forms | Core operations accept their canonical `{ ... }` options object (`{ path, range?, pattern?, text?, ... }`) as well as positional shorthands on `parseStatements`. |
113
- | Target groups and multi-target lists | `read`, `find`, and `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. `send`, `done`, and `fail` tolerate `target`/`targets`/`to` as a non-empty array of URI strings or comma/pipe-separated URI list (keeping message-reply URI lists on one statement so the body renders and weighs once, fanning out non-message `send` recipient lists per target, and refusing empty arrays or non-string targets at parse time rather than coercing to `null`; `work` and `fork` likewise refuse non-string targets). |
114
- | `note` annotation on retrievals | Providing `note` on `read` or `find` emits a preceding `note` statement before the retrieval(s). |
115
- | Endpoint and message options | `headers` (`Record<string, string>`) passes HTTP(S) request headers on `read`, `find`, `edit`, `send`, `kill`, and `copy`/`move` (`fromHeaders`/`toHeaders`); `remote` (`boolean`) confirms remote HTTP `DELETE` on `kill`; `attachments` (`string[]`) attaches resources to `send`, `done`, and `fail`. Unknown option keys (outside benign metadata and model-tier envelope/commentary echoes) are refused with a parser diagnostic. |
116
- | Operation aside | `aside` on `mcp` tool calls (or trailing `// aside` on `parseStatements`, plus `description`/`explanation`/`comment`/`reason`/`what`/`why`/`intent` options on the model tier when `aside` is absent) is captured into `aside` (`string` or `null`). |
98
+ - **Universal `mcp` wire tool**: Every emission-capable model turn exposes a single native wire tool named `mcp` taking `{ server, tool, aside, arguments }`, placing the terse intent `aside` ahead of `arguments` so models commit intent before payload while `lowerMcpCall` tolerates omitted/empty `aside` on the model tier and replays omitted asides as `aside: ""` ({§parse-recovery}). `plurnk` is the built-in MCP server (`read`, `find`, `edit`, `copy`, `move`, `kill`, `note`, `work`, `fork`, `bare`, `send`, `done`, `fail`, `wait`, runtime tools `sh`, `js`, `python3`, and Functionality tools `env`, `mcp`, `members`, `personas`, `schedule`, `skills`, `question`); external MCP servers are peer `server` names (`server: "<mcp>"`, `tool: "<tool>"`). Keeping `tools[]` fixed to `MCP_WIRE_TOOL` (`arguments.additionalProperties: true`) holds the request tool prefix constant across mid-session capability changes while deferring per-tool schemas to `mcp:///` and validation/coercion to `lowerMcpCall` ({§parse-recovery}).
99
+ - **Statement protocol and `ops://` representation**: Client-authored `: <statements>` blocks and `ops://` turn-source archives use `<server>.<tool>({ ... }) // aside` statement syntax (`gitea["issue-read"]({ ... })` for non-identifier tool names), parsed by `PlurnkParser.parseStatements` and rendered by `PlurnkParser.stringify` ({§expression-boundaries}, {§slot-order}).
117
100
 
118
101
  ---
119
102
 
@@ -125,13 +108,13 @@ flowchart LR
125
108
  | `plurnk` / `read` | required `path` / `paths` | optional `range`, `pattern`, `headers` | optional `note` normalized to preceding `note` |
126
109
  | `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 |
127
110
  | `plurnk` / `copy`, `move` | required `from` and `to` | optional `fromRange` / `toRange`, `fromHeaders` / `toHeaders` | none |
128
- | `plurnk` / `sh`, `js`, `python3` | optional `script`, `cwd` | none | `text` (or tolerated `code` / `command` / `cmd` / `body` / `source` / `prompt`), optional `args` |
129
- | `plurnk` / `<functionality>` | tool name (`env`, `mcp`, `members`, `personas`, `schedule`, `skills`, `question`) | none | JSON arguments object |
111
+ | `plurnk` / `sh`, `js`, `python3` | optional `script`, `cwd` | optional `env` | `text` (or tolerated `code` / `command` / `cmd` / `body` / `source` / `prompt`), optional `args` |
112
+ | `plurnk` / `<functionality>` | tool name (`env`, `mcp`, `members`, `personas`, `schedule`, `skills`, `question`, or module-registered family when `plurnk` is in `executors`) | none | JSON arguments object |
130
113
  | `<server>` / `<tool>` | external MCP `<server>` and `<tool>` | optional `range` | JSON arguments object |
131
114
  | `plurnk` / `bare` | none | none | required `text` (or tolerated `prompt` / `body` / `content` / `message`) |
132
115
  | `plurnk` / `work`, `fork` | optional `target` (`session://name`) | optional `persona`, `model`, `effort` | required `text` (or tolerated `prompt` / `body` / `content` / `message`) |
133
- | `plurnk` / `kill` | required `path` / `paths` | optional `range`, `pattern`, `remote`, `headers` | optional `note` distillation on `log:///` |
134
- | `plurnk` / `send` | optional `target` recipient (caller aliases `user`/`client`/`human`/`operator`/`caller` normalize to `null`) | optional `headers`, `attachments` | required `text` message body |
116
+ | `plurnk` / `kill` | required `path` / `paths` | optional `range`, `pattern`, `remote`, `headers` | none |
117
+ | `plurnk` / `send` | optional `target` recipient (caller aliases `user`/`client`/`human`/`operator`/`caller` normalize to `null`) | optional `headers`, `attachments`, client-only `actor` (refused on `model` origin and non-`session://` targets) | required `text` message body |
135
118
  | `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) |
136
119
  | `plurnk` / `fail` | optional `target` (`message://`; caller aliases normalize to `null`) | optional `attachments` | `text` final failure explanation (required in tool schema; parser tolerates empty to cancel silently) |
137
120
  | `plurnk` / `note` | none | none | `text` conclusions, findings, and plans |
@@ -158,12 +141,12 @@ flowchart LR
158
141
 
159
142
  | Prefix | Dialect | Validation & tolerance |
160
143
  | --- | --- | --- |
161
- | `//` | `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, and vacuous `/text()` after `@attr` steps) |
162
- | `/` or `^` | `regex` | ECMAScript `RegExp` (escaped pipe is literal, unescaped pipe is alternation); tolerates PCRE `\A`/`\z`/`\Z` anchors, trailing `-flags`, `/~.../` mixed prefix, unbalanced unescaped `(`, `)`, or `[`, and glob-shaped `/*text*/` |
144
+ | `//` | `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, and vacuous `/text()` after `@attr` steps; on `find` and `read`, invalid non-XPath `//<ident>...` patterns with regex operators recover as `regex`) |
145
+ | `/` or `^` | `regex` | ECMAScript `RegExp` (escaped pipe is literal, unescaped pipe is alternation); tolerates PCRE `\A`/`\z`/`\Z` anchors, Python `(?P<name>...)` / `(?P=name)` named groups and backreferences, empty code brackets `[]`, trailing `-flags`, `/~.../` mixed prefix, unbalanced unescaped `(`, `)`, or `[`, and glob-shaped `/*text*/` |
163
146
  | `$` | `jsonpath` | Validated with RFC 9535 `json-p3` |
164
- | `~` | `fulltext` | Single-line FTS5 query string |
165
- | `&` | `graph` | `&symbol`, `&<symbol`, or `&>symbol` relation query |
166
- | none | `glob` | Fallback shell glob or single/multiline literal substring |
147
+ | `~` | `fulltext` | Single-line FTS5 query string (`~^...` and `~/...` regex-prefixed queries recover as `regex`) |
148
+ | `&` | `graph` | `&symbol`, `&<symbol`, or `&>symbol` relation query (strips leading declaration keywords such as `&def symbol` or `&class Symbol`) |
149
+ | none | `glob` | Fallback shell glob or single/multiline literal substring (unslashed `a\|b` pipe alternations excluding extglobs and `\|\|` recover as `regex` on `find` and `read`) |
167
150
 
168
151
  - **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.
169
152
  - **Statement recovery and argument tolerances**: Statement errors fail only the offending call while admitting valid sibling calls; an inline `<L,M>` range written inside `path<L,M>` is lifted on the model tier.
@@ -208,19 +191,27 @@ flowchart LR
208
191
 
209
192
  | Projection / Helper | Contract |
210
193
  | --- | --- |
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`. |
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 }`. |
194
+ | `ApplicationPort` | Transport-neutral interface in `@plurnk/plurnk-contracts/port` exposing optional `serviceVersion`, 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`). |
195
+ | `DaemonNotification` / `NotificationFilter` | Closed discriminated union over the 18 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`. |
196
+ | `admitBearerRequest` / `admitBrowserOrigin` | Runtime-neutral async OIDC/OAuth 2.1 Bearer (`Authorization: Bearer`, `Sec-WebSocket-Protocol: bearer.<token>`, or optional `?access_token=`) and browser same-origin / loopback `Host` admission helpers over `CredentialAuthority`, returning `{ ok: true, subject }` or `{ ok: false, problem, challenge }`. |
214
197
  | `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. |
215
198
  | `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). |
216
199
  | `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`. |
217
200
  | `ApplicationSessionOverview` | Projects non-archived model-origin sessions (`{ workspaceId, id, name, parentSessionId, kind, lifecycle, gates, reply, title }`) ordered by most recently finished reply row first, then newest unreplied sessions, always including all gated sessions before applying `limit` and reporting `omitted`. |
218
201
 
202
+ ### §http-admission HTTP origin, CORS, scoped routing, and transport Problem helpers
203
+
204
+ | Helper | Owner | Contract |
205
+ | --- | --- | --- |
206
+ | `isLoopbackHost`, `requestOrigin`, `resolvePublicOrigin` | `@plurnk/plurnk-contracts` | Recognizes IPv4/IPv6 and IPv4-mapped loopback hosts; resolves the daemon's public HTTP(S) origin honoring explicit `CredentialAuthority` issuers, loopback reverse-proxy `X-Forwarded-Proto` / `X-Forwarded-Host`, or request `Host` / listener fallback. |
207
+ | `buildCorsHeaders`, `parseScopedRoute` | `@plurnk/plurnk-contracts` | Emits lowercase CORS response headers only when `allowOrigin` is non-empty; parses `/<mount>[/<workspace>[/<session>]]` pathnames with URI decoding and `404` / `400` RFC 9457 Problem refusals. |
208
+ | `writeHttpProblem`, `writeUpgradeProblem`, `attachSseKeepAlive`, `InFlightTracker` | `@plurnk/plurnk-contracts/port` | Writes `application/problem+json` HTTP and HTTP/1.1 WebSocket-upgrade refusals, manages `.unref()`ed SSE `: heartbeat\n\n` intervals with socket idle timeout disabled, and drains in-flight route promises on `close()`. |
209
+
219
210
  ---
220
211
 
221
- ## §parse-recovery 8. Argument tolerances and error shapes
212
+ ## §parse-recovery 8. Parse error contract and coordinate systems
222
213
 
223
- `PlurnkParseError` is a JSON-serializable `Error` carrying `{ line, column, source: "lexer" | "parser" | "visitor", severity: "error" | "warning", recovery?, attempt?, operationOmitted }`:
214
+ `PlurnkParseError` is a JSON-serializable `Error` carrying `{ line, column, source: "lexer" | "parser" | "visitor", severity: "error" | "warning", recovery?, attempt?, operationOmitted }` (lowered and populated by `@plurnk/plurnk-parser`, {§parser-lowering}):
224
215
 
225
216
  | Representation | Line | Column | Absence or extent |
226
217
  | --- | --- | --- | --- |
@@ -229,8 +220,66 @@ flowchart LR
229
220
  | Contracts `TextRegion` | 1-based | 1-based Unicode code points | Start included, end excluded; equality is zero-width |
230
221
  | SARIF 2.1.0 region | 1-based | 1-based (`columnKind: "unicodeCodePoints"`) | End excluded; parser point adapters add 1 to `column` |
231
222
 
232
- | Mechanism | Contract |
223
+ - **Working-form recovery & loss independence**: Every hard error (`severity: "error"`) carries `recovery` with the working `mcp({ server, tool, aside, arguments })` form of the refused construct and `attempt` (`{ text, verb }`) with the refused call's source text; `operationOmitted` records whether an attempted operation was omitted independently of `severity` ({§diagnostic-observation}).
224
+
225
+ ---
226
+
227
+ ## §client-interactive-commands 9. Shared interactive client contracts
228
+
229
+ All first-party interactive surfaces (CLI, Term, and Web) share one DOM-safe, runtime-neutral command, completion, OAuth PKCE, config-option, status, and diagnostic projection layer in `@plurnk/plurnk-contracts` ({§whitespace-contract}):
230
+
231
+ | Export | Surface contract |
232
+ | --- | --- |
233
+ | `INTERACTIVE_COMMANDS`, `FAMILY_SUBCOMMANDS_BY_FAMILY` | Authoritative slash-command inventory (`clientOnly?: "term" \| "web"` isolates local terminal/editor commands such as `/quit`, `/editor`, `/import`, `/script`, `/login`; `/logout` is available on both `"term"` and `"web"`) and per-family subcommands (`members` omits `replace`; `env` on `"web"` omits local dotenv `import`). |
234
+ | `completeInteractiveCommand`, `longestCommonPrefix` | Deterministic multi-token prefix completion over commands, advertised MCP prompts, selector-scoped `/model <selector> <effort>`, `/child` (`inherit` first), `/mode` (`PROPOSAL_POLICIES`), folder-aware `/learn --scope`, family subcommands/aliases, gates, loops, sessions, workspaces, inline `$<skill>`, and `plurnk.<op>`; `longestCommonPrefix` computes shared prefixes on Unicode code-point boundaries. |
235
+
236
+ ### §client-composer-sigils Composer sigils, inline skills, and learn expansion
237
+
238
+ | Sigil / Input | `classifyComposerInput` / helper contract |
239
+ | --- | --- |
240
+ | Blank | `{ kind: "empty" }` |
241
+ | `?` / `? <text>` | `{ kind: "help" }` on bare `?`; `{ kind: "review", text }` when followed by text |
242
+ | `...` / `... <text>` | `{ kind: "continue", text }` |
243
+ | `:` / `: <stmt>` / `[await ]plurnk.<op>(` | `{ kind: "statement-empty" }` on bare `:`; `{ kind: "statement", text }` for `_plurnk/action` `op.exec` |
244
+ | `!` / `! <cmd>` | `{ kind: "shell-empty" }` on bare `!`; `{ kind: "shell", command }` |
245
+ | `/<name>[ <args>]` | `{ kind: "slash", name, argsText }` |
246
+ | Ordinary text | `{ kind: "prompt", text }`; `buildPromptBlocks(text, availableSkills)` splits enabled `$<skill>` references into interleaved `{ type: "text", text }` and `{ type: "skill", name }` ACP v2 blocks while keeping unknown `$tokens` as text; `expandLearnCommand` resolves `/learn [--scope project\|plurnk] [instructions]` (`plurnk` default when `projectRoot === null`, refusing `--scope project` without a folder). |
247
+
248
+ ### §client-family-commands Slash argument tokenization and family command translation
249
+
250
+ - **Quote-preserving tokenization**: `tokenizeSlashArgs` preserves single-quoted literals, double-quoted strings with `\"`, `\\`, `\$`, `` \` `` escapes, and backslash-escaped whitespace while refusing unclosed quotes with a `400 https://problems.plurnk.xyz/client/usage` `ProblemDetails`.
251
+ - **Canonical family translation and formatting**: `parseFamilyCommand`, `formatFamilyRows`, and `formatFamilyResult` translate `mcp`, `skills`, `personas`, `members`, `env` (`--scope session\|workspace`, `set`/`unset`), and `schedule` slash invocations to `_plurnk/action` calls and render identical tabular, pagination, and mutation summaries across CLI, Term, and Web.
252
+
253
+ ### §client-collection-browsing Bounded collection filtering, pagination, and live candidate preview
254
+
255
+ - **Unified list contract (`FunctionalityListQuery` / `FunctionalityListResult`)**: Every `<scope>.<family>.list` action accepts `{ query?, state?, origin?, offset?, limit? }` (`limit` 1..100; omitting `limit` returns all matching definitions from `offset` onward). Responses carry `{ family, definitions, offset, total, nextOffset? }` with the same deterministic bounds invariant as `ModelCatalogPage` (`offset + definitions.length <= total`; `nextOffset` is present iff `offset + definitions.length < total`).
256
+ - **Unified discovery contract (`FunctionalityDiscoverQuery` / `FunctionalityDiscoverResult`)**: `discover` accepts optional `cursor` (opaque continuation token, 1..512 chars) and `limit` (1..100) alongside each family's declared filter/source inputs (`FunctionalityDiscovery.required` names inputs that stay mandatory alongside optional filters, e.g. `skills` requiring `source` with optional `query`; `mcp` allows empty-query registry browsing). Responses carry `{ family, candidates, total?, nextCursor? }`, and each `FunctionalityCandidate` may carry structured `detail` (e.g. `members` glob preview match counts and bounded sample paths) for inline live previews.
257
+ - **Three-face client parity**: `parseFamilyCommand` parses `[query...]`, `--query`, `--state`, `--origin`, `--offset`, and `--limit` on `list` and `--source`, `--query`, `--rule`, `--cursor`, and `--limit` on `discover`; `formatFamilyRows` and `formatFamilyResult` append concise `Showing X–Y of Z (next: --offset N)` / `Showing N[ of T] (next: --cursor C)` footers whenever a page is sliced; interactive slash completion exposes list, discover, and `/models` options uniformly across CLI, Term, and Web.
258
+
259
+ ### §client-schedule-command Schedule slash grammar, inspect, receipts, and reopen recovery
260
+
261
+ - **Unified prompt & macro grammar**: `parseScheduleFamilyArgs` (`SCHEDULE_USAGE`, `SCHEDULE_ADD_FLAGS`) parses `list`, `show`/`inspect`, `discover`, `add`/`replace` (`--manual` \| `--once` \| `--rule <r>`, prompt `--target`/`--prompt`/`--persona`/`--catchup` or macro `--step <server>.<tool> ['<json>'] [--aside <label>]` / `--run '<json>'`), `run`, `done`, `reopen`, `enable`, `disable`, and `remove`.
262
+ - **Inspect, receipts, and `409 already-done` recovery**: `formatScheduleInspect` and `formatScheduleStepReceipts` render single-alias definitions and per-step macro `results[]`; `extractScheduleProblem` unwraps RFC 9457 `ProblemDetails` from client or JSON-RPC errors and supplies `recovery: "/schedule reopen <alias>"` on `409 already-done` conflicts when absent.
263
+
264
+ ### §client-oauth-pkce OAuth 2.1 PKCE discovery, JWT expiry, and single-flight refresh
265
+
266
+ | Helper | Contract |
233
267
  | --- | --- |
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. |
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. |
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`). |
268
+ | `isAllowedOAuthUrl`, `parseWwwAuthenticateResourceMetadata` | Admits only credential-free `https:` URLs and loopback `http:` URLs (`127.0.0.1`, `localhost`, `::1`, {§http-admission}); extracts validated `resource_metadata` URLs from `WWW-Authenticate: Bearer`. |
269
+ | `discoverProtectedResourceMetadata`, `buildAuthorizationServerMetadataUrls`, `discoverAuthorizationServerMetadata` | Fetches RFC 9728 Protected Resource Metadata and discovers path-aware RFC 8414 / OIDC Authorization Server Metadata, enforcing exact issuer equality and PKCE `S256` support. |
270
+ | `generatePkcePair`, `parseJwtExpiresAt`, `resolveTokenExpiresAt`, `SingleFlightRefresh` | Generates Web Crypto `S256` PKCE verifiers/challenges; preserves short-lived `expires_in` (`<= 10s`) and JWT `exp` timestamps faithfully without fabricating TTLs for opaque tokens; deduplicates concurrent 401 token-refresh calls per origin key. |
271
+
272
+ ### §client-config-options Session config option flattening, model ranking, and per-model effort
273
+
274
+ - **Option projection**: `flattenConfigSelectOptions` flattens ungrouped `SessionConfigSelectOption` entries and grouped ACP v2 `SessionConfigSelectGroup` (`{ groupId, name, options }`) entries into one ordered list; `parseSessionConfigOptions` extracts `model`, `child`, `thought_level` (`thoughtLevel`), `mode`, `persona`, and `<family>:<alias>` `familyToggles`.
275
+ - **Deterministic 4-tier model ranking**: `rankModelChoices` orders matches by exact alias (`0`), prefix alias (`1`), exact `provider/model` (`2`), prefix `provider/model` (`3`), and selector/label substring (`4`), breaking ties lexicographically (`aliases` precede `catalog` entries when query is empty).
276
+
277
+ ### §client-session-status Session clock, turn phase, and causal actor attribution
278
+
279
+ - **Daemon-anchored status & clock**: `projectSessionStatus` derives `phase` (`requires_action` > `parked` > `queued` > `awaiting_model` > `running` > `idle`), `elapsedMs` from daemon `claimedAt`/`terminatedAt` timestamps, and `waitRemainingMs` from `waitUntil` without client-local wall-clock fabrication.
280
+ - **Causal actor attribution**: `extractActor` extracts non-default speaker or trigger names uniformly across `acp://<actor>`, `mcp://<actor>`, `session://<worker>`, `message://<session>/<actor>_<seq>`, and `schedule:///[rules/]<alias>` (omitting default unnamed exterior principals and `_plurnk`).
281
+
282
+ ### §client-diagnostics Problem summary preservation and operation glyphs
283
+
284
+ - **Lossless Problem formatting**: `formatProblemSummary` renders RFC 9457 `title`, `detail` (avoiding duplicated prefix when `detail` already starts with `title`), and `Recovery: <recovery>` without discarding `detail` or `recovery` when `title` is present ({§diagnostic-observation}).
285
+ - **Canonical operation headlines**: `summarizeOperation` maps every core verb and executor tag to one glyph, extracts primary target (`target`, `attrs.destination`, or `attrs.pathname`), flags `log:///` `kill` rows as `curated: true` ({§tokenomics}), and formats `<glyph> <verb>[ <target>][ — <aside>]`.
@@ -121,6 +121,32 @@
121
121
  "data": { "$ref": "#/$defs/SessionPolicy" }
122
122
  }
123
123
  },
124
+ {
125
+ "type": "object",
126
+ "additionalProperties": false,
127
+ "required": ["id", "event", "timestamp", "workspaceId", "sessionId", "data"],
128
+ "properties": {
129
+ "id": { "type": "integer", "minimum": 1 },
130
+ "event": { "const": "loop/started" },
131
+ "timestamp": { "type": "number" },
132
+ "workspaceId": { "type": ["integer", "null"], "minimum": 1 },
133
+ "sessionId": { "type": ["integer", "null"], "minimum": 1 },
134
+ "data": { "$ref": "#/$defs/LoopStarted" }
135
+ }
136
+ },
137
+ {
138
+ "type": "object",
139
+ "additionalProperties": false,
140
+ "required": ["id", "event", "timestamp", "workspaceId", "sessionId", "data"],
141
+ "properties": {
142
+ "id": { "type": "integer", "minimum": 1 },
143
+ "event": { "const": "loop/parked" },
144
+ "timestamp": { "type": "number" },
145
+ "workspaceId": { "type": ["integer", "null"], "minimum": 1 },
146
+ "sessionId": { "type": ["integer", "null"], "minimum": 1 },
147
+ "data": { "$ref": "#/$defs/LoopParked" }
148
+ }
149
+ },
124
150
  {
125
151
  "type": "object",
126
152
  "additionalProperties": false,
@@ -237,10 +263,10 @@
237
263
  "WorkspaceArchived": {
238
264
  "type": "object",
239
265
  "additionalProperties": false,
240
- "required": ["id", "archived_at"],
266
+ "required": ["id", "archivedAt"],
241
267
  "properties": {
242
268
  "id": { "type": "integer", "minimum": 1 },
243
- "archived_at": { "type": ["string", "null"] }
269
+ "archivedAt": { "type": ["string", "null"] }
244
270
  }
245
271
  },
246
272
  "FunctionalityChanged": {
@@ -285,10 +311,10 @@
285
311
  "SessionArchived": {
286
312
  "type": "object",
287
313
  "additionalProperties": false,
288
- "required": ["id", "archived_at", "sessionIds"],
314
+ "required": ["id", "archivedAt", "sessionIds"],
289
315
  "properties": {
290
316
  "id": { "type": "integer", "minimum": 1 },
291
- "archived_at": { "type": ["string", "null"] },
317
+ "archivedAt": { "type": ["string", "null"] },
292
318
  "sessionIds": {
293
319
  "type": "array",
294
320
  "items": { "type": "integer", "minimum": 1 }
@@ -319,7 +345,7 @@
319
345
  "SessionPolicy": {
320
346
  "type": "object",
321
347
  "additionalProperties": false,
322
- "required": ["sessionId", "model", "spawnModel"],
348
+ "required": ["sessionId", "model", "childModel"],
323
349
  "properties": {
324
350
  "sessionId": { "type": "integer", "minimum": 1 },
325
351
  "model": {
@@ -328,7 +354,7 @@
328
354
  { "type": "null" }
329
355
  ]
330
356
  },
331
- "spawnModel": {
357
+ "childModel": {
332
358
  "oneOf": [
333
359
  { "$ref": "https://schemas.plurnk.xyz/v0/ModelRoute.json" },
334
360
  { "type": "null" }
@@ -337,6 +363,27 @@
337
363
  "persona": { "type": ["string", "null"], "minLength": 1 }
338
364
  }
339
365
  },
366
+ "LoopStarted": {
367
+ "type": "object",
368
+ "additionalProperties": false,
369
+ "required": ["sessionId", "loopId", "loopSeq"],
370
+ "properties": {
371
+ "sessionId": { "type": "integer", "minimum": 1 },
372
+ "loopId": { "type": "integer", "minimum": 1 },
373
+ "loopSeq": { "type": "integer", "minimum": 1 }
374
+ }
375
+ },
376
+ "LoopParked": {
377
+ "type": "object",
378
+ "additionalProperties": false,
379
+ "required": ["sessionId", "loopId", "loopSeq", "status"],
380
+ "properties": {
381
+ "sessionId": { "type": "integer", "minimum": 1 },
382
+ "loopId": { "type": "integer", "minimum": 1 },
383
+ "loopSeq": { "type": "integer", "minimum": 1 },
384
+ "status": { "const": 202 }
385
+ }
386
+ },
340
387
  "LoopGateSettled": {
341
388
  "oneOf": [
342
389
  {
@@ -407,7 +454,7 @@
407
454
  "meta"
408
455
  ],
409
456
  "properties": {
410
- "accounting": { "$ref": "https://schemas.plurnk.xyz/ProviderAccounting.json" },
457
+ "accounting": { "$ref": "https://schemas.plurnk.xyz/v0/ProviderAccounting.json" },
411
458
  "curationWeight": { "type": ["number", "null"] },
412
459
  "curationBudget": { "type": ["number", "null"] },
413
460
  "contextTokens": { "type": ["number", "null"] },
@@ -430,12 +477,12 @@
430
477
  "additionalProperties": false,
431
478
  "required": [
432
479
  "id",
433
- "session_id",
434
- "session_name",
435
- "loop_id",
436
- "loop_seq",
437
- "turn_id",
438
- "turn_seq",
480
+ "sessionId",
481
+ "sessionName",
482
+ "loopId",
483
+ "loopSeq",
484
+ "turnId",
485
+ "turnSeq",
439
486
  "sequence",
440
487
  "at",
441
488
  "origin",
@@ -452,22 +499,22 @@
452
499
  "signal",
453
500
  "lineMarker",
454
501
  "tx",
455
- "mimetype_tx",
502
+ "mimetypeTx",
456
503
  "rx",
457
- "mimetype_rx",
458
- "status_rx",
504
+ "mimetypeRx",
505
+ "statusRx",
459
506
  "weight",
460
507
  "attrs",
461
508
  "state"
462
509
  ],
463
510
  "properties": {
464
511
  "id": { "type": "integer", "minimum": 1 },
465
- "session_id": { "type": "integer", "minimum": 1 },
466
- "session_name": { "type": "string", "minLength": 1 },
467
- "loop_id": { "type": "integer", "minimum": 1 },
468
- "loop_seq": { "type": "integer", "minimum": 1 },
469
- "turn_id": { "type": "integer", "minimum": 1 },
470
- "turn_seq": { "type": "integer", "minimum": 1 },
512
+ "sessionId": { "type": "integer", "minimum": 1 },
513
+ "sessionName": { "type": "string", "minLength": 1 },
514
+ "loopId": { "type": "integer", "minimum": 1 },
515
+ "loopSeq": { "type": "integer", "minimum": 1 },
516
+ "turnId": { "type": "integer", "minimum": 1 },
517
+ "turnSeq": { "type": "integer", "minimum": 1 },
471
518
  "sequence": { "type": "integer", "minimum": 1 },
472
519
  "at": { "type": "string", "minLength": 1 },
473
520
  "origin": { "type": "string", "minLength": 1 },
@@ -484,19 +531,19 @@
484
531
  "signal": {},
485
532
  "lineMarker": {},
486
533
  "tx": {},
487
- "mimetype_tx": { "type": "string" },
534
+ "mimetypeTx": { "type": "string" },
488
535
  "rx": {},
489
- "mimetype_rx": { "type": "string" },
490
- "status_rx": { "type": "integer" },
536
+ "mimetypeRx": { "type": "string" },
537
+ "statusRx": { "type": "integer" },
491
538
  "weight": { "type": "number" },
492
539
  "attrs": {},
493
540
  "state": { "enum": ["proposed", "resolved", "failed", "cancelled"] },
494
541
  "reasoning": { "type": "string" },
495
- "reasoning_model_call_id": { "type": "integer" },
496
- "reasoning_request_sequence": { "type": "integer" },
542
+ "reasoningModelCallId": { "type": "integer" },
543
+ "reasoningRequestSequence": { "type": "integer" },
497
544
  "invocation": { "type": "string" },
498
545
  "answering": { "type": "string" },
499
- "replied_to_sources": {
546
+ "repliedToSources": {
500
547
  "type": "array",
501
548
  "items": { "type": "string" }
502
549
  }
@@ -526,8 +573,8 @@
526
573
  "scheme": { "type": "string", "minLength": 1 },
527
574
  "summary": { "type": "string" },
528
575
  "wakeAction": { "type": "string", "minLength": 1 },
529
- "loop_seq": { "type": "integer", "minimum": 1 },
530
- "turn_seq": { "type": "integer", "minimum": 1 },
576
+ "loopSeq": { "type": "integer", "minimum": 1 },
577
+ "turnSeq": { "type": "integer", "minimum": 1 },
531
578
  "sequence": { "type": "integer", "minimum": 1 }
532
579
  }
533
580
  },
@@ -15,6 +15,10 @@
15
15
  "summary": {
16
16
  "type": "string"
17
17
  },
18
+ "detail": {
19
+ "description": "Optional family-owned structured presentation facts (for example a members preview's match counts and sample paths). Never credentials, never authority.",
20
+ "type": "object"
21
+ },
18
22
  "definition": {
19
23
  "description": "The exact family definition, conforming to the family's definition schema.",
20
24
  "type": "object"
@@ -12,6 +12,18 @@
12
12
  "configuration": {
13
13
  "description": "Caller-supplied configuration material the family interprets as candidates (a client's own PLURNK_SCHEDULE_* environment, a local directory list). It contributes candidates with client-configuration provenance; it never becomes durable authority.",
14
14
  "type": "object"
15
+ },
16
+ "cursor": {
17
+ "description": "Opaque continuation cursor returned by a previous discover page.",
18
+ "type": "string",
19
+ "minLength": 1,
20
+ "maxLength": 512
21
+ },
22
+ "limit": {
23
+ "description": "Maximum number of candidates or preview items to return on one page.",
24
+ "type": "integer",
25
+ "minimum": 1,
26
+ "maximum": 100
15
27
  }
16
28
  }
17
29
  }
@@ -10,6 +10,16 @@
10
10
  "candidates": {
11
11
  "type": "array",
12
12
  "items": { "$ref": "https://schemas.plurnk.xyz/v0/FunctionalityCandidate.json" }
13
+ },
14
+ "total": {
15
+ "type": "integer",
16
+ "minimum": 0,
17
+ "maximum": 9007199254740991
18
+ },
19
+ "nextCursor": {
20
+ "type": "string",
21
+ "minLength": 1,
22
+ "maxLength": 512
13
23
  }
14
24
  }
15
25
  }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.plurnk.xyz/v0/FunctionalityListQuery.json",
4
+ "title": "FunctionalityListQuery",
5
+ "description": "A family-neutral bounded filter and pagination query over workspace or session Functionality definitions.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "query": {
10
+ "description": "Case-insensitive substring filter over alias, provenance, and non-secret definition metadata.",
11
+ "type": "string",
12
+ "maxLength": 256
13
+ },
14
+ "state": {
15
+ "description": "Filter by current preparation or enablement state.",
16
+ "enum": ["disabled", "dormant", "active", "unavailable", "authorization-required"]
17
+ },
18
+ "origin": {
19
+ "description": "Filter by definition ownership.",
20
+ "enum": ["service", "workspace", "session"]
21
+ },
22
+ "offset": {
23
+ "type": "integer",
24
+ "minimum": 0,
25
+ "maximum": 9007199254740991
26
+ },
27
+ "limit": {
28
+ "type": "integer",
29
+ "minimum": 1,
30
+ "maximum": 100
31
+ }
32
+ }
33
+ }
@@ -4,12 +4,27 @@
4
4
  "title": "FunctionalityListResult",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
- "required": ["family", "definitions"],
7
+ "required": ["family", "definitions", "offset", "total"],
8
8
  "properties": {
9
9
  "family": { "type": "string", "minLength": 1 },
10
10
  "definitions": {
11
11
  "type": "array",
12
12
  "items": { "$ref": "https://schemas.plurnk.xyz/v0/FunctionalityDefinitionState.json" }
13
+ },
14
+ "offset": {
15
+ "type": "integer",
16
+ "minimum": 0,
17
+ "maximum": 9007199254740991
18
+ },
19
+ "total": {
20
+ "type": "integer",
21
+ "minimum": 0,
22
+ "maximum": 9007199254740991
23
+ },
24
+ "nextOffset": {
25
+ "type": "integer",
26
+ "minimum": 1,
27
+ "maximum": 9007199254740991
13
28
  }
14
29
  }
15
30
  }