@ottocode/web-sdk 0.1.297 → 0.1.299
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/components/common/UsageModal.d.ts.map +1 -1
- package/dist/components/common/UsageRing.d.ts.map +1 -1
- package/dist/components/file-browser/FileViewerPanel.d.ts.map +1 -1
- package/dist/components/index.js +153 -29
- package/dist/components/index.js.map +11 -11
- package/dist/components/messages/UserMessageGroup.d.ts.map +1 -1
- package/dist/components/workspace/ToolPreviewPanel.d.ts.map +1 -1
- package/dist/components/workspace/ViewerTabs.d.ts.map +1 -1
- package/dist/hooks/index.js +113 -6
- package/dist/hooks/index.js.map +5 -5
- package/dist/hooks/useProviderUsage.d.ts.map +1 -1
- package/dist/hooks/useSessionStream.d.ts.map +1 -1
- package/dist/index.js +153 -29
- package/dist/index.js.map +11 -11
- package/dist/stores/index.js +7 -4
- package/dist/stores/index.js.map +3 -3
- package/dist/stores/viewerTabsStore.d.ts +4 -3
- package/dist/stores/viewerTabsStore.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProviderUsage.d.ts","sourceRoot":"","sources":["../../src/hooks/useProviderUsage.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS;;;;
|
|
1
|
+
{"version":3,"file":"useProviderUsage.d.ts","sourceRoot":"","sources":["../../src/hooks/useProviderUsage.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS;;;;EAoE5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSessionStream.d.ts","sourceRoot":"","sources":["../../src/hooks/useSessionStream.ts"],"names":[],"mappings":"AAwBA,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,UAAO,
|
|
1
|
+
{"version":3,"file":"useSessionStream.d.ts","sourceRoot":"","sources":["../../src/hooks/useSessionStream.ts"],"names":[],"mappings":"AAwBA,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,UAAO,QA88Dd"}
|
package/dist/index.js
CHANGED
|
@@ -3736,6 +3736,9 @@ function upsertTab(tabs, tab) {
|
|
|
3736
3736
|
next[existingIndex] = tab;
|
|
3737
3737
|
return next;
|
|
3738
3738
|
}
|
|
3739
|
+
function isPatchPreviewTool(toolName) {
|
|
3740
|
+
return toolName === "apply_patch" || toolName === "edit" || toolName === "multiedit";
|
|
3741
|
+
}
|
|
3739
3742
|
function isSamePatchCall(existing, preview) {
|
|
3740
3743
|
if (!existing)
|
|
3741
3744
|
return false;
|
|
@@ -3908,8 +3911,8 @@ var useViewerTabsStore = create6((set) => ({
|
|
|
3908
3911
|
const targetPath = existingFile?.path ?? preview.path;
|
|
3909
3912
|
const existing = state.tabs.find((tab) => tab.type === "tool-preview" && viewerPathsMatch(tab.path, preview.path));
|
|
3910
3913
|
const tabs = state.tabs.filter((tab) => !((tab.type === "tool-preview" || tab.type === "file") && tab.id !== targetId && (viewerPathsMatch(tab.path, preview.path) || Boolean(preview.callId && "toolName" in tab && tab.callId === preview.callId))));
|
|
3911
|
-
if (preview.toolName
|
|
3912
|
-
const existingPatchPreview = existingFile?.patchPreview ?? (existing
|
|
3914
|
+
if (isPatchPreviewTool(preview.toolName)) {
|
|
3915
|
+
const existingPatchPreview = existingFile?.patchPreview ?? (existing && isPatchPreviewTool(existing.toolName) ? existing : undefined);
|
|
3913
3916
|
const samePatchCall = isSamePatchCall(existingPatchPreview, preview);
|
|
3914
3917
|
const baseContent = preview.baseContent ?? (samePatchCall ? existingPatchPreview?.baseContent : existingPatchPreview?.resultContent ?? existingPatchPreview?.baseContent);
|
|
3915
3918
|
const changedLines = samePatchCall ? preview.changedLines ?? existingPatchPreview?.changedLines : mergeChangedLines(existingPatchPreview?.changedLines, preview.changedLines);
|
|
@@ -3930,7 +3933,7 @@ var useViewerTabsStore = create6((set) => ({
|
|
|
3930
3933
|
writePreview: undefined,
|
|
3931
3934
|
patchPreview: {
|
|
3932
3935
|
path: targetPath,
|
|
3933
|
-
toolName:
|
|
3936
|
+
toolName: preview.toolName,
|
|
3934
3937
|
callId: preview.callId ?? existingPatchPreview?.callId,
|
|
3935
3938
|
baseContent,
|
|
3936
3939
|
patch: preview.patch ?? existingPatchPreview?.patch,
|
|
@@ -19096,14 +19099,17 @@ var UsageRing = memo16(function UsageRing2({
|
|
|
19096
19099
|
provider
|
|
19097
19100
|
}) {
|
|
19098
19101
|
const openModal = useUsageStore((s) => s.openModal);
|
|
19099
|
-
const percent = usage.primaryWindow?.usedPercent ?? 0;
|
|
19102
|
+
const percent = Math.max(0, Math.min(usage.primaryWindow?.usedPercent ?? 0, 100));
|
|
19103
|
+
const windowSeconds = usage.primaryWindow?.windowSeconds ?? 18000;
|
|
19104
|
+
const windowLabel = windowSeconds > 1209600 ? "mo" : "5h";
|
|
19105
|
+
const titleLabel = windowSeconds > 1209600 ? "monthly" : "5h window";
|
|
19100
19106
|
const dashOffset = CIRCUMFERENCE - percent / 100 * CIRCUMFERENCE;
|
|
19101
19107
|
const color = getColor(percent);
|
|
19102
19108
|
return /* @__PURE__ */ jsxs66("button", {
|
|
19103
19109
|
type: "button",
|
|
19104
19110
|
onClick: () => openModal(provider),
|
|
19105
19111
|
className: "relative flex items-center hover:opacity-80 transition-opacity cursor-pointer",
|
|
19106
|
-
title: `Usage: ${Math.round(percent)}% (
|
|
19112
|
+
title: `Usage: ${Math.round(percent)}% (${titleLabel}) — Click for details`,
|
|
19107
19113
|
children: [
|
|
19108
19114
|
/* @__PURE__ */ jsxs66("svg", {
|
|
19109
19115
|
width: SIZE,
|
|
@@ -19137,7 +19143,7 @@ var UsageRing = memo16(function UsageRing2({
|
|
|
19137
19143
|
/* @__PURE__ */ jsx78("span", {
|
|
19138
19144
|
className: "absolute inset-0 flex items-center justify-center rotate-0 font-medium text-muted-foreground",
|
|
19139
19145
|
style: { fontSize: 7 },
|
|
19140
|
-
children:
|
|
19146
|
+
children: windowLabel
|
|
19141
19147
|
})
|
|
19142
19148
|
]
|
|
19143
19149
|
});
|
|
@@ -19168,6 +19174,8 @@ function windowLabel(seconds) {
|
|
|
19168
19174
|
return "5 Hour";
|
|
19169
19175
|
if (seconds <= 86400)
|
|
19170
19176
|
return "24 Hour";
|
|
19177
|
+
if (seconds > 1209600)
|
|
19178
|
+
return "Monthly";
|
|
19171
19179
|
return "7 Day";
|
|
19172
19180
|
}
|
|
19173
19181
|
function UsageBar({
|
|
@@ -19257,11 +19265,11 @@ var UsageModal = memo17(function UsageModal2() {
|
|
|
19257
19265
|
]
|
|
19258
19266
|
}),
|
|
19259
19267
|
usage.primaryWindow && /* @__PURE__ */ jsx79(UsageBar, {
|
|
19260
|
-
label: `${windowLabel(usage.primaryWindow.windowSeconds)}
|
|
19268
|
+
label: `${windowLabel(usage.primaryWindow.windowSeconds)} Usage`,
|
|
19261
19269
|
window: usage.primaryWindow
|
|
19262
19270
|
}),
|
|
19263
19271
|
usage.secondaryWindow && /* @__PURE__ */ jsx79(UsageBar, {
|
|
19264
|
-
label: `${windowLabel(usage.secondaryWindow.windowSeconds)}
|
|
19272
|
+
label: `${windowLabel(usage.secondaryWindow.windowSeconds)} Usage`,
|
|
19265
19273
|
window: usage.secondaryWindow
|
|
19266
19274
|
}),
|
|
19267
19275
|
usage.sonnetWindow && usage.sonnetWindow.usedPercent > 0 && /* @__PURE__ */ jsx79(UsageBar, {
|
|
@@ -19342,7 +19350,7 @@ function useProviderUsage(provider, authType) {
|
|
|
19342
19350
|
const isModalOpen = useUsageStore((s) => s.isModalOpen);
|
|
19343
19351
|
const modalProvider = useUsageStore((s) => s.modalProvider);
|
|
19344
19352
|
const usage = useUsageStore((s) => provider ? s.usage[provider] : undefined);
|
|
19345
|
-
const isOAuthProvider = authType === "oauth" && (provider === "anthropic" || provider === "openai");
|
|
19353
|
+
const isOAuthProvider = authType === "oauth" && (provider === "anthropic" || provider === "openai" || provider === "xai");
|
|
19346
19354
|
const fetchUsage = useCallback21(async (force = false) => {
|
|
19347
19355
|
if (!provider || !isOAuthProvider)
|
|
19348
19356
|
return;
|
|
@@ -20791,7 +20799,13 @@ ${argPatch.slice(-STREAMING_PATCH_PREVIEW_TAIL_CHARS)}`;
|
|
|
20791
20799
|
${bestEffortUnescapeJsonString(rawTail)}`;
|
|
20792
20800
|
};
|
|
20793
20801
|
const getResultRecord = (payload) => payload?.result && typeof payload.result === "object" && !Array.isArray(payload.result) ? payload.result : null;
|
|
20794
|
-
const getArtifactRecord = (payload) =>
|
|
20802
|
+
const getArtifactRecord = (payload) => {
|
|
20803
|
+
if (payload?.artifact && typeof payload.artifact === "object" && !Array.isArray(payload.artifact)) {
|
|
20804
|
+
return payload.artifact;
|
|
20805
|
+
}
|
|
20806
|
+
const result = getResultRecord(payload);
|
|
20807
|
+
return result?.artifact && typeof result.artifact === "object" && !Array.isArray(result.artifact) ? result.artifact : null;
|
|
20808
|
+
};
|
|
20795
20809
|
const extractErrorMessage2 = (payload) => {
|
|
20796
20810
|
const result = getResultRecord(payload);
|
|
20797
20811
|
if (typeof payload?.error === "string")
|
|
@@ -20928,6 +20942,56 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
20928
20942
|
}
|
|
20929
20943
|
return lines.size > 0 ? [...lines] : undefined;
|
|
20930
20944
|
};
|
|
20945
|
+
const getPatchTextLines = (value) => {
|
|
20946
|
+
if (value.length === 0)
|
|
20947
|
+
return [];
|
|
20948
|
+
const lines = value.split(`
|
|
20949
|
+
`);
|
|
20950
|
+
if (value.endsWith(`
|
|
20951
|
+
`))
|
|
20952
|
+
lines.pop();
|
|
20953
|
+
return lines;
|
|
20954
|
+
};
|
|
20955
|
+
const appendStringEditPatchHunk = (lines, edit) => {
|
|
20956
|
+
lines.push("@@");
|
|
20957
|
+
for (const line of getPatchTextLines(edit.oldString)) {
|
|
20958
|
+
lines.push(`-${line}`);
|
|
20959
|
+
}
|
|
20960
|
+
for (const line of getPatchTextLines(edit.newString)) {
|
|
20961
|
+
lines.push(`+${line}`);
|
|
20962
|
+
}
|
|
20963
|
+
};
|
|
20964
|
+
const buildStringEditPatchPreview = (path, edits) => {
|
|
20965
|
+
const validEdits = edits.filter((edit) => edit.oldString.length > 0 || edit.newString.length > 0);
|
|
20966
|
+
if (validEdits.length === 0)
|
|
20967
|
+
return;
|
|
20968
|
+
const lines = ["*** Begin Patch", `*** Update File: ${path}`];
|
|
20969
|
+
for (const edit of validEdits)
|
|
20970
|
+
appendStringEditPatchHunk(lines, edit);
|
|
20971
|
+
lines.push("*** End Patch", "");
|
|
20972
|
+
return lines.join(`
|
|
20973
|
+
`);
|
|
20974
|
+
};
|
|
20975
|
+
const getMultiEditPreviewEdits = (args) => {
|
|
20976
|
+
const edits = Array.isArray(args?.edits) ? args.edits : [];
|
|
20977
|
+
return edits.flatMap((edit) => {
|
|
20978
|
+
if (!edit || typeof edit !== "object" || Array.isArray(edit))
|
|
20979
|
+
return [];
|
|
20980
|
+
const record = edit;
|
|
20981
|
+
return typeof record.oldString === "string" && typeof record.newString === "string" ? [{ oldString: record.oldString, newString: record.newString }] : [];
|
|
20982
|
+
});
|
|
20983
|
+
};
|
|
20984
|
+
const getEditPreviewPatch = (toolName, path, args, buffer, artifact) => {
|
|
20985
|
+
if (typeof artifact?.patch === "string")
|
|
20986
|
+
return artifact.patch;
|
|
20987
|
+
if (toolName === "edit") {
|
|
20988
|
+
const oldString = getStringArg(args, buffer, "oldString");
|
|
20989
|
+
const newString = getStringArg(args, buffer, "newString");
|
|
20990
|
+
return oldString !== undefined && newString !== undefined ? buildStringEditPatchPreview(path, [{ oldString, newString }]) : undefined;
|
|
20991
|
+
}
|
|
20992
|
+
const edits = getMultiEditPreviewEdits(args);
|
|
20993
|
+
return buildStringEditPatchPreview(path, edits);
|
|
20994
|
+
};
|
|
20931
20995
|
const handleReadToolActivity = (eventType, payload, delta) => {
|
|
20932
20996
|
const name = getToolEventName(payload);
|
|
20933
20997
|
if (name !== "read")
|
|
@@ -21062,6 +21126,51 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
21062
21126
|
});
|
|
21063
21127
|
}
|
|
21064
21128
|
};
|
|
21129
|
+
const handleEditToolActivity = (eventType, payload, delta) => {
|
|
21130
|
+
const name = getToolEventName(payload);
|
|
21131
|
+
if (name !== "edit" && name !== "multiedit")
|
|
21132
|
+
return;
|
|
21133
|
+
const args = getToolArgsForViewer(payload, delta);
|
|
21134
|
+
const buffer = getBufferedToolInput(payload);
|
|
21135
|
+
const artifact = getArtifactRecord(payload);
|
|
21136
|
+
const result = getResultRecord(payload);
|
|
21137
|
+
const path = (typeof result?.path === "string" ? result.path : undefined) ?? getStringArg(args, buffer, "path", true);
|
|
21138
|
+
if (!path)
|
|
21139
|
+
return;
|
|
21140
|
+
const failed = result?.ok === false || eventType === "error";
|
|
21141
|
+
const status = failed ? "error" : eventType === "tool.result" ? "success" : "streaming";
|
|
21142
|
+
const callId = getToolEventCallId(payload) ?? undefined;
|
|
21143
|
+
const patch = getEditPreviewPatch(name, path, args, buffer, artifact);
|
|
21144
|
+
if (status === "success")
|
|
21145
|
+
invalidateFileContentCache(path);
|
|
21146
|
+
if (!patch)
|
|
21147
|
+
return;
|
|
21148
|
+
const previewKey = callId ?? `${name}:${path}`;
|
|
21149
|
+
const lineSignature = status === "streaming" ? getCompletedPatchChangeLineSignature(patch) : undefined;
|
|
21150
|
+
if (status === "streaming") {
|
|
21151
|
+
const last = toolPreviewEmitRef.current.get(previewKey);
|
|
21152
|
+
if (last?.lineSignature === lineSignature)
|
|
21153
|
+
return;
|
|
21154
|
+
}
|
|
21155
|
+
const viewerStore = useViewerTabsStore.getState();
|
|
21156
|
+
if (!viewerStore.followToolActivity)
|
|
21157
|
+
return;
|
|
21158
|
+
viewerStore.openToolPreviewTab({
|
|
21159
|
+
path,
|
|
21160
|
+
toolName: name,
|
|
21161
|
+
callId,
|
|
21162
|
+
patch,
|
|
21163
|
+
status,
|
|
21164
|
+
error: extractErrorMessage2(payload)
|
|
21165
|
+
});
|
|
21166
|
+
if (status === "streaming") {
|
|
21167
|
+
toolPreviewEmitRef.current.set(previewKey, {
|
|
21168
|
+
emittedAt: Date.now(),
|
|
21169
|
+
contentLength: buffer.length,
|
|
21170
|
+
lineSignature
|
|
21171
|
+
});
|
|
21172
|
+
}
|
|
21173
|
+
};
|
|
21065
21174
|
const handleSimulatorToolActivity = (eventType, payload) => {
|
|
21066
21175
|
if (eventType !== "tool.result")
|
|
21067
21176
|
return;
|
|
@@ -21092,6 +21201,9 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
21092
21201
|
handleReadToolActivity(eventType, payload, delta);
|
|
21093
21202
|
if (name === "write")
|
|
21094
21203
|
handleWriteToolActivity(eventType, payload, delta);
|
|
21204
|
+
if (name === "edit" || name === "multiedit") {
|
|
21205
|
+
handleEditToolActivity(eventType, payload, delta);
|
|
21206
|
+
}
|
|
21095
21207
|
if (name === "apply_patch") {
|
|
21096
21208
|
handleApplyPatchToolActivity(eventType, payload, delta);
|
|
21097
21209
|
}
|
|
@@ -32834,6 +32946,16 @@ function getOptimizedWritePreview(content, status) {
|
|
|
32834
32946
|
usePlainText: true
|
|
32835
32947
|
};
|
|
32836
32948
|
}
|
|
32949
|
+
function isPatchPreviewTool2(toolName) {
|
|
32950
|
+
return toolName === "apply_patch" || toolName === "edit" || toolName === "multiedit";
|
|
32951
|
+
}
|
|
32952
|
+
function getPatchToolLabel(toolName) {
|
|
32953
|
+
if (toolName === "edit")
|
|
32954
|
+
return "Edit";
|
|
32955
|
+
if (toolName === "multiedit")
|
|
32956
|
+
return "Multi-edit";
|
|
32957
|
+
return "Patch";
|
|
32958
|
+
}
|
|
32837
32959
|
function normalizePatchPath(path) {
|
|
32838
32960
|
return path.replace(/^a\//, "").replace(/^b\//, "").trim();
|
|
32839
32961
|
}
|
|
@@ -33320,9 +33442,9 @@ function getStatusLabel(tab) {
|
|
|
33320
33442
|
if (tab.status === "error")
|
|
33321
33443
|
return `${tab.toolName.replace("_", " ")} failed`;
|
|
33322
33444
|
if (tab.status === "success") {
|
|
33323
|
-
return tab.toolName === "write" ? "Write applied" :
|
|
33445
|
+
return tab.toolName === "write" ? "Write applied" : `${getPatchToolLabel(tab.toolName)} applied`;
|
|
33324
33446
|
}
|
|
33325
|
-
return tab.toolName === "write" ? "Proposed write" :
|
|
33447
|
+
return tab.toolName === "write" ? "Proposed write" : `${getPatchToolLabel(tab.toolName)} preview`;
|
|
33326
33448
|
}
|
|
33327
33449
|
function StatusIcon({
|
|
33328
33450
|
status
|
|
@@ -33387,10 +33509,11 @@ function ToolPreviewPanel({ tab }) {
|
|
|
33387
33509
|
const scrollContainerRef = useRef38(null);
|
|
33388
33510
|
const lastPatchPreviewRef = useRef38(null);
|
|
33389
33511
|
const statusLabel = getStatusLabel(tab);
|
|
33390
|
-
const
|
|
33512
|
+
const isPatchPreview = isPatchPreviewTool2(tab.toolName);
|
|
33513
|
+
const shouldLoadPatchFile = isPatchPreview;
|
|
33391
33514
|
const shouldLoadAppliedFile = shouldLoadPatchFile && tab.status === "success";
|
|
33392
33515
|
const { data: appliedFile, refetch: refetchAppliedFile } = useFileContent(shouldLoadPatchFile ? tab.path : null);
|
|
33393
|
-
const shouldUseLargePatchFallback = Boolean(
|
|
33516
|
+
const shouldUseLargePatchFallback = Boolean(isPatchPreview && ((tab.patch?.length ?? 0) >= LARGE_PATCH_PREVIEW_CHARS || (appliedFile?.content?.length ?? 0) >= LARGE_PATCH_FILE_CHARS));
|
|
33394
33517
|
const largePatchPreview = useMemo33(() => {
|
|
33395
33518
|
if (!shouldUseLargePatchFallback)
|
|
33396
33519
|
return null;
|
|
@@ -33400,8 +33523,8 @@ function ToolPreviewPanel({ tab }) {
|
|
|
33400
33523
|
const patchTextLineTones = useMemo33(() => getPatchTextLineTones(tab.patch), [tab.patch]);
|
|
33401
33524
|
const writePreview = useMemo33(() => tab.toolName === "write" && tab.content !== undefined ? getOptimizedWritePreview(tab.content, tab.status) : null, [tab.toolName, tab.content, tab.status]);
|
|
33402
33525
|
const scrollSignal = `${tab.content?.length ?? 0}:${tab.patch?.length ?? 0}:${appliedFile?.content?.length ?? 0}`;
|
|
33403
|
-
const livePatchPreview = useMemo33(() =>
|
|
33404
|
-
|
|
33526
|
+
const livePatchPreview = useMemo33(() => isPatchPreview && tab.status !== "success" && !shouldUseLargePatchFallback && appliedFile?.content !== undefined ? buildLivePatchPreview(tab.baseContent ?? appliedFile.content, tab.patch, tab.path) : null, [
|
|
33527
|
+
isPatchPreview,
|
|
33405
33528
|
tab.status,
|
|
33406
33529
|
tab.baseContent,
|
|
33407
33530
|
tab.patch,
|
|
@@ -33427,7 +33550,7 @@ function ToolPreviewPanel({ tab }) {
|
|
|
33427
33550
|
tab.previewLatestLine
|
|
33428
33551
|
]);
|
|
33429
33552
|
const patchPreviewKey = `${tab.callId ?? ""}:${tab.path}`;
|
|
33430
|
-
if (
|
|
33553
|
+
if (isPatchPreview && livePatchPreview) {
|
|
33431
33554
|
lastPatchPreviewRef.current = {
|
|
33432
33555
|
key: patchPreviewKey,
|
|
33433
33556
|
preview: livePatchPreview
|
|
@@ -33435,7 +33558,7 @@ function ToolPreviewPanel({ tab }) {
|
|
|
33435
33558
|
}
|
|
33436
33559
|
const stablePatchPreview = lastPatchPreviewRef.current?.key === patchPreviewKey ? livePatchPreview ?? lastPatchPreviewRef.current.preview : livePatchPreview ?? persistedPatchPreview;
|
|
33437
33560
|
useEffect59(() => {
|
|
33438
|
-
if (tab.toolName
|
|
33561
|
+
if (!isPatchPreviewTool2(tab.toolName) || !livePatchPreview)
|
|
33439
33562
|
return;
|
|
33440
33563
|
const baseContent = tab.baseContent ?? appliedFile?.content;
|
|
33441
33564
|
const previewLineTones = [...livePatchPreview.lineTones.entries()];
|
|
@@ -33445,7 +33568,7 @@ function ToolPreviewPanel({ tab }) {
|
|
|
33445
33568
|
return;
|
|
33446
33569
|
useViewerTabsStore.getState().openToolPreviewTab({
|
|
33447
33570
|
path: tab.path,
|
|
33448
|
-
toolName:
|
|
33571
|
+
toolName: tab.toolName,
|
|
33449
33572
|
callId: tab.callId,
|
|
33450
33573
|
baseContent,
|
|
33451
33574
|
patch: tab.patch,
|
|
@@ -33504,16 +33627,16 @@ function ToolPreviewPanel({ tab }) {
|
|
|
33504
33627
|
/* @__PURE__ */ jsx124("div", {
|
|
33505
33628
|
ref: scrollContainerRef,
|
|
33506
33629
|
className: "flex-1 min-h-0 overflow-auto",
|
|
33507
|
-
children:
|
|
33630
|
+
children: isPatchPreview && largePatchPreview ? /* @__PURE__ */ jsx124(PlainSourceViewer, {
|
|
33508
33631
|
content: largePatchPreview,
|
|
33509
33632
|
path: "preview.patch",
|
|
33510
33633
|
notice: "Large patch/file preview: showing the patch text instead of rendering the full file to keep the app responsive."
|
|
33511
|
-
}) :
|
|
33634
|
+
}) : isPatchPreview && stablePatchPreview ? /* @__PURE__ */ jsx124(SourceViewer, {
|
|
33512
33635
|
content: stablePatchPreview.content,
|
|
33513
33636
|
path: tab.path,
|
|
33514
33637
|
lineTones: stablePatchPreview.lineTones,
|
|
33515
33638
|
scrollToLine: stablePatchPreview.latestLine
|
|
33516
|
-
}) :
|
|
33639
|
+
}) : isPatchPreview && tab.patch ? /* @__PURE__ */ jsx124(SourceViewer, {
|
|
33517
33640
|
content: tab.patch,
|
|
33518
33641
|
path: "preview.patch",
|
|
33519
33642
|
lineTones: patchTextLineTones
|
|
@@ -33526,7 +33649,7 @@ function ToolPreviewPanel({ tab }) {
|
|
|
33526
33649
|
}) : /* @__PURE__ */ jsx124("div", {
|
|
33527
33650
|
className: "h-full flex items-center justify-center text-sm text-muted-foreground",
|
|
33528
33651
|
children: "Loading patched file..."
|
|
33529
|
-
}) :
|
|
33652
|
+
}) : isPatchPreview ? appliedFile?.content !== undefined ? /* @__PURE__ */ jsx124(SourceViewer, {
|
|
33530
33653
|
content: appliedFile.content,
|
|
33531
33654
|
path: tab.path
|
|
33532
33655
|
}) : /* @__PURE__ */ jsx124("div", {
|
|
@@ -33643,11 +33766,12 @@ function formatReadHighlightLabel(highlight) {
|
|
|
33643
33766
|
return "Reading file";
|
|
33644
33767
|
}
|
|
33645
33768
|
function formatPatchPreviewLabel(preview) {
|
|
33769
|
+
const label = preview.toolName === "edit" ? "Edit" : preview.toolName === "multiedit" ? "Multi-edit" : "Patch";
|
|
33646
33770
|
if (preview.status === "success")
|
|
33647
|
-
return
|
|
33771
|
+
return `${label} applied`;
|
|
33648
33772
|
if (preview.status === "error")
|
|
33649
|
-
return
|
|
33650
|
-
return
|
|
33773
|
+
return `${label} failed`;
|
|
33774
|
+
return `${label} preview`;
|
|
33651
33775
|
}
|
|
33652
33776
|
function formatWritePreviewLabel(preview) {
|
|
33653
33777
|
if (preview.status === "success")
|
|
@@ -33719,7 +33843,7 @@ var FileViewerPanel = memo52(function FileViewerPanel2({
|
|
|
33719
33843
|
return;
|
|
33720
33844
|
useViewerTabsStore.getState().openToolPreviewTab({
|
|
33721
33845
|
path: selectedFile,
|
|
33722
|
-
toolName:
|
|
33846
|
+
toolName: patchPreview.toolName,
|
|
33723
33847
|
callId: patchPreview.callId,
|
|
33724
33848
|
baseContent,
|
|
33725
33849
|
patch: patchPreview.patch,
|
|
@@ -34836,7 +34960,7 @@ function tabKindLabel(tab) {
|
|
|
34836
34960
|
case "file":
|
|
34837
34961
|
return "file";
|
|
34838
34962
|
case "tool-preview":
|
|
34839
|
-
return tab.toolName === "write" ? "write preview" : "
|
|
34963
|
+
return tab.toolName === "write" ? "write preview" : `${tab.toolName.replace("_", "-")} preview`;
|
|
34840
34964
|
case "skill-file":
|
|
34841
34965
|
return tab.skill;
|
|
34842
34966
|
case "browser":
|
|
@@ -39750,4 +39874,4 @@ export {
|
|
|
39750
39874
|
API_BASE_URL
|
|
39751
39875
|
};
|
|
39752
39876
|
|
|
39753
|
-
//# debugId=
|
|
39877
|
+
//# debugId=CC255AE21A4A825F64756E2164756E21
|