@narumitw/pi-starship 0.65.1 → 0.66.0
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/CHANGELOG.md +328 -0
- package/README.md +8 -0
- package/dist/chunks/{chunk-S2KBLHE2.ts → chunk-3XLWHJ5Y.ts} +5 -5
- package/dist/chunks/chunk-3XLWHJ5Y.ts.map +7 -0
- package/dist/chunks/{chunk-D2YWQMYT.ts → chunk-BOMYDCT7.ts} +3 -3
- package/dist/chunks/{chunk-I22B7QPQ.ts → chunk-CUXPMKBQ.ts} +19 -3
- package/dist/chunks/chunk-CUXPMKBQ.ts.map +7 -0
- package/dist/chunks/{chunk-XTLQ4WUL.ts → chunk-QGB3NNTM.ts} +1 -1
- package/dist/chunks/chunk-QGB3NNTM.ts.map +7 -0
- package/dist/chunks/{chunk-YK4S4RRM.ts → chunk-UZJIMIWL.ts} +3 -2
- package/dist/chunks/chunk-UZJIMIWL.ts.map +7 -0
- package/dist/chunks/{cloud-J2ZOE3HE.ts → cloud-CNNWXSQ3.ts} +2 -2
- package/dist/chunks/{command-configuration-menu-BJYQXV2U.ts → command-configuration-menu-N3SP6R3I.ts} +6 -3
- package/dist/chunks/command-configuration-menu-N3SP6R3I.ts.map +7 -0
- package/dist/chunks/{command-settings-chat-42OTC7NJ.ts → command-settings-chat-4NLO3RDC.ts} +4 -4
- package/dist/chunks/{commands-ZL36J5TX.ts → commands-MSJ67CTR.ts} +6 -6
- package/dist/chunks/{deployment-NOJ2KCLI.ts → deployment-KNUSQSJ5.ts} +3 -3
- package/dist/chunks/{development-T3XXVVDP.ts → development-TJNVM4H2.ts} +2 -2
- package/dist/chunks/{execution-R2OHIP2L.ts → execution-OFQXHFAH.ts} +3 -3
- package/dist/chunks/{jujutsu-XLDYKSX2.ts → jujutsu-T2LTPHSY.ts} +2 -2
- package/dist/chunks/{languages-CBQNNYXM.ts → languages-VWXTVJ45.ts} +3 -3
- package/dist/chunks/{package-7KVAK3TC.ts → package-JA4CJ5DR.ts} +2 -2
- package/dist/chunks/{system-574MHB4R.ts → system-CDTPAQZX.ts} +2 -2
- package/dist/index.ts +74 -40
- package/dist/index.ts.map +2 -2
- package/package.json +6 -5
- package/skills/configure-pi-starship/references/module-catalog.md +19 -3
- package/skills/configure-pi-starship/references/modules.md +37 -2
- package/src/command-configuration-menu.ts +3 -0
- package/src/command-preview.ts +1 -0
- package/src/modules/catalog.ts +5 -1
- package/src/modules/cost.ts +2 -1
- package/src/modules/git/runtime.ts +33 -25
- package/src/modules/tokens-per-second.ts +14 -0
- package/src/modules/types.ts +2 -0
- package/src/pi-starship.ts +4 -7
- package/src/runtime/command.ts +8 -3
- package/src/runtime/github-pr.ts +5 -2
- package/src/runtime/helpers.ts +5 -4
- package/src/runtime/types.ts +1 -0
- package/src/usage.ts +42 -4
- package/dist/chunks/chunk-I22B7QPQ.ts.map +0 -7
- package/dist/chunks/chunk-S2KBLHE2.ts.map +0 -7
- package/dist/chunks/chunk-XTLQ4WUL.ts.map +0 -7
- package/dist/chunks/chunk-YK4S4RRM.ts.map +0 -7
- package/dist/chunks/command-configuration-menu-BJYQXV2U.ts.map +0 -7
- /package/dist/chunks/{chunk-D2YWQMYT.ts.map → chunk-BOMYDCT7.ts.map} +0 -0
- /package/dist/chunks/{cloud-J2ZOE3HE.ts.map → cloud-CNNWXSQ3.ts.map} +0 -0
- /package/dist/chunks/{command-settings-chat-42OTC7NJ.ts.map → command-settings-chat-4NLO3RDC.ts.map} +0 -0
- /package/dist/chunks/{commands-ZL36J5TX.ts.map → commands-MSJ67CTR.ts.map} +0 -0
- /package/dist/chunks/{deployment-NOJ2KCLI.ts.map → deployment-KNUSQSJ5.ts.map} +0 -0
- /package/dist/chunks/{development-T3XXVVDP.ts.map → development-TJNVM4H2.ts.map} +0 -0
- /package/dist/chunks/{execution-R2OHIP2L.ts.map → execution-OFQXHFAH.ts.map} +0 -0
- /package/dist/chunks/{jujutsu-XLDYKSX2.ts.map → jujutsu-T2LTPHSY.ts.map} +0 -0
- /package/dist/chunks/{languages-CBQNNYXM.ts.map → languages-VWXTVJ45.ts.map} +0 -0
- /package/dist/chunks/{package-7KVAK3TC.ts.map → package-JA4CJ5DR.ts.map} +0 -0
- /package/dist/chunks/{system-574MHB4R.ts.map → system-CDTPAQZX.ts.map} +0 -0
package/dist/index.ts
CHANGED
|
@@ -10,15 +10,14 @@ import {
|
|
|
10
10
|
directoryAlternateFormat,
|
|
11
11
|
loadStarshipConfig,
|
|
12
12
|
settingsFilePath
|
|
13
|
-
} from "./chunks/chunk-
|
|
13
|
+
} from "./chunks/chunk-CUXPMKBQ.ts";
|
|
14
14
|
import "./chunks/chunk-IYDZ3R2T.ts";
|
|
15
15
|
import {
|
|
16
16
|
PRIVATE_STYLE_SELECTOR
|
|
17
|
-
} from "./chunks/chunk-
|
|
17
|
+
} from "./chunks/chunk-QGB3NNTM.ts";
|
|
18
18
|
import {
|
|
19
|
-
MAX_COMMAND_OUTPUT_BYTES,
|
|
20
19
|
createFileSystem
|
|
21
|
-
} from "./chunks/chunk-
|
|
20
|
+
} from "./chunks/chunk-3XLWHJ5Y.ts";
|
|
22
21
|
import {
|
|
23
22
|
formatVariables,
|
|
24
23
|
isFillChunk,
|
|
@@ -44,7 +43,7 @@ import { spawn } from "node:child_process";
|
|
|
44
43
|
var FORCE_KILL_DELAY_MS = 250;
|
|
45
44
|
var execWorkspaceCommand = async (command, args, options) => new Promise((resolve2) => {
|
|
46
45
|
if (options.signal?.aborted) {
|
|
47
|
-
resolve2({ stdout: "", stderr: "", code: 1, killed: true });
|
|
46
|
+
resolve2({ stdout: "", stderr: "", code: 1, killed: true, truncated: false });
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
49
|
let child;
|
|
@@ -58,12 +57,13 @@ var execWorkspaceCommand = async (command, args, options) => new Promise((resolv
|
|
|
58
57
|
windowsHide: true
|
|
59
58
|
});
|
|
60
59
|
} catch {
|
|
61
|
-
resolve2({ stdout: "", stderr: "", code: 1, killed: false });
|
|
60
|
+
resolve2({ stdout: "", stderr: "", code: 1, killed: false, truncated: false });
|
|
62
61
|
return;
|
|
63
62
|
}
|
|
64
63
|
const stdout = [];
|
|
65
64
|
const stderr = [];
|
|
66
65
|
let outputBytes = 0;
|
|
66
|
+
let truncated = false;
|
|
67
67
|
let killed = false;
|
|
68
68
|
let settled = false;
|
|
69
69
|
let forceKillTimer;
|
|
@@ -78,7 +78,8 @@ var execWorkspaceCommand = async (command, args, options) => new Promise((resolv
|
|
|
78
78
|
stdout: Buffer.concat(stdout).toString("utf8"),
|
|
79
79
|
stderr: Buffer.concat(stderr).toString("utf8"),
|
|
80
80
|
code,
|
|
81
|
-
killed
|
|
81
|
+
killed,
|
|
82
|
+
truncated
|
|
82
83
|
});
|
|
83
84
|
};
|
|
84
85
|
const signalProcessTree = (signal) => {
|
|
@@ -120,7 +121,10 @@ var execWorkspaceCommand = async (command, args, options) => new Promise((resolv
|
|
|
120
121
|
const remaining = Math.max(0, options.maxOutputBytes - outputBytes);
|
|
121
122
|
if (remaining > 0) target.push(chunk.subarray(0, remaining));
|
|
122
123
|
outputBytes += chunk.byteLength;
|
|
123
|
-
if (outputBytes > options.maxOutputBytes)
|
|
124
|
+
if (outputBytes > options.maxOutputBytes) {
|
|
125
|
+
truncated = true;
|
|
126
|
+
terminate();
|
|
127
|
+
}
|
|
124
128
|
};
|
|
125
129
|
child.stdout?.on("data", collect(stdout));
|
|
126
130
|
child.stderr?.on("data", collect(stderr));
|
|
@@ -152,6 +156,7 @@ function explicitEnvironment(source) {
|
|
|
152
156
|
|
|
153
157
|
// src/modules/git/runtime.ts
|
|
154
158
|
var GIT_TIMEOUT_MS = 3e3;
|
|
159
|
+
var MAX_GIT_OUTPUT_BYTES = 64 * 1024;
|
|
155
160
|
async function readGitSnapshot(pi, cwd, options) {
|
|
156
161
|
if (options.signal?.aborted) return void 0;
|
|
157
162
|
const run = (args) => runGit(pi, cwd, args, options);
|
|
@@ -185,14 +190,14 @@ async function readGitSnapshot(pi, cwd, options) {
|
|
|
185
190
|
metricsPromise,
|
|
186
191
|
tagPromise
|
|
187
192
|
]);
|
|
188
|
-
if (options.signal?.aborted || statusResult.killed) return void 0;
|
|
193
|
+
if (statusResult.truncated || options.signal?.aborted || statusResult.killed) return void 0;
|
|
189
194
|
if (statusResult.code !== 0) {
|
|
190
195
|
return options.inspectBare ? readBareSnapshot(pi, cwd, options, tagResult) : void 0;
|
|
191
196
|
}
|
|
192
197
|
const parsed = parseGitStatusPorcelainV2(statusResult.stdout);
|
|
193
|
-
const metadata = metadataResult.code === 0 && !metadataResult.killed ? parseGitRepositoryMetadata(metadataResult.stdout) : void 0;
|
|
198
|
+
const metadata = !metadataResult.truncated && metadataResult.code === 0 && !metadataResult.killed ? parseGitRepositoryMetadata(metadataResult.stdout) : void 0;
|
|
194
199
|
const commit = withTag(parsed.commit, tagResult);
|
|
195
|
-
const metrics = metricsResult && metricsResult.code === 0 && !metricsResult.killed ? parseGitDiffShortstat(metricsResult.stdout) : void 0;
|
|
200
|
+
const metrics = metricsResult && !metricsResult.truncated && metricsResult.code === 0 && !metricsResult.killed ? parseGitDiffShortstat(metricsResult.stdout) : void 0;
|
|
196
201
|
return {
|
|
197
202
|
...parsed,
|
|
198
203
|
root: metadata?.root,
|
|
@@ -203,20 +208,25 @@ async function readGitSnapshot(pi, cwd, options) {
|
|
|
203
208
|
};
|
|
204
209
|
}
|
|
205
210
|
async function runGit(pi, cwd, args, options) {
|
|
206
|
-
const failed = { stdout: "", stderr: "", code: 1, killed: options.signal?.aborted ?? false };
|
|
211
|
+
const failed = { stdout: "", stderr: "", code: 1, killed: options.signal?.aborted ?? false, truncated: false };
|
|
207
212
|
if (options.signal?.aborted) return failed;
|
|
208
213
|
try {
|
|
209
214
|
const result = options.exec ? await options.exec("git", args, {
|
|
210
215
|
cwd,
|
|
211
216
|
timeout: GIT_TIMEOUT_MS,
|
|
212
|
-
maxOutputBytes:
|
|
217
|
+
maxOutputBytes: MAX_GIT_OUTPUT_BYTES,
|
|
213
218
|
signal: options.signal,
|
|
214
219
|
environment: process.env
|
|
215
|
-
}) : await pi.exec("git", args, {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
220
|
+
}) : await pi.exec("git", args, {
|
|
221
|
+
cwd,
|
|
222
|
+
signal: options.signal,
|
|
223
|
+
timeout: GIT_TIMEOUT_MS,
|
|
224
|
+
maxBuffer: MAX_GIT_OUTPUT_BYTES
|
|
225
|
+
});
|
|
226
|
+
if (result.truncated || Buffer.byteLength(result.stdout) + Buffer.byteLength(result.stderr) > MAX_GIT_OUTPUT_BYTES) {
|
|
227
|
+
return { ...failed, killed: result.killed, truncated: true };
|
|
219
228
|
}
|
|
229
|
+
if (options.signal?.aborted) return { ...failed, killed: true };
|
|
220
230
|
return result;
|
|
221
231
|
} catch {
|
|
222
232
|
return failed;
|
|
@@ -226,12 +236,13 @@ async function readBareSnapshot(pi, cwd, options, tagResult) {
|
|
|
226
236
|
const boundedOptions = { ...options, exec: options.exec ?? execWorkspaceCommand };
|
|
227
237
|
const run = (args) => runGit(pi, cwd, args, boundedOptions);
|
|
228
238
|
const bare = await run(["rev-parse", "--is-bare-repository"]);
|
|
229
|
-
if (options.signal?.aborted || bare.killed || bare.code !== 0 || bare.stdout.trim() !== "true")
|
|
239
|
+
if (bare.truncated || options.signal?.aborted || bare.killed || bare.code !== 0 || bare.stdout.trim() !== "true")
|
|
240
|
+
return void 0;
|
|
230
241
|
const [head, hash] = await Promise.all([
|
|
231
242
|
run(["symbolic-ref", "--short", "HEAD"]),
|
|
232
243
|
run(["rev-parse", "--verify", "HEAD"])
|
|
233
244
|
]);
|
|
234
|
-
if (options.signal?.aborted || head.killed || hash.killed) return void 0;
|
|
245
|
+
if (head.truncated || hash.truncated || options.signal?.aborted || head.killed || hash.killed) return void 0;
|
|
235
246
|
const name = head.code === 0 ? head.stdout.trim() : "";
|
|
236
247
|
const commitHash = hash.code === 0 ? hash.stdout.trim() : "";
|
|
237
248
|
const validHash = /^[a-fA-F0-9]{4,64}$/u.test(commitHash);
|
|
@@ -240,7 +251,7 @@ async function readBareSnapshot(pi, cwd, options, tagResult) {
|
|
|
240
251
|
const reference = `refs/heads/${name}`;
|
|
241
252
|
const upstreamResult = name ? await run(["for-each-ref", "--count=1", "--format=%(refname)%00%(upstream:short)", reference]) : void 0;
|
|
242
253
|
if (options.signal?.aborted) return void 0;
|
|
243
|
-
const upstreamFields = upstreamResult
|
|
254
|
+
const upstreamFields = upstreamResult && !upstreamResult.truncated && upstreamResult.code === 0 && !upstreamResult.killed ? upstreamResult.stdout.trimEnd().split("\0") : [];
|
|
244
255
|
const remote = upstreamFields[0] === reference ? splitUpstream(upstreamFields[1]) : {};
|
|
245
256
|
return {
|
|
246
257
|
branch: { name: name || "HEAD", detached, bare: true, ...remote },
|
|
@@ -409,7 +420,7 @@ function splitUpstream(upstream) {
|
|
|
409
420
|
};
|
|
410
421
|
}
|
|
411
422
|
function withTag(commit, result) {
|
|
412
|
-
if (!commit || !result || result.code !== 0 || result.killed) return commit;
|
|
423
|
+
if (!commit || !result || result.truncated || result.code !== 0 || result.killed) return commit;
|
|
413
424
|
const tag = result.stdout.trim();
|
|
414
425
|
return tag ? { ...commit, tag: tag.split(/\r?\n/u)[0] } : commit;
|
|
415
426
|
}
|
|
@@ -770,6 +781,7 @@ function githubPrEnvironment(source = process.env) {
|
|
|
770
781
|
return environment;
|
|
771
782
|
}
|
|
772
783
|
async function queryGithubPr(exec, cwd, signal, now = Date.now(), options = {}) {
|
|
784
|
+
if (signal?.aborted) return void 0;
|
|
773
785
|
const invocation = ghPrViewInvocation(options.platform);
|
|
774
786
|
try {
|
|
775
787
|
const result = await exec(invocation.command, invocation.args, {
|
|
@@ -779,8 +791,9 @@ async function queryGithubPr(exec, cwd, signal, now = Date.now(), options = {})
|
|
|
779
791
|
maxOutputBytes: MAX_GH_OUTPUT_BYTES,
|
|
780
792
|
environment: githubPrEnvironment(options.environment)
|
|
781
793
|
});
|
|
782
|
-
if (result.
|
|
783
|
-
if (
|
|
794
|
+
if (result.truncated) return void 0;
|
|
795
|
+
if (signal?.aborted || result.killed || result.code !== 0) return void 0;
|
|
796
|
+
if (Buffer.byteLength(result.stdout) + Buffer.byteLength(result.stderr) > MAX_GH_OUTPUT_BYTES) return void 0;
|
|
784
797
|
return buildGithubPrSnapshot(JSON.parse(result.stdout), now);
|
|
785
798
|
} catch {
|
|
786
799
|
return void 0;
|
|
@@ -1067,7 +1080,7 @@ async function collectWorkspaceSnapshot(input) {
|
|
|
1067
1080
|
};
|
|
1068
1081
|
const modules = {};
|
|
1069
1082
|
if (requirements.has("package")) {
|
|
1070
|
-
const { collectPackage } = await import("./chunks/package-
|
|
1083
|
+
const { collectPackage } = await import("./chunks/package-JA4CJ5DR.ts");
|
|
1071
1084
|
if (input.signal?.aborted) return freezeSnapshot({});
|
|
1072
1085
|
const packageValues = await collectPackage(context);
|
|
1073
1086
|
if (input.signal?.aborted) return freezeSnapshot({});
|
|
@@ -1095,31 +1108,31 @@ var COLLECTOR_GROUPS = [
|
|
|
1095
1108
|
},
|
|
1096
1109
|
{
|
|
1097
1110
|
modules: ["jj_bookmark", "jj_change", "jj_metrics", "jj_status"],
|
|
1098
|
-
load: async () => (await import("./chunks/jujutsu-
|
|
1111
|
+
load: async () => (await import("./chunks/jujutsu-T2LTPHSY.ts")).collectJujutsu
|
|
1099
1112
|
},
|
|
1100
1113
|
{
|
|
1101
1114
|
modules: ["memory_usage", "battery"],
|
|
1102
|
-
load: async () => (await import("./chunks/system-
|
|
1115
|
+
load: async () => (await import("./chunks/system-CDTPAQZX.ts")).collectSystem
|
|
1103
1116
|
},
|
|
1104
1117
|
{
|
|
1105
1118
|
modules: ["nodejs", "python", "rust", "golang", "bun", "deno"],
|
|
1106
|
-
load: async () => (await import("./chunks/languages-
|
|
1119
|
+
load: async () => (await import("./chunks/languages-VWXTVJ45.ts")).collectLanguages
|
|
1107
1120
|
},
|
|
1108
1121
|
{
|
|
1109
1122
|
modules: ["mise", "direnv", "pixi", "conda", "nix_shell", "guix_shell"],
|
|
1110
|
-
load: async () => (await import("./chunks/development-
|
|
1123
|
+
load: async () => (await import("./chunks/development-TJNVM4H2.ts")).collectDevelopment
|
|
1111
1124
|
},
|
|
1112
1125
|
{
|
|
1113
1126
|
modules: ["docker_context", "kubernetes", "terraform"],
|
|
1114
|
-
load: async () => (await import("./chunks/deployment-
|
|
1127
|
+
load: async () => (await import("./chunks/deployment-KNUSQSJ5.ts")).collectDeployment
|
|
1115
1128
|
},
|
|
1116
1129
|
{
|
|
1117
1130
|
modules: ["aws", "gcloud", "azure", "openstack"],
|
|
1118
|
-
load: async () => (await import("./chunks/cloud-
|
|
1131
|
+
load: async () => (await import("./chunks/cloud-CNNWXSQ3.ts")).collectCloud
|
|
1119
1132
|
},
|
|
1120
1133
|
{
|
|
1121
1134
|
modules: ["container", "hostname", "os", "username"],
|
|
1122
|
-
load: async () => (await import("./chunks/execution-
|
|
1135
|
+
load: async () => (await import("./chunks/execution-OFQXHFAH.ts")).collectExecution
|
|
1123
1136
|
}
|
|
1124
1137
|
];
|
|
1125
1138
|
var BUILT_IN_ONLY_MODULES = /* @__PURE__ */ new Set([
|
|
@@ -1168,21 +1181,39 @@ function freezeSnapshot(modules) {
|
|
|
1168
1181
|
}
|
|
1169
1182
|
|
|
1170
1183
|
// src/usage.ts
|
|
1184
|
+
function latestTokensPerSecond(branch) {
|
|
1185
|
+
for (let index = branch.length - 1; index >= 0; index -= 1) {
|
|
1186
|
+
const entry = branch[index];
|
|
1187
|
+
if (entry?.type !== "message" || entry.message.role !== "assistant") continue;
|
|
1188
|
+
const { stopReason, durationMs, usage } = entry.message;
|
|
1189
|
+
if (stopReason !== "stop" && stopReason !== "length" && stopReason !== "toolUse") return void 0;
|
|
1190
|
+
const output = usage?.output;
|
|
1191
|
+
if (typeof durationMs !== "number" || !Number.isFinite(durationMs) || durationMs <= 0 || typeof output !== "number" || !Number.isFinite(output) || output < 0) {
|
|
1192
|
+
return void 0;
|
|
1193
|
+
}
|
|
1194
|
+
const rate = output / (durationMs / 1e3);
|
|
1195
|
+
return Number.isFinite(rate) ? rate : void 0;
|
|
1196
|
+
}
|
|
1197
|
+
return void 0;
|
|
1198
|
+
}
|
|
1171
1199
|
function summarizeFooterUsage(entries) {
|
|
1172
1200
|
const totals = {
|
|
1173
1201
|
input: 0,
|
|
1174
1202
|
output: 0,
|
|
1175
1203
|
cacheRead: 0,
|
|
1176
1204
|
cacheWrite: 0,
|
|
1177
|
-
cost: 0
|
|
1205
|
+
cost: 0,
|
|
1206
|
+
costTotalFromProvider: false
|
|
1178
1207
|
};
|
|
1208
|
+
let hasUsage = false;
|
|
1209
|
+
let allTotalsFromProvider = true;
|
|
1179
1210
|
for (const entry of entries) {
|
|
1180
1211
|
let usage;
|
|
1181
1212
|
if (entry.type === "message" && entry.message.role === "assistant") {
|
|
1182
1213
|
usage = entry.message.usage;
|
|
1183
|
-
const input = usage
|
|
1184
|
-
const cacheRead = usage
|
|
1185
|
-
const cacheWrite = usage
|
|
1214
|
+
const input = usage?.input ?? 0;
|
|
1215
|
+
const cacheRead = usage?.cacheRead ?? 0;
|
|
1216
|
+
const cacheWrite = usage?.cacheWrite ?? 0;
|
|
1186
1217
|
const promptTokens = input + cacheRead + cacheWrite;
|
|
1187
1218
|
totals.latestCacheHitRate = promptTokens > 0 ? cacheRead / promptTokens * 100 : void 0;
|
|
1188
1219
|
} else if (entry.type === "message" && entry.message.role === "toolResult") {
|
|
@@ -1196,7 +1227,11 @@ function summarizeFooterUsage(entries) {
|
|
|
1196
1227
|
totals.cacheRead += usage.cacheRead ?? 0;
|
|
1197
1228
|
totals.cacheWrite += usage.cacheWrite ?? 0;
|
|
1198
1229
|
totals.cost += usage.cost?.total ?? 0;
|
|
1230
|
+
hasUsage = true;
|
|
1231
|
+
const cost = usage.cost;
|
|
1232
|
+
allTotalsFromProvider &&= cost?.totalFromProvider === true && typeof cost.total === "number" && Number.isFinite(cost.total) && cost.total >= 0;
|
|
1199
1233
|
}
|
|
1234
|
+
totals.costTotalFromProvider = hasUsage && allTotalsFromProvider && Number.isFinite(totals.cost);
|
|
1200
1235
|
return totals;
|
|
1201
1236
|
}
|
|
1202
1237
|
|
|
@@ -1208,7 +1243,7 @@ var MAX_TIMER_DELAY_MS = 2147483647;
|
|
|
1208
1243
|
var starshipCommandsPromise;
|
|
1209
1244
|
function loadStarshipCommands() {
|
|
1210
1245
|
if (!starshipCommandsPromise) {
|
|
1211
|
-
starshipCommandsPromise = import("./chunks/commands-
|
|
1246
|
+
starshipCommandsPromise = import("./chunks/commands-MSJ67CTR.ts").catch((error) => {
|
|
1212
1247
|
starshipCommandsPromise = void 0;
|
|
1213
1248
|
throw error;
|
|
1214
1249
|
});
|
|
@@ -1773,19 +1808,21 @@ function safeUsername() {
|
|
|
1773
1808
|
}
|
|
1774
1809
|
}
|
|
1775
1810
|
function runtimeSnapshot(ctx, footerData, runtime) {
|
|
1811
|
+
const branch = ctx.sessionManager.getBranch();
|
|
1776
1812
|
return {
|
|
1777
1813
|
cwd: ctx.cwd,
|
|
1778
1814
|
homeDir: homedir(),
|
|
1779
1815
|
gitRoot: runtime.git?.root,
|
|
1780
1816
|
model: ctx.model ? { provider: ctx.model.provider, id: ctx.model.id } : void 0,
|
|
1781
1817
|
thinkingLevel: runtime.thinkingLevel,
|
|
1782
|
-
turnCount:
|
|
1818
|
+
turnCount: branch.filter((entry) => entry.type === "message" && entry.message.role === "user").length,
|
|
1783
1819
|
activeTools: runtime.activeTools,
|
|
1784
1820
|
isStreaming: runtime.isStreaming,
|
|
1785
1821
|
uiPrompt: runtime.uiPrompt,
|
|
1786
1822
|
lastCompletedTool: runtime.lastCompletedTool,
|
|
1787
1823
|
contextUsage: ctx.getContextUsage() ?? void 0,
|
|
1788
1824
|
tokenTotals: summarizeFooterUsage(ctx.sessionManager.getEntries()),
|
|
1825
|
+
tokensPerSecond: latestTokensPerSecond(branch),
|
|
1789
1826
|
usingSubscription: isSubscriptionBacked(ctx),
|
|
1790
1827
|
gitBranch: runtime.git?.branch?.name ?? footerData.getGitBranch(),
|
|
1791
1828
|
gitBranchDetails: runtime.git?.branch,
|
|
@@ -1800,9 +1837,6 @@ function runtimeSnapshot(ctx, footerData, runtime) {
|
|
|
1800
1837
|
now: /* @__PURE__ */ new Date()
|
|
1801
1838
|
};
|
|
1802
1839
|
}
|
|
1803
|
-
function userTurnCount(ctx) {
|
|
1804
|
-
return ctx.sessionManager.getBranch().filter((entry) => entry.type === "message" && entry.message.role === "user").length;
|
|
1805
|
-
}
|
|
1806
1840
|
function isSubscriptionBacked(ctx) {
|
|
1807
1841
|
const model = ctx.model;
|
|
1808
1842
|
return model !== void 0 && (model.provider === "kimi-coding" || ctx.modelRegistry.isUsingOAuth(model));
|