openclaw-brokerkit 0.3.3 → 0.3.4

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.
package/README.md CHANGED
@@ -24,6 +24,24 @@ pnpm --filter openclaw-brokerkit build
24
24
  openclaw plugins install --link ./plugins/openclaw
25
25
  ```
26
26
 
27
+ ## Operator V1 consumers
28
+
29
+ Trusted hosts can consume the same generated Operator V1 types and runtime
30
+ validators as the plugin without installing OpenClaw:
31
+
32
+ ```ts
33
+ import {
34
+ parseRequestPage,
35
+ type RequestPage,
36
+ } from "openclaw-brokerkit/operator-v1";
37
+
38
+ const page: RequestPage = parseRequestPage(await response.json());
39
+ ```
40
+
41
+ The subpath is generated from BrokerKit's canonical OpenAPI document. Its
42
+ standalone validators use no runtime code generation and reject unknown fields,
43
+ invalid bounds, unsafe integers, and protocol drift.
44
+
27
45
  ## Choose a trust mode
28
46
 
29
47
  - `direct` trusts the OpenClaw process with operator SecretRefs and enables
@@ -0,0 +1,458 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+ export interface paths {
6
+ "/.well-known/brokerkit-operator": {
7
+ parameters: {
8
+ query?: never;
9
+ header?: never;
10
+ path?: never;
11
+ cookie?: never;
12
+ };
13
+ get: operations["discoverOperator"];
14
+ put?: never;
15
+ post?: never;
16
+ delete?: never;
17
+ options?: never;
18
+ head?: never;
19
+ patch?: never;
20
+ trace?: never;
21
+ };
22
+ "/healthz": {
23
+ parameters: {
24
+ query?: never;
25
+ header?: never;
26
+ path?: never;
27
+ cookie?: never;
28
+ };
29
+ get: operations["operatorHealth"];
30
+ put?: never;
31
+ post?: never;
32
+ delete?: never;
33
+ options?: never;
34
+ head?: never;
35
+ patch?: never;
36
+ trace?: never;
37
+ };
38
+ "/readyz": {
39
+ parameters: {
40
+ query?: never;
41
+ header?: never;
42
+ path?: never;
43
+ cookie?: never;
44
+ };
45
+ get: operations["operatorReady"];
46
+ put?: never;
47
+ post?: never;
48
+ delete?: never;
49
+ options?: never;
50
+ head?: never;
51
+ patch?: never;
52
+ trace?: never;
53
+ };
54
+ "/api/operator/v1/requests": {
55
+ parameters: {
56
+ query?: never;
57
+ header?: never;
58
+ path?: never;
59
+ cookie?: never;
60
+ };
61
+ /** @description Target fields use additional bounded query names with the target. prefix. */
62
+ get: operations["listOperatorRequests"];
63
+ put?: never;
64
+ post?: never;
65
+ delete?: never;
66
+ options?: never;
67
+ head?: never;
68
+ patch?: never;
69
+ trace?: never;
70
+ };
71
+ "/api/operator/v1/requests/{id}": {
72
+ parameters: {
73
+ query?: never;
74
+ header?: never;
75
+ path?: never;
76
+ cookie?: never;
77
+ };
78
+ get: operations["getOperatorRequest"];
79
+ put?: never;
80
+ post?: never;
81
+ delete?: never;
82
+ options?: never;
83
+ head?: never;
84
+ patch?: never;
85
+ trace?: never;
86
+ };
87
+ "/api/operator/v1/requests/{id}/{action}": {
88
+ parameters: {
89
+ query?: never;
90
+ header?: never;
91
+ path?: never;
92
+ cookie?: never;
93
+ };
94
+ get?: never;
95
+ put?: never;
96
+ post: operations["decideOperatorRequest"];
97
+ delete?: never;
98
+ options?: never;
99
+ head?: never;
100
+ patch?: never;
101
+ trace?: never;
102
+ };
103
+ "/api/operator/v1/events": {
104
+ parameters: {
105
+ query?: never;
106
+ header?: never;
107
+ path?: never;
108
+ cookie?: never;
109
+ };
110
+ get: operations["streamOperatorEvents"];
111
+ put?: never;
112
+ post?: never;
113
+ delete?: never;
114
+ options?: never;
115
+ head?: never;
116
+ patch?: never;
117
+ trace?: never;
118
+ };
119
+ }
120
+ export type webhooks = Record<string, never>;
121
+ export interface components {
122
+ schemas: {
123
+ Descriptor: {
124
+ /** @constant */
125
+ api_version: "brokerkit.io/operator/v1";
126
+ };
127
+ Health: {
128
+ status: string;
129
+ };
130
+ /** @enum {string} */
131
+ Action: "approve" | "deny" | "revoke";
132
+ /** @enum {string} */
133
+ Status: "pending" | "active" | "denied" | "canceled" | "expired" | "consumed" | "revoked";
134
+ /** @enum {string} */
135
+ StatusGroup: "pending" | "active" | "history" | "all";
136
+ Fact: {
137
+ label: string;
138
+ value: string;
139
+ };
140
+ Warning: {
141
+ severity: components["schemas"]["PresentationRisk"];
142
+ text: string;
143
+ };
144
+ /** @enum {string} */
145
+ PresentationRisk: "unknown" | "low" | "medium" | "high" | "critical";
146
+ Presentation: {
147
+ risk: components["schemas"]["PresentationRisk"];
148
+ title: string;
149
+ summary?: string;
150
+ target: string;
151
+ facts?: components["schemas"]["Fact"][];
152
+ warnings?: components["schemas"]["Warning"][];
153
+ plan_hash?: string;
154
+ };
155
+ ApprovalBounds: {
156
+ max_duration_seconds: number;
157
+ max_uses: number | null;
158
+ };
159
+ Constraints: {
160
+ duration_seconds?: number;
161
+ max_uses?: number | null;
162
+ };
163
+ NotificationDecision: {
164
+ /** @constant */
165
+ kind: "telegram";
166
+ renderer: string;
167
+ decision_token: string;
168
+ chat_id: number;
169
+ message_id: number;
170
+ text: string;
171
+ presentation_json: string;
172
+ presentation_digest: string;
173
+ rendered_digest: string;
174
+ };
175
+ Decision: {
176
+ expected_revision: number;
177
+ idempotency_key: string;
178
+ on_behalf_of?: string;
179
+ constraints?: components["schemas"]["Constraints"];
180
+ notification?: components["schemas"]["NotificationDecision"];
181
+ };
182
+ BrokerRequest: {
183
+ id: string;
184
+ revision: number;
185
+ requester: string;
186
+ operation: string;
187
+ status: components["schemas"]["Status"];
188
+ /** Format: date-time */
189
+ requested_at: string;
190
+ /** Format: date-time */
191
+ pending_expires_at?: string;
192
+ /** Format: date-time */
193
+ active_expires_at?: string;
194
+ requested_duration_seconds: number;
195
+ requested_max_uses: number | null;
196
+ granted_max_uses: number | null;
197
+ used_count: number;
198
+ request_reason?: string;
199
+ /** Format: date-time */
200
+ decided_at?: string;
201
+ decided_by?: string;
202
+ decided_on_behalf_of?: string;
203
+ presentation: components["schemas"]["Presentation"];
204
+ presentation_unavailable?: boolean;
205
+ allowed_actions: components["schemas"]["Action"][];
206
+ approval_bounds?: components["schemas"]["ApprovalBounds"];
207
+ };
208
+ RequestPage: {
209
+ requests: components["schemas"]["BrokerRequest"][];
210
+ next_cursor?: string;
211
+ event_cursor?: string;
212
+ };
213
+ UISourceHealth: {
214
+ id: string;
215
+ label: string;
216
+ healthy: boolean;
217
+ /** Format: date-time */
218
+ last_sync_at?: string;
219
+ error?: string;
220
+ };
221
+ UIRequest: {
222
+ source_id: string;
223
+ source_label: string;
224
+ handle: string;
225
+ request: components["schemas"]["BrokerRequest"];
226
+ };
227
+ UISnapshot: {
228
+ /** @constant */
229
+ api_version: "brokerkit.io/operator-ui/v1";
230
+ cursor: string;
231
+ /** Format: date-time */
232
+ synchronized_at: string;
233
+ sources: components["schemas"]["UISourceHealth"][];
234
+ requests: components["schemas"]["UIRequest"][];
235
+ delivery_failures?: number;
236
+ };
237
+ UISnapshotEvent: {
238
+ /** @constant */
239
+ api_version: "brokerkit.io/operator-ui/v1";
240
+ cursor: string;
241
+ changed: boolean;
242
+ };
243
+ UISummary: {
244
+ /** @constant */
245
+ api_version: "brokerkit.io/operator-ui/v1";
246
+ cursor: string;
247
+ pending: number;
248
+ healthy: boolean;
249
+ };
250
+ BrokerEvent: {
251
+ cursor: string;
252
+ /** @enum {string} */
253
+ kind: "request.created" | "request.approved" | "request.denied" | "request.canceled" | "request.expired" | "grant.revoked" | "grant.reserved" | "grant.consumed" | "grant.released" | "execution.succeeded" | "execution.failed" | "execution.ambiguous";
254
+ request_id: string;
255
+ revision: number;
256
+ status: components["schemas"]["Status"];
257
+ /** Format: date-time */
258
+ occurred_at: string;
259
+ used_count: number;
260
+ };
261
+ Error: {
262
+ /** @enum {string} */
263
+ code: "invalid_request" | "unauthorized" | "forbidden" | "not_found" | "method_not_allowed" | "revision_conflict" | "idempotency_conflict" | "constraint_exceeded" | "invalid_transition" | "invalid_decision_token" | "cursor_expired" | "temporarily_unavailable" | "internal_error";
264
+ message: string;
265
+ correlation_id: string;
266
+ current?: components["schemas"]["BrokerRequest"];
267
+ };
268
+ ErrorEnvelope: {
269
+ error: components["schemas"]["Error"];
270
+ };
271
+ };
272
+ responses: {
273
+ /** @description Stable error envelope */
274
+ ErrorResponse: {
275
+ headers: {
276
+ [name: string]: unknown;
277
+ };
278
+ content: {
279
+ "application/json": components["schemas"]["ErrorEnvelope"];
280
+ };
281
+ };
282
+ };
283
+ parameters: {
284
+ RequestID: string;
285
+ };
286
+ requestBodies: never;
287
+ headers: never;
288
+ pathItems: never;
289
+ }
290
+ export type $defs = Record<string, never>;
291
+ export interface operations {
292
+ discoverOperator: {
293
+ parameters: {
294
+ query?: never;
295
+ header?: never;
296
+ path?: never;
297
+ cookie?: never;
298
+ };
299
+ requestBody?: never;
300
+ responses: {
301
+ /** @description Operator V1 discovery */
302
+ 200: {
303
+ headers: {
304
+ [name: string]: unknown;
305
+ };
306
+ content: {
307
+ "application/json": components["schemas"]["Descriptor"];
308
+ };
309
+ };
310
+ default: components["responses"]["ErrorResponse"];
311
+ };
312
+ };
313
+ operatorHealth: {
314
+ parameters: {
315
+ query?: never;
316
+ header?: never;
317
+ path?: never;
318
+ cookie?: never;
319
+ };
320
+ requestBody?: never;
321
+ responses: {
322
+ /** @description Liveness status */
323
+ 200: {
324
+ headers: {
325
+ [name: string]: unknown;
326
+ };
327
+ content: {
328
+ "application/json": components["schemas"]["Health"];
329
+ };
330
+ };
331
+ };
332
+ };
333
+ operatorReady: {
334
+ parameters: {
335
+ query?: never;
336
+ header?: never;
337
+ path?: never;
338
+ cookie?: never;
339
+ };
340
+ requestBody?: never;
341
+ responses: {
342
+ /** @description Readiness status */
343
+ 200: {
344
+ headers: {
345
+ [name: string]: unknown;
346
+ };
347
+ content: {
348
+ "application/json": components["schemas"]["Health"];
349
+ };
350
+ };
351
+ 503: components["responses"]["ErrorResponse"];
352
+ };
353
+ };
354
+ listOperatorRequests: {
355
+ parameters: {
356
+ query?: {
357
+ status?: components["schemas"]["StatusGroup"];
358
+ requester?: string;
359
+ operation?: string;
360
+ target_kind?: string;
361
+ cursor?: string;
362
+ limit?: number;
363
+ };
364
+ header?: never;
365
+ path?: never;
366
+ cookie?: never;
367
+ };
368
+ requestBody?: never;
369
+ responses: {
370
+ /** @description Bounded request page */
371
+ 200: {
372
+ headers: {
373
+ [name: string]: unknown;
374
+ };
375
+ content: {
376
+ "application/json": components["schemas"]["RequestPage"];
377
+ };
378
+ };
379
+ default: components["responses"]["ErrorResponse"];
380
+ };
381
+ };
382
+ getOperatorRequest: {
383
+ parameters: {
384
+ query?: never;
385
+ header?: never;
386
+ path: {
387
+ id: components["parameters"]["RequestID"];
388
+ };
389
+ cookie?: never;
390
+ };
391
+ requestBody?: never;
392
+ responses: {
393
+ /** @description Safe operator request */
394
+ 200: {
395
+ headers: {
396
+ [name: string]: unknown;
397
+ };
398
+ content: {
399
+ "application/json": components["schemas"]["BrokerRequest"];
400
+ };
401
+ };
402
+ default: components["responses"]["ErrorResponse"];
403
+ };
404
+ };
405
+ decideOperatorRequest: {
406
+ parameters: {
407
+ query?: never;
408
+ header?: never;
409
+ path: {
410
+ id: components["parameters"]["RequestID"];
411
+ action: components["schemas"]["Action"];
412
+ };
413
+ cookie?: never;
414
+ };
415
+ requestBody: {
416
+ content: {
417
+ "application/json": components["schemas"]["Decision"];
418
+ };
419
+ };
420
+ responses: {
421
+ /** @description Committed decision */
422
+ 200: {
423
+ headers: {
424
+ [name: string]: unknown;
425
+ };
426
+ content: {
427
+ "application/json": components["schemas"]["BrokerRequest"];
428
+ };
429
+ };
430
+ default: components["responses"]["ErrorResponse"];
431
+ };
432
+ };
433
+ streamOperatorEvents: {
434
+ parameters: {
435
+ query?: {
436
+ cursor?: string;
437
+ };
438
+ header?: {
439
+ "Last-Event-ID"?: string;
440
+ };
441
+ path?: never;
442
+ cookie?: never;
443
+ };
444
+ requestBody?: never;
445
+ responses: {
446
+ /** @description SSE stream of BrokerEvent values */
447
+ 200: {
448
+ headers: {
449
+ [name: string]: unknown;
450
+ };
451
+ content: {
452
+ "text/event-stream": string;
453
+ };
454
+ };
455
+ default: components["responses"]["ErrorResponse"];
456
+ };
457
+ };
458
+ }
@@ -0,0 +1,36 @@
1
+ import type { components } from "./openapi-operator-v1.js";
2
+ export declare const OPERATOR_V1_SCHEMA_SHA256 = "fb446551ce8f2e00cfb6555daf93ed5b8e2ce8c45d8029b4a49e6a5fb8fef98d";
3
+ export declare const operatorV1: {
4
+ readonly apiVersion: "brokerkit.io/operator/v1";
5
+ readonly statuses: readonly ["pending", "active", "denied", "canceled", "expired", "consumed", "revoked"];
6
+ readonly actions: readonly ["approve", "deny", "revoke"];
7
+ readonly eventKinds: readonly ["request.created", "request.approved", "request.denied", "request.canceled", "request.expired", "grant.revoked", "grant.reserved", "grant.consumed", "grant.released", "execution.succeeded", "execution.failed", "execution.ambiguous"];
8
+ readonly errorCodes: readonly ["invalid_request", "unauthorized", "forbidden", "not_found", "method_not_allowed", "revision_conflict", "idempotency_conflict", "constraint_exceeded", "invalid_transition", "invalid_decision_token", "cursor_expired", "temporarily_unavailable", "internal_error"];
9
+ readonly limits: {
10
+ readonly id: 128;
11
+ readonly requester: 80;
12
+ readonly operation: 500;
13
+ readonly reason: 2000;
14
+ readonly actor: 200;
15
+ readonly title: 200;
16
+ readonly summary: 2000;
17
+ readonly facts: 20;
18
+ readonly factLabel: 80;
19
+ readonly factValue: 500;
20
+ readonly cursor: 1024;
21
+ readonly page: 100;
22
+ readonly idempotencyKey: 200;
23
+ readonly errorMessage: 500;
24
+ readonly correlationId: 128;
25
+ };
26
+ };
27
+ export type Decision = components["schemas"]["Decision"];
28
+ export type Discovery = components["schemas"]["Descriptor"];
29
+ export type ErrorEnvelope = components["schemas"]["ErrorEnvelope"];
30
+ export type BrokerEvent = components["schemas"]["BrokerEvent"];
31
+ export type RequestPage = components["schemas"]["RequestPage"];
32
+ export type Presentation = components["schemas"]["Presentation"];
33
+ export type BrokerRequest = components["schemas"]["BrokerRequest"];
34
+ export type UISnapshot = components["schemas"]["UISnapshot"];
35
+ export type UISnapshotEvent = components["schemas"]["UISnapshotEvent"];
36
+ export type UISummary = components["schemas"]["UISummary"];
@@ -1,4 +1,4 @@
1
- export const OPERATOR_V1_SCHEMA_SHA256 = "306810514cd7e378b194f9d539aae99de07396994ec7de273a18dc5a4aa47118";
1
+ export const OPERATOR_V1_SCHEMA_SHA256 = "fb446551ce8f2e00cfb6555daf93ed5b8e2ce8c45d8029b4a49e6a5fb8fef98d";
2
2
  export const operatorV1 = {
3
3
  apiVersion: "brokerkit.io/operator/v1",
4
4
  statuses: [
@@ -0,0 +1,131 @@
1
+ export declare const validateDescriptor: typeof validate20;
2
+ declare function validate20(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
3
+ instancePath?: string | undefined;
4
+ rootData?: any;
5
+ dynamicAnchors?: {} | undefined;
6
+ }): boolean;
7
+ declare namespace validate20 {
8
+ var evaluated: {
9
+ props: boolean;
10
+ dynamicProps: boolean;
11
+ dynamicItems: boolean;
12
+ };
13
+ }
14
+ export declare const validateHealth: typeof validate22;
15
+ declare function validate22(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
16
+ instancePath?: string | undefined;
17
+ rootData?: any;
18
+ dynamicAnchors?: {} | undefined;
19
+ }): boolean;
20
+ declare namespace validate22 {
21
+ var evaluated: {
22
+ props: boolean;
23
+ dynamicProps: boolean;
24
+ dynamicItems: boolean;
25
+ };
26
+ }
27
+ export declare const validateBrokerRequest: typeof validate23;
28
+ declare function validate23(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
29
+ instancePath?: string | undefined;
30
+ rootData?: any;
31
+ dynamicAnchors?: {} | undefined;
32
+ }): boolean;
33
+ declare namespace validate23 {
34
+ var evaluated: {
35
+ props: boolean;
36
+ dynamicProps: boolean;
37
+ dynamicItems: boolean;
38
+ };
39
+ }
40
+ export declare const validateRequestPage: typeof validate30;
41
+ declare function validate30(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
42
+ instancePath?: string | undefined;
43
+ rootData?: any;
44
+ dynamicAnchors?: {} | undefined;
45
+ }): boolean;
46
+ declare namespace validate30 {
47
+ var evaluated: {
48
+ props: boolean;
49
+ dynamicProps: boolean;
50
+ dynamicItems: boolean;
51
+ };
52
+ }
53
+ export declare const validateBrokerEvent: typeof validate36;
54
+ declare function validate36(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
55
+ instancePath?: string | undefined;
56
+ rootData?: any;
57
+ dynamicAnchors?: {} | undefined;
58
+ }): boolean;
59
+ declare namespace validate36 {
60
+ var evaluated: {
61
+ props: boolean;
62
+ dynamicProps: boolean;
63
+ dynamicItems: boolean;
64
+ };
65
+ }
66
+ export declare const validateErrorEnvelope: typeof validate39;
67
+ declare function validate39(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
68
+ instancePath?: string | undefined;
69
+ rootData?: any;
70
+ dynamicAnchors?: {} | undefined;
71
+ }): boolean;
72
+ declare namespace validate39 {
73
+ var evaluated: {
74
+ props: boolean;
75
+ dynamicProps: boolean;
76
+ dynamicItems: boolean;
77
+ };
78
+ }
79
+ export declare const validateUISnapshot: typeof validate45;
80
+ declare function validate45(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
81
+ instancePath?: string | undefined;
82
+ rootData?: any;
83
+ dynamicAnchors?: {} | undefined;
84
+ }): boolean;
85
+ declare namespace validate45 {
86
+ var evaluated: {
87
+ props: boolean;
88
+ dynamicProps: boolean;
89
+ dynamicItems: boolean;
90
+ };
91
+ }
92
+ export declare const validateUISnapshotEvent: typeof validate51;
93
+ declare function validate51(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
94
+ instancePath?: string | undefined;
95
+ rootData?: any;
96
+ dynamicAnchors?: {} | undefined;
97
+ }): boolean;
98
+ declare namespace validate51 {
99
+ var evaluated: {
100
+ props: boolean;
101
+ dynamicProps: boolean;
102
+ dynamicItems: boolean;
103
+ };
104
+ }
105
+ export declare const validateUISummary: typeof validate52;
106
+ declare function validate52(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
107
+ instancePath?: string | undefined;
108
+ rootData?: any;
109
+ dynamicAnchors?: {} | undefined;
110
+ }): boolean;
111
+ declare namespace validate52 {
112
+ var evaluated: {
113
+ props: boolean;
114
+ dynamicProps: boolean;
115
+ dynamicItems: boolean;
116
+ };
117
+ }
118
+ export declare const validateUIRequest: typeof validate53;
119
+ declare function validate53(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
120
+ instancePath?: string | undefined;
121
+ rootData?: any;
122
+ dynamicAnchors?: {} | undefined;
123
+ }): boolean;
124
+ declare namespace validate53 {
125
+ var evaluated: {
126
+ props: boolean;
127
+ dynamicProps: boolean;
128
+ dynamicItems: boolean;
129
+ };
130
+ }
131
+ export {};