@hearsay-tools/squawk 0.18.0-dev.8027 → 0.18.0-dev.8033

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 (119) hide show
  1. package/dist/activity/wait.js +5 -0
  2. package/dist/activity/wait.js.map +1 -1
  3. package/dist/built-in-run-slots.d.ts +3 -1
  4. package/dist/built-in-run-slots.js +6 -2
  5. package/dist/built-in-run-slots.js.map +1 -1
  6. package/dist/ci-wait/controller.d.ts +74 -2
  7. package/dist/ci-wait/tool-catalog.js +3 -3
  8. package/dist/ci-wait/tool-catalog.js.map +1 -1
  9. package/dist/ci-wait/tools.d.ts +62 -2
  10. package/dist/contract/activity.d.ts +64 -0
  11. package/dist/contract/index.js +52 -6
  12. package/dist/contract/runs.d.ts +240 -0
  13. package/dist/contract/wait-tools.d.ts +231 -10
  14. package/dist/contract/waits.d.ts +87 -0
  15. package/dist/contract/workspace-events.d.ts +12 -0
  16. package/dist/core/registry.d.ts +36 -0
  17. package/dist/core/registry.js +85 -0
  18. package/dist/core/registry.js.map +1 -0
  19. package/dist/runs/removal-slots.js +27 -20
  20. package/dist/runs/removal-slots.js.map +1 -1
  21. package/dist/runs/run-archive.d.ts +48 -0
  22. package/dist/runs/run-decode.d.ts +120 -0
  23. package/dist/runs/run-exits.d.ts +224 -0
  24. package/dist/runs/worker-executions-registry.d.ts +5 -3
  25. package/dist/runs/worker-executions-registry.js +13 -15
  26. package/dist/runs/worker-executions-registry.js.map +1 -1
  27. package/dist/server/activity-routes.d.ts +39 -23
  28. package/dist/server/provider-sign-in-routes.d.ts +2 -2
  29. package/dist/server/reports-api.d.ts +2 -2
  30. package/dist/server/runners-routes.d.ts +10 -10
  31. package/dist/server/server.d.ts +2644 -1512
  32. package/dist/subcommands.js +2 -1
  33. package/dist/subcommands.js.map +1 -1
  34. package/dist/workflows/continuation-admission.d.ts +48 -0
  35. package/dist/workflows/input-acknowledgement.d.ts +16 -0
  36. package/dist/workflows/run/wait-engine.d.ts +48 -0
  37. package/dist/workflows/run/wait-engine.js +4 -0
  38. package/dist/workflows/run/wait-engine.js.map +1 -1
  39. package/dist/workflows/run/wait-kinds.d.ts +6 -3
  40. package/dist/workflows/run/wait-kinds.js +24 -2
  41. package/dist/workflows/run/wait-kinds.js.map +1 -1
  42. package/dist/workflows/run/wait-registration.js +4 -3
  43. package/dist/workflows/run/wait-registration.js.map +1 -1
  44. package/dist/workflows/run/wait-registry.js +2 -2
  45. package/dist/workflows/run/wait-registry.js.map +1 -1
  46. package/dist/workflows/run-states.d.ts +1 -1
  47. package/dist/workflows/run-states.js +3 -2
  48. package/dist/workflows/run-states.js.map +1 -1
  49. package/dist/workflows/waits.js +5 -3
  50. package/dist/workflows/waits.js.map +1 -1
  51. package/package.json +4 -4
  52. package/scripts/benchmark-family-reconcile.ts +2 -1
  53. package/scripts/benchmark-run-store.ts +2 -1
  54. package/scripts/benchmark-stuck-destroys.ts +2 -1
  55. package/scripts/benchmark-worker-lifecycle.ts +2 -1
  56. package/scripts/benchmark-workspace-events.ts +2 -1
  57. package/scripts/benchmark-worktree-retention.ts +2 -1
  58. package/scripts/measure-transcript-facts-health.mjs +2 -1
  59. package/web/dist/assets/{accounts-section-Lxa13E8O.js → accounts-section-B-zlsH7k.js} +1 -1
  60. package/web/dist/assets/activity-motion-psm6jyeg.js +2 -0
  61. package/web/dist/assets/{activity-route-Bo-Cyzsz.js → activity-route-DeK0riM9.js} +1 -1
  62. package/web/dist/assets/{agent-config-section-BE239EYo.js → agent-config-section-BvmWn_h-.js} +1 -1
  63. package/web/dist/assets/{agent-defaults-section-Bj5dO6F3.js → agent-defaults-section-DsuYOQpY.js} +1 -1
  64. package/web/dist/assets/{appearance-C2v7z5MF.js → appearance-DNMXL1v0.js} +1 -1
  65. package/web/dist/assets/{archive-on-merge-field-Ta3WlY1p.js → archive-on-merge-field-BovFB0t7.js} +1 -1
  66. package/web/dist/assets/attention-DaLkUl4h.js +1 -0
  67. package/web/dist/assets/{automations-route-DPpaFR0Q.js → automations-route-DyiKOd25.js} +1 -1
  68. package/web/dist/assets/{commit-diff-panel-CzY8bO3p.js → commit-diff-panel-DawdFJ6E.js} +1 -1
  69. package/web/dist/assets/{diff-3jSM3IH7.js → diff-CfoXwmnl.js} +2 -2
  70. package/web/dist/assets/{diff-view-C3cwyYRv.js → diff-view-5xkdG47g.js} +1 -1
  71. package/web/dist/assets/{file-preview-B71T62DU.js → file-preview-DIVTxup4.js} +1 -1
  72. package/web/dist/assets/{folder-browser-BTYMFLBY.js → folder-browser-BzVWaANT.js} +1 -1
  73. package/web/dist/assets/{git-toolbar-Dng31AhK.js → git-toolbar-BUViNmxj.js} +1 -1
  74. package/web/dist/assets/{github-Cft2RNHM.js → github-COe1nsmn.js} +1 -1
  75. package/web/dist/assets/{global-activity-route-CngRjBlD.js → global-activity-route-B-cJo1pg.js} +1 -1
  76. package/web/dist/assets/{index-MG3T7zFQ.js → index-BZiixXpY.js} +5 -5
  77. package/web/dist/assets/{label-C9IGG0mW.js → label-DVUPtyTI.js} +1 -1
  78. package/web/dist/assets/{markdown-BDWm6oGX.js → markdown-bvY77s5D.js} +1 -1
  79. package/web/dist/assets/{notifications-section-BxIKJ1NF.js → notifications-section-Cet1mmEc.js} +1 -1
  80. package/web/dist/assets/{open-in-menu-LbTu2sP4.js → open-in-menu-BpSp2CJF.js} +1 -1
  81. package/web/dist/assets/{preview-pane-connected-CGQngtTw.js → preview-pane-connected-BCrpsIIn.js} +1 -1
  82. package/web/dist/assets/{project-location-B-18C392.js → project-location-ClZPnbBZ.js} +1 -1
  83. package/web/dist/assets/{project-router-DImKA81z.js → project-router-BYrAO9Ws.js} +1 -1
  84. package/web/dist/assets/{project-scope-context-D3_4Nfjk.js → project-scope-context-BDU1qGx3.js} +2 -2
  85. package/web/dist/assets/{projects-section-DQ1LxJ3A.js → projects-section-CdUdrEPd.js} +1 -1
  86. package/web/dist/assets/{prompt-templates-section-C5AYB6Ig.js → prompt-templates-section-D3ojaPZw.js} +1 -1
  87. package/web/dist/assets/{queries-BaHOUYn4.js → queries--x5yVcip.js} +1 -1
  88. package/web/dist/assets/{reference-chip-CdOqXRll.js → reference-chip-013dL8dQ.js} +1 -1
  89. package/web/dist/assets/{remote-settings-notice-BTdflMqO.js → remote-settings-notice-BbBWWAm8.js} +1 -1
  90. package/web/dist/assets/{repo-git-DChiMWrS.js → repo-git-1hSBzyJQ.js} +1 -1
  91. package/web/dist/assets/{report-reader-nV2G6iRk.js → report-reader-BNtgxtSI.js} +1 -1
  92. package/web/dist/assets/{reports-CoQqVEy4.js → reports-C64cW2KP.js} +1 -1
  93. package/web/dist/assets/{resources-section-CVaIlicS.js → resources-section-xAUouGNM.js} +1 -1
  94. package/web/dist/assets/{run-header-xPtXOBkm.js → run-header-75eMWFhM.js} +1 -1
  95. package/web/dist/assets/{runners-DccsyraI.js → runners-C4-xD5Cz.js} +1 -1
  96. package/web/dist/assets/{settings-agent-picker-ixlEQ-MP.js → settings-agent-picker-4P5j_ZP8.js} +1 -1
  97. package/web/dist/assets/{settings-shell-BwknM_fs.js → settings-shell-CME_R4D1.js} +1 -1
  98. package/web/dist/assets/{sidebar-section-BNy-fRPU.js → sidebar-section-BQSB_KxK.js} +1 -1
  99. package/web/dist/assets/{skills-CKceHo5J.js → skills-RUJCWIve.js} +1 -1
  100. package/web/dist/assets/{tab-link-VCVNqxFc.js → tab-link-DnbdjF4r.js} +1 -1
  101. package/web/dist/assets/{task-changes-D4H5YbMo.js → task-changes-Boec_UFj.js} +1 -1
  102. package/web/dist/assets/{task-commits-BNu0VTTf.js → task-commits-B6k-DdnE.js} +1 -1
  103. package/web/dist/assets/{task-files-C8q8GHYK.js → task-files-T731cz4q.js} +1 -1
  104. package/web/dist/assets/{task-github-item-D5kHfnwY.js → task-github-item-iQd_C1Y4.js} +1 -1
  105. package/web/dist/assets/{task-groups-C7yO8nMy.js → task-groups-BTMFLRHJ.js} +1 -1
  106. package/web/dist/assets/{task-thread-Dhts8Nbu.js → task-thread-BaPz3rdA.js} +3 -3
  107. package/web/dist/assets/{tasks-table-I_z4e7uI.js → tasks-table-BCuA9Kx7.js} +1 -1
  108. package/web/dist/assets/{thread-state-DV19z3BD.js → thread-state-B3Ichxx9.js} +1 -1
  109. package/web/dist/assets/{use-hand-to-agent-state-C6e6Mgi1.js → use-hand-to-agent-state-DIIBuX3r.js} +1 -1
  110. package/web/dist/assets/{useInfiniteQuery-DR5UfhCS.js → useInfiniteQuery-BxpPo6z-.js} +1 -1
  111. package/web/dist/assets/useQuery-DcVi2Spi.js +1 -0
  112. package/web/dist/assets/{workflows-BNHmFZRc.js → workflows-8HhOvPhw.js} +1 -1
  113. package/web/dist/assets/{workspace-tools-UHJAnHEN.js → workspace-tools-D6C2Yjat.js} +1 -1
  114. package/web/dist/assets/{worktrees-section-B4XPx6R5.js → worktrees-section-Cm4JH128.js} +1 -1
  115. package/web/dist/assets/{ws-CH3zNFKR.js → ws-Iixb-QFR.js} +1 -1
  116. package/web/dist/index.html +15 -15
  117. package/web/dist/assets/activity-motion-D-8GF_WP.js +0 -2
  118. package/web/dist/assets/attention-B1Ei1IW6.js +0 -1
  119. package/web/dist/assets/useQuery-BMyCehPp.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export declare const squawkWaitRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2
+ export declare const builtInSquawkWaitRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
3
  pr: z.ZodString;
4
4
  until: z.ZodDefault<z.ZodEnum<{
5
5
  checks: "checks";
@@ -49,6 +49,174 @@ export declare const squawkWaitRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObje
49
49
  timeout_seconds: z.ZodDefault<z.ZodNumber>;
50
50
  note: z.ZodOptional<z.ZodString>;
51
51
  }, z.core.$strict>], "kind">;
52
+ export type BuiltInSquawkWaitRequest = z.infer<typeof builtInSquawkWaitRequestSchema>;
53
+ export type BuiltInSquawkWaitRequestInput = z.input<typeof builtInSquawkWaitRequestSchema>;
54
+ /** Dispatch before validation so a malformed built-in retains its original Zod issues. */
55
+ export declare const squawkWaitRequestSchema: z.ZodPipe<z.ZodCustom<{
56
+ pr: string;
57
+ until?: "checks" | "merge" | "merge_or_blocked" | undefined;
58
+ wake_on_conflict?: boolean | undefined;
59
+ timeout_seconds?: number | undefined;
60
+ head_sha?: string | undefined;
61
+ operation_id?: string | undefined;
62
+ kind: "pr";
63
+ } | {
64
+ operation_id?: string | undefined;
65
+ kind: "worker";
66
+ worker_ids: string[];
67
+ mode?: "all" | "any" | "one" | undefined;
68
+ timeout_seconds?: number | undefined;
69
+ } | {
70
+ operation_id?: string | undefined;
71
+ kind: "request";
72
+ request_ids: string[];
73
+ mode?: "all" | "any" | "one" | undefined;
74
+ timeout_seconds?: number | undefined;
75
+ } | {
76
+ operation_id?: string | undefined;
77
+ kind: "peer";
78
+ peer_ids: string[];
79
+ timeout_seconds?: number | undefined;
80
+ } | {
81
+ operation_id?: string | undefined;
82
+ kind: "timer";
83
+ seconds: number;
84
+ note?: string | undefined;
85
+ } | {
86
+ operation_id?: string | undefined;
87
+ kind: "process";
88
+ pid: number;
89
+ exit_file?: string | undefined;
90
+ timeout_seconds?: number | undefined;
91
+ note?: string | undefined;
92
+ } | {
93
+ [x: string]: unknown;
94
+ operation_id?: string | undefined;
95
+ kind: string;
96
+ }, {
97
+ pr: string;
98
+ until?: "checks" | "merge" | "merge_or_blocked" | undefined;
99
+ wake_on_conflict?: boolean | undefined;
100
+ timeout_seconds?: number | undefined;
101
+ head_sha?: string | undefined;
102
+ operation_id?: string | undefined;
103
+ kind: "pr";
104
+ } | {
105
+ operation_id?: string | undefined;
106
+ kind: "worker";
107
+ worker_ids: string[];
108
+ mode?: "all" | "any" | "one" | undefined;
109
+ timeout_seconds?: number | undefined;
110
+ } | {
111
+ operation_id?: string | undefined;
112
+ kind: "request";
113
+ request_ids: string[];
114
+ mode?: "all" | "any" | "one" | undefined;
115
+ timeout_seconds?: number | undefined;
116
+ } | {
117
+ operation_id?: string | undefined;
118
+ kind: "peer";
119
+ peer_ids: string[];
120
+ timeout_seconds?: number | undefined;
121
+ } | {
122
+ operation_id?: string | undefined;
123
+ kind: "timer";
124
+ seconds: number;
125
+ note?: string | undefined;
126
+ } | {
127
+ operation_id?: string | undefined;
128
+ kind: "process";
129
+ pid: number;
130
+ exit_file?: string | undefined;
131
+ timeout_seconds?: number | undefined;
132
+ note?: string | undefined;
133
+ } | {
134
+ [x: string]: unknown;
135
+ operation_id?: string | undefined;
136
+ kind: string;
137
+ }>, z.ZodTransform<{
138
+ operation_id?: string | undefined;
139
+ kind: "worker";
140
+ worker_ids: string[];
141
+ mode?: "all" | "any" | "one" | undefined;
142
+ timeout_seconds: number;
143
+ } | {
144
+ operation_id?: string | undefined;
145
+ kind: "request";
146
+ request_ids: string[];
147
+ mode?: "all" | "any" | "one" | undefined;
148
+ timeout_seconds: number;
149
+ } | {
150
+ pr: string;
151
+ until: "checks" | "merge" | "merge_or_blocked";
152
+ wake_on_conflict: boolean;
153
+ timeout_seconds: number;
154
+ head_sha?: string | undefined;
155
+ operation_id?: string | undefined;
156
+ kind: "pr";
157
+ } | {
158
+ operation_id?: string | undefined;
159
+ kind: "peer";
160
+ peer_ids: string[];
161
+ timeout_seconds: number;
162
+ } | {
163
+ operation_id?: string | undefined;
164
+ kind: "timer";
165
+ seconds: number;
166
+ note?: string | undefined;
167
+ } | {
168
+ operation_id?: string | undefined;
169
+ kind: "process";
170
+ pid: number;
171
+ exit_file?: string | undefined;
172
+ timeout_seconds: number;
173
+ note?: string | undefined;
174
+ } | {
175
+ [x: string]: unknown;
176
+ operation_id?: string | undefined;
177
+ kind: string;
178
+ }, {
179
+ pr: string;
180
+ until?: "checks" | "merge" | "merge_or_blocked" | undefined;
181
+ wake_on_conflict?: boolean | undefined;
182
+ timeout_seconds?: number | undefined;
183
+ head_sha?: string | undefined;
184
+ operation_id?: string | undefined;
185
+ kind: "pr";
186
+ } | {
187
+ operation_id?: string | undefined;
188
+ kind: "worker";
189
+ worker_ids: string[];
190
+ mode?: "all" | "any" | "one" | undefined;
191
+ timeout_seconds?: number | undefined;
192
+ } | {
193
+ operation_id?: string | undefined;
194
+ kind: "request";
195
+ request_ids: string[];
196
+ mode?: "all" | "any" | "one" | undefined;
197
+ timeout_seconds?: number | undefined;
198
+ } | {
199
+ operation_id?: string | undefined;
200
+ kind: "peer";
201
+ peer_ids: string[];
202
+ timeout_seconds?: number | undefined;
203
+ } | {
204
+ operation_id?: string | undefined;
205
+ kind: "timer";
206
+ seconds: number;
207
+ note?: string | undefined;
208
+ } | {
209
+ operation_id?: string | undefined;
210
+ kind: "process";
211
+ pid: number;
212
+ exit_file?: string | undefined;
213
+ timeout_seconds?: number | undefined;
214
+ note?: string | undefined;
215
+ } | {
216
+ [x: string]: unknown;
217
+ operation_id?: string | undefined;
218
+ kind: string;
219
+ }>>;
52
220
  export type SquawkWaitRequest = z.infer<typeof squawkWaitRequestSchema>;
53
221
  /** What a caller may send: the defaults (`until`, `wake_on_conflict`, `timeout_seconds`) still unset. */
54
222
  export type SquawkWaitRequestInput = z.input<typeof squawkWaitRequestSchema>;
@@ -73,15 +241,8 @@ export declare const squawkWaitAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
73
241
  unavailable: "unavailable";
74
242
  }>>;
75
243
  wait_id: z.ZodUUID;
76
- kind: z.ZodEnum<{
77
- peer: "peer";
78
- pr: "pr";
79
- process: "process";
80
- request: "request";
81
- timer: "timer";
82
- worker: "worker";
83
- }>;
84
- deadline: z.ZodISODateTime;
244
+ kind: z.ZodString;
245
+ deadline: z.ZodOptional<z.ZodISODateTime>;
85
246
  open_waits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
86
247
  wait_id: z.ZodUUID;
87
248
  summary: z.ZodString;
@@ -98,6 +259,12 @@ export declare const squawkWaitAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
98
259
  wait_id: z.ZodUUID;
99
260
  summary: z.ZodString;
100
261
  kind: z.ZodLiteral<"human">;
262
+ }, z.core.$strict>, z.ZodObject<{
263
+ wait_id: z.ZodUUID;
264
+ summary: z.ZodString;
265
+ kind: z.ZodLiteral<"plugin">;
266
+ pluginKind: z.ZodString;
267
+ deadline: z.ZodOptional<z.ZodISODateTime>;
101
268
  }, z.core.$strict>], "kind">>;
102
269
  }, z.core.$strict>, z.ZodObject<{
103
270
  operation_id: z.ZodOptional<z.ZodUUID>;
@@ -122,6 +289,12 @@ export declare const squawkWaitAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
122
289
  wait_id: z.ZodUUID;
123
290
  summary: z.ZodString;
124
291
  kind: z.ZodLiteral<"human">;
292
+ }, z.core.$strict>, z.ZodObject<{
293
+ wait_id: z.ZodUUID;
294
+ summary: z.ZodString;
295
+ kind: z.ZodLiteral<"plugin">;
296
+ pluginKind: z.ZodString;
297
+ deadline: z.ZodOptional<z.ZodISODateTime>;
125
298
  }, z.core.$strict>], "kind">>;
126
299
  code: z.ZodEnum<{
127
300
  authentication: "authentication";
@@ -181,6 +354,12 @@ export declare const squawkWaitAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
181
354
  wait_id: z.ZodUUID;
182
355
  summary: z.ZodString;
183
356
  kind: z.ZodLiteral<"human">;
357
+ }, z.core.$strict>, z.ZodObject<{
358
+ wait_id: z.ZodUUID;
359
+ summary: z.ZodString;
360
+ kind: z.ZodLiteral<"plugin">;
361
+ pluginKind: z.ZodString;
362
+ deadline: z.ZodOptional<z.ZodISODateTime>;
184
363
  }, z.core.$strict>], "kind">>>;
185
364
  }, z.core.$strict>], "ok">;
186
365
  export type SquawkWaitAnswer = z.infer<typeof squawkWaitAnswerSchema>;
@@ -223,6 +402,12 @@ export declare const squawkAskAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObject
223
402
  wait_id: z.ZodUUID;
224
403
  summary: z.ZodString;
225
404
  kind: z.ZodLiteral<"human">;
405
+ }, z.core.$strict>, z.ZodObject<{
406
+ wait_id: z.ZodUUID;
407
+ summary: z.ZodString;
408
+ kind: z.ZodLiteral<"plugin">;
409
+ pluginKind: z.ZodString;
410
+ deadline: z.ZodOptional<z.ZodISODateTime>;
226
411
  }, z.core.$strict>], "kind">>;
227
412
  }, z.core.$strict>, z.ZodObject<{
228
413
  ok: z.ZodLiteral<false>;
@@ -265,6 +450,12 @@ export declare const squawkAskAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObject
265
450
  wait_id: z.ZodUUID;
266
451
  summary: z.ZodString;
267
452
  kind: z.ZodLiteral<"human">;
453
+ }, z.core.$strict>, z.ZodObject<{
454
+ wait_id: z.ZodUUID;
455
+ summary: z.ZodString;
456
+ kind: z.ZodLiteral<"plugin">;
457
+ pluginKind: z.ZodString;
458
+ deadline: z.ZodOptional<z.ZodISODateTime>;
268
459
  }, z.core.$strict>], "kind">>>;
269
460
  }, z.core.$strict>], "ok">;
270
461
  export type SquawkAskAnswer = z.infer<typeof squawkAskAnswerSchema>;
@@ -289,6 +480,12 @@ export declare const squawkCancelWaitAnswerSchema: z.ZodDiscriminatedUnion<[z.Zo
289
480
  wait_id: z.ZodUUID;
290
481
  summary: z.ZodString;
291
482
  kind: z.ZodLiteral<"human">;
483
+ }, z.core.$strict>, z.ZodObject<{
484
+ wait_id: z.ZodUUID;
485
+ summary: z.ZodString;
486
+ kind: z.ZodLiteral<"plugin">;
487
+ pluginKind: z.ZodString;
488
+ deadline: z.ZodOptional<z.ZodISODateTime>;
292
489
  }, z.core.$strict>], "kind">>;
293
490
  }, z.core.$strict>, z.ZodObject<{
294
491
  cancelled: z.ZodLiteral<false>;
@@ -316,6 +513,12 @@ export declare const squawkCancelWaitAnswerSchema: z.ZodDiscriminatedUnion<[z.Zo
316
513
  wait_id: z.ZodUUID;
317
514
  summary: z.ZodString;
318
515
  kind: z.ZodLiteral<"human">;
516
+ }, z.core.$strict>, z.ZodObject<{
517
+ wait_id: z.ZodUUID;
518
+ summary: z.ZodString;
519
+ kind: z.ZodLiteral<"plugin">;
520
+ pluginKind: z.ZodString;
521
+ deadline: z.ZodOptional<z.ZodISODateTime>;
319
522
  }, z.core.$strict>], "kind">>>;
320
523
  }, z.core.$strict>], "cancelled">;
321
524
  export type SquawkCancelWaitAnswer = z.infer<typeof squawkCancelWaitAnswerSchema>;
@@ -345,6 +548,12 @@ export declare const squawkDoneAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodDiscr
345
548
  wait_id: z.ZodUUID;
346
549
  summary: z.ZodString;
347
550
  kind: z.ZodLiteral<"human">;
551
+ }, z.core.$strict>, z.ZodObject<{
552
+ wait_id: z.ZodUUID;
553
+ summary: z.ZodString;
554
+ kind: z.ZodLiteral<"plugin">;
555
+ pluginKind: z.ZodString;
556
+ deadline: z.ZodOptional<z.ZodISODateTime>;
348
557
  }, z.core.$strict>], "kind">>;
349
558
  completes: z.ZodLiteral<"task">;
350
559
  }, z.core.$strict>, z.ZodObject<{
@@ -366,6 +575,12 @@ export declare const squawkDoneAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodDiscr
366
575
  wait_id: z.ZodUUID;
367
576
  summary: z.ZodString;
368
577
  kind: z.ZodLiteral<"human">;
578
+ }, z.core.$strict>, z.ZodObject<{
579
+ wait_id: z.ZodUUID;
580
+ summary: z.ZodString;
581
+ kind: z.ZodLiteral<"plugin">;
582
+ pluginKind: z.ZodString;
583
+ deadline: z.ZodOptional<z.ZodISODateTime>;
369
584
  }, z.core.$strict>], "kind">>;
370
585
  completes: z.ZodLiteral<"step">;
371
586
  next_step: z.ZodString;
@@ -420,6 +635,12 @@ export declare const squawkDoneAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodDiscr
420
635
  wait_id: z.ZodUUID;
421
636
  summary: z.ZodString;
422
637
  kind: z.ZodLiteral<"human">;
638
+ }, z.core.$strict>, z.ZodObject<{
639
+ wait_id: z.ZodUUID;
640
+ summary: z.ZodString;
641
+ kind: z.ZodLiteral<"plugin">;
642
+ pluginKind: z.ZodString;
643
+ deadline: z.ZodOptional<z.ZodISODateTime>;
423
644
  }, z.core.$strict>], "kind">>>;
424
645
  owed: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
425
646
  kind: z.ZodLiteral<"wait_result">;
@@ -533,6 +533,33 @@ export declare const subagentWaitEntrySchema: z.ZodObject<{
533
533
  export type SubagentWaitEntry = z.infer<typeof subagentWaitEntrySchema>;
534
534
  /** The children a subagent wait still waits on. */
535
535
  export declare function runningSubagents(wait: Pick<SubagentWaitEntry, 'children'>): number;
536
+ /** An open plugin-owned wait; its data remains readable without the plugin installed. */
537
+ export declare const pluginWaitEntrySchema: z.ZodObject<{
538
+ id: z.ZodUUID;
539
+ source: z.ZodEnum<{
540
+ agent: "agent";
541
+ cezar: "cezar";
542
+ }>;
543
+ registeredAt: z.ZodISODateTime;
544
+ phase: z.ZodEnum<{
545
+ cancelled: "cancelled";
546
+ delivered: "delivered";
547
+ open: "open";
548
+ resolved: "resolved";
549
+ }>;
550
+ resolvedAt: z.ZodOptional<z.ZodISODateTime>;
551
+ deliveredAt: z.ZodOptional<z.ZodISODateTime>;
552
+ cancelledAt: z.ZodOptional<z.ZodISODateTime>;
553
+ turnId: z.ZodString;
554
+ via: z.ZodString;
555
+ kind: z.ZodLiteral<"plugin">;
556
+ pluginKind: z.ZodString;
557
+ deadline: z.ZodOptional<z.ZodISODateTime>;
558
+ summary: z.ZodString;
559
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
560
+ result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
561
+ }, z.core.$strict>;
562
+ export type PluginWaitEntry = z.infer<typeof pluginWaitEntrySchema>;
536
563
  export declare const waitSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
537
564
  prUrl: z.ZodString;
538
565
  repository: z.ZodString;
@@ -929,6 +956,30 @@ export declare const waitSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
929
956
  timeout: "timeout";
930
957
  }>;
931
958
  }, z.core.$strict>>;
959
+ }, z.core.$strict>, z.ZodObject<{
960
+ id: z.ZodUUID;
961
+ source: z.ZodEnum<{
962
+ agent: "agent";
963
+ cezar: "cezar";
964
+ }>;
965
+ registeredAt: z.ZodISODateTime;
966
+ phase: z.ZodEnum<{
967
+ cancelled: "cancelled";
968
+ delivered: "delivered";
969
+ open: "open";
970
+ resolved: "resolved";
971
+ }>;
972
+ resolvedAt: z.ZodOptional<z.ZodISODateTime>;
973
+ deliveredAt: z.ZodOptional<z.ZodISODateTime>;
974
+ cancelledAt: z.ZodOptional<z.ZodISODateTime>;
975
+ turnId: z.ZodString;
976
+ via: z.ZodString;
977
+ kind: z.ZodLiteral<"plugin">;
978
+ pluginKind: z.ZodString;
979
+ deadline: z.ZodOptional<z.ZodISODateTime>;
980
+ summary: z.ZodString;
981
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
982
+ result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
932
983
  }, z.core.$strict>], "kind">;
933
984
  export type Wait = z.infer<typeof waitSchema>;
934
985
  export declare const openWaitSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -947,6 +998,12 @@ export declare const openWaitSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
947
998
  wait_id: z.ZodUUID;
948
999
  summary: z.ZodString;
949
1000
  kind: z.ZodLiteral<"human">;
1001
+ }, z.core.$strict>, z.ZodObject<{
1002
+ wait_id: z.ZodUUID;
1003
+ summary: z.ZodString;
1004
+ kind: z.ZodLiteral<"plugin">;
1005
+ pluginKind: z.ZodString;
1006
+ deadline: z.ZodOptional<z.ZodISODateTime>;
950
1007
  }, z.core.$strict>], "kind">;
951
1008
  export type OpenWait = z.infer<typeof openWaitSchema>;
952
1009
  export declare const waitErrorCodeSchema: z.ZodEnum<{
@@ -1390,6 +1447,30 @@ export declare const waitRegistrationReceiptSchema: z.ZodObject<{
1390
1447
  timeout: "timeout";
1391
1448
  }>;
1392
1449
  }, z.core.$strict>>;
1450
+ }, z.core.$strict>, z.ZodObject<{
1451
+ id: z.ZodUUID;
1452
+ source: z.ZodEnum<{
1453
+ agent: "agent";
1454
+ cezar: "cezar";
1455
+ }>;
1456
+ registeredAt: z.ZodISODateTime;
1457
+ phase: z.ZodEnum<{
1458
+ cancelled: "cancelled";
1459
+ delivered: "delivered";
1460
+ open: "open";
1461
+ resolved: "resolved";
1462
+ }>;
1463
+ resolvedAt: z.ZodOptional<z.ZodISODateTime>;
1464
+ deliveredAt: z.ZodOptional<z.ZodISODateTime>;
1465
+ cancelledAt: z.ZodOptional<z.ZodISODateTime>;
1466
+ turnId: z.ZodString;
1467
+ via: z.ZodString;
1468
+ kind: z.ZodLiteral<"plugin">;
1469
+ pluginKind: z.ZodString;
1470
+ deadline: z.ZodOptional<z.ZodISODateTime>;
1471
+ summary: z.ZodString;
1472
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1473
+ result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1393
1474
  }, z.core.$strict>], "kind">;
1394
1475
  deduplicated: z.ZodBoolean;
1395
1476
  }, z.core.$strict>;
@@ -1499,6 +1580,12 @@ export declare const waitingOnSchema: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z
1499
1580
  pid: z.ZodNumber;
1500
1581
  deadline: z.ZodISODateTime;
1501
1582
  note: z.ZodOptional<z.ZodString>;
1583
+ }, z.core.$strip>, z.ZodObject<{
1584
+ kind: z.ZodLiteral<"plugin">;
1585
+ pluginKind: z.ZodString;
1586
+ waitId: z.ZodUUID;
1587
+ summary: z.ZodString;
1588
+ deadline: z.ZodOptional<z.ZodISODateTime>;
1502
1589
  }, z.core.$strip>, z.ZodObject<{
1503
1590
  kind: z.ZodLiteral<"timer">;
1504
1591
  waitId: z.ZodUUID;
@@ -77,6 +77,12 @@ export declare const workspaceRunSummaryEventSchema: z.ZodObject<{
77
77
  pid: z.ZodNumber;
78
78
  deadline: z.ZodISODateTime;
79
79
  note: z.ZodOptional<z.ZodString>;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ kind: z.ZodLiteral<"plugin">;
82
+ pluginKind: z.ZodString;
83
+ waitId: z.ZodUUID;
84
+ summary: z.ZodString;
85
+ deadline: z.ZodOptional<z.ZodISODateTime>;
80
86
  }, z.core.$strip>, z.ZodObject<{
81
87
  kind: z.ZodLiteral<"timer">;
82
88
  waitId: z.ZodUUID;
@@ -261,6 +267,12 @@ export declare const runsIndexResponseSchema: z.ZodObject<{
261
267
  pid: z.ZodNumber;
262
268
  deadline: z.ZodISODateTime;
263
269
  note: z.ZodOptional<z.ZodString>;
270
+ }, z.core.$strip>, z.ZodObject<{
271
+ kind: z.ZodLiteral<"plugin">;
272
+ pluginKind: z.ZodString;
273
+ waitId: z.ZodUUID;
274
+ summary: z.ZodString;
275
+ deadline: z.ZodOptional<z.ZodISODateTime>;
264
276
  }, z.core.$strip>, z.ZodObject<{
265
277
  kind: z.ZodLiteral<"timer">;
266
278
  waitId: z.ZodUUID;
@@ -0,0 +1,36 @@
1
+ /** Process-wide registries register first, seal at boot, then allow normal reads. */
2
+ interface RegistryOptions {
3
+ name: string;
4
+ bootHint: string;
5
+ }
6
+ /** A keyed registry with passive inspection for cold callers. Returned arrays are snapshots. */
7
+ export declare function createKeyedRegistry<K extends string, V>(options: RegistryOptions & {
8
+ reservedKeys?: ReadonlySet<string> | readonly string[];
9
+ }): {
10
+ seal: () => void;
11
+ isSealed: () => boolean;
12
+ register(key: K, value: V): void;
13
+ get(key: K): V | undefined;
14
+ has(key: K): boolean;
15
+ values(): V[];
16
+ keys(): K[];
17
+ entries(): [K, V][];
18
+ peekKeys: () => K[];
19
+ peekHas: (key: K) => boolean;
20
+ };
21
+ /** An ordered list that ignores repeated registration of the same reference. */
22
+ export declare function createListRegistry<V>(options: RegistryOptions): {
23
+ seal: () => void;
24
+ isSealed: () => boolean;
25
+ register(item: V): void;
26
+ values(): V[];
27
+ };
28
+ /** A single registration. Even a sealed slot fails closed when it is empty. */
29
+ export declare function createSingleRegistry<V>(options: RegistryOptions): {
30
+ seal: () => void;
31
+ isSealed: () => boolean;
32
+ register(value: V): void;
33
+ has(): boolean;
34
+ get(): V;
35
+ };
36
+ export {};
@@ -0,0 +1,85 @@
1
+ function lifecycle({ name, bootHint }) {
2
+ let sealed = false;
3
+ return {
4
+ seal() { sealed = true; },
5
+ isSealed: () => sealed,
6
+ assertReadable() {
7
+ if (!sealed)
8
+ throw new Error(`${name} is unsealed: ${bootHint}`);
9
+ },
10
+ assertWritable() {
11
+ if (sealed)
12
+ throw new Error(`${name} is sealed: register every entry before sealing. ${bootHint}`);
13
+ },
14
+ };
15
+ }
16
+ /** A keyed registry with passive inspection for cold callers. Returned arrays are snapshots. */
17
+ export function createKeyedRegistry(options) {
18
+ const state = lifecycle(options);
19
+ const entries = new Map();
20
+ const reserved = new Set(options.reservedKeys);
21
+ return {
22
+ seal: state.seal,
23
+ isSealed: state.isSealed,
24
+ register(key, value) {
25
+ if (reserved.has(key))
26
+ throw new Error(`${options.name}: reserved legacy key '${key}'.`);
27
+ if (entries.has(key)) {
28
+ if (entries.get(key) === value)
29
+ return;
30
+ throw new Error(`${options.name}: conflicting registration for '${key}'.`);
31
+ }
32
+ state.assertWritable();
33
+ entries.set(key, value);
34
+ },
35
+ get(key) { state.assertReadable(); return entries.get(key); },
36
+ has(key) { state.assertReadable(); return entries.has(key); },
37
+ values() { state.assertReadable(); return [...entries.values()]; },
38
+ keys() { state.assertReadable(); return [...entries.keys()]; },
39
+ entries() { state.assertReadable(); return [...entries.entries()]; },
40
+ peekKeys: () => [...entries.keys()],
41
+ peekHas: (key) => entries.has(key),
42
+ };
43
+ }
44
+ /** An ordered list that ignores repeated registration of the same reference. */
45
+ export function createListRegistry(options) {
46
+ const state = lifecycle(options);
47
+ const items = [];
48
+ return {
49
+ seal: state.seal,
50
+ isSealed: state.isSealed,
51
+ register(item) {
52
+ if (items.some(value => value === item))
53
+ return;
54
+ state.assertWritable();
55
+ items.push(item);
56
+ },
57
+ values() { state.assertReadable(); return [...items]; },
58
+ };
59
+ }
60
+ /** A single registration. Even a sealed slot fails closed when it is empty. */
61
+ export function createSingleRegistry(options) {
62
+ const state = lifecycle(options);
63
+ let entry;
64
+ return {
65
+ seal: state.seal,
66
+ isSealed: state.isSealed,
67
+ register(value) {
68
+ if (entry) {
69
+ if (entry.value === value)
70
+ return;
71
+ throw new Error(`${options.name}: a different value is already registered.`);
72
+ }
73
+ state.assertWritable();
74
+ entry = { value };
75
+ },
76
+ has() { state.assertReadable(); return entry !== undefined; },
77
+ get() {
78
+ state.assertReadable();
79
+ if (!entry)
80
+ throw new Error(`${options.name}: missing registration. ${options.bootHint}`);
81
+ return entry.value;
82
+ },
83
+ };
84
+ }
85
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/core/registry.ts"],"names":[],"mappings":"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"}
@@ -1,41 +1,48 @@
1
- const gates = [];
2
- const preparations = [];
3
- const cleanups = [];
4
- let sealed = false;
5
- function add(list, slots) {
6
- for (const slot of slots ?? []) {
7
- if (list.includes(slot))
8
- continue;
9
- if (sealed)
1
+ import { createListRegistry } from '../core/registry.js';
2
+ const options = { name: 'The removal slots', bootHint: 'call registerBuiltInRunSlots(), then sealBuiltInRunSlots().' };
3
+ const gates = createListRegistry(options);
4
+ const preparations = createListRegistry(options);
5
+ const cleanups = createListRegistry(options);
6
+ function registerSlot(registry, slot) {
7
+ try {
8
+ registry.register(slot);
9
+ }
10
+ catch (error) {
11
+ if (runSlotsSealed())
10
12
  throw new Error('The removal slots are sealed: register every slot before sealRunSlots().');
11
- list.push(slot);
13
+ throw error;
12
14
  }
13
15
  }
14
16
  /** Add slots, in call order. Registering the same slot object again does nothing. */
15
17
  export function registerRunSlots(slots) {
16
- add(gates, slots.gates);
17
- add(preparations, slots.preparations);
18
- add(cleanups, slots.cleanups);
18
+ for (const slot of slots.gates ?? [])
19
+ registerSlot(gates, slot);
20
+ for (const slot of slots.preparations ?? [])
21
+ registerSlot(preparations, slot);
22
+ for (const slot of slots.cleanups ?? [])
23
+ registerSlot(cleanups, slot);
19
24
  }
20
25
  /** Close the registry: removals may run, and no new slot may register. */
21
26
  export function sealRunSlots() {
22
- sealed = true;
27
+ gates.seal();
28
+ preparations.seal();
29
+ cleanups.seal();
23
30
  }
24
31
  /** Whether this process sealed its removal slots. Never throws. */
25
32
  export function runSlotsSealed() {
26
- return sealed;
33
+ return gates.isSealed();
27
34
  }
28
35
  /** Throws unless the registry is sealed. A removal path calls it before its first side effect. */
29
36
  export function assertRunSlotsSealed() {
30
- if (!sealed) {
31
- throw new Error('No removal slot is registered: call registerBuiltInRunSlots() from built-in-run-slots.ts at the process entry, '
37
+ if (!runSlotsSealed()) {
38
+ throw new Error('No removal slot is registered: call registerBuiltInRunSlots() then sealBuiltInRunSlots() from built-in-run-slots.ts at the process entry, '
32
39
  + 'or seal the slots this test uses with sealTestRunSlots() from runs/removal-slots.testkit.ts.');
33
40
  }
34
41
  }
35
42
  /** The first gate's reason to refuse this deletion, in registration order. */
36
43
  export function deletionRefusal(runId, kind, dataDir) {
37
44
  assertRunSlotsSealed();
38
- for (const gate of gates) {
45
+ for (const gate of gates.values()) {
39
46
  const reason = gate.refuse(runId, kind, dataDir);
40
47
  if (reason)
41
48
  return reason;
@@ -45,14 +52,14 @@ export function deletionRefusal(runId, kind, dataDir) {
45
52
  /** Run every preparation in registration order; the first rejection stops the rest. */
46
53
  export async function prepareReclaim(run, context) {
47
54
  assertRunSlotsSealed();
48
- for (const preparation of preparations)
55
+ for (const preparation of preparations.values())
49
56
  await preparation.prepare(run, context);
50
57
  }
51
58
  /** Run every cleanup in registration order, then throw the first failure. */
52
59
  export function runRemovalCleanups(runId, dataDir) {
53
60
  assertRunSlotsSealed();
54
61
  const failures = [];
55
- for (const cleanup of cleanups) {
62
+ for (const cleanup of cleanups.values()) {
56
63
  try {
57
64
  cleanup.removed(runId, dataDir);
58
65
  }