@hearsay-tools/squawk 0.18.0-pr3684.6708 → 0.18.0-pr3685.6701

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 (48) hide show
  1. package/dist/ci-wait/controller.d.ts +37 -37
  2. package/dist/delegation/transport.d.ts +62 -62
  3. package/dist/server/activity-routes.d.ts +23 -23
  4. package/dist/server/server.d.ts +143 -152
  5. package/dist/server/server.js +35 -22
  6. package/dist/server/server.js.map +1 -1
  7. package/dist/ui-state.d.ts +6 -7
  8. package/dist/ui-state.js +6 -31
  9. package/dist/ui-state.js.map +1 -1
  10. package/dist/workspace/projects.d.ts +0 -2
  11. package/dist/workspace/projects.js +4 -3
  12. package/dist/workspace/projects.js.map +1 -1
  13. package/package.json +4 -4
  14. package/web/dist/assets/{activity-motion-DhLXb8Pt.js → activity-motion-Do_-Mdok.js} +1 -1
  15. package/web/dist/assets/{activity-route-CpwAMYLn.js → activity-route-bxjScx_a.js} +1 -1
  16. package/web/dist/assets/agent-accounts-BaHIZEqk.js +18 -0
  17. package/web/dist/assets/{commit-diff-panel-B1KZl0GP.js → commit-diff-panel-8ECLFhE_.js} +1 -1
  18. package/web/dist/assets/{diff-Ci-qd1lU.js → diff-BGy3x2Ql.js} +2 -2
  19. package/web/dist/assets/{diff-view-CWZElKoD.js → diff-view-CIxHVx_D.js} +1 -1
  20. package/web/dist/assets/{file-preview-CoWRr13R.js → file-preview-BGAJphag.js} +1 -1
  21. package/web/dist/assets/{git-toolbar-BYIni94R.js → git-toolbar-z8K71uY7.js} +1 -1
  22. package/web/dist/assets/github-B7CbHfsc.js +1 -0
  23. package/web/dist/assets/{global-activity-route-DLEwsMA7.js → global-activity-route-Dru667tt.js} +1 -1
  24. package/web/dist/assets/index-CpvjxWtG.js +17 -0
  25. package/web/dist/assets/{preview-pane-connected-CGw_9VuF.js → preview-pane-connected-K9bTKX6y.js} +1 -1
  26. package/web/dist/assets/{prompt-template-menu-BZTz2mIG.js → prompt-template-menu-Dr1mTAwf.js} +1 -1
  27. package/web/dist/assets/{reference-chip-Ht4xX9-k.js → reference-chip-BliLpdSz.js} +1 -1
  28. package/web/dist/assets/{repo-git-CzVLCWig.js → repo-git-CURxuoFu.js} +1 -1
  29. package/web/dist/assets/{report-reader-iTBkUgg-.js → report-reader-Dt-4w1Hu.js} +1 -1
  30. package/web/dist/assets/{reports-BJF1Cl3C.js → reports-BHuVysdB.js} +1 -1
  31. package/web/dist/assets/{run-header-BxB6gyt1.js → run-header-NTGqesnl.js} +1 -1
  32. package/web/dist/assets/{skills-DvgHKWgK.js → skills-D2OT0WM-.js} +1 -1
  33. package/web/dist/assets/{task-changes-CStxhLFG.js → task-changes-Dwr44jtm.js} +1 -1
  34. package/web/dist/assets/{task-commits-DhpOAdOf.js → task-commits-DVoDas-5.js} +1 -1
  35. package/web/dist/assets/{task-files-COmKUUfN.js → task-files-DGGM_Gwr.js} +1 -1
  36. package/web/dist/assets/{task-github-item-BNLeAz58.js → task-github-item-DjtclCJ6.js} +1 -1
  37. package/web/dist/assets/task-thread-BtWIjwYe.js +9 -0
  38. package/web/dist/assets/{thread-state-B5tTsVNm.js → thread-state-4VeKFceq.js} +1 -1
  39. package/web/dist/assets/use-desktop-jIeTPw3K.js +1 -0
  40. package/web/dist/assets/use-hand-to-agent-state-D_aBtCQ1.js +1 -0
  41. package/web/dist/assets/{workflows-CN8uKYnY.js → workflows-Blm0eY77.js} +1 -1
  42. package/web/dist/index.html +5 -5
  43. package/web/dist/assets/agent-accounts-Bc0LJ4SB.js +0 -18
  44. package/web/dist/assets/github-CAPNq5vY.js +0 -1
  45. package/web/dist/assets/index-CpwAOct4.js +0 -17
  46. package/web/dist/assets/task-thread-DjSFvEQe.js +0 -9
  47. package/web/dist/assets/use-desktop-BPWIJ0Kw.js +0 -1
  48. package/web/dist/assets/use-hand-to-agent-state-Ce6QW2j_.js +0 -1
@@ -2215,17 +2215,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
2215
2215
  } & {
2216
2216
  "/projects": {
2217
2217
  $post: {
2218
- output: {
2219
- error: string;
2220
- };
2221
- outputFormat: "json";
2222
- status: 400 | 500;
2223
- input: {
2224
- json: {
2225
- root: string;
2226
- };
2227
- };
2228
- } | {
2229
2218
  output: {
2230
2219
  project: {
2231
2220
  id: string;
@@ -2256,10 +2245,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
2256
2245
  agent: boolean;
2257
2246
  }[] | undefined;
2258
2247
  };
2259
- error: string;
2248
+ error?: string | undefined;
2260
2249
  };
2261
2250
  outputFormat: "json";
2262
- status: 409;
2251
+ status: 200;
2263
2252
  input: {
2264
2253
  json: {
2265
2254
  root: string;
@@ -2297,9 +2286,11 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
2297
2286
  }[] | undefined;
2298
2287
  };
2299
2288
  error?: string | undefined;
2289
+ } | {
2290
+ error: string;
2300
2291
  };
2301
2292
  outputFormat: "json";
2302
- status: 200;
2293
+ status: 400 | 409 | 500;
2303
2294
  input: {
2304
2295
  json: {
2305
2296
  root: string;
@@ -3297,46 +3288,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3297
3288
  "/ui-state": {
3298
3289
  $put: {
3299
3290
  output: {
3300
- [x: string]: import("hono/utils/types").JSONValue;
3301
- sidebarLimits?: {
3302
- overall?: number | null | undefined;
3303
- needsYou?: number | null | undefined;
3304
- finished?: number | null | undefined;
3305
- working?: number | null | undefined;
3306
- } | undefined;
3307
- lastTask?: {
3308
- source: "skill" | "workflow";
3309
- ref: string;
3310
- } | null | undefined;
3311
- recentSources?: {
3312
- source: "skill" | "workflow";
3313
- ref: string;
3314
- }[] | undefined;
3315
- lastWorktree?: boolean | undefined;
3316
- lastAutonomous?: boolean | undefined;
3317
- disabledTeamSkills?: {
3318
- repo: string;
3319
- name: string;
3320
- }[] | undefined;
3321
- skillUsage?: {
3322
- [x: string]: number;
3323
- } | undefined;
3324
- runsView?: "list" | "table" | undefined;
3325
- githubView?: "issues" | "prs" | undefined;
3326
- appearance?: {
3327
- accent?: "cezarion" | "lime" | "violet" | undefined;
3328
- density?: "comfortable" | "compact" | "ultra" | undefined;
3329
- width?: "narrow" | "wide" | undefined;
3330
- } | undefined;
3331
- promptTemplates?: {
3332
- id: string;
3333
- label: string;
3334
- text: string;
3335
- skills?: string[] | undefined;
3336
- }[] | undefined;
3291
+ error: string;
3337
3292
  };
3338
3293
  outputFormat: "json";
3339
- status: import("hono/utils/http-status").ContentfulStatusCode;
3294
+ status: 500;
3340
3295
  input: {
3341
3296
  json: {
3342
3297
  [x: string]: unknown;
@@ -3378,10 +3333,46 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3378
3333
  };
3379
3334
  } | {
3380
3335
  output: {
3381
- error: string;
3336
+ [x: string]: import("hono/utils/types").JSONValue;
3337
+ sidebarLimits?: {
3338
+ overall?: number | null | undefined;
3339
+ needsYou?: number | null | undefined;
3340
+ finished?: number | null | undefined;
3341
+ working?: number | null | undefined;
3342
+ } | undefined;
3343
+ lastTask?: {
3344
+ source: "skill" | "workflow";
3345
+ ref: string;
3346
+ } | null | undefined;
3347
+ recentSources?: {
3348
+ source: "skill" | "workflow";
3349
+ ref: string;
3350
+ }[] | undefined;
3351
+ lastWorktree?: boolean | undefined;
3352
+ lastAutonomous?: boolean | undefined;
3353
+ disabledTeamSkills?: {
3354
+ repo: string;
3355
+ name: string;
3356
+ }[] | undefined;
3357
+ skillUsage?: {
3358
+ [x: string]: number;
3359
+ } | undefined;
3360
+ runsView?: "list" | "table" | undefined;
3361
+ githubView?: "issues" | "prs" | undefined;
3362
+ appearance?: {
3363
+ accent?: "cezarion" | "lime" | "violet" | undefined;
3364
+ density?: "comfortable" | "compact" | "ultra" | undefined;
3365
+ width?: "narrow" | "wide" | undefined;
3366
+ } | undefined;
3367
+ promptTemplates?: {
3368
+ id: string;
3369
+ label: string;
3370
+ text: string;
3371
+ skills?: string[] | undefined;
3372
+ }[] | undefined;
3382
3373
  };
3383
3374
  outputFormat: "json";
3384
- status: 500;
3375
+ status: import("hono/utils/http-status").ContentfulStatusCode;
3385
3376
  input: {
3386
3377
  json: {
3387
3378
  [x: string]: unknown;
@@ -4794,6 +4785,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4794
4785
  } & {
4795
4786
  "/repo/commit/:sha": {
4796
4787
  $get: {
4788
+ output: string;
4789
+ outputFormat: "text";
4790
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4791
+ input: {
4792
+ query: {
4793
+ structured?: string | undefined;
4794
+ };
4795
+ } & {
4796
+ param: {
4797
+ sha: string;
4798
+ };
4799
+ };
4800
+ } | {
4797
4801
  output: {
4798
4802
  error: string;
4799
4803
  code?: "invalid_input" | undefined;
@@ -4857,19 +4861,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4857
4861
  sha: string;
4858
4862
  };
4859
4863
  };
4860
- } | {
4861
- output: string;
4862
- outputFormat: "text";
4863
- status: import("hono/utils/http-status").ContentfulStatusCode;
4864
- input: {
4865
- query: {
4866
- structured?: string | undefined;
4867
- };
4868
- } & {
4869
- param: {
4870
- sha: string;
4871
- };
4872
- };
4873
4864
  };
4874
4865
  };
4875
4866
  } & {
@@ -18206,20 +18197,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18206
18197
  } & {
18207
18198
  "/runs/:id/handoff": {
18208
18199
  $get: {
18209
- output: {
18210
- error: string;
18211
- };
18212
- outputFormat: "json";
18213
- status: 404;
18200
+ output: string;
18201
+ outputFormat: "text";
18202
+ status: 200;
18214
18203
  input: {
18215
18204
  param: {
18216
18205
  id: string;
18217
18206
  };
18218
18207
  };
18219
18208
  } | {
18220
- output: string;
18221
- outputFormat: "text";
18222
- status: 200;
18209
+ output: {
18210
+ error: string;
18211
+ };
18212
+ outputFormat: "json";
18213
+ status: 404;
18223
18214
  input: {
18224
18215
  param: {
18225
18216
  id: string;
@@ -18257,20 +18248,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18257
18248
  } & {
18258
18249
  "/runs/:id/diff": {
18259
18250
  $get: {
18260
- output: {
18261
- error: string;
18262
- };
18263
- outputFormat: "json";
18264
- status: 404 | 409;
18251
+ output: string;
18252
+ outputFormat: "text";
18253
+ status: import("hono/utils/http-status").ContentfulStatusCode;
18265
18254
  input: {
18266
18255
  param: {
18267
18256
  id: string;
18268
18257
  };
18269
18258
  };
18270
18259
  } | {
18271
- output: string;
18272
- outputFormat: "text";
18273
- status: import("hono/utils/http-status").ContentfulStatusCode;
18260
+ output: {
18261
+ error: string;
18262
+ };
18263
+ outputFormat: "json";
18264
+ status: 404 | 409;
18274
18265
  input: {
18275
18266
  param: {
18276
18267
  id: string;
@@ -19066,46 +19057,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19066
19057
  "/ui-state": {
19067
19058
  $put: {
19068
19059
  output: {
19069
- [x: string]: import("hono/utils/types").JSONValue;
19070
- sidebarLimits?: {
19071
- overall?: number | null | undefined;
19072
- needsYou?: number | null | undefined;
19073
- finished?: number | null | undefined;
19074
- working?: number | null | undefined;
19075
- } | undefined;
19076
- lastTask?: {
19077
- source: "skill" | "workflow";
19078
- ref: string;
19079
- } | null | undefined;
19080
- recentSources?: {
19081
- source: "skill" | "workflow";
19082
- ref: string;
19083
- }[] | undefined;
19084
- lastWorktree?: boolean | undefined;
19085
- lastAutonomous?: boolean | undefined;
19086
- disabledTeamSkills?: {
19087
- repo: string;
19088
- name: string;
19089
- }[] | undefined;
19090
- skillUsage?: {
19091
- [x: string]: number;
19092
- } | undefined;
19093
- runsView?: "list" | "table" | undefined;
19094
- githubView?: "issues" | "prs" | undefined;
19095
- appearance?: {
19096
- accent?: "cezarion" | "lime" | "violet" | undefined;
19097
- density?: "comfortable" | "compact" | "ultra" | undefined;
19098
- width?: "narrow" | "wide" | undefined;
19099
- } | undefined;
19100
- promptTemplates?: {
19101
- id: string;
19102
- label: string;
19103
- text: string;
19104
- skills?: string[] | undefined;
19105
- }[] | undefined;
19060
+ error: string;
19106
19061
  };
19107
19062
  outputFormat: "json";
19108
- status: import("hono/utils/http-status").ContentfulStatusCode;
19063
+ status: 500;
19109
19064
  input: {
19110
19065
  json: {
19111
19066
  [x: string]: unknown;
@@ -19147,10 +19102,46 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19147
19102
  };
19148
19103
  } | {
19149
19104
  output: {
19150
- error: string;
19105
+ [x: string]: import("hono/utils/types").JSONValue;
19106
+ sidebarLimits?: {
19107
+ overall?: number | null | undefined;
19108
+ needsYou?: number | null | undefined;
19109
+ finished?: number | null | undefined;
19110
+ working?: number | null | undefined;
19111
+ } | undefined;
19112
+ lastTask?: {
19113
+ source: "skill" | "workflow";
19114
+ ref: string;
19115
+ } | null | undefined;
19116
+ recentSources?: {
19117
+ source: "skill" | "workflow";
19118
+ ref: string;
19119
+ }[] | undefined;
19120
+ lastWorktree?: boolean | undefined;
19121
+ lastAutonomous?: boolean | undefined;
19122
+ disabledTeamSkills?: {
19123
+ repo: string;
19124
+ name: string;
19125
+ }[] | undefined;
19126
+ skillUsage?: {
19127
+ [x: string]: number;
19128
+ } | undefined;
19129
+ runsView?: "list" | "table" | undefined;
19130
+ githubView?: "issues" | "prs" | undefined;
19131
+ appearance?: {
19132
+ accent?: "cezarion" | "lime" | "violet" | undefined;
19133
+ density?: "comfortable" | "compact" | "ultra" | undefined;
19134
+ width?: "narrow" | "wide" | undefined;
19135
+ } | undefined;
19136
+ promptTemplates?: {
19137
+ id: string;
19138
+ label: string;
19139
+ text: string;
19140
+ skills?: string[] | undefined;
19141
+ }[] | undefined;
19151
19142
  };
19152
19143
  outputFormat: "json";
19153
- status: 500;
19144
+ status: import("hono/utils/http-status").ContentfulStatusCode;
19154
19145
  input: {
19155
19146
  json: {
19156
19147
  [x: string]: unknown;
@@ -20563,6 +20554,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20563
20554
  } & {
20564
20555
  "/repo/commit/:sha": {
20565
20556
  $get: {
20557
+ output: string;
20558
+ outputFormat: "text";
20559
+ status: import("hono/utils/http-status").ContentfulStatusCode;
20560
+ input: {
20561
+ query: {
20562
+ structured?: string | undefined;
20563
+ };
20564
+ } & {
20565
+ param: {
20566
+ sha: string;
20567
+ };
20568
+ };
20569
+ } | {
20566
20570
  output: {
20567
20571
  error: string;
20568
20572
  code?: "invalid_input" | undefined;
@@ -20626,19 +20630,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20626
20630
  sha: string;
20627
20631
  };
20628
20632
  };
20629
- } | {
20630
- output: string;
20631
- outputFormat: "text";
20632
- status: import("hono/utils/http-status").ContentfulStatusCode;
20633
- input: {
20634
- query: {
20635
- structured?: string | undefined;
20636
- };
20637
- } & {
20638
- param: {
20639
- sha: string;
20640
- };
20641
- };
20642
20633
  };
20643
20634
  };
20644
20635
  } & {
@@ -33975,20 +33966,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
33975
33966
  } & {
33976
33967
  "/runs/:id/handoff": {
33977
33968
  $get: {
33978
- output: {
33979
- error: string;
33980
- };
33981
- outputFormat: "json";
33982
- status: 404;
33969
+ output: string;
33970
+ outputFormat: "text";
33971
+ status: 200;
33983
33972
  input: {
33984
33973
  param: {
33985
33974
  id: string;
33986
33975
  };
33987
33976
  };
33988
33977
  } | {
33989
- output: string;
33990
- outputFormat: "text";
33991
- status: 200;
33978
+ output: {
33979
+ error: string;
33980
+ };
33981
+ outputFormat: "json";
33982
+ status: 404;
33992
33983
  input: {
33993
33984
  param: {
33994
33985
  id: string;
@@ -34026,20 +34017,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
34026
34017
  } & {
34027
34018
  "/runs/:id/diff": {
34028
34019
  $get: {
34029
- output: {
34030
- error: string;
34031
- };
34032
- outputFormat: "json";
34033
- status: 404 | 409;
34020
+ output: string;
34021
+ outputFormat: "text";
34022
+ status: import("hono/utils/http-status").ContentfulStatusCode;
34034
34023
  input: {
34035
34024
  param: {
34036
34025
  id: string;
34037
34026
  };
34038
34027
  };
34039
34028
  } | {
34040
- output: string;
34041
- outputFormat: "text";
34042
- status: import("hono/utils/http-status").ContentfulStatusCode;
34029
+ output: {
34030
+ error: string;
34031
+ };
34032
+ outputFormat: "json";
34033
+ status: 404 | 409;
34043
34034
  input: {
34044
34035
  param: {
34045
34036
  id: string;
@@ -134,7 +134,7 @@ import { mergeWriteWorkspaceUiState, readWorkspaceUiState } from '../workspace/u
134
134
  import { checkoutRepo } from './checkout.js';
135
135
  import { createProject, listGithubOwners } from './create-project.js';
136
136
  import { createWorkspaceRunFeed } from './workspace-run-feed.js';
137
- import { mergeWriteProjectUiState, readUiState } from '../ui-state.js';
137
+ import { readProjectUiState, readUiState, writeProjectUiState } from '../ui-state.js';
138
138
  import { agentHomePaths, expandTilde } from '../paths.js';
139
139
  import { isLoopbackHostHeader, normalizeHostname, resolveCapabilities } from './capabilities.js';
140
140
  import { browseDirectory, isInsideBrowseRoot, isLexicallyInsideBrowseRoot, resolveBrowseRoot } from './fs-browse.js';
@@ -1578,12 +1578,6 @@ export function createApp(deps) {
1578
1578
  const registered = await registerFolder(parsed.data.root, 'local');
1579
1579
  if (registered.status !== 200)
1580
1580
  return c.json(registered.body, registered.status);
1581
- if (registered.existing) {
1582
- // 409 with the EXISTING entry (spec): the dialog treats it as "you already have this one"
1583
- // and navigates there rather than dead-ending.
1584
- const { project } = registered.body;
1585
- return c.json({ project, error: `already registered as ${project.id}` }, 409);
1586
- }
1587
1581
  return c.json(registered.body, 200);
1588
1582
  })
1589
1583
  .delete('/projects/:projectId', async (c) => {
@@ -1832,15 +1826,15 @@ export function createApp(deps) {
1832
1826
  // `{ error, reason }` degradation, mirroring the GitHub pane.
1833
1827
  return c.json('reason' in result ? { error: result.error, reason: result.reason } : { error: result.error }, result.status);
1834
1828
  }
1835
- // An existing entry for the same root (its folder had been deleted) is a success too: the
1836
- // project the user asked for is there (hearsay-tools/squawk#1086).
1837
1829
  const registered = await registerFolder(result.target, 'checkout');
1838
1830
  if (registered.status !== 200) {
1839
1831
  // The clone SUCCEEDED and its files are legitimately the user's, so this
1840
1832
  // path deliberately does NOT clean up — an unregisterable checkout is a
1841
1833
  // registry problem, not a reason to delete a repo we just fetched. Say
1842
1834
  // where it is so they can register it by hand.
1843
- return c.json({ error: `${registered.body.error} (the clone is at ${result.target})` }, registered.status);
1835
+ const { body } = registered;
1836
+ const error = 'error' in body && body.error ? body.error : 'could not register the checkout';
1837
+ return c.json({ error: `${error} (the clone is at ${result.target})` }, registered.status);
1844
1838
  }
1845
1839
  return c.json(registered.body, 200);
1846
1840
  })
@@ -1888,16 +1882,25 @@ export function createApp(deps) {
1888
1882
  }
1889
1883
  // GitHub-backed projects register as `checkout` (they have an origin the
1890
1884
  // clone flow would also produce); a local-only repo is `local`.
1891
- // A new entry, or the existing one for the same root — what creating a registered project
1892
- // whose folder had been deleted produces. Both are a success.
1893
1885
  const registered = await registerFolder(result.target, result.slug ? 'checkout' : 'local');
1894
- if (registered.status !== 200) {
1886
+ // A new entry (200), or the existing one for the same root (409 "already registered") — what
1887
+ // creating a registered project whose folder had been deleted produces. The user asked for
1888
+ // that project and it is there, so both are a success. (An if/else chain, not a helper:
1889
+ // only narrowing `registered` keeps the error bodies out of the route's 200 type.)
1890
+ let project;
1891
+ if (registered.status === 200)
1892
+ project = registered.body.project;
1893
+ else if (registered.status === 409 && 'project' in registered.body)
1894
+ project = registered.body.project;
1895
+ else {
1895
1896
  // As with a clone: the repository is the user's now, so it stays — and a GitHub warning
1896
1897
  // rides along, since its finishing commands are the only record of what is left to do.
1898
+ const { body } = registered;
1899
+ const error = 'error' in body && body.error ? body.error : 'could not register the new project';
1897
1900
  const warning = result.warning ? `\n${result.warning}` : '';
1898
- return c.json({ error: `${registered.body.error} (the project is at ${result.target})${warning}` }, registered.status);
1901
+ return c.json({ error: `${error} (the project is at ${result.target})${warning}` }, registered.status);
1899
1902
  }
1900
- const body = { project: registered.body.project, ...(result.warning ? { warning: result.warning } : {}) };
1903
+ const body = { project, ...(result.warning ? { warning: result.warning } : {}) };
1901
1904
  return c.json(body, 200);
1902
1905
  });
1903
1906
  /** Hosted containment for a path that may not exist yet: lexical for the
@@ -1924,8 +1927,7 @@ export function createApp(deps) {
1924
1927
  * The register-a-folder half of `POST /api/projects`, factored out so the
1925
1928
  * checkout route (step 4.3) commits its fresh clone through the SAME guards
1926
1929
  * and the same `project-added` emission rather than a second copy of them.
1927
- * A root the registry already holds is a success with `existing: true`; each
1928
- * route decides how to answer it.
1930
+ * Returns the status + body for the caller to answer with.
1929
1931
  */
1930
1932
  const registerFolder = async (spelled, source) => {
1931
1933
  // `~` is expanded for the same reason `/api/fs/browse` expands it: the
@@ -2018,11 +2020,18 @@ export function createApp(deps) {
2018
2020
  body: { error: err instanceof Error ? err.message : String(err) },
2019
2021
  };
2020
2022
  }
2023
+ if (known) {
2024
+ // 409 with the EXISTING entry (spec): the dialog treats it as "you
2025
+ // already have this one" and navigates there rather than dead-ending.
2026
+ return {
2027
+ status: 409,
2028
+ body: { project, error: `already registered as ${project.id}` },
2029
+ };
2030
+ }
2021
2031
  // Only a genuinely new project is an event — a re-add is a no-op for every
2022
2032
  // open cockpit's sidebar.
2023
- if (!known)
2024
- workspaceEvents.emit('project-added', { project });
2025
- return { status: 200, body: { project }, existing: known };
2033
+ workspaceEvents.emit('project-added', { project });
2034
+ return { status: 200, body: { project } };
2026
2035
  };
2027
2036
  // Deregister a project (multi-project spec, step 4.4 — Settings → Projects,
2028
2037
  // the per-row "Remove"). READ THIS BEFORE TOUCHING THE HANDLER: the ONLY
@@ -2235,16 +2244,20 @@ export function createApp(deps) {
2235
2244
  // On `use`, not inline on the route — see the workspace ui-state PUT above.
2236
2245
  .use('/ui-state', bodyLimit({ maxSize: UI_STATE_BODY_LIMIT }))
2237
2246
  .put('/ui-state', jsonZodValidator(uiStateBody), async (c) => {
2247
+ const { root: repoRoot, dataDir } = c.get('project');
2238
2248
  // `.passthrough()` keeps unknown prefs, but a
2239
2249
  // single request may not stuff an unbounded key set (#429) — the shared
2240
2250
  // schema+cap half of both ui-state routes lives in `uiStateBody`.
2241
- const patch = c.req.valid('json');
2251
+ const parsed = { data: c.req.valid('json') };
2252
+ const merged = { ...(await readProjectUiState(repoRoot)), ...parsed.data };
2242
2253
  try {
2243
- return c.json(await mergeWriteProjectUiState(c.get('project').root, (current) => ({ ...current, ...patch })));
2254
+ await mkdir(dataDir, { recursive: true });
2255
+ await writeProjectUiState(repoRoot, merged);
2244
2256
  }
2245
2257
  catch (err) {
2246
2258
  return c.json({ error: err instanceof Error ? err.message : String(err) }, 500);
2247
2259
  }
2260
+ return c.json(merged);
2248
2261
  });
2249
2262
  // ---- chained family: workflows (project-scoped) --------------------------
2250
2263
  // One chained expression, mounted by `createApp` into BOTH the legacy `api`