@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
@@ -39,29 +39,198 @@ export interface MimetypeDisplayCapability {
39
39
  mimetype: string;
40
40
  display: CapabilityDisplay;
41
41
  }
42
- export type ApplicationOperationEvent = {
42
+ export type ClientInteractionRequest = ({
43
+ toolName: string;
44
+ mode: "form";
45
+ message: string;
46
+ requestedSchema: {
47
+ [k: string]: unknown;
48
+ };
49
+ } | {
50
+ toolName: string;
51
+ mode: "url";
52
+ message: string;
53
+ elicitationId: string;
54
+ url: string;
55
+ });
56
+ /**
57
+ * The runtime-neutral client-interface projection of one pending client interaction. Live delivery and reconnect discovery expose this same shape.
58
+ */
59
+ export interface ClientInteractionProjection {
60
+ interactionId: number;
43
61
  sessionId: number;
44
62
  loopId: number;
45
63
  turnId: number;
46
- sequence: number;
47
- origin: ("model" | "client" | "_plurnk");
48
- projectRoot: (string | null);
49
- statement: PlurnkStatement;
50
- phase: ("started" | "settled");
51
- result?: OperationResult;
52
- };
64
+ recipient: string;
65
+ request: ClientInteractionRequest;
66
+ }
67
+ export type ClientInteractionResolution = ({
68
+ action: "accept";
69
+ content?: {
70
+ [k: string]: unknown;
71
+ };
72
+ } | {
73
+ action: "decline";
74
+ } | {
75
+ action: "cancel";
76
+ });
77
+ export type DaemonNotificationEnvelope = ({
78
+ id: number;
79
+ event: "workspace/created";
80
+ timestamp: number;
81
+ workspaceId: (number | null);
82
+ sessionId: null;
83
+ data: WorkspaceCreated;
84
+ } | {
85
+ id: number;
86
+ event: "workspace/renamed";
87
+ timestamp: number;
88
+ workspaceId: (number | null);
89
+ sessionId: null;
90
+ data: WorkspaceRenamed;
91
+ } | {
92
+ id: number;
93
+ event: "workspace/archived";
94
+ timestamp: number;
95
+ workspaceId: (number | null);
96
+ sessionId: null;
97
+ data: WorkspaceArchived;
98
+ } | {
99
+ id: number;
100
+ event: "functionality/changed";
101
+ timestamp: number;
102
+ workspaceId: (number | null);
103
+ sessionId: (number | null);
104
+ data: FunctionalityChanged;
105
+ } | {
106
+ id: number;
107
+ event: "session/created";
108
+ timestamp: number;
109
+ workspaceId: (number | null);
110
+ sessionId: (number | null);
111
+ data: SessionCreated;
112
+ } | {
113
+ id: number;
114
+ event: "session/archived";
115
+ timestamp: number;
116
+ workspaceId: (number | null);
117
+ sessionId: (number | null);
118
+ data: SessionArchived;
119
+ } | {
120
+ id: number;
121
+ event: "session/deleted";
122
+ timestamp: number;
123
+ workspaceId: (number | null);
124
+ sessionId: (number | null);
125
+ data: SessionDeleted;
126
+ } | {
127
+ id: number;
128
+ event: "session/titled";
129
+ timestamp: number;
130
+ workspaceId: (number | null);
131
+ sessionId: (number | null);
132
+ data: SessionTitled;
133
+ } | {
134
+ id: number;
135
+ event: "session/policy";
136
+ timestamp: number;
137
+ workspaceId: (number | null);
138
+ sessionId: (number | null);
139
+ data: SessionPolicy;
140
+ } | {
141
+ id: number;
142
+ event: "loop/started";
143
+ timestamp: number;
144
+ workspaceId: (number | null);
145
+ sessionId: (number | null);
146
+ data: LoopStarted;
147
+ } | {
148
+ id: number;
149
+ event: "loop/parked";
150
+ timestamp: number;
151
+ workspaceId: (number | null);
152
+ sessionId: (number | null);
153
+ data: LoopParked;
154
+ } | {
155
+ id: number;
156
+ event: "loop/proposal";
157
+ timestamp: number;
158
+ workspaceId: (number | null);
159
+ sessionId: (number | null);
160
+ data: ProposalProjection;
161
+ } | {
162
+ id: number;
163
+ event: "loop/interaction";
164
+ timestamp: number;
165
+ workspaceId: (number | null);
166
+ sessionId: (number | null);
167
+ data: ClientInteractionProjection;
168
+ } | {
169
+ id: number;
170
+ event: "loop/gate-settled";
171
+ timestamp: number;
172
+ workspaceId: (number | null);
173
+ sessionId: (number | null);
174
+ data: LoopGateSettled;
175
+ } | {
176
+ id: number;
177
+ event: "loop/terminated";
178
+ timestamp: number;
179
+ workspaceId: (number | null);
180
+ sessionId: (number | null);
181
+ data: Terminated;
182
+ } | {
183
+ id: number;
184
+ event: "log/entry";
185
+ timestamp: number;
186
+ workspaceId: (number | null);
187
+ sessionId: (number | null);
188
+ data: LogEntry;
189
+ } | {
190
+ id: number;
191
+ event: "stream/concluded";
192
+ timestamp: number;
193
+ workspaceId: (number | null);
194
+ sessionId: (number | null);
195
+ data: StreamConcluded;
196
+ } | {
197
+ id: number;
198
+ event: "notice/event";
199
+ timestamp: number;
200
+ workspaceId: (number | null);
201
+ sessionId: (number | null);
202
+ data: NoticeEvent;
203
+ });
53
204
  /**
54
- * The parsed AST union for one protocol statement, discriminated by `op`. Every variant has fixed target, lineMarker, aside, body, and source-position fields, the text and log operations add a matcher lifted from the `pattern` option, HTTP-capable operations add `headers` (and `kill` adds `remote`), and messaging operations add `attachments`; operation-specific schemas constrain their types. A null field records an omitted tolerated slot and does not satisfy runtime requirements by itself.
205
+ * The portable durable reasoning effort shared by provider, runtime, and client boundaries.
55
206
  */
56
- export type PlurnkStatement = (FindStatement | ReadStatement | EditStatement | CopyStatement | MoveStatement | SendStatement | DoneStatement | FailStatement | ExecStatement | BareStatement | WorkStatement | ForkStatement | KillStatement | DispositionStatement | NoteStatement);
207
+ export type Effort = ("off" | "adaptive" | "low" | "medium" | "high" | "xhigh" | "max");
57
208
  /**
58
- * A parsed target slot from a plurnk statement. Discriminated on `kind`: a bare local path or a WHATWG-decomposed URL. Targets carry an exact address or a path glob; content matching belongs in the statement body.
209
+ * The one core-owned settlement decision. Review waits for the session's owner; accept and reject carry the automatic resolution core applies.
59
210
  */
60
- export type ParsedPath = (LocalPath | UrlPath);
211
+ export type ProposalDisposition = ({
212
+ decision: "review";
213
+ } | {
214
+ decision: ("accept" | "reject");
215
+ outcome?: string;
216
+ });
61
217
  /**
62
- * Parsed body of a matcher-bearing statement, discriminated on `dialect`. The dialect is determined by the body's leading characters (`//` xpath, `/` regex, `$` jsonpath, `~` full-text, `&` graph, else glob); a body the parser could not read in its claimed dialect is `unreadable` ({§matcher-prefix-claims}). The regex variant carries pattern and flags split out of the `/pattern/flags` literal; every variant remains JSON-serializable.
218
+ * A runtime-neutral client elicitation request in standard ACP v2 / MCP form or URL mode. Protocol-private continuation state is excluded.
63
219
  */
64
- export type MatcherBody = (XPathBody | RegexBody | JsonPathBody | FtsBody | GraphBody | GlobBody | UnreadableBody);
220
+ export type LoopGateSettled = ({
221
+ kind: "proposal";
222
+ sessionId: number;
223
+ loopId: number;
224
+ logEntryId: number;
225
+ decision: ("accept" | "reject" | "cancel");
226
+ outcome: string;
227
+ } | {
228
+ kind: "interaction";
229
+ sessionId: number;
230
+ loopId: number;
231
+ interactionId: number;
232
+ action: ("accept" | "decline" | "cancel");
233
+ });
65
234
  /**
66
235
  * Universal PLURNK operation result. Producer-owned metadata is open, but failures always carry one RFC 9457 Problem Details object.
67
236
  */
@@ -83,334 +252,174 @@ export type RequestedRange = [number, number];
83
252
  * @maxItems 2
84
253
  */
85
254
  export type ReturnedRange = [number, number];
86
- export interface FindStatement {
87
- op: "find";
88
- aside: (string | null);
89
- /**
90
- * Optional HTTP request headers (`{ [name: string]: string }`); null when omitted.
91
- */
92
- headers: ({
93
- [k: string]: string;
94
- } | null);
95
- target: (ParsedPath | null);
96
- lineMarker: (LineMarker | null);
97
- /**
98
- * The selection matcher lifted from the `pattern` option ({§parse-recovery}); null when omitted.
99
- */
100
- matcher: (MatcherBody | null);
101
- /**
102
- * Retrieval bodies normalize to separate `note` statements; selection belongs to the options ({§op-shapes}).
103
- */
104
- body: null;
105
- position: Position;
106
- }
107
- /**
108
- * A bare local path with no `scheme://` prefix. `raw` is the path as authored, minus any `#channel`, which is `fragment` exactly as on a URL; resolution is the runtime's job.
109
- */
110
- export interface LocalPath {
111
- kind: "local";
112
- raw: string;
113
- fragment?: (string | null);
114
- }
115
255
  /**
116
- * A path with a `scheme://` prefix, fully decomposed via WHATWG URL.
256
+ * Normalized monetary evidence for one physical provider request. Unknown is never represented as zero.
117
257
  */
118
- export interface UrlPath {
119
- kind: "url";
120
- raw: string;
121
- scheme: string;
122
- username: (string | null);
123
- password: (string | null);
124
- hostname: (string | null);
125
- port: (number | null);
126
- pathname: string;
127
- /**
128
- * Canonical serialized WHATWG query component without the leading `?`. Null means no query; the empty string means an explicit empty query (`?`). Ordering, duplicate names, and encoded spelling are preserved.
129
- */
130
- query: (string | null);
131
- fragment: (string | null);
258
+ export type ProviderCost = ({
259
+ kind: "charged";
260
+ amount: MonetaryAmount;
261
+ usdEquivalent?: string;
262
+ source: string;
263
+ } | {
264
+ kind: "estimated";
265
+ amount: MonetaryAmount;
266
+ source: string;
267
+ } | {
268
+ kind: "unknown";
269
+ reason: string;
270
+ });
271
+ export interface WorkspaceCreated {
272
+ id: number;
273
+ name: string;
274
+ projectRoot: (string | null);
275
+ projectLabel: (string | null);
132
276
  }
133
- /**
134
- * The ordered numeric components parsed from a `<scope>` slot. AstBuilder converts each lexical number to a JavaScript number; the operation owner assigns arity and meaning, including text coordinates, result positions, timing, and mutation anchors.
135
- */
136
- export interface LineMarker {
137
- /**
138
- * @minItems 1
139
- */
140
- marks: [number, ...(number)[]];
277
+ export interface WorkspaceRenamed {
278
+ id: number;
279
+ name: string;
141
280
  }
142
- /**
143
- * XPath 1.0 expression. Validated at parse time via the xpath library.
144
- */
145
- export interface XPathBody {
146
- dialect: "xpath";
147
- raw: string;
281
+ export interface WorkspaceArchived {
282
+ id: number;
283
+ archivedAt: (string | null);
148
284
  }
149
- /**
150
- * ECMAScript regex literal `/pattern/flags`. Escape a literal delimiter as `\/`. Pattern and flags are split out for direct use. `raw` preserves the literal form for round-tripping.
151
- */
152
- export interface RegexBody {
153
- dialect: "regex";
154
- raw: string;
155
- pattern: string;
156
- flags: string;
285
+ export interface FunctionalityChanged {
286
+ workspaceId: number;
287
+ sessionId: (number | null);
288
+ family: string;
157
289
  }
158
- /**
159
- * RFC 9535 JSONPath expression. Compiled at parse time with json-p3, the same engine used for runtime matching.
160
- */
161
- export interface JsonPathBody {
162
- dialect: "jsonpath";
163
- raw: string;
290
+ export interface SessionCreated {
291
+ id: number;
292
+ workspaceId: number;
293
+ workspaceName: string;
294
+ projectRoot: (string | null);
295
+ projectLabel: (string | null);
296
+ name: string;
297
+ parentSessionId: (number | null);
298
+ origin: ("model" | "_plurnk");
299
+ kind: ("root" | "fork" | "work");
300
+ lifecycle: ("idle" | "queued" | "running" | "parked" | "completed" | "cancelled" | "failed");
301
+ persona?: (string | null);
302
+ }
303
+ export interface SessionArchived {
304
+ id: number;
305
+ archivedAt: (string | null);
306
+ sessionIds: number[];
307
+ }
308
+ export interface SessionDeleted {
309
+ id: number;
310
+ sessionIds: number[];
311
+ }
312
+ export interface SessionTitled {
313
+ id: number;
314
+ title: string;
164
315
  }
165
- /**
166
- * Native SQLite FTS5 query after the `~` prefix. SQLite owns query validation, tokenization, matching and ranking; the statement's scope selects ordinary result positions.
167
- */
168
- export interface FtsBody {
169
- dialect: "fts";
170
- raw: string;
316
+ export interface SessionPolicy {
317
+ sessionId: number;
318
+ model: (ModelRoute | null);
319
+ childModel: (ModelRoute | null);
320
+ persona?: (string | null);
171
321
  }
172
322
  /**
173
- * Code-graph selection. Body is `&symbol` for definitions, `&<symbol` for references to that name, or `&>symbol` for definitions of its one-hop dependencies. Shape is validated during language admission; resolution happens service-side through the symbol index.
323
+ * A client-visible resolved provider/model identity. Alias is present only when a declared alias supplied the route; provider configuration remains private to the daemon. effort is the session's durable effort selection — absent when the model has no reasoning dimension.
174
324
  */
175
- export interface GraphBody {
176
- dialect: "graph";
177
- raw: string;
325
+ export interface ModelRoute {
326
+ alias?: string;
327
+ provider: string;
328
+ model: string;
329
+ effort?: Effort;
330
+ /**
331
+ * Whether effort was chosen through setSessionEffort (explicit) or seeded from the alias configuration (default). Present exactly when effort is.
332
+ */
333
+ effortSource?: ("default" | "explicit");
178
334
  }
179
- /**
180
- * Pattern with no dialect prefix; treated as a glob/literal match.
181
- */
182
- export interface GlobBody {
183
- dialect: "glob";
184
- raw: string;
335
+ export interface LoopStarted {
336
+ sessionId: number;
337
+ loopId: number;
338
+ loopSeq: number;
185
339
  }
186
- /**
187
- * A matcher the parser could not read in the dialect its prefix claims ({§matcher-prefix-claims}): the authored text, the diagnostic, and the working form. The statement is admitted and the operation refuses with that message and recovery; it is never a contract strike.
188
- */
189
- export interface UnreadableBody {
190
- dialect: "unreadable";
191
- raw: string;
192
- message: string;
193
- recovery: string;
340
+ export interface LoopParked {
341
+ sessionId: number;
342
+ loopId: number;
343
+ loopSeq: number;
344
+ status: 202;
194
345
  }
195
346
  /**
196
- * A source point in parsed PLURNK input. Lines are 1-based; columns are 0-based Unicode code points. LF and CRLF delimit lines, while a lone CR occupies one column. The exact pair {line: 0, column: 0} is the sole unknown/degraded position.
347
+ * The runtime-neutral client-interface projection of one durable stopped-world proposal. Live delivery and reconnect discovery expose this same shape.
197
348
  */
198
- export interface Position {
199
- line: number;
200
- column: number;
201
- }
202
- export interface ReadStatement {
203
- op: "read";
204
- aside: (string | null);
205
- /**
206
- * Optional HTTP request headers (`{ [name: string]: string }`); null when omitted.
207
- */
208
- headers: ({
209
- [k: string]: string;
210
- } | null);
211
- target: (ParsedPath | null);
212
- lineMarker: (TextLineMarker | null);
349
+ export interface ProposalProjection {
350
+ logEntryId: number;
351
+ sessionId: number;
213
352
  /**
214
- * The selection matcher lifted from the `pattern` option ({§parse-recovery}); null when omitted.
353
+ * The requesting session's name.
215
354
  */
216
- matcher: (MatcherBody | null);
217
- body: null;
218
- position: Position;
219
- }
220
- /**
221
- * The ordered components parsed from a text-coordinate <scope>. A line position may be numeric or a rendered five-character Base62 line anchor; columns remain numeric. Core resolves anchors against the addressed current text before a numeric scope reaches its operation owner.
222
- */
223
- export interface TextLineMarker {
355
+ session: string;
356
+ loopId: number;
357
+ turnId: number;
224
358
  /**
225
- * @minItems 1
359
+ * The gated operation's log coordinate, loop/turn/sequence: the id of the call it is.
226
360
  */
227
- marks: [(number | string), ...((number | string))[]];
228
- }
229
- export interface EditStatement {
230
- op: "edit";
231
- aside: (string | null);
361
+ coordinate: string;
232
362
  /**
233
- * Optional HTTP request headers (`{ [name: string]: string }`); null when omitted.
363
+ * An operation keyword, or a runtime tag: an execution's operation is its runtime.
234
364
  */
235
- headers: ({
236
- [k: string]: string;
237
- } | null);
238
- target: (ParsedPath | null);
239
- lineMarker: (TextLineMarker | null);
365
+ op: "find" | "read" | "edit" | "copy" | "move" | "send" | "done" | "fail" | "bare" | "work" | "fork" | "kill" | "note" | "wait" | Lowercase<string>;
366
+ target: {
367
+ scheme: (string | null);
368
+ authority: (string | null);
369
+ pathname: (string | null);
370
+ };
371
+ body: string;
372
+ attrs: {
373
+ [k: string]: unknown;
374
+ };
375
+ owner: string;
376
+ disposition: ProposalDisposition;
240
377
  /**
241
- * The selection matcher lifted from the `pattern` option ({§parse-recovery}); null when omitted.
378
+ * Structured ACP v2 permission subject for the proposed operation.
242
379
  */
243
- matcher: (MatcherBody | null);
244
- body: (string | null);
245
- position: Position;
246
- }
247
- export interface CopyStatement {
248
- op: "copy";
249
- aside: (string | null);
250
- source: ResourceSelection;
251
- destination: ResourceSelection;
252
- position: Position;
253
- }
254
- /**
255
- * One `copy`/`move` resource operand. A target without a fragment selects the scheme's default channel; a fragment selects a named channel; headers belong to an HTTP(S) endpoint; lineMarker scopes the selected textual content.
256
- */
257
- export interface ResourceSelection {
258
- target: ParsedPath;
259
- /**
260
- * Optional HTTP request headers owned by this operand's addressed endpoint; null when omitted.
261
- */
262
- headers: ({
263
- [k: string]: string;
264
- } | null);
265
- lineMarker: (TextLineMarker | null);
266
- /**
267
- * Optional selection matcher on the source operand; refused by the owner on a destination.
268
- */
269
- matcher: (MatcherBody | null);
270
- }
271
- export interface MoveStatement {
272
- op: "move";
273
- aside: (string | null);
274
- source: ResourceSelection;
275
- destination: ResourceSelection;
276
- position: Position;
277
- }
278
- export interface SendStatement {
279
- op: "send";
280
- aside: (string | null);
281
- /**
282
- * Optional HTTP request headers (`{ [name: string]: string }`); null when omitted.
283
- */
284
- headers: ({
285
- [k: string]: string;
286
- } | null);
380
+ subject?: ({
381
+ type: "command";
382
+ command: string;
383
+ cwd: string;
384
+ } | {
385
+ type: "tool_call";
386
+ kind: ("read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "other");
387
+ title: string;
388
+ locations?: {
389
+ path: string;
390
+ }[];
391
+ diff?: {
392
+ path: string;
393
+ patch: string;
394
+ };
395
+ });
287
396
  /**
288
- * Optional resource addresses attached to a message; null when omitted.
397
+ * When the gate stops waiting and core cancels it (ISO 8601); absent while it waits indefinitely.
289
398
  */
290
- attachments: (string[] | null);
291
- target: (ParsedPath | null);
292
- lineMarker: null;
293
- body: (SendBody | null);
294
- position: Position;
399
+ expiresAt?: string;
295
400
  }
296
401
  /**
297
- * Parsed body of a `send`, `done`, or `fail` statement. `raw` is the literal body text; `json` is the best-effort `JSON.parse(raw)` result, or null when the body isn't valid JSON.
402
+ * The runtime-neutral client-interface projection of one pending client interaction. Live delivery and reconnect discovery expose this same shape.
298
403
  */
299
- export interface SendBody {
300
- raw: string;
301
- json: unknown;
302
- }
303
- export interface DoneStatement {
304
- op: "done";
305
- aside: (string | null);
306
- /**
307
- * Optional resource addresses attached to a message; null when omitted.
308
- */
309
- attachments: (string[] | null);
310
- target: (ParsedPath | null);
311
- lineMarker: null;
312
- body: (SendBody | null);
313
- position: Position;
314
- }
315
- export interface FailStatement {
316
- op: "fail";
317
- aside: (string | null);
318
- /**
319
- * Optional resource addresses attached to a message; null when omitted.
320
- */
321
- attachments: (string[] | null);
322
- target: (ParsedPath | null);
323
- lineMarker: null;
324
- body: (SendBody | null);
325
- position: Position;
326
- }
327
- export interface ExecStatement {
328
- /**
329
- * The runtime tag the call names, in its registered lowercase spelling. An execution has no operation keyword: the call name is the runtime, and the log row's op shows it as written.
330
- */
331
- runtime: Lowercase<string>;
332
- /**
333
- * Never present: an execution is named by its runtime.
334
- */
335
- op?: never;
336
- aside: (string | null);
337
- target: (ParsedPath | null);
338
- cwd?: (string | null);
339
- lineMarker: (LineMarker | null);
340
- body: (string | null);
341
- position: Position;
342
- }
343
- export interface BareStatement {
344
- op: "bare";
345
- aside: (string | null);
346
- target: (ParsedPath | null);
347
- lineMarker: null;
348
- body: string;
349
- position: Position;
350
- }
351
- export interface WorkStatement {
352
- op: "work";
353
- aside: (string | null);
354
- target: (ParsedPath | null);
355
- lineMarker: null;
356
- body: string;
357
- position: Position;
358
- }
359
- export interface ForkStatement {
360
- op: "fork";
361
- aside: (string | null);
362
- target: (ParsedPath | null);
363
- lineMarker: null;
364
- body: string;
365
- position: Position;
366
- }
367
- export interface KillStatement {
368
- op: "kill";
369
- aside: (string | null);
370
- /**
371
- * Optional HTTP request headers (`{ [name: string]: string }`); null when omitted.
372
- */
373
- headers: ({
374
- [k: string]: string;
375
- } | null);
376
- /**
377
- * Optional confirmation for remote HTTP DELETE (`true`); null when omitted.
378
- */
379
- remote: (boolean | null);
380
- target: (ParsedPath | null);
381
- /**
382
- * Scope of the kill: lines of a log body or of an entry ({§op-shapes}); null kills the whole target.
383
- */
384
- lineMarker: (TextLineMarker | null);
385
- /**
386
- * The selection matcher lifted from the `pattern` option ({§parse-recovery}); null when omitted.
387
- */
388
- matcher: (MatcherBody | null);
389
- /**
390
- * A `log:///` `kill` carries its optional distillation, kept as the model's own `note` row ({§log-kill-scope}). Other `kill` statements take no body; their matcher rides on the `pattern` option ({§parse-recovery}).
391
- */
392
- body: (string | null);
393
- position: Position;
394
- }
395
- export interface DispositionStatement {
396
- op: "wait";
397
- aside: (string | null);
398
- target: (ParsedPath | null);
399
- lineMarker: null;
400
- /**
401
- * Optional maximum park duration from `timeout` option; zero continues without parking.
402
- */
403
- seconds: (number | null);
404
- body: (string | null);
405
- position: Position;
406
- }
407
- export interface NoteStatement {
408
- op: "note";
409
- aside: (string | null);
410
- target: null;
411
- lineMarker: null;
412
- body: (string | null);
413
- position: Position;
404
+ export interface Terminated {
405
+ sessionId: number;
406
+ loopId: number;
407
+ loopSeq: number;
408
+ result: OperationResult;
409
+ hitMaxTurns: boolean;
410
+ turnIds: number[];
411
+ attributions: string[];
412
+ terminatedAt: number;
413
+ usage: {
414
+ accounting: ProviderAccounting;
415
+ curationWeight: (number | null);
416
+ curationBudget: (number | null);
417
+ contextTokens: (number | null);
418
+ contextCapacity: (number | null);
419
+ meta: {
420
+ [k: string]: unknown;
421
+ };
422
+ };
414
423
  }
415
424
  /**
416
425
  * PLURNK operation failure using RFC 9457 Problem Details. Extension members are permitted so an owning boundary can add structured causal and recovery facts without inventing a second error envelope.
@@ -459,105 +468,177 @@ export interface RangeExtent {
459
468
  requested: RequestedRange;
460
469
  returned?: ReturnedRange;
461
470
  }
462
- export interface CapabilityDescriptor {
463
- /**
464
- * An operation keyword, or a runtime tag: an execution's operation is its runtime.
465
- */
466
- operation: "find" | "read" | "edit" | "copy" | "move" | "send" | "bare" | "work" | "fork" | "kill" | Lowercase<string>;
467
- scheme?: string;
468
- runtime?: string;
469
- tool?: string;
470
- access: ("observe" | "mutate" | "execute" | "interact" | "control");
471
- traits: string[];
472
- }
473
- export interface CapabilityPolicy {
474
- allow?: CapabilitySelector[];
475
- only?: CapabilitySelector[];
476
- deny?: CapabilitySelector[];
477
- }
478
471
  /**
479
- * One exact, conjunctive selector over a routed PLURNK capability demand. Omitted fields are wildcards; at least one field is required.
472
+ * Ordered physical provider-request evidence and its deterministic aggregate projection.
480
473
  */
481
- export interface CapabilitySelector {
482
- /**
483
- * An operation keyword, or a runtime tag: an execution's operation is its runtime.
484
- */
485
- operation?: "find" | "read" | "edit" | "copy" | "move" | "send" | "bare" | "work" | "fork" | "kill" | Lowercase<string>;
486
- scheme?: string;
487
- runtime?: string;
488
- tool?: string;
489
- access?: ("observe" | "mutate" | "execute" | "interact" | "control");
490
- /**
491
- * @minItems 1
492
- */
493
- traits?: [string, ...(string)[]];
494
- }
495
- export interface CapabilityProjection {
496
- service: CapabilityPolicy;
497
- workspace: CapabilityPolicy;
498
- effective: CapabilityPolicy;
474
+ export interface ProviderAccounting {
475
+ requests: ProviderRequestAccounting[];
476
+ usage: (ProviderUsage | null);
477
+ knownUsage: (ProviderUsage | null);
478
+ knownCostUsd: (string | null);
479
+ costUsd: (string | null);
499
480
  }
500
481
  /**
501
- * One capability-policy layer. Deny wins; when only is present, a demand must match at least one selector; allow pre-approves matching admitted proposals.
482
+ * The normalized accounting disposition of one physical provider request.
502
483
  */
503
- export type ClientInteractionRequest = ({
504
- toolName: string;
505
- mode: "form";
506
- message: string;
507
- requestedSchema: {
508
- [k: string]: unknown;
509
- };
510
- } | {
511
- toolName: string;
512
- mode: "url";
513
- message: string;
514
- elicitationId: string;
515
- url: string;
516
- });
484
+ export interface ProviderRequestAccounting {
485
+ provider: string;
486
+ model: string;
487
+ outcome: ("response" | "error");
488
+ status?: number;
489
+ usage?: ProviderUsage;
490
+ cost: ProviderCost;
491
+ }
517
492
  /**
518
- * The runtime-neutral client-interface projection of one pending client interaction. Live delivery and reconnect discovery expose this same shape.
493
+ * Token quantities. Physical-request instances enforce their partition identities. ProviderAccounting distinguishes complete usage from knownUsage subtotals. Omitted fields are unknown; explicit zero is observed or exactly derived.
519
494
  */
520
- export interface ClientInteractionProjection {
521
- interactionId: number;
495
+ export interface ProviderUsage {
496
+ inputTokens?: number;
497
+ outputTokens?: number;
498
+ totalTokens?: number;
499
+ inputTokenDetails?: {
500
+ noCacheTokens?: number;
501
+ cacheReadTokens?: number;
502
+ cacheWriteTokens?: number;
503
+ };
504
+ outputTokenDetails?: {
505
+ textTokens?: number;
506
+ reasoningTokens?: number;
507
+ };
508
+ }
509
+ export interface MonetaryAmount {
510
+ amount: string;
511
+ currency: string;
512
+ }
513
+ export interface LogEntry {
514
+ entry: {
515
+ id: number;
516
+ sessionId: number;
517
+ sessionName: string;
518
+ loopId: number;
519
+ loopSeq: number;
520
+ turnId: number;
521
+ turnSeq: number;
522
+ sequence: number;
523
+ at: string;
524
+ origin: string;
525
+ source: (string | null);
526
+ op: (string | null);
527
+ scheme: (string | null);
528
+ username: (string | null);
529
+ password: (string | null);
530
+ hostname: (string | null);
531
+ port: (number | null);
532
+ pathname: (string | null);
533
+ query: (string | null);
534
+ fragment: (string | null);
535
+ signal: unknown;
536
+ lineMarker: unknown;
537
+ tx: unknown;
538
+ mimetypeTx: string;
539
+ rx: unknown;
540
+ mimetypeRx: string;
541
+ statusRx: number;
542
+ weight: number;
543
+ attrs: unknown;
544
+ state: ("proposed" | "resolved" | "failed" | "cancelled");
545
+ reasoning?: string;
546
+ reasoningModelCallId?: number;
547
+ reasoningRequestSequence?: number;
548
+ invocation?: string;
549
+ answering?: string;
550
+ repliedToSources?: string[];
551
+ };
552
+ }
553
+ export interface StreamConcluded {
522
554
  sessionId: number;
555
+ entryId: number;
556
+ target: string;
557
+ subscriptionId: number;
558
+ result: OperationResult;
559
+ scheme: string;
560
+ summary: string;
561
+ wakeAction: string;
562
+ loopSeq?: number;
563
+ turnSeq?: number;
564
+ sequence?: number;
565
+ }
566
+ export interface NoticeEvent {
567
+ sessionId: (number | null);
523
568
  loopId: number;
524
- turnId: number;
525
- recipient: string;
526
- request: ClientInteractionRequest;
569
+ notice: Notice;
527
570
  }
528
- export type ClientInteractionResolution = ({
529
- action: "accept";
530
- content?: {
531
- [k: string]: unknown;
532
- };
533
- } | {
534
- action: "decline";
535
- } | {
536
- action: "cancel";
537
- });
538
- export type Effort = ("off" | "adaptive" | "low" | "medium" | "high" | "xhigh" | "max");
539
- export type EntryReadResult = ({
540
- status: 200;
541
- entry: ClientEntry;
542
- } | {
543
- status: number;
544
- problem: ProblemDetails;
545
- entry: null;
546
- });
547
- export interface ClientEntry {
571
+ /**
572
+ * A transient, nonterminal observation for clients and the next model packet. A Notice is never operation-failure truth and cannot determine durable history, lifecycle, scheduling, or recovery. Producers use the open `source` + `kind` discriminator; clients render the producer-owned `level` without inferring semantics from kind names.
573
+ */
574
+ export interface Notice {
548
575
  /**
549
- * The stored entry's durable identifier, or null for a representation core computes.
576
+ * Producer identifier. Top-level for self-contained subsystems; colon-namespaced for parameterized producers such as `provider:openai` or `exec:search`.
550
577
  */
551
- entryId: (number | null);
552
- target: string;
578
+ source: string;
553
579
  /**
554
- * Each channel by name; the empty name is the unnamed default channel of a scheme whose default is unnamed.
580
+ * Open discriminator within a source. Examples include `output_unaccounted`, `search_progress`, and `turn_awaiting_model`.
555
581
  */
556
- channels: {
557
- [k: string]: ClientEntryChannel;
558
- };
559
- }
560
- export interface ClientEntryChannel {
582
+ kind: string;
583
+ /**
584
+ * Display severity set by the producer. It does not make the Notice a durable operation result.
585
+ */
586
+ level: ("error" | "warn" | "info");
587
+ /**
588
+ * Optional model-facing imperative for an observation of the model's own output: `YOU MUST`, `YOU MUST NOT`, `YOU MUST ONLY`, `YOU SHOULD` or `YOU SHOULD NOT`, then the rule. The model packet leads with it; clients display `message`.
589
+ */
590
+ directive?: string;
591
+ /**
592
+ * Optional terse, factual display message.
593
+ */
594
+ message?: (string | null);
595
+ /**
596
+ * Optional typed position for an observation. ContentOffset points into model output; LogCoordinate points at a durable log row without replacing it.
597
+ */
598
+ position?: (ContentOffset | LogCoordinate | null);
599
+ [k: string]: unknown;
600
+ }
601
+ /**
602
+ * A point in model output using the parser-point convention: 1-based line and 0-based Unicode-code-point column. Absence or a null Notice.position represents an unknown location.
603
+ */
604
+ export interface ContentOffset {
605
+ type: "content-offset";
606
+ line: number;
607
+ column: number;
608
+ }
609
+ export interface LogCoordinate {
610
+ type: "log-coordinate";
611
+ /**
612
+ * Log row identity, typically `log:///<loop>/<turn>/<sequence>`.
613
+ */
614
+ coordinate: string;
615
+ /**
616
+ * Optional op token (find/read/edit/...) at the coordinate, for human-readable rendering.
617
+ */
618
+ op?: string;
619
+ }
620
+ export type EntryReadResult = ({
621
+ status: 200;
622
+ entry: ClientEntry;
623
+ } | {
624
+ status: number;
625
+ problem: ProblemDetails;
626
+ entry: null;
627
+ });
628
+ export interface ClientEntry {
629
+ /**
630
+ * The stored entry's durable identifier, or null for a representation core computes.
631
+ */
632
+ entryId: (number | null);
633
+ target: string;
634
+ /**
635
+ * Each channel by name; the empty name is the unnamed default channel of a scheme whose default is unnamed.
636
+ */
637
+ channels: {
638
+ [k: string]: ClientEntryChannel;
639
+ };
640
+ }
641
+ export interface ClientEntryChannel {
561
642
  content: string;
562
643
  contentOffset: number;
563
644
  contentLength: number;
@@ -574,6 +655,10 @@ export interface FunctionalityCandidate {
574
655
  */
575
656
  alias?: string;
576
657
  summary?: string;
658
+ /**
659
+ * Optional family-owned structured presentation facts (for example a members preview's match counts and sample paths). Never credentials, never authority.
660
+ */
661
+ detail?: {};
577
662
  /**
578
663
  * The exact family definition, conforming to the family's definition schema.
579
664
  */
@@ -627,17 +712,46 @@ export interface FunctionalityDiscoverQuery {
627
712
  * 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.
628
713
  */
629
714
  configuration?: {};
715
+ /**
716
+ * Opaque continuation cursor returned by a previous discover page.
717
+ */
718
+ cursor?: string;
719
+ /**
720
+ * Maximum number of candidates or preview items to return on one page.
721
+ */
722
+ limit?: number;
630
723
  }
631
724
  export interface FunctionalityDiscoverResult {
632
725
  family: string;
633
726
  candidates: FunctionalityCandidate[];
727
+ total?: number;
728
+ nextCursor?: string;
634
729
  }
635
730
  /**
636
731
  * One inert discovery result: an exact family definition with its provenance. Discovery never installs, persists, enables, or executes it.
637
732
  */
733
+ export interface FunctionalityListQuery {
734
+ /**
735
+ * Case-insensitive substring filter over alias, provenance, and non-secret definition metadata.
736
+ */
737
+ query?: string;
738
+ /**
739
+ * Filter by current preparation or enablement state.
740
+ */
741
+ state?: ("disabled" | "dormant" | "active" | "unavailable" | "authorization-required");
742
+ /**
743
+ * Filter by definition ownership.
744
+ */
745
+ origin?: ("service" | "workspace" | "session");
746
+ offset?: number;
747
+ limit?: number;
748
+ }
638
749
  export interface FunctionalityListResult {
639
750
  family: string;
640
751
  definitions: FunctionalityDefinitionState[];
752
+ offset: number;
753
+ total: number;
754
+ nextOffset?: number;
641
755
  }
642
756
  /**
643
757
  * The winning configuration input, when supplied by a source reader. Independent of origin and readiness; absent for locally owned definitions or host-provided resources without a configuration input.
@@ -666,6 +780,66 @@ export interface FunctionalityPreparationActivity {
666
780
  phase: ("preparing" | "publishing");
667
781
  since: string;
668
782
  }
783
+ export interface LineMarker {
784
+ /**
785
+ * @minItems 1
786
+ */
787
+ marks: [number, ...(number)[]];
788
+ }
789
+ export type MatcherBody = (XPathBody | RegexBody | JsonPathBody | FtsBody | GraphBody | GlobBody | UnreadableBody);
790
+ /**
791
+ * XPath 1.0 expression. Validated at parse time via the xpath library.
792
+ */
793
+ export interface XPathBody {
794
+ dialect: "xpath";
795
+ raw: string;
796
+ }
797
+ /**
798
+ * ECMAScript regex literal `/pattern/flags`. Escape a literal delimiter as `\/`. Pattern and flags are split out for direct use. `raw` preserves the literal form for round-tripping.
799
+ */
800
+ export interface RegexBody {
801
+ dialect: "regex";
802
+ raw: string;
803
+ pattern: string;
804
+ flags: string;
805
+ }
806
+ /**
807
+ * RFC 9535 JSONPath expression. Compiled at parse time with json-p3, the same engine used for runtime matching.
808
+ */
809
+ export interface JsonPathBody {
810
+ dialect: "jsonpath";
811
+ raw: string;
812
+ }
813
+ /**
814
+ * Native SQLite FTS5 query after the `~` prefix. SQLite owns query validation, tokenization, matching and ranking; the statement's scope selects ordinary result positions.
815
+ */
816
+ export interface FtsBody {
817
+ dialect: "fts";
818
+ raw: string;
819
+ }
820
+ /**
821
+ * Code-graph selection. Body is `&symbol` for definitions, `&<symbol` for references to that name, or `&>symbol` for definitions of its one-hop dependencies. Shape is validated during language admission; resolution happens service-side through the symbol index.
822
+ */
823
+ export interface GraphBody {
824
+ dialect: "graph";
825
+ raw: string;
826
+ }
827
+ /**
828
+ * Pattern with no dialect prefix; treated as a glob/literal match.
829
+ */
830
+ export interface GlobBody {
831
+ dialect: "glob";
832
+ raw: string;
833
+ }
834
+ /**
835
+ * A matcher the parser could not read in the dialect its prefix claims ({§matcher-prefix-claims}): the authored text, the diagnostic, and the working form. The statement is admitted and the operation refuses with that message and recovery; it is never a contract strike.
836
+ */
837
+ export interface UnreadableBody {
838
+ dialect: "unreadable";
839
+ raw: string;
840
+ message: string;
841
+ recovery: string;
842
+ }
669
843
  export type McpOAuth = ({
670
844
  type: "oauth";
671
845
  redirectUrl?: string;
@@ -803,6 +977,10 @@ export interface ModelCatalogPage {
803
977
  offset: number;
804
978
  total: number;
805
979
  nextOffset?: number;
980
+ /**
981
+ * Sorted unique provider ids available in this availability-scoped catalog.
982
+ */
983
+ providers?: string[];
806
984
  }
807
985
  export interface ModelCatalogEntry {
808
986
  selector: string;
@@ -857,62 +1035,34 @@ export interface ModelCatalogQuery {
857
1035
  offset?: number;
858
1036
  limit?: number;
859
1037
  }
860
- export interface ModelRoute {
861
- alias?: string;
862
- provider: string;
863
- model: string;
864
- effort?: Effort;
865
- /**
866
- * Whether effort was chosen through setSessionEffort (explicit) or seeded from the alias configuration (default). Present exactly when effort is.
867
- */
868
- effortSource?: ("default" | "explicit");
869
- }
870
- export interface Notice {
871
- /**
872
- * Producer identifier. Top-level for self-contained subsystems; colon-namespaced for parameterized producers such as `provider:openai` or `exec:search`.
873
- */
874
- source: string;
875
- /**
876
- * Open discriminator within a source. Examples include `output_unaccounted`, `search_progress`, and `turn_awaiting_model`.
877
- */
878
- kind: string;
879
- /**
880
- * Display severity set by the producer. It does not make the Notice a durable operation result.
881
- */
882
- level: ("error" | "warn" | "info");
883
- /**
884
- * Optional model-facing imperative for an observation of the model's own output: `YOU MUST`, `YOU MUST NOT`, `YOU MUST ONLY`, `YOU SHOULD` or `YOU SHOULD NOT`, then the rule. The model packet leads with it; clients display `message`.
885
- */
886
- directive?: string;
887
- /**
888
- * Optional terse, factual display message.
889
- */
890
- message?: (string | null);
891
- /**
892
- * Optional typed position for an observation. ContentOffset points into model output; LogCoordinate points at a durable log row without replacing it.
893
- */
894
- position?: (ContentOffset | LogCoordinate | null);
895
- [k: string]: unknown;
896
- }
1038
+ export type ParsedPath = (LocalPath | UrlPath);
897
1039
  /**
898
- * A point in model output using the parser-point convention: 1-based line and 0-based Unicode-code-point column. Absence or a null Notice.position represents an unknown location.
1040
+ * A bare local path with no `scheme://` prefix. `raw` is the path as authored, minus any `#channel`, which is `fragment` exactly as on a URL; resolution is the runtime's job.
899
1041
  */
900
- export interface ContentOffset {
901
- type: "content-offset";
902
- line: number;
903
- column: number;
1042
+ export interface LocalPath {
1043
+ kind: "local";
1044
+ raw: string;
1045
+ fragment?: (string | null);
904
1046
  }
905
- export interface LogCoordinate {
906
- type: "log-coordinate";
907
- /**
908
- * Log row identity, typically `log:///<loop>/<turn>/<sequence>`.
909
- */
910
- coordinate: string;
1047
+ /**
1048
+ * A path with a `scheme://` prefix, fully decomposed via WHATWG URL.
1049
+ */
1050
+ export interface UrlPath {
1051
+ kind: "url";
1052
+ raw: string;
1053
+ scheme: string;
1054
+ username: (string | null);
1055
+ password: (string | null);
1056
+ hostname: (string | null);
1057
+ port: (number | null);
1058
+ pathname: string;
911
1059
  /**
912
- * Optional op token (find/read/edit/...) at the coordinate, for human-readable rendering.
1060
+ * Canonical serialized WHATWG query component without the leading `?`. Null means no query; the empty string means an explicit empty query (`?`). Ordering, duplicate names, and encoded spelling are preserved.
913
1061
  */
914
- op?: string;
1062
+ query: (string | null);
1063
+ fragment: (string | null);
915
1064
  }
1065
+ export type PlurnkStatement = (FindStatement | ReadStatement | EditStatement | CopyStatement | MoveStatement | SendStatement | DoneStatement | FailStatement | ExecStatement | BareStatement | WorkStatement | ForkStatement | KillStatement | DispositionStatement | NoteStatement);
916
1066
  export type AsideOrNull = (string | null);
917
1067
  /**
918
1068
  * Optional HTTP request headers (`{ [name: string]: string }`); null when omitted.
@@ -934,6 +1084,221 @@ export type TextLineMarkerOrNull = (TextLineMarker | null);
934
1084
  */
935
1085
  export type AttachmentsOrNull = (string[] | null);
936
1086
  export type SendBodyOrNull = (SendBody | null);
1087
+ export interface FindStatement {
1088
+ op: "find";
1089
+ aside: AsideOrNull;
1090
+ headers: HeadersOrNull;
1091
+ target: PathOrNull;
1092
+ lineMarker: LineMarkerOrNull;
1093
+ /**
1094
+ * The selection matcher lifted from the `pattern` option ({§parse-recovery}); null when omitted.
1095
+ */
1096
+ matcher: (MatcherBody | null);
1097
+ /**
1098
+ * Retrieval bodies normalize to separate `note` statements; selection belongs to the options ({§op-shapes}).
1099
+ */
1100
+ body: null;
1101
+ position: Position;
1102
+ }
1103
+ /**
1104
+ * A bare local path with no `scheme://` prefix. `raw` is the path as authored, minus any `#channel`, which is `fragment` exactly as on a URL; resolution is the runtime's job.
1105
+ */
1106
+ export interface Position {
1107
+ line: number;
1108
+ column: number;
1109
+ }
1110
+ export interface ReadStatement {
1111
+ op: "read";
1112
+ aside: AsideOrNull;
1113
+ headers: HeadersOrNull;
1114
+ target: PathOrNull;
1115
+ lineMarker: TextLineMarkerOrNull;
1116
+ /**
1117
+ * The selection matcher lifted from the `pattern` option ({§parse-recovery}); null when omitted.
1118
+ */
1119
+ matcher: (MatcherBody | null);
1120
+ body: null;
1121
+ position: Position;
1122
+ }
1123
+ /**
1124
+ * The ordered components parsed from a text-coordinate <scope>. A line position may be numeric or a rendered five-character Base62 line anchor; columns remain numeric. Core resolves anchors against the addressed current text before a numeric scope reaches its operation owner.
1125
+ */
1126
+ export interface TextLineMarker {
1127
+ /**
1128
+ * @minItems 1
1129
+ */
1130
+ marks: [(number | string), ...((number | string))[]];
1131
+ }
1132
+ export interface EditStatement {
1133
+ op: "edit";
1134
+ aside: AsideOrNull;
1135
+ headers: HeadersOrNull;
1136
+ target: PathOrNull;
1137
+ lineMarker: TextLineMarkerOrNull;
1138
+ /**
1139
+ * The selection matcher lifted from the `pattern` option ({§parse-recovery}); null when omitted.
1140
+ */
1141
+ matcher: (MatcherBody | null);
1142
+ body: (string | null);
1143
+ position: Position;
1144
+ }
1145
+ export interface CopyStatement {
1146
+ op: "copy";
1147
+ aside: AsideOrNull;
1148
+ source: ResourceSelection;
1149
+ destination: ResourceSelection;
1150
+ position: Position;
1151
+ }
1152
+ /**
1153
+ * One `copy`/`move` resource operand. A target without a fragment selects the scheme's default channel; a fragment selects a named channel; headers belong to an HTTP(S) endpoint; lineMarker scopes the selected textual content.
1154
+ */
1155
+ export interface ResourceSelection {
1156
+ target: ParsedPath;
1157
+ /**
1158
+ * Optional HTTP request headers owned by this operand's addressed endpoint; null when omitted.
1159
+ */
1160
+ headers: ({
1161
+ [k: string]: string;
1162
+ } | null);
1163
+ lineMarker: (TextLineMarker | null);
1164
+ /**
1165
+ * Optional selection matcher on the source operand; refused by the owner on a destination.
1166
+ */
1167
+ matcher: (MatcherBody | null);
1168
+ }
1169
+ export interface MoveStatement {
1170
+ op: "move";
1171
+ aside: AsideOrNull;
1172
+ source: ResourceSelection;
1173
+ destination: ResourceSelection;
1174
+ position: Position;
1175
+ }
1176
+ export interface SendStatement {
1177
+ op: "send";
1178
+ aside: AsideOrNull;
1179
+ headers: HeadersOrNull;
1180
+ attachments: AttachmentsOrNull;
1181
+ target: PathOrNull;
1182
+ lineMarker: null;
1183
+ body: SendBodyOrNull;
1184
+ actor?: (string | null);
1185
+ position: Position;
1186
+ }
1187
+ /**
1188
+ * Parsed body of a `send`, `done`, or `fail` statement. `raw` is the literal body text; `json` is the best-effort `JSON.parse(raw)` result, or null when the body isn't valid JSON.
1189
+ */
1190
+ export interface SendBody {
1191
+ raw: string;
1192
+ json: unknown;
1193
+ }
1194
+ export interface DoneStatement {
1195
+ op: "done";
1196
+ aside: AsideOrNull;
1197
+ attachments: AttachmentsOrNull;
1198
+ target: PathOrNull;
1199
+ lineMarker: null;
1200
+ body: SendBodyOrNull;
1201
+ position: Position;
1202
+ }
1203
+ export interface FailStatement {
1204
+ op: "fail";
1205
+ aside: AsideOrNull;
1206
+ attachments: AttachmentsOrNull;
1207
+ target: PathOrNull;
1208
+ lineMarker: null;
1209
+ body: SendBodyOrNull;
1210
+ position: Position;
1211
+ }
1212
+ export interface ExecStatement {
1213
+ /**
1214
+ * The runtime tag the call names, in its registered lowercase spelling. An execution has no operation keyword: the call name is the runtime, and the log row's op shows it as written.
1215
+ */
1216
+ runtime: Lowercase<string>;
1217
+ /**
1218
+ * Never present: an execution is named by its runtime.
1219
+ */
1220
+ op?: never;
1221
+ aside: AsideOrNull;
1222
+ target: PathOrNull;
1223
+ cwd?: (string | null);
1224
+ /**
1225
+ * Optional per-invocation environment variables (`{ [name: string]: string }`).
1226
+ */
1227
+ env?: Readonly<Record<string, string>>;
1228
+ lineMarker: LineMarkerOrNull;
1229
+ body: (string | null);
1230
+ position: Position;
1231
+ }
1232
+ export interface BareStatement {
1233
+ op: "bare";
1234
+ aside: AsideOrNull;
1235
+ target: PathOrNull;
1236
+ lineMarker: null;
1237
+ body: string;
1238
+ position: Position;
1239
+ }
1240
+ export interface WorkStatement {
1241
+ op: "work";
1242
+ aside: AsideOrNull;
1243
+ target: PathOrNull;
1244
+ lineMarker: null;
1245
+ body: string;
1246
+ persona?: string;
1247
+ model?: string;
1248
+ effort?: string;
1249
+ position: Position;
1250
+ }
1251
+ export interface ForkStatement {
1252
+ op: "fork";
1253
+ aside: AsideOrNull;
1254
+ target: PathOrNull;
1255
+ lineMarker: null;
1256
+ body: string;
1257
+ persona?: string;
1258
+ model?: string;
1259
+ effort?: string;
1260
+ position: Position;
1261
+ }
1262
+ export interface KillStatement {
1263
+ op: "kill";
1264
+ aside: AsideOrNull;
1265
+ headers: HeadersOrNull;
1266
+ /**
1267
+ * Optional confirmation for remote HTTP DELETE (`true`); null when omitted.
1268
+ */
1269
+ remote: (boolean | null);
1270
+ target: PathOrNull;
1271
+ /**
1272
+ * Scope of the kill: lines of a log body or of an entry ({§op-shapes}); null kills the whole target.
1273
+ */
1274
+ lineMarker: (TextLineMarker | null);
1275
+ /**
1276
+ * The selection matcher lifted from the `pattern` option ({§parse-recovery}); null when omitted.
1277
+ */
1278
+ matcher: (MatcherBody | null);
1279
+ body: null;
1280
+ position: Position;
1281
+ }
1282
+ export interface DispositionStatement {
1283
+ op: "wait";
1284
+ aside: AsideOrNull;
1285
+ target: PathOrNull;
1286
+ lineMarker: null;
1287
+ /**
1288
+ * Optional maximum park duration from `timeout` option; zero continues without parking.
1289
+ */
1290
+ seconds: (number | null);
1291
+ body: (string | null);
1292
+ position: Position;
1293
+ }
1294
+ export interface NoteStatement {
1295
+ op: "note";
1296
+ aside: AsideOrNull;
1297
+ target: null;
1298
+ lineMarker: null;
1299
+ body: (string | null);
1300
+ position: Position;
1301
+ }
937
1302
  export interface ProblemProjection {
938
1303
  /**
939
1304
  * Absolute URI identifying the stable problem class.
@@ -960,124 +1325,7 @@ export interface ProblemProjection {
960
1325
  instance?: never;
961
1326
  [k: string]: unknown;
962
1327
  }
963
- export type ProposalDisposition = ({
964
- decision: "review";
965
- } | {
966
- decision: ("accept" | "reject");
967
- outcome?: string;
968
- });
969
1328
  export type ProposalPolicy = ("review" | "accept" | "reject");
970
- export interface ProposalProjection {
971
- logEntryId: number;
972
- sessionId: number;
973
- /**
974
- * The requesting session's name.
975
- */
976
- session: string;
977
- loopId: number;
978
- turnId: number;
979
- /**
980
- * The gated operation's log coordinate, loop/turn/sequence: the id of the call it is.
981
- */
982
- coordinate: string;
983
- /**
984
- * An operation keyword, or a runtime tag: an execution's operation is its runtime.
985
- */
986
- op: "find" | "read" | "edit" | "copy" | "move" | "send" | "done" | "fail" | "bare" | "work" | "fork" | "kill" | "note" | "wait" | Lowercase<string>;
987
- target: {
988
- scheme: (string | null);
989
- authority: (string | null);
990
- pathname: (string | null);
991
- };
992
- body: string;
993
- attrs: {
994
- [k: string]: unknown;
995
- };
996
- owner: string;
997
- disposition: ProposalDisposition;
998
- selector?: CapabilitySelector;
999
- /**
1000
- * Structured ACP v2 permission subject for the proposed operation.
1001
- */
1002
- subject?: ({
1003
- type: "command";
1004
- command: string;
1005
- cwd: string;
1006
- } | {
1007
- type: "tool_call";
1008
- kind: ("read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "other");
1009
- title: string;
1010
- locations?: {
1011
- path: string;
1012
- }[];
1013
- diff?: {
1014
- path: string;
1015
- patch: string;
1016
- };
1017
- });
1018
- /**
1019
- * When the gate stops waiting and core cancels it (ISO 8601); absent while it waits indefinitely.
1020
- */
1021
- expiresAt?: string;
1022
- }
1023
- /**
1024
- * The capability selector for the proposed operation, persisted on allow_always / reject_always.
1025
- */
1026
- export type ProviderCost = ({
1027
- kind: "charged";
1028
- amount: MonetaryAmount;
1029
- usdEquivalent?: string;
1030
- source: string;
1031
- } | {
1032
- kind: "estimated";
1033
- amount: MonetaryAmount;
1034
- source: string;
1035
- } | {
1036
- kind: "unknown";
1037
- reason: string;
1038
- });
1039
- /**
1040
- * Ordered physical provider-request evidence and its deterministic aggregate projection.
1041
- */
1042
- export interface ProviderAccounting {
1043
- requests: ProviderRequestAccounting[];
1044
- usage: (ProviderUsage | null);
1045
- knownUsage: (ProviderUsage | null);
1046
- knownCostUsd: (string | null);
1047
- costUsd: (string | null);
1048
- }
1049
- /**
1050
- * The normalized accounting disposition of one physical provider request.
1051
- */
1052
- export interface ProviderRequestAccounting {
1053
- provider: string;
1054
- model: string;
1055
- outcome: ("response" | "error");
1056
- status?: number;
1057
- usage?: ProviderUsage;
1058
- cost: ProviderCost;
1059
- }
1060
- /**
1061
- * Token quantities. Physical-request instances enforce their partition identities. ProviderAccounting distinguishes complete usage from knownUsage subtotals. Omitted fields are unknown; explicit zero is observed or exactly derived.
1062
- */
1063
- export interface ProviderUsage {
1064
- inputTokens?: number;
1065
- outputTokens?: number;
1066
- totalTokens?: number;
1067
- inputTokenDetails?: {
1068
- noCacheTokens?: number;
1069
- cacheReadTokens?: number;
1070
- cacheWriteTokens?: number;
1071
- };
1072
- outputTokenDetails?: {
1073
- textTokens?: number;
1074
- reasoningTokens?: number;
1075
- };
1076
- }
1077
- export interface MonetaryAmount {
1078
- amount: string;
1079
- currency: string;
1080
- }
1081
1329
  export type DecimalAmount = string;
1082
1330
  export type NonEmptyString = string;
1083
1331
  export type Tokens = number;