@hearsay-tools/squawk 0.18.0-dev.8043 → 0.18.0-dev.8044

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.
@@ -228,30 +228,6 @@ export declare class RunArchiveTopic implements RunArchive, RunCompletionActions
228
228
  deadline: string;
229
229
  seconds: number;
230
230
  note?: string | undefined;
231
- } | {
232
- id: string;
233
- source: "agent" | "cezar";
234
- via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
235
- registeredAt: string;
236
- phase: "cancelled" | "delivered" | "open" | "resolved";
237
- resolvedAt?: string | undefined;
238
- deliveredAt?: string | undefined;
239
- cancelledAt?: string | undefined;
240
- turnId: string;
241
- kind: "process";
242
- deadline: string;
243
- timeoutSeconds: number;
244
- pid: number;
245
- startToken?: string | undefined;
246
- exitFile?: string | undefined;
247
- note?: string | undefined;
248
- result?: {
249
- outcome: "deadline" | "error" | "exit_file" | "exited";
250
- observedAt: string;
251
- exitCode?: number | undefined;
252
- exitFileNote?: "not-an-exit-code" | undefined;
253
- diagnostic?: string | undefined;
254
- } | undefined;
255
231
  } | {
256
232
  id: string;
257
233
  source: "agent" | "cezar";
@@ -313,6 +289,30 @@ export declare class RunArchiveTopic implements RunArchive, RunCompletionActions
313
289
  reason: "outcome" | "timeout";
314
290
  } | undefined;
315
291
  wakeInputId?: string | undefined;
292
+ } | {
293
+ id: string;
294
+ source: "agent" | "cezar";
295
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
296
+ registeredAt: string;
297
+ phase: "cancelled" | "delivered" | "open" | "resolved";
298
+ resolvedAt?: string | undefined;
299
+ deliveredAt?: string | undefined;
300
+ cancelledAt?: string | undefined;
301
+ turnId: string;
302
+ kind: "process";
303
+ deadline: string;
304
+ timeoutSeconds: number;
305
+ pid: number;
306
+ startToken?: string | undefined;
307
+ exitFile?: string | undefined;
308
+ note?: string | undefined;
309
+ result?: {
310
+ outcome: "deadline" | "error" | "exit_file" | "exited";
311
+ observedAt: string;
312
+ exitCode?: number | undefined;
313
+ exitFileNote?: "not-an-exit-code" | undefined;
314
+ diagnostic?: string | undefined;
315
+ } | undefined;
316
316
  } | {
317
317
  id: string;
318
318
  source: "agent" | "cezar";
@@ -440,30 +440,6 @@ export declare class RunArchiveTopic implements RunArchive, RunCompletionActions
440
440
  deadline: string;
441
441
  seconds: number;
442
442
  note?: string | undefined;
443
- } | {
444
- id: string;
445
- source: "agent" | "cezar";
446
- via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
447
- registeredAt: string;
448
- phase: "cancelled" | "delivered" | "open" | "resolved";
449
- resolvedAt?: string | undefined;
450
- deliveredAt?: string | undefined;
451
- cancelledAt?: string | undefined;
452
- turnId: string;
453
- kind: "process";
454
- deadline: string;
455
- timeoutSeconds: number;
456
- pid: number;
457
- startToken?: string | undefined;
458
- exitFile?: string | undefined;
459
- note?: string | undefined;
460
- result?: {
461
- outcome: "deadline" | "error" | "exit_file" | "exited";
462
- observedAt: string;
463
- exitCode?: number | undefined;
464
- exitFileNote?: "not-an-exit-code" | undefined;
465
- diagnostic?: string | undefined;
466
- } | undefined;
467
443
  } | {
468
444
  id: string;
469
445
  source: "agent" | "cezar";
@@ -525,6 +501,30 @@ export declare class RunArchiveTopic implements RunArchive, RunCompletionActions
525
501
  reason: "outcome" | "timeout";
526
502
  } | undefined;
527
503
  wakeInputId?: string | undefined;
504
+ } | {
505
+ id: string;
506
+ source: "agent" | "cezar";
507
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
508
+ registeredAt: string;
509
+ phase: "cancelled" | "delivered" | "open" | "resolved";
510
+ resolvedAt?: string | undefined;
511
+ deliveredAt?: string | undefined;
512
+ cancelledAt?: string | undefined;
513
+ turnId: string;
514
+ kind: "process";
515
+ deadline: string;
516
+ timeoutSeconds: number;
517
+ pid: number;
518
+ startToken?: string | undefined;
519
+ exitFile?: string | undefined;
520
+ note?: string | undefined;
521
+ result?: {
522
+ outcome: "deadline" | "error" | "exit_file" | "exited";
523
+ observedAt: string;
524
+ exitCode?: number | undefined;
525
+ exitFileNote?: "not-an-exit-code" | undefined;
526
+ diagnostic?: string | undefined;
527
+ } | undefined;
528
528
  } | {
529
529
  id: string;
530
530
  source: "agent" | "cezar";
@@ -651,30 +651,6 @@ export declare class RunArchiveTopic implements RunArchive, RunCompletionActions
651
651
  deadline: string;
652
652
  seconds: number;
653
653
  note?: string | undefined;
654
- } | {
655
- id: string;
656
- source: "agent" | "cezar";
657
- via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
658
- registeredAt: string;
659
- phase: "cancelled" | "delivered" | "open" | "resolved";
660
- resolvedAt?: string | undefined;
661
- deliveredAt?: string | undefined;
662
- cancelledAt?: string | undefined;
663
- turnId: string;
664
- kind: "process";
665
- deadline: string;
666
- timeoutSeconds: number;
667
- pid: number;
668
- startToken?: string | undefined;
669
- exitFile?: string | undefined;
670
- note?: string | undefined;
671
- result?: {
672
- outcome: "deadline" | "error" | "exit_file" | "exited";
673
- observedAt: string;
674
- exitCode?: number | undefined;
675
- exitFileNote?: "not-an-exit-code" | undefined;
676
- diagnostic?: string | undefined;
677
- } | undefined;
678
654
  } | {
679
655
  id: string;
680
656
  source: "agent" | "cezar";
@@ -736,6 +712,30 @@ export declare class RunArchiveTopic implements RunArchive, RunCompletionActions
736
712
  reason: "outcome" | "timeout";
737
713
  } | undefined;
738
714
  wakeInputId?: string | undefined;
715
+ } | {
716
+ id: string;
717
+ source: "agent" | "cezar";
718
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
719
+ registeredAt: string;
720
+ phase: "cancelled" | "delivered" | "open" | "resolved";
721
+ resolvedAt?: string | undefined;
722
+ deliveredAt?: string | undefined;
723
+ cancelledAt?: string | undefined;
724
+ turnId: string;
725
+ kind: "process";
726
+ deadline: string;
727
+ timeoutSeconds: number;
728
+ pid: number;
729
+ startToken?: string | undefined;
730
+ exitFile?: string | undefined;
731
+ note?: string | undefined;
732
+ result?: {
733
+ outcome: "deadline" | "error" | "exit_file" | "exited";
734
+ observedAt: string;
735
+ exitCode?: number | undefined;
736
+ exitFileNote?: "not-an-exit-code" | undefined;
737
+ diagnostic?: string | undefined;
738
+ } | undefined;
739
739
  } | {
740
740
  id: string;
741
741
  source: "agent" | "cezar";
@@ -16,6 +16,12 @@ export declare function createLiveRoutes({ resolveProject, serverGeneration, res
16
16
  output: {
17
17
  generation: string;
18
18
  results: ({
19
+ projectId: string;
20
+ runId: string;
21
+ type: "error" | "reset";
22
+ status: 400 | 404 | 409 | 413 | 503;
23
+ error: string;
24
+ } | {
19
25
  projectId: string;
20
26
  runId: string;
21
27
  type: "batch";
@@ -29,12 +35,6 @@ export declare function createLiveRoutes({ resolveProject, serverGeneration, res
29
35
  cursor: string;
30
36
  afterSeq: number;
31
37
  hasMore: boolean;
32
- } | {
33
- projectId: string;
34
- runId: string;
35
- type: "error" | "reset";
36
- status: 400 | 404 | 409 | 413 | 503;
37
- error: string;
38
38
  })[];
39
39
  };
40
40
  outputFormat: "json";
@@ -3105,6 +3105,12 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3105
3105
  output: {
3106
3106
  generation: string;
3107
3107
  results: ({
3108
+ projectId: string;
3109
+ runId: string;
3110
+ type: "error" | "reset";
3111
+ status: 400 | 404 | 409 | 413 | 503;
3112
+ error: string;
3113
+ } | {
3108
3114
  projectId: string;
3109
3115
  runId: string;
3110
3116
  type: "batch";
@@ -3118,12 +3124,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3118
3124
  cursor: string;
3119
3125
  afterSeq: number;
3120
3126
  hasMore: boolean;
3121
- } | {
3122
- projectId: string;
3123
- runId: string;
3124
- type: "error" | "reset";
3125
- status: 400 | 404 | 409 | 413 | 503;
3126
- error: string;
3127
3127
  })[];
3128
3128
  };
3129
3129
  outputFormat: "json";
@@ -1,14 +1,6 @@
1
- /**
2
- * The CLI subcommands that take flags of their own, so `index.ts` runs them before its global
3
- * parseArgs: their flags are not cockpit flags (#504, #774, #1576). Each module loads only when
4
- * its command runs.
5
- */
6
1
  import type { Home } from './home/home.ts';
7
- export type SubcommandRunner = (argv: string[], env: NodeJS.ProcessEnv) => Promise<number>;
8
- export declare const SUBCOMMAND_NAMES: readonly ['backup', 'discover', 'artifact', 'job', 'task', 'automation', 'webhook', 'worker', 'message', 'remote-settings', 'migrate', 'server-migrate', 'migrate-project'];
9
- /** The runner for `name`, or nothing when `name` is not a subcommand. */
10
- export declare function loadSubcommand(name: string | undefined, home?: (env: NodeJS.ProcessEnv) => Home): Promise<SubcommandRunner | undefined>;
11
- /** Run `argv[0]` when it names a subcommand and answer its exit code; anything else is not ours. */
2
+ export type { SubcommandRunner } from './core/cli-registry.ts';
3
+ export declare function loadSubcommand(name: string | undefined, home?: (env: NodeJS.ProcessEnv) => Home): Promise<import("./core/cli-registry.ts").SubcommandRunner | undefined>;
12
4
  export declare function runSubcommand(argv: string[], env: NodeJS.ProcessEnv, home?: () => Home): Promise<number | undefined>;
13
5
  /** Install process services before loading commands that read runner or removal registries. */
14
6
  export declare function prepareCommandRuntime(command: string, argv?: readonly string[]): Promise<void>;
@@ -1,68 +1,21 @@
1
- /**
2
- * The CLI subcommands that take flags of their own, so `index.ts` runs them before its global
3
- * parseArgs: their flags are not cockpit flags (#504, #774, #1576). Each module loads only when
4
- * its command runs.
5
- */
6
1
  import { resolveHome } from './home/resolve.js';
7
- import { readInstallMarker } from './home/install-marker.js';
8
- export const SUBCOMMAND_NAMES = ['backup', 'discover', 'artifact', 'job', 'task', 'automation', 'webhook', 'worker', 'message', 'remote-settings', 'migrate', 'server-migrate', 'migrate-project'];
9
- /** An unreadable marker still marks the split home as in use: list it, as before the fallback. */
10
- function hasInstallMarker(root) {
11
- try {
12
- return readInstallMarker(root) !== undefined;
13
- }
14
- catch {
15
- return true;
16
- }
17
- }
18
- /** The runner for `name`, or nothing when `name` is not a subcommand. */
2
+ import { cliCommand } from './core/cli-registry.js';
19
3
  export async function loadSubcommand(name, home = env => resolveHome({ purpose: 'cli', env })) {
20
- switch (name) {
21
- case 'migrate': return (await import('./home/migration-cli.js')).runMigrationCommand;
22
- case 'migrate-project': return (await import('./project-migration/cli.js')).migrateProjectRunner(env => {
23
- return [resolveHome({ purpose: 'cli', env, layout: 'legacy' }), resolveHome({ purpose: 'cli', env, layout: 'split' })];
24
- });
25
- case 'server-migrate': return async (argv, env) => {
26
- const legacy = resolveHome({ purpose: 'cli', env, layout: 'legacy' }), target = resolveHome({ purpose: 'cli', env, layout: 'split' });
27
- return (await import('./server-install/migrate-cli.js')).runServerMigrateCommand(argv, env, { legacy, target });
28
- };
29
- case 'backup': return async (argv, env) => {
30
- const selected = operatorHelp('backup', argv) ? resolveHome({ purpose: 'cli', env }) : home(env);
31
- const source = selected.layout === 'split' && argv[0] === 'list' && !hasInstallMarker(selected.config)
32
- ? resolveHome({ purpose: 'cli', env, layout: 'legacy' }) : selected;
33
- return (await import('./workspace/backup-cli.js')).runBackupCommand(argv, env, source, { contained: source !== selected });
34
- };
35
- case 'discover': return (await import('./discovery/cli.js')).runDiscoverCommand;
36
- case 'artifact': return (await import('./artifacts/cli.js')).runArtifactCommand;
37
- case 'job': return (await import('./jobs/cli.js')).runJobCommand;
38
- case 'task': return (await import('./task-cli/cli.js')).runTaskCommand;
39
- case 'automation': return (await import('./automations/automation-cli.js')).runAutomationCommand;
40
- case 'webhook': return (await import('./webhooks/cli.js')).runWebhookCommand;
41
- case 'message': return (await import('./delegation/cli.js')).runMessageCommand;
42
- case 'worker': return (await import('./delegation/cli.js')).runWorkerCommand;
43
- case 'remote-settings': return async (argv, env) => {
44
- return (await import('./remote-settings-cli.js')).runRemoteSettingsCommand(argv, env, undefined, operatorHelp('remote-settings', argv)
45
- ? resolveHome({ purpose: 'cli', env }) : home(env));
46
- };
47
- default: return undefined;
48
- }
4
+ const command = cliCommand(name ?? '');
5
+ return command?.parseMode === 'subcommand' ? command.load(home) : undefined;
49
6
  }
50
- /** Run `argv[0]` when it names a subcommand and answer its exit code; anything else is not ours. */
51
7
  export async function runSubcommand(argv, env, home = () => resolveHome({ purpose: 'cli', env })) {
52
- if (SUBCOMMAND_NAMES.some(name => name === argv[0]))
53
- await prepareCommandRuntime(argv[0], argv.slice(1));
54
- // Only operator runners call the lazy Home factory. Task runners keep two arguments.
55
- const run = await loadSubcommand(argv[0], () => home());
56
- return run ? run(argv.slice(1), env) : undefined;
8
+ const command = cliCommand(argv[0] ?? '');
9
+ if (command?.parseMode !== 'subcommand')
10
+ return undefined;
11
+ await prepareCommandRuntime(command.name, argv.slice(1));
12
+ const run = await loadSubcommand(command.name, () => home());
13
+ return run(argv.slice(1), env);
57
14
  }
58
15
  /** Install process services before loading commands that read runner or removal registries. */
59
16
  export async function prepareCommandRuntime(command, argv = []) {
60
- const help = argv.some(arg => arg === '--help' || arg === '-h');
61
- const worker = command === 'worker' && (argv.length === 0 || help || argv[0] === 'help' || argv[0] === 'spawn');
62
- const operator = command === 'backup' || command === 'remote-settings';
63
- const operatorRuntime = operator && !operatorHelp(command, argv);
64
- if (!worker && !operatorRuntime && !['serve', 'run', 'init', 'projects', 'server-install', 'server-deploy', 'server-uninstall',
65
- 'migrate', 'server-migrate', 'migrate-project', 'discover', 'task'].includes(command))
17
+ const definition = cliCommand(command);
18
+ if (!definition || definition.runtimeMode === 'none' || (typeof definition.runtimeMode === 'function' && !definition.runtimeMode(argv)))
66
19
  return;
67
20
  const { registerBuiltInRunners, sealBuiltInRunners } = await import('./runners/built-in.js');
68
21
  registerBuiltInRunners();
@@ -74,8 +27,4 @@ export async function prepareCommandRuntime(command, argv = []) {
74
27
  registerBuiltInStepKinds();
75
28
  sealBuiltInStepKinds();
76
29
  }
77
- /** Help must skip both runtime registration and the migrating operator Home factory. */
78
- function operatorHelp(command, argv) {
79
- return ['--help', '-h', ...(command === 'remote-settings' ? ['help'] : [])].includes(argv[0] ?? '');
80
- }
81
30
  //# sourceMappingURL=subcommands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subcommands.js","sourceRoot":"","sources":["../src/subcommands.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,CAAU,CAAC;AAE5M,kGAAkG;AAClG,SAAS,gBAAgB,CAAC,IAAY;IACpC,IAAI,CAAC;QAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;AAC9E,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAwB,EAA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AC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7D,OAAO,GAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,+FAA+F;AAC/F,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAe,EAAE,IAAI,GAAsB,EAAE;IACvF,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,WAAW,KAAK,MAAM,IAAI,CAAC,OAAO,UAAU,CAAC,WAAW,KAAK,UAAU,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO;IAChJ,MAAM,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAC7F,sBAAsB,EAAE,CAAC;IACzB,kBAAkB,EAAE,CAAC;IACrB,MAAM,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC;IACjG,uBAAuB,EAAE,CAAC;IAC1B,mBAAmB,EAAE,CAAC;IACtB,MAAM,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,GAAG,MAAM,MAAM,CAAC,mCAAmC,CAAC,CAAC;IAC7G,wBAAwB,EAAE,CAAC;IAC3B,oBAAoB,EAAE,CAAC;AACzB,CAAC"}
@@ -296,6 +296,30 @@ export declare class ContinuationChecks {
296
296
  deadline: string;
297
297
  seconds: number;
298
298
  note?: string | undefined;
299
+ } | {
300
+ id: string;
301
+ source: "agent" | "cezar";
302
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
303
+ registeredAt: string;
304
+ phase: "cancelled" | "delivered" | "open" | "resolved";
305
+ resolvedAt?: string | undefined;
306
+ deliveredAt?: string | undefined;
307
+ cancelledAt?: string | undefined;
308
+ turnId: string;
309
+ kind: "process";
310
+ deadline: string;
311
+ timeoutSeconds: number;
312
+ pid: number;
313
+ startToken?: string | undefined;
314
+ exitFile?: string | undefined;
315
+ note?: string | undefined;
316
+ result?: {
317
+ outcome: "deadline" | "error" | "exit_file" | "exited";
318
+ observedAt: string;
319
+ exitCode?: number | undefined;
320
+ exitFileNote?: "not-an-exit-code" | undefined;
321
+ diagnostic?: string | undefined;
322
+ } | undefined;
299
323
  } | {
300
324
  id: string;
301
325
  source: "agent" | "cezar";
@@ -357,30 +381,6 @@ export declare class ContinuationChecks {
357
381
  reason: "outcome" | "timeout";
358
382
  } | undefined;
359
383
  wakeInputId?: string | undefined;
360
- } | {
361
- id: string;
362
- source: "agent" | "cezar";
363
- via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
364
- registeredAt: string;
365
- phase: "cancelled" | "delivered" | "open" | "resolved";
366
- resolvedAt?: string | undefined;
367
- deliveredAt?: string | undefined;
368
- cancelledAt?: string | undefined;
369
- turnId: string;
370
- kind: "process";
371
- deadline: string;
372
- timeoutSeconds: number;
373
- pid: number;
374
- startToken?: string | undefined;
375
- exitFile?: string | undefined;
376
- note?: string | undefined;
377
- result?: {
378
- outcome: "deadline" | "error" | "exit_file" | "exited";
379
- observedAt: string;
380
- exitCode?: number | undefined;
381
- exitFileNote?: "not-an-exit-code" | undefined;
382
- diagnostic?: string | undefined;
383
- } | undefined;
384
384
  } | {
385
385
  id: string;
386
386
  source: "agent" | "cezar";
@@ -508,6 +508,30 @@ export declare class ContinuationChecks {
508
508
  deadline: string;
509
509
  seconds: number;
510
510
  note?: string | undefined;
511
+ } | {
512
+ id: string;
513
+ source: "agent" | "cezar";
514
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
515
+ registeredAt: string;
516
+ phase: "cancelled" | "delivered" | "open" | "resolved";
517
+ resolvedAt?: string | undefined;
518
+ deliveredAt?: string | undefined;
519
+ cancelledAt?: string | undefined;
520
+ turnId: string;
521
+ kind: "process";
522
+ deadline: string;
523
+ timeoutSeconds: number;
524
+ pid: number;
525
+ startToken?: string | undefined;
526
+ exitFile?: string | undefined;
527
+ note?: string | undefined;
528
+ result?: {
529
+ outcome: "deadline" | "error" | "exit_file" | "exited";
530
+ observedAt: string;
531
+ exitCode?: number | undefined;
532
+ exitFileNote?: "not-an-exit-code" | undefined;
533
+ diagnostic?: string | undefined;
534
+ } | undefined;
511
535
  } | {
512
536
  id: string;
513
537
  source: "agent" | "cezar";
@@ -569,30 +593,6 @@ export declare class ContinuationChecks {
569
593
  reason: "outcome" | "timeout";
570
594
  } | undefined;
571
595
  wakeInputId?: string | undefined;
572
- } | {
573
- id: string;
574
- source: "agent" | "cezar";
575
- via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
576
- registeredAt: string;
577
- phase: "cancelled" | "delivered" | "open" | "resolved";
578
- resolvedAt?: string | undefined;
579
- deliveredAt?: string | undefined;
580
- cancelledAt?: string | undefined;
581
- turnId: string;
582
- kind: "process";
583
- deadline: string;
584
- timeoutSeconds: number;
585
- pid: number;
586
- startToken?: string | undefined;
587
- exitFile?: string | undefined;
588
- note?: string | undefined;
589
- result?: {
590
- outcome: "deadline" | "error" | "exit_file" | "exited";
591
- observedAt: string;
592
- exitCode?: number | undefined;
593
- exitFileNote?: "not-an-exit-code" | undefined;
594
- diagnostic?: string | undefined;
595
- } | undefined;
596
596
  } | {
597
597
  id: string;
598
598
  source: "agent" | "cezar";
@@ -719,6 +719,30 @@ export declare class ContinuationChecks {
719
719
  deadline: string;
720
720
  seconds: number;
721
721
  note?: string | undefined;
722
+ } | {
723
+ id: string;
724
+ source: "agent" | "cezar";
725
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
726
+ registeredAt: string;
727
+ phase: "cancelled" | "delivered" | "open" | "resolved";
728
+ resolvedAt?: string | undefined;
729
+ deliveredAt?: string | undefined;
730
+ cancelledAt?: string | undefined;
731
+ turnId: string;
732
+ kind: "process";
733
+ deadline: string;
734
+ timeoutSeconds: number;
735
+ pid: number;
736
+ startToken?: string | undefined;
737
+ exitFile?: string | undefined;
738
+ note?: string | undefined;
739
+ result?: {
740
+ outcome: "deadline" | "error" | "exit_file" | "exited";
741
+ observedAt: string;
742
+ exitCode?: number | undefined;
743
+ exitFileNote?: "not-an-exit-code" | undefined;
744
+ diagnostic?: string | undefined;
745
+ } | undefined;
722
746
  } | {
723
747
  id: string;
724
748
  source: "agent" | "cezar";
@@ -780,30 +804,6 @@ export declare class ContinuationChecks {
780
804
  reason: "outcome" | "timeout";
781
805
  } | undefined;
782
806
  wakeInputId?: string | undefined;
783
- } | {
784
- id: string;
785
- source: "agent" | "cezar";
786
- via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
787
- registeredAt: string;
788
- phase: "cancelled" | "delivered" | "open" | "resolved";
789
- resolvedAt?: string | undefined;
790
- deliveredAt?: string | undefined;
791
- cancelledAt?: string | undefined;
792
- turnId: string;
793
- kind: "process";
794
- deadline: string;
795
- timeoutSeconds: number;
796
- pid: number;
797
- startToken?: string | undefined;
798
- exitFile?: string | undefined;
799
- note?: string | undefined;
800
- result?: {
801
- outcome: "deadline" | "error" | "exit_file" | "exited";
802
- observedAt: string;
803
- exitCode?: number | undefined;
804
- exitFileNote?: "not-an-exit-code" | undefined;
805
- diagnostic?: string | undefined;
806
- } | undefined;
807
807
  } | {
808
808
  id: string;
809
809
  source: "agent" | "cezar";
@@ -6,24 +6,7 @@ export interface BackupEntry {
6
6
  time: string;
7
7
  path: string;
8
8
  }
9
- export declare function isBackupFile(value: string): value is BackupFile;
10
- /** The newest allowed backup time for `--at`; NaN when the value is not an ISO UTC time. */
11
- export declare function restoreLimit(at: string | undefined): number;
12
- /** The one parser for `backup` arguments: the command and its home entry read the same options. */
13
- export declare function parseBackupArgs(argv: readonly string[]): {
14
- values: {
15
- at?: string;
16
- help?: boolean;
17
- };
18
- positionals: string[];
19
- };
20
- /** `restore <file> [--at <time>]` with one supported file and no help; anything else is not a restore. */
21
- export declare function restoreRequest({ values, positionals }: ReturnType<typeof parseBackupArgs>): {
22
- file: BackupFile;
23
- at: string | undefined;
24
- } | undefined;
25
- /** A restore that will run: its arguments parse and its time is valid. Anything else is help or a usage error. */
26
- export declare function isValidRestore(argv: readonly string[]): boolean;
9
+ export { isBackupFile, restoreLimit, parseBackupArgs, restoreRequest, isValidRestore } from '../home/backup-args.ts';
27
10
  /** `contained` lists a home this command does not own: every read must stay inside its root. */
28
11
  export declare function listBackups(file: BackupFile | undefined, home: string | Home, { contained }?: {
29
12
  contained?: boolean | undefined;
@@ -1,44 +1,12 @@
1
1
  import { createHash, randomUUID } from 'node:crypto';
2
2
  import { linkSync, mkdirSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
3
3
  import { basename, dirname, join } from 'node:path';
4
- import { parseArgs } from 'node:util';
5
4
  import { assertSquawkHomeWriteIsSandboxed } from '../paths.js';
6
5
  import { assertHomePaths } from '../home/boundary.js';
7
- import { homeFileSchema } from '../contract/index.js';
8
6
  import { homeFileLocation, homePathLocation } from '../home/file-location.js';
9
7
  export const BACKUP_FILES = ['config.json', 'config.json.bak', 'agent-accounts.json', 'ui-state.json', 'server.json', 'server.install.lock'];
10
- export function isBackupFile(value) {
11
- return homeFileSchema.safeParse(value).success;
12
- }
13
- /** The newest allowed backup time for `--at`; NaN when the value is not an ISO UTC time. */
14
- export function restoreLimit(at) {
15
- if (at === undefined)
16
- return Infinity;
17
- return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/.test(at) ? Date.parse(at) : NaN;
18
- }
19
- /** The one parser for `backup` arguments: the command and its home entry read the same options. */
20
- export function parseBackupArgs(argv) {
21
- return parseArgs({ args: [...argv], allowPositionals: true, options: {
22
- at: { type: 'string' }, help: { type: 'boolean', short: 'h' },
23
- } });
24
- }
25
- /** `restore <file> [--at <time>]` with one supported file and no help; anything else is not a restore. */
26
- export function restoreRequest({ values, positionals }) {
27
- const [command, file] = positionals;
28
- if (values.help || command !== 'restore' || positionals.length !== 2 || file === undefined || !isBackupFile(file))
29
- return undefined;
30
- return { file, at: values.at };
31
- }
32
- /** A restore that will run: its arguments parse and its time is valid. Anything else is help or a usage error. */
33
- export function isValidRestore(argv) {
34
- try {
35
- const request = restoreRequest(parseBackupArgs(argv));
36
- return request !== undefined && !Number.isNaN(restoreLimit(request.at));
37
- }
38
- catch {
39
- return false;
40
- }
41
- }
8
+ export { isBackupFile, restoreLimit, parseBackupArgs, restoreRequest, isValidRestore } from '../home/backup-args.js';
9
+ import { isBackupFile } from '../home/backup-args.js';
42
10
  function backupRoot(home) {
43
11
  return typeof home === 'string' ? join(home, 'backups') : home.backups;
44
12
  }