@cmmd-center/forge 0.13.49 → 0.13.51
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 +98 -30
- package/dist/bin.mjs +98 -30
- package/dist/client/assets/{DiffPanel-D6uG2z0I.js → DiffPanel-BKiUItkC.js} +2 -2
- package/dist/client/assets/{DiffPanel.logic-CjSaOjWO.js → DiffPanel.logic-B8i62gxa.js} +2 -2
- package/dist/client/assets/{DiffPanelShell-CDR-QO16.js → DiffPanelShell-rl5__4lJ.js} +3 -3
- package/dist/client/assets/{DiffWorkerPoolProvider-DuLZBv2X.js → DiffWorkerPoolProvider-DXbwWz2S.js} +2 -2
- package/dist/client/assets/{PullRequestCodePanel-C9pGI1qK.js → PullRequestCodePanel-Bsxf7wkG.js} +2 -2
- package/dist/client/assets/{Virtualizer-Bo-au-FR.js → Virtualizer-BWn7-Vaq.js} +2 -2
- package/dist/client/assets/{index-19iPRfmd.js → index-DU3KdQDl.js} +6 -6
- package/dist/client/index.html +4 -4
- package/dist/forge-build.json +1 -1
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -66257,7 +66257,7 @@ function normalizeNumberish(value) {
|
|
|
66257
66257
|
}
|
|
66258
66258
|
//#endregion
|
|
66259
66259
|
//#region package.json
|
|
66260
|
-
var version$1 = "0.13.
|
|
66260
|
+
var version$1 = "0.13.51";
|
|
66261
66261
|
//#endregion
|
|
66262
66262
|
//#region src/sentry.ts
|
|
66263
66263
|
const SERVER_APP_NAME = "forge-server";
|
|
@@ -89213,6 +89213,13 @@ function errorFromBody(body, fallback) {
|
|
|
89213
89213
|
}
|
|
89214
89214
|
return fallback;
|
|
89215
89215
|
}
|
|
89216
|
+
function codeFromBody(body) {
|
|
89217
|
+
if (body && typeof body === "object") {
|
|
89218
|
+
const code = body["code"];
|
|
89219
|
+
if (typeof code === "string") return code;
|
|
89220
|
+
}
|
|
89221
|
+
return null;
|
|
89222
|
+
}
|
|
89216
89223
|
function shouldRefreshCmmdBrokerJwt(status) {
|
|
89217
89224
|
return status === 401 || status === 403;
|
|
89218
89225
|
}
|
|
@@ -89335,9 +89342,10 @@ var GitHubBroker = class {
|
|
|
89335
89342
|
} : auth);
|
|
89336
89343
|
}
|
|
89337
89344
|
async status(auth) {
|
|
89338
|
-
|
|
89339
|
-
|
|
89340
|
-
|
|
89345
|
+
return this.cmmdRequest(auth, {
|
|
89346
|
+
jwtPath: "/api/github-oauth/status",
|
|
89347
|
+
runtimeResource: "status"
|
|
89348
|
+
});
|
|
89341
89349
|
}
|
|
89342
89350
|
async workspaceStatus(input) {
|
|
89343
89351
|
const cwdValidation = validateCwd(input.cwd);
|
|
@@ -89526,12 +89534,16 @@ var GitHubBroker = class {
|
|
|
89526
89534
|
async listRepositories(auth, input = {}) {
|
|
89527
89535
|
const search = new URLSearchParams();
|
|
89528
89536
|
if (input.search?.trim()) search.set("search", input.search.trim());
|
|
89529
|
-
|
|
89530
|
-
|
|
89531
|
-
|
|
89537
|
+
return this.cmmdRequest(auth, {
|
|
89538
|
+
jwtPath: "/api/forge/github/repos",
|
|
89539
|
+
runtimeResource: "repos",
|
|
89540
|
+
search: search.size > 0 ? search : void 0
|
|
89541
|
+
});
|
|
89532
89542
|
}
|
|
89533
89543
|
async createRepository(auth, input) {
|
|
89534
|
-
return this.
|
|
89544
|
+
return this.cmmdRequest(auth, {
|
|
89545
|
+
jwtPath: "/api/forge/github/repos",
|
|
89546
|
+
runtimeResource: "repos",
|
|
89535
89547
|
method: "POST",
|
|
89536
89548
|
body: {
|
|
89537
89549
|
owner: input.owner,
|
|
@@ -90191,6 +90203,21 @@ var GitHubBroker = class {
|
|
|
90191
90203
|
}
|
|
90192
90204
|
};
|
|
90193
90205
|
}
|
|
90206
|
+
/**
|
|
90207
|
+
* The only way this broker calls CMMD as the person. Every operation names
|
|
90208
|
+
* both routes, because a managed runtime acts on its runtime grant and never
|
|
90209
|
+
* on a user JWT (CMMD ADR-015): it holds no refreshable JWT, so the JWT path
|
|
90210
|
+
* there reports a session expiry that signing in cannot fix. A cloud runtime
|
|
90211
|
+
* with no usable grant fails closed. Desktop and local keep the JWT path.
|
|
90212
|
+
*/
|
|
90213
|
+
async cmmdRequest(auth, operation) {
|
|
90214
|
+
const { jwtPath, runtimeResource, ...options } = operation;
|
|
90215
|
+
const grant = this.resolveRuntimeGrant();
|
|
90216
|
+
if (grant) return this.cmmdRuntimeJson(grant, runtimeResource, options);
|
|
90217
|
+
const missingGrantFailure = this.missingRuntimeGrantFailure();
|
|
90218
|
+
if (missingGrantFailure) return missingGrantFailure;
|
|
90219
|
+
return this.cmmdJson(auth, jwtPath, options);
|
|
90220
|
+
}
|
|
90194
90221
|
async cmmdJson(auth, path, options = {}) {
|
|
90195
90222
|
const jwt = await this.resolveJwt(auth);
|
|
90196
90223
|
if (!jwt) return {
|
|
@@ -90275,6 +90302,22 @@ var GitHubBroker = class {
|
|
|
90275
90302
|
token: token.trim()
|
|
90276
90303
|
};
|
|
90277
90304
|
}
|
|
90305
|
+
/**
|
|
90306
|
+
* A cloud runtime with no usable grant must not fall back to the person's JWT.
|
|
90307
|
+
* `githubWriteIdentity: "my-account"` is the deliberate opposite choice for git
|
|
90308
|
+
* credentials, so those paths pass `allowMyAccount`.
|
|
90309
|
+
*/
|
|
90310
|
+
missingRuntimeGrantFailure(options = {}) {
|
|
90311
|
+
if (options.allowMyAccount && this.githubWriteIdentity === "my-account") return null;
|
|
90312
|
+
const failure = classifyMissingRuntimeGrant({
|
|
90313
|
+
isCmmdCloudRuntimeMode: this.isCmmdCloudRuntimeMode,
|
|
90314
|
+
hasRuntimeGrant: false
|
|
90315
|
+
});
|
|
90316
|
+
return failure ? {
|
|
90317
|
+
ok: false,
|
|
90318
|
+
...failure
|
|
90319
|
+
} : null;
|
|
90320
|
+
}
|
|
90278
90321
|
async resolveInstallationToken(auth, repoFullName) {
|
|
90279
90322
|
const runtimeGrant = this.resolveRuntimeGrant("github");
|
|
90280
90323
|
if (runtimeGrant) {
|
|
@@ -90282,6 +90325,8 @@ var GitHubBroker = class {
|
|
|
90282
90325
|
if (!token.ok) return token;
|
|
90283
90326
|
return token.token ?? invalidInstallationTokenResult();
|
|
90284
90327
|
}
|
|
90328
|
+
const missingGrantFailure = this.missingRuntimeGrantFailure({ allowMyAccount: true });
|
|
90329
|
+
if (missingGrantFailure) return missingGrantFailure;
|
|
90285
90330
|
const jwt = await this.resolveJwt(auth);
|
|
90286
90331
|
if (!jwt) return cmmdReauthRequiredResult();
|
|
90287
90332
|
let token = await this.fetchInstallationToken(jwt, repoFullName);
|
|
@@ -90636,16 +90681,8 @@ var GitHubBroker = class {
|
|
|
90636
90681
|
repoFullName
|
|
90637
90682
|
};
|
|
90638
90683
|
}
|
|
90639
|
-
const missingGrantFailure = this.
|
|
90640
|
-
|
|
90641
|
-
hasRuntimeGrant: runtimeGrant !== null
|
|
90642
|
-
});
|
|
90643
|
-
if (missingGrantFailure) return {
|
|
90644
|
-
ok: false,
|
|
90645
|
-
code: missingGrantFailure.code,
|
|
90646
|
-
userActionRequired: missingGrantFailure.userActionRequired,
|
|
90647
|
-
error: missingGrantFailure.error
|
|
90648
|
-
};
|
|
90684
|
+
const missingGrantFailure = this.missingRuntimeGrantFailure({ allowMyAccount: true });
|
|
90685
|
+
if (missingGrantFailure) return missingGrantFailure;
|
|
90649
90686
|
const jwt = await this.resolveJwt(auth);
|
|
90650
90687
|
if (!jwt) return cmmdReauthRequiredResult();
|
|
90651
90688
|
let token = await this.fetchInstallationToken(jwt, repoFullName);
|
|
@@ -90710,7 +90747,7 @@ var GitHubBroker = class {
|
|
|
90710
90747
|
};
|
|
90711
90748
|
}
|
|
90712
90749
|
/**
|
|
90713
|
-
*
|
|
90750
|
+
* Call a grant-authenticated GitHub endpoint from inside a managed runtime. The
|
|
90714
90751
|
* runtime grant token (scope `github`) stands in for the user JWT — CMMD
|
|
90715
90752
|
* resolves identity server-side and returns the same body as the JWT routes,
|
|
90716
90753
|
* so callers get an identical `GitHubBrokerResult`. `resource` is the trailing
|
|
@@ -90719,18 +90756,21 @@ var GitHubBroker = class {
|
|
|
90719
90756
|
*/
|
|
90720
90757
|
async cmmdRuntimeJson(grant, resource, options = {}) {
|
|
90721
90758
|
const response = await this.fetchImpl(makeUrl(this.commandAppUrl, `/api/forge/runtimes/${encodeURIComponent(grant.runtimeId)}/github/${resource}`, options.search), {
|
|
90722
|
-
method: "GET",
|
|
90723
|
-
headers: {
|
|
90724
|
-
|
|
90725
|
-
|
|
90726
|
-
|
|
90759
|
+
method: options.method ?? "GET",
|
|
90760
|
+
headers: {
|
|
90761
|
+
Authorization: `Bearer ${grant.token}`,
|
|
90762
|
+
...options.body !== void 0 ? { "Content-Type": "application/json" } : {}
|
|
90763
|
+
},
|
|
90764
|
+
...options.body !== void 0 ? { body: JSON.stringify(options.body) } : {},
|
|
90765
|
+
signal: AbortSignal.timeout(GITHUB_BROKER_REQUEST_TIMEOUT_MS)
|
|
90766
|
+
}).catch(() => null);
|
|
90767
|
+
if (response === null) return {
|
|
90727
90768
|
ok: false,
|
|
90728
|
-
|
|
90729
|
-
|
|
90730
|
-
...response.status === 401 ? { userActionRequired: "connect_github" } : {},
|
|
90731
|
-
error: errorFromBody(body, `GitHub runtime request failed with status ${response.status}.`),
|
|
90732
|
-
data: body
|
|
90769
|
+
code: "GITHUB_BROKER_REQUEST_FAILED",
|
|
90770
|
+
error: "CMMD could not be reached for this GitHub request. Retry in a moment."
|
|
90733
90771
|
};
|
|
90772
|
+
const body = await parseResponseBody(response);
|
|
90773
|
+
if (!response.ok) return runtimeGrantRequestFailure(response.status, body);
|
|
90734
90774
|
return {
|
|
90735
90775
|
ok: true,
|
|
90736
90776
|
status: response.status,
|
|
@@ -90857,6 +90897,34 @@ function parseWorkspaceStatus(stdout) {
|
|
|
90857
90897
|
function isGitHubCliCredential(value) {
|
|
90858
90898
|
return "token" in value && "repoFullName" in value;
|
|
90859
90899
|
}
|
|
90900
|
+
function runtimeGrantRequestFailure(status, body) {
|
|
90901
|
+
const cmmdCode = codeFromBody(body);
|
|
90902
|
+
const grantFailure = cmmdCode?.startsWith("RUNTIME_GRANT_") ? classifyMissingRuntimeGrant({
|
|
90903
|
+
isCmmdCloudRuntimeMode: true,
|
|
90904
|
+
hasRuntimeGrant: false
|
|
90905
|
+
}) : null;
|
|
90906
|
+
if (grantFailure) return {
|
|
90907
|
+
ok: false,
|
|
90908
|
+
status,
|
|
90909
|
+
...grantFailure,
|
|
90910
|
+
data: body
|
|
90911
|
+
};
|
|
90912
|
+
if (status === 401) return {
|
|
90913
|
+
ok: false,
|
|
90914
|
+
status,
|
|
90915
|
+
code: "GITHUB_AUTH_REQUIRED",
|
|
90916
|
+
userActionRequired: "connect_github",
|
|
90917
|
+
error: errorFromBody(body, `GitHub runtime request failed with status ${status}.`),
|
|
90918
|
+
data: body
|
|
90919
|
+
};
|
|
90920
|
+
return {
|
|
90921
|
+
ok: false,
|
|
90922
|
+
status,
|
|
90923
|
+
code: cmmdCode ?? "GITHUB_BROKER_REQUEST_FAILED",
|
|
90924
|
+
error: errorFromBody(body, `GitHub runtime request failed with status ${status}.`),
|
|
90925
|
+
data: body
|
|
90926
|
+
};
|
|
90927
|
+
}
|
|
90860
90928
|
function cmmdReauthRequiredResult() {
|
|
90861
90929
|
return {
|
|
90862
90930
|
ok: false,
|
|
@@ -298065,7 +298133,7 @@ function resolveBuildCommitFromEnv(env) {
|
|
|
298065
298133
|
* environment descriptor down instead of reporting an honest "unknown".
|
|
298066
298134
|
*/
|
|
298067
298135
|
function readBakedBuildCommit() {
|
|
298068
|
-
return "
|
|
298136
|
+
return "d2258c3e8b25a193617b5dd06deadf3d8693eeff";
|
|
298069
298137
|
}
|
|
298070
298138
|
async function resolveServerBuildCommit(input) {
|
|
298071
298139
|
if (isFullCommitSha(input.baked)) return input.baked;
|
package/dist/bin.mjs
CHANGED
|
@@ -65961,7 +65961,7 @@ function normalizeNumberish(value) {
|
|
|
65961
65961
|
}
|
|
65962
65962
|
//#endregion
|
|
65963
65963
|
//#region package.json
|
|
65964
|
-
var version$1 = "0.13.
|
|
65964
|
+
var version$1 = "0.13.51";
|
|
65965
65965
|
//#endregion
|
|
65966
65966
|
//#region src/sentry.ts
|
|
65967
65967
|
const SERVER_APP_NAME = "forge-server";
|
|
@@ -88857,6 +88857,13 @@ function errorFromBody(body, fallback) {
|
|
|
88857
88857
|
}
|
|
88858
88858
|
return fallback;
|
|
88859
88859
|
}
|
|
88860
|
+
function codeFromBody(body) {
|
|
88861
|
+
if (body && typeof body === "object") {
|
|
88862
|
+
const code = body["code"];
|
|
88863
|
+
if (typeof code === "string") return code;
|
|
88864
|
+
}
|
|
88865
|
+
return null;
|
|
88866
|
+
}
|
|
88860
88867
|
function shouldRefreshCmmdBrokerJwt(status) {
|
|
88861
88868
|
return status === 401 || status === 403;
|
|
88862
88869
|
}
|
|
@@ -88979,9 +88986,10 @@ var GitHubBroker = class {
|
|
|
88979
88986
|
} : auth);
|
|
88980
88987
|
}
|
|
88981
88988
|
async status(auth) {
|
|
88982
|
-
|
|
88983
|
-
|
|
88984
|
-
|
|
88989
|
+
return this.cmmdRequest(auth, {
|
|
88990
|
+
jwtPath: "/api/github-oauth/status",
|
|
88991
|
+
runtimeResource: "status"
|
|
88992
|
+
});
|
|
88985
88993
|
}
|
|
88986
88994
|
async workspaceStatus(input) {
|
|
88987
88995
|
const cwdValidation = validateCwd(input.cwd);
|
|
@@ -89170,12 +89178,16 @@ var GitHubBroker = class {
|
|
|
89170
89178
|
async listRepositories(auth, input = {}) {
|
|
89171
89179
|
const search = new URLSearchParams();
|
|
89172
89180
|
if (input.search?.trim()) search.set("search", input.search.trim());
|
|
89173
|
-
|
|
89174
|
-
|
|
89175
|
-
|
|
89181
|
+
return this.cmmdRequest(auth, {
|
|
89182
|
+
jwtPath: "/api/forge/github/repos",
|
|
89183
|
+
runtimeResource: "repos",
|
|
89184
|
+
search: search.size > 0 ? search : void 0
|
|
89185
|
+
});
|
|
89176
89186
|
}
|
|
89177
89187
|
async createRepository(auth, input) {
|
|
89178
|
-
return this.
|
|
89188
|
+
return this.cmmdRequest(auth, {
|
|
89189
|
+
jwtPath: "/api/forge/github/repos",
|
|
89190
|
+
runtimeResource: "repos",
|
|
89179
89191
|
method: "POST",
|
|
89180
89192
|
body: {
|
|
89181
89193
|
owner: input.owner,
|
|
@@ -89835,6 +89847,21 @@ var GitHubBroker = class {
|
|
|
89835
89847
|
}
|
|
89836
89848
|
};
|
|
89837
89849
|
}
|
|
89850
|
+
/**
|
|
89851
|
+
* The only way this broker calls CMMD as the person. Every operation names
|
|
89852
|
+
* both routes, because a managed runtime acts on its runtime grant and never
|
|
89853
|
+
* on a user JWT (CMMD ADR-015): it holds no refreshable JWT, so the JWT path
|
|
89854
|
+
* there reports a session expiry that signing in cannot fix. A cloud runtime
|
|
89855
|
+
* with no usable grant fails closed. Desktop and local keep the JWT path.
|
|
89856
|
+
*/
|
|
89857
|
+
async cmmdRequest(auth, operation) {
|
|
89858
|
+
const { jwtPath, runtimeResource, ...options } = operation;
|
|
89859
|
+
const grant = this.resolveRuntimeGrant();
|
|
89860
|
+
if (grant) return this.cmmdRuntimeJson(grant, runtimeResource, options);
|
|
89861
|
+
const missingGrantFailure = this.missingRuntimeGrantFailure();
|
|
89862
|
+
if (missingGrantFailure) return missingGrantFailure;
|
|
89863
|
+
return this.cmmdJson(auth, jwtPath, options);
|
|
89864
|
+
}
|
|
89838
89865
|
async cmmdJson(auth, path, options = {}) {
|
|
89839
89866
|
const jwt = await this.resolveJwt(auth);
|
|
89840
89867
|
if (!jwt) return {
|
|
@@ -89919,6 +89946,22 @@ var GitHubBroker = class {
|
|
|
89919
89946
|
token: token.trim()
|
|
89920
89947
|
};
|
|
89921
89948
|
}
|
|
89949
|
+
/**
|
|
89950
|
+
* A cloud runtime with no usable grant must not fall back to the person's JWT.
|
|
89951
|
+
* `githubWriteIdentity: "my-account"` is the deliberate opposite choice for git
|
|
89952
|
+
* credentials, so those paths pass `allowMyAccount`.
|
|
89953
|
+
*/
|
|
89954
|
+
missingRuntimeGrantFailure(options = {}) {
|
|
89955
|
+
if (options.allowMyAccount && this.githubWriteIdentity === "my-account") return null;
|
|
89956
|
+
const failure = classifyMissingRuntimeGrant({
|
|
89957
|
+
isCmmdCloudRuntimeMode: this.isCmmdCloudRuntimeMode,
|
|
89958
|
+
hasRuntimeGrant: false
|
|
89959
|
+
});
|
|
89960
|
+
return failure ? {
|
|
89961
|
+
ok: false,
|
|
89962
|
+
...failure
|
|
89963
|
+
} : null;
|
|
89964
|
+
}
|
|
89922
89965
|
async resolveInstallationToken(auth, repoFullName) {
|
|
89923
89966
|
const runtimeGrant = this.resolveRuntimeGrant("github");
|
|
89924
89967
|
if (runtimeGrant) {
|
|
@@ -89926,6 +89969,8 @@ var GitHubBroker = class {
|
|
|
89926
89969
|
if (!token.ok) return token;
|
|
89927
89970
|
return token.token ?? invalidInstallationTokenResult();
|
|
89928
89971
|
}
|
|
89972
|
+
const missingGrantFailure = this.missingRuntimeGrantFailure({ allowMyAccount: true });
|
|
89973
|
+
if (missingGrantFailure) return missingGrantFailure;
|
|
89929
89974
|
const jwt = await this.resolveJwt(auth);
|
|
89930
89975
|
if (!jwt) return cmmdReauthRequiredResult();
|
|
89931
89976
|
let token = await this.fetchInstallationToken(jwt, repoFullName);
|
|
@@ -90280,16 +90325,8 @@ var GitHubBroker = class {
|
|
|
90280
90325
|
repoFullName
|
|
90281
90326
|
};
|
|
90282
90327
|
}
|
|
90283
|
-
const missingGrantFailure = this.
|
|
90284
|
-
|
|
90285
|
-
hasRuntimeGrant: runtimeGrant !== null
|
|
90286
|
-
});
|
|
90287
|
-
if (missingGrantFailure) return {
|
|
90288
|
-
ok: false,
|
|
90289
|
-
code: missingGrantFailure.code,
|
|
90290
|
-
userActionRequired: missingGrantFailure.userActionRequired,
|
|
90291
|
-
error: missingGrantFailure.error
|
|
90292
|
-
};
|
|
90328
|
+
const missingGrantFailure = this.missingRuntimeGrantFailure({ allowMyAccount: true });
|
|
90329
|
+
if (missingGrantFailure) return missingGrantFailure;
|
|
90293
90330
|
const jwt = await this.resolveJwt(auth);
|
|
90294
90331
|
if (!jwt) return cmmdReauthRequiredResult();
|
|
90295
90332
|
let token = await this.fetchInstallationToken(jwt, repoFullName);
|
|
@@ -90354,7 +90391,7 @@ var GitHubBroker = class {
|
|
|
90354
90391
|
};
|
|
90355
90392
|
}
|
|
90356
90393
|
/**
|
|
90357
|
-
*
|
|
90394
|
+
* Call a grant-authenticated GitHub endpoint from inside a managed runtime. The
|
|
90358
90395
|
* runtime grant token (scope `github`) stands in for the user JWT — CMMD
|
|
90359
90396
|
* resolves identity server-side and returns the same body as the JWT routes,
|
|
90360
90397
|
* so callers get an identical `GitHubBrokerResult`. `resource` is the trailing
|
|
@@ -90363,18 +90400,21 @@ var GitHubBroker = class {
|
|
|
90363
90400
|
*/
|
|
90364
90401
|
async cmmdRuntimeJson(grant, resource, options = {}) {
|
|
90365
90402
|
const response = await this.fetchImpl(makeUrl(this.commandAppUrl, `/api/forge/runtimes/${encodeURIComponent(grant.runtimeId)}/github/${resource}`, options.search), {
|
|
90366
|
-
method: "GET",
|
|
90367
|
-
headers: {
|
|
90368
|
-
|
|
90369
|
-
|
|
90370
|
-
|
|
90403
|
+
method: options.method ?? "GET",
|
|
90404
|
+
headers: {
|
|
90405
|
+
Authorization: `Bearer ${grant.token}`,
|
|
90406
|
+
...options.body !== void 0 ? { "Content-Type": "application/json" } : {}
|
|
90407
|
+
},
|
|
90408
|
+
...options.body !== void 0 ? { body: JSON.stringify(options.body) } : {},
|
|
90409
|
+
signal: AbortSignal.timeout(GITHUB_BROKER_REQUEST_TIMEOUT_MS)
|
|
90410
|
+
}).catch(() => null);
|
|
90411
|
+
if (response === null) return {
|
|
90371
90412
|
ok: false,
|
|
90372
|
-
|
|
90373
|
-
|
|
90374
|
-
...response.status === 401 ? { userActionRequired: "connect_github" } : {},
|
|
90375
|
-
error: errorFromBody(body, `GitHub runtime request failed with status ${response.status}.`),
|
|
90376
|
-
data: body
|
|
90413
|
+
code: "GITHUB_BROKER_REQUEST_FAILED",
|
|
90414
|
+
error: "CMMD could not be reached for this GitHub request. Retry in a moment."
|
|
90377
90415
|
};
|
|
90416
|
+
const body = await parseResponseBody(response);
|
|
90417
|
+
if (!response.ok) return runtimeGrantRequestFailure(response.status, body);
|
|
90378
90418
|
return {
|
|
90379
90419
|
ok: true,
|
|
90380
90420
|
status: response.status,
|
|
@@ -90501,6 +90541,34 @@ function parseWorkspaceStatus(stdout) {
|
|
|
90501
90541
|
function isGitHubCliCredential(value) {
|
|
90502
90542
|
return "token" in value && "repoFullName" in value;
|
|
90503
90543
|
}
|
|
90544
|
+
function runtimeGrantRequestFailure(status, body) {
|
|
90545
|
+
const cmmdCode = codeFromBody(body);
|
|
90546
|
+
const grantFailure = cmmdCode?.startsWith("RUNTIME_GRANT_") ? classifyMissingRuntimeGrant({
|
|
90547
|
+
isCmmdCloudRuntimeMode: true,
|
|
90548
|
+
hasRuntimeGrant: false
|
|
90549
|
+
}) : null;
|
|
90550
|
+
if (grantFailure) return {
|
|
90551
|
+
ok: false,
|
|
90552
|
+
status,
|
|
90553
|
+
...grantFailure,
|
|
90554
|
+
data: body
|
|
90555
|
+
};
|
|
90556
|
+
if (status === 401) return {
|
|
90557
|
+
ok: false,
|
|
90558
|
+
status,
|
|
90559
|
+
code: "GITHUB_AUTH_REQUIRED",
|
|
90560
|
+
userActionRequired: "connect_github",
|
|
90561
|
+
error: errorFromBody(body, `GitHub runtime request failed with status ${status}.`),
|
|
90562
|
+
data: body
|
|
90563
|
+
};
|
|
90564
|
+
return {
|
|
90565
|
+
ok: false,
|
|
90566
|
+
status,
|
|
90567
|
+
code: cmmdCode ?? "GITHUB_BROKER_REQUEST_FAILED",
|
|
90568
|
+
error: errorFromBody(body, `GitHub runtime request failed with status ${status}.`),
|
|
90569
|
+
data: body
|
|
90570
|
+
};
|
|
90571
|
+
}
|
|
90504
90572
|
function cmmdReauthRequiredResult() {
|
|
90505
90573
|
return {
|
|
90506
90574
|
ok: false,
|
|
@@ -297510,7 +297578,7 @@ function resolveBuildCommitFromEnv(env) {
|
|
|
297510
297578
|
* environment descriptor down instead of reporting an honest "unknown".
|
|
297511
297579
|
*/
|
|
297512
297580
|
function readBakedBuildCommit() {
|
|
297513
|
-
return "
|
|
297581
|
+
return "d2258c3e8b25a193617b5dd06deadf3d8693eeff";
|
|
297514
297582
|
}
|
|
297515
297583
|
async function resolveServerBuildCommit(input) {
|
|
297516
297584
|
if (isFullCommitSha(input.baked)) return input.baked;
|
|
@@ -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{Al as a,Fn as o,Gc as s,Hr as c,Jc as l,Qr as u,Rr as d,Sr as f,Tn as p,Uc as m,Xr as h,_r as g,d as _,fn as v,fr as y,gr as b,i as x,is as S,jn as C,l as w,m as T,ms as E,n as D,qc as O,qt as k,r as A,u as j,za as M,zr as N}from"./DiffPanelShell-
|
|
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{Al as a,Fn as o,Gc as s,Hr as c,Jc as l,Qr as u,Rr as d,Sr as f,Tn as p,Uc as m,Xr as h,_r as g,d as _,fn as v,fr as y,gr as b,i as x,is as S,jn as C,l as w,m as T,ms as E,n as D,qc as O,qt as k,r as A,u as j,za as M,zr as N}from"./DiffPanelShell-rl5__4lJ.js";import{hn as P}from"./CompositeItem-BsSeqHOM.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-BWn7-Vaq.js";import{Dn as q,at as J,it as ee}from"./src-IM0FnQax.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-B8i62gxa.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)(x),m=j(),h=(0,X.useRef)(null),g=_(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&&!k(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:y}=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)(v,{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:y}),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 O({queryKey:M.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],
|
|
@@ -61,4 +61,4 @@ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ha as t,Mi as n,Ua as
|
|
|
61
61
|
text-decoration-color: currentColor;
|
|
62
62
|
}
|
|
63
63
|
`;function Oe(e){let t=(0,$.c)(44),{mode:n}=e,r=n===void 0?`inline`:n,{resolvedTheme:i}=b(),a=g(),[c,l]=(0,X.useState)(`stacked`),[u,d]=(0,X.useState)(a.diffWordWrap),h=(0,X.useRef)(null),_=(0,X.useRef)(!1),v=Te(),{activeCwd:y,activeThread:x,bodyState:S,diffOpen:C,inferredCheckpointTurnCountByTurnId:w,orderedTurnDiffSummaries:T,renderableFiles:E,renderablePatch:D,selectedFilePath:O,selectedTurn:k,selectedTurnId:j}=Le(i),M,P;t[0]!==C||t[1]!==a.diffWordWrap?(M=()=>{C&&!_.current&&d(a.diffWordWrap),_.current=C},P=[C,a.diffWordWrap],t[0]=C,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]===O?F=t[5]:(F=()=>{!O||!h.current||Array.from(h.current.querySelectorAll(`[data-diff-file-path]`)).find(e=>e.dataset.diffFilePath===O)?.scrollIntoView({block:`nearest`})},t[4]=O,t[5]=F);let I;t[6]!==E||t[7]!==O?(I=[O,E],t[6]=E,t[7]=O,t[8]=I):I=t[8],(0,X.useEffect)(F,I);let L;t[9]===y?L=t[10]:(L=e=>{let t=f();if(!t)return;let n=y?p(e,y):e;N(t,n).catch(ke)},t[9]=y,t[10]=L);let R=L,z;t[11]===x?z=t[12]:(z=e=>{x&&o.getState().openDiff(s(m(x.environmentId,x.id)),e)},t[11]=x,t[12]=z);let B=z,V;t[13]===x?V=t[14]:(V=()=>{x&&o.getState().openDiff(s(m(x.environmentId,x.id)))},t[13]=x,t[14]=V);let H=V,U;t[15]===v.remeasure?U=t[16]:(U=()=>{let e=window.requestAnimationFrame(v.remeasure);return()=>window.cancelAnimationFrame(e)},t[15]=v.remeasure,t[16]=U);let W;t[17]!==T||t[18]!==j||t[19]!==v.remeasure?(W=[T,j,v.remeasure],t[17]=T,t[18]=j,t[19]=v.remeasure,t[20]=W):W=t[20],(0,X.useEffect)(U,W),Ee(v.ref,k?.turnId??j);let G;t[21]!==c||t[22]!==u||t[23]!==w||t[24]!==T||t[25]!==B||t[26]!==H||t[27]!==k||t[28]!==j||t[29]!==a||t[30]!==v?(G=(0,Q.jsx)(Ae,{diffRenderMode:c,diffWordWrap:u,inferredCheckpointTurnCountByTurnId:w,orderedTurnDiffSummaries:T,selectTurn:B,selectWholeConversation:H,selectedTurn:k,selectedTurnId:j,setDiffRenderMode:l,setDiffWordWrap:d,settings:a,turnStrip:v}),t[21]=c,t[22]=u,t[23]=w,t[24]=T,t[25]=B,t[26]=H,t[27]=k,t[28]=j,t[29]=a,t[30]=v,t[31]=G):G=t[31];let K=G,q;t[32]!==S||t[33]!==c||t[34]!==u||t[35]!==R||t[36]!==E||t[37]!==D||t[38]!==i?(q=(0,Q.jsx)(je,{bodyState:S,diffRenderMode:c,diffWordWrap:u,openDiffFileInEditor:R,patchViewportRef:h,renderableFiles:E,renderablePatch:D,resolvedTheme:i}),t[32]=S,t[33]=c,t[34]=u,t[35]=R,t[36]=E,t[37]=D,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)(A,{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=a(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,l;e[2]===n?l=e[3]:(l=C(n),e[2]=n,e[3]=l),c=l;let u=E(c),f=He(u),p=u?.worktreePath,m=f?.cwd,h;e[4]!==p||e[5]!==m?(h=I({threadWorktreePath:p,projectCwd:m}),e[4]=p,e[5]=m,e[6]=h):h=e[6];let g=h,_=u?.environmentId??null,v=g??null,y;e[7]!==_||e[8]!==v?(y={environmentId:_,cwd:v},e[7]=_,e[8]=v,e[9]=y):y=e[9];let b=d(y),x;e[10]===b.data?x=e[11]:(x=z(b.data),e[10]=b.data,e[11]=x);let S=x,w;return e[12]!==g||e[13]!==u||e[14]!==s||e[15]!==o||e[16]!==i||e[17]!==S?(w={activeThread:u,activeThreadId:s,activeCwd:g,isGitRepo:S,diffSearch:i,diffOpen:o},e[12]=g,e[13]=u,e[14]=s,e[15]=o,e[16]=i,e[17]=S,e[18]=w):w=e[18],w}function Fe(e){return G(e)}function Ie(e){return h(e)}function Le(e){let{activeThread:t,activeThreadId:n,activeCwd:r,isGitRepo:i,diffSearch:a,diffOpen:o}=Pe(),{turnDiffSummaries:s,inferredCheckpointTurnCountByTurnId:c}=H(t),u=a.diffTurnId??null,d=u===null?null:a.diffFilePath??null,{activeCheckpointRange:f,conversationCacheScope:p,orderedTurnDiffSummaries:m,selectedTurn:h}=(0,X.useMemo)(()=>te({summaries:s,inferredCheckpointTurnCountByTurnId:c,selectedTurnId:u}),[c,u,s]),g=l(xe(we({environmentId:t?.environmentId,threadId:n,range:f,selectedTurnId:h?.turnId,conversationCacheScope:p,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(h),[h]),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:m.length,checkpointDiffError:v,hasRenderablePatch:!!S,isLoadingCheckpointDiff:_,hasNoNetChanges:b,emptyDiffMessage:x}),diffOpen:o,inferredCheckpointTurnCountByTurnId:c,orderedTurnDiffSummaries:m,renderableFiles:C,renderablePatch:S,selectedFilePath:d,selectedTurn:h,selectedTurnId:u}}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)(D,{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:u,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`,l;t[0]!==s||t[1]!==c?(l=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]=l):l=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]!==l||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==m?(h=(0,Q.jsx)(`button`,{type:`button`,className:l,onClick:d,disabled:f,"aria-label":p,children:m}),t[8]=l,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?S(e,{environmentId:n,projectId:r}):void 0,t[0]=n,t[1]=r,t[2]=i):i=t[2],E(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-
|
|
64
|
+
//# sourceMappingURL=DiffPanel-BKiUItkC.js.map
|