@ottocode/web-sdk 0.1.313 → 0.1.315
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/chat/ConfigModal.d.ts.map +1 -1
- package/dist/components/common/ProviderLogo.d.ts.map +1 -1
- package/dist/components/dashboard/UsageDashboard.d.ts.map +1 -1
- package/dist/components/index.js +416 -20
- package/dist/components/index.js.map +14 -13
- package/dist/components/sessions/LeanHeader.d.ts.map +1 -1
- package/dist/components/sessions/SessionHeader.d.ts.map +1 -1
- package/dist/components/settings/SettingsSidebar.d.ts.map +1 -1
- package/dist/hooks/index.js +82 -9
- package/dist/hooks/index.js.map +7 -6
- package/dist/hooks/tool-preview-helpers.d.ts +6 -0
- package/dist/hooks/tool-preview-helpers.d.ts.map +1 -0
- package/dist/hooks/useAgents.d.ts +2 -0
- package/dist/hooks/useAgents.d.ts.map +1 -1
- package/dist/hooks/useChatComposer.d.ts +2 -0
- package/dist/hooks/useChatComposer.d.ts.map +1 -1
- package/dist/hooks/useConfig.d.ts +8 -0
- package/dist/hooks/useConfig.d.ts.map +1 -1
- package/dist/hooks/useSessionStream.d.ts.map +1 -1
- package/dist/index.js +416 -20
- package/dist/index.js.map +14 -13
- package/dist/lib/api-client/config.d.ts +6 -0
- package/dist/lib/api-client/config.d.ts.map +1 -1
- package/dist/lib/api-client/index.d.ts +6 -0
- package/dist/lib/api-client/index.d.ts.map +1 -1
- package/dist/lib/index.js.map +2 -2
- package/dist/types/api.d.ts +4 -1
- package/dist/types/api.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3970,7 +3970,6 @@ var providerLogos = {
|
|
|
3970
3970
|
"zai-coding": zaiLogo,
|
|
3971
3971
|
ottorouter: ottorouterLogo,
|
|
3972
3972
|
minimax: minimaxLogo,
|
|
3973
|
-
moonshot: kimiLogo,
|
|
3974
3973
|
kimi: kimiLogo,
|
|
3975
3974
|
opencode: opencodeLogo,
|
|
3976
3975
|
copilot: copilotLogo
|
|
@@ -10610,6 +10609,7 @@ function ConfigModal({
|
|
|
10610
10609
|
const updateDefaults = useUpdateDefaults();
|
|
10611
10610
|
const reasoningEnabled = config2?.defaults?.reasoningText ?? true;
|
|
10612
10611
|
const reasoningLevel = config2?.defaults?.reasoningLevel ?? "high";
|
|
10612
|
+
const coAuthorCommits = config2?.defaults?.coAuthorCommits ?? false;
|
|
10613
10613
|
const ottoEnabled = config2?.defaults?.ottoEnabled ?? true;
|
|
10614
10614
|
const agentNames = useMemo16(() => ((agentDetails?.agents.length) ? agentDetails.agents.map((agentDetail) => agentDetail.name) : config2?.agents ?? []).filter((name) => name !== "otto"), [agentDetails?.agents, config2?.agents]);
|
|
10615
10615
|
const agentSelectorRef = useRef11(null);
|
|
@@ -10717,6 +10717,36 @@ function ConfigModal({
|
|
|
10717
10717
|
})
|
|
10718
10718
|
]
|
|
10719
10719
|
}),
|
|
10720
|
+
/* @__PURE__ */ jsxs22("div", {
|
|
10721
|
+
className: "flex items-center justify-between",
|
|
10722
|
+
children: [
|
|
10723
|
+
/* @__PURE__ */ jsxs22("div", {
|
|
10724
|
+
children: [
|
|
10725
|
+
/* @__PURE__ */ jsx29("div", {
|
|
10726
|
+
className: "text-sm font-medium text-foreground",
|
|
10727
|
+
children: "Otto Commit Co-author"
|
|
10728
|
+
}),
|
|
10729
|
+
/* @__PURE__ */ jsx29("p", {
|
|
10730
|
+
className: "mt-0.5 text-xs text-muted-foreground",
|
|
10731
|
+
children: "Add the ottocode bot as a co-author on Otto commits."
|
|
10732
|
+
})
|
|
10733
|
+
]
|
|
10734
|
+
}),
|
|
10735
|
+
/* @__PURE__ */ jsx29("button", {
|
|
10736
|
+
type: "button",
|
|
10737
|
+
role: "switch",
|
|
10738
|
+
"aria-checked": coAuthorCommits,
|
|
10739
|
+
onClick: () => updateDefaults.mutate({
|
|
10740
|
+
coAuthorCommits: !coAuthorCommits,
|
|
10741
|
+
scope: "global"
|
|
10742
|
+
}),
|
|
10743
|
+
className: `relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 ${coAuthorCommits ? "bg-primary" : "bg-muted"}`,
|
|
10744
|
+
children: /* @__PURE__ */ jsx29("span", {
|
|
10745
|
+
className: `inline-block h-4 w-4 transform rounded-full transition-transform ${coAuthorCommits ? "translate-x-6" : "translate-x-1"} ${coAuthorCommits ? "bg-primary-foreground" : "bg-foreground"}`
|
|
10746
|
+
})
|
|
10747
|
+
})
|
|
10748
|
+
]
|
|
10749
|
+
}),
|
|
10720
10750
|
/* @__PURE__ */ jsxs22("div", {
|
|
10721
10751
|
className: "flex items-center justify-between",
|
|
10722
10752
|
children: [
|
|
@@ -11638,6 +11668,78 @@ class SSEClient {
|
|
|
11638
11668
|
}
|
|
11639
11669
|
}
|
|
11640
11670
|
|
|
11671
|
+
// src/hooks/tool-preview-helpers.ts
|
|
11672
|
+
function bestEffortUnescapeJsonString(value) {
|
|
11673
|
+
try {
|
|
11674
|
+
return JSON.parse(`"${value.replace(/\\$/, "")}"`);
|
|
11675
|
+
} catch {
|
|
11676
|
+
return value.replace(/\\n/g, `
|
|
11677
|
+
`).replace(/\\t/g, "\t").replace(/\\r/g, "\r").replace(/\\"/g, '"').replace(/\\\\/g, "\\");
|
|
11678
|
+
}
|
|
11679
|
+
}
|
|
11680
|
+
function extractJsonStringFieldAt(text, field, startIndex, requireClosed = false) {
|
|
11681
|
+
const marker = `"${field}"`;
|
|
11682
|
+
const markerIndex = text.indexOf(marker, Math.max(0, startIndex));
|
|
11683
|
+
if (markerIndex === -1)
|
|
11684
|
+
return;
|
|
11685
|
+
const colonIndex = text.indexOf(":", markerIndex + marker.length);
|
|
11686
|
+
if (colonIndex === -1)
|
|
11687
|
+
return;
|
|
11688
|
+
const quoteIndex = text.indexOf('"', colonIndex + 1);
|
|
11689
|
+
if (quoteIndex === -1)
|
|
11690
|
+
return;
|
|
11691
|
+
let escaped = "";
|
|
11692
|
+
let escaping = false;
|
|
11693
|
+
let closed = false;
|
|
11694
|
+
let endIndex = text.length;
|
|
11695
|
+
for (let i = quoteIndex + 1;i < text.length; i += 1) {
|
|
11696
|
+
const char = text[i];
|
|
11697
|
+
if (escaping) {
|
|
11698
|
+
escaped += `\\${char}`;
|
|
11699
|
+
escaping = false;
|
|
11700
|
+
continue;
|
|
11701
|
+
}
|
|
11702
|
+
if (char === "\\") {
|
|
11703
|
+
escaping = true;
|
|
11704
|
+
continue;
|
|
11705
|
+
}
|
|
11706
|
+
if (char === '"') {
|
|
11707
|
+
closed = true;
|
|
11708
|
+
endIndex = i + 1;
|
|
11709
|
+
break;
|
|
11710
|
+
}
|
|
11711
|
+
escaped += char;
|
|
11712
|
+
}
|
|
11713
|
+
if (requireClosed && !closed)
|
|
11714
|
+
return;
|
|
11715
|
+
return {
|
|
11716
|
+
value: bestEffortUnescapeJsonString(escaped),
|
|
11717
|
+
endIndex,
|
|
11718
|
+
closed
|
|
11719
|
+
};
|
|
11720
|
+
}
|
|
11721
|
+
function extractStreamingMultiEditPreviewEdits(buffer) {
|
|
11722
|
+
const editsStart = buffer.indexOf('"edits"');
|
|
11723
|
+
if (editsStart === -1)
|
|
11724
|
+
return [];
|
|
11725
|
+
const edits = [];
|
|
11726
|
+
let cursor = editsStart;
|
|
11727
|
+
const maxPreviewEdits = 50;
|
|
11728
|
+
while (cursor < buffer.length && edits.length < maxPreviewEdits) {
|
|
11729
|
+
const oldString = extractJsonStringFieldAt(buffer, "oldString", cursor, true);
|
|
11730
|
+
if (!oldString)
|
|
11731
|
+
break;
|
|
11732
|
+
const newString = extractJsonStringFieldAt(buffer, "newString", oldString.endIndex, false);
|
|
11733
|
+
if (!newString)
|
|
11734
|
+
break;
|
|
11735
|
+
edits.push({ oldString: oldString.value, newString: newString.value });
|
|
11736
|
+
cursor = Math.max(newString.endIndex, oldString.endIndex + 1);
|
|
11737
|
+
if (!newString.closed)
|
|
11738
|
+
break;
|
|
11739
|
+
}
|
|
11740
|
+
return edits;
|
|
11741
|
+
}
|
|
11742
|
+
|
|
11641
11743
|
// src/hooks/useSessionStream.ts
|
|
11642
11744
|
var TOOL_PREVIEW_THROTTLE_MS = 500;
|
|
11643
11745
|
var TOOL_PREVIEW_THROTTLE_MIN_CHARS = 8000;
|
|
@@ -11791,7 +11893,7 @@ ${value.slice(-STREAMING_TOOL_INPUT_TAIL_CHARS)}`;
|
|
|
11791
11893
|
toolInputBuffersRef.current.set(key, next);
|
|
11792
11894
|
return parseArgsRecord(next);
|
|
11793
11895
|
};
|
|
11794
|
-
const
|
|
11896
|
+
const bestEffortUnescapeJsonString2 = (value) => {
|
|
11795
11897
|
try {
|
|
11796
11898
|
return JSON.parse(`"${value.replace(/\\$/, "")}"`);
|
|
11797
11899
|
} catch {
|
|
@@ -11832,7 +11934,7 @@ ${value.slice(-STREAMING_TOOL_INPUT_TAIL_CHARS)}`;
|
|
|
11832
11934
|
}
|
|
11833
11935
|
if (requireClosed && !closed)
|
|
11834
11936
|
return;
|
|
11835
|
-
return
|
|
11937
|
+
return bestEffortUnescapeJsonString2(escaped);
|
|
11836
11938
|
};
|
|
11837
11939
|
const getBufferedToolInput = (payload) => {
|
|
11838
11940
|
const key = getToolBufferKey(payload);
|
|
@@ -11869,7 +11971,7 @@ ${argContent.slice(-STREAMING_WRITE_CONTENT_PREVIEW_CHARS)}`;
|
|
|
11869
11971
|
}
|
|
11870
11972
|
const rawTail = buffer.slice(Math.max(valueStart, buffer.length - STREAMING_WRITE_CONTENT_PREVIEW_CHARS));
|
|
11871
11973
|
return `… showing latest streamed content only …
|
|
11872
|
-
${
|
|
11974
|
+
${bestEffortUnescapeJsonString2(rawTail)}`;
|
|
11873
11975
|
};
|
|
11874
11976
|
const getStreamingPatchPreviewContent = (args, buffer) => {
|
|
11875
11977
|
const argPatch = args?.patch;
|
|
@@ -11898,9 +12000,9 @@ ${argPatch.slice(-STREAMING_PATCH_PREVIEW_TAIL_CHARS)}`;
|
|
|
11898
12000
|
}
|
|
11899
12001
|
const rawHead = buffer.slice(valueStart, valueStart + STREAMING_PATCH_PREVIEW_HEAD_CHARS);
|
|
11900
12002
|
const rawTail = buffer.slice(-STREAMING_PATCH_PREVIEW_TAIL_CHARS);
|
|
11901
|
-
return `${
|
|
12003
|
+
return `${bestEffortUnescapeJsonString2(rawHead)}
|
|
11902
12004
|
… patch preview truncated while streaming …
|
|
11903
|
-
${
|
|
12005
|
+
${bestEffortUnescapeJsonString2(rawTail)}`;
|
|
11904
12006
|
};
|
|
11905
12007
|
const getResultRecord = (payload) => payload?.result && typeof payload.result === "object" && !Array.isArray(payload.result) ? payload.result : null;
|
|
11906
12008
|
const getArtifactRecord = (payload) => {
|
|
@@ -12076,14 +12178,15 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
12076
12178
|
return lines.join(`
|
|
12077
12179
|
`);
|
|
12078
12180
|
};
|
|
12079
|
-
const getMultiEditPreviewEdits = (args) => {
|
|
12181
|
+
const getMultiEditPreviewEdits = (args, buffer) => {
|
|
12080
12182
|
const edits = Array.isArray(args?.edits) ? args.edits : [];
|
|
12081
|
-
|
|
12183
|
+
const parsedEdits = edits.flatMap((edit) => {
|
|
12082
12184
|
if (!edit || typeof edit !== "object" || Array.isArray(edit))
|
|
12083
12185
|
return [];
|
|
12084
12186
|
const record = edit;
|
|
12085
12187
|
return typeof record.oldString === "string" && typeof record.newString === "string" ? [{ oldString: record.oldString, newString: record.newString }] : [];
|
|
12086
12188
|
});
|
|
12189
|
+
return parsedEdits.length > 0 ? parsedEdits : extractStreamingMultiEditPreviewEdits(buffer);
|
|
12087
12190
|
};
|
|
12088
12191
|
const getEditPreviewPatch = (toolName, path, args, buffer, artifact) => {
|
|
12089
12192
|
if (typeof artifact?.patch === "string")
|
|
@@ -12093,7 +12196,7 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
12093
12196
|
const newString = getStringArg(args, buffer, "newString");
|
|
12094
12197
|
return oldString !== undefined && newString !== undefined ? buildStringEditPatchPreview(path, [{ oldString, newString }]) : undefined;
|
|
12095
12198
|
}
|
|
12096
|
-
const edits = getMultiEditPreviewEdits(args);
|
|
12199
|
+
const edits = getMultiEditPreviewEdits(args, buffer);
|
|
12097
12200
|
return buildStringEditPatchPreview(path, edits);
|
|
12098
12201
|
};
|
|
12099
12202
|
const handleReadToolActivity = (eventType, payload, delta) => {
|
|
@@ -23413,6 +23516,8 @@ function SessionHeader({
|
|
|
23413
23516
|
const width = useContainerWidth(rootRef);
|
|
23414
23517
|
const isCompact = width > 0 && width < 640;
|
|
23415
23518
|
const estimatedCost = useMemo25(() => {
|
|
23519
|
+
if (typeof session.totalCostUsd === "number")
|
|
23520
|
+
return session.totalCostUsd;
|
|
23416
23521
|
const inputTokens = session.totalInputTokens || 0;
|
|
23417
23522
|
const outputTokens2 = session.totalOutputTokens || 0;
|
|
23418
23523
|
const cachedInputTokens = session.totalCachedTokens || 0;
|
|
@@ -23429,8 +23534,10 @@ function SessionHeader({
|
|
|
23429
23534
|
session.totalInputTokens,
|
|
23430
23535
|
session.totalOutputTokens,
|
|
23431
23536
|
session.totalCachedTokens,
|
|
23432
|
-
session.totalCacheCreationTokens
|
|
23537
|
+
session.totalCacheCreationTokens,
|
|
23538
|
+
session.totalCostUsd
|
|
23433
23539
|
]);
|
|
23540
|
+
const subagentCost = session.subagentCostUsd ?? 0;
|
|
23434
23541
|
const formatDuration3 = (ms) => {
|
|
23435
23542
|
if (!ms)
|
|
23436
23543
|
return "0s";
|
|
@@ -23593,6 +23700,7 @@ function SessionHeader({
|
|
|
23593
23700
|
}),
|
|
23594
23701
|
estimatedCost > 0 && !isCompact && /* @__PURE__ */ jsxs75("div", {
|
|
23595
23702
|
className: "flex items-center gap-1.5",
|
|
23703
|
+
title: subagentCost > 0 ? `Total cost includes $${subagentCost.toFixed(4)} from sub-agents` : "Estimated session cost",
|
|
23596
23704
|
children: [
|
|
23597
23705
|
/* @__PURE__ */ jsx87(DollarSign, {
|
|
23598
23706
|
className: "w-4 h-4"
|
|
@@ -24072,6 +24180,8 @@ function LeanHeader({
|
|
|
24072
24180
|
const { data: parentData } = useParentSession(session.sessionType === "branch" ? session.id : undefined);
|
|
24073
24181
|
const { data: shareStatus } = useShareStatus(session.id);
|
|
24074
24182
|
const estimatedCost = useMemo27(() => {
|
|
24183
|
+
if (typeof session.totalCostUsd === "number")
|
|
24184
|
+
return session.totalCostUsd;
|
|
24075
24185
|
const inputTokens = session.totalInputTokens || 0;
|
|
24076
24186
|
const outputTokens = session.totalOutputTokens || 0;
|
|
24077
24187
|
const cachedInputTokens = session.totalCachedTokens || 0;
|
|
@@ -24088,8 +24198,10 @@ function LeanHeader({
|
|
|
24088
24198
|
session.totalInputTokens,
|
|
24089
24199
|
session.totalOutputTokens,
|
|
24090
24200
|
session.totalCachedTokens,
|
|
24091
|
-
session.totalCacheCreationTokens
|
|
24201
|
+
session.totalCacheCreationTokens,
|
|
24202
|
+
session.totalCostUsd
|
|
24092
24203
|
]);
|
|
24204
|
+
const subagentCost = session.subagentCostUsd ?? 0;
|
|
24093
24205
|
const formatCompactNumber = (num) => {
|
|
24094
24206
|
if (num >= 1e6)
|
|
24095
24207
|
return `${(num / 1e6).toFixed(1)}M`;
|
|
@@ -24222,6 +24334,7 @@ function LeanHeader({
|
|
|
24222
24334
|
}),
|
|
24223
24335
|
estimatedCost > 0 && !isCompact && /* @__PURE__ */ jsxs78("div", {
|
|
24224
24336
|
className: "flex items-center gap-1",
|
|
24337
|
+
title: subagentCost > 0 ? `Total cost includes $${subagentCost.toFixed(4)} from sub-agents` : "Estimated session cost",
|
|
24225
24338
|
children: [
|
|
24226
24339
|
/* @__PURE__ */ jsx90(DollarSign2, {
|
|
24227
24340
|
className: "size-3.5"
|
|
@@ -33569,6 +33682,15 @@ function PreferencesModal({ isOpen, onClose }) {
|
|
|
33569
33682
|
scope: "global"
|
|
33570
33683
|
})
|
|
33571
33684
|
}),
|
|
33685
|
+
/* @__PURE__ */ jsx128(ToggleRow, {
|
|
33686
|
+
label: "Otto Commit Co-author",
|
|
33687
|
+
description: "Add the ottocode bot as a co-author on commits made through Otto.",
|
|
33688
|
+
checked: config2?.defaults?.coAuthorCommits ?? false,
|
|
33689
|
+
onChange: (checked) => updateDefaults.mutate({
|
|
33690
|
+
coAuthorCommits: checked,
|
|
33691
|
+
scope: "global"
|
|
33692
|
+
})
|
|
33693
|
+
}),
|
|
33572
33694
|
/* @__PURE__ */ jsx128(ToggleRow, {
|
|
33573
33695
|
label: "Otto & Goals",
|
|
33574
33696
|
description: "Supervisor agent that verifies goal progress and re-enqueues sessions until the goal is done. Disabling also disables goals.",
|
|
@@ -41769,7 +41891,7 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
|
|
|
41769
41891
|
setOpenAICodeCopied(false);
|
|
41770
41892
|
setOpenAIAuthMode("choice");
|
|
41771
41893
|
setOpenAIModalOpen(true);
|
|
41772
|
-
} else if (providerId === "
|
|
41894
|
+
} else if (providerId === "kimi" && onStartKimiDeviceFlow) {
|
|
41773
41895
|
setKimiPolling(false);
|
|
41774
41896
|
setKimiDevice(null);
|
|
41775
41897
|
setKimiError(null);
|
|
@@ -43174,7 +43296,7 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
|
|
|
43174
43296
|
className: "flex items-center gap-3 p-6 border-b border-border",
|
|
43175
43297
|
children: [
|
|
43176
43298
|
/* @__PURE__ */ jsx154(ProviderLogo, {
|
|
43177
|
-
provider: "
|
|
43299
|
+
provider: "kimi",
|
|
43178
43300
|
size: 24
|
|
43179
43301
|
}),
|
|
43180
43302
|
/* @__PURE__ */ jsx154("h3", {
|
|
@@ -44164,6 +44286,278 @@ function TokenChart({ data, max, hover, onHover }) {
|
|
|
44164
44286
|
})
|
|
44165
44287
|
});
|
|
44166
44288
|
}
|
|
44289
|
+
var SKELETON_BARS = [
|
|
44290
|
+
{ id: "a", height: 32 },
|
|
44291
|
+
{ id: "b", height: 48 },
|
|
44292
|
+
{ id: "c", height: 24 },
|
|
44293
|
+
{ id: "d", height: 64 },
|
|
44294
|
+
{ id: "e", height: 40 },
|
|
44295
|
+
{ id: "f", height: 72 },
|
|
44296
|
+
{ id: "g", height: 16 },
|
|
44297
|
+
{ id: "h", height: 56 },
|
|
44298
|
+
{ id: "i", height: 36 },
|
|
44299
|
+
{ id: "j", height: 80 },
|
|
44300
|
+
{ id: "k", height: 28 },
|
|
44301
|
+
{ id: "l", height: 44 },
|
|
44302
|
+
{ id: "m", height: 20 },
|
|
44303
|
+
{ id: "n", height: 60 },
|
|
44304
|
+
{ id: "o", height: 52 },
|
|
44305
|
+
{ id: "p", height: 12 },
|
|
44306
|
+
{ id: "q", height: 68 },
|
|
44307
|
+
{ id: "r", height: 76 },
|
|
44308
|
+
{ id: "s", height: 44 },
|
|
44309
|
+
{ id: "t", height: 32 },
|
|
44310
|
+
{ id: "u", height: 50 },
|
|
44311
|
+
{ id: "v", height: 18 },
|
|
44312
|
+
{ id: "w", height: 66 },
|
|
44313
|
+
{ id: "x", height: 38 },
|
|
44314
|
+
{ id: "y", height: 58 },
|
|
44315
|
+
{ id: "z", height: 26 },
|
|
44316
|
+
{ id: "aa", height: 70 },
|
|
44317
|
+
{ id: "ab", height: 22 },
|
|
44318
|
+
{ id: "ac", height: 46 },
|
|
44319
|
+
{ id: "ad", height: 54 }
|
|
44320
|
+
];
|
|
44321
|
+
var SKELETON_LIST_ROWS = [
|
|
44322
|
+
{ id: "a" },
|
|
44323
|
+
{ id: "b" },
|
|
44324
|
+
{ id: "c" },
|
|
44325
|
+
{ id: "d" },
|
|
44326
|
+
{ id: "e" },
|
|
44327
|
+
{ id: "f" },
|
|
44328
|
+
{ id: "g" },
|
|
44329
|
+
{ id: "h" },
|
|
44330
|
+
{ id: "i" },
|
|
44331
|
+
{ id: "j" },
|
|
44332
|
+
{ id: "k" },
|
|
44333
|
+
{ id: "l" }
|
|
44334
|
+
];
|
|
44335
|
+
function SkeletonHero() {
|
|
44336
|
+
return /* @__PURE__ */ jsxs137("div", {
|
|
44337
|
+
className: "rounded-2xl border border-border bg-card/60 px-6 py-7",
|
|
44338
|
+
children: [
|
|
44339
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44340
|
+
className: "grid grid-cols-1 md:grid-cols-[1.4fr_1fr_1fr] gap-6 md:gap-10 items-center",
|
|
44341
|
+
children: [
|
|
44342
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44343
|
+
children: [
|
|
44344
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44345
|
+
className: "h-3 w-32 bg-muted rounded animate-pulse"
|
|
44346
|
+
}),
|
|
44347
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44348
|
+
className: "mt-3 h-12 w-40 bg-muted rounded animate-pulse"
|
|
44349
|
+
}),
|
|
44350
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44351
|
+
className: "mt-3 h-3 w-56 bg-muted rounded animate-pulse"
|
|
44352
|
+
})
|
|
44353
|
+
]
|
|
44354
|
+
}),
|
|
44355
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44356
|
+
className: "md:border-l md:border-border/60 md:pl-6",
|
|
44357
|
+
children: [
|
|
44358
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44359
|
+
className: "h-3 w-24 bg-muted rounded animate-pulse"
|
|
44360
|
+
}),
|
|
44361
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44362
|
+
className: "mt-3 h-9 w-32 bg-muted rounded animate-pulse"
|
|
44363
|
+
}),
|
|
44364
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44365
|
+
className: "mt-3 h-3 w-40 bg-muted rounded animate-pulse"
|
|
44366
|
+
})
|
|
44367
|
+
]
|
|
44368
|
+
}),
|
|
44369
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44370
|
+
className: "md:border-l md:border-border/60 md:pl-6",
|
|
44371
|
+
children: [
|
|
44372
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44373
|
+
className: "h-3 w-28 bg-muted rounded animate-pulse"
|
|
44374
|
+
}),
|
|
44375
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44376
|
+
className: "mt-3 h-9 w-32 bg-muted rounded animate-pulse"
|
|
44377
|
+
}),
|
|
44378
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44379
|
+
className: "mt-3 h-3 w-44 bg-muted rounded animate-pulse"
|
|
44380
|
+
})
|
|
44381
|
+
]
|
|
44382
|
+
})
|
|
44383
|
+
]
|
|
44384
|
+
}),
|
|
44385
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44386
|
+
className: "mt-6 pt-5 border-t border-border/40 grid grid-cols-3 gap-6",
|
|
44387
|
+
children: [
|
|
44388
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44389
|
+
children: [
|
|
44390
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44391
|
+
className: "h-3 w-20 bg-muted rounded animate-pulse"
|
|
44392
|
+
}),
|
|
44393
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44394
|
+
className: "mt-2 h-5 w-32 bg-muted rounded animate-pulse"
|
|
44395
|
+
})
|
|
44396
|
+
]
|
|
44397
|
+
}),
|
|
44398
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44399
|
+
children: [
|
|
44400
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44401
|
+
className: "h-3 w-16 bg-muted rounded animate-pulse"
|
|
44402
|
+
}),
|
|
44403
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44404
|
+
className: "mt-2 h-5 w-36 bg-muted rounded animate-pulse"
|
|
44405
|
+
})
|
|
44406
|
+
]
|
|
44407
|
+
}),
|
|
44408
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44409
|
+
children: [
|
|
44410
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44411
|
+
className: "h-3 w-12 bg-muted rounded animate-pulse"
|
|
44412
|
+
}),
|
|
44413
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44414
|
+
className: "mt-2 h-5 w-40 bg-muted rounded animate-pulse"
|
|
44415
|
+
})
|
|
44416
|
+
]
|
|
44417
|
+
})
|
|
44418
|
+
]
|
|
44419
|
+
})
|
|
44420
|
+
]
|
|
44421
|
+
});
|
|
44422
|
+
}
|
|
44423
|
+
function SkeletonSplit() {
|
|
44424
|
+
return /* @__PURE__ */ jsx157("div", {
|
|
44425
|
+
className: "space-y-2",
|
|
44426
|
+
children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxs137("div", {
|
|
44427
|
+
className: "flex items-center gap-3 py-2",
|
|
44428
|
+
children: [
|
|
44429
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44430
|
+
className: "h-3 w-20 bg-muted rounded animate-pulse shrink-0"
|
|
44431
|
+
}),
|
|
44432
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44433
|
+
className: "flex-1 h-1.5 rounded-full bg-muted/40 overflow-hidden",
|
|
44434
|
+
children: /* @__PURE__ */ jsx157("div", {
|
|
44435
|
+
className: "h-full w-2/3 bg-muted rounded animate-pulse"
|
|
44436
|
+
})
|
|
44437
|
+
}),
|
|
44438
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44439
|
+
className: "h-3 w-20 bg-muted rounded animate-pulse shrink-0"
|
|
44440
|
+
}),
|
|
44441
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44442
|
+
className: "h-4 w-16 bg-muted rounded animate-pulse shrink-0"
|
|
44443
|
+
})
|
|
44444
|
+
]
|
|
44445
|
+
}, i))
|
|
44446
|
+
});
|
|
44447
|
+
}
|
|
44448
|
+
function SkeletonChart() {
|
|
44449
|
+
return /* @__PURE__ */ jsxs137("div", {
|
|
44450
|
+
children: [
|
|
44451
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44452
|
+
className: "flex items-baseline justify-between gap-4 mb-4",
|
|
44453
|
+
children: [
|
|
44454
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44455
|
+
className: "min-w-0 space-y-2",
|
|
44456
|
+
children: [
|
|
44457
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44458
|
+
className: "h-3 w-24 bg-muted rounded animate-pulse"
|
|
44459
|
+
}),
|
|
44460
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44461
|
+
className: "h-7 w-28 bg-muted rounded animate-pulse"
|
|
44462
|
+
}),
|
|
44463
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44464
|
+
className: "h-3 w-48 bg-muted rounded animate-pulse"
|
|
44465
|
+
})
|
|
44466
|
+
]
|
|
44467
|
+
}),
|
|
44468
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44469
|
+
className: "h-7 w-28 bg-muted rounded animate-pulse shrink-0"
|
|
44470
|
+
})
|
|
44471
|
+
]
|
|
44472
|
+
}),
|
|
44473
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44474
|
+
className: "flex items-end gap-[3px] h-44",
|
|
44475
|
+
children: SKELETON_BARS.map((bar) => /* @__PURE__ */ jsx157("div", {
|
|
44476
|
+
className: "flex-1 bg-muted rounded-sm animate-pulse",
|
|
44477
|
+
style: { height: `${bar.height}%` }
|
|
44478
|
+
}, `chart-skeleton-${bar.id}`))
|
|
44479
|
+
}),
|
|
44480
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44481
|
+
className: "mt-3 flex items-center justify-between",
|
|
44482
|
+
children: [
|
|
44483
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44484
|
+
className: "h-3 w-16 bg-muted rounded animate-pulse"
|
|
44485
|
+
}),
|
|
44486
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44487
|
+
className: "h-3 w-24 bg-muted rounded animate-pulse"
|
|
44488
|
+
}),
|
|
44489
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44490
|
+
className: "h-3 w-16 bg-muted rounded animate-pulse"
|
|
44491
|
+
})
|
|
44492
|
+
]
|
|
44493
|
+
})
|
|
44494
|
+
]
|
|
44495
|
+
});
|
|
44496
|
+
}
|
|
44497
|
+
function SkeletonList({ rows = 6 }) {
|
|
44498
|
+
return /* @__PURE__ */ jsx157("div", {
|
|
44499
|
+
className: "divide-y divide-border/60",
|
|
44500
|
+
children: SKELETON_LIST_ROWS.slice(0, rows).map((row, index) => /* @__PURE__ */ jsxs137("div", {
|
|
44501
|
+
className: "flex items-center gap-3 py-2.5 px-1",
|
|
44502
|
+
children: [
|
|
44503
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44504
|
+
className: "size-7 shrink-0 rounded-md bg-muted animate-pulse"
|
|
44505
|
+
}),
|
|
44506
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44507
|
+
className: "flex-1 min-w-0 space-y-1.5",
|
|
44508
|
+
children: [
|
|
44509
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44510
|
+
className: "h-3.5 w-24 bg-muted rounded animate-pulse"
|
|
44511
|
+
}),
|
|
44512
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44513
|
+
className: "h-2.5 w-36 bg-muted rounded animate-pulse"
|
|
44514
|
+
})
|
|
44515
|
+
]
|
|
44516
|
+
}),
|
|
44517
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44518
|
+
className: "space-y-1.5 text-right shrink-0",
|
|
44519
|
+
children: [
|
|
44520
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44521
|
+
className: "h-3.5 w-16 bg-muted rounded animate-pulse"
|
|
44522
|
+
}),
|
|
44523
|
+
/* @__PURE__ */ jsx157("div", {
|
|
44524
|
+
className: "h-2.5 w-14 bg-muted rounded animate-pulse ml-auto"
|
|
44525
|
+
})
|
|
44526
|
+
]
|
|
44527
|
+
})
|
|
44528
|
+
]
|
|
44529
|
+
}, `list-skeleton-${row.id}-${index}`))
|
|
44530
|
+
});
|
|
44531
|
+
}
|
|
44532
|
+
function UsageDashboardSkeleton() {
|
|
44533
|
+
return /* @__PURE__ */ jsxs137("div", {
|
|
44534
|
+
className: "max-w-5xl mx-auto px-6 py-8 space-y-5",
|
|
44535
|
+
children: [
|
|
44536
|
+
/* @__PURE__ */ jsx157(SkeletonHero, {}),
|
|
44537
|
+
/* @__PURE__ */ jsx157(Section, {
|
|
44538
|
+
title: "How you're paying",
|
|
44539
|
+
children: /* @__PURE__ */ jsx157(SkeletonSplit, {})
|
|
44540
|
+
}),
|
|
44541
|
+
/* @__PURE__ */ jsx157(Section, {
|
|
44542
|
+
title: "Daily activity",
|
|
44543
|
+
children: /* @__PURE__ */ jsx157(SkeletonChart, {})
|
|
44544
|
+
}),
|
|
44545
|
+
/* @__PURE__ */ jsxs137("div", {
|
|
44546
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-5",
|
|
44547
|
+
children: [
|
|
44548
|
+
/* @__PURE__ */ jsx157(Section, {
|
|
44549
|
+
title: "By provider",
|
|
44550
|
+
children: /* @__PURE__ */ jsx157(SkeletonList, {})
|
|
44551
|
+
}),
|
|
44552
|
+
/* @__PURE__ */ jsx157(Section, {
|
|
44553
|
+
title: "Top models",
|
|
44554
|
+
children: /* @__PURE__ */ jsx157(SkeletonList, {})
|
|
44555
|
+
})
|
|
44556
|
+
]
|
|
44557
|
+
})
|
|
44558
|
+
]
|
|
44559
|
+
});
|
|
44560
|
+
}
|
|
44167
44561
|
function Dot({ color, label }) {
|
|
44168
44562
|
return /* @__PURE__ */ jsxs137("span", {
|
|
44169
44563
|
className: "flex items-center gap-1",
|
|
@@ -44523,6 +44917,11 @@ function UsageDashboard({ onBack }) {
|
|
|
44523
44917
|
else
|
|
44524
44918
|
window.location.assign("/");
|
|
44525
44919
|
}, [onBack]);
|
|
44920
|
+
const handleScopeChange = useCallback53((next) => {
|
|
44921
|
+
setScope(next);
|
|
44922
|
+
setStats(null);
|
|
44923
|
+
setError(null);
|
|
44924
|
+
}, []);
|
|
44526
44925
|
const projectName = useMemo48(() => {
|
|
44527
44926
|
if (scope === "global") {
|
|
44528
44927
|
const included = stats?.projects?.included.length ?? 0;
|
|
@@ -44588,13 +44987,13 @@ function UsageDashboard({ onBack }) {
|
|
|
44588
44987
|
children: [
|
|
44589
44988
|
/* @__PURE__ */ jsx157("button", {
|
|
44590
44989
|
type: "button",
|
|
44591
|
-
onClick: () =>
|
|
44990
|
+
onClick: () => handleScopeChange("project"),
|
|
44592
44991
|
className: `px-2 py-0.5 rounded transition-colors ${scope === "project" ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
|
|
44593
44992
|
children: "Project"
|
|
44594
44993
|
}),
|
|
44595
44994
|
/* @__PURE__ */ jsxs137("button", {
|
|
44596
44995
|
type: "button",
|
|
44597
|
-
onClick: () =>
|
|
44996
|
+
onClick: () => handleScopeChange("global"),
|
|
44598
44997
|
className: `px-2 py-0.5 rounded transition-colors inline-flex items-center gap-1 ${scope === "global" ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
|
|
44599
44998
|
children: [
|
|
44600
44999
|
/* @__PURE__ */ jsx157(Globe25, {
|
|
@@ -44630,10 +45029,7 @@ function UsageDashboard({ onBack }) {
|
|
|
44630
45029
|
className: "rounded-xl border border-destructive/40 bg-destructive/10 p-3 text-xs text-destructive",
|
|
44631
45030
|
children: error
|
|
44632
45031
|
}),
|
|
44633
|
-
loading && !stats && /* @__PURE__ */ jsx157(
|
|
44634
|
-
className: "py-24 text-center text-xs text-muted-foreground",
|
|
44635
|
-
children: "loading…"
|
|
44636
|
-
}),
|
|
45032
|
+
loading && !stats && /* @__PURE__ */ jsx157(UsageDashboardSkeleton, {}),
|
|
44637
45033
|
stats && /* @__PURE__ */ jsxs137(Fragment62, {
|
|
44638
45034
|
children: [
|
|
44639
45035
|
/* @__PURE__ */ jsxs137("div", {
|
|
@@ -46244,4 +46640,4 @@ export {
|
|
|
46244
46640
|
API_BASE_URL
|
|
46245
46641
|
};
|
|
46246
46642
|
|
|
46247
|
-
//# debugId=
|
|
46643
|
+
//# debugId=5221E4EC6E1F50B064756E2164756E21
|