@p4code/cli 0.6.18 → 0.6.19

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.
package/dist/bin.mjs CHANGED
@@ -268,7 +268,7 @@ const make$124 = () => {
268
268
  const layer$124 = Layer.sync(NetService, make$124);
269
269
  //#endregion
270
270
  //#region package.json
271
- var version$1 = "0.6.18";
271
+ var version$1 = "0.6.19";
272
272
  //#endregion
273
273
  //#region src/config.ts
274
274
  /**
@@ -2921,6 +2921,8 @@ const MODEL_SLUG_ALIASES_BY_PROVIDER = {
2921
2921
  "opus-4.6": "claude-opus-4-6",
2922
2922
  "claude-opus-4.6": "claude-opus-4-6",
2923
2923
  "claude-opus-4-6-20251117": "claude-opus-4-6",
2924
+ "sonnet-5.5": "claude-sonnet-5-5",
2925
+ "claude-sonnet-5.5": "claude-sonnet-5-5",
2924
2926
  sonnet: "claude-sonnet-5",
2925
2927
  "sonnet-5": "claude-sonnet-5",
2926
2928
  "claude-sonnet-5.0": "claude-sonnet-5",
@@ -3293,6 +3295,7 @@ const FUSION_RETRY_PROMPT_PREFIX = "[fusion-retry]";
3293
3295
  */
3294
3296
  const FUSION_REVIEW_MESSAGE_ID_PREFIX = "fusion-review:";
3295
3297
  const FUSION_GATE_MESSAGE_ID_PREFIX = "fusion-gate:";
3298
+ const FUSION_EVIDENCE_REPORT_REPAIR_MESSAGE_ID_PREFIX = "fusion-evidence-report-repair:";
3296
3299
  const FUSION_GATE_UNWATCHED_SUMMARY = "Gate passed unwatched";
3297
3300
  const FUSION_GATE_DEFAULT_TIMEOUT_MS = 12e4;
3298
3301
  const OrchestrationProposedPlanId = TrimmedNonEmptyString;
@@ -3401,7 +3404,8 @@ const JEV_CONSULTED_ACTIVITY_KIND = "jev.consulted";
3401
3404
  const JevConsultedFeature = Schema$1.Literals([
3402
3405
  "capability-hints",
3403
3406
  "auto-workspace",
3404
- "role-routing"
3407
+ "role-routing",
3408
+ "live-surface"
3405
3409
  ]);
3406
3410
  /**
3407
3411
  * Which Fusion role-routing decision a consultation answered: who owns a user
@@ -7803,7 +7807,9 @@ const ProviderSendTurnInput = Schema$1.Struct({
7803
7807
  interactionMode: Schema$1.optional(ProviderInteractionMode),
7804
7808
  compressMode: Schema$1.optional(CompressMode),
7805
7809
  unpromptedSubagents: Schema$1.optional(Schema$1.Boolean),
7806
- fusionRole: Schema$1.optional(FusionRole)
7810
+ fusionRole: Schema$1.optional(FusionRole),
7811
+ /** False when Jev judged the turn needs no Computer Use; omits its routing note. */
7812
+ computerUseGuidance: Schema$1.optional(Schema$1.Boolean)
7807
7813
  });
7808
7814
  Schema$1.Struct({
7809
7815
  threadId: ThreadId,
@@ -66873,7 +66879,7 @@ function hasValidClaudeManifestAdapters(manifest) {
66873
66879
  //#region src/provider/model-manifest.json
66874
66880
  var model_manifest_default = {
66875
66881
  version: 1,
66876
- updatedAt: "2026-09-04T19:10:48Z",
66882
+ updatedAt: "2026-09-28T20:00:00Z",
66877
66883
  currentModels: {
66878
66884
  "codex": [
66879
66885
  "gpt-6-astra",
@@ -66886,6 +66892,7 @@ var model_manifest_default = {
66886
66892
  "claudeAgent": [
66887
66893
  "claude-fable-5-1",
66888
66894
  "claude-opus-5",
66895
+ "claude-sonnet-5-5",
66889
66896
  "claude-sonnet-5"
66890
66897
  ],
66891
66898
  "antigravity": [
@@ -67404,6 +67411,15 @@ var model_manifest_default = {
67404
67411
  "status": "legacy",
67405
67412
  "profile": "opus-4-5"
67406
67413
  },
67414
+ {
67415
+ "slug": "claude-sonnet-5-5",
67416
+ "name": "Claude Sonnet 5.5",
67417
+ "aliases": ["sonnet-5.5", "claude-sonnet-5.5"],
67418
+ "status": "current",
67419
+ "badge": "new",
67420
+ "profile": "sonnet-5",
67421
+ "adapter": { "claudeCode": { "minVersion": "2.1.284" } }
67422
+ },
67407
67423
  {
67408
67424
  "slug": "claude-sonnet-5",
67409
67425
  "name": "Claude Sonnet 5",
@@ -68263,6 +68279,7 @@ const CLAUDE_PRESENTATION = {
68263
68279
  displayName: "Claude",
68264
68280
  showInteractionModeToggle: true
68265
68281
  };
68282
+ const MINIMUM_CLAUDE_SONNET_5_5_VERSION = "2.1.284";
68266
68283
  const MINIMUM_CLAUDE_FABLE_5_1_VERSION = "2.1.257";
68267
68284
  const MINIMUM_CLAUDE_OPUS_5_VERSION = "2.1.219";
68268
68285
  const MINIMUM_CLAUDE_FABLE_5_VERSION = "2.1.169";
@@ -68594,6 +68611,58 @@ const BUILT_IN_MODELS = [
68594
68611
  label: "Fast Mode"
68595
68612
  })] })
68596
68613
  },
68614
+ {
68615
+ slug: "claude-sonnet-5-5",
68616
+ name: "Claude Sonnet 5.5",
68617
+ isCustom: false,
68618
+ capabilities: createModelCapabilities({ optionDescriptors: [
68619
+ buildSelectOptionDescriptor({
68620
+ id: "effort",
68621
+ label: "Reasoning",
68622
+ options: [
68623
+ {
68624
+ value: "low",
68625
+ label: "Low"
68626
+ },
68627
+ {
68628
+ value: "medium",
68629
+ label: "Medium"
68630
+ },
68631
+ {
68632
+ value: "high",
68633
+ label: "High",
68634
+ isDefault: true
68635
+ },
68636
+ {
68637
+ value: "xhigh",
68638
+ label: "Extra High"
68639
+ },
68640
+ {
68641
+ value: "max",
68642
+ label: "Max"
68643
+ },
68644
+ {
68645
+ value: "ultrathink",
68646
+ label: "Ultrathink"
68647
+ }
68648
+ ],
68649
+ promptInjectedValues: ["ultrathink"]
68650
+ }),
68651
+ buildSelectOptionDescriptor({
68652
+ id: "contextWindow",
68653
+ label: "Context Window",
68654
+ options: [{
68655
+ value: "200k",
68656
+ label: "200k",
68657
+ isDefault: true
68658
+ }, {
68659
+ value: "1m",
68660
+ label: "1M"
68661
+ }]
68662
+ }),
68663
+ buildAutoCompactWindowDescriptor()
68664
+ ] })
68665
+ },
68597
68666
  {
68598
68667
  slug: "claude-sonnet-5",
68599
68668
  name: "Claude Sonnet 5",
@@ -68704,6 +68773,9 @@ const BUILT_IN_MODELS = [
68704
68773
  })] })
68705
68774
  }
68706
68775
  ];
68776
+ function supportsClaudeSonnet55(version) {
68777
+ return version ? compareSemverVersions(version, MINIMUM_CLAUDE_SONNET_5_5_VERSION) >= 0 : false;
68778
+ }
68707
68779
  function supportsClaudeOpus5(version) {
68708
68780
  return version ? compareSemverVersions(version, MINIMUM_CLAUDE_OPUS_5_VERSION) >= 0 : false;
68709
68781
  }
@@ -68721,6 +68793,7 @@ function supportsClaudeOpus47(version) {
68721
68793
  }
68722
68794
  function getBuiltInClaudeModelsForVersion(version) {
68723
68795
  return BUILT_IN_MODELS.filter((model) => {
68796
+ if (model.slug === "claude-sonnet-5-5") return supportsClaudeSonnet55(version);
68724
68797
  if (model.slug === "claude-fable-5-1") return supportsClaudeFable51(version);
68725
68798
  if (model.slug === "claude-opus-5") return supportsClaudeOpus5(version);
68726
68799
  if (model.slug === "claude-fable-5") return supportsClaudeFable5(version);
@@ -68749,6 +68822,9 @@ function mergeClaudeManifestModels(models, manifest, version) {
68749
68822
  }
68750
68823
  return additions.length === 0 ? models : [...models, ...additions];
68751
68824
  }
68825
+ function formatClaudeSonnet55UpgradeMessage(version) {
68826
+ return `Claude Code ${version ? `v${version}` : "the installed version"} is too old for Claude Sonnet 5.5. Upgrade to v${MINIMUM_CLAUDE_SONNET_5_5_VERSION} or newer to access it.`;
68827
+ }
68752
68828
  function formatClaudeFable51UpgradeMessage(version) {
68753
68829
  return `Claude Code ${version ? `v${version}` : "the installed version"} is too old for Claude Fable 5.1. Upgrade to v${MINIMUM_CLAUDE_FABLE_5_1_VERSION} or newer to access it.`;
68754
68830
  }
@@ -68804,7 +68880,7 @@ function normalizeClaudeCliEffort(effort, model, manifest, customModels = []) {
68804
68880
  if (catalog) return normalizeClaudeCatalogEffort(catalog, effort, model);
68805
68881
  if (!effort || effort === "ultrathink") return;
68806
68882
  if (effort === "ultracode") return "xhigh";
68807
- if (effort === "xhigh" && model !== "claude-fable-5-1" && model !== "claude-fable-5" && model !== "claude-opus-5" && model !== "claude-opus-4-8" && model !== "claude-sonnet-5") return "max";
68883
+ if (effort === "xhigh" && model !== "claude-fable-5-1" && model !== "claude-fable-5" && model !== "claude-opus-5" && model !== "claude-opus-4-8" && model !== "claude-sonnet-5-5" && model !== "claude-sonnet-5") return "max";
68808
68884
  if (effort === "max" && model === "claude-sonnet-4-6") return "high";
68809
68885
  return effort;
68810
68886
  }
@@ -69126,7 +69202,7 @@ const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(functio
69126
69202
  });
69127
69203
  }
69128
69204
  const models = providerModelsFromSettings(mergeClaudeManifestModels(getBuiltInClaudeModelsForVersion(parsedVersion), manifest, parsedVersion), claudeSettings.customModels, DEFAULT_CLAUDE_MODEL_CAPABILITIES);
69129
- const versionUpgradeMessage = supportsClaudeFable51(parsedVersion) ? void 0 : supportsClaudeOpus5(parsedVersion) ? formatClaudeFable51UpgradeMessage(parsedVersion) : supportsClaudeFable5(parsedVersion) ? formatClaudeOpus5UpgradeMessage(parsedVersion) : supportsClaudeOpus48(parsedVersion) ? formatClaudeFable5UpgradeMessage(parsedVersion) : supportsClaudeOpus47(parsedVersion) ? formatClaudeOpus48UpgradeMessage(parsedVersion) : formatClaudeOpus47UpgradeMessage(parsedVersion);
69205
+ const versionUpgradeMessage = supportsClaudeSonnet55(parsedVersion) ? void 0 : supportsClaudeFable51(parsedVersion) ? formatClaudeSonnet55UpgradeMessage(parsedVersion) : supportsClaudeOpus5(parsedVersion) ? formatClaudeFable51UpgradeMessage(parsedVersion) : supportsClaudeFable5(parsedVersion) ? formatClaudeOpus5UpgradeMessage(parsedVersion) : supportsClaudeOpus48(parsedVersion) ? formatClaudeFable5UpgradeMessage(parsedVersion) : supportsClaudeOpus47(parsedVersion) ? formatClaudeOpus48UpgradeMessage(parsedVersion) : formatClaudeOpus47UpgradeMessage(parsedVersion);
69130
69206
  const capabilities = resolveCapabilities ? yield* resolveCapabilities(claudeSettings).pipe(Effect.orElseSucceed(() => void 0)) : void 0;
69131
69207
  const skills = yield* discoverClaudeSkills(claudeSettings, cwd, resolvedEnvironment, disabledSkills);
69132
69208
  const dedupedSlashCommands = dedupeSlashCommands(capabilities?.slashCommands ?? []);
@@ -134516,6 +134592,12 @@ const makeProviderService = Effect.fn("makeProviderService")(function* (options)
134516
134592
  const serverSettings = yield* ServerSettingsService;
134517
134593
  const projectionQuery = yield* Effect.serviceOption(ProjectionSnapshotQuery);
134518
134594
  const pendingCompactions = /* @__PURE__ */ new Map();
134595
+ /**
134596
+ * The provider session whose conversation already carries the Computer Use
134597
+ * note, by thread. Jev may drop the note only on a later turn of that same
134598
+ * session; a new session, a compaction or a rollback sends it again.
134599
+ */
134600
+ const computerUseNoteSessions = /* @__PURE__ */ new Map();
134519
134601
  const timedOutNativeCompactions = /* @__PURE__ */ new Set();
134520
134602
  const settleCompaction = (threadId, pending, terminal) => Effect.gen(function* () {
134521
134603
  if (pendingCompactions.get(threadId) !== pending) return false;
@@ -134640,6 +134722,7 @@ const makeProviderService = Effect.fn("makeProviderService")(function* (options)
134640
134722
  provider: canonicalEvent.provider,
134641
134723
  eventType: canonicalEvent.type
134642
134724
  });
134725
+ if (isCompactedEvent(canonicalEvent)) computerUseNoteSessions.delete(canonicalEvent.threadId);
134643
134726
  if (isCompactedEvent(canonicalEvent) && timedOutNativeCompactions.delete(canonicalEvent.threadId)) {
134644
134727
  yield* publishRuntimeEvent(canonicalEvent);
134645
134728
  return;
@@ -134897,9 +134980,14 @@ const makeProviderService = Effect.fn("makeProviderService")(function* (options)
134897
134980
  ...input.modelSelection?.model ? { "provider.model": input.modelSelection.model } : {}
134898
134981
  });
134899
134982
  yield* touchActiveMcpThread(input.threadId);
134983
+ const mcpSession = readMcpProviderSession(input.threadId);
134984
+ const noteCarried = mcpSession !== void 0 && computerUseNoteSessions.get(input.threadId) === mcpSession.providerSessionId;
134985
+ const sendComputerUseNote = !forCompaction && Boolean(mcpSession?.computerUse) && (input.computerUseGuidance !== false || !noteCarried);
134986
+ if (forCompaction) computerUseNoteSessions.delete(input.threadId);
134987
+ else if (sendComputerUseNote && mcpSession !== void 0) computerUseNoteSessions.set(input.threadId, mcpSession.providerSessionId);
134900
134988
  const turn = yield* routed.adapter.sendTurn({
134901
134989
  ...input,
134902
- input: withComputerUseRouting(input.input, !forCompaction && Boolean(readMcpProviderSession(input.threadId)?.computerUse), computerUseMcpServerName(routed.adapter.provider))
134990
+ input: withComputerUseRouting(input.input, sendComputerUseNote, computerUseMcpServerName(routed.adapter.provider))
134903
134991
  });
134904
134992
  yield* directory.upsert({
134905
134993
  threadId: input.threadId,
@@ -134937,6 +135025,7 @@ const makeProviderService = Effect.fn("makeProviderService")(function* (options)
134937
135025
  });
134938
135026
  const sendTurn = (input) => sendTurnInternal(input);
134939
135027
  const compactThread = Effect.fn("compactThread")(function* (threadId, modelSelection, requestId) {
135028
+ computerUseNoteSessions.delete(threadId);
134940
135029
  const routed = yield* resolveRoutableSession({
134941
135030
  threadId,
134942
135031
  operation: "ProviderService.compactThread",
@@ -135213,6 +135302,7 @@ const makeProviderService = Effect.fn("makeProviderService")(function* (options)
135213
135302
  payload: rawInput
135214
135303
  });
135215
135304
  if (input.numTurns === 0) return;
135305
+ computerUseNoteSessions.delete(input.threadId);
135216
135306
  let metricProvider = "unknown";
135217
135307
  return yield* Effect.gen(function* () {
135218
135308
  const routed = yield* resolveRoutableSession({
@@ -137836,11 +137926,12 @@ const ROLE_ROUTE_QUESTION = {
137836
137926
  "The state describes one request received by one half of a supervised coding pair: a Supervisor that plans and reviews, and a Builder that implements.",
137837
137927
  "Both halves have the same tools. Decide which half should own the requested work, using the plan, current phase, shared context and gate state.",
137838
137928
  "Judge ownership only. Do not judge whether the work is allowed or wise.",
137929
+ "Requests are often short follow-ups to a conversation the state does not show. Judge the kind of work asked for, not how much detail is missing, and keep low confidence for requests that genuinely fit two owners.",
137839
137930
  "When the state names a computerUsePreferredRole and the request asks that the work itself be done by operating a computer, browser, simulator or device, choose that role. A request that only mentions computer use, such as editing its code or docs, is judged as usual."
137840
137931
  ].join(" "),
137841
137932
  criteria: {
137842
- supervisor: "Planning or re-planning phases, scope or requirement decisions, reviewing or approving Builder work, answering gates, task-board or ticket tracker changes and closeout comments, researching before planning, or starting and coordinating other threads.",
137843
- builder: "Implementation: editing code, configuration or docs; reproducing and fixing defects; running builds, tests or app verification; commits, pushes, pull requests and releases.",
137933
+ supervisor: "Planning or re-planning phases, scope or requirement decisions, reviewing or approving Builder work, answering gates, creating or updating tasks and tickets, tracker comments and closeout, researching before planning, or starting and coordinating other threads.",
137934
+ builder: "Implementation: editing code, configuration or docs; reproducing and fixing defects, including feedback that built work is wrong, slow or not as wanted; running, restarting or verifying apps, builds and tests; commits, pushes, pull requests, merging, shipping, deploying and releases.",
137844
137935
  either: "A question, status report or read-only lookup the receiving half can answer from shared context, which neither changes the plan nor the code."
137845
137936
  }
137846
137937
  };
@@ -142472,6 +142563,39 @@ const expandUserInvokedSkill = Effect.fnUntraced(function* (input) {
142472
142563
  //#region src/orchestration/Services/JevToolPrefetch.ts
142473
142564
  var JevToolPrefetch = class extends Context.Service()("@p4code/cli/orchestration/Services/JevToolPrefetch") {};
142474
142565
  //#endregion
142566
+ //#region src/orchestration/prefetch/jevLiveSurface.ts
142567
+ const SURFACES = [
142568
+ "none",
142569
+ "browser",
142570
+ "computer"
142571
+ ];
142572
+ /** Below this, the answer is ignored and the turn keeps the Computer Use note. */
142573
+ const JEV_LIVE_SURFACE_MIN_CONFIDENCE = .7;
142574
+ const JEV_LIVE_SURFACE_HINT_PREFIX = "[jev-surface]";
142575
+ const LIVE_SURFACE_QUESTION = {
142576
+ id: "live-surface",
142577
+ type: "choice",
142578
+ instructions: "The state is one message a user sent a coding agent. Decide which live surface the agent must operate this turn to do what the message asks. Editing code, docs or tests about a surface is not operating it.",
142579
+ criteria: {
142580
+ none: "No app, browser, simulator or device needs to be operated: code changes, questions, reviews, git, builds or tests.",
142581
+ browser: "A web page or web app must be opened, inspected, clicked, filled or screenshotted in a browser.",
142582
+ computer: "A native desktop app, simulator, emulator or connected device must be opened, inspected or driven."
142583
+ }
142584
+ };
142585
+ /** The confident surface in an answer, or nothing. */
142586
+ function readLiveSurface(answer, minConfidence = JEV_LIVE_SURFACE_MIN_CONFIDENCE) {
142587
+ if (answer?.type !== "choice" || answer.confidence < minConfidence) return void 0;
142588
+ return SURFACES.find((surface) => surface === answer.choice);
142589
+ }
142590
+ /** The advice appended to a browser turn; other surfaces add nothing. */
142591
+ function renderLiveSurfaceHint(surface) {
142592
+ return surface === "browser" ? `${JEV_LIVE_SURFACE_HINT_PREFIX} Browser work: use the p4-code preview_* tools, starting with preview_status, not Computer Use browser tabs. Advice only, not authorization.` : void 0;
142593
+ }
142594
+ /** The one-line summary for the consultation row. */
142595
+ function liveSurfaceSummary(surface) {
142596
+ return surface === "none" ? "No live surface" : surface === "browser" ? "Surface: built-in browser" : "Surface: computer";
142597
+ }
142598
+ //#endregion
142475
142599
  //#region src/orchestration/Layers/ProviderCommandReactor.ts
142476
142600
  const isProviderAdapterRequestError = Schema$1.is(ProviderAdapterRequestError);
142477
142601
  const isProviderDriverKind = Schema$1.is(ProviderDriverKind);
@@ -143335,36 +143459,46 @@ const make$8 = Effect.gen(function* () {
143335
143459
  reason: "provider not registered",
143336
143460
  instanceId: modelForTurn.instanceId
143337
143461
  });
143338
- const roleRouteInput = inputWithCompressSuffix !== void 0 && inputWithCompressSuffix.length + 600 + 2 <= 12e4 && activeFusionPair !== void 0 && fusionRole !== void 0 && !isFusionWatcherWakeMessageId(input.messageId) && !input.messageText.trimStart().startsWith("[fusion-") ? {
143462
+ const roleRouteInput = inputWithCompressSuffix !== void 0 && inputWithCompressSuffix.length + 600 + 2 <= 12e4 && activeFusionPair !== void 0 && fusionRole !== void 0 && !isFusionWatcherWakeMessageId(input.messageId) && !input.messageId.startsWith("fusion-evidence-report-repair:") && !input.messageText.trimStart().startsWith("[fusion-") ? {
143339
143463
  pair: activeFusionPair,
143340
143464
  callerRole: fusionRole,
143341
143465
  request: input.messageText,
143342
143466
  computerUseRole
143343
143467
  } : void 0;
143344
- const [prefetch, roleRoute] = yield* Effect.all([inputWithCompressSuffix === void 0 || prefetchProvider === void 0 ? Effect.succeed(void 0) : jevToolPrefetch.hintFor({
143345
- request: input.messageText,
143346
- skills: prefetchProvider.skills,
143347
- ...activeSession?.cwd ? {
143348
- cwd: activeSession.cwd,
143349
- resolveSkills: providerRegistry.getSkillsForCwd(modelForTurn.instanceId, activeSession.cwd)
143350
- } : {},
143351
- compact: compressMode !== "off",
143352
- maxChars: Math.max(0, PROVIDER_SEND_TURN_MAX_INPUT_CHARS - inputWithCompressSuffix.length - 2 - (roleRouteInput === void 0 ? 0 : 602)),
143353
- catalog: [...prefetchProvider.skills.map((skill) => ({
143354
- kind: "skill",
143355
- name: skill.name,
143356
- description: skill.description ?? skill.shortDescription,
143357
- enabled: skill.enabled
143358
- })), ...prefetchProvider.slashCommands.map((command) => ({
143359
- kind: "command",
143360
- name: command.name,
143361
- description: command.description
143362
- }))]
143363
- }), roleRouteInput === void 0 ? Effect.succeed(void 0) : jevRoleRouter.routeFor(roleRouteInput)], { concurrency: "unbounded" });
143468
+ const mcpSession = readMcpProviderSession(input.threadId);
143469
+ const consultLiveSurface = inputWithCompressSuffix !== void 0 && Boolean(mcpSession?.computerUse);
143470
+ const reservedHintChars = (roleRouteInput === void 0 ? 0 : 602) + (consultLiveSurface ? 242 : 0);
143471
+ const [prefetch, roleRoute, answeredSurface] = yield* Effect.all([
143472
+ inputWithCompressSuffix === void 0 || prefetchProvider === void 0 ? Effect.succeed(void 0) : jevToolPrefetch.hintFor({
143473
+ request: input.messageText,
143474
+ skills: prefetchProvider.skills,
143475
+ ...activeSession?.cwd ? {
143476
+ cwd: activeSession.cwd,
143477
+ resolveSkills: providerRegistry.getSkillsForCwd(modelForTurn.instanceId, activeSession.cwd)
143478
+ } : {},
143479
+ compact: compressMode !== "off",
143480
+ maxChars: Math.max(0, PROVIDER_SEND_TURN_MAX_INPUT_CHARS - inputWithCompressSuffix.length - 2 - reservedHintChars),
143481
+ catalog: [...prefetchProvider.skills.map((skill) => ({
143482
+ kind: "skill",
143483
+ name: skill.name,
143484
+ description: skill.description ?? skill.shortDescription,
143485
+ enabled: skill.enabled
143486
+ })), ...prefetchProvider.slashCommands.map((command) => ({
143487
+ kind: "command",
143488
+ name: command.name,
143489
+ description: command.description
143490
+ }))]
143491
+ }),
143492
+ roleRouteInput === void 0 ? Effect.succeed(void 0) : jevRoleRouter.routeFor(roleRouteInput),
143493
+ consultLiveSurface ? jevToolPrefetch.surfaceFor(input.messageText) : Effect.succeed(void 0)
143494
+ ], { concurrency: "unbounded" });
143495
+ const liveSurface = answeredSurface === "browser" && mcpSession?.browserAccess !== true ? void 0 : answeredSurface;
143496
+ const liveSurfaceHint = liveSurface !== void 0 && inputWithCompressSuffix !== void 0 && inputWithCompressSuffix.length + reservedHintChars <= 12e4 ? renderLiveSurfaceHint(liveSurface) : void 0;
143364
143497
  const inputWithPrefetchHint = inputWithCompressSuffix === void 0 ? void 0 : [
143365
143498
  inputWithCompressSuffix,
143366
143499
  prefetch?.hint,
143367
- roleRoute?.hint
143500
+ roleRoute?.hint,
143501
+ liveSurfaceHint
143368
143502
  ].filter((part) => part !== void 0).join("\n\n");
143369
143503
  if (prefetch !== void 0) yield* appendJevConsultedActivity({
143370
143504
  threadId: input.threadId,
@@ -143382,6 +143516,13 @@ const make$8 = Effect.gen(function* () {
143382
143516
  stage: "owner",
143383
143517
  result: roleRouteResult(roleRoute.route)
143384
143518
  });
143519
+ if (liveSurface !== void 0) yield* appendJevConsultedActivity({
143520
+ threadId: input.threadId,
143521
+ turnId: null,
143522
+ createdAt: input.createdAt,
143523
+ feature: "live-surface",
143524
+ summary: liveSurfaceSummary(liveSurface)
143525
+ });
143385
143526
  return {
143386
143527
  threadId: input.threadId,
143387
143528
  ...isChatProject(thread.projectId) && activeSession?.provider === "opencode" ? { systemPrompt: P4_CHAT_SYSTEM_PROMPT } : {},
@@ -143391,7 +143532,8 @@ const make$8 = Effect.gen(function* () {
143391
143532
  ...input.interactionMode !== void 0 ? { interactionMode: input.interactionMode } : {},
143392
143533
  compressMode,
143393
143534
  unpromptedSubagents: thread.unpromptedSubagents,
143394
- ...optimizedFusionPromptDelivery && fusionRole !== void 0 ? { fusionRole } : {}
143535
+ ...optimizedFusionPromptDelivery && fusionRole !== void 0 ? { fusionRole } : {},
143536
+ ...liveSurface !== void 0 && liveSurface !== "computer" ? { computerUseGuidance: false } : {}
143395
143537
  };
143396
143538
  });
143397
143539
  const maybeGenerateAndRenameWorktreeBranchForFirstTurn = Effect.fn("maybeGenerateAndRenameWorktreeBranchForFirstTurn")(function* (input) {
@@ -144605,7 +144747,29 @@ const make$5 = Effect.gen(function* () {
144605
144747
  cause
144606
144748
  })))), Effect.catchCause(() => Effect.succeed(void 0)));
144607
144749
  });
144608
- return { hintFor };
144750
+ const surfaceFor = (request) => Effect.gen(function* () {
144751
+ if (hasDirectCapabilityCall(request)) return void 0;
144752
+ const settings = yield* serverSettings.getSettings.pipe(Effect.catchCause(() => Effect.succeed(void 0)));
144753
+ if (!settings?.enableJevPrefetch) return void 0;
144754
+ const state = buildPrefetchState(request);
144755
+ if (state.length === 0) return void 0;
144756
+ const key = yield* secrets.read("typesafe");
144757
+ if (Option.isNone(key)) return void 0;
144758
+ const startedAt = yield* Clock.currentTimeMillis;
144759
+ return yield* jev.ask({
144760
+ apiKey: key.value.apiKey,
144761
+ model: JEV_PREFETCH_MODEL,
144762
+ state,
144763
+ question: LIVE_SURFACE_QUESTION
144764
+ }).pipe(Effect.map((answer) => readLiveSurface(answer)), Effect.timeout(settings.jevPrefetchTimeoutMs), Effect.tapCause((cause) => Clock.currentTimeMillis.pipe(Effect.flatMap((finishedAt) => Effect.logWarning("jev live surface did not answer", {
144765
+ elapsedMs: finishedAt - startedAt,
144766
+ cause
144767
+ })))), Effect.catchCause(() => Effect.succeed(void 0)));
144768
+ });
144769
+ return {
144770
+ hintFor,
144771
+ surfaceFor
144772
+ };
144609
144773
  });
144610
144774
  const JevToolPrefetchLive = Layer.effect(JevToolPrefetch, make$5);
144611
144775
  //#endregion
@@ -145451,9 +145615,8 @@ const reviewCommandId = (pairId, sequence) => CommandId.make(`server:fusion:${pa
145451
145615
  const cursorCommandId = (pairId, sequence) => CommandId.make(`server:fusion:${pairId}:cursor:${sequence}`);
145452
145616
  const triageCommandId = (pairId, sequence) => CommandId.make(`server:fusion:${pairId}:triage:${sequence}`);
145453
145617
  const reviewMessageId = (pairId, sequence) => MessageId.make(`${FUSION_REVIEW_MESSAGE_ID_PREFIX}${pairId}:${sequence}`);
145454
- const EVIDENCE_REPORT_REPAIR_MESSAGE_ID_PREFIX = "fusion-evidence-report-repair:";
145455
145618
  const evidenceReportRepairCommandId = (pairId, sequence) => CommandId.make(`server:fusion:${pairId}:evidence-report-repair:${sequence}`);
145456
- const evidenceReportRepairMessageId = (pairId, sequence) => MessageId.make(`${EVIDENCE_REPORT_REPAIR_MESSAGE_ID_PREFIX}${pairId}:${sequence}`);
145619
+ const evidenceReportRepairMessageId = (pairId, sequence) => MessageId.make(`${FUSION_EVIDENCE_REPORT_REPAIR_MESSAGE_ID_PREFIX}${pairId}:${sequence}`);
145457
145620
  const gateCommandId = (pairId, gateId, suffix) => CommandId.make(`server:fusion:${pairId}:gate:${gateId}:${suffix}`);
145458
145621
  const gateMessageId = (gateId, round) => MessageId.make(`${FUSION_GATE_MESSAGE_ID_PREFIX}${gateId}:wake:${round}`);
145459
145622
  const gateActivityId = (gateId, threadId, suffix) => EventId.make(`fusion-gate:${gateId}:${suffix}:${threadId}`);
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$a as i,$u as a,Ba as o,Cl as s,Cn as c,Dt as l,Eu as ee,Ga as te,Kl as u,Kr as ne,La as d,Qa as f,Qr as re,Sl as p,Vr as m,Wa as h,Xa as ie,Za as g,_t as _,b as v,bu as ae,ct as y,eo as b,gt as x,h as S,hu as C,lu as w,vn as oe,wl as T,xl as E,yt as D}from"./previewAssetResource-CscIFHNv.js";import{a as O,c as se,i as k,n as A,o as j,r as M,s as ce,t as le}from"./toggle-group-C8xCVvsa.js";import{A as ue,Fr as de,J as fe,Lr as pe,M as N,Mr as me,Nr as he,Rr as ge,Y as _e,_ as ve,ar as ye,cr as be,ct as xe,dr as Se,dt as Ce,ft as P,h as we,ir as Te,j as Ee,jr as De,k as Oe,lr as ke,lt as Ae,nr as je,oi as Me,or as Ne,ot as Pe,pr as Fe,rr as Ie,si as Le,sr as Re,st as ze,ut as Be,yr as Ve}from"./index-DYICyvf7.js";import{a as He,n as Ue}from"./fileCommentAnnotations-BRlauqkZ.js";var We=T(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),F=e(n(),1);function Ge({threadRef:e,filePath:t,activeCwd:n,openInEditor:r,openFileSurface:i}){if(e){if(i){i(t);return}y.getState().openFile(e,t);return}r(n?S(t,n):t)}var I=r();function Ke(e,t){let n=(0,I.c)(4),r=Se(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}var L=t(),qe=[];function Je(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function R(e,t,n){let r=Je(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function Ye(e){let t=(0,I.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:s,className:c,renderHeaderPrefix:l}=e,ee=m(Qe),te=m(B),u;t[0]===a?u=t[1]:(u=e=>e.getComposerDraft(a)?.reviewComments??qe,t[0]=a,t[1]=u);let d=m(u),[f,p]=(0,F.useState)(null),[h,ie]=(0,F.useState)(null),g;t[2]===n?g=t[3]:(g=new Map(n.map(Ze)),t[2]=n,t[3]=g);let _=g,v;if(t[4]!==h||t[5]!==n||t[6]!==d||t[7]!==r){let e;t[9]!==h||t[10]!==d||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:a}=e,o=d.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=re(t,n);return r?R(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=h?.fileKey===i?[...o,h.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:ze(`${a?`1`:`0`}:${s.flatMap(z).join(`:`)}`)}},t[9]=h,t[10]=d,t[11]=r,t[12]=e):e=t[12],v=n.map(e),t[4]=h,t[5]=n,t[6]=d,t[7]=r,t[8]=v}else v=t[8];let ae=v,y;t[13]!==a||t[14]!==h?.annotation||t[15]!==te?(y=e=>{p(null),h?.annotation.metadata.entries.some(t=>t.id===e)?ie(null):te(a,e)},t[13]=a,t[14]=h?.annotation,t[15]=te,t[16]=y):y=t[16];let b=y,x;t[17]!==ee||t[18]!==a||t[19]!==h||t[20]!==_||t[21]!==r||t[22]!==i?(x=(e,t)=>{let n=h?.annotation.metadata.entries.find(t=>t.id===e),o=h?_.get(h.fileKey):void 0;if(!n||!o)return;let s=ne({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});s&&ee(a,s),p(null),ie(null)},t[17]=ee,t[18]=a,t[19]=h,t[20]=_,t[21]=r,t[22]=i,t[23]=x):x=t[23];let S=x,C;t[24]!==_||t[25]!==r||t[26]!==i?(C=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=_.get(n.id);if(!a)return;let o=Ue(),s=ne({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});s&&ie({fileKey:n.id,annotation:{side:Je(e),lineNumber:e.end,metadata:{entries:[{id:o,kind:`draft`,range:e,rangeLabel:s.rangeLabel,text:``}]}}})},t[24]=_,t[25]=r,t[26]=i,t[27]=C):C=t[27];let w=C,oe=h!==null,T;t[28]===s?T=t[29]:(T=s?{ref:s}:{},t[28]=s,t[29]=T);let E;t[30]===c?E=t[31]:(E=c?{className:c}:{},t[30]=c,t[31]=E);let D=!oe,se=!oe,k;t[32]!==w||t[33]!==o||t[34]!==se||t[35]!==D?(k={...o,enableGutterUtility:D,enableLineSelection:se,onLineSelectionEnd:w},t[32]=w,t[33]=o,t[34]=se,t[35]=D,t[36]=k):k=t[36];let A;t[37]===l?A=t[38]:(A=e=>e.type===`diff`?l(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=l,t[38]=A);let j;t[39]!==b||t[40]!==S?(j=e=>(0,L.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,L.jsx)(He,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>b(e.id),onComment:t=>S(e.id,t),onDelete:()=>b(e.id)},e.id))}),t[39]=b,t[40]=S,t[41]=j):j=t[41];let M;return t[42]!==ae||t[43]!==f||t[44]!==k||t[45]!==A||t[46]!==j||t[47]!==T||t[48]!==E?(M=(0,L.jsx)(O,{...T,...E,items:ae,selectedLines:f,onSelectedLinesChange:p,options:k,renderHeaderPrefix:A,renderAnnotation:j}),t[42]=ae,t[43]=f,t[44]=k,t[45]=A,t[46]=j,t[47]=T,t[48]=E,t[49]=M):M=t[49],M}function z(e){return e.metadata.entries.map(Xe)}function Xe(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Ze(e){return[e.fileKey,e]}function B(e){return e.removeReviewComment}function Qe(e){return e.addReviewComment}function $e(e){return{diffPreview:w(e,{label:`environment-data:review:diff-preview`,tag:a.reviewGetDiffPreview,staleTimeMs:5e3})}}var et=$e(c);function V(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function tt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&V(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function nt(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var H=`__automatic_base_ref__`,rt=new Set,it=`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$a as i,$u as a,Ba as o,Cl as s,Cn as c,Dt as l,Eu as ee,Ga as te,Kl as u,Kr as ne,La as d,Qa as f,Qr as re,Sl as p,Vr as m,Wa as h,Xa as ie,Za as g,_t as _,b as v,bu as ae,ct as y,eo as b,gt as x,h as S,hu as C,lu as w,vn as oe,wl as T,xl as E,yt as D}from"./previewAssetResource-CtK3n1Z0.js";import{a as O,c as se,i as k,n as A,o as j,r as M,s as ce,t as le}from"./toggle-group-mp6NlHH3.js";import{A as ue,Fr as de,J as fe,Lr as pe,M as N,Mr as me,Nr as he,Rr as ge,Y as _e,_ as ve,ar as ye,cr as be,ct as xe,dr as Se,dt as Ce,ft as P,h as we,ir as Te,j as Ee,jr as De,k as Oe,lr as ke,lt as Ae,nr as je,oi as Me,or as Ne,ot as Pe,pr as Fe,rr as Ie,si as Le,sr as Re,st as ze,ut as Be,yr as Ve}from"./index-CMpygDVN.js";import{a as He,n as Ue}from"./fileCommentAnnotations-B9ndFlYm.js";var We=T(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),F=e(n(),1);function Ge({threadRef:e,filePath:t,activeCwd:n,openInEditor:r,openFileSurface:i}){if(e){if(i){i(t);return}y.getState().openFile(e,t);return}r(n?S(t,n):t)}var I=r();function Ke(e,t){let n=(0,I.c)(4),r=Se(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}var L=t(),qe=[];function Je(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function R(e,t,n){let r=Je(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function Ye(e){let t=(0,I.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:s,className:c,renderHeaderPrefix:l}=e,ee=m(Qe),te=m(B),u;t[0]===a?u=t[1]:(u=e=>e.getComposerDraft(a)?.reviewComments??qe,t[0]=a,t[1]=u);let d=m(u),[f,p]=(0,F.useState)(null),[h,ie]=(0,F.useState)(null),g;t[2]===n?g=t[3]:(g=new Map(n.map(Ze)),t[2]=n,t[3]=g);let _=g,v;if(t[4]!==h||t[5]!==n||t[6]!==d||t[7]!==r){let e;t[9]!==h||t[10]!==d||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:a}=e,o=d.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=re(t,n);return r?R(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=h?.fileKey===i?[...o,h.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:ze(`${a?`1`:`0`}:${s.flatMap(z).join(`:`)}`)}},t[9]=h,t[10]=d,t[11]=r,t[12]=e):e=t[12],v=n.map(e),t[4]=h,t[5]=n,t[6]=d,t[7]=r,t[8]=v}else v=t[8];let ae=v,y;t[13]!==a||t[14]!==h?.annotation||t[15]!==te?(y=e=>{p(null),h?.annotation.metadata.entries.some(t=>t.id===e)?ie(null):te(a,e)},t[13]=a,t[14]=h?.annotation,t[15]=te,t[16]=y):y=t[16];let b=y,x;t[17]!==ee||t[18]!==a||t[19]!==h||t[20]!==_||t[21]!==r||t[22]!==i?(x=(e,t)=>{let n=h?.annotation.metadata.entries.find(t=>t.id===e),o=h?_.get(h.fileKey):void 0;if(!n||!o)return;let s=ne({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});s&&ee(a,s),p(null),ie(null)},t[17]=ee,t[18]=a,t[19]=h,t[20]=_,t[21]=r,t[22]=i,t[23]=x):x=t[23];let S=x,C;t[24]!==_||t[25]!==r||t[26]!==i?(C=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=_.get(n.id);if(!a)return;let o=Ue(),s=ne({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});s&&ie({fileKey:n.id,annotation:{side:Je(e),lineNumber:e.end,metadata:{entries:[{id:o,kind:`draft`,range:e,rangeLabel:s.rangeLabel,text:``}]}}})},t[24]=_,t[25]=r,t[26]=i,t[27]=C):C=t[27];let w=C,oe=h!==null,T;t[28]===s?T=t[29]:(T=s?{ref:s}:{},t[28]=s,t[29]=T);let E;t[30]===c?E=t[31]:(E=c?{className:c}:{},t[30]=c,t[31]=E);let D=!oe,se=!oe,k;t[32]!==w||t[33]!==o||t[34]!==se||t[35]!==D?(k={...o,enableGutterUtility:D,enableLineSelection:se,onLineSelectionEnd:w},t[32]=w,t[33]=o,t[34]=se,t[35]=D,t[36]=k):k=t[36];let A;t[37]===l?A=t[38]:(A=e=>e.type===`diff`?l(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=l,t[38]=A);let j;t[39]!==b||t[40]!==S?(j=e=>(0,L.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,L.jsx)(He,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>b(e.id),onComment:t=>S(e.id,t),onDelete:()=>b(e.id)},e.id))}),t[39]=b,t[40]=S,t[41]=j):j=t[41];let M;return t[42]!==ae||t[43]!==f||t[44]!==k||t[45]!==A||t[46]!==j||t[47]!==T||t[48]!==E?(M=(0,L.jsx)(O,{...T,...E,items:ae,selectedLines:f,onSelectedLinesChange:p,options:k,renderHeaderPrefix:A,renderAnnotation:j}),t[42]=ae,t[43]=f,t[44]=k,t[45]=A,t[46]=j,t[47]=T,t[48]=E,t[49]=M):M=t[49],M}function z(e){return e.metadata.entries.map(Xe)}function Xe(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Ze(e){return[e.fileKey,e]}function B(e){return e.removeReviewComment}function Qe(e){return e.addReviewComment}function $e(e){return{diffPreview:w(e,{label:`environment-data:review:diff-preview`,tag:a.reviewGetDiffPreview,staleTimeMs:5e3})}}var et=$e(c);function V(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function tt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&V(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function nt(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var H=`__automatic_base_ref__`,rt=new Set,it=`
2
2
  [data-diffs-header],
3
3
  [data-diff],
4
4
  [data-file],
@@ -95,4 +95,4 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
95
95
  text-decoration-color: currentColor;
96
96
  }
97
97
  `;function U({mode:e=`inline`,composerDraftTarget:t,initialGitScope:n,threadRef:r}){let{resolvedTheme:a}=v(),c=de(),[ne]=(0,F.useState)(n),[re,m]=(0,F.useState)(`stacked`),[y,S]=(0,F.useState)(c.wordWrap),[w,T]=(0,F.useState)(c.diffIgnoreWhitespace),[O,ve]=(0,F.useState)(``),[Se,ze]=(0,F.useState)(()=>({scopeKey:null,fileKeys:rt})),He=(0,F.useRef)(null),Ue=r.threadId,I=he(r),qe=I?.projectId??null,Je=me(I&&qe?{environmentId:I.environmentId,projectId:qe}:null),R=I?.worktreePath??Je?.workspaceRoot,z=u(oe.configValueAtom(I?.environmentId??null)),Xe=Fe(I?.environmentId??null,z?.availableEditors??[]),Ze=l(I!=null&&R!=null?De.status({environmentId:I.environmentId,input:{cwd:R}}):null),B=N(e=>Ee(e.byThreadKey,r,ne===`unstaged`)),Qe=Ze.data?.isRepo??!0,{turnDiffSummaries:$e,inferredCheckpointTurnCountByTurnId:V}=ue(I),U=(0,F.useMemo)(()=>[...$e].toSorted((e,t)=>{let n=e.checkpointTurnCount??V[e.turnId]??0,r=t.checkpointTurnCount??V[t.turnId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[V,$e]);(0,F.useEffect)(()=>{B.kind===`turn`&&N.getState().reconcileTurnSelection(r,U.map(e=>e.turnId))},[B,U,r]);let W=B.kind===`turn`?B.turnId:null,G=B.kind===`unstaged`?`unstaged`:`branch`,K=B.kind===`branch`?B.baseRef:null,at=B.kind===`turn`?B.filePath:null,ot=B.kind===`turn`?B.revealRequestId:0,q=W===null?void 0:U.find(e=>e.turnId===W)??U[0],J=q&&(q.checkpointTurnCount??V[q.turnId]),st=U[0],ct=W===null?G===`unstaged`?`Working tree`:`Branch changes`:q?.turnId===st?.turnId?`Latest turn`:`Turn ${J??`?`}`,lt=q?`turn:${q.turnId}`:G,Y=`${r.environmentId}:${r.threadId}:${lt}`,ut=Se.scopeKey===Y?Se.fileKeys:rt,dt=q?`Turn ${J??`?`}`:G===`unstaged`?`Working tree`:`Branch changes`,ft=(0,F.useMemo)(()=>typeof J==`number`?{fromTurnCount:Math.max(0,J-1),toTurnCount:J}:null,[J]),pt=Ke({environmentId:I?.environmentId??null,threadId:Ue,fromTurnCount:ft?.fromTurnCount??null,toTurnCount:ft?.toTurnCount??null,ignoreWhitespace:w,cacheScope:q?`turn:${q.turnId}`:null},{enabled:Qe&&q!==void 0}),mt=l(W===null&&I&&R?et.diffPreview({environmentId:I.environmentId,input:{cwd:R,...K?{baseRef:K}:{},ignoreWhitespace:w}}):null),ht=W===null&&mt.error?.includes(`configured workspace root`)===!0&&z?.cwd!==void 0&&z.cwd!==R,gt=l(ht&&I&&z?et.diffPreview({environmentId:I.environmentId,input:{cwd:z.cwd,...K?{baseRef:K}:{},ignoreWhitespace:w}}):null),X=ht?gt:mt,Z=X.data?.sources.find(e=>e.kind===(G===`unstaged`?`working-tree`:`branch-range`)),_t=l(W===null&&G===`branch`&&I&&X.data?.cwd?De.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...O.trim().length>0?{query:O.trim()}:{},limit:100}}):null),vt=l(W===null&&G===`branch`&&I&&X.data?.cwd?De.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...O.trim().length>0?{query:O.trim()}:{},limit:100}}):null),yt=tt(_t.data?.refs.filter(e=>e.name!==Z?.headRef)??[],vt.data?.refs??[]),bt=nt(yt,O),xt=e=>K&&K===e.remote?.name?K:e.local?.name??e.remote?.name??e.id,St=[H,...yt.map(xt)],Ct=[...O.trim().length===0?[H]:[],...bt.map(xt)],wt=Z?.diff,Tt=q?pt.data?.diff:wt,Et=!q&&Z?.truncated===!0,Dt=q?pt.isPending:X.isPending,Ot=q?pt.error:X.error,kt=typeof Tt==`string`&&Tt.trim().length===0,Q=(0,F.useMemo)(()=>Be(Tt,`diff-panel:${a}`,{compactPartialHunkOffsets:W===null}),[a,Tt,W]),At=(0,F.useMemo)(()=>!Q||Q.kind!==`files`?[]:Q.files.toSorted((e,t)=>P(e).localeCompare(P(t),void 0,{numeric:!0,sensitivity:`base`})),[Q]),$=(0,F.useMemo)(()=>At.map(e=>{let t=Pe(e);return{fileDiff:e,filePath:P(e),fileKey:t,collapsed:ut.has(t)}}),[ut,At]),jt=(0,F.useMemo)(()=>$.map(e=>e.fileKey),[$]),Mt=M(jt,ut),Nt=(0,F.useMemo)(()=>Ae(At),[At]);(0,F.useEffect)(()=>{if(!at)return;let e=$.find(e=>e.filePath===at);e&&He.current?.scrollTo({type:`item`,id:e.fileKey,align:`start`})},[$,at,ot]);let Pt=Oe({threadRef:r,workspaceRoot:R??null}),Ft=(0,F.useCallback)(e=>{Ge({threadRef:r,filePath:e,activeCwd:R,openFileSurface:Pt,openInEditor:e=>{(async()=>{let t=await Xe(e);t._tag===`Failure`&&!C(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,environmentId:r.environmentId,threadId:r.threadId,...ee(ae(t))})})()}})},[R,Pt,Xe,r]),It=(0,F.useCallback)(e=>{ze(t=>{let n=new Set(t.scopeKey===Y?t.fileKeys:[]);return n.has(e)?n.delete(e):n.add(e),{scopeKey:Y,fileKeys:n}})},[Y]),Lt=(0,F.useCallback)(()=>{ze(e=>{let t=e.scopeKey===Y?e.fileKeys:rt;return{scopeKey:Y,fileKeys:k(jt,t)}})},[Y,jt]),Rt=e=>{N.getState().selectTurn(r,e)},zt=e=>{N.getState().selectGitScope(r,e)},Bt=e=>{N.getState().selectBranchBaseRef(r,e)};return(0,L.jsx)(_e,{mode:e,header:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]`,children:[(0,L.jsxs)(o,{children:[(0,L.jsxs)(i,{className:`inline-flex h-6 max-w-full items-center gap-1 rounded-md bg-muted/70 px-2 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Diff scope: ${ct}`,children:[(0,L.jsx)(`span`,{className:`truncate`,children:ct}),(0,L.jsx)(p,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,L.jsxs)(te,{align:`start`,className:`w-60`,children:[(0,L.jsx)(h,{className:W===null&&G===`unstaged`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`unstaged`),children:(0,L.jsx)(`span`,{children:`Working tree`})}),(0,L.jsx)(h,{className:W===null&&G===`branch`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`branch`),children:(0,L.jsx)(`span`,{children:`Branch changes`})}),(0,L.jsx)(h,{className:W!==null&&q?.turnId===st?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>{st&&Rt(st.turnId)},children:(0,L.jsx)(`span`,{children:`Latest turn`})}),(0,L.jsxs)(ie,{children:[(0,L.jsx)(f,{children:`Turn`}),(0,L.jsx)(g,{className:`w-64`,children:U.map(e=>{let t=e.checkpointTurnCount??V[e.turnId]??`?`;return(0,L.jsxs)(h,{className:e.turnId===q?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>Rt(e.turnId),children:[(0,L.jsxs)(`span`,{children:[`Turn `,t]}),(0,L.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-muted-foreground`,children:Ve(e.completedAt,c.timestampFormat)})]},e.turnId)})})]})]})]}),W===null&&G===`branch`&&Z?.baseRef&&(0,L.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground`,title:`${Z.headRef??`HEAD`} → ${Z.baseRef}`,"aria-label":`Comparing ${Z.headRef??`HEAD`} against ${Z.baseRef}`,children:[(0,L.jsx)(`span`,{className:`min-w-0 max-w-48 truncate`,children:Z.headRef??`HEAD`}),(0,L.jsx)(Le,{className:`size-3.5 shrink-0 opacity-70`}),(0,L.jsxs)(je,{items:St,filteredItems:Ct,value:K??H,onOpenChange:e=>{e||ve(``)},onValueChange:e=>{e&&Bt(e===H?null:e)},children:[(0,L.jsxs)(be,{className:`inline-flex min-w-0 max-w-48 items-center gap-1 overflow-hidden rounded-md px-1.5 py-1 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Change comparison target. Currently ${Z.baseRef}`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:Z.baseRef}),(0,L.jsx)(p,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,L.jsxs)(Re,{align:`start`,className:`w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden [&>[data-slot=combobox-popup]]:min-w-0 [&>[data-slot=combobox-popup]]:overflow-hidden`,children:[(0,L.jsx)(`div`,{className:`min-w-0 shrink-0 px-3 pt-2.5`,children:(0,L.jsxs)(`div`,{className:`relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring`,children:[(0,L.jsx)(ge,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55`}),(0,L.jsx)(Te,{className:`[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5`,inputClassName:`rounded-none bg-transparent text-sm`,placeholder:`Search refs...`,showTrigger:!1,size:`sm`,unstyled:!0,value:O,onChange:e=>ve(e.target.value)})]})}),(0,L.jsxs)(`div`,{className:`grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-[10px] text-muted-foreground uppercase tracking-wide`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`}),(0,L.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center`,children:[(0,L.jsx)(`span`,{children:`Branch`}),(0,L.jsx)(`span`,{className:`text-right`,children:`Remote`})]})]}),(0,L.jsx)(Ie,{children:`No matching refs.`}),(0,L.jsxs)(Ne,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,L.jsx)(ye,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:H,children:(0,L.jsx)(`span`,{className:`block min-w-0 truncate`,children:`Automatic`})}),yt.map(e=>{let t=xt(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,L.jsx)(ye,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:t,children:(0,L.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden`,children:[(0,L.jsx)(`span`,{className:`block min-w-0 truncate pe-2`,children:e.label}),n?(0,L.jsx)(`div`,{className:`flex justify-end`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,L.jsx)(ke,{"aria-label":`Use remote version of ${e.label}`,checked:r,className:`[--thumb-size:--spacing(3)]`,onCheckedChange:t=>{let n=t?e.remote?.name:e.local?.name;n&&Bt(n)}})}):e.remote?(0,L.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,title:`Remote only`,children:(0,L.jsx)(s,{"aria-hidden":`true`,className:`size-3`})}):null]})},e.id)})]})]})]})]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[$.length>0&&(0,L.jsx)(we,{additions:Nt.additions,deletions:Nt.deletions,className:`mr-1 text-[11px]`,layout:`inline`}),$.length>0&&(0,L.jsxs)(x,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(d,{type:`button`,size:`icon-xs`,variant:`outline`,"aria-label":Mt?`Expand all files`:`Collapse all files`,onClick:Lt}),children:Mt?(0,L.jsx)(Me,{className:`size-3`}):(0,L.jsx)(se,{className:`size-3`})}),(0,L.jsx)(_,{side:`top`,children:Mt?`Expand all files`:`Collapse all files`})]}),(0,L.jsxs)(A,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[re],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&m(t)},children:[(0,L.jsx)(le,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,L.jsx)(j,{className:`size-3`})}),(0,L.jsx)(le,{"aria-label":`Split diff view`,value:`split`,children:(0,L.jsx)(ce,{className:`size-3`})})]}),(0,L.jsxs)(x,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(le,{"aria-label":y?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`outline`,size:`xs`,pressed:y,onPressedChange:e=>{S(!!e)}}),children:(0,L.jsx)(pe,{className:`size-3`})}),(0,L.jsx)(_,{side:`top`,children:y?`Disable line wrapping`:`Enable line wrapping`})]}),(0,L.jsxs)(x,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(le,{"aria-label":w?`Show whitespace changes`:`Hide whitespace changes`,variant:`outline`,size:`xs`,pressed:w,onPressedChange:e=>{T(!!e)}}),children:(0,L.jsx)(We,{className:`size-3`})}),(0,L.jsx)(_,{side:`top`,children:w?`Show whitespace changes`:`Hide whitespace changes`})]})]})]}),children:I?Qe?W!==null&&U.length===0?(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{className:`diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[Et&&(0,L.jsx)(`p`,{className:`shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-[11px] text-muted-foreground`,children:`This diff was truncated because it exceeded the preview limit. The changes shown are incomplete.`}),Ot&&!Q&&(0,L.jsx)(`div`,{className:`px-3`,children:(0,L.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:Ot})}),Q?Q.kind===`files`?(0,L.jsx)(`div`,{className:`min-h-0 flex-1`,onClickCapture:e=>{let t=(e.nativeEvent.composedPath?.()??[]).find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent?.trim();t&&Ft(t)},children:(0,L.jsx)(Ye,{viewerRef:He,className:`diff-render-surface h-full min-h-0 overflow-auto`,files:$,sectionId:lt,sectionTitle:dt,composerDraftTarget:t,renderHeaderPrefix:(e,t,n)=>{let r=P(e);return(0,L.jsxs)(x,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(`button`,{type:`button`,className:b(`inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 transition-colors hover:bg-foreground/10 focus-visible:outline-hidden`,xe(e)),"aria-label":n?`Expand ${r}`:`Collapse ${r}`,"aria-expanded":!n,onClick:e=>{e.stopPropagation(),It(t)}}),children:n?(0,L.jsx)(E,{className:`size-4`}):(0,L.jsx)(p,{className:`size-4`})}),(0,L.jsx)(_,{side:`top`,children:n?`Expand diff`:`Collapse diff`})]})},options:{diffStyle:re===`split`?`split`:`unified`,lineDiffType:`none`,overflow:y?`wrap`:`scroll`,theme:Ce(a),themeType:a,unsafeCSS:it,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:33},layout:{paddingTop:0,paddingBottom:8,gap:8}}},Y??lt)}):(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:Q.reason}),(0,L.jsx)(`pre`,{className:b(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,y?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:Q.text})]})}):Dt?(0,L.jsx)(fe,{label:q?`Loading checkpoint diff...`:G===`unstaged`?`Loading working tree diff...`:`Loading branch diff...`}):(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,L.jsx)(`p`,{children:kt?`No net changes in this selection.`:`No patch available for this selection.`})})]})}):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`})})}export{ve as DiffWorkerPoolProvider,U as default};
98
- //# sourceMappingURL=DiffPanel-Cq5Tpiyo.js.map
98
+ //# sourceMappingURL=DiffPanel-C3sx9f-m.js.map