@wjarka/cezarion 0.17.0-dev.5511 → 0.17.0-dev.5525
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 +12 -0
- package/dist/ci-wait/errors.js +2 -2
- package/dist/ci-wait/errors.js.map +1 -1
- package/dist/ci-wait/tools.js +8 -6
- package/dist/ci-wait/tools.js.map +1 -1
- package/dist/cli-dispatch.js +1 -0
- package/dist/cli-dispatch.js.map +1 -1
- package/dist/delegation/transport.d.ts +62 -62
- package/dist/jobs/cli.d.ts +2 -0
- package/dist/jobs/cli.js +53 -0
- package/dist/jobs/cli.js.map +1 -0
- package/dist/jobs/command.d.ts +9 -0
- package/dist/jobs/command.js +19 -0
- package/dist/jobs/command.js.map +1 -0
- package/dist/jobs/job.d.ts +77 -0
- package/dist/jobs/job.js +252 -0
- package/dist/jobs/job.js.map +1 -0
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/run-checkout.d.ts +26 -1
- package/dist/server/run-checkout.js +80 -1
- package/dist/server/run-checkout.js.map +1 -1
- package/dist/server/server.d.ts +132 -238
- package/dist/server/server.js +36 -69
- package/dist/server/server.js.map +1 -1
- package/dist/subcommands.d.ts +1 -1
- package/dist/subcommands.js +2 -1
- package/dist/subcommands.js.map +1 -1
- package/dist/voice/routes.d.ts +19 -19
- package/dist/workflows/run/session-events.d.ts +1 -1
- package/dist/workflows/run/session-events.js +3 -2
- package/dist/workflows/run/session-events.js.map +1 -1
- package/dist/workflows/run/wait-kinds.d.ts +3 -0
- package/dist/workflows/run/wait-kinds.js +11 -1
- package/dist/workflows/run/wait-kinds.js.map +1 -1
- package/package.json +3 -3
- package/web/dist/assets/{activity-motion-BHr-ZAZp.js → activity-motion-D-wNjCZO.js} +1 -1
- package/web/dist/assets/{activity-route-Bk7-QeK_.js → activity-route-CEhKA6LC.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-C9vHxqqQ.js → commit-diff-panel-C5SEnKvj.js} +1 -1
- package/web/dist/assets/{diff-gmuErI3F.js → diff-DOKQG121.js} +2 -2
- package/web/dist/assets/{diff-view-DigfbKBX.js → diff-view-Dlbaomc6.js} +1 -1
- package/web/dist/assets/{git-toolbar-DOUDDTBC.js → git-toolbar-B_lgnDi3.js} +1 -1
- package/web/dist/assets/{github-DBcdEsSz.js → github-89EDv5jm.js} +1 -1
- package/web/dist/assets/{global-activity-route-CxCecB2W.js → global-activity-route-2SM3xKBA.js} +1 -1
- package/web/dist/assets/{index-Cybrk3p9.js → index-DKIv9VPA.js} +3 -3
- package/web/dist/assets/{preview-pane-connected-mMMD4IiM.js → preview-pane-connected-B730Jv1e.js} +1 -1
- package/web/dist/assets/{repo-git-Dv-6cKAC.js → repo-git-D6gQXbHu.js} +1 -1
- package/web/dist/assets/{report-reader-Dtus2Ua4.js → report-reader-DP43jeNM.js} +1 -1
- package/web/dist/assets/{reports-DAgEuUbp.js → reports-DV8NzFp3.js} +1 -1
- package/web/dist/assets/{run-header-BPaPARge.js → run-header-DjXPrh23.js} +1 -1
- package/web/dist/assets/{skills-XYpWQDCm.js → skills-DuZYEbo5.js} +1 -1
- package/web/dist/assets/{task-changes-BAQ4Gn66.js → task-changes-CUWFco57.js} +1 -1
- package/web/dist/assets/{task-commits-DS7kN8JG.js → task-commits-Cgoxt66y.js} +1 -1
- package/web/dist/assets/{task-files-D7YFhWFg.js → task-files-BmTRfJ5K.js} +1 -1
- package/web/dist/assets/{task-github-item-bRgH9WkE.js → task-github-item-Cmro8m-6.js} +1 -1
- package/web/dist/assets/{task-thread-CuRhXDEj.js → task-thread-BTjoNRed.js} +2 -2
- package/web/dist/assets/{thread-state-DDD8tLGN.js → thread-state-Cd3ERj1h.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-b8KEA5pM.js → use-hand-to-agent-state-C2rQan6D.js} +1 -1
- package/web/dist/assets/{workflows-BdKDN9aF.js → workflows-DemG2-He.js} +1 -1
- package/web/dist/index.html +1 -1
package/dist/server/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { runCheckout, NO_WORKTREE } from './run-checkout.js';
|
|
1
|
+
import { runCheckout, preparePublishCheckout, reclaimCheckoutError, NO_WORKTREE } from './run-checkout.js';
|
|
2
2
|
import { adoptFallbackControl, protectFallbackRun, runArtifactDirectory } from './project-run-files.js';
|
|
3
3
|
import { deleteSavedWorkflow } from './workflow-files.js';
|
|
4
4
|
import { projectPaths, fallbackProjectWriteError } from '../project-paths.js';
|
|
@@ -20,7 +20,6 @@ import { mergeNumberParams, prChangesParams, prChangesQuery, mergeBodySchema } f
|
|
|
20
20
|
import { gitCommitSchema, reclaimBodySchema, repoBranchSchema } from '../contract/index.js';
|
|
21
21
|
import { setConfigSchema, setAgentConfigSchema } from '../contract/index.js';
|
|
22
22
|
import { saveWorkflowInputSchema as saveWorkflowSchema } from '../contract/index.js';
|
|
23
|
-
import { isUsageLimitHold } from '../contract/index.js';
|
|
24
23
|
import { patchRunInputSchema as patchRunSchema, messageInputSchema as messageSchema } from '../contract/index.js';
|
|
25
24
|
import { checkoutProjectInputSchema as checkoutSchema, registerProjectInputSchema as registerProjectSchema } from '../contract/index.js';
|
|
26
25
|
import { setWorkspaceConfigInputSchema as workspaceConfigUpdateSchema } from '../contract/index.js';
|
|
@@ -118,7 +117,7 @@ import { artifactPreview, loadFileLink, rasterMime } from '../artifacts/resolve.
|
|
|
118
117
|
import { isUntouchedCancelledRun, toPastedContent } from '../workflows/run.js';
|
|
119
118
|
import { worktreeDiff, worktreeSizeBytes } from '../git-worktree.js';
|
|
120
119
|
import { releaseThenRemoveWorktree } from '../git-worktree-release.js';
|
|
121
|
-
import { isReclaimable, reclaimWorktree, reclaimWorktrees,
|
|
120
|
+
import { isReclaimable, reclaimWorktree, reclaimWorktrees, selectReclaimableWorktrees } from '../runs/retention.js';
|
|
122
121
|
import { getBranches, getCommit, getDiff, getLogWithParents, getBranchHead, getRepoInfo, getStatus, getTracking } from './git.js';
|
|
123
122
|
import { createGithubBranchForge } from './repo-branch-forge.js';
|
|
124
123
|
import { attributeLog, classifyInputFor, deleteBranches, forgetRepoBranches, readRepoBranchCounts, readRepoBranches } from './repo-branches.js';
|
|
@@ -3522,32 +3521,17 @@ export function createApp(deps) {
|
|
|
3522
3521
|
// badge. Failures come back as 409 with a `manual` merge command the GUI
|
|
3523
3522
|
// shows next to the toast. CEZ_DRY_RUN=1 fakes the URL (no push, no gh).
|
|
3524
3523
|
.post('/runs/:id/pr', async (c) => {
|
|
3525
|
-
const { root: repoRoot, store
|
|
3524
|
+
const { root: repoRoot, store } = c.get('project');
|
|
3526
3525
|
const id = c.req.param('id');
|
|
3527
|
-
const
|
|
3528
|
-
if (
|
|
3529
|
-
return c.json(
|
|
3530
|
-
const
|
|
3531
|
-
if (refusal)
|
|
3532
|
-
return c.json({ error: refusal }, 409);
|
|
3533
|
-
if (manager.isActive(id))
|
|
3534
|
-
return c.json({ error: 'run is still active — wait for the review gate' }, 409);
|
|
3535
|
-
// A hold is live: done would drop its resume (S7 B13). Don’t resume (DELETE …/auto-resume) settles it failed.
|
|
3536
|
-
if (isUsageLimitHold(held))
|
|
3537
|
-
return c.json({ error: 'run is waiting on a usage-limit hold — choose Don’t resume in the task’s usage-limit hint, then retry Draft PR' }, 409);
|
|
3538
|
-
const release = manager.claimForPublish(id);
|
|
3539
|
-
if (!release)
|
|
3540
|
-
return c.json({ error: 'its worktree or branch is being cleaned up — retry in a moment' }, 409);
|
|
3526
|
+
const checkout = runCheckout(c.get('project'), id, 'publish');
|
|
3527
|
+
if ('status' in checkout)
|
|
3528
|
+
return c.json(checkout.body, checkout.status);
|
|
3529
|
+
const { release } = checkout;
|
|
3541
3530
|
try {
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
const run =
|
|
3546
|
-
if (!run)
|
|
3547
|
-
return c.json({ error: 'not found' }, 404);
|
|
3548
|
-
if (!run.worktreePath || !existsSync(run.worktreePath) || !run.branch) {
|
|
3549
|
-
return c.json({ error: 'no worktree/branch to publish — this task ran in the repo working tree' }, 400);
|
|
3550
|
-
}
|
|
3531
|
+
const prepared = await preparePublishCheckout(c.get('project'), id);
|
|
3532
|
+
if ('status' in prepared)
|
|
3533
|
+
return c.json(prepared.body, prepared.status);
|
|
3534
|
+
const { run } = prepared;
|
|
3551
3535
|
const outcome = await resolveForgeRoot(repoRoot, deps.forgeFactory).createPR({
|
|
3552
3536
|
repoRoot,
|
|
3553
3537
|
run,
|
|
@@ -3570,18 +3554,15 @@ export function createApp(deps) {
|
|
|
3570
3554
|
// Archived tasks keep their worktree for inspection; this is the explicit
|
|
3571
3555
|
// "🧹 Remove worktree" cleanup (spec 006).
|
|
3572
3556
|
.post('/runs/:id/remove-worktree', protectFallbackRun('worktree'), async (c) => {
|
|
3573
|
-
const { root: repoRoot, store
|
|
3557
|
+
const { root: repoRoot, store } = c.get('project');
|
|
3574
3558
|
const id = c.req.param('id');
|
|
3575
|
-
const
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
const release = manager.claimForPublish(id);
|
|
3583
|
-
if (!release)
|
|
3584
|
-
return c.json({ error: 'worktree cleanup pending — retry after cleanup is confirmed' }, 409);
|
|
3559
|
+
const checkout = runCheckout(c.get('project'), id, 'remove', {
|
|
3560
|
+
claim: 'publish', activeBeforeLookup: false, checksActive: true, deletion: 'worktree', ignoresHold: true,
|
|
3561
|
+
nullClaimError: 'worktree cleanup pending — retry after cleanup is confirmed',
|
|
3562
|
+
});
|
|
3563
|
+
if ('status' in checkout)
|
|
3564
|
+
return c.json(checkout.body, checkout.status);
|
|
3565
|
+
const { run, release } = checkout;
|
|
3585
3566
|
try {
|
|
3586
3567
|
if (run.worktreePath)
|
|
3587
3568
|
await releaseThenRemoveWorktree({ previewHost: deps.previewHost }, id, repoRoot, run.worktreePath, run.branch);
|
|
@@ -3593,19 +3574,15 @@ export function createApp(deps) {
|
|
|
3593
3574
|
}
|
|
3594
3575
|
})
|
|
3595
3576
|
.delete('/runs/:id', protectFallbackRun('record'), async (c) => {
|
|
3596
|
-
const { root: repoRoot, store
|
|
3577
|
+
const { root: repoRoot, store } = c.get('project');
|
|
3597
3578
|
const id = c.req.param('id');
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
return c.json({ error: 'owned resources require verified worker cleanup and explicit child history deletion first' }, 409);
|
|
3606
|
-
const release = manager.claimForPublish(id);
|
|
3607
|
-
if (!release)
|
|
3608
|
-
return c.json({ error: 'worktree cleanup pending — retry after cleanup is confirmed' }, 409);
|
|
3579
|
+
const checkout = runCheckout(c.get('project'), id, 'remove', {
|
|
3580
|
+
claim: 'publish', activeBeforeLookup: true, checksActive: true, deletion: 'record', ignoresHold: true,
|
|
3581
|
+
nullClaimError: 'worktree cleanup pending — retry after cleanup is confirmed',
|
|
3582
|
+
});
|
|
3583
|
+
if ('status' in checkout)
|
|
3584
|
+
return c.json(checkout.body, checkout.status);
|
|
3585
|
+
const { run, release } = checkout;
|
|
3609
3586
|
try {
|
|
3610
3587
|
if (run.delegation?.role !== 'worker' && run.worktreePath)
|
|
3611
3588
|
await releaseThenRemoveWorktree({ previewHost: deps.previewHost }, id, repoRoot, run.worktreePath, run.branch);
|
|
@@ -3711,27 +3688,17 @@ export function createApp(deps) {
|
|
|
3711
3688
|
// the `cez/<id8>` branch is kept, which is what makes this safe to offer on every finished
|
|
3712
3689
|
// row. `/runs/:id/remove-worktree` (directory AND branch) stays the task screen's action.
|
|
3713
3690
|
.post('/worktrees/:runId/reclaim', paramZodValidator(reclaimRunParamsSchema), async (c) => {
|
|
3714
|
-
const { root: repoRoot, store
|
|
3715
|
-
const
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
if (
|
|
3720
|
-
return c.json(
|
|
3721
|
-
|
|
3722
|
-
const release = manager.claimWorktreeReclaim(run.id);
|
|
3723
|
-
if (!release) {
|
|
3724
|
-
return c.json({ error: 'this worktree is in use or already reclaimed — only a finished task\'s worktree can be reclaimed' }, 409);
|
|
3725
|
-
}
|
|
3691
|
+
const { root: repoRoot, store } = c.get('project');
|
|
3692
|
+
const checkout = runCheckout(c.get('project'), c.req.valid('param').runId, 'remove', {
|
|
3693
|
+
claim: 'reclaim', activeBeforeLookup: false, checksActive: false, deletion: 'inline', ignoresHold: true,
|
|
3694
|
+
nullClaimError: 'this worktree is in use or already reclaimed — only a finished task\'s worktree can be reclaimed',
|
|
3695
|
+
});
|
|
3696
|
+
if ('status' in checkout)
|
|
3697
|
+
return c.json(checkout.body, checkout.status);
|
|
3698
|
+
const { run, release } = checkout;
|
|
3726
3699
|
const worktreeReclaimedAt = await reclaimWorktree(repoRoot, store, run, { requireClean: true, previewHost: deps.previewHost }).finally(release);
|
|
3727
3700
|
if (!worktreeReclaimedAt) {
|
|
3728
|
-
|
|
3729
|
-
const dirty = run.worktreePath && existsSync(run.worktreePath) ? (await getStatus(run.worktreePath).catch(() => [])).length : 0;
|
|
3730
|
-
return c.json({
|
|
3731
|
-
error: dirty > 0
|
|
3732
|
-
? `the worktree has ${dirty} uncommitted file${dirty === 1 ? '' : 's'} that exist nowhere else — commit or discard them first`
|
|
3733
|
-
: 'the worktree directory could not be removed',
|
|
3734
|
-
}, 409);
|
|
3701
|
+
return c.json({ error: await reclaimCheckoutError(run) }, 409);
|
|
3735
3702
|
}
|
|
3736
3703
|
forgetRepoBranches(repoRoot);
|
|
3737
3704
|
return c.json({ runId: run.id, worktreeReclaimedAt });
|