@wjarka/cezarion 0.17.0-dev.5511 → 0.17.0-dev.5515

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/README.md +12 -0
  2. package/dist/ci-wait/controller.d.ts +37 -37
  3. package/dist/ci-wait/errors.js +2 -2
  4. package/dist/ci-wait/errors.js.map +1 -1
  5. package/dist/ci-wait/tools.js +8 -6
  6. package/dist/ci-wait/tools.js.map +1 -1
  7. package/dist/cli-dispatch.js +1 -0
  8. package/dist/cli-dispatch.js.map +1 -1
  9. package/dist/delegation/routes.d.ts +62 -62
  10. package/dist/delegation/transport.d.ts +62 -62
  11. package/dist/jobs/cli.d.ts +2 -0
  12. package/dist/jobs/cli.js +53 -0
  13. package/dist/jobs/cli.js.map +1 -0
  14. package/dist/jobs/command.d.ts +9 -0
  15. package/dist/jobs/command.js +19 -0
  16. package/dist/jobs/command.js.map +1 -0
  17. package/dist/jobs/job.d.ts +77 -0
  18. package/dist/jobs/job.js +252 -0
  19. package/dist/jobs/job.js.map +1 -0
  20. package/dist/server/activity-routes.d.ts +23 -23
  21. package/dist/server/live-routes.d.ts +6 -6
  22. package/dist/server/self-update-routes.d.ts +19 -19
  23. package/dist/server/server.d.ts +1395 -1395
  24. package/dist/subcommands.d.ts +1 -1
  25. package/dist/subcommands.js +2 -1
  26. package/dist/subcommands.js.map +1 -1
  27. package/dist/workflows/run/session-events.d.ts +1 -1
  28. package/dist/workflows/run/session-events.js +3 -2
  29. package/dist/workflows/run/session-events.js.map +1 -1
  30. package/dist/workflows/run/wait-kinds.d.ts +3 -0
  31. package/dist/workflows/run/wait-kinds.js +11 -1
  32. package/dist/workflows/run/wait-kinds.js.map +1 -1
  33. package/package.json +3 -3
  34. package/web/dist/assets/{activity-motion-BHr-ZAZp.js → activity-motion-D-wNjCZO.js} +1 -1
  35. package/web/dist/assets/{activity-route-Bk7-QeK_.js → activity-route-CEhKA6LC.js} +1 -1
  36. package/web/dist/assets/{commit-diff-panel-C9vHxqqQ.js → commit-diff-panel-C5SEnKvj.js} +1 -1
  37. package/web/dist/assets/{diff-gmuErI3F.js → diff-DOKQG121.js} +2 -2
  38. package/web/dist/assets/{diff-view-DigfbKBX.js → diff-view-Dlbaomc6.js} +1 -1
  39. package/web/dist/assets/{git-toolbar-DOUDDTBC.js → git-toolbar-B_lgnDi3.js} +1 -1
  40. package/web/dist/assets/{github-DBcdEsSz.js → github-89EDv5jm.js} +1 -1
  41. package/web/dist/assets/{global-activity-route-CxCecB2W.js → global-activity-route-2SM3xKBA.js} +1 -1
  42. package/web/dist/assets/{index-Cybrk3p9.js → index-DKIv9VPA.js} +3 -3
  43. package/web/dist/assets/{preview-pane-connected-mMMD4IiM.js → preview-pane-connected-B730Jv1e.js} +1 -1
  44. package/web/dist/assets/{repo-git-Dv-6cKAC.js → repo-git-D6gQXbHu.js} +1 -1
  45. package/web/dist/assets/{report-reader-Dtus2Ua4.js → report-reader-DP43jeNM.js} +1 -1
  46. package/web/dist/assets/{reports-DAgEuUbp.js → reports-DV8NzFp3.js} +1 -1
  47. package/web/dist/assets/{run-header-BPaPARge.js → run-header-DjXPrh23.js} +1 -1
  48. package/web/dist/assets/{skills-XYpWQDCm.js → skills-DuZYEbo5.js} +1 -1
  49. package/web/dist/assets/{task-changes-BAQ4Gn66.js → task-changes-CUWFco57.js} +1 -1
  50. package/web/dist/assets/{task-commits-DS7kN8JG.js → task-commits-Cgoxt66y.js} +1 -1
  51. package/web/dist/assets/{task-files-D7YFhWFg.js → task-files-BmTRfJ5K.js} +1 -1
  52. package/web/dist/assets/{task-github-item-bRgH9WkE.js → task-github-item-Cmro8m-6.js} +1 -1
  53. package/web/dist/assets/{task-thread-CuRhXDEj.js → task-thread-BTjoNRed.js} +2 -2
  54. package/web/dist/assets/{thread-state-DDD8tLGN.js → thread-state-Cd3ERj1h.js} +1 -1
  55. package/web/dist/assets/{use-hand-to-agent-state-b8KEA5pM.js → use-hand-to-agent-state-C2rQan6D.js} +1 -1
  56. package/web/dist/assets/{workflows-BdKDN9aF.js → workflows-DemG2-He.js} +1 -1
  57. package/web/dist/index.html +1 -1
@@ -0,0 +1,252 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { closeSync, existsSync, mkdirSync, openSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
3
+ import { constants, tmpdir } from 'node:os';
4
+ import { join, resolve } from 'node:path';
5
+ import { DatabaseSync } from 'node:sqlite';
6
+ import { recordedProcessLive } from '../delegation/process-liveness.js';
7
+ import { processStartToken, startOwnedGroup } from '../detached-process.js';
8
+ import { ownCommand } from './command.js';
9
+ /**
10
+ * A long command an agent starts from its own shell and leaves running (hearsay-tools/cezarion#3097).
11
+ * A supervisor process leads a session of its own, so the command outlives the shell call, the turn
12
+ * and the agent session on every runner: Codex ends a command's process group when the command
13
+ * returns, and Cezar ends a session's group when the session ends. The supervisor writes the
14
+ * command's output to a log file and its exit code to an exit file, and its own PID is the one a
15
+ * process wait watches. Each start has files of its own, `<name>.<run>.log` and `<name>.<run>.exit`:
16
+ * a process wait still open on an earlier start of the name never reads a later start's exit code.
17
+ *
18
+ * The supervisor, not its starter, claims the name: it is the process that lives as long as the
19
+ * job, so no starter's death leaves a claim behind or a job unclaimed. The claim is one SQLite
20
+ * write transaction on `<name>.job.db`. The database serializes claimants, and the operating
21
+ * system drops a dead claimant's file lock, so nothing is ever taken over by age or by guess.
22
+ */
23
+ const NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
24
+ /** How long a start waits for its supervisor to claim the name before it gives up. */
25
+ const READY_TIMEOUT_MS = 30_000;
26
+ /** How long one claimant waits for another's transaction, which holds a few statements. */
27
+ const CLAIM_BUSY_MS = 10_000;
28
+ export class JobError extends Error {
29
+ }
30
+ export function jobDirectory(dir, env) {
31
+ return resolve(dir ?? env.TMPDIR ?? tmpdir());
32
+ }
33
+ export function jobPaths(dir, name) {
34
+ if (!NAME.test(name))
35
+ throw new JobError(`Invalid job name ${JSON.stringify(name)}: use 1-64 letters, digits, ".", "_" or "-", starting with a letter or digit.`);
36
+ return { record: join(dir, `${name}.job.db`) };
37
+ }
38
+ const damaged = (paths, why) => new JobError(`The job record ${paths.record} cannot be used (${why}). Check that no process of this job runs, then delete it or choose another name.`);
39
+ function parseRecord(paths, text) {
40
+ let value = null;
41
+ try {
42
+ value = JSON.parse(String(text));
43
+ }
44
+ catch { /* refused below */ }
45
+ const pid = value?.pid;
46
+ if (!value || typeof pid !== 'number' || !Number.isSafeInteger(pid) || pid < 2 || typeof value.name !== 'string' || !Array.isArray(value.command) || (value.start !== undefined && typeof value.start !== 'string') || typeof value.log !== 'string' || typeof value.exitFile !== 'string') {
47
+ throw damaged(paths, 'it holds no job record');
48
+ }
49
+ return value;
50
+ }
51
+ /** Runs `use` on the record database. A file that is not one is a refusal, never an absent record:
52
+ * it may belong to a supervisor that still runs. */
53
+ function withRecords(paths, options, use) {
54
+ let db;
55
+ try {
56
+ db = new DatabaseSync(paths.record, options);
57
+ db.exec(`PRAGMA busy_timeout = ${CLAIM_BUSY_MS}`);
58
+ return use(db);
59
+ }
60
+ catch (error) {
61
+ throw error instanceof JobError ? error : damaged(paths, error instanceof Error ? error.message : String(error));
62
+ }
63
+ finally {
64
+ try {
65
+ db?.close();
66
+ }
67
+ catch { /* never opened */ }
68
+ }
69
+ }
70
+ const selectRecord = (paths, db) => {
71
+ const row = db.prepare('SELECT record FROM job WHERE id = 1').get();
72
+ return row === undefined ? undefined : parseRecord(paths, row.record);
73
+ };
74
+ function readRecord(paths) {
75
+ if (!existsSync(paths.record))
76
+ return undefined;
77
+ return withRecords(paths, { readOnly: true }, (db) => {
78
+ // A claimant that ended before its first commit leaves a database with nothing in it.
79
+ if (db.prepare('SELECT count(*) AS objects FROM sqlite_master').get()?.objects === 0)
80
+ return undefined;
81
+ const record = selectRecord(paths, db);
82
+ if (record === undefined)
83
+ throw damaged(paths, 'it holds no job record');
84
+ return record;
85
+ });
86
+ }
87
+ /** The first line of the exit file as an integer, when the supervisor has written it. */
88
+ function readExit(record) {
89
+ try {
90
+ const line = readFileSync(record.exitFile, 'utf8').split('\n', 1)[0].trim();
91
+ return /^-?\d+$/.test(line) ? Number(line) : undefined;
92
+ }
93
+ catch {
94
+ return undefined;
95
+ }
96
+ }
97
+ /** A record whose supervisor still runs. Without a start identity (Windows) a live PID counts. */
98
+ function running(record) {
99
+ return recordedProcessLive({ pid: record.pid, ...(record.start === undefined ? {} : { startToken: record.start }) });
100
+ }
101
+ export function jobStatus(dir, name) {
102
+ const paths = jobPaths(dir, name);
103
+ const record = readRecord(paths);
104
+ if (!record)
105
+ throw new JobError(`No job named ${JSON.stringify(name)} in ${dir}.`);
106
+ const base = { name, pid: record.pid, log: record.log, exitFile: record.exitFile };
107
+ const exitCode = readExit(record);
108
+ if (exitCode !== undefined)
109
+ return { ...base, state: 'exited', exitCode };
110
+ return running(record) ? { ...base, state: 'running' } : { ...base, state: 'exited' };
111
+ }
112
+ /**
113
+ * Claims `name` for this process, or answers who holds it. Read, decide and write are one write
114
+ * transaction, so two claimants never both find the name free. A holder that has written its exit
115
+ * file is done even while its process is still ending. Earlier starts' files stay as they are.
116
+ */
117
+ export function claimJob(paths, record) {
118
+ return withRecords(paths, { readOnly: false }, (db) => {
119
+ db.exec('BEGIN IMMEDIATE');
120
+ try {
121
+ // Only a database with nothing in it is a free name. One that holds anything else, or a job
122
+ // table without its row, is not this command's record of an ended job: it is refused.
123
+ const fresh = db.prepare('SELECT count(*) AS objects FROM sqlite_master').get()?.objects === 0;
124
+ if (fresh)
125
+ db.exec('CREATE TABLE job (id INTEGER PRIMARY KEY CHECK (id = 1), record TEXT NOT NULL)');
126
+ const previous = selectRecord(paths, db);
127
+ if (!fresh && previous === undefined)
128
+ throw damaged(paths, 'it holds no job record');
129
+ if (previous && running(previous) && readExit(previous) === undefined) {
130
+ db.exec('ROLLBACK');
131
+ return { claimed: false, pid: previous.pid };
132
+ }
133
+ db.prepare('INSERT INTO job (id, record) VALUES (1, ?) ON CONFLICT (id) DO UPDATE SET record = excluded.record').run(JSON.stringify(record));
134
+ db.exec('COMMIT');
135
+ return { claimed: true, replaced: previous !== undefined, log: record.log, exitFile: record.exitFile };
136
+ }
137
+ catch (error) {
138
+ try {
139
+ db.exec('ROLLBACK');
140
+ }
141
+ catch { /* no transaction is open */ }
142
+ throw error;
143
+ }
144
+ });
145
+ }
146
+ /** Starts the supervisor and answers once it holds the name. Refuses while the name runs. */
147
+ export async function startJob(options) {
148
+ const { name, dir, command } = options;
149
+ if (command.length === 0)
150
+ throw new JobError('Give the command to run after "--".');
151
+ mkdirSync(dir, { recursive: true });
152
+ jobPaths(dir, name);
153
+ const [bin, ...prefix] = ownCommand();
154
+ const { child } = await startOwnedGroup(bin, [...prefix, 'job', SUPERVISE, dir, name, '--', ...command], {
155
+ cwd: options.cwd ?? process.cwd(), env: options.env ?? process.env, stdio: ['ignore', 'ignore', 'ignore', 'ipc'],
156
+ });
157
+ const answer = await supervisorAnswer(child);
158
+ if (!answer.claimed) {
159
+ throw new JobError('pid' in answer ? `Job ${JSON.stringify(name)} is already running as PID ${answer.pid}. Wait for that PID, or choose another name.` : answer.error);
160
+ }
161
+ child.disconnect();
162
+ child.unref();
163
+ return { name, pid: child.pid, log: answer.log, exitFile: answer.exitFile, replaced: answer.replaced };
164
+ }
165
+ /** The supervisor's claim answer; a refusal when it ends or stays silent first. */
166
+ function supervisorAnswer(child) {
167
+ return new Promise((done, fail) => {
168
+ const timer = setTimeout(() => { child.kill('SIGKILL'); fail(new JobError('The job supervisor did not start.')); }, READY_TIMEOUT_MS);
169
+ const settle = (act) => { clearTimeout(timer); child.removeAllListeners('message'); child.removeAllListeners('exit'); act(); };
170
+ child.once('message', answer => settle(() => done(answer)));
171
+ child.once('exit', code => settle(() => fail(new JobError(`The job supervisor ended before it started the command (exit ${code ?? 'by signal'}).`))));
172
+ });
173
+ }
174
+ /** The hidden subcommand the supervisor runs as. */
175
+ export const SUPERVISE = '__supervise';
176
+ function writeAtomic(path, text) {
177
+ const temp = `${path}.${process.pid}.tmp`;
178
+ writeFileSync(temp, text);
179
+ renameSync(temp, path);
180
+ }
181
+ const signalNumber = (signal) => constants.signals[signal] ?? 0;
182
+ /** Sends the claim answer to the starter over the channel it opened, then lets go of the channel. */
183
+ export function tellStarter(answer) {
184
+ return new Promise((sent) => {
185
+ // A starter that has ended closed the channel: there is no one to tell.
186
+ if (!process.send || !process.connected) {
187
+ sent();
188
+ return;
189
+ }
190
+ try {
191
+ process.send(answer, () => { if (process.connected)
192
+ process.disconnect(); sent(); });
193
+ }
194
+ catch {
195
+ sent();
196
+ }
197
+ });
198
+ }
199
+ /**
200
+ * The supervisor: claims the name, tells its starter, runs the command and writes its exit code.
201
+ * It answers 1 without running anything when another supervisor holds the name. The exit file is
202
+ * renamed into place, so a reader never sees it half written. A SIGTERM or SIGINT goes on to the
203
+ * command, and the exit file still records how it ended.
204
+ */
205
+ export async function superviseJob(dir, name, command, tell = async () => { }) {
206
+ const paths = jobPaths(dir, name);
207
+ const start = processStartToken(process.pid);
208
+ const startedAt = new Date();
209
+ // The run id is unique to this supervisor among the starts of one name in this directory.
210
+ const run = `${startedAt.getTime().toString(36)}-${process.pid}`;
211
+ const record = { name, pid: process.pid, ...(start === undefined ? {} : { start }), command, startedAt: startedAt.toISOString(),
212
+ log: join(dir, `${name}.${run}.log`), exitFile: join(dir, `${name}.${run}.exit`) };
213
+ let answer;
214
+ try {
215
+ answer = claimJob(paths, record);
216
+ }
217
+ catch (error) {
218
+ answer = { claimed: false, error: error instanceof Error ? error.message : String(error) };
219
+ }
220
+ if (!answer.claimed) {
221
+ await tell(answer);
222
+ return 1;
223
+ }
224
+ const log = openSync(record.log, 'w');
225
+ // A hangup must not end the supervisor: its starter's terminal or session may close.
226
+ const signals = [['SIGHUP', () => { }]];
227
+ // A starter that died gets no answer; the job runs all the same, and `status` names it.
228
+ void tell(answer).catch(() => { });
229
+ return new Promise((done) => {
230
+ const finish = (code, note) => {
231
+ for (const [signal, handler] of signals)
232
+ process.off(signal, handler);
233
+ if (note)
234
+ writeFileSync(log, `${note}\n`);
235
+ closeSync(log);
236
+ // The directory can be gone: Cezar removes a task's temp directory when the task ends.
237
+ try {
238
+ writeAtomic(record.exitFile, `${code}\n`);
239
+ }
240
+ catch { /* no one can read it there */ }
241
+ done(code);
242
+ };
243
+ const child = spawn(command[0], command.slice(1), { stdio: ['ignore', log, log] });
244
+ for (const signal of ['SIGTERM', 'SIGINT'])
245
+ signals.push([signal, () => { child.kill(signal); }]);
246
+ for (const [signal, handler] of signals)
247
+ process.on(signal, handler);
248
+ child.once('error', error => finish(127, `cez job: cannot run ${command[0]}: ${error.message}`));
249
+ child.once('exit', (code, signal) => finish(code ?? 128 + (signal ? signalNumber(signal) : 0)));
250
+ });
251
+ }
252
+ //# sourceMappingURL=job.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job.js","sourceRoot":"","sources":["../../src/jobs/job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC9G,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AAEH,MAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,sFAAsF;AACtF,MAAM,gBAAgB,GAAG,MAAM,CAA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AClG,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -59,29 +59,6 @@ export declare function ciProgressPlugs(demand: ActivityDemand): {
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
- } | {
85
62
  output: {
86
63
  generatedAt: string;
87
64
  projects: {
@@ -312,6 +289,29 @@ export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): impo
312
289
  project?: string | undefined;
313
290
  };
314
291
  };
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">;
@@ -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";
@@ -184,17 +184,6 @@ stores: () => readonly RunStore[]): import("hono/hono-base").HonoBase<import("ho
184
184
  } & {
185
185
  "/workspace/self-update/channel": {
186
186
  $put: {
187
- output: {
188
- error: string;
189
- };
190
- outputFormat: "json";
191
- status: 500;
192
- input: {
193
- json: {
194
- channel: "development" | "nightly" | "stable";
195
- };
196
- };
197
- } | {
198
187
  output: {
199
188
  version: string;
200
189
  installKind: "checkout" | "global-npm" | "managed" | "npx" | "unknown";
@@ -241,22 +230,22 @@ stores: () => readonly RunStore[]): import("hono/hono-base").HonoBase<import("ho
241
230
  channel: "development" | "nightly" | "stable";
242
231
  };
243
232
  };
244
- };
245
- };
246
- } & {
247
- "/workspace/self-update/apply": {
248
- $post: {
233
+ } | {
249
234
  output: {
250
235
  error: string;
251
236
  };
252
237
  outputFormat: "json";
253
- status: 409;
238
+ status: 500;
254
239
  input: {
255
240
  json: {
256
- version: string;
241
+ channel: "development" | "nightly" | "stable";
257
242
  };
258
243
  };
259
- } | {
244
+ };
245
+ };
246
+ } & {
247
+ "/workspace/self-update/apply": {
248
+ $post: {
260
249
  output: {
261
250
  version: string;
262
251
  installKind: "checkout" | "global-npm" | "managed" | "npx" | "unknown";
@@ -303,6 +292,17 @@ stores: () => readonly RunStore[]): import("hono/hono-base").HonoBase<import("ho
303
292
  version: string;
304
293
  };
305
294
  };
295
+ } | {
296
+ output: {
297
+ error: string;
298
+ };
299
+ outputFormat: "json";
300
+ status: 409;
301
+ input: {
302
+ json: {
303
+ version: string;
304
+ };
305
+ };
306
306
  };
307
307
  };
308
308
  }, "/", "/workspace/self-update/apply">;