@p4code/cli 0.6.10 → 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 +65 -21
- package/dist/client/assets/{DiffPanel-DMhFJ-2N.js → DiffPanel-LdVJVEA7.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-1CMq7EG7.js → FilePreviewPanel-OONhxVl2.js} +4 -4
- package/dist/client/assets/PreviewPanel-CI0So2xt.js +2 -0
- package/dist/client/assets/{PullRequestCodeTab-BeEliDpc.js → PullRequestCodeTab-Cw8x7iAG.js} +2 -2
- package/dist/client/assets/{fileCommentAnnotations-frlpWfv_.js → fileCommentAnnotations-CKXyKV65.js} +2 -2
- package/dist/client/assets/{index-Bia2x-5A.js → index-zIgT1Y-z.js} +242 -233
- package/dist/client/assets/previewAssetResource-DEZquWCb.js +48 -0
- package/dist/client/assets/{renderFileChildren-B-gNWy28.js → renderFileChildren-BJJohpja.js} +2 -2
- package/dist/client/assets/{toggle-group-BPW-Z2uw.js → toggle-group-CX-BX4R0.js} +2 -2
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/PreviewPanel-DtP4hYaH.js +0 -2
- package/dist/client/assets/previewAssetResource-AzHfcBQJ.js +0 -48
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.
|
|
269
|
+
var version$1 = "0.6.12";
|
|
270
270
|
//#endregion
|
|
271
271
|
//#region src/config.ts
|
|
272
272
|
/**
|
|
@@ -10949,6 +10949,7 @@ const ClientSettingsSchema = Schema$1.Struct({
|
|
|
10949
10949
|
loadBalancingEnabled: Schema$1.Boolean.pipe(Schema$1.withDecodingDefault(Effect.succeed(false))),
|
|
10950
10950
|
loadBalancingWeights: LoadBalancingWeights.pipe(Schema$1.withDecodingDefault(Effect.succeed({}))),
|
|
10951
10951
|
appFontId: AppFontId.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_APP_FONT_ID))),
|
|
10952
|
+
attentionNotifications: Schema$1.Boolean.pipe(Schema$1.withDecodingDefault(Effect.succeed(false))),
|
|
10952
10953
|
autoOpenPlanSidebar: Schema$1.Boolean.pipe(Schema$1.withDecodingDefault(Effect.succeed(false))),
|
|
10953
10954
|
btwDefaultModelSelection: ModelSelection.pipe(Schema$1.withDecodingDefault(Effect.succeed(DEFAULT_BTW_MODEL_SELECTION))),
|
|
10954
10955
|
composerControlsExpanded: Schema$1.Boolean.pipe(Schema$1.withDecodingDefault(Effect.succeed(true))),
|
|
@@ -11006,6 +11007,11 @@ const JevPrefetchTimeoutMs = Schema$1.Int.check(Schema$1.isBetween({
|
|
|
11006
11007
|
minimum: 100,
|
|
11007
11008
|
maximum: 3e4
|
|
11008
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
|
+
}));
|
|
11009
11015
|
Schema$1.Literals([
|
|
11010
11016
|
"auto",
|
|
11011
11017
|
"local",
|
|
@@ -11416,6 +11422,8 @@ const ServerSettings = Schema$1.Struct({
|
|
|
11416
11422
|
* `enableJevPrefetch`; every failure path is what the pair did without it.
|
|
11417
11423
|
*/
|
|
11418
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))),
|
|
11419
11427
|
/**
|
|
11420
11428
|
* Whether the board offers the scoping agent: the Scope action on a task and
|
|
11421
11429
|
* the panel that drafts a new one by interview.
|
|
@@ -11651,6 +11659,7 @@ const ServerSettingsPatch = Schema$1.Struct({
|
|
|
11651
11659
|
jevPrefetchTimeoutMs: Schema$1.optionalKey(JevPrefetchTimeoutMs),
|
|
11652
11660
|
enableJevAutoWorkspace: Schema$1.optionalKey(Schema$1.Boolean),
|
|
11653
11661
|
enableJevRoleRouting: Schema$1.optionalKey(Schema$1.Boolean),
|
|
11662
|
+
jevRoleRoutingMinConfidence: Schema$1.optionalKey(JevRoleRoutingMinConfidence),
|
|
11654
11663
|
enableScopingAgent: Schema$1.optionalKey(Schema$1.Boolean),
|
|
11655
11664
|
enablePlanPhase: Schema$1.optionalKey(Schema$1.Boolean),
|
|
11656
11665
|
writeGeneratedSkillsToRepo: Schema$1.optionalKey(Schema$1.Boolean),
|
|
@@ -11719,6 +11728,7 @@ Schema$1.Struct({
|
|
|
11719
11728
|
minimum: 10,
|
|
11720
11729
|
maximum: 20
|
|
11721
11730
|
}))),
|
|
11731
|
+
attentionNotifications: Schema$1.optionalKey(Schema$1.Boolean),
|
|
11722
11732
|
autoOpenPlanSidebar: Schema$1.optionalKey(Schema$1.Boolean),
|
|
11723
11733
|
btwDefaultModelSelection: Schema$1.optionalKey(ModelSelection),
|
|
11724
11734
|
composerControlsExpanded: Schema$1.optionalKey(Schema$1.Boolean),
|
|
@@ -12219,12 +12229,14 @@ const ServerLocalCliStatus = Schema$1.Struct({
|
|
|
12219
12229
|
const ServerLocalCliUpdateInput = Schema$1.Struct({ targetVersion: TrimmedNonEmptyString });
|
|
12220
12230
|
/**
|
|
12221
12231
|
* What happened to the background service: moved onto the new CLI, none was
|
|
12222
|
-
* installed,
|
|
12223
|
-
*
|
|
12232
|
+
* installed, installed but not loaded so there was no process to move, left on
|
|
12233
|
+
* the old CLI because its data directory could not be read back from the
|
|
12234
|
+
* installed unit, or the move was attempted and failed.
|
|
12224
12235
|
*/
|
|
12225
12236
|
const ServerLocalCliServiceOutcome = Schema$1.Literals([
|
|
12226
12237
|
"updated",
|
|
12227
12238
|
"not-installed",
|
|
12239
|
+
"not-running",
|
|
12228
12240
|
"left-unchanged",
|
|
12229
12241
|
"failed"
|
|
12230
12242
|
]);
|
|
@@ -126394,7 +126406,9 @@ const reconcileWithNewBinary = Effect.fn("cli.selfUpdate.reconcileWithNewBinary"
|
|
|
126394
126406
|
* the service onto itself. Unlike that command, the service keeps the data
|
|
126395
126407
|
* directory its unit was installed with; when that cannot be read back the
|
|
126396
126408
|
* service is left on the old CLI. The service step is skipped when no unit is
|
|
126397
|
-
* installed, because `service update` would otherwise install one, and
|
|
126409
|
+
* installed, because `service update` would otherwise install one, and when a
|
|
126410
|
+
* LaunchAgent running the global p4c is installed but not loaded, because there
|
|
126411
|
+
* is no running process to move and its next load already runs the new CLI. Nothing
|
|
126398
126412
|
* happens at all unless an npm install older than this app is present.
|
|
126399
126413
|
*
|
|
126400
126414
|
* Only an npm global install is found or updated. A CLI installed another way
|
|
@@ -126409,12 +126423,17 @@ const make$35 = Effect.fn("local_cli_update.make")(function* (options) {
|
|
|
126409
126423
|
const fs = yield* FileSystem.FileSystem;
|
|
126410
126424
|
const path = yield* Path$1.Path;
|
|
126411
126425
|
const platform = yield* HostProcessPlatform;
|
|
126426
|
+
const userId = yield* HostProcessUserId;
|
|
126412
126427
|
const homeDir = yield* Config.string("HOME").pipe(Config.withDefault(""));
|
|
126413
126428
|
const targetVersion = options?.targetVersion ?? version$1;
|
|
126414
126429
|
const desktop = serverConfig.mode === "desktop";
|
|
126415
126430
|
const lock = yield* Semaphore.make(1);
|
|
126416
126431
|
const withRunner = Effect.provideService(ProcessRunner, runner);
|
|
126417
126432
|
const unitPath = platform === "darwin" ? path.join(homeDir, "Library", "LaunchAgents", LAUNCH_AGENT_PLIST_FILE) : platform === "linux" ? path.join(homeDir, ".config", "systemd", "user", BOOT_SERVICE_UNIT_FILE) : null;
|
|
126433
|
+
const launchAgentLoaded = runner.run({
|
|
126434
|
+
command: "launchctl",
|
|
126435
|
+
args: ["print", `gui/${String(userId)}/${LAUNCH_AGENT_LABEL}`]
|
|
126436
|
+
}).pipe(Effect.map((result) => result.code === 0), Effect.orElseSucceed(() => true));
|
|
126418
126437
|
const probeInstalledVersion = Effect.gen(function* () {
|
|
126419
126438
|
const binaryPath = yield* resolveGlobalBinary("p4c");
|
|
126420
126439
|
if (!(yield* fs.exists(binaryPath))) return null;
|
|
@@ -126451,6 +126470,10 @@ const make$35 = Effect.fn("local_cli_update.make")(function* (options) {
|
|
|
126451
126470
|
installedVersion: installed,
|
|
126452
126471
|
service: "left-unchanged"
|
|
126453
126472
|
};
|
|
126473
|
+
if (platform === "darwin" && unit.includes(binaryPath) && !(yield* launchAgentLoaded)) return {
|
|
126474
|
+
installedVersion: installed,
|
|
126475
|
+
service: "not-running"
|
|
126476
|
+
};
|
|
126454
126477
|
return yield* reconcileWithNewBinary({
|
|
126455
126478
|
binaryPath,
|
|
126456
126479
|
baseDir: serviceBaseDir
|
|
@@ -137419,8 +137442,25 @@ const pauseFusionBudget = Effect.fn("pauseFusionBudget")(function* (input) {
|
|
|
137419
137442
|
});
|
|
137420
137443
|
//#endregion
|
|
137421
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
|
+
*/
|
|
137422
137462
|
/** Below this, the owner is reported as unresolved rather than as a pick. */
|
|
137423
|
-
const JEV_ROLE_ROUTE_MIN_CONFIDENCE =
|
|
137463
|
+
const JEV_ROLE_ROUTE_MIN_CONFIDENCE = DEFAULT_JEV_ROLE_ROUTING_MIN_CONFIDENCE;
|
|
137424
137464
|
const JEV_ROLE_ROUTE_HINT_PREFIX = "[jev-role-route]";
|
|
137425
137465
|
const OWNERS = [
|
|
137426
137466
|
"supervisor",
|
|
@@ -137509,7 +137549,7 @@ function buildRoleRouteState(input, budgetTokens = roleRouteStateBudgetTokens())
|
|
|
137509
137549
|
return null;
|
|
137510
137550
|
}
|
|
137511
137551
|
/** Reads one answer into an owner, or an unresolved route with the reason. */
|
|
137512
|
-
function readRoleRoute(answer) {
|
|
137552
|
+
function readRoleRoute(answer, minConfidence = JEV_ROLE_ROUTE_MIN_CONFIDENCE) {
|
|
137513
137553
|
if (answer === void 0) return {
|
|
137514
137554
|
kind: "unresolved",
|
|
137515
137555
|
reason: "Jev did not answer"
|
|
@@ -137523,7 +137563,7 @@ function readRoleRoute(answer) {
|
|
|
137523
137563
|
kind: "unresolved",
|
|
137524
137564
|
reason: "Jev picked an unknown owner"
|
|
137525
137565
|
};
|
|
137526
|
-
if (answer.confidence <
|
|
137566
|
+
if (answer.confidence < minConfidence) return {
|
|
137527
137567
|
kind: "unresolved",
|
|
137528
137568
|
reason: `Jev leaned ${owner} at confidence ${answer.confidence.toFixed(2)}`
|
|
137529
137569
|
};
|
|
@@ -137638,16 +137678,17 @@ const BUILDER_END_CHECKS = [
|
|
|
137638
137678
|
/** The answers whose confidence decides whether a Builder ending is judged at all. */
|
|
137639
137679
|
const BUILDER_END_DECISIVE = /* @__PURE__ */ new Set(["builder-continue", "builder-conflict"]);
|
|
137640
137680
|
/** Reads a Builder-end answer set into its findings and whether Jev was unsure. */
|
|
137641
|
-
function readBuilderEndJudgment(answers, phase) {
|
|
137681
|
+
function readBuilderEndJudgment(answers, phase, minConfidence = JEV_ROLE_ROUTE_MIN_CONFIDENCE) {
|
|
137642
137682
|
const lowConfidence = BUILDER_END_CHECKS.some((check) => {
|
|
137643
137683
|
if (!BUILDER_END_DECISIVE.has(check.question.id)) return false;
|
|
137644
137684
|
const answer = answers[check.question.id];
|
|
137645
|
-
return answer !== void 0 && (answer.type !== "choice" || answer.confidence <
|
|
137685
|
+
return answer !== void 0 && (answer.type !== "choice" || answer.confidence < minConfidence);
|
|
137646
137686
|
});
|
|
137647
137687
|
return {
|
|
137648
|
-
findings: readBoundaryFindings(BUILDER_END_CHECKS, answers),
|
|
137688
|
+
findings: readBoundaryFindings(BUILDER_END_CHECKS, answers, minConfidence),
|
|
137649
137689
|
lowConfidence,
|
|
137650
|
-
phase
|
|
137690
|
+
phase,
|
|
137691
|
+
minConfidence
|
|
137651
137692
|
};
|
|
137652
137693
|
}
|
|
137653
137694
|
function builderEndConflict(judgment) {
|
|
@@ -137657,7 +137698,7 @@ function builderEndConflict(judgment) {
|
|
|
137657
137698
|
function readJevBoundaryRecord(payload) {
|
|
137658
137699
|
const record = payload;
|
|
137659
137700
|
if (record === null || typeof record !== "object") return void 0;
|
|
137660
|
-
const { sequence, phase, lowConfidenceStreak, escalated, continued, continuation, escalation } = record;
|
|
137701
|
+
const { sequence, phase, lowConfidenceStreak, minConfidence, escalated, continued, continuation, escalation } = record;
|
|
137661
137702
|
if (typeof sequence !== "number" || typeof lowConfidenceStreak !== "number" || typeof escalated !== "boolean" || typeof continued !== "boolean") return void 0;
|
|
137662
137703
|
if (phase !== null && typeof phase !== "string") return void 0;
|
|
137663
137704
|
const escalationRecord = escalation;
|
|
@@ -137665,6 +137706,7 @@ function readJevBoundaryRecord(payload) {
|
|
|
137665
137706
|
sequence,
|
|
137666
137707
|
phase,
|
|
137667
137708
|
lowConfidenceStreak,
|
|
137709
|
+
...typeof minConfidence === "number" ? { minConfidence } : {},
|
|
137668
137710
|
escalated,
|
|
137669
137711
|
continued,
|
|
137670
137712
|
...typeof continuation === "string" ? { continuation } : {},
|
|
@@ -137680,7 +137722,7 @@ function readJevBoundaryRecord(payload) {
|
|
|
137680
137722
|
*/
|
|
137681
137723
|
function nextLowConfidenceStreak(previous, judgment) {
|
|
137682
137724
|
if (!judgment.lowConfidence) return 0;
|
|
137683
|
-
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;
|
|
137684
137726
|
}
|
|
137685
137727
|
/** Why a finished Builder turn goes to a Supervisor gate instead of on, if it does. */
|
|
137686
137728
|
function jevEscalationFor(judgment, streak) {
|
|
@@ -137690,7 +137732,7 @@ function jevEscalationFor(judgment, streak) {
|
|
|
137690
137732
|
};
|
|
137691
137733
|
if (streak >= 2) return {
|
|
137692
137734
|
reason: "uncertain",
|
|
137693
|
-
detail: `Jev answered below ${
|
|
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.`
|
|
137694
137736
|
};
|
|
137695
137737
|
}
|
|
137696
137738
|
/** The one-line pill summary for a recorded Builder-end judgment. */
|
|
@@ -137719,11 +137761,11 @@ function supervisorRequestResult(findings) {
|
|
|
137719
137761
|
* or unsure answer flags nothing: a boundary check may add a finding, never
|
|
137720
137762
|
* invent one.
|
|
137721
137763
|
*/
|
|
137722
|
-
function readBoundaryFindings(checks, answers) {
|
|
137764
|
+
function readBoundaryFindings(checks, answers, minConfidence = JEV_ROLE_ROUTE_MIN_CONFIDENCE) {
|
|
137723
137765
|
if (answers === void 0) return [];
|
|
137724
137766
|
return checks.flatMap((check) => {
|
|
137725
137767
|
const answer = answers[check.question.id];
|
|
137726
|
-
return answer?.type === "choice" && answer.choice === check.flagChoice && answer.confidence >=
|
|
137768
|
+
return answer?.type === "choice" && answer.choice === check.flagChoice && answer.confidence >= minConfidence ? [{
|
|
137727
137769
|
id: check.question.id,
|
|
137728
137770
|
finding: check.finding,
|
|
137729
137771
|
confidence: answer.confidence
|
|
@@ -138316,7 +138358,8 @@ const make$12 = Effect.gen(function* () {
|
|
|
138316
138358
|
if (Option.isNone(key)) return void 0;
|
|
138317
138359
|
return {
|
|
138318
138360
|
apiKey: key.value.apiKey,
|
|
138319
|
-
timeoutMs: settings.jevPrefetchTimeoutMs
|
|
138361
|
+
timeoutMs: settings.jevPrefetchTimeoutMs,
|
|
138362
|
+
minConfidence: settings.jevRoleRoutingMinConfidence
|
|
138320
138363
|
};
|
|
138321
138364
|
});
|
|
138322
138365
|
const pairState = (pair) => {
|
|
@@ -138355,8 +138398,8 @@ const make$12 = Effect.gen(function* () {
|
|
|
138355
138398
|
model: JEV_PREFETCH_MODEL,
|
|
138356
138399
|
state,
|
|
138357
138400
|
question: ROLE_ROUTE_QUESTION
|
|
138358
|
-
}));
|
|
138359
|
-
}).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))));
|
|
138360
138403
|
if (route === null) return void 0;
|
|
138361
138404
|
return {
|
|
138362
138405
|
hint: renderRoleRouteHint(input.callerRole, route),
|
|
@@ -138386,7 +138429,7 @@ const make$12 = Effect.gen(function* () {
|
|
|
138386
138429
|
model: JEV_PREFETCH_MODEL,
|
|
138387
138430
|
state,
|
|
138388
138431
|
questions: checks.map((check) => check.question)
|
|
138389
|
-
}), currentPhase);
|
|
138432
|
+
}), currentPhase, consult.minConfidence);
|
|
138390
138433
|
}).pipe(Effect.timeout(consult.timeoutMs), Effect.tapCause((cause) => Effect.logWarning("jev boundary check did not answer", {
|
|
138391
138434
|
boundary,
|
|
138392
138435
|
cause
|
|
@@ -138394,7 +138437,7 @@ const make$12 = Effect.gen(function* () {
|
|
|
138394
138437
|
});
|
|
138395
138438
|
return {
|
|
138396
138439
|
routeFor,
|
|
138397
|
-
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)),
|
|
138398
138441
|
checkBuilderEnd: (input) => checkBoundary("builder-end", BUILDER_END_CHECKS, input, readBuilderEndJudgment)
|
|
138399
138442
|
};
|
|
138400
138443
|
});
|
|
@@ -146487,6 +146530,7 @@ const make$3 = Effect.gen(function* () {
|
|
|
146487
146530
|
sequence: completion.sequence,
|
|
146488
146531
|
phase: judgment.phase,
|
|
146489
146532
|
lowConfidenceStreak: streak,
|
|
146533
|
+
minConfidence: judgment.minConfidence,
|
|
146490
146534
|
escalated: escalation !== void 0,
|
|
146491
146535
|
continued: continues,
|
|
146492
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-
|
|
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-
|
|
98
|
+
//# sourceMappingURL=DiffPanel-LdVJVEA7.js.map
|