@p4code/cli 0.3.22 → 0.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +191 -138
- package/dist/client/assets/{DiffPanel-C8kzGnED.js → DiffPanel-DagtjUZ5.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-Y69TkmAH.js → FilePreviewPanel-Bb9aC93M.js} +4 -4
- package/dist/client/assets/PreviewPanel-DXutrGSC.js +2 -0
- package/dist/client/assets/{PullRequestCodeTab-GfSYPejl.js → PullRequestCodeTab-Ds2BAp6r.js} +2 -2
- package/dist/client/assets/{fileCommentAnnotations-6Dxr1gdD.js → fileCommentAnnotations-CHfu1OPg.js} +2 -2
- package/dist/client/assets/{index-BJLN1W_L.css → index-B4xwPQ4-.css} +1 -1
- package/dist/client/assets/{index-CDiCN7pg.js → index-fMAeFrHc.js} +191 -180
- package/dist/client/assets/previewAssetResource-DvTqD816.js +48 -0
- package/dist/client/assets/{renderFileChildren-BKb1mIpk.js → renderFileChildren-Mulim_7t.js} +2 -2
- package/dist/client/assets/{toggle-group-4rxcmFeq.js → toggle-group-BUlsuw8Z.js} +2 -2
- package/dist/client/index.html +3 -3
- package/package.json +1 -1
- package/dist/client/assets/PreviewPanel-6e4w4jhM.js +0 -2
- package/dist/client/assets/previewAssetResource-07-U9fAE.js +0 -48
package/dist/bin.mjs
CHANGED
|
@@ -239,7 +239,7 @@ const make$91 = () => {
|
|
|
239
239
|
const layer$82 = Layer.sync(NetService, make$91);
|
|
240
240
|
//#endregion
|
|
241
241
|
//#region package.json
|
|
242
|
-
var version = "0.3.
|
|
242
|
+
var version = "0.3.24";
|
|
243
243
|
//#endregion
|
|
244
244
|
//#region src/config.ts
|
|
245
245
|
/**
|
|
@@ -1619,6 +1619,10 @@ const MODEL_SLUG_ALIASES_BY_PROVIDER = {
|
|
|
1619
1619
|
"gpt-5.3-spark": "gpt-5.3-codex-spark"
|
|
1620
1620
|
},
|
|
1621
1621
|
[CLAUDE_DRIVER_KIND]: {
|
|
1622
|
+
fable: "claude-fable-5-1",
|
|
1623
|
+
"fable-5.1": "claude-fable-5-1",
|
|
1624
|
+
"fable-5-1": "claude-fable-5-1",
|
|
1625
|
+
"claude-fable-5.1": "claude-fable-5-1",
|
|
1622
1626
|
opus: "claude-opus-5",
|
|
1623
1627
|
"opus-5": "claude-opus-5",
|
|
1624
1628
|
"claude-opus-5.0": "claude-opus-5",
|
|
@@ -10569,6 +10573,8 @@ const agentAssetTotalBytes = (files) => files.reduce((total, file) => total + en
|
|
|
10569
10573
|
* has. Two definitions of the same rule is how one of them ends up laxer.
|
|
10570
10574
|
*/
|
|
10571
10575
|
const McpServerName = AgentAssetName;
|
|
10576
|
+
/** Provider-neutral session alias for a Claude user-scope server forwarded by p4code. */
|
|
10577
|
+
const mcpUserScopeSessionName = (name) => `p4-user-${name}`;
|
|
10572
10578
|
/**
|
|
10573
10579
|
* Where a secret goes when it is resolved.
|
|
10574
10580
|
*
|
|
@@ -11683,7 +11689,7 @@ const WsSkillsPublishRpc = Rpc.make(WS_METHODS.skillsPublish, {
|
|
|
11683
11689
|
error: Schema$1.Union([EnvironmentAuthorizationError])
|
|
11684
11690
|
});
|
|
11685
11691
|
const WsSkillsPublishAllRpc = Rpc.make(WS_METHODS.skillsPublishAll, {
|
|
11686
|
-
payload: Schema$1.Struct({}),
|
|
11692
|
+
payload: Schema$1.Struct({ kind: Schema$1.optional(AgentAssetKind) }),
|
|
11687
11693
|
success: Schema$1.Struct({
|
|
11688
11694
|
report: AgentSyncReport,
|
|
11689
11695
|
status: AgentSyncStatus
|
|
@@ -12922,15 +12928,21 @@ const make$87 = Effect.gen(function* () {
|
|
|
12922
12928
|
};
|
|
12923
12929
|
const create = (name, value) => {
|
|
12924
12930
|
const secretPath = resolveSecretPath(name);
|
|
12925
|
-
return
|
|
12926
|
-
|
|
12927
|
-
|
|
12928
|
-
|
|
12929
|
-
}
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12931
|
+
return crypto.randomUUIDv4.pipe(Effect.mapError((cause) => new SecretStoreTemporaryPathError({
|
|
12932
|
+
resource: `secret ${name}`,
|
|
12933
|
+
cause
|
|
12934
|
+
})), Effect.flatMap((uuid) => {
|
|
12935
|
+
const tempPath = `${secretPath}.${uuid}.tmp`;
|
|
12936
|
+
return Effect.scoped(Effect.gen(function* () {
|
|
12937
|
+
const file = yield* fileSystem.open(tempPath, {
|
|
12938
|
+
flag: "wx",
|
|
12939
|
+
mode: 384
|
|
12940
|
+
});
|
|
12941
|
+
yield* file.writeAll(value);
|
|
12942
|
+
yield* file.sync;
|
|
12943
|
+
yield* fileSystem.link(tempPath, secretPath);
|
|
12944
|
+
})).pipe(Effect.ensuring(fileSystem.remove(tempPath).pipe(Effect.ignore)));
|
|
12945
|
+
}), Effect.mapError((cause) => new SecretStorePersistError({
|
|
12934
12946
|
resource: `secret ${name}`,
|
|
12935
12947
|
cause
|
|
12936
12948
|
})));
|
|
@@ -21615,6 +21627,8 @@ const make$80 = Effect.gen(function* () {
|
|
|
21615
21627
|
const userPath = claudeUserConfigPath();
|
|
21616
21628
|
return {
|
|
21617
21629
|
readUser: readAt(userPath),
|
|
21630
|
+
readUserAt: (configDir) => readAt(Effect.succeed(path.join(path.resolve(expandHomePath$3(configDir)), ".claude.json"))),
|
|
21631
|
+
readUserFile: (filePath) => readAt(Effect.succeed(path.resolve(filePath))),
|
|
21618
21632
|
upsertUser: (registration) => upsertAt(userPath)(registration),
|
|
21619
21633
|
removeUser: (name) => removeAt(userPath)(name),
|
|
21620
21634
|
readProject: (projectDir) => readAt(Effect.succeed(projectFile(projectDir))),
|
|
@@ -21625,6 +21639,8 @@ const make$80 = Effect.gen(function* () {
|
|
|
21625
21639
|
const layer$70 = Layer.effect(ClaudeMcpFiles, make$80);
|
|
21626
21640
|
Layer.succeed(ClaudeMcpFiles, {
|
|
21627
21641
|
readUser: Effect.succeed([]),
|
|
21642
|
+
readUserAt: () => Effect.succeed([]),
|
|
21643
|
+
readUserFile: () => Effect.succeed([]),
|
|
21628
21644
|
upsertUser: () => Effect.fail(new McpRegistryError({ detail: "No Claude config in tests." })),
|
|
21629
21645
|
removeUser: () => Effect.fail(new McpRegistryError({ detail: "No Claude config in tests." })),
|
|
21630
21646
|
readProject: () => Effect.succeed([]),
|
|
@@ -22190,61 +22206,84 @@ const make$78 = Effect.gen(function* () {
|
|
|
22190
22206
|
target: slot.target,
|
|
22191
22207
|
key: slot.key
|
|
22192
22208
|
}), new TextEncoder().encode(value)).pipe(Effect.catchCause((cause) => Effect.logWarning("mcp secret write failed", { cause }).pipe(Effect.asVoid)));
|
|
22193
|
-
|
|
22194
|
-
|
|
22195
|
-
|
|
22196
|
-
|
|
22197
|
-
|
|
22198
|
-
|
|
22199
|
-
const
|
|
22200
|
-
|
|
22201
|
-
for (const
|
|
22202
|
-
|
|
22203
|
-
|
|
22204
|
-
|
|
22205
|
-
|
|
22206
|
-
for (const slot of slotsOf(registration)) {
|
|
22207
|
-
const value = yield* readSecret(registration.name, slot);
|
|
22208
|
-
if (Option.isNone(value)) {
|
|
22209
|
-
complete = false;
|
|
22210
|
-
break;
|
|
22211
|
-
}
|
|
22212
|
-
if (slot.target === "header") headers[slot.key] = value.value;
|
|
22213
|
-
else env[slot.key] = value.value;
|
|
22214
|
-
}
|
|
22215
|
-
if (!complete) continue;
|
|
22216
|
-
const hasExplicitAuthorization = Object.keys(headers).some((key) => key.toLowerCase() === "authorization");
|
|
22217
|
-
if (registration.transport !== "stdio" && !hasExplicitAuthorization) {
|
|
22218
|
-
const token = yield* oauth.accessTokenFor(registration);
|
|
22219
|
-
if (Option.isSome(token)) headers["Authorization"] = `Bearer ${token.value}`;
|
|
22209
|
+
const resolveForSessionWithUserScope = (readUserScope) => Effect.gen(function* () {
|
|
22210
|
+
const registrations = yield* readAll();
|
|
22211
|
+
const resolved = {};
|
|
22212
|
+
for (const registration of registrations) {
|
|
22213
|
+
if (!registration.enabled) continue;
|
|
22214
|
+
const headers = { ...registration.transport === "stdio" ? {} : registration.headers ?? {} };
|
|
22215
|
+
const env = { ...registration.transport === "stdio" ? registration.env ?? {} : {} };
|
|
22216
|
+
let complete = true;
|
|
22217
|
+
for (const slot of slotsOf(registration)) {
|
|
22218
|
+
const value = yield* readSecret(registration.name, slot);
|
|
22219
|
+
if (Option.isNone(value)) {
|
|
22220
|
+
complete = false;
|
|
22221
|
+
break;
|
|
22220
22222
|
}
|
|
22221
|
-
|
|
22223
|
+
if (slot.target === "header") headers[slot.key] = value.value;
|
|
22224
|
+
else env[slot.key] = value.value;
|
|
22225
|
+
}
|
|
22226
|
+
if (!complete) continue;
|
|
22227
|
+
const hasExplicitAuthorization = Object.keys(headers).some((key) => key.toLowerCase() === "authorization");
|
|
22228
|
+
if (registration.transport !== "stdio" && !hasExplicitAuthorization) {
|
|
22229
|
+
const token = yield* oauth.accessTokenFor(registration);
|
|
22230
|
+
if (Option.isSome(token)) headers["Authorization"] = `Bearer ${token.value}`;
|
|
22231
|
+
}
|
|
22232
|
+
resolved[registration.name] = registration.transport === "stdio" ? {
|
|
22233
|
+
type: "stdio",
|
|
22234
|
+
command: registration.command,
|
|
22235
|
+
args: registration.args ?? [],
|
|
22236
|
+
env
|
|
22237
|
+
} : {
|
|
22238
|
+
type: registration.transport,
|
|
22239
|
+
url: registration.url,
|
|
22240
|
+
headers
|
|
22241
|
+
};
|
|
22242
|
+
}
|
|
22243
|
+
for (const userScope of yield* readUserScope) {
|
|
22244
|
+
if (userScope.name in resolved) continue;
|
|
22245
|
+
const sessionName = mcpUserScopeSessionName(userScope.name);
|
|
22246
|
+
if (sessionName in resolved) {
|
|
22247
|
+
yield* Effect.logWarning("skipped user-scope MCP session alias collision", {
|
|
22248
|
+
server: userScope.name,
|
|
22249
|
+
sessionName
|
|
22250
|
+
});
|
|
22251
|
+
continue;
|
|
22252
|
+
}
|
|
22253
|
+
if (userScope.transport === "stdio") {
|
|
22254
|
+
resolved[sessionName] = {
|
|
22222
22255
|
type: "stdio",
|
|
22223
|
-
command:
|
|
22224
|
-
args:
|
|
22225
|
-
env
|
|
22226
|
-
} : {
|
|
22227
|
-
type: registration.transport,
|
|
22228
|
-
url: registration.url,
|
|
22229
|
-
headers
|
|
22256
|
+
command: userScope.command,
|
|
22257
|
+
args: userScope.args ?? [],
|
|
22258
|
+
env: userScope.env ?? {}
|
|
22230
22259
|
};
|
|
22260
|
+
continue;
|
|
22231
22261
|
}
|
|
22232
|
-
|
|
22233
|
-
|
|
22234
|
-
if (userScope.name in resolved) continue;
|
|
22262
|
+
const headers = { ...userScope.headers };
|
|
22263
|
+
if (!Object.keys(headers).some((key) => key.toLowerCase() === "authorization")) {
|
|
22235
22264
|
const token = yield* oauth.accessTokenFor(userScope);
|
|
22236
|
-
if (Option.
|
|
22237
|
-
|
|
22238
|
-
type: userScope.transport,
|
|
22239
|
-
url: userScope.url,
|
|
22240
|
-
headers: {
|
|
22241
|
-
...userScope.headers,
|
|
22242
|
-
Authorization: `Bearer ${token.value}`
|
|
22243
|
-
}
|
|
22244
|
-
};
|
|
22265
|
+
if (Option.isSome(token)) headers["Authorization"] = `Bearer ${token.value}`;
|
|
22266
|
+
else if (Option.isSome(yield* oauth.statusFor(userScope))) continue;
|
|
22245
22267
|
}
|
|
22246
|
-
|
|
22247
|
-
|
|
22268
|
+
resolved[sessionName] = {
|
|
22269
|
+
type: userScope.transport,
|
|
22270
|
+
url: userScope.url,
|
|
22271
|
+
headers
|
|
22272
|
+
};
|
|
22273
|
+
}
|
|
22274
|
+
return resolved;
|
|
22275
|
+
}).pipe(Effect.provide(services), Effect.catchCause((cause) => Effect.logWarning("mcp registry resolve failed", { cause }).pipe(Effect.as({}))));
|
|
22276
|
+
const resolveForSession = resolveForSessionWithUserScope(claudeFiles.readUser);
|
|
22277
|
+
const resolveForSessionAtClaudeConfigDir = (configDir) => resolveForSessionWithUserScope(claudeFiles.readUserAt(configDir));
|
|
22278
|
+
const resolveForSessionAtClaudeUserConfigPath = (filePath) => resolveForSessionWithUserScope(claudeFiles.readUserFile(filePath));
|
|
22279
|
+
return {
|
|
22280
|
+
list,
|
|
22281
|
+
save,
|
|
22282
|
+
remove,
|
|
22283
|
+
setSecret,
|
|
22284
|
+
resolveForSession,
|
|
22285
|
+
resolveForSessionAtClaudeConfigDir,
|
|
22286
|
+
resolveForSessionAtClaudeUserConfigPath
|
|
22248
22287
|
};
|
|
22249
22288
|
});
|
|
22250
22289
|
const layer$68 = Layer.effect(McpRegistry, make$78);
|
|
@@ -23893,10 +23932,10 @@ const make$75 = Effect.gen(function* () {
|
|
|
23893
23932
|
}]
|
|
23894
23933
|
};
|
|
23895
23934
|
}).pipe(Effect.provide(services), Effect.catchCause((cause) => Effect.logWarning("asset publish failed", { cause }).pipe(Effect.as(EMPTY_REPORT))));
|
|
23896
|
-
const publishAll = Effect.gen(function* () {
|
|
23935
|
+
const publishAll = (kind) => Effect.gen(function* () {
|
|
23897
23936
|
if (!(yield* isConfigured)) return EMPTY_REPORT;
|
|
23898
23937
|
const status = yield* assetStatus;
|
|
23899
|
-
const candidates = status.entries.filter((entry) => entry.state === "unmanaged");
|
|
23938
|
+
const candidates = status.entries.filter((entry) => entry.state === "unmanaged" && (kind === void 0 || entry.kind === kind));
|
|
23900
23939
|
const published = [];
|
|
23901
23940
|
const conflicts = [];
|
|
23902
23941
|
for (const candidate of candidates) {
|
|
@@ -23910,10 +23949,10 @@ const make$75 = Effect.gen(function* () {
|
|
|
23910
23949
|
return {
|
|
23911
23950
|
...EMPTY_REPORT,
|
|
23912
23951
|
ran: true,
|
|
23913
|
-
roots: status.roots,
|
|
23952
|
+
roots: status.roots.filter((root) => kind === void 0 || root.kind === kind),
|
|
23914
23953
|
published,
|
|
23915
23954
|
conflicts,
|
|
23916
|
-
refused: status.refused
|
|
23955
|
+
refused: status.refused.filter((refusal) => kind === void 0 || refusal.kind === kind)
|
|
23917
23956
|
};
|
|
23918
23957
|
}).pipe(Effect.provide(services), Effect.catchCause((cause) => Effect.logWarning("asset publish-all failed", { cause }).pipe(Effect.as(EMPTY_REPORT))));
|
|
23919
23958
|
const unpublish = ({ kind, name }) => Effect.gen(function* () {
|
|
@@ -24673,7 +24712,7 @@ const makeAssetCommands = (words) => {
|
|
|
24673
24712
|
name: nameArgument.pipe(Argument.optional),
|
|
24674
24713
|
all: Flag.boolean("all").pipe(Flag.withDescription("Share everything local this machine does not already share."))
|
|
24675
24714
|
}).pipe(Command.withDescription(`Share local ${words.plural} through the hub, so every machine gets them.`), Command.withHandler((flags) => runWithSync(flags, ({ sync }) => Effect.gen(function* () {
|
|
24676
|
-
if (flags.all) return yield* sync.publishAll.pipe(Effect.flatMap((report) => Console.log(formatReport(report))));
|
|
24715
|
+
if (flags.all) return yield* sync.publishAll().pipe(Effect.flatMap((report) => Console.log(formatReport(report))));
|
|
24677
24716
|
const name = Option.getOrUndefined(flags.name);
|
|
24678
24717
|
if (name === void 0) return yield* Console.error(`Name a ${words.singular}, or pass --all to share every unshared one.`);
|
|
24679
24718
|
return yield* sync.publish({
|
|
@@ -32446,7 +32485,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
32446
32485
|
const [thread, rows] = yield* Effect.all([getBtwThreadRow({ threadId }), listBtwContextRows({ threadId })]).pipe(Effect.mapError(toPersistenceSqlOrDecodeError$1("ProjectionSnapshotQuery.getBtwContext:query", "ProjectionSnapshotQuery.getBtwContext:decodeRows")));
|
|
32447
32486
|
if (Option.isNone(thread)) return Option.none();
|
|
32448
32487
|
let remaining = BTW_CONTEXT_CHARACTER_LIMIT;
|
|
32449
|
-
const newestFirst = [...rows].
|
|
32488
|
+
const newestFirst = [...rows].toReversed();
|
|
32450
32489
|
const retained = [];
|
|
32451
32490
|
for (const row of newestFirst) {
|
|
32452
32491
|
if (remaining <= 0) break;
|
|
@@ -32460,7 +32499,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
|
|
|
32460
32499
|
return Option.some({
|
|
32461
32500
|
projectId: thread.value.projectId,
|
|
32462
32501
|
cwd: thread.value.cwd,
|
|
32463
|
-
messages: retained.
|
|
32502
|
+
messages: retained.toReversed()
|
|
32464
32503
|
});
|
|
32465
32504
|
});
|
|
32466
32505
|
const getCommandReadModel = () => sql.withTransaction(Effect.all([
|
|
@@ -51692,8 +51731,8 @@ function filterQualifiers(filters, viewer) {
|
|
|
51692
51731
|
*/
|
|
51693
51732
|
function matchesFilters(item, filters, viewer) {
|
|
51694
51733
|
if (filters === void 0) return true;
|
|
51695
|
-
const labels = item.labels.map((label) => label.name.trim().toLowerCase());
|
|
51696
|
-
const holds = (label) => labels.
|
|
51734
|
+
const labels = new Set(item.labels.map((label) => label.name.trim().toLowerCase()));
|
|
51735
|
+
const holds = (label) => labels.has(label.trim().toLowerCase());
|
|
51697
51736
|
return (filters.draft === void 0 || item.isDraft === (filters.draft === "only")) && (filters.review === void 0 || (filters.review === "none" ? item.reviewDecision === null : item.reviewDecision === filters.review)) && (filters.checks === void 0 || item.checksState === filters.checks) && (filters.labels === void 0 || filters.labels.every((group) => group.some(holds))) && (filters.excludedLabels === void 0 || !filters.excludedLabels.some(holds)) && (filters.author === void 0 || item.author?.login.toLowerCase() === resolvePullRequestAuthorFilter(filters.author, viewer).toLowerCase());
|
|
51698
51737
|
}
|
|
51699
51738
|
function involvementArgs(input) {
|
|
@@ -54782,8 +54821,8 @@ const make$29 = Effect.gen(function* () {
|
|
|
54782
54821
|
*/
|
|
54783
54822
|
const matchesRowFilters = (item, filters, viewer) => {
|
|
54784
54823
|
if (filters === void 0) return true;
|
|
54785
|
-
const labels = item.labels.map((label) => label.name.trim().toLowerCase());
|
|
54786
|
-
const holds = (label) => labels.
|
|
54824
|
+
const labels = new Set(item.labels.map((label) => label.name.trim().toLowerCase()));
|
|
54825
|
+
const holds = (label) => labels.has(label.trim().toLowerCase());
|
|
54787
54826
|
return (filters.draft === void 0 || item.isDraft === (filters.draft === "only")) && (filters.review === void 0 || item.reviewDecision === void 0 || (filters.review === "none" ? item.reviewDecision === null : item.reviewDecision === filters.review)) && (filters.labels === void 0 || filters.labels.every((group) => group.some(holds))) && (filters.excludedLabels === void 0 || !filters.excludedLabels.some(holds)) && (filters.author === void 0 || item.author?.login.toLowerCase() === resolvePullRequestAuthorFilter(filters.author, viewer).toLowerCase());
|
|
54788
54827
|
};
|
|
54789
54828
|
const toEntry = (input) => {
|
|
@@ -64243,9 +64282,9 @@ const makeWsRpcLayer = (currentSession, previewAutomationBroker) => WsRpcGroup.t
|
|
|
64243
64282
|
status: yield* assetSync.status
|
|
64244
64283
|
};
|
|
64245
64284
|
}), { "rpc.aggregate": "skills" }),
|
|
64246
|
-
[WS_METHODS.skillsPublishAll]: (
|
|
64285
|
+
[WS_METHODS.skillsPublishAll]: (input) => observeRpcEffect$1(WS_METHODS.skillsPublishAll, Effect.gen(function* () {
|
|
64247
64286
|
return {
|
|
64248
|
-
report: yield* assetSync.publishAll,
|
|
64287
|
+
report: yield* assetSync.publishAll(input.kind),
|
|
64249
64288
|
status: yield* assetSync.status
|
|
64250
64289
|
};
|
|
64251
64290
|
}), { "rpc.aggregate": "skills" }),
|
|
@@ -67185,62 +67224,70 @@ const CLAUDE_PRESENTATION = {
|
|
|
67185
67224
|
displayName: "Claude",
|
|
67186
67225
|
showInteractionModeToggle: true
|
|
67187
67226
|
};
|
|
67227
|
+
const MINIMUM_CLAUDE_FABLE_5_1_VERSION = "2.1.257";
|
|
67188
67228
|
const MINIMUM_CLAUDE_OPUS_5_VERSION = "2.1.219";
|
|
67189
67229
|
const MINIMUM_CLAUDE_FABLE_5_VERSION = "2.1.169";
|
|
67190
67230
|
const MINIMUM_CLAUDE_OPUS_4_8_VERSION = "2.1.154";
|
|
67191
67231
|
const MINIMUM_CLAUDE_OPUS_4_7_VERSION = "2.1.111";
|
|
67232
|
+
const CLAUDE_FABLE_CAPABILITIES = createModelCapabilities({ optionDescriptors: [buildSelectOptionDescriptor({
|
|
67233
|
+
id: "effort",
|
|
67234
|
+
label: "Reasoning",
|
|
67235
|
+
options: [
|
|
67236
|
+
{
|
|
67237
|
+
value: "low",
|
|
67238
|
+
label: "Low"
|
|
67239
|
+
},
|
|
67240
|
+
{
|
|
67241
|
+
value: "medium",
|
|
67242
|
+
label: "Medium"
|
|
67243
|
+
},
|
|
67244
|
+
{
|
|
67245
|
+
value: "high",
|
|
67246
|
+
label: "High",
|
|
67247
|
+
isDefault: true
|
|
67248
|
+
},
|
|
67249
|
+
{
|
|
67250
|
+
value: "xhigh",
|
|
67251
|
+
label: "Extra High"
|
|
67252
|
+
},
|
|
67253
|
+
{
|
|
67254
|
+
value: "max",
|
|
67255
|
+
label: "Max"
|
|
67256
|
+
},
|
|
67257
|
+
{
|
|
67258
|
+
value: "ultracode",
|
|
67259
|
+
label: "Ultracode"
|
|
67260
|
+
},
|
|
67261
|
+
{
|
|
67262
|
+
value: "ultrathink",
|
|
67263
|
+
label: "Ultrathink"
|
|
67264
|
+
}
|
|
67265
|
+
],
|
|
67266
|
+
promptInjectedValues: ["ultrathink"]
|
|
67267
|
+
}), buildSelectOptionDescriptor({
|
|
67268
|
+
id: "contextWindow",
|
|
67269
|
+
label: "Context Window",
|
|
67270
|
+
options: [{
|
|
67271
|
+
value: "200k",
|
|
67272
|
+
label: "200k"
|
|
67273
|
+
}, {
|
|
67274
|
+
value: "1m",
|
|
67275
|
+
label: "1M",
|
|
67276
|
+
isDefault: true
|
|
67277
|
+
}]
|
|
67278
|
+
})] });
|
|
67192
67279
|
const BUILT_IN_MODELS = [
|
|
67280
|
+
{
|
|
67281
|
+
slug: "claude-fable-5-1",
|
|
67282
|
+
name: "Claude Fable 5.1",
|
|
67283
|
+
isCustom: false,
|
|
67284
|
+
capabilities: CLAUDE_FABLE_CAPABILITIES
|
|
67285
|
+
},
|
|
67193
67286
|
{
|
|
67194
67287
|
slug: "claude-fable-5",
|
|
67195
67288
|
name: "Claude Fable 5",
|
|
67196
67289
|
isCustom: false,
|
|
67197
|
-
capabilities:
|
|
67198
|
-
id: "effort",
|
|
67199
|
-
label: "Reasoning",
|
|
67200
|
-
options: [
|
|
67201
|
-
{
|
|
67202
|
-
value: "low",
|
|
67203
|
-
label: "Low"
|
|
67204
|
-
},
|
|
67205
|
-
{
|
|
67206
|
-
value: "medium",
|
|
67207
|
-
label: "Medium"
|
|
67208
|
-
},
|
|
67209
|
-
{
|
|
67210
|
-
value: "high",
|
|
67211
|
-
label: "High",
|
|
67212
|
-
isDefault: true
|
|
67213
|
-
},
|
|
67214
|
-
{
|
|
67215
|
-
value: "xhigh",
|
|
67216
|
-
label: "Extra High"
|
|
67217
|
-
},
|
|
67218
|
-
{
|
|
67219
|
-
value: "max",
|
|
67220
|
-
label: "Max"
|
|
67221
|
-
},
|
|
67222
|
-
{
|
|
67223
|
-
value: "ultracode",
|
|
67224
|
-
label: "Ultracode"
|
|
67225
|
-
},
|
|
67226
|
-
{
|
|
67227
|
-
value: "ultrathink",
|
|
67228
|
-
label: "Ultrathink"
|
|
67229
|
-
}
|
|
67230
|
-
],
|
|
67231
|
-
promptInjectedValues: ["ultrathink"]
|
|
67232
|
-
}), buildSelectOptionDescriptor({
|
|
67233
|
-
id: "contextWindow",
|
|
67234
|
-
label: "Context Window",
|
|
67235
|
-
options: [{
|
|
67236
|
-
value: "200k",
|
|
67237
|
-
label: "200k"
|
|
67238
|
-
}, {
|
|
67239
|
-
value: "1m",
|
|
67240
|
-
label: "1M",
|
|
67241
|
-
isDefault: true
|
|
67242
|
-
}]
|
|
67243
|
-
})] })
|
|
67290
|
+
capabilities: CLAUDE_FABLE_CAPABILITIES
|
|
67244
67291
|
},
|
|
67245
67292
|
{
|
|
67246
67293
|
slug: "claude-opus-5",
|
|
@@ -67572,6 +67619,9 @@ const BUILT_IN_MODELS = [
|
|
|
67572
67619
|
function supportsClaudeOpus5(version) {
|
|
67573
67620
|
return version ? compareSemverVersions(version, MINIMUM_CLAUDE_OPUS_5_VERSION) >= 0 : false;
|
|
67574
67621
|
}
|
|
67622
|
+
function supportsClaudeFable51(version) {
|
|
67623
|
+
return version ? compareSemverVersions(version, MINIMUM_CLAUDE_FABLE_5_1_VERSION) >= 0 : false;
|
|
67624
|
+
}
|
|
67575
67625
|
function supportsClaudeFable5(version) {
|
|
67576
67626
|
return version ? compareSemverVersions(version, MINIMUM_CLAUDE_FABLE_5_VERSION) >= 0 : false;
|
|
67577
67627
|
}
|
|
@@ -67583,6 +67633,7 @@ function supportsClaudeOpus47(version) {
|
|
|
67583
67633
|
}
|
|
67584
67634
|
function getBuiltInClaudeModelsForVersion(version) {
|
|
67585
67635
|
return BUILT_IN_MODELS.filter((model) => {
|
|
67636
|
+
if (model.slug === "claude-fable-5-1") return supportsClaudeFable51(version);
|
|
67586
67637
|
if (model.slug === "claude-opus-5") return supportsClaudeOpus5(version);
|
|
67587
67638
|
if (model.slug === "claude-fable-5") return supportsClaudeFable5(version);
|
|
67588
67639
|
if (model.slug === "claude-opus-4-8") return supportsClaudeOpus48(version);
|
|
@@ -67590,6 +67641,9 @@ function getBuiltInClaudeModelsForVersion(version) {
|
|
|
67590
67641
|
return true;
|
|
67591
67642
|
});
|
|
67592
67643
|
}
|
|
67644
|
+
function formatClaudeFable51UpgradeMessage(version) {
|
|
67645
|
+
return `Claude Code ${version ? `v${version}` : "the installed version"} is too old for Claude Fable 5.1. Upgrade to v${MINIMUM_CLAUDE_FABLE_5_1_VERSION} or newer to access it.`;
|
|
67646
|
+
}
|
|
67593
67647
|
function formatClaudeOpus5UpgradeMessage(version) {
|
|
67594
67648
|
return `Claude Code ${version ? `v${version}` : "the installed version"} is too old for Claude Opus 5. Upgrade to v${MINIMUM_CLAUDE_OPUS_5_VERSION} or newer to access it.`;
|
|
67595
67649
|
}
|
|
@@ -67629,7 +67683,7 @@ function resolveClaudeEffort(caps, raw) {
|
|
|
67629
67683
|
function normalizeClaudeCliEffort(effort, model) {
|
|
67630
67684
|
if (!effort || effort === "ultrathink") return;
|
|
67631
67685
|
if (effort === "ultracode") return "xhigh";
|
|
67632
|
-
if (effort === "xhigh" && model !== "claude-fable-5" && model !== "claude-opus-5" && model !== "claude-opus-4-8" && model !== "claude-sonnet-5") return "max";
|
|
67686
|
+
if (effort === "xhigh" && model !== "claude-fable-5-1" && model !== "claude-fable-5" && model !== "claude-opus-5" && model !== "claude-opus-4-8" && model !== "claude-sonnet-5") return "max";
|
|
67633
67687
|
if (effort === "max" && model === "claude-sonnet-4-6") return "high";
|
|
67634
67688
|
return effort;
|
|
67635
67689
|
}
|
|
@@ -67910,7 +67964,7 @@ const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(functio
|
|
|
67910
67964
|
});
|
|
67911
67965
|
}
|
|
67912
67966
|
const models = providerModelsFromSettings(getBuiltInClaudeModelsForVersion(parsedVersion), claudeSettings.customModels, DEFAULT_CLAUDE_MODEL_CAPABILITIES);
|
|
67913
|
-
const versionUpgradeMessage =
|
|
67967
|
+
const versionUpgradeMessage = supportsClaudeFable51(parsedVersion) ? void 0 : supportsClaudeOpus5(parsedVersion) ? formatClaudeFable51UpgradeMessage(parsedVersion) : supportsClaudeFable5(parsedVersion) ? formatClaudeOpus5UpgradeMessage(parsedVersion) : supportsClaudeOpus48(parsedVersion) ? formatClaudeFable5UpgradeMessage(parsedVersion) : supportsClaudeOpus47(parsedVersion) ? formatClaudeOpus48UpgradeMessage(parsedVersion) : formatClaudeOpus47UpgradeMessage(parsedVersion);
|
|
67914
67968
|
const capabilities = resolveCapabilities ? yield* resolveCapabilities(claudeSettings).pipe(Effect.orElseSucceed(() => void 0)) : void 0;
|
|
67915
67969
|
const skills = yield* discoverClaudeSkills(claudeSettings, cwd, resolvedEnvironment, disabledSkills);
|
|
67916
67970
|
const dedupedSlashCommands = dedupeSlashCommands(capabilities?.slashCommands ?? []);
|
|
@@ -71026,7 +71080,7 @@ const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* (claudeSettin
|
|
|
71026
71080
|
...skillOverrides ? { skillOverrides } : {}
|
|
71027
71081
|
};
|
|
71028
71082
|
const mcpSession = readMcpProviderSession(input.threadId);
|
|
71029
|
-
const externalMcpServers = options?.resolveMcpServers === void 0 ? {} : yield* options.resolveMcpServers;
|
|
71083
|
+
const externalMcpServers = options?.resolveMcpServers === void 0 ? {} : yield* options.resolveMcpServers(input.cwd);
|
|
71030
71084
|
const narrateBeforeTools = options?.resolveToolCallNarration === void 0 ? DEFAULT_SERVER_SETTINGS.enableToolCallNarration : yield* options.resolveToolCallNarration;
|
|
71031
71085
|
const guardrailSettings = options?.resolveGuardrailPrompts === void 0 ? {
|
|
71032
71086
|
enableVerificationBeforeCompletion: DEFAULT_SERVER_SETTINGS.enableVerificationBeforeCompletion,
|
|
@@ -71519,24 +71573,23 @@ const ClaudeDriver = {
|
|
|
71519
71573
|
continuationGroupKey
|
|
71520
71574
|
});
|
|
71521
71575
|
const mcpRegistry = yield* McpRegistry;
|
|
71576
|
+
const hasExplicitClaudeConfigDir = effectiveConfig.homePath.trim().length > 0 || (processEnv.CLAUDE_CONFIG_DIR?.trim().length ?? 0) > 0;
|
|
71577
|
+
const resolveMcpServers = (workspace) => (hasExplicitClaudeConfigDir ? resolveClaudeConfigDirPath(effectiveConfig, processEnv, workspace).pipe(Effect.map((configDir) => path.join(configDir, ".claude.json")), Effect.provideService(Path.Path, path)) : Effect.succeed(path.join(NodeOS.homedir(), ".claude.json"))).pipe(Effect.flatMap(mcpRegistry.resolveForSessionAtClaudeUserConfigPath));
|
|
71522
71578
|
const resolveDisabledSkills = serverSettings.getSettings.pipe(Effect.map((settings) => settings.disabledSkills), Effect.orElseSucceed(() => []));
|
|
71523
|
-
const resolveToolCallNarration = serverSettings.getSettings.pipe(Effect.map((settings) => settings.enableToolCallNarration), Effect.orElseSucceed(() => DEFAULT_SERVER_SETTINGS.enableToolCallNarration));
|
|
71524
|
-
const resolveGuardrailPrompts = serverSettings.getSettings.pipe(Effect.map((settings) => ({
|
|
71525
|
-
enableVerificationBeforeCompletion: settings.enableVerificationBeforeCompletion,
|
|
71526
|
-
enableRootCauseBeforeFix: settings.enableRootCauseBeforeFix
|
|
71527
|
-
})), Effect.orElseSucceed(() => ({
|
|
71528
|
-
enableVerificationBeforeCompletion: DEFAULT_SERVER_SETTINGS.enableVerificationBeforeCompletion,
|
|
71529
|
-
enableRootCauseBeforeFix: DEFAULT_SERVER_SETTINGS.enableRootCauseBeforeFix
|
|
71530
|
-
})));
|
|
71531
|
-
const resolveUnpromptedSubagents = serverSettings.getSettings.pipe(Effect.map((settings) => settings.enableUnpromptedSubagents), Effect.orElseSucceed(() => DEFAULT_SERVER_SETTINGS.enableUnpromptedSubagents));
|
|
71532
71579
|
const adapter = yield* makeClaudeAdapter(effectiveConfig, {
|
|
71533
71580
|
instanceId,
|
|
71534
71581
|
environment: processEnv,
|
|
71535
|
-
resolveMcpServers
|
|
71582
|
+
resolveMcpServers,
|
|
71536
71583
|
resolveDisabledSkills,
|
|
71537
|
-
resolveToolCallNarration,
|
|
71538
|
-
resolveGuardrailPrompts
|
|
71539
|
-
|
|
71584
|
+
resolveToolCallNarration: serverSettings.getSettings.pipe(Effect.map((settings) => settings.enableToolCallNarration), Effect.orElseSucceed(() => DEFAULT_SERVER_SETTINGS.enableToolCallNarration)),
|
|
71585
|
+
resolveGuardrailPrompts: serverSettings.getSettings.pipe(Effect.map((settings) => ({
|
|
71586
|
+
enableVerificationBeforeCompletion: settings.enableVerificationBeforeCompletion,
|
|
71587
|
+
enableRootCauseBeforeFix: settings.enableRootCauseBeforeFix
|
|
71588
|
+
})), Effect.orElseSucceed(() => ({
|
|
71589
|
+
enableVerificationBeforeCompletion: DEFAULT_SERVER_SETTINGS.enableVerificationBeforeCompletion,
|
|
71590
|
+
enableRootCauseBeforeFix: DEFAULT_SERVER_SETTINGS.enableRootCauseBeforeFix
|
|
71591
|
+
}))),
|
|
71592
|
+
resolveUnpromptedSubagents: serverSettings.getSettings.pipe(Effect.map((settings) => settings.enableUnpromptedSubagents), Effect.orElseSucceed(() => DEFAULT_SERVER_SETTINGS.enableUnpromptedSubagents)),
|
|
71540
71593
|
...eventLoggers.native ? { nativeEventLogger: eventLoggers.native } : {}
|
|
71541
71594
|
});
|
|
71542
71595
|
const textGeneration = yield* makeClaudeTextGeneration(effectiveConfig, processEnv);
|
|
@@ -90707,8 +90760,8 @@ const ANSI_ESCAPE_REGEX = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g
|
|
|
90707
90760
|
const CODEX_STDERR_LOG_REGEX = /^\d{4}-\d{2}-\d{2}T\S+\s+(TRACE|DEBUG|INFO|WARN|ERROR)\s+\S+:\s+(.*)$/;
|
|
90708
90761
|
const BENIGN_ERROR_LOG_SNIPPETS = ["state db missing rollout path for thread", "state db record_discrepancy: find_thread_path_by_id_str_in_subdir, falling_back"];
|
|
90709
90762
|
const CODEX_APP_SERVER_FORCE_KILL_AFTER = "2 seconds";
|
|
90710
|
-
const PATH_DELIMITER =
|
|
90711
|
-
const PATH_SEPARATOR =
|
|
90763
|
+
const PATH_DELIMITER = NodePath.delimiter;
|
|
90764
|
+
const PATH_SEPARATOR = NodePath.sep;
|
|
90712
90765
|
const RECOVERABLE_THREAD_RESUME_ERROR_SNIPPETS = [
|
|
90713
90766
|
"not found",
|
|
90714
90767
|
"missing thread",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$c as i,Ca as a,Cl as o,Da as s,Et as c,Fa as ee,Fr as te,Ia as l,La as u,Na as d,Oa as f,Pa as ne,Pl as re,Qc as p,_n as ie,ba as m,cu as h,el as g,gt as _,h as v,ht as y,kl as b,kr as ae,ot as x,tl as S,vl as oe,vt as C,wr as w,x as T,xn as E,zl as se}from"./previewAssetResource-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$c as i,Ca as a,Cl as o,Da as s,Et as c,Fa as ee,Fr as te,Ia as l,La as u,Na as d,Oa as f,Pa as ne,Pl as re,Qc as p,_n as ie,ba as m,cu as h,el as g,gt as _,h as v,ht as y,kl as b,kr as ae,ot as x,tl as S,vl as oe,vt as C,wr as w,x as T,xn as E,zl as se}from"./previewAssetResource-DvTqD816.js";import{a as D,i as ce,n as O,o as k,r as A,s as j,t as M}from"./toggle-group-BUlsuw8Z.js";import{F as le,Fr as ue,I as de,J as fe,L as pe,Lr as me,Mr as he,Nr as ge,R as N,Sr as _e,Y as ve,_ as ye,at as be,ci as xe,cr as Se,ct as Ce,dr as we,fr as Te,gr as Ee,h as De,it as Oe,jr as ke,lr as Ae,lt as P,mr as je,oi as Me,or as Ne,ot as Pe,pr as Fe,rt as Ie,si as Le,sr as Re,st as ze,ur as Be,zr as Ve}from"./index-fMAeFrHc.js";import{a as He,n as Ue}from"./fileCommentAnnotations-CHfu1OPg.js";var We=S(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),F=e(n(),1);function Ge({threadRef:e,filePath:t,activeCwd:n,openInEditor:r,openFileSurface:i}){if(e){if(i){i(t);return}x.getState().openFile(e,t);return}r(n?v(t,n):t)}var I=r();function Ke(e,t){let n=(0,I.c)(4),r=Ee(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}var L=t(),qe=[];function Je(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function R(e,t,n){let r=Je(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function Ye(e){let t=(0,I.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:s,className:c,renderHeaderPrefix:ee}=e,l=w(Qe),u=w(B),d;t[0]===a?d=t[1]:(d=e=>e.getComposerDraft(a)?.reviewComments??qe,t[0]=a,t[1]=d);let f=w(d),[ne,re]=(0,F.useState)(null),[p,ie]=(0,F.useState)(null),m;t[2]===n?m=t[3]:(m=new Map(n.map(Ze)),t[2]=n,t[3]=m);let h=m,g;if(t[4]!==p||t[5]!==n||t[6]!==f||t[7]!==r){let e;t[9]!==p||t[10]!==f||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:a}=e,o=f.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=te(t,n);return r?R(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=p?.fileKey===i?[...o,p.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:Oe(`${a?`1`:`0`}:${s.flatMap(z).join(`:`)}`)}},t[9]=p,t[10]=f,t[11]=r,t[12]=e):e=t[12],g=n.map(e),t[4]=p,t[5]=n,t[6]=f,t[7]=r,t[8]=g}else g=t[8];let _=g,v;t[13]!==a||t[14]!==p?.annotation||t[15]!==u?(v=e=>{re(null),p?.annotation.metadata.entries.some(t=>t.id===e)?ie(null):u(a,e)},t[13]=a,t[14]=p?.annotation,t[15]=u,t[16]=v):v=t[16];let y=v,b;t[17]!==l||t[18]!==a||t[19]!==p||t[20]!==h||t[21]!==r||t[22]!==i?(b=(e,t)=>{let n=p?.annotation.metadata.entries.find(t=>t.id===e),o=p?h.get(p.fileKey):void 0;if(!n||!o)return;let s=ae({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});s&&l(a,s),re(null),ie(null)},t[17]=l,t[18]=a,t[19]=p,t[20]=h,t[21]=r,t[22]=i,t[23]=b):b=t[23];let x=b,S;t[24]!==h||t[25]!==r||t[26]!==i?(S=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=h.get(n.id);if(!a)return;let o=Ue(),s=ae({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});s&&ie({fileKey:n.id,annotation:{side:Je(e),lineNumber:e.end,metadata:{entries:[{id:o,kind:`draft`,range:e,rangeLabel:s.rangeLabel,text:``}]}}})},t[24]=h,t[25]=r,t[26]=i,t[27]=S):S=t[27];let oe=S,C=p!==null,T;t[28]===s?T=t[29]:(T=s?{ref:s}:{},t[28]=s,t[29]=T);let E;t[30]===c?E=t[31]:(E=c?{className:c}:{},t[30]=c,t[31]=E);let se=!C,ce=!C,O;t[32]!==oe||t[33]!==o||t[34]!==ce||t[35]!==se?(O={...o,enableGutterUtility:se,enableLineSelection:ce,onLineSelectionEnd:oe},t[32]=oe,t[33]=o,t[34]=ce,t[35]=se,t[36]=O):O=t[36];let k;t[37]===ee?k=t[38]:(k=e=>e.type===`diff`?ee(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=ee,t[38]=k);let A;t[39]!==y||t[40]!==x?(A=e=>(0,L.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,L.jsx)(He,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>y(e.id),onComment:t=>x(e.id,t),onDelete:()=>y(e.id)},e.id))}),t[39]=y,t[40]=x,t[41]=A):A=t[41];let j;return t[42]!==_||t[43]!==ne||t[44]!==O||t[45]!==k||t[46]!==A||t[47]!==T||t[48]!==E?(j=(0,L.jsx)(D,{...T,...E,items:_,selectedLines:ne,onSelectedLinesChange:re,options:O,renderHeaderPrefix:k,renderAnnotation:A}),t[42]=_,t[43]=ne,t[44]=O,t[45]=k,t[46]=A,t[47]=T,t[48]=E,t[49]=j):j=t[49],j}function z(e){return e.metadata.entries.map(Xe)}function Xe(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Ze(e){return[e.fileKey,e]}function B(e){return e.removeReviewComment}function Qe(e){return e.addReviewComment}function $e(e){return{diffPreview:o(e,{label:`environment-data:review:diff-preview`,tag:h.reviewGetDiffPreview,staleTimeMs:5e3})}}var et=$e(E);function V(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function tt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&V(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function nt(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var H=`__automatic_base_ref__`,rt=new Set,it=`
|
|
2
2
|
[data-diffs-header],
|
|
3
3
|
[data-diff],
|
|
4
4
|
[data-file],
|
|
@@ -95,4 +95,4 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
|
|
|
95
95
|
text-decoration-color: currentColor;
|
|
96
96
|
}
|
|
97
97
|
`;function U({mode:e=`inline`,composerDraftTarget:t,initialGitScope:n,threadRef:r}){let{resolvedTheme:o}=T(),te=ue(),[h]=(0,F.useState)(n),[v,ae]=(0,F.useState)(`stacked`),[x,S]=(0,F.useState)(te.wordWrap),[w,E]=(0,F.useState)(te.diffIgnoreWhitespace),[D,ye]=(0,F.useState)(``),[Ee,Oe]=(0,F.useState)(()=>({scopeKey:null,fileKeys:rt})),He=(0,F.useRef)(null),Ue=r.threadId,I=ge(r),qe=I?.projectId??null,Je=he(I&&qe?{environmentId:I.environmentId,projectId:qe}:null),R=I?.worktreePath??Je?.workspaceRoot,z=oe(ie.configValueAtom(I?.environmentId??null)),Xe=je(I?.environmentId??null,z?.availableEditors??[]),Ze=c(I!=null&&R!=null?ke.status({environmentId:I.environmentId,input:{cwd:R}}):null),B=N(e=>pe(e.byThreadKey,r,h===`unstaged`)),Qe=Ze.data?.isRepo??!0,{turnDiffSummaries:$e,inferredCheckpointTurnCountByTurnId:V}=de(I),U=(0,F.useMemo)(()=>[...$e].toSorted((e,t)=>{let n=e.checkpointTurnCount??V[e.turnId]??0,r=t.checkpointTurnCount??V[t.turnId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[V,$e]);(0,F.useEffect)(()=>{B.kind===`turn`&&N.getState().reconcileTurnSelection(r,U.map(e=>e.turnId))},[B,U,r]);let W=B.kind===`turn`?B.turnId:null,G=B.kind===`unstaged`?`unstaged`:`branch`,K=B.kind===`branch`?B.baseRef:null,at=B.kind===`turn`?B.filePath:null,ot=B.kind===`turn`?B.revealRequestId:0,q=W===null?void 0:U.find(e=>e.turnId===W)??U[0],J=q&&(q.checkpointTurnCount??V[q.turnId]),st=U[0],ct=W===null?G===`unstaged`?`Working tree`:`Branch changes`:q?.turnId===st?.turnId?`Latest turn`:`Turn ${J??`?`}`,lt=q?`turn:${q.turnId}`:G,Y=`${r.environmentId}:${r.threadId}:${lt}`,ut=Ee.scopeKey===Y?Ee.fileKeys:rt,dt=q?`Turn ${J??`?`}`:G===`unstaged`?`Working tree`:`Branch changes`,ft=(0,F.useMemo)(()=>typeof J==`number`?{fromTurnCount:Math.max(0,J-1),toTurnCount:J}:null,[J]),pt=Ke({environmentId:I?.environmentId??null,threadId:Ue,fromTurnCount:ft?.fromTurnCount??null,toTurnCount:ft?.toTurnCount??null,ignoreWhitespace:w,cacheScope:q?`turn:${q.turnId}`:null},{enabled:Qe&&q!==void 0}),mt=c(W===null&&I&&R?et.diffPreview({environmentId:I.environmentId,input:{cwd:R,...K?{baseRef:K}:{},ignoreWhitespace:w}}):null),ht=W===null&&mt.error?.includes(`configured workspace root`)===!0&&z?.cwd!==void 0&&z.cwd!==R,gt=c(ht&&I&&z?et.diffPreview({environmentId:I.environmentId,input:{cwd:z.cwd,...K?{baseRef:K}:{},ignoreWhitespace:w}}):null),X=ht?gt:mt,Z=X.data?.sources.find(e=>e.kind===(G===`unstaged`?`working-tree`:`branch-range`)),_t=c(W===null&&G===`branch`&&I&&X.data?.cwd?ke.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...D.trim().length>0?{query:D.trim()}:{},limit:100}}):null),vt=c(W===null&&G===`branch`&&I&&X.data?.cwd?ke.listRefs({environmentId:I.environmentId,input:{cwd:X.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...D.trim().length>0?{query:D.trim()}:{},limit:100}}):null),yt=tt(_t.data?.refs.filter(e=>e.name!==Z?.headRef)??[],vt.data?.refs??[]),bt=nt(yt,D),xt=e=>K&&K===e.remote?.name?K:e.local?.name??e.remote?.name??e.id,St=[H,...yt.map(xt)],Ct=[...D.trim().length===0?[H]:[],...bt.map(xt)],wt=Z?.diff,Tt=q?pt.data?.diff:wt,Et=!q&&Z?.truncated===!0,Dt=q?pt.isPending:X.isPending,Ot=q?pt.error:X.error,kt=typeof Tt==`string`&&Tt.trim().length===0,Q=(0,F.useMemo)(()=>ze(Tt,`diff-panel:${o}`,{compactPartialHunkOffsets:W===null}),[o,Tt,W]),At=(0,F.useMemo)(()=>!Q||Q.kind!==`files`?[]:Q.files.toSorted((e,t)=>P(e).localeCompare(P(t),void 0,{numeric:!0,sensitivity:`base`})),[Q]),$=(0,F.useMemo)(()=>At.map(e=>{let t=Ie(e);return{fileDiff:e,filePath:P(e),fileKey:t,collapsed:ut.has(t)}}),[ut,At]),jt=(0,F.useMemo)(()=>$.map(e=>e.fileKey),[$]),Mt=A(jt,ut),Nt=(0,F.useMemo)(()=>Pe(At),[At]);(0,F.useEffect)(()=>{if(!at)return;let e=$.find(e=>e.filePath===at);e&&He.current?.scrollTo({type:`item`,id:e.fileKey,align:`start`})},[$,at,ot]);let Pt=le({threadRef:r,workspaceRoot:R??null}),Ft=(0,F.useCallback)(e=>{Ge({threadRef:r,filePath:e,activeCwd:R,openFileSurface:Pt,openInEditor:e=>{(async()=>{let t=await Xe(e);t._tag===`Failure`&&!b(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,environmentId:r.environmentId,threadId:r.threadId,...se(re(t))})})()}})},[R,Pt,Xe,r]),It=(0,F.useCallback)(e=>{Oe(t=>{let n=new Set(t.scopeKey===Y?t.fileKeys:[]);return n.has(e)?n.delete(e):n.add(e),{scopeKey:Y,fileKeys:n}})},[Y]),Lt=(0,F.useCallback)(()=>{Oe(e=>{let t=e.scopeKey===Y?e.fileKeys:rt;return{scopeKey:Y,fileKeys:ce(jt,t)}})},[Y,jt]),Rt=e=>{N.getState().selectTurn(r,e)},zt=e=>{N.getState().selectGitScope(r,e)},Bt=e=>{N.getState().selectBranchBaseRef(r,e)};return(0,L.jsx)(ve,{mode:e,header:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]`,children:[(0,L.jsxs)(a,{children:[(0,L.jsxs)(l,{className:`inline-flex h-6 max-w-full items-center gap-1 rounded-md bg-muted/70 px-2 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Diff scope: ${ct}`,children:[(0,L.jsx)(`span`,{className:`truncate`,children:ct}),(0,L.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,L.jsxs)(f,{align:`start`,className:`w-60`,children:[(0,L.jsx)(s,{className:W===null&&G===`unstaged`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`unstaged`),children:(0,L.jsx)(`span`,{children:`Working tree`})}),(0,L.jsx)(s,{className:W===null&&G===`branch`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`branch`),children:(0,L.jsx)(`span`,{children:`Branch changes`})}),(0,L.jsx)(s,{className:W!==null&&q?.turnId===st?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>{st&&Rt(st.turnId)},children:(0,L.jsx)(`span`,{children:`Latest turn`})}),(0,L.jsxs)(d,{children:[(0,L.jsx)(ee,{children:`Turn`}),(0,L.jsx)(ne,{className:`w-64`,children:U.map(e=>{let t=e.checkpointTurnCount??V[e.turnId]??`?`;return(0,L.jsxs)(s,{className:e.turnId===q?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>Rt(e.turnId),children:[(0,L.jsxs)(`span`,{children:[`Turn `,t]}),(0,L.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-muted-foreground`,children:_e(e.completedAt,te.timestampFormat)})]},e.turnId)})})]})]})]}),W===null&&G===`branch`&&Z?.baseRef&&(0,L.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground`,title:`${Z.headRef??`HEAD`} → ${Z.baseRef}`,"aria-label":`Comparing ${Z.headRef??`HEAD`} against ${Z.baseRef}`,children:[(0,L.jsx)(`span`,{className:`min-w-0 max-w-48 truncate`,children:Z.headRef??`HEAD`}),(0,L.jsx)(xe,{className:`size-3.5 shrink-0 opacity-70`}),(0,L.jsxs)(Re,{items:St,filteredItems:Ct,value:K??H,onOpenChange:e=>{e||ye(``)},onValueChange:e=>{e&&Bt(e===H?null:e)},children:[(0,L.jsxs)(Fe,{className:`inline-flex min-w-0 max-w-48 items-center gap-1 overflow-hidden rounded-md px-1.5 py-1 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Change comparison target. Currently ${Z.baseRef}`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:Z.baseRef}),(0,L.jsx)(i,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,L.jsxs)(Te,{align:`start`,className:`w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden [&>[data-slot=combobox-popup]]:min-w-0 [&>[data-slot=combobox-popup]]:overflow-hidden`,children:[(0,L.jsx)(`div`,{className:`min-w-0 shrink-0 px-3 pt-2.5`,children:(0,L.jsxs)(`div`,{className:`relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring`,children:[(0,L.jsx)(Ve,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55`}),(0,L.jsx)(Ae,{className:`[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5`,inputClassName:`rounded-none bg-transparent text-sm`,placeholder:`Search refs...`,showTrigger:!1,size:`sm`,unstyled:!0,value:D,onChange:e=>ye(e.target.value)})]})}),(0,L.jsxs)(`div`,{className:`grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-[10px] text-muted-foreground uppercase tracking-wide`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`}),(0,L.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center`,children:[(0,L.jsx)(`span`,{children:`Branch`}),(0,L.jsx)(`span`,{className:`text-right`,children:`Remote`})]})]}),(0,L.jsx)(Se,{children:`No matching refs.`}),(0,L.jsxs)(we,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,L.jsx)(Be,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:H,children:(0,L.jsx)(`span`,{className:`block min-w-0 truncate`,children:`Automatic`})}),yt.map(e=>{let t=xt(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,L.jsx)(Be,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:t,children:(0,L.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden`,children:[(0,L.jsx)(`span`,{className:`block min-w-0 truncate pe-2`,children:e.label}),n?(0,L.jsx)(`div`,{className:`flex justify-end`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,L.jsx)(Ne,{"aria-label":`Use remote version of ${e.label}`,checked:r,className:`[--thumb-size:--spacing(3)]`,onCheckedChange:t=>{let n=t?e.remote?.name:e.local?.name;n&&Bt(n)}})}):e.remote?(0,L.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,title:`Remote only`,children:(0,L.jsx)(g,{"aria-hidden":`true`,className:`size-3`})}):null]})},e.id)})]})]})]})]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[$.length>0&&(0,L.jsx)(De,{additions:Nt.additions,deletions:Nt.deletions,className:`mr-1 text-[11px]`,layout:`inline`}),$.length>0&&(0,L.jsxs)(y,{children:[(0,L.jsx)(C,{render:(0,L.jsx)(m,{type:`button`,size:`icon-xs`,variant:`outline`,"aria-label":Mt?`Expand all files`:`Collapse all files`,onClick:Lt}),children:Mt?(0,L.jsx)(Me,{className:`size-3`}):(0,L.jsx)(Le,{className:`size-3`})}),(0,L.jsx)(_,{side:`top`,children:Mt?`Expand all files`:`Collapse all files`})]}),(0,L.jsxs)(O,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[v],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&ae(t)},children:[(0,L.jsx)(M,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,L.jsx)(k,{className:`size-3`})}),(0,L.jsx)(M,{"aria-label":`Split diff view`,value:`split`,children:(0,L.jsx)(j,{className:`size-3`})})]}),(0,L.jsxs)(y,{children:[(0,L.jsx)(C,{render:(0,L.jsx)(M,{"aria-label":x?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`outline`,size:`xs`,pressed:x,onPressedChange:e=>{S(!!e)}}),children:(0,L.jsx)(me,{className:`size-3`})}),(0,L.jsx)(_,{side:`top`,children:x?`Disable line wrapping`:`Enable line wrapping`})]}),(0,L.jsxs)(y,{children:[(0,L.jsx)(C,{render:(0,L.jsx)(M,{"aria-label":w?`Show whitespace changes`:`Hide whitespace changes`,variant:`outline`,size:`xs`,pressed:w,onPressedChange:e=>{E(!!e)}}),children:(0,L.jsx)(We,{className:`size-3`})}),(0,L.jsx)(_,{side:`top`,children:w?`Show whitespace changes`:`Hide whitespace changes`})]})]})]}),children:I?Qe?W!==null&&U.length===0?(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{className:`diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[Et&&(0,L.jsx)(`p`,{className:`shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-[11px] text-muted-foreground`,children:`This diff was truncated because it exceeded the preview limit. The changes shown are incomplete.`}),Ot&&!Q&&(0,L.jsx)(`div`,{className:`px-3`,children:(0,L.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:Ot})}),Q?Q.kind===`files`?(0,L.jsx)(`div`,{className:`min-h-0 flex-1`,onClickCapture:e=>{let t=(e.nativeEvent.composedPath?.()??[]).find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent?.trim();t&&Ft(t)},children:(0,L.jsx)(Ye,{viewerRef:He,className:`diff-render-surface h-full min-h-0 overflow-auto`,files:$,sectionId:lt,sectionTitle:dt,composerDraftTarget:t,renderHeaderPrefix:(e,t,n)=>{let r=P(e);return(0,L.jsxs)(y,{children:[(0,L.jsx)(C,{render:(0,L.jsx)(`button`,{type:`button`,className:u(`inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 transition-colors hover:bg-foreground/10 focus-visible:outline-hidden`,be(e)),"aria-label":n?`Expand ${r}`:`Collapse ${r}`,"aria-expanded":!n,onClick:e=>{e.stopPropagation(),It(t)}}),children:n?(0,L.jsx)(p,{className:`size-4`}):(0,L.jsx)(i,{className:`size-4`})}),(0,L.jsx)(_,{side:`top`,children:n?`Expand diff`:`Collapse diff`})]})},options:{diffStyle:v===`split`?`split`:`unified`,lineDiffType:`none`,overflow:x?`wrap`:`scroll`,theme:Ce(o),themeType:o,unsafeCSS:it,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:33},layout:{paddingTop:0,paddingBottom:8,gap:8}}},Y??lt)}):(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:Q.reason}),(0,L.jsx)(`pre`,{className:u(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,x?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:Q.text})]})}):Dt?(0,L.jsx)(fe,{label:q?`Loading checkpoint diff...`:G===`unstaged`?`Loading working tree diff...`:`Loading branch diff...`}):(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,L.jsx)(`p`,{children:kt?`No net changes in this selection.`:`No patch available for this selection.`})})]})}):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`})})}export{ye as DiffWorkerPoolProvider,U as default};
|
|
98
|
-
//# sourceMappingURL=DiffPanel-
|
|
98
|
+
//# sourceMappingURL=DiffPanel-DagtjUZ5.js.map
|