ccstatusline-usage 2.0.40 → 2.0.42
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/README.md +1 -1
- package/dist/ccstatusline.js +205 -213
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ Session: [████░░░░░░░░░░░] 27.0% | Weekly: [██
|
|
|
40
40
|
Context: [███████░░░░░░░░] 103k/200k (51%)
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
These widgets are enabled by default. Just install and run!
|
|
44
44
|
|
|
45
45
|

|
|
46
46
|
|
package/dist/ccstatusline.js
CHANGED
|
@@ -32383,8 +32383,8 @@ var require_utils = __commonJS((exports) => {
|
|
|
32383
32383
|
}
|
|
32384
32384
|
return output;
|
|
32385
32385
|
};
|
|
32386
|
-
exports.basename = (
|
|
32387
|
-
const segs =
|
|
32386
|
+
exports.basename = (path6, { windows } = {}) => {
|
|
32387
|
+
const segs = path6.split(windows ? /[\\/]/ : "/");
|
|
32388
32388
|
const last = segs[segs.length - 1];
|
|
32389
32389
|
if (last === "") {
|
|
32390
32390
|
return segs[segs.length - 2];
|
|
@@ -51450,7 +51450,7 @@ import { execSync as execSync3 } from "child_process";
|
|
|
51450
51450
|
import * as fs5 from "fs";
|
|
51451
51451
|
import * as path4 from "path";
|
|
51452
51452
|
var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils";
|
|
51453
|
-
var PACKAGE_VERSION = "2.0.
|
|
51453
|
+
var PACKAGE_VERSION = "2.0.42";
|
|
51454
51454
|
function getPackageVersion() {
|
|
51455
51455
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
51456
51456
|
return PACKAGE_VERSION;
|
|
@@ -52296,8 +52296,11 @@ class ModelWidget {
|
|
|
52296
52296
|
render(item, context, settings) {
|
|
52297
52297
|
if (context.isPreview) {
|
|
52298
52298
|
return item.rawValue ? "Claude" : "Model: Claude";
|
|
52299
|
-
}
|
|
52300
|
-
|
|
52299
|
+
}
|
|
52300
|
+
const model = context.data?.model;
|
|
52301
|
+
const modelDisplayName = typeof model === "string" ? model : model?.display_name ?? model?.id;
|
|
52302
|
+
if (modelDisplayName) {
|
|
52303
|
+
return item.rawValue ? modelDisplayName : `Model: ${modelDisplayName}`;
|
|
52301
52304
|
}
|
|
52302
52305
|
return null;
|
|
52303
52306
|
}
|
|
@@ -52590,7 +52593,8 @@ function calculateContextPercentage(context) {
|
|
|
52590
52593
|
if (!context.tokenMetrics) {
|
|
52591
52594
|
return 0;
|
|
52592
52595
|
}
|
|
52593
|
-
const
|
|
52596
|
+
const model = context.data?.model;
|
|
52597
|
+
const modelId = typeof model === "string" ? model : model?.id;
|
|
52594
52598
|
const contextConfig = getContextConfig(modelId);
|
|
52595
52599
|
return Math.min(100, context.tokenMetrics.contextLength / contextConfig.maxTokens * 100);
|
|
52596
52600
|
}
|
|
@@ -53446,7 +53450,8 @@ class ContextPercentageWidget {
|
|
|
53446
53450
|
const previewValue = isInverse ? "90.7%" : "9.3%";
|
|
53447
53451
|
return item.rawValue ? previewValue : `Ctx: ${previewValue}`;
|
|
53448
53452
|
} else if (context.tokenMetrics) {
|
|
53449
|
-
const
|
|
53453
|
+
const model = context.data?.model;
|
|
53454
|
+
const modelId = typeof model === "string" ? model : model?.id;
|
|
53450
53455
|
const contextConfig = getContextConfig(modelId);
|
|
53451
53456
|
const usedPercentage = Math.min(100, context.tokenMetrics.contextLength / contextConfig.maxTokens * 100);
|
|
53452
53457
|
const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
|
|
@@ -53519,7 +53524,8 @@ class ContextPercentageUsableWidget {
|
|
|
53519
53524
|
const previewValue = isInverse ? "88.4%" : "11.6%";
|
|
53520
53525
|
return item.rawValue ? previewValue : `Ctx(u): ${previewValue}`;
|
|
53521
53526
|
} else if (context.tokenMetrics) {
|
|
53522
|
-
const
|
|
53527
|
+
const model = context.data?.model;
|
|
53528
|
+
const modelId = typeof model === "string" ? model : model?.id;
|
|
53523
53529
|
const contextConfig = getContextConfig(modelId);
|
|
53524
53530
|
const usedPercentage = Math.min(100, context.tokenMetrics.contextLength / contextConfig.usableTokens * 100);
|
|
53525
53531
|
const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
|
|
@@ -53812,83 +53818,8 @@ var CustomTextEditor = ({ widget, onComplete, onCancel }) => {
|
|
|
53812
53818
|
};
|
|
53813
53819
|
// src/widgets/CustomCommand.tsx
|
|
53814
53820
|
import { execSync as execSync7 } from "child_process";
|
|
53815
|
-
import * as fs6 from "fs";
|
|
53816
53821
|
var import_react30 = __toESM(require_react(), 1);
|
|
53817
|
-
import * as path5 from "path";
|
|
53818
53822
|
var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
53819
|
-
function getPackageDir() {
|
|
53820
|
-
const scriptPaths = [
|
|
53821
|
-
process.argv[1],
|
|
53822
|
-
__require.main?.filename
|
|
53823
|
-
].filter(Boolean);
|
|
53824
|
-
for (const scriptPath of scriptPaths) {
|
|
53825
|
-
try {
|
|
53826
|
-
const realPath = fs6.realpathSync(scriptPath);
|
|
53827
|
-
let dir = path5.dirname(realPath);
|
|
53828
|
-
for (let i = 0;i < 10; i++) {
|
|
53829
|
-
const pkgJson = path5.join(dir, "package.json");
|
|
53830
|
-
if (fs6.existsSync(pkgJson)) {
|
|
53831
|
-
try {
|
|
53832
|
-
const pkg = JSON.parse(fs6.readFileSync(pkgJson, "utf8"));
|
|
53833
|
-
if (pkg.name === "ccstatusline-usage") {
|
|
53834
|
-
return dir;
|
|
53835
|
-
}
|
|
53836
|
-
} catch {}
|
|
53837
|
-
}
|
|
53838
|
-
const scriptsDir = path5.join(dir, "scripts");
|
|
53839
|
-
if (fs6.existsSync(path5.join(scriptsDir, "usage.sh"))) {
|
|
53840
|
-
return dir;
|
|
53841
|
-
}
|
|
53842
|
-
dir = path5.dirname(dir);
|
|
53843
|
-
}
|
|
53844
|
-
} catch {}
|
|
53845
|
-
}
|
|
53846
|
-
const home = process.env.HOME ?? "";
|
|
53847
|
-
const npxPaths = [
|
|
53848
|
-
path5.join(home, ".npm", "_npx"),
|
|
53849
|
-
path5.join(home, ".cache", "npm", "_npx"),
|
|
53850
|
-
path5.join(home, ".local", "share", "npm", "_npx")
|
|
53851
|
-
];
|
|
53852
|
-
for (const npxBase of npxPaths) {
|
|
53853
|
-
if (fs6.existsSync(npxBase)) {
|
|
53854
|
-
try {
|
|
53855
|
-
const entries = fs6.readdirSync(npxBase);
|
|
53856
|
-
for (const entry of entries) {
|
|
53857
|
-
const pkgDir = path5.join(npxBase, entry, "node_modules", "ccstatusline-usage");
|
|
53858
|
-
if (fs6.existsSync(path5.join(pkgDir, "scripts", "usage.sh"))) {
|
|
53859
|
-
return pkgDir;
|
|
53860
|
-
}
|
|
53861
|
-
}
|
|
53862
|
-
} catch {}
|
|
53863
|
-
}
|
|
53864
|
-
}
|
|
53865
|
-
const globalPaths = [
|
|
53866
|
-
"/usr/local/lib/node_modules/ccstatusline-usage",
|
|
53867
|
-
"/usr/lib/node_modules/ccstatusline-usage",
|
|
53868
|
-
path5.join(home, ".nvm", "versions", "node"),
|
|
53869
|
-
path5.join(home, "node_modules", "ccstatusline-usage"),
|
|
53870
|
-
path5.join(home, ".local", "lib", "node_modules", "ccstatusline-usage")
|
|
53871
|
-
];
|
|
53872
|
-
for (const globalPath of globalPaths) {
|
|
53873
|
-
if (globalPath.includes(".nvm")) {
|
|
53874
|
-
try {
|
|
53875
|
-
if (fs6.existsSync(globalPath)) {
|
|
53876
|
-
const versions2 = fs6.readdirSync(globalPath);
|
|
53877
|
-
for (const ver of versions2) {
|
|
53878
|
-
const pkgDir = path5.join(globalPath, ver, "lib", "node_modules", "ccstatusline-usage");
|
|
53879
|
-
if (fs6.existsSync(path5.join(pkgDir, "scripts", "usage.sh"))) {
|
|
53880
|
-
return pkgDir;
|
|
53881
|
-
}
|
|
53882
|
-
}
|
|
53883
|
-
}
|
|
53884
|
-
} catch {}
|
|
53885
|
-
} else if (fs6.existsSync(path5.join(globalPath, "scripts", "usage.sh"))) {
|
|
53886
|
-
return globalPath;
|
|
53887
|
-
}
|
|
53888
|
-
}
|
|
53889
|
-
return "";
|
|
53890
|
-
}
|
|
53891
|
-
var PKG_DIR = getPackageDir();
|
|
53892
53823
|
|
|
53893
53824
|
class CustomCommandWidget {
|
|
53894
53825
|
getDefaultColor() {
|
|
@@ -53901,11 +53832,9 @@ class CustomCommandWidget {
|
|
|
53901
53832
|
return "Custom Command";
|
|
53902
53833
|
}
|
|
53903
53834
|
getEditorDisplay(item) {
|
|
53904
|
-
const
|
|
53905
|
-
|
|
53906
|
-
|
|
53907
|
-
return `${this.getDisplayName()} (${truncatedCmd})`;
|
|
53908
|
-
})();
|
|
53835
|
+
const cmd = item.commandPath ?? "No command";
|
|
53836
|
+
const truncatedCmd = cmd.length > 20 ? `${cmd.substring(0, 17)}...` : cmd;
|
|
53837
|
+
const displayText = `${this.getDisplayName()} (${truncatedCmd})`;
|
|
53909
53838
|
const modifiers = [];
|
|
53910
53839
|
if (item.maxWidth) {
|
|
53911
53840
|
modifiers.push(`max:${item.maxWidth}`);
|
|
@@ -53927,17 +53856,6 @@ class CustomCommandWidget {
|
|
|
53927
53856
|
}
|
|
53928
53857
|
return null;
|
|
53929
53858
|
}
|
|
53930
|
-
resolveCommandPath(commandPath) {
|
|
53931
|
-
if (commandPath.startsWith("$PKG/") || commandPath.startsWith("$PACKAGE_DIR/")) {
|
|
53932
|
-
const relativePath = commandPath.replace(/^\$(PKG|PACKAGE_DIR)\//, "");
|
|
53933
|
-
const resolved = path5.join(PKG_DIR, relativePath);
|
|
53934
|
-
return resolved;
|
|
53935
|
-
}
|
|
53936
|
-
if (commandPath.startsWith("$HOME/")) {
|
|
53937
|
-
return commandPath.replace("$HOME", process.env.HOME ?? "~");
|
|
53938
|
-
}
|
|
53939
|
-
return commandPath;
|
|
53940
|
-
}
|
|
53941
53859
|
render(item, context, settings) {
|
|
53942
53860
|
if (context.isPreview) {
|
|
53943
53861
|
return item.commandPath ? `[cmd: ${item.commandPath.substring(0, 20)}${item.commandPath.length > 20 ? "..." : ""}]` : "[No command]";
|
|
@@ -53945,8 +53863,7 @@ class CustomCommandWidget {
|
|
|
53945
53863
|
try {
|
|
53946
53864
|
const timeout = item.timeout ?? 1000;
|
|
53947
53865
|
const jsonInput = JSON.stringify(context.data);
|
|
53948
|
-
|
|
53949
|
-
let output = execSync7(resolvedPath, {
|
|
53866
|
+
let output = execSync7(item.commandPath, {
|
|
53950
53867
|
encoding: "utf8",
|
|
53951
53868
|
input: jsonInput,
|
|
53952
53869
|
timeout,
|
|
@@ -54367,13 +54284,13 @@ class CurrentWorkingDirWidget {
|
|
|
54367
54284
|
supportsColors(item) {
|
|
54368
54285
|
return true;
|
|
54369
54286
|
}
|
|
54370
|
-
abbreviatePath(
|
|
54287
|
+
abbreviatePath(path5) {
|
|
54371
54288
|
const homeDir = os5.homedir();
|
|
54372
|
-
const useBackslash =
|
|
54289
|
+
const useBackslash = path5.includes("\\") && !path5.includes("/");
|
|
54373
54290
|
const sep = useBackslash ? "\\" : "/";
|
|
54374
|
-
let normalizedPath =
|
|
54375
|
-
if (
|
|
54376
|
-
normalizedPath = "~" +
|
|
54291
|
+
let normalizedPath = path5;
|
|
54292
|
+
if (path5.startsWith(homeDir)) {
|
|
54293
|
+
normalizedPath = "~" + path5.slice(homeDir.length);
|
|
54377
54294
|
}
|
|
54378
54295
|
const parts = normalizedPath.split(/[\\/]+/).filter((part) => part !== "");
|
|
54379
54296
|
const abbreviated = parts.map((part, index) => {
|
|
@@ -54487,14 +54404,11 @@ class ClaudeSessionIdWidget {
|
|
|
54487
54404
|
}
|
|
54488
54405
|
}
|
|
54489
54406
|
// src/widgets/ApiUsage.tsx
|
|
54490
|
-
import {
|
|
54491
|
-
|
|
54492
|
-
|
|
54493
|
-
|
|
54494
|
-
|
|
54495
|
-
import * as path6 from "path";
|
|
54496
|
-
var CACHE_FILE = path6.join(process.env.HOME ?? "", ".cache", "ccstatusline-api.json");
|
|
54497
|
-
var LOCK_FILE = path6.join(process.env.HOME ?? "", ".cache", "ccstatusline-api.lock");
|
|
54407
|
+
import { execSync as execSync8, spawnSync } from "child_process";
|
|
54408
|
+
import * as fs6 from "fs";
|
|
54409
|
+
import * as path5 from "path";
|
|
54410
|
+
var CACHE_FILE = path5.join(process.env.HOME ?? "", ".cache", "ccstatusline-api.json");
|
|
54411
|
+
var LOCK_FILE = path5.join(process.env.HOME ?? "", ".cache", "ccstatusline-api.lock");
|
|
54498
54412
|
var CACHE_MAX_AGE = 180;
|
|
54499
54413
|
var LOCK_MAX_AGE = 30;
|
|
54500
54414
|
var TOKEN_CACHE_MAX_AGE = 3600;
|
|
@@ -54519,8 +54433,8 @@ function getToken() {
|
|
|
54519
54433
|
}
|
|
54520
54434
|
return token;
|
|
54521
54435
|
} else {
|
|
54522
|
-
const credFile =
|
|
54523
|
-
const creds = JSON.parse(
|
|
54436
|
+
const credFile = path5.join(process.env.HOME ?? "", ".claude", ".credentials.json");
|
|
54437
|
+
const creds = JSON.parse(fs6.readFileSync(credFile, "utf8"));
|
|
54524
54438
|
const token = creds?.claudeAiOauth?.accessToken ?? null;
|
|
54525
54439
|
if (token) {
|
|
54526
54440
|
cachedToken = token;
|
|
@@ -54534,21 +54448,59 @@ function getToken() {
|
|
|
54534
54448
|
}
|
|
54535
54449
|
function readStaleCache() {
|
|
54536
54450
|
try {
|
|
54537
|
-
return JSON.parse(
|
|
54451
|
+
return JSON.parse(fs6.readFileSync(CACHE_FILE, "utf8"));
|
|
54538
54452
|
} catch {
|
|
54539
54453
|
return null;
|
|
54540
54454
|
}
|
|
54541
54455
|
}
|
|
54456
|
+
function fetchFromApi(token) {
|
|
54457
|
+
const script = `
|
|
54458
|
+
const https = require('https');
|
|
54459
|
+
const options = {
|
|
54460
|
+
hostname: 'api.anthropic.com',
|
|
54461
|
+
path: '/api/oauth/usage',
|
|
54462
|
+
method: 'GET',
|
|
54463
|
+
headers: {
|
|
54464
|
+
'Authorization': 'Bearer ' + process.env.TOKEN,
|
|
54465
|
+
'anthropic-beta': 'oauth-2025-04-20'
|
|
54466
|
+
},
|
|
54467
|
+
timeout: 5000
|
|
54468
|
+
};
|
|
54469
|
+
const req = https.request(options, (res) => {
|
|
54470
|
+
let data = '';
|
|
54471
|
+
res.on('data', chunk => data += chunk);
|
|
54472
|
+
res.on('end', () => {
|
|
54473
|
+
if (res.statusCode === 200) {
|
|
54474
|
+
process.stdout.write(data);
|
|
54475
|
+
} else {
|
|
54476
|
+
process.exit(1);
|
|
54477
|
+
}
|
|
54478
|
+
});
|
|
54479
|
+
});
|
|
54480
|
+
req.on('error', () => process.exit(1));
|
|
54481
|
+
req.on('timeout', () => { req.destroy(); process.exit(1); });
|
|
54482
|
+
req.end();
|
|
54483
|
+
`;
|
|
54484
|
+
const result = spawnSync("node", ["-e", script], {
|
|
54485
|
+
encoding: "utf8",
|
|
54486
|
+
timeout: 6000,
|
|
54487
|
+
env: { ...process.env, TOKEN: token }
|
|
54488
|
+
});
|
|
54489
|
+
if (result.error || result.status !== 0 || !result.stdout) {
|
|
54490
|
+
return null;
|
|
54491
|
+
}
|
|
54492
|
+
return result.stdout;
|
|
54493
|
+
}
|
|
54542
54494
|
function fetchApiData() {
|
|
54543
54495
|
const now = Math.floor(Date.now() / 1000);
|
|
54544
54496
|
if (cachedData && !cachedData.error && now - cacheTime < CACHE_MAX_AGE) {
|
|
54545
54497
|
return cachedData;
|
|
54546
54498
|
}
|
|
54547
54499
|
try {
|
|
54548
|
-
const stat =
|
|
54500
|
+
const stat = fs6.statSync(CACHE_FILE);
|
|
54549
54501
|
const fileAge = now - Math.floor(stat.mtimeMs / 1000);
|
|
54550
54502
|
if (fileAge < CACHE_MAX_AGE) {
|
|
54551
|
-
const fileData = JSON.parse(
|
|
54503
|
+
const fileData = JSON.parse(fs6.readFileSync(CACHE_FILE, "utf8"));
|
|
54552
54504
|
if (!fileData.error) {
|
|
54553
54505
|
cachedData = fileData;
|
|
54554
54506
|
cacheTime = now;
|
|
@@ -54557,7 +54509,7 @@ function fetchApiData() {
|
|
|
54557
54509
|
}
|
|
54558
54510
|
} catch {}
|
|
54559
54511
|
try {
|
|
54560
|
-
const lockStat =
|
|
54512
|
+
const lockStat = fs6.statSync(LOCK_FILE);
|
|
54561
54513
|
const lockAge = now - Math.floor(lockStat.mtimeMs / 1000);
|
|
54562
54514
|
if (lockAge < LOCK_MAX_AGE) {
|
|
54563
54515
|
const stale = readStaleCache();
|
|
@@ -54567,11 +54519,11 @@ function fetchApiData() {
|
|
|
54567
54519
|
}
|
|
54568
54520
|
} catch {}
|
|
54569
54521
|
try {
|
|
54570
|
-
const lockDir =
|
|
54571
|
-
if (!
|
|
54572
|
-
|
|
54522
|
+
const lockDir = path5.dirname(LOCK_FILE);
|
|
54523
|
+
if (!fs6.existsSync(lockDir)) {
|
|
54524
|
+
fs6.mkdirSync(lockDir, { recursive: true });
|
|
54573
54525
|
}
|
|
54574
|
-
|
|
54526
|
+
fs6.writeFileSync(LOCK_FILE, "");
|
|
54575
54527
|
} catch {}
|
|
54576
54528
|
const token = getToken();
|
|
54577
54529
|
if (!token) {
|
|
@@ -54581,27 +54533,18 @@ function fetchApiData() {
|
|
|
54581
54533
|
return { error: "no-credentials" };
|
|
54582
54534
|
}
|
|
54583
54535
|
try {
|
|
54584
|
-
const
|
|
54585
|
-
|
|
54586
|
-
"--max-time",
|
|
54587
|
-
"5",
|
|
54588
|
-
"https://api.anthropic.com/api/oauth/usage",
|
|
54589
|
-
"-H",
|
|
54590
|
-
`Authorization: Bearer ${token}`,
|
|
54591
|
-
"-H",
|
|
54592
|
-
"anthropic-beta: oauth-2025-04-20"
|
|
54593
|
-
], { encoding: "utf8", timeout: 6000 });
|
|
54594
|
-
if (curlResult.error || curlResult.status !== 0 || !curlResult.stdout) {
|
|
54536
|
+
const response = fetchFromApi(token);
|
|
54537
|
+
if (!response) {
|
|
54595
54538
|
const stale = readStaleCache();
|
|
54596
54539
|
if (stale && !stale.error)
|
|
54597
54540
|
return stale;
|
|
54598
54541
|
return { error: "api-error" };
|
|
54599
54542
|
}
|
|
54600
|
-
const data = JSON.parse(
|
|
54543
|
+
const data = JSON.parse(response);
|
|
54601
54544
|
const apiData = {};
|
|
54602
54545
|
if (data.five_hour) {
|
|
54603
54546
|
apiData.sessionUsage = data.five_hour.utilization;
|
|
54604
|
-
apiData.sessionResetAt = data.five_hour.
|
|
54547
|
+
apiData.sessionResetAt = data.five_hour.resets_at;
|
|
54605
54548
|
}
|
|
54606
54549
|
if (data.seven_day) {
|
|
54607
54550
|
apiData.weeklyUsage = data.seven_day.utilization;
|
|
@@ -54613,11 +54556,11 @@ function fetchApiData() {
|
|
|
54613
54556
|
return { error: "parse-error" };
|
|
54614
54557
|
}
|
|
54615
54558
|
try {
|
|
54616
|
-
const cacheDir =
|
|
54617
|
-
if (!
|
|
54618
|
-
|
|
54559
|
+
const cacheDir = path5.dirname(CACHE_FILE);
|
|
54560
|
+
if (!fs6.existsSync(cacheDir)) {
|
|
54561
|
+
fs6.mkdirSync(cacheDir, { recursive: true });
|
|
54619
54562
|
}
|
|
54620
|
-
|
|
54563
|
+
fs6.writeFileSync(CACHE_FILE, JSON.stringify(apiData));
|
|
54621
54564
|
} catch {}
|
|
54622
54565
|
cachedData = apiData;
|
|
54623
54566
|
cacheTime = now;
|
|
@@ -56369,6 +56312,7 @@ var LineSelector = ({
|
|
|
56369
56312
|
}) => {
|
|
56370
56313
|
const [selectedIndex, setSelectedIndex] = import_react37.useState(initialSelection);
|
|
56371
56314
|
const [showDeleteDialog, setShowDeleteDialog] = import_react37.useState(false);
|
|
56315
|
+
const [moveMode, setMoveMode] = import_react37.useState(false);
|
|
56372
56316
|
const [localLines, setLocalLines] = import_react37.useState(lines);
|
|
56373
56317
|
import_react37.useEffect(() => {
|
|
56374
56318
|
setLocalLines(lines);
|
|
@@ -56400,6 +56344,32 @@ var LineSelector = ({
|
|
|
56400
56344
|
onBack();
|
|
56401
56345
|
return;
|
|
56402
56346
|
}
|
|
56347
|
+
if (moveMode) {
|
|
56348
|
+
if (key.upArrow && selectedIndex > 0) {
|
|
56349
|
+
const newLines = [...localLines];
|
|
56350
|
+
const temp = newLines[selectedIndex];
|
|
56351
|
+
const prev = newLines[selectedIndex - 1];
|
|
56352
|
+
if (temp && prev) {
|
|
56353
|
+
[newLines[selectedIndex], newLines[selectedIndex - 1]] = [prev, temp];
|
|
56354
|
+
}
|
|
56355
|
+
setLocalLines(newLines);
|
|
56356
|
+
onLinesUpdate(newLines);
|
|
56357
|
+
setSelectedIndex(selectedIndex - 1);
|
|
56358
|
+
} else if (key.downArrow && selectedIndex < localLines.length - 1) {
|
|
56359
|
+
const newLines = [...localLines];
|
|
56360
|
+
const temp = newLines[selectedIndex];
|
|
56361
|
+
const next = newLines[selectedIndex + 1];
|
|
56362
|
+
if (temp && next) {
|
|
56363
|
+
[newLines[selectedIndex], newLines[selectedIndex + 1]] = [next, temp];
|
|
56364
|
+
}
|
|
56365
|
+
setLocalLines(newLines);
|
|
56366
|
+
onLinesUpdate(newLines);
|
|
56367
|
+
setSelectedIndex(selectedIndex + 1);
|
|
56368
|
+
} else if (key.escape || key.return) {
|
|
56369
|
+
setMoveMode(false);
|
|
56370
|
+
}
|
|
56371
|
+
return;
|
|
56372
|
+
}
|
|
56403
56373
|
switch (input) {
|
|
56404
56374
|
case "a":
|
|
56405
56375
|
if (allowEditing) {
|
|
@@ -56411,6 +56381,11 @@ var LineSelector = ({
|
|
|
56411
56381
|
setShowDeleteDialog(true);
|
|
56412
56382
|
}
|
|
56413
56383
|
return;
|
|
56384
|
+
case "m":
|
|
56385
|
+
if (allowEditing && localLines.length > 1 && selectedIndex < localLines.length) {
|
|
56386
|
+
setMoveMode(true);
|
|
56387
|
+
}
|
|
56388
|
+
return;
|
|
56414
56389
|
}
|
|
56415
56390
|
if (key.escape) {
|
|
56416
56391
|
onBack();
|
|
@@ -56533,17 +56508,31 @@ var LineSelector = ({
|
|
|
56533
56508
|
children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
|
|
56534
56509
|
flexDirection: "column",
|
|
56535
56510
|
children: [
|
|
56536
|
-
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(
|
|
56537
|
-
|
|
56538
|
-
|
|
56539
|
-
|
|
56511
|
+
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
|
|
56512
|
+
children: [
|
|
56513
|
+
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
56514
|
+
bold: true,
|
|
56515
|
+
children: [
|
|
56516
|
+
title ?? "Select Line to Edit",
|
|
56517
|
+
" "
|
|
56518
|
+
]
|
|
56519
|
+
}, undefined, true, undefined, this),
|
|
56520
|
+
moveMode && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
56521
|
+
color: "blue",
|
|
56522
|
+
children: "[MOVE MODE]"
|
|
56523
|
+
}, undefined, false, undefined, this)
|
|
56524
|
+
]
|
|
56525
|
+
}, undefined, true, undefined, this),
|
|
56540
56526
|
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
56541
56527
|
dimColor: true,
|
|
56542
56528
|
children: "Choose which status line to configure"
|
|
56543
56529
|
}, undefined, false, undefined, this),
|
|
56544
|
-
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
56530
|
+
moveMode ? /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
56531
|
+
dimColor: true,
|
|
56532
|
+
children: "↑↓ to move line, ESC or Enter to exit move mode"
|
|
56533
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
56545
56534
|
dimColor: true,
|
|
56546
|
-
children: allowEditing ? localLines.length > 1 ? "(a) to append new line, (d) to delete line, ESC to go back" : "(a) to append new line, ESC to go back" : "ESC to go back"
|
|
56535
|
+
children: allowEditing ? localLines.length > 1 ? "(a) to append new line, (d) to delete line, (m) to move line, ESC to go back" : "(a) to append new line, ESC to go back" : "ESC to go back"
|
|
56547
56536
|
}, undefined, false, undefined, this),
|
|
56548
56537
|
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
|
|
56549
56538
|
marginTop: 1,
|
|
@@ -56554,10 +56543,10 @@ var LineSelector = ({
|
|
|
56554
56543
|
const suffix = line.length ? import_pluralize.default("widget", line.length, true) : "empty";
|
|
56555
56544
|
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
|
|
56556
56545
|
children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
56557
|
-
color: isSelected ? "green" : undefined,
|
|
56546
|
+
color: isSelected ? moveMode ? "blue" : "green" : undefined,
|
|
56558
56547
|
children: [
|
|
56559
56548
|
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
56560
|
-
children: isSelected ? "▶ " : " "
|
|
56549
|
+
children: isSelected ? moveMode ? "◆ " : "▶ " : " "
|
|
56561
56550
|
}, undefined, false, undefined, this),
|
|
56562
56551
|
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
56563
56552
|
children: [
|
|
@@ -56583,7 +56572,7 @@ var LineSelector = ({
|
|
|
56583
56572
|
}, undefined, true, undefined, this)
|
|
56584
56573
|
}, index, false, undefined, this);
|
|
56585
56574
|
}),
|
|
56586
|
-
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
|
|
56575
|
+
!moveMode && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
|
|
56587
56576
|
marginTop: 1,
|
|
56588
56577
|
children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
56589
56578
|
color: selectedIndex === localLines.length ? "green" : undefined,
|
|
@@ -58603,10 +58592,13 @@ var StatusJSONSchema = exports_external.looseObject({
|
|
|
58603
58592
|
session_id: exports_external.string().optional(),
|
|
58604
58593
|
transcript_path: exports_external.string().optional(),
|
|
58605
58594
|
cwd: exports_external.string().optional(),
|
|
58606
|
-
model: exports_external.
|
|
58607
|
-
|
|
58608
|
-
|
|
58609
|
-
|
|
58595
|
+
model: exports_external.union([
|
|
58596
|
+
exports_external.string(),
|
|
58597
|
+
exports_external.object({
|
|
58598
|
+
id: exports_external.string().optional(),
|
|
58599
|
+
display_name: exports_external.string().optional()
|
|
58600
|
+
})
|
|
58601
|
+
]).optional(),
|
|
58610
58602
|
workspace: exports_external.object({
|
|
58611
58603
|
current_dir: exports_external.string().optional(),
|
|
58612
58604
|
project_dir: exports_external.string().optional()
|
|
@@ -58639,42 +58631,42 @@ var StatusJSONSchema = exports_external.looseObject({
|
|
|
58639
58631
|
});
|
|
58640
58632
|
|
|
58641
58633
|
// src/utils/jsonl.ts
|
|
58642
|
-
import * as
|
|
58643
|
-
import
|
|
58634
|
+
import * as fs7 from "fs";
|
|
58635
|
+
import path7 from "node:path";
|
|
58644
58636
|
|
|
58645
58637
|
// node_modules/tinyglobby/dist/index.mjs
|
|
58646
|
-
import
|
|
58638
|
+
import path6, { posix } from "path";
|
|
58647
58639
|
|
|
58648
58640
|
// node_modules/fdir/dist/index.mjs
|
|
58649
58641
|
import { createRequire as createRequire2 } from "module";
|
|
58650
|
-
import { basename as basename2, dirname as
|
|
58642
|
+
import { basename as basename2, dirname as dirname3, normalize, relative, resolve as resolve2, sep } from "path";
|
|
58651
58643
|
import * as nativeFs from "fs";
|
|
58652
58644
|
var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
|
|
58653
|
-
function cleanPath(
|
|
58654
|
-
let normalized = normalize(
|
|
58645
|
+
function cleanPath(path6) {
|
|
58646
|
+
let normalized = normalize(path6);
|
|
58655
58647
|
if (normalized.length > 1 && normalized[normalized.length - 1] === sep)
|
|
58656
58648
|
normalized = normalized.substring(0, normalized.length - 1);
|
|
58657
58649
|
return normalized;
|
|
58658
58650
|
}
|
|
58659
58651
|
var SLASHES_REGEX = /[\\/]/g;
|
|
58660
|
-
function convertSlashes(
|
|
58661
|
-
return
|
|
58652
|
+
function convertSlashes(path6, separator) {
|
|
58653
|
+
return path6.replace(SLASHES_REGEX, separator);
|
|
58662
58654
|
}
|
|
58663
58655
|
var WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
58664
|
-
function isRootDirectory(
|
|
58665
|
-
return
|
|
58656
|
+
function isRootDirectory(path6) {
|
|
58657
|
+
return path6 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path6);
|
|
58666
58658
|
}
|
|
58667
|
-
function normalizePath(
|
|
58659
|
+
function normalizePath(path6, options) {
|
|
58668
58660
|
const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
|
|
58669
|
-
const pathNeedsCleaning = process.platform === "win32" &&
|
|
58661
|
+
const pathNeedsCleaning = process.platform === "win32" && path6.includes("/") || path6.startsWith(".");
|
|
58670
58662
|
if (resolvePaths)
|
|
58671
|
-
|
|
58663
|
+
path6 = resolve2(path6);
|
|
58672
58664
|
if (normalizePath$1 || pathNeedsCleaning)
|
|
58673
|
-
|
|
58674
|
-
if (
|
|
58665
|
+
path6 = cleanPath(path6);
|
|
58666
|
+
if (path6 === ".")
|
|
58675
58667
|
return "";
|
|
58676
|
-
const needsSeperator =
|
|
58677
|
-
return convertSlashes(needsSeperator ?
|
|
58668
|
+
const needsSeperator = path6[path6.length - 1] !== pathSeparator;
|
|
58669
|
+
return convertSlashes(needsSeperator ? path6 + pathSeparator : path6, pathSeparator);
|
|
58678
58670
|
}
|
|
58679
58671
|
function joinPathWithBasePath(filename, directoryPath) {
|
|
58680
58672
|
return directoryPath + filename;
|
|
@@ -58714,9 +58706,9 @@ var pushDirectory = (directoryPath, paths) => {
|
|
|
58714
58706
|
paths.push(directoryPath || ".");
|
|
58715
58707
|
};
|
|
58716
58708
|
var pushDirectoryFilter = (directoryPath, paths, filters) => {
|
|
58717
|
-
const
|
|
58718
|
-
if (filters.every((filter) => filter(
|
|
58719
|
-
paths.push(
|
|
58709
|
+
const path6 = directoryPath || ".";
|
|
58710
|
+
if (filters.every((filter) => filter(path6, true)))
|
|
58711
|
+
paths.push(path6);
|
|
58720
58712
|
};
|
|
58721
58713
|
var empty$2 = () => {};
|
|
58722
58714
|
function build$6(root, options) {
|
|
@@ -58773,29 +58765,29 @@ var empty = () => {};
|
|
|
58773
58765
|
function build$3(options) {
|
|
58774
58766
|
return options.group ? groupFiles : empty;
|
|
58775
58767
|
}
|
|
58776
|
-
var resolveSymlinksAsync = function(
|
|
58777
|
-
const { queue, fs:
|
|
58768
|
+
var resolveSymlinksAsync = function(path6, state, callback$1) {
|
|
58769
|
+
const { queue, fs: fs7, options: { suppressErrors } } = state;
|
|
58778
58770
|
queue.enqueue();
|
|
58779
|
-
|
|
58771
|
+
fs7.realpath(path6, (error43, resolvedPath) => {
|
|
58780
58772
|
if (error43)
|
|
58781
58773
|
return queue.dequeue(suppressErrors ? null : error43, state);
|
|
58782
|
-
|
|
58774
|
+
fs7.stat(resolvedPath, (error$1, stat) => {
|
|
58783
58775
|
if (error$1)
|
|
58784
58776
|
return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
58785
|
-
if (stat.isDirectory() && isRecursive(
|
|
58777
|
+
if (stat.isDirectory() && isRecursive(path6, resolvedPath, state))
|
|
58786
58778
|
return queue.dequeue(null, state);
|
|
58787
58779
|
callback$1(stat, resolvedPath);
|
|
58788
58780
|
queue.dequeue(null, state);
|
|
58789
58781
|
});
|
|
58790
58782
|
});
|
|
58791
58783
|
};
|
|
58792
|
-
var resolveSymlinks = function(
|
|
58793
|
-
const { queue, fs:
|
|
58784
|
+
var resolveSymlinks = function(path6, state, callback$1) {
|
|
58785
|
+
const { queue, fs: fs7, options: { suppressErrors } } = state;
|
|
58794
58786
|
queue.enqueue();
|
|
58795
58787
|
try {
|
|
58796
|
-
const resolvedPath =
|
|
58797
|
-
const stat =
|
|
58798
|
-
if (stat.isDirectory() && isRecursive(
|
|
58788
|
+
const resolvedPath = fs7.realpathSync(path6);
|
|
58789
|
+
const stat = fs7.statSync(resolvedPath);
|
|
58790
|
+
if (stat.isDirectory() && isRecursive(path6, resolvedPath, state))
|
|
58799
58791
|
return;
|
|
58800
58792
|
callback$1(stat, resolvedPath);
|
|
58801
58793
|
} catch (e) {
|
|
@@ -58808,10 +58800,10 @@ function build$2(options, isSynchronous) {
|
|
|
58808
58800
|
return null;
|
|
58809
58801
|
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
58810
58802
|
}
|
|
58811
|
-
function isRecursive(
|
|
58803
|
+
function isRecursive(path6, resolved, state) {
|
|
58812
58804
|
if (state.options.useRealPaths)
|
|
58813
58805
|
return isRecursiveUsingRealPaths(resolved, state);
|
|
58814
|
-
let parent =
|
|
58806
|
+
let parent = dirname3(path6);
|
|
58815
58807
|
let depth = 1;
|
|
58816
58808
|
while (parent !== state.root && depth < 2) {
|
|
58817
58809
|
const resolvedPath = state.symlinks.get(parent);
|
|
@@ -58819,9 +58811,9 @@ function isRecursive(path7, resolved, state) {
|
|
|
58819
58811
|
if (isSameRoot)
|
|
58820
58812
|
depth++;
|
|
58821
58813
|
else
|
|
58822
|
-
parent =
|
|
58814
|
+
parent = dirname3(parent);
|
|
58823
58815
|
}
|
|
58824
|
-
state.symlinks.set(
|
|
58816
|
+
state.symlinks.set(path6, resolved);
|
|
58825
58817
|
return depth > 1;
|
|
58826
58818
|
}
|
|
58827
58819
|
function isRecursiveUsingRealPaths(resolved, state) {
|
|
@@ -58877,23 +58869,23 @@ var walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
|
58877
58869
|
state.queue.enqueue();
|
|
58878
58870
|
if (currentDepth < 0)
|
|
58879
58871
|
return state.queue.dequeue(null, state);
|
|
58880
|
-
const { fs:
|
|
58872
|
+
const { fs: fs7 } = state;
|
|
58881
58873
|
state.visited.push(crawlPath);
|
|
58882
58874
|
state.counts.directories++;
|
|
58883
|
-
|
|
58875
|
+
fs7.readdir(crawlPath || ".", readdirOpts, (error43, entries = []) => {
|
|
58884
58876
|
callback$1(entries, directoryPath, currentDepth);
|
|
58885
58877
|
state.queue.dequeue(state.options.suppressErrors ? null : error43, state);
|
|
58886
58878
|
});
|
|
58887
58879
|
};
|
|
58888
58880
|
var walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
58889
|
-
const { fs:
|
|
58881
|
+
const { fs: fs7 } = state;
|
|
58890
58882
|
if (currentDepth < 0)
|
|
58891
58883
|
return;
|
|
58892
58884
|
state.visited.push(crawlPath);
|
|
58893
58885
|
state.counts.directories++;
|
|
58894
58886
|
let entries = [];
|
|
58895
58887
|
try {
|
|
58896
|
-
entries =
|
|
58888
|
+
entries = fs7.readdirSync(crawlPath || ".", readdirOpts);
|
|
58897
58889
|
} catch (e) {
|
|
58898
58890
|
if (!state.options.suppressErrors)
|
|
58899
58891
|
throw e;
|
|
@@ -58999,23 +58991,23 @@ var Walker = class {
|
|
|
58999
58991
|
const filename = this.joinPath(entry.name, directoryPath);
|
|
59000
58992
|
this.pushFile(filename, files, this.state.counts, filters);
|
|
59001
58993
|
} else if (entry.isDirectory()) {
|
|
59002
|
-
let
|
|
59003
|
-
if (exclude && exclude(entry.name,
|
|
58994
|
+
let path6 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
58995
|
+
if (exclude && exclude(entry.name, path6))
|
|
59004
58996
|
continue;
|
|
59005
|
-
this.pushDirectory(
|
|
59006
|
-
this.walkDirectory(this.state,
|
|
58997
|
+
this.pushDirectory(path6, paths, filters);
|
|
58998
|
+
this.walkDirectory(this.state, path6, path6, depth - 1, this.walk);
|
|
59007
58999
|
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
59008
|
-
let
|
|
59009
|
-
this.resolveSymlink(
|
|
59000
|
+
let path6 = joinPathWithBasePath(entry.name, directoryPath);
|
|
59001
|
+
this.resolveSymlink(path6, this.state, (stat, resolvedPath) => {
|
|
59010
59002
|
if (stat.isDirectory()) {
|
|
59011
59003
|
resolvedPath = normalizePath(resolvedPath, this.state.options);
|
|
59012
|
-
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath :
|
|
59004
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path6 + pathSeparator))
|
|
59013
59005
|
return;
|
|
59014
|
-
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath :
|
|
59006
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path6 + pathSeparator, depth - 1, this.walk);
|
|
59015
59007
|
} else {
|
|
59016
|
-
resolvedPath = useRealPaths ? resolvedPath :
|
|
59008
|
+
resolvedPath = useRealPaths ? resolvedPath : path6;
|
|
59017
59009
|
const filename = basename2(resolvedPath);
|
|
59018
|
-
const directoryPath$1 = normalizePath(
|
|
59010
|
+
const directoryPath$1 = normalizePath(dirname3(resolvedPath), this.state.options);
|
|
59019
59011
|
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
59020
59012
|
this.pushFile(resolvedPath, files, this.state.counts, filters);
|
|
59021
59013
|
}
|
|
@@ -59173,7 +59165,7 @@ var Builder = class {
|
|
|
59173
59165
|
isMatch = globFn(patterns, ...options);
|
|
59174
59166
|
this.globCache[patterns.join("\x00")] = isMatch;
|
|
59175
59167
|
}
|
|
59176
|
-
this.options.filters.push((
|
|
59168
|
+
this.options.filters.push((path6) => isMatch(path6));
|
|
59177
59169
|
return this;
|
|
59178
59170
|
}
|
|
59179
59171
|
};
|
|
@@ -59252,7 +59244,7 @@ function normalizePattern(pattern, expandDirectories, cwd2, props, isIgnore) {
|
|
|
59252
59244
|
if (!result.endsWith("*") && expandDirectories)
|
|
59253
59245
|
result += "/**";
|
|
59254
59246
|
const escapedCwd = escapePath(cwd2);
|
|
59255
|
-
if (
|
|
59247
|
+
if (path6.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")))
|
|
59256
59248
|
result = posix.relative(escapedCwd, result);
|
|
59257
59249
|
else
|
|
59258
59250
|
result = posix.normalize(result);
|
|
@@ -59289,7 +59281,7 @@ function normalizePattern(pattern, expandDirectories, cwd2, props, isIgnore) {
|
|
|
59289
59281
|
}
|
|
59290
59282
|
props.depthOffset = newCommonPath.length;
|
|
59291
59283
|
props.commonPath = newCommonPath;
|
|
59292
|
-
props.root = newCommonPath.length > 0 ?
|
|
59284
|
+
props.root = newCommonPath.length > 0 ? path6.posix.join(cwd2, ...newCommonPath) : cwd2;
|
|
59293
59285
|
}
|
|
59294
59286
|
return result;
|
|
59295
59287
|
}
|
|
@@ -59422,18 +59414,18 @@ function globSync(patternsOrOptions, options) {
|
|
|
59422
59414
|
...options,
|
|
59423
59415
|
patterns: patternsOrOptions
|
|
59424
59416
|
} : patternsOrOptions;
|
|
59425
|
-
const cwd2 = opts.cwd ?
|
|
59417
|
+
const cwd2 = opts.cwd ? path6.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
|
|
59426
59418
|
return crawl(opts, cwd2, true);
|
|
59427
59419
|
}
|
|
59428
59420
|
|
|
59429
59421
|
// src/utils/jsonl.ts
|
|
59430
59422
|
import { promisify } from "util";
|
|
59431
|
-
var readFile4 = promisify(
|
|
59432
|
-
var
|
|
59433
|
-
var statSync5 =
|
|
59423
|
+
var readFile4 = promisify(fs7.readFile);
|
|
59424
|
+
var readFileSync5 = fs7.readFileSync;
|
|
59425
|
+
var statSync5 = fs7.statSync;
|
|
59434
59426
|
async function getSessionDuration(transcriptPath) {
|
|
59435
59427
|
try {
|
|
59436
|
-
if (!
|
|
59428
|
+
if (!fs7.existsSync(transcriptPath)) {
|
|
59437
59429
|
return null;
|
|
59438
59430
|
}
|
|
59439
59431
|
const content = await readFile4(transcriptPath, "utf-8");
|
|
@@ -59485,7 +59477,7 @@ async function getSessionDuration(transcriptPath) {
|
|
|
59485
59477
|
}
|
|
59486
59478
|
async function getTokenMetrics(transcriptPath) {
|
|
59487
59479
|
try {
|
|
59488
|
-
if (!
|
|
59480
|
+
if (!fs7.existsSync(transcriptPath)) {
|
|
59489
59481
|
return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
|
|
59490
59482
|
}
|
|
59491
59483
|
const content = await readFile4(transcriptPath, "utf-8");
|
|
@@ -59538,7 +59530,7 @@ function getBlockMetrics() {
|
|
|
59538
59530
|
function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
|
|
59539
59531
|
const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
|
|
59540
59532
|
const now = new Date;
|
|
59541
|
-
const pattern =
|
|
59533
|
+
const pattern = path7.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
|
|
59542
59534
|
const files = globSync([pattern], {
|
|
59543
59535
|
absolute: true,
|
|
59544
59536
|
cwd: rootDir
|
|
@@ -59632,7 +59624,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
|
|
|
59632
59624
|
function getAllTimestampsFromFile(filePath) {
|
|
59633
59625
|
const timestamps = [];
|
|
59634
59626
|
try {
|
|
59635
|
-
const content =
|
|
59627
|
+
const content = readFileSync5(filePath, "utf-8");
|
|
59636
59628
|
const lines = content.trim().split(`
|
|
59637
59629
|
`).filter((line) => line.length > 0);
|
|
59638
59630
|
for (const line of lines) {
|