@plurnk/plurnk-contracts 8.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 (97) hide show
  1. package/.env.defaults +1 -19
  2. package/README.md +5 -6
  3. package/SPEC.md +100 -65
  4. package/dist/schema/DaemonNotificationEnvelope.json +602 -0
  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/McpServerDefinition.json +1 -1
  11. package/dist/schema/ModelCatalogPage.json +9 -0
  12. package/dist/schema/PlurnkStatement.json +42 -2
  13. package/dist/schema/ProposalProjection.json +0 -4
  14. package/dist/schema/ProviderAccounting.json +3 -3
  15. package/dist/schema/ProviderCost.json +1 -1
  16. package/dist/schema/ProviderRequestAccounting.json +3 -3
  17. package/dist/schema/ProviderUsage.json +1 -1
  18. package/dist/src/ActorIdentity.d.ts +26 -0
  19. package/dist/src/ActorIdentity.d.ts.map +1 -0
  20. package/dist/src/ActorIdentity.js +179 -0
  21. package/dist/src/ActorIdentity.js.map +1 -0
  22. package/dist/src/Application.d.ts +58 -125
  23. package/dist/src/Application.d.ts.map +1 -1
  24. package/dist/src/Application.js +372 -80
  25. package/dist/src/Application.js.map +1 -1
  26. package/dist/src/ApplicationNotifications.d.ts +77 -24
  27. package/dist/src/ApplicationNotifications.d.ts.map +1 -1
  28. package/dist/src/ApplicationNotifications.js +45 -9
  29. package/dist/src/ApplicationNotifications.js.map +1 -1
  30. package/dist/src/ApplicationPort.d.ts +53 -13
  31. package/dist/src/ApplicationPort.d.ts.map +1 -1
  32. package/dist/src/ApplicationPort.js +1 -1
  33. package/dist/src/ApplicationPort.js.map +1 -1
  34. package/dist/src/ApplicationStream.d.ts +2 -2
  35. package/dist/src/ApplicationStream.d.ts.map +1 -1
  36. package/dist/src/ApplicationStream.js.map +1 -1
  37. package/dist/src/CollectionCommand.d.ts +33 -0
  38. package/dist/src/CollectionCommand.d.ts.map +1 -0
  39. package/dist/src/CollectionCommand.js +277 -0
  40. package/dist/src/CollectionCommand.js.map +1 -0
  41. package/dist/src/Functionality.d.ts +7 -2
  42. package/dist/src/Functionality.d.ts.map +1 -1
  43. package/dist/src/Functionality.js.map +1 -1
  44. package/dist/src/HttpOrigin.d.ts +79 -10
  45. package/dist/src/HttpOrigin.d.ts.map +1 -1
  46. package/dist/src/HttpOrigin.js +286 -44
  47. package/dist/src/HttpOrigin.js.map +1 -1
  48. package/dist/src/HttpPort.d.ts +35 -0
  49. package/dist/src/HttpPort.d.ts.map +1 -0
  50. package/dist/src/HttpPort.js +106 -0
  51. package/dist/src/HttpPort.js.map +1 -0
  52. package/dist/src/InteractiveCommands.d.ts +96 -0
  53. package/dist/src/InteractiveCommands.d.ts.map +1 -0
  54. package/dist/src/InteractiveCommands.js +409 -0
  55. package/dist/src/InteractiveCommands.js.map +1 -0
  56. package/dist/src/LogRow.d.ts +1 -1
  57. package/dist/src/LogRow.js +1 -1
  58. package/dist/src/LogRow.js.map +1 -1
  59. package/dist/src/McpWireTool.d.ts +27 -0
  60. package/dist/src/McpWireTool.d.ts.map +1 -0
  61. package/dist/src/McpWireTool.js +30 -0
  62. package/dist/src/McpWireTool.js.map +1 -0
  63. package/dist/src/OAuthClient.d.ts +64 -0
  64. package/dist/src/OAuthClient.d.ts.map +1 -0
  65. package/dist/src/OAuthClient.js +226 -0
  66. package/dist/src/OAuthClient.js.map +1 -0
  67. package/dist/src/ScheduleCommand.d.ts +60 -0
  68. package/dist/src/ScheduleCommand.d.ts.map +1 -0
  69. package/dist/src/ScheduleCommand.js +677 -0
  70. package/dist/src/ScheduleCommand.js.map +1 -0
  71. package/dist/src/SessionProjection.d.ts +91 -0
  72. package/dist/src/SessionProjection.d.ts.map +1 -0
  73. package/dist/src/SessionProjection.js +223 -0
  74. package/dist/src/SessionProjection.js.map +1 -0
  75. package/dist/src/Validator.d.ts +4 -3
  76. package/dist/src/Validator.d.ts.map +1 -1
  77. package/dist/src/Validator.js +27 -17
  78. package/dist/src/Validator.js.map +1 -1
  79. package/dist/src/index.d.ts +11 -5
  80. package/dist/src/index.d.ts.map +1 -1
  81. package/dist/src/index.js +9 -4
  82. package/dist/src/index.js.map +1 -1
  83. package/dist/src/types.generated.d.ts +814 -566
  84. package/dist/src/types.generated.d.ts.map +1 -1
  85. package/dist/src/types.generated.js.map +1 -1
  86. package/dist/src/types.js +1 -1
  87. package/dist/src/types.js.map +1 -1
  88. package/package.json +3 -2
  89. package/dist/schema/ApplicationOperationEvent.json +0 -27
  90. package/dist/schema/CapabilityDescriptor.json +0 -28
  91. package/dist/schema/CapabilityPolicy.json +0 -22
  92. package/dist/schema/CapabilityProjection.json +0 -14
  93. package/dist/schema/CapabilitySelector.json +0 -29
  94. package/dist/src/CapabilityAdmission.d.ts +0 -11
  95. package/dist/src/CapabilityAdmission.d.ts.map +0 -1
  96. package/dist/src/CapabilityAdmission.js +0 -108
  97. package/dist/src/CapabilityAdmission.js.map +0 -1
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
@@ -7,20 +7,22 @@
7
7
  | Surface | Canonical export or artifact |
8
8
  | --- | --- |
9
9
  | AST, validators, Problems, results, Notices, text regions and extents | `@plurnk/plurnk-contracts` |
10
- | Capability admission and approval ownership | `CapabilityPolicy`, `SessionOwner`, `ProposalPolicy`, `PROPOSAL_POLICIES` |
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` |
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 |
@@ -46,29 +48,15 @@ flowchart LR
46
48
  - **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
49
  - **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
50
 
49
- ### §capability-policy-cascade Capability admission, proposals, and model catalog
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
- ```
51
+ ### §proposal-and-model-contracts Proposals, effort, and model catalog
59
52
 
60
53
  | Contract | Shape invariant | Runtime responsibility |
61
54
  | --- | --- | --- |
62
- | `CapabilityDescriptor` | One routed operation demand with its operation, access class (`read \| write \| exec \| network \| session \| interact`), resource/runtime/tool coordinates, and declared traits | Derive every demand before dispatch |
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 |
55
+ | `ProposalPolicy` | `review`, `accept`, or `reject` (`PROPOSAL_POLICIES`) | Read the server or workspace approval disposition at the proposal boundary |
66
56
  | `ProposalDisposition` | Review, or automatic accept/reject with optional outcome | Select once for the pending gate |
67
- | `ProposalProjection` | Identity, review target, body/attrs, owner, capability selector, ACP v2 subject, stale signal, disposition | One validated projection for live delivery and reconnect |
57
+ | `ProposalProjection` | Identity, review target, body/attrs, owner, ACP v2 subject, stale signal, disposition | One validated projection for live delivery and reconnect |
68
58
 
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.
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.
59
+ - **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
60
  - **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
61
 
74
62
  ### §provider-request-accounting Client interactions and provider request accounting
@@ -95,39 +83,20 @@ flowchart LR
95
83
  "name": "mcp",
96
84
  "parameters": {
97
85
  "type": "object",
98
- "required": ["server", "tool", "arguments"],
86
+ "required": ["server", "tool", "aside", "arguments"],
99
87
  "properties": {
100
88
  "server": { "type": "string" },
101
89
  "tool": { "type": "string" },
102
- "arguments": { "type": "object", "additionalProperties": true },
103
- "aside": { "type": "string", "description": "Optional terse intent note." }
90
+ "aside": { "type": "string", "description": "Terse intent note." },
91
+ "arguments": { "type": "object", "additionalProperties": true }
104
92
  },
105
93
  "additionalProperties": false
106
94
  }
107
95
  }
108
96
  ```
109
97
 
110
- - **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>"`).
111
- - **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`.
112
-
113
- ### §expression-boundaries Wire tool lowering, standalone runtime routing, and replay projection
114
-
115
- | Rule | Contract |
116
- | --- | --- |
117
- | `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. |
118
- | 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`. |
119
- | Case-insensitive method recovery | Uppercase or mixed-case core/runtime tool names recover silently to their lowercase canonical tool name. |
120
- | 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. |
121
-
122
- ### §slot-order Argument shapes, target groups, and endpoint options
123
-
124
- | Construct | Contract |
125
- | --- | --- |
126
- | Object and positional argument forms | Core operations accept their canonical `{ ... }` options object (`{ path, range?, pattern?, text?, ... }`) as well as positional shorthands on `parseStatements`. |
127
- | 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). |
128
- | `note` annotation on retrievals | Providing `note` on `read` or `find` emits a preceding `note` statement before the retrieval(s). |
129
- | 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. |
130
- | 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}).
131
100
 
132
101
  ---
133
102
 
@@ -137,15 +106,15 @@ flowchart LR
137
106
  | --- | --- | --- | --- |
138
107
  | `plurnk` / `find` | required `path` / `paths` | optional `range`, `pattern`, `headers` | optional `note` normalized to preceding `note` |
139
108
  | `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 |
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 |
141
110
  | `plurnk` / `copy`, `move` | required `from` and `to` | optional `fromRange` / `toRange`, `fromHeaders` / `toHeaders` | none |
142
- | `plurnk` / `sh`, `js`, `python3` | optional `script`, `cwd` | none | `text` (or tolerated `code` / `command` / `cmd` / `body` / `source` / `prompt`), optional `args` |
143
- | `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 |
144
113
  | `<server>` / `<tool>` | external MCP `<server>` and `<tool>` | optional `range` | JSON arguments object |
145
114
  | `plurnk` / `bare` | none | none | required `text` (or tolerated `prompt` / `body` / `content` / `message`) |
146
- | `plurnk` / `work`, `fork` | optional `target` (`session://name`) | none | required `text` (or tolerated `prompt` / `body` / `content` / `message`) |
147
- | `plurnk` / `kill` | required `path` / `paths` | optional `range`, `pattern`, `remote`, `headers` | optional `note` distillation on `log:///` |
148
- | `plurnk` / `send` | optional `target` recipient (caller aliases `user`/`client`/`human`/`operator`/`caller` normalize to `null`) | optional `headers`, `attachments` | required `text` message body |
115
+ | `plurnk` / `work`, `fork` | optional `target` (`session://name`) | optional `persona`, `model`, `effort` | required `text` (or tolerated `prompt` / `body` / `content` / `message`) |
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 |
149
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) |
150
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) |
151
120
  | `plurnk` / `note` | none | none | `text` conclusions, findings, and plans |
@@ -172,12 +141,12 @@ flowchart LR
172
141
 
173
142
  | Prefix | Dialect | Validation & tolerance |
174
143
  | --- | --- | --- |
175
- | `//` | `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) |
176
- | `/` 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*/` |
177
146
  | `$` | `jsonpath` | Validated with RFC 9535 `json-p3` |
178
- | `~` | `fulltext` | Single-line FTS5 query string |
179
- | `&` | `graph` | `&symbol`, `&<symbol`, or `&>symbol` relation query |
180
- | 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`) |
181
150
 
182
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.
183
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.
@@ -222,19 +191,27 @@ flowchart LR
222
191
 
223
192
  | Projection / Helper | Contract |
224
193
  | --- | --- |
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 filtered event subscriptions (`subscribeToEvents(handler, filter?)`). |
226
- | `DaemonNotification` / `NotificationFilter` | Closed discriminated union over the 19 `DAEMON_NOTIFICATION_EVENTS` (`{ id, event, timestamp, workspaceId, sessionId, data }`), constructed by `toDaemonNotification` and filtered at source by `matchesNotificationFilter(notification, { events?, workspaceId?, sessionId? })`. |
227
- | `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 }`. |
228
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. |
229
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). |
230
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`. |
231
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`. |
232
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
+
233
210
  ---
234
211
 
235
- ## §parse-recovery 8. Argument tolerances and error shapes
212
+ ## §parse-recovery 8. Parse error contract and coordinate systems
236
213
 
237
- `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}):
238
215
 
239
216
  | Representation | Line | Column | Absence or extent |
240
217
  | --- | --- | --- | --- |
@@ -243,8 +220,66 @@ flowchart LR
243
220
  | Contracts `TextRegion` | 1-based | 1-based Unicode code points | Start included, end excluded; equality is zero-width |
244
221
  | SARIF 2.1.0 region | 1-based | 1-based (`columnKind: "unicodeCodePoints"`) | End excluded; parser point adapters add 1 to `column` |
245
222
 
246
- | 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 |
247
232
  | --- | --- |
248
- | 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
- | 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 invoke-boundary `<|DSML|parameter name="...">` 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, singular `line` range aliases, `wait` `stream` and `timeoutMs`/`timeout_ms`/`ms` options, pattern-shaped `range` strings when `pattern` is omitted or empty, 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`). |
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 |
267
+ | --- | --- |
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>]`.