pantheon-opencode 1.6.0 → 1.6.2-beta.1
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/AGENTS.global.md +11 -11
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +45 -0
- package/README.md +122 -6
- package/README.pt-BR.md +14 -9
- package/bin/pantheon-init.mjs +255 -39
- package/package.json +8 -6
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/build-agents-md.mjs +1 -1
- package/scripts/doctor.mjs +231 -46
- package/scripts/install/agents-md.mjs +2 -1
- package/scripts/install/config-migration.mjs +344 -393
- package/scripts/install/config-paths.mjs +15 -0
- package/scripts/install/interactive.mjs +30 -9
- package/scripts/install/interrupt.mjs +78 -0
- package/scripts/install/mcp-permissions.mjs +164 -0
- package/scripts/install/opencode-state.mjs +91 -0
- package/scripts/install/opencode-version.mjs +31 -13
- package/scripts/install/opencode-wildcard.mjs +106 -0
- package/scripts/install/opencode.mjs +508 -108
- package/scripts/install/plan-artifact.mjs +12 -1
- package/scripts/install/plugin.mjs +17 -1
- package/scripts/install/run-record.mjs +115 -0
- package/scripts/install/strings.mjs +35 -6
- package/scripts/install/v2-capabilities.mjs +204 -0
- package/scripts/package-evidence.mjs +1 -0
- package/scripts/release-gates.mjs +7 -2
- package/scripts/sandbox-env.sh +174 -0
- package/scripts/setup-v2-config.mjs +1703 -0
- package/scripts/setup.mjs +415 -0
- package/scripts/sync-tui.mjs +9 -1
- package/scripts/test-opencode-v2-sandbox.sh +438 -151
- package/scripts/update-skills-lock.mjs +30 -0
- package/skills-lock.json +10 -10
- package/src/agents/aphrodite.md +5 -2
- package/src/agents/apollo.md +5 -0
- package/src/agents/athena.md +6 -1
- package/src/agents/demeter.md +5 -1
- package/src/agents/gaia.md +4 -0
- package/src/agents/hephaestus.md +6 -1
- package/src/agents/hermes.md +6 -3
- package/src/agents/iris.md +5 -1
- package/src/agents/mnemosyne.md +20 -50
- package/src/agents/nyx.md +5 -1
- package/src/agents/prometheus.md +4 -0
- package/src/agents/talos.md +4 -0
- package/src/agents/themis.md +4 -0
- package/src/agents/zeus.md +9 -3
- package/src/instructions/agent-return-format.instructions.md +1 -1
- package/src/instructions/memory-protocol.instructions.md +3 -3
- package/src/instructions/test-economy.instructions.md +6 -6
- package/src/mcp/pantheon_vision.py +37 -36
- package/src/mcp/requirements-mcp.txt +1 -1
- package/src/mcp/requirements-vision.txt +1 -1
- package/src/pantheon/cost-command.ts +127 -40
- package/src/pantheon/delegation-enforce.ts +160 -23
- package/src/pantheon/guard-path.ts +162 -0
- package/src/pantheon/v2-bounded-read.ts +15 -1
- package/src/pantheon/v2-bridge.ts +27 -0
- package/src/pantheon/v2-shell-hooks.ts +260 -0
- package/src/pantheon/v2-unsupported.mjs +32 -4
- package/src/pantheon/v2-vision.ts +34 -29
- package/src/pantheon/vision.ts +49 -11
- package/src/plugin-v2.ts +413 -60
- package/src/plugin.ts +22 -2
- package/src/plugins/tui/dist/quota-adapters.d.ts +89 -0
- package/src/plugins/tui/dist/quota-adapters.d.ts.map +1 -0
- package/src/plugins/tui/dist/quota-adapters.js +1142 -0
- package/src/plugins/tui/dist/quota-adapters.js.map +1 -0
- package/src/plugins/tui/dist/quota-cli.d.ts +17 -0
- package/src/plugins/tui/dist/quota-cli.d.ts.map +1 -0
- package/src/plugins/tui/dist/quota-cli.js +184 -0
- package/src/plugins/tui/dist/quota-cli.js.map +1 -0
- package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js +390 -0
- package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js.map +1 -0
- package/src/plugins/tui/dist/server-v2.d.ts +14 -0
- package/src/plugins/tui/dist/server-v2.d.ts.map +1 -0
- package/src/plugins/tui/dist/server-v2.js +673 -0
- package/src/plugins/tui/dist/server-v2.js.map +1 -0
- package/src/plugins/tui/dist/tui-v2.d.ts +247 -52
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +2492 -529
- package/src/plugins/tui/dist/tui-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/index-v2.ts +3 -6
- package/src/plugins/tui/package-lock.json +11 -11
- package/src/plugins/tui/package.json +6 -4
- package/src/plugins/tui/src/context-gauge.ts +59 -0
- package/src/plugins/tui/src/go-key-diagnostic-ui.ts +100 -0
- package/src/plugins/tui/src/go-key-diagnostic.ts +125 -0
- package/src/plugins/tui/src/index-v2.tsx +199 -240
- package/src/plugins/tui/src/model-usage-limits.ts +4 -0
- package/src/plugins/tui/src/quota-adapters.ts +1598 -0
- package/src/plugins/tui/src/quota-cli.ts +237 -0
- package/src/plugins/tui/src/quota-rpc.ts +209 -0
- package/src/plugins/tui/src/quota-v2-model.ts +1032 -0
- package/src/plugins/tui/src/quota-v2.tsx +986 -0
- package/src/plugins/tui/src/server-v2.ts +841 -0
- package/src/plugins/tui/src/sidebar-width.ts +129 -0
- package/src/plugins/tui/tsconfig.typecheck.json +1 -1
- package/src/plugins/tui/tsdown.config.ts +8 -1
- package/src/routing.yml +72 -13
- package/src/skills/README.md +4 -0
- package/src/skills/agent-coordination/SKILL.md +0 -3
- package/src/skills/artifact-management/SKILL.md +0 -3
- package/src/skills/auto-continue/SKILL.md +0 -3
- package/src/skills/code-review-checklist/SKILL.md +0 -3
- package/src/skills/context-compression/SKILL.md +0 -3
- package/src/skills/memory-bank/SKILL.md +6 -28
- package/src/skills/session-goal/SKILL.md +0 -3
- package/src/skills/simplify/SKILL.md +5 -4
- package/src/skills/tdd-with-agents/SKILL.md +0 -3
- package/src/skills/visual-review-pipeline/SKILL.md +0 -1
- package/src/pantheon/memory-context.ts +0 -1017
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as quotaRpc, t as QUOTA_PROVIDER_IDS } from "./quota-rpc-UL2HuFRJ.js";
|
|
1
2
|
import { createComponent, createElement, createTextNode, effect, insert, insertNode, memo, setProp } from "@opentui/solid";
|
|
2
3
|
import { readFile } from "node:fs/promises";
|
|
3
4
|
import { homedir } from "node:os";
|
|
@@ -5,6 +6,2053 @@ import { join } from "node:path";
|
|
|
5
6
|
import { For, Show, createEffect, createMemo, createSignal, on, onCleanup, onMount } from "solid-js";
|
|
6
7
|
import { execFile } from "node:child_process";
|
|
7
8
|
import { Plugin } from "@opencode/plugin/tui";
|
|
9
|
+
//#region src/context-gauge.ts
|
|
10
|
+
const CONTEXT_BAR_CELLS = 12;
|
|
11
|
+
const CONTEXT_BAR_FILLED_CELL = "▰";
|
|
12
|
+
const CONTEXT_BAR_EMPTY_CELL = "▱";
|
|
13
|
+
function numberOrNull$1(value) {
|
|
14
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
15
|
+
}
|
|
16
|
+
function contextUsageTone(percent) {
|
|
17
|
+
if (percent > 90) return "error";
|
|
18
|
+
if (percent > 50) return "warning";
|
|
19
|
+
if (percent > 25) return "success";
|
|
20
|
+
return "info";
|
|
21
|
+
}
|
|
22
|
+
function formatTokenCount(tokens) {
|
|
23
|
+
const value = numberOrNull$1(tokens);
|
|
24
|
+
if (value === null || value < 0) return null;
|
|
25
|
+
return Math.round(value).toLocaleString("en-US");
|
|
26
|
+
}
|
|
27
|
+
function formatContextWindow(limit) {
|
|
28
|
+
const value = numberOrNull$1(limit);
|
|
29
|
+
if (value === null || value <= 0) return null;
|
|
30
|
+
if (value >= 1e6) return `${(value / 1e6).toFixed(1)}M`;
|
|
31
|
+
if (value >= 1e3) return `${Math.floor(value / 1e3)}K`;
|
|
32
|
+
return `${Math.floor(value)}`;
|
|
33
|
+
}
|
|
34
|
+
function contextBarFilled(percent, cells = 12) {
|
|
35
|
+
const total = Math.max(1, Math.floor(cells));
|
|
36
|
+
const filled = Math.round(percent / 100 * total);
|
|
37
|
+
if (!Number.isFinite(filled)) return 0;
|
|
38
|
+
return Math.min(total, Math.max(0, filled));
|
|
39
|
+
}
|
|
40
|
+
function contextBar(percent, cells = 12) {
|
|
41
|
+
const value = numberOrNull$1(percent);
|
|
42
|
+
if (value === null) return null;
|
|
43
|
+
const total = Math.max(1, Math.floor(cells));
|
|
44
|
+
const filled = contextBarFilled(value, total);
|
|
45
|
+
return {
|
|
46
|
+
filled: "▰".repeat(filled),
|
|
47
|
+
empty: "▱".repeat(total - filled)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function formatSpent(cost) {
|
|
51
|
+
const value = numberOrNull$1(cost);
|
|
52
|
+
if (value === null || value < 0) return null;
|
|
53
|
+
return `$${value.toFixed(2)}`;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/model-usage-limits.ts
|
|
57
|
+
/** Shared bounds for cached recent model-usage aggregation. */
|
|
58
|
+
const MODEL_USAGE_VISIBLE_CEILING = 3;
|
|
59
|
+
const MODEL_USAGE_MESSAGE_LIMIT = 400;
|
|
60
|
+
const MODEL_USAGE_SESSION_LIMIT = 8;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/go-key-diagnostic-ui.ts
|
|
63
|
+
const EXPLANATIONS = {
|
|
64
|
+
not_run: "No request was sent. No eligible Go API key was available or the attempt was canceled.",
|
|
65
|
+
already_used: "No request was sent. The one-shot diagnostic was already used in this plugin runtime.",
|
|
66
|
+
success: "HTTP success only; not proof of a stable quota contract or parsed quota correctness.",
|
|
67
|
+
unauthorized: "Request rejected; cause unknown.",
|
|
68
|
+
redirect: "Redirect was not followed.",
|
|
69
|
+
http_error: "HTTP error; cause unknown.",
|
|
70
|
+
timeout: "Request timed out; no retry was made.",
|
|
71
|
+
network_error: "Network error; no retry was made."
|
|
72
|
+
};
|
|
73
|
+
const ERROR_STRUCTURE_EXPLANATIONS = {
|
|
74
|
+
present: "erro estruturado presente",
|
|
75
|
+
absent: "erro estruturado não detectado",
|
|
76
|
+
unavailable: "não foi possível inspecionar"
|
|
77
|
+
};
|
|
78
|
+
/** Treat RPC data as untrusted: only render allowlisted categories and coarse metadata. */
|
|
79
|
+
function resultMessage(value) {
|
|
80
|
+
if (!value || typeof value !== "object" || !("category" in value)) return "Diagnostic result unavailable. Request outcome unknown; no automatic retry.";
|
|
81
|
+
const category = value.category;
|
|
82
|
+
if (typeof category !== "string" || !Object.hasOwn(EXPLANATIONS, category)) return "Diagnostic result unavailable. Request outcome unknown; no automatic retry.";
|
|
83
|
+
return `${category}${"status" in value && typeof value.status === "number" && Number.isInteger(value.status) && value.status >= 100 && value.status <= 599 ? ` · HTTP ${value.status}` : ""}${"content_type" in value && typeof value.content_type === "string" && [
|
|
84
|
+
"application/json",
|
|
85
|
+
"text/plain",
|
|
86
|
+
"text/html",
|
|
87
|
+
"other",
|
|
88
|
+
"missing"
|
|
89
|
+
].includes(value.content_type) ? ` · content type: ${value.content_type}` : ""}${category === "unauthorized" && "status" in value && value.status === 401 && "error_structure" in value && typeof value.error_structure === "string" && Object.hasOwn(ERROR_STRUCTURE_EXPLANATIONS, value.error_structure) ? ` · ${ERROR_STRUCTURE_EXPLANATIONS[value.error_structure]}` : ""}\n${EXPLANATIONS[category]}`;
|
|
90
|
+
}
|
|
91
|
+
/** Native keyboard-accessible dialogs; never invoked by quota refresh or panel mounting. */
|
|
92
|
+
function quotaGoCheckCommand(context) {
|
|
93
|
+
let active = false;
|
|
94
|
+
return {
|
|
95
|
+
id: "pantheon.quota.go-check",
|
|
96
|
+
title: "Pantheon: Go API-key check (one-shot)",
|
|
97
|
+
description: "Manual diagnostic with confirmation; not a quota refresh",
|
|
98
|
+
group: "Pantheon",
|
|
99
|
+
palette: true,
|
|
100
|
+
slash: { name: "quota-go-check" },
|
|
101
|
+
run: async () => {
|
|
102
|
+
if (active) return;
|
|
103
|
+
active = true;
|
|
104
|
+
try {
|
|
105
|
+
if (await context.ui.dialog.confirm({
|
|
106
|
+
title: "Go API-key diagnostic — send once?",
|
|
107
|
+
message: "Send one GET to https://opencode.ai/zen/go/v1/usage using the configured Go API key once? OAuth is not used. No request body, redirects, or retries. Only HTTP 401 bodies are inspected (up to 4096 bytes) for a top-level JSON error property; no error values or response details are shown. Rejection cause remains unknown. 5-second timeout. One attempt per plugin runtime, including failed or unavailable-key attempts. This does not refresh quota.",
|
|
108
|
+
label: {
|
|
109
|
+
confirm: "Send once",
|
|
110
|
+
cancel: "Cancel (no request)"
|
|
111
|
+
}
|
|
112
|
+
}) !== true) return;
|
|
113
|
+
let message;
|
|
114
|
+
try {
|
|
115
|
+
message = resultMessage(await context.client.rpc(quotaRpc).go_key_diagnostic({}, { location: context.location ?? context.data.location.default() }));
|
|
116
|
+
} catch {
|
|
117
|
+
message = "Diagnostic result unavailable. Request outcome unknown; no automatic retry.";
|
|
118
|
+
}
|
|
119
|
+
await context.ui.dialog.alert({
|
|
120
|
+
title: "Go API-key diagnostic",
|
|
121
|
+
message
|
|
122
|
+
});
|
|
123
|
+
} finally {
|
|
124
|
+
active = false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/quota-v2-model.ts
|
|
131
|
+
const DEFAULT_QUOTA_PREFERENCES = {
|
|
132
|
+
enabled: true,
|
|
133
|
+
display: "remaining"
|
|
134
|
+
};
|
|
135
|
+
const QUOTA_CLOCK_INTERVAL_MS = 6e4;
|
|
136
|
+
/** Create a shared local clock for countdown displays; it never refreshes quota data. */
|
|
137
|
+
function createQuotaClock(options = {}) {
|
|
138
|
+
const now = options.now ?? Date.now;
|
|
139
|
+
const schedule = options.setInterval ?? globalThis.setInterval;
|
|
140
|
+
const cancel = options.clearInterval ?? globalThis.clearInterval;
|
|
141
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
142
|
+
let timer;
|
|
143
|
+
const notify = () => {
|
|
144
|
+
const currentTime = now();
|
|
145
|
+
for (const listener of [...listeners]) listener(currentTime);
|
|
146
|
+
};
|
|
147
|
+
return { subscribe(listener) {
|
|
148
|
+
listeners.add(listener);
|
|
149
|
+
if (timer === void 0) {
|
|
150
|
+
timer = schedule(notify, QUOTA_CLOCK_INTERVAL_MS);
|
|
151
|
+
timer.unref?.();
|
|
152
|
+
}
|
|
153
|
+
listener(now());
|
|
154
|
+
let subscribed = true;
|
|
155
|
+
return () => {
|
|
156
|
+
if (!subscribed) return;
|
|
157
|
+
subscribed = false;
|
|
158
|
+
listeners.delete(listener);
|
|
159
|
+
if (listeners.size === 0 && timer !== void 0) {
|
|
160
|
+
cancel(timer);
|
|
161
|
+
timer = void 0;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
} };
|
|
165
|
+
}
|
|
166
|
+
/** Module-local clock shared by all countdown consumers in the TUI bundle. */
|
|
167
|
+
const quotaClock = createQuotaClock();
|
|
168
|
+
/** Format a provider-reported reset timestamp using the caller's local clock. */
|
|
169
|
+
function formatQuotaCountdown(resetsAt, now) {
|
|
170
|
+
if (resetsAt === void 0 || !Number.isFinite(resetsAt) || !Number.isFinite(now)) return;
|
|
171
|
+
const remainingMs = resetsAt - now;
|
|
172
|
+
if (remainingMs <= 0) return null;
|
|
173
|
+
if (remainingMs < 6e4) return "<1m";
|
|
174
|
+
const remainingMinutes = Math.ceil(remainingMs / 6e4);
|
|
175
|
+
const days = Math.floor(remainingMinutes / 1440);
|
|
176
|
+
if (days > 0) {
|
|
177
|
+
const hours = Math.floor(remainingMinutes % 1440 / 60);
|
|
178
|
+
return hours > 0 ? `${days}d ${hours}h` : `${days}d`;
|
|
179
|
+
}
|
|
180
|
+
const hours = Math.floor(remainingMinutes / 60);
|
|
181
|
+
if (hours > 0) {
|
|
182
|
+
const minutes = remainingMinutes % 60;
|
|
183
|
+
return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`;
|
|
184
|
+
}
|
|
185
|
+
return `${remainingMinutes}m`;
|
|
186
|
+
}
|
|
187
|
+
const SETTINGS_KEY = "pantheon.quota.preferences.v1";
|
|
188
|
+
const SNAPSHOT_KEY = "pantheon.quota.live.v1";
|
|
189
|
+
const REFRESH_INTERVAL_MS = 6e4;
|
|
190
|
+
const QUOTA_PROVIDER_ID_SET = new Set(QUOTA_PROVIDER_IDS);
|
|
191
|
+
const INITIAL_SNAPSHOT = {
|
|
192
|
+
status: "loading",
|
|
193
|
+
providers: [],
|
|
194
|
+
details: [],
|
|
195
|
+
updatedAt: null
|
|
196
|
+
};
|
|
197
|
+
function asRecord(value) {
|
|
198
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
199
|
+
}
|
|
200
|
+
function modelID(ref) {
|
|
201
|
+
const record = asRecord(ref);
|
|
202
|
+
const id = typeof ref === "string" ? ref : record?.id ?? record?.modelID;
|
|
203
|
+
return typeof id === "string" && id.trim() !== "" ? id : null;
|
|
204
|
+
}
|
|
205
|
+
function messageModelRef(message) {
|
|
206
|
+
return message.model ?? message;
|
|
207
|
+
}
|
|
208
|
+
function modelProvider(ref, models) {
|
|
209
|
+
const direct = asRecord(ref)?.providerID;
|
|
210
|
+
if (typeof direct === "string" && direct.trim() !== "") return direct.trim();
|
|
211
|
+
const id = modelID(ref);
|
|
212
|
+
if (id === null) return null;
|
|
213
|
+
const segment = id.slice(id.lastIndexOf("/") + 1);
|
|
214
|
+
const providers = /* @__PURE__ */ new Set();
|
|
215
|
+
for (const candidate of models) {
|
|
216
|
+
const item = asRecord(candidate);
|
|
217
|
+
if (!item) continue;
|
|
218
|
+
if (item.id !== id && item.modelID !== id && item.id !== segment && item.modelID !== segment) continue;
|
|
219
|
+
if (typeof item.providerID === "string" && item.providerID.trim() !== "") providers.add(item.providerID.trim());
|
|
220
|
+
}
|
|
221
|
+
const explicitProvider = id.includes("/") ? id.slice(0, id.indexOf("/")) : null;
|
|
222
|
+
if (explicitProvider && providers.has(explicitProvider)) return explicitProvider;
|
|
223
|
+
return providers.size === 1 ? [...providers][0] ?? null : null;
|
|
224
|
+
}
|
|
225
|
+
function modelIdentity(ref, models) {
|
|
226
|
+
const id = modelID(ref);
|
|
227
|
+
if (id === null) return null;
|
|
228
|
+
const providerID = modelProvider(ref, models);
|
|
229
|
+
const segment = id.slice(id.lastIndexOf("/") + 1);
|
|
230
|
+
return {
|
|
231
|
+
key: `${providerID ?? ""}\u0000${id}`,
|
|
232
|
+
id,
|
|
233
|
+
providerID,
|
|
234
|
+
label: segment || id
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function tokenCount(message) {
|
|
238
|
+
const tokens = asRecord(message.tokens);
|
|
239
|
+
if (!tokens) return null;
|
|
240
|
+
const cache = asRecord(tokens.cache);
|
|
241
|
+
const reported = [
|
|
242
|
+
tokens.input,
|
|
243
|
+
tokens.output,
|
|
244
|
+
tokens.reasoning,
|
|
245
|
+
cache?.read,
|
|
246
|
+
cache?.write
|
|
247
|
+
].filter((value) => typeof value === "number" && Number.isFinite(value) && value >= 0);
|
|
248
|
+
return reported.length === 0 ? null : reported.reduce((sum, value) => sum + value, 0);
|
|
249
|
+
}
|
|
250
|
+
function validCost(message) {
|
|
251
|
+
const cost = message.cost;
|
|
252
|
+
return typeof cost === "number" && Number.isFinite(cost) && cost >= 0 ? cost : null;
|
|
253
|
+
}
|
|
254
|
+
function contextLimit(ref, models) {
|
|
255
|
+
const id = modelID(ref);
|
|
256
|
+
if (id === null) return null;
|
|
257
|
+
const providerID = modelProvider(ref, models);
|
|
258
|
+
if (providerID === null) return null;
|
|
259
|
+
const segment = id.slice(id.lastIndexOf("/") + 1);
|
|
260
|
+
const matches = models.filter((value) => {
|
|
261
|
+
const model = asRecord(value);
|
|
262
|
+
if (!model) return false;
|
|
263
|
+
return (model.id === id || model.modelID === id || model.id === segment || model.modelID === segment) && model.providerID === providerID;
|
|
264
|
+
});
|
|
265
|
+
const limits = /* @__PURE__ */ new Set();
|
|
266
|
+
for (const candidate of matches) {
|
|
267
|
+
const limit = asRecord(asRecord(candidate)?.limit)?.context;
|
|
268
|
+
if (typeof limit === "number" && Number.isFinite(limit) && limit > 0) limits.add(limit);
|
|
269
|
+
}
|
|
270
|
+
return limits.size === 1 ? [...limits][0] ?? null : null;
|
|
271
|
+
}
|
|
272
|
+
function liveTranscriptWindow(messages, revertMessageID) {
|
|
273
|
+
let end = messages.length;
|
|
274
|
+
if (revertMessageID) {
|
|
275
|
+
const boundary = messages.findIndex((message) => asRecord(message)?.id === revertMessageID);
|
|
276
|
+
if (boundary >= 0) end = boundary;
|
|
277
|
+
}
|
|
278
|
+
let start = 0;
|
|
279
|
+
for (let index = end - 1; index >= 0; index -= 1) if (asRecord(messages[index])?.type === "compaction") {
|
|
280
|
+
start = index + 1;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
return {
|
|
284
|
+
start,
|
|
285
|
+
end
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function latestContext(messages, modelRef, models, revertMessageID) {
|
|
289
|
+
const target = modelIdentity(modelRef, models);
|
|
290
|
+
if (target === null || target.providerID === null) return null;
|
|
291
|
+
const limit = contextLimit(modelRef, models);
|
|
292
|
+
if (limit === null || limit <= 0) return null;
|
|
293
|
+
const { start, end } = liveTranscriptWindow(messages, revertMessageID);
|
|
294
|
+
for (let index = end - 1; index >= start; index -= 1) {
|
|
295
|
+
const message = asRecord(messages[index]);
|
|
296
|
+
if (message?.type !== "assistant") continue;
|
|
297
|
+
const identity = modelIdentity(messageModelRef(message), models);
|
|
298
|
+
if (identity?.id !== target.id || identity.providerID !== target.providerID) continue;
|
|
299
|
+
const tokens = tokenCount(message);
|
|
300
|
+
if (tokens === null || tokens <= 0) continue;
|
|
301
|
+
return {
|
|
302
|
+
tokens,
|
|
303
|
+
percent: Math.round(tokens / limit * 100),
|
|
304
|
+
limit
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
/** Snapshot for one exact model identity in the bounded active transcript. */
|
|
310
|
+
function resolveModelContextSnapshot(messages, modelRef, models, revertMessageID) {
|
|
311
|
+
return latestContext(messages.slice(-400), modelRef, models, revertMessageID);
|
|
312
|
+
}
|
|
313
|
+
/** Select the pinned chat model before transcript or configured-agent fallbacks. */
|
|
314
|
+
function resolveActiveModelRef(sessionModel, activeMessages, fallbackModel = null) {
|
|
315
|
+
if (modelID(sessionModel) !== null) return sessionModel;
|
|
316
|
+
const firstMessage = Math.max(0, activeMessages.length - 400);
|
|
317
|
+
for (let index = activeMessages.length - 1; index >= firstMessage; index -= 1) {
|
|
318
|
+
const message = asRecord(activeMessages[index]);
|
|
319
|
+
if (message?.type !== "assistant") continue;
|
|
320
|
+
const ref = messageModelRef(message);
|
|
321
|
+
if (modelID(ref) !== null) return ref;
|
|
322
|
+
}
|
|
323
|
+
return modelID(fallbackModel) === null ? null : fallbackModel;
|
|
324
|
+
}
|
|
325
|
+
/** Pin the active chat first, then rank two distinct models by summed reported
|
|
326
|
+
* tokens from the already-cached, bounded session-family messages. */
|
|
327
|
+
function collectRecentModelUsageRows(input) {
|
|
328
|
+
const models = Array.isArray(input.models) ? input.models : [];
|
|
329
|
+
const activeMessages = input.activeMessages.slice(-400);
|
|
330
|
+
const contextSessions = input.usageSessions ? input.usageSessions.map((session) => ({
|
|
331
|
+
...session,
|
|
332
|
+
messages: session.messages.slice(-400)
|
|
333
|
+
})) : [{
|
|
334
|
+
messages: input.usageMessages.slice(-400),
|
|
335
|
+
revertMessageID: null
|
|
336
|
+
}];
|
|
337
|
+
const usageMessages = contextSessions.flatMap((session) => session.messages);
|
|
338
|
+
const active = modelIdentity(input.activeModel, models);
|
|
339
|
+
const totals = /* @__PURE__ */ new Map();
|
|
340
|
+
for (const value of usageMessages) {
|
|
341
|
+
const message = asRecord(value);
|
|
342
|
+
if (message?.type !== "assistant") continue;
|
|
343
|
+
const identity = modelIdentity(messageModelRef(message), models);
|
|
344
|
+
if (!identity) continue;
|
|
345
|
+
const current = totals.get(identity.key) ?? {
|
|
346
|
+
identity,
|
|
347
|
+
tokens: null,
|
|
348
|
+
cost: null
|
|
349
|
+
};
|
|
350
|
+
const tokens = tokenCount(message);
|
|
351
|
+
const cost = validCost(message);
|
|
352
|
+
if (tokens !== null) current.tokens = (current.tokens ?? 0) + tokens;
|
|
353
|
+
if (cost !== null) current.cost = (current.cost ?? 0) + cost;
|
|
354
|
+
totals.set(identity.key, current);
|
|
355
|
+
}
|
|
356
|
+
const latestContextMessages = /* @__PURE__ */ new Map();
|
|
357
|
+
let contextIndex = 0;
|
|
358
|
+
for (const session of contextSessions) {
|
|
359
|
+
const messages = session.messages;
|
|
360
|
+
const { start, end } = liveTranscriptWindow(messages, session.revertMessageID);
|
|
361
|
+
for (let index = start; index < end; index += 1) {
|
|
362
|
+
const order = contextIndex;
|
|
363
|
+
contextIndex += 1;
|
|
364
|
+
const message = asRecord(messages[index]);
|
|
365
|
+
if (message?.type !== "assistant" || (tokenCount(message) ?? 0) <= 0) continue;
|
|
366
|
+
const identity = modelIdentity(messageModelRef(message), models);
|
|
367
|
+
if (!identity) continue;
|
|
368
|
+
const time = asRecord(message.time);
|
|
369
|
+
const timestamp = typeof time?.created === "number" && Number.isFinite(time.created) ? time.created : null;
|
|
370
|
+
const current = latestContextMessages.get(identity.key);
|
|
371
|
+
if (current === void 0 || (timestamp !== null && current.timestamp !== null ? timestamp >= current.timestamp : order > current.index)) latestContextMessages.set(identity.key, {
|
|
372
|
+
message,
|
|
373
|
+
timestamp,
|
|
374
|
+
index: order
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
const activeUsage = active === null ? void 0 : totals.get(active.key);
|
|
379
|
+
return [{
|
|
380
|
+
providerID: active?.providerID ?? null,
|
|
381
|
+
modelID: active?.id ?? null,
|
|
382
|
+
label: active?.label ?? "Modelo atual",
|
|
383
|
+
tokens: activeUsage?.tokens ?? null,
|
|
384
|
+
cost: activeUsage?.cost ?? null,
|
|
385
|
+
context: active === null ? null : resolveModelContextSnapshot(activeMessages, input.activeModel, models, input.revertMessageID),
|
|
386
|
+
active: true
|
|
387
|
+
}, ...[...totals.values()].filter((entry) => entry.tokens !== null).filter((entry) => {
|
|
388
|
+
if (!active) return true;
|
|
389
|
+
return !(entry.identity.id === active.id && (entry.identity.providerID === null || active.providerID === null || entry.identity.providerID === active.providerID));
|
|
390
|
+
}).sort((left, right) => (right.tokens ?? 0) - (left.tokens ?? 0) || left.identity.label.localeCompare(right.identity.label) || (left.identity.providerID ?? "").localeCompare(right.identity.providerID ?? "")).slice(0, 2).map((entry) => {
|
|
391
|
+
const latest = latestContextMessages.get(entry.identity.key)?.message;
|
|
392
|
+
const modelRef = latest === void 0 ? void 0 : messageModelRef(latest);
|
|
393
|
+
const context = latest === void 0 ? null : latestContext([latest], modelRef, models);
|
|
394
|
+
return {
|
|
395
|
+
providerID: entry.identity.providerID,
|
|
396
|
+
modelID: entry.identity.id,
|
|
397
|
+
label: entry.identity.label,
|
|
398
|
+
tokens: entry.tokens,
|
|
399
|
+
cost: entry.cost,
|
|
400
|
+
context,
|
|
401
|
+
active: false
|
|
402
|
+
};
|
|
403
|
+
})];
|
|
404
|
+
}
|
|
405
|
+
function normalizeQuotaPreferences(value) {
|
|
406
|
+
const settings = asRecord(value);
|
|
407
|
+
return {
|
|
408
|
+
enabled: typeof settings?.enabled === "boolean" ? settings.enabled : DEFAULT_QUOTA_PREFERENCES.enabled,
|
|
409
|
+
display: settings?.display === "used" ? "used" : "remaining"
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
function providerLabel(id) {
|
|
413
|
+
return id.split(/[._-]+/).filter((part) => part.length > 0).map((part) => `${part.charAt(0).toLocaleUpperCase()}${part.slice(1)}`).join(" ");
|
|
414
|
+
}
|
|
415
|
+
function providerStatus(value) {
|
|
416
|
+
const item = asRecord(value);
|
|
417
|
+
if (typeof item?.provider !== "string" || typeof item.label !== "string" || item.scope !== "account" && item.scope !== "selected_key" && item.scope !== "team" && item.scope !== "session" || item.authentication !== "connected" && item.authentication !== "not_connected" && item.authentication !== "unavailable" || item.state !== "available" && item.state !== "needs_setup" && item.state !== "unavailable" || typeof item.reason !== "string" || item.route_kind !== void 0 && item.route_kind !== "api_key" && item.route_kind !== "console_oauth" && item.route_kind !== "none" && item.route_kind !== "unsupported" || !Array.isArray(item.metrics)) return;
|
|
418
|
+
if (!QUOTA_PROVIDER_ID_SET.has(item.provider)) return void 0;
|
|
419
|
+
return {
|
|
420
|
+
provider: item.provider,
|
|
421
|
+
label: item.label,
|
|
422
|
+
scope: item.scope,
|
|
423
|
+
authentication: item.authentication,
|
|
424
|
+
state: item.state,
|
|
425
|
+
reason: item.reason,
|
|
426
|
+
...item.route_kind === void 0 ? {} : { route_kind: item.route_kind },
|
|
427
|
+
metrics: item.metrics
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function unavailableMessage(reason, provider) {
|
|
431
|
+
if (provider === "opencode-go" && reason === "unauthorized") return "Pedido recusado; uso indisponível. Verifique o Console oficial.";
|
|
432
|
+
if (provider === "opencode-go" && reason === "not_subscribed") return "sem assinatura OpenCode Go nesta conta";
|
|
433
|
+
switch (reason) {
|
|
434
|
+
case "not_connected": return "setup necessário";
|
|
435
|
+
case "unsupported": return "fonte de credencial não suportada";
|
|
436
|
+
case "private_endpoint": return "endpoint privado não validado";
|
|
437
|
+
case "eligibility_unverified": return "elegibilidade da conta não comprovada";
|
|
438
|
+
case "runtime_accounting_unavailable": return "dados de uso do runtime não disponíveis";
|
|
439
|
+
case "cli_identity_unavailable": return "identidade do CLI não validada";
|
|
440
|
+
case "unsupported_credential_method": return "método de autenticação não suportado";
|
|
441
|
+
case "rate_limited": return "limite de consultas; aguarde";
|
|
442
|
+
case "unauthorized": return "credencial rejeitada; reconecte o provedor";
|
|
443
|
+
case "forbidden": return "acesso negado pelo provedor";
|
|
444
|
+
case "timeout": return "tempo limite da consulta";
|
|
445
|
+
case "network_error": return "falha de rede ao consultar";
|
|
446
|
+
case "invalid_response": return "resposta inválida do provedor";
|
|
447
|
+
case "provider_error": return "provedor temporariamente indisponível";
|
|
448
|
+
default: return;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
function metricIsAvailable(metric) {
|
|
452
|
+
switch (metric.kind) {
|
|
453
|
+
case "provider_quota": return Number.isFinite(metric.used) && Number.isFinite(metric.remaining) && metric.unit.trim().length > 0;
|
|
454
|
+
case "balance":
|
|
455
|
+
case "key_usage": return Number.isFinite(metric.amount) && metric.currency.trim().length > 0;
|
|
456
|
+
case "estimate":
|
|
457
|
+
case "session_usage": return Number.isFinite(metric.amount) && metric.unit.trim().length > 0;
|
|
458
|
+
case "provider_status": return metric.status !== "unavailable";
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function providerHasAvailableMetrics(provider) {
|
|
462
|
+
return provider.state === "available" && provider.metrics.some(metricIsAvailable);
|
|
463
|
+
}
|
|
464
|
+
function quotaSnapshotStatusLabel(status, error) {
|
|
465
|
+
switch (status) {
|
|
466
|
+
case "loading": return "Buscando status…";
|
|
467
|
+
case "ready": return "Quota disponível";
|
|
468
|
+
case "partial": return "Dados parciais";
|
|
469
|
+
case "connected_unavailable": return "Credencial local · dados indisponíveis";
|
|
470
|
+
case "needs_setup": return "Nenhum provedor elegível";
|
|
471
|
+
case "unavailable": return error !== void 0 ? `Erro: ${error}` : "Status indisponível";
|
|
472
|
+
case "stale": return "Dados desatualizados";
|
|
473
|
+
case "disabled": return "Desativado";
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Short, UI-safe summary of a failed status request. OpenCode rejects plugin RPC calls
|
|
478
|
+
* with a plain `{ type, message }` object (not an `Error`), so both shapes are handled;
|
|
479
|
+
* `rpc.unavailable` means no server side registered the quota RPC in this run — the
|
|
480
|
+
* historical "Status indisponível" blind spot.
|
|
481
|
+
*/
|
|
482
|
+
function quotaRpcFaultMessage(error) {
|
|
483
|
+
const message = error instanceof Error ? error.message : typeof error === "object" && error !== null && "message" in error ? String(error.message) : String(error);
|
|
484
|
+
const type = typeof error === "object" && error !== null ? error.type : void 0;
|
|
485
|
+
const cleaned = message.trim().replace(/^Error:\s*/i, "");
|
|
486
|
+
if (type === "rpc.unavailable" || cleaned === "rpc.unavailable") return "rpc de quota indisponível no servidor";
|
|
487
|
+
if (cleaned.length === 0) return "erro desconhecido na consulta de quota";
|
|
488
|
+
return cleaned.length > 80 ? `${cleaned.slice(0, 79)}…` : cleaned;
|
|
489
|
+
}
|
|
490
|
+
/** Map the current typed RPC status into a provider-neutral, data-only UI model. */
|
|
491
|
+
function quotaSnapshotFromStatus(response, now = Date.now()) {
|
|
492
|
+
const statusResponse = asRecord(response);
|
|
493
|
+
const credentialResolutionFailed = statusResponse?.credential_resolution_failed === true;
|
|
494
|
+
const providersValue = statusResponse?.providers;
|
|
495
|
+
const providerList = Array.isArray(providersValue) ? providersValue : void 0;
|
|
496
|
+
const statuses = providerList ? providerList.map(providerStatus).filter((item) => item !== void 0) : [];
|
|
497
|
+
const connected = statuses.filter((item) => item.authentication === "connected");
|
|
498
|
+
const availableConnected = connected.filter(providerHasAvailableMetrics);
|
|
499
|
+
const status = credentialResolutionFailed ? connected.length > 0 ? availableConnected.length > 0 ? "partial" : "connected_unavailable" : "unavailable" : connected.length > 0 ? availableConnected.length === connected.length ? "ready" : availableConnected.length > 0 ? "partial" : "connected_unavailable" : statuses.length === 0 && providerList?.length !== 0 || statuses.some((item) => item.authentication === "unavailable") ? "unavailable" : "needs_setup";
|
|
500
|
+
const details = statuses.map((item) => {
|
|
501
|
+
const hasMetrics = item.authentication === "connected" && providerHasAvailableMetrics(item);
|
|
502
|
+
const message = unavailableMessage(item.reason, item.provider) ?? (item.authentication === "connected" && !hasMetrics ? "dados de quota indisponíveis" : void 0);
|
|
503
|
+
return {
|
|
504
|
+
id: item.provider,
|
|
505
|
+
label: item.label || providerLabel(item.provider),
|
|
506
|
+
authentication: item.authentication,
|
|
507
|
+
state: item.authentication === "not_connected" ? "needs_setup" : hasMetrics ? "available" : "unavailable",
|
|
508
|
+
...message === void 0 ? {} : { message },
|
|
509
|
+
metrics: item.metrics
|
|
510
|
+
};
|
|
511
|
+
});
|
|
512
|
+
return {
|
|
513
|
+
status,
|
|
514
|
+
providers: connected.map((item) => {
|
|
515
|
+
const hasMetrics = providerHasAvailableMetrics(item);
|
|
516
|
+
const message = unavailableMessage(item.reason, item.provider) ?? (!hasMetrics ? "dados de quota indisponíveis" : void 0);
|
|
517
|
+
return {
|
|
518
|
+
id: item.provider,
|
|
519
|
+
label: item.label || providerLabel(item.provider),
|
|
520
|
+
quotaState: hasMetrics ? "available" : "unavailable",
|
|
521
|
+
...message === void 0 ? {} : { message },
|
|
522
|
+
metrics: item.metrics
|
|
523
|
+
};
|
|
524
|
+
}),
|
|
525
|
+
details,
|
|
526
|
+
...status === "unavailable" && credentialResolutionFailed ? { error: "resolução de credenciais falhou no servidor" } : {},
|
|
527
|
+
updatedAt: now
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
function numeric(value) {
|
|
531
|
+
if (!Number.isFinite(value)) return void 0;
|
|
532
|
+
return new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 }).format(value);
|
|
533
|
+
}
|
|
534
|
+
function amount(value, unit) {
|
|
535
|
+
const formatted = numeric(value);
|
|
536
|
+
const safeUnit = unit.trim();
|
|
537
|
+
return formatted && safeUnit ? `${formatted} ${safeUnit}` : void 0;
|
|
538
|
+
}
|
|
539
|
+
/** Return complementary whole percentages only when both quota values define a real range. */
|
|
540
|
+
function quotaProgress(metric) {
|
|
541
|
+
if (!Number.isFinite(metric.used) || !Number.isFinite(metric.remaining) || metric.used < 0 || metric.remaining < 0) return;
|
|
542
|
+
const total = metric.used + metric.remaining;
|
|
543
|
+
if (!Number.isFinite(total) || total <= 0) return void 0;
|
|
544
|
+
const usedPercent = Math.round(metric.used / total * 100);
|
|
545
|
+
return {
|
|
546
|
+
usedPercent,
|
|
547
|
+
remainingPercent: 100 - usedPercent
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
/** Connected-provider rows for the compact sidebar; only reported quota windows become gauges. */
|
|
551
|
+
function quotaSidebarEntries(snapshot) {
|
|
552
|
+
const entries = [];
|
|
553
|
+
for (const provider of snapshot.providers) {
|
|
554
|
+
let quotaCount = 0;
|
|
555
|
+
let hasQuotaMetric = false;
|
|
556
|
+
provider.metrics.forEach((metric, index) => {
|
|
557
|
+
if (metric.kind !== "provider_quota") return;
|
|
558
|
+
hasQuotaMetric = true;
|
|
559
|
+
if (metric.unit.trim() === "") return;
|
|
560
|
+
const progress = quotaProgress(metric);
|
|
561
|
+
if (!progress) return;
|
|
562
|
+
quotaCount += 1;
|
|
563
|
+
entries.push({
|
|
564
|
+
kind: "quota",
|
|
565
|
+
key: `${provider.id}:quota:${index}`,
|
|
566
|
+
providerID: provider.id,
|
|
567
|
+
providerLabel: provider.label,
|
|
568
|
+
metric,
|
|
569
|
+
progress
|
|
570
|
+
});
|
|
571
|
+
});
|
|
572
|
+
if (quotaCount === 0 && (provider.quotaState === "unavailable" || hasQuotaMetric)) entries.push({
|
|
573
|
+
kind: "status",
|
|
574
|
+
key: `${provider.id}:status`,
|
|
575
|
+
providerID: provider.id,
|
|
576
|
+
providerLabel: provider.label,
|
|
577
|
+
message: provider.message ?? "dados de quota indisponíveis"
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
return entries;
|
|
581
|
+
}
|
|
582
|
+
/** Render each measurement with its source/category label; no category is inferred. */
|
|
583
|
+
function formatQuotaMetric(metric, display) {
|
|
584
|
+
switch (metric.kind) {
|
|
585
|
+
case "provider_quota": {
|
|
586
|
+
const used = amount(metric.used, metric.unit);
|
|
587
|
+
const remaining = amount(metric.remaining, metric.unit);
|
|
588
|
+
if (!used || !remaining) return void 0;
|
|
589
|
+
const label = metric.label ?? "Quota do provedor";
|
|
590
|
+
const period = metric.period ? ` · ${metric.period}` : "";
|
|
591
|
+
return display === "remaining" ? `${label} · restante ${remaining} · usado ${used}${period}` : `${label} · usado ${used} · restante ${remaining}${period}`;
|
|
592
|
+
}
|
|
593
|
+
case "balance": {
|
|
594
|
+
const balance = amount(metric.amount, metric.currency);
|
|
595
|
+
if (!balance) return void 0;
|
|
596
|
+
const status = metric.status?.trim();
|
|
597
|
+
return `${metric.label ?? "Saldo"} · ${balance}${status ? ` · ${status}` : ""}`;
|
|
598
|
+
}
|
|
599
|
+
case "estimate": {
|
|
600
|
+
const estimate = amount(metric.amount, metric.unit);
|
|
601
|
+
return estimate ? `${metric.label ?? "Estimativa"} · ${estimate}` : void 0;
|
|
602
|
+
}
|
|
603
|
+
case "key_usage": {
|
|
604
|
+
const usage = amount(metric.amount, metric.currency);
|
|
605
|
+
const period = metric.period ? ` · ${metric.period}` : "";
|
|
606
|
+
return usage ? `${metric.label ?? "Uso da chave"} · ${usage}${period}` : void 0;
|
|
607
|
+
}
|
|
608
|
+
case "provider_status": return `${metric.label} · ${metric.status}`;
|
|
609
|
+
case "session_usage": {
|
|
610
|
+
const usage = amount(metric.amount, metric.unit);
|
|
611
|
+
return usage ? `${metric.label ?? "Uso da sessão"} · ${usage}` : void 0;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
/** Compact one-value summary for the footer; quota display follows the setting. */
|
|
616
|
+
function compactQuotaMetric(metric, display) {
|
|
617
|
+
switch (metric.kind) {
|
|
618
|
+
case "provider_quota": {
|
|
619
|
+
const formatted = amount(display === "remaining" ? metric.remaining : metric.used, metric.unit);
|
|
620
|
+
return formatted ? `${metric.label ?? (display === "remaining" ? "restante" : "usado")} ${formatted}` : void 0;
|
|
621
|
+
}
|
|
622
|
+
case "balance": {
|
|
623
|
+
const formatted = amount(metric.amount, metric.currency);
|
|
624
|
+
return formatted ? `${metric.label ?? "saldo"} ${formatted}` : void 0;
|
|
625
|
+
}
|
|
626
|
+
case "estimate": {
|
|
627
|
+
const formatted = amount(metric.amount, metric.unit);
|
|
628
|
+
return formatted ? `${metric.label ?? "estimativa"} ${formatted}` : void 0;
|
|
629
|
+
}
|
|
630
|
+
case "key_usage": {
|
|
631
|
+
const formatted = amount(metric.amount, metric.currency);
|
|
632
|
+
return formatted ? `${metric.label ?? "uso da chave"} ${formatted}` : void 0;
|
|
633
|
+
}
|
|
634
|
+
case "provider_status": return `${metric.label} ${metric.status}`;
|
|
635
|
+
case "session_usage": {
|
|
636
|
+
const formatted = amount(metric.amount, metric.unit);
|
|
637
|
+
return formatted ? `${metric.label ?? "sessão"} ${formatted}` : void 0;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
/** One storage-backed source of truth for all quota TUI surfaces. */
|
|
642
|
+
function createQuotaRuntime(context) {
|
|
643
|
+
const [settings, persistSettings] = context.storage.store(SETTINGS_KEY, { initial: { ...DEFAULT_QUOTA_PREFERENCES } });
|
|
644
|
+
const [snapshot, setSnapshot] = context.storage.memory(SNAPSHOT_KEY, { initial: {
|
|
645
|
+
...INITIAL_SNAPSHOT,
|
|
646
|
+
providers: []
|
|
647
|
+
} });
|
|
648
|
+
const client = context.client.rpc(quotaRpc);
|
|
649
|
+
let unsubscribeCredentialChanges;
|
|
650
|
+
let requestController;
|
|
651
|
+
let refreshTimer;
|
|
652
|
+
let requestVersion = 0;
|
|
653
|
+
let disposed = false;
|
|
654
|
+
const preferences = () => normalizeQuotaPreferences({
|
|
655
|
+
enabled: settings.enabled,
|
|
656
|
+
display: settings.display
|
|
657
|
+
});
|
|
658
|
+
const currentSnapshot = () => ({
|
|
659
|
+
status: snapshot.status,
|
|
660
|
+
providers: snapshot.providers,
|
|
661
|
+
details: snapshot.details ?? [],
|
|
662
|
+
updatedAt: snapshot.updatedAt,
|
|
663
|
+
error: snapshot.error
|
|
664
|
+
});
|
|
665
|
+
const updateSnapshot = (next) => {
|
|
666
|
+
setSnapshot((draft) => {
|
|
667
|
+
draft.status = next.status;
|
|
668
|
+
draft.providers = next.providers;
|
|
669
|
+
draft.details = next.details;
|
|
670
|
+
draft.updatedAt = next.updatedAt;
|
|
671
|
+
draft.error = next.error;
|
|
672
|
+
});
|
|
673
|
+
};
|
|
674
|
+
const cancelScheduledRefresh = () => {
|
|
675
|
+
if (refreshTimer) clearTimeout(refreshTimer);
|
|
676
|
+
refreshTimer = void 0;
|
|
677
|
+
};
|
|
678
|
+
const scheduleRefresh = () => {
|
|
679
|
+
cancelScheduledRefresh();
|
|
680
|
+
if (disposed || !preferences().enabled) return;
|
|
681
|
+
refreshTimer = setTimeout(() => {
|
|
682
|
+
refresh();
|
|
683
|
+
}, REFRESH_INTERVAL_MS);
|
|
684
|
+
refreshTimer.unref?.();
|
|
685
|
+
};
|
|
686
|
+
const refresh = async () => {
|
|
687
|
+
if (disposed) return;
|
|
688
|
+
if (!preferences().enabled) {
|
|
689
|
+
updateSnapshot({
|
|
690
|
+
status: "disabled",
|
|
691
|
+
providers: [],
|
|
692
|
+
details: [],
|
|
693
|
+
updatedAt: null
|
|
694
|
+
});
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
requestController?.abort();
|
|
698
|
+
const controller = new AbortController();
|
|
699
|
+
requestController = controller;
|
|
700
|
+
const version = ++requestVersion;
|
|
701
|
+
const previous = currentSnapshot();
|
|
702
|
+
updateSnapshot({
|
|
703
|
+
...previous,
|
|
704
|
+
status: previous.updatedAt === null ? "loading" : "stale"
|
|
705
|
+
});
|
|
706
|
+
try {
|
|
707
|
+
const response = await client.status({}, {
|
|
708
|
+
signal: controller.signal,
|
|
709
|
+
location: context.location ?? context.data.location.default()
|
|
710
|
+
});
|
|
711
|
+
if (!disposed && version === requestVersion) updateSnapshot(quotaSnapshotFromStatus(response));
|
|
712
|
+
} catch (error) {
|
|
713
|
+
if (!disposed && version === requestVersion && !controller.signal.aborted) {
|
|
714
|
+
const fault = quotaRpcFaultMessage(error);
|
|
715
|
+
console.warn(`[pantheon-tui quota] status request failed: ${fault}`);
|
|
716
|
+
updateSnapshot({
|
|
717
|
+
...previous,
|
|
718
|
+
status: previous.updatedAt === null ? "unavailable" : "stale",
|
|
719
|
+
error: fault
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
} finally {
|
|
723
|
+
if (requestController === controller) {
|
|
724
|
+
requestController = void 0;
|
|
725
|
+
scheduleRefresh();
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
const runtime = {
|
|
730
|
+
preferences,
|
|
731
|
+
snapshot: currentSnapshot,
|
|
732
|
+
async toggleEnabled() {
|
|
733
|
+
const enabled = !preferences().enabled;
|
|
734
|
+
if (!enabled) {
|
|
735
|
+
requestVersion += 1;
|
|
736
|
+
requestController?.abort();
|
|
737
|
+
requestController = void 0;
|
|
738
|
+
cancelScheduledRefresh();
|
|
739
|
+
}
|
|
740
|
+
await persistSettings((draft) => {
|
|
741
|
+
draft.enabled = enabled;
|
|
742
|
+
});
|
|
743
|
+
if (enabled) {
|
|
744
|
+
updateSnapshot({
|
|
745
|
+
status: "loading",
|
|
746
|
+
providers: [],
|
|
747
|
+
details: [],
|
|
748
|
+
updatedAt: null
|
|
749
|
+
});
|
|
750
|
+
await refresh();
|
|
751
|
+
} else updateSnapshot({
|
|
752
|
+
status: "disabled",
|
|
753
|
+
providers: [],
|
|
754
|
+
details: [],
|
|
755
|
+
updatedAt: null
|
|
756
|
+
});
|
|
757
|
+
},
|
|
758
|
+
async toggleDisplay() {
|
|
759
|
+
const display = preferences().display === "remaining" ? "used" : "remaining";
|
|
760
|
+
await persistSettings((draft) => {
|
|
761
|
+
draft.display = display;
|
|
762
|
+
});
|
|
763
|
+
},
|
|
764
|
+
refresh,
|
|
765
|
+
dispose() {
|
|
766
|
+
disposed = true;
|
|
767
|
+
requestVersion += 1;
|
|
768
|
+
requestController?.abort();
|
|
769
|
+
requestController = void 0;
|
|
770
|
+
cancelScheduledRefresh();
|
|
771
|
+
unsubscribeCredentialChanges?.();
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
unsubscribeCredentialChanges = client.events?.on("credentials_changed", () => {
|
|
775
|
+
updateSnapshot({
|
|
776
|
+
status: "loading",
|
|
777
|
+
providers: [],
|
|
778
|
+
details: [],
|
|
779
|
+
updatedAt: null
|
|
780
|
+
});
|
|
781
|
+
refresh();
|
|
782
|
+
});
|
|
783
|
+
if (preferences().enabled) {
|
|
784
|
+
updateSnapshot({
|
|
785
|
+
status: "loading",
|
|
786
|
+
providers: [],
|
|
787
|
+
details: [],
|
|
788
|
+
updatedAt: null
|
|
789
|
+
});
|
|
790
|
+
refresh();
|
|
791
|
+
} else updateSnapshot({
|
|
792
|
+
status: "disabled",
|
|
793
|
+
providers: [],
|
|
794
|
+
details: [],
|
|
795
|
+
updatedAt: null
|
|
796
|
+
});
|
|
797
|
+
return runtime;
|
|
798
|
+
}
|
|
799
|
+
//#endregion
|
|
800
|
+
//#region src/sidebar-width.ts
|
|
801
|
+
const GRAPHEMES = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
802
|
+
/** A grapheme the host draws two cells wide: emoji presentation, an extended
|
|
803
|
+
* pictograph (a bare `❤` counts too, exactly as the host's `emoji-regex`
|
|
804
|
+
* does) and a regional-indicator pair (a flag). */
|
|
805
|
+
const EMOJI_GLYPH = /\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{Regional_Indicator}/u;
|
|
806
|
+
/** VS16 asks for emoji presentation; without it `1` is one cell, with it the
|
|
807
|
+
* keycap sequence is drawn as one two-cell glyph. */
|
|
808
|
+
const EMOJI_PRESENTATION_SELECTOR = "️";
|
|
809
|
+
/** Unicode default-ignorable code points carry no width of their own. */
|
|
810
|
+
const IGNORABLE_GLYPH = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
811
|
+
/** East Asian Wide/Fullwidth ranges — two cells, never the ambiguous width
|
|
812
|
+
* (the host measures ambiguous as narrow, so `▸`/`✓`/`—` stay one cell).
|
|
813
|
+
* Generated from the host's own measurement (`string-width` over every code
|
|
814
|
+
* point, emoji excluded), so this table can be regenerated verbatim when the
|
|
815
|
+
* host upgrades its Unicode data instead of being hand-edited. */
|
|
816
|
+
const CELL_WIDE_RANGES = [
|
|
817
|
+
[4352, 4446],
|
|
818
|
+
[9001, 9002],
|
|
819
|
+
[9776, 9783],
|
|
820
|
+
[9866, 9871],
|
|
821
|
+
[11904, 11929],
|
|
822
|
+
[11931, 12019],
|
|
823
|
+
[12032, 12245],
|
|
824
|
+
[12272, 12335],
|
|
825
|
+
[12337, 12348],
|
|
826
|
+
[12350, 12350],
|
|
827
|
+
[12353, 12438],
|
|
828
|
+
[12441, 12543],
|
|
829
|
+
[12549, 12591],
|
|
830
|
+
[12593, 12643],
|
|
831
|
+
[12645, 12686],
|
|
832
|
+
[12688, 12773],
|
|
833
|
+
[12783, 12830],
|
|
834
|
+
[12832, 12871],
|
|
835
|
+
[12880, 12950],
|
|
836
|
+
[12952, 12952],
|
|
837
|
+
[12954, 42124],
|
|
838
|
+
[42128, 42182],
|
|
839
|
+
[43360, 43388],
|
|
840
|
+
[44032, 55203],
|
|
841
|
+
[63744, 64255],
|
|
842
|
+
[65040, 65049],
|
|
843
|
+
[65072, 65106],
|
|
844
|
+
[65108, 65126],
|
|
845
|
+
[65128, 65131],
|
|
846
|
+
[65281, 65376],
|
|
847
|
+
[65504, 65510],
|
|
848
|
+
[94176, 94180],
|
|
849
|
+
[94192, 94198],
|
|
850
|
+
[94208, 101594],
|
|
851
|
+
[101631, 101664],
|
|
852
|
+
[101760, 101874],
|
|
853
|
+
[101888, 102801],
|
|
854
|
+
[102816, 102866],
|
|
855
|
+
[110576, 110579],
|
|
856
|
+
[110581, 110587],
|
|
857
|
+
[110589, 110590],
|
|
858
|
+
[110592, 110888],
|
|
859
|
+
[110898, 110898],
|
|
860
|
+
[110928, 110930],
|
|
861
|
+
[110933, 110933],
|
|
862
|
+
[110948, 110952],
|
|
863
|
+
[110960, 111355],
|
|
864
|
+
[119552, 119638],
|
|
865
|
+
[119648, 119670],
|
|
866
|
+
[127488, 127488],
|
|
867
|
+
[127504, 127513],
|
|
868
|
+
[127515, 127534],
|
|
869
|
+
[127536, 127537],
|
|
870
|
+
[127547, 127547],
|
|
871
|
+
[127552, 127560],
|
|
872
|
+
[127584, 127589],
|
|
873
|
+
[131072, 196605],
|
|
874
|
+
[196608, 262141]
|
|
875
|
+
];
|
|
876
|
+
/** One code point the terminal draws no cell for: control characters, the
|
|
877
|
+
* zero-width joiners/marks, combining marks and variation selectors. */
|
|
878
|
+
function isZeroWidthCodePoint(code, glyph) {
|
|
879
|
+
if (code <= 31 || code >= 127 && code <= 159) return true;
|
|
880
|
+
if (code >= 8203 && code <= 8207) return true;
|
|
881
|
+
if (code === 65279) return true;
|
|
882
|
+
if (code >= 768 && code <= 879) return true;
|
|
883
|
+
if (code >= 6832 && code <= 6911) return true;
|
|
884
|
+
if (code >= 7616 && code <= 7679) return true;
|
|
885
|
+
if (code >= 8400 && code <= 8447) return true;
|
|
886
|
+
if (code >= 65024 && code <= 65039) return true;
|
|
887
|
+
if (code >= 65056 && code <= 65071) return true;
|
|
888
|
+
if (code >= 917760 && code <= 917999) return true;
|
|
889
|
+
if (code >= 55296 && code <= 57343) return true;
|
|
890
|
+
return IGNORABLE_GLYPH.test(glyph);
|
|
891
|
+
}
|
|
892
|
+
function isWideCodePoint(code) {
|
|
893
|
+
for (const [low, high] of CELL_WIDE_RANGES) {
|
|
894
|
+
if (code < low) return false;
|
|
895
|
+
if (code <= high) return true;
|
|
896
|
+
}
|
|
897
|
+
return false;
|
|
898
|
+
}
|
|
899
|
+
/** Cells one grapheme occupies. */
|
|
900
|
+
function graphemeWidth(segment) {
|
|
901
|
+
if (EMOJI_GLYPH.test(segment)) return 2;
|
|
902
|
+
if (segment.length > 1 && segment.includes(EMOJI_PRESENTATION_SELECTOR)) return 2;
|
|
903
|
+
let width = 0;
|
|
904
|
+
for (const glyph of segment) {
|
|
905
|
+
const code = glyph.codePointAt(0) ?? 0;
|
|
906
|
+
if (isZeroWidthCodePoint(code, glyph)) continue;
|
|
907
|
+
width += isWideCodePoint(code) ? 2 : 1;
|
|
908
|
+
}
|
|
909
|
+
return width;
|
|
910
|
+
}
|
|
911
|
+
/** Terminal cells `value` occupies — the unit every column in this plugin is
|
|
912
|
+
* measured in. Mirrors the host (that is how `@opentui/core` sizes a text
|
|
913
|
+
* run): emoji count as two cells, East Asian Wide/Fullwidth as two, East
|
|
914
|
+
* Asian Ambiguous as one, combining marks and variation selectors as none.
|
|
915
|
+
* Pure. */
|
|
916
|
+
function cellWidth(value) {
|
|
917
|
+
let width = 0;
|
|
918
|
+
for (const { segment } of GRAPHEMES.segment(value)) width += graphemeWidth(segment);
|
|
919
|
+
return width;
|
|
920
|
+
}
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region src/quota-v2.tsx
|
|
923
|
+
/** @jsxImportSource @opentui/solid */
|
|
924
|
+
const QUOTA_PANEL_NAME = "pantheon.quota";
|
|
925
|
+
const QUOTA_OPEN_COMMAND_ID = "pantheon.quota.open";
|
|
926
|
+
const QUOTA_ICON = "▥";
|
|
927
|
+
const QUOTA_PANEL_TOAST = "Abra uma sessão para ver os detalhes da quota.";
|
|
928
|
+
const MODEL_USAGE_REFRESH_EVENTS = [
|
|
929
|
+
"session.created",
|
|
930
|
+
"session.renamed",
|
|
931
|
+
"session.metadata.updated",
|
|
932
|
+
"session.moved",
|
|
933
|
+
"session.idle",
|
|
934
|
+
"session.status",
|
|
935
|
+
"session.deleted"
|
|
936
|
+
];
|
|
937
|
+
function base(context) {
|
|
938
|
+
return context.theme.text?.base ?? (context.themeMode === "dark" ? "#ffffff" : "#111111");
|
|
939
|
+
}
|
|
940
|
+
function muted(context) {
|
|
941
|
+
return context.theme.text?.muted ?? base(context);
|
|
942
|
+
}
|
|
943
|
+
function quotaUsageTone(usedPercent) {
|
|
944
|
+
return usedPercent > 85 ? "error" : usedPercent >= 60 ? "warning" : "success";
|
|
945
|
+
}
|
|
946
|
+
function quotaColor(context, usedPercent) {
|
|
947
|
+
return usedPercent === void 0 ? base(context) : tone(context, quotaUsageTone(usedPercent));
|
|
948
|
+
}
|
|
949
|
+
function tone(context, color) {
|
|
950
|
+
return context.theme.text?.feedback?.[color]?.base ?? base(context);
|
|
951
|
+
}
|
|
952
|
+
function snapshotSummary(snapshot, display) {
|
|
953
|
+
if (snapshot.status === "loading") return "carregando status";
|
|
954
|
+
if (snapshot.status !== "ready" && snapshot.status !== "partial") return quotaSnapshotStatusLabel(snapshot.status, snapshot.error).toLowerCase();
|
|
955
|
+
const metrics = snapshot.providers.flatMap((provider) => provider.metrics);
|
|
956
|
+
const metric = metrics.find((item) => item.kind !== "provider_status") ?? metrics[0];
|
|
957
|
+
if (metric) {
|
|
958
|
+
const value = compactQuotaMetric(metric, display) ?? "quota indisponível";
|
|
959
|
+
return snapshot.status === "partial" ? `parcial · ${value}` : value;
|
|
960
|
+
}
|
|
961
|
+
if (snapshot.status === "partial") return "dados parciais";
|
|
962
|
+
if (snapshot.providers[0]?.message) return snapshot.providers[0].message;
|
|
963
|
+
return "quota indisponível";
|
|
964
|
+
}
|
|
965
|
+
function sidebarFinanceEntries(snapshot) {
|
|
966
|
+
return snapshot.providers.flatMap((provider) => provider.metrics.flatMap((metric) => (metric.kind === "balance" || metric.kind === "estimate" || metric.kind === "key_usage") && metricRow(metric) ? [{
|
|
967
|
+
providerID: provider.id,
|
|
968
|
+
metric
|
|
969
|
+
}] : []));
|
|
970
|
+
}
|
|
971
|
+
function QuotaSidebarEntryRow(props) {
|
|
972
|
+
return createComponent(Show, {
|
|
973
|
+
get when() {
|
|
974
|
+
return props.entry.kind === "quota";
|
|
975
|
+
},
|
|
976
|
+
get fallback() {
|
|
977
|
+
return createComponent(For, {
|
|
978
|
+
get each() {
|
|
979
|
+
return memo(() => props.entry.kind === "status")() ? quotaTextLines(props.entry.message, 34, 2) : [];
|
|
980
|
+
},
|
|
981
|
+
children: (line) => (() => {
|
|
982
|
+
var _el$ = createElement("text");
|
|
983
|
+
insert(_el$, line);
|
|
984
|
+
effect((_$p) => setProp(_el$, "fg", muted(props.context), _$p));
|
|
985
|
+
return _el$;
|
|
986
|
+
})()
|
|
987
|
+
});
|
|
988
|
+
},
|
|
989
|
+
get children() {
|
|
990
|
+
return createComponent(For, {
|
|
991
|
+
get each() {
|
|
992
|
+
return memo(() => props.entry.kind === "quota")() ? quotaWindowLines(props.entry.metric, props.display, 34, props.now, true) : [];
|
|
993
|
+
},
|
|
994
|
+
children: (line) => (() => {
|
|
995
|
+
var _el$2 = createElement("text");
|
|
996
|
+
insert(_el$2, line);
|
|
997
|
+
effect((_$p) => setProp(_el$2, "fg", quotaColor(props.context, props.entry.kind === "quota" ? props.entry.progress.usedPercent : void 0), _$p));
|
|
998
|
+
return _el$2;
|
|
999
|
+
})()
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
function QuotaSidebarSummary(props) {
|
|
1005
|
+
const entries = createMemo(() => quotaSidebarEntries(props.runtime.snapshot()));
|
|
1006
|
+
const finance = createMemo(() => sidebarFinanceEntries(props.runtime.snapshot()));
|
|
1007
|
+
const [now, setNow] = createSignal(Date.now());
|
|
1008
|
+
onMount(() => onCleanup(quotaClock.subscribe(setNow)));
|
|
1009
|
+
return createComponent(Show, {
|
|
1010
|
+
get when() {
|
|
1011
|
+
return props.runtime.preferences().enabled;
|
|
1012
|
+
},
|
|
1013
|
+
get children() {
|
|
1014
|
+
var _el$3 = createElement("box"), _el$4 = createElement("text");
|
|
1015
|
+
insertNode(_el$3, _el$4);
|
|
1016
|
+
setProp(_el$3, "flexDirection", "column");
|
|
1017
|
+
setProp(_el$3, "marginTop", 1);
|
|
1018
|
+
insertNode(_el$4, createTextNode(`▥ Pantheon quota`));
|
|
1019
|
+
insert(_el$3, createComponent(Show, {
|
|
1020
|
+
get when() {
|
|
1021
|
+
return props.runtime.snapshot().status !== "ready" || entries().length === 0;
|
|
1022
|
+
},
|
|
1023
|
+
get children() {
|
|
1024
|
+
var _el$6 = createElement("text");
|
|
1025
|
+
insert(_el$6, () => quotaSnapshotStatusLabel(props.runtime.snapshot().status, props.runtime.snapshot().error));
|
|
1026
|
+
effect((_$p) => setProp(_el$6, "fg", muted(props.context), _$p));
|
|
1027
|
+
return _el$6;
|
|
1028
|
+
}
|
|
1029
|
+
}), null);
|
|
1030
|
+
insert(_el$3, createComponent(For, {
|
|
1031
|
+
get each() {
|
|
1032
|
+
return props.runtime.snapshot().providers;
|
|
1033
|
+
},
|
|
1034
|
+
children: (provider) => (() => {
|
|
1035
|
+
var _el$7 = createElement("box");
|
|
1036
|
+
setProp(_el$7, "flexDirection", "column");
|
|
1037
|
+
insert(_el$7, createComponent(Show, {
|
|
1038
|
+
get when() {
|
|
1039
|
+
return entries().some((entry) => entry.providerID === provider.id) || finance().some((entry) => entry.providerID === provider.id) || provider.metrics.some((metric) => metric.kind === "provider_status");
|
|
1040
|
+
},
|
|
1041
|
+
get children() {
|
|
1042
|
+
return createComponent(For, {
|
|
1043
|
+
get each() {
|
|
1044
|
+
return quotaTextLines(provider.label, 34, 0);
|
|
1045
|
+
},
|
|
1046
|
+
children: (line) => (() => {
|
|
1047
|
+
var _el$8 = createElement("text");
|
|
1048
|
+
insert(_el$8, line);
|
|
1049
|
+
effect((_$p) => setProp(_el$8, "fg", muted(props.context), _$p));
|
|
1050
|
+
return _el$8;
|
|
1051
|
+
})()
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
}), null);
|
|
1055
|
+
insert(_el$7, createComponent(For, {
|
|
1056
|
+
get each() {
|
|
1057
|
+
return entries().filter((entry) => entry.providerID === provider.id);
|
|
1058
|
+
},
|
|
1059
|
+
children: (entry) => createComponent(QuotaSidebarEntryRow, {
|
|
1060
|
+
entry,
|
|
1061
|
+
get display() {
|
|
1062
|
+
return props.runtime.preferences().display;
|
|
1063
|
+
},
|
|
1064
|
+
get context() {
|
|
1065
|
+
return props.context;
|
|
1066
|
+
},
|
|
1067
|
+
get now() {
|
|
1068
|
+
return now();
|
|
1069
|
+
}
|
|
1070
|
+
})
|
|
1071
|
+
}), null);
|
|
1072
|
+
insert(_el$7, createComponent(For, {
|
|
1073
|
+
get each() {
|
|
1074
|
+
return provider.metrics.filter((metric) => metric.kind === "provider_status");
|
|
1075
|
+
},
|
|
1076
|
+
children: (metric) => createComponent(For, {
|
|
1077
|
+
get each() {
|
|
1078
|
+
return quotaMetricLines(metric, 34);
|
|
1079
|
+
},
|
|
1080
|
+
children: (line) => (() => {
|
|
1081
|
+
var _el$9 = createElement("text");
|
|
1082
|
+
insert(_el$9, line);
|
|
1083
|
+
effect((_$p) => setProp(_el$9, "fg", muted(props.context), _$p));
|
|
1084
|
+
return _el$9;
|
|
1085
|
+
})()
|
|
1086
|
+
})
|
|
1087
|
+
}), null);
|
|
1088
|
+
insert(_el$7, createComponent(For, {
|
|
1089
|
+
get each() {
|
|
1090
|
+
return finance().filter((entry) => entry.providerID === provider.id);
|
|
1091
|
+
},
|
|
1092
|
+
children: (entry) => createComponent(For, {
|
|
1093
|
+
get each() {
|
|
1094
|
+
return financeMetricLines(entry.metric, 34);
|
|
1095
|
+
},
|
|
1096
|
+
children: (line) => (() => {
|
|
1097
|
+
var _el$0 = createElement("text");
|
|
1098
|
+
insert(_el$0, line);
|
|
1099
|
+
effect((_$p) => setProp(_el$0, "fg", base(props.context), _$p));
|
|
1100
|
+
return _el$0;
|
|
1101
|
+
})()
|
|
1102
|
+
})
|
|
1103
|
+
}), null);
|
|
1104
|
+
return _el$7;
|
|
1105
|
+
})()
|
|
1106
|
+
}), null);
|
|
1107
|
+
effect((_$p) => setProp(_el$4, "fg", base(props.context), _$p));
|
|
1108
|
+
return _el$3;
|
|
1109
|
+
}
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
function QuotaFooterSummary(props) {
|
|
1113
|
+
const preferences = () => props.runtime.preferences();
|
|
1114
|
+
return createComponent(Show, {
|
|
1115
|
+
get when() {
|
|
1116
|
+
return preferences().enabled;
|
|
1117
|
+
},
|
|
1118
|
+
get children() {
|
|
1119
|
+
var _el$1 = createElement("text");
|
|
1120
|
+
insert(_el$1, () => `Quota · ${snapshotSummary(props.runtime.snapshot(), preferences().display)}`);
|
|
1121
|
+
effect((_$p) => setProp(_el$1, "fg", muted(props.context), _$p));
|
|
1122
|
+
return _el$1;
|
|
1123
|
+
}
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
function clipped(value, width) {
|
|
1127
|
+
const max = Math.max(5, Math.floor(width) - 2);
|
|
1128
|
+
return value.length <= max ? value : `${value.slice(0, max - 1)}…`;
|
|
1129
|
+
}
|
|
1130
|
+
function quotaAmount(value, unit) {
|
|
1131
|
+
const safeUnit = unit.trim();
|
|
1132
|
+
if (!Number.isFinite(value) || !safeUnit) return void 0;
|
|
1133
|
+
return `${new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 }).format(value)} ${safeUnit}`;
|
|
1134
|
+
}
|
|
1135
|
+
function quotaResetDate(resetsAt, now) {
|
|
1136
|
+
if (resetsAt === void 0 || !Number.isFinite(resetsAt) || !Number.isFinite(now)) return void 0;
|
|
1137
|
+
const date = new Date(resetsAt);
|
|
1138
|
+
if (!Number.isFinite(date.getTime()) || resetsAt <= now) return void 0;
|
|
1139
|
+
return `Resets on ${date.toISOString().slice(0, 16).replace("T", " ")} UTC`;
|
|
1140
|
+
}
|
|
1141
|
+
/** Wrap on grapheme boundaries, measuring terminal cells rather than code units. */
|
|
1142
|
+
function quotaTextLines(text, width, indent) {
|
|
1143
|
+
const max = Number.isFinite(width) ? Math.max(0, Math.floor(width)) : 0;
|
|
1144
|
+
if (max < 1) return [];
|
|
1145
|
+
const padding = " ".repeat(Math.min(Math.max(0, indent), Math.max(0, max - 2)));
|
|
1146
|
+
const lines = [];
|
|
1147
|
+
let line = padding;
|
|
1148
|
+
const segmenter = new Intl.Segmenter();
|
|
1149
|
+
for (const word of text.trim().split(/\s+/)) {
|
|
1150
|
+
if (!word) continue;
|
|
1151
|
+
if (line.trim() && cellWidth(line) + 1 + cellWidth(word) > max) {
|
|
1152
|
+
lines.push(line.trimEnd());
|
|
1153
|
+
line = padding;
|
|
1154
|
+
}
|
|
1155
|
+
if (line.trim()) line += " ";
|
|
1156
|
+
for (const { segment } of segmenter.segment(word)) {
|
|
1157
|
+
const glyphWidth = cellWidth(segment);
|
|
1158
|
+
if (glyphWidth > max) continue;
|
|
1159
|
+
if (cellWidth(line) + glyphWidth > max) {
|
|
1160
|
+
if (line.trim()) lines.push(line.trimEnd());
|
|
1161
|
+
line = glyphWidth + cellWidth(padding) <= max ? padding : "";
|
|
1162
|
+
}
|
|
1163
|
+
line += segment;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
if (line.trim()) lines.push(line.trimEnd());
|
|
1167
|
+
return lines;
|
|
1168
|
+
}
|
|
1169
|
+
/** Layout uses only a provider-reported reset; a local clock never refreshes data. */
|
|
1170
|
+
function quotaWindowLines(metric, display, width, now, sidebarPercent = false) {
|
|
1171
|
+
const title = metric.period?.trim() || metric.label?.trim() || "Quota";
|
|
1172
|
+
const progress = quotaProgress(metric);
|
|
1173
|
+
const amount = sidebarPercent && progress ? `${display === "remaining" ? progress.remainingPercent : progress.usedPercent}%` : quotaAmount(display === "remaining" ? metric.remaining : metric.used, metric.unit);
|
|
1174
|
+
if (!amount) return [];
|
|
1175
|
+
const value = `${amount} ${display === "remaining" ? "rest." : "uso"}`;
|
|
1176
|
+
const countdown = formatQuotaCountdown(metric.resetsAt, now);
|
|
1177
|
+
const reset = countdown === null ? "(aguardando atualização)" : countdown ? `(${countdown})` : void 0;
|
|
1178
|
+
const resetDate = countdown !== void 0 && countdown !== null ? quotaResetDate(metric.resetsAt, now) : void 0;
|
|
1179
|
+
const resetDateLines = resetDate ? quotaTextLines(resetDate, width, 4) : [];
|
|
1180
|
+
const padded = ` ${title.padEnd(8)} ${value}`;
|
|
1181
|
+
const compact = ` ${title} ${value}`;
|
|
1182
|
+
const prefix = cellWidth(padded) <= width ? padded : compact;
|
|
1183
|
+
const suffix = reset ? ` ${reset}` : "";
|
|
1184
|
+
const rawBar = progress && (sidebarPercent || metric.unit.trim() === "%") ? contextBar(progress.usedPercent, 4) : void 0;
|
|
1185
|
+
const bar = rawBar ? {
|
|
1186
|
+
...rawBar,
|
|
1187
|
+
empty: "░".repeat(cellWidth(rawBar.empty))
|
|
1188
|
+
} : void 0;
|
|
1189
|
+
const secondaryAmount = sidebarPercent ? void 0 : quotaAmount(display === "remaining" ? metric.used : metric.remaining, metric.unit);
|
|
1190
|
+
const secondary = secondaryAmount ? quotaTextLines(`${display === "remaining" ? "Usado" : "Restante"} ${secondaryAmount}`, width, 4) : [];
|
|
1191
|
+
if (!sidebarPercent && progress) secondary.push(...quotaTextLines(`${progress.remainingPercent}% restante`, width, 4));
|
|
1192
|
+
if (bar && cellWidth(prefix + suffix) + 5 <= width) return [
|
|
1193
|
+
`${prefix} ${bar.filled}${bar.empty}${suffix}`,
|
|
1194
|
+
...resetDateLines,
|
|
1195
|
+
...secondary
|
|
1196
|
+
];
|
|
1197
|
+
if (cellWidth(prefix + suffix) <= width) return [
|
|
1198
|
+
`${prefix}${suffix}`,
|
|
1199
|
+
...resetDateLines,
|
|
1200
|
+
...secondary
|
|
1201
|
+
];
|
|
1202
|
+
if (cellWidth(prefix) <= width) return reset ? [
|
|
1203
|
+
prefix,
|
|
1204
|
+
...quotaTextLines(reset, width, 4),
|
|
1205
|
+
...resetDateLines,
|
|
1206
|
+
...secondary
|
|
1207
|
+
] : [
|
|
1208
|
+
prefix,
|
|
1209
|
+
...resetDateLines,
|
|
1210
|
+
...secondary
|
|
1211
|
+
];
|
|
1212
|
+
return [
|
|
1213
|
+
...quotaTextLines(title, width, 2),
|
|
1214
|
+
...quotaTextLines(value, width, 4),
|
|
1215
|
+
...reset ? quotaTextLines(reset, width, 4) : [],
|
|
1216
|
+
...resetDateLines,
|
|
1217
|
+
...secondary
|
|
1218
|
+
];
|
|
1219
|
+
}
|
|
1220
|
+
function QuotaWindow(props) {
|
|
1221
|
+
return (() => {
|
|
1222
|
+
var _el$10 = createElement("box");
|
|
1223
|
+
setProp(_el$10, "flexDirection", "column");
|
|
1224
|
+
insert(_el$10, createComponent(For, {
|
|
1225
|
+
get each() {
|
|
1226
|
+
return quotaWindowLines(props.metric, props.display, props.width, props.now);
|
|
1227
|
+
},
|
|
1228
|
+
children: (line) => (() => {
|
|
1229
|
+
var _el$11 = createElement("text");
|
|
1230
|
+
insert(_el$11, line);
|
|
1231
|
+
effect((_$p) => setProp(_el$11, "fg", quotaColor(props.context, quotaProgress(props.metric)?.usedPercent), _$p));
|
|
1232
|
+
return _el$11;
|
|
1233
|
+
})()
|
|
1234
|
+
}));
|
|
1235
|
+
return _el$10;
|
|
1236
|
+
})();
|
|
1237
|
+
}
|
|
1238
|
+
function metricRow(metric) {
|
|
1239
|
+
const label = (fallback) => metric.label?.trim() || fallback;
|
|
1240
|
+
switch (metric.kind) {
|
|
1241
|
+
case "balance": {
|
|
1242
|
+
const value = quotaAmount(metric.amount, metric.currency);
|
|
1243
|
+
return value ? {
|
|
1244
|
+
label: label("Saldo"),
|
|
1245
|
+
value: `${value}${metric.status?.trim() ? ` · ${metric.status.trim()}` : ""}`
|
|
1246
|
+
} : void 0;
|
|
1247
|
+
}
|
|
1248
|
+
case "estimate": {
|
|
1249
|
+
const value = quotaAmount(metric.amount, metric.unit);
|
|
1250
|
+
return value ? {
|
|
1251
|
+
label: label("Estimativa"),
|
|
1252
|
+
value
|
|
1253
|
+
} : void 0;
|
|
1254
|
+
}
|
|
1255
|
+
case "key_usage": {
|
|
1256
|
+
const value = quotaAmount(metric.amount, metric.currency);
|
|
1257
|
+
if (!value) return void 0;
|
|
1258
|
+
const source = label("Uso da chave selecionada");
|
|
1259
|
+
return {
|
|
1260
|
+
label: /selected\s+key|chave selecionada/i.test(source) ? source : `Chave selecionada · ${source}`,
|
|
1261
|
+
value: `${value}${metric.period?.trim() ? ` · ${metric.period.trim()}` : ""}`
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
case "session_usage": {
|
|
1265
|
+
const value = quotaAmount(metric.amount, metric.unit);
|
|
1266
|
+
return value ? {
|
|
1267
|
+
label: label("Uso da sessão"),
|
|
1268
|
+
value
|
|
1269
|
+
} : void 0;
|
|
1270
|
+
}
|
|
1271
|
+
case "provider_status": return {
|
|
1272
|
+
label: metric.label,
|
|
1273
|
+
value: metric.status
|
|
1274
|
+
};
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
function financeMetricLines(metric, width) {
|
|
1278
|
+
return quotaMetricLines(metric, width);
|
|
1279
|
+
}
|
|
1280
|
+
function quotaMetricLines(metric, width) {
|
|
1281
|
+
const row = metricRow(metric);
|
|
1282
|
+
if (!row) return [];
|
|
1283
|
+
const left = ` ${row.label}`;
|
|
1284
|
+
const spaces = width - cellWidth(left) - cellWidth(row.value);
|
|
1285
|
+
if (spaces >= 2) return [`${left}${" ".repeat(spaces)}${row.value}`];
|
|
1286
|
+
return [...quotaTextLines(row.label, width, 2), ...quotaTextLines(row.value, width, 4)];
|
|
1287
|
+
}
|
|
1288
|
+
function QuotaMetricLine(props) {
|
|
1289
|
+
const row = () => metricRow(props.metric);
|
|
1290
|
+
return createComponent(Show, {
|
|
1291
|
+
get when() {
|
|
1292
|
+
return row();
|
|
1293
|
+
},
|
|
1294
|
+
get children() {
|
|
1295
|
+
var _el$12 = createElement("box");
|
|
1296
|
+
setProp(_el$12, "flexDirection", "column");
|
|
1297
|
+
insert(_el$12, createComponent(For, {
|
|
1298
|
+
get each() {
|
|
1299
|
+
return quotaMetricLines(props.metric, props.width);
|
|
1300
|
+
},
|
|
1301
|
+
children: (line) => (() => {
|
|
1302
|
+
var _el$13 = createElement("text");
|
|
1303
|
+
insert(_el$13, line);
|
|
1304
|
+
effect((_$p) => setProp(_el$13, "fg", base(props.context), _$p));
|
|
1305
|
+
return _el$13;
|
|
1306
|
+
})()
|
|
1307
|
+
}));
|
|
1308
|
+
return _el$12;
|
|
1309
|
+
}
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
function providerState(provider) {
|
|
1313
|
+
if (provider.authentication === "not_connected") return {
|
|
1314
|
+
label: "○ Precisa configurar",
|
|
1315
|
+
tone: "warning"
|
|
1316
|
+
};
|
|
1317
|
+
if (provider.authentication === "unavailable") return {
|
|
1318
|
+
label: "× Indisponível",
|
|
1319
|
+
tone: "error"
|
|
1320
|
+
};
|
|
1321
|
+
return provider.state === "available" ? {
|
|
1322
|
+
label: "✓ Credencial local · há dados",
|
|
1323
|
+
tone: "success"
|
|
1324
|
+
} : {
|
|
1325
|
+
label: "! Credencial local · sem dados",
|
|
1326
|
+
tone: "warning"
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
function recentModelUsage(context, sessionID) {
|
|
1330
|
+
if (!sessionID.startsWith("ses")) return collectRecentModelUsageRows({
|
|
1331
|
+
activeModel: null,
|
|
1332
|
+
activeMessages: [],
|
|
1333
|
+
usageMessages: [],
|
|
1334
|
+
models: []
|
|
1335
|
+
});
|
|
1336
|
+
let session;
|
|
1337
|
+
let activeMessages = [];
|
|
1338
|
+
try {
|
|
1339
|
+
session = context.data.session.get(sessionID);
|
|
1340
|
+
} catch {
|
|
1341
|
+
session = void 0;
|
|
1342
|
+
}
|
|
1343
|
+
const messagesBySession = /* @__PURE__ */ new Map();
|
|
1344
|
+
try {
|
|
1345
|
+
const messages = context.data.session.message.list(sessionID);
|
|
1346
|
+
if (Array.isArray(messages)) {
|
|
1347
|
+
activeMessages = messages.slice(-400);
|
|
1348
|
+
messagesBySession.set(sessionID, activeMessages);
|
|
1349
|
+
}
|
|
1350
|
+
} catch {}
|
|
1351
|
+
const sessionIDs = [sessionID];
|
|
1352
|
+
try {
|
|
1353
|
+
const family = context.data.session.family(sessionID);
|
|
1354
|
+
if (Array.isArray(family)) for (const id of family) {
|
|
1355
|
+
if (typeof id !== "string" || !id.startsWith("ses") || sessionIDs.includes(id)) continue;
|
|
1356
|
+
sessionIDs.push(id);
|
|
1357
|
+
if (sessionIDs.length >= 8) break;
|
|
1358
|
+
}
|
|
1359
|
+
} catch {}
|
|
1360
|
+
const usageMessages = [];
|
|
1361
|
+
const usageSessions = [];
|
|
1362
|
+
for (const id of sessionIDs) {
|
|
1363
|
+
let messages = messagesBySession.get(id) ?? [];
|
|
1364
|
+
if (!messagesBySession.has(id)) try {
|
|
1365
|
+
const result = context.data.session.message.list(id);
|
|
1366
|
+
if (Array.isArray(result)) messages = result.slice(-400);
|
|
1367
|
+
} catch {}
|
|
1368
|
+
messagesBySession.set(id, messages);
|
|
1369
|
+
usageMessages.push(...messages);
|
|
1370
|
+
let familySession = session;
|
|
1371
|
+
if (id !== sessionID) try {
|
|
1372
|
+
familySession = context.data.session.get(id);
|
|
1373
|
+
} catch {
|
|
1374
|
+
familySession = void 0;
|
|
1375
|
+
}
|
|
1376
|
+
const revert = familySession?.revert;
|
|
1377
|
+
const revertMessageID = typeof revert === "object" && revert !== null && typeof revert.messageID === "string" ? revert.messageID : null;
|
|
1378
|
+
usageSessions.push({
|
|
1379
|
+
messages,
|
|
1380
|
+
revertMessageID
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
let models = [];
|
|
1384
|
+
let fallbackModel = null;
|
|
1385
|
+
try {
|
|
1386
|
+
const location = context.location ?? context.data.location.default();
|
|
1387
|
+
const result = context.data.location.model.list(location);
|
|
1388
|
+
if (Array.isArray(result)) models = result;
|
|
1389
|
+
const agentID = session?.agent;
|
|
1390
|
+
if (typeof agentID === "string" && agentID !== "") {
|
|
1391
|
+
const agents = context.data.location.agent?.list?.(location);
|
|
1392
|
+
if (Array.isArray(agents)) fallbackModel = agents.find((agent) => agent?.id === agentID)?.model ?? null;
|
|
1393
|
+
}
|
|
1394
|
+
} catch {}
|
|
1395
|
+
const activeModel = resolveActiveModelRef(session?.model, activeMessages, fallbackModel);
|
|
1396
|
+
const revert = session?.revert;
|
|
1397
|
+
const revertMessageID = typeof revert === "object" && revert !== null && typeof revert.messageID === "string" ? revert.messageID : null;
|
|
1398
|
+
return collectRecentModelUsageRows({
|
|
1399
|
+
activeModel,
|
|
1400
|
+
activeMessages,
|
|
1401
|
+
usageMessages,
|
|
1402
|
+
usageSessions,
|
|
1403
|
+
models,
|
|
1404
|
+
revertMessageID
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
function ModelUsageDetails(props) {
|
|
1408
|
+
const [revision, setRevision] = createSignal(0);
|
|
1409
|
+
const rows = createMemo(() => {
|
|
1410
|
+
revision();
|
|
1411
|
+
return recentModelUsage(props.context, props.sessionID);
|
|
1412
|
+
});
|
|
1413
|
+
onMount(() => {
|
|
1414
|
+
const unsubscribe = [];
|
|
1415
|
+
for (const event of MODEL_USAGE_REFRESH_EVENTS) try {
|
|
1416
|
+
unsubscribe.push(props.context.data.on(event, () => setRevision((value) => value + 1)));
|
|
1417
|
+
} catch {}
|
|
1418
|
+
onCleanup(() => {
|
|
1419
|
+
for (const dispose of unsubscribe) dispose();
|
|
1420
|
+
});
|
|
1421
|
+
});
|
|
1422
|
+
const contextTone = (percent) => tone(props.context, contextUsageTone(percent));
|
|
1423
|
+
const contextCells = () => Math.max(4, Math.min(12, Math.floor((props.width - 30) / 2)));
|
|
1424
|
+
const modelLabel = (row) => `${row.providerID ? `${row.providerID}/` : ""}${row.label}`;
|
|
1425
|
+
return (() => {
|
|
1426
|
+
var _el$14 = createElement("box"), _el$15 = createElement("text"), _el$17 = createElement("text");
|
|
1427
|
+
insertNode(_el$14, _el$15);
|
|
1428
|
+
insertNode(_el$14, _el$17);
|
|
1429
|
+
setProp(_el$14, "flexDirection", "column");
|
|
1430
|
+
setProp(_el$14, "paddingTop", 1);
|
|
1431
|
+
insertNode(_el$15, createTextNode(`Modelos em uso`));
|
|
1432
|
+
setProp(_el$15, "attributes", 1);
|
|
1433
|
+
insertNode(_el$17, createTextNode(`Mensagens recentes da sessão ativa e delegações.`));
|
|
1434
|
+
insert(_el$14, createComponent(For, {
|
|
1435
|
+
get each() {
|
|
1436
|
+
return rows();
|
|
1437
|
+
},
|
|
1438
|
+
children: (row, index) => [
|
|
1439
|
+
createComponent(Show, {
|
|
1440
|
+
get when() {
|
|
1441
|
+
return row.active;
|
|
1442
|
+
},
|
|
1443
|
+
get children() {
|
|
1444
|
+
var _el$19 = createElement("text");
|
|
1445
|
+
insertNode(_el$19, createTextNode(`MODELO ATUAL`));
|
|
1446
|
+
setProp(_el$19, "attributes", 1);
|
|
1447
|
+
effect((_$p) => setProp(_el$19, "fg", tone(props.context, "info"), _$p));
|
|
1448
|
+
return _el$19;
|
|
1449
|
+
}
|
|
1450
|
+
}),
|
|
1451
|
+
createComponent(Show, {
|
|
1452
|
+
get when() {
|
|
1453
|
+
return memo(() => !!!row.active)() && index() === 1;
|
|
1454
|
+
},
|
|
1455
|
+
get children() {
|
|
1456
|
+
var _el$21 = createElement("text");
|
|
1457
|
+
insertNode(_el$21, createTextNode(`MAIS USADOS RECENTEMENTE`));
|
|
1458
|
+
setProp(_el$21, "attributes", 1);
|
|
1459
|
+
effect((_$p) => setProp(_el$21, "fg", muted(props.context), _$p));
|
|
1460
|
+
return _el$21;
|
|
1461
|
+
}
|
|
1462
|
+
}),
|
|
1463
|
+
(() => {
|
|
1464
|
+
var _el$23 = createElement("box"), _el$24 = createElement("text");
|
|
1465
|
+
insertNode(_el$23, _el$24);
|
|
1466
|
+
setProp(_el$23, "flexDirection", "column");
|
|
1467
|
+
setProp(_el$23, "paddingTop", 1);
|
|
1468
|
+
setProp(_el$23, "paddingLeft", 1);
|
|
1469
|
+
setProp(_el$24, "attributes", 1);
|
|
1470
|
+
insert(_el$24, () => clipped(modelLabel(row), props.width - 2));
|
|
1471
|
+
insert(_el$23, createComponent(Show, {
|
|
1472
|
+
get when() {
|
|
1473
|
+
return row.tokens !== null;
|
|
1474
|
+
},
|
|
1475
|
+
get fallback() {
|
|
1476
|
+
return (() => {
|
|
1477
|
+
var _el$31 = createElement("text");
|
|
1478
|
+
insertNode(_el$31, createTextNode(`dados indisponíveis`));
|
|
1479
|
+
effect((_$p) => setProp(_el$31, "fg", muted(props.context), _$p));
|
|
1480
|
+
return _el$31;
|
|
1481
|
+
})();
|
|
1482
|
+
},
|
|
1483
|
+
get children() {
|
|
1484
|
+
var _el$25 = createElement("box"), _el$26 = createElement("text"), _el$28 = createElement("text");
|
|
1485
|
+
insertNode(_el$25, _el$26);
|
|
1486
|
+
insertNode(_el$25, _el$28);
|
|
1487
|
+
setProp(_el$25, "flexDirection", "row");
|
|
1488
|
+
setProp(_el$25, "justifyContent", "space-between");
|
|
1489
|
+
setProp(_el$25, "gap", 1);
|
|
1490
|
+
insertNode(_el$26, createTextNode(`Tokens nas mensagens recentes`));
|
|
1491
|
+
insert(_el$28, () => `${formatTokenCount(row.tokens) ?? "—"}`);
|
|
1492
|
+
effect((_p$) => {
|
|
1493
|
+
var _v$3 = muted(props.context), _v$4 = base(props.context);
|
|
1494
|
+
_v$3 !== _p$.e && (_p$.e = setProp(_el$26, "fg", _v$3, _p$.e));
|
|
1495
|
+
_v$4 !== _p$.t && (_p$.t = setProp(_el$28, "fg", _v$4, _p$.t));
|
|
1496
|
+
return _p$;
|
|
1497
|
+
}, {
|
|
1498
|
+
e: void 0,
|
|
1499
|
+
t: void 0
|
|
1500
|
+
});
|
|
1501
|
+
return _el$25;
|
|
1502
|
+
}
|
|
1503
|
+
}), null);
|
|
1504
|
+
insert(_el$23, createComponent(Show, {
|
|
1505
|
+
get when() {
|
|
1506
|
+
return row.context;
|
|
1507
|
+
},
|
|
1508
|
+
children: (usage) => {
|
|
1509
|
+
const bar = () => contextBar(usage().percent, contextCells());
|
|
1510
|
+
return (() => {
|
|
1511
|
+
var _el$33 = createElement("box"), _el$34 = createElement("box"), _el$35 = createElement("text"), _el$37 = createElement("text"), _el$38 = createElement("box"), _el$39 = createElement("text");
|
|
1512
|
+
insertNode(_el$33, _el$34);
|
|
1513
|
+
insertNode(_el$33, _el$38);
|
|
1514
|
+
setProp(_el$33, "flexDirection", "column");
|
|
1515
|
+
setProp(_el$33, "paddingTop", 1);
|
|
1516
|
+
insertNode(_el$34, _el$35);
|
|
1517
|
+
insertNode(_el$34, _el$37);
|
|
1518
|
+
setProp(_el$34, "flexDirection", "row");
|
|
1519
|
+
setProp(_el$34, "justifyContent", "space-between");
|
|
1520
|
+
setProp(_el$34, "gap", 1);
|
|
1521
|
+
insertNode(_el$35, createTextNode(`Último contexto reportado`));
|
|
1522
|
+
insert(_el$37, () => `${formatTokenCount(usage().tokens) ?? "—"} tokens`);
|
|
1523
|
+
insertNode(_el$38, _el$39);
|
|
1524
|
+
setProp(_el$38, "flexDirection", "row");
|
|
1525
|
+
setProp(_el$38, "gap", 1);
|
|
1526
|
+
insert(_el$38, createComponent(Show, {
|
|
1527
|
+
get when() {
|
|
1528
|
+
return bar();
|
|
1529
|
+
},
|
|
1530
|
+
children: (cells) => [(() => {
|
|
1531
|
+
var _el$40 = createElement("text");
|
|
1532
|
+
insert(_el$40, () => cells().filled);
|
|
1533
|
+
effect((_$p) => setProp(_el$40, "fg", contextTone(usage().percent), _$p));
|
|
1534
|
+
return _el$40;
|
|
1535
|
+
})(), (() => {
|
|
1536
|
+
var _el$41 = createElement("text");
|
|
1537
|
+
insert(_el$41, () => cells().empty);
|
|
1538
|
+
effect((_$p) => setProp(_el$41, "fg", muted(props.context), _$p));
|
|
1539
|
+
return _el$41;
|
|
1540
|
+
})()]
|
|
1541
|
+
}), _el$39);
|
|
1542
|
+
insert(_el$39, () => `${usage().percent}% de ${formatContextWindow(usage().limit) ?? "—"}`);
|
|
1543
|
+
effect((_p$) => {
|
|
1544
|
+
var _v$5 = muted(props.context), _v$6 = contextTone(usage().percent), _v$7 = contextTone(usage().percent);
|
|
1545
|
+
_v$5 !== _p$.e && (_p$.e = setProp(_el$35, "fg", _v$5, _p$.e));
|
|
1546
|
+
_v$6 !== _p$.t && (_p$.t = setProp(_el$37, "fg", _v$6, _p$.t));
|
|
1547
|
+
_v$7 !== _p$.a && (_p$.a = setProp(_el$39, "fg", _v$7, _p$.a));
|
|
1548
|
+
return _p$;
|
|
1549
|
+
}, {
|
|
1550
|
+
e: void 0,
|
|
1551
|
+
t: void 0,
|
|
1552
|
+
a: void 0
|
|
1553
|
+
});
|
|
1554
|
+
return _el$33;
|
|
1555
|
+
})();
|
|
1556
|
+
}
|
|
1557
|
+
}), null);
|
|
1558
|
+
insert(_el$23, createComponent(Show, {
|
|
1559
|
+
get when() {
|
|
1560
|
+
return row.cost !== null;
|
|
1561
|
+
},
|
|
1562
|
+
get children() {
|
|
1563
|
+
return createComponent(For, {
|
|
1564
|
+
get each() {
|
|
1565
|
+
return quotaTextLines(`Custo reportado · mensagens recentes · ${formatSpent(row.cost) ?? "—"}`, props.width - 2, 0);
|
|
1566
|
+
},
|
|
1567
|
+
children: (line) => (() => {
|
|
1568
|
+
var _el$42 = createElement("text");
|
|
1569
|
+
insert(_el$42, line);
|
|
1570
|
+
effect((_$p) => setProp(_el$42, "fg", muted(props.context), _$p));
|
|
1571
|
+
return _el$42;
|
|
1572
|
+
})()
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
}), null);
|
|
1576
|
+
insert(_el$23, createComponent(Show, {
|
|
1577
|
+
get when() {
|
|
1578
|
+
return memo(() => row.tokens !== null)() && row.context === null;
|
|
1579
|
+
},
|
|
1580
|
+
get children() {
|
|
1581
|
+
var _el$29 = createElement("text");
|
|
1582
|
+
insertNode(_el$29, createTextNode(`Contexto indisponível`));
|
|
1583
|
+
effect((_$p) => setProp(_el$29, "fg", muted(props.context), _$p));
|
|
1584
|
+
return _el$29;
|
|
1585
|
+
}
|
|
1586
|
+
}), null);
|
|
1587
|
+
effect((_$p) => setProp(_el$24, "fg", base(props.context), _$p));
|
|
1588
|
+
return _el$23;
|
|
1589
|
+
})()
|
|
1590
|
+
]
|
|
1591
|
+
}), null);
|
|
1592
|
+
effect((_p$) => {
|
|
1593
|
+
var _v$ = tone(props.context, "info"), _v$2 = muted(props.context);
|
|
1594
|
+
_v$ !== _p$.e && (_p$.e = setProp(_el$15, "fg", _v$, _p$.e));
|
|
1595
|
+
_v$2 !== _p$.t && (_p$.t = setProp(_el$17, "fg", _v$2, _p$.t));
|
|
1596
|
+
return _p$;
|
|
1597
|
+
}, {
|
|
1598
|
+
e: void 0,
|
|
1599
|
+
t: void 0
|
|
1600
|
+
});
|
|
1601
|
+
return _el$14;
|
|
1602
|
+
})();
|
|
1603
|
+
}
|
|
1604
|
+
function QuotaProviderDetails(props) {
|
|
1605
|
+
const [now, setNow] = createSignal(Date.now());
|
|
1606
|
+
onMount(() => onCleanup(quotaClock.subscribe(setNow)));
|
|
1607
|
+
const state = () => providerState(props.provider);
|
|
1608
|
+
const quotaMetrics = () => props.provider.metrics.filter((metric) => metric.kind === "provider_quota");
|
|
1609
|
+
const financeMetrics = () => props.provider.metrics.filter((metric) => metric.kind === "balance" || metric.kind === "estimate" || metric.kind === "key_usage");
|
|
1610
|
+
const otherMetrics = () => props.provider.metrics.filter((metric) => metric.kind === "provider_status" || metric.kind === "session_usage");
|
|
1611
|
+
const safeError = () => {
|
|
1612
|
+
const message = props.provider.message;
|
|
1613
|
+
return message && message !== "status indisponível" && message !== "dados de quota indisponíveis" && message !== "setup necessário" ? message : void 0;
|
|
1614
|
+
};
|
|
1615
|
+
return (() => {
|
|
1616
|
+
var _el$43 = createElement("box"), _el$48 = createElement("text");
|
|
1617
|
+
insertNode(_el$43, _el$48);
|
|
1618
|
+
setProp(_el$43, "flexDirection", "column");
|
|
1619
|
+
setProp(_el$43, "paddingBottom", 1);
|
|
1620
|
+
insert(_el$43, createComponent(For, {
|
|
1621
|
+
get each() {
|
|
1622
|
+
return quotaTextLines(props.provider.label, props.width, 0);
|
|
1623
|
+
},
|
|
1624
|
+
children: (line) => (() => {
|
|
1625
|
+
var _el$49 = createElement("text");
|
|
1626
|
+
setProp(_el$49, "attributes", 1);
|
|
1627
|
+
insert(_el$49, line);
|
|
1628
|
+
effect((_$p) => setProp(_el$49, "fg", tone(props.context, "info"), _$p));
|
|
1629
|
+
return _el$49;
|
|
1630
|
+
})()
|
|
1631
|
+
}), _el$48);
|
|
1632
|
+
insert(_el$43, createComponent(For, {
|
|
1633
|
+
get each() {
|
|
1634
|
+
return quotaTextLines(state().label, props.width, 0);
|
|
1635
|
+
},
|
|
1636
|
+
children: (line) => (() => {
|
|
1637
|
+
var _el$50 = createElement("text");
|
|
1638
|
+
insert(_el$50, line);
|
|
1639
|
+
effect((_$p) => setProp(_el$50, "fg", tone(props.context, state().tone), _$p));
|
|
1640
|
+
return _el$50;
|
|
1641
|
+
})()
|
|
1642
|
+
}), _el$48);
|
|
1643
|
+
insert(_el$43, createComponent(Show, {
|
|
1644
|
+
get when() {
|
|
1645
|
+
return quotaMetrics().length > 0;
|
|
1646
|
+
},
|
|
1647
|
+
get children() {
|
|
1648
|
+
return createComponent(For, {
|
|
1649
|
+
get each() {
|
|
1650
|
+
return quotaMetrics();
|
|
1651
|
+
},
|
|
1652
|
+
children: (metric) => createComponent(QuotaWindow, {
|
|
1653
|
+
metric,
|
|
1654
|
+
get now() {
|
|
1655
|
+
return now();
|
|
1656
|
+
},
|
|
1657
|
+
get display() {
|
|
1658
|
+
return props.display;
|
|
1659
|
+
},
|
|
1660
|
+
get width() {
|
|
1661
|
+
return props.width;
|
|
1662
|
+
},
|
|
1663
|
+
get context() {
|
|
1664
|
+
return props.context;
|
|
1665
|
+
}
|
|
1666
|
+
})
|
|
1667
|
+
});
|
|
1668
|
+
}
|
|
1669
|
+
}), _el$48);
|
|
1670
|
+
insert(_el$43, createComponent(Show, {
|
|
1671
|
+
get when() {
|
|
1672
|
+
return financeMetrics().length > 0;
|
|
1673
|
+
},
|
|
1674
|
+
get children() {
|
|
1675
|
+
return [(() => {
|
|
1676
|
+
var _el$44 = createElement("text");
|
|
1677
|
+
insertNode(_el$44, createTextNode(`GASTOS & SALDO`));
|
|
1678
|
+
effect((_$p) => setProp(_el$44, "fg", muted(props.context), _$p));
|
|
1679
|
+
return _el$44;
|
|
1680
|
+
})(), createComponent(For, {
|
|
1681
|
+
get each() {
|
|
1682
|
+
return financeMetrics();
|
|
1683
|
+
},
|
|
1684
|
+
children: (metric) => createComponent(QuotaMetricLine, {
|
|
1685
|
+
metric,
|
|
1686
|
+
get width() {
|
|
1687
|
+
return props.width;
|
|
1688
|
+
},
|
|
1689
|
+
get context() {
|
|
1690
|
+
return props.context;
|
|
1691
|
+
}
|
|
1692
|
+
})
|
|
1693
|
+
})];
|
|
1694
|
+
}
|
|
1695
|
+
}), _el$48);
|
|
1696
|
+
insert(_el$43, createComponent(Show, {
|
|
1697
|
+
get when() {
|
|
1698
|
+
return otherMetrics().length > 0;
|
|
1699
|
+
},
|
|
1700
|
+
get children() {
|
|
1701
|
+
return [(() => {
|
|
1702
|
+
var _el$46 = createElement("text");
|
|
1703
|
+
insertNode(_el$46, createTextNode(`OUTRAS MÉTRICAS`));
|
|
1704
|
+
effect((_$p) => setProp(_el$46, "fg", muted(props.context), _$p));
|
|
1705
|
+
return _el$46;
|
|
1706
|
+
})(), createComponent(For, {
|
|
1707
|
+
get each() {
|
|
1708
|
+
return otherMetrics();
|
|
1709
|
+
},
|
|
1710
|
+
children: (metric) => createComponent(QuotaMetricLine, {
|
|
1711
|
+
metric,
|
|
1712
|
+
get width() {
|
|
1713
|
+
return props.width;
|
|
1714
|
+
},
|
|
1715
|
+
get context() {
|
|
1716
|
+
return props.context;
|
|
1717
|
+
}
|
|
1718
|
+
})
|
|
1719
|
+
})];
|
|
1720
|
+
}
|
|
1721
|
+
}), _el$48);
|
|
1722
|
+
insert(_el$43, createComponent(Show, {
|
|
1723
|
+
get when() {
|
|
1724
|
+
return safeError();
|
|
1725
|
+
},
|
|
1726
|
+
children: (message) => (() => {
|
|
1727
|
+
var _el$51 = createElement("text");
|
|
1728
|
+
insert(_el$51, () => clipped(`! ${message()}`, props.width - 2));
|
|
1729
|
+
effect((_$p) => setProp(_el$51, "fg", tone(props.context, "warning"), _$p));
|
|
1730
|
+
return _el$51;
|
|
1731
|
+
})()
|
|
1732
|
+
}), _el$48);
|
|
1733
|
+
insert(_el$48, () => "─".repeat(Math.max(8, Math.min(32, props.width - 4))));
|
|
1734
|
+
effect((_$p) => setProp(_el$48, "fg", muted(props.context), _$p));
|
|
1735
|
+
return _el$43;
|
|
1736
|
+
})();
|
|
1737
|
+
}
|
|
1738
|
+
const QUOTA_PANEL_COMMANDS = [
|
|
1739
|
+
{
|
|
1740
|
+
action: "toggle-enabled",
|
|
1741
|
+
id: "pantheon.quota.toggle-enabled",
|
|
1742
|
+
title: "Quota: ativar/desativar",
|
|
1743
|
+
bind: "e"
|
|
1744
|
+
},
|
|
1745
|
+
{
|
|
1746
|
+
action: "toggle-display",
|
|
1747
|
+
id: "pantheon.quota.toggle-display",
|
|
1748
|
+
title: "Quota: alternar usado/restante",
|
|
1749
|
+
bind: "m"
|
|
1750
|
+
},
|
|
1751
|
+
{
|
|
1752
|
+
action: "refresh",
|
|
1753
|
+
id: "pantheon.quota.refresh",
|
|
1754
|
+
title: "Quota: atualizar",
|
|
1755
|
+
bind: "r"
|
|
1756
|
+
},
|
|
1757
|
+
{
|
|
1758
|
+
action: "close",
|
|
1759
|
+
id: "pantheon.quota.close",
|
|
1760
|
+
title: "Quota: fechar",
|
|
1761
|
+
bind: "escape,q"
|
|
1762
|
+
}
|
|
1763
|
+
];
|
|
1764
|
+
function runQuotaPanelCommand(action, panel, runtime) {
|
|
1765
|
+
if (panel.focused !== true) return false;
|
|
1766
|
+
switch (action) {
|
|
1767
|
+
case "toggle-enabled": return runtime.toggleEnabled();
|
|
1768
|
+
case "toggle-display": return runtime.toggleDisplay();
|
|
1769
|
+
case "refresh": return runtime.refresh();
|
|
1770
|
+
case "close":
|
|
1771
|
+
panel.close();
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
function quotaPanelKeymapLayer(panel, runtime) {
|
|
1776
|
+
const focused = () => panel.focused === true;
|
|
1777
|
+
return {
|
|
1778
|
+
mode: "global",
|
|
1779
|
+
enabled: focused,
|
|
1780
|
+
commands: QUOTA_PANEL_COMMANDS.map((command) => ({
|
|
1781
|
+
id: command.id,
|
|
1782
|
+
title: command.title,
|
|
1783
|
+
bind: command.bind,
|
|
1784
|
+
run: () => focused() ? runQuotaPanelCommand(command.action, panel, runtime) : false
|
|
1785
|
+
}))
|
|
1786
|
+
};
|
|
1787
|
+
}
|
|
1788
|
+
function quotaOpenCommand(context) {
|
|
1789
|
+
return {
|
|
1790
|
+
id: QUOTA_OPEN_COMMAND_ID,
|
|
1791
|
+
title: "Pantheon: Quota",
|
|
1792
|
+
description: "Painel de quota",
|
|
1793
|
+
group: "Pantheon",
|
|
1794
|
+
palette: true,
|
|
1795
|
+
slash: {
|
|
1796
|
+
name: "quota",
|
|
1797
|
+
aliases: ["pantheon-quota"]
|
|
1798
|
+
},
|
|
1799
|
+
run: () => {
|
|
1800
|
+
openQuotaPanel(context);
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
function openQuotaPanel(context) {
|
|
1805
|
+
let opened = false;
|
|
1806
|
+
try {
|
|
1807
|
+
opened = context.ui.panel.open(QUOTA_PANEL_NAME);
|
|
1808
|
+
} catch {
|
|
1809
|
+
opened = false;
|
|
1810
|
+
}
|
|
1811
|
+
if (opened) return true;
|
|
1812
|
+
try {
|
|
1813
|
+
context.ui.toast.show({
|
|
1814
|
+
message: QUOTA_PANEL_TOAST,
|
|
1815
|
+
variant: "warning"
|
|
1816
|
+
});
|
|
1817
|
+
} catch {}
|
|
1818
|
+
return false;
|
|
1819
|
+
}
|
|
1820
|
+
function QuotaPanel(props) {
|
|
1821
|
+
props.context.keymap.layer(() => quotaPanelKeymapLayer(props.panel, props.runtime));
|
|
1822
|
+
const preferences = () => props.runtime.preferences();
|
|
1823
|
+
const snapshot = () => props.runtime.snapshot();
|
|
1824
|
+
const snapshotTone = () => {
|
|
1825
|
+
switch (snapshot().status) {
|
|
1826
|
+
case "ready": return "success";
|
|
1827
|
+
case "partial":
|
|
1828
|
+
case "connected_unavailable":
|
|
1829
|
+
case "needs_setup":
|
|
1830
|
+
case "stale": return "warning";
|
|
1831
|
+
case "unavailable": return "error";
|
|
1832
|
+
case "loading":
|
|
1833
|
+
case "disabled": return "info";
|
|
1834
|
+
}
|
|
1835
|
+
};
|
|
1836
|
+
return (() => {
|
|
1837
|
+
var _el$52 = createElement("box"), _el$64 = createElement("scrollbox"), _el$65 = createElement("box"), _el$66 = createElement("box"), _el$67 = createElement("text"), _el$68 = createElement("text"), _el$69 = createElement("text"), _el$71 = createElement("text");
|
|
1838
|
+
insertNode(_el$52, _el$64);
|
|
1839
|
+
insertNode(_el$52, _el$66);
|
|
1840
|
+
setProp(_el$52, "flexDirection", "column");
|
|
1841
|
+
setProp(_el$52, "width", "100%");
|
|
1842
|
+
setProp(_el$52, "height", "100%");
|
|
1843
|
+
setProp(_el$52, "padding", 1);
|
|
1844
|
+
insert(_el$52, createComponent(Show, {
|
|
1845
|
+
get when() {
|
|
1846
|
+
return props.panel.width >= 54;
|
|
1847
|
+
},
|
|
1848
|
+
get fallback() {
|
|
1849
|
+
return (() => {
|
|
1850
|
+
var _el$73 = createElement("box"), _el$74 = createElement("text"), _el$76 = createElement("text");
|
|
1851
|
+
insertNode(_el$73, _el$74);
|
|
1852
|
+
insertNode(_el$73, _el$76);
|
|
1853
|
+
setProp(_el$73, "flexDirection", "column");
|
|
1854
|
+
insertNode(_el$74, createTextNode(`▥ Pantheon / Quota`));
|
|
1855
|
+
setProp(_el$74, "attributes", 1);
|
|
1856
|
+
insert(_el$76, () => quotaSnapshotStatusLabel(snapshot().status, snapshot().error));
|
|
1857
|
+
effect((_p$) => {
|
|
1858
|
+
var _v$15 = tone(props.context, "info"), _v$16 = tone(props.context, snapshotTone());
|
|
1859
|
+
_v$15 !== _p$.e && (_p$.e = setProp(_el$74, "fg", _v$15, _p$.e));
|
|
1860
|
+
_v$16 !== _p$.t && (_p$.t = setProp(_el$76, "fg", _v$16, _p$.t));
|
|
1861
|
+
return _p$;
|
|
1862
|
+
}, {
|
|
1863
|
+
e: void 0,
|
|
1864
|
+
t: void 0
|
|
1865
|
+
});
|
|
1866
|
+
return _el$73;
|
|
1867
|
+
})();
|
|
1868
|
+
},
|
|
1869
|
+
get children() {
|
|
1870
|
+
var _el$53 = createElement("box"), _el$54 = createElement("text"), _el$56 = createElement("text");
|
|
1871
|
+
insertNode(_el$53, _el$54);
|
|
1872
|
+
insertNode(_el$53, _el$56);
|
|
1873
|
+
setProp(_el$53, "flexDirection", "row");
|
|
1874
|
+
setProp(_el$53, "justifyContent", "space-between");
|
|
1875
|
+
setProp(_el$53, "gap", 1);
|
|
1876
|
+
insertNode(_el$54, createTextNode(`▥ Pantheon / Quota`));
|
|
1877
|
+
setProp(_el$54, "attributes", 1);
|
|
1878
|
+
insert(_el$56, () => quotaSnapshotStatusLabel(snapshot().status, snapshot().error));
|
|
1879
|
+
effect((_p$) => {
|
|
1880
|
+
var _v$8 = tone(props.context, "info"), _v$9 = tone(props.context, snapshotTone());
|
|
1881
|
+
_v$8 !== _p$.e && (_p$.e = setProp(_el$54, "fg", _v$8, _p$.e));
|
|
1882
|
+
_v$9 !== _p$.t && (_p$.t = setProp(_el$56, "fg", _v$9, _p$.t));
|
|
1883
|
+
return _p$;
|
|
1884
|
+
}, {
|
|
1885
|
+
e: void 0,
|
|
1886
|
+
t: void 0
|
|
1887
|
+
});
|
|
1888
|
+
return _el$53;
|
|
1889
|
+
}
|
|
1890
|
+
}), _el$64);
|
|
1891
|
+
insert(_el$52, createComponent(Show, {
|
|
1892
|
+
get when() {
|
|
1893
|
+
return memo(() => snapshot().error !== void 0)() && snapshot().status !== "ready";
|
|
1894
|
+
},
|
|
1895
|
+
get children() {
|
|
1896
|
+
var _el$57 = createElement("text");
|
|
1897
|
+
insert(_el$57, () => `Último erro: ${snapshot().error}`);
|
|
1898
|
+
effect((_$p) => setProp(_el$57, "fg", muted(props.context), _$p));
|
|
1899
|
+
return _el$57;
|
|
1900
|
+
}
|
|
1901
|
+
}), _el$64);
|
|
1902
|
+
insert(_el$52, createComponent(Show, {
|
|
1903
|
+
get when() {
|
|
1904
|
+
return memo(() => snapshot().status === "needs_setup")() && snapshot().details.length === 0;
|
|
1905
|
+
},
|
|
1906
|
+
get children() {
|
|
1907
|
+
var _el$58 = createElement("text");
|
|
1908
|
+
insertNode(_el$58, createTextNode(`Nenhum provedor elegível: verifique conexão ativa e credencial local compatível.`));
|
|
1909
|
+
effect((_$p) => setProp(_el$58, "fg", muted(props.context), _$p));
|
|
1910
|
+
return _el$58;
|
|
1911
|
+
}
|
|
1912
|
+
}), _el$64);
|
|
1913
|
+
insert(_el$52, createComponent(Show, {
|
|
1914
|
+
get when() {
|
|
1915
|
+
return snapshot().status === "unavailable";
|
|
1916
|
+
},
|
|
1917
|
+
get children() {
|
|
1918
|
+
var _el$60 = createElement("text");
|
|
1919
|
+
insertNode(_el$60, createTextNode(`Não foi possível verificar o status da quota.`));
|
|
1920
|
+
effect((_$p) => setProp(_el$60, "fg", muted(props.context), _$p));
|
|
1921
|
+
return _el$60;
|
|
1922
|
+
}
|
|
1923
|
+
}), _el$64);
|
|
1924
|
+
insert(_el$52, createComponent(Show, {
|
|
1925
|
+
get when() {
|
|
1926
|
+
return snapshot().status === "stale";
|
|
1927
|
+
},
|
|
1928
|
+
get children() {
|
|
1929
|
+
var _el$62 = createElement("text");
|
|
1930
|
+
insertNode(_el$62, createTextNode(`A última resposta continua visível; atualize para tentar novamente.`));
|
|
1931
|
+
effect((_$p) => setProp(_el$62, "fg", muted(props.context), _$p));
|
|
1932
|
+
return _el$62;
|
|
1933
|
+
}
|
|
1934
|
+
}), _el$64);
|
|
1935
|
+
insertNode(_el$64, _el$65);
|
|
1936
|
+
setProp(_el$64, "flexGrow", 1);
|
|
1937
|
+
setProp(_el$64, "flexShrink", 1);
|
|
1938
|
+
setProp(_el$64, "flexBasis", 0);
|
|
1939
|
+
setProp(_el$64, "minHeight", 3);
|
|
1940
|
+
setProp(_el$64, "width", "100%");
|
|
1941
|
+
setProp(_el$64, "scrollY", true);
|
|
1942
|
+
setProp(_el$64, "focusable", true);
|
|
1943
|
+
setProp(_el$64, "border", true);
|
|
1944
|
+
setProp(_el$65, "flexDirection", "column");
|
|
1945
|
+
setProp(_el$65, "paddingX", 1);
|
|
1946
|
+
setProp(_el$65, "paddingY", 1);
|
|
1947
|
+
insert(_el$65, createComponent(For, {
|
|
1948
|
+
get each() {
|
|
1949
|
+
return snapshot().details;
|
|
1950
|
+
},
|
|
1951
|
+
children: (provider) => createComponent(QuotaProviderDetails, {
|
|
1952
|
+
provider,
|
|
1953
|
+
get display() {
|
|
1954
|
+
return preferences().display;
|
|
1955
|
+
},
|
|
1956
|
+
get width() {
|
|
1957
|
+
return props.panel.width - 4;
|
|
1958
|
+
},
|
|
1959
|
+
get context() {
|
|
1960
|
+
return props.context;
|
|
1961
|
+
}
|
|
1962
|
+
})
|
|
1963
|
+
}), null);
|
|
1964
|
+
insert(_el$65, createComponent(ModelUsageDetails, {
|
|
1965
|
+
get context() {
|
|
1966
|
+
return props.context;
|
|
1967
|
+
},
|
|
1968
|
+
get sessionID() {
|
|
1969
|
+
return props.panel.sessionID;
|
|
1970
|
+
},
|
|
1971
|
+
get width() {
|
|
1972
|
+
return props.panel.width - 6;
|
|
1973
|
+
}
|
|
1974
|
+
}), null);
|
|
1975
|
+
insertNode(_el$66, _el$67);
|
|
1976
|
+
insertNode(_el$66, _el$68);
|
|
1977
|
+
insertNode(_el$66, _el$69);
|
|
1978
|
+
insertNode(_el$66, _el$71);
|
|
1979
|
+
setProp(_el$66, "flexDirection", "column");
|
|
1980
|
+
setProp(_el$66, "flexShrink", 0);
|
|
1981
|
+
insert(_el$67, () => `Quota ${preferences().enabled ? "ativada" : "desativada"} · exibição: ${preferences().display === "remaining" ? "restante" : "usado"}`);
|
|
1982
|
+
insert(_el$68, () => `E ${preferences().enabled ? "desativar" : "ativar"} · M alternar usado/restante`);
|
|
1983
|
+
insertNode(_el$69, createTextNode(`↑/↓ rolar · R atualizar`));
|
|
1984
|
+
insertNode(_el$71, createTextNode(`Esc/Q fechar`));
|
|
1985
|
+
effect((_p$) => {
|
|
1986
|
+
var _v$0 = props.panel.focused, _v$1 = muted(props.context), _v$10 = tone(props.context, "info"), _v$11 = muted(props.context), _v$12 = muted(props.context), _v$13 = muted(props.context), _v$14 = muted(props.context);
|
|
1987
|
+
_v$0 !== _p$.e && (_p$.e = setProp(_el$64, "focused", _v$0, _p$.e));
|
|
1988
|
+
_v$1 !== _p$.t && (_p$.t = setProp(_el$64, "borderColor", _v$1, _p$.t));
|
|
1989
|
+
_v$10 !== _p$.a && (_p$.a = setProp(_el$64, "focusedBorderColor", _v$10, _p$.a));
|
|
1990
|
+
_v$11 !== _p$.o && (_p$.o = setProp(_el$67, "fg", _v$11, _p$.o));
|
|
1991
|
+
_v$12 !== _p$.i && (_p$.i = setProp(_el$68, "fg", _v$12, _p$.i));
|
|
1992
|
+
_v$13 !== _p$.n && (_p$.n = setProp(_el$69, "fg", _v$13, _p$.n));
|
|
1993
|
+
_v$14 !== _p$.s && (_p$.s = setProp(_el$71, "fg", _v$14, _p$.s));
|
|
1994
|
+
return _p$;
|
|
1995
|
+
}, {
|
|
1996
|
+
e: void 0,
|
|
1997
|
+
t: void 0,
|
|
1998
|
+
a: void 0,
|
|
1999
|
+
o: void 0,
|
|
2000
|
+
i: void 0,
|
|
2001
|
+
n: void 0,
|
|
2002
|
+
s: void 0
|
|
2003
|
+
});
|
|
2004
|
+
return _el$52;
|
|
2005
|
+
})();
|
|
2006
|
+
}
|
|
2007
|
+
function QuotaCommandLayer(props) {
|
|
2008
|
+
const goCheck = quotaGoCheckCommand(props.context);
|
|
2009
|
+
props.context.keymap.layer(() => ({
|
|
2010
|
+
mode: "global",
|
|
2011
|
+
commands: [quotaOpenCommand(props.context), goCheck]
|
|
2012
|
+
}));
|
|
2013
|
+
return null;
|
|
2014
|
+
}
|
|
2015
|
+
/** Register footer/panel controls and own teardown of the shared sidebar runtime. */
|
|
2016
|
+
function registerQuotaTui(context, runtime) {
|
|
2017
|
+
const unregister = [];
|
|
2018
|
+
try {
|
|
2019
|
+
unregister.push(context.ui.slot({
|
|
2020
|
+
append: "prompt.footer",
|
|
2021
|
+
render: () => createComponent(QuotaFooterSummary, {
|
|
2022
|
+
context,
|
|
2023
|
+
runtime
|
|
2024
|
+
})
|
|
2025
|
+
}));
|
|
2026
|
+
unregister.push(context.ui.slot({
|
|
2027
|
+
append: "session.panel",
|
|
2028
|
+
render: (panel) => panel.name === "pantheon.quota" ? createComponent(QuotaPanel, {
|
|
2029
|
+
context,
|
|
2030
|
+
runtime,
|
|
2031
|
+
panel
|
|
2032
|
+
}) : null
|
|
2033
|
+
}));
|
|
2034
|
+
unregister.push(context.ui.slot({
|
|
2035
|
+
append: "app",
|
|
2036
|
+
render: () => createComponent(QuotaCommandLayer, {
|
|
2037
|
+
context,
|
|
2038
|
+
runtime
|
|
2039
|
+
})
|
|
2040
|
+
}));
|
|
2041
|
+
} catch (error) {
|
|
2042
|
+
runtime.dispose();
|
|
2043
|
+
unregister.reverse().forEach((dispose) => {
|
|
2044
|
+
dispose();
|
|
2045
|
+
});
|
|
2046
|
+
throw error;
|
|
2047
|
+
}
|
|
2048
|
+
return () => {
|
|
2049
|
+
runtime.dispose();
|
|
2050
|
+
unregister.reverse().forEach((dispose) => {
|
|
2051
|
+
dispose();
|
|
2052
|
+
});
|
|
2053
|
+
};
|
|
2054
|
+
}
|
|
2055
|
+
//#endregion
|
|
8
2056
|
//#region src/index-v2.tsx
|
|
9
2057
|
/** @jsxImportSource @opentui/solid */
|
|
10
2058
|
const SINGLETON = Symbol.for("pantheon.tui.v2.loaded");
|
|
@@ -260,17 +2308,6 @@ function computeContextUsage(messages, contextLimit, revertMessageID) {
|
|
|
260
2308
|
}
|
|
261
2309
|
return null;
|
|
262
2310
|
}
|
|
263
|
-
/** Semantic tone for a context percentage, inclusive at the top of each band:
|
|
264
|
-
* info (blue) up to 25%, success (green) up to 50%, warning (yellow) up to
|
|
265
|
-
* 90%, error (red) above it. Four explicit stages, each backed by a feedback
|
|
266
|
-
* token, so the gauge follows the active theme. Pure. */
|
|
267
|
-
function contextUsageTone(percent) {
|
|
268
|
-
if (percent > 90) return "error";
|
|
269
|
-
if (percent > 50) return "warning";
|
|
270
|
-
if (percent > 25) return "success";
|
|
271
|
-
return "info";
|
|
272
|
-
}
|
|
273
|
-
/** The gauge's four stages, one per theme feedback token. */
|
|
274
2311
|
/** Color for one gauge stage. Filled cells and the percent value both come from
|
|
275
2312
|
* this one call, so the bar and its number can never disagree. `theme` is the
|
|
276
2313
|
* host's resolved theme (loosely typed at runtime); a missing token falls back
|
|
@@ -360,60 +2397,8 @@ function turnTokensPerSecond(messages, position) {
|
|
|
360
2397
|
const rate = output / (duration / 1e3);
|
|
361
2398
|
return Number.isFinite(rate) && rate > 0 ? rate : null;
|
|
362
2399
|
}
|
|
363
|
-
/** Last-message telemetry the Context block renders in muted text. Both halves
|
|
364
|
-
* are optional; the block renders no line when neither is available. */
|
|
365
|
-
/** Thousands-separated token total: `55320` → `55,320` (en-US, matching the
|
|
366
|
-
* native block this one replaces). Null for a missing/invalid value. Pure. */
|
|
367
|
-
function formatTokenCount(tokens) {
|
|
368
|
-
const value = numberOrNull(tokens);
|
|
369
|
-
if (value === null || value < 0) return null;
|
|
370
|
-
return Math.round(value).toLocaleString("en-US");
|
|
371
|
-
}
|
|
372
|
-
/** Context-window label: `1_000_000` → `1.0M`, `200_000` → `200K`,
|
|
373
|
-
* `128_000` → `128K`, `32_768` → `32K`. Sub-million limits truncate to whole K
|
|
374
|
-
* so the printed window never overstates the model's capacity. Pure. */
|
|
375
|
-
function formatContextWindow(limit) {
|
|
376
|
-
const value = numberOrNull(limit);
|
|
377
|
-
if (value === null || value <= 0) return null;
|
|
378
|
-
if (value >= 1e6) return `${(value / 1e6).toFixed(1)}M`;
|
|
379
|
-
if (value >= 1e3) return `${Math.floor(value / 1e3)}K`;
|
|
380
|
-
return `${Math.floor(value)}`;
|
|
381
|
-
}
|
|
382
|
-
/** Cells in the Context gauge: always rendered in full, so the bar never
|
|
383
|
-
* changes width between refreshes. With the space, the percent and the
|
|
384
|
-
* `of <window>` tail (at most 9 columns) the line stays inside 34 columns. */
|
|
385
|
-
const CONTEXT_BAR_CELLS = 12;
|
|
386
|
-
/** Filled cell (U+25B0) and empty cell (U+25B1), both single-width. */
|
|
387
|
-
const CONTEXT_BAR_FILLED_CELL = "▰";
|
|
388
|
-
const CONTEXT_BAR_EMPTY_CELL = "▱";
|
|
389
|
-
/** Filled cells for a percentage: rounded, clamped to `0..cells`, so 0% is an
|
|
390
|
-
* empty bar and anything at or above 100% is a full one. Pure. */
|
|
391
|
-
function contextBarFilled(percent, cells = 12) {
|
|
392
|
-
const total = Math.max(1, Math.floor(cells));
|
|
393
|
-
const filled = Math.round(percent / 100 * total);
|
|
394
|
-
if (!Number.isFinite(filled)) return 0;
|
|
395
|
-
return Math.min(total, Math.max(0, filled));
|
|
396
|
-
}
|
|
397
|
-
/** The gauge split into its toned half (filled cells) and its muted half (empty
|
|
398
|
-
* cells), so the caller colors each side. Null when the percentage is missing:
|
|
399
|
-
* the Context block then keeps its tokens + cost rows and renders no bar. Pure. */
|
|
400
|
-
function contextBar(percent, cells = 12) {
|
|
401
|
-
const value = numberOrNull(percent);
|
|
402
|
-
if (value === null) return null;
|
|
403
|
-
const total = Math.max(1, Math.floor(cells));
|
|
404
|
-
const filled = contextBarFilled(value, total);
|
|
405
|
-
return {
|
|
406
|
-
filled: "▰".repeat(filled),
|
|
407
|
-
empty: "▱".repeat(total - filled)
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
/** USD spent with two decimals (`$0.18`), the native block's format. Null for
|
|
411
|
-
* a missing/negative value. Pure. */
|
|
412
|
-
function formatSpent(cost) {
|
|
413
|
-
const value = numberOrNull(cost);
|
|
414
|
-
if (value === null || value < 0) return null;
|
|
415
|
-
return `$${value.toFixed(2)}`;
|
|
416
|
-
}
|
|
2400
|
+
/** Last-message telemetry the Context block renders in muted text. Both halves
|
|
2401
|
+
* are optional; the block renders no line when neither is available. */
|
|
417
2402
|
/** One rendered context row. `lead` and `tail` carry the gauge bar when the row
|
|
418
2403
|
* has one (`lead` is toned with the value, `tail` is muted), so the 12 cells
|
|
419
2404
|
* stay contiguous while the empty half still reads as background. */
|
|
@@ -430,7 +2415,7 @@ function contextBlockRows(usage, cost) {
|
|
|
430
2415
|
lead: null,
|
|
431
2416
|
value: spentValue,
|
|
432
2417
|
tail: null,
|
|
433
|
-
suffix: "
|
|
2418
|
+
suffix: " gasto na sessão",
|
|
434
2419
|
tone: null
|
|
435
2420
|
};
|
|
436
2421
|
if (usage === null) return spent === null ? null : {
|
|
@@ -463,12 +2448,6 @@ function contextBlockRows(usage, cost) {
|
|
|
463
2448
|
spent
|
|
464
2449
|
};
|
|
465
2450
|
}
|
|
466
|
-
/** Models rendered in the Context block before the aggregate `… +N` line. */
|
|
467
|
-
const MODEL_USAGE_VISIBLE_CEILING = 3;
|
|
468
|
-
/** Newest messages read per session — bounds the O(n) walk on long sessions. */
|
|
469
|
-
const MODEL_USAGE_MESSAGE_LIMIT = 400;
|
|
470
|
-
/** Sessions read per family (root + delegations) for the aggregate. */
|
|
471
|
-
const MODEL_USAGE_SESSION_LIMIT = 8;
|
|
472
2451
|
/** Column widths for one model row (labels are muted, numbers right-aligned). */
|
|
473
2452
|
const MODEL_USAGE_MODEL_WIDTH = 12;
|
|
474
2453
|
const MODEL_USAGE_TOKEN_WIDTH = 6;
|
|
@@ -549,6 +2528,30 @@ function modelUsageRows(rows) {
|
|
|
549
2528
|
function modelUsageRowText(row) {
|
|
550
2529
|
return `${row.model.padEnd(12)} ${row.tokens.padStart(6)} ${row.cost.padStart(8)}`;
|
|
551
2530
|
}
|
|
2531
|
+
/** Wrap sidebar text by terminal cells, preserving the complete values. */
|
|
2532
|
+
function sidebarTextLines(value) {
|
|
2533
|
+
return quotaTextLines(value, 34, 0);
|
|
2534
|
+
}
|
|
2535
|
+
/** Align a monetary value when it fits, otherwise preserve it on a new line. */
|
|
2536
|
+
function sidebarMoneyLines(label, value) {
|
|
2537
|
+
const gap = 34 - cellWidth(label) - cellWidth(value);
|
|
2538
|
+
return gap >= 1 ? [`${label}${" ".repeat(gap)}${value}`] : [...sidebarTextLines(label), ...sidebarTextLines(value)];
|
|
2539
|
+
}
|
|
2540
|
+
/** Keep the existing OpenCode periods together when possible. */
|
|
2541
|
+
function contextSpendLines(value) {
|
|
2542
|
+
const match = /^(.*\S)\s+(<?\$\S+)$/.exec(value);
|
|
2543
|
+
return match?.[1] && match[2] && cellWidth(value) <= 34 ? sidebarMoneyLines(match[1], match[2]) : sidebarTextLines(value);
|
|
2544
|
+
}
|
|
2545
|
+
/** Keep ordinary rows aligned; give oversized values their own lines. */
|
|
2546
|
+
function modelUsageRowLines(row) {
|
|
2547
|
+
const single = modelUsageRowText(row);
|
|
2548
|
+
if (cellWidth(single) <= 34) return [single];
|
|
2549
|
+
return [
|
|
2550
|
+
...sidebarTextLines(row.model),
|
|
2551
|
+
...sidebarTextLines(`Tokens ${row.tokens}`),
|
|
2552
|
+
...sidebarTextLines(`USD ${row.cost}`)
|
|
2553
|
+
];
|
|
2554
|
+
}
|
|
552
2555
|
/** Muted aggregate line for the models beyond the cap (`… +2 $0.03`). Null
|
|
553
2556
|
* when every model fits. Pure. */
|
|
554
2557
|
function hiddenModelUsageText(hidden, hiddenCost) {
|
|
@@ -912,10 +2915,10 @@ function statsRangeMatches(range, sent, scale) {
|
|
|
912
2915
|
const asMilliseconds = Math.abs(from - sent.from * scale) <= 12e4 && Math.abs(to - sent.to * scale) <= 12e4;
|
|
913
2916
|
return sameUnit || asMilliseconds;
|
|
914
2917
|
}
|
|
915
|
-
/** The `Context` block's last line:
|
|
916
|
-
* (`hoje $0.42 · 30d $9.80`). A window without a
|
|
917
|
-
* no usable window at all yields null so the
|
|
918
|
-
* dropped. Pure. */
|
|
2918
|
+
/** The `Context` block's last line: OpenCode stats source and both spend windows
|
|
2919
|
+
* on one muted row (`OpenCode · hoje $0.42 · 30d $9.80`). A window without a
|
|
2920
|
+
* usable amount is omitted, and no usable window at all yields null so the
|
|
2921
|
+
* line (and not the block) is dropped. Pure. */
|
|
919
2922
|
function contextSpendLine(totals) {
|
|
920
2923
|
if (totals === null) return null;
|
|
921
2924
|
const parts = [];
|
|
@@ -923,130 +2926,10 @@ function contextSpendLine(totals) {
|
|
|
923
2926
|
if (today !== null) parts.push(`${SPEND_TODAY_LABEL} ${today}`);
|
|
924
2927
|
const thirtyDays = formatSpendUSD(totals.thirtyDays);
|
|
925
2928
|
if (thirtyDays !== null) parts.push(`30d ${thirtyDays}`);
|
|
926
|
-
return parts.length === 0 ? null : parts.join(SPEND_LINE_SEPARATOR)
|
|
2929
|
+
return parts.length === 0 ? null : `OpenCode${SPEND_LINE_SEPARATOR}${parts.join(SPEND_LINE_SEPARATOR)}`;
|
|
927
2930
|
}
|
|
928
2931
|
/** Grapheme iterator: a cut never splits a surrogate pair, a combining mark
|
|
929
2932
|
* from its base or a ZWJ emoji sequence, so truncation stays cell-exact. */
|
|
930
|
-
const GRAPHEMES = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
931
|
-
/** A grapheme the host draws two cells wide: emoji presentation, an extended
|
|
932
|
-
* pictograph (a bare `❤` counts too, exactly as the host's `emoji-regex`
|
|
933
|
-
* does) and a regional-indicator pair (a flag). */
|
|
934
|
-
const EMOJI_GLYPH = /\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{Regional_Indicator}/u;
|
|
935
|
-
/** VS16 asks for emoji presentation; without it `1` is one cell, with it the
|
|
936
|
-
* keycap sequence is drawn as one two-cell glyph. */
|
|
937
|
-
const EMOJI_PRESENTATION_SELECTOR = "️";
|
|
938
|
-
/** Unicode default-ignorable code points carry no width of their own. */
|
|
939
|
-
const IGNORABLE_GLYPH = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
940
|
-
/** East Asian Wide/Fullwidth ranges — two cells, never the ambiguous width
|
|
941
|
-
* (the host measures ambiguous as narrow, so `▸`/`✓`/`—` stay one cell).
|
|
942
|
-
* Generated from the host's own measurement (`string-width` over every code
|
|
943
|
-
* point, emoji excluded), so this table can be regenerated verbatim when the
|
|
944
|
-
* host upgrades its Unicode data instead of being hand-edited. */
|
|
945
|
-
const CELL_WIDE_RANGES = [
|
|
946
|
-
[4352, 4446],
|
|
947
|
-
[9001, 9002],
|
|
948
|
-
[9776, 9783],
|
|
949
|
-
[9866, 9871],
|
|
950
|
-
[11904, 11929],
|
|
951
|
-
[11931, 12019],
|
|
952
|
-
[12032, 12245],
|
|
953
|
-
[12272, 12335],
|
|
954
|
-
[12337, 12348],
|
|
955
|
-
[12350, 12350],
|
|
956
|
-
[12353, 12438],
|
|
957
|
-
[12441, 12543],
|
|
958
|
-
[12549, 12591],
|
|
959
|
-
[12593, 12643],
|
|
960
|
-
[12645, 12686],
|
|
961
|
-
[12688, 12773],
|
|
962
|
-
[12783, 12830],
|
|
963
|
-
[12832, 12871],
|
|
964
|
-
[12880, 12950],
|
|
965
|
-
[12952, 12952],
|
|
966
|
-
[12954, 42124],
|
|
967
|
-
[42128, 42182],
|
|
968
|
-
[43360, 43388],
|
|
969
|
-
[44032, 55203],
|
|
970
|
-
[63744, 64255],
|
|
971
|
-
[65040, 65049],
|
|
972
|
-
[65072, 65106],
|
|
973
|
-
[65108, 65126],
|
|
974
|
-
[65128, 65131],
|
|
975
|
-
[65281, 65376],
|
|
976
|
-
[65504, 65510],
|
|
977
|
-
[94176, 94180],
|
|
978
|
-
[94192, 94198],
|
|
979
|
-
[94208, 101594],
|
|
980
|
-
[101631, 101664],
|
|
981
|
-
[101760, 101874],
|
|
982
|
-
[101888, 102801],
|
|
983
|
-
[102816, 102866],
|
|
984
|
-
[110576, 110579],
|
|
985
|
-
[110581, 110587],
|
|
986
|
-
[110589, 110590],
|
|
987
|
-
[110592, 110888],
|
|
988
|
-
[110898, 110898],
|
|
989
|
-
[110928, 110930],
|
|
990
|
-
[110933, 110933],
|
|
991
|
-
[110948, 110952],
|
|
992
|
-
[110960, 111355],
|
|
993
|
-
[119552, 119638],
|
|
994
|
-
[119648, 119670],
|
|
995
|
-
[127488, 127488],
|
|
996
|
-
[127504, 127513],
|
|
997
|
-
[127515, 127534],
|
|
998
|
-
[127536, 127537],
|
|
999
|
-
[127547, 127547],
|
|
1000
|
-
[127552, 127560],
|
|
1001
|
-
[127584, 127589],
|
|
1002
|
-
[131072, 196605],
|
|
1003
|
-
[196608, 262141]
|
|
1004
|
-
];
|
|
1005
|
-
/** One code point the terminal draws no cell for: control characters, the
|
|
1006
|
-
* zero-width joiners/marks, combining marks and variation selectors. */
|
|
1007
|
-
function isZeroWidthCodePoint(code, glyph) {
|
|
1008
|
-
if (code <= 31 || code >= 127 && code <= 159) return true;
|
|
1009
|
-
if (code >= 8203 && code <= 8207) return true;
|
|
1010
|
-
if (code === 65279) return true;
|
|
1011
|
-
if (code >= 768 && code <= 879) return true;
|
|
1012
|
-
if (code >= 6832 && code <= 6911) return true;
|
|
1013
|
-
if (code >= 7616 && code <= 7679) return true;
|
|
1014
|
-
if (code >= 8400 && code <= 8447) return true;
|
|
1015
|
-
if (code >= 65024 && code <= 65039) return true;
|
|
1016
|
-
if (code >= 65056 && code <= 65071) return true;
|
|
1017
|
-
if (code >= 917760 && code <= 917999) return true;
|
|
1018
|
-
if (code >= 55296 && code <= 57343) return true;
|
|
1019
|
-
return IGNORABLE_GLYPH.test(glyph);
|
|
1020
|
-
}
|
|
1021
|
-
function isWideCodePoint(code) {
|
|
1022
|
-
for (const [low, high] of CELL_WIDE_RANGES) {
|
|
1023
|
-
if (code < low) return false;
|
|
1024
|
-
if (code <= high) return true;
|
|
1025
|
-
}
|
|
1026
|
-
return false;
|
|
1027
|
-
}
|
|
1028
|
-
/** Cells one grapheme occupies. */
|
|
1029
|
-
function graphemeWidth(segment) {
|
|
1030
|
-
if (EMOJI_GLYPH.test(segment)) return 2;
|
|
1031
|
-
if (segment.length > 1 && segment.includes(EMOJI_PRESENTATION_SELECTOR)) return 2;
|
|
1032
|
-
let width = 0;
|
|
1033
|
-
for (const glyph of segment) {
|
|
1034
|
-
const code = glyph.codePointAt(0) ?? 0;
|
|
1035
|
-
if (isZeroWidthCodePoint(code, glyph)) continue;
|
|
1036
|
-
width += isWideCodePoint(code) ? 2 : 1;
|
|
1037
|
-
}
|
|
1038
|
-
return width;
|
|
1039
|
-
}
|
|
1040
|
-
/** Terminal cells `value` occupies — the unit every column in this plugin is
|
|
1041
|
-
* measured in. Mirrors the host (that is how `@opentui/core` sizes a text
|
|
1042
|
-
* run): emoji count as two cells, East Asian Wide/Fullwidth as two, East
|
|
1043
|
-
* Asian Ambiguous as one, combining marks and variation selectors as none.
|
|
1044
|
-
* Pure. */
|
|
1045
|
-
function cellWidth(value) {
|
|
1046
|
-
let width = 0;
|
|
1047
|
-
for (const { segment } of GRAPHEMES.segment(value)) width += graphemeWidth(segment);
|
|
1048
|
-
return width;
|
|
1049
|
-
}
|
|
1050
2933
|
/** Clamp a free-form label to `max` terminal cells without wrapping. The width
|
|
1051
2934
|
* is measured in display cells, never in UTF-16 code units: a CJK or emoji
|
|
1052
2935
|
* label used to overflow the column it was cut for (`計画の移行` is 5 code
|
|
@@ -1084,9 +2967,9 @@ const HEADER_MAX_WIDTH = 34;
|
|
|
1084
2967
|
function presetHeaderLine(presetName, providerID) {
|
|
1085
2968
|
const base = `▸ ${presetName.trim() === "" ? "default" : presetName.trim()}`;
|
|
1086
2969
|
const provider = providerID === null ? "" : providerID.trim();
|
|
1087
|
-
if (provider === "") return truncateLabel(base,
|
|
1088
|
-
const room =
|
|
1089
|
-
if (room < 2) return truncateLabel(base,
|
|
2970
|
+
if (provider === "") return truncateLabel(base, HEADER_MAX_WIDTH);
|
|
2971
|
+
const room = HEADER_MAX_WIDTH - `${base} · `.length;
|
|
2972
|
+
if (room < 2) return truncateLabel(base, HEADER_MAX_WIDTH);
|
|
1090
2973
|
return `${base} · ${truncateLabel(provider, room)}`;
|
|
1091
2974
|
}
|
|
1092
2975
|
/** One classification plus the evidence that produced it. */
|
|
@@ -2731,18 +4614,17 @@ function createSidebarModel(context, sessionID, gitExec = defaultGitExec) {
|
|
|
2731
4614
|
}
|
|
2732
4615
|
});
|
|
2733
4616
|
const contextUsage = createMemo(() => {
|
|
2734
|
-
const list = messages();
|
|
4617
|
+
const list = messages().slice(-400);
|
|
2735
4618
|
if (list.length === 0) return null;
|
|
2736
4619
|
const refs = modelRefs();
|
|
2737
|
-
const ref =
|
|
2738
|
-
|
|
4620
|
+
const ref = resolveActiveModelRef(refs.sessionRef, list, refs.agentRef);
|
|
4621
|
+
if (ref === null) return null;
|
|
4622
|
+
let models = [];
|
|
2739
4623
|
try {
|
|
2740
|
-
const
|
|
2741
|
-
|
|
2742
|
-
} catch {
|
|
2743
|
-
|
|
2744
|
-
}
|
|
2745
|
-
return computeContextUsage(list, limit, session()?.revert?.messageID);
|
|
4624
|
+
const result = context.data.location?.model?.list?.(location);
|
|
4625
|
+
if (Array.isArray(result)) models = result;
|
|
4626
|
+
} catch {}
|
|
4627
|
+
return resolveModelContextSnapshot(list, ref, models, session()?.revert?.messageID);
|
|
2746
4628
|
});
|
|
2747
4629
|
const cachePerformance = createMemo(() => {
|
|
2748
4630
|
const message = lastAssistantWithTokens(messages(), session()?.revert?.messageID);
|
|
@@ -2874,47 +4756,96 @@ function createSidebarModel(context, sessionID, gitExec = defaultGitExec) {
|
|
|
2874
4756
|
* cells), the value, the muted gauge tail (empty cells) and the muted unit
|
|
2875
4757
|
* suffix (`tokens` / `of 200K` / `spent`). */
|
|
2876
4758
|
function ContextRowView(props) {
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
4759
|
+
const fullWidth = () => cellWidth(`${props.row.lead ?? ""}${props.row.tail ?? ""}${props.row.value}${props.row.suffix ?? ""}`);
|
|
4760
|
+
return createComponent(Show, {
|
|
4761
|
+
get when() {
|
|
4762
|
+
return props.row.suffix !== " gasto na sessão";
|
|
4763
|
+
},
|
|
4764
|
+
get fallback() {
|
|
4765
|
+
return (() => {
|
|
4766
|
+
var _el$3 = createElement("box");
|
|
4767
|
+
setProp(_el$3, "flexDirection", "column");
|
|
4768
|
+
insert(_el$3, createComponent(For, {
|
|
4769
|
+
get each() {
|
|
4770
|
+
return sidebarMoneyLines("gasto na sessão", props.row.value);
|
|
4771
|
+
},
|
|
4772
|
+
children: (line) => (() => {
|
|
4773
|
+
var _el$4 = createElement("text");
|
|
4774
|
+
insert(_el$4, line);
|
|
4775
|
+
effect((_$p) => setProp(_el$4, "fg", props.fg, _$p));
|
|
4776
|
+
return _el$4;
|
|
4777
|
+
})()
|
|
4778
|
+
}));
|
|
2889
4779
|
return _el$3;
|
|
2890
|
-
})()
|
|
2891
|
-
}
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
4780
|
+
})();
|
|
4781
|
+
},
|
|
4782
|
+
get children() {
|
|
4783
|
+
return createComponent(Show, {
|
|
4784
|
+
get when() {
|
|
4785
|
+
return fullWidth() <= 34;
|
|
4786
|
+
},
|
|
4787
|
+
get fallback() {
|
|
4788
|
+
return (() => {
|
|
4789
|
+
var _el$5 = createElement("box");
|
|
4790
|
+
setProp(_el$5, "flexDirection", "column");
|
|
4791
|
+
insert(_el$5, createComponent(For, {
|
|
4792
|
+
get each() {
|
|
4793
|
+
return sidebarTextLines(`${props.row.value.trim()}${props.row.suffix ?? ""}`);
|
|
4794
|
+
},
|
|
4795
|
+
children: (line) => (() => {
|
|
4796
|
+
var _el$6 = createElement("text");
|
|
4797
|
+
insert(_el$6, line);
|
|
4798
|
+
effect((_$p) => setProp(_el$6, "fg", props.fg, _$p));
|
|
4799
|
+
return _el$6;
|
|
4800
|
+
})()
|
|
4801
|
+
}));
|
|
4802
|
+
return _el$5;
|
|
4803
|
+
})();
|
|
4804
|
+
},
|
|
4805
|
+
get children() {
|
|
4806
|
+
var _el$ = createElement("box"), _el$2 = createElement("text");
|
|
4807
|
+
insertNode(_el$, _el$2);
|
|
4808
|
+
setProp(_el$, "flexDirection", "row");
|
|
4809
|
+
insert(_el$, createComponent(Show, {
|
|
4810
|
+
get when() {
|
|
4811
|
+
return props.row.lead;
|
|
4812
|
+
},
|
|
4813
|
+
children: (lead) => (() => {
|
|
4814
|
+
var _el$7 = createElement("text");
|
|
4815
|
+
insert(_el$7, lead);
|
|
4816
|
+
effect((_$p) => setProp(_el$7, "fg", props.fg, _$p));
|
|
4817
|
+
return _el$7;
|
|
4818
|
+
})()
|
|
4819
|
+
}), _el$2);
|
|
4820
|
+
insert(_el$, createComponent(Show, {
|
|
4821
|
+
get when() {
|
|
4822
|
+
return props.row.tail;
|
|
4823
|
+
},
|
|
4824
|
+
children: (tail) => (() => {
|
|
4825
|
+
var _el$8 = createElement("text");
|
|
4826
|
+
insert(_el$8, tail);
|
|
4827
|
+
effect((_$p) => setProp(_el$8, "fg", props.muted, _$p));
|
|
4828
|
+
return _el$8;
|
|
4829
|
+
})()
|
|
4830
|
+
}), _el$2);
|
|
4831
|
+
insert(_el$2, () => props.row.value);
|
|
4832
|
+
insert(_el$, createComponent(Show, {
|
|
4833
|
+
get when() {
|
|
4834
|
+
return props.row.suffix;
|
|
4835
|
+
},
|
|
4836
|
+
children: (suffix) => (() => {
|
|
4837
|
+
var _el$9 = createElement("text");
|
|
4838
|
+
insert(_el$9, suffix);
|
|
4839
|
+
effect((_$p) => setProp(_el$9, "fg", props.muted, _$p));
|
|
4840
|
+
return _el$9;
|
|
4841
|
+
})()
|
|
4842
|
+
}), null);
|
|
4843
|
+
effect((_$p) => setProp(_el$2, "fg", props.fg, _$p));
|
|
4844
|
+
return _el$;
|
|
4845
|
+
}
|
|
4846
|
+
});
|
|
4847
|
+
}
|
|
4848
|
+
});
|
|
2918
4849
|
}
|
|
2919
4850
|
/** Block title: a muted single-width glyph, then the bold label. The fixed
|
|
2920
4851
|
* header at the top of the sidebar deliberately renders no icon. `summary` is
|
|
@@ -2922,34 +4853,34 @@ function ContextRowView(props) {
|
|
|
2922
4853
|
* stays one line. */
|
|
2923
4854
|
function BlockHeader(props) {
|
|
2924
4855
|
return (() => {
|
|
2925
|
-
var _el$
|
|
2926
|
-
insertNode(_el$
|
|
2927
|
-
insertNode(_el$
|
|
2928
|
-
setProp(_el$
|
|
2929
|
-
insert(_el$
|
|
2930
|
-
setProp(_el$
|
|
2931
|
-
insert(_el$
|
|
2932
|
-
insert(_el$
|
|
4856
|
+
var _el$0 = createElement("box"), _el$1 = createElement("text"), _el$10 = createElement("text");
|
|
4857
|
+
insertNode(_el$0, _el$1);
|
|
4858
|
+
insertNode(_el$0, _el$10);
|
|
4859
|
+
setProp(_el$0, "flexDirection", "row");
|
|
4860
|
+
insert(_el$1, () => `${props.icon} `);
|
|
4861
|
+
setProp(_el$10, "attributes", 1);
|
|
4862
|
+
insert(_el$10, () => props.label);
|
|
4863
|
+
insert(_el$0, createComponent(Show, {
|
|
2933
4864
|
get when() {
|
|
2934
4865
|
return props.summary;
|
|
2935
4866
|
},
|
|
2936
4867
|
children: (summary) => (() => {
|
|
2937
|
-
var _el$
|
|
2938
|
-
insert(_el$
|
|
2939
|
-
effect((_$p) => setProp(_el$
|
|
2940
|
-
return _el$
|
|
4868
|
+
var _el$11 = createElement("text");
|
|
4869
|
+
insert(_el$11, () => `${SPEND_LINE_SEPARATOR}${summary()}`);
|
|
4870
|
+
effect((_$p) => setProp(_el$11, "fg", props.muted, _$p));
|
|
4871
|
+
return _el$11;
|
|
2941
4872
|
})()
|
|
2942
4873
|
}), null);
|
|
2943
4874
|
effect((_p$) => {
|
|
2944
4875
|
var _v$ = props.muted, _v$2 = props.fg;
|
|
2945
|
-
_v$ !== _p$.e && (_p$.e = setProp(_el$
|
|
2946
|
-
_v$2 !== _p$.t && (_p$.t = setProp(_el$
|
|
4876
|
+
_v$ !== _p$.e && (_p$.e = setProp(_el$1, "fg", _v$, _p$.e));
|
|
4877
|
+
_v$2 !== _p$.t && (_p$.t = setProp(_el$10, "fg", _v$2, _p$.t));
|
|
2947
4878
|
return _p$;
|
|
2948
4879
|
}, {
|
|
2949
4880
|
e: void 0,
|
|
2950
4881
|
t: void 0
|
|
2951
4882
|
});
|
|
2952
|
-
return _el$
|
|
4883
|
+
return _el$0;
|
|
2953
4884
|
})();
|
|
2954
4885
|
}
|
|
2955
4886
|
function Sidebar(props) {
|
|
@@ -2979,62 +4910,62 @@ function Sidebar(props) {
|
|
|
2979
4910
|
};
|
|
2980
4911
|
const failedSuffix = () => failedSuffixText(dispatchView()?.failures);
|
|
2981
4912
|
return (() => {
|
|
2982
|
-
var _el$
|
|
2983
|
-
insertNode(_el$
|
|
2984
|
-
insertNode(_el$
|
|
2985
|
-
setProp(_el$
|
|
2986
|
-
setProp(_el$
|
|
2987
|
-
setProp(_el$
|
|
2988
|
-
setProp(_el$
|
|
2989
|
-
insert(_el$
|
|
2990
|
-
insert(_el$
|
|
2991
|
-
insert(_el$
|
|
4913
|
+
var _el$12 = createElement("box"), _el$13 = createElement("text"), _el$14 = createElement("text");
|
|
4914
|
+
insertNode(_el$12, _el$13);
|
|
4915
|
+
insertNode(_el$12, _el$14);
|
|
4916
|
+
setProp(_el$12, "flexDirection", "column");
|
|
4917
|
+
setProp(_el$12, "width", "100%");
|
|
4918
|
+
setProp(_el$12, "padding", 1);
|
|
4919
|
+
setProp(_el$13, "attributes", 1);
|
|
4920
|
+
insert(_el$13, `Pantheon v1.6.2-beta.1`);
|
|
4921
|
+
insert(_el$14, () => presetHeaderLine(model.preset().name ?? "", model.provider()));
|
|
4922
|
+
insert(_el$12, createComponent(Show, {
|
|
2992
4923
|
get when() {
|
|
2993
4924
|
return memo(() => model.activeSessionID() !== "")() && model.session();
|
|
2994
4925
|
},
|
|
2995
4926
|
get fallback() {
|
|
2996
4927
|
return (() => {
|
|
2997
|
-
var _el$
|
|
2998
|
-
insert(_el$
|
|
2999
|
-
effect((_$p) => setProp(_el$
|
|
3000
|
-
return _el$
|
|
4928
|
+
var _el$25 = createElement("text");
|
|
4929
|
+
insert(_el$25, () => sidebarPlaceholder(props.sessionID));
|
|
4930
|
+
effect((_$p) => setProp(_el$25, "fg", muted(), _$p));
|
|
4931
|
+
return _el$25;
|
|
3001
4932
|
})();
|
|
3002
4933
|
},
|
|
3003
4934
|
children: (current) => (() => {
|
|
3004
|
-
var _el$
|
|
3005
|
-
insert(_el$
|
|
3006
|
-
effect((_$p) => setProp(_el$
|
|
3007
|
-
return _el$
|
|
4935
|
+
var _el$26 = createElement("text");
|
|
4936
|
+
insert(_el$26, () => `Sessão: ${truncateLabel(current().title || current().id)}`);
|
|
4937
|
+
effect((_$p) => setProp(_el$26, "fg", text(), _$p));
|
|
4938
|
+
return _el$26;
|
|
3008
4939
|
})()
|
|
3009
4940
|
}), null);
|
|
3010
|
-
insert(_el$
|
|
4941
|
+
insert(_el$12, createComponent(Show, {
|
|
3011
4942
|
get when() {
|
|
3012
4943
|
return model.blocks().length > 0;
|
|
3013
4944
|
},
|
|
3014
4945
|
get children() {
|
|
3015
|
-
var _el$
|
|
3016
|
-
setProp(_el$
|
|
3017
|
-
return _el$
|
|
4946
|
+
var _el$15 = createElement("box");
|
|
4947
|
+
setProp(_el$15, "height", 1);
|
|
4948
|
+
return _el$15;
|
|
3018
4949
|
}
|
|
3019
4950
|
}), null);
|
|
3020
|
-
insert(_el$
|
|
4951
|
+
insert(_el$12, createComponent(Show, {
|
|
3021
4952
|
get when() {
|
|
3022
4953
|
return block("context");
|
|
3023
4954
|
},
|
|
3024
4955
|
get children() {
|
|
3025
|
-
var _el$
|
|
3026
|
-
setProp(_el$
|
|
3027
|
-
insert(_el$
|
|
4956
|
+
var _el$16 = createElement("box");
|
|
4957
|
+
setProp(_el$16, "flexDirection", "column");
|
|
4958
|
+
insert(_el$16, createComponent(Show, {
|
|
3028
4959
|
get when() {
|
|
3029
4960
|
return spacer("context");
|
|
3030
4961
|
},
|
|
3031
4962
|
get children() {
|
|
3032
|
-
var _el$
|
|
3033
|
-
setProp(_el$
|
|
3034
|
-
return _el$
|
|
4963
|
+
var _el$17 = createElement("box");
|
|
4964
|
+
setProp(_el$17, "height", 1);
|
|
4965
|
+
return _el$17;
|
|
3035
4966
|
}
|
|
3036
4967
|
}), null);
|
|
3037
|
-
insert(_el$
|
|
4968
|
+
insert(_el$16, createComponent(BlockHeader, {
|
|
3038
4969
|
get icon() {
|
|
3039
4970
|
return BLOCK_ICONS.context;
|
|
3040
4971
|
},
|
|
@@ -3046,14 +4977,14 @@ function Sidebar(props) {
|
|
|
3046
4977
|
return muted();
|
|
3047
4978
|
}
|
|
3048
4979
|
}), null);
|
|
3049
|
-
insert(_el$
|
|
4980
|
+
insert(_el$16, createComponent(Show, {
|
|
3050
4981
|
get when() {
|
|
3051
4982
|
return contextRows();
|
|
3052
4983
|
},
|
|
3053
4984
|
children: (rows) => (() => {
|
|
3054
|
-
var _el$
|
|
3055
|
-
setProp(_el$
|
|
3056
|
-
insert(_el$
|
|
4985
|
+
var _el$27 = createElement("box");
|
|
4986
|
+
setProp(_el$27, "flexDirection", "column");
|
|
4987
|
+
insert(_el$27, createComponent(Show, {
|
|
3057
4988
|
get when() {
|
|
3058
4989
|
return rows().tokens;
|
|
3059
4990
|
},
|
|
@@ -3069,7 +5000,7 @@ function Sidebar(props) {
|
|
|
3069
5000
|
}
|
|
3070
5001
|
})
|
|
3071
5002
|
}), null);
|
|
3072
|
-
insert(_el$
|
|
5003
|
+
insert(_el$27, createComponent(Show, {
|
|
3073
5004
|
get when() {
|
|
3074
5005
|
return rows().percent;
|
|
3075
5006
|
},
|
|
@@ -3085,7 +5016,7 @@ function Sidebar(props) {
|
|
|
3085
5016
|
}
|
|
3086
5017
|
})
|
|
3087
5018
|
}), null);
|
|
3088
|
-
insert(_el$
|
|
5019
|
+
insert(_el$27, createComponent(Show, {
|
|
3089
5020
|
get when() {
|
|
3090
5021
|
return rows().spent;
|
|
3091
5022
|
},
|
|
@@ -3101,90 +5032,112 @@ function Sidebar(props) {
|
|
|
3101
5032
|
}
|
|
3102
5033
|
})
|
|
3103
5034
|
}), null);
|
|
3104
|
-
insert(_el$
|
|
5035
|
+
insert(_el$27, createComponent(Show, {
|
|
5036
|
+
get when() {
|
|
5037
|
+
return usageRows().length > 0;
|
|
5038
|
+
},
|
|
5039
|
+
get children() {
|
|
5040
|
+
return [(() => {
|
|
5041
|
+
var _el$28 = createElement("text");
|
|
5042
|
+
insertNode(_el$28, createTextNode(`Sessão · custo reportado`));
|
|
5043
|
+
effect((_$p) => setProp(_el$28, "fg", muted(), _$p));
|
|
5044
|
+
return _el$28;
|
|
5045
|
+
})(), (() => {
|
|
5046
|
+
var _el$30 = createElement("text");
|
|
5047
|
+
insertNode(_el$30, createTextNode(`Modelo Tokens USD`));
|
|
5048
|
+
effect((_$p) => setProp(_el$30, "fg", muted(), _$p));
|
|
5049
|
+
return _el$30;
|
|
5050
|
+
})()];
|
|
5051
|
+
}
|
|
5052
|
+
}), null);
|
|
5053
|
+
insert(_el$27, createComponent(For, {
|
|
3105
5054
|
get each() {
|
|
3106
5055
|
return usageRows();
|
|
3107
5056
|
},
|
|
3108
5057
|
children: (row) => (() => {
|
|
3109
|
-
var _el$
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
}, {
|
|
3124
|
-
e: void 0,
|
|
3125
|
-
t: void 0,
|
|
3126
|
-
a: void 0
|
|
3127
|
-
});
|
|
3128
|
-
return _el$24;
|
|
5058
|
+
var _el$32 = createElement("box");
|
|
5059
|
+
setProp(_el$32, "flexDirection", "column");
|
|
5060
|
+
insert(_el$32, createComponent(For, {
|
|
5061
|
+
get each() {
|
|
5062
|
+
return modelUsageRowLines(row);
|
|
5063
|
+
},
|
|
5064
|
+
children: (line) => (() => {
|
|
5065
|
+
var _el$33 = createElement("text");
|
|
5066
|
+
insert(_el$33, line);
|
|
5067
|
+
effect((_$p) => setProp(_el$33, "fg", text(), _$p));
|
|
5068
|
+
return _el$33;
|
|
5069
|
+
})()
|
|
5070
|
+
}));
|
|
5071
|
+
return _el$32;
|
|
3129
5072
|
})()
|
|
3130
5073
|
}), null);
|
|
3131
|
-
insert(_el$
|
|
5074
|
+
insert(_el$27, createComponent(Show, {
|
|
3132
5075
|
get when() {
|
|
3133
5076
|
return usageHidden();
|
|
3134
5077
|
},
|
|
3135
|
-
children: (line) => (
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
5078
|
+
children: (line) => createComponent(For, {
|
|
5079
|
+
get each() {
|
|
5080
|
+
return sidebarTextLines(line());
|
|
5081
|
+
},
|
|
5082
|
+
children: (part) => (() => {
|
|
5083
|
+
var _el$34 = createElement("text");
|
|
5084
|
+
insert(_el$34, part);
|
|
5085
|
+
effect((_$p) => setProp(_el$34, "fg", muted(), _$p));
|
|
5086
|
+
return _el$34;
|
|
5087
|
+
})()
|
|
5088
|
+
})
|
|
3141
5089
|
}), null);
|
|
3142
|
-
return _el$
|
|
5090
|
+
return _el$27;
|
|
3143
5091
|
})()
|
|
3144
5092
|
}), null);
|
|
3145
|
-
insert(_el$
|
|
5093
|
+
insert(_el$16, createComponent(Show, {
|
|
3146
5094
|
get when() {
|
|
3147
5095
|
return performanceLine();
|
|
3148
5096
|
},
|
|
3149
5097
|
children: (line) => (() => {
|
|
3150
|
-
var _el$
|
|
3151
|
-
insert(_el$
|
|
3152
|
-
effect((_$p) => setProp(_el$
|
|
3153
|
-
return _el$
|
|
5098
|
+
var _el$35 = createElement("text");
|
|
5099
|
+
insert(_el$35, line);
|
|
5100
|
+
effect((_$p) => setProp(_el$35, "fg", muted(), _$p));
|
|
5101
|
+
return _el$35;
|
|
3154
5102
|
})()
|
|
3155
5103
|
}), null);
|
|
3156
|
-
insert(_el$
|
|
5104
|
+
insert(_el$16, createComponent(Show, {
|
|
3157
5105
|
get when() {
|
|
3158
5106
|
return spendLine();
|
|
3159
5107
|
},
|
|
3160
|
-
children: (line) => (
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
5108
|
+
children: (line) => createComponent(For, {
|
|
5109
|
+
get each() {
|
|
5110
|
+
return contextSpendLines(line());
|
|
5111
|
+
},
|
|
5112
|
+
children: (part) => (() => {
|
|
5113
|
+
var _el$36 = createElement("text");
|
|
5114
|
+
insert(_el$36, part);
|
|
5115
|
+
effect((_$p) => setProp(_el$36, "fg", muted(), _$p));
|
|
5116
|
+
return _el$36;
|
|
5117
|
+
})()
|
|
5118
|
+
})
|
|
3166
5119
|
}), null);
|
|
3167
|
-
return _el$
|
|
5120
|
+
return _el$16;
|
|
3168
5121
|
}
|
|
3169
5122
|
}), null);
|
|
3170
|
-
insert(_el$
|
|
5123
|
+
insert(_el$12, createComponent(Show, {
|
|
3171
5124
|
get when() {
|
|
3172
5125
|
return block("git");
|
|
3173
5126
|
},
|
|
3174
5127
|
get children() {
|
|
3175
|
-
var _el$
|
|
3176
|
-
setProp(_el$
|
|
3177
|
-
insert(_el$
|
|
5128
|
+
var _el$18 = createElement("box");
|
|
5129
|
+
setProp(_el$18, "flexDirection", "column");
|
|
5130
|
+
insert(_el$18, createComponent(Show, {
|
|
3178
5131
|
get when() {
|
|
3179
5132
|
return spacer("git");
|
|
3180
5133
|
},
|
|
3181
5134
|
get children() {
|
|
3182
|
-
var _el$
|
|
3183
|
-
setProp(_el$
|
|
3184
|
-
return _el$
|
|
5135
|
+
var _el$19 = createElement("box");
|
|
5136
|
+
setProp(_el$19, "height", 1);
|
|
5137
|
+
return _el$19;
|
|
3185
5138
|
}
|
|
3186
5139
|
}), null);
|
|
3187
|
-
insert(_el$
|
|
5140
|
+
insert(_el$18, createComponent(BlockHeader, {
|
|
3188
5141
|
get icon() {
|
|
3189
5142
|
return BLOCK_ICONS.git;
|
|
3190
5143
|
},
|
|
@@ -3196,68 +5149,68 @@ function Sidebar(props) {
|
|
|
3196
5149
|
return muted();
|
|
3197
5150
|
}
|
|
3198
5151
|
}), null);
|
|
3199
|
-
insert(_el$
|
|
5152
|
+
insert(_el$18, createComponent(Show, {
|
|
3200
5153
|
get when() {
|
|
3201
5154
|
return model.branch();
|
|
3202
5155
|
},
|
|
3203
5156
|
children: (value) => (() => {
|
|
3204
|
-
var _el$
|
|
3205
|
-
insertNode(_el$
|
|
3206
|
-
insertNode(_el$
|
|
3207
|
-
setProp(_el$
|
|
3208
|
-
insertNode(_el$
|
|
3209
|
-
insert(_el$
|
|
5157
|
+
var _el$37 = createElement("box"), _el$38 = createElement("text"), _el$40 = createElement("text");
|
|
5158
|
+
insertNode(_el$37, _el$38);
|
|
5159
|
+
insertNode(_el$37, _el$40);
|
|
5160
|
+
setProp(_el$37, "flexDirection", "row");
|
|
5161
|
+
insertNode(_el$38, createTextNode(`⎇ `));
|
|
5162
|
+
insert(_el$40, () => truncateLabel(value(), 32));
|
|
3210
5163
|
effect((_p$) => {
|
|
3211
|
-
var _v$
|
|
3212
|
-
_v$
|
|
3213
|
-
_v$
|
|
5164
|
+
var _v$5 = muted(), _v$6 = text();
|
|
5165
|
+
_v$5 !== _p$.e && (_p$.e = setProp(_el$38, "fg", _v$5, _p$.e));
|
|
5166
|
+
_v$6 !== _p$.t && (_p$.t = setProp(_el$40, "fg", _v$6, _p$.t));
|
|
3214
5167
|
return _p$;
|
|
3215
5168
|
}, {
|
|
3216
5169
|
e: void 0,
|
|
3217
5170
|
t: void 0
|
|
3218
5171
|
});
|
|
3219
|
-
return _el$
|
|
5172
|
+
return _el$37;
|
|
3220
5173
|
})()
|
|
3221
5174
|
}), null);
|
|
3222
|
-
insert(_el$
|
|
5175
|
+
insert(_el$18, createComponent(Show, {
|
|
3223
5176
|
get when() {
|
|
3224
5177
|
return model.gitLine();
|
|
3225
5178
|
},
|
|
3226
5179
|
children: (line) => (() => {
|
|
3227
|
-
var _el$
|
|
3228
|
-
insert(_el$
|
|
3229
|
-
effect((_$p) => setProp(_el$
|
|
3230
|
-
return _el$
|
|
5180
|
+
var _el$41 = createElement("text");
|
|
5181
|
+
insert(_el$41, line);
|
|
5182
|
+
effect((_$p) => setProp(_el$41, "fg", text(), _$p));
|
|
5183
|
+
return _el$41;
|
|
3231
5184
|
})()
|
|
3232
5185
|
}), null);
|
|
3233
|
-
return _el$
|
|
5186
|
+
return _el$18;
|
|
3234
5187
|
}
|
|
3235
5188
|
}), null);
|
|
3236
|
-
insert(_el$
|
|
5189
|
+
insert(_el$12, createComponent(Show, {
|
|
3237
5190
|
get when() {
|
|
3238
5191
|
return block("todo");
|
|
3239
5192
|
},
|
|
3240
5193
|
get children() {
|
|
3241
|
-
var _el$
|
|
3242
|
-
setProp(_el$
|
|
3243
|
-
insert(_el$
|
|
5194
|
+
var _el$20 = createElement("box");
|
|
5195
|
+
setProp(_el$20, "flexDirection", "column");
|
|
5196
|
+
insert(_el$20, createComponent(Show, {
|
|
3244
5197
|
get when() {
|
|
3245
5198
|
return spacer("todo");
|
|
3246
5199
|
},
|
|
3247
5200
|
get children() {
|
|
3248
|
-
var _el$
|
|
3249
|
-
setProp(_el$
|
|
3250
|
-
return _el$
|
|
5201
|
+
var _el$21 = createElement("box");
|
|
5202
|
+
setProp(_el$21, "height", 1);
|
|
5203
|
+
return _el$21;
|
|
3251
5204
|
}
|
|
3252
5205
|
}), null);
|
|
3253
|
-
insert(_el$
|
|
5206
|
+
insert(_el$20, createComponent(Show, {
|
|
3254
5207
|
get when() {
|
|
3255
5208
|
return model.todo().visible.length > 0;
|
|
3256
5209
|
},
|
|
3257
5210
|
get children() {
|
|
3258
|
-
var _el$
|
|
3259
|
-
setProp(_el$
|
|
3260
|
-
insert(_el$
|
|
5211
|
+
var _el$22 = createElement("box");
|
|
5212
|
+
setProp(_el$22, "flexDirection", "column");
|
|
5213
|
+
insert(_el$22, createComponent(BlockHeader, {
|
|
3261
5214
|
get icon() {
|
|
3262
5215
|
return BLOCK_ICONS.todo;
|
|
3263
5216
|
},
|
|
@@ -3269,59 +5222,59 @@ function Sidebar(props) {
|
|
|
3269
5222
|
return muted();
|
|
3270
5223
|
}
|
|
3271
5224
|
}), null);
|
|
3272
|
-
insert(_el$
|
|
5225
|
+
insert(_el$22, createComponent(For, {
|
|
3273
5226
|
get each() {
|
|
3274
5227
|
return model.todo().visible;
|
|
3275
5228
|
},
|
|
3276
5229
|
children: (item) => (() => {
|
|
3277
|
-
var _el$
|
|
3278
|
-
insert(_el$
|
|
3279
|
-
effect((_$p) => setProp(_el$
|
|
3280
|
-
return _el$
|
|
5230
|
+
var _el$42 = createElement("text");
|
|
5231
|
+
insert(_el$42, () => todoRowText(item));
|
|
5232
|
+
effect((_$p) => setProp(_el$42, "fg", todoFg(item.status), _$p));
|
|
5233
|
+
return _el$42;
|
|
3281
5234
|
})()
|
|
3282
5235
|
}), null);
|
|
3283
|
-
insert(_el$
|
|
5236
|
+
insert(_el$22, createComponent(Show, {
|
|
3284
5237
|
get when() {
|
|
3285
5238
|
return hiddenTodoText(model.todo().hidden);
|
|
3286
5239
|
},
|
|
3287
5240
|
children: (line) => (() => {
|
|
3288
|
-
var _el$
|
|
3289
|
-
insert(_el$
|
|
3290
|
-
effect((_$p) => setProp(_el$
|
|
3291
|
-
return _el$
|
|
5241
|
+
var _el$43 = createElement("text");
|
|
5242
|
+
insert(_el$43, line);
|
|
5243
|
+
effect((_$p) => setProp(_el$43, "fg", muted(), _$p));
|
|
5244
|
+
return _el$43;
|
|
3292
5245
|
})()
|
|
3293
5246
|
}), null);
|
|
3294
|
-
return _el$
|
|
5247
|
+
return _el$22;
|
|
3295
5248
|
}
|
|
3296
5249
|
}), null);
|
|
3297
|
-
return _el$
|
|
5250
|
+
return _el$20;
|
|
3298
5251
|
}
|
|
3299
5252
|
}), null);
|
|
3300
|
-
insert(_el$
|
|
5253
|
+
insert(_el$12, createComponent(Show, {
|
|
3301
5254
|
get when() {
|
|
3302
5255
|
return block("dispatch");
|
|
3303
5256
|
},
|
|
3304
5257
|
get children() {
|
|
3305
|
-
var _el$
|
|
3306
|
-
setProp(_el$
|
|
3307
|
-
insert(_el$
|
|
5258
|
+
var _el$23 = createElement("box");
|
|
5259
|
+
setProp(_el$23, "flexDirection", "column");
|
|
5260
|
+
insert(_el$23, createComponent(Show, {
|
|
3308
5261
|
get when() {
|
|
3309
5262
|
return spacer("dispatch");
|
|
3310
5263
|
},
|
|
3311
5264
|
get children() {
|
|
3312
|
-
var _el$
|
|
3313
|
-
setProp(_el$
|
|
3314
|
-
return _el$
|
|
5265
|
+
var _el$24 = createElement("box");
|
|
5266
|
+
setProp(_el$24, "height", 1);
|
|
5267
|
+
return _el$24;
|
|
3315
5268
|
}
|
|
3316
5269
|
}), null);
|
|
3317
|
-
insert(_el$
|
|
5270
|
+
insert(_el$23, createComponent(Show, {
|
|
3318
5271
|
get when() {
|
|
3319
5272
|
return dispatchView();
|
|
3320
5273
|
},
|
|
3321
5274
|
children: (view) => (() => {
|
|
3322
|
-
var _el$
|
|
3323
|
-
setProp(_el$
|
|
3324
|
-
insert(_el$
|
|
5275
|
+
var _el$44 = createElement("box");
|
|
5276
|
+
setProp(_el$44, "flexDirection", "column");
|
|
5277
|
+
insert(_el$44, createComponent(BlockHeader, {
|
|
3325
5278
|
get icon() {
|
|
3326
5279
|
return BLOCK_ICONS.dispatch;
|
|
3327
5280
|
},
|
|
@@ -3336,101 +5289,107 @@ function Sidebar(props) {
|
|
|
3336
5289
|
return dispatchSummary();
|
|
3337
5290
|
}
|
|
3338
5291
|
}), null);
|
|
3339
|
-
insert(_el$
|
|
5292
|
+
insert(_el$44, createComponent(For, {
|
|
3340
5293
|
get each() {
|
|
3341
5294
|
return view().running;
|
|
3342
5295
|
},
|
|
3343
5296
|
children: (row) => (() => {
|
|
3344
|
-
var _el$
|
|
3345
|
-
insertNode(_el$
|
|
3346
|
-
setProp(_el$
|
|
3347
|
-
insert(_el$
|
|
5297
|
+
var _el$46 = createElement("box"), _el$47 = createElement("text");
|
|
5298
|
+
insertNode(_el$46, _el$47);
|
|
5299
|
+
setProp(_el$46, "flexShrink", 0);
|
|
5300
|
+
insert(_el$47, () => row.text);
|
|
3348
5301
|
effect((_p$) => {
|
|
3349
|
-
var _v$
|
|
3350
|
-
_v$
|
|
3351
|
-
_v$
|
|
5302
|
+
var _v$7 = open(row.id), _v$8 = tone("success");
|
|
5303
|
+
_v$7 !== _p$.e && (_p$.e = setProp(_el$46, "onMouseDown", _v$7, _p$.e));
|
|
5304
|
+
_v$8 !== _p$.t && (_p$.t = setProp(_el$47, "fg", _v$8, _p$.t));
|
|
3352
5305
|
return _p$;
|
|
3353
5306
|
}, {
|
|
3354
5307
|
e: void 0,
|
|
3355
5308
|
t: void 0
|
|
3356
5309
|
});
|
|
3357
|
-
return _el$
|
|
5310
|
+
return _el$46;
|
|
3358
5311
|
})()
|
|
3359
5312
|
}), null);
|
|
3360
|
-
insert(_el$
|
|
5313
|
+
insert(_el$44, createComponent(Show, {
|
|
3361
5314
|
get when() {
|
|
3362
5315
|
return view().runningHidden > 0;
|
|
3363
5316
|
},
|
|
3364
5317
|
get children() {
|
|
3365
|
-
var _el$
|
|
3366
|
-
insert(_el$
|
|
3367
|
-
effect((_$p) => setProp(_el$
|
|
3368
|
-
return _el$
|
|
5318
|
+
var _el$45 = createElement("text");
|
|
5319
|
+
insert(_el$45, () => `\u2026 +${view().runningHidden} rodando`);
|
|
5320
|
+
effect((_$p) => setProp(_el$45, "fg", muted(), _$p));
|
|
5321
|
+
return _el$45;
|
|
3369
5322
|
}
|
|
3370
5323
|
}), null);
|
|
3371
|
-
insert(_el$
|
|
5324
|
+
insert(_el$44, createComponent(Show, {
|
|
3372
5325
|
get when() {
|
|
3373
5326
|
return view().summary;
|
|
3374
5327
|
},
|
|
3375
5328
|
children: (line) => (() => {
|
|
3376
|
-
var _el$
|
|
3377
|
-
insertNode(_el$
|
|
3378
|
-
setProp(_el$
|
|
3379
|
-
setProp(_el$
|
|
3380
|
-
insert(_el$
|
|
3381
|
-
insert(_el$
|
|
5329
|
+
var _el$48 = createElement("box"), _el$49 = createElement("text");
|
|
5330
|
+
insertNode(_el$48, _el$49);
|
|
5331
|
+
setProp(_el$48, "flexDirection", "row");
|
|
5332
|
+
setProp(_el$48, "flexShrink", 0);
|
|
5333
|
+
insert(_el$49, line);
|
|
5334
|
+
insert(_el$48, createComponent(Show, {
|
|
3382
5335
|
get when() {
|
|
3383
5336
|
return failedSuffix();
|
|
3384
5337
|
},
|
|
3385
5338
|
children: (suffix) => (() => {
|
|
3386
|
-
var _el$
|
|
3387
|
-
insert(_el$
|
|
3388
|
-
effect((_$p) => setProp(_el$
|
|
3389
|
-
return _el$
|
|
5339
|
+
var _el$50 = createElement("text");
|
|
5340
|
+
insert(_el$50, () => `${SPEND_LINE_SEPARATOR}${suffix()}`);
|
|
5341
|
+
effect((_$p) => setProp(_el$50, "fg", tone("error"), _$p));
|
|
5342
|
+
return _el$50;
|
|
3390
5343
|
})()
|
|
3391
5344
|
}), null);
|
|
3392
|
-
effect((_$p) => setProp(_el$
|
|
3393
|
-
return _el$
|
|
5345
|
+
effect((_$p) => setProp(_el$49, "fg", muted(), _$p));
|
|
5346
|
+
return _el$48;
|
|
3394
5347
|
})()
|
|
3395
5348
|
}), null);
|
|
3396
|
-
insert(_el$
|
|
5349
|
+
insert(_el$44, createComponent(For, {
|
|
3397
5350
|
get each() {
|
|
3398
5351
|
return view().agents;
|
|
3399
5352
|
},
|
|
3400
5353
|
children: (row) => (() => {
|
|
3401
|
-
var _el$
|
|
3402
|
-
insert(_el$
|
|
3403
|
-
effect((_$p) => setProp(_el$
|
|
3404
|
-
return _el$
|
|
5354
|
+
var _el$51 = createElement("text");
|
|
5355
|
+
insert(_el$51, () => childAgentRowText(row));
|
|
5356
|
+
effect((_$p) => setProp(_el$51, "fg", muted(), _$p));
|
|
5357
|
+
return _el$51;
|
|
3405
5358
|
})()
|
|
3406
5359
|
}), null);
|
|
3407
|
-
insert(_el$
|
|
5360
|
+
insert(_el$44, createComponent(Show, {
|
|
3408
5361
|
get when() {
|
|
3409
5362
|
return hiddenChildAgentsText(view().agentsHidden, view().agentsHiddenCost);
|
|
3410
5363
|
},
|
|
3411
5364
|
children: (line) => (() => {
|
|
3412
|
-
var _el$
|
|
3413
|
-
insert(_el$
|
|
3414
|
-
effect((_$p) => setProp(_el$
|
|
3415
|
-
return _el$
|
|
5365
|
+
var _el$52 = createElement("text");
|
|
5366
|
+
insert(_el$52, line);
|
|
5367
|
+
effect((_$p) => setProp(_el$52, "fg", muted(), _$p));
|
|
5368
|
+
return _el$52;
|
|
3416
5369
|
})()
|
|
3417
5370
|
}), null);
|
|
3418
|
-
return _el$
|
|
5371
|
+
return _el$44;
|
|
3419
5372
|
})()
|
|
3420
5373
|
}), null);
|
|
3421
|
-
return _el$
|
|
5374
|
+
return _el$23;
|
|
5375
|
+
}
|
|
5376
|
+
}), null);
|
|
5377
|
+
insert(_el$12, createComponent(QuotaSidebarSummary, {
|
|
5378
|
+
context,
|
|
5379
|
+
get runtime() {
|
|
5380
|
+
return props.quotaRuntime;
|
|
3422
5381
|
}
|
|
3423
5382
|
}), null);
|
|
3424
5383
|
effect((_p$) => {
|
|
3425
5384
|
var _v$3 = text(), _v$4 = muted();
|
|
3426
|
-
_v$3 !== _p$.e && (_p$.e = setProp(_el$
|
|
3427
|
-
_v$4 !== _p$.t && (_p$.t = setProp(_el$
|
|
5385
|
+
_v$3 !== _p$.e && (_p$.e = setProp(_el$13, "fg", _v$3, _p$.e));
|
|
5386
|
+
_v$4 !== _p$.t && (_p$.t = setProp(_el$14, "fg", _v$4, _p$.t));
|
|
3428
5387
|
return _p$;
|
|
3429
5388
|
}, {
|
|
3430
5389
|
e: void 0,
|
|
3431
5390
|
t: void 0
|
|
3432
5391
|
});
|
|
3433
|
-
return _el$
|
|
5392
|
+
return _el$12;
|
|
3434
5393
|
})();
|
|
3435
5394
|
}
|
|
3436
5395
|
/** Panel actions that only make sense with a row selected. A panel over an
|
|
@@ -3499,25 +5458,25 @@ function DispatchPanel(props) {
|
|
|
3499
5458
|
return model.visible().rows;
|
|
3500
5459
|
},
|
|
3501
5460
|
children: (row) => (() => {
|
|
3502
|
-
var _el$
|
|
3503
|
-
insertNode(_el$
|
|
3504
|
-
insertNode(_el$
|
|
3505
|
-
setProp(_el$
|
|
3506
|
-
setProp(_el$
|
|
3507
|
-
insert(_el$
|
|
3508
|
-
insert(_el$
|
|
5461
|
+
var _el$53 = createElement("box"), _el$54 = createElement("text"), _el$55 = createElement("text");
|
|
5462
|
+
insertNode(_el$53, _el$54);
|
|
5463
|
+
insertNode(_el$53, _el$55);
|
|
5464
|
+
setProp(_el$53, "flexDirection", "row");
|
|
5465
|
+
setProp(_el$53, "flexShrink", 0);
|
|
5466
|
+
insert(_el$54, () => selected(row.id) ? `▸ ` : " ");
|
|
5467
|
+
insert(_el$55, () => row.text);
|
|
3509
5468
|
effect((_p$) => {
|
|
3510
|
-
var _v$
|
|
3511
|
-
_v$
|
|
3512
|
-
_v$
|
|
3513
|
-
_v$
|
|
5469
|
+
var _v$9 = selected(row.id) ? text() : muted(), _v$0 = rowFg(row.state), _v$1 = selected(row.id) ? 1 : 0;
|
|
5470
|
+
_v$9 !== _p$.e && (_p$.e = setProp(_el$54, "fg", _v$9, _p$.e));
|
|
5471
|
+
_v$0 !== _p$.t && (_p$.t = setProp(_el$55, "fg", _v$0, _p$.t));
|
|
5472
|
+
_v$1 !== _p$.a && (_p$.a = setProp(_el$55, "attributes", _v$1, _p$.a));
|
|
3514
5473
|
return _p$;
|
|
3515
5474
|
}, {
|
|
3516
5475
|
e: void 0,
|
|
3517
5476
|
t: void 0,
|
|
3518
5477
|
a: void 0
|
|
3519
5478
|
});
|
|
3520
|
-
return _el$
|
|
5479
|
+
return _el$53;
|
|
3521
5480
|
})()
|
|
3522
5481
|
});
|
|
3523
5482
|
const detail = () => createComponent(For, {
|
|
@@ -3525,28 +5484,28 @@ function DispatchPanel(props) {
|
|
|
3525
5484
|
return model.detail();
|
|
3526
5485
|
},
|
|
3527
5486
|
children: (line, index) => (() => {
|
|
3528
|
-
var _el$
|
|
3529
|
-
insert(_el$
|
|
3530
|
-
effect((_$p) => setProp(_el$
|
|
3531
|
-
return _el$
|
|
5487
|
+
var _el$56 = createElement("text");
|
|
5488
|
+
insert(_el$56, line);
|
|
5489
|
+
effect((_$p) => setProp(_el$56, "fg", index() === 0 ? text() : muted(), _$p));
|
|
5490
|
+
return _el$56;
|
|
3532
5491
|
})()
|
|
3533
5492
|
});
|
|
3534
5493
|
const empty = () => (() => {
|
|
3535
|
-
var _el$
|
|
3536
|
-
insertNode(_el$
|
|
3537
|
-
effect((_$p) => setProp(_el$
|
|
3538
|
-
return _el$
|
|
5494
|
+
var _el$57 = createElement("text");
|
|
5495
|
+
insertNode(_el$57, createTextNode(`Nenhuma sessão delegada`));
|
|
5496
|
+
effect((_$p) => setProp(_el$57, "fg", muted(), _$p));
|
|
5497
|
+
return _el$57;
|
|
3539
5498
|
})();
|
|
3540
5499
|
return (() => {
|
|
3541
|
-
var _el$
|
|
3542
|
-
insertNode(_el$
|
|
3543
|
-
insertNode(_el$
|
|
3544
|
-
insertNode(_el$
|
|
3545
|
-
insertNode(_el$
|
|
3546
|
-
setProp(_el$
|
|
3547
|
-
setProp(_el$
|
|
3548
|
-
setProp(_el$
|
|
3549
|
-
insert(_el$
|
|
5500
|
+
var _el$59 = createElement("box"), _el$60 = createElement("text"), _el$61 = createElement("text"), _el$65 = createElement("box"), _el$66 = createElement("text");
|
|
5501
|
+
insertNode(_el$59, _el$60);
|
|
5502
|
+
insertNode(_el$59, _el$61);
|
|
5503
|
+
insertNode(_el$59, _el$65);
|
|
5504
|
+
insertNode(_el$59, _el$66);
|
|
5505
|
+
setProp(_el$59, "flexDirection", "column");
|
|
5506
|
+
setProp(_el$59, "width", "100%");
|
|
5507
|
+
setProp(_el$59, "padding", 1);
|
|
5508
|
+
insert(_el$59, createComponent(DispatchPanelKeymap, {
|
|
3550
5509
|
get context() {
|
|
3551
5510
|
return props.context;
|
|
3552
5511
|
},
|
|
@@ -3554,30 +5513,30 @@ function DispatchPanel(props) {
|
|
|
3554
5513
|
return props.panel;
|
|
3555
5514
|
},
|
|
3556
5515
|
model
|
|
3557
|
-
}), _el$
|
|
3558
|
-
setProp(_el$
|
|
3559
|
-
insert(_el$
|
|
3560
|
-
insert(_el$
|
|
5516
|
+
}), _el$60);
|
|
5517
|
+
setProp(_el$60, "attributes", 1);
|
|
5518
|
+
insert(_el$60, () => model.title());
|
|
5519
|
+
insert(_el$59, createComponent(Show, {
|
|
3561
5520
|
get when() {
|
|
3562
5521
|
return model.header();
|
|
3563
5522
|
},
|
|
3564
5523
|
children: (line) => (() => {
|
|
3565
|
-
var _el$
|
|
3566
|
-
insert(_el$
|
|
3567
|
-
effect((_$p) => setProp(_el$
|
|
3568
|
-
return _el$
|
|
5524
|
+
var _el$67 = createElement("text");
|
|
5525
|
+
insert(_el$67, line);
|
|
5526
|
+
effect((_$p) => setProp(_el$67, "fg", muted(), _$p));
|
|
5527
|
+
return _el$67;
|
|
3569
5528
|
})()
|
|
3570
|
-
}), _el$
|
|
3571
|
-
insert(_el$
|
|
3572
|
-
insert(_el$
|
|
5529
|
+
}), _el$61);
|
|
5530
|
+
insert(_el$61, () => dispatchPanelRule(props.panel.width - 2));
|
|
5531
|
+
insert(_el$59, createComponent(Show, {
|
|
3573
5532
|
get when() {
|
|
3574
5533
|
return model.layout().mode === "wide";
|
|
3575
5534
|
},
|
|
3576
5535
|
get fallback() {
|
|
3577
5536
|
return (() => {
|
|
3578
|
-
var _el$
|
|
3579
|
-
setProp(_el$
|
|
3580
|
-
insert(_el$
|
|
5537
|
+
var _el$68 = createElement("box");
|
|
5538
|
+
setProp(_el$68, "flexDirection", "column");
|
|
5539
|
+
insert(_el$68, createComponent(Show, {
|
|
3581
5540
|
get when() {
|
|
3582
5541
|
return model.rows().length > 0;
|
|
3583
5542
|
},
|
|
@@ -3585,34 +5544,34 @@ function DispatchPanel(props) {
|
|
|
3585
5544
|
return empty();
|
|
3586
5545
|
},
|
|
3587
5546
|
get children() {
|
|
3588
|
-
var _el$
|
|
3589
|
-
setProp(_el$
|
|
3590
|
-
insert(_el$
|
|
3591
|
-
return _el$
|
|
5547
|
+
var _el$69 = createElement("box");
|
|
5548
|
+
setProp(_el$69, "flexDirection", "column");
|
|
5549
|
+
insert(_el$69, rows);
|
|
5550
|
+
return _el$69;
|
|
3592
5551
|
}
|
|
3593
5552
|
}), null);
|
|
3594
|
-
insert(_el$
|
|
5553
|
+
insert(_el$68, createComponent(Show, {
|
|
3595
5554
|
get when() {
|
|
3596
5555
|
return model.selectedID();
|
|
3597
5556
|
},
|
|
3598
5557
|
get children() {
|
|
3599
|
-
var _el$
|
|
3600
|
-
insertNode(_el$
|
|
3601
|
-
setProp(_el$
|
|
3602
|
-
setProp(_el$
|
|
3603
|
-
insert(_el$
|
|
3604
|
-
return _el$
|
|
5558
|
+
var _el$70 = createElement("box"), _el$71 = createElement("box");
|
|
5559
|
+
insertNode(_el$70, _el$71);
|
|
5560
|
+
setProp(_el$70, "flexDirection", "column");
|
|
5561
|
+
setProp(_el$71, "height", 1);
|
|
5562
|
+
insert(_el$70, detail, null);
|
|
5563
|
+
return _el$70;
|
|
3605
5564
|
}
|
|
3606
5565
|
}), null);
|
|
3607
|
-
return _el$
|
|
5566
|
+
return _el$68;
|
|
3608
5567
|
})();
|
|
3609
5568
|
},
|
|
3610
5569
|
get children() {
|
|
3611
|
-
var _el$
|
|
3612
|
-
insertNode(_el$
|
|
3613
|
-
setProp(_el$
|
|
3614
|
-
setProp(_el$
|
|
3615
|
-
insert(_el$
|
|
5570
|
+
var _el$62 = createElement("box"), _el$63 = createElement("box");
|
|
5571
|
+
insertNode(_el$62, _el$63);
|
|
5572
|
+
setProp(_el$62, "flexDirection", "row");
|
|
5573
|
+
setProp(_el$63, "flexDirection", "column");
|
|
5574
|
+
insert(_el$63, createComponent(Show, {
|
|
3616
5575
|
get when() {
|
|
3617
5576
|
return model.rows().length > 0;
|
|
3618
5577
|
},
|
|
@@ -3623,36 +5582,36 @@ function DispatchPanel(props) {
|
|
|
3623
5582
|
return rows();
|
|
3624
5583
|
}
|
|
3625
5584
|
}));
|
|
3626
|
-
insert(_el$
|
|
5585
|
+
insert(_el$62, createComponent(Show, {
|
|
3627
5586
|
get when() {
|
|
3628
5587
|
return model.selectedID();
|
|
3629
5588
|
},
|
|
3630
5589
|
get children() {
|
|
3631
|
-
var _el$
|
|
3632
|
-
setProp(_el$
|
|
3633
|
-
insert(_el$
|
|
3634
|
-
effect((_$p) => setProp(_el$
|
|
3635
|
-
return _el$
|
|
5590
|
+
var _el$64 = createElement("box");
|
|
5591
|
+
setProp(_el$64, "flexDirection", "column");
|
|
5592
|
+
insert(_el$64, detail);
|
|
5593
|
+
effect((_$p) => setProp(_el$64, "width", model.layout().detailWidth, _$p));
|
|
5594
|
+
return _el$64;
|
|
3636
5595
|
}
|
|
3637
5596
|
}), null);
|
|
3638
|
-
effect((_$p) => setProp(_el$
|
|
3639
|
-
return _el$
|
|
5597
|
+
effect((_$p) => setProp(_el$63, "width", model.layout().listWidth, _$p));
|
|
5598
|
+
return _el$62;
|
|
3640
5599
|
}
|
|
3641
|
-
}), _el$
|
|
3642
|
-
setProp(_el$
|
|
3643
|
-
insert(_el$
|
|
5600
|
+
}), _el$65);
|
|
5601
|
+
setProp(_el$65, "height", 1);
|
|
5602
|
+
insert(_el$66, () => model.footer());
|
|
3644
5603
|
effect((_p$) => {
|
|
3645
|
-
var _v$
|
|
3646
|
-
_v$
|
|
3647
|
-
_v$
|
|
3648
|
-
_v$
|
|
5604
|
+
var _v$10 = text(), _v$11 = muted(), _v$12 = muted();
|
|
5605
|
+
_v$10 !== _p$.e && (_p$.e = setProp(_el$60, "fg", _v$10, _p$.e));
|
|
5606
|
+
_v$11 !== _p$.t && (_p$.t = setProp(_el$61, "fg", _v$11, _p$.t));
|
|
5607
|
+
_v$12 !== _p$.a && (_p$.a = setProp(_el$66, "fg", _v$12, _p$.a));
|
|
3649
5608
|
return _p$;
|
|
3650
5609
|
}, {
|
|
3651
5610
|
e: void 0,
|
|
3652
5611
|
t: void 0,
|
|
3653
5612
|
a: void 0
|
|
3654
5613
|
});
|
|
3655
|
-
return _el$
|
|
5614
|
+
return _el$59;
|
|
3656
5615
|
})();
|
|
3657
5616
|
}
|
|
3658
5617
|
/** App-level command claim: the only way into the panel. It registers the
|
|
@@ -3684,10 +5643,10 @@ function HomeStatus(props) {
|
|
|
3684
5643
|
const preset = useActivePreset(props.context).preset;
|
|
3685
5644
|
const muted = () => props.context.theme?.text?.muted ?? props.context.theme?.text?.base;
|
|
3686
5645
|
return (() => {
|
|
3687
|
-
var _el$
|
|
3688
|
-
insert(_el$
|
|
3689
|
-
effect((_$p) => setProp(_el$
|
|
3690
|
-
return _el$
|
|
5646
|
+
var _el$72 = createElement("text");
|
|
5647
|
+
insert(_el$72, () => `Pantheon v1.6.2-beta.1${preset().name ? ` ▸ ${preset().name}` : ""}`);
|
|
5648
|
+
effect((_$p) => setProp(_el$72, "fg", muted(), _$p));
|
|
5649
|
+
return _el$72;
|
|
3691
5650
|
})();
|
|
3692
5651
|
}
|
|
3693
5652
|
/** Lean footer model: only the preset label and the live delegation count. It
|
|
@@ -3742,10 +5701,10 @@ function PromptFooter(props) {
|
|
|
3742
5701
|
return model.running() > 0;
|
|
3743
5702
|
},
|
|
3744
5703
|
get children() {
|
|
3745
|
-
var _el$
|
|
3746
|
-
insert(_el$
|
|
3747
|
-
effect((_$p) => setProp(_el$
|
|
3748
|
-
return _el$
|
|
5704
|
+
var _el$73 = createElement("text");
|
|
5705
|
+
insert(_el$73, () => `▸${model.preset().name ?? "default"} · ✦${model.running()} ativos`);
|
|
5706
|
+
effect((_$p) => setProp(_el$73, "fg", muted(), _$p));
|
|
5707
|
+
return _el$73;
|
|
3749
5708
|
}
|
|
3750
5709
|
});
|
|
3751
5710
|
}
|
|
@@ -3756,11 +5715,14 @@ const plugin = Plugin.define({
|
|
|
3756
5715
|
if (globalState[SINGLETON]) return;
|
|
3757
5716
|
globalState[SINGLETON] = true;
|
|
3758
5717
|
warmUpSidebarData(context, resolveLocation(context));
|
|
5718
|
+
const quotaRuntime = createQuotaRuntime(context);
|
|
5719
|
+
const unregisterQuotaTui = registerQuotaTui(context, quotaRuntime);
|
|
3759
5720
|
const unregisterSidebar = context.ui.slot({
|
|
3760
5721
|
append: "sidebar.content",
|
|
3761
5722
|
render: ({ sessionID }) => createComponent(Sidebar, {
|
|
3762
5723
|
context,
|
|
3763
|
-
sessionID
|
|
5724
|
+
sessionID,
|
|
5725
|
+
quotaRuntime
|
|
3764
5726
|
})
|
|
3765
5727
|
});
|
|
3766
5728
|
const unregisterHome = context.ui.slot({
|
|
@@ -3798,11 +5760,12 @@ const plugin = Plugin.define({
|
|
|
3798
5760
|
if (typeof unregisterPromptFooter === "function") unregisterPromptFooter();
|
|
3799
5761
|
if (typeof unregisterPanel === "function") unregisterPanel();
|
|
3800
5762
|
if (typeof unregisterCommands === "function") unregisterCommands();
|
|
5763
|
+
unregisterQuotaTui();
|
|
3801
5764
|
delete globalState[SINGLETON];
|
|
3802
5765
|
};
|
|
3803
5766
|
}
|
|
3804
5767
|
});
|
|
3805
5768
|
//#endregion
|
|
3806
|
-
export { BLOCK_ICONS, CONTEXT_BAR_CELLS, CONTEXT_BAR_EMPTY_CELL, CONTEXT_BAR_FILLED_CELL, DELEGATION_CHILD_STATUS_GRACE_MS, DISPATCH_AGENT_CEILING, DISPATCH_AGENT_WIDTH, DISPATCH_COST_WIDTH, DISPATCH_COUNT_WIDTH, DISPATCH_DONE_MARKER, DISPATCH_DURATION_WIDTH, DISPATCH_GROUP_COST_WIDTH, DISPATCH_KIND_ORIGIN_LABELS, DISPATCH_MAX_LINES, DISPATCH_MAX_WIDTH, DISPATCH_MIN_AGENT_WIDTH, DISPATCH_MODEL_WIDTH, DISPATCH_PANEL_AGENT_WIDTH, DISPATCH_PANEL_COMMANDS, DISPATCH_PANEL_COST_WIDTH, DISPATCH_PANEL_DASH, DISPATCH_PANEL_DURATION_WIDTH, DISPATCH_PANEL_EMPTY_TEXT, DISPATCH_PANEL_FULLSCREEN_BADGE, DISPATCH_PANEL_HEADER_MARKER, DISPATCH_PANEL_KIND_WIDTH, DISPATCH_PANEL_MIN_AGENT_WIDTH, DISPATCH_PANEL_NAME, DISPATCH_PANEL_PAGE_SIZE, DISPATCH_PANEL_RULE_CHAR, DISPATCH_PANEL_SELECTION_GUTTER, DISPATCH_PANEL_SELECTION_MARKER, DISPATCH_PANEL_TITLE_WIDTH, DISPATCH_PANEL_TOAST, DISPATCH_PANEL_WIDE_MIN_WIDTH, DISPATCH_RUNNING_CEILING, GIT_ARROW_DOWN, GIT_ARROW_UP, GIT_CHANGES_DEBOUNCE_MS, GIT_CLI_DEBOUNCE_MS, GIT_CLI_MAX_BUFFER, GIT_CLI_MIN_INTERVAL_MS, GIT_CLI_TIMEOUT_MS, HEADER_MAX_WIDTH, MODEL_USAGE_COST_WIDTH, MODEL_USAGE_DEBOUNCE_MS, MODEL_USAGE_MESSAGE_LIMIT, MODEL_USAGE_MODEL_WIDTH, MODEL_USAGE_SESSION_LIMIT, MODEL_USAGE_TOKEN_WIDTH, MODEL_USAGE_VISIBLE_CEILING, PRESET_MARKER, SIDEBAR_REFRESH_EVENTS, SIDEBAR_WAITING_LABEL, SPEND_30D_LABEL, SPEND_30D_MS, SPEND_LINE_SEPARATOR, SPEND_PROBE_TOLERANCE_MS, SPEND_PROBE_WINDOW_MS, SPEND_REFRESH_DEBOUNCE_MS, SPEND_TODAY_LABEL, TODO_TEXT_WIDTH, TODO_VISIBLE_CEILING, UNKNOWN_AGENT, agentKey, buildDispatchBlock, cacheHitPercent, ceilingModelUsage, ceilingTodoItems, cellWidth, childAgentRowText, classifyDispatchKind, collectChildAgentUsage, collectDispatch, collectModelUsage, collectSubagentCalls, collectWarmupTargets, completedSummaryText, computeContextUsage, contextBar, contextBarFilled, contextBlockRows, contextPerformanceLine, contextProgressColor, contextSpendLine, contextUsageTone, countGitChanges, createDispatchPanelModel, createFooterModel, createSidebarModel, plugin as default, defaultGitExec, delegationStateFromOutcome, delegationStateFromStatus, detectDelegationCompletions, dispatchAgentText, dispatchElapsed, dispatchHeaderSummary, dispatchKindFromAgent, dispatchKindFromPrefix, dispatchKindSuffix, dispatchModelText, dispatchPanelCell, dispatchPanelDetail, dispatchPanelFooter, dispatchPanelHeader, dispatchPanelKeymapLayer, dispatchPanelLayout, dispatchPanelMarker, dispatchPanelRangeText, dispatchPanelRowText, dispatchPanelRows, dispatchPanelRule, dispatchPanelTitle, dispatchPanelWindow, dispatchTokenLine, dispatchTokens, dispatchTotalCost, failedSuffixText, formatContextWindow, formatDispatchCost, formatDispatchDuration, formatGitChanges, formatGitSnapshot, formatSpendUSD, formatSpent, formatTokenCount, formatUsageCost, formatUsageTokens, gitProbeAllowed, hiddenChildAgentsText, hiddenModelUsageText, hiddenTodoText, isTodoStatus, isValidSessionID, lastAssistantWithTokens, latestTodoItems, messageTokensTotal, modelRefID, modelUsageRowText, modelUsageRows, navigateToSession, openDispatchPanel, orderDispatchEntries, orderTodoItems, padCell, parseGitAheadBehind, parseGitStatusPorcelain, parsePresetOverrides, parseTodoItems, performDispatchPanelAction, presetFromEnv, presetHeaderLine, providerIDFromModels, providerIDFromRef, readGitSnapshot, resetSpendUnit, resolveActivePresetForTui, resolveContextLimit, resolvedSpendUnit, runDispatchPanelCommand, runningChildRowText, shortModelID, shortSessionID, sidebarPlaceholder, spendWindows, spinnerFrame, startOfLocalDay, statsCost, statsRangeMatches, toDelegationView, toDispatchEntry, todoRowText, todoTone, transcriptWindow, truncateLabel, turnTokensPerSecond, withBlockSpacers };
|
|
5769
|
+
export { BLOCK_ICONS, CONTEXT_BAR_CELLS, CONTEXT_BAR_EMPTY_CELL, CONTEXT_BAR_FILLED_CELL, DEFAULT_QUOTA_PREFERENCES, DELEGATION_CHILD_STATUS_GRACE_MS, DISPATCH_AGENT_CEILING, DISPATCH_AGENT_WIDTH, DISPATCH_COST_WIDTH, DISPATCH_COUNT_WIDTH, DISPATCH_DONE_MARKER, DISPATCH_DURATION_WIDTH, DISPATCH_GROUP_COST_WIDTH, DISPATCH_KIND_ORIGIN_LABELS, DISPATCH_MAX_LINES, DISPATCH_MAX_WIDTH, DISPATCH_MIN_AGENT_WIDTH, DISPATCH_MODEL_WIDTH, DISPATCH_PANEL_AGENT_WIDTH, DISPATCH_PANEL_COMMANDS, DISPATCH_PANEL_COST_WIDTH, DISPATCH_PANEL_DASH, DISPATCH_PANEL_DURATION_WIDTH, DISPATCH_PANEL_EMPTY_TEXT, DISPATCH_PANEL_FULLSCREEN_BADGE, DISPATCH_PANEL_HEADER_MARKER, DISPATCH_PANEL_KIND_WIDTH, DISPATCH_PANEL_MIN_AGENT_WIDTH, DISPATCH_PANEL_NAME, DISPATCH_PANEL_PAGE_SIZE, DISPATCH_PANEL_RULE_CHAR, DISPATCH_PANEL_SELECTION_GUTTER, DISPATCH_PANEL_SELECTION_MARKER, DISPATCH_PANEL_TITLE_WIDTH, DISPATCH_PANEL_TOAST, DISPATCH_PANEL_WIDE_MIN_WIDTH, DISPATCH_RUNNING_CEILING, GIT_ARROW_DOWN, GIT_ARROW_UP, GIT_CHANGES_DEBOUNCE_MS, GIT_CLI_DEBOUNCE_MS, GIT_CLI_MAX_BUFFER, GIT_CLI_MIN_INTERVAL_MS, GIT_CLI_TIMEOUT_MS, HEADER_MAX_WIDTH, MODEL_USAGE_COST_WIDTH, MODEL_USAGE_DEBOUNCE_MS, MODEL_USAGE_MESSAGE_LIMIT, MODEL_USAGE_MODEL_WIDTH, MODEL_USAGE_SESSION_LIMIT, MODEL_USAGE_TOKEN_WIDTH, MODEL_USAGE_VISIBLE_CEILING, PRESET_MARKER, QUOTA_CLOCK_INTERVAL_MS, QUOTA_ICON, QUOTA_OPEN_COMMAND_ID, QUOTA_PANEL_COMMANDS, QUOTA_PANEL_NAME, SIDEBAR_REFRESH_EVENTS, SIDEBAR_WAITING_LABEL, SPEND_30D_LABEL, SPEND_30D_MS, SPEND_LINE_SEPARATOR, SPEND_PROBE_TOLERANCE_MS, SPEND_PROBE_WINDOW_MS, SPEND_REFRESH_DEBOUNCE_MS, SPEND_TODAY_LABEL, TODO_TEXT_WIDTH, TODO_VISIBLE_CEILING, UNKNOWN_AGENT, agentKey, buildDispatchBlock, cacheHitPercent, ceilingModelUsage, ceilingTodoItems, cellWidth, childAgentRowText, classifyDispatchKind, collectChildAgentUsage, collectDispatch, collectModelUsage, collectRecentModelUsageRows, collectSubagentCalls, collectWarmupTargets, compactQuotaMetric, completedSummaryText, computeContextUsage, contextBar, contextBarFilled, contextBlockRows, contextPerformanceLine, contextProgressColor, contextSpendLine, contextSpendLines, contextUsageTone, countGitChanges, createDispatchPanelModel, createFooterModel, createQuotaClock, createQuotaRuntime, createSidebarModel, plugin as default, defaultGitExec, delegationStateFromOutcome, delegationStateFromStatus, detectDelegationCompletions, dispatchAgentText, dispatchElapsed, dispatchHeaderSummary, dispatchKindFromAgent, dispatchKindFromPrefix, dispatchKindSuffix, dispatchModelText, dispatchPanelCell, dispatchPanelDetail, dispatchPanelFooter, dispatchPanelHeader, dispatchPanelKeymapLayer, dispatchPanelLayout, dispatchPanelMarker, dispatchPanelRangeText, dispatchPanelRowText, dispatchPanelRows, dispatchPanelRule, dispatchPanelTitle, dispatchPanelWindow, dispatchTokenLine, dispatchTokens, dispatchTotalCost, failedSuffixText, financeMetricLines, formatContextWindow, formatDispatchCost, formatDispatchDuration, formatGitChanges, formatGitSnapshot, formatQuotaCountdown, formatQuotaMetric, formatSpendUSD, formatSpent, formatTokenCount, formatUsageCost, formatUsageTokens, gitProbeAllowed, hiddenChildAgentsText, hiddenModelUsageText, hiddenTodoText, isTodoStatus, isValidSessionID, lastAssistantWithTokens, latestTodoItems, messageTokensTotal, modelRefID, modelUsageRowLines, modelUsageRowText, modelUsageRows, navigateToSession, normalizeQuotaPreferences, openDispatchPanel, openQuotaPanel, orderDispatchEntries, orderTodoItems, padCell, parseGitAheadBehind, parseGitStatusPorcelain, parsePresetOverrides, parseTodoItems, performDispatchPanelAction, presetFromEnv, presetHeaderLine, providerIDFromModels, providerIDFromRef, quotaClock, quotaGoCheckCommand, quotaMetricLines, quotaOpenCommand, quotaPanelKeymapLayer, quotaProgress, quotaSidebarEntries, quotaSnapshotFromStatus, quotaSnapshotStatusLabel, quotaTextLines, quotaUsageTone, quotaWindowLines, readGitSnapshot, resetSpendUnit, resolveActiveModelRef, resolveActivePresetForTui, resolveContextLimit, resolveModelContextSnapshot, resolvedSpendUnit, runDispatchPanelCommand, runQuotaPanelCommand, runningChildRowText, shortModelID, shortSessionID, sidebarFinanceEntries, sidebarMoneyLines, sidebarPlaceholder, sidebarTextLines, snapshotSummary, spendWindows, spinnerFrame, startOfLocalDay, statsCost, statsRangeMatches, toDelegationView, toDispatchEntry, todoRowText, todoTone, transcriptWindow, truncateLabel, turnTokensPerSecond, withBlockSpacers };
|
|
3807
5770
|
|
|
3808
5771
|
//# sourceMappingURL=tui-v2.js.map
|