@cmmd-center/forge 0.13.9 → 0.13.11
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.cjs +49 -33
- package/dist/bin.mjs +73 -57
- package/dist/client/assets/{DiffPanel-DTiRv6A3.js → DiffPanel-BrlSm5kH.js} +3 -3
- package/dist/client/assets/{DiffPanel.logic-BrHjYrbX.js → DiffPanel.logic-OZhO8GfQ.js} +2 -2
- package/dist/client/assets/{DiffPanelShell-CivZRVc4.js → DiffPanelShell-DnugngHM.js} +8 -8
- package/dist/client/assets/{DiffWorkerPoolProvider-Vm64F-i1.js → DiffWorkerPoolProvider-BOD7cQPe.js} +9 -9
- package/dist/client/assets/PullRequestCodePanel-DACYpcbJ.js +5 -0
- package/dist/client/assets/{Virtualizer-CJivXWYL.js → Virtualizer-R_LG4CvG.js} +2 -2
- package/dist/client/assets/index-BXzYKPmD.js +154 -0
- package/dist/client/assets/index-Bn-ASQRG.css +1 -0
- package/dist/client/index.html +5 -5
- package/dist/forge-build.json +1 -1
- package/dist/{open-FIgTDosf.mjs → open-D8mGyWmt.mjs} +3 -3
- package/package.json +1 -1
- package/dist/client/assets/PullRequestCodePanel-DJPvOmkY.js +0 -5
- package/dist/client/assets/index-DTtOLoW6.css +0 -1
- package/dist/client/assets/index-TdSTLuh4.js +0 -154
package/dist/bin.cjs
CHANGED
|
@@ -66289,7 +66289,7 @@ function normalizeNumberish(value) {
|
|
|
66289
66289
|
}
|
|
66290
66290
|
//#endregion
|
|
66291
66291
|
//#region package.json
|
|
66292
|
-
var version$1 = "0.13.
|
|
66292
|
+
var version$1 = "0.13.11";
|
|
66293
66293
|
//#endregion
|
|
66294
66294
|
//#region src/sentry.ts
|
|
66295
66295
|
const SERVER_APP_NAME = "forge-server";
|
|
@@ -90131,9 +90131,9 @@ var GitHubBroker = class {
|
|
|
90131
90131
|
};
|
|
90132
90132
|
}
|
|
90133
90133
|
async resolveInstallationToken(auth, repoFullName) {
|
|
90134
|
-
const runtimeGrant = this.resolveRuntimeGrant("
|
|
90134
|
+
const runtimeGrant = this.resolveRuntimeGrant("github");
|
|
90135
90135
|
if (runtimeGrant) {
|
|
90136
|
-
const token = await this.
|
|
90136
|
+
const token = await this.fetchRuntimeInstallationToken(runtimeGrant, repoFullName);
|
|
90137
90137
|
if (!token.ok) return token;
|
|
90138
90138
|
return token.token ?? invalidInstallationTokenResult();
|
|
90139
90139
|
}
|
|
@@ -90600,18 +90600,6 @@ var GitHubBroker = class {
|
|
|
90600
90600
|
label: "GitHub installation token"
|
|
90601
90601
|
});
|
|
90602
90602
|
}
|
|
90603
|
-
async fetchRuntimeScmCredential(grant, repoFullName) {
|
|
90604
|
-
return this.fetchRuntimeCredential(grant, {
|
|
90605
|
-
url: makeUrl(this.commandAppUrl, `/api/forge/runtimes/${encodeURIComponent(grant.runtimeId)}/scm/credential`),
|
|
90606
|
-
requestBody: {
|
|
90607
|
-
provider: "github",
|
|
90608
|
-
host: "github.com",
|
|
90609
|
-
repository_path: repoFullName
|
|
90610
|
-
},
|
|
90611
|
-
responseField: "credential",
|
|
90612
|
-
label: "GitHub source-control credential"
|
|
90613
|
-
});
|
|
90614
|
-
}
|
|
90615
90603
|
async fetchRuntimeCredential(grant, input) {
|
|
90616
90604
|
const response = await this.fetchImpl(input.url, {
|
|
90617
90605
|
method: "POST",
|
|
@@ -151837,8 +151825,8 @@ async function prepareWorkspaceRepositoryDependencies(input) {
|
|
|
151837
151825
|
const dependencies = resolveWorkspaceEnvironmentConfig(input.cwd).repositoryDependencies;
|
|
151838
151826
|
if (dependencies.length === 0) return [];
|
|
151839
151827
|
const broker = input.broker ?? new GitHubBroker();
|
|
151840
|
-
const auth = broker.runtimeGrantAuthContext("
|
|
151841
|
-
if (auth === null) throw new Error("Repository dependencies require an exact scoped runtime
|
|
151828
|
+
const auth = broker.runtimeGrantAuthContext("github");
|
|
151829
|
+
if (auth === null) throw new Error("Repository dependencies require an exact scoped runtime GitHub grant.");
|
|
151842
151830
|
const readOrigin = input.readOrigin ?? readOriginFromGit;
|
|
151843
151831
|
const resolved = resolveRepositoryDependencies(dependencies, input.cloudProjectsRoot);
|
|
151844
151832
|
const prepared = [];
|
|
@@ -289697,6 +289685,7 @@ const RuntimeDrainStateLive = require_Schema$1.effect(RuntimeDrainState, makeRun
|
|
|
289697
289685
|
//#region src/runtimeDrain/RuntimeDrainReporter.ts
|
|
289698
289686
|
const HEARTBEAT_INTERVAL = require_Schema$1.seconds(30);
|
|
289699
289687
|
const HEARTBEAT_TICK_TIMEOUT = require_Schema$1.seconds(60);
|
|
289688
|
+
const FORCE_FORGE_APP_UPDATE_DRAIN_REASON = "forge_app_force_update";
|
|
289700
289689
|
function runtimeHeartbeatConfig(config) {
|
|
289701
289690
|
if (config.forgeCmmdRuntimeMode !== true) return null;
|
|
289702
289691
|
const runtimeId = config.forgeCmmdRuntimeId?.trim();
|
|
@@ -289731,6 +289720,9 @@ function hasDrainUpdateTarget(runtime) {
|
|
|
289731
289720
|
function isReadyForRuntimeUpdateActivation(runtime, snapshot) {
|
|
289732
289721
|
return runtime.draining === true && snapshot.activeTurnCount === 0 && snapshot.activeSessionCount === 0 && hasDrainUpdateTarget(runtime);
|
|
289733
289722
|
}
|
|
289723
|
+
function forceStopsResumableTurns(runtime) {
|
|
289724
|
+
return runtime.drainForceRequired === true && runtime.drainReason?.startsWith(`${FORCE_FORGE_APP_UPDATE_DRAIN_REASON}:`) === true;
|
|
289725
|
+
}
|
|
289734
289726
|
const terminateForRuntimeUpdate = (runtime) => require_Schema$1.gen(function* () {
|
|
289735
289727
|
yield* require_Schema$1.logWarning("CMMD runtime drain is clean and targets a Forge app update; terminating for supervisor activation.", {
|
|
289736
289728
|
drainReason: runtime.drainReason,
|
|
@@ -289741,6 +289733,16 @@ const terminateForRuntimeUpdate = (runtime) => require_Schema$1.gen(function* ()
|
|
|
289741
289733
|
process.kill(process.pid, "SIGTERM");
|
|
289742
289734
|
});
|
|
289743
289735
|
});
|
|
289736
|
+
const postRuntimeHeartbeat = (config, snapshot) => require_Schema$1.promise(async () => {
|
|
289737
|
+
const forgeGitCommit = await resolveForgeGitCommit();
|
|
289738
|
+
return require_runtimeControlAuthority.sendRuntimeControlHeartbeat({
|
|
289739
|
+
...config,
|
|
289740
|
+
activeTurnCount: snapshot.activeTurnCount,
|
|
289741
|
+
activeSessionCount: snapshot.activeSessionCount,
|
|
289742
|
+
...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
|
|
289743
|
+
forgeServerVersion: installedForgeServerVersion
|
|
289744
|
+
});
|
|
289745
|
+
});
|
|
289744
289746
|
const makeRuntimeDrainReporter = require_Schema$1.gen(function* () {
|
|
289745
289747
|
const drainState = yield* RuntimeDrainState;
|
|
289746
289748
|
const providerService = yield* ProviderService;
|
|
@@ -289748,16 +289750,6 @@ const makeRuntimeDrainReporter = require_Schema$1.gen(function* () {
|
|
|
289748
289750
|
const spriteTaskHoldReactor = yield* SpriteTaskHoldReactor;
|
|
289749
289751
|
const reportSemaphore = yield* require_Path.make$5(1);
|
|
289750
289752
|
let heartbeatSilent = false;
|
|
289751
|
-
const postHeartbeat = (config, snapshot) => require_Schema$1.promise(async () => {
|
|
289752
|
-
const forgeGitCommit = await resolveForgeGitCommit();
|
|
289753
|
-
return require_runtimeControlAuthority.sendRuntimeControlHeartbeat({
|
|
289754
|
-
...config,
|
|
289755
|
-
activeTurnCount: snapshot.activeTurnCount,
|
|
289756
|
-
activeSessionCount: snapshot.activeSessionCount,
|
|
289757
|
-
...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
|
|
289758
|
-
forgeServerVersion: installedForgeServerVersion
|
|
289759
|
-
});
|
|
289760
|
-
});
|
|
289761
289753
|
const applyControlPlaneState = (runtime) => drainState.applyControlPlaneState({
|
|
289762
289754
|
draining: runtime.draining,
|
|
289763
289755
|
drainReason: runtime.drainReason,
|
|
@@ -289776,11 +289768,35 @@ const makeRuntimeDrainReporter = require_Schema$1.gen(function* () {
|
|
|
289776
289768
|
})
|
|
289777
289769
|
}).pipe(require_Schema$1.catch_((cause) => require_Schema$1.logError("CMMD runtime provisioning grant refresh failed — this runtime will go dark once its current grant expires", { cause })));
|
|
289778
289770
|
});
|
|
289779
|
-
const
|
|
289780
|
-
if (
|
|
289771
|
+
const settleActiveDrainTurns = (runtime, initialSessions, initialSnapshot) => require_Schema$1.gen(function* () {
|
|
289772
|
+
if (initialSnapshot.activeTurnCount === 0) return {
|
|
289773
|
+
ready: true,
|
|
289774
|
+
sessions: initialSessions,
|
|
289775
|
+
snapshot: initialSnapshot
|
|
289776
|
+
};
|
|
289777
|
+
if (!forceStopsResumableTurns(runtime)) return {
|
|
289778
|
+
ready: false,
|
|
289779
|
+
sessions: initialSessions,
|
|
289780
|
+
snapshot: initialSnapshot
|
|
289781
|
+
};
|
|
289782
|
+
yield* require_Schema$1.forEach(initialSessions.filter((session) => session.activeTurnId !== void 0), (session) => providerService.interruptTurn({
|
|
289783
|
+
threadId: session.threadId,
|
|
289784
|
+
turnId: session.activeTurnId
|
|
289785
|
+
}), { concurrency: 1 });
|
|
289781
289786
|
const sessions = yield* providerService.listSessions();
|
|
289782
289787
|
const snapshot = yield* drainState.reconcileProviderSessions(sessions);
|
|
289783
|
-
|
|
289788
|
+
return {
|
|
289789
|
+
ready: snapshot.activeTurnCount === 0,
|
|
289790
|
+
sessions,
|
|
289791
|
+
snapshot
|
|
289792
|
+
};
|
|
289793
|
+
});
|
|
289794
|
+
const completeDrainIfRequested = (config, runtime) => require_Schema$1.gen(function* () {
|
|
289795
|
+
if (runtime.draining !== true) return;
|
|
289796
|
+
const initialSessions = yield* providerService.listSessions();
|
|
289797
|
+
const settled = yield* settleActiveDrainTurns(runtime, initialSessions, yield* drainState.reconcileProviderSessions(initialSessions));
|
|
289798
|
+
if (!settled.ready) return;
|
|
289799
|
+
const { sessions, snapshot } = settled;
|
|
289784
289800
|
yield* spriteTaskHoldReactor.releaseAll;
|
|
289785
289801
|
const wasAlreadySessionless = snapshot.activeSessionCount === 0;
|
|
289786
289802
|
const drainedSnapshot = wasAlreadySessionless ? snapshot : yield* require_Schema$1.gen(function* () {
|
|
@@ -289792,7 +289808,7 @@ const makeRuntimeDrainReporter = require_Schema$1.gen(function* () {
|
|
|
289792
289808
|
return yield* drainState.reconcileProviderSessions(remainingSessions);
|
|
289793
289809
|
});
|
|
289794
289810
|
if (wasAlreadySessionless && !hasDrainUpdateTarget(runtime)) return;
|
|
289795
|
-
const drainedRuntime = yield*
|
|
289811
|
+
const drainedRuntime = yield* postRuntimeHeartbeat(config, drainedSnapshot);
|
|
289796
289812
|
if (drainedRuntime) {
|
|
289797
289813
|
yield* applyControlPlaneState(drainedRuntime);
|
|
289798
289814
|
if (isReadyForRuntimeUpdateActivation(drainedRuntime, drainedSnapshot)) yield* terminateForRuntimeUpdate(drainedRuntime);
|
|
@@ -289803,7 +289819,7 @@ const makeRuntimeDrainReporter = require_Schema$1.gen(function* () {
|
|
|
289803
289819
|
const config = runtimeHeartbeatConfig(serverConfig);
|
|
289804
289820
|
if (!config) return;
|
|
289805
289821
|
const initialSessions = yield* providerService.listSessions();
|
|
289806
|
-
const runtime = yield*
|
|
289822
|
+
const runtime = yield* postRuntimeHeartbeat(config, yield* drainState.reconcileProviderSessions(initialSessions));
|
|
289807
289823
|
if (!runtime) {
|
|
289808
289824
|
if (!heartbeatSilent) {
|
|
289809
289825
|
heartbeatSilent = true;
|
|
@@ -297377,7 +297393,7 @@ function resolveBuildCommitFromEnv(env) {
|
|
|
297377
297393
|
* environment descriptor down instead of reporting an honest "unknown".
|
|
297378
297394
|
*/
|
|
297379
297395
|
function readBakedBuildCommit() {
|
|
297380
|
-
return "
|
|
297396
|
+
return "05d8568497fdceb5b5d827b142ea4c681bef25ce";
|
|
297381
297397
|
}
|
|
297382
297398
|
async function resolveServerBuildCommit(input) {
|
|
297383
297399
|
if (isFullCommitSha(input.baked)) return input.baked;
|
package/dist/bin.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { createCipheriv, createDecipheriv, createHash, createHmac, createPublicK
|
|
|
22
22
|
import * as FS$1 from "node:fs";
|
|
23
23
|
import fs, { accessSync, chmodSync, constants, createReadStream, existsSync, mkdirSync, mkdtempSync, promises, readFile, readFileSync, readdir, readdirSync, realpathSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
24
24
|
import * as NodeOS from "node:os";
|
|
25
|
-
import
|
|
25
|
+
import $U, { homedir, networkInterfaces, tmpdir } from "node:os";
|
|
26
26
|
import * as Path$1 from "node:path";
|
|
27
27
|
import path, { basename, delimiter, dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
|
|
28
28
|
import { pathToFileURL } from "node:url";
|
|
@@ -50614,7 +50614,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
50614
50614
|
const min = forceColor || 0;
|
|
50615
50615
|
if (env.TERM === "dumb") return min;
|
|
50616
50616
|
if (process$1.platform === "win32") {
|
|
50617
|
-
const osRelease =
|
|
50617
|
+
const osRelease = $U.release().split(".");
|
|
50618
50618
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
50619
50619
|
return 1;
|
|
50620
50620
|
}
|
|
@@ -53057,7 +53057,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
53057
53057
|
exports.processDetector = void 0;
|
|
53058
53058
|
const api_1 = (init_esm$1(), __toCommonJS(esm_exports$1));
|
|
53059
53059
|
const semconv_1 = require_semconv$1();
|
|
53060
|
-
const os$
|
|
53060
|
+
const os$3 = __require("os");
|
|
53061
53061
|
/**
|
|
53062
53062
|
* ProcessDetector will be used to detect the resources related current process running
|
|
53063
53063
|
* and being instrumented from the NodeJS Process module.
|
|
@@ -53079,7 +53079,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
53079
53079
|
};
|
|
53080
53080
|
if (process.argv.length > 1) attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
|
|
53081
53081
|
try {
|
|
53082
|
-
const userInfo = os$
|
|
53082
|
+
const userInfo = os$3.userInfo();
|
|
53083
53083
|
attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
|
|
53084
53084
|
} catch (e) {
|
|
53085
53085
|
api_1.diag.debug(`error obtaining process owner: ${e}`);
|
|
@@ -66002,7 +66002,7 @@ function normalizeNumberish(value) {
|
|
|
66002
66002
|
}
|
|
66003
66003
|
//#endregion
|
|
66004
66004
|
//#region package.json
|
|
66005
|
-
var version$1 = "0.13.
|
|
66005
|
+
var version$1 = "0.13.11";
|
|
66006
66006
|
//#endregion
|
|
66007
66007
|
//#region src/sentry.ts
|
|
66008
66008
|
const SERVER_APP_NAME = "forge-server";
|
|
@@ -75215,7 +75215,7 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
75215
75215
|
var fs$6 = __require("fs");
|
|
75216
75216
|
var path$5 = __require("path");
|
|
75217
75217
|
var url$1 = __require("url");
|
|
75218
|
-
var os$
|
|
75218
|
+
var os$2 = __require("os");
|
|
75219
75219
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
75220
75220
|
var vars = process.config && process.config.variables || {};
|
|
75221
75221
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
@@ -75223,8 +75223,8 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
75223
75223
|
var abi = versions.modules;
|
|
75224
75224
|
if (versions.deno || process.isBun) abi = "unsupported";
|
|
75225
75225
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
75226
|
-
var arch = process.env.npm_config_arch || os$
|
|
75227
|
-
var platform = process.env.npm_config_platform || os$
|
|
75226
|
+
var arch = process.env.npm_config_arch || os$2.arch();
|
|
75227
|
+
var platform = process.env.npm_config_platform || os$2.platform();
|
|
75228
75228
|
var libc = process.env.LIBC || (isMusl(platform) ? "musl" : "glibc");
|
|
75229
75229
|
var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
|
|
75230
75230
|
var uv = (versions.uv || "").split(".")[0];
|
|
@@ -89785,9 +89785,9 @@ var GitHubBroker = class {
|
|
|
89785
89785
|
};
|
|
89786
89786
|
}
|
|
89787
89787
|
async resolveInstallationToken(auth, repoFullName) {
|
|
89788
|
-
const runtimeGrant = this.resolveRuntimeGrant("
|
|
89788
|
+
const runtimeGrant = this.resolveRuntimeGrant("github");
|
|
89789
89789
|
if (runtimeGrant) {
|
|
89790
|
-
const token = await this.
|
|
89790
|
+
const token = await this.fetchRuntimeInstallationToken(runtimeGrant, repoFullName);
|
|
89791
89791
|
if (!token.ok) return token;
|
|
89792
89792
|
return token.token ?? invalidInstallationTokenResult();
|
|
89793
89793
|
}
|
|
@@ -90254,18 +90254,6 @@ var GitHubBroker = class {
|
|
|
90254
90254
|
label: "GitHub installation token"
|
|
90255
90255
|
});
|
|
90256
90256
|
}
|
|
90257
|
-
async fetchRuntimeScmCredential(grant, repoFullName) {
|
|
90258
|
-
return this.fetchRuntimeCredential(grant, {
|
|
90259
|
-
url: makeUrl(this.commandAppUrl, `/api/forge/runtimes/${encodeURIComponent(grant.runtimeId)}/scm/credential`),
|
|
90260
|
-
requestBody: {
|
|
90261
|
-
provider: "github",
|
|
90262
|
-
host: "github.com",
|
|
90263
|
-
repository_path: repoFullName
|
|
90264
|
-
},
|
|
90265
|
-
responseField: "credential",
|
|
90266
|
-
label: "GitHub source-control credential"
|
|
90267
|
-
});
|
|
90268
|
-
}
|
|
90269
90257
|
async fetchRuntimeCredential(grant, input) {
|
|
90270
90258
|
const response = await this.fetchImpl(input.url, {
|
|
90271
90259
|
method: "POST",
|
|
@@ -93418,7 +93406,7 @@ const launchDetached = (launch) => gen(function* () {
|
|
|
93418
93406
|
});
|
|
93419
93407
|
const OpenLive = effect(Open, gen(function* () {
|
|
93420
93408
|
const open = yield* tryPromise({
|
|
93421
|
-
try: () => import("./open-
|
|
93409
|
+
try: () => import("./open-D8mGyWmt.mjs"),
|
|
93422
93410
|
catch: (cause) => new OpenError$1({
|
|
93423
93411
|
message: "failed to load browser opener",
|
|
93424
93412
|
cause
|
|
@@ -151420,8 +151408,8 @@ async function prepareWorkspaceRepositoryDependencies(input) {
|
|
|
151420
151408
|
const dependencies = resolveWorkspaceEnvironmentConfig(input.cwd).repositoryDependencies;
|
|
151421
151409
|
if (dependencies.length === 0) return [];
|
|
151422
151410
|
const broker = input.broker ?? new GitHubBroker();
|
|
151423
|
-
const auth = broker.runtimeGrantAuthContext("
|
|
151424
|
-
if (auth === null) throw new Error("Repository dependencies require an exact scoped runtime
|
|
151411
|
+
const auth = broker.runtimeGrantAuthContext("github");
|
|
151412
|
+
if (auth === null) throw new Error("Repository dependencies require an exact scoped runtime GitHub grant.");
|
|
151425
151413
|
const readOrigin = input.readOrigin ?? readOriginFromGit;
|
|
151426
151414
|
const resolved = resolveRepositoryDependencies(dependencies, input.cloudProjectsRoot);
|
|
151427
151415
|
const prepared = [];
|
|
@@ -190547,7 +190535,7 @@ var Vce = {
|
|
|
190547
190535
|
function Ve() {
|
|
190548
190536
|
return Vce;
|
|
190549
190537
|
}
|
|
190550
|
-
var Us =
|
|
190538
|
+
var Us = $U.homedir(), lk = $U.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
|
|
190551
190539
|
let t = path.join(Us, "Library");
|
|
190552
190540
|
return {
|
|
190553
190541
|
data: path.join(t, "Application Support", e),
|
|
@@ -200747,12 +200735,12 @@ function qZ(e, t) {
|
|
|
200747
200735
|
}
|
|
200748
200736
|
return n;
|
|
200749
200737
|
}
|
|
200750
|
-
var os$
|
|
200738
|
+
var os$1 = "https://code.claude.com/docs/en", kKe = [
|
|
200751
200739
|
{
|
|
200752
200740
|
matches: (e) => e.path === "permissions.defaultMode" && e.code === "invalid_value",
|
|
200753
200741
|
tip: {
|
|
200754
200742
|
suggestion: "Valid modes: \"acceptEdits\" (ask before file changes), \"plan\" (analysis only), \"bypassPermissions\" (auto-accept all), or \"default\" (standard behavior)",
|
|
200755
|
-
docLink: `${os$
|
|
200743
|
+
docLink: `${os$1}/iam#permission-modes`
|
|
200756
200744
|
}
|
|
200757
200745
|
},
|
|
200758
200746
|
{
|
|
@@ -200767,7 +200755,7 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
|
|
|
200767
200755
|
matches: (e) => e.path.startsWith("env.") && e.code === "invalid_type",
|
|
200768
200756
|
tip: {
|
|
200769
200757
|
suggestion: "Environment variables must be strings. Wrap numbers and booleans in quotes. Example: \"DEBUG\": \"true\", \"PORT\": \"3000\"",
|
|
200770
|
-
docLink: `${os$
|
|
200758
|
+
docLink: `${os$1}/settings#environment-variables`
|
|
200771
200759
|
}
|
|
200772
200760
|
},
|
|
200773
200761
|
{
|
|
@@ -200778,14 +200766,14 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
|
|
|
200778
200766
|
matches: (e) => e.path.startsWith("hooks.") && e.code === "invalid_key",
|
|
200779
200767
|
tip: {
|
|
200780
200768
|
suggestion: "Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",
|
|
200781
|
-
docLink: `${os$
|
|
200769
|
+
docLink: `${os$1}/hooks`
|
|
200782
200770
|
}
|
|
200783
200771
|
},
|
|
200784
200772
|
{
|
|
200785
200773
|
matches: (e) => /\.hooks\.\d+\.command$/.test(e.path) && e.code === "invalid_type" && e.received === "undefined",
|
|
200786
200774
|
tip: {
|
|
200787
200775
|
suggestion: "Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {\"type\": \"command\", \"command\": \"echo\", \"args\": [\"hi\"]}. For shell form, set `command` to the full shell string: {\"type\": \"command\", \"command\": \"echo hi\"}.",
|
|
200788
|
-
docLink: `${os$
|
|
200776
|
+
docLink: `${os$1}/hooks#exec-form-and-shell-form`
|
|
200789
200777
|
}
|
|
200790
200778
|
},
|
|
200791
200779
|
{
|
|
@@ -200800,7 +200788,7 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
|
|
|
200800
200788
|
matches: (e) => e.code === "unrecognized_keys",
|
|
200801
200789
|
tip: {
|
|
200802
200790
|
suggestion: "Check for typos or refer to the documentation for valid fields",
|
|
200803
|
-
docLink: `${os$
|
|
200791
|
+
docLink: `${os$1}/settings`
|
|
200804
200792
|
}
|
|
200805
200793
|
},
|
|
200806
200794
|
{
|
|
@@ -200815,13 +200803,13 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
|
|
|
200815
200803
|
matches: (e) => e.path === "permissions.additionalDirectories" && e.code === "invalid_type",
|
|
200816
200804
|
tip: {
|
|
200817
200805
|
suggestion: "Must be an array of directory paths. Example: [\"~/projects\", \"/tmp/workspace\"]. You can also use --add-dir flag or /add-dir command",
|
|
200818
|
-
docLink: `${os$
|
|
200806
|
+
docLink: `${os$1}/iam#working-directories`
|
|
200819
200807
|
}
|
|
200820
200808
|
}
|
|
200821
200809
|
], AKe = {
|
|
200822
|
-
permissions: `${os$
|
|
200823
|
-
env: `${os$
|
|
200824
|
-
hooks: `${os$
|
|
200810
|
+
permissions: `${os$1}/iam#configuring-permissions`,
|
|
200811
|
+
env: `${os$1}/settings#environment-variables`,
|
|
200812
|
+
hooks: `${os$1}/hooks`
|
|
200825
200813
|
};
|
|
200826
200814
|
function GZ(e) {
|
|
200827
200815
|
let t = kKe.find((r) => r.matches(e));
|
|
@@ -267710,7 +267698,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
267710
267698
|
var dgram = __require("dgram");
|
|
267711
267699
|
var thunky = require_thunky();
|
|
267712
267700
|
var events = __require("events");
|
|
267713
|
-
var os
|
|
267701
|
+
var os = __require("os");
|
|
267714
267702
|
var noop = function() {};
|
|
267715
267703
|
module.exports = function(opts) {
|
|
267716
267704
|
if (!opts) opts = {};
|
|
@@ -267841,14 +267829,14 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
267841
267829
|
return that;
|
|
267842
267830
|
};
|
|
267843
267831
|
function defaultInterface() {
|
|
267844
|
-
var networks = os
|
|
267832
|
+
var networks = os.networkInterfaces();
|
|
267845
267833
|
var names = Object.keys(networks);
|
|
267846
267834
|
for (var i = 0; i < names.length; i++) {
|
|
267847
267835
|
var net = networks[names[i]];
|
|
267848
267836
|
for (var j = 0; j < net.length; j++) {
|
|
267849
267837
|
var iface = net[j];
|
|
267850
267838
|
if (isIPv4(iface.family) && !iface.internal) {
|
|
267851
|
-
if (os
|
|
267839
|
+
if (os.platform() === "darwin" && names[i] === "en0") return iface.address;
|
|
267852
267840
|
return "0.0.0.0";
|
|
267853
267841
|
}
|
|
267854
267842
|
}
|
|
@@ -267856,7 +267844,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
267856
267844
|
return "127.0.0.1";
|
|
267857
267845
|
}
|
|
267858
267846
|
function allInterfaces() {
|
|
267859
|
-
var networks = os
|
|
267847
|
+
var networks = os.networkInterfaces();
|
|
267860
267848
|
var names = Object.keys(networks);
|
|
267861
267849
|
var res = [];
|
|
267862
267850
|
for (var i = 0; i < names.length; i++) {
|
|
@@ -289189,6 +289177,7 @@ const RuntimeDrainStateLive = effect(RuntimeDrainState, makeRuntimeDrainState);
|
|
|
289189
289177
|
//#region src/runtimeDrain/RuntimeDrainReporter.ts
|
|
289190
289178
|
const HEARTBEAT_INTERVAL = seconds(30);
|
|
289191
289179
|
const HEARTBEAT_TICK_TIMEOUT = seconds(60);
|
|
289180
|
+
const FORCE_FORGE_APP_UPDATE_DRAIN_REASON = "forge_app_force_update";
|
|
289192
289181
|
function runtimeHeartbeatConfig(config) {
|
|
289193
289182
|
if (config.forgeCmmdRuntimeMode !== true) return null;
|
|
289194
289183
|
const runtimeId = config.forgeCmmdRuntimeId?.trim();
|
|
@@ -289223,6 +289212,9 @@ function hasDrainUpdateTarget(runtime) {
|
|
|
289223
289212
|
function isReadyForRuntimeUpdateActivation(runtime, snapshot) {
|
|
289224
289213
|
return runtime.draining === true && snapshot.activeTurnCount === 0 && snapshot.activeSessionCount === 0 && hasDrainUpdateTarget(runtime);
|
|
289225
289214
|
}
|
|
289215
|
+
function forceStopsResumableTurns(runtime) {
|
|
289216
|
+
return runtime.drainForceRequired === true && runtime.drainReason?.startsWith(`${FORCE_FORGE_APP_UPDATE_DRAIN_REASON}:`) === true;
|
|
289217
|
+
}
|
|
289226
289218
|
const terminateForRuntimeUpdate = (runtime) => gen(function* () {
|
|
289227
289219
|
yield* logWarning$1("CMMD runtime drain is clean and targets a Forge app update; terminating for supervisor activation.", {
|
|
289228
289220
|
drainReason: runtime.drainReason,
|
|
@@ -289233,6 +289225,16 @@ const terminateForRuntimeUpdate = (runtime) => gen(function* () {
|
|
|
289233
289225
|
process.kill(process.pid, "SIGTERM");
|
|
289234
289226
|
});
|
|
289235
289227
|
});
|
|
289228
|
+
const postRuntimeHeartbeat = (config, snapshot) => promise(async () => {
|
|
289229
|
+
const forgeGitCommit = await resolveForgeGitCommit();
|
|
289230
|
+
return sendRuntimeControlHeartbeat({
|
|
289231
|
+
...config,
|
|
289232
|
+
activeTurnCount: snapshot.activeTurnCount,
|
|
289233
|
+
activeSessionCount: snapshot.activeSessionCount,
|
|
289234
|
+
...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
|
|
289235
|
+
forgeServerVersion: installedForgeServerVersion
|
|
289236
|
+
});
|
|
289237
|
+
});
|
|
289236
289238
|
const makeRuntimeDrainReporter = gen(function* () {
|
|
289237
289239
|
const drainState = yield* RuntimeDrainState;
|
|
289238
289240
|
const providerService = yield* ProviderService;
|
|
@@ -289240,16 +289242,6 @@ const makeRuntimeDrainReporter = gen(function* () {
|
|
|
289240
289242
|
const spriteTaskHoldReactor = yield* SpriteTaskHoldReactor;
|
|
289241
289243
|
const reportSemaphore = yield* make$44(1);
|
|
289242
289244
|
let heartbeatSilent = false;
|
|
289243
|
-
const postHeartbeat = (config, snapshot) => promise(async () => {
|
|
289244
|
-
const forgeGitCommit = await resolveForgeGitCommit();
|
|
289245
|
-
return sendRuntimeControlHeartbeat({
|
|
289246
|
-
...config,
|
|
289247
|
-
activeTurnCount: snapshot.activeTurnCount,
|
|
289248
|
-
activeSessionCount: snapshot.activeSessionCount,
|
|
289249
|
-
...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
|
|
289250
|
-
forgeServerVersion: installedForgeServerVersion
|
|
289251
|
-
});
|
|
289252
|
-
});
|
|
289253
289245
|
const applyControlPlaneState = (runtime) => drainState.applyControlPlaneState({
|
|
289254
289246
|
draining: runtime.draining,
|
|
289255
289247
|
drainReason: runtime.drainReason,
|
|
@@ -289268,11 +289260,35 @@ const makeRuntimeDrainReporter = gen(function* () {
|
|
|
289268
289260
|
})
|
|
289269
289261
|
}).pipe(catch_((cause) => logError("CMMD runtime provisioning grant refresh failed — this runtime will go dark once its current grant expires", { cause })));
|
|
289270
289262
|
});
|
|
289271
|
-
const
|
|
289272
|
-
if (
|
|
289263
|
+
const settleActiveDrainTurns = (runtime, initialSessions, initialSnapshot) => gen(function* () {
|
|
289264
|
+
if (initialSnapshot.activeTurnCount === 0) return {
|
|
289265
|
+
ready: true,
|
|
289266
|
+
sessions: initialSessions,
|
|
289267
|
+
snapshot: initialSnapshot
|
|
289268
|
+
};
|
|
289269
|
+
if (!forceStopsResumableTurns(runtime)) return {
|
|
289270
|
+
ready: false,
|
|
289271
|
+
sessions: initialSessions,
|
|
289272
|
+
snapshot: initialSnapshot
|
|
289273
|
+
};
|
|
289274
|
+
yield* forEach(initialSessions.filter((session) => session.activeTurnId !== void 0), (session) => providerService.interruptTurn({
|
|
289275
|
+
threadId: session.threadId,
|
|
289276
|
+
turnId: session.activeTurnId
|
|
289277
|
+
}), { concurrency: 1 });
|
|
289273
289278
|
const sessions = yield* providerService.listSessions();
|
|
289274
289279
|
const snapshot = yield* drainState.reconcileProviderSessions(sessions);
|
|
289275
|
-
|
|
289280
|
+
return {
|
|
289281
|
+
ready: snapshot.activeTurnCount === 0,
|
|
289282
|
+
sessions,
|
|
289283
|
+
snapshot
|
|
289284
|
+
};
|
|
289285
|
+
});
|
|
289286
|
+
const completeDrainIfRequested = (config, runtime) => gen(function* () {
|
|
289287
|
+
if (runtime.draining !== true) return;
|
|
289288
|
+
const initialSessions = yield* providerService.listSessions();
|
|
289289
|
+
const settled = yield* settleActiveDrainTurns(runtime, initialSessions, yield* drainState.reconcileProviderSessions(initialSessions));
|
|
289290
|
+
if (!settled.ready) return;
|
|
289291
|
+
const { sessions, snapshot } = settled;
|
|
289276
289292
|
yield* spriteTaskHoldReactor.releaseAll;
|
|
289277
289293
|
const wasAlreadySessionless = snapshot.activeSessionCount === 0;
|
|
289278
289294
|
const drainedSnapshot = wasAlreadySessionless ? snapshot : yield* gen(function* () {
|
|
@@ -289284,7 +289300,7 @@ const makeRuntimeDrainReporter = gen(function* () {
|
|
|
289284
289300
|
return yield* drainState.reconcileProviderSessions(remainingSessions);
|
|
289285
289301
|
});
|
|
289286
289302
|
if (wasAlreadySessionless && !hasDrainUpdateTarget(runtime)) return;
|
|
289287
|
-
const drainedRuntime = yield*
|
|
289303
|
+
const drainedRuntime = yield* postRuntimeHeartbeat(config, drainedSnapshot);
|
|
289288
289304
|
if (drainedRuntime) {
|
|
289289
289305
|
yield* applyControlPlaneState(drainedRuntime);
|
|
289290
289306
|
if (isReadyForRuntimeUpdateActivation(drainedRuntime, drainedSnapshot)) yield* terminateForRuntimeUpdate(drainedRuntime);
|
|
@@ -289295,7 +289311,7 @@ const makeRuntimeDrainReporter = gen(function* () {
|
|
|
289295
289311
|
const config = runtimeHeartbeatConfig(serverConfig);
|
|
289296
289312
|
if (!config) return;
|
|
289297
289313
|
const initialSessions = yield* providerService.listSessions();
|
|
289298
|
-
const runtime = yield*
|
|
289314
|
+
const runtime = yield* postRuntimeHeartbeat(config, yield* drainState.reconcileProviderSessions(initialSessions));
|
|
289299
289315
|
if (!runtime) {
|
|
289300
289316
|
if (!heartbeatSilent) {
|
|
289301
289317
|
heartbeatSilent = true;
|
|
@@ -296817,7 +296833,7 @@ function resolveBuildCommitFromEnv(env) {
|
|
|
296817
296833
|
* environment descriptor down instead of reporting an honest "unknown".
|
|
296818
296834
|
*/
|
|
296819
296835
|
function readBakedBuildCommit() {
|
|
296820
|
-
return "
|
|
296836
|
+
return "05d8568497fdceb5b5d827b142ea4c681bef25ce";
|
|
296821
296837
|
}
|
|
296822
296838
|
async function resolveServerBuildCommit(input) {
|
|
296823
296839
|
if (isFullCommitSha(input.baked)) return input.baked;
|
|
@@ -320993,7 +321009,7 @@ const connectLoginCommand = make$34("login", {
|
|
|
320993
321009
|
})).json();
|
|
320994
321010
|
},
|
|
320995
321011
|
openBrowser: async (url) => {
|
|
320996
|
-
const open = (await import("./open-
|
|
321012
|
+
const open = (await import("./open-D8mGyWmt.mjs")).default;
|
|
320997
321013
|
await open(url);
|
|
320998
321014
|
return true;
|
|
320999
321015
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ha as t,Mi as n,Ua as r,Wa as i}from"./Stream-mUTFnSY9.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ha as t,Mi as n,Ua as r,Wa as i}from"./Stream-mUTFnSY9.js";import{Do as a,Fn as o,Hc as s,Hr as c,Qr as l,Rr as u,Sr as d,Tn as f,Xr as p,_o as m,_r as h,aa as g,ac as _,d as v,fn as y,fr as b,gr as x,i as S,jn as C,l as w,m as T,n as E,oc as D,qt as O,r as k,rc as A,tc as j,u as M,zr as N}from"./DiffPanelShell-DnugngHM.js";import{Tn as P}from"./CompositeItem-P9UVXCKv.js";import{a as F,c as I,f as L,i as R,l as z,m as B,n as V,o as H,p as U,r as W,s as G,t as K}from"./Virtualizer-R_LG4CvG.js";import{Dn as q,at as J,it as ee}from"./src-BL-mOkT1.js";import{a as te,c as ne,d as re,h as ie,i as ae,l as oe,m as se,n as ce,o as Y,p as le,r as ue,s as de,t as fe,u as pe}from"./DiffPanel.logic-OZhO8GfQ.js";var X=e(i(),1),me=typeof window>`u`?X.useEffect:X.useLayoutEffect;function he({fileDiff:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=V(),f=i!==void 0,p=(0,X.useContext)(S),m=M(),h=(0,X.useRef)(null),g=v(n=>{if(n!=null){if(h.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);d==null?h.current=new re(Z({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new pe(Z({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({fileDiff:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return me(()=>{let{current:n}=h;if(n==null)return;let a=Z({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),o=a!==void 0&&!O(n.options,a);n.setOptions(a),n.render({forceRender:o,fileDiff:e,lineAnnotations:r}),i!==void 0&&n.setSelectedLines(i)}),me(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`FileDiff: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`FileDiff: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,X.useCallback)(()=>h.current?.getHoveredLine(),[])}}function Z({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?w:e?.renderCustomHeader,renderGutterUtility:r?w:e?.renderGutterUtility}:e}var Q=r();function ge({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,className:o,style:s,prerenderedHTML:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=he({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:c,hasGutterRenderUtility:m!=null,hasCustomHeader:u!=null,disableWorkerPool:h,edit:g});return(0,Q.jsx)(y,{ref:_,className:o,style:s,children:W(oe({fileDiff:e,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderAnnotation:l,renderGutterUtility:m,lineAnnotations:i,getHoveredLine:v}),c)})}var $=t();function _e(e){return e.fromTurnCount===0?q(ee)({threadId:e.threadId,toTurnCount:e.toTurnCount}).pipe(n(e=>({kind:`fullThreadDiff`,input:e}))):q(J)({threadId:e.threadId,fromTurnCount:e.fromTurnCount,toTurnCount:e.toTurnCount}).pipe(n(e=>({kind:`turnDiff`,input:e})))}function ve(e){return e instanceof Error?e.message:typeof e==`string`?e:``}function ye(e){let t=ve(e).trim();if(t.length===0)return`Failed to load checkpoint diff.`;let n=t.toLowerCase();if(n.includes(`not a git repository`))return`Turn diffs are unavailable because this project is not a git repository.`;if(n.includes(`checkpoint unavailable for thread`)||n.includes(`checkpoint invariant violation`)){let e=t.indexOf(`:`);if(e>=0){let n=t.slice(e+1).trim();if(n.length>0)return n}}return t}function be(e){let t=ve(e).toLowerCase();return t.includes(`exceeds current turn count`)||t.includes(`checkpoint is unavailable for turn`)||t.includes(`filesystem checkpoint is unavailable`)}function xe(e){let t=_e(e);return _({queryKey:g.checkpointDiff(e),queryFn:async({signal:n})=>{if(!e.environmentId||!e.threadId||t._tag===`None`)throw Error(`Checkpoint diff is unavailable.`);let r=c(e.environmentId);try{return t.value.kind===`fullThreadDiff`?await r.orchestration.getFullThreadDiff(t.value.input,{signal:n}):await r.orchestration.getTurnDiff(t.value.input,{signal:n})}catch(e){throw Error(ye(e),{cause:e})}},enabled:(e.enabled??!0)&&!!e.environmentId&&!!e.threadId&&t._tag===`Some`,staleTime:1/0,retry:(e,t)=>be(t)?e<12:e<3,retryDelay:(e,t)=>be(t)?Math.min(5e3,250*2**(e-1)):Math.min(1e3,100*2**(e-1))})}function Se(e){if(!(!e.canScrollLeft&&!e.canScrollRight))return{maskImage:`linear-gradient(to right, ${e.canScrollLeft?`transparent 24px, black 72px`:`black`}, ${e.canScrollRight?`black calc(100% - 72px), transparent calc(100% - 24px)`:`black`})`}}function Ce(e){return e instanceof Error?e.message:e?`Failed to load checkpoint diff.`:null}function we(e){return{environmentId:e.environmentId??null,threadId:e.threadId,fromTurnCount:e.range?.fromTurnCount??null,toTurnCount:e.range?.toTurnCount??null,cacheScope:e.selectedTurnId?`turn:${e.selectedTurnId}`:e.conversationCacheScope,enabled:e.enabled}}function Te(){let e=(0,$.c)(8),t=(0,X.useRef)(null),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=t.current;if(!e){r(!1),a(!1);return}let n=de({scrollLeft:e.scrollLeft,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth});r(n.canScrollLeft),a(n.canScrollRight)},e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>{t.current?.scrollBy({left:e,behavior:`smooth`})},e[1]=c):c=e[1];let l=c,u;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{let n=t.current;n&&ne({scrollWidth:n.scrollWidth,clientWidth:n.clientWidth,deltaX:e.deltaX,deltaY:e.deltaY})&&(e.preventDefault(),n.scrollBy({left:e.deltaY,behavior:`auto`}))},e[2]=u):u=e[2];let d=u,f,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=t.current;if(!e)return;let n=window.requestAnimationFrame(s),r=()=>s();e.addEventListener(`scroll`,r,{passive:!0});let i=new ResizeObserver(()=>s());return i.observe(e),()=>{window.cancelAnimationFrame(n),e.removeEventListener(`scroll`,r),i.disconnect()}},p=[s],e[3]=f,e[4]=p):(f=e[3],p=e[4]),(0,X.useEffect)(f,p);let m;return e[5]!==n||e[6]!==i?(m={ref:t,canScrollLeft:n,canScrollRight:i,scrollBy:l,onWheel:d,remeasure:s},e[5]=n,e[6]=i,e[7]=m):m=e[7],m}function Ee(e,t){let n=(0,$.c)(5),r;n[0]===e.current?r=n[1]:(r=()=>{(e.current?.querySelector(`[data-turn-chip-selected='true']`))?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`smooth`})},n[0]=e.current,n[1]=r);let i;n[2]!==e||n[3]!==t?(i=[e,t],n[2]=e,n[3]=t,n[4]=i):i=n[4],(0,X.useEffect)(r,i)}var De=`
|
|
2
2
|
[data-diffs-header],
|
|
3
3
|
[data-diff],
|
|
4
4
|
[data-file],
|
|
@@ -60,5 +60,5 @@ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ha as t,Mi as n,Ua as
|
|
|
60
60
|
color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;
|
|
61
61
|
text-decoration-color: currentColor;
|
|
62
62
|
}
|
|
63
|
-
`;function Oe(e){let t=(0,$.c)(44),{mode:n}=e,r=n===void 0?`inline`:n,{resolvedTheme:i}=x(),a=m(),[s,c]=(0,X.useState)(`stacked`),[l,f]=(0,X.useState)(a.diffWordWrap),p=(0,X.useRef)(null),h=(0,X.useRef)(!1),g=Te(),{activeCwd:v,activeThread:y,bodyState:b,diffOpen:S,inferredCheckpointTurnCountByTurnId:C,orderedTurnDiffSummaries:w,renderableFiles:T,renderablePatch:E,selectedFilePath:D,selectedTurn:O,selectedTurnId:A}=Le(i),M,P;t[0]!==S||t[1]!==a.diffWordWrap?(M=()=>{S&&!h.current&&f(a.diffWordWrap),h.current=S},P=[S,a.diffWordWrap],t[0]=S,t[1]=a.diffWordWrap,t[2]=M,t[3]=P):(M=t[2],P=t[3]),(0,X.useEffect)(M,P);let F;t[4]===D?F=t[5]:(F=()=>{!D||!p.current||Array.from(p.current.querySelectorAll(`[data-diff-file-path]`)).find(e=>e.dataset.diffFilePath===D)?.scrollIntoView({block:`nearest`})},t[4]=D,t[5]=F);let I;t[6]!==T||t[7]!==D?(I=[D,T],t[6]=T,t[7]=D,t[8]=I):I=t[8],(0,X.useEffect)(F,I);let L;t[9]===v?L=t[10]:(L=e=>{let t=u();if(!t)return;let n=v?d(e,v):e;N(t,n).catch(ke)},t[9]=v,t[10]=L);let R=L,z;t[11]===y?z=t[12]:(z=e=>{y&&o.getState().openDiff(k(_(y.environmentId,y.id)),e)},t[11]=y,t[12]=z);let B=z,V;t[13]===y?V=t[14]:(V=()=>{y&&o.getState().openDiff(k(_(y.environmentId,y.id)))},t[13]=y,t[14]=V);let H=V,U;t[15]===g.remeasure?U=t[16]:(U=()=>{let e=window.requestAnimationFrame(g.remeasure);return()=>window.cancelAnimationFrame(e)},t[15]=g.remeasure,t[16]=U);let W;t[17]!==w||t[18]!==A||t[19]!==g.remeasure?(W=[w,A,g.remeasure],t[17]=w,t[18]=A,t[19]=g.remeasure,t[20]=W):W=t[20],(0,X.useEffect)(U,W),Ee(g.ref,O?.turnId??A);let G;t[21]!==s||t[22]!==l||t[23]!==C||t[24]!==w||t[25]!==B||t[26]!==H||t[27]!==O||t[28]!==A||t[29]!==a||t[30]!==g?(G=(0,Q.jsx)(Ae,{diffRenderMode:s,diffWordWrap:l,inferredCheckpointTurnCountByTurnId:C,orderedTurnDiffSummaries:w,selectTurn:B,selectWholeConversation:H,selectedTurn:O,selectedTurnId:A,setDiffRenderMode:c,setDiffWordWrap:f,settings:a,turnStrip:g}),t[21]=s,t[22]=l,t[23]=C,t[24]=w,t[25]=B,t[26]=H,t[27]=O,t[28]=A,t[29]=a,t[30]=g,t[31]=G):G=t[31];let K=G,q;t[32]!==b||t[33]!==s||t[34]!==l||t[35]!==R||t[36]!==T||t[37]!==E||t[38]!==i?(q=(0,Q.jsx)(je,{bodyState:b,diffRenderMode:s,diffWordWrap:l,openDiffFileInEditor:R,patchViewportRef:p,renderableFiles:T,renderablePatch:E,resolvedTheme:i}),t[32]=b,t[33]=s,t[34]=l,t[35]=R,t[36]=T,t[37]=E,t[38]=i,t[39]=q):q=t[39];let J;return t[40]!==K||t[41]!==r||t[42]!==q?(J=(0,Q.jsx)(j,{mode:r,header:K,children:q}),t[40]=K,t[41]=r,t[42]=q,t[43]=J):J=t[43],J}function ke(e){console.warn(`Failed to open diff file in editor.`,e)}function Ae(e){let t=(0,$.c)(59),{diffRenderMode:n,diffWordWrap:r,inferredCheckpointTurnCountByTurnId:i,orderedTurnDiffSummaries:a,selectTurn:o,selectWholeConversation:s,selectedTurn:c,selectedTurnId:l,setDiffRenderMode:u,setDiffWordWrap:d,settings:f,turnStrip:p}=e,m,h;t[0]===p?(m=t[1],h=t[2]):(m=(0,Q.jsx)(Be,{direction:`left`,strip:p}),h=(0,Q.jsx)(Be,{direction:`right`,strip:p}),t[0]=p,t[1]=m,t[2]=h);let g=p.ref,_;t[3]!==p.canScrollLeft||t[4]!==p.canScrollRight?(_=Se({canScrollLeft:p.canScrollLeft,canScrollRight:p.canScrollRight}),t[3]=p.canScrollLeft,t[4]=p.canScrollRight,t[5]=_):_=t[5];let v=p.onWheel,y=l===null,b=l===null?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`,x;t[6]===b?x=t[7]:(x=P(`rounded-md border px-2 py-1 text-left transition-colors`,b),t[6]=b,t[7]=x);let S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`div`,{className:`text-[10px] leading-tight font-medium`,children:`All turns`}),t[8]=S):S=t[8];let C;t[9]===x?C=t[10]:(C=(0,Q.jsx)(`div`,{className:x,children:S}),t[9]=x,t[10]=C);let w;t[11]!==s||t[12]!==C||t[13]!==y?(w=(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md`,onClick:s,"data-turn-chip-selected":y,children:C}),t[11]=s,t[12]=C,t[13]=y,t[14]=w):w=t[14];let T;if(t[15]!==i||t[16]!==a||t[17]!==o||t[18]!==c?.turnId||t[19]!==f){let e;t[21]!==i||t[22]!==o||t[23]!==c?.turnId||t[24]!==f?(e=e=>(0,Q.jsx)(Ve,{summary:e,selected:e.turnId===c?.turnId,turnCount:e.checkpointTurnCount??i[e.turnId],timestampFormat:f.timestampFormat,onSelect:o},e.turnId),t[21]=i,t[22]=o,t[23]=c?.turnId,t[24]=f,t[25]=e):e=t[25],T=a.map(e),t[15]=i,t[16]=a,t[17]=o,t[18]=c?.turnId,t[19]=f,t[20]=T}else T=t[20];let E;t[26]!==w||t[27]!==T||t[28]!==_||t[29]!==p.onWheel||t[30]!==p.ref?(E=(0,Q.jsxs)(`div`,{ref:g,className:`turn-chip-strip flex gap-1 overflow-x-auto px-8 py-0.5`,style:_,onWheel:v,children:[w,T]}),t[26]=w,t[27]=T,t[28]=_,t[29]=p.onWheel,t[30]=p.ref,t[31]=E):E=t[31];let D;t[32]!==m||t[33]!==E||t[34]!==h?(D=(0,Q.jsxs)(`div`,{className:`relative min-w-0 flex-1 [-webkit-app-region:no-drag]`,children:[m,h,E]}),t[32]=m,t[33]=E,t[34]=h,t[35]=D):D=t[35];let O;t[36]===n?O=t[37]:(O=[n],t[36]=n,t[37]=O);let k;t[38]===u?k=t[39]:(k=e=>{let t=e[0];(t===`stacked`||t===`split`)&&u(t)},t[38]=u,t[39]=k);let A;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(R,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,Q.jsx)(se,{className:`size-3`})}),t[40]=A):A=t[40];let j;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(R,{"aria-label":`Split diff view`,value:`split`,children:(0,Q.jsx)(ie,{className:`size-3`})}),t[41]=j):j=t[41];let M;t[42]!==O||t[43]!==k?(M=(0,Q.jsxs)(F,{className:`shrink-0`,variant:`outline`,size:`xs`,value:O,onValueChange:k,children:[A,j]}),t[42]=O,t[43]=k,t[44]=M):M=t[44];let N=r?`Disable diff line wrapping`:`Enable diff line wrapping`,I=r?`Disable line wrapping`:`Enable line wrapping`,L;t[45]===d?L=t[46]:(L=e=>{d(!!e)},t[45]=d,t[46]=L);let z;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(le,{className:`size-3`}),t[47]=z):z=t[47];let B;t[48]!==r||t[49]!==N||t[50]!==I||t[51]!==L?(B=(0,Q.jsx)(R,{"aria-label":N,title:I,variant:`outline`,size:`xs`,pressed:r,onPressedChange:L,children:z}),t[48]=r,t[49]=N,t[50]=I,t[51]=L,t[52]=B):B=t[52];let V;t[53]!==M||t[54]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[M,B]}),t[53]=M,t[54]=B,t[55]=V):V=t[55];let H;return t[56]!==D||t[57]!==V?(H=(0,Q.jsxs)(Q.Fragment,{children:[D,V]}),t[56]=D,t[57]=V,t[58]=H):H=t[58],H}function je(e){let t=(0,$.c)(18),{bodyState:n,diffRenderMode:r,diffWordWrap:i,openDiffFileInEditor:a,patchViewportRef:o,renderableFiles:s,renderablePatch:c,resolvedTheme:l}=e;if(n.kind===`no-thread`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ne,{children:`Select a thread to inspect turn diffs.`}),t[0]=e):e=t[0],e}if(n.kind===`not-git-repo`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ne,{children:`Turn diffs are unavailable because this project is not a git repository.`}),t[1]=e):e=t[1],e}if(n.kind===`no-completed-turns`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ne,{children:`No completed turns yet.`}),t[2]=e):e=t[2],e}let u;t[3]!==n.error||t[4]!==c?(u=n.error&&!c&&(0,Q.jsx)(`div`,{className:`px-3`,children:(0,Q.jsx)(`p`,{className:`mb-2 text-[11px] text-destructive-foreground`,children:n.error})}),t[3]=n.error,t[4]=c,t[5]=u):u=t[5];let d;t[6]!==n||t[7]!==r||t[8]!==i||t[9]!==a||t[10]!==s||t[11]!==c||t[12]!==l?(d=c?c.kind===`files`?(0,Q.jsx)(K,{className:`diff-render-surface h-full min-h-0 overflow-auto px-2 pb-2`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:s.map(e=>{let t=Y(e),n=`${fe(e)}:${l}`;return(0,Q.jsx)(`div`,{"data-diff-file-path":t,className:`diff-render-file mb-2 rounded-md first:mt-2 last:mb-0`,onClickCapture:e=>{(e.nativeEvent.composedPath?.()??[]).some(Me)&&a(t)},children:(0,Q.jsx)(ge,{fileDiff:e,options:{diffStyle:r===`split`?`split`:`unified`,lineDiffType:`none`,overflow:i?`wrap`:`scroll`,theme:D(l),themeType:l,unsafeCSS:De}})},n)})}):(0,Q.jsx)(`div`,{className:`h-full overflow-auto p-2`,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:c.reason}),(0,Q.jsx)(`pre`,{className:P(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,i?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:c.text})]})}):(0,Q.jsx)(Re,{bodyState:n}),t[6]=n,t[7]=r,t[8]=i,t[9]=a,t[10]=s,t[11]=c,t[12]=l,t[13]=d):d=t[13];let f;return t[14]!==o||t[15]!==u||t[16]!==d?(f=(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{ref:o,className:`diff-panel-viewport min-h-0 min-w-0 flex-1 overflow-hidden`,children:[u,d]})}),t[14]=o,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function Me(e){return e instanceof Element&&e.hasAttribute(`data-title`)}function Ne(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:n}),t[0]=n,t[1]=r),r}function Pe(){let e=(0,$.c)(19),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1,select:Ie},e[0]=t):t=e[0];let n=f(t),r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r={strict:!1,select:Fe},e[1]=r):r=e[1];let i=B(r),o=i.rightPanel===`diff`,s=n?.threadId??null,c,u;e[2]===n?u=e[3]:(u=T(n),e[2]=n,e[3]=u),c=u;let d=a(c),p=He(d),m=d?.worktreePath,h=p?.cwd,g;e[4]!==m||e[5]!==h?(g=I({threadWorktreePath:m,projectCwd:h}),e[4]=m,e[5]=h,e[6]=g):g=e[6];let _=g,v=d?.environmentId??null,y=_??null,b;e[7]!==v||e[8]!==y?(b={environmentId:v,cwd:y},e[7]=v,e[8]=y,e[9]=b):b=e[9];let x=l(b),S;e[10]===x.data?S=e[11]:(S=z(x.data),e[10]=x.data,e[11]=S);let C=S,w;return e[12]!==_||e[13]!==d||e[14]!==s||e[15]!==o||e[16]!==i||e[17]!==C?(w={activeThread:d,activeThreadId:s,activeCwd:_,isGitRepo:C,diffSearch:i,diffOpen:o},e[12]=_,e[13]=d,e[14]=s,e[15]=o,e[16]=i,e[17]=C,e[18]=w):w=e[18],w}function Fe(e){return G(e)}function Ie(e){return p(e)}function Le(e){let{activeThread:t,activeThreadId:n,activeCwd:r,isGitRepo:i,diffSearch:a,diffOpen:o}=Pe(),{turnDiffSummaries:s,inferredCheckpointTurnCountByTurnId:c}=H(t),l=a.diffTurnId??null,u=l===null?null:a.diffFilePath??null,{activeCheckpointRange:d,conversationCacheScope:f,orderedTurnDiffSummaries:p,selectedTurn:m}=(0,X.useMemo)(()=>te({summaries:s,inferredCheckpointTurnCountByTurnId:c,selectedTurnId:l}),[c,l,s]),g=h(xe(we({environmentId:t?.environmentId,threadId:n,range:d,selectedTurnId:m?.turnId,conversationCacheScope:f,enabled:i}))),_=g.isLoading,v=Ce(g.error),y=g.data?.diff,b=typeof y==`string`&&y.trim().length===0,{emptyDiffMessage:x}=(0,X.useMemo)(()=>ae(m),[m]),S=(0,X.useMemo)(()=>ce(y,`diff-panel:${e}`),[e,y]),C=(0,X.useMemo)(()=>Ue(S),[S]);return{activeCwd:r,activeThread:t,bodyState:ue({hasActiveThread:!!t,isGitRepo:i,turnSummaryCount:p.length,checkpointDiffError:v,hasRenderablePatch:!!S,isLoadingCheckpointDiff:_,hasNoNetChanges:b,emptyDiffMessage:x}),diffOpen:o,inferredCheckpointTurnCountByTurnId:c,orderedTurnDiffSummaries:p,renderableFiles:C,renderablePatch:S,selectedFilePath:u,selectedTurn:m,selectedTurnId:l}}function Re(e){let t=(0,$.c)(4),{bodyState:n}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(O,{label:`Loading checkpoint diff...`}),t[0]=e):e=t[0],e}let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(L,{className:`size-7 text-muted-foreground/25`}),t[1]=r):r=t[1];let i=n.kind===`empty`?n.message:`No diff is available for this range.`,a;return t[2]===i?a=t[3]:(a=(0,Q.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 px-5 py-2 text-center`,children:[r,(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:i})]}),t[2]=i,t[3]=a),a}var ze=180;function Be(e){let t=(0,$.c)(14),{direction:n,strip:r}=e,i=n===`left`,a=i?r.canScrollLeft:r.canScrollRight,o=i?U:c,s=i?`left-0`:`right-0`,l=a?`border-border/70 hover:border-border hover:text-foreground`:`cursor-not-allowed border-border/40 text-muted-foreground/40`,u;t[0]!==s||t[1]!==l?(u=P(`absolute top-1/2 z-20 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md border bg-background/90 text-muted-foreground transition-colors`,s,l),t[0]=s,t[1]=l,t[2]=u):u=t[2];let d;t[3]!==i||t[4]!==r?(d=()=>r.scrollBy(i?-180:ze),t[3]=i,t[4]=r,t[5]=d):d=t[5];let f=!a,p=`Scroll turn list ${n}`,m;t[6]===o?m=t[7]:(m=(0,Q.jsx)(o,{className:`size-3.5`}),t[6]=o,t[7]=m);let h;return t[8]!==u||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==m?(h=(0,Q.jsx)(`button`,{type:`button`,className:u,onClick:d,disabled:f,"aria-label":p,children:m}),t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h):h=t[13],h}function Ve(e){let t=(0,$.c)(23),{summary:n,selected:r,turnCount:i,timestampFormat:a,onSelect:o}=e,s;t[0]!==o||t[1]!==n.turnId?(s=()=>o(n.turnId),t[0]=o,t[1]=n.turnId,t[2]=s):s=t[2];let c=n.turnId,l=r?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`,u;t[3]===l?u=t[4]:(u=P(`rounded-md border px-2 py-1 text-left transition-colors`,l),t[3]=l,t[4]=u);let d=i??`?`,f;t[5]===d?f=t[6]:(f=(0,Q.jsxs)(`span`,{className:`text-[10px] leading-tight font-medium`,children:[`Turn `,d]}),t[5]=d,t[6]=f);let p;t[7]!==n.completedAt||t[8]!==a?(p=y(n.completedAt,a),t[7]=n.completedAt,t[8]=a,t[9]=p):p=t[9];let m;t[10]===p?m=t[11]:(m=(0,Q.jsx)(`span`,{className:`text-[9px] leading-tight opacity-70`,children:p}),t[10]=p,t[11]=m);let h;t[12]!==f||t[13]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[f,m]}),t[12]=f,t[13]=m,t[14]=h):h=t[14];let g;t[15]!==u||t[16]!==h?(g=(0,Q.jsx)(`div`,{className:u,children:h}),t[15]=u,t[16]=h,t[17]=g):g=t[17];let _;return t[18]!==r||t[19]!==n.turnId||t[20]!==s||t[21]!==g?(_=(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md`,onClick:s,title:c,"data-turn-chip-selected":r,children:g}),t[18]=r,t[19]=n.turnId,t[20]=s,t[21]=g,t[22]=_):_=t[22],_}function He(e){let t=(0,$.c)(3),n=e?.environmentId,r=e?.projectId,i;return t[0]!==n||t[1]!==r?(i=e=>n&&r?b(e,{environmentId:n,projectId:r}):void 0,t[0]=n,t[1]=r,t[2]=i):i=t[2],a(i)}function Ue(e){return!e||e.kind!==`files`?[]:e.files.toSorted((e,t)=>Y(e).localeCompare(Y(t),void 0,{numeric:!0,sensitivity:`base`}))}export{Oe as default};
|
|
64
|
-
//# sourceMappingURL=DiffPanel-
|
|
63
|
+
`;function Oe(e){let t=(0,$.c)(44),{mode:n}=e,r=n===void 0?`inline`:n,{resolvedTheme:i}=x(),a=h(),[s,c]=(0,X.useState)(`stacked`),[l,u]=(0,X.useState)(a.diffWordWrap),p=(0,X.useRef)(null),m=(0,X.useRef)(!1),g=Te(),{activeCwd:_,activeThread:v,bodyState:y,diffOpen:b,inferredCheckpointTurnCountByTurnId:S,orderedTurnDiffSummaries:C,renderableFiles:w,renderablePatch:T,selectedFilePath:E,selectedTurn:D,selectedTurnId:O}=Le(i),M,P;t[0]!==b||t[1]!==a.diffWordWrap?(M=()=>{b&&!m.current&&u(a.diffWordWrap),m.current=b},P=[b,a.diffWordWrap],t[0]=b,t[1]=a.diffWordWrap,t[2]=M,t[3]=P):(M=t[2],P=t[3]),(0,X.useEffect)(M,P);let F;t[4]===E?F=t[5]:(F=()=>{!E||!p.current||Array.from(p.current.querySelectorAll(`[data-diff-file-path]`)).find(e=>e.dataset.diffFilePath===E)?.scrollIntoView({block:`nearest`})},t[4]=E,t[5]=F);let I;t[6]!==w||t[7]!==E?(I=[E,w],t[6]=w,t[7]=E,t[8]=I):I=t[8],(0,X.useEffect)(F,I);let L;t[9]===_?L=t[10]:(L=e=>{let t=d();if(!t)return;let n=_?f(e,_):e;N(t,n).catch(ke)},t[9]=_,t[10]=L);let R=L,z;t[11]===v?z=t[12]:(z=e=>{v&&o.getState().openDiff(A(j(v.environmentId,v.id)),e)},t[11]=v,t[12]=z);let B=z,V;t[13]===v?V=t[14]:(V=()=>{v&&o.getState().openDiff(A(j(v.environmentId,v.id)))},t[13]=v,t[14]=V);let H=V,U;t[15]===g.remeasure?U=t[16]:(U=()=>{let e=window.requestAnimationFrame(g.remeasure);return()=>window.cancelAnimationFrame(e)},t[15]=g.remeasure,t[16]=U);let W;t[17]!==C||t[18]!==O||t[19]!==g.remeasure?(W=[C,O,g.remeasure],t[17]=C,t[18]=O,t[19]=g.remeasure,t[20]=W):W=t[20],(0,X.useEffect)(U,W),Ee(g.ref,D?.turnId??O);let G;t[21]!==s||t[22]!==l||t[23]!==S||t[24]!==C||t[25]!==B||t[26]!==H||t[27]!==D||t[28]!==O||t[29]!==a||t[30]!==g?(G=(0,Q.jsx)(Ae,{diffRenderMode:s,diffWordWrap:l,inferredCheckpointTurnCountByTurnId:S,orderedTurnDiffSummaries:C,selectTurn:B,selectWholeConversation:H,selectedTurn:D,selectedTurnId:O,setDiffRenderMode:c,setDiffWordWrap:u,settings:a,turnStrip:g}),t[21]=s,t[22]=l,t[23]=S,t[24]=C,t[25]=B,t[26]=H,t[27]=D,t[28]=O,t[29]=a,t[30]=g,t[31]=G):G=t[31];let K=G,q;t[32]!==y||t[33]!==s||t[34]!==l||t[35]!==R||t[36]!==w||t[37]!==T||t[38]!==i?(q=(0,Q.jsx)(je,{bodyState:y,diffRenderMode:s,diffWordWrap:l,openDiffFileInEditor:R,patchViewportRef:p,renderableFiles:w,renderablePatch:T,resolvedTheme:i}),t[32]=y,t[33]=s,t[34]=l,t[35]=R,t[36]=w,t[37]=T,t[38]=i,t[39]=q):q=t[39];let J;return t[40]!==K||t[41]!==r||t[42]!==q?(J=(0,Q.jsx)(k,{mode:r,header:K,children:q}),t[40]=K,t[41]=r,t[42]=q,t[43]=J):J=t[43],J}function ke(e){console.warn(`Failed to open diff file in editor.`,e)}function Ae(e){let t=(0,$.c)(59),{diffRenderMode:n,diffWordWrap:r,inferredCheckpointTurnCountByTurnId:i,orderedTurnDiffSummaries:a,selectTurn:o,selectWholeConversation:s,selectedTurn:c,selectedTurnId:l,setDiffRenderMode:u,setDiffWordWrap:d,settings:f,turnStrip:p}=e,m,h;t[0]===p?(m=t[1],h=t[2]):(m=(0,Q.jsx)(Be,{direction:`left`,strip:p}),h=(0,Q.jsx)(Be,{direction:`right`,strip:p}),t[0]=p,t[1]=m,t[2]=h);let g=p.ref,_;t[3]!==p.canScrollLeft||t[4]!==p.canScrollRight?(_=Se({canScrollLeft:p.canScrollLeft,canScrollRight:p.canScrollRight}),t[3]=p.canScrollLeft,t[4]=p.canScrollRight,t[5]=_):_=t[5];let v=p.onWheel,y=l===null,b=l===null?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`,x;t[6]===b?x=t[7]:(x=P(`rounded-md border px-2 py-1 text-left transition-colors`,b),t[6]=b,t[7]=x);let S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`div`,{className:`text-[10px] leading-tight font-medium`,children:`All turns`}),t[8]=S):S=t[8];let C;t[9]===x?C=t[10]:(C=(0,Q.jsx)(`div`,{className:x,children:S}),t[9]=x,t[10]=C);let w;t[11]!==s||t[12]!==C||t[13]!==y?(w=(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md`,onClick:s,"data-turn-chip-selected":y,children:C}),t[11]=s,t[12]=C,t[13]=y,t[14]=w):w=t[14];let T;if(t[15]!==i||t[16]!==a||t[17]!==o||t[18]!==c?.turnId||t[19]!==f){let e;t[21]!==i||t[22]!==o||t[23]!==c?.turnId||t[24]!==f?(e=e=>(0,Q.jsx)(Ve,{summary:e,selected:e.turnId===c?.turnId,turnCount:e.checkpointTurnCount??i[e.turnId],timestampFormat:f.timestampFormat,onSelect:o},e.turnId),t[21]=i,t[22]=o,t[23]=c?.turnId,t[24]=f,t[25]=e):e=t[25],T=a.map(e),t[15]=i,t[16]=a,t[17]=o,t[18]=c?.turnId,t[19]=f,t[20]=T}else T=t[20];let E;t[26]!==w||t[27]!==T||t[28]!==_||t[29]!==p.onWheel||t[30]!==p.ref?(E=(0,Q.jsxs)(`div`,{ref:g,className:`turn-chip-strip flex gap-1 overflow-x-auto px-8 py-0.5`,style:_,onWheel:v,children:[w,T]}),t[26]=w,t[27]=T,t[28]=_,t[29]=p.onWheel,t[30]=p.ref,t[31]=E):E=t[31];let D;t[32]!==m||t[33]!==E||t[34]!==h?(D=(0,Q.jsxs)(`div`,{className:`relative min-w-0 flex-1 [-webkit-app-region:no-drag]`,children:[m,h,E]}),t[32]=m,t[33]=E,t[34]=h,t[35]=D):D=t[35];let O;t[36]===n?O=t[37]:(O=[n],t[36]=n,t[37]=O);let k;t[38]===u?k=t[39]:(k=e=>{let t=e[0];(t===`stacked`||t===`split`)&&u(t)},t[38]=u,t[39]=k);let A;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(R,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,Q.jsx)(se,{className:`size-3`})}),t[40]=A):A=t[40];let j;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(R,{"aria-label":`Split diff view`,value:`split`,children:(0,Q.jsx)(ie,{className:`size-3`})}),t[41]=j):j=t[41];let M;t[42]!==O||t[43]!==k?(M=(0,Q.jsxs)(F,{className:`shrink-0`,variant:`outline`,size:`xs`,value:O,onValueChange:k,children:[A,j]}),t[42]=O,t[43]=k,t[44]=M):M=t[44];let N=r?`Disable diff line wrapping`:`Enable diff line wrapping`,I=r?`Disable line wrapping`:`Enable line wrapping`,L;t[45]===d?L=t[46]:(L=e=>{d(!!e)},t[45]=d,t[46]=L);let z;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(le,{className:`size-3`}),t[47]=z):z=t[47];let B;t[48]!==r||t[49]!==N||t[50]!==I||t[51]!==L?(B=(0,Q.jsx)(R,{"aria-label":N,title:I,variant:`outline`,size:`xs`,pressed:r,onPressedChange:L,children:z}),t[48]=r,t[49]=N,t[50]=I,t[51]=L,t[52]=B):B=t[52];let V;t[53]!==M||t[54]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[M,B]}),t[53]=M,t[54]=B,t[55]=V):V=t[55];let H;return t[56]!==D||t[57]!==V?(H=(0,Q.jsxs)(Q.Fragment,{children:[D,V]}),t[56]=D,t[57]=V,t[58]=H):H=t[58],H}function je(e){let t=(0,$.c)(18),{bodyState:n,diffRenderMode:r,diffWordWrap:i,openDiffFileInEditor:a,patchViewportRef:o,renderableFiles:s,renderablePatch:c,resolvedTheme:l}=e;if(n.kind===`no-thread`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ne,{children:`Select a thread to inspect turn diffs.`}),t[0]=e):e=t[0],e}if(n.kind===`not-git-repo`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ne,{children:`Turn diffs are unavailable because this project is not a git repository.`}),t[1]=e):e=t[1],e}if(n.kind===`no-completed-turns`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ne,{children:`No completed turns yet.`}),t[2]=e):e=t[2],e}let u;t[3]!==n.error||t[4]!==c?(u=n.error&&!c&&(0,Q.jsx)(`div`,{className:`px-3`,children:(0,Q.jsx)(`p`,{className:`mb-2 text-[11px] text-destructive-foreground`,children:n.error})}),t[3]=n.error,t[4]=c,t[5]=u):u=t[5];let d;t[6]!==n||t[7]!==r||t[8]!==i||t[9]!==a||t[10]!==s||t[11]!==c||t[12]!==l?(d=c?c.kind===`files`?(0,Q.jsx)(K,{className:`diff-render-surface h-full min-h-0 overflow-auto px-2 pb-2`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:s.map(e=>{let t=Y(e),n=`${fe(e)}:${l}`;return(0,Q.jsx)(`div`,{"data-diff-file-path":t,className:`diff-render-file mb-2 rounded-md first:mt-2 last:mb-0`,onClickCapture:e=>{(e.nativeEvent.composedPath?.()??[]).some(Me)&&a(t)},children:(0,Q.jsx)(ge,{fileDiff:e,options:{diffStyle:r===`split`?`split`:`unified`,lineDiffType:`none`,overflow:i?`wrap`:`scroll`,theme:T(l),themeType:l,unsafeCSS:De}})},n)})}):(0,Q.jsx)(`div`,{className:`h-full overflow-auto p-2`,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:c.reason}),(0,Q.jsx)(`pre`,{className:P(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,i?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:c.text})]})}):(0,Q.jsx)(Re,{bodyState:n}),t[6]=n,t[7]=r,t[8]=i,t[9]=a,t[10]=s,t[11]=c,t[12]=l,t[13]=d):d=t[13];let f;return t[14]!==o||t[15]!==u||t[16]!==d?(f=(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{ref:o,className:`diff-panel-viewport min-h-0 min-w-0 flex-1 overflow-hidden`,children:[u,d]})}),t[14]=o,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function Me(e){return e instanceof Element&&e.hasAttribute(`data-title`)}function Ne(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:n}),t[0]=n,t[1]=r),r}function Pe(){let e=(0,$.c)(19),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1,select:Ie},e[0]=t):t=e[0];let n=s(t),r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r={strict:!1,select:Fe},e[1]=r):r=e[1];let i=B(r),o=i.rightPanel===`diff`,c=n?.threadId??null,l,d;e[2]===n?d=e[3]:(d=C(n),e[2]=n,e[3]=d),l=d;let f=a(l),p=He(f),m=f?.worktreePath,h=p?.cwd,g;e[4]!==m||e[5]!==h?(g=I({threadWorktreePath:m,projectCwd:h}),e[4]=m,e[5]=h,e[6]=g):g=e[6];let _=g,v=f?.environmentId??null,y=_??null,b;e[7]!==v||e[8]!==y?(b={environmentId:v,cwd:y},e[7]=v,e[8]=y,e[9]=b):b=e[9];let x=u(b),S;e[10]===x.data?S=e[11]:(S=z(x.data),e[10]=x.data,e[11]=S);let w=S,T;return e[12]!==_||e[13]!==f||e[14]!==c||e[15]!==o||e[16]!==i||e[17]!==w?(T={activeThread:f,activeThreadId:c,activeCwd:_,isGitRepo:w,diffSearch:i,diffOpen:o},e[12]=_,e[13]=f,e[14]=c,e[15]=o,e[16]=i,e[17]=w,e[18]=T):T=e[18],T}function Fe(e){return G(e)}function Ie(e){return p(e)}function Le(e){let{activeThread:t,activeThreadId:n,activeCwd:r,isGitRepo:i,diffSearch:a,diffOpen:o}=Pe(),{turnDiffSummaries:s,inferredCheckpointTurnCountByTurnId:c}=H(t),l=a.diffTurnId??null,u=l===null?null:a.diffFilePath??null,{activeCheckpointRange:d,conversationCacheScope:f,orderedTurnDiffSummaries:p,selectedTurn:m}=(0,X.useMemo)(()=>te({summaries:s,inferredCheckpointTurnCountByTurnId:c,selectedTurnId:l}),[c,l,s]),h=D(xe(we({environmentId:t?.environmentId,threadId:n,range:d,selectedTurnId:m?.turnId,conversationCacheScope:f,enabled:i}))),g=h.isLoading,_=Ce(h.error),v=h.data?.diff,y=typeof v==`string`&&v.trim().length===0,{emptyDiffMessage:b}=(0,X.useMemo)(()=>ae(m),[m]),x=(0,X.useMemo)(()=>ce(v,`diff-panel:${e}`),[e,v]),S=(0,X.useMemo)(()=>Ue(x),[x]);return{activeCwd:r,activeThread:t,bodyState:ue({hasActiveThread:!!t,isGitRepo:i,turnSummaryCount:p.length,checkpointDiffError:_,hasRenderablePatch:!!x,isLoadingCheckpointDiff:g,hasNoNetChanges:y,emptyDiffMessage:b}),diffOpen:o,inferredCheckpointTurnCountByTurnId:c,orderedTurnDiffSummaries:p,renderableFiles:S,renderablePatch:x,selectedFilePath:u,selectedTurn:m,selectedTurnId:l}}function Re(e){let t=(0,$.c)(4),{bodyState:n}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(E,{label:`Loading checkpoint diff...`}),t[0]=e):e=t[0],e}let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(L,{className:`size-7 text-muted-foreground/25`}),t[1]=r):r=t[1];let i=n.kind===`empty`?n.message:`No diff is available for this range.`,a;return t[2]===i?a=t[3]:(a=(0,Q.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 px-5 py-2 text-center`,children:[r,(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:i})]}),t[2]=i,t[3]=a),a}var ze=180;function Be(e){let t=(0,$.c)(14),{direction:n,strip:r}=e,i=n===`left`,a=i?r.canScrollLeft:r.canScrollRight,o=i?U:l,s=i?`left-0`:`right-0`,c=a?`border-border/70 hover:border-border hover:text-foreground`:`cursor-not-allowed border-border/40 text-muted-foreground/40`,u;t[0]!==s||t[1]!==c?(u=P(`absolute top-1/2 z-20 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md border bg-background/90 text-muted-foreground transition-colors`,s,c),t[0]=s,t[1]=c,t[2]=u):u=t[2];let d;t[3]!==i||t[4]!==r?(d=()=>r.scrollBy(i?-180:ze),t[3]=i,t[4]=r,t[5]=d):d=t[5];let f=!a,p=`Scroll turn list ${n}`,m;t[6]===o?m=t[7]:(m=(0,Q.jsx)(o,{className:`size-3.5`}),t[6]=o,t[7]=m);let h;return t[8]!==u||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==m?(h=(0,Q.jsx)(`button`,{type:`button`,className:u,onClick:d,disabled:f,"aria-label":p,children:m}),t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h):h=t[13],h}function Ve(e){let t=(0,$.c)(23),{summary:n,selected:r,turnCount:i,timestampFormat:a,onSelect:o}=e,s;t[0]!==o||t[1]!==n.turnId?(s=()=>o(n.turnId),t[0]=o,t[1]=n.turnId,t[2]=s):s=t[2];let c=n.turnId,l=r?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`,u;t[3]===l?u=t[4]:(u=P(`rounded-md border px-2 py-1 text-left transition-colors`,l),t[3]=l,t[4]=u);let d=i??`?`,f;t[5]===d?f=t[6]:(f=(0,Q.jsxs)(`span`,{className:`text-[10px] leading-tight font-medium`,children:[`Turn `,d]}),t[5]=d,t[6]=f);let p;t[7]!==n.completedAt||t[8]!==a?(p=b(n.completedAt,a),t[7]=n.completedAt,t[8]=a,t[9]=p):p=t[9];let m;t[10]===p?m=t[11]:(m=(0,Q.jsx)(`span`,{className:`text-[9px] leading-tight opacity-70`,children:p}),t[10]=p,t[11]=m);let h;t[12]!==f||t[13]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[f,m]}),t[12]=f,t[13]=m,t[14]=h):h=t[14];let g;t[15]!==u||t[16]!==h?(g=(0,Q.jsx)(`div`,{className:u,children:h}),t[15]=u,t[16]=h,t[17]=g):g=t[17];let _;return t[18]!==r||t[19]!==n.turnId||t[20]!==s||t[21]!==g?(_=(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md`,onClick:s,title:c,"data-turn-chip-selected":r,children:g}),t[18]=r,t[19]=n.turnId,t[20]=s,t[21]=g,t[22]=_):_=t[22],_}function He(e){let t=(0,$.c)(3),n=e?.environmentId,r=e?.projectId,i;return t[0]!==n||t[1]!==r?(i=e=>n&&r?m(e,{environmentId:n,projectId:r}):void 0,t[0]=n,t[1]=r,t[2]=i):i=t[2],a(i)}function Ue(e){return!e||e.kind!==`files`?[]:e.files.toSorted((e,t)=>Y(e).localeCompare(Y(t),void 0,{numeric:!0,sensitivity:`base`}))}export{Oe as default};
|
|
64
|
+
//# sourceMappingURL=DiffPanel-BrlSm5kH.js.map
|