@openwop/openwop 1.8.0 → 2.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 (60) hide show
  1. package/README.md +64 -117
  2. package/dist/client.d.ts +131 -245
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +233 -440
  5. package/dist/client.js.map +1 -1
  6. package/dist/cost-attribution.d.ts +2 -2
  7. package/dist/cost-attribution.js +2 -2
  8. package/dist/envelope-directive.d.ts +1 -1
  9. package/dist/envelope-directive.js +1 -1
  10. package/dist/event-helpers.js +1 -1
  11. package/dist/event-helpers.js.map +1 -1
  12. package/dist/generated.d.ts +17 -0
  13. package/dist/generated.d.ts.map +1 -0
  14. package/dist/generated.js +311 -0
  15. package/dist/generated.js.map +1 -0
  16. package/dist/index.d.ts +16 -16
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +26 -53
  19. package/dist/index.js.map +1 -1
  20. package/dist/run-helpers.d.ts +20 -21
  21. package/dist/run-helpers.d.ts.map +1 -1
  22. package/dist/run-helpers.js +23 -72
  23. package/dist/run-helpers.js.map +1 -1
  24. package/dist/sse.d.ts +33 -15
  25. package/dist/sse.d.ts.map +1 -1
  26. package/dist/sse.js +28 -30
  27. package/dist/sse.js.map +1 -1
  28. package/dist/types.d.ts +253 -559
  29. package/dist/types.d.ts.map +1 -1
  30. package/dist/types.js.map +1 -1
  31. package/dist/webhook-header-families.d.ts +42 -0
  32. package/dist/webhook-header-families.d.ts.map +1 -0
  33. package/dist/webhook-header-families.js +58 -0
  34. package/dist/webhook-header-families.js.map +1 -0
  35. package/dist/webhook-helpers.browser.d.ts +15 -28
  36. package/dist/webhook-helpers.browser.d.ts.map +1 -1
  37. package/dist/webhook-helpers.browser.js +16 -27
  38. package/dist/webhook-helpers.browser.js.map +1 -1
  39. package/dist/webhook-helpers.d.ts +48 -32
  40. package/dist/webhook-helpers.d.ts.map +1 -1
  41. package/dist/webhook-helpers.js +52 -37
  42. package/dist/webhook-helpers.js.map +1 -1
  43. package/package.json +6 -4
  44. package/src/client.ts +255 -454
  45. package/src/cost-attribution.ts +2 -2
  46. package/src/envelope-directive.ts +1 -1
  47. package/src/event-helpers.ts +1 -1
  48. package/src/generated.ts +322 -0
  49. package/src/index.ts +78 -105
  50. package/src/run-helpers.ts +27 -85
  51. package/src/sse.ts +63 -42
  52. package/src/types.ts +268 -603
  53. package/src/webhook-header-families.ts +78 -0
  54. package/src/webhook-helpers.browser.ts +24 -28
  55. package/src/webhook-helpers.ts +87 -39
  56. package/dist/registry-helpers.d.ts +0 -118
  57. package/dist/registry-helpers.d.ts.map +0 -1
  58. package/dist/registry-helpers.js +0 -82
  59. package/dist/registry-helpers.js.map +0 -1
  60. package/src/registry-helpers.ts +0 -173
package/dist/types.d.ts CHANGED
@@ -10,184 +10,13 @@
10
10
  * Consumers wanting exhaustive narrowing should `as const` their checks
11
11
  * rather than relying on the SDK to refuse unknown values.
12
12
  */
13
+ import type { CapabilityFamilyKey, ErrorCode } from './generated.js';
13
14
  /** Run statuses per `RunSnapshot.status` in OpenAPI. */
14
15
  export type RunStatus = 'pending' | 'running' | 'paused' | 'waiting-approval' | 'waiting-input' | 'waiting-external' | 'completed' | 'failed'
15
16
  /** RFC 0094 §B — transitional state between a cancel request being
16
17
  * accepted and the terminal `cancelled`. Non-terminal: a snapshot
17
18
  * read during the cancel cascade carries it. */
18
19
  | 'cancelling' | 'cancelled';
19
- export interface Capabilities {
20
- protocolVersion: string;
21
- supportedEnvelopes: readonly string[];
22
- schemaVersions: Record<string, number>;
23
- limits: {
24
- clarificationRounds: number;
25
- schemaRounds: number;
26
- envelopesPerTurn: number;
27
- maxNodeExecutions?: number;
28
- /** RFC 0058. Engine-side wall-clock ceiling per run (ms); upper bound for `RunConfigurable.runTimeoutMs`. */
29
- maxRunDurationMs?: number;
30
- /** RFC 0058. Engine-side agent-loop iteration ceiling; upper bound for `RunConfigurable.maxLoopIterations`. */
31
- maxLoopIterations?: number;
32
- /** RFC 0094 §H. Maximum REST request body size (bytes) the host
33
- * accepts. Hosts that advertise it MUST enforce it. */
34
- maxRequestBodyBytes?: number;
35
- };
36
- /** RFC 0094 §H. gRPC transport advertisement per `grpc-transport.md`
37
- * §"Capability advertisement". Absent ⇒ the host exposes no gRPC
38
- * transport. A host that exposes the gRPC surface advertises this
39
- * block AND includes `'grpc'` in `supportedTransports`. REST + SSE
40
- * remain exposed regardless. */
41
- grpc?: {
42
- /** Toggle — `true` when the gRPC surface is live. */
43
- supported: boolean;
44
- /** Full URI: `grpc://` (cleartext, intra-trusted-network only) OR
45
- * `grpcs://` (TLS). Hosts SHOULD require TLS in production. */
46
- endpoint?: string;
47
- /** Canonical service name. v1 hosts MUST use `openwop.v1.Engine`. */
48
- service: 'openwop.v1.Engine';
49
- /** TLS posture. Production hosts MUST set `'required'`. */
50
- tls: 'required' | 'optional' | 'disabled';
51
- };
52
- /** RFC 0101. Multi-party group-conversation advertisement. Absent ⇒ the
53
- * host does not support N agents co-participating in one shared
54
- * transcript (the single user + single driving agent shape of RFC 0005
55
- * remains). When `supported: true`, the host honors the additive
56
- * `participants: AgentRef[]` roster on `conversation.opened` and the
57
- * conditionally-required per-turn `speakerId` on `role: 'agent'`
58
- * conversation turns — advertising `supported: true` without enforcing
59
- * both is a dishonest claim (`OPENWOP_REQUIRE_BEHAVIOR=true` fails it). */
60
- multiPartyConversation?: {
61
- /** Toggle — `true` when the host supports multi-party conversations. */
62
- supported: boolean;
63
- /** Upper bound on `participants[]` size the host accepts. Absent ⇒
64
- * host-defined / unbounded. */
65
- maxParticipants?: number;
66
- };
67
- /** RFC 0100. Host exposes itself as an A2A (Agent2Agent) agent. `supported`
68
- * alone ⇒ the synchronous `message/send` → poll `tasks/get` round-trip
69
- * (`a2a-integration.md`). The optional flags gate the RFC 0100 async/durable
70
- * additions. Absent ⇒ no A2A advertisement. */
71
- a2a?: {
72
- /** Host exposes itself as an A2A agent. */
73
- supported: boolean;
74
- /** A2A 0.3 well-known agent card URL (`/.well-known/agent-card.json`). */
75
- agentCardUrl: string;
76
- /** `message/stream` + `tasks/resubscribe` (RFC 0100 §3 resubscribe re-attach). */
77
- streaming?: boolean;
78
- /** A2A push-notification config (RFC 0100 §4); a caller-supplied
79
- * `pushConfig.url` is SSRF-validated (`a2a-push-egress-ssrf`). */
80
- pushNotifications?: boolean;
81
- /** RFC 0100 §2. Host persists the projected `A2ATaskState` per backing run;
82
- * `tasks/get` returns live state after disconnect. Absent/false ⇒
83
- * synchronous round-trip only. */
84
- durableTasks?: boolean;
85
- };
86
- /** RFC 0109. Host stamps the optional non-secret `agent.model`
87
- * (`{ provider, model }`) on `role:'agent'` conversation turns, recording
88
- * which model produced the turn (read verbatim on `:fork`). Absent ⇒ no
89
- * provenance; the host omits `agent.model`. */
90
- conversationTurnModelProvenance?: {
91
- /** Toggle — `true` when the host stamps `agent.model`. */
92
- supported: boolean;
93
- };
94
- /** RFC 0110. Host emits the ephemeral `channel.presence` RunEvent (online +
95
- * per-member typing) for `type:'channel'` conversations. Presence is live
96
- * state — the host never persists it to the replayable event log and it
97
- * never affects replay / `:fork`. Membership-gated (default-deny, CTI-1).
98
- * Absent ⇒ no presence. */
99
- channelPresence?: {
100
- /** Toggle — `true` when the host emits `channel.presence`. */
101
- supported: boolean;
102
- };
103
- /** Capability advertisement for the host AI-proxy (`aiProviders` in
104
- * `capabilities.md`). Absent ⇒ the host advertises no AI-proxy surface.
105
- * Carries BYOK policy plus the RFC 0105/0106/0108 self-hosted / speech /
106
- * real-time-voice flags. The wire object MAY carry additional fields
107
- * (`input`, `authModes`, `maxInlineMediaBytes`) not modeled here. */
108
- aiProviders?: AIProvidersCapability;
109
- /** RFC 0104. Portable HITL approver-routing advertisement. When
110
- * `approverRouting.supported`, the host honors the OPTIONAL, ADVISORY
111
- * `approverGroupRefs` / `approverRoleRefs` / `audience` fields on the
112
- * `kind:'approval'` interrupt payload (the SDK carries the interrupt
113
- * payload opaquely as `data`, so those advisory fields ride that opaque
114
- * object), resolves the advertised `refKinds` against its own RBAC, and
115
- * ENFORCES eligibility at resolve time. Absent ⇒ the host ignores them. */
116
- interrupt?: {
117
- approverRouting?: {
118
- /** Host honors the RFC 0104 approver-routing fields. */
119
- supported: boolean;
120
- /** Ref kinds the host actually resolves: `'group'` ⇒ honors
121
- * `approverGroupRefs`, `'role'` ⇒ honors `approverRoleRefs`. Absent ⇒
122
- * advisory-only passthrough (the host resolves neither). */
123
- refKinds?: readonly ('group' | 'role')[];
124
- /** Host honors the `audience` notification-targeting override.
125
- * Absent/`false` ⇒ the host notifies the resolved eligible union. */
126
- audience?: boolean;
127
- };
128
- };
129
- /** RFC 0007 + RFC 0118. Top-level `core.dispatch` capability descriptors
130
- * (`capabilities.md` §`dispatch`). This is the discovery surface for
131
- * parallel sub-workflow fan-out/join. NOTE: distinct from the legacy
132
- * boolean {@link AgentsCapability.dispatch} — `dispatch.supported` here
133
- * carries the SAME "host implements the `core.dispatch` Core typeId"
134
- * meaning, exposed top-level per `capabilities.md` (the corpus advertises
135
- * it both nested under `agents` and at the doc root; absent ⇒ the host
136
- * advertises no top-level dispatch descriptors). Read-only. */
137
- dispatch?: DispatchCapability;
138
- /** RFC 0117 (amended by RFC 0119). Host loads SIGNED, SANDBOXED front-end
139
- * plugin packs (`kind:"frontend-plugin"`) in an origin/execution-isolated
140
- * sandbox and talks to them over the closed `ui-plugin/1` host-RPC boundary
141
- * (`capabilities.md` §`uiPlugins`). This is the DISCOVERY surface only — the
142
- * `ui-plugin/1` RPC envelope + the `frontend-plugin` manifest are a
143
- * renderer/registry concern the SDK does not model (as with the RFC 0102
144
- * A2UI `surface` and RFC 0071 pack manifests). Absent ⇒ the host loads no
145
- * plugin packs (graceful degradation to RFC 0071 host rendering). Read-only. */
146
- uiPlugins?: UiPluginsCapability;
147
- /** RFC 0113. Agent-memory capability descriptors. `injectionBudget` advertises
148
- * that the host honors `MemoryListOptions.tokenBudget` (a token-bounded
149
- * prefix of the ranked, SR-1-redacted, single-tenant entry list). Absent ⇒
150
- * a supplied `tokenBudget` is ignored (today's `limit`/`tag` behavior).
151
- * Read-only; the wire `memory` block MAY carry other descriptors not modeled
152
- * here (e.g. `search`). */
153
- memory?: {
154
- injectionBudget?: {
155
- /** Host honors `MemoryListOptions.tokenBudget` (RFC 0113). */
156
- supported: boolean;
157
- /** Unit `tokenBudget` is denominated in. `chars` counts UTF-8/Unicode
158
- * characters of the entry `content` (tokenizer-free). */
159
- tokenCounter?: 'o200k_base' | 'cl100k_base' | 'chars' | 'host-defined';
160
- };
161
- };
162
- /** RFC 0115. Conditional-GET + Content-Encoding negotiation on run reads
163
- * (`GET /v1/runs/{runId}`). Absent ⇒ the host returns today's `200` +
164
- * identity body. Distinct from the file-egress `fileHandling.transport`
165
- * (ftp/sftp/ssh) sub-capability — this advertises HTTP-layer poll economy
166
- * on the run-read REST surface. Read-only. */
167
- restTransport?: {
168
- /** Host emits a strong, event-log-sequence-derived `ETag` on
169
- * `GET /v1/runs/{runId}` and honors `If-None-Match` with a `304 Not
170
- * Modified` (empty body) when the validator matches the current state. */
171
- conditionalRunGet?: boolean;
172
- /** Content-Encoding values the host will negotiate on run reads. `gzip`
173
- * is the baseline; `br`/`zstd` are optional — the host advertises only
174
- * the subset it can serve. For each advertised value the decoded body is
175
- * byte-identical to the identity body. */
176
- contentEncodings?: readonly ('gzip' | 'br' | 'zstd')[];
177
- };
178
- extensions?: Record<string, unknown>;
179
- implementation?: {
180
- name?: string;
181
- version?: string;
182
- vendor?: string;
183
- };
184
- engineVersion?: number;
185
- eventLogSchemaVersion?: number;
186
- supportedTransports?: readonly ('rest' | 'mcp' | 'a2a' | 'grpc')[];
187
- configurable?: Record<string, unknown>;
188
- observability?: Record<string, unknown>;
189
- minClientVersion?: string;
190
- }
191
20
  /**
192
21
  * The `kind` discriminator on a `cap.breached` event payload
193
22
  * (`run-event-payloads.schema.json#capBreached`). The four engine kinds, the
@@ -202,13 +31,24 @@ export type CapBreachedKind = 'clarification' | 'schema' | 'envelopes' | 'node-e
202
31
  * does not advertise `capabilities.compensation` omits the field; an
203
32
  * advertising host carries it on every snapshot, `none` when idle. The
204
33
  * value is the deterministic fold of the `compensation.*` events defined in
205
- * `spec/v1/compensation.md §"Run rollup: compensationStatus"`.
34
+ * `spec/v2/core/compensation.md §"Run rollup: compensationStatus"`.
206
35
  */
207
36
  export type CompensationStatus = 'none' | 'pending' | 'running' | 'completed' | 'partial' | 'failed' | 'manual';
37
+ /** `RunSnapshot.owner` — closed; `subject` REQUIRED (identity.md). */
38
+ export interface RunOwner {
39
+ tenant: string;
40
+ workspace?: string;
41
+ subject: string;
42
+ }
43
+ /** `schemas/v2/run-snapshot.schema.json` — the fold of the event log through the run projection (runs.md §Snapshot). */
208
44
  export interface RunSnapshot {
209
45
  runId: string;
210
46
  workflowId: string;
211
47
  status: RunStatus;
48
+ owner: RunOwner;
49
+ /** The era key, integer ≥ 2; a v2 host stamps `3` on every run it creates. */
50
+ eventLogSchemaVersion: number;
51
+ engineVersion?: number;
212
52
  /** RFC 0151 §D. Present iff the host advertises `capabilities.compensation`.
213
53
  * See {@link CompensationStatus}. */
214
54
  compensationStatus?: CompensationStatus;
@@ -218,9 +58,31 @@ export interface RunSnapshot {
218
58
  nodeStates?: Record<string, unknown>;
219
59
  variables?: Record<string, unknown>;
220
60
  channels?: Record<string, unknown>;
61
+ /** `{ code, message, details? }` on terminal `failed`. */
221
62
  error?: {
222
- code?: string;
223
- message?: string;
63
+ code: string;
64
+ message: string;
65
+ details?: Record<string, unknown>;
66
+ };
67
+ /** The persisted `RunOptions` (runs.md §Run options). */
68
+ configurable?: RunConfigurable;
69
+ tags?: readonly string[];
70
+ metadata?: Record<string, unknown>;
71
+ agent?: AgentRef;
72
+ /** MUST NOT change for the run's lifetime. */
73
+ runOrchestrator?: AgentRef;
74
+ metrics?: {
75
+ openwopCost?: {
76
+ usd?: number;
77
+ tokens?: {
78
+ input?: number;
79
+ output?: number;
80
+ };
81
+ model?: string;
82
+ provider?: string;
83
+ duration_ms?: number;
84
+ };
85
+ [key: string]: unknown;
224
86
  };
225
87
  /** Linkage back to the parent run when this run was spawned via
226
88
  * `core.subWorkflow`. Per `interrupt-profiles.md §openwop-interrupt-
@@ -230,7 +92,7 @@ export interface RunSnapshot {
230
92
  parentNodeId?: string;
231
93
  /** Surfaced for `waiting-*` runs per `interrupt.md §"Signed-token
232
94
  * callback"`. Carries the open interrupt's metadata so clients can
233
- * resolve via `POST /v1/interrupts/{token}` without consulting a
95
+ * resolve via `POST /interrupts/{token}` without consulting a
234
96
  * separate endpoint. Hosts MAY omit `data` to keep payloads small;
235
97
  * the token + callbackUrl are the load-bearing fields. */
236
98
  interrupt?: {
@@ -242,32 +104,48 @@ export interface RunSnapshot {
242
104
  };
243
105
  }
244
106
  /**
245
- * Per-run parameter overlay carried in `RunOptions.configurable`. Reserved
246
- * keys are typed; unknown keys are passed through verbatim. See
247
- * `run-options.md`.
107
+ * `schemas/v2/configurable.schema.json` closed, nested and versioned (RFC
108
+ * 0171 §D.1; runs.md §Run options). `version` is REQUIRED and is `1`. An
109
+ * unknown root key, an unknown key inside a section, or a dotted key is
110
+ * rejected with `400 validation_error`; vendor keys live under
111
+ * `extensions.<org>`.
248
112
  */
249
113
  export interface RunConfigurable {
250
- /** Override the per-run node-execution ceiling. Clamped server-side. */
251
- recursionLimit?: number;
252
- /** RFC 0058. Wall-clock run deadline (ms from `run.started`); clamped to
253
- * `Capabilities.limits.maxRunDurationMs`. Breach → `cap.breached
254
- * { kind: 'run-duration' }` + `run_timeout`. */
255
- runTimeoutMs?: number;
256
- /** RFC 0058. Agent-loop iteration ceiling (one per orchestrator turn);
257
- * clamped to `Capabilities.limits.maxLoopIterations`. Breach →
258
- * `cap.breached { kind: 'loop-iterations' }` + `loop_limit_exceeded`.
259
- * Ignored unless the host advertises `capabilities.agents.loop.supported`. */
260
- maxLoopIterations?: number;
261
- /** Override AI model for nodes that consume `ctx.config.configurable.model`. */
262
- model?: string;
263
- /** Override AI temperature (server SHOULD enforce 0..2). */
264
- temperature?: number;
265
- /** Override AI max-tokens cap. */
266
- maxTokens?: number;
267
- /** Per-prompt-ID variant override map. */
268
- promptOverrides?: Record<string, string>;
269
- /** Implementation-specific extensions; passed through verbatim. */
270
- [key: string]: unknown;
114
+ version: 1;
115
+ run?: {
116
+ /** Clamped to `limits.maxNodeExecutions`. */
117
+ recursionLimit?: number;
118
+ /** Resolves to `min(runTimeoutMs, limits.maxRunDurationMs)`; breach → `run_timeout`. */
119
+ runTimeoutMs?: number;
120
+ /** Resolves against `limits.maxLoopIterations`; breach `loop_limit_exceeded`. */
121
+ maxLoopIterations?: number;
122
+ /** The `low-confidence` interrupt threshold. */
123
+ escalationThreshold?: number;
124
+ };
125
+ ai?: {
126
+ /** MUST be in `aiProviders.supported`, else `400 validation_error`. */
127
+ provider?: string;
128
+ model?: string;
129
+ /** 0..2 */
130
+ temperature?: number;
131
+ maxTokens?: number;
132
+ /** References a provider in `aiProviders.byok`; never carries key material. */
133
+ credentialRef?: string;
134
+ promptOverrides?: Record<string, string>;
135
+ /** Test-keys-only; `403 mock_provider_forbidden` on a production credential. */
136
+ mockProvider?: string;
137
+ reasoningVerbosity?: 'none' | 'summary' | 'full';
138
+ /** The `envelope.refusal` ceiling (events.md E5). */
139
+ maxRefusals?: number;
140
+ };
141
+ distillation?: {
142
+ /** Resolves to `min(tokenBudget, memory.distillation.maxTokenBudget)`. */
143
+ tokenBudget?: number;
144
+ };
145
+ /** `schemas/v2/budget-policy.schema.json`. */
146
+ budget?: Record<string, unknown>;
147
+ /** A vendor key lives under its registered org and nowhere else. */
148
+ extensions?: Record<string, Record<string, unknown>>;
271
149
  }
272
150
  export interface CreateRunRequest {
273
151
  /**
@@ -279,6 +157,12 @@ export interface CreateRunRequest {
279
157
  inputs?: Record<string, unknown>;
280
158
  tenantId?: string;
281
159
  scopeId?: string;
160
+ /** `schemas/v2/residency.schema.json`; an unadvertised `region` → `422 residency_unavailable`. */
161
+ residency?: {
162
+ region?: string;
163
+ [key: string]: unknown;
164
+ };
165
+ /** The signed-token callback (interrupt.md). */
282
166
  callbackUrl?: string;
283
167
  configurable?: RunConfigurable;
284
168
  tags?: readonly string[];
@@ -303,37 +187,6 @@ export interface CancelRunResponse {
303
187
  runId: string;
304
188
  status: 'cancelled' | 'cancelling';
305
189
  }
306
- /**
307
- * Portable JSON diagnostic export for a single run per
308
- * `spec/v1/debug-bundle.md` + `schemas/debug-bundle.schema.json`.
309
- *
310
- * Hosts MAY omit non-required fields. Consumers MUST treat masked /
311
- * omitted / hashed values as the spec-canonical content per the host's
312
- * advertised `redactionMode` — they are NOT placeholders for missing
313
- * data.
314
- */
315
- export interface DebugBundle {
316
- bundleVersion: string;
317
- generatedAt: string;
318
- host: {
319
- name?: string;
320
- version?: string;
321
- vendor?: string;
322
- };
323
- run: Record<string, unknown>;
324
- events: ReadonlyArray<Record<string, unknown>>;
325
- redactionApplied: boolean;
326
- /** Reflects the host's `capabilities.compliance.defaultMode`. */
327
- redactionMode: 'mask' | 'omit' | 'hash' | 'passthrough';
328
- /** True when the bundle hit the host's size cap; pair with `truncatedReason`. */
329
- truncated?: boolean;
330
- truncatedReason?: string;
331
- [key: string]: unknown;
332
- }
333
- export interface DebugBundleOptions {
334
- /** Optional host-extension query parameter to lower the size cap for testing. Spec-canonical hosts SHOULD prefer `host.<vendor>.<query>` namespacing; this is the SQLite-reference convention. */
335
- maxEvents?: number;
336
- }
337
190
  export interface RegisterWebhookRequest {
338
191
  /** Receiver URL the host will POST signed deliveries to. */
339
192
  url: string;
@@ -461,26 +314,8 @@ export interface CreateAnnotationRequest {
461
314
  signal: AnnotationSignal;
462
315
  note?: string;
463
316
  }
464
- /** RFC 0059 versioned, tenant·workspace-scoped ground-truth file
465
- * (`workspace-file.schema.json`). The `list` endpoint returns this shape
466
- * minus `content` (metadata only). */
467
- export interface WorkspaceFile {
468
- path: string;
469
- content: string;
470
- contentType?: string;
471
- version: number;
472
- etag?: string;
473
- updatedAt: string;
474
- }
475
- /** RFC 0059 request body for `putWorkspaceFile` (`workspace-file-create.schema.json`).
476
- * `path` is URL-bound; the host assigns `version`/`etag`/`updatedAt`.
477
- * Optimistic concurrency is expressed via the `If-Match` header, not the body. */
478
- export interface PutWorkspaceFileRequest {
479
- content: string;
480
- contentType?: string;
481
- }
482
317
  /**
483
- * Response from `GET /v1/runs/{runId}/ancestry` — RFC 0040 §C cross-host
318
+ * Response from `GET /runs/{runId}/ancestry` — RFC 0040 §C cross-host
484
319
  * composition parent. `parent: null` for top-level runs (not dispatched
485
320
  * from any other run); otherwise `parent.wellKnownUrl` is set when the
486
321
  * parent is on a different host so callers can walk the chain.
@@ -499,7 +334,7 @@ export interface RunAncestryResponse {
499
334
  cause: 'mcp-tool-call' | 'a2a-message' | 'core.subWorkflow' | 'core.dispatch';
500
335
  };
501
336
  }
502
- /** RFC 0054 — response from `GET /v1/runs/{runId}:diff?against={otherRunId}`.
337
+ /** RFC 0054 — response from `GET /runs/{runId}:diff?against={otherRunId}`.
503
338
  * Mirror of `run-diff-response.schema.json`. Deterministic, replay-aware
504
339
  * structured diff of two runs' event sequences + terminal states. */
505
340
  export interface RunDiffEventDiff {
@@ -545,9 +380,16 @@ export interface InterruptByTokenInspection {
545
380
  export interface ResolveInterruptByTokenResponse {
546
381
  [key: string]: unknown;
547
382
  }
383
+ /** `GET /runs/{runId}/events/poll` response (events.md §Poll) — closed. */
548
384
  export interface PollEventsResponse {
385
+ runId: string;
549
386
  events: readonly RunEventDoc[];
550
- isComplete: boolean;
387
+ /** The highest sequence in the log at the time of the response; `-1` when the log is empty. */
388
+ lastSequence: number;
389
+ /** The snapshot status. */
390
+ status: RunStatus;
391
+ /** Whether the run is terminal. */
392
+ isTerminal: boolean;
551
393
  }
552
394
  /** Mirror of `run-event.schema.json` — top-level shape only. */
553
395
  export interface RunEventDoc {
@@ -557,96 +399,162 @@ export interface RunEventDoc {
557
399
  type: string;
558
400
  payload: unknown;
559
401
  timestamp: string;
402
+ /** The one ordering field: integer ≥ 0, first event `0`, strictly increasing per run. */
560
403
  sequence: number;
561
- schemaVersion?: number;
562
- engineVersion?: string;
404
+ /** Per-event schema version, integer ≥ 1 (RFC 0172 §B axis 5). */
405
+ schemaVersion: number;
406
+ /** Integer ≥ 0 everywhere (RFC 0172 §B axis 3). */
407
+ engineVersion?: number;
563
408
  causationId?: string;
564
409
  }
410
+ /**
411
+ * A vendor error code: `<org>.<name>` with the org registered in
412
+ * `spec/v2/declaration.json`; `openwop.` is reserved (errors.md). The template
413
+ * literal keeps `ErrorEnvelope.error` open to registered vendor codes while
414
+ * every protocol code is a member of the generated {@link ErrorCode} union.
415
+ */
416
+ export type VendorErrorCode = `${string}.${string}`;
417
+ /** `{ error, message, details? }` and nothing else (errors.md §The envelope). */
565
418
  export interface ErrorEnvelope {
566
- error: string;
419
+ error: ErrorCode | VendorErrorCode;
567
420
  message: string;
568
421
  details?: Record<string, unknown>;
569
422
  }
570
423
  export type StreamMode = 'values' | 'updates' | 'messages' | 'debug';
424
+ /** Maturity of a capability record. */
425
+ export type CapabilityStatus = 'stable' | 'experimental' | 'deprecated';
426
+ /** The five wire-legal witness classes (RFC 0168 §B); `unwitnessable` never appears on the wire. */
427
+ export type WitnessClass = 'witnessable-unaided' | 'witnessable-gated' | 'seam-gated' | 'claims-check' | 'negative-existence';
571
428
  /**
572
- * AI policy mode advertised by the host per `capabilities.md`
573
- * §`aiProviders.policies`. Hosts MAY advertise a subset; clients MUST
574
- * tolerate any subset.
575
- *
576
- * - `disabled` provider MUST NOT be used at all
577
- * - `optional` — no restriction (default)
578
- * - `required` — provider call MUST carry a `credentialRef`
579
- * - `restricted` — model MUST match the policy's `allowedModels`
580
- */
581
- export type AIPolicyMode = 'disabled' | 'optional' | 'required' | 'restricted';
582
- /**
583
- * Closed-set deny reason returned in `provider_policy_denied.details.reason`
584
- * per spec §"Wire-format error".
429
+ * One capability record (RFC 0169 §A). `status`, `since` and `witness` are
430
+ * REQUIRED; `until` is REQUIRED when `status` is `experimental` or
431
+ * `deprecated` and MUST NOT be present when `stable`. `supported` does not
432
+ * exist — presence of the record is the claim. The remaining members are the
433
+ * family's facets (`spec/v2/facets/<key>.schema.json` where hand-decided).
585
434
  */
586
- export type AIPolicyDenyReason = 'provider_disabled' | 'byok_required' | 'byok_required_but_unresolved' | 'model_not_allowed';
435
+ export interface CapabilityRecord {
436
+ status: CapabilityStatus;
437
+ /** `<major>.<minor>` */
438
+ since: string;
439
+ /** `<major>.<minor>` or `YYYY-MM-DD` */
440
+ until?: string;
441
+ witness: WitnessClass;
442
+ [facet: string]: unknown;
443
+ }
444
+ /** A version-axis grammar: `<major>.<minor>` with no leading zero (RFC 0149 §C). */
445
+ export type ProtocolVersion = `${number}.${number}`;
587
446
  /**
588
- * Capability advertisement payload mirroring spec §`aiProviders` +
589
- * §`aiProviders.policies`. Optional sub-fields are absent on hosts
590
- * that don't enforce per-provider policies.
447
+ * The closed v2 discovery root (`schemas/v2/capabilities.schema.json`,
448
+ * `additionalProperties: false`). Every key is one of the generated
449
+ * {@link CapabilityMetadataKey}s, a family key ({@link CapabilityFamilyKey})
450
+ * carrying a {@link CapabilityRecord}, or `extensions`. `protocolVersions`
451
+ * and `preferredVersion` are REQUIRED (versioning.md §1.1).
591
452
  */
592
- export interface AIProvidersCapability {
593
- /** Provider ids the host's AI-proxy can route to. Optional per
594
- * `capabilities.schema.json` (the `aiProviders` block has no required
595
- * fields); a host advertising the block normally lists them. */
596
- supported?: readonly string[];
597
- /** Subset of `supported` for which BYOK is permitted. */
598
- byok?: readonly string[];
599
- /** Optional 4-mode policy enforcement advertisement. */
600
- policies?: {
601
- modes: readonly AIPolicyMode[];
602
- scopes?: readonly string[];
603
- errorCode?: string;
604
- };
605
- /** RFC 0108. Subset of `supported` whose entries are operator-/tenant-
606
- * configured OpenAI-compatible endpoints (Ollama / vLLM / LM Studio / any
607
- * `/v1/chat/completions`-compatible server), as opposed to a host-managed
608
- * connection to a known public vendor. Each entry also appears in
609
- * `supported` and MAY also appear in `byok`. The id is an OPAQUE label that
610
- * MUST NOT encode the endpoint's network location (RFC 0108 §A.3), and a
611
- * client MUST NOT infer model capabilities from it (§B) — the authoritative
612
- * sources are `modelCapabilities.advertised[]` and `aiProviders.input`. */
613
- selfHosted?: readonly string[];
614
- /** RFC 0105. Present (value MUST be `'supported'`) ⇒ the host exposes speech
615
- * synthesis via the host-side `ctx.callSpeechSynthesizer`. Absent ⇒ no TTS
616
- * (a call is rejected with `speech_synthesis_unsupported`). */
617
- speechSynthesis?: 'supported';
618
- /** RFC 0106. Optional real-time voice profile. Absent ⇒ no live voice. The
619
- * sub-flags gate streaming STT / chunked TTS and turn-taking; the host
620
- * enforces that `turnDetection`/`bargeIn` require `transcription`. */
621
- realtimeVoice?: {
622
- /** Present (`'streaming'`) ⇒ host exposes streaming `ctx.callTranscriber`. */
623
- transcription?: 'streaming';
624
- /** Present (`'streaming'`) ⇒ `ctx.callSpeechSynthesizer` honors `stream:true`.
625
- * Requires `aiProviders.speechSynthesis: 'supported'`. */
626
- synthesis?: 'streaming';
627
- /** Endpointing sophistication; requires `transcription`. */
628
- turnDetection?: 'vad' | 'semantic';
629
- /** Present (`'supported'`) ⇒ host emits `voice.barge_in`/`voice.cancelled`
630
- * on overlapping speech; requires `transcription`. */
631
- bargeIn?: 'supported';
453
+ export type Capabilities = {
454
+ /** Every `<major>.<minor>` this host serves. */
455
+ protocolVersions: readonly ProtocolVersion[];
456
+ /** The header-less default; MUST be a member of `protocolVersions[]`. */
457
+ preferredVersion: ProtocolVersion;
458
+ /** Kept as `preferredVersion`'s twin for v1 readers through the overlap. */
459
+ protocolVersion?: ProtocolVersion;
460
+ /** RFC 0172 row C5.8 — a host MAY refuse a client below it with `426 client_version_unsupported`. */
461
+ minClientVersion?: string;
462
+ /** Integer everywhere (RFC 0172 §B axis 3). */
463
+ engineVersion?: number;
464
+ /** The era key; a v2 host writes `3`. */
465
+ eventLogSchemaVersion?: number;
466
+ implementation?: {
467
+ name?: string;
468
+ version?: string;
469
+ vendor?: string;
632
470
  };
633
- /** RFC 0116. Provider-scoped advert that the host honors the AI-envelope
634
- * `generate` request's optional `cachePrefixId` (a tenant-namespaced,
635
- * secret-free label) as a routing hint into the routed provider's
636
- * server-side context cache. Absent ⇒ the host ignores `cachePrefixId`
637
- * (no error). The cache MUST be keyed by `(resolved tenant, cachePrefixId)`
638
- * (SECURITY invariant `prompt-prefix-cache-cross-tenant-isolation`) and a
639
- * hit/miss MUST NOT change the recorded envelope or
640
- * `provider.usage.inputTokens`/`outputTokens` (replay-invariant). NOT a
641
- * universal claim — `providers` scopes it per routed provider. */
642
- promptPrefixCache?: {
643
- /** Whether the host honors `cachePrefixId`. */
644
- supported: boolean;
645
- /** Subset of `supported` for which `cachePrefixId` is honored (prefix
646
- * caching is provider-specific, e.g. Anthropic ephemeral). A request
647
- * whose routed provider is not listed has `cachePrefixId` ignored. */
648
- providers?: readonly string[];
471
+ /** `extensions.<org>.<name>` vendor and host extension records; the org's own shape. */
472
+ extensions?: Record<`${string}.${string}`, Record<string, unknown>>;
473
+ configurable?: Record<string, unknown>;
474
+ observability?: Record<string, unknown>;
475
+ runtimeCapabilities?: Record<string, unknown>;
476
+ testing?: Record<string, unknown>;
477
+ conformance?: Record<string, unknown>;
478
+ fixtures?: Record<string, unknown>;
479
+ compliance?: Record<string, unknown>;
480
+ discovery?: Record<string, unknown>;
481
+ } & {
482
+ readonly [K in CapabilityFamilyKey]?: CapabilityRecord;
483
+ };
484
+ /** `GET /runs/{runId}/compensation` (`schemas/v2/compensation-projection.schema.json`). */
485
+ export interface CompensationProjection {
486
+ runId: string;
487
+ status: 'none' | 'pending' | 'running' | 'completed' | 'partial' | 'failed' | 'manual-intervention';
488
+ plan: readonly {
489
+ nodeId: string;
490
+ order: number;
491
+ /** `schemas/v2/compensation-policy.schema.json` */
492
+ policy?: Record<string, unknown>;
493
+ irreversibleEffect?: boolean;
494
+ }[];
495
+ attempts: readonly {
496
+ nodeId: string;
497
+ attempt: number;
498
+ outcome: 'succeeded' | 'failed' | 'skipped' | 'manual';
499
+ at: string;
500
+ reason?: string;
501
+ }[];
502
+ }
503
+ /** `GET /runs/{runId}/effects` (`schemas/v2/effect-ledger-projection.schema.json`). */
504
+ export interface EffectLedgerProjection {
505
+ runId: string;
506
+ effects: readonly {
507
+ effectId: string;
508
+ nodeId: string;
509
+ attempt: number;
510
+ invocationId?: string;
511
+ keying: 'business-identity' | 'activity-recipe';
512
+ /** Redaction-safe provider-side identity; never credential material. */
513
+ providerKey?: string;
514
+ state: 'claimed' | 'completed' | 'released' | 'escaped';
515
+ at: string;
516
+ }[];
517
+ }
518
+ /** `GET /host/effect-seams` (`schemas/v2/effect-seam-manifest.schema.json`). */
519
+ export interface EffectSeamManifest {
520
+ manifestVersion: '1';
521
+ host: {
522
+ name: string;
523
+ build: {
524
+ kind: 'image-digest' | 'commit' | 'artifact-sha256';
525
+ id: string;
526
+ };
649
527
  };
528
+ seams: readonly {
529
+ /** The outbound effect path, host-named (e.g. `http.fetch`). */
530
+ seam: string;
531
+ kind: 'http' | 'queue' | 'storage' | 'provider-sdk' | 'webhook-fanout';
532
+ guarded: true;
533
+ guardedBy: string;
534
+ branchReFires?: boolean;
535
+ note?: string;
536
+ }[];
537
+ }
538
+ /** `heartbeat.evaluated` (`schemas/v2/heartbeat-evaluated.schema.json`). */
539
+ export interface HeartbeatEvaluatedPayload {
540
+ heartbeatId: string;
541
+ status: 'ok' | 'timeout' | 'error';
542
+ changed: boolean;
543
+ [key: string]: unknown;
544
+ }
545
+ /** `heartbeat.stateChanged` (`schemas/v2/heartbeat-state-changed.schema.json`). */
546
+ export interface HeartbeatStateChangedPayload {
547
+ heartbeatId: string;
548
+ from: Record<string, unknown>;
549
+ to: Record<string, unknown>;
550
+ [key: string]: unknown;
551
+ }
552
+ /** One frame of the `hostEvents` channel — content-free of run data. */
553
+ export interface HostEventDoc {
554
+ type: string;
555
+ payload: unknown;
556
+ timestamp?: string;
557
+ [key: string]: unknown;
650
558
  }
651
559
  /**
652
560
  * Opaque host-issued reference to a stored secret. Sent via
@@ -666,19 +574,6 @@ export interface AIRunOverlay {
666
574
  /** Implementation extensions; passed through verbatim. */
667
575
  [key: string]: unknown;
668
576
  }
669
- /**
670
- * Capability advertisement for hosts that operate an MCP client.
671
- * Mirrors `examples/hosts/postgres/src/mcp-client.ts` reference shape.
672
- * `trustBoundary: "untrusted"` is REQUIRED per
673
- * threat-model-prompt-injection.md §"UNTRUSTED marker": tool output is
674
- * adversarial-tolerant and downstream LLM nodes treat it as user data.
675
- */
676
- export interface McpClientCapability {
677
- supported: true;
678
- transports: readonly string[];
679
- defaultTimeoutMs?: number;
680
- trustBoundary: 'untrusted';
681
- }
682
577
  /** Wire shape of the `core.mcp.toolCall` node config. */
683
578
  export interface McpToolCallNodeConfig {
684
579
  serverId: string;
@@ -696,15 +591,6 @@ export interface McpInvokedSummary {
696
591
  isError: boolean;
697
592
  durationMs: number;
698
593
  }
699
- /** Capability advertisement for hosts that implement `core.http.request`. */
700
- export interface HttpClientCapability {
701
- supported: true;
702
- methods: readonly ('GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD')[];
703
- defaultTimeoutMs?: number;
704
- maxResponseBodyBytes: number;
705
- ssrfGuard: boolean;
706
- redirectPolicy?: 'follow' | 'reject';
707
- }
708
594
  /** Wire shape of the `core.http.request` node config. */
709
595
  export interface HttpRequestNodeConfig {
710
596
  url: string;
@@ -743,12 +629,6 @@ export interface MemoryListOptions {
743
629
  /** RFC 0113. Free-text relevance anchor; REQUIRED when `rank: 'relevance'`. */
744
630
  query?: string;
745
631
  }
746
- /** Capability advertisement shape per capabilities.md §`memory`. */
747
- export interface MemoryCapability {
748
- supported: true;
749
- maxEntrySizeBytes: number;
750
- ttlSupported: boolean;
751
- }
752
632
  /** Mirror of `schemas/agent-ref.schema.json`. */
753
633
  export interface AgentRef {
754
634
  agentId: string;
@@ -758,100 +638,6 @@ export interface AgentRef {
758
638
  }
759
639
  /** Reasoning verbosity per capabilities.md §`agents.reasoning`. */
760
640
  export type ReasoningVerbosity = 'off' | 'summary' | 'full';
761
- /** Capability advertisement shape per capabilities.md §`agents` (Phase 1-6). */
762
- export interface AgentsCapability {
763
- supported: true;
764
- profile?: string;
765
- modelClasses?: readonly ('reasoning' | 'tool-using' | 'chat')[];
766
- orchestratorPattern?: string;
767
- memoryBackends?: readonly string[];
768
- orchestrator?: boolean;
769
- /** Phase 6. Host implements the `core.dispatch` Core typeId. The RFC 0118
770
- * fan-out/join descriptors live on the top-level {@link Capabilities.dispatch}
771
- * object (`capabilities.md` §`dispatch`), NOT here. */
772
- dispatch?: boolean;
773
- reasoning?: {
774
- verbosity: ReasoningVerbosity;
775
- tokenLimit?: number;
776
- /** RFC 0024. When `true`, host MAY emit `agent.reasoning.delta`
777
- * events incrementally while a reasoning block is still open,
778
- * in addition to the final `agent.reasoned`. Consumers that
779
- * only read `agent.reasoned` remain correct (the closing event
780
- * is authoritative). */
781
- streaming?: boolean;
782
- };
783
- }
784
- /**
785
- * RFC 0007 + RFC 0118 — the top-level `core.dispatch` capability descriptors
786
- * (`capabilities.md` §`dispatch`), exposed as {@link Capabilities.dispatch}.
787
- * The discovery surface for parallel sub-workflow fan-out and join: an author
788
- * reads `joinModes` / `onChildFailureModes` / `fanOutPolicies` to detect partial
789
- * support before pinning a `core.dispatch` node's `fanOutPolicy` / `joinPolicy`.
790
- * All fields OPTIONAL + read-only; absent descriptors carry the documented
791
- * conservative defaults (a host that omits `joinModes` implements no parallel
792
- * join; one that omits `onChildFailureModes` accepts only `'collect'`). The SDK
793
- * does NOT model the authoring-side `DispatchConfig` (`fanOutPolicy` /
794
- * `joinPolicy` / `maxConcurrency`) — that is a workflow-node-definition shape,
795
- * out of this client SDK's read-only scope.
796
- */
797
- export interface DispatchCapability {
798
- /** Host implements the `core.dispatch` Core typeId (the top-level mirror of
799
- * the legacy {@link AgentsCapability.dispatch} boolean). */
800
- supported?: boolean;
801
- /** RFC 0007 + RFC 0118. Host honors `nextWorkerIds.length > 1`; since RFC 0118
802
- * ALSO the gate for accepting `fanOutPolicy: 'parallel'` at registration. A
803
- * host advertising `false` rejects a node pinning `'parallel'`. */
804
- fanOutSupported?: boolean;
805
- /** RFC 0118. The `fanOutPolicy` values the host accepts. Absent ⇒ treat as
806
- * `['sequential', 'reject']` (parallel unsupported). */
807
- fanOutPolicies?: readonly ('sequential' | 'reject' | 'parallel')[];
808
- /** RFC 0118. The `joinPolicy.mode` values the host implements for
809
- * `fanOutPolicy: 'parallel'`. Absent ⇒ the host implements no parallel join. */
810
- joinModes?: readonly ('wait-all' | 'quorum' | 'first' | 'race')[];
811
- /** RFC 0118. The `joinPolicy.onChildFailure` error-aggregation values the host
812
- * accepts (orthogonal to {@link joinModes}). Absent ⇒ `['collect']` only — a
813
- * host that omits this MUST reject a node pinning `'fail-fast'` / `'absorb'`. */
814
- onChildFailureModes?: readonly ('collect' | 'fail-fast' | 'absorb')[];
815
- /** RFC 0118. The host's hard concurrency/breadth ceiling for a parallel
816
- * fan-out. Effective concurrency is `min(config.maxConcurrency ?? ∞,
817
- * maxFanOut ?? ∞)`. Absent ⇒ unbounded (treat as "unknown, may be capped"). */
818
- maxFanOut?: number;
819
- }
820
- /**
821
- * RFC 0117 (`Active`; amended by RFC 0119) — the `uiPlugins` capability
822
- * advertisement (`capabilities.md` §`uiPlugins`), exposed as
823
- * {@link Capabilities.uiPlugins}. The host loads `kind:"frontend-plugin"` packs
824
- * in an origin/execution-isolated sandbox (mechanism per {@link isolation}) and
825
- * serves the closed `ui-plugin/1` host-RPC boundary. All fields but `supported`
826
- * are OPTIONAL + read-only; a client reads them to decide whether (and which
827
- * surfaces / RPC methods) a plugin can target before install. The SDK models
828
- * only this discovery block — NOT the `ui-plugin/1` RPC envelope or the
829
- * `frontend-plugin` manifest (a renderer/registry concern, out of client scope).
830
- */
831
- export interface UiPluginsCapability {
832
- /** Host loads `kind:"frontend-plugin"` packs in an isolated sandbox and
833
- * serves the `ui-plugin/1` host-RPC boundary. `false`/absent ⇒ the host
834
- * rejects such packs at registration and renders no plugin surface. */
835
- supported: boolean;
836
- /** RFC 0117 (amended by RFC 0119). The categorical isolation MECHANISM the
837
- * host enforces for plugin bytes. The five named values plus a vendor
838
- * `x-host-<host>-<key>` form (per `host-extensions.md`) — the open string
839
- * admits the vendor form without discarding autocomplete for the known set.
840
- * ALL values denote the SAME mandatory isolation property (no host execution
841
- * context / DOM / origin-storage / credential access, deny-egress, RPC-only);
842
- * the field names the mechanism, never relaxes the property. Absent ⇒
843
- * `'cross-origin-iframe'` (the default). */
844
- isolation?: 'cross-origin-iframe' | 'wasm' | 'process' | 'container' | 'vm' | (string & {});
845
- /** RFC 0117. Plugin surfaces this host renders. A pack surface not in this
846
- * set is installable-but-inert (graceful degradation). */
847
- surfaces?: readonly ('artifact-viewer' | 'route' | 'settings-panel')[];
848
- /** RFC 0117. The `ui-plugin/1` host-RPC methods this host honors. A plugin
849
- * call to a method not in this set is rejected with `method_not_allowed`
850
- * (SECURITY invariant `frontend-plugin-rpc-allowlist`). */
851
- hostApi?: readonly ('artifact.read' | 'artifact.write' | 'host.toast' | 'host.navigate')[];
852
- /** RFC 0117. Per-plugin entry-bundle byte ceiling the host will load. */
853
- maxEntryBytes?: number;
854
- }
855
641
  /** `agent.reasoned` payload (RFC 0002 §B). Fired once per closed
856
642
  * reasoning block. The `reasoning` field is authoritative — when a
857
643
  * streaming host also emitted `agent.reasoning.delta` events, this
@@ -1024,7 +810,7 @@ export interface VoiceCancelledPayload {
1024
810
  /** `channel.presence` (RFC 0110). EPHEMERAL online + typing presence for a
1025
811
  * `type:'channel'` conversation. Observable on the LIVE run-event stream
1026
812
  * only — the host MUST NOT persist it to the replayable event log, so it is
1027
- * ABSENT on replay / `POST /v1/runs/{runId}:fork`. Membership-gated: every
813
+ * ABSENT on replay / `POST /runs/{runId}:fork`. Membership-gated: every
1028
814
  * ref is a current participant (opaque RFC 0041 subject refs, non-PII). */
1029
815
  export interface ChannelPresencePayload {
1030
816
  conversationId: string;
@@ -1081,7 +867,7 @@ export interface DispatchJoinPayload {
1081
867
  * in-window orchestrator-loop transcript turns with a host-produced summary to
1082
868
  * honor `multiAgent.executionModel.contextBudget.transcriptTokenBudget`.
1083
869
  * CONTENT-FREE: the summary text never rides the wire — `summaryRef` is an
1084
- * artifactId resolved via `GET /v1/runs/{runId}/artifacts/{artifactId}`. The
870
+ * artifactId resolved via `GET /runs/{runId}/artifacts/{artifactId}`. The
1085
871
  * summary is nondeterministic host output governed like an RFC 0041 envelope:
1086
872
  * on `:fork mode:replay` the host MUST reuse this recorded `summaryRef` and
1087
873
  * MUST NOT re-summarize. `replacedTurns` lists the event ids the summary stands
@@ -1108,18 +894,6 @@ export interface ContextSummarizedPayload {
1108
894
  export interface TypedRunEvent<T> extends RunEventDoc {
1109
895
  payload: T;
1110
896
  }
1111
- /** Profile identifiers per auth-profiles.md. */
1112
- export type AuthProfileClaim = 'openwop-audit-log-integrity' | 'openwop-auth-api-key-rotation' | 'openwop-auth-oauth2-client-credentials' | 'openwop-auth-oidc-user-bearer' | 'openwop-auth-mtls' | 'openwop-discovery-auth-scoped' | 'openwop-interrupt-quorum' | 'openwop-interrupt-auth-required' | 'openwop-interrupt-external-event' | 'openwop-interrupt-cascade-cancel' | 'openwop-production';
1113
- /** Rotation advertisement shape per auth-profiles.md §"openwop-auth-api-key-rotation". */
1114
- export interface AuthRotationCapability {
1115
- supported: true;
1116
- minGraceSeconds: number;
1117
- }
1118
- /** Auth-scoped discovery advertisement per RFC 0011 §A. */
1119
- export interface DiscoveryAuthScopedCapability {
1120
- supported: true;
1121
- mode: 'same-endpoint';
1122
- }
1123
897
  /** Wire metadata on every AI Envelope. */
1124
898
  export interface EnvelopeMeta {
1125
899
  /** Provenance of this emission. */
@@ -1140,7 +914,7 @@ export interface PartialInfo {
1140
914
  /** -1 when total is unknown (streaming without precount). */
1141
915
  total: number;
1142
916
  }
1143
- /** Canonical inbound LLM-emission wire shape per `spec/v1/ai-envelope.md`. */
917
+ /** Canonical inbound LLM-emission wire shape per `spec/v2/core/ai-envelope.md`. */
1144
918
  export interface AIEnvelope<TPayload = unknown> {
1145
919
  /** Discriminator for payload shape, kind routing, and Envelope Contract gate. */
1146
920
  type: string;
@@ -1194,10 +968,6 @@ export interface ValidationDetail {
1194
968
  }
1195
969
  /** Optional capability advertisement. Default when absent: 'warn'. */
1196
970
  export type EnvelopeStrictness = 'warn' | 'strict';
1197
- /** Optional capability advertisement per `ai-envelope.md` §"Capability handshake integration". */
1198
- export interface EnvelopeContractsCapability {
1199
- advertised: boolean;
1200
- }
1201
971
  /** Payload of the universal `clarification.request` envelope kind. */
1202
972
  export interface ClarificationRequestPayload {
1203
973
  questions: Array<{
@@ -1278,7 +1048,7 @@ export interface A2uiSurfacePatchOp {
1278
1048
  /**
1279
1049
  * RFC 0114 — a HOST-SIDE TRANSPORT frame carrying an RFC 6902 delta over a
1280
1050
  * recorded `ui.a2ui-surface` envelope ({@link A2UISurfacePayload}). Delivered
1281
- * ONLY over the run event stream (`GET /v1/runs/{runId}/events`) to a subscriber
1051
+ * ONLY over the run event stream (`GET /runs/{runId}/events`) to a subscriber
1282
1052
  * that negotiated `?a2uiDelta=1`; every other consumer (the event-log read,
1283
1053
  * replay, `:fork`, any non-negotiating subscriber) receives the materialized
1284
1054
  * FULL surface. This is NOT a recorded-envelope shape — the recorded
@@ -1322,7 +1092,7 @@ export interface PromptVariable {
1322
1092
  }
1323
1093
  /**
1324
1094
  * Named, versioned, variable-bound prompt body. Per
1325
- * `schemas/prompt-template.schema.json` + spec/v1/prompts.md §PromptTemplate.
1095
+ * `schemas/prompt-template.schema.json` + spec/v2/core/prompts.md §PromptTemplate.
1326
1096
  *
1327
1097
  * `meta.packName` + `meta.packVersion` are required when `meta.source: "pack"`
1328
1098
  * (RFC 0028 §C); a JSON-Schema `if/then` conditional enforces this at the
@@ -1426,8 +1196,8 @@ export declare class WopError extends Error {
1426
1196
  constructor(status: number, rawText: string, envelope: ErrorEnvelope | undefined, traceparent: string | undefined);
1427
1197
  }
1428
1198
  /**
1429
- * One installed manifest agent, as projected by `GET /v1/agents` /
1430
- * `GET /v1/agents/{agentId}` (RFC 0072 §A). Read-only — never carries the
1199
+ * One installed manifest agent, as projected by `GET /agents` /
1200
+ * `GET /agents/{agentId}` (RFC 0072 §A). Read-only — never carries the
1431
1201
  * system-prompt body, resolved handoff schemas, or credential material (SR-1).
1432
1202
  */
1433
1203
  export interface AgentInventoryEntry {
@@ -1449,7 +1219,7 @@ export interface AgentInventoryEntry {
1449
1219
  /** RFC 0072 §C — optional capability tiers this host does not satisfy, inert here. */
1450
1220
  degraded?: string[];
1451
1221
  }
1452
- /** Response body for `GET /v1/agents` (RFC 0072 §A). */
1222
+ /** Response body for `GET /agents` (RFC 0072 §A). */
1453
1223
  export interface AgentInventoryResponse {
1454
1224
  agents: AgentInventoryEntry[];
1455
1225
  total: number;
@@ -1473,7 +1243,7 @@ export interface AgentRosterEntry {
1473
1243
  label?: string;
1474
1244
  description?: string;
1475
1245
  }
1476
- /** Response for `GET /v1/agents/roster` (RFC 0086 §B). */
1246
+ /** Response for `GET /agents/roster` (RFC 0086 §B). */
1477
1247
  export interface AgentRosterResponse {
1478
1248
  roster: AgentRosterEntry[];
1479
1249
  total: number;
@@ -1505,89 +1275,13 @@ export interface AgentOrgChart {
1505
1275
  departments: OrgChartDepartment[];
1506
1276
  members: OrgChartMember[];
1507
1277
  }
1508
- /** Response for `GET /v1/agents/org-chart/{departmentId}` (RFC 0087 §D) — the
1278
+ /** Response for `GET /agents/org-chart/{departmentId}` (RFC 0087 §D) — the
1509
1279
  * department subtree + the responsibility roll-up (union of member portfolios). */
1510
1280
  export interface OrgChartResponsibilityView {
1511
1281
  department: OrgChartDepartment;
1512
1282
  members: OrgChartMember[];
1513
1283
  responsibilities: string[];
1514
1284
  }
1515
- /** Body for `POST /v1/host/sample/agents`. The server synthesises
1516
- * the agentId as `user.<tenantId>.<persona-slug>`. */
1517
- export interface CreateUserAgentRequest {
1518
- /** Short name; becomes the `@`-mention slug and chat panel label.
1519
- * Required, ≤64 chars. */
1520
- persona: string;
1521
- /** Longer display name; defaults to the persona when omitted. */
1522
- label?: string;
1523
- description?: string;
1524
- /** One of: `chat`, `reasoning`, `coding`, `extraction`. */
1525
- modelClass: string;
1526
- /** Inline system prompt body; ≤16 000 chars. The sample-host stores
1527
- * it directly (no pack-file ref). */
1528
- systemPrompt: string;
1529
- /** Capability ids the agent is allowed to call; ≤32 entries. */
1530
- toolAllowlist?: string[];
1531
- memoryShape?: {
1532
- scratchpad?: boolean;
1533
- conversation?: boolean;
1534
- longTerm?: boolean;
1535
- };
1536
- /** 0.0-1.0; decisions below this are surfaced as low-confidence. */
1537
- confidenceThreshold?: number;
1538
- }
1539
- /** Response body for `POST /v1/host/sample/agents` — shaped to
1540
- * match `AgentInventoryEntry` minus normative-only fields, so a
1541
- * follow-up `GET /v1/agents` returns a row of the same shape. */
1542
- export interface UserAgentRecord {
1543
- agentId: string;
1544
- persona: string;
1545
- label: string;
1546
- description?: string;
1547
- modelClass: string;
1548
- packName: string;
1549
- packVersion: string;
1550
- toolAllowlist: string[];
1551
- memoryShape: {
1552
- scratchpad: boolean;
1553
- conversation: boolean;
1554
- longTerm: boolean;
1555
- };
1556
- confidenceThreshold?: number;
1557
- hasHandoffSchemas: false;
1558
- }
1559
- /** One installable agent-pack summary from the sample host's local
1560
- * registry mirror (`GET /v1/host/sample/registry/agent-packs`). */
1561
- export interface AgentPackSummary {
1562
- /** Pack name, e.g. `core.openwop.agents.code-reviewer`. */
1563
- name: string;
1564
- version: string;
1565
- description?: string;
1566
- /** Personas declared by the pack's `agents[]` (per RFC 0003). */
1567
- personas: string[];
1568
- /** True when at least one of the pack's agents is registered in
1569
- * this host's in-process AgentRegistry. */
1570
- installed: boolean;
1571
- }
1572
- export interface AgentPackRegistryResponse {
1573
- packs: AgentPackSummary[];
1574
- total: number;
1575
- }
1576
- export interface InstallAgentPackRequest {
1577
- /** Must start with `core.openwop.agents.` — the sample's install
1578
- * route filters to that namespace. */
1579
- name: string;
1580
- /** Defaults to `1.0.0` when omitted. */
1581
- version?: string;
1582
- }
1583
- export interface InstallAgentPackResponse {
1584
- name: string;
1585
- version: string;
1586
- /** True when the pack was newly installed; false when it was
1587
- * already present in the registry. */
1588
- installed: boolean;
1589
- alreadyInstalled: boolean;
1590
- }
1591
1285
  /** Abstract model class (RFC 0002 / RFC 0003 manifest vocabulary). */
1592
1286
  export type AgentModelClass = 'reasoning' | 'writing' | 'coding' | 'research' | 'classification' | 'general';
1593
1287
  /** A redaction-safe safety finding ({kind, severity} descriptor — never excerpted content). */
@@ -1632,7 +1326,7 @@ export interface EvalSummary {
1632
1326
  export type DeploymentState = 'draft' | 'test' | 'staged' | 'active' | 'paused' | 'deprecated' | 'rolled-back';
1633
1327
  /**
1634
1328
  * RFC 0078 §B — a portable tool descriptor as projected onto the host's
1635
- * `GET /v1/tools` catalog. Source-agnostic (node-pack / workflow / mcp /
1329
+ * `GET /tools` catalog. Source-agnostic (node-pack / workflow / mcp /
1636
1330
  * connector / host-extension); `safetyTier`, `egress`, and `approval` let a
1637
1331
  * caller reason about a tool's blast radius before invoking it.
1638
1332
  */
@@ -1653,8 +1347,8 @@ export interface ToolDescriptor {
1653
1347
  }
1654
1348
  /**
1655
1349
  * RFC 0112 — a compact, model-facing projection of `ToolDescriptor`, returned by
1656
- * `GET /v1/tools?view=compact` (envelope `{ tools: CompactToolDescriptor[] }`) +
1657
- * `GET /v1/tools/{toolId}?view=compact` when the host advertises
1350
+ * `GET /tools?view=compact` (envelope `{ tools: CompactToolDescriptor[] }`) +
1351
+ * `GET /tools/{toolId}?view=compact` when the host advertises
1658
1352
  * `capabilities.toolCatalog.compactView`. The heavy descriptor fields
1659
1353
  * (`outputSchema`/`auth`/`egress`/`approval`/`replayPolicy`/`costHint`/`latencyHint`)
1660
1354
  * are dropped, and any `inputSchema` is bounded to the compact structural subset
@@ -1725,7 +1419,7 @@ export interface LocalizedContentSection {
1725
1419
  enabled: boolean;
1726
1420
  order: number;
1727
1421
  }
1728
- /** Public delivery response for `GET /v1/content/pages/{slug}` — the negotiated
1422
+ /** Public delivery response for `GET /content/pages/{slug}` — the negotiated
1729
1423
  * locale's resolved page + sections (the RFC 0103 `resolveSection` merge is
1730
1424
  * applied host-side: exact → language-family → base). */
1731
1425
  export interface LocalizedContentPageResponse {
@@ -1744,14 +1438,14 @@ export interface LocalizedContentLanguageSettings {
1744
1438
  supportedLocales: readonly string[];
1745
1439
  autoTranslateOnPublish: boolean;
1746
1440
  }
1747
- /** Request body for `PUT /v1/content/pages/{pageId}/sections/{sectionId}`. */
1441
+ /** Request body for `PUT /content/pages/{pageId}/sections/{sectionId}`. */
1748
1442
  export interface PutContentSectionRequest {
1749
1443
  /** Target locale; the baseLocale upserts `data`, else `localizations[locale]`. */
1750
1444
  locale: string;
1751
1445
  /** The field overlay for the target locale (host-defined open shape). */
1752
1446
  data: Record<string, unknown>;
1753
1447
  }
1754
- /** Registration body for `POST /v1/trigger-subscriptions`
1448
+ /** Registration body for `POST /trigger-subscriptions`
1755
1449
  * (`schemas/trigger-subscription-registration.schema.json`). */
1756
1450
  export interface TriggerSubscriptionRegistration {
1757
1451
  /** External event source descriptor (host-defined: webhook / email / form …). */
@@ -1766,7 +1460,7 @@ export interface TriggerSubscriptionRegistration {
1766
1460
  * (`schemas/trigger-subscription.schema.json`). Kept open beyond the
1767
1461
  * registration fields the host echoes back. */
1768
1462
  export type TriggerSubscription = Record<string, unknown>;
1769
- /** `201` response for `POST /v1/trigger-subscriptions`. `binding` carries the
1463
+ /** `201` response for `POST /trigger-subscriptions`. `binding` carries the
1770
1464
  * source-specific wiring the caller needs (e.g. `{ ingestUrl,
1771
1465
  * secretFingerprint }` for webhook); the secret is returned ONCE at creation
1772
1466
  * (SR-1) — persist it, it is not retrievable again. */