@hearsay-tools/squawk 0.18.0-pr3768.6979 → 0.18.0-pr3769.6986

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 (76) hide show
  1. package/dist/automations/github-poller.js +1 -5
  2. package/dist/automations/github-poller.js.map +1 -1
  3. package/dist/automations/prompts.js +19 -14
  4. package/dist/automations/prompts.js.map +1 -1
  5. package/dist/automations/scheduler.d.ts +1 -1
  6. package/dist/automations/scheduler.js +3 -1
  7. package/dist/automations/scheduler.js.map +1 -1
  8. package/dist/automations/service.d.ts +1 -1
  9. package/dist/automations/service.js +3 -1
  10. package/dist/automations/service.js.map +1 -1
  11. package/dist/automations/tool-adapter.d.ts +6 -1
  12. package/dist/automations/tool-adapter.js +85 -1
  13. package/dist/automations/tool-adapter.js.map +1 -1
  14. package/dist/automations/tool-github.d.ts +9 -0
  15. package/dist/automations/tool-github.js +9 -0
  16. package/dist/automations/tool-github.js.map +1 -0
  17. package/dist/automations/tool-timeout.d.ts +2 -0
  18. package/dist/automations/tool-timeout.js +22 -0
  19. package/dist/automations/tool-timeout.js.map +1 -0
  20. package/dist/ci-wait/client.d.ts +2 -0
  21. package/dist/ci-wait/client.js +5 -0
  22. package/dist/ci-wait/client.js.map +1 -1
  23. package/dist/ci-wait/controller.d.ts +383 -36
  24. package/dist/ci-wait/controller.js +13 -0
  25. package/dist/ci-wait/controller.js.map +1 -1
  26. package/dist/ci-wait/tool-catalog.d.ts +29 -0
  27. package/dist/ci-wait/tool-catalog.js +16 -1
  28. package/dist/ci-wait/tool-catalog.js.map +1 -1
  29. package/dist/ci-wait/tools.d.ts +100 -1
  30. package/dist/ci-wait/tools.js +10 -4
  31. package/dist/ci-wait/tools.js.map +1 -1
  32. package/dist/contract/automation-tool.d.ts +320 -0
  33. package/dist/contract/index.d.ts +1 -0
  34. package/dist/contract/index.js +31 -7
  35. package/dist/core/github-request-limits.d.ts +9 -0
  36. package/dist/core/github-request-limits.js +13 -0
  37. package/dist/core/github-request-limits.js.map +1 -0
  38. package/dist/delegation/routes.d.ts +66 -66
  39. package/dist/delegation/transport.d.ts +73 -73
  40. package/dist/server/live-routes.d.ts +6 -6
  41. package/dist/server/reports-api.d.ts +2 -2
  42. package/dist/server/server.d.ts +188 -188
  43. package/dist/workflows/run/squawk-tools.js +4 -0
  44. package/dist/workflows/run/squawk-tools.js.map +1 -1
  45. package/dist/workflows/run/types.d.ts +2 -0
  46. package/dist/workflows/run.d.ts +2 -2
  47. package/dist/workflows/run.js +2 -2
  48. package/package.json +4 -4
  49. package/scripts/mock-ci-tool.mjs +5 -0
  50. package/scripts/mock-omp-rpc.mjs +1 -1
  51. package/web/dist/assets/{activity-motion-jtXo23BH.js → activity-motion-CwyYT4SH.js} +1 -1
  52. package/web/dist/assets/{activity-route-BMQTuzfV.js → activity-route-Bt5MPPwp.js} +1 -1
  53. package/web/dist/assets/{commit-diff-panel-Cc19k61n.js → commit-diff-panel-B9Y_vEU3.js} +1 -1
  54. package/web/dist/assets/{diff-D81v0XSv.js → diff-RbR9hVio.js} +2 -2
  55. package/web/dist/assets/{diff-view-DGqayt94.js → diff-view-Cry0Ysix.js} +1 -1
  56. package/web/dist/assets/{file-preview-CvFWYfZe.js → file-preview-CNTXq7aI.js} +1 -1
  57. package/web/dist/assets/{git-toolbar-CEgI-Xxh.js → git-toolbar-D831zwk0.js} +1 -1
  58. package/web/dist/assets/{github-BBpDYcnE.js → github-BJhv3NeS.js} +1 -1
  59. package/web/dist/assets/{global-activity-route-BtAy1ibD.js → global-activity-route-BC8lE6mD.js} +1 -1
  60. package/web/dist/assets/index-H4yO5F4V.js +17 -0
  61. package/web/dist/assets/{preview-pane-connected-B6Mk-4Z6.js → preview-pane-connected-CrZr2qiu.js} +1 -1
  62. package/web/dist/assets/{repo-git-6S7sePGj.js → repo-git-uo2jvYGV.js} +1 -1
  63. package/web/dist/assets/{report-reader-DTbLfexd.js → report-reader-B8A3re5u.js} +1 -1
  64. package/web/dist/assets/{reports-D_HD3irC.js → reports-wBxMmGcA.js} +1 -1
  65. package/web/dist/assets/{run-header-OGi1iR5p.js → run-header-Dful8ShW.js} +1 -1
  66. package/web/dist/assets/{skills-BxpbZtzV.js → skills-BC-JV9qH.js} +1 -1
  67. package/web/dist/assets/{task-changes-C2wVYoQg.js → task-changes-CSmmrm3P.js} +1 -1
  68. package/web/dist/assets/{task-commits-BdRhOyZV.js → task-commits-Cwzk3wqQ.js} +1 -1
  69. package/web/dist/assets/{task-files-DIX9_aVh.js → task-files-ZYn-viaP.js} +1 -1
  70. package/web/dist/assets/{task-github-item-DzLaicwO.js → task-github-item-Dc2ZMK64.js} +1 -1
  71. package/web/dist/assets/{task-thread-lzT8biTV.js → task-thread-DxhoU3iK.js} +1 -1
  72. package/web/dist/assets/{thread-state-BCHiZaAg.js → thread-state-DVsIoqGb.js} +1 -1
  73. package/web/dist/assets/{use-hand-to-agent-state-BLGpj2jQ.js → use-hand-to-agent-state-BaOux-t-.js} +1 -1
  74. package/web/dist/assets/{workflows-FPGd3Fjx.js → workflows-DtCubsoI.js} +1 -1
  75. package/web/dist/index.html +1 -1
  76. package/web/dist/assets/index-DdUN3xKQ.js +0 -17
@@ -1,3 +1,4 @@
1
+ import { type AutomationToolRequest, type AutomationToolAnswer } from '../contract/index.js';
1
2
  export { ToolsUnavailableError } from './errors.ts';
2
3
  import { type ScheduleTaskAnswer, type ScheduleTaskRequest, type ScheduledTasksAnswer, type ScheduledTasksRequest } from '../contract/index.js';
3
4
  import { type SquawkAskAnswer, type SquawkAskRequest, type SquawkCancelWaitAnswer, type SquawkCancelWaitRequest, type SquawkDoneAnswer, type SquawkDoneRequest, type SquawkWaitAnswer, type SquawkWaitRequestInput, type Wait, type WaitVia } from '../contract/index.js';
@@ -34,6 +35,7 @@ export type SquawkToolHandlers = {
34
35
  stopPreview?: PreviewStop | undefined;
35
36
  /** hearsay-tools/cezarion#1465: absent where no cockpit serves the project, answered as `unavailable`. */
36
37
  scheduleTask?: (request: ScheduleTaskRequest, signal: AbortSignal) => Promise<ScheduleTaskAnswer>;
38
+ automation?: (request: AutomationToolRequest, signal: AbortSignal) => Promise<AutomationToolAnswer>;
37
39
  scheduledTasks?: (request: ScheduledTasksRequest, signal: AbortSignal) => Promise<ScheduledTasksAnswer>;
38
40
  };
39
41
  type Capability = SquawkToolHandlers & {
@@ -280,11 +282,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
280
282
  "/api/v1/tools/ask": {
281
283
  $post: {
282
284
  output: {
283
- code: 'capability_revoked';
285
+ ok: false;
286
+ code: 'unavailable';
284
287
  message: string;
285
288
  };
286
289
  outputFormat: "json";
287
- status: 401;
290
+ status: import("hono/utils/http-status").ContentfulStatusCode;
288
291
  input: {
289
292
  json: {
290
293
  questions: {
@@ -302,12 +305,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
302
305
  };
303
306
  } | {
304
307
  output: {
305
- ok: false;
306
- code: 'unavailable';
308
+ code: 'capability_revoked';
307
309
  message: string;
308
310
  };
309
311
  outputFormat: "json";
310
- status: import("hono/utils/http-status").ContentfulStatusCode;
312
+ status: 401;
311
313
  input: {
312
314
  json: {
313
315
  questions: {
@@ -375,11 +377,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
375
377
  "/api/v1/tools/cancel-wait": {
376
378
  $post: {
377
379
  output: {
378
- code: 'capability_revoked';
380
+ cancelled: false;
381
+ code: 'unavailable';
379
382
  message: string;
380
383
  };
381
384
  outputFormat: "json";
382
- status: 401;
385
+ status: import("hono/utils/http-status").ContentfulStatusCode;
383
386
  input: {
384
387
  json: {
385
388
  wait_id: string;
@@ -387,12 +390,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
387
390
  };
388
391
  } | {
389
392
  output: {
390
- cancelled: false;
391
- code: 'unavailable';
393
+ code: 'capability_revoked';
392
394
  message: string;
393
395
  };
394
396
  outputFormat: "json";
395
- status: import("hono/utils/http-status").ContentfulStatusCode;
397
+ status: 401;
396
398
  input: {
397
399
  json: {
398
400
  wait_id: string;
@@ -440,11 +442,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
440
442
  "/api/v1/tools/done": {
441
443
  $post: {
442
444
  output: {
443
- code: 'capability_revoked';
445
+ ok: false;
446
+ code: 'unavailable';
444
447
  message: string;
445
448
  };
446
449
  outputFormat: "json";
447
- status: 401;
450
+ status: import("hono/utils/http-status").ContentfulStatusCode;
448
451
  input: {
449
452
  json: {
450
453
  summary?: string | undefined;
@@ -452,12 +455,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
452
455
  };
453
456
  } | {
454
457
  output: {
455
- ok: false;
456
- code: 'unavailable';
458
+ code: 'capability_revoked';
457
459
  message: string;
458
460
  };
459
461
  outputFormat: "json";
460
- status: import("hono/utils/http-status").ContentfulStatusCode;
462
+ status: 401;
461
463
  input: {
462
464
  json: {
463
465
  summary?: string | undefined;
@@ -540,11 +542,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
540
542
  "/api/v1/tools/preview-stop": {
541
543
  $post: {
542
544
  output: {
543
- code: 'capability_revoked';
545
+ ok: boolean;
546
+ code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
544
547
  message: string;
548
+ hint: string;
545
549
  };
546
550
  outputFormat: "json";
547
- status: 401;
551
+ status: import("hono/utils/http-status").ContentfulStatusCode;
548
552
  input: {
549
553
  json: {
550
554
  port: number;
@@ -553,13 +557,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
553
557
  };
554
558
  } | {
555
559
  output: {
556
- ok: boolean;
557
- code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
560
+ code: 'capability_revoked';
558
561
  message: string;
559
- hint: string;
560
562
  };
561
563
  outputFormat: "json";
562
- status: import("hono/utils/http-status").ContentfulStatusCode;
564
+ status: 401;
563
565
  input: {
564
566
  json: {
565
567
  port: number;
@@ -572,11 +574,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
572
574
  "/api/v1/tools/preview-serve": {
573
575
  $post: {
574
576
  output: {
575
- code: 'capability_revoked';
577
+ ok: boolean;
578
+ code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
576
579
  message: string;
580
+ hint: string;
577
581
  };
578
582
  outputFormat: "json";
579
- status: 401;
583
+ status: import("hono/utils/http-status").ContentfulStatusCode;
580
584
  input: {
581
585
  json: {
582
586
  command: string;
@@ -588,13 +592,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
588
592
  };
589
593
  } | {
590
594
  output: {
591
- ok: boolean;
592
- code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
595
+ code: 'capability_revoked';
593
596
  message: string;
594
- hint: string;
595
597
  };
596
598
  outputFormat: "json";
597
- status: import("hono/utils/http-status").ContentfulStatusCode;
599
+ status: 401;
598
600
  input: {
599
601
  json: {
600
602
  command: string;
@@ -607,14 +609,360 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
607
609
  };
608
610
  };
609
611
  } & {
610
- "/api/v1/tools/schedule-task": {
612
+ "/api/v1/tools/automation": {
611
613
  $post: {
614
+ output: {
615
+ ok: false;
616
+ code: import('../contract/index.js').ScheduledTaskRefusalCode;
617
+ message: string;
618
+ };
619
+ outputFormat: "json";
620
+ status: import("hono/utils/http-status").ContentfulStatusCode;
621
+ input: {
622
+ json: {
623
+ action: "create";
624
+ definition: {
625
+ name: string;
626
+ description?: string | undefined;
627
+ kind?: "github" | "schedule" | undefined;
628
+ events?: ("issue.labeled" | "issue.opened" | "issue.unlabeled" | "pull_request.opened")[] | undefined;
629
+ intervalSeconds?: number | undefined;
630
+ filters?: {
631
+ [x: string]: unknown;
632
+ includeExisting?: boolean | undefined;
633
+ requireCurrentLabels?: boolean | undefined;
634
+ authors?: string[] | undefined;
635
+ assignees?: string[] | undefined;
636
+ allLabels?: string[] | undefined;
637
+ anyLabels?: string[] | undefined;
638
+ excludeLabels?: string[] | undefined;
639
+ changedLabels?: string[] | undefined;
640
+ lookbackDays?: number | undefined;
641
+ maxRecords?: number | undefined;
642
+ } | undefined;
643
+ schedule?: {
644
+ type: "daily" | "hours" | "once" | "weekdays" | "weekly";
645
+ hour?: number | undefined;
646
+ minute?: number | undefined;
647
+ day?: number | undefined;
648
+ every?: 1 | 2 | 3 | 4 | 6 | 8 | 12 | undefined;
649
+ at?: string | undefined;
650
+ timeZone?: string | undefined;
651
+ latestStartMinutes?: number | undefined;
652
+ } | undefined;
653
+ task: {
654
+ archiveWhenDone?: boolean | undefined;
655
+ autoMergePr?: boolean | undefined;
656
+ allowWorkers?: boolean | undefined;
657
+ allowMessaging?: boolean | undefined;
658
+ prompt: string;
659
+ workflow?: string | undefined;
660
+ steps?: {
661
+ id: string;
662
+ name?: string | undefined;
663
+ prompt?: string | undefined;
664
+ skill?: string | undefined;
665
+ model?: string | undefined;
666
+ effort?: string | undefined;
667
+ timeoutMs?: number | undefined;
668
+ runner?: "claude" | "codex" | "omp" | "opencode" | "pi" | undefined;
669
+ agentProfile?: string | undefined;
670
+ allowedTools?: string[] | undefined;
671
+ bashAllowlist?: string[] | undefined;
672
+ command?: string | undefined;
673
+ onFail?: {
674
+ retry: string;
675
+ max?: number | undefined;
676
+ } | undefined;
677
+ }[] | undefined;
678
+ runner?: "claude" | "codex" | "omp" | "opencode" | "pi" | undefined;
679
+ model?: string | undefined;
680
+ effort?: string | undefined;
681
+ worktree?: boolean | undefined;
682
+ autonomous?: boolean | undefined;
683
+ systemPrompt?: string | undefined;
684
+ };
685
+ };
686
+ } | {
687
+ action: "show";
688
+ id: string;
689
+ } | {
690
+ action: "preview";
691
+ id: string;
692
+ } | {
693
+ action: "enable";
694
+ id: string;
695
+ explicit?: boolean | undefined;
696
+ };
697
+ };
698
+ } | {
612
699
  output: {
613
700
  code: 'capability_revoked';
614
701
  message: string;
615
702
  };
616
703
  outputFormat: "json";
617
704
  status: 401;
705
+ input: {
706
+ json: {
707
+ action: "create";
708
+ definition: {
709
+ name: string;
710
+ description?: string | undefined;
711
+ kind?: "github" | "schedule" | undefined;
712
+ events?: ("issue.labeled" | "issue.opened" | "issue.unlabeled" | "pull_request.opened")[] | undefined;
713
+ intervalSeconds?: number | undefined;
714
+ filters?: {
715
+ [x: string]: unknown;
716
+ includeExisting?: boolean | undefined;
717
+ requireCurrentLabels?: boolean | undefined;
718
+ authors?: string[] | undefined;
719
+ assignees?: string[] | undefined;
720
+ allLabels?: string[] | undefined;
721
+ anyLabels?: string[] | undefined;
722
+ excludeLabels?: string[] | undefined;
723
+ changedLabels?: string[] | undefined;
724
+ lookbackDays?: number | undefined;
725
+ maxRecords?: number | undefined;
726
+ } | undefined;
727
+ schedule?: {
728
+ type: "daily" | "hours" | "once" | "weekdays" | "weekly";
729
+ hour?: number | undefined;
730
+ minute?: number | undefined;
731
+ day?: number | undefined;
732
+ every?: 1 | 2 | 3 | 4 | 6 | 8 | 12 | undefined;
733
+ at?: string | undefined;
734
+ timeZone?: string | undefined;
735
+ latestStartMinutes?: number | undefined;
736
+ } | undefined;
737
+ task: {
738
+ archiveWhenDone?: boolean | undefined;
739
+ autoMergePr?: boolean | undefined;
740
+ allowWorkers?: boolean | undefined;
741
+ allowMessaging?: boolean | undefined;
742
+ prompt: string;
743
+ workflow?: string | undefined;
744
+ steps?: {
745
+ id: string;
746
+ name?: string | undefined;
747
+ prompt?: string | undefined;
748
+ skill?: string | undefined;
749
+ model?: string | undefined;
750
+ effort?: string | undefined;
751
+ timeoutMs?: number | undefined;
752
+ runner?: "claude" | "codex" | "omp" | "opencode" | "pi" | undefined;
753
+ agentProfile?: string | undefined;
754
+ allowedTools?: string[] | undefined;
755
+ bashAllowlist?: string[] | undefined;
756
+ command?: string | undefined;
757
+ onFail?: {
758
+ retry: string;
759
+ max?: number | undefined;
760
+ } | undefined;
761
+ }[] | undefined;
762
+ runner?: "claude" | "codex" | "omp" | "opencode" | "pi" | undefined;
763
+ model?: string | undefined;
764
+ effort?: string | undefined;
765
+ worktree?: boolean | undefined;
766
+ autonomous?: boolean | undefined;
767
+ systemPrompt?: string | undefined;
768
+ };
769
+ };
770
+ } | {
771
+ action: "show";
772
+ id: string;
773
+ } | {
774
+ action: "preview";
775
+ id: string;
776
+ } | {
777
+ action: "enable";
778
+ id: string;
779
+ explicit?: boolean | undefined;
780
+ };
781
+ };
782
+ } | {
783
+ output: {
784
+ ok: true;
785
+ automation: {
786
+ [x: string]: import("hono/utils/types").JSONValue;
787
+ id: string;
788
+ revision: number;
789
+ name: string;
790
+ description?: string | undefined;
791
+ enabled: boolean;
792
+ kind: "github" | "schedule";
793
+ events?: ("issue.labeled" | "issue.opened" | "issue.unlabeled" | "pull_request.opened")[] | undefined;
794
+ intervalSeconds?: number | undefined;
795
+ filters?: {
796
+ [x: string]: import("hono/utils/types").JSONValue;
797
+ includeExisting?: boolean | undefined;
798
+ requireCurrentLabels?: boolean | undefined;
799
+ authors?: string[] | undefined;
800
+ assignees?: string[] | undefined;
801
+ allLabels?: string[] | undefined;
802
+ anyLabels?: string[] | undefined;
803
+ excludeLabels?: string[] | undefined;
804
+ changedLabels?: string[] | undefined;
805
+ lookbackDays: number;
806
+ maxRecords: number;
807
+ } | undefined;
808
+ schedule?: {
809
+ [x: string]: import("hono/utils/types").JSONValue;
810
+ type: "daily" | "hours" | "once" | "weekdays" | "weekly";
811
+ hour?: number | undefined;
812
+ minute?: number | undefined;
813
+ day?: number | undefined;
814
+ every?: 1 | 2 | 3 | 4 | 6 | 8 | 12 | undefined;
815
+ at?: string | undefined;
816
+ timeZone?: string | undefined;
817
+ latestStartMinutes?: number | undefined;
818
+ } | undefined;
819
+ task: {
820
+ [x: string]: import("hono/utils/types").JSONValue;
821
+ archiveWhenDone?: boolean | undefined;
822
+ autoMergePr?: boolean | undefined;
823
+ allowWorkers?: boolean | undefined;
824
+ allowMessaging?: boolean | undefined;
825
+ prompt: string;
826
+ workflow?: string | undefined;
827
+ steps?: {
828
+ id: string;
829
+ name?: string | undefined;
830
+ prompt?: string | undefined;
831
+ skill?: string | undefined;
832
+ model?: string | undefined;
833
+ effort?: string | undefined;
834
+ timeoutMs?: number | undefined;
835
+ runner?: "claude" | "codex" | "omp" | "opencode" | "pi" | undefined;
836
+ agentProfile?: string | undefined;
837
+ allowedTools?: string[] | undefined;
838
+ bashAllowlist?: string[] | undefined;
839
+ command?: string | undefined;
840
+ onFail?: {
841
+ retry: string;
842
+ max: number;
843
+ } | undefined;
844
+ }[] | undefined;
845
+ runner?: "claude" | "codex" | "omp" | "opencode" | "pi" | undefined;
846
+ model?: string | undefined;
847
+ effort?: string | undefined;
848
+ variants?: 1 | 2 | 3 | undefined;
849
+ worktree?: boolean | undefined;
850
+ autonomous?: boolean | undefined;
851
+ systemPrompt?: string | undefined;
852
+ };
853
+ archived?: {
854
+ [x: string]: import("hono/utils/types").JSONValue;
855
+ at: string;
856
+ outcome: "cancelled" | "launched";
857
+ runId?: string | undefined;
858
+ receiptId?: string | undefined;
859
+ trigger?: "late" | "manual" | "retry" | "schedule" | undefined;
860
+ } | undefined;
861
+ createdAt: string;
862
+ updatedAt: string;
863
+ };
864
+ url?: string | undefined;
865
+ next_run_at?: string | undefined;
866
+ preview?: {
867
+ matches: number;
868
+ truncated: boolean;
869
+ } | undefined;
870
+ } | {
871
+ ok: false;
872
+ code: "automations_off" | "conflict" | "explicit_required" | "invalid_request" | "not_found" | "preview_required" | "unavailable";
873
+ message: string;
874
+ };
875
+ outputFormat: "json";
876
+ status: import("hono/utils/http-status").ContentfulStatusCode;
877
+ input: {
878
+ json: {
879
+ action: "create";
880
+ definition: {
881
+ name: string;
882
+ description?: string | undefined;
883
+ kind?: "github" | "schedule" | undefined;
884
+ events?: ("issue.labeled" | "issue.opened" | "issue.unlabeled" | "pull_request.opened")[] | undefined;
885
+ intervalSeconds?: number | undefined;
886
+ filters?: {
887
+ [x: string]: unknown;
888
+ includeExisting?: boolean | undefined;
889
+ requireCurrentLabels?: boolean | undefined;
890
+ authors?: string[] | undefined;
891
+ assignees?: string[] | undefined;
892
+ allLabels?: string[] | undefined;
893
+ anyLabels?: string[] | undefined;
894
+ excludeLabels?: string[] | undefined;
895
+ changedLabels?: string[] | undefined;
896
+ lookbackDays?: number | undefined;
897
+ maxRecords?: number | undefined;
898
+ } | undefined;
899
+ schedule?: {
900
+ type: "daily" | "hours" | "once" | "weekdays" | "weekly";
901
+ hour?: number | undefined;
902
+ minute?: number | undefined;
903
+ day?: number | undefined;
904
+ every?: 1 | 2 | 3 | 4 | 6 | 8 | 12 | undefined;
905
+ at?: string | undefined;
906
+ timeZone?: string | undefined;
907
+ latestStartMinutes?: number | undefined;
908
+ } | undefined;
909
+ task: {
910
+ archiveWhenDone?: boolean | undefined;
911
+ autoMergePr?: boolean | undefined;
912
+ allowWorkers?: boolean | undefined;
913
+ allowMessaging?: boolean | undefined;
914
+ prompt: string;
915
+ workflow?: string | undefined;
916
+ steps?: {
917
+ id: string;
918
+ name?: string | undefined;
919
+ prompt?: string | undefined;
920
+ skill?: string | undefined;
921
+ model?: string | undefined;
922
+ effort?: string | undefined;
923
+ timeoutMs?: number | undefined;
924
+ runner?: "claude" | "codex" | "omp" | "opencode" | "pi" | undefined;
925
+ agentProfile?: string | undefined;
926
+ allowedTools?: string[] | undefined;
927
+ bashAllowlist?: string[] | undefined;
928
+ command?: string | undefined;
929
+ onFail?: {
930
+ retry: string;
931
+ max?: number | undefined;
932
+ } | undefined;
933
+ }[] | undefined;
934
+ runner?: "claude" | "codex" | "omp" | "opencode" | "pi" | undefined;
935
+ model?: string | undefined;
936
+ effort?: string | undefined;
937
+ worktree?: boolean | undefined;
938
+ autonomous?: boolean | undefined;
939
+ systemPrompt?: string | undefined;
940
+ };
941
+ };
942
+ } | {
943
+ action: "show";
944
+ id: string;
945
+ } | {
946
+ action: "preview";
947
+ id: string;
948
+ } | {
949
+ action: "enable";
950
+ id: string;
951
+ explicit?: boolean | undefined;
952
+ };
953
+ };
954
+ };
955
+ };
956
+ } & {
957
+ "/api/v1/tools/schedule-task": {
958
+ $post: {
959
+ output: {
960
+ ok: false;
961
+ code: import('../contract/index.js').ScheduledTaskRefusalCode;
962
+ message: string;
963
+ };
964
+ outputFormat: "json";
965
+ status: import("hono/utils/http-status").ContentfulStatusCode;
618
966
  input: {
619
967
  json: {
620
968
  at?: string | undefined;
@@ -631,12 +979,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
631
979
  };
632
980
  } | {
633
981
  output: {
634
- ok: false;
635
- code: import('../contract/index.js').ScheduledTaskRefusalCode;
982
+ code: 'capability_revoked';
636
983
  message: string;
637
984
  };
638
985
  outputFormat: "json";
639
- status: import("hono/utils/http-status").ContentfulStatusCode;
986
+ status: 401;
640
987
  input: {
641
988
  json: {
642
989
  at?: string | undefined;
@@ -691,11 +1038,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
691
1038
  "/api/v1/tools/scheduled-tasks": {
692
1039
  $post: {
693
1040
  output: {
694
- code: 'capability_revoked';
1041
+ ok: false;
1042
+ code: import('../contract/index.js').ScheduledTaskRefusalCode;
695
1043
  message: string;
696
1044
  };
697
1045
  outputFormat: "json";
698
- status: 401;
1046
+ status: import("hono/utils/http-status").ContentfulStatusCode;
699
1047
  input: {
700
1048
  json: {
701
1049
  at?: string | undefined;
@@ -728,12 +1076,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
728
1076
  };
729
1077
  } | {
730
1078
  output: {
731
- ok: false;
732
- code: import('../contract/index.js').ScheduledTaskRefusalCode;
1079
+ code: 'capability_revoked';
733
1080
  message: string;
734
1081
  };
735
1082
  outputFormat: "json";
736
- status: import("hono/utils/http-status").ContentfulStatusCode;
1083
+ status: 401;
737
1084
  input: {
738
1085
  json: {
739
1086
  at?: string | undefined;
@@ -1,3 +1,4 @@
1
+ import { automationToolRequestSchema, automationToolAnswerSchema } from '../contract/index.js';
1
2
  import { productEnvEntries } from '../core/product-env.js';
2
3
  import { randomBytes, randomUUID } from 'node:crypto';
3
4
  import { chmod, mkdtemp, rm } from 'node:fs/promises';
@@ -261,6 +262,18 @@ export function ciToolRoutes(capabilities) {
261
262
  catch {
262
263
  return capabilityRevoked(c, capability, () => c.json(previewRefusal('unavailable')));
263
264
  }
265
+ })
266
+ .use('/api/v1/tools/automation', requireCapability)
267
+ .post('/api/v1/tools/automation', bodyLimit({ maxSize: SCHEDULED_TASK_LIMITS.wireBytes, onError: c => c.json(scheduleRefusal('invalid_request', 'The arguments exceed 1 MiB.')) }), async (c, next) => {
268
+ if (!automationsToolEnabled())
269
+ return c.json(scheduleRefusal('automations_off'));
270
+ await next();
271
+ }, jsonZodValidator(automationToolRequestSchema, { invalid: (c, error) => c.json(scheduleRefusal('invalid_request', scheduleInvalidInput(error))) }), async (c) => {
272
+ const capability = c.get('capability');
273
+ const automation = capability.automation;
274
+ if (!automation)
275
+ return c.json(scheduleRefusal('unavailable'));
276
+ return capabilityAnswer(c, capability, async () => automationToolAnswerSchema.parse(await automation.call(capability, c.req.valid('json'), capability.lifetime.signal)), answer => c.json(answer), () => c.json(scheduleRefusal('unavailable')));
264
277
  })
265
278
  .use('/api/v1/tools/schedule-task', requireCapability)
266
279
  // A prompt takes up to 100 000 characters, so these bodies get their own limit. The flag gate