@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
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Cost-attribution allowlist + sanitizer helpers
3
- * (`spec/v1/observability.md §"Cost attribution attributes"`).
3
+ * (`spec/v2/core/observability.md §"Cost attribution attributes"`).
4
4
  *
5
5
  * The spec MUSTs that hosts emitting `openwop.cost.*` OTel span attrs
6
6
  * route them through an allowlist sanitizer that drops any attribute
@@ -18,7 +18,7 @@
18
18
  * eighth attribute, one PR updates the constant and both surfaces
19
19
  * pick it up.
20
20
  *
21
- * @see spec/v1/observability.md §"Cost attribution attributes"
21
+ * @see spec/v2/core/observability.md §"Cost attribution attributes"
22
22
  * @see SECURITY/invariants.yaml row `cost-attribution-allowlist-redaction`
23
23
  * @see conformance/src/scenarios/cost-attribution.test.ts
24
24
  */
@@ -26,7 +26,7 @@
26
26
  * active model class confirms `"mandatory"` doesn't trigger refusals.
27
27
  *
28
28
  * @see RFCS/0030-envelope-reasoning-and-tier-one-subset.md §A
29
- * @see spec/v1/ai-envelope.md §"Reasoning field (normative)"
29
+ * @see spec/v2/core/ai-envelope.md §"Reasoning field (normative)"
30
30
  */
31
31
 
32
32
  /**
@@ -367,7 +367,7 @@ export function subscribeToAgentReasoning(
367
367
  void (async () => {
368
368
  try {
369
369
  // streamModes default to 'updates' — agent.* events flow there
370
- // per `spec/v1/stream-modes.md`.
370
+ // per `spec/v2/core/stream-modes.md`.
371
371
  const events = streamEvents(ctx, runId, {
372
372
  ...options,
373
373
  streamMode: options.streamMode ?? 'updates',
@@ -0,0 +1,322 @@
1
+ // GENERATED by scripts/generate.mjs — do not edit.
2
+ //
3
+ // Sources: spec/v2/errors.json (registry version 2.0, updated 2026-09-05,
4
+ // 97 codes) and schemas/v2/capabilities.schema.json (71 families,
5
+ // 17 metadata keys), both vendored at CORPUS_TAG.
6
+ // `npm run generate` rewrites this file; `npm run generate:check` fails on drift.
7
+
8
+ /** Every registered v2 error code (`spec/v2/errors.json`), sorted. */
9
+ export const ERROR_CODES = [
10
+ 'audience_mismatch',
11
+ 'capability_not_provided',
12
+ 'capability_required',
13
+ 'client_version_unsupported',
14
+ 'connection_provider_conflict',
15
+ 'connection_provider_unresolved',
16
+ 'connector_action_unresolved',
17
+ 'connector_auth_expired',
18
+ 'credential_forbidden',
19
+ 'credential_not_found',
20
+ 'credential_required',
21
+ 'credential_revoked',
22
+ 'credential_scope_unsupported',
23
+ 'credential_unavailable',
24
+ 'delegation_chain_cyclic',
25
+ 'delegation_chain_too_long',
26
+ 'delegation_expired',
27
+ 'delegation_scope_amplified',
28
+ 'envelope_correlation_conflict',
29
+ 'envelope_invalid',
30
+ 'envelope_refusal',
31
+ 'envelope_truncation_unrecoverable',
32
+ 'event_type_unmapped',
33
+ 'forbidden',
34
+ 'force_engine_version_forbidden',
35
+ 'fork_point_invalid',
36
+ 'id_tenant_mismatch',
37
+ 'idempotency_in_flight',
38
+ 'idempotency_key_invalid',
39
+ 'idempotency_key_mismatch',
40
+ 'identity_unresolvable',
41
+ 'identity_unverified',
42
+ 'internal_error',
43
+ 'interop_version_unsupported',
44
+ 'interrupt_already_resolved',
45
+ 'interrupt_cancelled',
46
+ 'interrupt_expired',
47
+ 'interrupt_not_found',
48
+ 'interrupt_token_invalid',
49
+ 'key_revoked',
50
+ 'loop_limit_exceeded',
51
+ 'mcp_mrtr_rounds_exceeded',
52
+ 'mock_provider_forbidden',
53
+ 'not_found',
54
+ 'oauth_provider_unsupported',
55
+ 'oauth_scope_unsupported',
56
+ 'pack_dependency_conflict',
57
+ 'pack_dependency_cycle',
58
+ 'pack_engine_unsupported',
59
+ 'pack_integrity_failure',
60
+ 'pack_integrity_mismatch',
61
+ 'pack_kind_invalid',
62
+ 'pack_load_failure',
63
+ 'pack_lockfile_incomplete',
64
+ 'pack_namespace_unauthorized',
65
+ 'pack_peer_dependency_missing',
66
+ 'pack_peer_dependency_undefined',
67
+ 'pack_registry_unreachable',
68
+ 'pack_runtime_requirement_unmet',
69
+ 'pack_signature_invalid',
70
+ 'pack_validation_failed',
71
+ 'pack_version_not_found',
72
+ 'payload_too_large',
73
+ 'protocol_version_mismatch',
74
+ 'protocol_version_unsupported',
75
+ 'rate_limited',
76
+ 'recursion_limit_exceeded',
77
+ 'replay_diverged_at_refusal',
78
+ 'replay_memory_snapshot_unavailable',
79
+ 'replay_source_missing',
80
+ 'residency_unavailable',
81
+ 'run_already_active',
82
+ 'run_forbidden',
83
+ 'run_state_conflict',
84
+ 'run_terminal',
85
+ 'run_timeout',
86
+ 'runner_unavailable',
87
+ 'sandbox_capability_denied',
88
+ 'sandbox_escape_attempt',
89
+ 'sandbox_memory_exceeded',
90
+ 'sandbox_timeout',
91
+ 'schedule_horizon_exceeded',
92
+ 'sender_constraint_missing',
93
+ 'signature_not_available',
94
+ 'sub_chain_cycle',
95
+ 'sub_chain_depth_exceeded',
96
+ 'token_budget_exceeded',
97
+ 'unauthenticated',
98
+ 'unsupported_media_type',
99
+ 'unsupported_stream_mode',
100
+ 'until_in_past',
101
+ 'validation_error',
102
+ 'version_conflict',
103
+ 'webhook_url_rejected',
104
+ 'workspace_conflict',
105
+ 'workspace_membership_required',
106
+ 'workspace_too_large',
107
+ ] as const;
108
+
109
+ /** A registered protocol error code. A vendor code is `<org>.<name>` (see {@link VENDOR_ERROR_CODE_PATTERN}). */
110
+ export type ErrorCode = (typeof ERROR_CODES)[number];
111
+
112
+ /** The registered HTTP status for each code (RFC 0171 §B.1 — a host MUST answer with it). */
113
+ export const ERROR_CODE_HTTP_STATUS: Readonly<Record<ErrorCode, number>> = {
114
+ 'audience_mismatch': 401,
115
+ 'capability_not_provided': 422,
116
+ 'capability_required': 422,
117
+ 'client_version_unsupported': 426,
118
+ 'connection_provider_conflict': 409,
119
+ 'connection_provider_unresolved': 400,
120
+ 'connector_action_unresolved': 400,
121
+ 'connector_auth_expired': 401,
122
+ 'credential_forbidden': 403,
123
+ 'credential_not_found': 404,
124
+ 'credential_required': 422,
125
+ 'credential_revoked': 401,
126
+ 'credential_scope_unsupported': 400,
127
+ 'credential_unavailable': 501,
128
+ 'delegation_chain_cyclic': 400,
129
+ 'delegation_chain_too_long': 400,
130
+ 'delegation_expired': 401,
131
+ 'delegation_scope_amplified': 403,
132
+ 'envelope_correlation_conflict': 409,
133
+ 'envelope_invalid': 422,
134
+ 'envelope_refusal': 422,
135
+ 'envelope_truncation_unrecoverable': 422,
136
+ 'event_type_unmapped': 500,
137
+ 'forbidden': 403,
138
+ 'force_engine_version_forbidden': 403,
139
+ 'fork_point_invalid': 422,
140
+ 'id_tenant_mismatch': 403,
141
+ 'idempotency_in_flight': 409,
142
+ 'idempotency_key_invalid': 400,
143
+ 'idempotency_key_mismatch': 409,
144
+ 'identity_unresolvable': 401,
145
+ 'identity_unverified': 401,
146
+ 'internal_error': 500,
147
+ 'interop_version_unsupported': 400,
148
+ 'interrupt_already_resolved': 409,
149
+ 'interrupt_cancelled': 410,
150
+ 'interrupt_expired': 410,
151
+ 'interrupt_not_found': 404,
152
+ 'interrupt_token_invalid': 401,
153
+ 'key_revoked': 401,
154
+ 'loop_limit_exceeded': 422,
155
+ 'mcp_mrtr_rounds_exceeded': 422,
156
+ 'mock_provider_forbidden': 403,
157
+ 'not_found': 404,
158
+ 'oauth_provider_unsupported': 400,
159
+ 'oauth_scope_unsupported': 400,
160
+ 'pack_dependency_conflict': 409,
161
+ 'pack_dependency_cycle': 400,
162
+ 'pack_engine_unsupported': 400,
163
+ 'pack_integrity_failure': 400,
164
+ 'pack_integrity_mismatch': 409,
165
+ 'pack_kind_invalid': 400,
166
+ 'pack_load_failure': 500,
167
+ 'pack_lockfile_incomplete': 400,
168
+ 'pack_namespace_unauthorized': 403,
169
+ 'pack_peer_dependency_missing': 400,
170
+ 'pack_peer_dependency_undefined': 400,
171
+ 'pack_registry_unreachable': 503,
172
+ 'pack_runtime_requirement_unmet': 422,
173
+ 'pack_signature_invalid': 400,
174
+ 'pack_validation_failed': 400,
175
+ 'pack_version_not_found': 404,
176
+ 'payload_too_large': 413,
177
+ 'protocol_version_mismatch': 400,
178
+ 'protocol_version_unsupported': 406,
179
+ 'rate_limited': 429,
180
+ 'recursion_limit_exceeded': 422,
181
+ 'replay_diverged_at_refusal': 409,
182
+ 'replay_memory_snapshot_unavailable': 409,
183
+ 'replay_source_missing': 404,
184
+ 'residency_unavailable': 422,
185
+ 'run_already_active': 409,
186
+ 'run_forbidden': 403,
187
+ 'run_state_conflict': 409,
188
+ 'run_terminal': 409,
189
+ 'run_timeout': 422,
190
+ 'runner_unavailable': 503,
191
+ 'sandbox_capability_denied': 403,
192
+ 'sandbox_escape_attempt': 403,
193
+ 'sandbox_memory_exceeded': 422,
194
+ 'sandbox_timeout': 422,
195
+ 'schedule_horizon_exceeded': 400,
196
+ 'sender_constraint_missing': 401,
197
+ 'signature_not_available': 404,
198
+ 'sub_chain_cycle': 400,
199
+ 'sub_chain_depth_exceeded': 400,
200
+ 'token_budget_exceeded': 422,
201
+ 'unauthenticated': 401,
202
+ 'unsupported_media_type': 415,
203
+ 'unsupported_stream_mode': 400,
204
+ 'until_in_past': 400,
205
+ 'validation_error': 400,
206
+ 'version_conflict': 409,
207
+ 'webhook_url_rejected': 400,
208
+ 'workspace_conflict': 409,
209
+ 'workspace_membership_required': 403,
210
+ 'workspace_too_large': 413,
211
+ };
212
+
213
+ /** The codes registered `retriable: true`; retry timing lives in `Retry-After` only (RFC 0171 §B.2). */
214
+ export const RETRIABLE_ERROR_CODES = [
215
+ 'internal_error',
216
+ 'pack_registry_unreachable',
217
+ 'rate_limited',
218
+ 'residency_unavailable',
219
+ 'runner_unavailable',
220
+ ] as const;
221
+
222
+ /** Grammar of a vendor error code: `<org>.<name>`, `openwop.` reserved (`spec/v2/errors.json` `vendorCodePattern`). */
223
+ export const VENDOR_ERROR_CODE_PATTERN = /^(?!openwop\.)[a-z][a-z0-9]*(-[a-z0-9]+)*\.[a-z][a-z0-9_]*$/;
224
+
225
+ /** Root metadata keys of the closed v2 discovery document (capabilities.md §3.1). */
226
+ export const CAPABILITY_METADATA_KEYS = [
227
+ 'compliance',
228
+ 'configurable',
229
+ 'conformance',
230
+ 'discovery',
231
+ 'engineVersion',
232
+ 'eventLogSchemaVersion',
233
+ 'extensions',
234
+ 'fixtures',
235
+ 'implementation',
236
+ 'minClientVersion',
237
+ 'observability',
238
+ 'preferredVersion',
239
+ 'protocolVersion',
240
+ 'protocolVersions',
241
+ 'runtimeCapabilities',
242
+ 'signingKeys',
243
+ 'testing',
244
+ ] as const;
245
+
246
+ /** Root capability-record keys of the closed v2 discovery document (capabilities.md §5–§6). */
247
+ export const CAPABILITY_FAMILY_KEYS = [
248
+ 'a2a',
249
+ 'agentRuntime',
250
+ 'agents',
251
+ 'aiEnvelope',
252
+ 'aiProviders',
253
+ 'anonymousActor',
254
+ 'artifactTypes',
255
+ 'auth',
256
+ 'authorization',
257
+ 'blobStorage',
258
+ 'budget',
259
+ 'cache',
260
+ 'channelPresence',
261
+ 'compensation',
262
+ 'connections',
263
+ 'content',
264
+ 'conversationPrimitive',
265
+ 'conversationTurnModelProvenance',
266
+ 'credentials',
267
+ 'dataResidency',
268
+ 'deadLetter',
269
+ 'envelopeContracts',
270
+ 'envelopeStrictness',
271
+ 'envelopes',
272
+ 'eventLog',
273
+ 'feedback',
274
+ 'forms',
275
+ 'fs',
276
+ 'heartbeat',
277
+ 'httpClient',
278
+ 'i18n',
279
+ 'idempotency',
280
+ 'interrupt',
281
+ 'kvStorage',
282
+ 'limits',
283
+ 'mcp',
284
+ 'memory',
285
+ 'modelCapabilities',
286
+ 'multiAgent',
287
+ 'multiPartyConversation',
288
+ 'nodePackRuntimes',
289
+ 'nondeterminismPolicy',
290
+ 'nosql',
291
+ 'oauth',
292
+ 'packs',
293
+ 'portability',
294
+ 'production',
295
+ 'promptLibrary',
296
+ 'prompts',
297
+ 'providerUsage',
298
+ 'purposePropagation',
299
+ 'queueBus',
300
+ 'replay',
301
+ 'sandbox',
302
+ 'scheduling',
303
+ 'schemaVersions',
304
+ 'searchIndex',
305
+ 'secrets',
306
+ 'selfHostedRunner',
307
+ 'sql',
308
+ 'subWorkflow',
309
+ 'supportedEnvelopes',
310
+ 'tableStorage',
311
+ 'toolCatalog',
312
+ 'toolHooks',
313
+ 'triggerBridge',
314
+ 'uiPlugins',
315
+ 'vectorStore',
316
+ 'webhooks',
317
+ 'workflowChainPacks',
318
+ 'workspace',
319
+ ] as const;
320
+
321
+ export type CapabilityMetadataKey = (typeof CAPABILITY_METADATA_KEYS)[number];
322
+ export type CapabilityFamilyKey = (typeof CAPABILITY_FAMILY_KEYS)[number];
package/src/index.ts CHANGED
@@ -1,16 +1,17 @@
1
1
  /**
2
- * @openwop/openwop — TypeScript reference SDK for OpenWOP-compliant servers.
2
+ * @openwop/openwop 2.x — TypeScript reference SDK for OpenWOP v2 hosts.
3
3
  *
4
4
  * Public surface:
5
- * - OpenwopClient (auth + endpoint methods)
6
- * - WopError (typed error wrapping ErrorEnvelope)
7
- * - All request/response types mirroring the OpenAPI spec
8
- * - streamEvents helper for advanced SSE use cases
5
+ * - OpenwopClient (auth + one method per `spec/v2/path-manifest.json` operation)
6
+ * - WopError (typed error wrapping the v2 ErrorEnvelope)
7
+ * - Generated ERROR_CODES / ErrorCode + capability-key unions (`generated.ts`)
8
+ * - All request/response types mirroring `api/v2/openapi.yaml` + `schemas/v2/`
9
+ * - streamEvents / streamHostEvents SSE helpers
9
10
  *
10
11
  * See README.md for usage examples.
11
12
  */
12
13
 
13
- export { OpenwopClient } from './client.js';
14
+ export { OpenwopClient, SDK_PROTOCOL_MAJOR, protocolVersionHeader } from './client.js';
14
15
  export type { OpenwopClientOptions, MutationOptions } from './client.js';
15
16
  export { WopError } from './types.js';
16
17
  export type {
@@ -20,20 +21,20 @@ export type {
20
21
  BulkCancelRunResult,
21
22
  BulkCancelRunsRequest,
22
23
  BulkCancelRunsResponse,
24
+ // The closed v2 discovery root (capabilities.md)
23
25
  Capabilities,
24
- // RFC 0007 + RFC 0118 — top-level dispatch fan-out/join capability
25
- DispatchCapability,
26
- // RFC 0117 + RFC 0119 — front-end plugin packs capability
27
- UiPluginsCapability,
26
+ CapabilityRecord,
27
+ CapabilityStatus,
28
+ WitnessClass,
29
+ ProtocolVersion,
28
30
  CancelRunRequest,
29
31
  CancelRunResponse,
30
32
  CreateRunRequest,
31
33
  CreateRunResponse,
32
34
  ErrorEnvelope,
35
+ VendorErrorCode,
33
36
  ForkRunRequest,
34
37
  ForkRunResponse,
35
- DebugBundle,
36
- DebugBundleOptions,
37
38
  RegisterWebhookRequest,
38
39
  RegisterWebhookResponse,
39
40
  InterruptByTokenInspection,
@@ -49,14 +50,20 @@ export type {
49
50
  RunDiffEventDiff,
50
51
  RunDiffResponse,
51
52
  RunEventDoc,
53
+ RunOwner,
52
54
  RunSnapshot,
53
55
  RunStatus,
54
56
  CompensationStatus,
55
57
  StreamMode,
56
58
  TypedRunEvent,
57
- // RFC 0059agent workspace (spec/v1/agent-workspace.md)
58
- WorkspaceFile,
59
- PutWorkspaceFileRequest,
59
+ // RFC 0173compensation / effect ledger / effect seams
60
+ CompensationProjection,
61
+ EffectLedgerProjection,
62
+ EffectSeamManifest,
63
+ // `/host/events` channel
64
+ HostEventDoc,
65
+ HeartbeatEvaluatedPayload,
66
+ HeartbeatStateChangedPayload,
60
67
  AgentReasonedPayload,
61
68
  AgentReasoningDeltaPayload,
62
69
  AgentToolCalledPayload,
@@ -64,9 +71,7 @@ export type {
64
71
  AgentHandoffPayload,
65
72
  AgentDecidedPayload,
66
73
  MemoryWrittenPayload,
67
- // RFC 0094 §D — streaming output chunk (`output.chunk` / `ai.message.chunk`)
68
74
  OutputChunkPayload,
69
- // RFC 0106 — voice.* run-event payloads
70
75
  VoiceSpeechStartPayload,
71
76
  VoiceTranscriptPayload,
72
77
  VoiceEndpointCandidatePayload,
@@ -74,14 +79,11 @@ export type {
74
79
  VoiceSynthesisChunkPayload,
75
80
  VoiceBargeInPayload,
76
81
  VoiceCancelledPayload,
77
- // RFC 0110 — channel.presence run-event payload
78
82
  ChannelPresencePayload,
79
- // RFC 0118 — core.dispatch.fanOut / core.dispatch.join run-event payloads
80
83
  DispatchFanOutPayload,
81
84
  DispatchJoinPayload,
82
- // RFC 0111 — context.summarized run-event payload
83
85
  ContextSummarizedPayload,
84
- // RFC 0027 + RFC 0028 — Prompt library (spec/v1/prompts.md)
86
+ // RFC 0027 + RFC 0028 — Prompt library
85
87
  GetPromptRequest,
86
88
  ListPromptsRequest,
87
89
  ListPromptsResponse,
@@ -91,42 +93,52 @@ export type {
91
93
  PromptVariable,
92
94
  RenderPromptRequest,
93
95
  RenderPromptResponse,
94
- // RFC 0072 §A — Manifest-agent inventory (GET /v1/agents).
95
- // Consumed by the workflow-engine sample app's Agents tab + chat
96
- // `@` mention picker (2026-05-28 mention-symbol swap).
96
+ // RFC 0072 §A — Manifest-agent inventory
97
97
  AgentInventoryEntry,
98
98
  AgentInventoryResponse,
99
- // RFC 0081 — Agent evaluation (spec/v1/agent-evaluation.md). EvalSummary
100
- // scorecard read via `client.runs.evalSummary(runId)` for a `mode:'eval'` run.
99
+ AgentRef,
100
+ // RFC 0081 Agent evaluation
101
101
  AgentModelClass,
102
102
  EvalSafetyFinding,
103
103
  EvalTaskResult,
104
104
  EvalRegression,
105
105
  EvalSummary,
106
- // RFC 0078 — Portable tool catalog (spec/v1/tool-catalog.md).
107
- // `client.tools.list` / `client.tools.get`.
106
+ // RFC 0078 — Portable tool catalog
108
107
  ToolDescriptor,
109
- // RFC 0082 — Agent deployment lifecycle (spec/v1/agent-deployment.md).
110
- // `client.agents.listDeployments` / `transitionDeployment`.
108
+ CompactToolDescriptor,
109
+ // RFC 0082 — Agent deployment lifecycle
111
110
  DeploymentState,
112
111
  AgentDeployment,
113
112
  AgentDeploymentTransition,
114
- // Sample-extension surfaceuser-authored agents
115
- // (`POST /v1/host/sample/agents`) + agent-pack registry browser
116
- // (`GET/POST /v1/host/sample/registry/agent-packs`). Non-normative;
117
- // wraps host-extension routes the sample app authors against.
118
- CreateUserAgentRequest,
119
- UserAgentRecord,
120
- AgentPackSummary,
121
- AgentPackRegistryResponse,
122
- InstallAgentPackRequest,
123
- InstallAgentPackResponse,
113
+ // RFC 0086 / 0087 roster + org chart
114
+ AgentRosterEntry,
115
+ AgentRosterResponse,
116
+ AgentOrgChart,
117
+ OrgChartDepartment,
118
+ OrgChartMember,
119
+ OrgChartResponsibilityView,
120
+ // RFC 0056 — annotations
121
+ Annotation,
122
+ AnnotationSignal,
123
+ CreateAnnotationRequest,
124
+ RunAncestryResponse,
124
125
  } from './types.js';
125
- export { streamEvents } from './sse.js';
126
- export type { EventsStreamContext, EventsStreamOptions } from './sse.js';
126
+ export { streamEvents, streamHostEvents } from './sse.js';
127
+ export type { EventsStreamContext, EventsStreamOptions, HostEventsStreamOptions } from './sse.js';
127
128
 
128
- // RFC 0002 + RFC 0024 typed event helpers — type guards over `RunEventDoc`
129
- // plus a high-level streaming-reasoning subscription helper.
129
+ // Generated from spec/v2/errors.json + schemas/v2/capabilities.schema.json.
130
+ export {
131
+ ERROR_CODES,
132
+ ERROR_CODE_HTTP_STATUS,
133
+ RETRIABLE_ERROR_CODES,
134
+ VENDOR_ERROR_CODE_PATTERN,
135
+ CAPABILITY_FAMILY_KEYS,
136
+ CAPABILITY_METADATA_KEYS,
137
+ } from './generated.js';
138
+ export type { ErrorCode, CapabilityFamilyKey, CapabilityMetadataKey } from './generated.js';
139
+
140
+ // Typed event helpers — type guards over `RunEventDoc` plus a high-level
141
+ // streaming-reasoning subscription helper.
130
142
  export {
131
143
  isAgentReasoned,
132
144
  isAgentReasoningDelta,
@@ -154,15 +166,18 @@ export type {
154
166
  Unsubscribe,
155
167
  } from './event-helpers.js';
156
168
 
157
- // Run-status + run-error helpers (added in 1). Forward-compat predicates
158
- // over the wire-format unions declared above; full design + rationale in
159
- // `run-helpers.ts`.
169
+ // Run-status + error-code helpers. `HTTP_ERROR_CODES` is the generated
170
+ // registry; `isErrorCode` narrows to it, `isRetriableErrorCode` to the
171
+ // `retriable: true` rows.
160
172
  export {
161
173
  ACTIVE_RUN_STATUSES,
162
174
  TERMINAL_RUN_STATUSES,
163
175
  isTerminalRunStatus,
164
176
  HTTP_ERROR_CODES,
165
177
  isHttpErrorCode,
178
+ isErrorCode,
179
+ isRetriableErrorCode,
180
+ isVendorErrorCode,
166
181
  RUN_ERROR_CODES,
167
182
  isRunErrorCode,
168
183
  } from './run-helpers.js';
@@ -174,56 +189,26 @@ export type {
174
189
  RunError,
175
190
  } from './run-helpers.js';
176
191
 
177
- // Cost-attribution allowlist + sanitizer helpers
178
- // (`spec/v1/observability.md §"Cost attribution attributes"`). Single
179
- // source of truth for the canonical attribute names so independent
180
- // hosts share one list instead of each re-deriving it.
192
+ // Cost-attribution allowlist + sanitizer helpers.
181
193
  export {
182
194
  OPENWOP_COST_ATTRIBUTE_NAMES,
183
195
  sanitizeCostAttributes,
184
196
  } from './cost-attribution.js';
185
197
  export type { OpenwopCostAttributeName } from './cost-attribution.js';
186
198
 
187
- // Webhook-delivery verification helpers (SDK-3 close-out 2026-05-15).
188
- // HMAC-SHA256 + timestamp freshness window verification per
189
- // spec/v1/webhooks.md §"Signature recipe". Receivers MUST verify both
190
- // the HMAC AND the timestamp to defeat replay attacks.
191
- //
192
- // DEPRECATED ON THE BARREL (openwop-sdks#30). These re-exports are why a
193
- // browser consumer importing anything at all from `@openwop/openwop` dragged
194
- // in `node:crypto` and failed the build. Import them from
195
- // `@openwop/openwop/webhooks` instead; the barrel re-export is retained for
196
- // compatibility and will be removed in the next major.
197
- //
198
- // Until then the `browser` field in package.json substitutes a stub that
199
- // throws with an explanatory message, so a browser build succeeds and only a
200
- // browser CALL fails — which is the correct outcome either way, since the
201
- // subscription secret must never reach a browser.
202
- /** @deprecated Import from `@openwop/openwop/webhooks` — server-only; removed from the barrel in the next major. */
199
+ // Webhook verification is server-only (`node:crypto`) and lives on the
200
+ // `@openwop/openwop/webhooks` subpath it is no longer re-exported from the
201
+ // barrel (the 1.x deprecation, removed in this major). The browser-safe
202
+ // header-family readers stay here.
203
203
  export {
204
- DEFAULT_WEBHOOK_FRESHNESS_WINDOW_SECONDS,
205
- verifyWebhookSignature,
206
- signWebhookDelivery,
207
- } from './webhook-helpers.js';
208
- export type {
209
- VerifyWebhookSignatureOptions,
210
- VerifyWebhookOutcome,
211
- } from './webhook-helpers.js';
212
-
213
- // Public-registry read helpers (SDK-5 close-out 2026-05-15). Read-only
214
- // typed client for the public node-pack registry at packs.openwop.dev
215
- // per spec/v1/registry-operations.md.
216
- export { RegistryClient } from './registry-helpers.js';
217
- export type {
218
- RegistryClientOptions,
219
- RegistryDiscovery,
220
- RegistryIndex,
221
- RegistryIndexEntry,
222
- RegistryPackMetadata,
223
- RegistryVersionManifest,
224
- } from './registry-helpers.js';
204
+ WEBHOOK_HEADER_FAMILIES,
205
+ WEBHOOK_SIGNATURE_ALGORITHMS,
206
+ parseSignatureValue,
207
+ readWebhookHeaders,
208
+ } from './webhook-header-families.js';
209
+ export type { WebhookHeaderRead, WebhookSignatureAlgorithm } from './webhook-header-families.js';
225
210
 
226
- // AI Envelope types (DRAFT v1.x spec/v1/ai-envelope.md). Inbound LLM-emission
211
+ // AI Envelope types (events.md §AI envelopes). Inbound LLM-emission
227
212
  // envelope, distinct from RunEventDoc (outbound) and ErrorEnvelope (host HTTP).
228
213
  export type {
229
214
  A2UISurfacePayload,
@@ -234,7 +219,6 @@ export type {
234
219
  ClarificationRequestPayload,
235
220
  EnvelopeContract,
236
221
  EnvelopeContractRefusal,
237
- EnvelopeContractsCapability,
238
222
  EnvelopeMeta,
239
223
  EnvelopeOutcome,
240
224
  EnvelopeStrictness,
@@ -255,23 +239,12 @@ export type {
255
239
  CreateTriggerSubscriptionResponse,
256
240
  } from './types.js';
257
241
 
258
- // RFC 0030 §A `reasoning` field prompt-directive helper. Hosts that
259
- // advertise `capabilities.envelopes.reasoning.supported: true` use this
260
- // to synthesize the system-prompt fragment that instructs the model to
261
- // populate the OPTIONAL `reasoning` field. See `envelope-directive.ts`
262
- // for the operational note on `"mandatory"` strength (provider-side
263
- // refusal risk per the 2026-05-21 RFC 0030 amendment).
242
+ // RFC 0030 §A `reasoning` field prompt-directive helper.
264
243
  export { buildReasoningDirective } from './envelope-directive.js';
265
244
  export type { ReasoningDirectiveStrength } from './envelope-directive.js';
266
245
 
267
- // RFC 0032 §B.3 + RFC 0033 §D refusal detection helper. Normalizes
268
- // per-provider safety-stop signals (Anthropic `stop_reason: "refusal"`,
269
- // OpenAI `message.refusal` + `finish_reason: "content_filter"`, Gemini
270
- // `finishReason: "SAFETY"` + `promptFeedback.blockReason: "SAFETY"`)
271
- // to a canonical `{ refusalText, safetyCategory?, provider }` shape.
272
- // Hosts route the non-null return through `envelope.refusal` emission
273
- // + the `envelope_refusal` terminal error code (RFC 0033 §F).
274
- // **SECURITY:** Pass `refusalText` through the BYOK redaction harness
275
- // BEFORE persistence — this helper does NOT redact.
246
+ // RFC 0032 §B.3 + RFC 0033 §D refusal detection helper. **SECURITY:** pass
247
+ // `refusalText` through the BYOK redaction harness BEFORE persistence — this
248
+ // helper does NOT redact.
276
249
  export { parseRefusal } from './parse-refusal.js';
277
250
  export type { RefusalProvider, RefusalSignal } from './parse-refusal.js';