@wjarka/cezarion 0.17.0-dev.5585 → 0.17.0-dev.5604
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/delegation/routes.d.ts +66 -66
- package/dist/delegation/transport.d.ts +13 -13
- package/dist/home/home.js +2 -0
- package/dist/home/home.js.map +1 -1
- package/dist/home/install-marker.d.ts +4 -1
- package/dist/home/install-marker.js +7 -1
- package/dist/home/install-marker.js.map +1 -1
- package/dist/home/protected-roots.d.ts +25 -0
- package/dist/home/protected-roots.js +90 -0
- package/dist/home/protected-roots.js.map +1 -0
- package/dist/paths.js +5 -45
- package/dist/paths.js.map +1 -1
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/open-in-targets.d.ts +7 -0
- package/dist/server/open-in-targets.js +18 -15
- package/dist/server/open-in-targets.js.map +1 -1
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/run-checkout.d.ts +1 -5
- package/dist/server/run-checkout.js +5 -7
- package/dist/server/run-checkout.js.map +1 -1
- package/dist/server/self-update-routes.d.ts +19 -19
- package/dist/server/server.d.ts +64 -64
- package/dist/server/server.js +23 -22
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/package.json +3 -3
|
@@ -65,24 +65,13 @@ export async function openRunCli(c, run, cliRunner, dir, repoRoot, { providerAct
|
|
|
65
65
|
// An id resumeCommand refuses (open-mercato/cezar#431) degrades to a fresh CLI in the worktree,
|
|
66
66
|
// exactly like a run that never recorded a session.
|
|
67
67
|
const resume = sessionId && cliRunner === (sessionStep?.backend ?? run.runner ?? 'claude') ? resumeCommand(cliRunner, sessionId) : null;
|
|
68
|
-
//
|
|
69
|
-
const command = resume ?? freshCliCommand(cliRunner);
|
|
70
|
-
if (command === null) {
|
|
71
|
-
return c.json({ error: `the configured ${cliRunner === 'omp' ? 'OMP' : 'Cursor'} executable cannot be used in a terminal command` }, 409);
|
|
72
|
-
}
|
|
73
|
-
// BOTH branches carry the account (spec 2026-07-29-agent-profiles): a resume needs the
|
|
74
|
-
// config dir that holds its session, and a FRESH CLI in this worktree should still open
|
|
75
|
-
// on the account the project works under — otherwise "Open in → Claude CLI" quietly
|
|
76
|
-
// hands the user a different subscription than every task in the same project uses.
|
|
68
|
+
// A resume uses the session account; a fresh CLI uses the project's account.
|
|
77
69
|
const account = resume
|
|
78
|
-
? await handoffEnv(cliRunner, sessionStep?.profileId)
|
|
79
|
-
: await
|
|
80
|
-
if (err instanceof AgentAccountUnavailableError)
|
|
81
|
-
return { error: err.message };
|
|
82
|
-
throw err;
|
|
83
|
-
});
|
|
70
|
+
? { command: resume, ...await handoffEnv(cliRunner, sessionStep?.profileId) }
|
|
71
|
+
: await freshCliHandoff(cliRunner, repoRoot, home);
|
|
84
72
|
if ('error' in account)
|
|
85
73
|
return c.json({ error: account.error }, 409);
|
|
74
|
+
const { command } = account;
|
|
86
75
|
const fallback = handoffFallbackCommand(dir, command, account.env);
|
|
87
76
|
if (fallback === null) {
|
|
88
77
|
return c.json({ error: 'this account\'s folder cannot be used in a terminal command' }, 409);
|
|
@@ -93,6 +82,20 @@ export async function openRunCli(c, run, cliRunner, dir, repoRoot, { providerAct
|
|
|
93
82
|
}
|
|
94
83
|
return c.json({ opened: true, path: dir, command });
|
|
95
84
|
}
|
|
85
|
+
/** Fresh terminals use the selected executable and the project's account. */
|
|
86
|
+
export async function freshCliHandoff(cliRunner, repoRoot, home) {
|
|
87
|
+
// Runners with a CEZ_*_BIN override launch the configured binary, not the PATH name.
|
|
88
|
+
const command = freshCliCommand(cliRunner);
|
|
89
|
+
if (command === null) {
|
|
90
|
+
return { error: `the configured ${cliRunner === 'omp' ? 'OMP' : 'Cursor'} executable cannot be used in a terminal command` };
|
|
91
|
+
}
|
|
92
|
+
const account = await resolveProfileEnvForRoot(repoRoot, cliRunner, undefined, process.env, home).then(({ env }) => ({ env }), (err) => {
|
|
93
|
+
if (err instanceof AgentAccountUnavailableError)
|
|
94
|
+
return { error: err.message };
|
|
95
|
+
throw err;
|
|
96
|
+
});
|
|
97
|
+
return { command, ...account };
|
|
98
|
+
}
|
|
96
99
|
/** Resolve only the fresh-launch executable; resume commands keep their own session flags. */
|
|
97
100
|
function freshCliCommand(cliRunner) {
|
|
98
101
|
return cliRunner === 'cursor'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-in-targets.js","sourceRoot":"","sources":["../../src/server/open-in-targets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AACxG,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAcpD,4FAA4F;AAC5F,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,CAAU,EACV,SAAiB,EACjB,OAA2B,EAC3B,QAAqC;IAErC,IAAI,CAAC,OAAO;QAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,0CAA0C,EAAE,EAAE,GAAG,CAAC,CAAC;IACxF,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC1D,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,CAAC,IAAI,CACX;YACE,KAAK,EAAE,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,OAAO,EAAE,CAAC,CAAC,CA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CAAC,QAAQ,CAAC;QAC9D,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,oBAAoB,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAClG,CAAC;AAED,2FAA2F;AAC3F,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,CAAU,EAAE,MAAc,EAAE,GAAW,EAAE,OAAyB;IACjG,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,kBAAkB,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;IAClF,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -40,7 +40,7 @@ export declare const reportsRoutes: import("hono/hono-base").HonoBase<ProjectApi
|
|
|
40
40
|
error: string;
|
|
41
41
|
};
|
|
42
42
|
outputFormat: "json";
|
|
43
|
-
status:
|
|
43
|
+
status: 400;
|
|
44
44
|
input: {
|
|
45
45
|
query: {
|
|
46
46
|
q?: string | undefined;
|
|
@@ -53,7 +53,7 @@ export declare const reportsRoutes: import("hono/hono-base").HonoBase<ProjectApi
|
|
|
53
53
|
error: string;
|
|
54
54
|
};
|
|
55
55
|
outputFormat: "json";
|
|
56
|
-
status:
|
|
56
|
+
status: 409;
|
|
57
57
|
input: {
|
|
58
58
|
query: {
|
|
59
59
|
q?: string | undefined;
|
|
@@ -24,9 +24,6 @@ type ReadHandle<Rule extends ReadDirectoryRule> = {
|
|
|
24
24
|
interface ReadActions {
|
|
25
25
|
beforeLiveIndex: LiveIndexCheck;
|
|
26
26
|
}
|
|
27
|
-
interface OpenOptions {
|
|
28
|
-
ignoresEngineOwnership: boolean;
|
|
29
|
-
}
|
|
30
27
|
type OpenHandle = {
|
|
31
28
|
run: RunRecord;
|
|
32
29
|
directory: () => string;
|
|
@@ -40,12 +37,11 @@ type ClaimedHandle = {
|
|
|
40
37
|
};
|
|
41
38
|
interface RemoveOptions {
|
|
42
39
|
claim: 'publish' | 'reclaim';
|
|
43
|
-
activeBeforeLookup: boolean;
|
|
44
40
|
checksActive: boolean;
|
|
45
41
|
deletion: 'worktree' | 'record' | 'inline';
|
|
46
42
|
nullClaimError: string;
|
|
47
43
|
}
|
|
48
|
-
export declare function runCheckout(host: RunCheckoutHost, id: string, intent: 'open'
|
|
44
|
+
export declare function runCheckout(host: RunCheckoutHost, id: string, intent: 'open'): CheckoutRefusal | OpenHandle;
|
|
49
45
|
/** Admission stays synchronous: no yield between lookup and claim. */
|
|
50
46
|
export declare function runCheckout(host: RunCheckoutHost, id: string, intent: 'publish'): CheckoutRefusal | ClaimedHandle;
|
|
51
47
|
export declare function runCheckout(host: RunCheckoutHost, id: string, intent: 'remove', options: RemoveOptions): CheckoutRefusal | ClaimedHandle;
|
|
@@ -18,8 +18,8 @@ const NO_WORKTREE = 'no worktree — this task ran directly in the repo working
|
|
|
18
18
|
export function runCheckout(host, id, intent, options = { directory: 'existing-worktree' }) {
|
|
19
19
|
if (intent === 'publish')
|
|
20
20
|
return publishCheckout(host, id);
|
|
21
|
-
if ('
|
|
22
|
-
return openCheckout(host, id
|
|
21
|
+
if (intent === 'open')
|
|
22
|
+
return openCheckout(host, id);
|
|
23
23
|
if ('claim' in options)
|
|
24
24
|
return removeCheckout(host, id, options);
|
|
25
25
|
const { root, store } = host;
|
|
@@ -97,12 +97,10 @@ function removalRefusal(store, run, id, deletion) {
|
|
|
97
97
|
}
|
|
98
98
|
function removeCheckout({ store, manager }, id, options) {
|
|
99
99
|
const active = { status: 409, body: { error: 'run is active — cancel it first' } };
|
|
100
|
-
if (options.checksActive && options.activeBeforeLookup && manager.isActive(id))
|
|
101
|
-
return active;
|
|
102
100
|
const run = store.getRun(id);
|
|
103
101
|
if (!run)
|
|
104
102
|
return { status: 404, body: { error: 'not found' } };
|
|
105
|
-
if (options.checksActive &&
|
|
103
|
+
if (options.checksActive && manager.isActive(id))
|
|
106
104
|
return active;
|
|
107
105
|
const refused = removalRefusal(store, run, id, options.deletion);
|
|
108
106
|
if (refused)
|
|
@@ -123,7 +121,7 @@ export async function reclaimCheckoutError(run) {
|
|
|
123
121
|
? `the worktree has ${dirty} uncommitted file${dirty === 1 ? '' : 's'} that exist nowhere else — commit or discard them first`
|
|
124
122
|
: 'the worktree directory could not be removed';
|
|
125
123
|
}
|
|
126
|
-
function openCheckout({ root, store }, id
|
|
124
|
+
function openCheckout({ root, store }, id) {
|
|
127
125
|
const run = store.getRun(id);
|
|
128
126
|
if (!run)
|
|
129
127
|
return { status: 404, body: { error: 'not found' } };
|
|
@@ -134,7 +132,7 @@ function openCheckout({ root, store }, id, options) {
|
|
|
134
132
|
defaultWorktree() {
|
|
135
133
|
return workingDirectoryOf(run, root) ?? { status: 409, body: { error: NO_WORKTREE } };
|
|
136
134
|
},
|
|
137
|
-
get resumeAllowed() { return
|
|
135
|
+
get resumeAllowed() { return !engineOwnsRun(run); },
|
|
138
136
|
};
|
|
139
137
|
}
|
|
140
138
|
//# sourceMappingURL=run-checkout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-checkout.js","sourceRoot":"","sources":["../../src/server/run-checkout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,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AAC,CAAC,CAAC,CAAC,CAAC;IAChI,OAAO,KAAK,GAAG,CAAC;QACd,CAAC,CAAC,oBAAoB,KAAK,oBAAoB,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,yDAAyD;QAC9H,CAAC,CAAC,6CAA6C,CAAC;AACpD,CAAC;AAED,SAAS,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAmB,EAAE,EAAU;IAChE,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC7B,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,CAAC;IAC/D,OAAO;QACL,GAAG;QACH,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI;QACxC,IAAI,QAAQ,KAAK,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC1C,eAAe;YACb,OAAO,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,CAAC;QACxF,CAAC;QACD,IAAI,aAAa,KAAK,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACpD,CAAC;AACJ,CAAC"}
|
|
@@ -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:
|
|
238
|
+
status: 500;
|
|
254
239
|
input: {
|
|
255
240
|
json: {
|
|
256
|
-
|
|
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">;
|
package/dist/server/server.d.ts
CHANGED
|
@@ -3376,12 +3376,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
3376
3376
|
output: {
|
|
3377
3377
|
generation: string;
|
|
3378
3378
|
results: ({
|
|
3379
|
-
projectId: string;
|
|
3380
|
-
runId: string;
|
|
3381
|
-
type: "error" | "reset";
|
|
3382
|
-
status: 400 | 404 | 409 | 413 | 503;
|
|
3383
|
-
error: string;
|
|
3384
|
-
} | {
|
|
3385
3379
|
projectId: string;
|
|
3386
3380
|
runId: string;
|
|
3387
3381
|
type: "batch";
|
|
@@ -3395,6 +3389,12 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
3395
3389
|
cursor: string;
|
|
3396
3390
|
afterSeq: number;
|
|
3397
3391
|
hasMore: boolean;
|
|
3392
|
+
} | {
|
|
3393
|
+
projectId: string;
|
|
3394
|
+
runId: string;
|
|
3395
|
+
type: "error" | "reset";
|
|
3396
|
+
status: 400 | 404 | 409 | 413 | 503;
|
|
3397
|
+
error: string;
|
|
3398
3398
|
})[];
|
|
3399
3399
|
};
|
|
3400
3400
|
outputFormat: "json";
|
|
@@ -5289,6 +5289,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
5289
5289
|
} & {
|
|
5290
5290
|
"/repo/commit/:sha": {
|
|
5291
5291
|
$get: {
|
|
5292
|
+
output: string;
|
|
5293
|
+
outputFormat: "text";
|
|
5294
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
5295
|
+
input: {
|
|
5296
|
+
query: {
|
|
5297
|
+
structured?: string | undefined;
|
|
5298
|
+
};
|
|
5299
|
+
} & {
|
|
5300
|
+
param: {
|
|
5301
|
+
sha: string;
|
|
5302
|
+
};
|
|
5303
|
+
};
|
|
5304
|
+
} | {
|
|
5292
5305
|
output: {
|
|
5293
5306
|
error: string;
|
|
5294
5307
|
code?: "invalid_input" | undefined;
|
|
@@ -5352,19 +5365,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
5352
5365
|
sha: string;
|
|
5353
5366
|
};
|
|
5354
5367
|
};
|
|
5355
|
-
} | {
|
|
5356
|
-
output: string;
|
|
5357
|
-
outputFormat: "text";
|
|
5358
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
5359
|
-
input: {
|
|
5360
|
-
query: {
|
|
5361
|
-
structured?: string | undefined;
|
|
5362
|
-
};
|
|
5363
|
-
} & {
|
|
5364
|
-
param: {
|
|
5365
|
-
sha: string;
|
|
5366
|
-
};
|
|
5367
|
-
};
|
|
5368
5368
|
};
|
|
5369
5369
|
};
|
|
5370
5370
|
} & {
|
|
@@ -18687,20 +18687,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
18687
18687
|
} & {
|
|
18688
18688
|
"/runs/:id/handoff": {
|
|
18689
18689
|
$get: {
|
|
18690
|
-
output:
|
|
18691
|
-
|
|
18692
|
-
|
|
18693
|
-
outputFormat: "json";
|
|
18694
|
-
status: 404;
|
|
18690
|
+
output: string;
|
|
18691
|
+
outputFormat: "text";
|
|
18692
|
+
status: 200;
|
|
18695
18693
|
input: {
|
|
18696
18694
|
param: {
|
|
18697
18695
|
id: string;
|
|
18698
18696
|
};
|
|
18699
18697
|
};
|
|
18700
18698
|
} | {
|
|
18701
|
-
output:
|
|
18702
|
-
|
|
18703
|
-
|
|
18699
|
+
output: {
|
|
18700
|
+
error: string;
|
|
18701
|
+
};
|
|
18702
|
+
outputFormat: "json";
|
|
18703
|
+
status: 404;
|
|
18704
18704
|
input: {
|
|
18705
18705
|
param: {
|
|
18706
18706
|
id: string;
|
|
@@ -18738,20 +18738,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
18738
18738
|
} & {
|
|
18739
18739
|
"/runs/:id/diff": {
|
|
18740
18740
|
$get: {
|
|
18741
|
-
output:
|
|
18742
|
-
|
|
18743
|
-
|
|
18744
|
-
outputFormat: "json";
|
|
18745
|
-
status: 404 | 409;
|
|
18741
|
+
output: string;
|
|
18742
|
+
outputFormat: "text";
|
|
18743
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
18746
18744
|
input: {
|
|
18747
18745
|
param: {
|
|
18748
18746
|
id: string;
|
|
18749
18747
|
};
|
|
18750
18748
|
};
|
|
18751
18749
|
} | {
|
|
18752
|
-
output:
|
|
18753
|
-
|
|
18754
|
-
|
|
18750
|
+
output: {
|
|
18751
|
+
error: string;
|
|
18752
|
+
};
|
|
18753
|
+
outputFormat: "json";
|
|
18754
|
+
status: 404 | 409;
|
|
18755
18755
|
input: {
|
|
18756
18756
|
param: {
|
|
18757
18757
|
id: string;
|
|
@@ -21151,6 +21151,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
21151
21151
|
} & {
|
|
21152
21152
|
"/repo/commit/:sha": {
|
|
21153
21153
|
$get: {
|
|
21154
|
+
output: string;
|
|
21155
|
+
outputFormat: "text";
|
|
21156
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
21157
|
+
input: {
|
|
21158
|
+
query: {
|
|
21159
|
+
structured?: string | undefined;
|
|
21160
|
+
};
|
|
21161
|
+
} & {
|
|
21162
|
+
param: {
|
|
21163
|
+
sha: string;
|
|
21164
|
+
};
|
|
21165
|
+
};
|
|
21166
|
+
} | {
|
|
21154
21167
|
output: {
|
|
21155
21168
|
error: string;
|
|
21156
21169
|
code?: "invalid_input" | undefined;
|
|
@@ -21214,19 +21227,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
21214
21227
|
sha: string;
|
|
21215
21228
|
};
|
|
21216
21229
|
};
|
|
21217
|
-
} | {
|
|
21218
|
-
output: string;
|
|
21219
|
-
outputFormat: "text";
|
|
21220
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
21221
|
-
input: {
|
|
21222
|
-
query: {
|
|
21223
|
-
structured?: string | undefined;
|
|
21224
|
-
};
|
|
21225
|
-
} & {
|
|
21226
|
-
param: {
|
|
21227
|
-
sha: string;
|
|
21228
|
-
};
|
|
21229
|
-
};
|
|
21230
21230
|
};
|
|
21231
21231
|
};
|
|
21232
21232
|
} & {
|
|
@@ -34549,20 +34549,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
34549
34549
|
} & {
|
|
34550
34550
|
"/runs/:id/handoff": {
|
|
34551
34551
|
$get: {
|
|
34552
|
-
output:
|
|
34553
|
-
|
|
34554
|
-
|
|
34555
|
-
outputFormat: "json";
|
|
34556
|
-
status: 404;
|
|
34552
|
+
output: string;
|
|
34553
|
+
outputFormat: "text";
|
|
34554
|
+
status: 200;
|
|
34557
34555
|
input: {
|
|
34558
34556
|
param: {
|
|
34559
34557
|
id: string;
|
|
34560
34558
|
};
|
|
34561
34559
|
};
|
|
34562
34560
|
} | {
|
|
34563
|
-
output:
|
|
34564
|
-
|
|
34565
|
-
|
|
34561
|
+
output: {
|
|
34562
|
+
error: string;
|
|
34563
|
+
};
|
|
34564
|
+
outputFormat: "json";
|
|
34565
|
+
status: 404;
|
|
34566
34566
|
input: {
|
|
34567
34567
|
param: {
|
|
34568
34568
|
id: string;
|
|
@@ -34600,20 +34600,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
34600
34600
|
} & {
|
|
34601
34601
|
"/runs/:id/diff": {
|
|
34602
34602
|
$get: {
|
|
34603
|
-
output:
|
|
34604
|
-
|
|
34605
|
-
|
|
34606
|
-
outputFormat: "json";
|
|
34607
|
-
status: 404 | 409;
|
|
34603
|
+
output: string;
|
|
34604
|
+
outputFormat: "text";
|
|
34605
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
34608
34606
|
input: {
|
|
34609
34607
|
param: {
|
|
34610
34608
|
id: string;
|
|
34611
34609
|
};
|
|
34612
34610
|
};
|
|
34613
34611
|
} | {
|
|
34614
|
-
output:
|
|
34615
|
-
|
|
34616
|
-
|
|
34612
|
+
output: {
|
|
34613
|
+
error: string;
|
|
34614
|
+
};
|
|
34615
|
+
outputFormat: "json";
|
|
34616
|
+
status: 404 | 409;
|
|
34617
34617
|
input: {
|
|
34618
34618
|
param: {
|
|
34619
34619
|
id: string;
|
package/dist/server/server.js
CHANGED
|
@@ -158,7 +158,7 @@ import { GithubPrNotFoundError, GH_CHECKS_MAX, GH_REF_STATUS_MAX } from './forge
|
|
|
158
158
|
import { projectAdmissionRefusal, withProjectAdmission } from './cockpit-ownership.js';
|
|
159
159
|
import { closingSignal, prepareBeforeTicks, prepareProject, prepareProjects } from '../project-migration/auto.js';
|
|
160
160
|
import { RunStoreOpenError } from '../runs/store-open-error.js';
|
|
161
|
-
import { openRunApp, openRunCli, openRunDefaultApp } from './open-in-targets.js';
|
|
161
|
+
import { freshCliHandoff, openRunApp, openRunCli, openRunDefaultApp } from './open-in-targets.js';
|
|
162
162
|
import { agentCliRunner, detectOpenTargets } from './open-in-app.js';
|
|
163
163
|
import { ProviderRuntimeAuthObserver } from './provider-auth-runtime.js';
|
|
164
164
|
import { providerForExistingRun, providersRequiredByWorkflow, } from './provider-action-gate.js';
|
|
@@ -965,6 +965,16 @@ export function createApp(deps) {
|
|
|
965
965
|
return { error: `unknown ${provider} account: ${profileId}` };
|
|
966
966
|
return { profile: resolveStoredProfile(stored) };
|
|
967
967
|
};
|
|
968
|
+
const openHandoffCheckout = (c, suffix = '') => {
|
|
969
|
+
const checkout = runCheckout(c.get('project'), c.req.param('id'), 'open');
|
|
970
|
+
if ('status' in checkout)
|
|
971
|
+
return checkout;
|
|
972
|
+
// Hosted mode: there is no "my machine" to open a terminal on. The UI
|
|
973
|
+
// hides the button when localHandoff is false — this is defense in depth.
|
|
974
|
+
return !capabilities().localHandoff
|
|
975
|
+
? { status: 409, body: { error: `local handoff is disabled — this cockpit runs in hosted mode (CEZ_REMOTE)${suffix}` } }
|
|
976
|
+
: checkout;
|
|
977
|
+
};
|
|
968
978
|
/**
|
|
969
979
|
* The environment a terminal handoff must carry so the CLI lands on the right account.
|
|
970
980
|
*
|
|
@@ -3188,16 +3198,9 @@ export function createApp(deps) {
|
|
|
3188
3198
|
// in the task's worktree when it still exists (spec 006).
|
|
3189
3199
|
.post('/runs/:id/open-in-cli', async (c) => {
|
|
3190
3200
|
const project = c.get('project');
|
|
3191
|
-
const checkout =
|
|
3201
|
+
const checkout = openHandoffCheckout(c, '; resume the session from a machine that has the checkout');
|
|
3192
3202
|
if ('status' in checkout)
|
|
3193
3203
|
return c.json(checkout.body, checkout.status);
|
|
3194
|
-
// Hosted mode: there is no "my machine" to open a terminal on. The UI
|
|
3195
|
-
// hides the button when localHandoff is false — this is defense in depth.
|
|
3196
|
-
if (!capabilities().localHandoff) {
|
|
3197
|
-
return c.json({
|
|
3198
|
-
error: 'local handoff is disabled — this cockpit runs in hosted mode (CEZ_REMOTE); resume the session from a machine that has the checkout',
|
|
3199
|
-
}, 409);
|
|
3200
|
-
}
|
|
3201
3204
|
const sessionStep = [...checkout.run.steps].reverse().find((s) => s.sessionId);
|
|
3202
3205
|
const sessionId = sessionStep?.sessionId;
|
|
3203
3206
|
if (!sessionId)
|
|
@@ -3210,13 +3213,16 @@ export function createApp(deps) {
|
|
|
3210
3213
|
const refusal = fallbackProjectWriteError(cwd);
|
|
3211
3214
|
if (refusal)
|
|
3212
3215
|
return c.json({ error: refusal }, 409);
|
|
3213
|
-
const
|
|
3214
|
-
// Fails closed on an id we do not recognise — see resumeCommand (#431).
|
|
3215
|
-
if (
|
|
3216
|
+
const resume = checkout.resumeAllowed ? resumeCommand(backend, sessionId) : undefined;
|
|
3217
|
+
// Fails closed on an id we do not recognise — see resumeCommand (open-mercato/cezar#431).
|
|
3218
|
+
if (resume === null)
|
|
3216
3219
|
return c.json({ error: 'the recorded session id has an unexpected shape' }, 409);
|
|
3217
|
-
const account =
|
|
3220
|
+
const account = resume
|
|
3221
|
+
? { command: resume, ...await handoffEnv(backend, sessionStep?.profileId) }
|
|
3222
|
+
: await freshCliHandoff(backend, project.root, deps.home);
|
|
3218
3223
|
if ('error' in account)
|
|
3219
3224
|
return c.json({ error: account.error }, 409);
|
|
3225
|
+
const { command } = account;
|
|
3220
3226
|
const fallback = handoffFallbackCommand(cwd, command, account.env);
|
|
3221
3227
|
// Fail closed for the same reason as the session id: a terminal opened without the
|
|
3222
3228
|
// account's config dir resumes nothing and says nothing about why.
|
|
@@ -3232,14 +3238,9 @@ export function createApp(deps) {
|
|
|
3232
3238
|
// Open a run's worktree (or the repo root) in the chosen local app.
|
|
3233
3239
|
.post('/runs/:id/open-in', jsonZodValidator(openInSchema), async (c) => {
|
|
3234
3240
|
const project = c.get('project');
|
|
3235
|
-
const checkout =
|
|
3241
|
+
const checkout = openHandoffCheckout(c);
|
|
3236
3242
|
if ('status' in checkout)
|
|
3237
3243
|
return c.json(checkout.body, checkout.status);
|
|
3238
|
-
if (!capabilities().localHandoff) {
|
|
3239
|
-
return c.json({
|
|
3240
|
-
error: 'local handoff is disabled — this cockpit runs in hosted mode (CEZ_REMOTE)',
|
|
3241
|
-
}, 409);
|
|
3242
|
-
}
|
|
3243
3244
|
// Follows the safeParse convention (#429); the downstream allowlist match is the real
|
|
3244
3245
|
// injection guard, this just validates the shape.
|
|
3245
3246
|
const { target, path: relPath } = c.req.valid('json');
|
|
@@ -3559,7 +3560,7 @@ export function createApp(deps) {
|
|
|
3559
3560
|
const { root: repoRoot, store } = c.get('project');
|
|
3560
3561
|
const id = c.req.param('id');
|
|
3561
3562
|
const checkout = runCheckout(c.get('project'), id, 'remove', {
|
|
3562
|
-
claim: 'publish',
|
|
3563
|
+
claim: 'publish', checksActive: true, deletion: 'worktree',
|
|
3563
3564
|
nullClaimError: 'worktree cleanup pending — retry after cleanup is confirmed',
|
|
3564
3565
|
});
|
|
3565
3566
|
if ('status' in checkout)
|
|
@@ -3579,7 +3580,7 @@ export function createApp(deps) {
|
|
|
3579
3580
|
const { root: repoRoot, store } = c.get('project');
|
|
3580
3581
|
const id = c.req.param('id');
|
|
3581
3582
|
const checkout = runCheckout(c.get('project'), id, 'remove', {
|
|
3582
|
-
claim: 'publish',
|
|
3583
|
+
claim: 'publish', checksActive: true, deletion: 'record',
|
|
3583
3584
|
nullClaimError: 'worktree cleanup pending — retry after cleanup is confirmed',
|
|
3584
3585
|
});
|
|
3585
3586
|
if ('status' in checkout)
|
|
@@ -3692,7 +3693,7 @@ export function createApp(deps) {
|
|
|
3692
3693
|
.post('/worktrees/:runId/reclaim', paramZodValidator(reclaimRunParamsSchema), async (c) => {
|
|
3693
3694
|
const { root: repoRoot, store } = c.get('project');
|
|
3694
3695
|
const checkout = runCheckout(c.get('project'), c.req.valid('param').runId, 'remove', {
|
|
3695
|
-
claim: 'reclaim',
|
|
3696
|
+
claim: 'reclaim', checksActive: false, deletion: 'inline',
|
|
3696
3697
|
nullClaimError: 'this worktree is in use or already reclaimed — only a finished task\'s worktree can be reclaimed',
|
|
3697
3698
|
});
|
|
3698
3699
|
if ('status' in checkout)
|