@dev.fast/whiteboard 0.3.5-preview.20261022.134 → 0.3.5-preview.20261023.135

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.
@@ -0,0 +1,2 @@
1
+ import { n as runReviewAgentCli } from "./agent-cli-BMm7SuZF.js";
2
+ export { runReviewAgentCli };
@@ -44,7 +44,7 @@ async function runReviewAgentCli(input) {
44
44
  [REVIEW_THREAD_HEADER, thread ?? ""]
45
45
  ]);
46
46
  if (mode === "mcp") {
47
- const { serveReviewMcp } = await import("./mcp-IkZ0jBxU.js");
47
+ const { serveReviewMcp } = await import("./mcp-mroZC5-9.js");
48
48
  exitOnInstallUpdate(input.stderr);
49
49
  await serveReviewMcp(async (key, agentKind) => {
50
50
  const connected = await connectReviewInstance(key ? {
@@ -1,6 +1,6 @@
1
1
  import { n as isJsonObject } from "./src-X9phtB2j.js";
2
- import { c as activityBeginSchema, l as activityEndSchema, n as uploadSchema, r as commandSchema, u as activityUpdateSchema } from "./local-data-m4BCbtSA.js";
3
- import { I as publishedEditSchema, M as pathTargetSchema } from "./stored-document-migration-B-lTO-_P.js";
2
+ import { c as activityBeginSchema, l as activityEndSchema, n as uploadSchema, r as commandSchema, u as activityUpdateSchema } from "./local-data-HEAXumv5.js";
3
+ import { L as publishedEditSchema, N as pathTargetSchema } from "./stored-document-migration-DEt8iwem.js";
4
4
  import { t as ReviewInputError } from "./input-error-OLgB_h31.js";
5
5
  import { t as findReviewPackageRoot } from "./package-paths-BeYHYjeR.js";
6
6
  import { z } from "zod";
@@ -1 +1 @@
1
- {"version":"0.3.5-preview.20261022.134","commit":"e6b58d262b3ad613be4acc3a53b79c8720ba6a0b","dirty":true,"builtAt":"2026-10-22T19:59:15.711Z"}
1
+ {"version":"0.3.5-preview.20261023.135","commit":"df0b0764e064a9868ca27f0ea13db56c272bd223","dirty":true,"builtAt":"2026-10-23T06:38:34.826Z"}
@@ -13,7 +13,7 @@ import { t as ReviewTelemetry } from "./review-telemetry-BM-_KdLi.js";
13
13
  import { t as fuzzyRank } from "./fuzzy-match-CfSxqzBF.js";
14
14
  import { _ as isInstallTarget, a as isOwnedShim, f as windowsInstallerCommand, g as ALL_INSTALL_TARGETS, h as detectConnectAgents, m as connectAgent, o as pathShimPath, p as scanLegacySkills, t as aliasInstallationToAccount, v as connectPrompts } from "./account-alias-2yTAxoBx.js";
15
15
  import { n as focusReviewDesktop, r as runReviewAppLaunch } from "./review-app-launcher-BZAnR8Vp.js";
16
- import { t as reviewAgentCliHelp } from "./agent-cli-DpSj5jCW.js";
16
+ import { t as reviewAgentCliHelp } from "./agent-cli-BMm7SuZF.js";
17
17
  import { existsSync, mkdirSync, renameSync, writeFileSync } from "node:fs";
18
18
  import { realpath } from "node:fs/promises";
19
19
  import path from "node:path";
@@ -4356,7 +4356,7 @@ async function runReviewCli(input) {
4356
4356
  process.once("SIGINT", stop);
4357
4357
  process.once("SIGTERM", stop);
4358
4358
  process.once(DESKTOP_TAKEOVER_SIGNAL, takeover);
4359
- const { HeadlessServerBusyError, runHeadlessServer } = await import("./headless-host-Ck5-JjGV.js");
4359
+ const { HeadlessServerBusyError, runHeadlessServer } = await import("./headless-host-BqhXupMu.js");
4360
4360
  try {
4361
4361
  await runHeadlessServer({
4362
4362
  stateDir,
@@ -4421,7 +4421,7 @@ async function runReviewCli(input) {
4421
4421
  if (!existsSync(path.join(stateDir, "review-api.db"))) throw new Error(`No saved reviews in ${stateDir}, so there is no server id to reset. Check --state-dir.`);
4422
4422
  const inUse = `A Whiteboard server is using ${stateDir}. Stop it first, then run whiteboard server reset-id again.`;
4423
4423
  if (await desktopUsesHome(stateDir, env)) return refuse(inUse, options.json);
4424
- const [{ openReviewProfile }, { withHeadlessServerLock }] = await Promise.all([import("./profile-BfY9lECc.js"), import("./headless-host-Ck5-JjGV.js")]);
4424
+ const [{ openReviewProfile }, { withHeadlessServerLock }] = await Promise.all([import("./profile-wmzgPWK8.js"), import("./headless-host-BqhXupMu.js")]);
4425
4425
  const reset = await withHeadlessServerLock(await realpath(stateDir), async () => {
4426
4426
  const local = await openReviewProfile(stateDir, { manageWorkspaces: false });
4427
4427
  try {
@@ -4795,7 +4795,7 @@ async function runReviewCli(input) {
4795
4795
  return commands;
4796
4796
  } });
4797
4797
  for (const [name, description] of [["api", "Call a JSON review authoring tool on the running server"], ["mcp", "Serve the JSON review authoring tools over stdio MCP"]]) configureOutput(program.command(name).description(description).argument("[args...]", "tool name and JSON input").allowUnknownOption().allowExcessArguments().helpOption(false).passThroughOptions().addHelpText("after", `\n${reviewAgentCliHelp}`), "plain").action(async (args) => {
4798
- const { runReviewAgentCli } = await import("./agent-cli-a7X9Th1U.js");
4798
+ const { runReviewAgentCli } = await import("./agent-cli-B388TP61.js");
4799
4799
  state.exitCode = await runReviewAgentCli({
4800
4800
  ...input,
4801
4801
  env: authoringEnv(),
package/dist/cli.js CHANGED
@@ -17,7 +17,7 @@ async function runCli(effectivePath) {
17
17
  `);
18
18
  return 1;
19
19
  }
20
- const { runReviewCli } = await import("./cli-runner-D1PRTICL.js");
20
+ const { runReviewCli } = await import("./cli-runner-BTIv01OF.js");
21
21
  return runReviewCli({
22
22
  argv,
23
23
  cliPaths: {
@@ -2,7 +2,7 @@ import { f as gitAt } from "./src-X9ZebeOD.js";
2
2
  import { n as isJsonObject, u as parseJsonText } from "./src-X9phtB2j.js";
3
3
  import "./src-DYHVzX3b.js";
4
4
  import { f as sourceAnchors } from "./lens-selection-9byzEgvU.js";
5
- import { $ as lensSchema, A as elements, E as boardRepositoryId, F as pinsSchema, G as sourceReferences, L as readsAtBoardPins, O as documentSchema, R as resourceReference, c as traceSchema, ct as parseMarkdown, et as lensSelections, n as migrateStoredDocument, ot as markdownNodes, q as checkReferences, r as migrateStoredLenses, s as softwareModelDataSchema, t as liftFileLenses, u as pullRequestUrl, x as anchorPins, y as textIncludesQuote, z as resourceReferences } from "./stored-document-migration-B-lTO-_P.js";
5
+ import { B as resourceReferences, D as boardRepositoryId, I as pinsSchema, J as checkReferences, K as sourceReferences, R as readsAtBoardPins, S as anchorPins, b as textIncludesQuote, c as traceSchema, et as lensSchema, j as elements, k as documentSchema, lt as parseMarkdown, n as migrateStoredDocument, r as migrateStoredLenses, s as softwareModelDataSchema, st as markdownNodes, t as liftFileLenses, tt as lensSelections, u as pullRequestUrl, z as resourceReference } from "./stored-document-migration-DEt8iwem.js";
6
6
  import { t as ReviewInputError } from "./input-error-OLgB_h31.js";
7
7
  import { createHash, randomUUID } from "node:crypto";
8
8
  import { z } from "zod";
@@ -483,9 +483,11 @@ const sharedSnapshotSchema = z.strictObject({
483
483
  origin: z.strictObject({
484
484
  branch: z.string().optional(),
485
485
  baseRef: z.string().optional(),
486
+ baseBranch: z.string().optional(),
486
487
  pullRequestNumber: z.number().int().positive().optional(),
487
488
  pullRequestUrl: pullRequestUrl.optional(),
488
489
  pullRequestTitle: z.string().optional(),
490
+ pullRequestBaseBranch: z.string().optional(),
489
491
  revision: z.string().optional()
490
492
  }).optional()
491
493
  });
@@ -1,2 +1,2 @@
1
- import { i as withHeadlessServerLock, n as runHeadlessServer, r as takeOverServerHome, t as HeadlessServerBusyError } from "./headless-host-D9y2sBIj.js";
1
+ import { i as withHeadlessServerLock, n as runHeadlessServer, r as takeOverServerHome, t as HeadlessServerBusyError } from "./headless-host-Sg_3jomq.js";
2
2
  export { HeadlessServerBusyError, runHeadlessServer, takeOverServerHome, withHeadlessServerLock };
@@ -1,11 +1,11 @@
1
1
  import { b as resolveRepoContext, d as git, r as defaultBranch, w as runVcs } from "./src-X9ZebeOD.js";
2
2
  import { c as jsonString, m as isStringValue, n as isJsonObject, p as isObjectValue, u as parseJsonText } from "./src-X9phtB2j.js";
3
- import { a as sharedReviewId, c as verifyShareRepository, d as validateShareSources, f as StreamLimitError, h as shareIdSchema, l as exportShare, m as parseShareLink, n as ShareClient, p as readBoundedStream, r as SharePreflightError, s as readShareRepository, t as ShareAuthError, u as referenceCommits } from "./client-CiB4MRlo.js";
4
- import { d as textualRows, f as invalidateStructuralComparisons, i as inspectSnapshot, m as diffrMissingError, p as diffrExecutable, r as commandSchema } from "./local-data-m4BCbtSA.js";
3
+ import { a as sharedReviewId, c as verifyShareRepository, d as validateShareSources, f as StreamLimitError, h as shareIdSchema, l as exportShare, m as parseShareLink, n as ShareClient, p as readBoundedStream, r as SharePreflightError, s as readShareRepository, t as ShareAuthError, u as referenceCommits } from "./client-p9WB8Sj0.js";
4
+ import { d as textualRows, f as invalidateStructuralComparisons, h as readGitHubPullRequests, i as inspectSnapshot, m as diffrMissingError, p as diffrExecutable, r as commandSchema } from "./local-data-HEAXumv5.js";
5
5
  import { N as reviewDiffrSummarizerInputSchema, O as ReviewFeedbackContactSchema, P as decodeStructuralDiffEvent, a as parseReviewVerbRequest, c as boardIconKind, i as parseReviewDesktopVerbResult, j as ReviewOnboardingRunRequestSchema, k as ReviewFeedbackSchema, l as boardTitle, m as REVIEW_CLIENT_REMOTE, p as REVIEW_CLIENT_HEADER, y as REVIEW_HOST_HEADER } from "./src-DYHVzX3b.js";
6
6
  import { $ as runStoreLogin, M as selectTraceStorage, N as TraceStorageDeniedError, Q as readStoreAuth, X as DEFAULT_STORE_ORIGIN, Z as clearStoreAuth, b as listReviewTraceSessions, j as resolveTraceStorage, k as isTraceStorageConfigured, q as shellQuote, v as traceMachineEnabled, x as loadReviewAgentTrace } from "./src-Z1x4-Qmb.js";
7
7
  import { _ as scopedCoverage, h as emptyCoverage, i as anchorSelection, l as resolveDiffSelection, m as coverageSources, n as SelectionUnavailableError, o as comparisonKey, s as formatAnchor, u as selectionKey, v as subtractIntervals, y as unionIntervals } from "./lens-selection-9byzEgvU.js";
8
- import { A as elements, E as boardRepositoryId, T as boardLinks, W as selectionReferences, X as UNCATEGORIZED_LENS_ID, Y as stepSources, et as lensSelections, rt as fileLineRangeSchema, x as anchorPins } from "./stored-document-migration-B-lTO-_P.js";
8
+ import { D as boardRepositoryId, E as boardLinks, G as selectionReferences, S as anchorPins, X as stepSources, Z as UNCATEGORIZED_LENS_ID, f as sourceBranchName, it as fileLineRangeSchema, j as elements, l as pullRequestKey, p as pullRequestProvider, tt as lensSelections } from "./stored-document-migration-DEt8iwem.js";
9
9
  import { t as ReviewInputError } from "./input-error-OLgB_h31.js";
10
10
  import { A as processStartIdentity, L as writePrivateJsonAtomic, N as devReviewHome, h as TraceConfigurationError, i as isS3MockMode, j as withFileLock } from "./s3-config-CjcLyFV5.js";
11
11
  import { t as errorMessage } from "./error-message-OtiDonty.js";
@@ -13,10 +13,10 @@ import { i as readReviewPackageVersion, n as readBuildCommit, t as findReviewPac
13
13
  import "./review-home-paths-CG-sb9Cw.js";
14
14
  import { _ as reviewInstanceIdentity, n as desktopOwnsHome, o as reviewServerDiscoveryPath, p as desktopUsesHome, r as headlessServerLockPath, t as DESKTOP_TAKEOVER_SIGNAL } from "./server-discovery-DKLIOgg3.js";
15
15
  import { c as askPicksSchema, d as selectionMarkdown, l as askQuestionSchema, n as askAgentIds, r as askChoiceKinds, s as askPermissionsSchema, t as applyAskChange, u as AgentSelectionSchema } from "./thread-state-CO97FUqK.js";
16
- import { t as openReviewProfile } from "./profile-BfvRNmRc.js";
16
+ import { t as openReviewProfile } from "./profile-BuyV9AEf.js";
17
17
  import { c as REVIEW_APP_SESSION_ID_HEADER, d as sanitizeUiTelemetryEvent, f as cleanTelemetryText, o as reviewRequestOrigin, r as REVIEW_PERSON_HEADER, s as BUNDLE_FRAME_PATTERN, t as ASK_THREAD_ENV, u as isReportableCleanedMessage } from "./request-origin-CNSLVn7x.js";
18
18
  import { a as defaultAskPermissions, i as askAgents, l as launchAskAgent, n as askAgentSettings, o as detectAskAgents, r as askAgentTakesMcp, t as fuzzyRank } from "./fuzzy-match-CfSxqzBF.js";
19
- import { a as inspectQuerySchema, i as renderInstructions, o as queryAnchor, r as instructionsQuerySchema, s as readQuerySchemas, t as authoringTools } from "./authoring-tools-BBksBplC.js";
19
+ import { a as inspectQuerySchema, i as renderInstructions, o as queryAnchor, r as instructionsQuerySchema, s as readQuerySchemas, t as authoringTools } from "./authoring-tools-BQW10hIy.js";
20
20
  import { a as headlessServerOwner, c as stopBackgroundServer, o as recordedBackgroundServer } from "./background-server-DHWHzpo5.js";
21
21
  import crypto$1, { createHash, randomBytes, randomUUID } from "node:crypto";
22
22
  import { z } from "zod";
@@ -2618,9 +2618,20 @@ const GitHubStacksSchema = z.array(z.object({ pull_requests: z.array(z.object({
2618
2618
  number: z.number().int().positive(),
2619
2619
  head: z.object({ ref: z.string().min(1) })
2620
2620
  })) }));
2621
+ /** The branch a review sits on: its PR's target, else the base it names. */
2622
+ const baseOf = (review) => sourceBranchName(review?.origin?.pullRequestBaseBranch ?? review?.origin?.baseBranch);
2623
+ /** A GitHub PR URL's host, owner/repo slug and number; else undefined. */
2624
+ function gitHubPullRequest(url) {
2625
+ const resolution = url ? pullRequestProvider(url) : void 0;
2626
+ return resolution?.provider.id === "github" ? resolution.address : void 0;
2627
+ }
2621
2628
  /** The review's GitHub stack, else the chain of reviews through its base. */
2622
2629
  async function resolveReviewStackLayers(subject, reviews, options = {}) {
2623
2630
  let entries = await gitHubStack(subject, reviews, options.runGitHubApi ?? defaultRunGitHubApi);
2631
+ if (entries.length < 2) {
2632
+ const discovered = await inferredGitHubStack(subject, reviews, options.runGitHubApi ?? defaultRunGitHubApi).catch(() => []);
2633
+ if (discovered.length > 1) entries = discovered;
2634
+ }
2624
2635
  if (!entries.length && options.repositoryPath) entries = await localStack(subject, reviews, options.repositoryPath);
2625
2636
  const currentIndex = entries.findIndex((entry) => entry.current);
2626
2637
  return entries.map((entry, index) => {
@@ -2659,14 +2670,13 @@ function readGitHubStacks(runGitHubApi, host, repository, pullRequestNumber) {
2659
2670
  return read.stacks;
2660
2671
  }
2661
2672
  async function gitHubStack(subject, reviews, runGitHubApi) {
2662
- const binding = subject.origin?.pullRequestUrl?.match(/^https:\/\/([a-z0-9.-]+)\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\/pull\/([1-9]\d*)$/);
2673
+ const binding = gitHubPullRequest(subject.origin?.pullRequestUrl);
2663
2674
  if (!binding) return [];
2664
- const [, host, owner, repository, number] = binding;
2665
- const pullRequestNumber = Number(number);
2666
- const repoKey = `https://${host}/${owner}/${repository}`;
2675
+ const { host, slug, number: pullRequestNumber } = binding;
2676
+ const repoKey = `https://${host}/${slug}`;
2667
2677
  let stacks;
2668
2678
  try {
2669
- stacks = await readGitHubStacks(runGitHubApi, host, `${owner}/${repository}`, pullRequestNumber);
2679
+ stacks = await readGitHubStacks(runGitHubApi, host, slug, pullRequestNumber);
2670
2680
  } catch {
2671
2681
  return [];
2672
2682
  }
@@ -2680,21 +2690,61 @@ async function gitHubStack(subject, reviews, runGitHubApi) {
2680
2690
  reviews: reviews.filter((candidate) => (candidate.origin?.pullRequestUrl?.replace(/\/pull\/\d+.*$/, "") ?? candidate.pins?.repositoryId) === repoKey && candidate.origin?.pullRequestNumber === pr.number)
2681
2691
  }));
2682
2692
  }
2693
+ /** A stack inferred from open PRs whose bases chain through this one's, for
2694
+ * repositories without GitHub stacks. Whiteboards only annotate the result. */
2695
+ async function inferredGitHubStack(subject, reviews, run) {
2696
+ const binding = gitHubPullRequest(subject.origin?.pullRequestUrl);
2697
+ if (!binding) return [];
2698
+ const graph = await readGitHubPullRequests(binding.host, binding.slug, run);
2699
+ const current = graph.find((pr) => pr.number === binding.number);
2700
+ if (!current) return [];
2701
+ const chain = [current];
2702
+ const seen = /* @__PURE__ */ new Set([current.headBranch]);
2703
+ const extend = (direction) => {
2704
+ let end = current;
2705
+ for (;;) {
2706
+ const matches = graph.filter((pr) => direction === "base" ? pr.headBranch === end.baseBranch : pr.baseBranch === end.headBranch);
2707
+ if (matches.length !== 1 || seen.has(matches[0].headBranch)) return;
2708
+ end = matches[0];
2709
+ seen.add(end.headBranch);
2710
+ if (direction === "base") chain.unshift(end);
2711
+ else chain.push(end);
2712
+ }
2713
+ };
2714
+ extend("base");
2715
+ extend("head");
2716
+ if (chain.length < 2) return [];
2717
+ const project = reviews.find((review) => review.reviewId === subject.reviewId)?.project?.id;
2718
+ return chain.map((pr) => ({
2719
+ branch: pr.headBranch,
2720
+ pullRequestNumber: pr.number,
2721
+ pullRequestUrl: pr.url,
2722
+ base: null,
2723
+ subject: pr.title,
2724
+ current: pr.number === current.number,
2725
+ reviews: reviews.filter((review) => {
2726
+ const candidateUrl = review.origin?.pullRequestUrl;
2727
+ if (candidateUrl) return pullRequestKey(candidateUrl) === pullRequestKey(pr.url);
2728
+ return (subject.pins?.repositoryId ? review.pins?.repositoryId === subject.pins.repositoryId : Boolean(project && review.project?.id === project)) && sourceBranchName(review.origin?.branch) === pr.headBranch;
2729
+ })
2730
+ }));
2731
+ }
2683
2732
  /** The chain of reviews through this one, linked by the base each names. */
2684
2733
  async function localStack(subject, reviews, repositoryPath) {
2685
2734
  const group = reviews.find((review) => review.reviewId === subject.reviewId)?.project?.id;
2686
- const current = subject.origin?.branch;
2735
+ const current = sourceBranchName(subject.origin?.branch);
2736
+ const currentBase = baseOf(subject);
2687
2737
  if (!group || !current) return [];
2688
- const main = subject.origin?.baseBranch ? await defaultBranch(repositoryPath).catch(() => null) : null;
2689
- const name = (ref) => ref.replace(/^origin\//, "");
2738
+ const main = currentBase ? await defaultBranch(repositoryPath).catch(() => null) : null;
2690
2739
  const inGroup = reviews.filter((review) => review.project?.id === group);
2740
+ const branchOf = (review) => sourceBranchName(review?.origin?.branch);
2691
2741
  const latest = (field, branch) => {
2692
- const matches = inGroup.filter((review) => review.origin?.[field] === branch);
2742
+ const matches = inGroup.filter((review) => (field === "branch" ? branchOf(review) : baseOf(review)) === branch);
2693
2743
  return matches.findLast((review) => !review.trashedAt) ?? matches.at(-1);
2694
2744
  };
2695
2745
  const branches = [current];
2696
- for (let base = subject.origin?.baseBranch; base && name(base) !== (main && name(main.ref)) && !branches.includes(base); base = latest("branch", base)?.origin?.baseBranch) branches.unshift(base);
2697
- for (let child = latest("baseBranch", current)?.origin?.branch; child && !branches.includes(child); child = latest("baseBranch", child)?.origin?.branch) branches.push(child);
2746
+ for (let base = currentBase; base && base !== (main && sourceBranchName(main.ref)) && !branches.includes(base); base = baseOf(latest("branch", base))) branches.unshift(base);
2747
+ for (let child = branchOf(latest("baseBranch", current)); child && !branches.includes(child); child = branchOf(latest("baseBranch", child))) branches.push(child);
2698
2748
  const bottom = branches[0];
2699
2749
  const start = latest("branch", bottom) || !main ? null : await forkPoint(repositoryPath, main.commit, bottom);
2700
2750
  if (!latest("branch", bottom) && !start) branches.shift();
@@ -2706,7 +2756,7 @@ async function localStack(subject, reviews, repositoryPath) {
2706
2756
  base: branch === bottom && start?.base || null,
2707
2757
  subject: branch === bottom && start?.subject || null,
2708
2758
  current: branch === current,
2709
- reviews: inGroup.filter((review) => review.origin?.branch === branch)
2759
+ reviews: inGroup.filter((review) => branchOf(review) === branch)
2710
2760
  }));
2711
2761
  }
2712
2762
  /** Where a local branch left `main`, and its oldest commit's subject. */
@@ -4536,8 +4586,9 @@ function createReviewApi(store, data, open, shared, capabilities = () => ({
4536
4586
  app.get("/:id/stack", async (context) => {
4537
4587
  const query = readQuerySchemas.get.parse(context.req.query());
4538
4588
  const id = context.req.param("id");
4539
- const snapshot = readReview(id, query.version);
4589
+ let snapshot = readReview(id, query.version);
4540
4590
  if (isShared(id) || !snapshot.pins) return context.json({ layers: [] });
4591
+ if (data) snapshot = await data.discoverPullRequest(snapshot);
4541
4592
  const repositoryPath = store.repositories().find((repository) => repository.id === snapshot.pins.repositoryId)?.path;
4542
4593
  const layers = await resolveReviewStackLayers(snapshot, store.list(), { repositoryPath });
4543
4594
  const trunk = layers.length > 1 && repositoryPath ? await defaultBranch(repositoryPath).catch(() => null) : null;
@@ -4637,7 +4688,8 @@ function createReviewApi(store, data, open, shared, capabilities = () => ({
4637
4688
  });
4638
4689
  app.get("/:id", async (context) => {
4639
4690
  const query = readQuerySchemas.get.parse(context.req.query());
4640
- const snapshot = { ...readReview(context.req.param("id"), query.version) };
4691
+ let snapshot = { ...readReview(context.req.param("id"), query.version) };
4692
+ if (data && query.full && query.version === void 0 && !isShared(snapshot.reviewId)) snapshot = await data.discoverPullRequest(snapshot);
4641
4693
  if (data && query.full) try {
4642
4694
  const pins = await data.sourcePins(snapshot);
4643
4695
  if (pins) snapshot.pins = pins;
@@ -4661,10 +4713,7 @@ function createReviewApi(store, data, open, shared, capabilities = () => ({
4661
4713
  app.post("/commands", async (context) => {
4662
4714
  const { command: body, open: requestedOpen } = takeCreateOpen(await readBoundedRequestJson(context.req.raw));
4663
4715
  const register = async (path) => data ? data.register(path) : store.registerRepository(path);
4664
- const request = withBoardRepository(await locateRepositories(await pullRequestTargets(body, register, (url, repositoryId) => {
4665
- if (!data) throw new ReviewInputError("Repositories are unavailable.");
4666
- return data.resolvePullRequest(url, { id: repositoryId });
4667
- }, (id) => store.read(id)), register), (id) => store.has(id) ? store.read(id) : void 0);
4716
+ const request = withBoardRepository(await locateRepositories(await pullRequestTargets(body, register, (id) => store.read(id)), register), (id) => store.has(id) ? store.read(id) : void 0);
4668
4717
  const input = commandSchema.parse(request);
4669
4718
  const command = sharedCommandSchema.safeParse(input);
4670
4719
  if (command.success && command.data.operation.reviewId?.startsWith("shared-")) {
@@ -4779,7 +4828,7 @@ async function locateRepositories(body, register) {
4779
4828
  }
4780
4829
  /** Turns an agent's pullRequest target into what the store takes: a create
4781
4830
  * from pullRequestUrl, or for set_target the PR's resolved commits. */
4782
- async function pullRequestTargets(body, register, resolve, board) {
4831
+ async function pullRequestTargets(body, register, board) {
4783
4832
  const target = z.strictObject({
4784
4833
  kind: z.literal("pullRequest"),
4785
4834
  repositoryPath: z.string().min(1),
@@ -4810,7 +4859,7 @@ async function pullRequestTargets(body, register, resolve, board) {
4810
4859
  ...located.data,
4811
4860
  operation: {
4812
4861
  ...operation,
4813
- target: (await resolve(url, repositoryId)).target,
4862
+ repositoryId,
4814
4863
  pullRequestUrl: url
4815
4864
  }
4816
4865
  };