@undefineds.co/models 0.2.15 → 0.2.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +26 -28
  2. package/dist/agent.providers.js +11 -0
  3. package/dist/agent.repository.d.ts +1 -1
  4. package/dist/ai-config/index.d.ts +10 -2
  5. package/dist/ai-config/index.js +53 -15
  6. package/dist/ai-model.schema.js +4 -3
  7. package/dist/ai-provider.schema.js +1 -1
  8. package/dist/approval.schema.d.ts +7 -1
  9. package/dist/approval.schema.js +6 -8
  10. package/dist/audit.presentation.d.ts +23 -0
  11. package/dist/audit.presentation.js +275 -0
  12. package/dist/audit.schema.d.ts +1 -1
  13. package/dist/audit.schema.js +3 -8
  14. package/dist/chat.repository.d.ts +1 -1
  15. package/dist/chat.utils.d.ts +9 -0
  16. package/dist/chat.utils.js +33 -0
  17. package/dist/contact.repository.d.ts +1 -1
  18. package/dist/contact.schema.d.ts +8 -0
  19. package/dist/contact.schema.js +12 -0
  20. package/dist/credential.schema.js +1 -1
  21. package/dist/discovery/models.json +29 -0
  22. package/dist/discovery/providers.json +10 -0
  23. package/dist/grant.schema.d.ts +28 -1
  24. package/dist/grant.schema.js +21 -7
  25. package/dist/index.d.ts +10 -8
  26. package/dist/index.js +9 -7
  27. package/dist/message.repository.d.ts +1 -1
  28. package/dist/namespaces.js +11 -0
  29. package/dist/profile.repository.d.ts +7 -7
  30. package/dist/repository.d.ts +1 -99
  31. package/dist/repository.js +1 -189
  32. package/dist/schema.d.ts +34 -0
  33. package/dist/session/index.d.ts +1 -1
  34. package/dist/session/index.js +1 -1
  35. package/dist/session/session.schema.d.ts +2 -1
  36. package/dist/session/session.schema.js +11 -7
  37. package/dist/session.repository.d.ts +1 -1
  38. package/dist/sidecar/persistence-mapping.d.ts +2 -2
  39. package/dist/sidecar/sidecar-events.d.ts +192 -6
  40. package/dist/sidecar/sidecar-events.js +10 -0
  41. package/dist/thread.repository.d.ts +1 -1
  42. package/dist/vocab/sidecar.vocab.d.ts +17 -0
  43. package/dist/vocab/sidecar.vocab.js +17 -0
  44. package/dist/watch/index.d.ts +55 -0
  45. package/dist/watch/index.js +349 -12
  46. package/package.json +4 -4
@@ -15,6 +15,23 @@ export declare const ToolCallEventV1Schema: z.ZodObject<{
15
15
  toolName: z.ZodString;
16
16
  risk: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
17
17
  status: z.ZodEnum<["calling", "waiting_approval", "approved", "rejected", "running", "done", "error"]>;
18
+ approvalOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
19
+ optionId: z.ZodString;
20
+ label: z.ZodString;
21
+ kind: z.ZodOptional<z.ZodString>;
22
+ description: z.ZodOptional<z.ZodString>;
23
+ }, "strict", z.ZodTypeAny, {
24
+ label: string;
25
+ optionId: string;
26
+ description?: string | undefined;
27
+ kind?: string | undefined;
28
+ }, {
29
+ label: string;
30
+ optionId: string;
31
+ description?: string | undefined;
32
+ kind?: string | undefined;
33
+ }>, "many">>;
34
+ expiresAt: z.ZodOptional<z.ZodString>;
18
35
  target: z.ZodOptional<z.ZodString>;
19
36
  action: z.ZodOptional<z.ZodString>;
20
37
  arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -37,6 +54,13 @@ export declare const ToolCallEventV1Schema: z.ZodObject<{
37
54
  target?: string | undefined;
38
55
  action?: string | undefined;
39
56
  risk?: "low" | "medium" | "high" | undefined;
57
+ approvalOptions?: {
58
+ label: string;
59
+ optionId: string;
60
+ description?: string | undefined;
61
+ kind?: string | undefined;
62
+ }[] | undefined;
63
+ expiresAt?: string | undefined;
40
64
  policyVersion?: string | undefined;
41
65
  decisionBy?: string | undefined;
42
66
  decisionRole?: "human" | "secretary" | "system" | undefined;
@@ -57,6 +81,13 @@ export declare const ToolCallEventV1Schema: z.ZodObject<{
57
81
  target?: string | undefined;
58
82
  action?: string | undefined;
59
83
  risk?: "low" | "medium" | "high" | undefined;
84
+ approvalOptions?: {
85
+ label: string;
86
+ optionId: string;
87
+ description?: string | undefined;
88
+ kind?: string | undefined;
89
+ }[] | undefined;
90
+ expiresAt?: string | undefined;
60
91
  policyVersion?: string | undefined;
61
92
  decisionBy?: string | undefined;
62
93
  decisionRole?: "human" | "secretary" | "system" | undefined;
@@ -76,6 +107,23 @@ export declare const ToolCallEventSchema: z.ZodObject<{
76
107
  toolName: z.ZodString;
77
108
  risk: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
78
109
  status: z.ZodEnum<["calling", "waiting_approval", "approved", "rejected", "running", "done", "error"]>;
110
+ approvalOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
111
+ optionId: z.ZodString;
112
+ label: z.ZodString;
113
+ kind: z.ZodOptional<z.ZodString>;
114
+ description: z.ZodOptional<z.ZodString>;
115
+ }, "strict", z.ZodTypeAny, {
116
+ label: string;
117
+ optionId: string;
118
+ description?: string | undefined;
119
+ kind?: string | undefined;
120
+ }, {
121
+ label: string;
122
+ optionId: string;
123
+ description?: string | undefined;
124
+ kind?: string | undefined;
125
+ }>, "many">>;
126
+ expiresAt: z.ZodOptional<z.ZodString>;
79
127
  target: z.ZodOptional<z.ZodString>;
80
128
  action: z.ZodOptional<z.ZodString>;
81
129
  arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -98,6 +146,13 @@ export declare const ToolCallEventSchema: z.ZodObject<{
98
146
  target?: string | undefined;
99
147
  action?: string | undefined;
100
148
  risk?: "low" | "medium" | "high" | undefined;
149
+ approvalOptions?: {
150
+ label: string;
151
+ optionId: string;
152
+ description?: string | undefined;
153
+ kind?: string | undefined;
154
+ }[] | undefined;
155
+ expiresAt?: string | undefined;
101
156
  policyVersion?: string | undefined;
102
157
  decisionBy?: string | undefined;
103
158
  decisionRole?: "human" | "secretary" | "system" | undefined;
@@ -118,6 +173,13 @@ export declare const ToolCallEventSchema: z.ZodObject<{
118
173
  target?: string | undefined;
119
174
  action?: string | undefined;
120
175
  risk?: "low" | "medium" | "high" | undefined;
176
+ approvalOptions?: {
177
+ label: string;
178
+ optionId: string;
179
+ description?: string | undefined;
180
+ kind?: string | undefined;
181
+ }[] | undefined;
182
+ expiresAt?: string | undefined;
121
183
  policyVersion?: string | undefined;
122
184
  decisionBy?: string | undefined;
123
185
  decisionRole?: "human" | "secretary" | "system" | undefined;
@@ -151,9 +213,9 @@ export declare const SessionStateEventV1Schema: z.ZodObject<{
151
213
  tokenUsage: number;
152
214
  type: "session.state";
153
215
  tool: "claude-code" | "cursor" | "windsurf";
216
+ chatId: string;
154
217
  sessionId: string;
155
218
  timestamp: string;
156
- chatId: string;
157
219
  previousStatus: string;
158
220
  policy?: string | undefined;
159
221
  policyVersion?: string | undefined;
@@ -163,9 +225,9 @@ export declare const SessionStateEventV1Schema: z.ZodObject<{
163
225
  tokenUsage: number;
164
226
  type: "session.state";
165
227
  tool: "claude-code" | "cursor" | "windsurf";
228
+ chatId: string;
166
229
  sessionId: string;
167
230
  timestamp: string;
168
- chatId: string;
169
231
  previousStatus: string;
170
232
  policy?: string | undefined;
171
233
  policyVersion?: string | undefined;
@@ -188,9 +250,9 @@ export declare const SessionStateEventSchema: z.ZodObject<{
188
250
  tokenUsage: number;
189
251
  type: "session.state";
190
252
  tool: "claude-code" | "cursor" | "windsurf";
253
+ chatId: string;
191
254
  sessionId: string;
192
255
  timestamp: string;
193
- chatId: string;
194
256
  previousStatus: string;
195
257
  policy?: string | undefined;
196
258
  policyVersion?: string | undefined;
@@ -200,9 +262,9 @@ export declare const SessionStateEventSchema: z.ZodObject<{
200
262
  tokenUsage: number;
201
263
  type: "session.state";
202
264
  tool: "claude-code" | "cursor" | "windsurf";
265
+ chatId: string;
203
266
  sessionId: string;
204
267
  timestamp: string;
205
- chatId: string;
206
268
  previousStatus: string;
207
269
  policy?: string | undefined;
208
270
  policyVersion?: string | undefined;
@@ -346,8 +408,25 @@ export declare const InboxApprovalEventV1Schema: z.ZodObject<{
346
408
  policyVersion: z.ZodOptional<z.ZodString>;
347
409
  risk: z.ZodEnum<["low", "medium", "high"]>;
348
410
  status: z.ZodEnum<["pending", "approved", "rejected", "expired"]>;
411
+ approvalOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
412
+ optionId: z.ZodString;
413
+ label: z.ZodString;
414
+ kind: z.ZodOptional<z.ZodString>;
415
+ description: z.ZodOptional<z.ZodString>;
416
+ }, "strict", z.ZodTypeAny, {
417
+ label: string;
418
+ optionId: string;
419
+ description?: string | undefined;
420
+ kind?: string | undefined;
421
+ }, {
422
+ label: string;
423
+ optionId: string;
424
+ description?: string | undefined;
425
+ kind?: string | undefined;
426
+ }>, "many">>;
349
427
  assignedTo: z.ZodOptional<z.ZodString>;
350
428
  createdAt: z.ZodString;
429
+ expiresAt: z.ZodOptional<z.ZodString>;
351
430
  resolvedAt: z.ZodOptional<z.ZodString>;
352
431
  }, "strict", z.ZodTypeAny, {
353
432
  createdAt: string;
@@ -362,6 +441,13 @@ export declare const InboxApprovalEventV1Schema: z.ZodObject<{
362
441
  assignedTo?: string | undefined;
363
442
  resolvedAt?: string | undefined;
364
443
  policy?: string | undefined;
444
+ approvalOptions?: {
445
+ label: string;
446
+ optionId: string;
447
+ description?: string | undefined;
448
+ kind?: string | undefined;
449
+ }[] | undefined;
450
+ expiresAt?: string | undefined;
365
451
  policyVersion?: string | undefined;
366
452
  version?: 1 | undefined;
367
453
  }, {
@@ -377,6 +463,13 @@ export declare const InboxApprovalEventV1Schema: z.ZodObject<{
377
463
  assignedTo?: string | undefined;
378
464
  resolvedAt?: string | undefined;
379
465
  policy?: string | undefined;
466
+ approvalOptions?: {
467
+ label: string;
468
+ optionId: string;
469
+ description?: string | undefined;
470
+ kind?: string | undefined;
471
+ }[] | undefined;
472
+ expiresAt?: string | undefined;
380
473
  policyVersion?: string | undefined;
381
474
  version?: 1 | undefined;
382
475
  }>;
@@ -392,8 +485,25 @@ export declare const InboxApprovalEventSchema: z.ZodObject<{
392
485
  policyVersion: z.ZodOptional<z.ZodString>;
393
486
  risk: z.ZodEnum<["low", "medium", "high"]>;
394
487
  status: z.ZodEnum<["pending", "approved", "rejected", "expired"]>;
488
+ approvalOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
489
+ optionId: z.ZodString;
490
+ label: z.ZodString;
491
+ kind: z.ZodOptional<z.ZodString>;
492
+ description: z.ZodOptional<z.ZodString>;
493
+ }, "strict", z.ZodTypeAny, {
494
+ label: string;
495
+ optionId: string;
496
+ description?: string | undefined;
497
+ kind?: string | undefined;
498
+ }, {
499
+ label: string;
500
+ optionId: string;
501
+ description?: string | undefined;
502
+ kind?: string | undefined;
503
+ }>, "many">>;
395
504
  assignedTo: z.ZodOptional<z.ZodString>;
396
505
  createdAt: z.ZodString;
506
+ expiresAt: z.ZodOptional<z.ZodString>;
397
507
  resolvedAt: z.ZodOptional<z.ZodString>;
398
508
  }, "strict", z.ZodTypeAny, {
399
509
  createdAt: string;
@@ -408,6 +518,13 @@ export declare const InboxApprovalEventSchema: z.ZodObject<{
408
518
  assignedTo?: string | undefined;
409
519
  resolvedAt?: string | undefined;
410
520
  policy?: string | undefined;
521
+ approvalOptions?: {
522
+ label: string;
523
+ optionId: string;
524
+ description?: string | undefined;
525
+ kind?: string | undefined;
526
+ }[] | undefined;
527
+ expiresAt?: string | undefined;
411
528
  policyVersion?: string | undefined;
412
529
  version?: 1 | undefined;
413
530
  }, {
@@ -423,6 +540,13 @@ export declare const InboxApprovalEventSchema: z.ZodObject<{
423
540
  assignedTo?: string | undefined;
424
541
  resolvedAt?: string | undefined;
425
542
  policy?: string | undefined;
543
+ approvalOptions?: {
544
+ label: string;
545
+ optionId: string;
546
+ description?: string | undefined;
547
+ kind?: string | undefined;
548
+ }[] | undefined;
549
+ expiresAt?: string | undefined;
426
550
  policyVersion?: string | undefined;
427
551
  version?: 1 | undefined;
428
552
  }>;
@@ -435,6 +559,23 @@ export declare const SidecarEventSchema: z.ZodUnion<[z.ZodObject<{
435
559
  toolName: z.ZodString;
436
560
  risk: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
437
561
  status: z.ZodEnum<["calling", "waiting_approval", "approved", "rejected", "running", "done", "error"]>;
562
+ approvalOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
563
+ optionId: z.ZodString;
564
+ label: z.ZodString;
565
+ kind: z.ZodOptional<z.ZodString>;
566
+ description: z.ZodOptional<z.ZodString>;
567
+ }, "strict", z.ZodTypeAny, {
568
+ label: string;
569
+ optionId: string;
570
+ description?: string | undefined;
571
+ kind?: string | undefined;
572
+ }, {
573
+ label: string;
574
+ optionId: string;
575
+ description?: string | undefined;
576
+ kind?: string | undefined;
577
+ }>, "many">>;
578
+ expiresAt: z.ZodOptional<z.ZodString>;
438
579
  target: z.ZodOptional<z.ZodString>;
439
580
  action: z.ZodOptional<z.ZodString>;
440
581
  arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -457,6 +598,13 @@ export declare const SidecarEventSchema: z.ZodUnion<[z.ZodObject<{
457
598
  target?: string | undefined;
458
599
  action?: string | undefined;
459
600
  risk?: "low" | "medium" | "high" | undefined;
601
+ approvalOptions?: {
602
+ label: string;
603
+ optionId: string;
604
+ description?: string | undefined;
605
+ kind?: string | undefined;
606
+ }[] | undefined;
607
+ expiresAt?: string | undefined;
460
608
  policyVersion?: string | undefined;
461
609
  decisionBy?: string | undefined;
462
610
  decisionRole?: "human" | "secretary" | "system" | undefined;
@@ -477,6 +625,13 @@ export declare const SidecarEventSchema: z.ZodUnion<[z.ZodObject<{
477
625
  target?: string | undefined;
478
626
  action?: string | undefined;
479
627
  risk?: "low" | "medium" | "high" | undefined;
628
+ approvalOptions?: {
629
+ label: string;
630
+ optionId: string;
631
+ description?: string | undefined;
632
+ kind?: string | undefined;
633
+ }[] | undefined;
634
+ expiresAt?: string | undefined;
480
635
  policyVersion?: string | undefined;
481
636
  decisionBy?: string | undefined;
482
637
  decisionRole?: "human" | "secretary" | "system" | undefined;
@@ -504,9 +659,9 @@ export declare const SidecarEventSchema: z.ZodUnion<[z.ZodObject<{
504
659
  tokenUsage: number;
505
660
  type: "session.state";
506
661
  tool: "claude-code" | "cursor" | "windsurf";
662
+ chatId: string;
507
663
  sessionId: string;
508
664
  timestamp: string;
509
- chatId: string;
510
665
  previousStatus: string;
511
666
  policy?: string | undefined;
512
667
  policyVersion?: string | undefined;
@@ -516,9 +671,9 @@ export declare const SidecarEventSchema: z.ZodUnion<[z.ZodObject<{
516
671
  tokenUsage: number;
517
672
  type: "session.state";
518
673
  tool: "claude-code" | "cursor" | "windsurf";
674
+ chatId: string;
519
675
  sessionId: string;
520
676
  timestamp: string;
521
- chatId: string;
522
677
  previousStatus: string;
523
678
  policy?: string | undefined;
524
679
  policyVersion?: string | undefined;
@@ -594,8 +749,25 @@ export declare const SidecarEventSchema: z.ZodUnion<[z.ZodObject<{
594
749
  policyVersion: z.ZodOptional<z.ZodString>;
595
750
  risk: z.ZodEnum<["low", "medium", "high"]>;
596
751
  status: z.ZodEnum<["pending", "approved", "rejected", "expired"]>;
752
+ approvalOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
753
+ optionId: z.ZodString;
754
+ label: z.ZodString;
755
+ kind: z.ZodOptional<z.ZodString>;
756
+ description: z.ZodOptional<z.ZodString>;
757
+ }, "strict", z.ZodTypeAny, {
758
+ label: string;
759
+ optionId: string;
760
+ description?: string | undefined;
761
+ kind?: string | undefined;
762
+ }, {
763
+ label: string;
764
+ optionId: string;
765
+ description?: string | undefined;
766
+ kind?: string | undefined;
767
+ }>, "many">>;
597
768
  assignedTo: z.ZodOptional<z.ZodString>;
598
769
  createdAt: z.ZodString;
770
+ expiresAt: z.ZodOptional<z.ZodString>;
599
771
  resolvedAt: z.ZodOptional<z.ZodString>;
600
772
  }, "strict", z.ZodTypeAny, {
601
773
  createdAt: string;
@@ -610,6 +782,13 @@ export declare const SidecarEventSchema: z.ZodUnion<[z.ZodObject<{
610
782
  assignedTo?: string | undefined;
611
783
  resolvedAt?: string | undefined;
612
784
  policy?: string | undefined;
785
+ approvalOptions?: {
786
+ label: string;
787
+ optionId: string;
788
+ description?: string | undefined;
789
+ kind?: string | undefined;
790
+ }[] | undefined;
791
+ expiresAt?: string | undefined;
613
792
  policyVersion?: string | undefined;
614
793
  version?: 1 | undefined;
615
794
  }, {
@@ -625,6 +804,13 @@ export declare const SidecarEventSchema: z.ZodUnion<[z.ZodObject<{
625
804
  assignedTo?: string | undefined;
626
805
  resolvedAt?: string | undefined;
627
806
  policy?: string | undefined;
807
+ approvalOptions?: {
808
+ label: string;
809
+ optionId: string;
810
+ description?: string | undefined;
811
+ kind?: string | undefined;
812
+ }[] | undefined;
813
+ expiresAt?: string | undefined;
628
814
  policyVersion?: string | undefined;
629
815
  version?: 1 | undefined;
630
816
  }>]>;
@@ -11,6 +11,12 @@ export const ToolCallStatusSchema = z.enum([
11
11
  'error',
12
12
  ]);
13
13
  const IsoDatetimeSchema = z.string().datetime();
14
+ const ApprovalOptionSchema = z.object({
15
+ optionId: z.string(),
16
+ label: z.string(),
17
+ kind: z.string().optional(),
18
+ description: z.string().optional(),
19
+ }).strict();
14
20
  // --------------------------------------------
15
21
  // tool.call
16
22
  // --------------------------------------------
@@ -23,6 +29,8 @@ export const ToolCallEventV1Schema = z
23
29
  toolName: z.string(),
24
30
  risk: RiskLevelSchema.optional(),
25
31
  status: ToolCallStatusSchema,
32
+ approvalOptions: z.array(ApprovalOptionSchema).optional(),
33
+ expiresAt: IsoDatetimeSchema.optional(),
26
34
  // CP0 Pod-only scope projection
27
35
  target: z.string().optional(),
28
36
  action: z.string().optional(),
@@ -113,8 +121,10 @@ export const InboxApprovalEventV1Schema = z
113
121
  policyVersion: z.string().optional(),
114
122
  risk: RiskLevelSchema,
115
123
  status: InboxApprovalStatusSchema,
124
+ approvalOptions: z.array(ApprovalOptionSchema).optional(),
116
125
  assignedTo: z.string().optional(),
117
126
  createdAt: IsoDatetimeSchema,
127
+ expiresAt: IsoDatetimeSchema.optional(),
118
128
  resolvedAt: IsoDatetimeSchema.optional(),
119
129
  })
120
130
  .strict();
@@ -1,4 +1,4 @@
1
- export declare const threadRepository: import("./repository").PodRepositoryDescriptor<import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
1
+ export declare const threadRepository: import("@undefineds.co/drizzle-solid/dist/core/repository").PodRepositoryDescriptor<import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
2
2
  id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
3
3
  chat: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
4
4
  title: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
@@ -11,8 +11,11 @@ export declare const ApprovalVocab: {
11
11
  readonly decisionRole: string;
12
12
  readonly onBehalfOf: string;
13
13
  readonly reason: string;
14
+ readonly context: string;
15
+ readonly approvalOptions: string;
14
16
  readonly policyVersion: string;
15
17
  readonly createdAt: string;
18
+ readonly expiresAt: string;
16
19
  readonly resolvedAt: string;
17
20
  };
18
21
  export declare const AuditVocab: {
@@ -32,8 +35,22 @@ export declare const AuditVocab: {
32
35
  export declare const GrantVocab: {
33
36
  readonly target: string;
34
37
  readonly action: string;
38
+ readonly title: string;
39
+ readonly summary: string;
40
+ readonly body: string;
41
+ readonly schema: string;
42
+ readonly pageKind: string;
43
+ readonly wikiStatus: string;
44
+ readonly tags: string;
45
+ readonly source: string;
46
+ readonly sourceHash: string;
47
+ readonly compiledAt: string;
48
+ readonly compiledFrom: string;
49
+ readonly related: string;
35
50
  readonly effect: string;
36
51
  readonly riskCeiling: string;
52
+ readonly policy: string;
53
+ readonly context: string;
37
54
  readonly decisionBy: string;
38
55
  readonly decisionRole: string;
39
56
  readonly onBehalfOf: string;
@@ -12,8 +12,11 @@ export const ApprovalVocab = {
12
12
  decisionRole: UDFS.decisionRole,
13
13
  onBehalfOf: UDFS.onBehalfOf,
14
14
  reason: UDFS.reason,
15
+ context: UDFS.context,
16
+ approvalOptions: UDFS.approvalOptions,
15
17
  policyVersion: UDFS.policyVersion,
16
18
  createdAt: DCTerms.created,
19
+ expiresAt: UDFS.expiresAt,
17
20
  resolvedAt: UDFS.resolvedAt,
18
21
  };
19
22
  export const AuditVocab = {
@@ -33,8 +36,22 @@ export const AuditVocab = {
33
36
  export const GrantVocab = {
34
37
  target: ODRL.target,
35
38
  action: ODRL.action,
39
+ title: DCTerms.title,
40
+ summary: UDFS.summary,
41
+ body: UDFS.body,
42
+ schema: DCTerms.conformsTo,
43
+ pageKind: UDFS.pageKind,
44
+ wikiStatus: UDFS.status,
45
+ tags: UDFS.tags,
46
+ source: UDFS.source,
47
+ sourceHash: UDFS.sourceHash,
48
+ compiledAt: UDFS.compiledAt,
49
+ compiledFrom: UDFS.compiledFrom,
50
+ related: UDFS.related,
36
51
  effect: UDFS.effect,
37
52
  riskCeiling: UDFS.riskCeiling,
53
+ policy: UDFS.policy,
54
+ context: UDFS.context,
38
55
  decisionBy: UDFS.decisionBy,
39
56
  decisionRole: UDFS.decisionRole,
40
57
  onBehalfOf: UDFS.onBehalfOf,
@@ -54,9 +54,20 @@ export interface WatchSessionRecord {
54
54
  export type WatchApprovalRequestKind = 'command-approval' | 'file-change-approval' | 'permissions-approval' | 'codex-approval';
55
55
  export type WatchInteractionRequestKind = WatchApprovalRequestKind | 'user-input';
56
56
  export type WatchApprovalDecision = 'accept' | 'accept_for_session' | 'decline' | 'cancel';
57
+ export type WatchSecretaryApprovalDecision = 'accept' | 'decline' | 'cancel';
58
+ export type WatchApprovalOptionKind = 'allow_once' | 'allow_always' | 'reject_once' | 'reject_always' | (string & {});
59
+ export interface WatchApprovalOption {
60
+ optionId: string;
61
+ label: string;
62
+ kind?: WatchApprovalOptionKind;
63
+ description?: string;
64
+ }
57
65
  interface WatchInteractionRequestBase {
58
66
  kind: WatchInteractionRequestKind;
59
67
  message: string;
68
+ approvalOptions?: WatchApprovalOption[];
69
+ timeoutMs?: number;
70
+ expiresAt?: string;
60
71
  raw?: unknown;
61
72
  }
62
73
  export interface WatchCommandApprovalRequest extends WatchInteractionRequestBase {
@@ -95,6 +106,38 @@ export interface WatchUserInputAnswerRecord {
95
106
  answers: string[];
96
107
  }
97
108
  export type WatchUserInputAnswers = Record<string, WatchUserInputAnswerRecord>;
109
+ export type WatchSecretaryRecommendationSource = 'model' | 'fallback';
110
+ export interface WatchSecretaryRecommendationBase {
111
+ kind: WatchInteractionRequestKind;
112
+ canAutoDecide: boolean;
113
+ confidence?: number;
114
+ reason?: string;
115
+ reactionWindowMs?: number;
116
+ source?: WatchSecretaryRecommendationSource;
117
+ }
118
+ export interface WatchSecretaryApprovalRecommendation extends WatchSecretaryRecommendationBase {
119
+ kind: WatchApprovalRequestKind;
120
+ decision?: WatchSecretaryApprovalDecision;
121
+ }
122
+ export interface WatchSecretaryUserInputRecommendation extends WatchSecretaryRecommendationBase {
123
+ kind: 'user-input';
124
+ answers?: WatchUserInputAnswers;
125
+ }
126
+ export type WatchSecretaryRecommendation = WatchSecretaryApprovalRecommendation | WatchSecretaryUserInputRecommendation;
127
+ export interface WatchGrantCoverageDecision {
128
+ covers: boolean;
129
+ confidence?: number;
130
+ reason?: string;
131
+ source?: WatchSecretaryRecommendationSource;
132
+ }
133
+ export interface ParseWatchSecretaryRecommendationOptions {
134
+ mode: WatchMode;
135
+ request: WatchInteractionRequest;
136
+ defaultReactionWindowMs?: number;
137
+ }
138
+ export declare const DEFAULT_WATCH_SECRETARY_REACTION_WINDOW_MS = 5000;
139
+ export declare const MIN_WATCH_SECRETARY_REACTION_WINDOW_MS = 5000;
140
+ export declare const MAX_WATCH_SECRETARY_REACTION_WINDOW_MS = 60000;
98
141
  export interface WatchToolCallEvent {
99
142
  type: 'tool.call';
100
143
  name: string;
@@ -152,8 +195,10 @@ export interface WatchThreadMetadata extends Record<string, unknown> {
152
195
  backendSessionId?: string;
153
196
  }
154
197
  export type WatchTranscriptMessageRole = 'user' | 'assistant' | 'system';
198
+ export type WatchTranscriptMessageSource = 'user' | 'primary-agent' | 'secretary' | 'tool' | 'system';
155
199
  export interface WatchTranscriptMessage {
156
200
  role: WatchTranscriptMessageRole;
201
+ source: WatchTranscriptMessageSource;
157
202
  content: string;
158
203
  createdAt: string;
159
204
  }
@@ -172,6 +217,7 @@ export declare const WATCH_SESSION_FILE_NAME = "session.json";
172
217
  export declare const WATCH_EVENTS_FILE_NAME = "events.jsonl";
173
218
  export declare function normalizeWatchUserInputQuestion(value: unknown, fallbackId?: string): WatchUserInputQuestion | null;
174
219
  export declare function resolveWatchQuestionAnswer(question: WatchUserInputQuestion, answer: string): string[];
220
+ export declare function normalizeWatchApprovalOptions(value: unknown): WatchApprovalOption[];
175
221
  export declare function createWatchSessionId(options?: CreateWatchSessionIdOptions): string;
176
222
  export declare function normalizeWatchCredentialSource(source?: WatchCredentialSource | null): WatchCredentialSource;
177
223
  export declare function shouldAttemptCloudCredentialProbe(requestedSource: WatchCredentialSource, localAuthStatus: WatchAuthStatus): boolean;
@@ -186,6 +232,15 @@ export declare function resolveWatchAutoApprovalDecision(input: {
186
232
  mode: WatchMode;
187
233
  request: WatchApprovalRequest;
188
234
  }): WatchApprovalDecision | null;
235
+ export declare function createFallbackWatchSecretaryRecommendation(input: {
236
+ mode: WatchMode;
237
+ request: WatchInteractionRequest;
238
+ }): WatchSecretaryRecommendation | null;
239
+ export declare function parseWatchSecretaryRecommendation(text: string, options: ParseWatchSecretaryRecommendationOptions): WatchSecretaryRecommendation | null;
240
+ export declare function watchApprovalDecisionLabel(decision: WatchApprovalDecision): string;
241
+ export declare function watchUserInputAnswersSummary(answers: WatchUserInputAnswers): string;
242
+ export declare function parseWatchGrantCoverageDecision(text: string): WatchGrantCoverageDecision | null;
243
+ export declare function computeWatchSecretaryReactionWindowMs(confidence: number | undefined, fallback?: number): number;
189
244
  export declare function getWatchAuthLoginCommand(backend: WatchBackend): string | null;
190
245
  export declare function formatWatchBackendAuthMessage(backend: WatchBackend, detail?: string): string;
191
246
  export declare function looksLikeWatchAuthFailureText(text: string): boolean;