@dev.fast/whiteboard 0.3.4 → 0.3.5-preview.20261021.131

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 (120) hide show
  1. package/dist/{account-alias-CprZojXd.js → account-alias-CisiYUZT.js} +13 -8
  2. package/dist/agent-cli-BglNRDZN.js +2 -0
  3. package/dist/{agent-cli-CThN7Q59.js → agent-cli-TJ7_5_B3.js} +15 -10
  4. package/dist/{agent-client-BOOi7EUR.js → agent-client-H53ajvrm.js} +13 -3
  5. package/dist/{authoring-tools-BNwuMnz6.js → authoring-tools-BCquUsB3.js} +34 -27
  6. package/dist/{background-server-DLSDogkI.js → background-server-BSYXD9au.js} +1 -1
  7. package/dist/{background-server-CkvxA-6O.js → background-server-Xom8cA_u.js} +5 -5
  8. package/dist/build-info.json +1 -1
  9. package/dist/{cli-R4yfa5DT.js → cli-BOnV4cCh.js} +1 -1
  10. package/dist/{cli-runner-Cuc9FSzu.js → cli-runner-cRY5NOno.js} +70 -34
  11. package/dist/cli.js +4 -3
  12. package/dist/{client-BN_FDxFr.js → client-UH1bEG7Z.js} +260 -49
  13. package/dist/{fuzzy-match-BO9bK37N.js → fuzzy-match-D_x3wumC.js} +6 -4
  14. package/dist/{headless-host-CVBOQyRS.js → headless-host-BEe-aFtB.js} +1 -1
  15. package/dist/{headless-host-Cog6SpS9.js → headless-host-CEb5d-A0.js} +563 -175
  16. package/dist/lens-selection-BxPk53c8.js +214 -0
  17. package/dist/{local-data-D_9tvdsp.js → local-data-mbCb1HDH.js} +2448 -347
  18. package/dist/{mcp-D1hziANa.js → mcp-cBtzXsmN.js} +9 -12
  19. package/dist/{package-paths-C--__jEv.js → package-paths-BkeQsdaw.js} +1 -1
  20. package/dist/profile-Dbyidrcr.js +2 -0
  21. package/dist/{profile-DokFw782.js → profile-duqp5uPa.js} +20 -8
  22. package/dist/{remote-attach-CEJ-kvDY.js → remote-attach-BeKuMm_x.js} +4 -4
  23. package/dist/{remote-extensions-GN8Gf_qG.js → remote-extensions-CX2fAec1.js} +1 -1
  24. package/dist/{remote-extensions-Blcjr9Ze.js → remote-extensions-CYWNTVSf.js} +3 -3
  25. package/dist/{remote-language-server-BTKBQ7x4.js → remote-language-server-DLWluAeR.js} +5 -5
  26. package/dist/{remote-uninstall-DW7Gdryh.js → remote-uninstall-Y3S0YmJs.js} +6 -6
  27. package/dist/{request-origin-Zcn_CjX4.js → request-origin-icXPv6jh.js} +55 -18
  28. package/dist/{review-app-launcher-CkwLclzR.js → review-app-launcher-DZvG5ZAh.js} +2 -2
  29. package/dist/{review-home-paths-j2BRAaNv.js → review-home-paths-BwH08ihj.js} +19 -17
  30. package/dist/{review-telemetry-BLNwYnLV.js → review-telemetry-AZ0imsmJ.js} +6 -6
  31. package/dist/runtime-CF4JXdb8.js +27 -0
  32. package/dist/runtime.d.ts +1 -1
  33. package/dist/runtime.js +1 -1
  34. package/dist/{s3-DtJFWC0G.js → s3-CsG2EWED.js} +1 -1
  35. package/dist/{s3-config-BTO12tCC.js → s3-config-CjcLyFV5.js} +4 -2
  36. package/dist/{s3-config-CSy3fx8H.js → s3-config-zz4GWh2T.js} +1 -1
  37. package/dist/server/desktop-host.js +28 -104
  38. package/dist/{server-discovery-Bey8IqXH.js → server-discovery-DeVTdcqK.js} +3 -3
  39. package/dist/sharing/index.d.ts +484 -74
  40. package/dist/sharing/index.js +1 -1
  41. package/dist/{src-DsM3jO8G.js → src-DYZLCUP_.js} +98 -18
  42. package/dist/{src-BMPuxWv4.js → src-DtfSndqS.js} +269 -227
  43. package/dist/{stored-document-migration-CChxtFAy.js → stored-document-migration-B29lve9-.js} +318 -271
  44. package/dist/{thread-state-5pYr6_zM.js → thread-state-BPpvKFwQ.js} +12 -2
  45. package/dist/{tool-failure-C9MpbXJJ.js → tool-failure-CQhyLht3.js} +10 -3
  46. package/instructions/authoring.md +20 -5
  47. package/package.json +4 -4
  48. package/src/agent-selection.ts +6 -0
  49. package/src/ask/agents.ts +13 -1
  50. package/src/ask/checkout-files.ts +2 -5
  51. package/src/ask/thread-state.ts +4 -0
  52. package/src/ask/thread.ts +61 -31
  53. package/src/ask/threads.ts +24 -3
  54. package/src/cli-install.ts +13 -2
  55. package/src/cli-runner.ts +4 -1
  56. package/src/cli.ts +4 -1
  57. package/src/diff-selection-migration.ts +48 -34
  58. package/src/heading-anchors.ts +42 -0
  59. package/src/lens-selection.ts +38 -2
  60. package/src/markdown.ts +42 -0
  61. package/src/posthog-capture-client.ts +1 -1
  62. package/src/review-api/README.md +52 -13
  63. package/src/review-api/activity.ts +1 -4
  64. package/src/review-api/agent-cli.ts +9 -1
  65. package/src/review-api/anchor-quotes.ts +14 -7
  66. package/src/review-api/ask-history.ts +118 -51
  67. package/src/review-api/authoring-tools.ts +45 -30
  68. package/src/review-api/azure-devops-provider.ts +2 -20
  69. package/src/review-api/azure-remote.ts +21 -0
  70. package/src/review-api/blocks/definition.ts +1 -1
  71. package/src/review-api/blocks/markdown.ts +2 -2
  72. package/src/review-api/board-order.ts +144 -0
  73. package/src/review-api/checkout-groups.ts +586 -0
  74. package/src/review-api/document-headings.ts +58 -27
  75. package/src/review-api/document-text.ts +31 -2
  76. package/src/review-api/document.ts +362 -67
  77. package/src/review-api/foreign-references.ts +328 -0
  78. package/src/review-api/github-provider.ts +51 -13
  79. package/src/review-api/http.ts +734 -135
  80. package/src/review-api/instructions.ts +0 -19
  81. package/src/review-api/link-preview.ts +113 -0
  82. package/src/review-api/local-data.ts +310 -46
  83. package/src/review-api/mcp.ts +7 -13
  84. package/src/review-api/onboarding.ts +1 -1
  85. package/src/review-api/profile.ts +37 -6
  86. package/src/review-api/public-tools.ts +24 -2
  87. package/src/review-api/pull-request.ts +82 -49
  88. package/src/review-api/request-origin.ts +10 -0
  89. package/src/review-api/review-progress.ts +61 -27
  90. package/src/review-api/scratchpad-plan-upgrade.ts +250 -0
  91. package/src/review-api/store-migrations.ts +355 -0
  92. package/src/review-api/store-schema.ts +38 -29
  93. package/src/review-api/store.ts +2176 -495
  94. package/src/review-api/worktree-events.ts +3 -5
  95. package/src/review-api/worktree-source.ts +3 -7
  96. package/src/review-api/worktree-structural.integration.ts +72 -0
  97. package/src/review-stack.ts +15 -23
  98. package/src/runtime.ts +4 -30
  99. package/src/server/desktop-host.ts +6 -1
  100. package/src/server/desktop-server.ts +1 -36
  101. package/src/server/headless-host.ts +0 -2
  102. package/src/server/hono-http.ts +2 -1
  103. package/src/server/review-gateway-list.ts +3 -5
  104. package/src/server/review-gateway-memory.ts +1 -1
  105. package/src/server/review-lifecycle-telemetry.ts +2 -2
  106. package/src/server/review-server-core.ts +1 -5
  107. package/src/server/structural-comparisons.ts +47 -0
  108. package/src/sharing/export.ts +36 -7
  109. package/src/sharing/host.ts +34 -14
  110. package/src/sharing/import.ts +156 -24
  111. package/src/sharing/repository.ts +143 -24
  112. package/src/startup-trace.ts +3 -3
  113. package/src/stored-document-migration.ts +110 -19
  114. package/src/ui-telemetry-events.ts +44 -18
  115. package/dist/agent-cli-C6SPSII0.js +0 -2
  116. package/dist/profile-CYPmvBoA.js +0 -2
  117. package/dist/runtime-CKiWhGrf.js +0 -52
  118. package/instructions/scratchpad.md +0 -23
  119. package/src/review-preferences.ts +0 -88
  120. package/src/server/legacy-tutorial-cleanup.ts +0 -38
@@ -0,0 +1,144 @@
1
+ /** What sibling order reads about a board. */
2
+ export interface SiblingFacts {
3
+ id: string;
4
+ /** When it was made: an edit never moves it. */
5
+ createdAt: string;
6
+ /** Its pins: commits of repositoryId. Plans have none. */
7
+ repositoryId?: string;
8
+ base?: string;
9
+ head?: string;
10
+ /** A PR board's head branch, and its PR's base branch, when known. */
11
+ headBranch?: string;
12
+ baseBranch?: string;
13
+ }
14
+
15
+ /**
16
+ * Siblings in reading order. A comes after B when A reaches B through
17
+ * depends_on, directly or through boards outside the siblings. Between two
18
+ * siblings with no such chain either way, commits decide: A comes after B
19
+ * when A's base is, or descends from, B's head, or A's PR merges into B's
20
+ * branch. Remaining ties go newest made first, then by id, so an edit
21
+ * never reorders them.
22
+ */
23
+ export function orderSiblings(
24
+ siblings: readonly SiblingFacts[],
25
+ dependsOn: (id: string) => readonly string[],
26
+ isAncestor: (repositoryId: string, ancestor: string, of: string) => boolean,
27
+ ): string[] {
28
+ const reach = new Map(
29
+ siblings.map((board) => [board.id, reachable(board.id, dependsOn)]),
30
+ );
31
+
32
+ const after = (a: SiblingFacts, b: SiblingFacts) => {
33
+ if (reach.get(a.id)!.has(b.id)) return true;
34
+
35
+ if (reach.get(b.id)!.has(a.id)) return false;
36
+
37
+ return buildsOn(a, b, isAncestor) && !buildsOn(b, a, isAncestor);
38
+ };
39
+
40
+ const before = new Map(
41
+ siblings.map((a) => [
42
+ a.id,
43
+ new Set(siblings.flatMap((b) => (b !== a && after(a, b) ? [b.id] : []))),
44
+ ]),
45
+ );
46
+
47
+ const newestFirst = [...siblings].sort(
48
+ (a, b) =>
49
+ Date.parse(b.createdAt) - Date.parse(a.createdAt) ||
50
+ a.id.localeCompare(b.id),
51
+ );
52
+
53
+ const placed = new Set<string>();
54
+ const order: string[] = [];
55
+
56
+ while (order.length < siblings.length) {
57
+ const remaining = newestFirst.filter((board) => !placed.has(board.id));
58
+
59
+ // Inferred order can disagree with itself; then age breaks the loop.
60
+ const next =
61
+ remaining.find((board) =>
62
+ [...before.get(board.id)!].every((id) => placed.has(id)),
63
+ ) ?? remaining[0]!;
64
+
65
+ placed.add(next.id);
66
+ order.push(next.id);
67
+ }
68
+
69
+ return order;
70
+ }
71
+
72
+ function reachable(
73
+ id: string,
74
+ dependsOn: (id: string) => readonly string[],
75
+ ): Set<string> {
76
+ const seen = new Set<string>();
77
+ const stack = [...dependsOn(id)];
78
+
79
+ while (stack.length) {
80
+ const next = stack.pop()!;
81
+
82
+ if (seen.has(next)) continue;
83
+ seen.add(next);
84
+ stack.push(...dependsOn(next));
85
+ }
86
+
87
+ return seen;
88
+ }
89
+
90
+ /** Whether a's change sits on top of b's. */
91
+ function buildsOn(
92
+ a: SiblingFacts,
93
+ b: SiblingFacts,
94
+ isAncestor: (repositoryId: string, ancestor: string, of: string) => boolean,
95
+ ): boolean {
96
+ if (a.repositoryId !== b.repositoryId) return false;
97
+
98
+ if (a.baseBranch && a.baseBranch === b.headBranch) return true;
99
+
100
+ if (!a.base || !b.head) return false;
101
+
102
+ if (a.base === b.head) return true;
103
+
104
+ // A board with no change of its own builds on nothing.
105
+ return a.base !== a.head && isAncestor(a.repositoryId!, b.head, a.base);
106
+ }
107
+
108
+ /**
109
+ * The path that adding `from → to` would close, from `from` back to itself,
110
+ * or undefined when it closes none.
111
+ */
112
+ export function dependencyCycle(
113
+ from: string,
114
+ to: string,
115
+ dependsOn: (id: string) => readonly string[],
116
+ ): string[] | undefined {
117
+ if (from === to) return [from, from];
118
+
119
+ const previous = new Map<string, string>();
120
+ const queue = [to];
121
+ const seen = new Set([to]);
122
+
123
+ while (queue.length) {
124
+ const current = queue.shift()!;
125
+
126
+ if (current === from) {
127
+ const path = [from];
128
+
129
+ for (let at = from; at !== to; at = previous.get(at)!)
130
+ path.unshift(previous.get(at)!);
131
+
132
+ return [from, ...path];
133
+ }
134
+
135
+ for (const next of dependsOn(current))
136
+ if (!seen.has(next)) {
137
+ seen.add(next);
138
+ previous.set(next, current);
139
+ queue.push(next);
140
+ }
141
+ }
142
+
143
+ return undefined;
144
+ }