@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
@@ -1,7 +1,7 @@
1
- import { a as toolResultText, s as ReviewApiError } from "./agent-client-BOOi7EUR.js";
1
+ import { a as toolResultText, s as ReviewApiError } from "./agent-client-H53ajvrm.js";
2
2
  import { t as ReviewInputError } from "./input-error-OLgB_h31.js";
3
- import { n as REVIEW_STATUS_TOOL, t as authoringTools } from "./authoring-tools-BNwuMnz6.js";
4
- import { i as publicTool, n as RECOVERY, r as callPublicTool, t as toolFailure } from "./tool-failure-C9MpbXJJ.js";
3
+ import { n as REVIEW_STATUS_TOOL, t as authoringTools } from "./authoring-tools-BCquUsB3.js";
4
+ import { i as publicTool, n as RECOVERY, r as callPublicTool, t as toolFailure } from "./tool-failure-CQhyLht3.js";
5
5
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
6
6
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
7
7
  import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
@@ -30,15 +30,14 @@ function mcpClientAgent(name) {
30
30
  const RELOAD_TOOLS = "Whiteboard is running now, but this session listed Whiteboard's tools before it started, so you may see only session_get_instructions. Before authoring, reload the `whiteboard` MCP server's tools (reconnect it in your agent, or start a new agent session). If you can already see tools such as session_create, carry on.";
31
31
  function mcpAuthoringGuidance(context) {
32
32
  return [
33
- "Whiteboard explains code in documents the user reads in Whiteboard Desktop. Call session_get_instructions before creating or editing a Whiteboard and follow it. Read session_capabilities before authoring; session_create opens the new review in Desktop when it is available, so call session_open only for an existing review, and generate software maps only when softwareMapEnabled is true. When the user asks for a Whiteboard or to use Whiteboard (for example to review a branch, a change or a pull request, or to explain a system in Whiteboard), author a Whiteboard with the default topic.",
34
- ...context.scratchpadAvailable ? ["When the user asks in conversation to be shown how code works or wants a diagram, without asking for a Whiteboard, call session_capabilities; if it reports scratchpadEnabled and desktopAvailable, draw on the Whiteboard scratchpad rather than answering only in chat, starting with session_get_instructions({topic:\"scratchpad\"})."] : [],
33
+ "Whiteboard explains code in documents the user reads in Whiteboard Desktop. Call session_get_instructions before creating or editing a Whiteboard and follow it. Read session_capabilities before authoring; session_create opens the new review in Desktop when it is available, so call session_open only for an existing review, and generate software maps only when softwareMapEnabled is true. When the user asks for a Whiteboard or to use Whiteboard (for example to plan work, review a branch or PR stack, or explain a system in Whiteboard), author a Whiteboard with the default topic.",
35
34
  ...context.traceEnabled ? ["For why code exists, what an agent was thinking, or whether an agent solved something before, call session_get_instructions({topic:\"trace-archaeology\"})."] : [],
36
35
  "Never read or write Whiteboard files or SQL."
37
36
  ].join(" ");
38
37
  }
39
38
  async function serveReviewMcp(connect, stdin, stdout, stderr = process.stderr, traceEnabled = false, offlineStatus, onToolCall, environmentAgent) {
40
39
  const instructionsTool = {
41
- ...authoringTools(false, traceEnabled).find((tool) => tool.name === "review_get_instructions"),
40
+ ...authoringTools(traceEnabled).find((tool) => tool.name === "review_get_instructions"),
42
41
  name: "session_get_instructions"
43
42
  };
44
43
  const server = new Server({
@@ -74,13 +73,11 @@ async function serveReviewMcp(connect, stdin, stdout, stderr = process.stderr, t
74
73
  stderr.write(`whiteboard mcp: ${error instanceof Error ? error.message : String(error)}\n`);
75
74
  }
76
75
  const always = [instructionsTool, REVIEW_STATUS_TOOL].map((fallback) => tools.find((tool) => tool.name === fallback.name) ?? fallback);
77
- return { tools: [...always, ...tools.filter((tool) => !always.includes(tool))].map(({ name, description, inputSchema }) => ({
76
+ return { tools: [...always, ...tools.filter((tool) => !always.includes(tool))].map(({ name, description, inputSchema, method }) => ({
78
77
  name,
79
- description: name === instructionsTool.name ? `${mcpAuthoringGuidance({
80
- scratchpadAvailable: true,
81
- traceEnabled
82
- })}\n\n${description}` : description,
83
- inputSchema
78
+ description: name === instructionsTool.name ? `${mcpAuthoringGuidance({ traceEnabled })}\n\n${description}` : description,
79
+ inputSchema,
80
+ ...method === "GET" && { annotations: { readOnlyHint: true } }
84
81
  })) };
85
82
  });
86
83
  server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
@@ -1,5 +1,5 @@
1
1
  import { c as jsonString, o as jsonObject, u as parseJsonText } from "./src-X9phtB2j.js";
2
- import "./review-home-paths-j2BRAaNv.js";
2
+ import "./review-home-paths-BwH08ihj.js";
3
3
  import { readFileSync } from "node:fs";
4
4
  import path from "node:path";
5
5
  import { fileURLToPath } from "node:url";
@@ -0,0 +1,2 @@
1
+ import { t as openReviewProfile } from "./profile-duqp5uPa.js";
2
+ export { openReviewProfile };
@@ -1,6 +1,6 @@
1
- import { o as initializeReviewStoreSchema, t as openLocalReviewStore } from "./local-data-D_9tvdsp.js";
2
- import "./review-home-paths-j2BRAaNv.js";
3
- import { j as withFileLock } from "./s3-config-BTO12tCC.js";
1
+ import { a as projectOfCheckout, g as CheckoutGroups, o as groupCheckoutsAhead, s as initializeReviewStoreSchema, t as openLocalReviewStore } from "./local-data-mbCb1HDH.js";
2
+ import "./review-home-paths-BwH08ihj.js";
3
+ import { j as withFileLock } from "./s3-config-CjcLyFV5.js";
4
4
  import { access, mkdir } from "node:fs/promises";
5
5
  import path from "node:path";
6
6
  import { DatabaseSync } from "node:sqlite";
@@ -18,7 +18,11 @@ async function openReviewProfile(home, options) {
18
18
  });
19
19
  const outcome = await withFileLock(path.join(home, ".review-profile-startup"), lockOptions, async () => {
20
20
  for (const source of [path.join(home, "review-server", "reviews.db"), path.join(home, "reviews.db")]) await importHeadlessStore(home, source);
21
- return openLocalReviewStore(path.join(home, "review-api.db"), options);
21
+ const database = path.join(home, "review-api.db");
22
+ return openLocalReviewStore(database, {
23
+ ...options,
24
+ checkoutOwners: await groupCheckoutsAhead(database)
25
+ });
22
26
  });
23
27
  if (!outcome.acquired) throw new Error("Another Review process is initializing this profile. Retry shortly.");
24
28
  return outcome.result;
@@ -45,19 +49,27 @@ async function importHeadlessStore(home, source) {
45
49
  try {
46
50
  if (database.prepare("SELECT 1 FROM headless.reviews s JOIN reviews t ON s.id=t.id LIMIT 1").get()) throw new Error(`Cannot merge ${source}: the shared store already contains one of its review IDs. Both databases are unchanged.`);
47
51
  database.exec(`
48
- INSERT INTO repositories SELECT s.* FROM headless.repositories s WHERE NOT EXISTS (SELECT 1 FROM repositories t WHERE t.path=s.path);
52
+ INSERT INTO repositories(id,path,name) SELECT s.id,s.path,s.name FROM headless.repositories s WHERE NOT EXISTS (SELECT 1 FROM repositories t WHERE t.path=s.path);
49
53
  CREATE TEMP TABLE repository_ids AS SELECT s.id old_id,t.id new_id FROM headless.repositories s JOIN repositories t ON s.path=t.path;
50
54
  `);
51
55
  if (database.prepare(`SELECT 1 FROM headless.versions s LEFT JOIN repository_ids r ON json_extract(s.snapshot,'$.pins.repositoryId')=r.old_id WHERE r.old_id IS NULL LIMIT 1`).get()) throw new Error(`Cannot merge ${source}: a version refers to an unregistered repository. Both databases are unchanged.`);
52
56
  if (database.prepare(`SELECT 1 FROM headless.resources s JOIN resources t ON s.id=t.id JOIN repository_ids r ON s.repository_id=r.old_id
53
57
  WHERE t.repository_id!=r.new_id OR t.kind!=s.kind OR t.mime_type!=s.mime_type OR t.data IS NOT s.data LIMIT 1`).get()) throw new Error(`Cannot merge ${source}: a resource ID has different content. Both databases are unchanged.`);
58
+ if (database.prepare("SELECT 1 FROM pragma_table_info('reviews') WHERE name='project_id'").get()) {
59
+ const groups = new CheckoutGroups(database);
60
+ for (const { new_id: repositoryId } of database.prepare("SELECT new_id FROM repository_ids").all()) projectOfCheckout(database, String(repositoryId), groups);
61
+ database.exec(`INSERT INTO reviews(id,version,next_id,project_id) SELECT s.id,s.version,s.next_id,p.project_id
62
+ FROM headless.reviews s JOIN headless.versions v ON v.review_id=s.id AND v.version=s.version
63
+ JOIN repository_ids r ON json_extract(v.snapshot,'$.pins.repositoryId')=r.old_id
64
+ JOIN repositories p ON p.id=r.new_id;`);
65
+ } else database.exec("INSERT INTO reviews(id,version,next_id) SELECT id,version,next_id FROM headless.reviews;");
54
66
  database.exec(`
55
67
  INSERT OR IGNORE INTO resources SELECT s.id,r.new_id,s.kind,s.mime_type,s.data FROM headless.resources s JOIN repository_ids r ON s.repository_id=r.old_id;
56
- INSERT INTO reviews SELECT * FROM headless.reviews;
57
- INSERT INTO versions SELECT s.review_id,s.version,
68
+ INSERT INTO versions(review_id,version,snapshot,thread_id,author_kind) SELECT s.review_id,s.version,
58
69
  CASE WHEN json_type(s.snapshot,'$.target')='object'
59
70
  THEN json_set(s.snapshot,'$.pins.repositoryId',r.new_id,'$.target.repositoryId',r.new_id)
60
- ELSE json_set(s.snapshot,'$.pins.repositoryId',r.new_id) END
71
+ ELSE json_set(s.snapshot,'$.pins.repositoryId',r.new_id) END,
72
+ NULL, NULL
61
73
  FROM headless.versions s JOIN repository_ids r ON json_extract(s.snapshot,'$.pins.repositoryId')=r.old_id;
62
74
  INSERT INTO review_attention SELECT * FROM headless.review_attention;
63
75
  `);
@@ -1,7 +1,7 @@
1
- import { i as readReviewPackageVersion } from "./package-paths-C--__jEv.js";
2
- import { a as readReviewServerHealth, l as serverNotReady } from "./server-discovery-Bey8IqXH.js";
3
- import { c as stopBackgroundServer, o as recordedBackgroundServer, r as ensureBackgroundServer } from "./background-server-CkvxA-6O.js";
4
- import { t as ensureRemoteLanguageServer } from "./remote-language-server-BTKBQ7x4.js";
1
+ import { i as readReviewPackageVersion } from "./package-paths-BkeQsdaw.js";
2
+ import { a as readReviewServerHealth, l as serverNotReady } from "./server-discovery-DeVTdcqK.js";
3
+ import { c as stopBackgroundServer, o as recordedBackgroundServer, r as ensureBackgroundServer } from "./background-server-Xom8cA_u.js";
4
+ import { t as ensureRemoteLanguageServer } from "./remote-language-server-DLWluAeR.js";
5
5
  import path from "node:path";
6
6
  import { spawn } from "node:child_process";
7
7
  import { gt, valid } from "semver";
@@ -1,2 +1,2 @@
1
- import { t as ensureRemoteExtensions } from "./remote-extensions-Blcjr9Ze.js";
1
+ import { t as ensureRemoteExtensions } from "./remote-extensions-CYWNTVSf.js";
2
2
  export { ensureRemoteExtensions };
@@ -1,7 +1,7 @@
1
1
  import { u as parseJsonText } from "./src-X9phtB2j.js";
2
- import "./review-home-paths-j2BRAaNv.js";
3
- import { N as devReviewHome } from "./s3-config-BTO12tCC.js";
4
- import { t as findReviewPackageRoot } from "./package-paths-C--__jEv.js";
2
+ import "./review-home-paths-BwH08ihj.js";
3
+ import { N as devReviewHome } from "./s3-config-CjcLyFV5.js";
4
+ import { t as findReviewPackageRoot } from "./package-paths-BkeQsdaw.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { z } from "zod";
7
7
  import { createReadStream, createWriteStream } from "node:fs";
@@ -1,8 +1,8 @@
1
- import "./review-home-paths-j2BRAaNv.js";
2
- import { A as processStartIdentity, j as withFileLock } from "./s3-config-BTO12tCC.js";
3
- import { t as findReviewPackageRoot } from "./package-paths-C--__jEv.js";
4
- import { n as cliSpawn, s as spawnDetached } from "./background-server-CkvxA-6O.js";
5
- import { r as remoteServerPaths, t as ensureRemoteExtensions } from "./remote-extensions-Blcjr9Ze.js";
1
+ import "./review-home-paths-BwH08ihj.js";
2
+ import { A as processStartIdentity, j as withFileLock } from "./s3-config-CjcLyFV5.js";
3
+ import { t as findReviewPackageRoot } from "./package-paths-BkeQsdaw.js";
4
+ import { n as cliSpawn, s as spawnDetached } from "./background-server-Xom8cA_u.js";
5
+ import { r as remoteServerPaths, t as ensureRemoteExtensions } from "./remote-extensions-CYWNTVSf.js";
6
6
  import { randomBytes } from "node:crypto";
7
7
  import { z } from "zod";
8
8
  import { mkdir, readFile, rename, stat, writeFile } from "node:fs/promises";
@@ -1,9 +1,9 @@
1
- import { b as REVIEW_REMOTE_INSTALL_LOCK, x as REVIEW_REMOTE_WRAPPER_MARK } from "./src-DsM3jO8G.js";
2
- import "./review-home-paths-j2BRAaNv.js";
3
- import { M as DEV_REVIEW_HOME_ENV } from "./s3-config-BTO12tCC.js";
4
- import { c as stopBackgroundServer, o as recordedBackgroundServer } from "./background-server-CkvxA-6O.js";
5
- import { i as whiteboardRemoteHome } from "./remote-extensions-Blcjr9Ze.js";
6
- import { n as remoteLanguageServerGroups, r as stopProcessGroup } from "./remote-language-server-BTKBQ7x4.js";
1
+ import { C as REVIEW_REMOTE_INSTALL_LOCK, w as REVIEW_REMOTE_WRAPPER_MARK } from "./src-DYZLCUP_.js";
2
+ import "./review-home-paths-BwH08ihj.js";
3
+ import { M as DEV_REVIEW_HOME_ENV } from "./s3-config-CjcLyFV5.js";
4
+ import { c as stopBackgroundServer, o as recordedBackgroundServer } from "./background-server-Xom8cA_u.js";
5
+ import { i as whiteboardRemoteHome } from "./remote-extensions-CYWNTVSf.js";
6
+ import { n as remoteLanguageServerGroups, r as stopProcessGroup } from "./remote-language-server-DLWluAeR.js";
7
7
  import { existsSync } from "node:fs";
8
8
  import { lstat, mkdir, readFile, readdir, rm, stat } from "node:fs/promises";
9
9
  import path from "node:path";
@@ -1,6 +1,7 @@
1
1
  import { a as jsonNumber, c as jsonString, i as jsonBoolean, n as isJsonObject } from "./src-X9phtB2j.js";
2
- import { S as REVIEW_THEME_CHOICES, h as REVIEW_DIFF_LAYOUT_SCOPES, m as REVIEW_DIFF_LAYOUTS } from "./src-DsM3jO8G.js";
3
- import { n as askAgentIds } from "./thread-state-5pYr6_zM.js";
2
+ import { _ as REVIEW_DIFF_LAYOUTS, g as REVIEW_COLOR_THEME_KINDS, v as REVIEW_DIFF_LAYOUT_SCOPES } from "./src-DYZLCUP_.js";
3
+ import { t as SELECTION_UNAVAILABLE_REASONS } from "./lens-selection-BxPk53c8.js";
4
+ import { n as askAgentIds } from "./thread-state-BPpvKFwQ.js";
4
5
  import { z } from "zod";
5
6
  //#region src/telemetry-clean-text.ts
6
7
  const USER_DATA_REGEXES = [
@@ -155,6 +156,12 @@ const PEEK_VIA = [
155
156
  "diff_definition"
156
157
  ];
157
158
  const PEEK_ROOT_KIND = ["range"];
159
+ /** `unresolved`: progress finished without this selection; `error`: progress failed. */
160
+ const PEEK_FAILURE_REASON = [
161
+ ...SELECTION_UNAVAILABLE_REASONS,
162
+ "error",
163
+ "unresolved"
164
+ ];
158
165
  const LSP_FEATURE = [
159
166
  "hover",
160
167
  "goto_definition",
@@ -224,25 +231,32 @@ const SETTING_NAME = [
224
231
  "telemetry_enabled",
225
232
  "keymap",
226
233
  "software_map_enabled",
227
- "scratchpad_enabled",
234
+ "sharing_enabled",
228
235
  "diffr_config",
229
236
  "theme",
230
237
  "ctrl_tab",
231
238
  "open_files_in",
232
239
  "ready_notification",
233
240
  "document_width",
234
- "code_font_size"
241
+ "code_font_size",
242
+ "document_font_size",
243
+ "reading_font",
244
+ "code_font_family",
245
+ "font_ligatures",
246
+ "diff_font_size",
247
+ "diff_word_wrap",
248
+ "diff_ignore_whitespace"
235
249
  ];
236
250
  const REVIEW_OPENED_VIA = [
237
251
  "home",
238
252
  "cli",
239
253
  "other"
240
254
  ];
241
- /** Where a review's source comes from: its target's kind, or the one scratchpad. */
255
+ /** Where a review's source comes from: its target's kind. */
242
256
  const SESSION_SOURCE_KIND = [
243
257
  "worktree",
244
258
  "commits",
245
- "scratchpad"
259
+ "project"
246
260
  ];
247
261
  /**
248
262
  * The authoring agent a review session is attributed to. This is the one
@@ -324,12 +338,21 @@ const INSTALL_LOCATION = [
324
338
  ];
325
339
  const DIFF_OPENED_VIA = [
326
340
  "topbar",
341
+ "sidebar",
327
342
  "lens",
328
343
  "locate",
329
344
  "file_picker"
330
345
  ];
331
346
  /** Which diff opened: a commit's, or a file diff drawn plain or structural. */
332
347
  const DIFF_OPENED_KIND = ["commit", "structural"];
348
+ const DIFF_FAILED_REASON = [
349
+ "missing_binary",
350
+ "process_exit",
351
+ "stream_ended",
352
+ "aborted",
353
+ "file_error",
354
+ "other"
355
+ ];
333
356
  /** GitHub Enterprise is any GitHub host but github.com. */
334
357
  const PR_PROVIDER = [
335
358
  "github",
@@ -356,7 +379,12 @@ const ONBOARDING_STEP = [
356
379
  "run"
357
380
  ];
358
381
  const RUN_MODE = ["draw", "copy"];
359
- const NEW_WHITEBOARD_VIA = ["button", "command"];
382
+ const NEW_WHITEBOARD_VIA = [
383
+ "button",
384
+ "command",
385
+ "sidebar"
386
+ ];
387
+ const NEW_WHITEBOARD_MODE = [...RUN_MODE, "empty"];
360
388
  const FIND_SURFACE = ["review", "diff"];
361
389
  const DISCORD_VIA = [
362
390
  "topbar",
@@ -455,10 +483,6 @@ const UI_TELEMETRY_EVENTS = {
455
483
  event: "review_map_expanded",
456
484
  properties: { level: MAP_LEVEL }
457
485
  },
458
- commit_expanded: {
459
- event: "review_commit_expanded",
460
- properties: { expanded: "boolean" }
461
- },
462
486
  commit_diff_opened: {
463
487
  event: "review_commit_diff_opened",
464
488
  properties: { via: COMMIT_DIFF_VIA }
@@ -607,7 +631,7 @@ const UI_TELEMETRY_EVENTS = {
607
631
  properties: {
608
632
  setting: SETTING_NAME,
609
633
  enabled: "boolean",
610
- value: REVIEW_THEME_CHOICES
634
+ value: REVIEW_COLOR_THEME_KINDS
611
635
  }
612
636
  },
613
637
  review_opened: {
@@ -677,9 +701,12 @@ const UI_TELEMETRY_EVENTS = {
677
701
  via: DIFF_OPENED_VIA
678
702
  }
679
703
  },
680
- scratchpad_opened: {
681
- event: "review_scratchpad_opened",
682
- properties: {}
704
+ diff_failed: {
705
+ event: "review_diff_failed",
706
+ properties: {
707
+ reason: DIFF_FAILED_REASON,
708
+ files: "number"
709
+ }
683
710
  },
684
711
  discord_clicked: {
685
712
  event: "review_discord_clicked",
@@ -699,7 +726,10 @@ const UI_TELEMETRY_EVENTS = {
699
726
  },
700
727
  peek_resolve_failed: {
701
728
  event: "review_peek_resolve_failed",
702
- properties: { root_kind: PEEK_ROOT_KIND }
729
+ properties: {
730
+ root_kind: PEEK_ROOT_KIND,
731
+ reason: PEEK_FAILURE_REASON
732
+ }
703
733
  },
704
734
  review_deleted: {
705
735
  event: "review_review_deleted",
@@ -744,7 +774,7 @@ const UI_TELEMETRY_EVENTS = {
744
774
  new_whiteboard_started: {
745
775
  event: "review_new_whiteboard_started",
746
776
  properties: {
747
- mode: RUN_MODE,
777
+ mode: NEW_WHITEBOARD_MODE,
748
778
  embedded: "boolean",
749
779
  agent: askAgentIds
750
780
  }
@@ -882,6 +912,13 @@ function isValidReviewAppSessionId(value) {
882
912
  */
883
913
  const REVIEW_VIA_HEADER = "x-review-via";
884
914
  const REVIEW_AGENT_HEADER = "x-review-agent";
915
+ /** The Ask thread a request comes from. The CLI reads it from ASK_THREAD_ENV,
916
+ * which Desktop sets for the thread's agent. */
917
+ const REVIEW_THREAD_HEADER = "x-review-thread";
918
+ const ASK_THREAD_ENV = "DEV_REVIEW_ASK_THREAD";
919
+ /** Set by Desktop and the canvas on a command a person gave, such as a new
920
+ * board from the sidebar; its version is credited to them. */
921
+ const REVIEW_PERSON_HEADER = "x-review-person";
885
922
  const viaSchema = z.enum([
886
923
  "api",
887
924
  "mcp",
@@ -897,4 +934,4 @@ function reviewRequestOrigin(headers) {
897
934
  } : { via };
898
935
  }
899
936
  //#endregion
900
- export { REVIEW_APP_SESSION_ID_HEADER as a, sanitizeUiTelemetryEvent as c, BUNDLE_FRAME_PATTERN as i, cleanTelemetryText as l, REVIEW_VIA_HEADER as n, REVIEW_TELEMETRY_TABS as o, reviewRequestOrigin as r, isReportableCleanedMessage as s, REVIEW_AGENT_HEADER as t };
937
+ export { REVIEW_VIA_HEADER as a, REVIEW_APP_SESSION_ID_HEADER as c, sanitizeUiTelemetryEvent as d, cleanTelemetryText as f, REVIEW_THREAD_HEADER as i, REVIEW_TELEMETRY_TABS as l, REVIEW_AGENT_HEADER as n, reviewRequestOrigin as o, REVIEW_PERSON_HEADER as r, BUNDLE_FRAME_PATTERN as s, ASK_THREAD_ENV as t, isReportableCleanedMessage as u };
@@ -1,5 +1,5 @@
1
- import { o as parseReviewVerbResponse } from "./src-DsM3jO8G.js";
2
- import { b as selectReviewInstance, m as healthyReviewInstance, v as reviewInstanceStartHint, y as reviewInstanceUnavailable } from "./server-discovery-Bey8IqXH.js";
1
+ import { o as parseReviewVerbResponse } from "./src-DYZLCUP_.js";
2
+ import { b as selectReviewInstance, m as healthyReviewInstance, v as reviewInstanceStartHint, y as reviewInstanceUnavailable } from "./server-discovery-DeVTdcqK.js";
3
3
  import { closeSync, existsSync, fstatSync, mkdtempSync, openSync, readSync } from "node:fs";
4
4
  import path from "node:path";
5
5
  import { homedir, tmpdir } from "node:os";
@@ -1,7 +1,7 @@
1
- import { d as git, f as gitAt, y as resolveRepoContext } from "./src-BMPuxWv4.js";
1
+ import { b as resolveRepoContext, d as git, f as gitAt, w as runVcs } from "./src-DtfSndqS.js";
2
2
  import { a as jsonNumber, c as jsonString, i as jsonBoolean, m as isStringValue, n as isJsonObject, o as jsonObject, r as jsonArray, t as isJsonArray, u as parseJsonText } from "./src-X9phtB2j.js";
3
3
  import { a as TRACE_STORE_CLIENT_ID, b as commitShaSchema, c as deleteStoreResponseSchema, d as listUploadsResponseSchema, f as storeErrorCodeSchema, g as uploadManifestMismatch, h as traceObjectNameSchema, i as storeRoutes, l as listSessionsResponseSchema, m as storeResponseSchema, n as DEVICE_TOKEN_PATH, o as beginUploadResponseSchema, p as storeErrorEnvelopeSchema, r as SESSION_PATH, s as completeUploadResponseSchema, t as DEVICE_CODE_PATH, u as listUploadsQuerySchema, x as sessionIdSchema } from "./src-CGP5ytbV.js";
4
- import { E as writeTraceConfigFile, F as writeFileAtomic, I as writeFileAtomicAsync, L as writePrivateJsonAtomic, N as devReviewHome, P as normalizeStoreOrigin, S as readTraceConfigFile, _ as emptyTraceConfig, b as hostedCaptureEnabled, c as resolveS3Setup, d as traceEnvPath, f as traceEnvValue$1, g as currentStore, h as TraceConfigurationError, i as isS3MockMode, l as s3CacheIdentity, m as DEFAULT_HOSTED_ORIGIN, n as clearTraceEnvCache$1, p as traceSettingsPath, u as s3MockRoot, v as enabledOriginsOf, w as s3Store, x as hostedOrigin, y as hasHostedStore } from "./s3-config-BTO12tCC.js";
4
+ import { E as writeTraceConfigFile, F as writeFileAtomic, I as writeFileAtomicAsync, L as writePrivateJsonAtomic, N as devReviewHome, P as normalizeStoreOrigin, S as readTraceConfigFile, _ as emptyTraceConfig, b as hostedCaptureEnabled, c as resolveS3Setup, d as traceEnvPath, f as traceEnvValue$1, g as currentStore, h as TraceConfigurationError, i as isS3MockMode, l as s3CacheIdentity, m as DEFAULT_HOSTED_ORIGIN, n as clearTraceEnvCache$1, p as traceSettingsPath, u as s3MockRoot, v as enabledOriginsOf, w as s3Store, x as hostedOrigin, y as hasHostedStore } from "./s3-config-CjcLyFV5.js";
5
5
  import { t as errorMessage } from "./error-message-OtiDonty.js";
6
6
  import crypto, { createHash, randomBytes } from "node:crypto";
7
7
  import { z } from "zod";
@@ -9,8 +9,7 @@ import { accessSync, closeSync, constants, createReadStream, createWriteStream,
9
9
  import { chmod, mkdir, mkdtemp, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
10
10
  import path from "node:path";
11
11
  import os, { homedir, tmpdir } from "node:os";
12
- import { execFile, spawn } from "node:child_process";
13
- import { promisify } from "node:util";
12
+ import { spawn } from "node:child_process";
14
13
  import { Readable, Transform } from "node:stream";
15
14
  import { AsyncLocalStorage } from "node:async_hooks";
16
15
  import { pipeline } from "node:stream/promises";
@@ -401,14 +400,18 @@ async function runStoreLogin(input) {
401
400
  } catch (error) {
402
401
  return failWithJsonError(output, "login", error instanceof StoreApiError ? error.message : "Could not start the login.");
403
402
  }
403
+ const pending = {
404
+ url: device.verification_uri_complete,
405
+ userCode: device.user_code
406
+ };
404
407
  humanStream(output).write(`Open ${device.verification_uri_complete}\n`);
405
408
  humanStream(output).write(`Code: ${device.user_code}\n`);
406
409
  emitJsonEvent(output, {
407
410
  event: "login",
408
411
  status: "pending",
409
- url: device.verification_uri_complete,
410
- userCode: device.user_code
412
+ ...pending
411
413
  });
414
+ input.onDeviceCode?.(pending);
412
415
  if (!input.noBrowser) await openUrl(device.verification_uri_complete);
413
416
  let intervalMs = Math.max(1, device.interval) * 1e3;
414
417
  const expiresAt = Date.now() + device.expires_in * 1e3;
@@ -2537,7 +2540,7 @@ function isTraceStorageConfigured(scope = {}) {
2537
2540
  }
2538
2541
  /** Loads the direct-store implementation on demand, without opening a store. */
2539
2542
  async function loadS3TraceStorage() {
2540
- return (await import("./s3-DtJFWC0G.js")).S3TraceStorage;
2543
+ return (await import("./s3-CsG2EWED.js")).S3TraceStorage;
2541
2544
  }
2542
2545
  //#endregion
2543
2546
  //#region ../trace-core/src/trace-upload-status.ts
@@ -5263,7 +5266,7 @@ async function configureTraceMachine(input) {
5263
5266
  if (input.verify !== false) {
5264
5267
  if (env.TRACE_R2_MODE === "mock") verifiedAt = (/* @__PURE__ */ new Date()).toISOString();
5265
5268
  else {
5266
- const { S3TraceStorage } = await import("./s3-DtJFWC0G.js");
5269
+ const { S3TraceStorage } = await import("./s3-CsG2EWED.js");
5267
5270
  const readiness = await S3TraceStorage.fromCredentials({
5268
5271
  endpoint: credentials.endpoint,
5269
5272
  bucket: credentials.bucket,
@@ -5397,7 +5400,6 @@ async function writeSettings(filePath, settings) {
5397
5400
  }
5398
5401
  //#endregion
5399
5402
  //#region ../trace-core/src/trace-hook-runner.ts
5400
- const execFileAsync = promisify(execFile);
5401
5403
  const SESSION_ID_REGEX = /^[A-Za-z0-9][A-Za-z0-9._-]{7,127}$/;
5402
5404
  /**
5403
5405
  * Starts `whiteboard trace sync` detached for one session. The attempt names
@@ -5479,7 +5481,7 @@ async function runTraceHook(input) {
5479
5481
  ], { allowFailure: true });
5480
5482
  let sessionFilePath = null;
5481
5483
  if (gitPathResult.ok && gitPathResult.stdout.trim()) sessionFilePath = gitPathResult.stdout.trim();
5482
- const jjRootResult = await execFileAsync("jj", ["root"], { cwd: input.cwd }).catch(() => null);
5484
+ const jjRootResult = await runVcs("jj", ["root"], { cwd: input.cwd }).catch(() => null);
5483
5485
  if (!sessionFilePath && jjRootResult?.stdout.trim()) sessionFilePath = path.join(jjRootResult.stdout.trim(), ".jj", "agent-session");
5484
5486
  let remainingSessions = [];
5485
5487
  if (sessionFilePath) {
@@ -5498,24 +5500,24 @@ async function runTraceHook(input) {
5498
5500
  if (jjRootResult?.stdout.trim()) {
5499
5501
  if ((isStart || isHeartbeat) && remainingSessions.length > 0) {
5500
5502
  const templateVal = jjCommitTrailersConfigValue(remainingSessions);
5501
- await execFileAsync("jj", [
5503
+ await runVcs("jj", [
5502
5504
  "config",
5503
5505
  "set",
5504
5506
  "--repo",
5505
5507
  "templates.commit_trailers",
5506
- templateVal
5508
+ { value: templateVal }
5507
5509
  ], { cwd: input.cwd }).catch(() => void 0);
5508
5510
  } else if (isEnd) {
5509
5511
  if (remainingSessions.length > 0) {
5510
5512
  const templateVal = jjCommitTrailersConfigValue(remainingSessions);
5511
- await execFileAsync("jj", [
5513
+ await runVcs("jj", [
5512
5514
  "config",
5513
5515
  "set",
5514
5516
  "--repo",
5515
5517
  "templates.commit_trailers",
5516
- templateVal
5518
+ { value: templateVal }
5517
5519
  ], { cwd: input.cwd }).catch(() => void 0);
5518
- } else await execFileAsync("jj", [
5520
+ } else await runVcs("jj", [
5519
5521
  "config",
5520
5522
  "unset",
5521
5523
  "--repo",
@@ -5734,7 +5736,7 @@ async function runTraceStatus(input) {
5734
5736
  input.stderr.write("Upload status filters require hosted storage.\n");
5735
5737
  return 1;
5736
5738
  }
5737
- const [{ S3TraceStorage }, { describeS3Setup, noTraceConfigurationMessage }] = await Promise.all([import("./s3-DtJFWC0G.js"), import("./s3-config-CSy3fx8H.js")]);
5739
+ const [{ S3TraceStorage }, { describeS3Setup, noTraceConfigurationMessage }] = await Promise.all([import("./s3-CsG2EWED.js"), import("./s3-config-zz4GWh2T.js")]);
5738
5740
  const setup = describeS3Setup(input.scope.env);
5739
5741
  input.stdout.write(`Checking trace configuration (${setup.envPath})…\n`);
5740
5742
  for (const failure of await listTraceSyncFailures(input.scope.devHome)) input.stdout.write(describeTraceSyncFailure(failure));
@@ -6401,4 +6403,4 @@ function reviewDesktopStateDir(env = process.env) {
6401
6403
  return path.join(reviewDesktopRoot(env), "state");
6402
6404
  }
6403
6405
  //#endregion
6404
- export { resolveTraceCommand as $, runTraceDeny as A, TraceStorageDeniedError as B, disableTraceMachine as C, listReviewTraceSessions as D, traceMachineStatus as E, describeSelection as F, listTraceRepositoryRoots as G, resolveTraceRepositoryTarget as H, isTraceStorageConfigured as I, HOSTED_CAPTURE_SCOPE_DESCRIPTION as J, traceRepositoryStatus as K, loadS3TraceStorage as L, runTraceSessions as M, runTraceStoreDelete as N, loadReviewAgentTrace as O, runTraceStoreInfo as P, removeAgentTraceHook as Q, resolveTraceStorage as R, configureTraceMachine as S, traceMachineEnabled as T, disableAllTraceRepositories as U, requireTraceConsent as V, enableTraceRepository as W, describeTraceHookOwners as X, AGENT_TRACE_HOOK_AGENTS as Y, installHarnessHooks as Z, runTraceRepair as _, reviewInstancesDir as a, openUrlInBrowser as at, runTraceGitHook as b, registerTraceCommands as c, runStoreLogout as ct, runTraceList as d, StoreClient as dt, shellQuote as et, runTracePull as f, withStoreAuthorization as ft, runTraceInstallMachine as g, jsonRequestedInArgv as gt, runTraceEnable as h, humanStream as ht, reviewInstanceDiscoveryPath as i, clearStoreAuth as it, runTraceOnboard as j, runTraceAllow as k, resolveTraceReadStorage as l, runStoreWhoami as lt, runTraceDisable as m, failWithJsonError as mt, reviewDesktopStateDir as n, traceScope as nt, reviewLegacyDiscoveryPath as o, readStoreAuth as ot, runTraceShow as p, emitJsonEvent as pt, readTraceUserConfig as q, reviewDevInstanceKey as r, DEFAULT_STORE_ORIGIN as rt, safeStorageSegment as s, runStoreLogin as st, reviewDefaultInstancePath as t, traceHomeDir as tt, runTraceBlame as u, StoreApiError as ut, runTraceStatus as v, readLegacyCaptureSettings as w, runTraceHook as x, runTraceSync as y, selectTraceStorage as z };
6406
+ export { resolveTraceCommand as $, runTraceDeny as A, TraceStorageDeniedError as B, disableTraceMachine as C, listReviewTraceSessions as D, traceMachineStatus as E, describeSelection as F, listTraceRepositoryRoots as G, resolveTraceRepositoryTarget as H, isTraceStorageConfigured as I, HOSTED_CAPTURE_SCOPE_DESCRIPTION as J, traceRepositoryStatus as K, loadS3TraceStorage as L, runTraceSessions as M, runTraceStoreDelete as N, loadReviewAgentTrace as O, runTraceStoreInfo as P, removeAgentTraceHook as Q, resolveTraceStorage as R, configureTraceMachine as S, traceMachineEnabled as T, disableAllTraceRepositories as U, requireTraceConsent as V, enableTraceRepository as W, describeTraceHookOwners as X, AGENT_TRACE_HOOK_AGENTS as Y, installHarnessHooks as Z, runTraceRepair as _, reviewInstancesDir as a, readStoreAuth as at, runTraceGitHook as b, registerTraceCommands as c, runStoreWhoami as ct, runTraceList as d, withStoreAuthorization as dt, shellQuote as et, runTracePull as f, emitJsonEvent as ft, runTraceInstallMachine as g, runTraceEnable as h, jsonRequestedInArgv as ht, reviewInstanceDiscoveryPath as i, clearStoreAuth as it, runTraceOnboard as j, runTraceAllow as k, resolveTraceReadStorage as l, StoreApiError as lt, runTraceDisable as m, humanStream as mt, reviewDesktopStateDir as n, traceScope as nt, reviewLegacyDiscoveryPath as o, runStoreLogin as ot, runTraceShow as p, failWithJsonError as pt, readTraceUserConfig as q, reviewDevInstanceKey as r, DEFAULT_STORE_ORIGIN as rt, safeStorageSegment as s, runStoreLogout as st, reviewDefaultInstancePath as t, traceHomeDir as tt, runTraceBlame as u, StoreClient as ut, runTraceStatus as v, readLegacyCaptureSettings as w, runTraceHook as x, runTraceSync as y, selectTraceStorage as z };
@@ -1,9 +1,9 @@
1
1
  import { c as jsonString, l as jsonValueSchema, o as jsonObject, u as parseJsonText } from "./src-X9phtB2j.js";
2
- import "./src-DsM3jO8G.js";
3
- import "./review-home-paths-j2BRAaNv.js";
4
- import { F as writeFileAtomic, N as devReviewHome, j as withFileLock, k as processIsAlive } from "./s3-config-BTO12tCC.js";
5
- import { i as readReviewPackageVersion, t as findReviewPackageRoot } from "./package-paths-C--__jEv.js";
6
- import "./request-origin-Zcn_CjX4.js";
2
+ import "./src-DYZLCUP_.js";
3
+ import "./review-home-paths-BwH08ihj.js";
4
+ import { F as writeFileAtomic, N as devReviewHome, j as withFileLock, k as processIsAlive } from "./s3-config-CjcLyFV5.js";
5
+ import { i as readReviewPackageVersion, t as findReviewPackageRoot } from "./package-paths-BkeQsdaw.js";
6
+ import "./request-origin-icXPv6jh.js";
7
7
  import { createHmac, randomUUID } from "node:crypto";
8
8
  import { z } from "zod";
9
9
  import { existsSync, readFileSync, rmSync } from "node:fs";
@@ -116,7 +116,7 @@ function parseFrame(frame, platform, chunkIds) {
116
116
  if (chunkId) parsed.chunk_id = chunkId;
117
117
  return [parsed];
118
118
  }
119
- const DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com";
119
+ const DEFAULT_POSTHOG_HOST = "https://e.dev.fast";
120
120
  const DEFAULT_CAPTURE_TIMEOUT_MS = 1e3;
121
121
  const QUEUE_LIMIT = 1e3;
122
122
  const BATCH_LIMIT = 50;
@@ -0,0 +1,27 @@
1
+ import { w as runVcs } from "./src-DtfSndqS.js";
2
+ import path from "node:path";
3
+ //#region src/runtime.ts
4
+ async function resolveReviewRoot(cwd, execFile = execFilePromise) {
5
+ const initialCwd = path.resolve(cwd);
6
+ try {
7
+ const { stdout } = await execFile("jj", ["root"], { cwd: initialCwd });
8
+ const root = stdout.trim();
9
+ if (root) return path.resolve(root);
10
+ } catch {}
11
+ try {
12
+ const { stdout } = await execFile("git", [
13
+ "-C",
14
+ initialCwd,
15
+ "rev-parse",
16
+ "--show-toplevel"
17
+ ]);
18
+ const root = stdout.trim();
19
+ if (root) return path.resolve(root);
20
+ } catch {}
21
+ return initialCwd;
22
+ }
23
+ function execFilePromise(file, args, options = {}) {
24
+ return runVcs(file, args, options);
25
+ }
26
+ //#endregion
27
+ export { resolveReviewRoot as t };
package/dist/runtime.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region src/runtime.d.ts
2
2
  declare function resolveReviewRoot(cwd: string, execFile?: typeof execFilePromise): Promise<string>;
3
- declare function execFilePromise(file: string, args: string[], options?: {
3
+ declare function execFilePromise(file: "git" | "jj", args: string[], options?: {
4
4
  cwd?: string;
5
5
  }): Promise<{
6
6
  stdout: string;
package/dist/runtime.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as resolveReviewRoot } from "./runtime-CKiWhGrf.js";
1
+ import { t as resolveReviewRoot } from "./runtime-CF4JXdb8.js";
2
2
  export { resolveReviewRoot };
@@ -1,6 +1,6 @@
1
1
  import { a as jsonNumber, c as jsonString, o as jsonObject, r as jsonArray, u as parseJsonText } from "./src-X9phtB2j.js";
2
2
  import { S as sessionMetaSchema, b as commitShaSchema, y as byCommitSchema } from "./src-CGP5ytbV.js";
3
- import { i as isS3MockMode, l as s3CacheIdentity, s as resolveS3Credentials, u as s3MockRoot } from "./s3-config-BTO12tCC.js";
3
+ import { i as isS3MockMode, l as s3CacheIdentity, s as resolveS3Credentials, u as s3MockRoot } from "./s3-config-CjcLyFV5.js";
4
4
  import { t as errorMessage } from "./error-message-OtiDonty.js";
5
5
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
6
6
  import path from "node:path";
@@ -169,11 +169,13 @@ const DEV_REVIEW_HOME_ENV = "DEV_REVIEW_HOME";
169
169
  * The one resolver for the Review home directory. Every reader of
170
170
  * DEV_REVIEW_HOME calls this, so an untrimmed or empty value cannot make two
171
171
  * modules disagree about the directory. An empty value means "use the
172
- * default".
172
+ * default", which is ~/.dev-preview for preview.
173
173
  */
174
174
  function devReviewHome(env = process.env, homeDir = os.homedir()) {
175
175
  const override = env[DEV_REVIEW_HOME_ENV]?.trim();
176
- return override ? path.resolve(override) : path.join(homeDir, ".dev");
176
+ if (override) return path.resolve(override);
177
+ const channel = env.DEV_FAST_REVIEW_CHANNEL?.trim() || env.DEV_REVIEW_INSTANCE?.trim();
178
+ return path.join(homeDir, channel === "preview" ? ".dev-preview" : ".dev");
177
179
  }
178
180
  //#endregion
179
181
  //#region ../trace-core/src/with-file-lock.ts
@@ -1,2 +1,2 @@
1
- import { a as noTraceConfigurationMessage, c as resolveS3Setup, d as traceEnvPath, f as traceEnvValue, i as isS3MockMode, l as s3CacheIdentity, n as clearTraceEnvCache, o as readTraceEnvFile, p as traceSettingsPath, r as describeS3Setup, s as resolveS3Credentials, t as S3_DEFAULT_REGION, u as s3MockRoot } from "./s3-config-BTO12tCC.js";
1
+ import { a as noTraceConfigurationMessage, c as resolveS3Setup, d as traceEnvPath, f as traceEnvValue, i as isS3MockMode, l as s3CacheIdentity, n as clearTraceEnvCache, o as readTraceEnvFile, p as traceSettingsPath, r as describeS3Setup, s as resolveS3Credentials, t as S3_DEFAULT_REGION, u as s3MockRoot } from "./s3-config-CjcLyFV5.js";
2
2
  export { S3_DEFAULT_REGION, clearTraceEnvCache, describeS3Setup, isS3MockMode, noTraceConfigurationMessage, readTraceEnvFile, resolveS3Credentials, resolveS3Setup, s3CacheIdentity, s3MockRoot, traceEnvPath, traceEnvValue, traceSettingsPath };