@hearsay-tools/squawk 0.18.0-pr4358.8559 → 0.18.0-pr4358.8568

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 (76) hide show
  1. package/dist/contract/index.js +23 -2
  2. package/dist/contract/session-context.d.ts +54 -8
  3. package/dist/data-gitignore.js +1 -0
  4. package/dist/data-gitignore.js.map +1 -1
  5. package/dist/delegation/routes.d.ts +65 -65
  6. package/dist/server/projects-routes.d.ts +45 -45
  7. package/dist/server/repo-routes.d.ts +13 -13
  8. package/dist/server/runners-routes.d.ts +10 -10
  9. package/dist/server/runs-routes.d.ts +16 -16
  10. package/dist/server/server.d.ts +122 -82
  11. package/dist/server/session-context-routes.d.ts +35 -15
  12. package/dist/server/session-context-routes.js +6 -6
  13. package/dist/server/session-context-routes.js.map +1 -1
  14. package/dist/session-context-file.d.ts +3 -3
  15. package/dist/session-context-file.js +45 -16
  16. package/dist/session-context-file.js.map +1 -1
  17. package/dist/session-context.d.ts +18 -9
  18. package/dist/session-context.js +118 -47
  19. package/dist/session-context.js.map +1 -1
  20. package/package.json +4 -4
  21. package/web/dist/assets/{accounts-section-AHiwnrqA.js → accounts-section-VLKEYGPj.js} +1 -1
  22. package/web/dist/assets/{activity-motion-DuUXo_fX.js → activity-motion-IiyiWtXq.js} +1 -1
  23. package/web/dist/assets/{activity-route-BFl6F4Lu.js → activity-route-QCPCR9kZ.js} +1 -1
  24. package/web/dist/assets/{agent-config-section-B9ij5XUt.js → agent-config-section-BK0gs0uc.js} +1 -1
  25. package/web/dist/assets/{agent-defaults-section-BL5axoK7.js → agent-defaults-section-BoluhHkE.js} +1 -1
  26. package/web/dist/assets/{appearance-BdF0mo9V.js → appearance-CEFPwlnq.js} +1 -1
  27. package/web/dist/assets/{archive-on-merge-field-BKFGWhTW.js → archive-on-merge-field-BEt4jVZt.js} +1 -1
  28. package/web/dist/assets/{automations-route-Xusdh9RP.js → automations-route-F58YdVbC.js} +1 -1
  29. package/web/dist/assets/{commit-list-DNXq8Wgs.js → commit-list-BZ6wfGPz.js} +1 -1
  30. package/web/dist/assets/{diff-C1wKJ5AH.js → diff-BbD04q_C.js} +2 -2
  31. package/web/dist/assets/{diff-controls-Du09ZD1K.js → diff-controls-CW1hOWET.js} +1 -1
  32. package/web/dist/assets/{diff-view-D5esnwHT.js → diff-view-C3XewBZ4.js} +1 -1
  33. package/web/dist/assets/{file-preview-DmgDJn82.js → file-preview-B3r8zavn.js} +1 -1
  34. package/web/dist/assets/{folder-browser-Dg4CmonF.js → folder-browser-6LK4AIPp.js} +1 -1
  35. package/web/dist/assets/{git-toolbar-D2uMxLAD.js → git-toolbar-CCZtGd6H.js} +1 -1
  36. package/web/dist/assets/{github-2g3W6ycO.js → github-CzZZ-wwm.js} +1 -1
  37. package/web/dist/assets/{global-activity-route-9lfwsKE2.js → global-activity-route-BNyhS-a8.js} +1 -1
  38. package/web/dist/assets/{image-preview-DK8CeCRn.js → image-preview-CMk53HOX.js} +1 -1
  39. package/web/dist/assets/{index-D06X-OoO.js → index-DaJ5iats.js} +5 -5
  40. package/web/dist/assets/{label-D1xUdJjL.js → label-YDZzSz0S.js} +1 -1
  41. package/web/dist/assets/{markdown-D-hVmnwQ.js → markdown-q0pVKAO0.js} +1 -1
  42. package/web/dist/assets/{notifications-section-fNt0kDTB.js → notifications-section-n3Xb47pL.js} +1 -1
  43. package/web/dist/assets/{preview-pane-connected-ClJma202.js → preview-pane-connected-VmfC04wB.js} +1 -1
  44. package/web/dist/assets/{project-location-CDQm9Gul.js → project-location-GPzDWXuH.js} +1 -1
  45. package/web/dist/assets/{projects-section-LfAk73FY.js → projects-section-BotQxpQ6.js} +1 -1
  46. package/web/dist/assets/{prompt-templates-section-BGPpireM.js → prompt-templates-section-B8pr6Ue3.js} +1 -1
  47. package/web/dist/assets/queries-DDhFFTvR.js +1 -0
  48. package/web/dist/assets/{reference-chip-Clhghu8I.js → reference-chip-90x9Bq44.js} +1 -1
  49. package/web/dist/assets/{remote-settings-notice-EZ382VXA.js → remote-settings-notice-F_onp6Yr.js} +1 -1
  50. package/web/dist/assets/{repo-git-3BV6yXp9.js → repo-git-B5Bse6ld.js} +1 -1
  51. package/web/dist/assets/{report-reader-BtMDZSxx.js → report-reader-B_kyYgIY.js} +1 -1
  52. package/web/dist/assets/{reports-CJIw7o8_.js → reports-D0E8DWXQ.js} +1 -1
  53. package/web/dist/assets/{resources-section-D2xgeg1K.js → resources-section-DcfHTNpN.js} +1 -1
  54. package/web/dist/assets/{run-header-B65PhE5J.js → run-header-OhEYfuQX.js} +1 -1
  55. package/web/dist/assets/{select-BQ0b8D0M.js → select-r1KS5cjs.js} +1 -1
  56. package/web/dist/assets/session-context-section-PCOCiOTV.js +119 -0
  57. package/web/dist/assets/{settings-agent-picker-rRKtgEym.js → settings-agent-picker-D0UKjmOj.js} +1 -1
  58. package/web/dist/assets/{settings-shell-CbXRegSQ.js → settings-shell-BiPh5fg6.js} +1 -1
  59. package/web/dist/assets/{sidebar-section-y3wevbWE.js → sidebar-section-DmOlTUs8.js} +1 -1
  60. package/web/dist/assets/{skills-D9rmPjwB.js → skills-CSLg7E0x.js} +1 -1
  61. package/web/dist/assets/{task-changes-1M-8Nih4.js → task-changes-DuOb61QV.js} +1 -1
  62. package/web/dist/assets/{task-commits-DbJNq4EA.js → task-commits-CiGYJpqo.js} +1 -1
  63. package/web/dist/assets/{task-files-Bq5k3QiX.js → task-files-fJSQ4Abg.js} +1 -1
  64. package/web/dist/assets/{task-github-item-B4EEYok0.js → task-github-item-CRxN82Yw.js} +1 -1
  65. package/web/dist/assets/{task-groups-fk4Gq4hX.js → task-groups-B3Z2qfE6.js} +1 -1
  66. package/web/dist/assets/task-thread-CqjKwRuV.js +9 -0
  67. package/web/dist/assets/{tasks-table-JFvtNCc1.js → tasks-table-Cm6YZBUB.js} +1 -1
  68. package/web/dist/assets/{thread-state-CgZtq0-9.js → thread-state-DcHyKcQ-.js} +1 -1
  69. package/web/dist/assets/{use-hand-to-agent-state-BCjj7r3n.js → use-hand-to-agent-state-DuefXU2m.js} +1 -1
  70. package/web/dist/assets/{workflows-CuNxWGhE.js → workflows-CC3TZmBS.js} +1 -1
  71. package/web/dist/assets/{workspace-tools-BmyQFlI8.js → workspace-tools-kscvD6KC.js} +1 -1
  72. package/web/dist/assets/{worktrees-section-CByb6iJZ.js → worktrees-section-CoKimDBt.js} +1 -1
  73. package/web/dist/index.html +7 -7
  74. package/web/dist/assets/queries-BvWsZhaH.js +0 -1
  75. package/web/dist/assets/session-context-section-BTWK-HXW.js +0 -119
  76. package/web/dist/assets/task-thread-B-yxE86v.js +0 -9
@@ -12273,20 +12273,20 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
12273
12273
  } & {
12274
12274
  "/runs/:id/handoff": {
12275
12275
  $get: {
12276
- output: {
12277
- error: string;
12278
- };
12279
- outputFormat: "json";
12280
- status: 404;
12276
+ output: string;
12277
+ outputFormat: "text";
12278
+ status: 200;
12281
12279
  input: {
12282
12280
  param: {
12283
12281
  id: string;
12284
12282
  };
12285
12283
  };
12286
12284
  } | {
12287
- output: string;
12288
- outputFormat: "text";
12289
- status: 200;
12285
+ output: {
12286
+ error: string;
12287
+ };
12288
+ outputFormat: "json";
12289
+ status: 404;
12290
12290
  input: {
12291
12291
  param: {
12292
12292
  id: string;
@@ -12324,20 +12324,20 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
12324
12324
  } & {
12325
12325
  "/runs/:id/diff": {
12326
12326
  $get: {
12327
- output: {
12328
- error: string;
12329
- };
12330
- outputFormat: "json";
12331
- status: 404 | 409;
12327
+ output: string;
12328
+ outputFormat: "text";
12329
+ status: import("hono/utils/http-status").ContentfulStatusCode;
12332
12330
  input: {
12333
12331
  param: {
12334
12332
  id: string;
12335
12333
  };
12336
12334
  };
12337
12335
  } | {
12338
- output: string;
12339
- outputFormat: "text";
12340
- status: import("hono/utils/http-status").ContentfulStatusCode;
12336
+ output: {
12337
+ error: string;
12338
+ };
12339
+ outputFormat: "json";
12340
+ status: 404 | 409;
12341
12341
  input: {
12342
12342
  param: {
12343
12343
  id: string;
@@ -4188,12 +4188,21 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4188
4188
  "/session-context": {
4189
4189
  $get: {
4190
4190
  output: {
4191
- path: string;
4192
- exists: boolean;
4193
- content: string;
4194
- version: string | null;
4195
- writable: boolean;
4196
- readOnlyReason: string | null;
4191
+ local: {
4192
+ path: string;
4193
+ exists: boolean;
4194
+ content: string;
4195
+ version: string | null;
4196
+ writable: boolean;
4197
+ readOnlyReason: string | null;
4198
+ };
4199
+ shared: {
4200
+ path: string;
4201
+ exists: boolean;
4202
+ content: string;
4203
+ tracked: boolean;
4204
+ unreadableReason: string | null;
4205
+ };
4197
4206
  };
4198
4207
  outputFormat: "json";
4199
4208
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -4211,8 +4220,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4211
4220
  }[];
4212
4221
  blocks: {
4213
4222
  id: string;
4223
+ source: 'built-in' | import("../session-context.ts").SessionContextRuleSource;
4214
4224
  target: import("../session-context.ts").SessionContextRule['target'] | 'built-in' | null;
4215
4225
  status: import("../session-context.ts").SessionContextReportStatus | 'not-for-role';
4226
+ overridesShared: boolean;
4216
4227
  bytes: number | null;
4217
4228
  reason: string | null;
4218
4229
  sources: string[];
@@ -4236,12 +4247,21 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4236
4247
  "/session-context": {
4237
4248
  $put: {
4238
4249
  output: {
4239
- path: string;
4240
- exists: boolean;
4241
- content: string;
4242
- version: string | null;
4243
- writable: boolean;
4244
- readOnlyReason: string | null;
4250
+ local: {
4251
+ path: string;
4252
+ exists: boolean;
4253
+ content: string;
4254
+ version: string | null;
4255
+ writable: boolean;
4256
+ readOnlyReason: string | null;
4257
+ };
4258
+ shared: {
4259
+ path: string;
4260
+ exists: boolean;
4261
+ content: string;
4262
+ tracked: boolean;
4263
+ unreadableReason: string | null;
4264
+ };
4245
4265
  };
4246
4266
  outputFormat: "json";
4247
4267
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -4697,6 +4717,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4697
4717
  } & {
4698
4718
  "/repo/commit/:sha": {
4699
4719
  $get: {
4720
+ output: string;
4721
+ outputFormat: "text";
4722
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4723
+ input: {
4724
+ query: {
4725
+ structured?: string | undefined;
4726
+ };
4727
+ } & {
4728
+ param: {
4729
+ sha: string;
4730
+ };
4731
+ };
4732
+ } | {
4700
4733
  output: {
4701
4734
  error: string;
4702
4735
  code?: "invalid_input" | undefined;
@@ -4760,19 +4793,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4760
4793
  sha: string;
4761
4794
  };
4762
4795
  };
4763
- } | {
4764
- output: string;
4765
- outputFormat: "text";
4766
- status: import("hono/utils/http-status").ContentfulStatusCode;
4767
- input: {
4768
- query: {
4769
- structured?: string | undefined;
4770
- };
4771
- } & {
4772
- param: {
4773
- sha: string;
4774
- };
4775
- };
4776
4796
  };
4777
4797
  };
4778
4798
  } & {
@@ -19240,20 +19260,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19240
19260
  } & {
19241
19261
  "/runs/:id/handoff": {
19242
19262
  $get: {
19243
- output: {
19244
- error: string;
19245
- };
19246
- outputFormat: "json";
19247
- status: 404;
19263
+ output: string;
19264
+ outputFormat: "text";
19265
+ status: 200;
19248
19266
  input: {
19249
19267
  param: {
19250
19268
  id: string;
19251
19269
  };
19252
19270
  };
19253
19271
  } | {
19254
- output: string;
19255
- outputFormat: "text";
19256
- status: 200;
19272
+ output: {
19273
+ error: string;
19274
+ };
19275
+ outputFormat: "json";
19276
+ status: 404;
19257
19277
  input: {
19258
19278
  param: {
19259
19279
  id: string;
@@ -19291,20 +19311,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19291
19311
  } & {
19292
19312
  "/runs/:id/diff": {
19293
19313
  $get: {
19294
- output: {
19295
- error: string;
19296
- };
19297
- outputFormat: "json";
19298
- status: 404 | 409;
19314
+ output: string;
19315
+ outputFormat: "text";
19316
+ status: import("hono/utils/http-status").ContentfulStatusCode;
19299
19317
  input: {
19300
19318
  param: {
19301
19319
  id: string;
19302
19320
  };
19303
19321
  };
19304
19322
  } | {
19305
- output: string;
19306
- outputFormat: "text";
19307
- status: import("hono/utils/http-status").ContentfulStatusCode;
19323
+ output: {
19324
+ error: string;
19325
+ };
19326
+ outputFormat: "json";
19327
+ status: 404 | 409;
19308
19328
  input: {
19309
19329
  param: {
19310
19330
  id: string;
@@ -20910,12 +20930,21 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20910
20930
  "/session-context": {
20911
20931
  $get: {
20912
20932
  output: {
20913
- path: string;
20914
- exists: boolean;
20915
- content: string;
20916
- version: string | null;
20917
- writable: boolean;
20918
- readOnlyReason: string | null;
20933
+ local: {
20934
+ path: string;
20935
+ exists: boolean;
20936
+ content: string;
20937
+ version: string | null;
20938
+ writable: boolean;
20939
+ readOnlyReason: string | null;
20940
+ };
20941
+ shared: {
20942
+ path: string;
20943
+ exists: boolean;
20944
+ content: string;
20945
+ tracked: boolean;
20946
+ unreadableReason: string | null;
20947
+ };
20919
20948
  };
20920
20949
  outputFormat: "json";
20921
20950
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -20933,8 +20962,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20933
20962
  }[];
20934
20963
  blocks: {
20935
20964
  id: string;
20965
+ source: 'built-in' | import("../session-context.ts").SessionContextRuleSource;
20936
20966
  target: import("../session-context.ts").SessionContextRule['target'] | 'built-in' | null;
20937
20967
  status: import("../session-context.ts").SessionContextReportStatus | 'not-for-role';
20968
+ overridesShared: boolean;
20938
20969
  bytes: number | null;
20939
20970
  reason: string | null;
20940
20971
  sources: string[];
@@ -20958,12 +20989,21 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20958
20989
  "/session-context": {
20959
20990
  $put: {
20960
20991
  output: {
20961
- path: string;
20962
- exists: boolean;
20963
- content: string;
20964
- version: string | null;
20965
- writable: boolean;
20966
- readOnlyReason: string | null;
20992
+ local: {
20993
+ path: string;
20994
+ exists: boolean;
20995
+ content: string;
20996
+ version: string | null;
20997
+ writable: boolean;
20998
+ readOnlyReason: string | null;
20999
+ };
21000
+ shared: {
21001
+ path: string;
21002
+ exists: boolean;
21003
+ content: string;
21004
+ tracked: boolean;
21005
+ unreadableReason: string | null;
21006
+ };
20967
21007
  };
20968
21008
  outputFormat: "json";
20969
21009
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -21419,6 +21459,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21419
21459
  } & {
21420
21460
  "/repo/commit/:sha": {
21421
21461
  $get: {
21462
+ output: string;
21463
+ outputFormat: "text";
21464
+ status: import("hono/utils/http-status").ContentfulStatusCode;
21465
+ input: {
21466
+ query: {
21467
+ structured?: string | undefined;
21468
+ };
21469
+ } & {
21470
+ param: {
21471
+ sha: string;
21472
+ };
21473
+ };
21474
+ } | {
21422
21475
  output: {
21423
21476
  error: string;
21424
21477
  code?: "invalid_input" | undefined;
@@ -21482,19 +21535,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21482
21535
  sha: string;
21483
21536
  };
21484
21537
  };
21485
- } | {
21486
- output: string;
21487
- outputFormat: "text";
21488
- status: import("hono/utils/http-status").ContentfulStatusCode;
21489
- input: {
21490
- query: {
21491
- structured?: string | undefined;
21492
- };
21493
- } & {
21494
- param: {
21495
- sha: string;
21496
- };
21497
- };
21498
21538
  };
21499
21539
  };
21500
21540
  } & {
@@ -35962,20 +36002,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
35962
36002
  } & {
35963
36003
  "/runs/:id/handoff": {
35964
36004
  $get: {
35965
- output: {
35966
- error: string;
35967
- };
35968
- outputFormat: "json";
35969
- status: 404;
36005
+ output: string;
36006
+ outputFormat: "text";
36007
+ status: 200;
35970
36008
  input: {
35971
36009
  param: {
35972
36010
  id: string;
35973
36011
  };
35974
36012
  };
35975
36013
  } | {
35976
- output: string;
35977
- outputFormat: "text";
35978
- status: 200;
36014
+ output: {
36015
+ error: string;
36016
+ };
36017
+ outputFormat: "json";
36018
+ status: 404;
35979
36019
  input: {
35980
36020
  param: {
35981
36021
  id: string;
@@ -36013,20 +36053,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
36013
36053
  } & {
36014
36054
  "/runs/:id/diff": {
36015
36055
  $get: {
36016
- output: {
36017
- error: string;
36018
- };
36019
- outputFormat: "json";
36020
- status: 404 | 409;
36056
+ output: string;
36057
+ outputFormat: "text";
36058
+ status: import("hono/utils/http-status").ContentfulStatusCode;
36021
36059
  input: {
36022
36060
  param: {
36023
36061
  id: string;
36024
36062
  };
36025
36063
  };
36026
36064
  } | {
36027
- output: string;
36028
- outputFormat: "text";
36029
- status: import("hono/utils/http-status").ContentfulStatusCode;
36065
+ output: {
36066
+ error: string;
36067
+ };
36068
+ outputFormat: "json";
36069
+ status: 404 | 409;
36030
36070
  input: {
36031
36071
  param: {
36032
36072
  id: string;
@@ -1,19 +1,28 @@
1
1
  import type { ProjectApiEnv } from './server-types.ts';
2
2
  /**
3
- * Settings → Session context (hearsay-tools/squawk#4308). Writing `context.yaml` needs no
4
- * `settingsAdmin`: the file runs no host command, and its file includes stay inside the worktree
5
- * (ADR 0055 gates only settings that persist host commands).
3
+ * Settings → Session context (hearsay-tools/squawk#4308, hearsay-tools/squawk#4341). Writing `context.local.yaml`
4
+ * needs no `settingsAdmin`: the file runs no host command, is gitignored, and its file includes
5
+ * stay inside the worktree (ADR 0055 gates only settings that persist host commands).
6
6
  */
7
7
  export declare function createSessionContextRoutes(): import("hono/hono-base").HonoBase<ProjectApiEnv, {
8
8
  "/session-context": {
9
9
  $get: {
10
10
  output: {
11
- path: string;
12
- exists: boolean;
13
- content: string;
14
- version: string | null;
15
- writable: boolean;
16
- readOnlyReason: string | null;
11
+ local: {
12
+ path: string;
13
+ exists: boolean;
14
+ content: string;
15
+ version: string | null;
16
+ writable: boolean;
17
+ readOnlyReason: string | null;
18
+ };
19
+ shared: {
20
+ path: string;
21
+ exists: boolean;
22
+ content: string;
23
+ tracked: boolean;
24
+ unreadableReason: string | null;
25
+ };
17
26
  };
18
27
  outputFormat: "json";
19
28
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -31,8 +40,10 @@ export declare function createSessionContextRoutes(): import("hono/hono-base").H
31
40
  }[];
32
41
  blocks: {
33
42
  id: string;
43
+ source: 'built-in' | import("../session-context.ts").SessionContextRuleSource;
34
44
  target: import("../session-context.ts").SessionContextRule['target'] | 'built-in' | null;
35
45
  status: import("../session-context.ts").SessionContextReportStatus | 'not-for-role';
46
+ overridesShared: boolean;
36
47
  bytes: number | null;
37
48
  reason: string | null;
38
49
  sources: string[];
@@ -56,12 +67,21 @@ export declare function createSessionContextRoutes(): import("hono/hono-base").H
56
67
  "/session-context": {
57
68
  $put: {
58
69
  output: {
59
- path: string;
60
- exists: boolean;
61
- content: string;
62
- version: string | null;
63
- writable: boolean;
64
- readOnlyReason: string | null;
70
+ local: {
71
+ path: string;
72
+ exists: boolean;
73
+ content: string;
74
+ version: string | null;
75
+ writable: boolean;
76
+ readOnlyReason: string | null;
77
+ };
78
+ shared: {
79
+ path: string;
80
+ exists: boolean;
81
+ content: string;
82
+ tracked: boolean;
83
+ unreadableReason: string | null;
84
+ };
65
85
  };
66
86
  outputFormat: "json";
67
87
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -1,16 +1,16 @@
1
1
  import { Hono } from 'hono';
2
2
  import { sessionContextPreviewRequestSchema, setSessionContextSchema } from '../contract/index.js';
3
3
  import { previewSessionContext } from '../session-context.js';
4
- import { readSessionContextFile, writeSessionContextFile } from '../session-context-file.js';
4
+ import { readSessionContextState, writeSessionContextFile } from '../session-context-file.js';
5
5
  import { jsonZodValidator } from './validators.js';
6
6
  /**
7
- * Settings → Session context (hearsay-tools/squawk#4308). Writing `context.yaml` needs no
8
- * `settingsAdmin`: the file runs no host command, and its file includes stay inside the worktree
9
- * (ADR 0055 gates only settings that persist host commands).
7
+ * Settings → Session context (hearsay-tools/squawk#4308, hearsay-tools/squawk#4341). Writing `context.local.yaml`
8
+ * needs no `settingsAdmin`: the file runs no host command, is gitignored, and its file includes
9
+ * stay inside the worktree (ADR 0055 gates only settings that persist host commands).
10
10
  */
11
11
  export function createSessionContextRoutes() {
12
12
  return new Hono()
13
- .get('/session-context', async (c) => c.json(await readSessionContextFile(c.get('project').root)))
13
+ .get('/session-context', async (c) => c.json(await readSessionContextState(c.get('project').root)))
14
14
  .post('/session-context/preview', jsonZodValidator(sessionContextPreviewRequestSchema), (c) => {
15
15
  const body = c.req.valid('json');
16
16
  return c.json(previewSessionContext({ projectRoot: c.get('project').root, content: body.content, role: body.role }));
@@ -20,7 +20,7 @@ export function createSessionContextRoutes() {
20
20
  const out = await writeSessionContextFile(c.get('project').root, body.content, body.version);
21
21
  if (!out.ok)
22
22
  return c.json({ error: out.error }, out.status);
23
- return c.json(out.file);
23
+ return c.json(out.state);
24
24
  });
25
25
  }
26
26
  //# sourceMappingURL=session-context-routes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-context-routes.js","sourceRoot":"","sources":["../../src/server/session-context-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,kCAAkC,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC3H,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;GAIG;AAC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CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7F,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAC7D,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,8 +1,8 @@
1
- import { type SessionContextFile } from './contract/index.js';
2
- export declare function readSessionContextFile(projectRoot: string): Promise<SessionContextFile>;
1
+ import { type SessionContextState } from './contract/index.js';
2
+ export declare function readSessionContextState(projectRoot: string): Promise<SessionContextState>;
3
3
  export type SessionContextWrite = {
4
4
  ok: true;
5
- file: SessionContextFile;
5
+ state: SessionContextState;
6
6
  } | {
7
7
  ok: false;
8
8
  status: 400 | 409 | 500;
@@ -1,16 +1,20 @@
1
1
  import { createHash, randomUUID } from 'node:crypto';
2
2
  import { lstat, mkdir, readFile, realpath, rename, rm, stat, writeFile } from 'node:fs/promises';
3
3
  import { dirname, join, relative } from 'node:path';
4
- import { SESSION_CONTEXT_FILE_MAX_BYTES } from './contract/index.js';
4
+ import { SESSION_CONTEXT_FILE_MAX_BYTES, } from './contract/index.js';
5
+ import { ensureDataGitignore } from './data-gitignore.js';
6
+ import { runGit } from './git-command.js';
5
7
  import { fallbackProjectWriteError, readProjectPath } from './project-paths.js';
6
8
  import { parseSessionContextText } from './session-context.js';
7
9
  /**
8
- * The cockpit's read and write of the project's `context.yaml` (hearsay-tools/squawk#4308). It reads
9
- * the same path a launch reads, and writes it back in place: atomically, only over the version the
10
- * editor read, and only text with no problems. Fallback project data stays read only, and so does a
11
- * file reached through a symbolic link: a remote user could otherwise point the editor at another
12
- * file, such as `config.json`, and write settings that need settings administration.
10
+ * The cockpit's read of both `context.yaml` (shared, read-only) and `context.local.yaml` (local,
11
+ * editable), and atomic write of `context.local.yaml` (hearsay-tools/squawk#4308, hearsay-tools/squawk#4341). Writing
12
+ * ensures `context.local.yaml` is gitignored so host edits never dirty `git status`. Fallback
13
+ * project data and symlinks stay read only so a remote user cannot redirect writes onto another
14
+ * file such as `config.json`.
13
15
  */
16
+ const SHARED_FILE = 'context.yaml';
17
+ const LOCAL_FILE = 'context.local.yaml';
14
18
  function hashBytes(content) {
15
19
  return createHash('sha256').update(content, 'utf8').digest('hex');
16
20
  }
@@ -73,6 +77,15 @@ async function readCurrent(projectRoot, path) {
73
77
  return { exists: true, unreadable: `it cannot be read (${error.code ?? 'error'})` };
74
78
  }
75
79
  }
80
+ async function isGitTracked(projectRoot, relPath) {
81
+ try {
82
+ const { stdout } = await runGit(['ls-files', '--cached', '--', relPath.replace(/\\/g, '/')], { cwd: projectRoot, timeout: 10_000 });
83
+ return stdout.trim().length > 0;
84
+ }
85
+ catch {
86
+ return false;
87
+ }
88
+ }
76
89
  function answer(projectRoot, path, current) {
77
90
  const shown = relative(projectRoot, path);
78
91
  const fallback = fallbackProjectWriteError(path);
@@ -90,14 +103,29 @@ function answer(projectRoot, path, current) {
90
103
  writable: fallback === undefined, readOnlyReason: fallback ?? null,
91
104
  };
92
105
  }
93
- export async function readSessionContextFile(projectRoot) {
94
- const path = readProjectPath(projectRoot, 'context.yaml');
95
- return answer(projectRoot, path, await readCurrent(projectRoot, path));
106
+ async function readSharedFile(projectRoot) {
107
+ const path = readProjectPath(projectRoot, SHARED_FILE);
108
+ const shown = relative(projectRoot, path);
109
+ const current = await readCurrent(projectRoot, path);
110
+ if (!current.exists) {
111
+ const unreadableReason = current.unwritable ? `Squawk cannot read ${shown}: ${current.unwritable}.` : null;
112
+ return { path: shown, exists: false, content: '', tracked: false, unreadableReason };
113
+ }
114
+ const tracked = await isGitTracked(projectRoot, shown);
115
+ if ('unreadable' in current) {
116
+ return { path: shown, exists: true, content: '', tracked, unreadableReason: `Squawk cannot read ${shown}: ${current.unreadable}.` };
117
+ }
118
+ return { path: shown, exists: true, content: current.content, tracked, unreadableReason: null };
119
+ }
120
+ export async function readSessionContextState(projectRoot) {
121
+ const localPath = readProjectPath(projectRoot, LOCAL_FILE);
122
+ const [localCurrent, shared] = await Promise.all([readCurrent(projectRoot, localPath), readSharedFile(projectRoot)]);
123
+ return { local: answer(projectRoot, localPath, localCurrent), shared };
96
124
  }
97
125
  /** One save at a time per file, so two saves over one version cannot both pass the check. */
98
126
  const writing = new Map();
99
127
  export function writeSessionContextFile(projectRoot, content, version) {
100
- const path = readProjectPath(projectRoot, 'context.yaml');
128
+ const path = readProjectPath(projectRoot, LOCAL_FILE);
101
129
  const previous = writing.get(path) ?? Promise.resolve();
102
130
  const next = previous.then(() => writeChecked(projectRoot, path, content, version));
103
131
  const settled = next.catch(() => undefined);
@@ -112,15 +140,16 @@ async function writeChecked(projectRoot, path, content, version) {
112
140
  return { ok: false, status: 409, error: before.readOnlyReason ?? `${before.path} is read only` };
113
141
  if (before.version !== version) {
114
142
  const error = before.exists
115
- ? 'context.yaml changed on disk since you opened it. Show the disk version, or overwrite it.'
116
- : 'context.yaml was deleted on disk since you opened it. Show the disk version, or overwrite it.';
143
+ ? 'context.local.yaml changed on disk since you opened it. Show the disk version, or overwrite it.'
144
+ : 'context.local.yaml was deleted on disk since you opened it. Show the disk version, or overwrite it.';
117
145
  return { ok: false, status: 409, error };
118
146
  }
119
- const first = parseSessionContextText(content).problems[0];
147
+ const first = parseSessionContextText(content, 'local', before.path).problems[0];
120
148
  if (first) {
121
149
  const where = first.line === null ? '' : `line ${first.line}: `;
122
- return { ok: false, status: 400, error: `context.yaml has problems; fix them to save (${where}${first.message})` };
150
+ return { ok: false, status: 400, error: `context.local.yaml has problems; fix them to save (${where}${first.message})` };
123
151
  }
152
+ ensureDataGitignore(projectRoot);
124
153
  // The rename replaces the path itself, never a file a link points to: the check above refuses links.
125
154
  const tmp = `${path}.hsq-tmp-${process.pid}-${randomUUID()}`;
126
155
  try {
@@ -131,7 +160,7 @@ async function writeChecked(projectRoot, path, content, version) {
131
160
  const staged = answer(projectRoot, path, await readCurrent(projectRoot, path));
132
161
  if (staged.version !== version || !staged.writable) {
133
162
  await rm(tmp, { force: true });
134
- return { ok: false, status: 409, error: 'context.yaml changed on disk since you opened it. Show the disk version, or overwrite it.' };
163
+ return { ok: false, status: 409, error: 'context.local.yaml changed on disk since you opened it. Show the disk version, or overwrite it.' };
135
164
  }
136
165
  await rename(tmp, path);
137
166
  }
@@ -139,6 +168,6 @@ async function writeChecked(projectRoot, path, content, version) {
139
168
  await rm(tmp, { force: true });
140
169
  return { ok: false, status: 500, error: error.message };
141
170
  }
142
- return { ok: true, file: answer(projectRoot, path, await readCurrent(projectRoot, path)) };
171
+ return { ok: true, state: await readSessionContextState(projectRoot) };
143
172
  }
144
173
  //# sourceMappingURL=session-context-file.js.map