@butterbase/shared 0.4.0 → 0.4.2

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.
@@ -0,0 +1,2376 @@
1
+ import { z } from 'zod';
2
+ /** Public organization-scoped Office protocol. No app or browser session is implied. */
3
+ export declare const OFFICE_ACTIONS: readonly ["status", "enable", "pause", "resume", "list_decisions", "get_decision", "get_decision_context", "approve", "deny", "create_conversation", "list_conversations", "get_conversation", "ask", "list_memory", "search_memory", "get_source_artifact", "record_decision", "record_commitment", "record_learning", "list_principles", "get_principle", "record_principle"];
4
+ export type OfficeAction = typeof OFFICE_ACTIONS[number];
5
+ export declare const decisionRefSchema: z.ZodObject<{
6
+ source: z.ZodEnum<["office", "substrate"]>;
7
+ id: z.ZodString;
8
+ }, "strict", z.ZodTypeAny, {
9
+ source: "office" | "substrate";
10
+ id: string;
11
+ }, {
12
+ source: "office" | "substrate";
13
+ id: string;
14
+ }>;
15
+ export type DecisionRef = z.infer<typeof decisionRefSchema>;
16
+ export declare const officeRecordDecisionSchema: z.ZodObject<{
17
+ title: z.ZodString;
18
+ rationale: z.ZodOptional<z.ZodString>;
19
+ kind: z.ZodEnum<["operational", "strategic", "mission", "vision", "principle", "policy_decision"]>;
20
+ salience: z.ZodDefault<z.ZodEnum<["ambient", "normal", "archival"]>>;
21
+ source_artifact_id: z.ZodOptional<z.ZodString>;
22
+ }, "strict", z.ZodTypeAny, {
23
+ title: string;
24
+ kind: "vision" | "operational" | "strategic" | "mission" | "principle" | "policy_decision";
25
+ salience: "ambient" | "normal" | "archival";
26
+ rationale?: string | undefined;
27
+ source_artifact_id?: string | undefined;
28
+ }, {
29
+ title: string;
30
+ kind: "vision" | "operational" | "strategic" | "mission" | "principle" | "policy_decision";
31
+ rationale?: string | undefined;
32
+ salience?: "ambient" | "normal" | "archival" | undefined;
33
+ source_artifact_id?: string | undefined;
34
+ }>;
35
+ export declare const officeRecordCommitmentSchema: z.ZodObject<{
36
+ description: z.ZodString;
37
+ from_entity: z.ZodOptional<z.ZodString>;
38
+ to_entity: z.ZodOptional<z.ZodString>;
39
+ amount: z.ZodOptional<z.ZodNumber>;
40
+ unit: z.ZodOptional<z.ZodString>;
41
+ due_at: z.ZodOptional<z.ZodString>;
42
+ status: z.ZodEnum<["proposed", "tentative", "confirmed", "fulfilled", "expired", "broken"]>;
43
+ source_artifact_id: z.ZodOptional<z.ZodString>;
44
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
45
+ }, "strict", z.ZodTypeAny, {
46
+ status: "proposed" | "tentative" | "confirmed" | "fulfilled" | "expired" | "broken";
47
+ description: string;
48
+ source_artifact_id?: string | undefined;
49
+ from_entity?: string | undefined;
50
+ to_entity?: string | undefined;
51
+ amount?: number | undefined;
52
+ unit?: string | undefined;
53
+ due_at?: string | undefined;
54
+ attrs?: Record<string, unknown> | undefined;
55
+ }, {
56
+ status: "proposed" | "tentative" | "confirmed" | "fulfilled" | "expired" | "broken";
57
+ description: string;
58
+ source_artifact_id?: string | undefined;
59
+ from_entity?: string | undefined;
60
+ to_entity?: string | undefined;
61
+ amount?: number | undefined;
62
+ unit?: string | undefined;
63
+ due_at?: string | undefined;
64
+ attrs?: Record<string, unknown> | undefined;
65
+ }>;
66
+ export declare const officeRecordLearningSchema: z.ZodObject<{
67
+ title: z.ZodString;
68
+ description: z.ZodString;
69
+ resolution_taken: z.ZodOptional<z.ZodString>;
70
+ related_decision_id: z.ZodOptional<z.ZodString>;
71
+ source_artifact_id: z.ZodOptional<z.ZodString>;
72
+ }, "strict", z.ZodTypeAny, {
73
+ title: string;
74
+ description: string;
75
+ source_artifact_id?: string | undefined;
76
+ resolution_taken?: string | undefined;
77
+ related_decision_id?: string | undefined;
78
+ }, {
79
+ title: string;
80
+ description: string;
81
+ source_artifact_id?: string | undefined;
82
+ resolution_taken?: string | undefined;
83
+ related_decision_id?: string | undefined;
84
+ }>;
85
+ export declare const officeRecordPrincipleSchema: z.ZodObject<{
86
+ title: z.ZodString;
87
+ rationale: z.ZodOptional<z.ZodString>;
88
+ applies_to: z.ZodRecord<z.ZodString, z.ZodUnknown>;
89
+ constraint_spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
90
+ salience: z.ZodDefault<z.ZodEnum<["ambient", "normal", "archival"]>>;
91
+ }, "strict", z.ZodTypeAny, {
92
+ title: string;
93
+ salience: "ambient" | "normal" | "archival";
94
+ applies_to: Record<string, unknown>;
95
+ constraint_spec: Record<string, unknown>;
96
+ rationale?: string | undefined;
97
+ }, {
98
+ title: string;
99
+ applies_to: Record<string, unknown>;
100
+ constraint_spec: Record<string, unknown>;
101
+ rationale?: string | undefined;
102
+ salience?: "ambient" | "normal" | "archival" | undefined;
103
+ }>;
104
+ export type OfficeRecordDecisionInput = z.input<typeof officeRecordDecisionSchema>;
105
+ export type OfficeRecordCommitmentInput = z.input<typeof officeRecordCommitmentSchema>;
106
+ export type OfficeRecordLearningInput = z.input<typeof officeRecordLearningSchema>;
107
+ export type OfficeRecordPrincipleInput = z.input<typeof officeRecordPrincipleSchema>;
108
+ export declare const officeMemorySchemas: {
109
+ readonly record_decision: z.ZodObject<{
110
+ title: z.ZodString;
111
+ rationale: z.ZodOptional<z.ZodString>;
112
+ kind: z.ZodEnum<["operational", "strategic", "mission", "vision", "principle", "policy_decision"]>;
113
+ salience: z.ZodDefault<z.ZodEnum<["ambient", "normal", "archival"]>>;
114
+ source_artifact_id: z.ZodOptional<z.ZodString>;
115
+ }, "strict", z.ZodTypeAny, {
116
+ title: string;
117
+ kind: "vision" | "operational" | "strategic" | "mission" | "principle" | "policy_decision";
118
+ salience: "ambient" | "normal" | "archival";
119
+ rationale?: string | undefined;
120
+ source_artifact_id?: string | undefined;
121
+ }, {
122
+ title: string;
123
+ kind: "vision" | "operational" | "strategic" | "mission" | "principle" | "policy_decision";
124
+ rationale?: string | undefined;
125
+ salience?: "ambient" | "normal" | "archival" | undefined;
126
+ source_artifact_id?: string | undefined;
127
+ }>;
128
+ readonly record_commitment: z.ZodObject<{
129
+ description: z.ZodString;
130
+ from_entity: z.ZodOptional<z.ZodString>;
131
+ to_entity: z.ZodOptional<z.ZodString>;
132
+ amount: z.ZodOptional<z.ZodNumber>;
133
+ unit: z.ZodOptional<z.ZodString>;
134
+ due_at: z.ZodOptional<z.ZodString>;
135
+ status: z.ZodEnum<["proposed", "tentative", "confirmed", "fulfilled", "expired", "broken"]>;
136
+ source_artifact_id: z.ZodOptional<z.ZodString>;
137
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
138
+ }, "strict", z.ZodTypeAny, {
139
+ status: "proposed" | "tentative" | "confirmed" | "fulfilled" | "expired" | "broken";
140
+ description: string;
141
+ source_artifact_id?: string | undefined;
142
+ from_entity?: string | undefined;
143
+ to_entity?: string | undefined;
144
+ amount?: number | undefined;
145
+ unit?: string | undefined;
146
+ due_at?: string | undefined;
147
+ attrs?: Record<string, unknown> | undefined;
148
+ }, {
149
+ status: "proposed" | "tentative" | "confirmed" | "fulfilled" | "expired" | "broken";
150
+ description: string;
151
+ source_artifact_id?: string | undefined;
152
+ from_entity?: string | undefined;
153
+ to_entity?: string | undefined;
154
+ amount?: number | undefined;
155
+ unit?: string | undefined;
156
+ due_at?: string | undefined;
157
+ attrs?: Record<string, unknown> | undefined;
158
+ }>;
159
+ readonly record_learning: z.ZodObject<{
160
+ title: z.ZodString;
161
+ description: z.ZodString;
162
+ resolution_taken: z.ZodOptional<z.ZodString>;
163
+ related_decision_id: z.ZodOptional<z.ZodString>;
164
+ source_artifact_id: z.ZodOptional<z.ZodString>;
165
+ }, "strict", z.ZodTypeAny, {
166
+ title: string;
167
+ description: string;
168
+ source_artifact_id?: string | undefined;
169
+ resolution_taken?: string | undefined;
170
+ related_decision_id?: string | undefined;
171
+ }, {
172
+ title: string;
173
+ description: string;
174
+ source_artifact_id?: string | undefined;
175
+ resolution_taken?: string | undefined;
176
+ related_decision_id?: string | undefined;
177
+ }>;
178
+ readonly record_principle: z.ZodObject<{
179
+ title: z.ZodString;
180
+ rationale: z.ZodOptional<z.ZodString>;
181
+ applies_to: z.ZodRecord<z.ZodString, z.ZodUnknown>;
182
+ constraint_spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
183
+ salience: z.ZodDefault<z.ZodEnum<["ambient", "normal", "archival"]>>;
184
+ }, "strict", z.ZodTypeAny, {
185
+ title: string;
186
+ salience: "ambient" | "normal" | "archival";
187
+ applies_to: Record<string, unknown>;
188
+ constraint_spec: Record<string, unknown>;
189
+ rationale?: string | undefined;
190
+ }, {
191
+ title: string;
192
+ applies_to: Record<string, unknown>;
193
+ constraint_spec: Record<string, unknown>;
194
+ rationale?: string | undefined;
195
+ salience?: "ambient" | "normal" | "archival" | undefined;
196
+ }>;
197
+ };
198
+ export type OfficeMemoryKind = keyof typeof officeMemorySchemas;
199
+ export declare const officeActionSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
200
+ action: z.ZodLiteral<"status">;
201
+ confirmation_id: z.ZodOptional<z.ZodString>;
202
+ org_id: z.ZodString;
203
+ }, "strict", z.ZodTypeAny, {
204
+ action: "status";
205
+ org_id: string;
206
+ confirmation_id?: string | undefined;
207
+ }, {
208
+ action: "status";
209
+ org_id: string;
210
+ confirmation_id?: string | undefined;
211
+ }>, z.ZodObject<{
212
+ action: z.ZodLiteral<"enable">;
213
+ idempotency_key: z.ZodString;
214
+ org_id: z.ZodString;
215
+ }, "strict", z.ZodTypeAny, {
216
+ action: "enable";
217
+ org_id: string;
218
+ idempotency_key: string;
219
+ }, {
220
+ action: "enable";
221
+ org_id: string;
222
+ idempotency_key: string;
223
+ }>, z.ZodObject<{
224
+ action: z.ZodLiteral<"pause">;
225
+ idempotency_key: z.ZodString;
226
+ org_id: z.ZodString;
227
+ }, "strict", z.ZodTypeAny, {
228
+ action: "pause";
229
+ org_id: string;
230
+ idempotency_key: string;
231
+ }, {
232
+ action: "pause";
233
+ org_id: string;
234
+ idempotency_key: string;
235
+ }>, z.ZodObject<{
236
+ action: z.ZodLiteral<"resume">;
237
+ idempotency_key: z.ZodString;
238
+ org_id: z.ZodString;
239
+ }, "strict", z.ZodTypeAny, {
240
+ action: "resume";
241
+ org_id: string;
242
+ idempotency_key: string;
243
+ }, {
244
+ action: "resume";
245
+ org_id: string;
246
+ idempotency_key: string;
247
+ }>, z.ZodObject<{
248
+ action: z.ZodLiteral<"list_decisions">;
249
+ status: z.ZodDefault<z.ZodEnum<["pending", "resolved", "all"]>>;
250
+ cursor: z.ZodOptional<z.ZodString>;
251
+ limit: z.ZodOptional<z.ZodNumber>;
252
+ org_id: z.ZodString;
253
+ }, "strict", z.ZodTypeAny, {
254
+ status: "pending" | "resolved" | "all";
255
+ action: "list_decisions";
256
+ org_id: string;
257
+ cursor?: string | undefined;
258
+ limit?: number | undefined;
259
+ }, {
260
+ action: "list_decisions";
261
+ org_id: string;
262
+ status?: "pending" | "resolved" | "all" | undefined;
263
+ cursor?: string | undefined;
264
+ limit?: number | undefined;
265
+ }>, z.ZodObject<{
266
+ action: z.ZodLiteral<"get_decision">;
267
+ decision_id: z.ZodString;
268
+ decision_source: z.ZodDefault<z.ZodEnum<["office", "substrate"]>>;
269
+ org_id: z.ZodString;
270
+ }, "strict", z.ZodTypeAny, {
271
+ action: "get_decision";
272
+ org_id: string;
273
+ decision_id: string;
274
+ decision_source: "office" | "substrate";
275
+ }, {
276
+ action: "get_decision";
277
+ org_id: string;
278
+ decision_id: string;
279
+ decision_source?: "office" | "substrate" | undefined;
280
+ }>, z.ZodObject<{
281
+ action: z.ZodLiteral<"get_decision_context">;
282
+ limit: z.ZodOptional<z.ZodNumber>;
283
+ decision_id: z.ZodString;
284
+ decision_source: z.ZodDefault<z.ZodEnum<["office", "substrate"]>>;
285
+ org_id: z.ZodString;
286
+ }, "strict", z.ZodTypeAny, {
287
+ action: "get_decision_context";
288
+ org_id: string;
289
+ decision_id: string;
290
+ decision_source: "office" | "substrate";
291
+ limit?: number | undefined;
292
+ }, {
293
+ action: "get_decision_context";
294
+ org_id: string;
295
+ decision_id: string;
296
+ limit?: number | undefined;
297
+ decision_source?: "office" | "substrate" | undefined;
298
+ }>, z.ZodObject<{
299
+ action: z.ZodLiteral<"approve">;
300
+ idempotency_key: z.ZodString;
301
+ decision_id: z.ZodString;
302
+ decision_source: z.ZodDefault<z.ZodEnum<["office", "substrate"]>>;
303
+ org_id: z.ZodString;
304
+ }, "strict", z.ZodTypeAny, {
305
+ action: "approve";
306
+ org_id: string;
307
+ idempotency_key: string;
308
+ decision_id: string;
309
+ decision_source: "office" | "substrate";
310
+ }, {
311
+ action: "approve";
312
+ org_id: string;
313
+ idempotency_key: string;
314
+ decision_id: string;
315
+ decision_source?: "office" | "substrate" | undefined;
316
+ }>, z.ZodObject<{
317
+ action: z.ZodLiteral<"deny">;
318
+ reason: z.ZodString;
319
+ decision_id: z.ZodString;
320
+ decision_source: z.ZodDefault<z.ZodEnum<["office", "substrate"]>>;
321
+ org_id: z.ZodString;
322
+ }, "strict", z.ZodTypeAny, {
323
+ reason: string;
324
+ action: "deny";
325
+ org_id: string;
326
+ decision_id: string;
327
+ decision_source: "office" | "substrate";
328
+ }, {
329
+ reason: string;
330
+ action: "deny";
331
+ org_id: string;
332
+ decision_id: string;
333
+ decision_source?: "office" | "substrate" | undefined;
334
+ }>, z.ZodObject<{
335
+ action: z.ZodLiteral<"create_conversation">;
336
+ title: z.ZodOptional<z.ZodString>;
337
+ idempotency_key: z.ZodString;
338
+ org_id: z.ZodString;
339
+ }, "strict", z.ZodTypeAny, {
340
+ action: "create_conversation";
341
+ org_id: string;
342
+ idempotency_key: string;
343
+ title?: string | undefined;
344
+ }, {
345
+ action: "create_conversation";
346
+ org_id: string;
347
+ idempotency_key: string;
348
+ title?: string | undefined;
349
+ }>, z.ZodObject<{
350
+ action: z.ZodLiteral<"list_conversations">;
351
+ cursor: z.ZodOptional<z.ZodString>;
352
+ limit: z.ZodOptional<z.ZodNumber>;
353
+ org_id: z.ZodString;
354
+ }, "strict", z.ZodTypeAny, {
355
+ action: "list_conversations";
356
+ org_id: string;
357
+ cursor?: string | undefined;
358
+ limit?: number | undefined;
359
+ }, {
360
+ action: "list_conversations";
361
+ org_id: string;
362
+ cursor?: string | undefined;
363
+ limit?: number | undefined;
364
+ }>, z.ZodObject<{
365
+ action: z.ZodLiteral<"get_conversation">;
366
+ conversation_id: z.ZodString;
367
+ turn_id: z.ZodOptional<z.ZodString>;
368
+ after_sequence: z.ZodOptional<z.ZodNumber>;
369
+ limit: z.ZodOptional<z.ZodNumber>;
370
+ org_id: z.ZodString;
371
+ }, "strict", z.ZodTypeAny, {
372
+ action: "get_conversation";
373
+ org_id: string;
374
+ conversation_id: string;
375
+ limit?: number | undefined;
376
+ turn_id?: string | undefined;
377
+ after_sequence?: number | undefined;
378
+ }, {
379
+ action: "get_conversation";
380
+ org_id: string;
381
+ conversation_id: string;
382
+ limit?: number | undefined;
383
+ turn_id?: string | undefined;
384
+ after_sequence?: number | undefined;
385
+ }>, z.ZodObject<{
386
+ action: z.ZodLiteral<"ask">;
387
+ message: z.ZodString;
388
+ conversation_id: z.ZodOptional<z.ZodString>;
389
+ wait_ms: z.ZodDefault<z.ZodNumber>;
390
+ idempotency_key: z.ZodString;
391
+ org_id: z.ZodString;
392
+ }, "strict", z.ZodTypeAny, {
393
+ message: string;
394
+ action: "ask";
395
+ org_id: string;
396
+ idempotency_key: string;
397
+ wait_ms: number;
398
+ conversation_id?: string | undefined;
399
+ }, {
400
+ message: string;
401
+ action: "ask";
402
+ org_id: string;
403
+ idempotency_key: string;
404
+ conversation_id?: string | undefined;
405
+ wait_ms?: number | undefined;
406
+ }>, z.ZodObject<{
407
+ action: z.ZodLiteral<"list_memory">;
408
+ kind: z.ZodOptional<z.ZodEnum<["decision", "commitment", "learning"]>>;
409
+ cursor: z.ZodOptional<z.ZodString>;
410
+ limit: z.ZodOptional<z.ZodNumber>;
411
+ org_id: z.ZodString;
412
+ }, "strict", z.ZodTypeAny, {
413
+ action: "list_memory";
414
+ org_id: string;
415
+ kind?: "decision" | "commitment" | "learning" | undefined;
416
+ cursor?: string | undefined;
417
+ limit?: number | undefined;
418
+ }, {
419
+ action: "list_memory";
420
+ org_id: string;
421
+ kind?: "decision" | "commitment" | "learning" | undefined;
422
+ cursor?: string | undefined;
423
+ limit?: number | undefined;
424
+ }>, z.ZodObject<{
425
+ action: z.ZodLiteral<"search_memory">;
426
+ query: z.ZodString;
427
+ limit: z.ZodOptional<z.ZodNumber>;
428
+ org_id: z.ZodString;
429
+ }, "strict", z.ZodTypeAny, {
430
+ action: "search_memory";
431
+ org_id: string;
432
+ query: string;
433
+ limit?: number | undefined;
434
+ }, {
435
+ action: "search_memory";
436
+ org_id: string;
437
+ query: string;
438
+ limit?: number | undefined;
439
+ }>, z.ZodObject<{
440
+ action: z.ZodLiteral<"get_source_artifact">;
441
+ source_artifact_id: z.ZodString;
442
+ org_id: z.ZodString;
443
+ }, "strict", z.ZodTypeAny, {
444
+ source_artifact_id: string;
445
+ action: "get_source_artifact";
446
+ org_id: string;
447
+ }, {
448
+ source_artifact_id: string;
449
+ action: "get_source_artifact";
450
+ org_id: string;
451
+ }>, z.ZodObject<{
452
+ action: z.ZodLiteral<"record_decision">;
453
+ payload: z.ZodObject<{
454
+ title: z.ZodString;
455
+ rationale: z.ZodOptional<z.ZodString>;
456
+ kind: z.ZodEnum<["operational", "strategic", "mission", "vision", "principle", "policy_decision"]>;
457
+ salience: z.ZodDefault<z.ZodEnum<["ambient", "normal", "archival"]>>;
458
+ source_artifact_id: z.ZodOptional<z.ZodString>;
459
+ }, "strict", z.ZodTypeAny, {
460
+ title: string;
461
+ kind: "vision" | "operational" | "strategic" | "mission" | "principle" | "policy_decision";
462
+ salience: "ambient" | "normal" | "archival";
463
+ rationale?: string | undefined;
464
+ source_artifact_id?: string | undefined;
465
+ }, {
466
+ title: string;
467
+ kind: "vision" | "operational" | "strategic" | "mission" | "principle" | "policy_decision";
468
+ rationale?: string | undefined;
469
+ salience?: "ambient" | "normal" | "archival" | undefined;
470
+ source_artifact_id?: string | undefined;
471
+ }>;
472
+ idempotency_key: z.ZodString;
473
+ org_id: z.ZodString;
474
+ }, "strict", z.ZodTypeAny, {
475
+ action: "record_decision";
476
+ org_id: string;
477
+ idempotency_key: string;
478
+ payload: {
479
+ title: string;
480
+ kind: "vision" | "operational" | "strategic" | "mission" | "principle" | "policy_decision";
481
+ salience: "ambient" | "normal" | "archival";
482
+ rationale?: string | undefined;
483
+ source_artifact_id?: string | undefined;
484
+ };
485
+ }, {
486
+ action: "record_decision";
487
+ org_id: string;
488
+ idempotency_key: string;
489
+ payload: {
490
+ title: string;
491
+ kind: "vision" | "operational" | "strategic" | "mission" | "principle" | "policy_decision";
492
+ rationale?: string | undefined;
493
+ salience?: "ambient" | "normal" | "archival" | undefined;
494
+ source_artifact_id?: string | undefined;
495
+ };
496
+ }>, z.ZodObject<{
497
+ action: z.ZodLiteral<"record_commitment">;
498
+ payload: z.ZodObject<{
499
+ description: z.ZodString;
500
+ from_entity: z.ZodOptional<z.ZodString>;
501
+ to_entity: z.ZodOptional<z.ZodString>;
502
+ amount: z.ZodOptional<z.ZodNumber>;
503
+ unit: z.ZodOptional<z.ZodString>;
504
+ due_at: z.ZodOptional<z.ZodString>;
505
+ status: z.ZodEnum<["proposed", "tentative", "confirmed", "fulfilled", "expired", "broken"]>;
506
+ source_artifact_id: z.ZodOptional<z.ZodString>;
507
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
508
+ }, "strict", z.ZodTypeAny, {
509
+ status: "proposed" | "tentative" | "confirmed" | "fulfilled" | "expired" | "broken";
510
+ description: string;
511
+ source_artifact_id?: string | undefined;
512
+ from_entity?: string | undefined;
513
+ to_entity?: string | undefined;
514
+ amount?: number | undefined;
515
+ unit?: string | undefined;
516
+ due_at?: string | undefined;
517
+ attrs?: Record<string, unknown> | undefined;
518
+ }, {
519
+ status: "proposed" | "tentative" | "confirmed" | "fulfilled" | "expired" | "broken";
520
+ description: string;
521
+ source_artifact_id?: string | undefined;
522
+ from_entity?: string | undefined;
523
+ to_entity?: string | undefined;
524
+ amount?: number | undefined;
525
+ unit?: string | undefined;
526
+ due_at?: string | undefined;
527
+ attrs?: Record<string, unknown> | undefined;
528
+ }>;
529
+ idempotency_key: z.ZodString;
530
+ org_id: z.ZodString;
531
+ }, "strict", z.ZodTypeAny, {
532
+ action: "record_commitment";
533
+ org_id: string;
534
+ idempotency_key: string;
535
+ payload: {
536
+ status: "proposed" | "tentative" | "confirmed" | "fulfilled" | "expired" | "broken";
537
+ description: string;
538
+ source_artifact_id?: string | undefined;
539
+ from_entity?: string | undefined;
540
+ to_entity?: string | undefined;
541
+ amount?: number | undefined;
542
+ unit?: string | undefined;
543
+ due_at?: string | undefined;
544
+ attrs?: Record<string, unknown> | undefined;
545
+ };
546
+ }, {
547
+ action: "record_commitment";
548
+ org_id: string;
549
+ idempotency_key: string;
550
+ payload: {
551
+ status: "proposed" | "tentative" | "confirmed" | "fulfilled" | "expired" | "broken";
552
+ description: string;
553
+ source_artifact_id?: string | undefined;
554
+ from_entity?: string | undefined;
555
+ to_entity?: string | undefined;
556
+ amount?: number | undefined;
557
+ unit?: string | undefined;
558
+ due_at?: string | undefined;
559
+ attrs?: Record<string, unknown> | undefined;
560
+ };
561
+ }>, z.ZodObject<{
562
+ action: z.ZodLiteral<"record_learning">;
563
+ payload: z.ZodObject<{
564
+ title: z.ZodString;
565
+ description: z.ZodString;
566
+ resolution_taken: z.ZodOptional<z.ZodString>;
567
+ related_decision_id: z.ZodOptional<z.ZodString>;
568
+ source_artifact_id: z.ZodOptional<z.ZodString>;
569
+ }, "strict", z.ZodTypeAny, {
570
+ title: string;
571
+ description: string;
572
+ source_artifact_id?: string | undefined;
573
+ resolution_taken?: string | undefined;
574
+ related_decision_id?: string | undefined;
575
+ }, {
576
+ title: string;
577
+ description: string;
578
+ source_artifact_id?: string | undefined;
579
+ resolution_taken?: string | undefined;
580
+ related_decision_id?: string | undefined;
581
+ }>;
582
+ idempotency_key: z.ZodString;
583
+ org_id: z.ZodString;
584
+ }, "strict", z.ZodTypeAny, {
585
+ action: "record_learning";
586
+ org_id: string;
587
+ idempotency_key: string;
588
+ payload: {
589
+ title: string;
590
+ description: string;
591
+ source_artifact_id?: string | undefined;
592
+ resolution_taken?: string | undefined;
593
+ related_decision_id?: string | undefined;
594
+ };
595
+ }, {
596
+ action: "record_learning";
597
+ org_id: string;
598
+ idempotency_key: string;
599
+ payload: {
600
+ title: string;
601
+ description: string;
602
+ source_artifact_id?: string | undefined;
603
+ resolution_taken?: string | undefined;
604
+ related_decision_id?: string | undefined;
605
+ };
606
+ }>, z.ZodObject<{
607
+ action: z.ZodLiteral<"list_principles">;
608
+ cursor: z.ZodOptional<z.ZodString>;
609
+ limit: z.ZodOptional<z.ZodNumber>;
610
+ org_id: z.ZodString;
611
+ }, "strict", z.ZodTypeAny, {
612
+ action: "list_principles";
613
+ org_id: string;
614
+ cursor?: string | undefined;
615
+ limit?: number | undefined;
616
+ }, {
617
+ action: "list_principles";
618
+ org_id: string;
619
+ cursor?: string | undefined;
620
+ limit?: number | undefined;
621
+ }>, z.ZodObject<{
622
+ action: z.ZodLiteral<"get_principle">;
623
+ principle_id: z.ZodString;
624
+ org_id: z.ZodString;
625
+ }, "strict", z.ZodTypeAny, {
626
+ action: "get_principle";
627
+ org_id: string;
628
+ principle_id: string;
629
+ }, {
630
+ action: "get_principle";
631
+ org_id: string;
632
+ principle_id: string;
633
+ }>, z.ZodObject<{
634
+ action: z.ZodLiteral<"record_principle">;
635
+ payload: z.ZodObject<{
636
+ title: z.ZodString;
637
+ rationale: z.ZodOptional<z.ZodString>;
638
+ applies_to: z.ZodRecord<z.ZodString, z.ZodUnknown>;
639
+ constraint_spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
640
+ salience: z.ZodDefault<z.ZodEnum<["ambient", "normal", "archival"]>>;
641
+ }, "strict", z.ZodTypeAny, {
642
+ title: string;
643
+ salience: "ambient" | "normal" | "archival";
644
+ applies_to: Record<string, unknown>;
645
+ constraint_spec: Record<string, unknown>;
646
+ rationale?: string | undefined;
647
+ }, {
648
+ title: string;
649
+ applies_to: Record<string, unknown>;
650
+ constraint_spec: Record<string, unknown>;
651
+ rationale?: string | undefined;
652
+ salience?: "ambient" | "normal" | "archival" | undefined;
653
+ }>;
654
+ idempotency_key: z.ZodString;
655
+ org_id: z.ZodString;
656
+ }, "strict", z.ZodTypeAny, {
657
+ action: "record_principle";
658
+ org_id: string;
659
+ idempotency_key: string;
660
+ payload: {
661
+ title: string;
662
+ salience: "ambient" | "normal" | "archival";
663
+ applies_to: Record<string, unknown>;
664
+ constraint_spec: Record<string, unknown>;
665
+ rationale?: string | undefined;
666
+ };
667
+ }, {
668
+ action: "record_principle";
669
+ org_id: string;
670
+ idempotency_key: string;
671
+ payload: {
672
+ title: string;
673
+ applies_to: Record<string, unknown>;
674
+ constraint_spec: Record<string, unknown>;
675
+ rationale?: string | undefined;
676
+ salience?: "ambient" | "normal" | "archival" | undefined;
677
+ };
678
+ }>]>, {
679
+ action: "status";
680
+ org_id: string;
681
+ confirmation_id?: string | undefined;
682
+ } | {
683
+ action: "enable";
684
+ org_id: string;
685
+ idempotency_key: string;
686
+ } | {
687
+ action: "pause";
688
+ org_id: string;
689
+ idempotency_key: string;
690
+ } | {
691
+ action: "resume";
692
+ org_id: string;
693
+ idempotency_key: string;
694
+ } | {
695
+ status: "pending" | "resolved" | "all";
696
+ action: "list_decisions";
697
+ org_id: string;
698
+ cursor?: string | undefined;
699
+ limit?: number | undefined;
700
+ } | {
701
+ action: "get_decision";
702
+ org_id: string;
703
+ decision_id: string;
704
+ decision_source: "office" | "substrate";
705
+ } | {
706
+ action: "get_decision_context";
707
+ org_id: string;
708
+ decision_id: string;
709
+ decision_source: "office" | "substrate";
710
+ limit?: number | undefined;
711
+ } | {
712
+ action: "approve";
713
+ org_id: string;
714
+ idempotency_key: string;
715
+ decision_id: string;
716
+ decision_source: "office" | "substrate";
717
+ } | {
718
+ reason: string;
719
+ action: "deny";
720
+ org_id: string;
721
+ decision_id: string;
722
+ decision_source: "office" | "substrate";
723
+ } | {
724
+ action: "create_conversation";
725
+ org_id: string;
726
+ idempotency_key: string;
727
+ title?: string | undefined;
728
+ } | {
729
+ action: "list_conversations";
730
+ org_id: string;
731
+ cursor?: string | undefined;
732
+ limit?: number | undefined;
733
+ } | {
734
+ action: "get_conversation";
735
+ org_id: string;
736
+ conversation_id: string;
737
+ limit?: number | undefined;
738
+ turn_id?: string | undefined;
739
+ after_sequence?: number | undefined;
740
+ } | {
741
+ message: string;
742
+ action: "ask";
743
+ org_id: string;
744
+ idempotency_key: string;
745
+ wait_ms: number;
746
+ conversation_id?: string | undefined;
747
+ } | {
748
+ action: "list_memory";
749
+ org_id: string;
750
+ kind?: "decision" | "commitment" | "learning" | undefined;
751
+ cursor?: string | undefined;
752
+ limit?: number | undefined;
753
+ } | {
754
+ action: "search_memory";
755
+ org_id: string;
756
+ query: string;
757
+ limit?: number | undefined;
758
+ } | {
759
+ source_artifact_id: string;
760
+ action: "get_source_artifact";
761
+ org_id: string;
762
+ } | {
763
+ action: "record_decision";
764
+ org_id: string;
765
+ idempotency_key: string;
766
+ payload: {
767
+ title: string;
768
+ kind: "vision" | "operational" | "strategic" | "mission" | "principle" | "policy_decision";
769
+ salience: "ambient" | "normal" | "archival";
770
+ rationale?: string | undefined;
771
+ source_artifact_id?: string | undefined;
772
+ };
773
+ } | {
774
+ action: "record_commitment";
775
+ org_id: string;
776
+ idempotency_key: string;
777
+ payload: {
778
+ status: "proposed" | "tentative" | "confirmed" | "fulfilled" | "expired" | "broken";
779
+ description: string;
780
+ source_artifact_id?: string | undefined;
781
+ from_entity?: string | undefined;
782
+ to_entity?: string | undefined;
783
+ amount?: number | undefined;
784
+ unit?: string | undefined;
785
+ due_at?: string | undefined;
786
+ attrs?: Record<string, unknown> | undefined;
787
+ };
788
+ } | {
789
+ action: "record_learning";
790
+ org_id: string;
791
+ idempotency_key: string;
792
+ payload: {
793
+ title: string;
794
+ description: string;
795
+ source_artifact_id?: string | undefined;
796
+ resolution_taken?: string | undefined;
797
+ related_decision_id?: string | undefined;
798
+ };
799
+ } | {
800
+ action: "list_principles";
801
+ org_id: string;
802
+ cursor?: string | undefined;
803
+ limit?: number | undefined;
804
+ } | {
805
+ action: "get_principle";
806
+ org_id: string;
807
+ principle_id: string;
808
+ } | {
809
+ action: "record_principle";
810
+ org_id: string;
811
+ idempotency_key: string;
812
+ payload: {
813
+ title: string;
814
+ salience: "ambient" | "normal" | "archival";
815
+ applies_to: Record<string, unknown>;
816
+ constraint_spec: Record<string, unknown>;
817
+ rationale?: string | undefined;
818
+ };
819
+ }, {
820
+ action: "status";
821
+ org_id: string;
822
+ confirmation_id?: string | undefined;
823
+ } | {
824
+ action: "enable";
825
+ org_id: string;
826
+ idempotency_key: string;
827
+ } | {
828
+ action: "pause";
829
+ org_id: string;
830
+ idempotency_key: string;
831
+ } | {
832
+ action: "resume";
833
+ org_id: string;
834
+ idempotency_key: string;
835
+ } | {
836
+ action: "list_decisions";
837
+ org_id: string;
838
+ status?: "pending" | "resolved" | "all" | undefined;
839
+ cursor?: string | undefined;
840
+ limit?: number | undefined;
841
+ } | {
842
+ action: "get_decision";
843
+ org_id: string;
844
+ decision_id: string;
845
+ decision_source?: "office" | "substrate" | undefined;
846
+ } | {
847
+ action: "get_decision_context";
848
+ org_id: string;
849
+ decision_id: string;
850
+ limit?: number | undefined;
851
+ decision_source?: "office" | "substrate" | undefined;
852
+ } | {
853
+ action: "approve";
854
+ org_id: string;
855
+ idempotency_key: string;
856
+ decision_id: string;
857
+ decision_source?: "office" | "substrate" | undefined;
858
+ } | {
859
+ reason: string;
860
+ action: "deny";
861
+ org_id: string;
862
+ decision_id: string;
863
+ decision_source?: "office" | "substrate" | undefined;
864
+ } | {
865
+ action: "create_conversation";
866
+ org_id: string;
867
+ idempotency_key: string;
868
+ title?: string | undefined;
869
+ } | {
870
+ action: "list_conversations";
871
+ org_id: string;
872
+ cursor?: string | undefined;
873
+ limit?: number | undefined;
874
+ } | {
875
+ action: "get_conversation";
876
+ org_id: string;
877
+ conversation_id: string;
878
+ limit?: number | undefined;
879
+ turn_id?: string | undefined;
880
+ after_sequence?: number | undefined;
881
+ } | {
882
+ message: string;
883
+ action: "ask";
884
+ org_id: string;
885
+ idempotency_key: string;
886
+ conversation_id?: string | undefined;
887
+ wait_ms?: number | undefined;
888
+ } | {
889
+ action: "list_memory";
890
+ org_id: string;
891
+ kind?: "decision" | "commitment" | "learning" | undefined;
892
+ cursor?: string | undefined;
893
+ limit?: number | undefined;
894
+ } | {
895
+ action: "search_memory";
896
+ org_id: string;
897
+ query: string;
898
+ limit?: number | undefined;
899
+ } | {
900
+ source_artifact_id: string;
901
+ action: "get_source_artifact";
902
+ org_id: string;
903
+ } | {
904
+ action: "record_decision";
905
+ org_id: string;
906
+ idempotency_key: string;
907
+ payload: {
908
+ title: string;
909
+ kind: "vision" | "operational" | "strategic" | "mission" | "principle" | "policy_decision";
910
+ rationale?: string | undefined;
911
+ salience?: "ambient" | "normal" | "archival" | undefined;
912
+ source_artifact_id?: string | undefined;
913
+ };
914
+ } | {
915
+ action: "record_commitment";
916
+ org_id: string;
917
+ idempotency_key: string;
918
+ payload: {
919
+ status: "proposed" | "tentative" | "confirmed" | "fulfilled" | "expired" | "broken";
920
+ description: string;
921
+ source_artifact_id?: string | undefined;
922
+ from_entity?: string | undefined;
923
+ to_entity?: string | undefined;
924
+ amount?: number | undefined;
925
+ unit?: string | undefined;
926
+ due_at?: string | undefined;
927
+ attrs?: Record<string, unknown> | undefined;
928
+ };
929
+ } | {
930
+ action: "record_learning";
931
+ org_id: string;
932
+ idempotency_key: string;
933
+ payload: {
934
+ title: string;
935
+ description: string;
936
+ source_artifact_id?: string | undefined;
937
+ resolution_taken?: string | undefined;
938
+ related_decision_id?: string | undefined;
939
+ };
940
+ } | {
941
+ action: "list_principles";
942
+ org_id: string;
943
+ cursor?: string | undefined;
944
+ limit?: number | undefined;
945
+ } | {
946
+ action: "get_principle";
947
+ org_id: string;
948
+ principle_id: string;
949
+ } | {
950
+ action: "record_principle";
951
+ org_id: string;
952
+ idempotency_key: string;
953
+ payload: {
954
+ title: string;
955
+ applies_to: Record<string, unknown>;
956
+ constraint_spec: Record<string, unknown>;
957
+ rationale?: string | undefined;
958
+ salience?: "ambient" | "normal" | "archival" | undefined;
959
+ };
960
+ }>;
961
+ export type OfficeActionRequest = z.infer<typeof officeActionSchema>;
962
+ export declare const OFFICE_ERROR_CODES: readonly ["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"];
963
+ export type OfficeErrorCode = typeof OFFICE_ERROR_CODES[number];
964
+ export declare const officeErrorSchema: z.ZodObject<{
965
+ code: z.ZodEnum<["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"]>;
966
+ message: z.ZodString;
967
+ decision: z.ZodOptional<z.ZodObject<{
968
+ source: z.ZodEnum<["office", "substrate"]>;
969
+ id: z.ZodString;
970
+ }, "strict", z.ZodTypeAny, {
971
+ source: "office" | "substrate";
972
+ id: string;
973
+ }, {
974
+ source: "office" | "substrate";
975
+ id: string;
976
+ }>>;
977
+ history: z.ZodOptional<z.ZodObject<{
978
+ turn_id: z.ZodString;
979
+ conversation_id: z.ZodString;
980
+ state: z.ZodEnum<["running", "awaiting_approval", "completed", "blocked", "failed", "interrupted"]>;
981
+ }, "strict", z.ZodTypeAny, {
982
+ conversation_id: string;
983
+ turn_id: string;
984
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
985
+ }, {
986
+ conversation_id: string;
987
+ turn_id: string;
988
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
989
+ }>>;
990
+ }, "strict", z.ZodTypeAny, {
991
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
992
+ message: string;
993
+ decision?: {
994
+ source: "office" | "substrate";
995
+ id: string;
996
+ } | undefined;
997
+ history?: {
998
+ conversation_id: string;
999
+ turn_id: string;
1000
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1001
+ } | undefined;
1002
+ }, {
1003
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1004
+ message: string;
1005
+ decision?: {
1006
+ source: "office" | "substrate";
1007
+ id: string;
1008
+ } | undefined;
1009
+ history?: {
1010
+ conversation_id: string;
1011
+ turn_id: string;
1012
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1013
+ } | undefined;
1014
+ }>;
1015
+ export type OfficeError = z.infer<typeof officeErrorSchema>;
1016
+ export declare const confirmationReceiptSchema: z.ZodDiscriminatedUnion<"state", [z.ZodObject<{
1017
+ state: z.ZodLiteral<"awaiting_confirmation">;
1018
+ confirmation_url: z.ZodString;
1019
+ expires_at: z.ZodString;
1020
+ confirmation_id: z.ZodString;
1021
+ }, "strict", z.ZodTypeAny, {
1022
+ confirmation_id: string;
1023
+ state: "awaiting_confirmation";
1024
+ confirmation_url: string;
1025
+ expires_at: string;
1026
+ }, {
1027
+ confirmation_id: string;
1028
+ state: "awaiting_confirmation";
1029
+ confirmation_url: string;
1030
+ expires_at: string;
1031
+ }>, z.ZodObject<{
1032
+ state: z.ZodLiteral<"executing">;
1033
+ confirmation_id: z.ZodString;
1034
+ }, "strict", z.ZodTypeAny, {
1035
+ confirmation_id: string;
1036
+ state: "executing";
1037
+ }, {
1038
+ confirmation_id: string;
1039
+ state: "executing";
1040
+ }>, z.ZodObject<{
1041
+ state: z.ZodLiteral<"succeeded">;
1042
+ outcome: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1043
+ confirmation_id: z.ZodString;
1044
+ }, "strict", z.ZodTypeAny, {
1045
+ confirmation_id: string;
1046
+ state: "succeeded";
1047
+ outcome: Record<string, unknown>;
1048
+ }, {
1049
+ confirmation_id: string;
1050
+ state: "succeeded";
1051
+ outcome: Record<string, unknown>;
1052
+ }>, z.ZodObject<{
1053
+ state: z.ZodLiteral<"rejected">;
1054
+ confirmation_id: z.ZodString;
1055
+ }, "strict", z.ZodTypeAny, {
1056
+ confirmation_id: string;
1057
+ state: "rejected";
1058
+ }, {
1059
+ confirmation_id: string;
1060
+ state: "rejected";
1061
+ }>, z.ZodObject<{
1062
+ state: z.ZodLiteral<"expired">;
1063
+ confirmation_id: z.ZodString;
1064
+ }, "strict", z.ZodTypeAny, {
1065
+ confirmation_id: string;
1066
+ state: "expired";
1067
+ }, {
1068
+ confirmation_id: string;
1069
+ state: "expired";
1070
+ }>, z.ZodObject<{
1071
+ state: z.ZodLiteral<"failed">;
1072
+ error: z.ZodObject<{
1073
+ code: z.ZodEnum<["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"]>;
1074
+ message: z.ZodString;
1075
+ decision: z.ZodOptional<z.ZodObject<{
1076
+ source: z.ZodEnum<["office", "substrate"]>;
1077
+ id: z.ZodString;
1078
+ }, "strict", z.ZodTypeAny, {
1079
+ source: "office" | "substrate";
1080
+ id: string;
1081
+ }, {
1082
+ source: "office" | "substrate";
1083
+ id: string;
1084
+ }>>;
1085
+ history: z.ZodOptional<z.ZodObject<{
1086
+ turn_id: z.ZodString;
1087
+ conversation_id: z.ZodString;
1088
+ state: z.ZodEnum<["running", "awaiting_approval", "completed", "blocked", "failed", "interrupted"]>;
1089
+ }, "strict", z.ZodTypeAny, {
1090
+ conversation_id: string;
1091
+ turn_id: string;
1092
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1093
+ }, {
1094
+ conversation_id: string;
1095
+ turn_id: string;
1096
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1097
+ }>>;
1098
+ }, "strict", z.ZodTypeAny, {
1099
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1100
+ message: string;
1101
+ decision?: {
1102
+ source: "office" | "substrate";
1103
+ id: string;
1104
+ } | undefined;
1105
+ history?: {
1106
+ conversation_id: string;
1107
+ turn_id: string;
1108
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1109
+ } | undefined;
1110
+ }, {
1111
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1112
+ message: string;
1113
+ decision?: {
1114
+ source: "office" | "substrate";
1115
+ id: string;
1116
+ } | undefined;
1117
+ history?: {
1118
+ conversation_id: string;
1119
+ turn_id: string;
1120
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1121
+ } | undefined;
1122
+ }>;
1123
+ confirmation_id: z.ZodString;
1124
+ }, "strict", z.ZodTypeAny, {
1125
+ error: {
1126
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1127
+ message: string;
1128
+ decision?: {
1129
+ source: "office" | "substrate";
1130
+ id: string;
1131
+ } | undefined;
1132
+ history?: {
1133
+ conversation_id: string;
1134
+ turn_id: string;
1135
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1136
+ } | undefined;
1137
+ };
1138
+ confirmation_id: string;
1139
+ state: "failed";
1140
+ }, {
1141
+ error: {
1142
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1143
+ message: string;
1144
+ decision?: {
1145
+ source: "office" | "substrate";
1146
+ id: string;
1147
+ } | undefined;
1148
+ history?: {
1149
+ conversation_id: string;
1150
+ turn_id: string;
1151
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1152
+ } | undefined;
1153
+ };
1154
+ confirmation_id: string;
1155
+ state: "failed";
1156
+ }>, z.ZodObject<{
1157
+ state: z.ZodLiteral<"outcome_unknown">;
1158
+ error: z.ZodObject<{
1159
+ code: z.ZodEnum<["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"]>;
1160
+ message: z.ZodString;
1161
+ decision: z.ZodOptional<z.ZodObject<{
1162
+ source: z.ZodEnum<["office", "substrate"]>;
1163
+ id: z.ZodString;
1164
+ }, "strict", z.ZodTypeAny, {
1165
+ source: "office" | "substrate";
1166
+ id: string;
1167
+ }, {
1168
+ source: "office" | "substrate";
1169
+ id: string;
1170
+ }>>;
1171
+ history: z.ZodOptional<z.ZodObject<{
1172
+ turn_id: z.ZodString;
1173
+ conversation_id: z.ZodString;
1174
+ state: z.ZodEnum<["running", "awaiting_approval", "completed", "blocked", "failed", "interrupted"]>;
1175
+ }, "strict", z.ZodTypeAny, {
1176
+ conversation_id: string;
1177
+ turn_id: string;
1178
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1179
+ }, {
1180
+ conversation_id: string;
1181
+ turn_id: string;
1182
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1183
+ }>>;
1184
+ }, "strict", z.ZodTypeAny, {
1185
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1186
+ message: string;
1187
+ decision?: {
1188
+ source: "office" | "substrate";
1189
+ id: string;
1190
+ } | undefined;
1191
+ history?: {
1192
+ conversation_id: string;
1193
+ turn_id: string;
1194
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1195
+ } | undefined;
1196
+ }, {
1197
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1198
+ message: string;
1199
+ decision?: {
1200
+ source: "office" | "substrate";
1201
+ id: string;
1202
+ } | undefined;
1203
+ history?: {
1204
+ conversation_id: string;
1205
+ turn_id: string;
1206
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1207
+ } | undefined;
1208
+ }>;
1209
+ confirmation_id: z.ZodString;
1210
+ }, "strict", z.ZodTypeAny, {
1211
+ error: {
1212
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1213
+ message: string;
1214
+ decision?: {
1215
+ source: "office" | "substrate";
1216
+ id: string;
1217
+ } | undefined;
1218
+ history?: {
1219
+ conversation_id: string;
1220
+ turn_id: string;
1221
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1222
+ } | undefined;
1223
+ };
1224
+ confirmation_id: string;
1225
+ state: "outcome_unknown";
1226
+ }, {
1227
+ error: {
1228
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1229
+ message: string;
1230
+ decision?: {
1231
+ source: "office" | "substrate";
1232
+ id: string;
1233
+ } | undefined;
1234
+ history?: {
1235
+ conversation_id: string;
1236
+ turn_id: string;
1237
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1238
+ } | undefined;
1239
+ };
1240
+ confirmation_id: string;
1241
+ state: "outcome_unknown";
1242
+ }>]>;
1243
+ export type ConfirmationReceipt = z.infer<typeof confirmationReceiptSchema>;
1244
+ /** Human review is derived from the stored command, never the selected dashboard org. */
1245
+ export interface OfficeCommandReview {
1246
+ organization: {
1247
+ id: string;
1248
+ name: string;
1249
+ };
1250
+ receipt: ConfirmationReceipt;
1251
+ action: 'enable' | 'pause' | 'resume' | 'approve';
1252
+ title: string;
1253
+ target: string;
1254
+ consequence: string;
1255
+ details: Array<{
1256
+ label: string;
1257
+ value: string;
1258
+ }>;
1259
+ can_confirm: boolean;
1260
+ blocked_reason?: 'confirmation_changed' | 'confirmation_unreviewable';
1261
+ }
1262
+ export declare const officeStatusSchema: z.ZodObject<{
1263
+ organization_id: z.ZodString;
1264
+ activation_state: z.ZodEnum<["not_enabled", "enabling", "enabled", "failed"]>;
1265
+ can_enable: z.ZodBoolean;
1266
+ can_approve: z.ZodBoolean;
1267
+ work_allowed: z.ZodBoolean;
1268
+ paused: z.ZodBoolean;
1269
+ blocked_reason: z.ZodNullable<z.ZodEnum<["paid_plan_required", "account_suspended", "credits_required", "credential_repair_required", "service_unavailable", "paused_by_owner"]>>;
1270
+ last_turn: z.ZodNullable<z.ZodObject<{
1271
+ at: z.ZodString;
1272
+ outcome: z.ZodString;
1273
+ }, "strict", z.ZodTypeAny, {
1274
+ at: string;
1275
+ outcome: string;
1276
+ }, {
1277
+ at: string;
1278
+ outcome: string;
1279
+ }>>;
1280
+ }, "strict", z.ZodTypeAny, {
1281
+ organization_id: string;
1282
+ activation_state: "failed" | "not_enabled" | "enabling" | "enabled";
1283
+ can_enable: boolean;
1284
+ can_approve: boolean;
1285
+ work_allowed: boolean;
1286
+ paused: boolean;
1287
+ blocked_reason: "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | null;
1288
+ last_turn: {
1289
+ at: string;
1290
+ outcome: string;
1291
+ } | null;
1292
+ }, {
1293
+ organization_id: string;
1294
+ activation_state: "failed" | "not_enabled" | "enabling" | "enabled";
1295
+ can_enable: boolean;
1296
+ can_approve: boolean;
1297
+ work_allowed: boolean;
1298
+ paused: boolean;
1299
+ blocked_reason: "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | null;
1300
+ last_turn: {
1301
+ at: string;
1302
+ outcome: string;
1303
+ } | null;
1304
+ }>;
1305
+ export type OfficeStatus = z.infer<typeof officeStatusSchema>;
1306
+ export declare const officeStatusResultSchema: z.ZodUnion<[z.ZodObject<{
1307
+ organization_id: z.ZodString;
1308
+ activation_state: z.ZodEnum<["not_enabled", "enabling", "enabled", "failed"]>;
1309
+ can_enable: z.ZodBoolean;
1310
+ can_approve: z.ZodBoolean;
1311
+ work_allowed: z.ZodBoolean;
1312
+ paused: z.ZodBoolean;
1313
+ blocked_reason: z.ZodNullable<z.ZodEnum<["paid_plan_required", "account_suspended", "credits_required", "credential_repair_required", "service_unavailable", "paused_by_owner"]>>;
1314
+ last_turn: z.ZodNullable<z.ZodObject<{
1315
+ at: z.ZodString;
1316
+ outcome: z.ZodString;
1317
+ }, "strict", z.ZodTypeAny, {
1318
+ at: string;
1319
+ outcome: string;
1320
+ }, {
1321
+ at: string;
1322
+ outcome: string;
1323
+ }>>;
1324
+ }, "strict", z.ZodTypeAny, {
1325
+ organization_id: string;
1326
+ activation_state: "failed" | "not_enabled" | "enabling" | "enabled";
1327
+ can_enable: boolean;
1328
+ can_approve: boolean;
1329
+ work_allowed: boolean;
1330
+ paused: boolean;
1331
+ blocked_reason: "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | null;
1332
+ last_turn: {
1333
+ at: string;
1334
+ outcome: string;
1335
+ } | null;
1336
+ }, {
1337
+ organization_id: string;
1338
+ activation_state: "failed" | "not_enabled" | "enabling" | "enabled";
1339
+ can_enable: boolean;
1340
+ can_approve: boolean;
1341
+ work_allowed: boolean;
1342
+ paused: boolean;
1343
+ blocked_reason: "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | null;
1344
+ last_turn: {
1345
+ at: string;
1346
+ outcome: string;
1347
+ } | null;
1348
+ }>, z.ZodDiscriminatedUnion<"state", [z.ZodObject<{
1349
+ state: z.ZodLiteral<"awaiting_confirmation">;
1350
+ confirmation_url: z.ZodString;
1351
+ expires_at: z.ZodString;
1352
+ confirmation_id: z.ZodString;
1353
+ }, "strict", z.ZodTypeAny, {
1354
+ confirmation_id: string;
1355
+ state: "awaiting_confirmation";
1356
+ confirmation_url: string;
1357
+ expires_at: string;
1358
+ }, {
1359
+ confirmation_id: string;
1360
+ state: "awaiting_confirmation";
1361
+ confirmation_url: string;
1362
+ expires_at: string;
1363
+ }>, z.ZodObject<{
1364
+ state: z.ZodLiteral<"executing">;
1365
+ confirmation_id: z.ZodString;
1366
+ }, "strict", z.ZodTypeAny, {
1367
+ confirmation_id: string;
1368
+ state: "executing";
1369
+ }, {
1370
+ confirmation_id: string;
1371
+ state: "executing";
1372
+ }>, z.ZodObject<{
1373
+ state: z.ZodLiteral<"succeeded">;
1374
+ outcome: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1375
+ confirmation_id: z.ZodString;
1376
+ }, "strict", z.ZodTypeAny, {
1377
+ confirmation_id: string;
1378
+ state: "succeeded";
1379
+ outcome: Record<string, unknown>;
1380
+ }, {
1381
+ confirmation_id: string;
1382
+ state: "succeeded";
1383
+ outcome: Record<string, unknown>;
1384
+ }>, z.ZodObject<{
1385
+ state: z.ZodLiteral<"rejected">;
1386
+ confirmation_id: z.ZodString;
1387
+ }, "strict", z.ZodTypeAny, {
1388
+ confirmation_id: string;
1389
+ state: "rejected";
1390
+ }, {
1391
+ confirmation_id: string;
1392
+ state: "rejected";
1393
+ }>, z.ZodObject<{
1394
+ state: z.ZodLiteral<"expired">;
1395
+ confirmation_id: z.ZodString;
1396
+ }, "strict", z.ZodTypeAny, {
1397
+ confirmation_id: string;
1398
+ state: "expired";
1399
+ }, {
1400
+ confirmation_id: string;
1401
+ state: "expired";
1402
+ }>, z.ZodObject<{
1403
+ state: z.ZodLiteral<"failed">;
1404
+ error: z.ZodObject<{
1405
+ code: z.ZodEnum<["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"]>;
1406
+ message: z.ZodString;
1407
+ decision: z.ZodOptional<z.ZodObject<{
1408
+ source: z.ZodEnum<["office", "substrate"]>;
1409
+ id: z.ZodString;
1410
+ }, "strict", z.ZodTypeAny, {
1411
+ source: "office" | "substrate";
1412
+ id: string;
1413
+ }, {
1414
+ source: "office" | "substrate";
1415
+ id: string;
1416
+ }>>;
1417
+ history: z.ZodOptional<z.ZodObject<{
1418
+ turn_id: z.ZodString;
1419
+ conversation_id: z.ZodString;
1420
+ state: z.ZodEnum<["running", "awaiting_approval", "completed", "blocked", "failed", "interrupted"]>;
1421
+ }, "strict", z.ZodTypeAny, {
1422
+ conversation_id: string;
1423
+ turn_id: string;
1424
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1425
+ }, {
1426
+ conversation_id: string;
1427
+ turn_id: string;
1428
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1429
+ }>>;
1430
+ }, "strict", z.ZodTypeAny, {
1431
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1432
+ message: string;
1433
+ decision?: {
1434
+ source: "office" | "substrate";
1435
+ id: string;
1436
+ } | undefined;
1437
+ history?: {
1438
+ conversation_id: string;
1439
+ turn_id: string;
1440
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1441
+ } | undefined;
1442
+ }, {
1443
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1444
+ message: string;
1445
+ decision?: {
1446
+ source: "office" | "substrate";
1447
+ id: string;
1448
+ } | undefined;
1449
+ history?: {
1450
+ conversation_id: string;
1451
+ turn_id: string;
1452
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1453
+ } | undefined;
1454
+ }>;
1455
+ confirmation_id: z.ZodString;
1456
+ }, "strict", z.ZodTypeAny, {
1457
+ error: {
1458
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1459
+ message: string;
1460
+ decision?: {
1461
+ source: "office" | "substrate";
1462
+ id: string;
1463
+ } | undefined;
1464
+ history?: {
1465
+ conversation_id: string;
1466
+ turn_id: string;
1467
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1468
+ } | undefined;
1469
+ };
1470
+ confirmation_id: string;
1471
+ state: "failed";
1472
+ }, {
1473
+ error: {
1474
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1475
+ message: string;
1476
+ decision?: {
1477
+ source: "office" | "substrate";
1478
+ id: string;
1479
+ } | undefined;
1480
+ history?: {
1481
+ conversation_id: string;
1482
+ turn_id: string;
1483
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1484
+ } | undefined;
1485
+ };
1486
+ confirmation_id: string;
1487
+ state: "failed";
1488
+ }>, z.ZodObject<{
1489
+ state: z.ZodLiteral<"outcome_unknown">;
1490
+ error: z.ZodObject<{
1491
+ code: z.ZodEnum<["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"]>;
1492
+ message: z.ZodString;
1493
+ decision: z.ZodOptional<z.ZodObject<{
1494
+ source: z.ZodEnum<["office", "substrate"]>;
1495
+ id: z.ZodString;
1496
+ }, "strict", z.ZodTypeAny, {
1497
+ source: "office" | "substrate";
1498
+ id: string;
1499
+ }, {
1500
+ source: "office" | "substrate";
1501
+ id: string;
1502
+ }>>;
1503
+ history: z.ZodOptional<z.ZodObject<{
1504
+ turn_id: z.ZodString;
1505
+ conversation_id: z.ZodString;
1506
+ state: z.ZodEnum<["running", "awaiting_approval", "completed", "blocked", "failed", "interrupted"]>;
1507
+ }, "strict", z.ZodTypeAny, {
1508
+ conversation_id: string;
1509
+ turn_id: string;
1510
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1511
+ }, {
1512
+ conversation_id: string;
1513
+ turn_id: string;
1514
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1515
+ }>>;
1516
+ }, "strict", z.ZodTypeAny, {
1517
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1518
+ message: string;
1519
+ decision?: {
1520
+ source: "office" | "substrate";
1521
+ id: string;
1522
+ } | undefined;
1523
+ history?: {
1524
+ conversation_id: string;
1525
+ turn_id: string;
1526
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1527
+ } | undefined;
1528
+ }, {
1529
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1530
+ message: string;
1531
+ decision?: {
1532
+ source: "office" | "substrate";
1533
+ id: string;
1534
+ } | undefined;
1535
+ history?: {
1536
+ conversation_id: string;
1537
+ turn_id: string;
1538
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1539
+ } | undefined;
1540
+ }>;
1541
+ confirmation_id: z.ZodString;
1542
+ }, "strict", z.ZodTypeAny, {
1543
+ error: {
1544
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1545
+ message: string;
1546
+ decision?: {
1547
+ source: "office" | "substrate";
1548
+ id: string;
1549
+ } | undefined;
1550
+ history?: {
1551
+ conversation_id: string;
1552
+ turn_id: string;
1553
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1554
+ } | undefined;
1555
+ };
1556
+ confirmation_id: string;
1557
+ state: "outcome_unknown";
1558
+ }, {
1559
+ error: {
1560
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1561
+ message: string;
1562
+ decision?: {
1563
+ source: "office" | "substrate";
1564
+ id: string;
1565
+ } | undefined;
1566
+ history?: {
1567
+ conversation_id: string;
1568
+ turn_id: string;
1569
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1570
+ } | undefined;
1571
+ };
1572
+ confirmation_id: string;
1573
+ state: "outcome_unknown";
1574
+ }>]>]>;
1575
+ export declare const officeTurnSchema: z.ZodDiscriminatedUnion<"state", [z.ZodObject<{
1576
+ state: z.ZodLiteral<"running">;
1577
+ turn_id: z.ZodString;
1578
+ conversation_id: z.ZodString;
1579
+ output: z.ZodString;
1580
+ }, "strict", z.ZodTypeAny, {
1581
+ conversation_id: string;
1582
+ turn_id: string;
1583
+ state: "running";
1584
+ output: string;
1585
+ }, {
1586
+ conversation_id: string;
1587
+ turn_id: string;
1588
+ state: "running";
1589
+ output: string;
1590
+ }>, z.ZodObject<{
1591
+ state: z.ZodLiteral<"awaiting_approval">;
1592
+ decision: z.ZodObject<{
1593
+ source: z.ZodEnum<["office", "substrate"]>;
1594
+ id: z.ZodString;
1595
+ }, "strict", z.ZodTypeAny, {
1596
+ source: "office" | "substrate";
1597
+ id: string;
1598
+ }, {
1599
+ source: "office" | "substrate";
1600
+ id: string;
1601
+ }>;
1602
+ turn_id: z.ZodString;
1603
+ conversation_id: z.ZodString;
1604
+ output: z.ZodString;
1605
+ }, "strict", z.ZodTypeAny, {
1606
+ conversation_id: string;
1607
+ turn_id: string;
1608
+ decision: {
1609
+ source: "office" | "substrate";
1610
+ id: string;
1611
+ };
1612
+ state: "awaiting_approval";
1613
+ output: string;
1614
+ }, {
1615
+ conversation_id: string;
1616
+ turn_id: string;
1617
+ decision: {
1618
+ source: "office" | "substrate";
1619
+ id: string;
1620
+ };
1621
+ state: "awaiting_approval";
1622
+ output: string;
1623
+ }>, z.ZodObject<{
1624
+ state: z.ZodLiteral<"completed">;
1625
+ resolution: z.ZodOptional<z.ZodEnum<["approved", "denied"]>>;
1626
+ turn_id: z.ZodString;
1627
+ conversation_id: z.ZodString;
1628
+ output: z.ZodString;
1629
+ }, "strict", z.ZodTypeAny, {
1630
+ conversation_id: string;
1631
+ turn_id: string;
1632
+ state: "completed";
1633
+ output: string;
1634
+ resolution?: "approved" | "denied" | undefined;
1635
+ }, {
1636
+ conversation_id: string;
1637
+ turn_id: string;
1638
+ state: "completed";
1639
+ output: string;
1640
+ resolution?: "approved" | "denied" | undefined;
1641
+ }>, z.ZodObject<{
1642
+ state: z.ZodLiteral<"blocked">;
1643
+ error: z.ZodObject<{
1644
+ code: z.ZodEnum<["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"]>;
1645
+ message: z.ZodString;
1646
+ decision: z.ZodOptional<z.ZodObject<{
1647
+ source: z.ZodEnum<["office", "substrate"]>;
1648
+ id: z.ZodString;
1649
+ }, "strict", z.ZodTypeAny, {
1650
+ source: "office" | "substrate";
1651
+ id: string;
1652
+ }, {
1653
+ source: "office" | "substrate";
1654
+ id: string;
1655
+ }>>;
1656
+ history: z.ZodOptional<z.ZodObject<{
1657
+ turn_id: z.ZodString;
1658
+ conversation_id: z.ZodString;
1659
+ state: z.ZodEnum<["running", "awaiting_approval", "completed", "blocked", "failed", "interrupted"]>;
1660
+ }, "strict", z.ZodTypeAny, {
1661
+ conversation_id: string;
1662
+ turn_id: string;
1663
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1664
+ }, {
1665
+ conversation_id: string;
1666
+ turn_id: string;
1667
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1668
+ }>>;
1669
+ }, "strict", z.ZodTypeAny, {
1670
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1671
+ message: string;
1672
+ decision?: {
1673
+ source: "office" | "substrate";
1674
+ id: string;
1675
+ } | undefined;
1676
+ history?: {
1677
+ conversation_id: string;
1678
+ turn_id: string;
1679
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1680
+ } | undefined;
1681
+ }, {
1682
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1683
+ message: string;
1684
+ decision?: {
1685
+ source: "office" | "substrate";
1686
+ id: string;
1687
+ } | undefined;
1688
+ history?: {
1689
+ conversation_id: string;
1690
+ turn_id: string;
1691
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1692
+ } | undefined;
1693
+ }>;
1694
+ turn_id: z.ZodString;
1695
+ conversation_id: z.ZodString;
1696
+ output: z.ZodString;
1697
+ }, "strict", z.ZodTypeAny, {
1698
+ error: {
1699
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1700
+ message: string;
1701
+ decision?: {
1702
+ source: "office" | "substrate";
1703
+ id: string;
1704
+ } | undefined;
1705
+ history?: {
1706
+ conversation_id: string;
1707
+ turn_id: string;
1708
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1709
+ } | undefined;
1710
+ };
1711
+ conversation_id: string;
1712
+ turn_id: string;
1713
+ state: "blocked";
1714
+ output: string;
1715
+ }, {
1716
+ error: {
1717
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1718
+ message: string;
1719
+ decision?: {
1720
+ source: "office" | "substrate";
1721
+ id: string;
1722
+ } | undefined;
1723
+ history?: {
1724
+ conversation_id: string;
1725
+ turn_id: string;
1726
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1727
+ } | undefined;
1728
+ };
1729
+ conversation_id: string;
1730
+ turn_id: string;
1731
+ state: "blocked";
1732
+ output: string;
1733
+ }>, z.ZodObject<{
1734
+ state: z.ZodLiteral<"failed">;
1735
+ error: z.ZodObject<{
1736
+ code: z.ZodEnum<["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"]>;
1737
+ message: z.ZodString;
1738
+ decision: z.ZodOptional<z.ZodObject<{
1739
+ source: z.ZodEnum<["office", "substrate"]>;
1740
+ id: z.ZodString;
1741
+ }, "strict", z.ZodTypeAny, {
1742
+ source: "office" | "substrate";
1743
+ id: string;
1744
+ }, {
1745
+ source: "office" | "substrate";
1746
+ id: string;
1747
+ }>>;
1748
+ history: z.ZodOptional<z.ZodObject<{
1749
+ turn_id: z.ZodString;
1750
+ conversation_id: z.ZodString;
1751
+ state: z.ZodEnum<["running", "awaiting_approval", "completed", "blocked", "failed", "interrupted"]>;
1752
+ }, "strict", z.ZodTypeAny, {
1753
+ conversation_id: string;
1754
+ turn_id: string;
1755
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1756
+ }, {
1757
+ conversation_id: string;
1758
+ turn_id: string;
1759
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1760
+ }>>;
1761
+ }, "strict", z.ZodTypeAny, {
1762
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1763
+ message: string;
1764
+ decision?: {
1765
+ source: "office" | "substrate";
1766
+ id: string;
1767
+ } | undefined;
1768
+ history?: {
1769
+ conversation_id: string;
1770
+ turn_id: string;
1771
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1772
+ } | undefined;
1773
+ }, {
1774
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1775
+ message: string;
1776
+ decision?: {
1777
+ source: "office" | "substrate";
1778
+ id: string;
1779
+ } | undefined;
1780
+ history?: {
1781
+ conversation_id: string;
1782
+ turn_id: string;
1783
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1784
+ } | undefined;
1785
+ }>;
1786
+ turn_id: z.ZodString;
1787
+ conversation_id: z.ZodString;
1788
+ output: z.ZodString;
1789
+ }, "strict", z.ZodTypeAny, {
1790
+ error: {
1791
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1792
+ message: string;
1793
+ decision?: {
1794
+ source: "office" | "substrate";
1795
+ id: string;
1796
+ } | undefined;
1797
+ history?: {
1798
+ conversation_id: string;
1799
+ turn_id: string;
1800
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1801
+ } | undefined;
1802
+ };
1803
+ conversation_id: string;
1804
+ turn_id: string;
1805
+ state: "failed";
1806
+ output: string;
1807
+ }, {
1808
+ error: {
1809
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1810
+ message: string;
1811
+ decision?: {
1812
+ source: "office" | "substrate";
1813
+ id: string;
1814
+ } | undefined;
1815
+ history?: {
1816
+ conversation_id: string;
1817
+ turn_id: string;
1818
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1819
+ } | undefined;
1820
+ };
1821
+ conversation_id: string;
1822
+ turn_id: string;
1823
+ state: "failed";
1824
+ output: string;
1825
+ }>, z.ZodObject<{
1826
+ state: z.ZodLiteral<"interrupted">;
1827
+ error: z.ZodObject<{
1828
+ code: z.ZodEnum<["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"]>;
1829
+ message: z.ZodString;
1830
+ decision: z.ZodOptional<z.ZodObject<{
1831
+ source: z.ZodEnum<["office", "substrate"]>;
1832
+ id: z.ZodString;
1833
+ }, "strict", z.ZodTypeAny, {
1834
+ source: "office" | "substrate";
1835
+ id: string;
1836
+ }, {
1837
+ source: "office" | "substrate";
1838
+ id: string;
1839
+ }>>;
1840
+ history: z.ZodOptional<z.ZodObject<{
1841
+ turn_id: z.ZodString;
1842
+ conversation_id: z.ZodString;
1843
+ state: z.ZodEnum<["running", "awaiting_approval", "completed", "blocked", "failed", "interrupted"]>;
1844
+ }, "strict", z.ZodTypeAny, {
1845
+ conversation_id: string;
1846
+ turn_id: string;
1847
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1848
+ }, {
1849
+ conversation_id: string;
1850
+ turn_id: string;
1851
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1852
+ }>>;
1853
+ }, "strict", z.ZodTypeAny, {
1854
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1855
+ message: string;
1856
+ decision?: {
1857
+ source: "office" | "substrate";
1858
+ id: string;
1859
+ } | undefined;
1860
+ history?: {
1861
+ conversation_id: string;
1862
+ turn_id: string;
1863
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1864
+ } | undefined;
1865
+ }, {
1866
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1867
+ message: string;
1868
+ decision?: {
1869
+ source: "office" | "substrate";
1870
+ id: string;
1871
+ } | undefined;
1872
+ history?: {
1873
+ conversation_id: string;
1874
+ turn_id: string;
1875
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1876
+ } | undefined;
1877
+ }>;
1878
+ turn_id: z.ZodString;
1879
+ conversation_id: z.ZodString;
1880
+ output: z.ZodString;
1881
+ }, "strict", z.ZodTypeAny, {
1882
+ error: {
1883
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1884
+ message: string;
1885
+ decision?: {
1886
+ source: "office" | "substrate";
1887
+ id: string;
1888
+ } | undefined;
1889
+ history?: {
1890
+ conversation_id: string;
1891
+ turn_id: string;
1892
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1893
+ } | undefined;
1894
+ };
1895
+ conversation_id: string;
1896
+ turn_id: string;
1897
+ state: "interrupted";
1898
+ output: string;
1899
+ }, {
1900
+ error: {
1901
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
1902
+ message: string;
1903
+ decision?: {
1904
+ source: "office" | "substrate";
1905
+ id: string;
1906
+ } | undefined;
1907
+ history?: {
1908
+ conversation_id: string;
1909
+ turn_id: string;
1910
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
1911
+ } | undefined;
1912
+ };
1913
+ conversation_id: string;
1914
+ turn_id: string;
1915
+ state: "interrupted";
1916
+ output: string;
1917
+ }>]>;
1918
+ export type OfficeTurn = z.infer<typeof officeTurnSchema>;
1919
+ export declare const officePublicEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1920
+ type: z.ZodLiteral<"started">;
1921
+ turn_id: z.ZodString;
1922
+ conversation_id: z.ZodString;
1923
+ sequence: z.ZodNumber;
1924
+ }, "strict", z.ZodTypeAny, {
1925
+ type: "started";
1926
+ conversation_id: string;
1927
+ turn_id: string;
1928
+ sequence: number;
1929
+ }, {
1930
+ type: "started";
1931
+ conversation_id: string;
1932
+ turn_id: string;
1933
+ sequence: number;
1934
+ }>, z.ZodObject<{
1935
+ type: z.ZodLiteral<"text_delta">;
1936
+ text: z.ZodString;
1937
+ sequence: z.ZodNumber;
1938
+ }, "strict", z.ZodTypeAny, {
1939
+ type: "text_delta";
1940
+ sequence: number;
1941
+ text: string;
1942
+ }, {
1943
+ type: "text_delta";
1944
+ sequence: number;
1945
+ text: string;
1946
+ }>, z.ZodObject<{
1947
+ type: z.ZodLiteral<"message">;
1948
+ text: z.ZodString;
1949
+ sequence: z.ZodNumber;
1950
+ }, "strict", z.ZodTypeAny, {
1951
+ type: "message";
1952
+ sequence: number;
1953
+ text: string;
1954
+ }, {
1955
+ type: "message";
1956
+ sequence: number;
1957
+ text: string;
1958
+ }>, z.ZodObject<{
1959
+ type: z.ZodLiteral<"approval_required">;
1960
+ decision: z.ZodObject<{
1961
+ source: z.ZodEnum<["office", "substrate"]>;
1962
+ id: z.ZodString;
1963
+ }, "strict", z.ZodTypeAny, {
1964
+ source: "office" | "substrate";
1965
+ id: string;
1966
+ }, {
1967
+ source: "office" | "substrate";
1968
+ id: string;
1969
+ }>;
1970
+ sequence: z.ZodNumber;
1971
+ }, "strict", z.ZodTypeAny, {
1972
+ type: "approval_required";
1973
+ decision: {
1974
+ source: "office" | "substrate";
1975
+ id: string;
1976
+ };
1977
+ sequence: number;
1978
+ }, {
1979
+ type: "approval_required";
1980
+ decision: {
1981
+ source: "office" | "substrate";
1982
+ id: string;
1983
+ };
1984
+ sequence: number;
1985
+ }>, z.ZodObject<{
1986
+ type: z.ZodLiteral<"decision_resolved">;
1987
+ decision: z.ZodObject<{
1988
+ source: z.ZodEnum<["office", "substrate"]>;
1989
+ id: z.ZodString;
1990
+ }, "strict", z.ZodTypeAny, {
1991
+ source: "office" | "substrate";
1992
+ id: string;
1993
+ }, {
1994
+ source: "office" | "substrate";
1995
+ id: string;
1996
+ }>;
1997
+ resolution: z.ZodEnum<["approved", "denied"]>;
1998
+ sequence: z.ZodNumber;
1999
+ }, "strict", z.ZodTypeAny, {
2000
+ type: "decision_resolved";
2001
+ decision: {
2002
+ source: "office" | "substrate";
2003
+ id: string;
2004
+ };
2005
+ resolution: "approved" | "denied";
2006
+ sequence: number;
2007
+ }, {
2008
+ type: "decision_resolved";
2009
+ decision: {
2010
+ source: "office" | "substrate";
2011
+ id: string;
2012
+ };
2013
+ resolution: "approved" | "denied";
2014
+ sequence: number;
2015
+ }>, z.ZodObject<{
2016
+ type: z.ZodLiteral<"blocked">;
2017
+ error: z.ZodObject<{
2018
+ code: z.ZodEnum<["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"]>;
2019
+ message: z.ZodString;
2020
+ decision: z.ZodOptional<z.ZodObject<{
2021
+ source: z.ZodEnum<["office", "substrate"]>;
2022
+ id: z.ZodString;
2023
+ }, "strict", z.ZodTypeAny, {
2024
+ source: "office" | "substrate";
2025
+ id: string;
2026
+ }, {
2027
+ source: "office" | "substrate";
2028
+ id: string;
2029
+ }>>;
2030
+ history: z.ZodOptional<z.ZodObject<{
2031
+ turn_id: z.ZodString;
2032
+ conversation_id: z.ZodString;
2033
+ state: z.ZodEnum<["running", "awaiting_approval", "completed", "blocked", "failed", "interrupted"]>;
2034
+ }, "strict", z.ZodTypeAny, {
2035
+ conversation_id: string;
2036
+ turn_id: string;
2037
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2038
+ }, {
2039
+ conversation_id: string;
2040
+ turn_id: string;
2041
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2042
+ }>>;
2043
+ }, "strict", z.ZodTypeAny, {
2044
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2045
+ message: string;
2046
+ decision?: {
2047
+ source: "office" | "substrate";
2048
+ id: string;
2049
+ } | undefined;
2050
+ history?: {
2051
+ conversation_id: string;
2052
+ turn_id: string;
2053
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2054
+ } | undefined;
2055
+ }, {
2056
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2057
+ message: string;
2058
+ decision?: {
2059
+ source: "office" | "substrate";
2060
+ id: string;
2061
+ } | undefined;
2062
+ history?: {
2063
+ conversation_id: string;
2064
+ turn_id: string;
2065
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2066
+ } | undefined;
2067
+ }>;
2068
+ sequence: z.ZodNumber;
2069
+ }, "strict", z.ZodTypeAny, {
2070
+ error: {
2071
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2072
+ message: string;
2073
+ decision?: {
2074
+ source: "office" | "substrate";
2075
+ id: string;
2076
+ } | undefined;
2077
+ history?: {
2078
+ conversation_id: string;
2079
+ turn_id: string;
2080
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2081
+ } | undefined;
2082
+ };
2083
+ type: "blocked";
2084
+ sequence: number;
2085
+ }, {
2086
+ error: {
2087
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2088
+ message: string;
2089
+ decision?: {
2090
+ source: "office" | "substrate";
2091
+ id: string;
2092
+ } | undefined;
2093
+ history?: {
2094
+ conversation_id: string;
2095
+ turn_id: string;
2096
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2097
+ } | undefined;
2098
+ };
2099
+ type: "blocked";
2100
+ sequence: number;
2101
+ }>, z.ZodObject<{
2102
+ type: z.ZodLiteral<"completed">;
2103
+ turn_id: z.ZodString;
2104
+ conversation_id: z.ZodString;
2105
+ resolution: z.ZodOptional<z.ZodEnum<["approved", "denied"]>>;
2106
+ sequence: z.ZodNumber;
2107
+ }, "strict", z.ZodTypeAny, {
2108
+ type: "completed";
2109
+ conversation_id: string;
2110
+ turn_id: string;
2111
+ sequence: number;
2112
+ resolution?: "approved" | "denied" | undefined;
2113
+ }, {
2114
+ type: "completed";
2115
+ conversation_id: string;
2116
+ turn_id: string;
2117
+ sequence: number;
2118
+ resolution?: "approved" | "denied" | undefined;
2119
+ }>, z.ZodObject<{
2120
+ type: z.ZodLiteral<"failed">;
2121
+ error: z.ZodObject<{
2122
+ code: z.ZodEnum<["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"]>;
2123
+ message: z.ZodString;
2124
+ decision: z.ZodOptional<z.ZodObject<{
2125
+ source: z.ZodEnum<["office", "substrate"]>;
2126
+ id: z.ZodString;
2127
+ }, "strict", z.ZodTypeAny, {
2128
+ source: "office" | "substrate";
2129
+ id: string;
2130
+ }, {
2131
+ source: "office" | "substrate";
2132
+ id: string;
2133
+ }>>;
2134
+ history: z.ZodOptional<z.ZodObject<{
2135
+ turn_id: z.ZodString;
2136
+ conversation_id: z.ZodString;
2137
+ state: z.ZodEnum<["running", "awaiting_approval", "completed", "blocked", "failed", "interrupted"]>;
2138
+ }, "strict", z.ZodTypeAny, {
2139
+ conversation_id: string;
2140
+ turn_id: string;
2141
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2142
+ }, {
2143
+ conversation_id: string;
2144
+ turn_id: string;
2145
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2146
+ }>>;
2147
+ }, "strict", z.ZodTypeAny, {
2148
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2149
+ message: string;
2150
+ decision?: {
2151
+ source: "office" | "substrate";
2152
+ id: string;
2153
+ } | undefined;
2154
+ history?: {
2155
+ conversation_id: string;
2156
+ turn_id: string;
2157
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2158
+ } | undefined;
2159
+ }, {
2160
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2161
+ message: string;
2162
+ decision?: {
2163
+ source: "office" | "substrate";
2164
+ id: string;
2165
+ } | undefined;
2166
+ history?: {
2167
+ conversation_id: string;
2168
+ turn_id: string;
2169
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2170
+ } | undefined;
2171
+ }>;
2172
+ sequence: z.ZodNumber;
2173
+ }, "strict", z.ZodTypeAny, {
2174
+ error: {
2175
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2176
+ message: string;
2177
+ decision?: {
2178
+ source: "office" | "substrate";
2179
+ id: string;
2180
+ } | undefined;
2181
+ history?: {
2182
+ conversation_id: string;
2183
+ turn_id: string;
2184
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2185
+ } | undefined;
2186
+ };
2187
+ type: "failed";
2188
+ sequence: number;
2189
+ }, {
2190
+ error: {
2191
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2192
+ message: string;
2193
+ decision?: {
2194
+ source: "office" | "substrate";
2195
+ id: string;
2196
+ } | undefined;
2197
+ history?: {
2198
+ conversation_id: string;
2199
+ turn_id: string;
2200
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2201
+ } | undefined;
2202
+ };
2203
+ type: "failed";
2204
+ sequence: number;
2205
+ }>, z.ZodObject<{
2206
+ type: z.ZodLiteral<"interrupted">;
2207
+ error: z.ZodObject<{
2208
+ code: z.ZodEnum<["invalid_request", "unauthenticated", "forbidden", "not_found", "owner_required", "managed_credential_forbidden", "credential_revoked", "organization_scope_required", "paid_plan_required", "account_suspended", "credits_required", "paused_by_owner", "credential_repair_required", "service_unavailable", "office_not_enabled", "idempotency_conflict", "conversation_busy", "conversation_awaiting_approval", "conversation_not_client_owned", "confirmation_expired", "confirmation_changed", "confirmation_unreviewable", "policy_conflict_requires_resolution", "events_expired", "event_limit_exceeded", "turn_interrupted", "deadline_exceeded", "execution_failed", "outcome_unknown", "observation_timeout", "connection_error", "protocol_error", "aborted"]>;
2209
+ message: z.ZodString;
2210
+ decision: z.ZodOptional<z.ZodObject<{
2211
+ source: z.ZodEnum<["office", "substrate"]>;
2212
+ id: z.ZodString;
2213
+ }, "strict", z.ZodTypeAny, {
2214
+ source: "office" | "substrate";
2215
+ id: string;
2216
+ }, {
2217
+ source: "office" | "substrate";
2218
+ id: string;
2219
+ }>>;
2220
+ history: z.ZodOptional<z.ZodObject<{
2221
+ turn_id: z.ZodString;
2222
+ conversation_id: z.ZodString;
2223
+ state: z.ZodEnum<["running", "awaiting_approval", "completed", "blocked", "failed", "interrupted"]>;
2224
+ }, "strict", z.ZodTypeAny, {
2225
+ conversation_id: string;
2226
+ turn_id: string;
2227
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2228
+ }, {
2229
+ conversation_id: string;
2230
+ turn_id: string;
2231
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2232
+ }>>;
2233
+ }, "strict", z.ZodTypeAny, {
2234
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2235
+ message: string;
2236
+ decision?: {
2237
+ source: "office" | "substrate";
2238
+ id: string;
2239
+ } | undefined;
2240
+ history?: {
2241
+ conversation_id: string;
2242
+ turn_id: string;
2243
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2244
+ } | undefined;
2245
+ }, {
2246
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2247
+ message: string;
2248
+ decision?: {
2249
+ source: "office" | "substrate";
2250
+ id: string;
2251
+ } | undefined;
2252
+ history?: {
2253
+ conversation_id: string;
2254
+ turn_id: string;
2255
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2256
+ } | undefined;
2257
+ }>;
2258
+ sequence: z.ZodNumber;
2259
+ }, "strict", z.ZodTypeAny, {
2260
+ error: {
2261
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2262
+ message: string;
2263
+ decision?: {
2264
+ source: "office" | "substrate";
2265
+ id: string;
2266
+ } | undefined;
2267
+ history?: {
2268
+ conversation_id: string;
2269
+ turn_id: string;
2270
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2271
+ } | undefined;
2272
+ };
2273
+ type: "interrupted";
2274
+ sequence: number;
2275
+ }, {
2276
+ error: {
2277
+ code: "aborted" | "invalid_request" | "unauthenticated" | "forbidden" | "not_found" | "owner_required" | "managed_credential_forbidden" | "credential_revoked" | "organization_scope_required" | "paid_plan_required" | "account_suspended" | "credits_required" | "paused_by_owner" | "credential_repair_required" | "service_unavailable" | "office_not_enabled" | "idempotency_conflict" | "conversation_busy" | "conversation_awaiting_approval" | "conversation_not_client_owned" | "confirmation_expired" | "confirmation_changed" | "confirmation_unreviewable" | "policy_conflict_requires_resolution" | "events_expired" | "event_limit_exceeded" | "turn_interrupted" | "deadline_exceeded" | "execution_failed" | "outcome_unknown" | "observation_timeout" | "connection_error" | "protocol_error";
2278
+ message: string;
2279
+ decision?: {
2280
+ source: "office" | "substrate";
2281
+ id: string;
2282
+ } | undefined;
2283
+ history?: {
2284
+ conversation_id: string;
2285
+ turn_id: string;
2286
+ state: "running" | "awaiting_approval" | "completed" | "blocked" | "failed" | "interrupted";
2287
+ } | undefined;
2288
+ };
2289
+ type: "interrupted";
2290
+ sequence: number;
2291
+ }>]>;
2292
+ export type OfficePublicEvent = z.infer<typeof officePublicEventSchema>;
2293
+ export type OfficePublicEventInput = OfficePublicEvent extends infer E ? E extends OfficePublicEvent ? Omit<E, 'sequence'> : never : never;
2294
+ export interface OfficeClientOptions {
2295
+ apiUrl: string;
2296
+ organizationId: string;
2297
+ getToken: () => string | Promise<string>;
2298
+ fetch?: typeof globalThis.fetch;
2299
+ }
2300
+ export interface OfficeRequestOptions {
2301
+ signal?: AbortSignal;
2302
+ }
2303
+ export interface OfficeWriteOptions extends OfficeRequestOptions {
2304
+ idempotencyKey?: string;
2305
+ }
2306
+ export interface OfficePageOptions extends OfficeRequestOptions {
2307
+ cursor?: string;
2308
+ limit?: number;
2309
+ }
2310
+ export interface OfficePage<T> {
2311
+ items: T[];
2312
+ next_cursor: string | null;
2313
+ }
2314
+ export interface OfficeDecision {
2315
+ ref: DecisionRef;
2316
+ canonical_ref?: DecisionRef;
2317
+ status: 'pending' | 'approved' | 'denied' | 'executed' | 'failed' | 'expired';
2318
+ title: string;
2319
+ created_at: string;
2320
+ preview: Record<string, unknown>;
2321
+ outcome?: Record<string, unknown>;
2322
+ }
2323
+ export interface OfficeDecisionContext {
2324
+ decision: OfficeDecision;
2325
+ references: Array<{
2326
+ kind: string;
2327
+ id: string;
2328
+ }>;
2329
+ policy?: Record<string, unknown>;
2330
+ messages?: Array<{
2331
+ role: string;
2332
+ content: string;
2333
+ }>;
2334
+ }
2335
+ export interface OfficeConversation {
2336
+ id: string;
2337
+ organization_id: string;
2338
+ origin: 'office';
2339
+ title: string | null;
2340
+ created_at: string;
2341
+ updated_at: string;
2342
+ }
2343
+ export interface OfficeConversationDetail extends OfficeConversation {
2344
+ messages: Array<{
2345
+ id: string;
2346
+ role: string;
2347
+ content: string;
2348
+ created_at: string;
2349
+ }>;
2350
+ turn?: OfficeTurn;
2351
+ events?: OfficePublicEvent[];
2352
+ }
2353
+ export interface OfficeMemoryResult {
2354
+ action_id: string;
2355
+ verdict: Record<string, unknown>;
2356
+ result?: Record<string, unknown>;
2357
+ decision?: DecisionRef;
2358
+ }
2359
+ /** Memory readers preserve the native record payload rather than maintaining a second schema. */
2360
+ export interface OfficeMemoryRecord {
2361
+ id: string;
2362
+ kind: string;
2363
+ [key: string]: unknown;
2364
+ }
2365
+ export interface OfficeSourceArtifact {
2366
+ id: string;
2367
+ [key: string]: unknown;
2368
+ }
2369
+ export interface OfficePrinciple {
2370
+ id: string;
2371
+ title: string;
2372
+ applies_to: Record<string, unknown>;
2373
+ constraint_spec: Record<string, unknown>;
2374
+ [key: string]: unknown;
2375
+ }
2376
+ //# sourceMappingURL=office.d.ts.map