@hearsay-tools/squawk 0.18.0-pr3545.6411 → 0.18.0-pr3552.6420
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/README.md +1 -1
- package/dist/autosave-commit.d.ts +2 -2
- package/dist/ci-wait/controller.d.ts +41 -41
- package/dist/ci-wait/tools.d.ts +4 -4
- package/dist/delegation/routes.d.ts +9 -9
- package/dist/delegation/service.js +1 -1
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +20 -20
- package/dist/delegation/workspace-removal.js +21 -8
- package/dist/delegation/workspace-removal.js.map +1 -1
- package/dist/runs/store.d.ts +2 -2
- package/dist/runs/store.js +9 -14
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/worker-execution.d.ts +17 -0
- package/dist/runs/worker-execution.js +32 -0
- package/dist/runs/worker-execution.js.map +1 -1
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/forge/draft-pr.js +25 -15
- package/dist/server/forge/draft-pr.js.map +1 -1
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/server.js +16 -21
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/task-branch-head.d.ts +7 -0
- package/dist/task-branch-head.js +34 -0
- package/dist/task-branch-head.js.map +1 -0
- package/dist/workflows/continuation-admission.d.ts +7 -0
- package/dist/workflows/continuation-admission.js +5 -3
- package/dist/workflows/continuation-admission.js.map +1 -1
- package/dist/workflows/input-acknowledgement.d.ts +24 -24
- package/dist/workflows/run/compose.js +1 -4
- package/dist/workflows/run/compose.js.map +1 -1
- package/dist/workflows/run/continuation-acceptance.d.ts +1 -5
- package/dist/workflows/run/continuation-acceptance.js +8 -4
- package/dist/workflows/run/continuation-acceptance.js.map +1 -1
- package/dist/workflows/run/run-line.d.ts +0 -1
- package/dist/workflows/run/run-line.js +2 -1
- package/dist/workflows/run/run-line.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +72 -72
- package/dist/workflows/run/worker-executions.d.ts +0 -1
- package/dist/workflows/run/worker-executions.js +4 -3
- package/dist/workflows/run/worker-executions.js.map +1 -1
- package/dist/workflows/run/worker-orphans.d.ts +3 -6
- package/dist/workflows/run/worker-orphans.js +8 -10
- package/dist/workflows/run/worker-orphans.js.map +1 -1
- package/dist/workflows/run.d.ts +2 -5
- package/package.json +4 -4
|
@@ -22,3 +22,20 @@ export type WorkerExecution = z.infer<typeof workerExecutionSchema>;
|
|
|
22
22
|
* project move left in `.ai/cezar/` keeps its evidence there; only such a task's own evidence
|
|
23
23
|
* files reserve it, so a kept task that never was a worker stays deletable. */
|
|
24
24
|
export declare function workerEvidenceRunIds(dataDir: string): string[] | undefined;
|
|
25
|
+
/** Why a worker execution may not start, and the command that gets past it (hearsay-tools/squawk#867). */
|
|
26
|
+
export declare class WorkerAdmissionRefusal extends Error {
|
|
27
|
+
readonly next: string;
|
|
28
|
+
constructor(cause: string, next: string);
|
|
29
|
+
}
|
|
30
|
+
export declare const SPAWN_NEXT = "spawn a new worker with the instruction";
|
|
31
|
+
/** The previous execution when it lets a new one start: complete, or queued and never started. */
|
|
32
|
+
export declare function admissibleExecution(prior: WorkerExecution | undefined): WorkerExecution;
|
|
33
|
+
/** The refusal for live holders of the worker's paths; no PID means the holder proof was unreadable. */
|
|
34
|
+
export declare function holderRefusal(holders: readonly number[]): WorkerAdmissionRefusal;
|
|
35
|
+
/** The refusal a failed admission returns: its own cause and next step. Only an error without
|
|
36
|
+
* a message falls back to `fallback`. */
|
|
37
|
+
export declare function admissionRefusal(error: unknown, fallback: string): {
|
|
38
|
+
ok: false;
|
|
39
|
+
error: string;
|
|
40
|
+
next?: string;
|
|
41
|
+
};
|
|
@@ -2,6 +2,7 @@ import { legacyRunsBeside, runDataDir } from '../legacy-runs.js';
|
|
|
2
2
|
import { lstatSync, readdirSync, realpathSync } from 'node:fs';
|
|
3
3
|
import { isAbsolute, join, resolve } from 'node:path';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
+
import { describeProcesses } from '../delegation/process-liveness.js';
|
|
5
6
|
/** Terminal task intent survives loss/quarantine of the public run index. Starting a new
|
|
6
7
|
* generation replaces this entire checkpoint, so an old cleanup cannot authorize reuse. */
|
|
7
8
|
export const workerExecutionSchema = z.object({
|
|
@@ -44,4 +45,35 @@ function evidenceIdsIn(dir) {
|
|
|
44
45
|
return error.code === 'ENOENT' ? [] : undefined;
|
|
45
46
|
}
|
|
46
47
|
}
|
|
48
|
+
/** Why a worker execution may not start, and the command that gets past it (hearsay-tools/squawk#867). */
|
|
49
|
+
export class WorkerAdmissionRefusal extends Error {
|
|
50
|
+
next;
|
|
51
|
+
constructor(cause, next) {
|
|
52
|
+
super(cause);
|
|
53
|
+
this.next = next;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export const SPAWN_NEXT = 'spawn a new worker with the instruction';
|
|
57
|
+
/** The previous execution when it lets a new one start: complete, or queued and never started. */
|
|
58
|
+
export function admissibleExecution(prior) {
|
|
59
|
+
if (prior?.abandoned)
|
|
60
|
+
throw new WorkerAdmissionRefusal('the worker execution was abandoned', SPAWN_NEXT);
|
|
61
|
+
if (!prior || (prior.phase !== 'queued' && prior.phase !== 'complete')) {
|
|
62
|
+
throw new WorkerAdmissionRefusal(`the previous execution is not proven finished (checkpoint ${prior?.phase ?? 'missing'})`, `retry the same command after it ends; if this repeats, ${SPAWN_NEXT}`);
|
|
63
|
+
}
|
|
64
|
+
return prior;
|
|
65
|
+
}
|
|
66
|
+
/** The refusal for live holders of the worker's paths; no PID means the holder proof was unreadable. */
|
|
67
|
+
export function holderRefusal(holders) {
|
|
68
|
+
return holders.length
|
|
69
|
+
? new WorkerAdmissionRefusal(`processes ${describeProcesses(holders)} still hold the worker's worktree or scratch`, 'end them, then retry the same command')
|
|
70
|
+
: new WorkerAdmissionRefusal("the worker's worktree or scratch is not proven free of processes", `retry the same command; if this repeats, ${SPAWN_NEXT}`);
|
|
71
|
+
}
|
|
72
|
+
/** The refusal a failed admission returns: its own cause and next step. Only an error without
|
|
73
|
+
* a message falls back to `fallback`. */
|
|
74
|
+
export function admissionRefusal(error, fallback) {
|
|
75
|
+
if (error instanceof WorkerAdmissionRefusal)
|
|
76
|
+
return { ok: false, error: error.message, next: error.next };
|
|
77
|
+
return { ok: false, error: error instanceof Error && error.message ? error.message : fallback };
|
|
78
|
+
}
|
|
47
79
|
//# sourceMappingURL=worker-execution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-execution.js","sourceRoot":"","sources":["../../src/runs/worker-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"worker-execution.js","sourceRoot":"","sources":["../../src/runs/worker-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE;2FAC2F;AAC3F,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EA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ityDemand): {
|
|
|
59
59
|
export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, {
|
|
60
60
|
"/workspace/activity": {
|
|
61
61
|
$get: {
|
|
62
|
+
output: {
|
|
63
|
+
error: string;
|
|
64
|
+
code?: "invalid_input" | undefined;
|
|
65
|
+
};
|
|
66
|
+
outputFormat: "json";
|
|
67
|
+
status: 400;
|
|
68
|
+
input: {
|
|
69
|
+
query: {
|
|
70
|
+
project?: string | undefined;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
} | {
|
|
74
|
+
output: {
|
|
75
|
+
error: string;
|
|
76
|
+
};
|
|
77
|
+
outputFormat: "json";
|
|
78
|
+
status: 404 | 409 | 503;
|
|
79
|
+
input: {
|
|
80
|
+
query: {
|
|
81
|
+
project?: string | undefined;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
} | {
|
|
62
85
|
output: {
|
|
63
86
|
generatedAt: string;
|
|
64
87
|
projects: {
|
|
@@ -289,29 +312,6 @@ export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): impo
|
|
|
289
312
|
project?: string | undefined;
|
|
290
313
|
};
|
|
291
314
|
};
|
|
292
|
-
} | {
|
|
293
|
-
output: {
|
|
294
|
-
error: string;
|
|
295
|
-
code?: "invalid_input" | undefined;
|
|
296
|
-
};
|
|
297
|
-
outputFormat: "json";
|
|
298
|
-
status: 400;
|
|
299
|
-
input: {
|
|
300
|
-
query: {
|
|
301
|
-
project?: string | undefined;
|
|
302
|
-
};
|
|
303
|
-
};
|
|
304
|
-
} | {
|
|
305
|
-
output: {
|
|
306
|
-
error: string;
|
|
307
|
-
};
|
|
308
|
-
outputFormat: "json";
|
|
309
|
-
status: 404 | 409 | 503;
|
|
310
|
-
input: {
|
|
311
|
-
query: {
|
|
312
|
-
project?: string | undefined;
|
|
313
|
-
};
|
|
314
|
-
};
|
|
315
315
|
};
|
|
316
316
|
};
|
|
317
317
|
}, "/", "/workspace/activity">;
|
|
@@ -6,6 +6,7 @@ import { execFile } from 'node:child_process';
|
|
|
6
6
|
import { gitEnv } from '../../git-command.js';
|
|
7
7
|
import { exactLineIndex, nextLineIndex } from '../../contract/index.js';
|
|
8
8
|
import { autosaveCommit } from '../../autosave-commit.js';
|
|
9
|
+
import { headLeftTaskBranch } from '../../task-branch-head.js';
|
|
9
10
|
// ---- draft-PR creation (review gate, spec 009) ------------------------------
|
|
10
11
|
// Final autosave-commit → `git push -u origin cez/<id8>` → `gh pr create
|
|
11
12
|
// --draft`, all executed in the task worktree (gh picks the repo up from the
|
|
@@ -24,21 +25,9 @@ export async function createDraftPr(input) {
|
|
|
24
25
|
const refusal = fallbackProjectWriteError(worktree);
|
|
25
26
|
if (refusal)
|
|
26
27
|
return { ok: false, error: refusal };
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// failed commit has to stop the publish instead of silently opening a PR from
|
|
31
|
-
// a branch that is missing the run's final state.
|
|
32
|
-
const saved = await autosaveCommit(worktree, 'pre-PR');
|
|
33
|
-
if (saved === 'refused') {
|
|
34
|
-
return {
|
|
35
|
-
ok: false,
|
|
36
|
-
error: 'worktree has unresolved merge conflicts — resolve them, then publish again',
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
if (saved === 'failed') {
|
|
40
|
-
return { ok: false, error: 'could not commit the final changes — check git status in the worktree' };
|
|
41
|
-
}
|
|
28
|
+
const unsaved = await saveFinalWork(worktree, branch);
|
|
29
|
+
if (unsaved)
|
|
30
|
+
return { ok: false, error: unsaved };
|
|
42
31
|
// DRY-RUN (CEZ_DRY_RUN=1): no push, no gh — simulate success with a fake PR
|
|
43
32
|
// URL so the whole review → PR flow is testable without GitHub.
|
|
44
33
|
if (productEnv('DRY_RUN') === '1') {
|
|
@@ -74,6 +63,27 @@ export async function createDraftPr(input) {
|
|
|
74
63
|
}
|
|
75
64
|
return { ok: true, url: match[0], dryRun: false };
|
|
76
65
|
}
|
|
66
|
+
/** Why the task branch cannot hold the run's final state, or `undefined` once it does. */
|
|
67
|
+
async function saveFinalWork(worktree, branch) {
|
|
68
|
+
// Final autosave: the branch must hold everything before it leaves the box.
|
|
69
|
+
// This is the LAST flush — unlike the turn-end and run-finalize ones there is
|
|
70
|
+
// no later autosave to pick the work up, so a refusal (conflicted tree) or a
|
|
71
|
+
// failed commit has to stop the publish instead of silently opening a PR from
|
|
72
|
+
// a branch that is missing the run's final state. `taskBranch` commits only onto
|
|
73
|
+
// the branch the push publishes, and skips while HEAD is elsewhere.
|
|
74
|
+
const saved = await autosaveCommit(worktree, 'pre-PR', { taskBranch: branch });
|
|
75
|
+
if (saved === 'refused')
|
|
76
|
+
return 'worktree has unresolved merge conflicts — resolve them, then publish again';
|
|
77
|
+
if (saved === 'failed')
|
|
78
|
+
return 'could not commit the final changes — check git status in the worktree';
|
|
79
|
+
// The push publishes the task branch: with HEAD elsewhere, the final work is not on it
|
|
80
|
+
// (hearsay-tools/squawk#1110). Checked after the save, so a clean tree that skipped the
|
|
81
|
+
// save's own HEAD read is covered too. Refuse and let the agent decide where its work belongs.
|
|
82
|
+
const left = await headLeftTaskBranch(worktree, branch);
|
|
83
|
+
if (left || saved !== 'skipped')
|
|
84
|
+
return left;
|
|
85
|
+
return 'worktree HEAD moved during the final autosave — publish again';
|
|
86
|
+
}
|
|
77
87
|
/**
|
|
78
88
|
* PR body from the handoff journal: the "## Goal" section (task text as
|
|
79
89
|
* fallback) + the first ~10 lines of "## Progress log" (newest first) +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draft-pr.js","sourceRoot":"","sources":["../../../src/server/forge/draft-pr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAy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c,EAAE,GAAW,EAAE,GAAW,EAAE,SAAS,GAAG,MAAM;IAC5E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,QAAQ,CACN,GAAG,EACH,IAAI,EACJ;YACE,GAAG;YACH,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;YAC1B,QAAQ,EAAE,MAAM;YAChB,mEAAmE;YACnE,uEAAuE;YACvE,oEAAoE;YACpE,yEAAyE;YACzE,GAAG,EAAE,MAAM,CAAC,EAAE,mBAAmB,EAAE,GAAG,EAAE,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SACvE,EACD,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CACtB,OAAO,CAAC;YACN,EAAE,EAAE,CAAC,GAAG;YACR,MAAM,EAAE,MAAM,IAAI,EAAE;YACpB,MAAM,EAAE,MAAM,IAAI,EAAE;YACpB,QAAQ,EAAE,GAAG,EAAE,IAAI,KAAK,QAAQ;SACjC,CAAC,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -16,6 +16,12 @@ export declare function createLiveRoutes({ resolveProject, serverGeneration, res
|
|
|
16
16
|
output: {
|
|
17
17
|
generation: string;
|
|
18
18
|
results: ({
|
|
19
|
+
projectId: string;
|
|
20
|
+
runId: string;
|
|
21
|
+
type: "error" | "reset";
|
|
22
|
+
status: 400 | 404 | 409 | 413 | 503;
|
|
23
|
+
error: string;
|
|
24
|
+
} | {
|
|
19
25
|
projectId: string;
|
|
20
26
|
runId: string;
|
|
21
27
|
type: "batch";
|
|
@@ -29,12 +35,6 @@ export declare function createLiveRoutes({ resolveProject, serverGeneration, res
|
|
|
29
35
|
cursor: string;
|
|
30
36
|
afterSeq: number;
|
|
31
37
|
hasMore: boolean;
|
|
32
|
-
} | {
|
|
33
|
-
projectId: string;
|
|
34
|
-
runId: string;
|
|
35
|
-
type: "error" | "reset";
|
|
36
|
-
status: 400 | 404 | 409 | 413 | 503;
|
|
37
|
-
error: string;
|
|
38
38
|
})[];
|
|
39
39
|
};
|
|
40
40
|
outputFormat: "json";
|
package/dist/server/server.js
CHANGED
|
@@ -1186,6 +1186,13 @@ export function createApp(deps) {
|
|
|
1186
1186
|
return null;
|
|
1187
1187
|
}
|
|
1188
1188
|
};
|
|
1189
|
+
/** The per-account routes' gate: refuse hosted mode before resolving the id, then 404 an unknown id. */
|
|
1190
|
+
const localAccount = async (c) => {
|
|
1191
|
+
if (!capabilities().localHandoff)
|
|
1192
|
+
return c.json(hostedProfileRefusal, 409);
|
|
1193
|
+
const id = c.req.param('id');
|
|
1194
|
+
return (await accountById(id)) ?? c.json({ error: `unknown account: ${id}` }, 404);
|
|
1195
|
+
};
|
|
1189
1196
|
/** Validate a client-supplied config dir. Returns the error text, or null when it is usable. */
|
|
1190
1197
|
const checkProfileDir = async (configDir, provider) => {
|
|
1191
1198
|
if (CONTROL_CHARS_RE.test(configDir))
|
|
@@ -1382,13 +1389,9 @@ export function createApp(deps) {
|
|
|
1382
1389
|
* unsettled one for a minute (`cacheTtlFor` in `core/provider-auth.ts`).
|
|
1383
1390
|
*/
|
|
1384
1391
|
.get('/workspace/agent-profiles/:id/status', paramZodValidator(agentProfileRouteParamsSchema), queryZodValidator(strictRefreshQuerySchema, { message: 'refresh must be 1 when provided' }), async (c) => {
|
|
1385
|
-
|
|
1386
|
-
if (
|
|
1387
|
-
return
|
|
1388
|
-
const account = await accountById(c.req.param('id'));
|
|
1389
|
-
if (!account)
|
|
1390
|
-
return c.json({ error: `unknown account: ${c.req.param('id')}` }, 404);
|
|
1391
|
-
// jscpd:ignore-end
|
|
1392
|
+
const account = await localAccount(c);
|
|
1393
|
+
if (account instanceof Response)
|
|
1394
|
+
return account;
|
|
1392
1395
|
const refresh = c.req.valid('query').refresh === '1';
|
|
1393
1396
|
if (refresh)
|
|
1394
1397
|
invalidateHostModels(account.provider);
|
|
@@ -1421,13 +1424,9 @@ export function createApp(deps) {
|
|
|
1421
1424
|
* listings, logs and run persistence.
|
|
1422
1425
|
*/
|
|
1423
1426
|
.get('/workspace/agent-profiles/:id/details', paramZodValidator(agentProfileRouteParamsSchema), async (c) => {
|
|
1424
|
-
|
|
1425
|
-
if (
|
|
1426
|
-
return
|
|
1427
|
-
const account = await accountById(c.req.param('id'));
|
|
1428
|
-
if (!account)
|
|
1429
|
-
return c.json({ error: `unknown account: ${c.req.param('id')}` }, 404);
|
|
1430
|
-
// jscpd:ignore-end
|
|
1427
|
+
const account = await localAccount(c);
|
|
1428
|
+
if (account instanceof Response)
|
|
1429
|
+
return account;
|
|
1431
1430
|
return c.json(await readAccountIdentity(account.provider, account.path));
|
|
1432
1431
|
})
|
|
1433
1432
|
/**
|
|
@@ -1439,13 +1438,9 @@ export function createApp(deps) {
|
|
|
1439
1438
|
* the account's dir rather than anything the caller spelled.
|
|
1440
1439
|
*/
|
|
1441
1440
|
.post('/workspace/agent-profiles/:id/open', paramZodValidator(agentProfileRouteParamsSchema), jsonZodValidator(() => openAgentAccountFileSchema), async (c) => {
|
|
1442
|
-
|
|
1443
|
-
if (
|
|
1444
|
-
return
|
|
1445
|
-
const account = await accountById(c.req.param('id'));
|
|
1446
|
-
if (!account)
|
|
1447
|
-
return c.json({ error: `unknown account: ${c.req.param('id')}` }, 404);
|
|
1448
|
-
// jscpd:ignore-end
|
|
1441
|
+
const account = await localAccount(c);
|
|
1442
|
+
if (account instanceof Response)
|
|
1443
|
+
return account;
|
|
1449
1444
|
const { file, target } = c.req.valid('json');
|
|
1450
1445
|
let path;
|
|
1451
1446
|
if (file === 'folder') {
|