@hearsay-tools/squawk 0.18.0-pr3322.5828.2 → 0.18.0-pr3328.5835.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/automations/automation-cli.js +5 -0
  2. package/dist/automations/automation-cli.js.map +1 -1
  3. package/dist/automations/github-baseline.js +2 -0
  4. package/dist/automations/github-baseline.js.map +1 -1
  5. package/dist/automations/github-repository.d.ts +22 -0
  6. package/dist/automations/github-repository.js +40 -0
  7. package/dist/automations/github-repository.js.map +1 -0
  8. package/dist/automations/scheduler.d.ts +2 -3
  9. package/dist/automations/scheduler.js +31 -11
  10. package/dist/automations/scheduler.js.map +1 -1
  11. package/dist/automations/service.d.ts +4 -0
  12. package/dist/automations/task-template.js +12 -2
  13. package/dist/automations/task-template.js.map +1 -1
  14. package/dist/ci-wait/controller.d.ts +41 -41
  15. package/dist/ci-wait/tools.d.ts +4 -4
  16. package/dist/contract/automation-storage.d.ts +4 -0
  17. package/dist/contract/automations.d.ts +26 -0
  18. package/dist/contract/index.js +22 -0
  19. package/dist/delegation/routes.d.ts +13 -13
  20. package/dist/delegation/transport.d.ts +9 -9
  21. package/dist/server/forge/github-cli.d.ts +14 -0
  22. package/dist/server/forge/github-cli.js +25 -0
  23. package/dist/server/forge/github-cli.js.map +1 -0
  24. package/dist/server/forge/github-repo-handle.d.ts +42 -0
  25. package/dist/server/forge/github-repo-handle.js +160 -0
  26. package/dist/server/forge/github-repo-handle.js.map +1 -0
  27. package/dist/server/forge/github.d.ts +11 -17
  28. package/dist/server/forge/github.js +22 -139
  29. package/dist/server/forge/github.js.map +1 -1
  30. package/dist/server/live-routes.d.ts +6 -6
  31. package/dist/server/server.d.ts +1546 -1538
  32. package/dist/server/server.js +7 -11
  33. package/dist/server/server.js.map +1 -1
  34. package/dist/voice/routes.d.ts +19 -19
  35. package/dist/workflows/run/wait-engine.d.ts +72 -72
  36. package/package.json +4 -4
  37. package/web/dist/assets/{activity-motion-2nE59DAT.js → activity-motion-BdGFmrw-.js} +1 -1
  38. package/web/dist/assets/{activity-route-R9lPc2jy.js → activity-route-1OFUVP3A.js} +1 -1
  39. package/web/dist/assets/{commit-diff-panel-BJyNYmCY.js → commit-diff-panel-BiNPMHC6.js} +1 -1
  40. package/web/dist/assets/{diff-D_9MtICR.js → diff-BHwQUS2W.js} +2 -2
  41. package/web/dist/assets/{diff-view-xRPxXHXl.js → diff-view-BBhxSIlf.js} +1 -1
  42. package/web/dist/assets/{git-toolbar-D9taioU5.js → git-toolbar-BnOaO_OH.js} +1 -1
  43. package/web/dist/assets/{github-bv_pBGc5.js → github-CXc8nroh.js} +1 -1
  44. package/web/dist/assets/{global-activity-route-QxTPDyx-.js → global-activity-route-Dt83uvZc.js} +1 -1
  45. package/web/dist/assets/{index-DgU3yYUl.js → index-B5LayM4y.js} +6 -6
  46. package/web/dist/assets/{preview-pane-connected-cD-MTiVN.js → preview-pane-connected-JHeCgq7I.js} +1 -1
  47. package/web/dist/assets/{repo-git-E_4Ighvg.js → repo-git-wEXDON29.js} +1 -1
  48. package/web/dist/assets/{report-reader-XVNQsXB4.js → report-reader-DJ_0htSx.js} +1 -1
  49. package/web/dist/assets/{reports-B_PVTBzP.js → reports-BIXmTBFJ.js} +1 -1
  50. package/web/dist/assets/{run-header-wm0gSs6X.js → run-header-Bgtlx-vc.js} +1 -1
  51. package/web/dist/assets/{skills-D2RLxUIc.js → skills-BJ2nSfyr.js} +1 -1
  52. package/web/dist/assets/{task-changes-DNtkfFzQ.js → task-changes-Dz0udwrE.js} +1 -1
  53. package/web/dist/assets/{task-commits-CivO-OrN.js → task-commits-5uILgm5M.js} +1 -1
  54. package/web/dist/assets/{task-files-dczkxV_G.js → task-files-DGZjTKSS.js} +1 -1
  55. package/web/dist/assets/{task-github-item-DKV4yrcf.js → task-github-item-npfGLu9C.js} +1 -1
  56. package/web/dist/assets/{task-thread-DIaTTGEF.js → task-thread-DnpkXb5P.js} +1 -1
  57. package/web/dist/assets/{thread-state-DIozHuHb.js → thread-state-BfrO2t7g.js} +1 -1
  58. package/web/dist/assets/{use-hand-to-agent-state-D58ayxI4.js → use-hand-to-agent-state-DyVB4IBv.js} +1 -1
  59. package/web/dist/assets/{workflows-YMEsGXeB.js → workflows-ByduCwgu.js} +1 -1
  60. package/web/dist/index.html +1 -1
@@ -288,12 +288,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
288
288
  "/api/v1/tools/ask": {
289
289
  $post: {
290
290
  output: {
291
- ok: false;
292
- code: 'unavailable';
291
+ code: 'capability_revoked';
293
292
  message: string;
294
293
  };
295
294
  outputFormat: "json";
296
- status: import("hono/utils/http-status").ContentfulStatusCode;
295
+ status: 401;
297
296
  input: {
298
297
  json: {
299
298
  questions: {
@@ -311,11 +310,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
311
310
  };
312
311
  } | {
313
312
  output: {
314
- code: 'capability_revoked';
313
+ ok: false;
314
+ code: 'unavailable';
315
315
  message: string;
316
316
  };
317
317
  outputFormat: "json";
318
- status: 401;
318
+ status: import("hono/utils/http-status").ContentfulStatusCode;
319
319
  input: {
320
320
  json: {
321
321
  questions: {
@@ -383,12 +383,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
383
383
  "/api/v1/tools/cancel-wait": {
384
384
  $post: {
385
385
  output: {
386
- cancelled: false;
387
- code: 'unavailable';
386
+ code: 'capability_revoked';
388
387
  message: string;
389
388
  };
390
389
  outputFormat: "json";
391
- status: import("hono/utils/http-status").ContentfulStatusCode;
390
+ status: 401;
392
391
  input: {
393
392
  json: {
394
393
  wait_id: string;
@@ -396,11 +395,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
396
395
  };
397
396
  } | {
398
397
  output: {
399
- code: 'capability_revoked';
398
+ cancelled: false;
399
+ code: 'unavailable';
400
400
  message: string;
401
401
  };
402
402
  outputFormat: "json";
403
- status: 401;
403
+ status: import("hono/utils/http-status").ContentfulStatusCode;
404
404
  input: {
405
405
  json: {
406
406
  wait_id: string;
@@ -448,12 +448,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
448
448
  "/api/v1/tools/done": {
449
449
  $post: {
450
450
  output: {
451
- ok: false;
452
- code: 'unavailable';
451
+ code: 'capability_revoked';
453
452
  message: string;
454
453
  };
455
454
  outputFormat: "json";
456
- status: import("hono/utils/http-status").ContentfulStatusCode;
455
+ status: 401;
457
456
  input: {
458
457
  json: {
459
458
  summary?: string | undefined;
@@ -461,11 +460,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
461
460
  };
462
461
  } | {
463
462
  output: {
464
- code: 'capability_revoked';
463
+ ok: false;
464
+ code: 'unavailable';
465
465
  message: string;
466
466
  };
467
467
  outputFormat: "json";
468
- status: 401;
468
+ status: import("hono/utils/http-status").ContentfulStatusCode;
469
469
  input: {
470
470
  json: {
471
471
  summary?: string | undefined;
@@ -533,13 +533,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
533
533
  "/api/v1/tools/preview-stop": {
534
534
  $post: {
535
535
  output: {
536
- ok: boolean;
537
- code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
536
+ code: 'capability_revoked';
538
537
  message: string;
539
- hint: string;
540
538
  };
541
539
  outputFormat: "json";
542
- status: import("hono/utils/http-status").ContentfulStatusCode;
540
+ status: 401;
543
541
  input: {
544
542
  json: {
545
543
  port: number;
@@ -548,11 +546,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
548
546
  };
549
547
  } | {
550
548
  output: {
551
- code: 'capability_revoked';
549
+ ok: boolean;
550
+ code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
552
551
  message: string;
552
+ hint: string;
553
553
  };
554
554
  outputFormat: "json";
555
- status: 401;
555
+ status: import("hono/utils/http-status").ContentfulStatusCode;
556
556
  input: {
557
557
  json: {
558
558
  port: number;
@@ -565,13 +565,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
565
565
  "/api/v1/tools/preview-serve": {
566
566
  $post: {
567
567
  output: {
568
- ok: boolean;
569
- code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
568
+ code: 'capability_revoked';
570
569
  message: string;
571
- hint: string;
572
570
  };
573
571
  outputFormat: "json";
574
- status: import("hono/utils/http-status").ContentfulStatusCode;
572
+ status: 401;
575
573
  input: {
576
574
  json: {
577
575
  command: string;
@@ -583,11 +581,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
583
581
  };
584
582
  } | {
585
583
  output: {
586
- code: 'capability_revoked';
584
+ ok: boolean;
585
+ code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
587
586
  message: string;
587
+ hint: string;
588
588
  };
589
589
  outputFormat: "json";
590
- status: 401;
590
+ status: import("hono/utils/http-status").ContentfulStatusCode;
591
591
  input: {
592
592
  json: {
593
593
  command: string;
@@ -603,12 +603,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
603
603
  "/api/v1/tools/schedule-task": {
604
604
  $post: {
605
605
  output: {
606
- ok: false;
607
- code: import('../contract/index.js').ScheduledTaskRefusalCode;
606
+ code: 'capability_revoked';
608
607
  message: string;
609
608
  };
610
609
  outputFormat: "json";
611
- status: import("hono/utils/http-status").ContentfulStatusCode;
610
+ status: 401;
612
611
  input: {
613
612
  json: {
614
613
  at?: string | undefined;
@@ -625,11 +624,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
625
624
  };
626
625
  } | {
627
626
  output: {
628
- code: 'capability_revoked';
627
+ ok: false;
628
+ code: import('../contract/index.js').ScheduledTaskRefusalCode;
629
629
  message: string;
630
630
  };
631
631
  outputFormat: "json";
632
- status: 401;
632
+ status: import("hono/utils/http-status").ContentfulStatusCode;
633
633
  input: {
634
634
  json: {
635
635
  at?: string | undefined;
@@ -646,6 +646,10 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
646
646
  };
647
647
  } | {
648
648
  output: {
649
+ ok: false;
650
+ code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
651
+ message: string;
652
+ } | {
649
653
  ok: true;
650
654
  task: {
651
655
  id: string;
@@ -657,10 +661,6 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
657
661
  url?: string | undefined;
658
662
  };
659
663
  note: string;
660
- } | {
661
- ok: false;
662
- code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
663
- message: string;
664
664
  };
665
665
  outputFormat: "json";
666
666
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -684,12 +684,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
684
684
  "/api/v1/tools/scheduled-tasks": {
685
685
  $post: {
686
686
  output: {
687
- ok: false;
688
- code: import('../contract/index.js').ScheduledTaskRefusalCode;
687
+ code: 'capability_revoked';
689
688
  message: string;
690
689
  };
691
690
  outputFormat: "json";
692
- status: import("hono/utils/http-status").ContentfulStatusCode;
691
+ status: 401;
693
692
  input: {
694
693
  json: {
695
694
  at?: string | undefined;
@@ -722,11 +721,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
722
721
  };
723
722
  } | {
724
723
  output: {
725
- code: 'capability_revoked';
724
+ ok: false;
725
+ code: import('../contract/index.js').ScheduledTaskRefusalCode;
726
726
  message: string;
727
727
  };
728
728
  outputFormat: "json";
729
- status: 401;
729
+ status: import("hono/utils/http-status").ContentfulStatusCode;
730
730
  input: {
731
731
  json: {
732
732
  at?: string | undefined;
@@ -783,6 +783,10 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
783
783
  }[];
784
784
  isError: boolean;
785
785
  details: {
786
+ ok: false;
787
+ code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
788
+ message: string;
789
+ } | {
786
790
  ok: true;
787
791
  task: {
788
792
  id: string;
@@ -794,10 +798,6 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
794
798
  url?: string | undefined;
795
799
  };
796
800
  note: string;
797
- } | {
798
- ok: false;
799
- code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
800
- message: string;
801
801
  };
802
802
  }>;
803
803
  export declare function invokeScheduledTasksTool(input: unknown): Promise<{
@@ -309,6 +309,8 @@ export declare const storedAutomationHistoryScanSchema: z.ZodObject<{
309
309
  }, z.core.$loose>>;
310
310
  }, z.core.$strip>;
311
311
  export declare const storedAutomationRuntimeStateSchema: z.ZodObject<{
312
+ lastError: z.ZodOptional<z.ZodString>;
313
+ lastErrorAt: z.ZodOptional<z.ZodString>;
312
314
  revision: z.ZodOptional<z.ZodNumber>;
313
315
  baselineAt: z.ZodOptional<z.ZodString>;
314
316
  armedAt: z.ZodOptional<z.ZodString>;
@@ -351,6 +353,8 @@ export declare const storedAutomationRuntimeStateSchema: z.ZodObject<{
351
353
  export declare const storedAutomationStateFileSchema: z.ZodObject<{
352
354
  version: z.ZodDefault<z.ZodLiteral<1>>;
353
355
  states: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
356
+ lastError: z.ZodOptional<z.ZodString>;
357
+ lastErrorAt: z.ZodOptional<z.ZodString>;
354
358
  revision: z.ZodOptional<z.ZodNumber>;
355
359
  baselineAt: z.ZodOptional<z.ZodString>;
356
360
  armedAt: z.ZodOptional<z.ZodString>;
@@ -269,7 +269,16 @@ export declare const automationHistoryScanSchema: z.ZodObject<{
269
269
  tieBreaker: z.ZodOptional<z.ZodString>;
270
270
  }, z.core.$strip>>;
271
271
  }, z.core.$strip>;
272
+ /** The longest `lastError` the scheduler stores. */
273
+ export declare const AUTOMATION_LAST_ERROR_MAX = 1000;
274
+ /** `github` kind: the error of the last failed check and when it failed, until a check succeeds. */
275
+ export declare const automationLastErrorShape: {
276
+ lastError: z.ZodOptional<z.ZodString>;
277
+ lastErrorAt: z.ZodOptional<z.ZodString>;
278
+ };
272
279
  export declare const automationRuntimeStateSchema: z.ZodObject<{
280
+ lastError: z.ZodOptional<z.ZodString>;
281
+ lastErrorAt: z.ZodOptional<z.ZodString>;
273
282
  revision: z.ZodOptional<z.ZodNumber>;
274
283
  baselineAt: z.ZodOptional<z.ZodString>;
275
284
  armedAt: z.ZodOptional<z.ZodString>;
@@ -310,6 +319,17 @@ export declare const automationRuntimeStateSchema: z.ZodObject<{
310
319
  }>>;
311
320
  }, z.core.$strip>;
312
321
  export type AutomationRuntimeState = z.infer<typeof automationRuntimeStateSchema>;
322
+ /** Consecutive failed checks after which the cockpit and `hsq automation list` show the error. */
323
+ export declare const AUTOMATION_FAILURE_NOTICE_AFTER = 3;
324
+ export interface AutomationFailureNotice {
325
+ consecutiveFailures: number;
326
+ lastError: string;
327
+ lastErrorAt?: string;
328
+ /** When the scheduler tries again. */
329
+ retryAt?: string;
330
+ }
331
+ /** The failure a GitHub automation shows, or undefined while fewer checks than the threshold failed in a row. */
332
+ export declare function automationFailureNotice(state: AutomationRuntimeState | undefined): AutomationFailureNotice | undefined;
313
333
  /** What one poll decided about one candidate. `baseline` and `preview` are bookkeeping rows: no
314
334
  * task was launched and none was meant to be. */
315
335
  export declare const automationLogResultSchema: z.ZodEnum<{
@@ -490,6 +510,8 @@ export declare const automationListEntrySchema: z.ZodObject<{
490
510
  createdAt: z.ZodString;
491
511
  updatedAt: z.ZodString;
492
512
  state: z.ZodOptional<z.ZodObject<{
513
+ lastError: z.ZodOptional<z.ZodString>;
514
+ lastErrorAt: z.ZodOptional<z.ZodString>;
493
515
  revision: z.ZodOptional<z.ZodNumber>;
494
516
  baselineAt: z.ZodOptional<z.ZodString>;
495
517
  armedAt: z.ZodOptional<z.ZodString>;
@@ -717,6 +739,8 @@ export declare const automationsResponseSchema: z.ZodObject<{
717
739
  createdAt: z.ZodString;
718
740
  updatedAt: z.ZodString;
719
741
  state: z.ZodOptional<z.ZodObject<{
742
+ lastError: z.ZodOptional<z.ZodString>;
743
+ lastErrorAt: z.ZodOptional<z.ZodString>;
720
744
  revision: z.ZodOptional<z.ZodNumber>;
721
745
  baselineAt: z.ZodOptional<z.ZodString>;
722
746
  armedAt: z.ZodOptional<z.ZodString>;
@@ -1167,6 +1191,8 @@ export declare const automationDetailResponseSchema: z.ZodObject<{
1167
1191
  updatedAt: z.ZodString;
1168
1192
  }, z.core.$strip>;
1169
1193
  state: z.ZodOptional<z.ZodObject<{
1194
+ lastError: z.ZodOptional<z.ZodString>;
1195
+ lastErrorAt: z.ZodOptional<z.ZodString>;
1170
1196
  revision: z.ZodOptional<z.ZodNumber>;
1171
1197
  baselineAt: z.ZodOptional<z.ZodString>;
1172
1198
  armedAt: z.ZodOptional<z.ZodString>;
@@ -4280,6 +4280,11 @@ var automationHistoryScanSchema = z28.object({
4280
4280
  event: z28.number().int().min(0).max(1e3),
4281
4281
  cursor: automationCursorSchema.optional()
4282
4282
  });
4283
+ var AUTOMATION_LAST_ERROR_MAX = 1e3;
4284
+ var automationLastErrorShape = {
4285
+ lastError: z28.string().max(AUTOMATION_LAST_ERROR_MAX).optional(),
4286
+ lastErrorAt: z28.string().datetime().optional()
4287
+ };
4283
4288
  var automationRuntimeStateSchema = z28.object({
4284
4289
  /** The definition revision this state belongs to; activation or history-policy changes re-arm. */
4285
4290
  revision: z28.number().optional(),
@@ -4300,9 +4305,21 @@ var automationRuntimeStateSchema = z28.object({
4300
4305
  etags: z28.record(z28.string(), z28.string()).optional(),
4301
4306
  backoffUntil: z28.string().optional(),
4302
4307
  consecutiveFailures: z28.number().optional(),
4308
+ ...automationLastErrorShape,
4303
4309
  /** `once` schedules: why it stopped without a task — its launch failed, or it started past its cutoff. */
4304
4310
  onceOutcome: z28.enum(["failed", "missed"]).optional()
4305
4311
  });
4312
+ var AUTOMATION_FAILURE_NOTICE_AFTER = 3;
4313
+ function automationFailureNotice(state) {
4314
+ const failures = state?.consecutiveFailures ?? 0;
4315
+ if (failures < AUTOMATION_FAILURE_NOTICE_AFTER || !state?.lastError) return void 0;
4316
+ return {
4317
+ consecutiveFailures: failures,
4318
+ lastError: state.lastError,
4319
+ ...state.lastErrorAt ? { lastErrorAt: state.lastErrorAt } : {},
4320
+ ...state.backoffUntil ? { retryAt: state.backoffUntil } : {}
4321
+ };
4322
+ }
4306
4323
  var automationLogResultSchema = z28.enum([
4307
4324
  "launched",
4308
4325
  "no-match",
@@ -5538,6 +5555,7 @@ var storedAutomationRuntimeStateSchema = z39.object({
5538
5555
  etags: z39.record(z39.string(), z39.string()).optional(),
5539
5556
  backoffUntil: z39.string().datetime().optional(),
5540
5557
  consecutiveFailures: z39.number().int().nonnegative().optional(),
5558
+ ...automationLastErrorShape,
5541
5559
  /** once schedule: it stopped without a task — the launch failed, or it started past its cutoff. */
5542
5560
  onceOutcome: z39.enum(["failed", "missed"]).optional()
5543
5561
  }).passthrough();
@@ -5992,6 +6010,8 @@ export {
5992
6010
  ASK_LIMITS,
5993
6011
  ATTENTION_RANK,
5994
6012
  ATTENTION_RUNGS,
6013
+ AUTOMATION_FAILURE_NOTICE_AFTER,
6014
+ AUTOMATION_LAST_ERROR_MAX,
5995
6015
  CI_WAIT_LIMITATION,
5996
6016
  CI_WAIT_RECEIPT_INSTRUCTION,
5997
6017
  CONTROL_LOCATIONS,
@@ -6152,10 +6172,12 @@ export {
6152
6172
  automationDetailResponseSchema,
6153
6173
  automationEditableSchema,
6154
6174
  automationEventSchema,
6175
+ automationFailureNotice,
6155
6176
  automationFiltersSchema,
6156
6177
  automationHistoryScanSchema,
6157
6178
  automationIdOf,
6158
6179
  automationKindSchema,
6180
+ automationLastErrorShape,
6159
6181
  automationListEntrySchema,
6160
6182
  automationListQuerySchema,
6161
6183
  automationLogQuerySchema,
@@ -82,15 +82,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
82
82
  "/discover": {
83
83
  $post: {
84
84
  output: {
85
- scope: "host-default-account";
86
- runners: {
87
- status: "connected" | "disconnected" | "not-installed" | "unknown";
88
- enabled?: boolean | undefined;
89
- hint?: string | undefined;
90
- authFailureId?: string | undefined;
91
- runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
92
- }[];
93
- } | {
94
85
  tasks: {
95
86
  id: string;
96
87
  title: string;
@@ -102,6 +93,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
102
93
  reason?: string | undefined;
103
94
  }[];
104
95
  nextOffset?: number | undefined;
96
+ } | {
97
+ scope: "host-default-account";
98
+ runners: {
99
+ status: "connected" | "disconnected" | "not-installed" | "unknown";
100
+ enabled?: boolean | undefined;
101
+ hint?: string | undefined;
102
+ authFailureId?: string | undefined;
103
+ runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
104
+ }[];
105
105
  } | {
106
106
  runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
107
107
  models: {
@@ -221,13 +221,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
221
221
  status: 200;
222
222
  input: {
223
223
  json: {
224
- requestIds: string[];
225
- mode?: "all" | "any" | "one" | undefined;
226
- timeoutSeconds?: number | undefined;
227
- } | {
228
224
  workerIds: string[];
229
225
  timeoutSeconds?: number | undefined;
230
226
  mode?: "all" | "any" | "one" | undefined;
227
+ } | {
228
+ requestIds: string[];
229
+ mode?: "all" | "any" | "one" | undefined;
230
+ timeoutSeconds?: number | undefined;
231
231
  } | {
232
232
  peerIds: string[];
233
233
  timeoutSeconds?: number | undefined;
@@ -57,6 +57,15 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
57
57
  "/discover": {
58
58
  $post: {
59
59
  output: {
60
+ scope: "host-default-account";
61
+ runners: {
62
+ status: "connected" | "disconnected" | "not-installed" | "unknown";
63
+ enabled?: boolean | undefined;
64
+ hint?: string | undefined;
65
+ authFailureId?: string | undefined;
66
+ runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
67
+ }[];
68
+ } | {
60
69
  runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
61
70
  models: {
62
71
  id: string;
@@ -67,15 +76,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
67
76
  source: "cache" | "live" | "unavailable";
68
77
  stale: boolean;
69
78
  reason?: string | undefined;
70
- } | {
71
- scope: "host-default-account";
72
- runners: {
73
- status: "connected" | "disconnected" | "not-installed" | "unknown";
74
- enabled?: boolean | undefined;
75
- hint?: string | undefined;
76
- authFailureId?: string | undefined;
77
- runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
78
- }[];
79
79
  } | {
80
80
  tasks: {
81
81
  id: string;
@@ -0,0 +1,14 @@
1
+ export declare function githubContext(repoRoot: string): {
2
+ key: string;
3
+ env: {
4
+ GH_HOST: string | undefined;
5
+ GH_CONFIG_DIR: string | undefined;
6
+ };
7
+ };
8
+ export type GithubContext = ReturnType<typeof githubContext>;
9
+ export declare function gh(repoRoot: string, args: string[], timeout?: number, signal?: AbortSignal, context?: GithubContext): Promise<string>;
10
+ /** `owner/name` → `{ owner, name }`, or null when the handle isn't a clean two-part slug. */
11
+ export declare function parseOwnerName(nameWithOwner: string): {
12
+ owner: string;
13
+ name: string;
14
+ } | null;
@@ -0,0 +1,25 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { promisify } from 'node:util';
3
+ const exec = promisify(execFile);
4
+ // Keep account-directory and host selection attached to shared work. Never key by owner/name:
5
+ // separate local roots (including different remotes/accounts) must not share results.
6
+ export function githubContext(repoRoot) {
7
+ const env = { GH_HOST: process.env.GH_HOST, GH_CONFIG_DIR: process.env.GH_CONFIG_DIR };
8
+ return { key: JSON.stringify([repoRoot, env.GH_HOST, env.GH_CONFIG_DIR]), env };
9
+ }
10
+ export async function gh(repoRoot, args, timeout = 15_000, signal, context) {
11
+ const { stdout } = await exec('gh', args, {
12
+ cwd: repoRoot,
13
+ ...(context ? { env: { ...process.env, ...context.env } } : {}),
14
+ timeout,
15
+ maxBuffer: 50 * 1024 * 1024,
16
+ ...(signal ? { signal } : {}),
17
+ });
18
+ return stdout;
19
+ }
20
+ /** `owner/name` → `{ owner, name }`, or null when the handle isn't a clean two-part slug. */
21
+ export function parseOwnerName(nameWithOwner) {
22
+ const [owner, name, ...rest] = nameWithOwner.trim().split('/');
23
+ return owner && name && rest.length === 0 ? { owner, name } : null;
24
+ }
25
+ //# sourceMappingURL=github-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-cli.js","sourceRoot":"","sources":["../../../src/server/forge/github-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEjC,8FAA8F;AAC9F,sFAAsF;AACtF,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,MAAM,GAAG,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;IACvF,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;AAClF,CAAC;AAGD,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,QAAgB,EAAE,IAAc,EAAE,OAAO,GAAG,MAAM,EAAE,MAAoB,EAAE,OAAuB;IACxH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE;QACxC,GAAG,EAAE,QAAQ;QACb,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,OAAO;QACP,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;QAC3B,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9B,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,cAAc,CAAC,aAAqB;IAClD,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/D,OAAO,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { RepoHandleDiscovery } from './repo-handle-discovery.ts';
2
+ type RepoHandle = {
3
+ owner: string;
4
+ name: string;
5
+ } | null;
6
+ /** Each subscriber owns a lease, not the subprocess. Only the last cancellation aborts it.
7
+ * Keep the rejecting promise intact so strict callers retain gh's diagnostic. */
8
+ export declare function sharedRepoHandle(repoRoot: string, signal?: AbortSignal, context?: {
9
+ key: string;
10
+ env: {
11
+ GH_HOST: string | undefined;
12
+ GH_CONFIG_DIR: string | undefined;
13
+ };
14
+ }): Promise<RepoHandle>;
15
+ /** Test-only: drop the memoized repo handles. */
16
+ export declare function __clearRepoHandleCacheForTests(): void;
17
+ /** Drop this root's memoized names after a read that named them failed or was redirected: the
18
+ * repository may have been renamed since, and the next lookup asks GitHub again. */
19
+ export declare function forgetRepoHandle(repoRoot: string): void;
20
+ /** A GitHub answer that can mean the name is no longer the repository's. */
21
+ export declare function isRepositoryNameMiss(error: unknown): boolean;
22
+ /** Runs a read that names the repository; when GitHub no longer knows that name, the next read
23
+ * asks for the current one. The error still reaches the caller. */
24
+ export declare function forgettingNameOnMiss<T>(repoRoot: string, read: () => Promise<T>): Promise<T>;
25
+ /** Share the existing memo with ordinary discovery, but retain failure classification (#102).
26
+ * An aborted owner must never publish its late result into this shared cache. */
27
+ export declare function discoverRepoHandle(repoRoot: string, signal?: AbortSignal): Promise<RepoHandleDiscovery>;
28
+ /** Compatible fail-open lookup for existing API and cold-index callers. */
29
+ export declare function resolveRepoHandle(repoRoot: string, signal?: AbortSignal): Promise<{
30
+ owner: string;
31
+ name: string;
32
+ } | null>;
33
+ type RepoRef = {
34
+ owner: string;
35
+ repo: string;
36
+ };
37
+ /** The name to read `remote`'s repository under: GitHub's current name for that repository, or
38
+ * `remote` itself when `gh` cannot say. It names `remote` explicitly: an unqualified `gh repo
39
+ * view` follows gh's default repository, which in a fork checkout is `upstream`. Failures are not
40
+ * memoized. Null only without a remote. */
41
+ export declare function canonicalRepoRef(repoRoot: string, remote: RepoRef | null): Promise<RepoRef | null>;
42
+ export {};