@p4code/cli 0.1.47 → 0.1.48
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 +37 -10
- package/dist/client/assets/DiffPanel-CcCh3yaW.js +98 -0
- package/dist/client/assets/{FilePreviewPanel-3mponsnf.js → FilePreviewPanel-DfiTiyHt.js} +7 -7
- package/dist/client/assets/PreviewPanel-BUN0oQCp.js +2 -0
- package/dist/client/assets/PullRequestCodeTab-DzV-AeSF.js +251 -0
- package/dist/client/assets/arrow-right-CmnS08GR.js +2 -0
- package/dist/client/assets/{fileCommentAnnotations-D1IJuyQs.js → fileCommentAnnotations-Ckd97XTl.js} +2 -2
- package/dist/client/assets/index-KbcBrY8u.js +1067 -0
- package/dist/client/assets/{renderFileChildren-BgE2D-9e.js → renderFileChildren-BFjFkvfF.js} +2 -2
- package/dist/client/assets/terminal-links-CbkAv5Ji.js +47 -0
- package/dist/client/assets/{toggle-group-D0YAb1xh.js → toggle-group-C3woDObP.js} +2 -2
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/DiffPanel-CZ1s-Iug.js +0 -98
- package/dist/client/assets/PreviewPanel-CWZwRMlA.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-C7nXySfj.js +0 -251
- package/dist/client/assets/arrow-right-ErO11CiL.js +0 -2
- package/dist/client/assets/index-CEYXdFfh.js +0 -1058
- package/dist/client/assets/terminal-links-DFgxYsvC.js +0 -46
package/dist/bin.mjs
CHANGED
|
@@ -237,7 +237,7 @@ const make$87 = () => {
|
|
|
237
237
|
const layer$79 = Layer.sync(NetService, make$87);
|
|
238
238
|
//#endregion
|
|
239
239
|
//#region package.json
|
|
240
|
-
var version = "0.1.
|
|
240
|
+
var version = "0.1.48";
|
|
241
241
|
//#endregion
|
|
242
242
|
//#region src/config.ts
|
|
243
243
|
/**
|
|
@@ -276,6 +276,7 @@ const deriveServerPaths = Effect.fn(function* (baseDir, devUrl, options = {}) {
|
|
|
276
276
|
settingsPath: join(stateDir, "settings.json"),
|
|
277
277
|
providerStatusCacheDir,
|
|
278
278
|
worktreesDir: join(baseDir, "worktrees"),
|
|
279
|
+
chatWorkspaceDir: join(baseDir, "chat"),
|
|
279
280
|
attachmentsDir,
|
|
280
281
|
mdxBuildsDir,
|
|
281
282
|
logsDir,
|
|
@@ -301,6 +302,7 @@ const ensureServerDirectories = Effect.fn(function* (derivedPaths) {
|
|
|
301
302
|
fs.makeDirectory(derivedPaths.attachmentsDir, { recursive: true }),
|
|
302
303
|
fs.makeDirectory(derivedPaths.mdxBuildsDir, { recursive: true }),
|
|
303
304
|
fs.makeDirectory(derivedPaths.worktreesDir, { recursive: true }),
|
|
305
|
+
fs.makeDirectory(derivedPaths.chatWorkspaceDir, { recursive: true }),
|
|
304
306
|
fs.makeDirectory(path.dirname(derivedPaths.keybindingsConfigPath), { recursive: true }),
|
|
305
307
|
fs.makeDirectory(path.dirname(derivedPaths.settingsPath), { recursive: true }),
|
|
306
308
|
fs.makeDirectory(derivedPaths.providerStatusCacheDir, { recursive: true }),
|
|
@@ -990,6 +992,16 @@ const RuntimeTaskId = makeEntityId("RuntimeTaskId");
|
|
|
990
992
|
const ApprovalRequestId = makeEntityId("ApprovalRequestId");
|
|
991
993
|
const CheckpointRef = makeEntityId("CheckpointRef");
|
|
992
994
|
//#endregion
|
|
995
|
+
//#region ../../packages/contracts/src/chatProject.ts
|
|
996
|
+
/**
|
|
997
|
+
* Reserved pseudo-project that owns P4 Chat threads. It has no
|
|
998
|
+
* `projection_projects` row, so it never appears in project listings;
|
|
999
|
+
* clients and the server identify chat threads solely through this
|
|
1000
|
+
* constant. The value is persisted in thread rows and must never change.
|
|
1001
|
+
*/
|
|
1002
|
+
const P4_CHAT_PROJECT_ID = ProjectId.make("a67cca3e-9f3c-4e30-9d09-58ef21051f7a");
|
|
1003
|
+
const isChatProject = (projectId) => projectId === P4_CHAT_PROJECT_ID;
|
|
1004
|
+
//#endregion
|
|
993
1005
|
//#region ../../packages/contracts/src/auth.ts
|
|
994
1006
|
/**
|
|
995
1007
|
* Declares the server's overall authentication posture.
|
|
@@ -34608,6 +34620,7 @@ function checkpointRefForThreadTurn(threadId, turnCount) {
|
|
|
34608
34620
|
return CheckpointRef.make(`${CHECKPOINT_REFS_PREFIX}/${Encoding.encodeBase64Url(threadId)}/turn/${turnCount}`);
|
|
34609
34621
|
}
|
|
34610
34622
|
function resolveThreadWorkspaceCwd(input) {
|
|
34623
|
+
if (input.chatWorkspaceDir !== void 0 && isChatProject(input.thread.projectId)) return input.chatWorkspaceDir;
|
|
34611
34624
|
const worktreeCwd = input.thread.worktreePath ?? void 0;
|
|
34612
34625
|
if (worktreeCwd) return worktreeCwd;
|
|
34613
34626
|
return input.projects.find((project) => project.id === input.thread.projectId)?.workspaceRoot;
|
|
@@ -101687,7 +101700,8 @@ const make$2 = Effect.gen(function* () {
|
|
|
101687
101700
|
const project = yield* resolveProject(thread.projectId);
|
|
101688
101701
|
const cwd = resolveThreadWorkspaceCwd({
|
|
101689
101702
|
thread,
|
|
101690
|
-
projects: project ? [project] : []
|
|
101703
|
+
projects: project ? [project] : [],
|
|
101704
|
+
chatWorkspaceDir: serverConfig.chatWorkspaceDir
|
|
101691
101705
|
});
|
|
101692
101706
|
return [userSkillsDir, ...cwd ? [path.join(cwd, ".claude", "skills")] : []];
|
|
101693
101707
|
});
|
|
@@ -101783,7 +101797,8 @@ const make$2 = Effect.gen(function* () {
|
|
|
101783
101797
|
const project = yield* resolveProject(thread.projectId);
|
|
101784
101798
|
const effectiveCwd = resolveThreadWorkspaceCwd({
|
|
101785
101799
|
thread,
|
|
101786
|
-
projects: project ? [project] : []
|
|
101800
|
+
projects: project ? [project] : [],
|
|
101801
|
+
chatWorkspaceDir: serverConfig.chatWorkspaceDir
|
|
101787
101802
|
});
|
|
101788
101803
|
const startProviderSession = (input) => {
|
|
101789
101804
|
threadSessionRulesetModes.set(threadId, thread.compressMode);
|
|
@@ -102014,7 +102029,8 @@ const make$2 = Effect.gen(function* () {
|
|
|
102014
102029
|
const project = yield* resolveProject(thread.projectId);
|
|
102015
102030
|
const generationCwd = resolveThreadWorkspaceCwd({
|
|
102016
102031
|
thread,
|
|
102017
|
-
projects: project ? [project] : []
|
|
102032
|
+
projects: project ? [project] : [],
|
|
102033
|
+
chatWorkspaceDir: serverConfig.chatWorkspaceDir
|
|
102018
102034
|
}) ?? process.cwd();
|
|
102019
102035
|
const generationInput = {
|
|
102020
102036
|
messageText: message.text,
|
|
@@ -103247,6 +103263,19 @@ const TAILSCALE_STATUS_TIMEOUT = Duration.millis(1500);
|
|
|
103247
103263
|
const TAILSCALE_SERVE_TIMEOUT = Duration.seconds(10);
|
|
103248
103264
|
Duration.millis(2500);
|
|
103249
103265
|
const tailscaleCommandForPlatform = (platform) => platform === "win32" ? "tailscale.exe" : "tailscale";
|
|
103266
|
+
const MACOS_TAILSCALE_FALLBACK_PATHS = [
|
|
103267
|
+
"/usr/local/bin/tailscale",
|
|
103268
|
+
"/opt/homebrew/bin/tailscale",
|
|
103269
|
+
"/Applications/Tailscale.app/Contents/MacOS/Tailscale"
|
|
103270
|
+
];
|
|
103271
|
+
const tailscaleSpawnCandidates = (platform) => {
|
|
103272
|
+
const executable = tailscaleCommandForPlatform(platform);
|
|
103273
|
+
return platform === "darwin" ? [executable, ...MACOS_TAILSCALE_FALLBACK_PATHS] : [executable];
|
|
103274
|
+
};
|
|
103275
|
+
const spawnTailscaleChild = (spawner, platform, args) => {
|
|
103276
|
+
const [firstCandidate, ...fallbackCandidates] = tailscaleSpawnCandidates(platform);
|
|
103277
|
+
return fallbackCandidates.reduce((attempt, candidate) => attempt.pipe(Effect.catch(() => spawner.spawn(ChildProcess.make(candidate, args)))), spawner.spawn(ChildProcess.make(firstCandidate, args)));
|
|
103278
|
+
};
|
|
103250
103279
|
const TailscaleCommandContext = {
|
|
103251
103280
|
executable: Schema$1.Literals(["tailscale", "tailscale.exe"]),
|
|
103252
103281
|
subcommand: Schema$1.Literals(["status", "serve"]),
|
|
@@ -103361,14 +103390,13 @@ Effect.gen(function* () {
|
|
|
103361
103390
|
const args = ["status", "--json"];
|
|
103362
103391
|
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
103363
103392
|
const hostPlatform = yield* HostProcessPlatform;
|
|
103364
|
-
const executable = tailscaleCommandForPlatform(hostPlatform);
|
|
103365
103393
|
const commandContext = {
|
|
103366
|
-
executable,
|
|
103394
|
+
executable: tailscaleCommandForPlatform(hostPlatform),
|
|
103367
103395
|
subcommand: "status",
|
|
103368
103396
|
argumentCount: args.length
|
|
103369
103397
|
};
|
|
103370
103398
|
return yield* Effect.gen(function* () {
|
|
103371
|
-
const child = yield* spawner
|
|
103399
|
+
const child = yield* spawnTailscaleChild(spawner, hostPlatform, args).pipe(Effect.mapError((cause) => new TailscaleCommandSpawnError({
|
|
103372
103400
|
...commandContext,
|
|
103373
103401
|
cause
|
|
103374
103402
|
})));
|
|
@@ -103397,15 +103425,14 @@ Effect.gen(function* () {
|
|
|
103397
103425
|
const runTailscaleCommand = (args, timeoutInput) => Effect.gen(function* () {
|
|
103398
103426
|
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
103399
103427
|
const hostPlatform = yield* HostProcessPlatform;
|
|
103400
|
-
const executable = tailscaleCommandForPlatform(hostPlatform);
|
|
103401
103428
|
const commandContext = {
|
|
103402
|
-
executable,
|
|
103429
|
+
executable: tailscaleCommandForPlatform(hostPlatform),
|
|
103403
103430
|
subcommand: "serve",
|
|
103404
103431
|
argumentCount: args.length
|
|
103405
103432
|
};
|
|
103406
103433
|
const timeout = Duration.fromInputUnsafe(timeoutInput);
|
|
103407
103434
|
return yield* Effect.gen(function* () {
|
|
103408
|
-
const child = yield* spawner
|
|
103435
|
+
const child = yield* spawnTailscaleChild(spawner, hostPlatform, args).pipe(Effect.mapError((cause) => new TailscaleCommandSpawnError({
|
|
103409
103436
|
...commandContext,
|
|
103410
103437
|
cause
|
|
103411
103438
|
})));
|
|
@@ -0,0 +1,98 @@
|
|
|
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{$s as i,Ci as a,Di as o,Fi as s,Fn as ee,Ii as c,Li as l,Nc as te,Ni as ne,Oc as u,Oi as d,Pi as re,Qs as f,Rc as p,S as m,Sc as h,Tt as g,Zs as _,_c as ie,am as v,b as y,ct as b,ec as x,i as S,j as C,kn as ae,ol as w,u as T,v as E,wn as D,xt as oe,y as O,yi as k}from"./terminal-links-CbkAv5Ji.js";import{t as A}from"./arrow-right-CmnS08GR.js";import{a as se,i as j,n as M,o as ce,r as le,s as ue,t as de}from"./toggle-group-C3woDObP.js";import{$n as fe,F as pe,Fr as me,Hr as he,I as ge,Ir as _e,J as ve,L as N,Lr as ye,Qn as be,Wr as xe,Zn as Se,_ as Ce,ar as we,at as Te,ct as Ee,dt as De,er as Oe,h as ke,ir as Ae,lt as je,mi as Me,nr as Ne,ot as Pe,pi as Fe,pr as Ie,q as Le,rr as Re,sr as ze,st as Be,tr as Ve,ut as He,zr as Ue}from"./index-KbcBrY8u.js";import{a as P,n as We}from"./fileCommentAnnotations-Ckd97XTl.js";var Ge=x(`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 Ke({threadRef:e,filePath:t,activeCwd:n,openInEditor:r}){if(e){E.getState().openFile(e,t);return}r(n?S(t,n):t)}var I=r();function qe(e,t){let n=(0,I.c)(4),r=ze(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(),Je=[];function Ye(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function R(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,I.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:s,className:c,renderHeaderPrefix:l}=e,te=D($e),ne=D(B),u;t[0]===a?u=t[1]:(u=e=>e.getComposerDraft(a)?.reviewComments??Je,t[0]=a,t[1]=u);let d=D(u),[re,f]=(0,F.useState)(null),[p,m]=(0,F.useState)(null),h;t[2]===n?h=t[3]:(h=new Map(n.map(Qe)),t[2]=n,t[3]=h);let g=h,_;if(t[4]!==p||t[5]!==n||t[6]!==d||t[7]!==r){let e;t[9]!==p||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=ee(t,n);return r?R(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=p?.fileKey===i?[...o,p.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:Pe(`${a?`1`:`0`}:${s.flatMap(z).join(`:`)}`)}},t[9]=p,t[10]=d,t[11]=r,t[12]=e):e=t[12],_=n.map(e),t[4]=p,t[5]=n,t[6]=d,t[7]=r,t[8]=_}else _=t[8];let ie=_,v;t[13]!==a||t[14]!==p?.annotation||t[15]!==ne?(v=e=>{f(null),p?.annotation.metadata.entries.some(t=>t.id===e)?m(null):ne(a,e)},t[13]=a,t[14]=p?.annotation,t[15]=ne,t[16]=v):v=t[16];let y=v,b;t[17]!==te||t[18]!==a||t[19]!==p||t[20]!==g||t[21]!==r||t[22]!==i?(b=(e,t)=>{let n=p?.annotation.metadata.entries.find(t=>t.id===e),o=p?g.get(p.fileKey):void 0;if(!n||!o)return;let s=ae({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});s&&te(a,s),f(null),m(null)},t[17]=te,t[18]=a,t[19]=p,t[20]=g,t[21]=r,t[22]=i,t[23]=b):b=t[23];let x=b,S;t[24]!==g||t[25]!==r||t[26]!==i?(S=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=g.get(n.id);if(!a)return;let o=We(),s=ae({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});s&&m({fileKey:n.id,annotation:{side:Ye(e),lineNumber:e.end,metadata:{entries:[{id:o,kind:`draft`,range:e,rangeLabel:s.rangeLabel,text:``}]}}})},t[24]=g,t[25]=r,t[26]=i,t[27]=S):S=t[27];let C=S,w=p!==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 oe=!w,O=!w,k;t[32]!==C||t[33]!==o||t[34]!==O||t[35]!==oe?(k={...o,enableGutterUtility:oe,enableLineSelection:O,onLineSelectionEnd:C},t[32]=C,t[33]=o,t[34]=O,t[35]=oe,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]!==y||t[40]!==x?(j=e=>(0,L.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,L.jsx)(P,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>y(e.id),onComment:t=>x(e.id,t),onDelete:()=>y(e.id)},e.id))}),t[39]=y,t[40]=x,t[41]=j):j=t[41];let M;return t[42]!==ie||t[43]!==re||t[44]!==k||t[45]!==A||t[46]!==j||t[47]!==T||t[48]!==E?(M=(0,L.jsx)(se,{...T,...E,items:ie,selectedLines:re,onSelectedLinesChange:f,options:k,renderHeaderPrefix:A,renderAnnotation:j}),t[42]=ie,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 z(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 B(e){return e.removeReviewComment}function $e(e){return e.addReviewComment}function et(e){return{diffPreview:h(e,{label:`environment-data:review:diff-preview`,tag:w.reviewGetDiffPreview,staleTimeMs:5e3})}}var tt=et(g);function V(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)&&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 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 H=`__automatic_base_ref__`,it=new Set,at=`
|
|
2
|
+
[data-diffs-header],
|
|
3
|
+
[data-diff],
|
|
4
|
+
[data-file],
|
|
5
|
+
[data-error-wrapper],
|
|
6
|
+
[data-virtualizer-buffer] {
|
|
7
|
+
--diffs-header-font-family: var(--font-sans) !important;
|
|
8
|
+
--diffs-font-family: var(--font-mono) !important;
|
|
9
|
+
--diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
10
|
+
--diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
11
|
+
--diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
12
|
+
--diffs-token-light-bg: transparent;
|
|
13
|
+
--diffs-token-dark-bg: transparent;
|
|
14
|
+
|
|
15
|
+
--diffs-bg-context-override: color-mix(in srgb, var(--background) 97%, var(--foreground));
|
|
16
|
+
--diffs-bg-hover-override: color-mix(in srgb, var(--background) 94%, var(--foreground));
|
|
17
|
+
--diffs-bg-separator-override: color-mix(in srgb, var(--background) 95%, var(--foreground));
|
|
18
|
+
--diffs-bg-buffer-override: color-mix(in srgb, var(--background) 90%, var(--foreground));
|
|
19
|
+
|
|
20
|
+
--diffs-bg-addition-override: color-mix(in srgb, var(--background) 92%, var(--success));
|
|
21
|
+
--diffs-bg-addition-number-override: color-mix(in srgb, var(--background) 88%, var(--success));
|
|
22
|
+
--diffs-bg-addition-hover-override: color-mix(in srgb, var(--background) 85%, var(--success));
|
|
23
|
+
--diffs-bg-addition-emphasis-override: color-mix(in srgb, var(--background) 80%, var(--success));
|
|
24
|
+
|
|
25
|
+
--diffs-bg-deletion-override: color-mix(in srgb, var(--background) 92%, var(--destructive));
|
|
26
|
+
--diffs-bg-deletion-number-override: color-mix(in srgb, var(--background) 88%, var(--destructive));
|
|
27
|
+
--diffs-bg-deletion-hover-override: color-mix(in srgb, var(--background) 85%, var(--destructive));
|
|
28
|
+
--diffs-bg-deletion-emphasis-override: color-mix(
|
|
29
|
+
in srgb,
|
|
30
|
+
var(--background) 80%,
|
|
31
|
+
var(--destructive)
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
background-color: var(--diffs-bg) !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[data-file-info] {
|
|
38
|
+
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
39
|
+
border-block-color: var(--border) !important;
|
|
40
|
+
color: var(--foreground) !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-diffs-header] {
|
|
44
|
+
position: sticky !important;
|
|
45
|
+
top: 0;
|
|
46
|
+
z-index: 4;
|
|
47
|
+
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
48
|
+
border-bottom: 1px solid var(--border) !important;
|
|
49
|
+
align-items: center !important;
|
|
50
|
+
font-family: var(--font-sans) !important;
|
|
51
|
+
font-size: 12px !important;
|
|
52
|
+
line-height: 1 !important;
|
|
53
|
+
min-height: 32px !important;
|
|
54
|
+
padding-block: 6px !important;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
[data-diffs-header] [data-header-content] {
|
|
58
|
+
align-items: center !important;
|
|
59
|
+
line-height: 1 !important;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[data-diffs-header] [data-metadata] {
|
|
63
|
+
align-items: center !important;
|
|
64
|
+
line-height: 1 !important;
|
|
65
|
+
font-variant-numeric: tabular-nums;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[data-diffs-header] [data-additions-count],
|
|
69
|
+
[data-diffs-header] [data-deletions-count] {
|
|
70
|
+
font-family: var(--font-mono) !important;
|
|
71
|
+
font-size: 11px !important;
|
|
72
|
+
font-variant-numeric: tabular-nums;
|
|
73
|
+
line-height: 1 !important;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[data-diffs-header] [data-change-icon],
|
|
77
|
+
[data-diffs-header] [data-rename-icon] {
|
|
78
|
+
display: block;
|
|
79
|
+
flex-shrink: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
[data-title] {
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
transition:
|
|
85
|
+
color 120ms ease,
|
|
86
|
+
text-decoration-color 120ms ease;
|
|
87
|
+
text-decoration: underline;
|
|
88
|
+
text-decoration-color: transparent;
|
|
89
|
+
text-underline-offset: 2px;
|
|
90
|
+
font-family: var(--font-sans) !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
[data-title]:hover {
|
|
94
|
+
color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;
|
|
95
|
+
text-decoration-color: currentColor;
|
|
96
|
+
}
|
|
97
|
+
`;function U({mode:e=`inline`,composerDraftTarget:t,initialGitScope:n}){let{resolvedTheme:r}=T(),ee=Ue(),[h]=(0,F.useState)(n),[g,x]=(0,F.useState)(`stacked`),[S,ae]=(0,F.useState)(ee.wordWrap),[w,E]=(0,F.useState)(ee.diffIgnoreWhitespace),[D,se]=(0,F.useState)(``),[Ce,Pe]=(0,F.useState)(()=>({scopeKey:null,fileKeys:it})),ze=(0,F.useRef)(null),P=v({strict:!1,select:e=>b(e)}),We=P?.threadId??null,I=ye(P),Je=I?.projectId??null,Ye=_e(I&&Je?{environmentId:I.environmentId,projectId:Je}:null),R=I?.worktreePath??Ye?.workspaceRoot,z=ie(oe.configValueAtom(I?.environmentId??null)),Ze=we(I?.environmentId??null,z?.availableEditors??[]),Qe=C(I!=null&&R!=null?me.status({environmentId:I.environmentId,input:{cwd:R}}):null),B=N(e=>ge(e.byThreadKey,P,h===`unstaged`)),$e=Qe.data?.isRepo??!0,{turnDiffSummaries:et,inferredCheckpointTurnCountByTurnId:V}=pe(I),U=(0,F.useMemo)(()=>[...et].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,et]);(0,F.useEffect)(()=>{!P||B.kind!==`turn`||N.getState().reconcileTurnSelection(P,U.map(e=>e.turnId))},[B,U,P]);let W=B.kind===`turn`?B.turnId:null,G=B.kind===`unstaged`?`unstaged`:`branch`,K=B.kind===`branch`?B.baseRef:null,ot=B.kind===`turn`?B.filePath:null,st=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]),ct=U[0],lt=W===null?G===`unstaged`?`Working tree`:`Branch changes`:q?.turnId===ct?.turnId?`Latest turn`:`Turn ${J??`?`}`,ut=q?`turn:${q.turnId}`:G,Y=P?`${P.environmentId}:${P.threadId}:${ut}`:null,dt=Ce.scopeKey===Y?Ce.fileKeys:it,ft=q?`Turn ${J??`?`}`:G===`unstaged`?`Working tree`:`Branch changes`,pt=(0,F.useMemo)(()=>typeof J==`number`?{fromTurnCount:Math.max(0,J-1),toTurnCount:J}:null,[J]),mt=qe({environmentId:I?.environmentId??null,threadId:We,fromTurnCount:pt?.fromTurnCount??null,toTurnCount:pt?.toTurnCount??null,ignoreWhitespace:w,cacheScope:q?`turn:${q.turnId}`:null},{enabled:$e&&q!==void 0}),ht=C(W===null&&I&&R?tt.diffPreview({environmentId:I.environmentId,input:{cwd:R,...K?{baseRef:K}:{},ignoreWhitespace:w}}):null),gt=W===null&&ht.error?.includes(`configured workspace root`)===!0&&z?.cwd!==void 0&&z.cwd!==R,_t=C(gt&&I&&z?tt.diffPreview({environmentId:I.environmentId,input:{cwd:z.cwd,...K?{baseRef:K}:{},ignoreWhitespace:w}}):null),X=gt?_t:ht,Z=X.data?.sources.find(e=>e.kind===(G===`unstaged`?`working-tree`:`branch-range`)),vt=C(W===null&&G===`branch`&&I&&X.data?.cwd?me.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...D.trim().length>0?{query:D.trim()}:{},limit:100}}):null),yt=C(W===null&&G===`branch`&&I&&X.data?.cwd?me.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...D.trim().length>0?{query:D.trim()}:{},limit:100}}):null),bt=nt(vt.data?.refs.filter(e=>e.name!==Z?.headRef)??[],yt.data?.refs??[]),xt=rt(bt,D),St=e=>K&&K===e.remote?.name?K:e.local?.name??e.remote?.name??e.id,Ct=[H,...bt.map(St)],wt=[...D.trim().length===0?[H]:[],...xt.map(St)],Tt=Z?.diff,Et=q?mt.data?.diff:Tt,Dt=!q&&Z?.truncated===!0,Ot=q?mt.isPending:X.isPending,kt=q?mt.error:X.error,At=typeof Et==`string`&&Et.trim().length===0,Q=(0,F.useMemo)(()=>je(Et,`diff-panel:${r}`,{compactPartialHunkOffsets:W===null}),[r,Et,W]),jt=(0,F.useMemo)(()=>!Q||Q.kind!==`files`?[]:Q.files.toSorted((e,t)=>De(e).localeCompare(De(t),void 0,{numeric:!0,sensitivity:`base`})),[Q]),$=(0,F.useMemo)(()=>jt.map(e=>{let t=Te(e);return{fileDiff:e,filePath:De(e),fileKey:t,collapsed:dt.has(t)}}),[dt,jt]),Mt=(0,F.useMemo)(()=>$.map(e=>e.fileKey),[$]),Nt=le(Mt,dt),Pt=(0,F.useMemo)(()=>Ee(jt),[jt]);(0,F.useEffect)(()=>{if(!ot)return;let e=$.find(e=>e.filePath===ot);e&&ze.current?.scrollTo({type:`item`,id:e.fileKey,align:`start`})},[$,ot,st]);let Ft=(0,F.useCallback)(e=>{Ke({threadRef:P,filePath:e,activeCwd:R,openInEditor:e=>{(async()=>{let t=await Ze(e);t._tag===`Failure`&&!u(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,...P?{environmentId:P.environmentId,threadId:P.threadId}:{},...p(te(t))})})()}})},[R,Ze,P]),It=(0,F.useCallback)(e=>{Pe(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)(()=>{Pe(e=>{let t=e.scopeKey===Y?e.fileKeys:it;return{scopeKey:Y,fileKeys:j(Mt,t)}})},[Y,Mt]),Rt=e=>{P&&N.getState().selectTurn(P,e)},zt=e=>{P&&N.getState().selectGitScope(P,e)},Bt=e=>{P&&N.getState().selectBranchBaseRef(P,e)};return(0,L.jsx)(ve,{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)(a,{children:[(0,L.jsxs)(c,{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: ${lt}`,children:[(0,L.jsx)(`span`,{className:`truncate`,children:lt}),(0,L.jsx)(f,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,L.jsxs)(d,{align:`start`,className:`w-60`,children:[(0,L.jsx)(o,{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)(o,{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)(o,{className:W!==null&&q?.turnId===ct?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>{ct&&Rt(ct.turnId)},children:(0,L.jsx)(`span`,{children:`Latest turn`})}),(0,L.jsxs)(ne,{children:[(0,L.jsx)(s,{children:`Turn`}),(0,L.jsx)(re,{className:`w-64`,children:U.map(e=>{let t=e.checkpointTurnCount??V[e.turnId]??`?`;return(0,L.jsxs)(o,{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:Ie(e.completedAt,ee.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)(A,{className:`size-3.5 shrink-0 opacity-70`}),(0,L.jsxs)(be,{items:Ct,filteredItems:wt,value:K??H,onOpenChange:e=>{e||se(``)},onValueChange:e=>{e&&Bt(e===H?null:e)},children:[(0,L.jsxs)(Ae,{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)(f,{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)(xe,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55`}),(0,L.jsx)(Oe,{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:D,onChange:e=>se(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)(fe,{children:`No matching refs.`}),(0,L.jsxs)(Ne,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,L.jsx)(Ve,{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`})}),bt.map(e=>{let t=St(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,L.jsx)(Ve,{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)(Se,{"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)(i,{"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)(ke,{additions:Pt.additions,deletions:Pt.deletions,className:`mr-1 text-[11px]`,layout:`inline`}),$.length>0&&(0,L.jsxs)(O,{children:[(0,L.jsx)(m,{render:(0,L.jsx)(k,{type:`button`,size:`icon-xs`,variant:`outline`,"aria-label":Nt?`Expand all files`:`Collapse all files`,onClick:Lt}),children:Nt?(0,L.jsx)(Fe,{className:`size-3`}):(0,L.jsx)(Me,{className:`size-3`})}),(0,L.jsx)(y,{side:`top`,children:Nt?`Expand all files`:`Collapse all files`})]}),(0,L.jsxs)(M,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[g],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&x(t)},children:[(0,L.jsx)(de,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,L.jsx)(ce,{className:`size-3`})}),(0,L.jsx)(de,{"aria-label":`Split diff view`,value:`split`,children:(0,L.jsx)(ue,{className:`size-3`})})]}),(0,L.jsxs)(O,{children:[(0,L.jsx)(m,{render:(0,L.jsx)(de,{"aria-label":S?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`outline`,size:`xs`,pressed:S,onPressedChange:e=>{ae(!!e)}}),children:(0,L.jsx)(he,{className:`size-3`})}),(0,L.jsx)(y,{side:`top`,children:S?`Disable line wrapping`:`Enable line wrapping`})]}),(0,L.jsxs)(O,{children:[(0,L.jsx)(m,{render:(0,L.jsx)(de,{"aria-label":w?`Show whitespace changes`:`Hide whitespace changes`,variant:`outline`,size:`xs`,pressed:w,onPressedChange:e=>{E(!!e)}}),children:(0,L.jsx)(Ge,{className:`size-3`})}),(0,L.jsx)(y,{side:`top`,children:w?`Show whitespace changes`:`Hide whitespace changes`})]})]})]}),children:I?$e?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:[Dt&&(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.`}),kt&&!Q&&(0,L.jsx)(`div`,{className:`px-3`,children:(0,L.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:kt})}),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)(Xe,{viewerRef:ze,className:`diff-render-surface h-full min-h-0 overflow-auto`,files:$,sectionId:ut,sectionTitle:ft,composerDraftTarget:t,renderHeaderPrefix:(e,t,n)=>{let r=De(e);return(0,L.jsxs)(O,{children:[(0,L.jsx)(m,{render:(0,L.jsx)(`button`,{type:`button`,className:l(`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`,Be(e)),"aria-label":n?`Expand ${r}`:`Collapse ${r}`,"aria-expanded":!n,onClick:e=>{e.stopPropagation(),It(t)}}),children:n?(0,L.jsx)(_,{className:`size-4`}):(0,L.jsx)(f,{className:`size-4`})}),(0,L.jsx)(y,{side:`top`,children:n?`Expand diff`:`Collapse diff`})]})},options:{diffStyle:g===`split`?`split`:`unified`,lineDiffType:`none`,overflow:S?`wrap`:`scroll`,theme:He(r),themeType:r,unsafeCSS:at,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:33},layout:{paddingTop:0,paddingBottom:8,gap:8}}},Y??ut)}):(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:l(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,S?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:Q.text})]})}):Ot?(0,L.jsx)(Le,{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:At?`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{Ce as DiffWorkerPoolProvider,U as default};
|
|
98
|
+
//# sourceMappingURL=DiffPanel-CcCh3yaW.js.map
|