@hearsay-tools/squawk 0.18.0-dev.6409 → 0.18.0-dev.6433
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-cleanup.d.ts +2 -1
- package/dist/autosave-cleanup.js +22 -3
- package/dist/autosave-cleanup.js.map +1 -1
- package/dist/autosave-commit.d.ts +2 -2
- package/dist/autosave-commit.js +4 -4
- package/dist/autosave-commit.js.map +1 -1
- package/dist/autosave-git.d.ts +15 -8
- package/dist/autosave-git.js +141 -45
- package/dist/autosave-git.js.map +1 -1
- package/dist/autosave-holders.d.ts +2 -0
- package/dist/autosave-holders.js +5 -3
- package/dist/autosave-holders.js.map +1 -1
- 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 +15 -15
- package/dist/delegation/workspace-removal.js +21 -8
- package/dist/delegation/workspace-removal.js.map +1 -1
- package/dist/runs/run-exits.d.ts +290 -290
- 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/forge/draft-pr.js +25 -15
- package/dist/server/forge/draft-pr.js.map +1 -1
- package/dist/server/server.d.ts +58 -58
- package/dist/server/server.js +16 -21
- package/dist/server/server.js.map +1 -1
- 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/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/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;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,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAClG,CAAC"}
|
|
@@ -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,MAA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GAAG,CAAC,CAAC;AACvE,CAAC;AAUD,SAAS,QAAQ,CAAC,IAAc,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"}
|
package/dist/server/server.d.ts
CHANGED
|
@@ -4893,6 +4893,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4893
4893
|
} & {
|
|
4894
4894
|
"/repo/commit/:sha": {
|
|
4895
4895
|
$get: {
|
|
4896
|
+
output: string;
|
|
4897
|
+
outputFormat: "text";
|
|
4898
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
4899
|
+
input: {
|
|
4900
|
+
query: {
|
|
4901
|
+
structured?: string | undefined;
|
|
4902
|
+
};
|
|
4903
|
+
} & {
|
|
4904
|
+
param: {
|
|
4905
|
+
sha: string;
|
|
4906
|
+
};
|
|
4907
|
+
};
|
|
4908
|
+
} | {
|
|
4896
4909
|
output: {
|
|
4897
4910
|
error: string;
|
|
4898
4911
|
code?: "invalid_input" | undefined;
|
|
@@ -4956,19 +4969,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4956
4969
|
sha: string;
|
|
4957
4970
|
};
|
|
4958
4971
|
};
|
|
4959
|
-
} | {
|
|
4960
|
-
output: string;
|
|
4961
|
-
outputFormat: "text";
|
|
4962
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
4963
|
-
input: {
|
|
4964
|
-
query: {
|
|
4965
|
-
structured?: string | undefined;
|
|
4966
|
-
};
|
|
4967
|
-
} & {
|
|
4968
|
-
param: {
|
|
4969
|
-
sha: string;
|
|
4970
|
-
};
|
|
4971
|
-
};
|
|
4972
4972
|
};
|
|
4973
4973
|
};
|
|
4974
4974
|
} & {
|
|
@@ -18306,20 +18306,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
18306
18306
|
} & {
|
|
18307
18307
|
"/runs/:id/handoff": {
|
|
18308
18308
|
$get: {
|
|
18309
|
-
output:
|
|
18310
|
-
|
|
18311
|
-
|
|
18312
|
-
outputFormat: "json";
|
|
18313
|
-
status: 404;
|
|
18309
|
+
output: string;
|
|
18310
|
+
outputFormat: "text";
|
|
18311
|
+
status: 200;
|
|
18314
18312
|
input: {
|
|
18315
18313
|
param: {
|
|
18316
18314
|
id: string;
|
|
18317
18315
|
};
|
|
18318
18316
|
};
|
|
18319
18317
|
} | {
|
|
18320
|
-
output:
|
|
18321
|
-
|
|
18322
|
-
|
|
18318
|
+
output: {
|
|
18319
|
+
error: string;
|
|
18320
|
+
};
|
|
18321
|
+
outputFormat: "json";
|
|
18322
|
+
status: 404;
|
|
18323
18323
|
input: {
|
|
18324
18324
|
param: {
|
|
18325
18325
|
id: string;
|
|
@@ -18357,20 +18357,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
18357
18357
|
} & {
|
|
18358
18358
|
"/runs/:id/diff": {
|
|
18359
18359
|
$get: {
|
|
18360
|
-
output:
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
outputFormat: "json";
|
|
18364
|
-
status: 404 | 409;
|
|
18360
|
+
output: string;
|
|
18361
|
+
outputFormat: "text";
|
|
18362
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
18365
18363
|
input: {
|
|
18366
18364
|
param: {
|
|
18367
18365
|
id: string;
|
|
18368
18366
|
};
|
|
18369
18367
|
};
|
|
18370
18368
|
} | {
|
|
18371
|
-
output:
|
|
18372
|
-
|
|
18373
|
-
|
|
18369
|
+
output: {
|
|
18370
|
+
error: string;
|
|
18371
|
+
};
|
|
18372
|
+
outputFormat: "json";
|
|
18373
|
+
status: 404 | 409;
|
|
18374
18374
|
input: {
|
|
18375
18375
|
param: {
|
|
18376
18376
|
id: string;
|
|
@@ -20770,6 +20770,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
20770
20770
|
} & {
|
|
20771
20771
|
"/repo/commit/:sha": {
|
|
20772
20772
|
$get: {
|
|
20773
|
+
output: string;
|
|
20774
|
+
outputFormat: "text";
|
|
20775
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
20776
|
+
input: {
|
|
20777
|
+
query: {
|
|
20778
|
+
structured?: string | undefined;
|
|
20779
|
+
};
|
|
20780
|
+
} & {
|
|
20781
|
+
param: {
|
|
20782
|
+
sha: string;
|
|
20783
|
+
};
|
|
20784
|
+
};
|
|
20785
|
+
} | {
|
|
20773
20786
|
output: {
|
|
20774
20787
|
error: string;
|
|
20775
20788
|
code?: "invalid_input" | undefined;
|
|
@@ -20833,19 +20846,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
20833
20846
|
sha: string;
|
|
20834
20847
|
};
|
|
20835
20848
|
};
|
|
20836
|
-
} | {
|
|
20837
|
-
output: string;
|
|
20838
|
-
outputFormat: "text";
|
|
20839
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
20840
|
-
input: {
|
|
20841
|
-
query: {
|
|
20842
|
-
structured?: string | undefined;
|
|
20843
|
-
};
|
|
20844
|
-
} & {
|
|
20845
|
-
param: {
|
|
20846
|
-
sha: string;
|
|
20847
|
-
};
|
|
20848
|
-
};
|
|
20849
20849
|
};
|
|
20850
20850
|
};
|
|
20851
20851
|
} & {
|
|
@@ -34183,20 +34183,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
34183
34183
|
} & {
|
|
34184
34184
|
"/runs/:id/handoff": {
|
|
34185
34185
|
$get: {
|
|
34186
|
-
output:
|
|
34187
|
-
|
|
34188
|
-
|
|
34189
|
-
outputFormat: "json";
|
|
34190
|
-
status: 404;
|
|
34186
|
+
output: string;
|
|
34187
|
+
outputFormat: "text";
|
|
34188
|
+
status: 200;
|
|
34191
34189
|
input: {
|
|
34192
34190
|
param: {
|
|
34193
34191
|
id: string;
|
|
34194
34192
|
};
|
|
34195
34193
|
};
|
|
34196
34194
|
} | {
|
|
34197
|
-
output:
|
|
34198
|
-
|
|
34199
|
-
|
|
34195
|
+
output: {
|
|
34196
|
+
error: string;
|
|
34197
|
+
};
|
|
34198
|
+
outputFormat: "json";
|
|
34199
|
+
status: 404;
|
|
34200
34200
|
input: {
|
|
34201
34201
|
param: {
|
|
34202
34202
|
id: string;
|
|
@@ -34234,20 +34234,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
34234
34234
|
} & {
|
|
34235
34235
|
"/runs/:id/diff": {
|
|
34236
34236
|
$get: {
|
|
34237
|
-
output:
|
|
34238
|
-
|
|
34239
|
-
|
|
34240
|
-
outputFormat: "json";
|
|
34241
|
-
status: 404 | 409;
|
|
34237
|
+
output: string;
|
|
34238
|
+
outputFormat: "text";
|
|
34239
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
34242
34240
|
input: {
|
|
34243
34241
|
param: {
|
|
34244
34242
|
id: string;
|
|
34245
34243
|
};
|
|
34246
34244
|
};
|
|
34247
34245
|
} | {
|
|
34248
|
-
output:
|
|
34249
|
-
|
|
34250
|
-
|
|
34246
|
+
output: {
|
|
34247
|
+
error: string;
|
|
34248
|
+
};
|
|
34249
|
+
outputFormat: "json";
|
|
34250
|
+
status: 404 | 409;
|
|
34251
34251
|
input: {
|
|
34252
34252
|
param: {
|
|
34253
34253
|
id: string;
|
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') {
|