jg-agent-hq 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +7 -4
  3. package/api/README.md +35 -17
  4. package/dist/actions/live/live.d.ts +4 -1
  5. package/dist/actions/live/live.js +22 -6
  6. package/dist/actions/reads.d.ts +1 -1
  7. package/dist/actions/reads.js +4 -2
  8. package/dist/contracts/actions/types.d.ts +6 -6
  9. package/dist/contracts/actions/types.js +1 -1
  10. package/dist/contracts/browser/index.d.ts +4 -0
  11. package/dist/contracts/browser/index.js +6 -0
  12. package/dist/contracts/browser/types.d.ts +2475 -0
  13. package/dist/contracts/browser/types.js +109 -0
  14. package/dist/contracts/handoffs/types.d.ts +5 -5
  15. package/dist/contracts/index.d.ts +4 -0
  16. package/dist/contracts/index.js +6 -0
  17. package/dist/contracts/plans/types.d.ts +25 -25
  18. package/dist/contracts/plans/types.js +9 -10
  19. package/dist/contracts/types.d.ts +96 -30
  20. package/dist/contracts/types.js +10 -2
  21. package/dist/handoffs/types.d.ts +6 -6
  22. package/dist/plans/admission.d.ts +2 -2
  23. package/dist/plans/admission.js +24 -16
  24. package/dist/plans/authority.d.ts +6 -0
  25. package/dist/plans/authority.js +39 -8
  26. package/dist/plans/finalization.d.ts +1 -1
  27. package/dist/plans/finalization.js +4 -3
  28. package/dist/plans/plans.d.ts +3 -3
  29. package/dist/plans/plans.js +9 -11
  30. package/dist/plans/reconciliation.js +3 -3
  31. package/dist/plans/revisions.d.ts +2 -2
  32. package/dist/plans/revisions.js +21 -3
  33. package/dist/plans/types.d.ts +4 -4
  34. package/dist/providers/claude/control/control.d.ts +1 -1
  35. package/dist/providers/claude/history/types.d.ts +39 -11
  36. package/dist/runtime/browser/browser.d.ts +8 -0
  37. package/dist/runtime/browser/browser.js +55 -0
  38. package/dist/runtime/browser/index.d.ts +1 -0
  39. package/dist/runtime/browser/index.js +2 -0
  40. package/dist/runtime/runtime.js +12 -1
  41. package/dist/runtime/types.d.ts +19 -1
  42. package/dist/store/browser/browser.model.d.ts +24 -0
  43. package/dist/store/browser/browser.model.js +75 -0
  44. package/dist/store/browser/index.d.ts +1 -0
  45. package/dist/store/browser/index.js +2 -0
  46. package/dist/store/control/types.d.ts +6 -6
  47. package/dist/store/plans/plans.model.d.ts +2 -2
  48. package/dist/store/plans/plans.model.js +1 -1
  49. package/dist/store/schema.sql +15 -2
  50. package/dist/store/store.js +4 -1
  51. package/dist/store/store.worker.js +11 -0
  52. package/dist/store/types.d.ts +1545 -510
  53. package/dist/store/types.js +17 -1
  54. package/errors/README.md +11 -1
  55. package/package.json +1 -1
@@ -0,0 +1,109 @@
1
+ import { z } from 'zod';
2
+ import { ActionEnvelopeSchema, ActionReceiptSchema, ActionSummarySchema, ActionPlanContextSchema, ManagedThreadSchema, NativeApprovalSchema, } from '../actions/index.js';
3
+ import { RuntimeStatusSchema, LiveItemsSchema } from '../types.js';
4
+ import { HandoffCommandSchema } from '../handoffs/index.js';
5
+ import { PlanCommandSchema, PlanStatusSchema, PlanResultSchema, PlanMetadataSchema, PlanRevisionSchema, PlanTargetSchema, } from '../plans/index.js';
6
+ // the browser surface is closed; hosts resolve every supplied identity against their registry
7
+ export const BrowserCommandSchema = z.discriminatedUnion('kind', [
8
+ z.strictObject({ kind: z.literal('native'), action: ActionEnvelopeSchema }),
9
+ z.strictObject({ kind: z.literal('plan'), command: PlanCommandSchema }),
10
+ z.strictObject({ kind: z.literal('handoff'), command: HandoffCommandSchema }),
11
+ z.strictObject({
12
+ kind: z.literal('priority'),
13
+ target: PlanTargetSchema,
14
+ expectedRevision: PlanRevisionSchema,
15
+ priority: z.enum(['P0', 'P1', 'P2', 'P3']),
16
+ reason: z.string().min(1).max(4096),
17
+ }),
18
+ z.strictObject({
19
+ kind: z.literal('error-reservation'),
20
+ target: PlanTargetSchema,
21
+ expectedRevision: PlanRevisionSchema,
22
+ reservation: PlanMetadataSchema.shape.errorReservations.element,
23
+ release: z.boolean(),
24
+ }),
25
+ z.strictObject({
26
+ kind: z.literal('publication-retry'),
27
+ expectedCommit: z.string().regex(/^[a-f0-9]{40}(?:[a-f0-9]{24})?$/),
28
+ }),
29
+ ]);
30
+ export const BrowserActionSchema = z
31
+ .strictObject({
32
+ id: z.uuid(),
33
+ runtimeEpoch: z.uuid(),
34
+ command: BrowserCommandSchema,
35
+ })
36
+ .refine((request) => new TextEncoder().encode(JSON.stringify(request)).byteLength <= 2_097_152);
37
+ // admission and host completion do not imply native turn completion
38
+ export const BrowserReceiptSchema = z.object({
39
+ id: z.uuid(),
40
+ runtimeEpoch: z.uuid(),
41
+ kind: z.enum(BrowserCommandSchema.options.map((command) => command.shape.kind.value)),
42
+ state: z.enum(['submitted', 'acknowledged', 'uncertain']),
43
+ nativeActionId: z.uuid(),
44
+ createdAt: z.number().int(),
45
+ updatedAt: z.number().int(),
46
+ native: ActionReceiptSchema.nullable(),
47
+ });
48
+ // read models contain generic registration metadata, never deployment configuration
49
+ export const BrowserRepositorySchema = z.object({
50
+ name: z.string().max(128),
51
+ root: z.string().max(4096).nullable(),
52
+ purpose: z.string().max(4096),
53
+ worktrees: z.boolean(),
54
+ });
55
+ export const BrowserPlanSummarySchema = z.object({
56
+ id: z.string().max(128),
57
+ directory: z.string().max(4096),
58
+ scope: z.string().max(128),
59
+ status: z.enum(['planned', 'in-progress', 'done', 'abandoned']),
60
+ summary: z.string().max(4096),
61
+ priority: z.enum(['P0', 'P1', 'P2', 'P3']),
62
+ priorityReason: z.string().max(4096),
63
+ repositories: PlanMetadataSchema.shape.repositories,
64
+ errorReservations: PlanMetadataSchema.shape.errorReservations,
65
+ });
66
+ export const BrowserPlanPageSchema = z.object({
67
+ data: z.array(BrowserPlanSummarySchema).max(128),
68
+ nextCursor: z.string().nullable(),
69
+ revision: z.string().regex(/^[a-f0-9]{64}$/),
70
+ });
71
+ export const BrowserPlanDetailSchema = z.object({
72
+ summary: BrowserPlanSummarySchema,
73
+ contract: z.string().max(1_048_576),
74
+ status: PlanStatusSchema,
75
+ presentation: z.string().max(1_048_576).nullable(),
76
+ page: PlanResultSchema.nullable(),
77
+ });
78
+ export const BrowserSessionSchema = z.object({
79
+ operator: z.object({ id: z.string().max(256) }),
80
+ runtimeEpoch: z.uuid(),
81
+ capabilities: z.object({
82
+ native: z.boolean(),
83
+ plans: z.boolean(),
84
+ handoffs: z.boolean(),
85
+ priorities: z.boolean(),
86
+ errorReservations: z.boolean(),
87
+ publicationRetry: z.boolean(),
88
+ }),
89
+ });
90
+ export const BrowserRepositoryPageSchema = z.object({
91
+ data: z.array(BrowserRepositorySchema).max(128),
92
+ nextCursor: z.string().nullable(),
93
+ });
94
+ export const BrowserSystemSchema = z.object({
95
+ runtime: RuntimeStatusSchema,
96
+ publication: z.object({ state: z.literal('unavailable') }),
97
+ resources: z.object({ state: z.literal('unavailable') }),
98
+ service: z.object({ state: z.literal('unavailable') }),
99
+ });
100
+ export const BrowserThreadDetailSchema = z.object({
101
+ thread: ManagedThreadSchema,
102
+ plan: ActionPlanContextSchema.nullable(),
103
+ approvals: z.array(NativeApprovalSchema).max(128),
104
+ live: LiveItemsSchema,
105
+ actions: z.object({
106
+ data: z.array(ActionSummarySchema).max(128),
107
+ nextCursor: z.string().nullable(),
108
+ }),
109
+ });
@@ -12,7 +12,7 @@ export declare const HandoffSourceSchema: z.ZodObject<{
12
12
  scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
13
13
  kind: z.ZodLiteral<"execution">;
14
14
  authorizationId: z.ZodUUID;
15
- milestoneId: z.ZodUUID;
15
+ milestoneId: z.ZodNullable<z.ZodUUID>;
16
16
  mode: z.ZodEnum<{
17
17
  supervised: "supervised";
18
18
  auto: "auto";
@@ -126,7 +126,7 @@ export declare const HandoffSummarySchema: z.ZodObject<{
126
126
  scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
127
127
  kind: z.ZodLiteral<"execution">;
128
128
  authorizationId: z.ZodUUID;
129
- milestoneId: z.ZodUUID;
129
+ milestoneId: z.ZodNullable<z.ZodUUID>;
130
130
  mode: z.ZodEnum<{
131
131
  supervised: "supervised";
132
132
  auto: "auto";
@@ -229,7 +229,7 @@ export declare const HandoffSchema: z.ZodObject<{
229
229
  scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
230
230
  kind: z.ZodLiteral<"execution">;
231
231
  authorizationId: z.ZodUUID;
232
- milestoneId: z.ZodUUID;
232
+ milestoneId: z.ZodNullable<z.ZodUUID>;
233
233
  mode: z.ZodEnum<{
234
234
  supervised: "supervised";
235
235
  auto: "auto";
@@ -363,7 +363,7 @@ export declare const HandoffResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
363
363
  scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
364
364
  kind: z.ZodLiteral<"execution">;
365
365
  authorizationId: z.ZodUUID;
366
- milestoneId: z.ZodUUID;
366
+ milestoneId: z.ZodNullable<z.ZodUUID>;
367
367
  mode: z.ZodEnum<{
368
368
  supervised: "supervised";
369
369
  auto: "auto";
@@ -496,7 +496,7 @@ export declare const HandoffResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
496
496
  scope: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
497
497
  kind: z.ZodLiteral<"execution">;
498
498
  authorizationId: z.ZodUUID;
499
- milestoneId: z.ZodUUID;
499
+ milestoneId: z.ZodNullable<z.ZodUUID>;
500
500
  mode: z.ZodEnum<{
501
501
  supervised: "supervised";
502
502
  auto: "auto";
@@ -17,3 +17,7 @@ export { PlanActionScopeSchema, ActionPlanContextSchema } from './actions/index.
17
17
  export type { IPlanActionScope, IActionPlanContext } from './actions/index.js';
18
18
  export { HandoffSourceSchema, HandoffFindingsSchema, HandoffPhaseSchema, HandoffCommandSchema, HandoffDeliverySchema, HandoffSummarySchema, HandoffSchema, HandoffPreviewSchema, HandoffResultSchema, } from './handoffs/index.js';
19
19
  export type { IHandoffCommand, IHandoffPhase, IHandoffSource, IHandoffFindings, IHandoff, IHandoffSummary, IHandoffPreview, IHandoffResult, } from './handoffs/index.js';
20
+ export { BrowserCommandSchema, BrowserActionSchema, BrowserReceiptSchema, } from './browser/index.js';
21
+ export type { IBrowserAction, IBrowserReceipt } from './browser/index.js';
22
+ export { BrowserRepositorySchema, BrowserPlanSummarySchema, BrowserPlanPageSchema, BrowserPlanDetailSchema, BrowserSessionSchema, } from './browser/index.js';
23
+ export { BrowserRepositoryPageSchema, BrowserSystemSchema, BrowserThreadDetailSchema, } from './browser/index.js';
@@ -18,3 +18,9 @@ export { PlanCorrespondenceSummarySchema, PlanReconciliationEntrySchema } from '
18
18
  export { PlanActionScopeSchema, ActionPlanContextSchema } from './actions/index.js';
19
19
  // explicit cross-provider handoffs
20
20
  export { HandoffSourceSchema, HandoffFindingsSchema, HandoffPhaseSchema, HandoffCommandSchema, HandoffDeliverySchema, HandoffSummarySchema, HandoffSchema, HandoffPreviewSchema, HandoffResultSchema, } from './handoffs/index.js';
21
+ // authenticated host actions
22
+ export { BrowserCommandSchema, BrowserActionSchema, BrowserReceiptSchema, } from './browser/index.js';
23
+ // host read models
24
+ export { BrowserRepositorySchema, BrowserPlanSummarySchema, BrowserPlanPageSchema, BrowserPlanDetailSchema, BrowserSessionSchema, } from './browser/index.js';
25
+ // bounded host views
26
+ export { BrowserRepositoryPageSchema, BrowserSystemSchema, BrowserThreadDetailSchema, } from './browser/index.js';
@@ -81,7 +81,7 @@ export declare const PlanCompletionSchema: z.ZodObject<{
81
81
  reference: z.ZodString;
82
82
  }, z.core.$strict>;
83
83
  }, z.core.$strict>;
84
- milestoneId: z.ZodUUID;
84
+ milestoneId: z.ZodNullable<z.ZodUUID>;
85
85
  revision: z.ZodObject<{
86
86
  planDigest: z.ZodString;
87
87
  breakdownDigest: z.ZodNullable<z.ZodString>;
@@ -89,7 +89,7 @@ export declare const PlanCompletionSchema: z.ZodObject<{
89
89
  contractDigest: z.ZodString;
90
90
  title: z.ZodString;
91
91
  contract: z.ZodString;
92
- sharedDigest: z.ZodString;
92
+ sharedDigest: z.ZodNullable<z.ZodString>;
93
93
  checkouts: z.ZodArray<z.ZodObject<{
94
94
  repository: z.ZodString;
95
95
  directory: z.ZodString;
@@ -128,7 +128,7 @@ export declare const PlanCheckpointSchema: z.ZodObject<{
128
128
  breakdownDigest: z.ZodNullable<z.ZodString>;
129
129
  }, z.core.$strict>;
130
130
  plan: z.ZodString;
131
- milestones: z.ZodString;
131
+ milestones: z.ZodNullable<z.ZodString>;
132
132
  entries: z.ZodArray<z.ZodObject<{
133
133
  ordinal: z.ZodNumber;
134
134
  title: z.ZodString;
@@ -192,7 +192,7 @@ export declare const PlanProposalSchema: z.ZodObject<{
192
192
  planDigest: z.ZodString;
193
193
  breakdownDigest: z.ZodNullable<z.ZodString>;
194
194
  }, z.core.$strict>;
195
- inspectionHash: z.ZodString;
195
+ inspectionHash: z.ZodNullable<z.ZodString>;
196
196
  drafts: z.ZodArray<z.ZodObject<{
197
197
  ordinal: z.ZodNumber;
198
198
  title: z.ZodString;
@@ -285,7 +285,7 @@ export declare const PlanRevisionWorkflowSchema: z.ZodObject<{
285
285
  breakdownDigest: z.ZodNullable<z.ZodString>;
286
286
  }, z.core.$strict>;
287
287
  plan: z.ZodString;
288
- milestones: z.ZodString;
288
+ milestones: z.ZodNullable<z.ZodString>;
289
289
  entries: z.ZodArray<z.ZodObject<{
290
290
  ordinal: z.ZodNumber;
291
291
  title: z.ZodString;
@@ -335,7 +335,7 @@ export declare const PlanRevisionWorkflowSchema: z.ZodObject<{
335
335
  planDigest: z.ZodString;
336
336
  breakdownDigest: z.ZodNullable<z.ZodString>;
337
337
  }, z.core.$strict>;
338
- inspectionHash: z.ZodString;
338
+ inspectionHash: z.ZodNullable<z.ZodString>;
339
339
  drafts: z.ZodArray<z.ZodObject<{
340
340
  ordinal: z.ZodNumber;
341
341
  title: z.ZodString;
@@ -482,7 +482,7 @@ export declare const PlanCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
482
482
  }, z.core.$strict>;
483
483
  kind: z.ZodLiteral<"finalize">;
484
484
  }, z.core.$strict>, z.ZodObject<{
485
- milestoneId: z.ZodUUID;
485
+ milestoneId: z.ZodNullable<z.ZodUUID>;
486
486
  checks: z.ZodArray<z.ZodObject<{
487
487
  command: z.ZodString;
488
488
  outcome: z.ZodLiteral<"passed">;
@@ -668,7 +668,7 @@ export declare const PlanCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
668
668
  breakdownDigest: z.ZodNullable<z.ZodString>;
669
669
  }, z.core.$strict>;
670
670
  authorizationId: z.ZodUUID;
671
- milestoneId: z.ZodUUID;
671
+ milestoneId: z.ZodNullable<z.ZodUUID>;
672
672
  mode: z.ZodEnum<{
673
673
  supervised: "supervised";
674
674
  auto: "auto";
@@ -757,7 +757,7 @@ export declare const PlanFinalizationSchema: z.ZodObject<{
757
757
  planDigest: z.ZodString;
758
758
  breakdownDigest: z.ZodNullable<z.ZodString>;
759
759
  }, z.core.$strict>;
760
- fileHash: z.ZodString;
760
+ fileHash: z.ZodNullable<z.ZodString>;
761
761
  createdAt: z.ZodNumber;
762
762
  }, z.core.$strict>;
763
763
  export declare const PlanComparisonSchema: z.ZodObject<{
@@ -831,7 +831,7 @@ export declare const PlanCoordinationSchema: z.ZodObject<{
831
831
  planDigest: z.ZodString;
832
832
  breakdownDigest: z.ZodNullable<z.ZodString>;
833
833
  }, z.core.$strict>;
834
- fileHash: z.ZodString;
834
+ fileHash: z.ZodNullable<z.ZodString>;
835
835
  createdAt: z.ZodNumber;
836
836
  }, z.core.$strict>>;
837
837
  planApproval: z.ZodNullable<z.ZodObject<{
@@ -943,7 +943,7 @@ export declare const PlanCoordinationSchema: z.ZodObject<{
943
943
  reference: z.ZodString;
944
944
  }, z.core.$strict>;
945
945
  }, z.core.$strict>;
946
- milestoneId: z.ZodUUID;
946
+ milestoneId: z.ZodNullable<z.ZodUUID>;
947
947
  revision: z.ZodObject<{
948
948
  planDigest: z.ZodString;
949
949
  breakdownDigest: z.ZodNullable<z.ZodString>;
@@ -951,7 +951,7 @@ export declare const PlanCoordinationSchema: z.ZodObject<{
951
951
  contractDigest: z.ZodString;
952
952
  title: z.ZodString;
953
953
  contract: z.ZodString;
954
- sharedDigest: z.ZodString;
954
+ sharedDigest: z.ZodNullable<z.ZodString>;
955
955
  checkouts: z.ZodArray<z.ZodObject<{
956
956
  repository: z.ZodString;
957
957
  directory: z.ZodString;
@@ -1065,7 +1065,7 @@ export declare const PlanCoordinationSchema: z.ZodObject<{
1065
1065
  breakdownDigest: z.ZodNullable<z.ZodString>;
1066
1066
  }, z.core.$strict>;
1067
1067
  plan: z.ZodString;
1068
- milestones: z.ZodString;
1068
+ milestones: z.ZodNullable<z.ZodString>;
1069
1069
  entries: z.ZodArray<z.ZodObject<{
1070
1070
  ordinal: z.ZodNumber;
1071
1071
  title: z.ZodString;
@@ -1115,7 +1115,7 @@ export declare const PlanCoordinationSchema: z.ZodObject<{
1115
1115
  planDigest: z.ZodString;
1116
1116
  breakdownDigest: z.ZodNullable<z.ZodString>;
1117
1117
  }, z.core.$strict>;
1118
- inspectionHash: z.ZodString;
1118
+ inspectionHash: z.ZodNullable<z.ZodString>;
1119
1119
  drafts: z.ZodArray<z.ZodObject<{
1120
1120
  ordinal: z.ZodNumber;
1121
1121
  title: z.ZodString;
@@ -1168,7 +1168,7 @@ export declare const PlanCoordinationSchema: z.ZodObject<{
1168
1168
  breakdownDigest: z.ZodNullable<z.ZodString>;
1169
1169
  }, z.core.$strict>;
1170
1170
  plan: z.ZodString;
1171
- milestones: z.ZodString;
1171
+ milestones: z.ZodNullable<z.ZodString>;
1172
1172
  entries: z.ZodArray<z.ZodObject<{
1173
1173
  ordinal: z.ZodNumber;
1174
1174
  title: z.ZodString;
@@ -1269,7 +1269,7 @@ export declare const PlanCoordinationSummarySchema: z.ZodObject<{
1269
1269
  planDigest: z.ZodString;
1270
1270
  breakdownDigest: z.ZodNullable<z.ZodString>;
1271
1271
  }, z.core.$strict>;
1272
- fileHash: z.ZodString;
1272
+ fileHash: z.ZodNullable<z.ZodString>;
1273
1273
  createdAt: z.ZodNumber;
1274
1274
  }, z.core.$strict>>;
1275
1275
  planApproval: z.ZodNullable<z.ZodObject<{
@@ -1486,7 +1486,7 @@ export declare const PlanStatusSchema: z.ZodObject<{
1486
1486
  planDigest: z.ZodString;
1487
1487
  breakdownDigest: z.ZodNullable<z.ZodString>;
1488
1488
  }, z.core.$strict>;
1489
- fileHash: z.ZodString;
1489
+ fileHash: z.ZodNullable<z.ZodString>;
1490
1490
  createdAt: z.ZodNumber;
1491
1491
  }, z.core.$strict>>;
1492
1492
  planApproval: z.ZodNullable<z.ZodObject<{
@@ -1716,7 +1716,7 @@ export declare const PlanReconciliationEntrySchema: z.ZodDiscriminatedUnion<[z.Z
1716
1716
  reference: z.ZodString;
1717
1717
  }, z.core.$strict>;
1718
1718
  }, z.core.$strict>;
1719
- milestoneId: z.ZodUUID;
1719
+ milestoneId: z.ZodNullable<z.ZodUUID>;
1720
1720
  revision: z.ZodObject<{
1721
1721
  planDigest: z.ZodString;
1722
1722
  breakdownDigest: z.ZodNullable<z.ZodString>;
@@ -1724,7 +1724,7 @@ export declare const PlanReconciliationEntrySchema: z.ZodDiscriminatedUnion<[z.Z
1724
1724
  contractDigest: z.ZodString;
1725
1725
  title: z.ZodString;
1726
1726
  contract: z.ZodString;
1727
- sharedDigest: z.ZodString;
1727
+ sharedDigest: z.ZodNullable<z.ZodString>;
1728
1728
  checkouts: z.ZodArray<z.ZodObject<{
1729
1729
  repository: z.ZodString;
1730
1730
  directory: z.ZodString;
@@ -1871,7 +1871,7 @@ export declare const PlanResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1871
1871
  planDigest: z.ZodString;
1872
1872
  breakdownDigest: z.ZodNullable<z.ZodString>;
1873
1873
  }, z.core.$strict>;
1874
- fileHash: z.ZodString;
1874
+ fileHash: z.ZodNullable<z.ZodString>;
1875
1875
  createdAt: z.ZodNumber;
1876
1876
  }, z.core.$strict>>;
1877
1877
  planApproval: z.ZodNullable<z.ZodObject<{
@@ -2091,7 +2091,7 @@ export declare const PlanResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2091
2091
  planDigest: z.ZodString;
2092
2092
  breakdownDigest: z.ZodNullable<z.ZodString>;
2093
2093
  }, z.core.$strict>;
2094
- fileHash: z.ZodString;
2094
+ fileHash: z.ZodNullable<z.ZodString>;
2095
2095
  createdAt: z.ZodNumber;
2096
2096
  }, z.core.$strict>>;
2097
2097
  planApproval: z.ZodNullable<z.ZodObject<{
@@ -2279,7 +2279,7 @@ export declare const PlanResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2279
2279
  reference: z.ZodString;
2280
2280
  }, z.core.$strict>;
2281
2281
  }, z.core.$strict>;
2282
- milestoneId: z.ZodUUID;
2282
+ milestoneId: z.ZodNullable<z.ZodUUID>;
2283
2283
  revision: z.ZodObject<{
2284
2284
  planDigest: z.ZodString;
2285
2285
  breakdownDigest: z.ZodNullable<z.ZodString>;
@@ -2287,7 +2287,7 @@ export declare const PlanResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2287
2287
  contractDigest: z.ZodString;
2288
2288
  title: z.ZodString;
2289
2289
  contract: z.ZodString;
2290
- sharedDigest: z.ZodString;
2290
+ sharedDigest: z.ZodNullable<z.ZodString>;
2291
2291
  checkouts: z.ZodArray<z.ZodObject<{
2292
2292
  repository: z.ZodString;
2293
2293
  directory: z.ZodString;
@@ -2435,7 +2435,7 @@ export declare const PlanResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2435
2435
  planDigest: z.ZodString;
2436
2436
  breakdownDigest: z.ZodNullable<z.ZodString>;
2437
2437
  }, z.core.$strict>;
2438
- fileHash: z.ZodString;
2438
+ fileHash: z.ZodNullable<z.ZodString>;
2439
2439
  createdAt: z.ZodNumber;
2440
2440
  }, z.core.$strict>>;
2441
2441
  planApproval: z.ZodNullable<z.ZodObject<{
@@ -2574,7 +2574,7 @@ export declare const PlanResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2574
2574
  }, z.core.$strict>>;
2575
2575
  }, z.core.$strict>;
2576
2576
  }, z.core.$strip>;
2577
- content: z.ZodString;
2577
+ content: z.ZodNullable<z.ZodString>;
2578
2578
  }, z.core.$strip>, z.ZodObject<{
2579
2579
  kind: z.ZodLiteral<"milestones">;
2580
2580
  result: z.ZodObject<{
@@ -64,12 +64,12 @@ export const PlanWorktreeProofSchema = PlanCheckoutSchema.extend({
64
64
  export const PlanCompletionSchema = z.strictObject({
65
65
  id: z.uuid(),
66
66
  action: PlanOperatorActionSchema,
67
- milestoneId: z.uuid(),
67
+ milestoneId: z.uuid().nullable(),
68
68
  revision: PlanRevisionSchema,
69
69
  contractDigest: PlanDigestSchema,
70
70
  title: z.string().min(1).max(4096),
71
71
  contract: z.string().max(1_048_576),
72
- sharedDigest: PlanDigestSchema,
72
+ sharedDigest: PlanDigestSchema.nullable(),
73
73
  checkouts: z.array(PlanWorktreeProofSchema).max(128),
74
74
  checks: z.array(PlanCheckSchema).min(1).max(32),
75
75
  completedAt: z.number().int(),
@@ -84,7 +84,7 @@ export const PlanSnapshotMilestoneSchema = PlanMilestoneSchema.extend({
84
84
  export const PlanCheckpointSchema = z.strictObject({
85
85
  revision: PlanRevisionSchema,
86
86
  plan: z.string().max(1_048_576),
87
- milestones: z.string().max(1_048_576),
87
+ milestones: z.string().max(1_048_576).nullable(),
88
88
  entries: z.array(PlanSnapshotMilestoneSchema).max(1024),
89
89
  checkouts: z.array(PlanWorktreeProofSchema).max(128),
90
90
  threadIds: z.array(z.uuid()).max(32),
@@ -111,7 +111,7 @@ export const PlanDraftMilestoneSchema = PlanSnapshotMilestoneSchema.extend({
111
111
  export const PlanProposalSchema = z.strictObject({
112
112
  id: z.uuid(),
113
113
  revision: PlanRevisionSchema,
114
- inspectionHash: PlanDigestSchema,
114
+ inspectionHash: PlanDigestSchema.nullable(),
115
115
  drafts: z.array(PlanDraftMilestoneSchema).max(1024),
116
116
  unmatchedSourceIds: z.array(z.uuid()).max(1024),
117
117
  confirmation: z
@@ -193,7 +193,7 @@ export const PlanCommandSchema = z.discriminatedUnion('kind', [
193
193
  z.strictObject({
194
194
  kind: z.literal('complete'),
195
195
  ...MutationFields,
196
- milestoneId: z.uuid(),
196
+ milestoneId: z.uuid().nullable(),
197
197
  checks: z.array(PlanCheckSchema).min(1).max(32),
198
198
  checkouts: z.array(PlanCheckoutSchema).max(128),
199
199
  }),
@@ -234,7 +234,6 @@ export const PlanCommandSchema = z.discriminatedUnion('kind', [
234
234
  mode: z.enum(['supervised', 'auto']),
235
235
  milestoneIds: z
236
236
  .array(z.uuid())
237
- .min(1)
238
237
  .max(1024)
239
238
  .refine((ids) => new Set(ids).size === ids.length),
240
239
  }),
@@ -243,7 +242,7 @@ export const PlanCommandSchema = z.discriminatedUnion('kind', [
243
242
  target: PlanTargetSchema,
244
243
  expected: PlanRevisionSchema,
245
244
  authorizationId: z.uuid(),
246
- milestoneId: z.uuid(),
245
+ milestoneId: z.uuid().nullable(),
247
246
  mode: z.enum(['supervised', 'auto']),
248
247
  }),
249
248
  ]);
@@ -259,7 +258,7 @@ export const PlanExecutionSchema = z.strictObject({
259
258
  action: PlanOperatorActionSchema,
260
259
  revision: PlanRevisionSchema,
261
260
  mode: z.enum(['supervised', 'auto']),
262
- milestoneIds: z.array(z.uuid()).min(1).max(1024),
261
+ milestoneIds: z.array(z.uuid()).max(1024),
263
262
  createdAt: z.number().int(),
264
263
  revokedBy: PlanOperatorActionSchema.nullable(),
265
264
  });
@@ -267,7 +266,7 @@ export const PlanExecutionSchema = z.strictObject({
267
266
  export const PlanFinalizationSchema = z.strictObject({
268
267
  action: PlanOperatorActionSchema,
269
268
  revision: PlanRevisionSchema,
270
- fileHash: PlanDigestSchema,
269
+ fileHash: PlanDigestSchema.nullable(),
271
270
  createdAt: z.number().int(),
272
271
  });
273
272
  // coordinators own semantic review; the core preserves its exact revision-bound evidence
@@ -385,7 +384,7 @@ export const PlanResultSchema = z.discriminatedUnion('kind', [
385
384
  z.object({
386
385
  kind: z.literal('finalized'),
387
386
  result: PlanStatusSchema,
388
- content: z.string().max(1_048_576),
387
+ content: z.string().max(1_048_576).nullable(),
389
388
  }),
390
389
  z.object({
391
390
  kind: z.literal('milestones'),