@wjarka/cezarion 0.17.0-dev.5440 → 0.17.0-dev.5466

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 (93) hide show
  1. package/dist/artifacts/cli.js +17 -4
  2. package/dist/artifacts/cli.js.map +1 -1
  3. package/dist/artifacts/reports-index.d.ts +1 -1
  4. package/dist/artifacts/reports-index.js +1 -6
  5. package/dist/artifacts/reports-index.js.map +1 -1
  6. package/dist/automations/coordinator.d.ts +1 -1
  7. package/dist/automations/coordinator.js +1 -1
  8. package/dist/automations/coordinator.js.map +1 -1
  9. package/dist/automations/schedule-runner.d.ts +6 -2
  10. package/dist/automations/schedule-runner.js +35 -27
  11. package/dist/automations/schedule-runner.js.map +1 -1
  12. package/dist/automations/scheduler.js +3 -14
  13. package/dist/automations/scheduler.js.map +1 -1
  14. package/dist/automations/store.d.ts +2 -2
  15. package/dist/automations/store.js +11 -13
  16. package/dist/automations/store.js.map +1 -1
  17. package/dist/automations/task-template.js +5 -6
  18. package/dist/automations/task-template.js.map +1 -1
  19. package/dist/ci-wait/controller.d.ts +37 -37
  20. package/dist/cli-dispatch.js +14 -8
  21. package/dist/cli-dispatch.js.map +1 -1
  22. package/dist/delegation/routes.d.ts +62 -62
  23. package/dist/delegation/routes.js +2 -2
  24. package/dist/delegation/routes.js.map +1 -1
  25. package/dist/delegation/transport.d.ts +12 -12
  26. package/dist/preview/browser-launch.d.ts +0 -1
  27. package/dist/preview/browser-launch.js +12 -1
  28. package/dist/preview/browser-launch.js.map +1 -1
  29. package/dist/preview/host.d.ts +0 -6
  30. package/dist/preview/host.js +3 -17
  31. package/dist/preview/host.js.map +1 -1
  32. package/dist/project-migration/answer.d.ts +19 -0
  33. package/dist/project-migration/answer.js +33 -0
  34. package/dist/project-migration/answer.js.map +1 -0
  35. package/dist/project-migration/auto.d.ts +73 -0
  36. package/dist/project-migration/auto.js +157 -0
  37. package/dist/project-migration/auto.js.map +1 -0
  38. package/dist/project-migration/cli.d.ts +18 -0
  39. package/dist/project-migration/cli.js +55 -0
  40. package/dist/project-migration/cli.js.map +1 -0
  41. package/dist/project-migration/containment.d.ts +52 -0
  42. package/dist/project-migration/containment.js +200 -0
  43. package/dist/project-migration/containment.js.map +1 -0
  44. package/dist/project-migration/engine.d.ts +9 -11
  45. package/dist/project-migration/engine.js +14 -8
  46. package/dist/project-migration/engine.js.map +1 -1
  47. package/dist/project-migration/live.d.ts +47 -0
  48. package/dist/project-migration/live.js +137 -0
  49. package/dist/project-migration/live.js.map +1 -0
  50. package/dist/project-migration/offline.d.ts +25 -0
  51. package/dist/project-migration/offline.js +54 -0
  52. package/dist/project-migration/offline.js.map +1 -0
  53. package/dist/project-migration/plan.d.ts +7 -0
  54. package/dist/project-migration/plan.js +34 -24
  55. package/dist/project-migration/plan.js.map +1 -1
  56. package/dist/project-migration/recovery.d.ts +28 -0
  57. package/dist/project-migration/recovery.js +78 -0
  58. package/dist/project-migration/recovery.js.map +1 -0
  59. package/dist/project-migration/steps.js +27 -0
  60. package/dist/project-migration/steps.js.map +1 -1
  61. package/dist/project-paths.d.ts +7 -0
  62. package/dist/project-paths.js +19 -0
  63. package/dist/project-paths.js.map +1 -1
  64. package/dist/runs/webhook.js +2 -3
  65. package/dist/runs/webhook.js.map +1 -1
  66. package/dist/self-update/checkouts.js +13 -1
  67. package/dist/self-update/checkouts.js.map +1 -1
  68. package/dist/serve-command.d.ts +4 -0
  69. package/dist/serve-command.js +8 -1
  70. package/dist/serve-command.js.map +1 -1
  71. package/dist/server/archive-on-merge.js +1 -1
  72. package/dist/server/archive-on-merge.js.map +1 -1
  73. package/dist/server/cockpit-ownership.d.ts +18 -34
  74. package/dist/server/cockpit-ownership.js +38 -120
  75. package/dist/server/cockpit-ownership.js.map +1 -1
  76. package/dist/server/live-routes.js +1 -1
  77. package/dist/server/live-routes.js.map +1 -1
  78. package/dist/server/project-context.d.ts +5 -14
  79. package/dist/server/project-context.js +14 -33
  80. package/dist/server/project-context.js.map +1 -1
  81. package/dist/server/server.d.ts +182 -182
  82. package/dist/server/server.js +17 -13
  83. package/dist/server/server.js.map +1 -1
  84. package/dist/server/workspace-live-routes.d.ts +6 -6
  85. package/dist/server/workspace-projects.d.ts +1 -1
  86. package/dist/server/workspace-projects.js +4 -0
  87. package/dist/server/workspace-projects.js.map +1 -1
  88. package/dist/subcommands.js +5 -1
  89. package/dist/subcommands.js.map +1 -1
  90. package/package.json +3 -3
  91. package/dist/preview/project-exits.d.ts +0 -16
  92. package/dist/preview/project-exits.js +0 -36
  93. package/dist/preview/project-exits.js.map +0 -1
@@ -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";
@@ -3645,94 +3645,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3645
3645
  };
3646
3646
  };
3647
3647
  };
3648
- }, "/"> | import("hono/types").MergeSchemaPath<{
3649
- "/reports/state": {
3650
- $get: {
3651
- output: {
3652
- error: string;
3653
- };
3654
- outputFormat: "json";
3655
- status: 409;
3656
- input: {};
3657
- } | {
3658
- output: {
3659
- epoch: string;
3660
- generation: number;
3661
- metadataGeneration: number;
3662
- };
3663
- outputFormat: "json";
3664
- status: import("hono/utils/http-status").ContentfulStatusCode;
3665
- input: {};
3666
- };
3667
- };
3668
- } & {
3669
- "/reports": {
3670
- $get: {
3671
- output: {
3672
- error: string;
3673
- code?: "invalid_input" | undefined;
3674
- };
3675
- outputFormat: "json";
3676
- status: 400;
3677
- input: {
3678
- query: {
3679
- q?: string | undefined;
3680
- before?: string | undefined;
3681
- limit?: number | undefined;
3682
- };
3683
- };
3684
- } | {
3685
- output: {
3686
- error: string;
3687
- };
3688
- outputFormat: "json";
3689
- status: 409;
3690
- input: {
3691
- query: {
3692
- q?: string | undefined;
3693
- before?: string | undefined;
3694
- limit?: number | undefined;
3695
- };
3696
- };
3697
- } | {
3698
- output: {
3699
- error: string;
3700
- };
3701
- outputFormat: "json";
3702
- status: 400;
3703
- input: {
3704
- query: {
3705
- q?: string | undefined;
3706
- before?: string | undefined;
3707
- limit?: number | undefined;
3708
- };
3709
- };
3710
- } | {
3711
- output: {
3712
- reports: {
3713
- id: string;
3714
- runId: string;
3715
- name: string;
3716
- title: string;
3717
- createdAt: string;
3718
- size: number;
3719
- taskTitle: string;
3720
- taskStatus: "cancelled" | "done" | "failed" | "queued" | "review" | "running" | "waiting";
3721
- }[];
3722
- nextCursor: string | null;
3723
- total: number;
3724
- };
3725
- outputFormat: "json";
3726
- status: import("hono/utils/http-status").ContentfulStatusCode;
3727
- input: {
3728
- query: {
3729
- q?: string | undefined;
3730
- before?: string | undefined;
3731
- limit?: number | undefined;
3732
- };
3733
- };
3734
- };
3735
- };
3736
3648
  }, "/"> | import("hono/types").MergeSchemaPath<{
3737
3649
  "/ui-state": {
3738
3650
  $get: {
@@ -4343,6 +4255,94 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4343
4255
  };
4344
4256
  };
4345
4257
  };
4258
+ }, "/"> | import("hono/types").MergeSchemaPath<{
4259
+ "/reports/state": {
4260
+ $get: {
4261
+ output: {
4262
+ error: string;
4263
+ };
4264
+ outputFormat: "json";
4265
+ status: 409;
4266
+ input: {};
4267
+ } | {
4268
+ output: {
4269
+ epoch: string;
4270
+ generation: number;
4271
+ metadataGeneration: number;
4272
+ };
4273
+ outputFormat: "json";
4274
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4275
+ input: {};
4276
+ };
4277
+ };
4278
+ } & {
4279
+ "/reports": {
4280
+ $get: {
4281
+ output: {
4282
+ error: string;
4283
+ code?: "invalid_input" | undefined;
4284
+ };
4285
+ outputFormat: "json";
4286
+ status: 400;
4287
+ input: {
4288
+ query: {
4289
+ q?: string | undefined;
4290
+ before?: string | undefined;
4291
+ limit?: number | undefined;
4292
+ };
4293
+ };
4294
+ } | {
4295
+ output: {
4296
+ error: string;
4297
+ };
4298
+ outputFormat: "json";
4299
+ status: 409;
4300
+ input: {
4301
+ query: {
4302
+ q?: string | undefined;
4303
+ before?: string | undefined;
4304
+ limit?: number | undefined;
4305
+ };
4306
+ };
4307
+ } | {
4308
+ output: {
4309
+ error: string;
4310
+ };
4311
+ outputFormat: "json";
4312
+ status: 400;
4313
+ input: {
4314
+ query: {
4315
+ q?: string | undefined;
4316
+ before?: string | undefined;
4317
+ limit?: number | undefined;
4318
+ };
4319
+ };
4320
+ } | {
4321
+ output: {
4322
+ reports: {
4323
+ id: string;
4324
+ runId: string;
4325
+ name: string;
4326
+ title: string;
4327
+ createdAt: string;
4328
+ size: number;
4329
+ taskTitle: string;
4330
+ taskStatus: "cancelled" | "done" | "failed" | "queued" | "review" | "running" | "waiting";
4331
+ }[];
4332
+ nextCursor: string | null;
4333
+ total: number;
4334
+ };
4335
+ outputFormat: "json";
4336
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4337
+ input: {
4338
+ query: {
4339
+ q?: string | undefined;
4340
+ before?: string | undefined;
4341
+ limit?: number | undefined;
4342
+ };
4343
+ };
4344
+ };
4345
+ };
4346
4346
  }, "/"> | import("hono/types").MergeSchemaPath<{
4347
4347
  "/skills": {
4348
4348
  $get: {
@@ -19693,94 +19693,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19693
19693
  };
19694
19694
  };
19695
19695
  };
19696
- }, "/"> | import("hono/types").MergeSchemaPath<{
19697
- "/reports/state": {
19698
- $get: {
19699
- output: {
19700
- error: string;
19701
- };
19702
- outputFormat: "json";
19703
- status: 409;
19704
- input: {};
19705
- } | {
19706
- output: {
19707
- epoch: string;
19708
- generation: number;
19709
- metadataGeneration: number;
19710
- };
19711
- outputFormat: "json";
19712
- status: import("hono/utils/http-status").ContentfulStatusCode;
19713
- input: {};
19714
- };
19715
- };
19716
- } & {
19717
- "/reports": {
19718
- $get: {
19719
- output: {
19720
- error: string;
19721
- code?: "invalid_input" | undefined;
19722
- };
19723
- outputFormat: "json";
19724
- status: 400;
19725
- input: {
19726
- query: {
19727
- q?: string | undefined;
19728
- before?: string | undefined;
19729
- limit?: number | undefined;
19730
- };
19731
- };
19732
- } | {
19733
- output: {
19734
- error: string;
19735
- };
19736
- outputFormat: "json";
19737
- status: 409;
19738
- input: {
19739
- query: {
19740
- q?: string | undefined;
19741
- before?: string | undefined;
19742
- limit?: number | undefined;
19743
- };
19744
- };
19745
- } | {
19746
- output: {
19747
- error: string;
19748
- };
19749
- outputFormat: "json";
19750
- status: 400;
19751
- input: {
19752
- query: {
19753
- q?: string | undefined;
19754
- before?: string | undefined;
19755
- limit?: number | undefined;
19756
- };
19757
- };
19758
- } | {
19759
- output: {
19760
- reports: {
19761
- id: string;
19762
- runId: string;
19763
- name: string;
19764
- title: string;
19765
- createdAt: string;
19766
- size: number;
19767
- taskTitle: string;
19768
- taskStatus: "cancelled" | "done" | "failed" | "queued" | "review" | "running" | "waiting";
19769
- }[];
19770
- nextCursor: string | null;
19771
- total: number;
19772
- };
19773
- outputFormat: "json";
19774
- status: import("hono/utils/http-status").ContentfulStatusCode;
19775
- input: {
19776
- query: {
19777
- q?: string | undefined;
19778
- before?: string | undefined;
19779
- limit?: number | undefined;
19780
- };
19781
- };
19782
- };
19783
- };
19784
19696
  }, "/"> | import("hono/types").MergeSchemaPath<{
19785
19697
  "/ui-state": {
19786
19698
  $get: {
@@ -20391,6 +20303,94 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20391
20303
  };
20392
20304
  };
20393
20305
  };
20306
+ }, "/"> | import("hono/types").MergeSchemaPath<{
20307
+ "/reports/state": {
20308
+ $get: {
20309
+ output: {
20310
+ error: string;
20311
+ };
20312
+ outputFormat: "json";
20313
+ status: 409;
20314
+ input: {};
20315
+ } | {
20316
+ output: {
20317
+ epoch: string;
20318
+ generation: number;
20319
+ metadataGeneration: number;
20320
+ };
20321
+ outputFormat: "json";
20322
+ status: import("hono/utils/http-status").ContentfulStatusCode;
20323
+ input: {};
20324
+ };
20325
+ };
20326
+ } & {
20327
+ "/reports": {
20328
+ $get: {
20329
+ output: {
20330
+ error: string;
20331
+ code?: "invalid_input" | undefined;
20332
+ };
20333
+ outputFormat: "json";
20334
+ status: 400;
20335
+ input: {
20336
+ query: {
20337
+ q?: string | undefined;
20338
+ before?: string | undefined;
20339
+ limit?: number | undefined;
20340
+ };
20341
+ };
20342
+ } | {
20343
+ output: {
20344
+ error: string;
20345
+ };
20346
+ outputFormat: "json";
20347
+ status: 409;
20348
+ input: {
20349
+ query: {
20350
+ q?: string | undefined;
20351
+ before?: string | undefined;
20352
+ limit?: number | undefined;
20353
+ };
20354
+ };
20355
+ } | {
20356
+ output: {
20357
+ error: string;
20358
+ };
20359
+ outputFormat: "json";
20360
+ status: 400;
20361
+ input: {
20362
+ query: {
20363
+ q?: string | undefined;
20364
+ before?: string | undefined;
20365
+ limit?: number | undefined;
20366
+ };
20367
+ };
20368
+ } | {
20369
+ output: {
20370
+ reports: {
20371
+ id: string;
20372
+ runId: string;
20373
+ name: string;
20374
+ title: string;
20375
+ createdAt: string;
20376
+ size: number;
20377
+ taskTitle: string;
20378
+ taskStatus: "cancelled" | "done" | "failed" | "queued" | "review" | "running" | "waiting";
20379
+ }[];
20380
+ nextCursor: string | null;
20381
+ total: number;
20382
+ };
20383
+ outputFormat: "json";
20384
+ status: import("hono/utils/http-status").ContentfulStatusCode;
20385
+ input: {
20386
+ query: {
20387
+ q?: string | undefined;
20388
+ before?: string | undefined;
20389
+ limit?: number | undefined;
20390
+ };
20391
+ };
20392
+ };
20393
+ };
20394
20394
  }, "/"> | import("hono/types").MergeSchemaPath<{
20395
20395
  "/skills": {
20396
20396
  $get: {
@@ -126,11 +126,10 @@ import { claimRepoGitMutation, localPullBranches, pullRepoCheckout } from './rep
126
126
  import { collectChanges, collectCommitChanges, collectRunCommits, commitAll, createOrSwitchBranch, pushCurrentBranch, readWorktreePath, } from './git-changes.js';
127
127
  import { healthConfig, loadConfig, resolveWorktreeRetention } from '../config.js';
128
128
  import { resolveWorktreeSetup } from '../worktree-setup.js';
129
- import { findConfigFile } from '../agent-config/catalog.js';
130
129
  import { readConfigFile, statConfigPath, writeConfigFile } from '../agent-config/files.js';
131
130
  import { readAgentModelDefaults } from '../agent-config/models.js';
132
131
  import { listAgentConfig } from '../agent-config/service.js';
133
- import { listConfigFiles } from '../agent-config/catalog.js';
132
+ import { findConfigFile, listConfigFiles } from '../agent-config/catalog.js';
134
133
  import { readAccountIdentity } from '../agent-config/account-identity.js';
135
134
  import { defaultWorkspaceConfig, loadWorkspaceConfig, mergeWriteWorkspaceConfig, effectiveComposerDefault, } from '../workspace/config.js';
136
135
  import { CONTROL_CHARS_RE, DEFAULT_AGENT_ACCOUNT_ID, defaultAgentAccountStore, isAbsoluteConfigDir, loadAgentAccounts, mergeWriteAgentAccounts, } from '../workspace/agent-accounts.js';
@@ -158,6 +157,7 @@ import { parseRemote, forgeKindOfRemote, forgeRepositoryUrl, resolveForge, forge
158
157
  import { refNumberFromUrl } from '../contract/index.js';
159
158
  import { GithubPrNotFoundError, GH_CHECKS_MAX, GH_REF_STATUS_MAX } from './forge/index.js';
160
159
  import { projectAdmissionRefusal, withProjectAdmission } from './cockpit-ownership.js';
160
+ import { closingSignal, prepareBeforeTicks, prepareProject, prepareProjects } from '../project-migration/auto.js';
161
161
  import { RunStoreOpenError } from '../runs/store-open-error.js';
162
162
  import { openRunApp, openRunCli, openRunDefaultApp } from './open-in-targets.js';
163
163
  import { agentCliRunner, detectOpenTargets } from './open-in-app.js';
@@ -4485,8 +4485,8 @@ export function createApp(deps) {
4485
4485
  coldRepoHandles.retainRoots(new Set(projects
4486
4486
  .filter((project) => project.status !== 'missing' && project.id !== bootId && !contexts.peek(project.id))
4487
4487
  .map((project) => project.root)));
4488
- // No folder or a migration fence: no runs to read. `not-git` still has an `.ai/cezar` worth indexing.
4489
- return projects.filter((project) => project.status !== 'missing' && !projectAdmissionRefusal(projectPaths(project.root).write)).map((project) => {
4488
+ // An unfinished migration finishes first. No folder or a fence: no runs. `not-git` still has an `.ai/cezar` worth indexing.
4489
+ return (await prepareProjects(projects, { ownership: deps.ownership, homes: [deps.home], rebrand: deps.legacyCanary })).filter((project) => project.status !== 'missing' && !projectAdmissionRefusal(projectPaths(project.root).write)).map((project) => {
4490
4490
  const owned = project.id === bootId ? bootContext : contexts.peek(project.id);
4491
4491
  // A cold project's repository identity only: asking for an owned one starts a discovery
4492
4492
  // nothing reads.
@@ -4656,7 +4656,7 @@ export function startServer(deps, port, listener) {
4656
4656
  const workspaceProjects = deps.workspaceProjects ?? createWorkspaceProjects({ bootRoot: deps.repoRoot, bootProjectId: deps.bootProjectId, bindHost: deps.bindHost, home: deps.home });
4657
4657
  // Every registry reader below sees what createApp sees: single-project mode hides other projects.
4658
4658
  const visibleProjects = () => workspaceProjects.listVisibleProjects();
4659
- const automationCoordinator = new AutomationCoordinator({ listProjects: visibleProjects });
4659
+ const automationCoordinator = new AutomationCoordinator({ listProjects: () => visibleProjects().then((projects) => prepareProjects(projects, { ownership: deps.ownership, homes: [deps.home], rebrand: deps.legacyCanary })) }); // projects arrive prepared
4660
4660
  const bootProjectId = deps.bootProjectId ?? 'default';
4661
4661
  const bootAutomationStore = automationCoordinator.store(bootProjectId, deps.repoRoot);
4662
4662
  const taskWebhooks = createTaskWebhooks(deps);
@@ -4675,7 +4675,7 @@ export function startServer(deps, port, listener) {
4675
4675
  automationStore: (projectId, root) => automationCoordinator.store(projectId, root),
4676
4676
  addressManager,
4677
4677
  });
4678
- const archiveDeps = {
4678
+ const archiveDeps = prepareBeforeTicks({ ownership: deps.ownership, homes: [deps.home], rebrand: deps.legacyCanary }, {
4679
4679
  projects: async () => {
4680
4680
  const boot = { id: bootProjectId, root: deps.repoRoot, status: 'ok' };
4681
4681
  return [boot, ...(await visibleProjects()).filter(project => project.id !== bootProjectId && project.root !== deps.repoRoot)];
@@ -4691,7 +4691,7 @@ export function startServer(deps, port, listener) {
4691
4691
  return sharedContexts.withMaintenanceStore(project.id, (store, valid) => work(store, id => sharedContexts.peek(project.id)?.manager.isActive(id) ?? false, valid));
4692
4692
  }, () => undefined),
4693
4693
  lookup: (root, identities, signal) => resolveForgeRoot(root, deps.forgeFactory).mergedPullRequests(identities, signal),
4694
- };
4694
+ });
4695
4695
  const archiveOnMerge = new ArchiveOnMergeCoordinator(archiveDeps);
4696
4696
  const completionActions = new CompletionActionCoordinator({
4697
4697
  projects: archiveDeps.projects,
@@ -4859,7 +4859,7 @@ export function startServer(deps, port, listener) {
4859
4859
  const project = data.project;
4860
4860
  if (project && typeof project.id === 'string' && typeof project.root === 'string' && project.status !== 'missing') {
4861
4861
  const { id, root } = project;
4862
- void rememberAutomationProject(id, root).then(() => {
4862
+ void prepareProject(root, { ownership: deps.ownership, homes: [deps.home], rebrand: deps.legacyCanary }).then(() => rememberAutomationProject(id, root)).then(() => {
4863
4863
  if (!automationsEnabled())
4864
4864
  return;
4865
4865
  brakeIdleAutomations(id, automationCoordinator.store(id, root));
@@ -4876,14 +4876,18 @@ export function startServer(deps, port, listener) {
4876
4876
  }
4877
4877
  }
4878
4878
  });
4879
+ const lifecycle = closingSignal(server);
4879
4880
  const startBackgroundServices = () => {
4880
4881
  if (!deps.store.unavailable)
4881
4882
  deps.store.reports.start();
4882
- archiveOnMerge.start();
4883
- completionActions.start();
4884
- void visibleProjects().then((projects) => {
4883
+ void visibleProjects().then(async (projects) => {
4885
4884
  const all = projects.some((project) => project.root === deps.repoRoot)
4886
4885
  ? projects : [{ id: deps.bootProjectId ?? 'default', root: deps.repoRoot, status: 'ok' }, ...projects];
4886
+ await prepareProjects(all, { ownership: deps.ownership, homes: [deps.home], rebrand: deps.legacyCanary, stopped: lifecycle.stopped }); // before any touch below
4887
+ if (!lifecycle.stopped()) {
4888
+ archiveOnMerge.start();
4889
+ completionActions.start();
4890
+ }
4887
4891
  // #781: every registered project's preview leftovers, not only the boot project's.
4888
4892
  void sweepRegisteredPreviewLeftovers(all, deps.previewHost).catch(() => 0);
4889
4893
  // #667: build every other project's context now, so the first click on one does not pay
@@ -4897,8 +4901,7 @@ export function startServer(deps, port, listener) {
4897
4901
  void sharedContexts.warmAll(all.filter((project) => project.id !== bootId && project.root !== deps.repoRoot))
4898
4902
  .catch(() => undefined);
4899
4903
  }
4900
- // No automation warmup while opted out, or after discovery outlives the listener.
4901
- // The final continuation also checks for close during Git inspection.
4904
+ // No automation warmup while opted out, or after discovery outlives the listener; the final continuation also checks for close during Git inspection.
4902
4905
  if (!automationsEnabled() || !server.listening)
4903
4906
  return;
4904
4907
  void Promise.all(all.map(async (project) => {
@@ -4940,6 +4943,7 @@ export function startServer(deps, port, listener) {
4940
4943
  // The one `upgrade` listener: the subscription bus and the preview's sockets (hearsay-tools/cezarion#781).
4941
4944
  attachUpgradeRouter(server, [socketHubRoute(socketHub, (req) => verifyWsUpgrade(req, deps.bindHost)), ...previewSockets.routes]);
4942
4945
  const shutdownForRestart = async () => {
4946
+ lifecycle.stop();
4943
4947
  archiveOnMerge.stop();
4944
4948
  completionActions.stop();
4945
4949
  sharedContexts.disposeAll(); // close every built secondary project before old process exits