@p4code/cli 0.6.11 → 0.6.12

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
@@ -266,7 +266,7 @@ const make$124 = () => {
266
266
  const layer$124 = Layer.sync(NetService, make$124);
267
267
  //#endregion
268
268
  //#region package.json
269
- var version$1 = "0.6.11";
269
+ var version$1 = "0.6.12";
270
270
  //#endregion
271
271
  //#region src/config.ts
272
272
  /**
@@ -11007,6 +11007,11 @@ const JevPrefetchTimeoutMs = Schema$1.Int.check(Schema$1.isBetween({
11007
11007
  minimum: 100,
11008
11008
  maximum: 3e4
11009
11009
  }));
11010
+ const DEFAULT_JEV_ROLE_ROUTING_MIN_CONFIDENCE = .7;
11011
+ const JevRoleRoutingMinConfidence = Schema$1.Number.check(Schema$1.isBetween({
11012
+ minimum: 0,
11013
+ maximum: 1
11014
+ }));
11010
11015
  Schema$1.Literals([
11011
11016
  "auto",
11012
11017
  "local",
@@ -11417,6 +11422,8 @@ const ServerSettings = Schema$1.Struct({
11417
11422
  * `enableJevPrefetch`; every failure path is what the pair did without it.
11418
11423
  */
11419
11424
  enableJevRoleRouting: Schema$1.Boolean.pipe(Schema$1.withDecodingDefault(Effect.succeed(true))),
11425
+ /** Minimum confidence for Fusion role and boundary decisions, from 0 to 1. */
11426
+ jevRoleRoutingMinConfidence: JevRoleRoutingMinConfidence.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_JEV_ROLE_ROUTING_MIN_CONFIDENCE))),
11420
11427
  /**
11421
11428
  * Whether the board offers the scoping agent: the Scope action on a task and
11422
11429
  * the panel that drafts a new one by interview.
@@ -11652,6 +11659,7 @@ const ServerSettingsPatch = Schema$1.Struct({
11652
11659
  jevPrefetchTimeoutMs: Schema$1.optionalKey(JevPrefetchTimeoutMs),
11653
11660
  enableJevAutoWorkspace: Schema$1.optionalKey(Schema$1.Boolean),
11654
11661
  enableJevRoleRouting: Schema$1.optionalKey(Schema$1.Boolean),
11662
+ jevRoleRoutingMinConfidence: Schema$1.optionalKey(JevRoleRoutingMinConfidence),
11655
11663
  enableScopingAgent: Schema$1.optionalKey(Schema$1.Boolean),
11656
11664
  enablePlanPhase: Schema$1.optionalKey(Schema$1.Boolean),
11657
11665
  writeGeneratedSkillsToRepo: Schema$1.optionalKey(Schema$1.Boolean),
@@ -137434,8 +137442,25 @@ const pauseFusionBudget = Effect.fn("pauseFusionBudget")(function* (input) {
137434
137442
  });
137435
137443
  //#endregion
137436
137444
  //#region src/orchestration/prefetch/jevRoleRouting.ts
137445
+ /**
137446
+ * Jev role routing: which half of a Fusion pair owns one request.
137447
+ *
137448
+ * Both halves hold the same tools, so what one half may do no longer answers
137449
+ * who should do it. Before a paired turn's first model request, System One is
137450
+ * shown the request together with the pair's plan, shared working context and
137451
+ * gate state, and picks the owning role. The caller is told the owner and, when
137452
+ * it is the other half, how to hand the work over.
137453
+ *
137454
+ * The answer is advice, never authorization. A low-confidence, unreadable or
137455
+ * missing answer is reported as unresolved, and the role prompt then falls back
137456
+ * to a cheap provider-native subagent and finally to the role's own judgment.
137457
+ * Nothing in the state may carry a secret: every string is scrubbed of common
137458
+ * credential shapes before it is sent.
137459
+ *
137460
+ * @module orchestration/prefetch/jevRoleRouting
137461
+ */
137437
137462
  /** Below this, the owner is reported as unresolved rather than as a pick. */
137438
- const JEV_ROLE_ROUTE_MIN_CONFIDENCE = .7;
137463
+ const JEV_ROLE_ROUTE_MIN_CONFIDENCE = DEFAULT_JEV_ROLE_ROUTING_MIN_CONFIDENCE;
137439
137464
  const JEV_ROLE_ROUTE_HINT_PREFIX = "[jev-role-route]";
137440
137465
  const OWNERS = [
137441
137466
  "supervisor",
@@ -137524,7 +137549,7 @@ function buildRoleRouteState(input, budgetTokens = roleRouteStateBudgetTokens())
137524
137549
  return null;
137525
137550
  }
137526
137551
  /** Reads one answer into an owner, or an unresolved route with the reason. */
137527
- function readRoleRoute(answer) {
137552
+ function readRoleRoute(answer, minConfidence = JEV_ROLE_ROUTE_MIN_CONFIDENCE) {
137528
137553
  if (answer === void 0) return {
137529
137554
  kind: "unresolved",
137530
137555
  reason: "Jev did not answer"
@@ -137538,7 +137563,7 @@ function readRoleRoute(answer) {
137538
137563
  kind: "unresolved",
137539
137564
  reason: "Jev picked an unknown owner"
137540
137565
  };
137541
- if (answer.confidence < .7) return {
137566
+ if (answer.confidence < minConfidence) return {
137542
137567
  kind: "unresolved",
137543
137568
  reason: `Jev leaned ${owner} at confidence ${answer.confidence.toFixed(2)}`
137544
137569
  };
@@ -137653,16 +137678,17 @@ const BUILDER_END_CHECKS = [
137653
137678
  /** The answers whose confidence decides whether a Builder ending is judged at all. */
137654
137679
  const BUILDER_END_DECISIVE = /* @__PURE__ */ new Set(["builder-continue", "builder-conflict"]);
137655
137680
  /** Reads a Builder-end answer set into its findings and whether Jev was unsure. */
137656
- function readBuilderEndJudgment(answers, phase) {
137681
+ function readBuilderEndJudgment(answers, phase, minConfidence = JEV_ROLE_ROUTE_MIN_CONFIDENCE) {
137657
137682
  const lowConfidence = BUILDER_END_CHECKS.some((check) => {
137658
137683
  if (!BUILDER_END_DECISIVE.has(check.question.id)) return false;
137659
137684
  const answer = answers[check.question.id];
137660
- return answer !== void 0 && (answer.type !== "choice" || answer.confidence < .7);
137685
+ return answer !== void 0 && (answer.type !== "choice" || answer.confidence < minConfidence);
137661
137686
  });
137662
137687
  return {
137663
- findings: readBoundaryFindings(BUILDER_END_CHECKS, answers),
137688
+ findings: readBoundaryFindings(BUILDER_END_CHECKS, answers, minConfidence),
137664
137689
  lowConfidence,
137665
- phase
137690
+ phase,
137691
+ minConfidence
137666
137692
  };
137667
137693
  }
137668
137694
  function builderEndConflict(judgment) {
@@ -137672,7 +137698,7 @@ function builderEndConflict(judgment) {
137672
137698
  function readJevBoundaryRecord(payload) {
137673
137699
  const record = payload;
137674
137700
  if (record === null || typeof record !== "object") return void 0;
137675
- const { sequence, phase, lowConfidenceStreak, escalated, continued, continuation, escalation } = record;
137701
+ const { sequence, phase, lowConfidenceStreak, minConfidence, escalated, continued, continuation, escalation } = record;
137676
137702
  if (typeof sequence !== "number" || typeof lowConfidenceStreak !== "number" || typeof escalated !== "boolean" || typeof continued !== "boolean") return void 0;
137677
137703
  if (phase !== null && typeof phase !== "string") return void 0;
137678
137704
  const escalationRecord = escalation;
@@ -137680,6 +137706,7 @@ function readJevBoundaryRecord(payload) {
137680
137706
  sequence,
137681
137707
  phase,
137682
137708
  lowConfidenceStreak,
137709
+ ...typeof minConfidence === "number" ? { minConfidence } : {},
137683
137710
  escalated,
137684
137711
  continued,
137685
137712
  ...typeof continuation === "string" ? { continuation } : {},
@@ -137695,7 +137722,7 @@ function readJevBoundaryRecord(payload) {
137695
137722
  */
137696
137723
  function nextLowConfidenceStreak(previous, judgment) {
137697
137724
  if (!judgment.lowConfidence) return 0;
137698
- return (previous !== void 0 && !previous.escalated && previous.phase === judgment.phase ? previous.lowConfidenceStreak : 0) + 1;
137725
+ return (previous !== void 0 && !previous.escalated && previous.phase === judgment.phase && (previous.minConfidence ?? JEV_ROLE_ROUTE_MIN_CONFIDENCE) === judgment.minConfidence ? previous.lowConfidenceStreak : 0) + 1;
137699
137726
  }
137700
137727
  /** Why a finished Builder turn goes to a Supervisor gate instead of on, if it does. */
137701
137728
  function jevEscalationFor(judgment, streak) {
@@ -137705,7 +137732,7 @@ function jevEscalationFor(judgment, streak) {
137705
137732
  };
137706
137733
  if (streak >= 2) return {
137707
137734
  reason: "uncertain",
137708
- detail: `Jev answered below ${JEV_ROLE_ROUTE_MIN_CONFIDENCE} confidence on ${streak} consecutive Builder turns${judgment.phase === null ? "" : ` in phase "${judgment.phase}"`}, so it cannot judge whether the Builder should have stopped.`
137735
+ detail: `Jev answered below ${judgment.minConfidence} confidence on ${streak} consecutive Builder turns${judgment.phase === null ? "" : ` in phase "${judgment.phase}"`}, so it cannot judge whether the Builder should have stopped.`
137709
137736
  };
137710
137737
  }
137711
137738
  /** The one-line pill summary for a recorded Builder-end judgment. */
@@ -137734,11 +137761,11 @@ function supervisorRequestResult(findings) {
137734
137761
  * or unsure answer flags nothing: a boundary check may add a finding, never
137735
137762
  * invent one.
137736
137763
  */
137737
- function readBoundaryFindings(checks, answers) {
137764
+ function readBoundaryFindings(checks, answers, minConfidence = JEV_ROLE_ROUTE_MIN_CONFIDENCE) {
137738
137765
  if (answers === void 0) return [];
137739
137766
  return checks.flatMap((check) => {
137740
137767
  const answer = answers[check.question.id];
137741
- return answer?.type === "choice" && answer.choice === check.flagChoice && answer.confidence >= .7 ? [{
137768
+ return answer?.type === "choice" && answer.choice === check.flagChoice && answer.confidence >= minConfidence ? [{
137742
137769
  id: check.question.id,
137743
137770
  finding: check.finding,
137744
137771
  confidence: answer.confidence
@@ -138331,7 +138358,8 @@ const make$12 = Effect.gen(function* () {
138331
138358
  if (Option.isNone(key)) return void 0;
138332
138359
  return {
138333
138360
  apiKey: key.value.apiKey,
138334
- timeoutMs: settings.jevPrefetchTimeoutMs
138361
+ timeoutMs: settings.jevPrefetchTimeoutMs,
138362
+ minConfidence: settings.jevRoleRoutingMinConfidence
138335
138363
  };
138336
138364
  });
138337
138365
  const pairState = (pair) => {
@@ -138370,8 +138398,8 @@ const make$12 = Effect.gen(function* () {
138370
138398
  model: JEV_PREFETCH_MODEL,
138371
138399
  state,
138372
138400
  question: ROLE_ROUTE_QUESTION
138373
- }));
138374
- }).pipe(Effect.timeout(consult.timeoutMs), Effect.tapCause((cause) => Effect.logWarning("jev role routing did not answer", { cause })), Effect.catchCause(() => Effect.succeed(readRoleRoute(void 0))));
138401
+ }), consult.minConfidence);
138402
+ }).pipe(Effect.timeout(consult.timeoutMs), Effect.tapCause((cause) => Effect.logWarning("jev role routing did not answer", { cause })), Effect.catchCause(() => Effect.succeed(readRoleRoute(void 0, consult.minConfidence))));
138375
138403
  if (route === null) return void 0;
138376
138404
  return {
138377
138405
  hint: renderRoleRouteHint(input.callerRole, route),
@@ -138401,7 +138429,7 @@ const make$12 = Effect.gen(function* () {
138401
138429
  model: JEV_PREFETCH_MODEL,
138402
138430
  state,
138403
138431
  questions: checks.map((check) => check.question)
138404
- }), currentPhase);
138432
+ }), currentPhase, consult.minConfidence);
138405
138433
  }).pipe(Effect.timeout(consult.timeoutMs), Effect.tapCause((cause) => Effect.logWarning("jev boundary check did not answer", {
138406
138434
  boundary,
138407
138435
  cause
@@ -138409,7 +138437,7 @@ const make$12 = Effect.gen(function* () {
138409
138437
  });
138410
138438
  return {
138411
138439
  routeFor,
138412
- checkSupervisorRequest: (input) => checkBoundary("supervisor-request", SUPERVISOR_REQUEST_CHECKS, input, (answers) => readBoundaryFindings(SUPERVISOR_REQUEST_CHECKS, answers)),
138440
+ checkSupervisorRequest: (input) => checkBoundary("supervisor-request", SUPERVISOR_REQUEST_CHECKS, input, (answers, _phase, minConfidence) => readBoundaryFindings(SUPERVISOR_REQUEST_CHECKS, answers, minConfidence)),
138413
138441
  checkBuilderEnd: (input) => checkBoundary("builder-end", BUILDER_END_CHECKS, input, readBuilderEndJudgment)
138414
138442
  };
138415
138443
  });
@@ -146502,6 +146530,7 @@ const make$3 = Effect.gen(function* () {
146502
146530
  sequence: completion.sequence,
146503
146531
  phase: judgment.phase,
146504
146532
  lowConfidenceStreak: streak,
146533
+ minConfidence: judgment.minConfidence,
146505
146534
  escalated: escalation !== void 0,
146506
146535
  continued: continues,
146507
146536
  ...escalation === void 0 ? {} : { escalation },
@@ -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{Cn as i,Dt as a,Fa as o,Ha as s,Ja as c,Kr as l,Qa as u,Qr as ee,Ra as te,Sl as d,Ua as f,Vr as ne,Wl as p,Xa as re,Ya as ie,Za as m,Zu as h,_t as g,b as _,bl as v,ct as y,gt as b,h as x,pu as S,su as C,vn as w,vu as ae,wu as oe,xl as T,yl as E,yt as D}from"./previewAssetResource-BkTI2WoF.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-DV04EELH.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 we,h as Te,ir as Ee,j as De,jr as Oe,k as ke,lr as Ae,lt as je,nr as Me,oi as Ne,or as Pe,ot as Fe,pr as Ie,rr as Le,si as Re,sr as ze,st as Be,ut as Ve,yr as He}from"./index-Du5fQoNR.js";import{a as Ue,n as We}from"./fileCommentAnnotations-BiTe4RMp.js";var Ge=d(`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`}]]),P=e(n(),1);function Ke({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?x(t,n):t)}var F=r();function qe(e,t){let n=(0,F.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 I=t(),Je=[];function Ye(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function L(e,t,n){let r=Ye(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 Xe(e){let t=(0,F.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:s,className:c,renderHeaderPrefix:u}=e,te=ne($e),d=ne(z),f;t[0]===a?f=t[1]:(f=e=>e.getComposerDraft(a)?.reviewComments??Je,t[0]=a,t[1]=f);let p=ne(f),[re,ie]=(0,P.useState)(null),[m,h]=(0,P.useState)(null),g;t[2]===n?g=t[3]:(g=new Map(n.map(Qe)),t[2]=n,t[3]=g);let _=g,v;if(t[4]!==m||t[5]!==n||t[6]!==p||t[7]!==r){let e;t[9]!==m||t[10]!==p||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:a}=e,o=p.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=ee(t,n);return r?L(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=m?.fileKey===i?[...o,m.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:Be(`${a?`1`:`0`}:${s.flatMap(R).join(`:`)}`)}},t[9]=m,t[10]=p,t[11]=r,t[12]=e):e=t[12],v=n.map(e),t[4]=m,t[5]=n,t[6]=p,t[7]=r,t[8]=v}else v=t[8];let y=v,b;t[13]!==a||t[14]!==m?.annotation||t[15]!==d?(b=e=>{ie(null),m?.annotation.metadata.entries.some(t=>t.id===e)?h(null):d(a,e)},t[13]=a,t[14]=m?.annotation,t[15]=d,t[16]=b):b=t[16];let x=b,S;t[17]!==te||t[18]!==a||t[19]!==m||t[20]!==_||t[21]!==r||t[22]!==i?(S=(e,t)=>{let n=m?.annotation.metadata.entries.find(t=>t.id===e),o=m?_.get(m.fileKey):void 0;if(!n||!o)return;let s=l({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});s&&te(a,s),ie(null),h(null)},t[17]=te,t[18]=a,t[19]=m,t[20]=_,t[21]=r,t[22]=i,t[23]=S):S=t[23];let C=S,w;t[24]!==_||t[25]!==r||t[26]!==i?(w=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=_.get(n.id);if(!a)return;let o=We(),s=l({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});s&&h({fileKey:n.id,annotation:{side:Ye(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]=w):w=t[27];let ae=w,oe=m!==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]!==ae||t[33]!==o||t[34]!==se||t[35]!==D?(k={...o,enableGutterUtility:D,enableLineSelection:se,onLineSelectionEnd:ae},t[32]=ae,t[33]=o,t[34]=se,t[35]=D,t[36]=k):k=t[36];let A;t[37]===u?A=t[38]:(A=e=>e.type===`diff`?u(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=u,t[38]=A);let j;t[39]!==x||t[40]!==C?(j=e=>(0,I.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,I.jsx)(Ue,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>x(e.id),onComment:t=>C(e.id,t),onDelete:()=>x(e.id)},e.id))}),t[39]=x,t[40]=C,t[41]=j):j=t[41];let M;return t[42]!==y||t[43]!==re||t[44]!==k||t[45]!==A||t[46]!==j||t[47]!==T||t[48]!==E?(M=(0,I.jsx)(O,{...T,...E,items:y,selectedLines:re,onSelectedLinesChange:ie,options:k,renderHeaderPrefix:A,renderAnnotation:j}),t[42]=y,t[43]=re,t[44]=k,t[45]=A,t[46]=j,t[47]=T,t[48]=E,t[49]=M):M=t[49],M}function R(e){return e.metadata.entries.map(Ze)}function Ze(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Qe(e){return[e.fileKey,e]}function z(e){return e.removeReviewComment}function $e(e){return e.addReviewComment}function et(e){return{diffPreview:C(e,{label:`environment-data:review:diff-preview`,tag:h.reviewGetDiffPreview,staleTimeMs:5e3})}}var tt=et(i);function B(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function nt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&B(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 rt(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 V=`__automatic_base_ref__`,it=new Set,at=`
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{Cn as i,Dt as a,Fa as o,Ha as s,Ja as c,Kr as l,Qa as u,Qr as ee,Ra as te,Sl as d,Ua as f,Vr as ne,Wl as p,Xa as re,Ya as ie,Za as m,Zu as h,_t as g,b as _,bl as v,ct as y,gt as b,h as x,pu as S,su as C,vn as w,vu as ae,wu as oe,xl as T,yl as E,yt as D}from"./previewAssetResource-DEZquWCb.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-CX-BX4R0.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 we,h as Te,ir as Ee,j as De,jr as Oe,k as ke,lr as Ae,lt as je,nr as Me,oi as Ne,or as Pe,ot as Fe,pr as Ie,rr as Le,si as Re,sr as ze,st as Be,ut as Ve,yr as He}from"./index-zIgT1Y-z.js";import{a as Ue,n as We}from"./fileCommentAnnotations-CKXyKV65.js";var Ge=d(`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`}]]),P=e(n(),1);function Ke({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?x(t,n):t)}var F=r();function qe(e,t){let n=(0,F.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 I=t(),Je=[];function Ye(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function L(e,t,n){let r=Ye(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 Xe(e){let t=(0,F.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:s,className:c,renderHeaderPrefix:u}=e,te=ne($e),d=ne(z),f;t[0]===a?f=t[1]:(f=e=>e.getComposerDraft(a)?.reviewComments??Je,t[0]=a,t[1]=f);let p=ne(f),[re,ie]=(0,P.useState)(null),[m,h]=(0,P.useState)(null),g;t[2]===n?g=t[3]:(g=new Map(n.map(Qe)),t[2]=n,t[3]=g);let _=g,v;if(t[4]!==m||t[5]!==n||t[6]!==p||t[7]!==r){let e;t[9]!==m||t[10]!==p||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:a}=e,o=p.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=ee(t,n);return r?L(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=m?.fileKey===i?[...o,m.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:Be(`${a?`1`:`0`}:${s.flatMap(R).join(`:`)}`)}},t[9]=m,t[10]=p,t[11]=r,t[12]=e):e=t[12],v=n.map(e),t[4]=m,t[5]=n,t[6]=p,t[7]=r,t[8]=v}else v=t[8];let y=v,b;t[13]!==a||t[14]!==m?.annotation||t[15]!==d?(b=e=>{ie(null),m?.annotation.metadata.entries.some(t=>t.id===e)?h(null):d(a,e)},t[13]=a,t[14]=m?.annotation,t[15]=d,t[16]=b):b=t[16];let x=b,S;t[17]!==te||t[18]!==a||t[19]!==m||t[20]!==_||t[21]!==r||t[22]!==i?(S=(e,t)=>{let n=m?.annotation.metadata.entries.find(t=>t.id===e),o=m?_.get(m.fileKey):void 0;if(!n||!o)return;let s=l({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});s&&te(a,s),ie(null),h(null)},t[17]=te,t[18]=a,t[19]=m,t[20]=_,t[21]=r,t[22]=i,t[23]=S):S=t[23];let C=S,w;t[24]!==_||t[25]!==r||t[26]!==i?(w=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=_.get(n.id);if(!a)return;let o=We(),s=l({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});s&&h({fileKey:n.id,annotation:{side:Ye(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]=w):w=t[27];let ae=w,oe=m!==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]!==ae||t[33]!==o||t[34]!==se||t[35]!==D?(k={...o,enableGutterUtility:D,enableLineSelection:se,onLineSelectionEnd:ae},t[32]=ae,t[33]=o,t[34]=se,t[35]=D,t[36]=k):k=t[36];let A;t[37]===u?A=t[38]:(A=e=>e.type===`diff`?u(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=u,t[38]=A);let j;t[39]!==x||t[40]!==C?(j=e=>(0,I.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,I.jsx)(Ue,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>x(e.id),onComment:t=>C(e.id,t),onDelete:()=>x(e.id)},e.id))}),t[39]=x,t[40]=C,t[41]=j):j=t[41];let M;return t[42]!==y||t[43]!==re||t[44]!==k||t[45]!==A||t[46]!==j||t[47]!==T||t[48]!==E?(M=(0,I.jsx)(O,{...T,...E,items:y,selectedLines:re,onSelectedLinesChange:ie,options:k,renderHeaderPrefix:A,renderAnnotation:j}),t[42]=y,t[43]=re,t[44]=k,t[45]=A,t[46]=j,t[47]=T,t[48]=E,t[49]=M):M=t[49],M}function R(e){return e.metadata.entries.map(Ze)}function Ze(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Qe(e){return[e.fileKey,e]}function z(e){return e.removeReviewComment}function $e(e){return e.addReviewComment}function et(e){return{diffPreview:C(e,{label:`environment-data:review:diff-preview`,tag:h.reviewGetDiffPreview,staleTimeMs:5e3})}}var tt=et(i);function B(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function nt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&B(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 rt(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 V=`__automatic_base_ref__`,it=new Set,at=`
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 H({mode:e=`inline`,composerDraftTarget:t,initialGitScope:n,threadRef:r}){let{resolvedTheme:i}=_(),l=de(),[ee]=(0,P.useState)(n),[d,ne]=(0,P.useState)(`stacked`),[h,y]=(0,P.useState)(l.wordWrap),[x,C]=(0,P.useState)(l.diffIgnoreWhitespace),[O,ve]=(0,P.useState)(``),[Se,Be]=(0,P.useState)(()=>({scopeKey:null,fileKeys:it})),Ue=(0,P.useRef)(null),We=r.threadId,F=he(r),Je=F?.projectId??null,Ye=me(F&&Je?{environmentId:F.environmentId,projectId:Je}:null),L=F?.worktreePath??Ye?.workspaceRoot,R=p(w.configValueAtom(F?.environmentId??null)),Ze=Ie(F?.environmentId??null,R?.availableEditors??[]),Qe=a(F!=null&&L!=null?Oe.status({environmentId:F.environmentId,input:{cwd:L}}):null),z=N(e=>De(e.byThreadKey,r,ee===`unstaged`)),$e=Qe.data?.isRepo??!0,{turnDiffSummaries:et,inferredCheckpointTurnCountByTurnId:B}=ue(F),H=(0,P.useMemo)(()=>[...et].toSorted((e,t)=>{let n=e.checkpointTurnCount??B[e.turnId]??0,r=t.checkpointTurnCount??B[t.turnId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[B,et]);(0,P.useEffect)(()=>{z.kind===`turn`&&N.getState().reconcileTurnSelection(r,H.map(e=>e.turnId))},[z,H,r]);let U=z.kind===`turn`?z.turnId:null,W=z.kind===`unstaged`?`unstaged`:`branch`,G=z.kind===`branch`?z.baseRef:null,ot=z.kind===`turn`?z.filePath:null,st=z.kind===`turn`?z.revealRequestId:0,K=U===null?void 0:H.find(e=>e.turnId===U)??H[0],q=K&&(K.checkpointTurnCount??B[K.turnId]),J=H[0],ct=U===null?W===`unstaged`?`Working tree`:`Branch changes`:K?.turnId===J?.turnId?`Latest turn`:`Turn ${q??`?`}`,lt=K?`turn:${K.turnId}`:W,Y=`${r.environmentId}:${r.threadId}:${lt}`,ut=Se.scopeKey===Y?Se.fileKeys:it,dt=K?`Turn ${q??`?`}`:W===`unstaged`?`Working tree`:`Branch changes`,ft=(0,P.useMemo)(()=>typeof q==`number`?{fromTurnCount:Math.max(0,q-1),toTurnCount:q}:null,[q]),pt=qe({environmentId:F?.environmentId??null,threadId:We,fromTurnCount:ft?.fromTurnCount??null,toTurnCount:ft?.toTurnCount??null,ignoreWhitespace:x,cacheScope:K?`turn:${K.turnId}`:null},{enabled:$e&&K!==void 0}),mt=a(U===null&&F&&L?tt.diffPreview({environmentId:F.environmentId,input:{cwd:L,...G?{baseRef:G}:{},ignoreWhitespace:x}}):null),ht=U===null&&mt.error?.includes(`configured workspace root`)===!0&&R?.cwd!==void 0&&R.cwd!==L,gt=a(ht&&F&&R?tt.diffPreview({environmentId:F.environmentId,input:{cwd:R.cwd,...G?{baseRef:G}:{},ignoreWhitespace:x}}):null),X=ht?gt:mt,Z=X.data?.sources.find(e=>e.kind===(W===`unstaged`?`working-tree`:`branch-range`)),_t=a(U===null&&W===`branch`&&F&&X.data?.cwd?Oe.listRefs({environmentId:F.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...O.trim().length>0?{query:O.trim()}:{},limit:100}}):null),vt=a(U===null&&W===`branch`&&F&&X.data?.cwd?Oe.listRefs({environmentId:F.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...O.trim().length>0?{query:O.trim()}:{},limit:100}}):null),yt=nt(_t.data?.refs.filter(e=>e.name!==Z?.headRef)??[],vt.data?.refs??[]),bt=rt(yt,O),xt=e=>G&&G===e.remote?.name?G:e.local?.name??e.remote?.name??e.id,St=[V,...yt.map(xt)],Ct=[...O.trim().length===0?[V]:[],...bt.map(xt)],wt=Z?.diff,Tt=K?pt.data?.diff:wt,Et=!K&&Z?.truncated===!0,Dt=K?pt.isPending:X.isPending,Ot=K?pt.error:X.error,kt=typeof Tt==`string`&&Tt.trim().length===0,Q=(0,P.useMemo)(()=>Ve(Tt,`diff-panel:${i}`,{compactPartialHunkOffsets:U===null}),[i,Tt,U]),At=(0,P.useMemo)(()=>!Q||Q.kind!==`files`?[]:Q.files.toSorted((e,t)=>we(e).localeCompare(we(t),void 0,{numeric:!0,sensitivity:`base`})),[Q]),$=(0,P.useMemo)(()=>At.map(e=>{let t=Fe(e);return{fileDiff:e,filePath:we(e),fileKey:t,collapsed:ut.has(t)}}),[ut,At]),jt=(0,P.useMemo)(()=>$.map(e=>e.fileKey),[$]),Mt=M(jt,ut),Nt=(0,P.useMemo)(()=>je(At),[At]);(0,P.useEffect)(()=>{if(!ot)return;let e=$.find(e=>e.filePath===ot);e&&Ue.current?.scrollTo({type:`item`,id:e.fileKey,align:`start`})},[$,ot,st]);let Pt=ke({threadRef:r,workspaceRoot:L??null}),Ft=(0,P.useCallback)(e=>{Ke({threadRef:r,filePath:e,activeCwd:L,openFileSurface:Pt,openInEditor:e=>{(async()=>{let t=await Ze(e);t._tag===`Failure`&&!S(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,environmentId:r.environmentId,threadId:r.threadId,...oe(ae(t))})})()}})},[L,Pt,Ze,r]),It=(0,P.useCallback)(e=>{Be(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,P.useCallback)(()=>{Be(e=>{let t=e.scopeKey===Y?e.fileKeys:it;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,I.jsx)(_e,{mode:e,header:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]`,children:[(0,I.jsxs)(te,{children:[(0,I.jsxs)(m,{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,I.jsx)(`span`,{className:`truncate`,children:ct}),(0,I.jsx)(v,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,I.jsxs)(f,{align:`start`,className:`w-60`,children:[(0,I.jsx)(s,{className:U===null&&W===`unstaged`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`unstaged`),children:(0,I.jsx)(`span`,{children:`Working tree`})}),(0,I.jsx)(s,{className:U===null&&W===`branch`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`branch`),children:(0,I.jsx)(`span`,{children:`Branch changes`})}),(0,I.jsx)(s,{className:U!==null&&K?.turnId===J?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>{J&&Rt(J.turnId)},children:(0,I.jsx)(`span`,{children:`Latest turn`})}),(0,I.jsxs)(c,{children:[(0,I.jsx)(re,{children:`Turn`}),(0,I.jsx)(ie,{className:`w-64`,children:H.map(e=>{let t=e.checkpointTurnCount??B[e.turnId]??`?`;return(0,I.jsxs)(s,{className:e.turnId===K?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>Rt(e.turnId),children:[(0,I.jsxs)(`span`,{children:[`Turn `,t]}),(0,I.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-muted-foreground`,children:He(e.completedAt,l.timestampFormat)})]},e.turnId)})})]})]})]}),U===null&&W===`branch`&&Z?.baseRef&&(0,I.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,I.jsx)(`span`,{className:`min-w-0 max-w-48 truncate`,children:Z.headRef??`HEAD`}),(0,I.jsx)(Re,{className:`size-3.5 shrink-0 opacity-70`}),(0,I.jsxs)(Me,{items:St,filteredItems:Ct,value:G??V,onOpenChange:e=>{e||ve(``)},onValueChange:e=>{e&&Bt(e===V?null:e)},children:[(0,I.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,I.jsx)(`span`,{className:`min-w-0 truncate`,children:Z.baseRef}),(0,I.jsx)(v,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,I.jsxs)(ze,{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,I.jsx)(`div`,{className:`min-w-0 shrink-0 px-3 pt-2.5`,children:(0,I.jsxs)(`div`,{className:`relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring`,children:[(0,I.jsx)(ge,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55`}),(0,I.jsx)(Ee,{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,I.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,I.jsx)(`span`,{"aria-hidden":`true`}),(0,I.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center`,children:[(0,I.jsx)(`span`,{children:`Branch`}),(0,I.jsx)(`span`,{className:`text-right`,children:`Remote`})]})]}),(0,I.jsx)(Le,{children:`No matching refs.`}),(0,I.jsxs)(Pe,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,I.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:V,children:(0,I.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,I.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,I.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden`,children:[(0,I.jsx)(`span`,{className:`block min-w-0 truncate pe-2`,children:e.label}),n?(0,I.jsx)(`div`,{className:`flex justify-end`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,I.jsx)(Ae,{"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,I.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,title:`Remote only`,children:(0,I.jsx)(T,{"aria-hidden":`true`,className:`size-3`})}):null]})},e.id)})]})]})]})]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[$.length>0&&(0,I.jsx)(Te,{additions:Nt.additions,deletions:Nt.deletions,className:`mr-1 text-[11px]`,layout:`inline`}),$.length>0&&(0,I.jsxs)(b,{children:[(0,I.jsx)(D,{render:(0,I.jsx)(o,{type:`button`,size:`icon-xs`,variant:`outline`,"aria-label":Mt?`Expand all files`:`Collapse all files`,onClick:Lt}),children:Mt?(0,I.jsx)(Ne,{className:`size-3`}):(0,I.jsx)(se,{className:`size-3`})}),(0,I.jsx)(g,{side:`top`,children:Mt?`Expand all files`:`Collapse all files`})]}),(0,I.jsxs)(A,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[d],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&ne(t)},children:[(0,I.jsx)(le,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,I.jsx)(j,{className:`size-3`})}),(0,I.jsx)(le,{"aria-label":`Split diff view`,value:`split`,children:(0,I.jsx)(ce,{className:`size-3`})})]}),(0,I.jsxs)(b,{children:[(0,I.jsx)(D,{render:(0,I.jsx)(le,{"aria-label":h?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`outline`,size:`xs`,pressed:h,onPressedChange:e=>{y(!!e)}}),children:(0,I.jsx)(pe,{className:`size-3`})}),(0,I.jsx)(g,{side:`top`,children:h?`Disable line wrapping`:`Enable line wrapping`})]}),(0,I.jsxs)(b,{children:[(0,I.jsx)(D,{render:(0,I.jsx)(le,{"aria-label":x?`Show whitespace changes`:`Hide whitespace changes`,variant:`outline`,size:`xs`,pressed:x,onPressedChange:e=>{C(!!e)}}),children:(0,I.jsx)(Ge,{className:`size-3`})}),(0,I.jsx)(g,{side:`top`,children:x?`Show whitespace changes`:`Hide whitespace changes`})]})]})]}),children:F?$e?U!==null&&H.length===0?(0,I.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,I.jsx)(I.Fragment,{children:(0,I.jsxs)(`div`,{className:`diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[Et&&(0,I.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,I.jsx)(`div`,{className:`px-3`,children:(0,I.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:Ot})}),Q?Q.kind===`files`?(0,I.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,I.jsx)(Xe,{viewerRef:Ue,className:`diff-render-surface h-full min-h-0 overflow-auto`,files:$,sectionId:lt,sectionTitle:dt,composerDraftTarget:t,renderHeaderPrefix:(e,t,n)=>{let r=we(e);return(0,I.jsxs)(b,{children:[(0,I.jsx)(D,{render:(0,I.jsx)(`button`,{type:`button`,className:u(`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,I.jsx)(E,{className:`size-4`}):(0,I.jsx)(v,{className:`size-4`})}),(0,I.jsx)(g,{side:`top`,children:n?`Expand diff`:`Collapse diff`})]})},options:{diffStyle:d===`split`?`split`:`unified`,lineDiffType:`none`,overflow:h?`wrap`:`scroll`,theme:Ce(i),themeType:i,unsafeCSS:at,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:33},layout:{paddingTop:0,paddingBottom:8,gap:8}}},Y??lt)}):(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:Q.reason}),(0,I.jsx)(`pre`,{className:u(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,h?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:Q.text})]})}):Dt?(0,I.jsx)(fe,{label:K?`Loading checkpoint diff...`:W===`unstaged`?`Loading working tree diff...`:`Loading branch diff...`}):(0,I.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,I.jsx)(`p`,{children:kt?`No net changes in this selection.`:`No patch available for this selection.`})})]})}):(0,I.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,I.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,H as default};
98
- //# sourceMappingURL=DiffPanel-BQMTQ-tc.js.map
98
+ //# sourceMappingURL=DiffPanel-LdVJVEA7.js.map