@hearsay-tools/squawk 0.18.0-pr4407.8607 → 0.18.0-pr4407.8625
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.
- package/dist/automations/tools.d.ts +8 -8
- package/dist/ci-wait/controller.d.ts +7 -7
- package/dist/delegation/transport.d.ts +65 -65
- package/dist/features/mcp/cli.d.ts +14 -0
- package/dist/features/mcp/cli.js +87 -0
- package/dist/features/mcp/cli.js.map +1 -0
- package/dist/features/mcp/index.d.ts +9 -0
- package/dist/features/mcp/index.js +13 -0
- package/dist/features/mcp/index.js.map +1 -0
- package/dist/features/mcp/stdio.d.ts +10 -0
- package/dist/features/mcp/stdio.js +41 -0
- package/dist/features/mcp/stdio.js.map +1 -0
- package/dist/features/mcp/tools.d.ts +19 -0
- package/dist/features/mcp/tools.js +476 -0
- package/dist/features/mcp/tools.js.map +1 -0
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/models-routes.d.ts +12 -12
- package/dist/server/provider-sign-in-routes.d.ts +2 -2
- package/dist/server/providers-routes.d.ts +57 -57
- package/dist/server/repo-routes.d.ts +34 -34
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/runs-routes.d.ts +277 -277
- package/dist/server/server.d.ts +1472 -1472
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/server/workspace-routes.d.ts +84 -84
- package/dist/task-cli/cli.js +54 -221
- package/dist/task-cli/cli.js.map +1 -1
- package/dist/task-cli/discovery.d.ts +22 -1
- package/dist/task-cli/discovery.js +69 -17
- package/dist/task-cli/discovery.js.map +1 -1
- package/dist/task-cli/http.d.ts +15 -13
- package/dist/task-cli/http.js +16 -6
- package/dist/task-cli/http.js.map +1 -1
- package/dist/task-cli/operations.d.ts +156 -0
- package/dist/task-cli/operations.js +388 -0
- package/dist/task-cli/operations.js.map +1 -0
- package/dist/task-cli/watch.d.ts +31 -8
- package/dist/task-cli/watch.js +159 -91
- package/dist/task-cli/watch.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-DbLoty0g.js → accounts-section-D7EK3_7b.js} +1 -1
- package/web/dist/assets/{activity-motion-DsIybVZn.js → activity-motion-2BQBW4lA.js} +1 -1
- package/web/dist/assets/{activity-route-BXehwJ4N.js → activity-route-Ct06t8Y9.js} +1 -1
- package/web/dist/assets/{agent-config-section-BKANTX-h.js → agent-config-section-D6Lcc7c5.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-D7ohQxAI.js → agent-defaults-section-BnDBbzuG.js} +1 -1
- package/web/dist/assets/{appearance-rXtZGJD_.js → appearance-CM6ahUyy.js} +1 -1
- package/web/dist/assets/{automations-route-h7bwC5xx.js → automations-route-7B_DF4O1.js} +1 -1
- package/web/dist/assets/{commit-list-yW-pZ7Bc.js → commit-list-O4ugJ12w.js} +1 -1
- package/web/dist/assets/{diff-CfS2Qosw.js → diff-DKZvZQ2G.js} +2 -2
- package/web/dist/assets/{diff-controls-DUiipGjf.js → diff-controls-BpTFu29H.js} +1 -1
- package/web/dist/assets/{diff-view-pPxrBBze.js → diff-view-D4yXb2w7.js} +1 -1
- package/web/dist/assets/{file-preview-CGAcZe9q.js → file-preview-CUhut4J9.js} +1 -1
- package/web/dist/assets/{git-toolbar-Dwndizit.js → git-toolbar-po0QJciG.js} +1 -1
- package/web/dist/assets/{github-DJ0jdSaa.js → github-TgLTixC7.js} +1 -1
- package/web/dist/assets/{global-activity-route-BV9RmVEz.js → global-activity-route-OHCmn0ZO.js} +1 -1
- package/web/dist/assets/{image-preview-Bvd30ghX.js → image-preview-Sisptm3b.js} +1 -1
- package/web/dist/assets/{index-B-_22hXp.js → index-CvVmG4Yu.js} +5 -5
- package/web/dist/assets/{markdown-BDjWFex4.js → markdown-jle_P0a2.js} +1 -1
- package/web/dist/assets/{notifications-section-ALnp6W1u.js → notifications-section-Bhqr3yOz.js} +1 -1
- package/web/dist/assets/page-shell-DQPYcKyL.css +1 -0
- package/web/dist/assets/{preview-pane-connected-rud-axMx.js → preview-pane-connected-CBt_nlmX.js} +1 -1
- package/web/dist/assets/{projects-section-BTyOG2uL.js → projects-section-DnGSWHZJ.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-BQdQIVys.js → prompt-templates-section-8kBTviSw.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-DeCObYJC.js → remote-settings-notice-D7G8cXSx.js} +1 -1
- package/web/dist/assets/{repo-git-CegVXOtZ.js → repo-git-DqBUjQMh.js} +1 -1
- package/web/dist/assets/{report-reader-zqO4yokN.js → report-reader-DtSBGt0O.js} +1 -1
- package/web/dist/assets/{reports-DP-sxf1p.js → reports-ea3-iuBm.js} +1 -1
- package/web/dist/assets/{resources-section-B19JoAbk.js → resources-section-CpXFFHXl.js} +1 -1
- package/web/dist/assets/{run-header-PqdYTt5O.js → run-header-BWTrj0_2.js} +1 -1
- package/web/dist/assets/{select-CEH-C-jh.js → select-aiSr0uTB.js} +1 -1
- package/web/dist/assets/{session-context-section-C33VjuF4.js → session-context-section-BRaZbxVO.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-4PfVRtdT.js → settings-agent-picker-DMIqQhkC.js} +1 -1
- package/web/dist/assets/{settings-shell-CE1EKMmX.js → settings-shell-DwMbZhxp.js} +1 -1
- package/web/dist/assets/{sidebar-section-DOTH6fiq.js → sidebar-section-ClrORHpO.js} +1 -1
- package/web/dist/assets/{skills-BuxDnPg-.js → skills-B97qjJ7j.js} +1 -1
- package/web/dist/assets/{task-changes-D8rzLeLg.js → task-changes-BEfLx9dF.js} +1 -1
- package/web/dist/assets/{task-commits-BpcYm-FY.js → task-commits-6f0GpNF7.js} +1 -1
- package/web/dist/assets/{task-files-DaaC4c18.js → task-files-CA2xTRaM.js} +1 -1
- package/web/dist/assets/{task-github-item-D8kwUMZL.js → task-github-item-BWapcDJr.js} +1 -1
- package/web/dist/assets/{task-thread-9E6bYoV6.js → task-thread-0rKVutjQ.js} +1 -1
- package/web/dist/assets/{thread-state-_-bLdUA2.js → thread-state-C3eDWXYs.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-B-chm1Rk.js → use-hand-to-agent-state-DrAmCxn8.js} +1 -1
- package/web/dist/assets/{workflows-Df3RjnXf.js → workflows-CW-1K6tq.js} +1 -1
- package/web/dist/assets/{workspace-tools-CAQH-2K5.js → workspace-tools-BzDQrP3y.js} +1 -1
- package/web/dist/assets/{worktrees-section-CN78zo2m.js → worktrees-section-ay1jJn_w.js} +1 -1
- package/web/dist/index.html +3 -3
- package/web/dist/assets/page-shell-DPQBoUpR.css +0 -1
- /package/web/dist/assets/{page-shell-h8a6oznS.js → page-shell-7pLJMOgh.js} +0 -0
|
@@ -7,12 +7,6 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
|
|
|
7
7
|
output: {
|
|
8
8
|
generation: string;
|
|
9
9
|
results: ({
|
|
10
|
-
projectId: string;
|
|
11
|
-
runId: string;
|
|
12
|
-
type: "error" | "reset";
|
|
13
|
-
status: 400 | 404 | 409 | 413 | 503;
|
|
14
|
-
error: string;
|
|
15
|
-
} | {
|
|
16
10
|
projectId: string;
|
|
17
11
|
runId: string;
|
|
18
12
|
type: "batch";
|
|
@@ -33,6 +27,12 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
|
|
|
33
27
|
cursor: string;
|
|
34
28
|
afterSeq: number;
|
|
35
29
|
hasMore: boolean;
|
|
30
|
+
} | {
|
|
31
|
+
projectId: string;
|
|
32
|
+
runId: string;
|
|
33
|
+
type: "error" | "reset";
|
|
34
|
+
status: 400 | 404 | 409 | 413 | 503;
|
|
35
|
+
error: string;
|
|
36
36
|
})[];
|
|
37
37
|
};
|
|
38
38
|
outputFormat: "json";
|
|
@@ -51,34 +51,10 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
|
|
|
51
51
|
"/workspace/config": {
|
|
52
52
|
$put: {
|
|
53
53
|
output: {
|
|
54
|
-
|
|
55
|
-
projectsDir: string;
|
|
56
|
-
archiveOnMerge: boolean | null;
|
|
57
|
-
effectiveArchiveOnMerge: boolean;
|
|
58
|
-
archiveOnMergeSource: "default" | "environment" | "global";
|
|
59
|
-
composerDefaults: {
|
|
60
|
-
autonomous: boolean | null;
|
|
61
|
-
worktree: boolean | null;
|
|
62
|
-
inheritedAutonomous: "source-dependent" | boolean;
|
|
63
|
-
inheritedWorktree: boolean;
|
|
64
|
-
};
|
|
65
|
-
resources: {
|
|
66
|
-
maxParallel: number;
|
|
67
|
-
maxMonitoringSessions: number;
|
|
68
|
-
monitoringWakeIntervalMinutes: number | null;
|
|
69
|
-
autoResumeOnUsageLimit: boolean;
|
|
70
|
-
memoryLimitMb: number | null;
|
|
71
|
-
worktreeRetentionDefault: number;
|
|
72
|
-
};
|
|
73
|
-
agentDefaults: {
|
|
74
|
-
runner?: string | undefined;
|
|
75
|
-
models?: {
|
|
76
|
-
[x: string]: string | undefined;
|
|
77
|
-
} | undefined;
|
|
78
|
-
};
|
|
54
|
+
error: string;
|
|
79
55
|
};
|
|
80
56
|
outputFormat: "json";
|
|
81
|
-
status:
|
|
57
|
+
status: 400;
|
|
82
58
|
input: {
|
|
83
59
|
json: {
|
|
84
60
|
browseRoot?: string | undefined;
|
|
@@ -107,7 +83,7 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
|
|
|
107
83
|
error: string;
|
|
108
84
|
};
|
|
109
85
|
outputFormat: "json";
|
|
110
|
-
status:
|
|
86
|
+
status: 500;
|
|
111
87
|
input: {
|
|
112
88
|
json: {
|
|
113
89
|
browseRoot?: string | undefined;
|
|
@@ -133,10 +109,34 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
|
|
|
133
109
|
};
|
|
134
110
|
} | {
|
|
135
111
|
output: {
|
|
136
|
-
|
|
112
|
+
browseRoot: string;
|
|
113
|
+
projectsDir: string;
|
|
114
|
+
archiveOnMerge: boolean | null;
|
|
115
|
+
effectiveArchiveOnMerge: boolean;
|
|
116
|
+
archiveOnMergeSource: "default" | "environment" | "global";
|
|
117
|
+
composerDefaults: {
|
|
118
|
+
autonomous: boolean | null;
|
|
119
|
+
worktree: boolean | null;
|
|
120
|
+
inheritedAutonomous: "source-dependent" | boolean;
|
|
121
|
+
inheritedWorktree: boolean;
|
|
122
|
+
};
|
|
123
|
+
resources: {
|
|
124
|
+
maxParallel: number;
|
|
125
|
+
maxMonitoringSessions: number;
|
|
126
|
+
monitoringWakeIntervalMinutes: number | null;
|
|
127
|
+
autoResumeOnUsageLimit: boolean;
|
|
128
|
+
memoryLimitMb: number | null;
|
|
129
|
+
worktreeRetentionDefault: number;
|
|
130
|
+
};
|
|
131
|
+
agentDefaults: {
|
|
132
|
+
runner?: string | undefined;
|
|
133
|
+
models?: {
|
|
134
|
+
[x: string]: string | undefined;
|
|
135
|
+
} | undefined;
|
|
136
|
+
};
|
|
137
137
|
};
|
|
138
138
|
outputFormat: "json";
|
|
139
|
-
status:
|
|
139
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
140
140
|
input: {
|
|
141
141
|
json: {
|
|
142
142
|
browseRoot?: string | undefined;
|
|
@@ -208,41 +208,10 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
|
|
|
208
208
|
"/workspace/ui-state": {
|
|
209
209
|
$put: {
|
|
210
210
|
output: {
|
|
211
|
-
|
|
212
|
-
sidebar?: {
|
|
213
|
-
[x: string]: import("hono/utils/types").JSONValue;
|
|
214
|
-
collapsed?: {
|
|
215
|
-
[x: string]: boolean;
|
|
216
|
-
} | undefined;
|
|
217
|
-
projectOrder?: string[] | undefined;
|
|
218
|
-
} | undefined;
|
|
219
|
-
dismissedProviderAuthFailures?: {
|
|
220
|
-
[x: string]: string | undefined;
|
|
221
|
-
} | undefined;
|
|
222
|
-
appearance?: {
|
|
223
|
-
accent?: "cezarion" | "lime" | "violet" | undefined;
|
|
224
|
-
density?: "comfortable" | "compact" | "ultra" | undefined;
|
|
225
|
-
width?: "narrow" | "wide" | undefined;
|
|
226
|
-
} | undefined;
|
|
227
|
-
notifications?: {
|
|
228
|
-
[x: string]: import("hono/utils/types").JSONValue;
|
|
229
|
-
enabled?: boolean | undefined;
|
|
230
|
-
} | undefined;
|
|
231
|
-
taskTable?: {
|
|
232
|
-
[x: string]: import("hono/utils/types").JSONValue;
|
|
233
|
-
expandedColumns?: {
|
|
234
|
-
[x: string]: boolean;
|
|
235
|
-
} | undefined;
|
|
236
|
-
} | undefined;
|
|
237
|
-
lastLocation?: {
|
|
238
|
-
projectId: string;
|
|
239
|
-
pathname: string;
|
|
240
|
-
search?: string | undefined;
|
|
241
|
-
hash?: string | undefined;
|
|
242
|
-
} | undefined;
|
|
211
|
+
error: string;
|
|
243
212
|
};
|
|
244
213
|
outputFormat: "json";
|
|
245
|
-
status:
|
|
214
|
+
status: 500;
|
|
246
215
|
input: {
|
|
247
216
|
json: {
|
|
248
217
|
[x: string]: unknown;
|
|
@@ -275,10 +244,41 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
|
|
|
275
244
|
};
|
|
276
245
|
} | {
|
|
277
246
|
output: {
|
|
278
|
-
|
|
247
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
248
|
+
sidebar?: {
|
|
249
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
250
|
+
collapsed?: {
|
|
251
|
+
[x: string]: boolean;
|
|
252
|
+
} | undefined;
|
|
253
|
+
projectOrder?: string[] | undefined;
|
|
254
|
+
} | undefined;
|
|
255
|
+
dismissedProviderAuthFailures?: {
|
|
256
|
+
[x: string]: string | undefined;
|
|
257
|
+
} | undefined;
|
|
258
|
+
appearance?: {
|
|
259
|
+
accent?: "cezarion" | "lime" | "violet" | undefined;
|
|
260
|
+
density?: "comfortable" | "compact" | "ultra" | undefined;
|
|
261
|
+
width?: "narrow" | "wide" | undefined;
|
|
262
|
+
} | undefined;
|
|
263
|
+
notifications?: {
|
|
264
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
265
|
+
enabled?: boolean | undefined;
|
|
266
|
+
} | undefined;
|
|
267
|
+
taskTable?: {
|
|
268
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
269
|
+
expandedColumns?: {
|
|
270
|
+
[x: string]: boolean;
|
|
271
|
+
} | undefined;
|
|
272
|
+
} | undefined;
|
|
273
|
+
lastLocation?: {
|
|
274
|
+
projectId: string;
|
|
275
|
+
pathname: string;
|
|
276
|
+
search?: string | undefined;
|
|
277
|
+
hash?: string | undefined;
|
|
278
|
+
} | undefined;
|
|
279
279
|
};
|
|
280
280
|
outputFormat: "json";
|
|
281
|
-
status:
|
|
281
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
282
282
|
input: {
|
|
283
283
|
json: {
|
|
284
284
|
[x: string]: unknown;
|
|
@@ -329,10 +329,17 @@ export declare function createFsBrowseRoutes(workspaceBrowseRoot: () => Promise<
|
|
|
329
329
|
};
|
|
330
330
|
} | {
|
|
331
331
|
output: {
|
|
332
|
-
|
|
332
|
+
path: string;
|
|
333
|
+
parent: string | null;
|
|
334
|
+
dirs: {
|
|
335
|
+
name: string;
|
|
336
|
+
path: string;
|
|
337
|
+
isRepo: boolean;
|
|
338
|
+
}[];
|
|
339
|
+
truncated: boolean;
|
|
333
340
|
};
|
|
334
341
|
outputFormat: "json";
|
|
335
|
-
status:
|
|
342
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
336
343
|
input: {
|
|
337
344
|
query: {
|
|
338
345
|
path?: string | undefined;
|
|
@@ -341,17 +348,10 @@ export declare function createFsBrowseRoutes(workspaceBrowseRoot: () => Promise<
|
|
|
341
348
|
};
|
|
342
349
|
} | {
|
|
343
350
|
output: {
|
|
344
|
-
|
|
345
|
-
parent: string | null;
|
|
346
|
-
dirs: {
|
|
347
|
-
name: string;
|
|
348
|
-
path: string;
|
|
349
|
-
isRepo: boolean;
|
|
350
|
-
}[];
|
|
351
|
-
truncated: boolean;
|
|
351
|
+
error: string;
|
|
352
352
|
};
|
|
353
353
|
outputFormat: "json";
|
|
354
|
-
status:
|
|
354
|
+
status: 400 | 403 | 404;
|
|
355
355
|
input: {
|
|
356
356
|
query: {
|
|
357
357
|
path?: string | undefined;
|
|
@@ -370,15 +370,6 @@ export interface WorkspaceEventsRouteDeps {
|
|
|
370
370
|
export declare function createWorkspaceEventsRoutes(deps: WorkspaceEventsRouteDeps): import("hono/hono-base").HonoBase<ProjectApiEnv, {
|
|
371
371
|
"/workspace/events": {
|
|
372
372
|
$get: {
|
|
373
|
-
output: {};
|
|
374
|
-
outputFormat: string;
|
|
375
|
-
status: import("hono/utils/http-status").StatusCode;
|
|
376
|
-
input: {
|
|
377
|
-
query: {
|
|
378
|
-
runs?: "summary" | undefined;
|
|
379
|
-
};
|
|
380
|
-
};
|
|
381
|
-
} | {
|
|
382
373
|
output: {
|
|
383
374
|
error: string;
|
|
384
375
|
code?: "invalid_input" | undefined;
|
|
@@ -390,6 +381,15 @@ export declare function createWorkspaceEventsRoutes(deps: WorkspaceEventsRouteDe
|
|
|
390
381
|
runs?: "summary" | undefined;
|
|
391
382
|
};
|
|
392
383
|
};
|
|
384
|
+
} | {
|
|
385
|
+
output: {};
|
|
386
|
+
outputFormat: string;
|
|
387
|
+
status: import("hono/utils/http-status").StatusCode;
|
|
388
|
+
input: {
|
|
389
|
+
query: {
|
|
390
|
+
runs?: "summary" | undefined;
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
393
|
};
|
|
394
394
|
};
|
|
395
395
|
}, "/", "/workspace/events">;
|
package/dist/task-cli/cli.js
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
import { commandText } from '../home/command.js';
|
|
2
2
|
import { productEnv } from '../core/product-env.js';
|
|
3
|
-
import { randomUUID } from 'node:crypto';
|
|
4
3
|
import { open as openFile } from 'node:fs/promises';
|
|
5
4
|
import { resolve } from 'node:path';
|
|
6
5
|
import { parseArgs } from 'node:util';
|
|
7
6
|
import { controlLocation } from '../contract/index.js';
|
|
8
|
-
import {
|
|
9
|
-
import { changesPayloadSchema } from '../contract/index.js';
|
|
10
|
-
import { pendingAskOf } from '../contract/index.js';
|
|
11
|
-
import { asksQuestion } from '../contract/index.js';
|
|
12
|
-
import { runHistoryContextSchema } from '../contract/index.js';
|
|
13
|
-
import { runnerSkillListSchema } from '../contract/index.js';
|
|
14
|
-
import { runnerSchema } from '../contract/index.js';
|
|
15
|
-
import { runnersResponseSchema } from '../contract/index.js';
|
|
7
|
+
import { runStatusSchema } from '../contract/index.js';
|
|
16
8
|
import { openUrl } from '../open-url.js';
|
|
17
9
|
import { knownRunnerIds } from '../core/runner-registry.js';
|
|
18
|
-
import { runnerFlag, skillFlagIssue
|
|
10
|
+
import { runnerFlag, skillFlagIssue } from '../workflows/types.js';
|
|
19
11
|
import { discoverCockpit } from './discovery.js';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { DEFAULT_WAIT_UNTIL, readLog
|
|
12
|
+
import { TaskCliError, threadUrl } from './http.js';
|
|
13
|
+
import { archiveFinishedTasks, archiveTask, finishTask, getRun, getTaskDiff, getTaskStatus, listTasks, sendTaskMessage, setTaskNotify, startTask, stopTask, waitForTasks, workerParent, } from './operations.js';
|
|
14
|
+
import { DEFAULT_WAIT_UNTIL, readLog } from './watch.js';
|
|
23
15
|
/**
|
|
24
16
|
* `cez task` — start, watch and steer cockpit tasks from a terminal or a bot (#504, spec
|
|
25
17
|
* 2026-09-24-cez-task-cli). A thin JSON client over the cockpit's own run routes: one JSON
|
|
@@ -419,41 +411,12 @@ function validateFlags(name, values) {
|
|
|
419
411
|
if (name === 'wait' || name === 'log' || values.wait)
|
|
420
412
|
timeoutMs(values);
|
|
421
413
|
}
|
|
422
|
-
async function getRun(cockpit, id) {
|
|
423
|
-
const result = await request(cockpit, `/runs/${encodeURIComponent(id)}`);
|
|
424
|
-
if (result.status !== 200)
|
|
425
|
-
refuse(result);
|
|
426
|
-
const run = apiRunSchema.safeParse(result.data);
|
|
427
|
-
return run.success ? run.data : invalidResponse('run');
|
|
428
|
-
}
|
|
429
|
-
/** `list --full` prints contract `ApiRun` rows, so it alone still reads every full record. */
|
|
430
|
-
async function listRuns(cockpit) {
|
|
431
|
-
const result = await request(cockpit, '/runs');
|
|
432
|
-
if (result.status !== 200)
|
|
433
|
-
refuse(result);
|
|
434
|
-
const runs = apiRunSchema.array().safeParse(result.data);
|
|
435
|
-
return runs.success ? runs.data : invalidResponse('run list');
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Workers are steer targets of their parent, not tasks ops follows (#635): the list leaves them
|
|
439
|
-
* out, and subscribing one to the webhook is refused with the parent to subscribe instead. Every
|
|
440
|
-
* other id-addressed operation still reaches a worker.
|
|
441
|
-
*/
|
|
442
|
-
function workerParent(run) {
|
|
443
|
-
return run.delegation?.role === 'worker' ? run.delegation.parentRunId : undefined;
|
|
444
|
-
}
|
|
445
414
|
async function refuseWorkerNotify(cockpit, id) {
|
|
446
415
|
const parentId = workerParent(await getRun(cockpit, id));
|
|
447
416
|
if (parentId !== undefined) {
|
|
448
417
|
usageError(commandText(`task ${id} is a worker of task ${parentId}; notify the parent instead: cez task notify ${parentId}`), { parentId });
|
|
449
418
|
}
|
|
450
419
|
}
|
|
451
|
-
/** The latest valid unanswered question, from the same derivation the cockpit renders. */
|
|
452
|
-
async function pendingQuestion(cockpit, id) {
|
|
453
|
-
const result = await request(cockpit, `/runs/${encodeURIComponent(id)}/history-context`);
|
|
454
|
-
const context = runHistoryContextSchema.safeParse(result.data);
|
|
455
|
-
return result.status === 200 && context.success ? pendingAskOf(context.data.contextEvents) : undefined;
|
|
456
|
-
}
|
|
457
420
|
/** The boolean start flags, each sent only when given, so an absent flag keeps the server default. */
|
|
458
421
|
function startToggles(values) {
|
|
459
422
|
return {
|
|
@@ -465,143 +428,63 @@ function startToggles(values) {
|
|
|
465
428
|
...(values['no-messaging'] ? { allowMessaging: false } : {}),
|
|
466
429
|
};
|
|
467
430
|
}
|
|
468
|
-
/**
|
|
469
|
-
* The project's default runner as the server runs it. A stored id no runner registered names the
|
|
470
|
-
* first registered runner, as the server's `resolveRunnerId` does (hearsay-tools/squawk#4200). When
|
|
471
|
-
* the runners list cannot be read, the stored id is used as it is.
|
|
472
|
-
*/
|
|
473
|
-
async function defaultRunnerFor(cockpit) {
|
|
474
|
-
const config = await request(cockpit, '/config');
|
|
475
|
-
const stored = config.status === 200 && config.data && typeof config.data === 'object' ? runnerSchema.safeParse(Reflect.get(config.data, 'defaultRunner')) : undefined;
|
|
476
|
-
if (!stored?.success)
|
|
477
|
-
return undefined;
|
|
478
|
-
const runners = await fetchJson(`${cockpit.origin}/api/v1/runners`);
|
|
479
|
-
const registered = runners.status === 200 ? runnersResponseSchema.safeParse(runners.data) : undefined;
|
|
480
|
-
if (!registered?.success)
|
|
481
|
-
return stored.data;
|
|
482
|
-
const ids = registered.data.runners.map((entry) => entry.id);
|
|
483
|
-
return ids.includes(stored.data) ? stored.data : ids[0] ?? stored.data;
|
|
484
|
-
}
|
|
485
|
-
async function skillWarning(cockpit, skill, runner) {
|
|
486
|
-
let warning;
|
|
487
|
-
// Discovery is advisory: the catalog can change before a queued run executes. The server
|
|
488
|
-
// fails a step with a missing skill, and idempotent retries still go to POST /runs.
|
|
489
|
-
const unverified = `could not check whether skill "${skill}" is available; a missing id fails the step`;
|
|
490
|
-
try {
|
|
491
|
-
const selectedRunner = runner ?? await defaultRunnerFor(cockpit);
|
|
492
|
-
const catalog = selectedRunner ? await request(cockpit, `/runner-skills?runner=${encodeURIComponent(selectedRunner)}`) : undefined;
|
|
493
|
-
if (catalog?.status === 200) {
|
|
494
|
-
const skills = runnerSkillListSchema.safeParse(catalog.data);
|
|
495
|
-
warning = skills.success
|
|
496
|
-
? skills.data.skills.some((entry) => entry.id === skill)
|
|
497
|
-
? undefined
|
|
498
|
-
: `skill "${skill}" is not currently available; a missing id fails the step`
|
|
499
|
-
: unverified;
|
|
500
|
-
}
|
|
501
|
-
else {
|
|
502
|
-
warning = unverified;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
catch {
|
|
506
|
-
warning = unverified;
|
|
507
|
-
}
|
|
508
|
-
return warning;
|
|
509
|
-
}
|
|
510
431
|
async function start(cockpit, io, values, task, print) {
|
|
511
432
|
const waitMs = values.wait ? timeoutMs(values) : undefined;
|
|
512
|
-
const requestId = values['request-id'] ?? randomUUID();
|
|
513
|
-
const skill = values.skill;
|
|
514
433
|
const { runner } = runnerFlag({ runner: values.runner, backend: values.backend });
|
|
515
434
|
// The webhook is opt-in: only `--notify` subscribes the task, and the server refuses it on a
|
|
516
435
|
// project with no webhook (400 with a hint). `--no-notify` stays accepted for older scripts.
|
|
517
436
|
const notify = values['no-notify'] ? false : values.notify ? true : undefined;
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
...startToggles(values),
|
|
529
|
-
notify,
|
|
530
|
-
clientRequestId: requestId,
|
|
531
|
-
},
|
|
437
|
+
const started = await startTask(cockpit, {
|
|
438
|
+
task,
|
|
439
|
+
requestId: values['request-id'],
|
|
440
|
+
workflow: values.workflow,
|
|
441
|
+
skill: values.skill,
|
|
442
|
+
runner,
|
|
443
|
+
model: values.model,
|
|
444
|
+
effort: values.effort,
|
|
445
|
+
...startToggles(values),
|
|
446
|
+
notify,
|
|
532
447
|
});
|
|
533
|
-
if (result.status !== 200 && result.status !== 201)
|
|
534
|
-
refuse(result);
|
|
535
|
-
const run = runRecordSchema.safeParse(result.data);
|
|
536
|
-
if (!run.success)
|
|
537
|
-
invalidResponse('start');
|
|
538
|
-
const started = {
|
|
539
|
-
id: run.data.id,
|
|
540
|
-
url: threadUrl(cockpit, run.data.id),
|
|
541
|
-
status: run.data.status,
|
|
542
|
-
created: result.status === 201,
|
|
543
|
-
requestId,
|
|
544
|
-
notify: run.data.notify === true,
|
|
545
|
-
warning,
|
|
546
|
-
branch: run.data.branch,
|
|
547
|
-
};
|
|
548
448
|
if (waitMs === undefined) {
|
|
549
449
|
print(started);
|
|
550
450
|
return EXIT.ok;
|
|
551
451
|
}
|
|
552
|
-
const waited = await
|
|
452
|
+
const waited = await waitForTasks(cockpit, {
|
|
453
|
+
ids: [started.id],
|
|
454
|
+
mode: 'all',
|
|
455
|
+
until: waitUntil(values),
|
|
456
|
+
timeoutMs: waitMs,
|
|
457
|
+
pollMs: io.pollMs,
|
|
458
|
+
});
|
|
553
459
|
const final = waited.runs[0];
|
|
554
460
|
print({ ...started, ...final, until: waited.until, timedOut: waited.timedOut });
|
|
555
461
|
return waited.exitCode;
|
|
556
462
|
}
|
|
557
|
-
async function setNotify(cockpit, id, notify, message) {
|
|
558
|
-
const result = await request(cockpit, `/runs/${encodeURIComponent(id)}/notify`, {
|
|
559
|
-
body: { notify, message },
|
|
560
|
-
});
|
|
561
|
-
if (result.status !== 200)
|
|
562
|
-
refuse(result);
|
|
563
|
-
const run = runRecordSchema.safeParse(result.data);
|
|
564
|
-
return run.success ? run.data : invalidResponse('notify');
|
|
565
|
-
}
|
|
566
463
|
async function send(cockpit, values, id, text, print) {
|
|
567
|
-
const path = `/runs/${encodeURIComponent(id)}`;
|
|
568
464
|
if (values.notify)
|
|
569
465
|
await refuseWorkerNotify(cockpit, id);
|
|
570
466
|
// Before the message, so the status change it causes is already reported.
|
|
571
|
-
const notified = values.notify ? { notify: (await
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
if (!answer.success)
|
|
576
|
-
invalidResponse('message');
|
|
577
|
-
const delivery = 'delivered' in answer.data ? 'delivered' : 'queued' in answer.data ? 'queued' : 'deferred';
|
|
578
|
-
print({ id, delivery, ...notified });
|
|
579
|
-
return EXIT.ok;
|
|
580
|
-
}
|
|
581
|
-
const closed = delivered.status === 409 && delivered.data?.error === 'session closed';
|
|
582
|
-
if (!closed)
|
|
583
|
-
refuse(delivered);
|
|
584
|
-
if (!values.resume) {
|
|
585
|
-
print({ id, delivery: 'not-delivered', reason: 'session closed', next: commandText(`cez task send ${id} '…' --resume`), ...notified });
|
|
586
|
-
return EXIT.failed;
|
|
587
|
-
}
|
|
588
|
-
const resumed = await request(cockpit, `${path}/continue`, { body: { text } });
|
|
589
|
-
if (resumed.status !== 200)
|
|
590
|
-
refuse(resumed);
|
|
591
|
-
print({ id, delivery: 'resumed', ...notified });
|
|
592
|
-
return EXIT.ok;
|
|
467
|
+
const notified = values.notify ? { notify: (await setTaskNotify(cockpit, id, true, undefined)).notify === true } : {};
|
|
468
|
+
const result = await sendTaskMessage(cockpit, { id, text, resume: values.resume === true }, { closedHintStyle: 'cli' });
|
|
469
|
+
print({ ...result, ...notified });
|
|
470
|
+
return result.delivery === 'not-delivered' ? EXIT.failed : EXIT.ok;
|
|
593
471
|
}
|
|
594
472
|
async function notify(cockpit, id, values, text, print) {
|
|
595
473
|
// --off stays open so a subscription made before this guard can still be undone.
|
|
596
474
|
if (!values.off)
|
|
597
475
|
await refuseWorkerNotify(cockpit, id);
|
|
598
|
-
const run = await
|
|
476
|
+
const run = await setTaskNotify(cockpit, id, !values.off, text);
|
|
599
477
|
print({ id, notify: run.notify === true, ...(text === undefined ? {} : { message: true }) });
|
|
600
478
|
return EXIT.ok;
|
|
601
479
|
}
|
|
602
480
|
async function wait(cockpit, io, values, positionals, print) {
|
|
603
|
-
const
|
|
604
|
-
|
|
481
|
+
const waited = await waitForTasks(cockpit, {
|
|
482
|
+
ids: positionals,
|
|
483
|
+
mode: waitMode(values),
|
|
484
|
+
until: waitUntil(values),
|
|
485
|
+
timeoutMs: timeoutMs(values),
|
|
486
|
+
pollMs: io.pollMs,
|
|
487
|
+
});
|
|
605
488
|
print({ until: waited.until, runs: waited.runs, timedOut: waited.timedOut });
|
|
606
489
|
return waited.exitCode;
|
|
607
490
|
}
|
|
@@ -617,85 +500,36 @@ async function log(cockpit, id, io, values) {
|
|
|
617
500
|
});
|
|
618
501
|
}
|
|
619
502
|
async function status(cockpit, id, values, print) {
|
|
620
|
-
|
|
621
|
-
if (values.full) {
|
|
622
|
-
print(run);
|
|
623
|
-
return EXIT.ok;
|
|
624
|
-
}
|
|
625
|
-
const question = asksQuestion(run) ? await pendingQuestion(cockpit, id) : undefined;
|
|
626
|
-
print({ ...projectStatus(run, threadUrl(cockpit, id), question), handoffUrl: handoffUrl(cockpit, id) });
|
|
503
|
+
print(await getTaskStatus(cockpit, { id, full: values.full === true }));
|
|
627
504
|
return EXIT.ok;
|
|
628
505
|
}
|
|
629
506
|
async function list(cockpit, values, print) {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
.
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
|
637
|
-
// Without --all, archived runs are dropped above, so the windowed list (#864) has every row
|
|
638
|
-
// this prints; --all needs every archived run there is.
|
|
639
|
-
const summaries = () => requestRunSummaries(cockpit, undefined, values.all ? {} : { archived: 'recent' });
|
|
640
|
-
const runs = values.full ? listed(await listRuns(cockpit)) : listed(await summaries());
|
|
641
|
-
print({ runs: runs.slice(0, limit).map((run) => (values.full ? run : projectListRow(run))), total: runs.length });
|
|
507
|
+
print(await listTasks(cockpit, {
|
|
508
|
+
statuses: statuses(values.status),
|
|
509
|
+
limit: listLimit(values),
|
|
510
|
+
all: values.all === true,
|
|
511
|
+
full: values.full === true,
|
|
512
|
+
}));
|
|
642
513
|
return EXIT.ok;
|
|
643
514
|
}
|
|
644
|
-
async function stop(cockpit,
|
|
645
|
-
|
|
646
|
-
const answer = cancelResponseSchema.safeParse(result.data);
|
|
647
|
-
if (result.status !== 200)
|
|
648
|
-
refuse(result);
|
|
649
|
-
if (!answer.success)
|
|
650
|
-
invalidResponse('cancel');
|
|
651
|
-
print({ id, cancelled: answer.data.cancelled });
|
|
515
|
+
async function stop(cockpit, id, print) {
|
|
516
|
+
print(await stopTask(cockpit, id));
|
|
652
517
|
return EXIT.ok;
|
|
653
518
|
}
|
|
654
|
-
async function finish(cockpit,
|
|
655
|
-
|
|
656
|
-
if (result.status !== 200)
|
|
657
|
-
refuse(result);
|
|
658
|
-
if (!finishResponseSchema.safeParse(result.data).success)
|
|
659
|
-
invalidResponse('finish');
|
|
660
|
-
print({ id, finished: true });
|
|
519
|
+
async function finish(cockpit, id, print) {
|
|
520
|
+
print(await finishTask(cockpit, id));
|
|
661
521
|
return EXIT.ok;
|
|
662
522
|
}
|
|
663
|
-
async function archive(cockpit,
|
|
664
|
-
|
|
665
|
-
const result = await request(cockpit, `${path}/archive`, { body: { archived } });
|
|
666
|
-
if (result.status !== 200)
|
|
667
|
-
refuse(result);
|
|
668
|
-
const run = runRecordSchema.safeParse(result.data);
|
|
669
|
-
if (!run.success)
|
|
670
|
-
invalidResponse('archive');
|
|
671
|
-
print({ id: run.data.id, archived: run.data.archived === true });
|
|
523
|
+
async function archive(cockpit, name, id, print) {
|
|
524
|
+
print(await archiveTask(cockpit, id, name === 'archive'));
|
|
672
525
|
return EXIT.ok;
|
|
673
526
|
}
|
|
674
527
|
async function archiveFinished(cockpit, print) {
|
|
675
|
-
|
|
676
|
-
if (result.status !== 200)
|
|
677
|
-
refuse(result);
|
|
678
|
-
const answer = archiveFinishedResponseSchema.safeParse(result.data);
|
|
679
|
-
if (!answer.success)
|
|
680
|
-
invalidResponse('archive-finished');
|
|
681
|
-
print(answer.data);
|
|
528
|
+
print(await archiveFinishedTasks(cockpit));
|
|
682
529
|
return EXIT.ok;
|
|
683
530
|
}
|
|
684
|
-
async function diff(cockpit,
|
|
685
|
-
|
|
686
|
-
const result = await request(cockpit, `${path}/changes`);
|
|
687
|
-
if (result.status !== 200)
|
|
688
|
-
refuse(result);
|
|
689
|
-
const changes = changesPayloadSchema.safeParse(result.data);
|
|
690
|
-
if (!changes.success)
|
|
691
|
-
invalidResponse('changes');
|
|
692
|
-
print({ id, stat: changes.data.stat, files: changes.data.files.map((file) => ({ path: file.path, status: file.status, adds: file.adds, dels: file.dels })) });
|
|
693
|
-
return EXIT.ok;
|
|
694
|
-
}
|
|
695
|
-
const result = await request(cockpit, `${path}/diff`);
|
|
696
|
-
if (result.status !== 200)
|
|
697
|
-
refuse(result);
|
|
698
|
-
print({ id, diff: typeof result.data === 'string' ? result.data : invalidResponse('diff') });
|
|
531
|
+
async function diff(cockpit, id, values, print) {
|
|
532
|
+
print(await getTaskDiff(cockpit, { id, stat: values.stat === true }));
|
|
699
533
|
return EXIT.ok;
|
|
700
534
|
}
|
|
701
535
|
async function open(cockpit, io, id, values, print) {
|
|
@@ -709,7 +543,6 @@ async function open(cockpit, io, id, values, print) {
|
|
|
709
543
|
/** One helper per operation, so this switch stays a dispatcher under the complexity limit. */
|
|
710
544
|
async function execute(name, cockpit, io, values, positionals, text, print) {
|
|
711
545
|
const id = positionals[0];
|
|
712
|
-
const path = `/runs/${encodeURIComponent(id)}`;
|
|
713
546
|
switch (name) {
|
|
714
547
|
case 'start':
|
|
715
548
|
return start(cockpit, io, values, text, print);
|
|
@@ -726,16 +559,16 @@ async function execute(name, cockpit, io, values, positionals, text, print) {
|
|
|
726
559
|
case 'list':
|
|
727
560
|
return list(cockpit, values, print);
|
|
728
561
|
case 'stop':
|
|
729
|
-
return stop(cockpit,
|
|
562
|
+
return stop(cockpit, id, print);
|
|
730
563
|
case 'finish':
|
|
731
|
-
return finish(cockpit,
|
|
564
|
+
return finish(cockpit, id, print);
|
|
732
565
|
case 'archive':
|
|
733
566
|
case 'unarchive':
|
|
734
|
-
return archive(cockpit,
|
|
567
|
+
return archive(cockpit, name, id, print);
|
|
735
568
|
case 'archive-finished':
|
|
736
569
|
return archiveFinished(cockpit, print);
|
|
737
570
|
case 'diff':
|
|
738
|
-
return diff(cockpit,
|
|
571
|
+
return diff(cockpit, id, values, print);
|
|
739
572
|
case 'open':
|
|
740
573
|
return open(cockpit, io, id, values, print);
|
|
741
574
|
default:
|