@hearsay-tools/squawk 0.18.0-dev.6146 → 0.18.0-dev.6153

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 (57) hide show
  1. package/dist/delegation/identity-file-store.d.ts +1 -1
  2. package/dist/delegation/owned-workspace-release.d.ts +8 -0
  3. package/dist/delegation/owned-workspace-release.js +9 -0
  4. package/dist/delegation/owned-workspace-release.js.map +1 -0
  5. package/dist/delegation/provision.d.ts +4 -2
  6. package/dist/delegation/provision.js +5 -3
  7. package/dist/delegation/provision.js.map +1 -1
  8. package/dist/delegation/routes.d.ts +15 -15
  9. package/dist/delegation/service.d.ts +13 -4
  10. package/dist/delegation/service.js +13 -7
  11. package/dist/delegation/service.js.map +1 -1
  12. package/dist/delegation/transport.d.ts +13 -13
  13. package/dist/delegation/windows-identity-store.d.ts +1 -1
  14. package/dist/delegation/windows-identity-store.js +1 -1
  15. package/dist/delegation/windows-identity-store.js.map +1 -1
  16. package/dist/delegation/worker-cleanup.d.ts +3 -1
  17. package/dist/delegation/worker-cleanup.js +7 -2
  18. package/dist/delegation/worker-cleanup.js.map +1 -1
  19. package/dist/delegation/workspace-git.d.ts +19 -0
  20. package/dist/delegation/workspace-git.js +67 -0
  21. package/dist/delegation/workspace-git.js.map +1 -0
  22. package/dist/delegation/workspace-record.d.ts +63 -0
  23. package/dist/delegation/workspace-record.js +78 -0
  24. package/dist/delegation/workspace-record.js.map +1 -0
  25. package/dist/delegation/workspace-removal.d.ts +19 -0
  26. package/dist/delegation/workspace-removal.js +284 -0
  27. package/dist/delegation/workspace-removal.js.map +1 -0
  28. package/dist/delegation/workspace.d.ts +1 -28
  29. package/dist/delegation/workspace.js +7 -411
  30. package/dist/delegation/workspace.js.map +1 -1
  31. package/dist/git-worktree-release.d.ts +5 -9
  32. package/dist/git-worktree-release.js +5 -10
  33. package/dist/git-worktree-release.js.map +1 -1
  34. package/dist/headless-run.d.ts +3 -0
  35. package/dist/headless-run.js +1 -1
  36. package/dist/headless-run.js.map +1 -1
  37. package/dist/index.js +3 -2
  38. package/dist/index.js.map +1 -1
  39. package/dist/project-migration/containment.js +1 -1
  40. package/dist/project-migration/containment.js.map +1 -1
  41. package/dist/project-migration/plan.js +1 -1
  42. package/dist/project-migration/plan.js.map +1 -1
  43. package/dist/project-migration/steps.js +1 -1
  44. package/dist/project-migration/steps.js.map +1 -1
  45. package/dist/serve-command.d.ts +3 -0
  46. package/dist/serve-command.js +1 -1
  47. package/dist/serve-command.js.map +1 -1
  48. package/dist/server/reports-api.d.ts +2 -2
  49. package/dist/server/server-deps.d.ts +1 -1
  50. package/dist/server/server-deps.js +2 -0
  51. package/dist/server/server-deps.js.map +1 -1
  52. package/dist/server/server.d.ts +103 -99
  53. package/dist/server/server.js +2 -3
  54. package/dist/server/server.js.map +1 -1
  55. package/dist/server/workspace-live-routes.d.ts +6 -6
  56. package/package.json +4 -4
  57. package/scripts/benchmark-stuck-destroys.ts +2 -1
@@ -2,11 +2,13 @@ export type { WorkspaceConfigResponse } from '../contract/index.js';
2
2
  import { type ActivityServerDeps } from './activity-routes.ts';
3
3
  import type { Home } from '../home/home.ts';
4
4
  import { type WorkspaceProjects } from './workspace-projects.ts';
5
+ import { type WorkerCleanupFactory } from '../delegation/service.ts';
5
6
  import type { DelegationController } from '../delegation/provision.ts';
6
7
  import { AutomationStore } from '../automations/store.ts';
7
8
  import type { IncomingMessage } from 'node:http';
8
9
  import { Hono } from 'hono';
9
10
  import { TaskWebhooks } from '../runs/webhook.ts';
11
+ import type { detectEnvironment } from '../core/backend-detect.ts';
10
12
  import { ProviderAuthService, type ProviderId } from '../core/provider-auth.ts';
11
13
  import { RunnerModelCatalog } from '../core/runner-model-catalog.ts';
12
14
  import { type RunStore } from '../runs/store.ts';
@@ -39,8 +41,9 @@ export interface ServerDeps extends ActivityServerDeps {
39
41
  /** Test seam for task-webhook deliveries (#589): the `fetch` they POST with. Used only when
40
42
  * `createApp` builds its own `TaskWebhooks`. */
41
43
  taskWebhookFetch?: typeof fetch;
42
- /** Same-process optional private listener; attached to managers before recovery. */
44
+ /** Same-process optional private listener; attached to managers before recovery. Without it, `workerCleanup` lets the fallback service destroy workers. */
43
45
  delegation?: DelegationController;
46
+ workerCleanup?: WorkerCleanupFactory;
44
47
  repoRoot: string;
45
48
  store: RunStore;
46
49
  manager: RunManager;
@@ -100,6 +103,7 @@ export interface ServerDeps extends ActivityServerDeps {
100
103
  modelCatalog?: RunnerModelCatalog;
101
104
  /** Host-wide provider authentication discovery. Tests inject deterministic probes. */
102
105
  providerAuth?: ProviderAuthService;
106
+ detectEnvironment?: typeof detectEnvironment;
103
107
  /** Global provider enablement preferences. Tests may inject an in-memory store. */
104
108
  workspaceConfig?: {
105
109
  load: (path?: string) => ReturnType<typeof loadWorkspaceConfig>;
@@ -3035,12 +3039,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3035
3039
  output: {
3036
3040
  generation: string;
3037
3041
  results: ({
3038
- projectId: string;
3039
- runId: string;
3040
- type: "error" | "reset";
3041
- status: 400 | 404 | 409 | 413 | 503;
3042
- error: string;
3043
- } | {
3044
3042
  projectId: string;
3045
3043
  runId: string;
3046
3044
  type: "batch";
@@ -3054,6 +3052,12 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3054
3052
  cursor: string;
3055
3053
  afterSeq: number;
3056
3054
  hasMore: boolean;
3055
+ } | {
3056
+ projectId: string;
3057
+ runId: string;
3058
+ type: "error" | "reset";
3059
+ status: 400 | 404 | 409 | 413 | 503;
3060
+ error: string;
3057
3061
  })[];
3058
3062
  };
3059
3063
  outputFormat: "json";
@@ -4948,19 +4952,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4948
4952
  } & {
4949
4953
  "/repo/commit/:sha": {
4950
4954
  $get: {
4951
- output: string;
4952
- outputFormat: "text";
4953
- status: import("hono/utils/http-status").ContentfulStatusCode;
4954
- input: {
4955
- query: {
4956
- structured?: string | undefined;
4957
- };
4958
- } & {
4959
- param: {
4960
- sha: string;
4961
- };
4962
- };
4963
- } | {
4964
4955
  output: {
4965
4956
  error: string;
4966
4957
  code?: "invalid_input" | undefined;
@@ -5024,6 +5015,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
5024
5015
  sha: string;
5025
5016
  };
5026
5017
  };
5018
+ } | {
5019
+ output: string;
5020
+ outputFormat: "text";
5021
+ status: import("hono/utils/http-status").ContentfulStatusCode;
5022
+ input: {
5023
+ query: {
5024
+ structured?: string | undefined;
5025
+ };
5026
+ } & {
5027
+ param: {
5028
+ sha: string;
5029
+ };
5030
+ };
5027
5031
  };
5028
5032
  };
5029
5033
  } & {
@@ -8734,22 +8738,11 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8734
8738
  "/runs/:id/worker-destroy": {
8735
8739
  $post: {
8736
8740
  output: {
8737
- readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
8738
- readonly error: string;
8739
- readonly modelChoices?: {
8740
- runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
8741
- requestedModel: string;
8742
- availableModels: {
8743
- id: string;
8744
- label: string;
8745
- description: string;
8746
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
8747
- }[];
8748
- otherRunners: ("claude" | "codex" | "cursor" | "omp" | "opencode" | "pi")[];
8749
- } | undefined;
8741
+ error: string;
8742
+ code?: "invalid_input" | undefined;
8750
8743
  };
8751
8744
  outputFormat: "json";
8752
- status: 400 | 401 | 403 | 409 | 503;
8745
+ status: 400;
8753
8746
  input: {
8754
8747
  query: {
8755
8748
  [x: string]: string | string[];
@@ -8763,11 +8756,22 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8763
8756
  };
8764
8757
  } | {
8765
8758
  output: {
8766
- error: string;
8767
- code?: "invalid_input" | undefined;
8759
+ readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
8760
+ readonly error: string;
8761
+ readonly modelChoices?: {
8762
+ runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
8763
+ requestedModel: string;
8764
+ availableModels: {
8765
+ id: string;
8766
+ label: string;
8767
+ description: string;
8768
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
8769
+ }[];
8770
+ otherRunners: ("claude" | "codex" | "cursor" | "omp" | "opencode" | "pi")[];
8771
+ } | undefined;
8768
8772
  };
8769
8773
  outputFormat: "json";
8770
- status: 400;
8774
+ status: 400 | 401 | 403 | 409 | 503;
8771
8775
  input: {
8772
8776
  query: {
8773
8777
  [x: string]: string | string[];
@@ -18361,20 +18365,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18361
18365
  } & {
18362
18366
  "/runs/:id/handoff": {
18363
18367
  $get: {
18364
- output: string;
18365
- outputFormat: "text";
18366
- status: 200;
18368
+ output: {
18369
+ error: string;
18370
+ };
18371
+ outputFormat: "json";
18372
+ status: 404;
18367
18373
  input: {
18368
18374
  param: {
18369
18375
  id: string;
18370
18376
  };
18371
18377
  };
18372
18378
  } | {
18373
- output: {
18374
- error: string;
18375
- };
18376
- outputFormat: "json";
18377
- status: 404;
18379
+ output: string;
18380
+ outputFormat: "text";
18381
+ status: 200;
18378
18382
  input: {
18379
18383
  param: {
18380
18384
  id: string;
@@ -18412,20 +18416,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18412
18416
  } & {
18413
18417
  "/runs/:id/diff": {
18414
18418
  $get: {
18415
- output: string;
18416
- outputFormat: "text";
18417
- status: import("hono/utils/http-status").ContentfulStatusCode;
18419
+ output: {
18420
+ error: string;
18421
+ };
18422
+ outputFormat: "json";
18423
+ status: 404 | 409;
18418
18424
  input: {
18419
18425
  param: {
18420
18426
  id: string;
18421
18427
  };
18422
18428
  };
18423
18429
  } | {
18424
- output: {
18425
- error: string;
18426
- };
18427
- outputFormat: "json";
18428
- status: 404 | 409;
18430
+ output: string;
18431
+ outputFormat: "text";
18432
+ status: import("hono/utils/http-status").ContentfulStatusCode;
18429
18433
  input: {
18430
18434
  param: {
18431
18435
  id: string;
@@ -20825,19 +20829,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20825
20829
  } & {
20826
20830
  "/repo/commit/:sha": {
20827
20831
  $get: {
20828
- output: string;
20829
- outputFormat: "text";
20830
- status: import("hono/utils/http-status").ContentfulStatusCode;
20831
- input: {
20832
- query: {
20833
- structured?: string | undefined;
20834
- };
20835
- } & {
20836
- param: {
20837
- sha: string;
20838
- };
20839
- };
20840
- } | {
20841
20832
  output: {
20842
20833
  error: string;
20843
20834
  code?: "invalid_input" | undefined;
@@ -20901,6 +20892,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20901
20892
  sha: string;
20902
20893
  };
20903
20894
  };
20895
+ } | {
20896
+ output: string;
20897
+ outputFormat: "text";
20898
+ status: import("hono/utils/http-status").ContentfulStatusCode;
20899
+ input: {
20900
+ query: {
20901
+ structured?: string | undefined;
20902
+ };
20903
+ } & {
20904
+ param: {
20905
+ sha: string;
20906
+ };
20907
+ };
20904
20908
  };
20905
20909
  };
20906
20910
  } & {
@@ -24611,22 +24615,11 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
24611
24615
  "/runs/:id/worker-destroy": {
24612
24616
  $post: {
24613
24617
  output: {
24614
- readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
24615
- readonly error: string;
24616
- readonly modelChoices?: {
24617
- runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
24618
- requestedModel: string;
24619
- availableModels: {
24620
- id: string;
24621
- label: string;
24622
- description: string;
24623
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
24624
- }[];
24625
- otherRunners: ("claude" | "codex" | "cursor" | "omp" | "opencode" | "pi")[];
24626
- } | undefined;
24618
+ error: string;
24619
+ code?: "invalid_input" | undefined;
24627
24620
  };
24628
24621
  outputFormat: "json";
24629
- status: 400 | 401 | 403 | 409 | 503;
24622
+ status: 400;
24630
24623
  input: {
24631
24624
  query: {
24632
24625
  [x: string]: string | string[];
@@ -24640,11 +24633,22 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
24640
24633
  };
24641
24634
  } | {
24642
24635
  output: {
24643
- error: string;
24644
- code?: "invalid_input" | undefined;
24636
+ readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
24637
+ readonly error: string;
24638
+ readonly modelChoices?: {
24639
+ runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
24640
+ requestedModel: string;
24641
+ availableModels: {
24642
+ id: string;
24643
+ label: string;
24644
+ description: string;
24645
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
24646
+ }[];
24647
+ otherRunners: ("claude" | "codex" | "cursor" | "omp" | "opencode" | "pi")[];
24648
+ } | undefined;
24645
24649
  };
24646
24650
  outputFormat: "json";
24647
- status: 400;
24651
+ status: 400 | 401 | 403 | 409 | 503;
24648
24652
  input: {
24649
24653
  query: {
24650
24654
  [x: string]: string | string[];
@@ -34238,20 +34242,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
34238
34242
  } & {
34239
34243
  "/runs/:id/handoff": {
34240
34244
  $get: {
34241
- output: string;
34242
- outputFormat: "text";
34243
- status: 200;
34245
+ output: {
34246
+ error: string;
34247
+ };
34248
+ outputFormat: "json";
34249
+ status: 404;
34244
34250
  input: {
34245
34251
  param: {
34246
34252
  id: string;
34247
34253
  };
34248
34254
  };
34249
34255
  } | {
34250
- output: {
34251
- error: string;
34252
- };
34253
- outputFormat: "json";
34254
- status: 404;
34256
+ output: string;
34257
+ outputFormat: "text";
34258
+ status: 200;
34255
34259
  input: {
34256
34260
  param: {
34257
34261
  id: string;
@@ -34289,20 +34293,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
34289
34293
  } & {
34290
34294
  "/runs/:id/diff": {
34291
34295
  $get: {
34292
- output: string;
34293
- outputFormat: "text";
34294
- status: import("hono/utils/http-status").ContentfulStatusCode;
34296
+ output: {
34297
+ error: string;
34298
+ };
34299
+ outputFormat: "json";
34300
+ status: 404 | 409;
34295
34301
  input: {
34296
34302
  param: {
34297
34303
  id: string;
34298
34304
  };
34299
34305
  };
34300
34306
  } | {
34301
- output: {
34302
- error: string;
34303
- };
34304
- outputFormat: "json";
34305
- status: 404 | 409;
34307
+ output: string;
34308
+ outputFormat: "text";
34309
+ status: import("hono/utils/http-status").ContentfulStatusCode;
34306
34310
  input: {
34307
34311
  param: {
34308
34312
  id: string;
@@ -82,7 +82,6 @@ import { attachmentFileParamSchema, } from '../contract/index.js';
82
82
  import { agentWebhookParamsSchema, createProjectWebhookInputSchema, projectWebhookParamsSchema, sendAgentReportInputSchema, updateProjectInputSchema, updateProjectWebhookInputSchema, } from '../contract/index.js';
83
83
  import { PROJECT_WEBHOOKS_MAX } from '../contract/index.js';
84
84
  import { agentWebhook, agentWebhooks, applyTaskWebhookInput, createdWebhook, editedWebhook, nameTaken, projectWebhooks, redactWebhook, setProjectWebhooks, taskWebhooks as taskWebhookList, } from '../workspace/webhooks.js';
85
- import { detectEnvironment } from '../core/backend-detect.js';
86
85
  import { AGENT_MODELS_LOCKED_ERROR, agentModelsLocked } from '../core/agent-model-policy.js';
87
86
  import { PROVIDER_IDS } from '../core/provider-auth.js';
88
87
  import { applyProviderEnablement } from '../core/provider-availability.js';
@@ -353,7 +352,7 @@ export function createApp(deps) {
353
352
  const bootRoot = deps.repoRoot;
354
353
  const bootDataDir = projectPaths(bootRoot).write;
355
354
  // The host-wide services and the provider closures built on them live in `./server-deps.ts`.
356
- const { modelCatalog, providerAuth, workspaceConfig, openTerminal, openFile, openApp } = resolveServerDeps(deps, bootRoot);
355
+ const { modelCatalog, providerAuth, workspaceConfig, openTerminal, openFile, openApp, detectEnvironment } = resolveServerDeps(deps, bootRoot);
357
356
  const { providerStatus, providerActionError, invalidateHostModels } = createProviderStatus({ modelCatalog, providerAuth, workspaceConfig });
358
357
  const workspaceProjects = deps.workspaceProjects ?? createWorkspaceProjects({ bootRoot, bootProjectId, bindHost, home: deps.home });
359
358
  const { resolveBootProject } = workspaceProjects;
@@ -2688,7 +2687,7 @@ export function createApp(deps) {
2688
2687
  : c.json({ error: refusal }, 409);
2689
2688
  };
2690
2689
  // ---- chained family: runs lifecycle + artifacts (project-scoped) ----
2691
- const delegationService = deps.delegation?.service ?? new DelegationService();
2690
+ const delegationService = deps.delegation?.service ?? new DelegationService(deps.workerCleanup);
2692
2691
  delegationService.setDiscovery({ models: modelCatalog, providers: providerStatus });
2693
2692
  const runsRoutes = new Hono()
2694
2693
  .use('/runs/:id', adoptFallbackControl, requireRunControl)