@dev.fast/whiteboard 0.3.4-preview.20261019.127 → 0.3.4

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 (115) hide show
  1. package/dist/{account-alias-B5-HYi1D.js → account-alias-CprZojXd.js} +8 -13
  2. package/dist/agent-cli-C6SPSII0.js +2 -0
  3. package/dist/{agent-cli-CohHf6Ua.js → agent-cli-CThN7Q59.js} +10 -15
  4. package/dist/{agent-client-Dtc-Kn_w.js → agent-client-BOOi7EUR.js} +3 -13
  5. package/dist/{authoring-tools-B7KU04f7.js → authoring-tools-BNwuMnz6.js} +27 -34
  6. package/dist/{background-server-C03RKxKS.js → background-server-CkvxA-6O.js} +5 -5
  7. package/dist/{background-server-CB9C4uoc.js → background-server-DLSDogkI.js} +1 -1
  8. package/dist/build-info.json +1 -1
  9. package/dist/{cli-CJaEb7zC.js → cli-R4yfa5DT.js} +1 -1
  10. package/dist/{cli-runner-DGDIqh3V.js → cli-runner-Cuc9FSzu.js} +26 -26
  11. package/dist/cli.js +3 -4
  12. package/dist/{client-lKVF_Elo.js → client-BN_FDxFr.js} +47 -253
  13. package/dist/{fuzzy-match-BmVJJm9I.js → fuzzy-match-BO9bK37N.js} +4 -6
  14. package/dist/{headless-host-DRtjf9WA.js → headless-host-CVBOQyRS.js} +1 -1
  15. package/dist/{headless-host-XhL1X4vX.js → headless-host-Cog6SpS9.js} +140 -513
  16. package/dist/{local-data-Cpl4ENbJ.js → local-data-D_9tvdsp.js} +323 -2419
  17. package/dist/{mcp-ovmiUE_x.js → mcp-D1hziANa.js} +9 -5
  18. package/dist/{package-paths-BWxO-UEL.js → package-paths-C--__jEv.js} +1 -1
  19. package/dist/profile-CYPmvBoA.js +2 -0
  20. package/dist/{profile-BadSkCkI.js → profile-DokFw782.js} +8 -20
  21. package/dist/{remote-attach-Dd-YobM6.js → remote-attach-CEJ-kvDY.js} +4 -4
  22. package/dist/{remote-extensions-CNXwqK0D.js → remote-extensions-Blcjr9Ze.js} +3 -3
  23. package/dist/{remote-extensions-VP-kfq0C.js → remote-extensions-GN8Gf_qG.js} +1 -1
  24. package/dist/{remote-language-server-BXk87KCr.js → remote-language-server-BTKBQ7x4.js} +5 -5
  25. package/dist/{remote-uninstall-DuOzsvaD.js → remote-uninstall-DW7Gdryh.js} +6 -6
  26. package/dist/{request-origin-B9qCPiVB.js → request-origin-Zcn_CjX4.js} +12 -45
  27. package/dist/{review-app-launcher-C7el2Uoy.js → review-app-launcher-CkwLclzR.js} +2 -2
  28. package/dist/{review-home-paths-D8AoCdd2.js → review-home-paths-j2BRAaNv.js} +17 -19
  29. package/dist/{review-telemetry-BsoRMC2w.js → review-telemetry-BLNwYnLV.js} +5 -5
  30. package/dist/runtime-CKiWhGrf.js +52 -0
  31. package/dist/runtime.d.ts +1 -1
  32. package/dist/runtime.js +1 -1
  33. package/dist/{s3-CsG2EWED.js → s3-DtJFWC0G.js} +1 -1
  34. package/dist/{s3-config-CjcLyFV5.js → s3-config-BTO12tCC.js} +2 -4
  35. package/dist/{s3-config-zz4GWh2T.js → s3-config-CSy3fx8H.js} +1 -1
  36. package/dist/server/desktop-host.js +76 -29
  37. package/dist/{server-discovery-CKjw3-6h.js → server-discovery-Bey8IqXH.js} +3 -3
  38. package/dist/sharing/index.d.ts +70 -484
  39. package/dist/sharing/index.js +1 -1
  40. package/dist/{src-WPaQn75m.js → src-BMPuxWv4.js} +73 -208
  41. package/dist/{src-BiWNbcF_.js → src-DsM3jO8G.js} +12 -89
  42. package/dist/{stored-document-migration-dFbewRTG.js → stored-document-migration-CChxtFAy.js} +269 -270
  43. package/dist/{thread-state-Do5LX10I.js → thread-state-5pYr6_zM.js} +2 -7
  44. package/dist/{tool-failure-DvI-gys2.js → tool-failure-C9MpbXJJ.js} +3 -10
  45. package/instructions/authoring.md +2 -3
  46. package/instructions/scratchpad.md +23 -0
  47. package/package.json +4 -4
  48. package/src/ask/agents.ts +1 -13
  49. package/src/ask/checkout-files.ts +5 -2
  50. package/src/ask/thread-state.ts +0 -4
  51. package/src/ask/thread.ts +0 -16
  52. package/src/ask/threads.ts +3 -24
  53. package/src/cli-install.ts +2 -13
  54. package/src/cli-runner.ts +1 -4
  55. package/src/cli.ts +1 -4
  56. package/src/diff-selection-migration.ts +34 -48
  57. package/src/lens-selection.ts +2 -38
  58. package/src/review-api/README.md +13 -52
  59. package/src/review-api/activity.ts +4 -1
  60. package/src/review-api/agent-cli.ts +1 -9
  61. package/src/review-api/anchor-quotes.ts +7 -14
  62. package/src/review-api/ask-history.ts +51 -137
  63. package/src/review-api/authoring-tools.ts +30 -45
  64. package/src/review-api/blocks/definition.ts +1 -1
  65. package/src/review-api/blocks/markdown.ts +2 -2
  66. package/src/review-api/document-headings.ts +27 -58
  67. package/src/review-api/document-text.ts +2 -31
  68. package/src/review-api/document.ts +34 -281
  69. package/src/review-api/github-provider.ts +13 -51
  70. package/src/review-api/http.ts +123 -702
  71. package/src/review-api/instructions.ts +19 -0
  72. package/src/review-api/local-data.ts +46 -310
  73. package/src/review-api/mcp.ts +11 -3
  74. package/src/review-api/onboarding.ts +1 -1
  75. package/src/review-api/profile.ts +6 -37
  76. package/src/review-api/public-tools.ts +2 -24
  77. package/src/review-api/pull-request.ts +49 -82
  78. package/src/review-api/request-origin.ts +0 -10
  79. package/src/review-api/review-progress.ts +27 -61
  80. package/src/review-api/store-schema.ts +29 -38
  81. package/src/review-api/store.ts +478 -2142
  82. package/src/review-api/worktree-events.ts +5 -3
  83. package/src/review-api/worktree-source.ts +7 -3
  84. package/src/review-api/worktree-structural.integration.ts +0 -72
  85. package/src/review-preferences.ts +88 -0
  86. package/src/review-stack.ts +23 -15
  87. package/src/runtime.ts +30 -4
  88. package/src/server/desktop-host.ts +1 -6
  89. package/src/server/desktop-server.ts +31 -1
  90. package/src/server/headless-host.ts +2 -0
  91. package/src/server/hono-http.ts +1 -2
  92. package/src/server/legacy-tutorial-cleanup.ts +3 -2
  93. package/src/server/review-gateway-list.ts +5 -3
  94. package/src/server/review-gateway-memory.ts +1 -1
  95. package/src/server/review-lifecycle-telemetry.ts +2 -2
  96. package/src/server/review-server-core.ts +5 -1
  97. package/src/server/structural-comparisons.ts +0 -47
  98. package/src/sharing/export.ts +7 -36
  99. package/src/sharing/host.ts +14 -34
  100. package/src/sharing/import.ts +24 -156
  101. package/src/sharing/repository.ts +20 -128
  102. package/src/startup-trace.ts +3 -3
  103. package/src/stored-document-migration.ts +19 -110
  104. package/src/ui-telemetry-events.ts +11 -33
  105. package/dist/agent-cli-_YyMIMRY.js +0 -2
  106. package/dist/lens-selection-CyJapcsl.js +0 -214
  107. package/dist/profile-DJvkBJNQ.js +0 -2
  108. package/dist/runtime-Bj2tD33R.js +0 -27
  109. package/src/heading-anchors.ts +0 -42
  110. package/src/review-api/board-order.ts +0 -144
  111. package/src/review-api/checkout-groups.ts +0 -560
  112. package/src/review-api/foreign-references.ts +0 -328
  113. package/src/review-api/link-preview.ts +0 -113
  114. package/src/review-api/scratchpad-plan-upgrade.ts +0 -250
  115. package/src/review-api/store-migrations.ts +0 -357
@@ -46,44 +46,6 @@ declare const shareManifestSchema: z.ZodObject<{
46
46
  }, z.core.$strict>;
47
47
  type ShareManifest = z.infer<typeof shareManifestSchema>;
48
48
  //#endregion
49
- //#region ../local-vcs/src/exec.d.ts
50
- /** A value from outside the code, given to git, jj or gh as an operand. */
51
- type Operand =
52
- /** A full commit id. */
53
- {
54
- commit: string;
55
- } |
56
- /** A revision expression: a commit, ref, `HEAD~1`, `a..b`. */
57
- {
58
- rev: string;
59
- } |
60
- /** A ref or branch name. */
61
- {
62
- ref: string;
63
- } |
64
- /** `[+]<from>:<to>`, each a commit id or ref. */
65
- {
66
- refspec: {
67
- from: string;
68
- to: string;
69
- force?: boolean;
70
- };
71
- } |
72
- /** A path in a checkout; always after `--`. */
73
- {
74
- path: string;
75
- } |
76
- /** A remote's name or URL. */
77
- {
78
- remote: string;
79
- } |
80
- /** Any other value: a message, a search, a PR number. */
81
- {
82
- value: string;
83
- };
84
- /** An argument: a flag or subcommand written in the code, or an operand. */
85
- type VcsArg = string | Operand;
86
- //#endregion
87
49
  //#region ../local-vcs/src/vcs.d.ts
88
50
  interface LocalVcsDiffFileSummary {
89
51
  path: string;
@@ -243,16 +205,19 @@ type StructuralLineCounts = {
243
205
  removed: number;
244
206
  };
245
207
  //#endregion
246
- //#region ../review-protocol/src/board-icons.d.ts
247
- /** "code" for a board with code attached, "board" for one without. */
248
- type BoardIconKind = "board" | "code";
249
- //#endregion
250
208
  //#region ../review-protocol/src/review-api-client.d.ts
251
209
  /** List metadata for the authenticated local catalog; document contents stay in snapshots. */
252
210
  interface ReviewApiSummary {
253
211
  reviewId: string;
254
212
  version: number;
255
213
  title: string;
214
+ /** Absent for a review. The one scratchpad has no pins or lifecycle. */
215
+ kind?: "scratchpad";
216
+ /** What is on the scratchpad, for its Home card; absent for a review. */
217
+ contents?: {
218
+ blocks: number;
219
+ diagrams: number;
220
+ };
256
221
  /** Absent for a document whose references all carry their own pins. */
257
222
  pins?: {
258
223
  repositoryId: string;
@@ -261,9 +226,6 @@ interface ReviewApiSummary {
261
226
  worktreeRevision?: string;
262
227
  };
263
228
  target?: {
264
- kind: "project";
265
- repositoryId: string;
266
- } | {
267
229
  kind: "worktree";
268
230
  repositoryId: string;
269
231
  base?: string;
@@ -286,17 +248,14 @@ interface ReviewApiSummary {
286
248
  pullRequestTitle?: string;
287
249
  revision?: string;
288
250
  };
289
- /** The PR's state on GitHub, when the host has read it. */
290
- pullRequestState?: PullRequestState;
291
251
  /** Shared imports have separate local checkouts but retain their remote identity. */
292
252
  shared?: {
293
253
  cloneUrl?: string;
294
254
  };
295
- /** The project the board belongs to; absent for a share with no
296
- * repository here. */
297
- project?: {
298
- id: string;
299
- name: string;
255
+ /** Display grouping only; source pins remain bound to their own checkout. */
256
+ repositoryGroup?: {
257
+ key: string;
258
+ label: string;
300
259
  };
301
260
  repositoryName: string;
302
261
  repositoryPath?: string;
@@ -307,8 +266,6 @@ interface ReviewApiSummary {
307
266
  } | null;
308
267
  viewedAt: string | null;
309
268
  trashedAt: string | null;
310
- /** A version was saved after viewedAt, or the board was never viewed. */
311
- changed?: boolean;
312
269
  /** An agent holds a live lease; absent on shared reviews. */
313
270
  working?: boolean;
314
271
  host?: string;
@@ -319,12 +276,6 @@ interface ReviewApiSummary {
319
276
  reason?: string;
320
277
  pending?: true;
321
278
  };
322
- /** The board this one is nested under; absent at top level. */
323
- parentId?: string;
324
- /** The boards nested under this one, in sibling order. */
325
- children?: string[];
326
- /** The boards in its project this one builds on. */
327
- dependsOn?: string[];
328
279
  }
329
280
  interface ReviewSourceEntry {
330
281
  path: string;
@@ -332,8 +283,6 @@ interface ReviewSourceEntry {
332
283
  }
333
284
  //#endregion
334
285
  //#region ../review-protocol/src/contracts.d.ts
335
- declare const PULL_REQUEST_STATES: readonly ["open", "draft", "merged", "closed"];
336
- type PullRequestState = (typeof PULL_REQUEST_STATES)[number];
337
286
  /** Workspace attachment identity is independent of the displayed source generation. */
338
287
  interface ReviewLanguageEnvironment {
339
288
  /** Absent for a caller on another machine. */
@@ -407,8 +356,8 @@ type SourcePins = z.infer<typeof sourcePinsSchema>;
407
356
  * Authored document attachments use DiffSelection instead. */
408
357
  declare const fileLineRangeSchema: z.ZodObject<{
409
358
  side: z.ZodDefault<z.ZodEnum<{
410
- base: "base";
411
359
  head: "head";
360
+ base: "base";
412
361
  }>>;
413
362
  file: z.ZodString;
414
363
  fromLine: z.ZodNumber;
@@ -760,9 +709,6 @@ type Pins = z.infer<typeof pinsSchema> & {
760
709
  worktreeRevision?: string;
761
710
  };
762
711
  declare const reviewTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
763
- kind: z.ZodLiteral<"project">;
764
- repositoryId: z.ZodString;
765
- }, z.core.$strict>, z.ZodObject<{
766
712
  kind: z.ZodLiteral<"worktree">;
767
713
  repositoryId: z.ZodString;
768
714
  base: z.ZodOptional<z.ZodString>;
@@ -777,15 +723,6 @@ type ReviewTarget = z.infer<typeof reviewTargetSchema>;
777
723
  type Element = Block | Step | FlowDiagramNode | FlowDiagramEdge;
778
724
  /** A diagram unit: addressed on its own, but only ever inside its diagram. */
779
725
  type Unit = Step | FlowDiagramNode | FlowDiagramEdge;
780
- /** Names a block from outside its board. Block ids are unique only within a board. */
781
- type BlockRef = {
782
- board: string;
783
- block: string;
784
- };
785
- type BoardRef = BlockRef | {
786
- board: string;
787
- block?: undefined;
788
- };
789
726
  declare const editSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
790
727
  parentId: z.ZodOptional<z.ZodString>;
791
728
  afterId: z.ZodOptional<z.ZodString>;
@@ -1094,8 +1031,6 @@ interface EditSummary {
1094
1031
  units?: string[];
1095
1032
  /** The agent whose courier draws this edit, when the host could tell. */
1096
1033
  activityId?: string;
1097
- /** The Ask thread that made this edit, if any. */
1098
- threadId?: string;
1099
1034
  }
1100
1035
  /** A component an edit wrote, named so the author can address it. */
1101
1036
  interface WrittenComponent {
@@ -1113,10 +1048,8 @@ interface ComparisonCoverage {
1113
1048
  }
1114
1049
  //#endregion
1115
1050
  //#region src/review-api/pull-request.d.ts
1116
- /** Runs one subprocess and resolves its stdout; rejects on failure or
1117
- * timeout. git, jj and gh go through the VCS runner; Azure DevOps's az (by
1118
- * way of cmd.exe on Windows) gets its operands checked the same way. */
1119
- type RunCommand = (file: "git" | "jj" | "gh" | "az" | "cmd.exe", args: VcsArg[], options: {
1051
+ /** Runs one subprocess and resolves its stdout; rejects on failure or timeout. */
1052
+ type RunCommand = (file: string, args: string[], options: {
1120
1053
  cwd?: string;
1121
1054
  timeoutMs: number;
1122
1055
  }) => Promise<string>;
@@ -1282,29 +1215,37 @@ declare const askPermissionsSchema: z.ZodEnum<{
1282
1215
  }>;
1283
1216
  type AskPermissions = z.infer<typeof askPermissionsSchema>;
1284
1217
  type AskEntry = z.infer<typeof askEntrySchema>;
1218
+ /** A saved conversation, as the history list shows it. The transcript stays
1219
+ * with the agent; Whiteboard keeps what it needs to find and reopen it. */
1220
+ declare const askHistoryEntrySchema: z.ZodObject<{
1221
+ id: z.ZodString;
1222
+ agent: z.ZodEnum<{
1223
+ claude: "claude";
1224
+ codex: "codex";
1225
+ cursor: "cursor";
1226
+ opencode: "opencode";
1227
+ pi: "pi";
1228
+ }>;
1229
+ title: z.ZodString;
1230
+ question: z.ZodOptional<z.ZodString>;
1231
+ selection: any;
1232
+ head: z.ZodString;
1233
+ createdAt: z.ZodString;
1234
+ updatedAt: z.ZodString;
1235
+ }, z.core.$strip>;
1236
+ type AskHistoryEntry = z.infer<typeof askHistoryEntrySchema>;
1285
1237
  //#endregion
1286
1238
  //#region src/review-api/ask-history.d.ts
1287
1239
  /** A saved Ask conversation: its history entry, and how to reopen it. */
1288
1240
  declare const askRecordSchema: any;
1289
1241
  type AskRecord = z.infer<typeof askRecordSchema>;
1290
- /** Saved Ask conversations by project, each anchored on the board it started
1291
- * on. No foreign key on the anchor: shared reviews are not in `reviews`.
1292
- * So deleting a board removes its threads by hand (removeReview). */
1242
+ /** Saved Ask conversations, per review. Shared reviews are not in
1243
+ * `reviews`, so there is no foreign key; deleting a review deletes its rows. */
1293
1244
  declare class AskHistory {
1294
1245
  private readonly db;
1295
- /** The store's rule for writing about a board: one in Trash is
1296
- * read-only. */
1297
- private readonly writable;
1298
- private readonly listeners;
1299
1246
  private externalWriteGuard?;
1300
1247
  setExternalWriteGuard(guard: (reviewId: string) => void): void;
1301
- constructor(db: DatabaseSync,
1302
- /** The store's rule for writing about a board: one in Trash is
1303
- * read-only. */
1304
- writable?: (reviewId: string) => void);
1305
- /** Calls back when a conversation is saved, renamed, used or deleted. */
1306
- subscribe(listener: () => void): () => void;
1307
- private changed;
1248
+ constructor(db: DatabaseSync);
1308
1249
  private assertWritable;
1309
1250
  private assertThreadWritable;
1310
1251
  save(record: AskRecord): void;
@@ -1324,62 +1265,14 @@ declare class AskHistory {
1324
1265
  /** What the agent offered last, or last with the model given. */
1325
1266
  offer(agent: AskAgentId, model?: string): AskOffer | undefined;
1326
1267
  touch(id: string, at?: string): void;
1327
- /** Conversations in a board's project, or started on the board when it
1328
- * has none. Newest first. */
1329
- list(board: string, projectId?: string): any[];
1330
- /** Every project's conversations, newest first. */
1331
- listAll(): any[];
1332
- private entries;
1268
+ /** Newest first. */
1269
+ list(reviewId: string): AskHistoryEntry[];
1333
1270
  get(id: string): AskRecord | undefined;
1334
- /** The reviewer saw the thread, on screen with the app focused. Only
1335
- * when it was seen changes: not its order, nor when it was used. */
1336
- markViewed(id: string, at?: string): void;
1337
- /** When each of these threads was last viewed, where it ever was.
1338
- * Threads from before views were kept have none, and none is unread. */
1339
- viewedAt(ids: readonly string[]): Map<string, string>;
1340
- /** Forgets the threads that started on a board gone for good. */
1341
1271
  removeReview(reviewId: string): void;
1342
1272
  delete(id: string): void;
1343
1273
  }
1344
1274
  //#endregion
1345
- //#region src/review-api/link-preview.d.ts
1346
- /** What a board link's hover card shows of the board or block it links to. */
1347
- interface BoardLinkPreview {
1348
- /** A block link: the title of the section the block is in. */
1349
- section?: string;
1350
- /** Markdown paragraphs, opening the board or block. */
1351
- prose?: string[];
1352
- /** A block link to code: its language and first lines. */
1353
- code?: {
1354
- language: string;
1355
- lines: string[];
1356
- };
1357
- /** A block link to a diagram or other figure: its kind and title. */
1358
- figure?: {
1359
- type: string;
1360
- title: string;
1361
- };
1362
- }
1363
- //#endregion
1364
1275
  //#region src/review-api/store.d.ts
1365
- /** What a person's save wrote: the version, and the id each new block got
1366
- * by its clientKey. */
1367
- interface PersonEditResult {
1368
- reviewId: string;
1369
- version: number;
1370
- ids: Record<string, string>;
1371
- }
1372
- /** One row of a board's history. */
1373
- interface HistoryEntry {
1374
- version: number;
1375
- title: string;
1376
- createdAt: string;
1377
- /** "you" for a version a person saved from the canvas; absent for one
1378
- * saved before Whiteboard recorded who wrote it. */
1379
- author?: "you" | "agent";
1380
- /** The Ask thread whose edit made this version, if any. */
1381
- threadId?: string;
1382
- }
1383
1276
  /** Source identity displayed in the review header and Home, alongside immutable pins. */
1384
1277
  interface SnapshotOrigin {
1385
1278
  branch?: string;
@@ -1404,6 +1297,8 @@ interface Snapshot {
1404
1297
  reviewId: string;
1405
1298
  version: number;
1406
1299
  title: string;
1300
+ /** Absent for a review. The scratchpad has no pins, target or lifecycle. */
1301
+ kind?: "scratchpad";
1407
1302
  /** The default pins for references that name none. A document whose
1408
1303
  * references all carry their own pins has neither pins nor target. */
1409
1304
  pins?: Pins;
@@ -1419,28 +1314,7 @@ interface Snapshot {
1419
1314
  /** The edit that produced this version, when one did; absent for a
1420
1315
  * rename, set_target, restore or import, which the canvas does not draw. */
1421
1316
  lastEdit?: EditSummary;
1422
- /** The Ask thread that caused this version when it made no edit to
1423
- * name it on: a create, rename, retarget or restore. */
1424
- threadId?: string;
1425
- /** A person saved this version from the canvas: the blocks they added,
1426
- * removed or changed. Absent on every other version. */
1427
- personEdit?: {
1428
- changed: string[];
1429
- ids?: Record<string, string>;
1430
- };
1431
1317
  }
1432
- /** Who is writing: the rules a write keeps depend on it. */
1433
- type Author =
1434
- /** An agent, through the API; a thread's agent stamps its versions
1435
- * with the thread. */
1436
- {
1437
- kind: "agent";
1438
- threadId?: string;
1439
- } |
1440
- /** A person, from Desktop or the canvas. */
1441
- {
1442
- kind: "person";
1443
- };
1444
1318
  interface Result {
1445
1319
  /** Create only: false when an existing review for the same PR came back. */
1446
1320
  created?: boolean;
@@ -1464,24 +1338,8 @@ interface Result {
1464
1338
  attention?: true;
1465
1339
  lifecycle?: true;
1466
1340
  deleted?: true;
1467
- /** After set_parent or set_dependencies: the board's relations. */
1468
- relations?: BoardRelations;
1469
1341
  warnings?: string[];
1470
1342
  }
1471
- /** A board as its place in a project shows it. */
1472
- interface PlacedBoard {
1473
- reviewId: string;
1474
- title: string;
1475
- target?: ReviewTarget;
1476
- origin?: SnapshotOrigin;
1477
- }
1478
- /** Where a board sits among its project's boards. Kept outside its versions. */
1479
- interface BoardRelations {
1480
- parentId: string | null;
1481
- /** In sibling order. */
1482
- children: string[];
1483
- dependsOn: string[];
1484
- }
1485
1343
  /** A PR's current comparison: GitHub's head and diff base, fetched locally. */
1486
1344
  interface ResolvedPullRequest {
1487
1345
  target: ReviewTarget;
@@ -1494,9 +1352,11 @@ interface ResolvedPullRequest {
1494
1352
  interface ReviewProviders {
1495
1353
  headBranch?(pins: Pins, headRef?: string): Promise<string | undefined>;
1496
1354
  projectSource?(snapshot: Snapshot, pins: Pins): Promise<Snapshot>;
1497
- /** Fetch a PR into the registered checkout the caller names. */
1355
+ /** Fetch a PR into a registered checkout: the named one, else the first
1356
+ * preferred one that still matches, else any whose remote is the PR's. */
1498
1357
  resolvePullRequest?(url: string, repository: {
1499
- id: string;
1358
+ id?: string;
1359
+ preferred?: string;
1500
1360
  }): Promise<ResolvedPullRequest>;
1501
1361
  /** Undefined when the forge can't be read. */
1502
1362
  pullRequestTitle?(url: string): Promise<string | undefined>;
@@ -1510,8 +1370,6 @@ interface ReviewProviders {
1510
1370
  /** Ids of references whose own pins no longer name a usable checkout. */
1511
1371
  unavailableAnchors?(snapshot: Snapshot): Promise<string[]>;
1512
1372
  validatePins(pins: Pins): Promise<void>;
1513
- /** The full commit a commit ID or its prefix names, if any. */
1514
- resolveCommit?(repositoryId: string, commit: string): Promise<string | undefined>;
1515
1373
  /** The files each side's commit changed from one set of pins to another,
1516
1374
  * or undefined when they can't be diffed commit to commit. */
1517
1375
  filesChangedBetween?(from: Pins, to: Pins): Promise<{
@@ -1522,8 +1380,6 @@ interface ReviewProviders {
1522
1380
  peek: boolean;
1523
1381
  }): Promise<void>;
1524
1382
  validateResource(pins: Pins | undefined, block: Block): Promise<void>;
1525
- /** A PR's base branch, as last read from GitHub; undefined until read. */
1526
- pullRequestBaseBranch?(url: string): string | undefined;
1527
1383
  }
1528
1384
  /** One instance owned by the desktop server. All writers go through execute().
1529
1385
  * The queue includes async validation; SQLite transactions contain only writes.
@@ -1531,8 +1387,6 @@ interface ReviewProviders {
1531
1387
  */
1532
1388
  declare class ReviewStore {
1533
1389
  private readonly providers;
1534
- /** How the checkouts group, if `groupCheckoutsAhead` worked it out. */
1535
- private readonly checkoutOwners?;
1536
1390
  readonly activity: ReviewActivity;
1537
1391
  readonly askHistory: AskHistory;
1538
1392
  private readonly db;
@@ -1562,29 +1416,10 @@ declare class ReviewStore {
1562
1416
  private observedVersions;
1563
1417
  private observedDeletions;
1564
1418
  subscribeCatalog(listener: () => void): () => void;
1419
+ /** For a host whose listing changed without the store: a preference flip. */
1420
+ invalidateCatalog(): void;
1565
1421
  subscribe(listener: (result: Result) => void): () => void;
1566
- constructor(databasePath: string, providers: ReviewProviders,
1567
- /** How the checkouts group, if `groupCheckoutsAhead` worked it out. */
1568
- checkoutOwners?: ReadonlyMap<string, string> | undefined);
1569
- /** Saves a version over what it was; the current one re-indexes its
1570
- * board's links, as every written version does. */
1571
- private rewriteVersion;
1572
- /** The project of a registered checkout, made on first use. Checkouts of
1573
- * one repository (worktrees, or clones of one GitHub repository) share it. */
1574
- projectOfRepository(repositoryId: string): string;
1575
- /** For a board with no repository: the project of the board opened last,
1576
- * else of the first registered checkout, else one with no repository. */
1577
- private fallbackProject;
1578
- private firstRepositoryProject;
1579
- /** A checkout's project, as the catalog lists it; undefined once the
1580
- * checkout is unregistered. */
1581
- checkoutProject(repositoryId: string): ReviewApiSummary["project"] | undefined;
1582
- /** Undefined when the file can't be read. */
1583
- private fileAtCommit;
1584
- /** A checkout's name as its project labels it, else its folder. */
1585
- private repositoryName;
1586
- /** A board's project. */
1587
- projectOf(id: string): string;
1422
+ constructor(databasePath: string, providers: ReviewProviders);
1588
1423
  private dataVersion;
1589
1424
  private currentVersions;
1590
1425
  private currentDeletions;
@@ -1599,19 +1434,13 @@ declare class ReviewStore {
1599
1434
  fingerprint: string;
1600
1435
  scope: Coverage;
1601
1436
  }[], viewed: boolean): void;
1602
- private checkoutGroups;
1603
- /** How the store's checkouts group into projects, kept for the open. */
1604
- private get checkouts();
1437
+ private readonly repositoryGroups;
1605
1438
  private repositoryGroup;
1606
1439
  registerRepository(root: string): {
1607
1440
  id: string;
1608
1441
  name: string;
1609
1442
  };
1610
- /** Forgets a checkout no board uses, after every write queued before it,
1611
- * so a board being made with it keeps it. */
1612
- unregisterRepository(id: string): Promise<void>;
1613
- /** Checkouts whose remote is cloneUrl, most recently used first. */
1614
- checkoutsOf(cloneUrl: string): string[];
1443
+ unregisterRepository(id: string): void;
1615
1444
  /** Registered checkouts, oldest registration first. */
1616
1445
  repositories(): {
1617
1446
  id: string;
@@ -1636,31 +1465,32 @@ declare class ReviewStore {
1636
1465
  resetServerId(): string;
1637
1466
  /** The 404 check alone, without loading a snapshot. */
1638
1467
  assertExists(id: string): void;
1639
- /** A board that exists and isn't in Trash: the one rule every write
1640
- * about a board keeps. */
1641
1468
  assertWritable(id: string): void;
1642
- /** Refuses a board in Trash, which is read-only until it is restored. */
1643
- assertOutOfTrash(id: string): void;
1644
1469
  private trashTime;
1645
- /** Removes a board for good, from Delete… or Trash's purge. Links into
1646
- * it stay, and show it as deleted. */
1647
1470
  private removePermanently;
1648
- /** Deletes the boards 30 days in Trash, each as Delete… would. */
1649
1471
  private purgeExpired;
1650
1472
  read(id: string, version?: number): Snapshot;
1651
1473
  setDiffStats(pins: Pins, stats: NonNullable<ReviewApiSummary["diffStats"]>): void;
1652
- /** Deletes the tutorial earlier versions shipped. Like any board, each
1653
- * goes to Trash first, then is deleted from there. */
1654
- removeLegacyTutorials(): Promise<void>;
1474
+ /** Reviews of the tutorial earlier versions shipped, for their removal. */
1475
+ legacyTutorialIds(): string[];
1655
1476
  list(): ReviewApiSummary[];
1656
1477
  /** One review's catalog entry, as review_list shows it. */
1657
1478
  summary(id: string): ReviewApiSummary | undefined;
1658
1479
  private summaries;
1659
1480
  /** Local and imported summaries use the same persisted counts. */
1660
1481
  withDiffStats<T extends ReviewApiSummary>(reviews: T[]): T[];
1482
+ /** What the pad holds, for its Home card: blocks, and the diagrams among them. */
1483
+ private scratchpadContents;
1484
+ /** The one scratchpad, made on first use. A host that loses the race to
1485
+ * another on the same home finds it made. */
1486
+ ensureScratchpad(): Promise<void>;
1661
1487
  /** Two saved board/day pairs in the last fourteen days. */
1662
1488
  feedbackEligible(now?: number): boolean;
1663
- history(id: string): HistoryEntry[];
1489
+ history(id: string): {
1490
+ version: number;
1491
+ title: string;
1492
+ createdAt: string;
1493
+ }[];
1664
1494
  inspect(id: string, targetId?: string, version?: number): Element | {
1665
1495
  id: string | undefined;
1666
1496
  type: "image" | "code" | "markdown" | "divider" | "code_peek" | "sequence" | "step" | "call_stack_diff" | "database_lens" | "trace_quote" | "software_map" | "flow_diagram" | "flow_node" | "flow_edge" | "section" | "callout";
@@ -1670,191 +1500,7 @@ declare class ReviewStore {
1670
1500
  execute(input: unknown, initial?: {
1671
1501
  document: Block[];
1672
1502
  origin: SnapshotOrigin;
1673
- }, author?: Author): Promise<Result>;
1674
- /**
1675
- * Commits a board's next version: the one place a version is written.
1676
- * Whoever writes it, it keeps the same rules:
1677
- * - an agent may not change a block a person holds;
1678
- * - the version names its author: a thread's names the thread, a
1679
- * person's is theirs and never inherits a thread;
1680
- * - only a change of repository moves a board to another project, and an
1681
- * existing board never takes the project of the board opened last;
1682
- * - only links the change adds are checked;
1683
- * - the version, its link index, the board's project and its relations
1684
- * are written together, and only if the board is still at the version
1685
- * read and the rules still hold.
1686
- * Runs inside the write queue.
1687
- */
1688
- private commitVersion;
1689
- /** The project a version puts its board in: a new board's repository's,
1690
- * or, for a board that has one, its own unless the version moves it to
1691
- * another registered repository. */
1692
- private projectFor;
1693
- private currentVersion;
1694
- /** Runs one write after every write queued before it. */
1695
- private enqueue;
1696
- /** Respells a document's links and resolves its commit links, as every
1697
- * save does. A changed reference is no longer stale. */
1698
- private normalizeDocument;
1699
- /** Checks a candidate version and numbers it. A worktree board's version
1700
- * may come back with its live source projected. */
1701
- private prepareVersion;
1702
- /** Writes a version; call inside commitCommand. */
1703
- private saveVersion;
1704
- /** Deletes a board and its history, if it is still at the version read
1705
- * and passes `guard`: Delete… from Trash, Trash's purge and a discarded
1706
- * empty board all end here. An agent can't delete a board while a person
1707
- * holds a block in it. */
1708
- private deleteBoard;
1709
- /** Writes what a board is outside its versions: its parent or what it
1710
- * depends on, Trash or back, or that it was viewed. No version is saved,
1711
- * but the rules are a version's: a board in Trash takes nothing but a
1712
- * restore, and an agent can't put a board a person is in to Trash. */
1713
- private commitBoardFacts;
1714
- /** Deletes a board the person made and left as it was: with no title
1715
- * (it reads "Untitled"), no blocks and no child boards. A title typed as
1716
- * "Untitled" is a title. A board still open on a canvas, or
1717
- * one an agent is working on, is kept. A closing canvas saves, then lets
1718
- * go of the board, so the discard waits for that first. */
1719
- discard(reviewId: string): Promise<{
1720
- deleted: boolean;
1721
- }>;
1722
- /** Each board's canvas leases by client: the board is open there, and
1723
- * `blockId` is the block the person is in, if any. In memory: a lease
1724
- * outlives neither its renewals nor the host. */
1725
- private readonly leases;
1726
- /** Whether a canvas still holds the board open. */
1727
- private leased;
1728
- /** Records the block a person's canvas has focus in (null for none), or
1729
- * with `open: false` that the canvas closed the board. */
1730
- focus(reviewId: string, input: unknown): {
1731
- ok: true;
1732
- };
1733
- /** Refuses an agent's change to a board while a person holds any block
1734
- * in it. */
1735
- private assertUnheld;
1736
- /** Refuses an agent's edit to a block a person is editing. */
1737
- private assertUnleased;
1738
- /** Saves a person's whole board as their own version, against the version
1739
- * they started from. Blocks without ids get fresh ones. */
1740
- personEdit(reviewId: string, input: unknown): Promise<PersonEditResult>;
1741
- /** Where a board sits: its parent, and the parent's children in order,
1742
- * each with what its header shows. */
1743
- place(id: string): {
1744
- children?: PlacedBoard[] | undefined;
1745
- siblings: PlacedBoard[];
1746
- parent?: PlacedBoard | undefined;
1747
- board: PlacedBoard;
1748
- };
1749
- /** The siblings Home and the sidebar list, which a board's place counts
1750
- * among: all but those in Trash, and the board itself. */
1751
- private listedSiblings;
1752
- /** A board's parent, its children in sibling order, and what it depends on. */
1753
- relations(id: string): BoardRelations;
1754
- /** Parents, children and dependencies. A board in Trash is out of them
1755
- * until it is restored, its rows kept; only its own place sees it. */
1756
- private relationGraph;
1757
- /** Drops a board's parent, children and dependencies in other projects,
1758
- * after it moved to `projectId`. Whether it dropped any. */
1759
- private dropRelationsOutside;
1760
- private orderChildren;
1761
- private siblingFacts;
1762
- /** Commits never change, so a definite answer is kept. */
1763
- private readonly ancestry;
1764
- /** When git was last asked, for questions with no answer yet. */
1765
- private readonly ancestryAsked;
1766
- /** Whether `ancestor` is an ancestor of `of`, as far as is known. git is
1767
- * asked in the background, never on the server thread: until it answers,
1768
- * or when it fails, the answer is no, and a yes re-sorts the catalog. */
1769
- private isAncestor;
1770
- private readonly ancestryQueue;
1771
- private ancestryRunning;
1772
- private askNextAncestry;
1773
- private knowAncestry;
1774
- private catalogChanged;
1775
- private boardName;
1776
- /** The other board exists and is in the same project. */
1777
- private checkRelated;
1778
- /** One parent, one level: a parent is top-level and a child has no
1779
- * children. Null makes the board top-level. */
1780
- private setParent;
1781
- private setDependencies;
1782
- /** New links must point at a board and block that exist. Saved links are
1783
- * not rechecked, since their target may have been deleted. */
1784
- private checkBoardLinks;
1785
- private wasDeleted;
1786
- /** The boards that link to a board or its blocks. */
1787
- linkingBoards(id: string): string[];
1788
- /** Rebuilds the board_links rows for one board. */
1789
- private indexBoardLinks;
1790
- /** Link previews by board, version and block; a version never changes. */
1791
- private readonly linkPreviews;
1792
- private linkPreview;
1793
- /** What a link's hover card shows of the board or block it links to,
1794
- * read when the card opens rather than with every link. Only for a link
1795
- * the version has. */
1796
- linkPeek(id: string, to: {
1797
- board: string;
1798
- block?: string;
1799
- }, version?: number): BoardLinkPreview;
1800
- /** "owner / repo" for a board in a GitHub repository, else its folder. */
1801
- private repositoryLabel;
1802
- /** A version's outgoing links and the board's current backlinks. Links to a
1803
- * deleted board or block are marked missing. */
1804
- links(id: string, version?: number): {
1805
- outgoing: {
1806
- title?: string | undefined;
1807
- deletedAt?: string | undefined;
1808
- missing: boolean;
1809
- updatedAt?: string | undefined;
1810
- pullRequestNumber?: number | undefined;
1811
- pullRequestUrl?: string | undefined;
1812
- repository?: string | undefined;
1813
- icon?: BoardIconKind | undefined;
1814
- from: BlockRef;
1815
- to: BoardRef;
1816
- }[];
1817
- backlinks: {
1818
- pullRequestNumber?: number | undefined;
1819
- pullRequestUrl?: string | undefined;
1820
- icon?: BoardIconKind | undefined;
1821
- from: {
1822
- board: string;
1823
- block: string;
1824
- };
1825
- to: {
1826
- board: string;
1827
- block?: undefined;
1828
- } | {
1829
- board: string;
1830
- block: string;
1831
- };
1832
- title: string;
1833
- }[];
1834
- };
1835
- /** Boards edited by an Ask thread, most recent first. */
1836
- boardsChangedBy(threadId: string): {
1837
- reviewId: string;
1838
- title: string;
1839
- icon: BoardIconKind;
1840
- blockId?: string;
1841
- }[];
1842
- /** The boards each thread changed, newest first, for many threads in one
1843
- * query. */
1844
- /** A board's title and icon, read without its document. */
1845
- /** Where a board lives, as Recent names it: its checkout's folder, else
1846
- * its project's name. */
1847
- boardPlace(reviewId: string): string;
1848
- boardFace(reviewId: string): {
1849
- reviewId: string;
1850
- title: string;
1851
- icon: BoardIconKind;
1852
- };
1853
- boardsChangedByThreads(threadIds: readonly string[]): Map<string, {
1854
- reviewId: string;
1855
- title: string;
1856
- icon: BoardIconKind;
1857
- }[]>;
1503
+ }): Promise<Result>;
1858
1504
  /** Resolve a target-less PR create before it queues, when it will need it. */
1859
1505
  private startPullRequest;
1860
1506
  private startPullRequestTitle;
@@ -1870,10 +1516,6 @@ declare class ReviewStore {
1870
1516
  /** Viewing a review in Trash does not restore it. */
1871
1517
  trashedIds(): string[];
1872
1518
  has(reviewId: string): boolean;
1873
- /** Saves each new commit link's commit in full, resolved in the board's
1874
- * repository; one it does not have rejects the edit, as pins do. A link the
1875
- * board already had stays as it was saved, even if its commit is gone. */
1876
- private resolveCommitLinks;
1877
1519
  private validateExternal;
1878
1520
  }
1879
1521
  //#endregion
@@ -2008,11 +1650,8 @@ declare class LocalReviewData {
2008
1650
  filePath?: string;
2009
1651
  rootPath: string;
2010
1652
  }>;
2011
- /** A document read that needs default pins: its own, or for a plan its
2012
- * repository's live checkout with base at head; 409 when it has neither. */
1653
+ /** A document read that needs default pins; 409 when the document has none. */
2013
1654
  documentPins(snapshot: Snapshot): Promise<Pins>;
2014
- /** A checkout's current state, base at head: what a plan reads. */
2015
- private livePins;
2016
1655
  /** Pins a reference names itself, checked against the registered checkout. */
2017
1656
  anchorSourcePins(anchor: SourcePins): Promise<Pins>;
2018
1657
  /** References whose own repository is unregistered or gone from disk.
@@ -2030,8 +1669,6 @@ declare class LocalReviewData {
2030
1669
  subscribe?: typeof subscribe;
2031
1670
  /** gh, git and GitHub API access for pull request targets. */
2032
1671
  pullRequests?: PullRequestDeps;
2033
- /** Read PR states from GitHub for the catalog. */
2034
- pullRequestStates?: boolean;
2035
1672
  });
2036
1673
  structuralChanges({ reviewId, pins, signal, file }: {
2037
1674
  reviewId: string;
@@ -2070,33 +1707,10 @@ declare class LocalReviewData {
2070
1707
  }>;
2071
1708
  /** The fork point from `ref`, by default the repository's default branch. */
2072
1709
  private worktreeBase;
2073
- /** Each PR's state, by URL, as last read. */
2074
- private readonly pullRequestStates;
2075
- private readonly pullRequestStateListeners;
2076
- private pullRequestStateTimer;
2077
- private readonly pullRequestStateQueue;
2078
- private pullRequestStateReads;
2079
- /** While GitHub rate-limits, no state is read. */
2080
- private pullRequestStatesPausedUntil;
2081
- /** Calls back when a PR's state changes. While anyone listens, every PR
2082
- * still shown is read again once its state is a few minutes old. */
2083
- subscribePullRequestStates(listener: () => void): () => void;
2084
- /** A PR's state as last read from GitHub; a read older than a few minutes
2085
- * queues another in the background. Undefined until the first read lands,
2086
- * and a failed read keeps the last state. A merged or closed PR is not
2087
- * read again. */
2088
- pullRequestState(url: string | undefined, { seen }?: {
2089
- seen?: boolean;
2090
- }): PullRequestState | undefined;
2091
- /** Reads queued PR states a few at a time. */
2092
- private readPullRequestStates;
2093
- /** The branch a PR merges into, as last read with its state. */
2094
- pullRequestBaseBranch(url: string): string | undefined;
2095
- /** A PR's own branch, as last read with its state. */
2096
- pullRequestHeadBranch(url: string): string | undefined;
2097
1710
  /** The PR's current comparison, fetched into a registered checkout of its repository. */
2098
1711
  resolvePullRequest(url: string, repository: {
2099
- id: string;
1712
+ id?: string;
1713
+ preferred?: string;
2100
1714
  }): Promise<ResolvedPullRequest>;
2101
1715
  pullRequestTitle(url: string): Promise<string | undefined>;
2102
1716
  /** A registered checkout with a remote for host/owner/repo, and that remote. */
@@ -2108,22 +1722,6 @@ declare class LocalReviewData {
2108
1722
  base: Set<string>;
2109
1723
  head: Set<string>;
2110
1724
  } | undefined>;
2111
- /** What a commit is, for a quote read at it: its subject, author and
2112
- * date, and how far behind the default branch's tip it is when both are
2113
- * known. */
2114
- commitInfo(repositoryId: string, commit: string): Promise<{
2115
- commit: string;
2116
- subject: string;
2117
- author: string;
2118
- authoredAt: string;
2119
- behind?: {
2120
- count: number;
2121
- branch: string;
2122
- };
2123
- }>;
2124
- /** The full commit a commit ID or its prefix names in the repository,
2125
- * or undefined when it names none. */
2126
- resolveCommit(repositoryId: string, commit: string): Promise<string | undefined>;
2127
1725
  validatePins(pins: Pins): Promise<void>;
2128
1726
  file(pins: Pins, side: "base" | "head", file: string, allowBinary?: boolean): Promise<{
2129
1727
  file: string;
@@ -2230,16 +1828,11 @@ declare class ShareClient {
2230
1828
  }
2231
1829
  //#endregion
2232
1830
  //#region src/sharing/repository.d.ts
2233
- /** Recipients need complete history; publication only checks that the commits exist.
2234
- * `commits` are other commits the board's references read at; a plan has
2235
- * only those. */
2236
- declare function fetchPinnedRepository(root: string, url: string, pins: Pick<Pins, "base" | "head"> | undefined, publishing?: boolean, commits?: readonly string[]): Promise<void>;
2237
- /** A managed clone of a repository's default branch, for a shared board
2238
- * with no pins whose repository the receiver has no checkout of. */
2239
- declare function cloneSharedRepository(root: string, url: string): Promise<void>;
2240
- declare function verifyShareRepository(root: string, pins: Pins | undefined, repository?: {
1831
+ /** Recipients need complete history; publication only checks that the commits exist. */
1832
+ declare function fetchPinnedRepository(root: string, url: string, pins: Pick<Pins, "base" | "head">, publishing?: boolean): Promise<void>;
1833
+ declare function verifyShareRepository(root: string, pins: Pins, repository?: {
2241
1834
  cloneUrl: string;
2242
- }, commits?: readonly string[]): Promise<{
1835
+ }): Promise<{
2243
1836
  cloneUrl: string;
2244
1837
  }>;
2245
1838
  //#endregion
@@ -2319,7 +1912,6 @@ declare function sharedReviewId(origin: string, shareId: string): string;
2319
1912
  declare class SharedReviewStore {
2320
1913
  readonly root: string;
2321
1914
  private readonly fetchRepository;
2322
- private readonly cloneRepository;
2323
1915
  private readonly loaded;
2324
1916
  private readonly validated;
2325
1917
  private readonly attention;
@@ -2334,7 +1926,7 @@ declare class SharedReviewStore {
2334
1926
  private readonly repositories;
2335
1927
  private readonly jobs;
2336
1928
  private readonly states;
2337
- constructor(root: string, fetchRepository?: typeof fetchPinnedRepository, cloneRepository?: typeof cloneSharedRepository);
1929
+ constructor(root: string, fetchRepository?: typeof fetchPinnedRepository);
2338
1930
  private purgeExpired;
2339
1931
  connect(store: ReviewStore, data: LocalReviewData): void;
2340
1932
  has(id: string): boolean;
@@ -2346,12 +1938,6 @@ declare class SharedReviewStore {
2346
1938
  repositoryRoot(id: string): string;
2347
1939
  prepare(id: string): Promise<void>;
2348
1940
  private prepareRepository;
2349
- /** Reads each of a shared board's references at its own commits, in the
2350
- * checkout of its repository. */
2351
- private validateReferences;
2352
- /** Files an unpinned board under a local checkout of its repository,
2353
- * else a managed clone. */
2354
- private prepareUnpinned;
2355
1941
  assertReady(id: string): Promise<void>;
2356
1942
  subscribe(listener: () => void): () => void;
2357
1943
  load(): Promise<void>;