@yhong91/vibetime 0.1.38 → 0.1.39
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/bin/vibetime.mjs +40 -2
- package/package.json +1 -1
package/bin/vibetime.mjs
CHANGED
|
@@ -1928,7 +1928,7 @@ function countTextLines(text) {
|
|
|
1928
1928
|
}
|
|
1929
1929
|
|
|
1930
1930
|
// src/lib/constants.ts
|
|
1931
|
-
var PACKAGE_VERSION = true ? "0.1.
|
|
1931
|
+
var PACKAGE_VERSION = true ? "0.1.39" : "0.1.1";
|
|
1932
1932
|
var DEFAULT_API_URL = "http://121.196.224.82:3001";
|
|
1933
1933
|
var DEFAULT_BACKFILL_BATCH_SIZE = 50;
|
|
1934
1934
|
var DEFAULT_BACKFILL_BATCH_BYTES = 800 * 1024;
|
|
@@ -4209,7 +4209,7 @@ async function parseCodebuddyTraceFile(filePath, options) {
|
|
|
4209
4209
|
return [];
|
|
4210
4210
|
}
|
|
4211
4211
|
const sessionMeta = await readCodebuddySessionMeta(trace.workerPid, trace.sessionId, options);
|
|
4212
|
-
const sessionId = trace.sessionId || sessionMeta.sessionId || sessionIdFromTracePath(filePath);
|
|
4212
|
+
const sessionId = trace.sessionId || sessionMeta.sessionId || await resolveSessionIdFromSiblingTraces(filePath) || sessionIdFromTracePath(filePath);
|
|
4213
4213
|
let cwd = sessionMeta.cwd;
|
|
4214
4214
|
if (!cwd && trace.startedAt) {
|
|
4215
4215
|
cwd = await cwdFromHistoryFile(trace.startedAt, options);
|
|
@@ -4586,6 +4586,7 @@ function extractUsageFromGenerationSpan(span) {
|
|
|
4586
4586
|
return {
|
|
4587
4587
|
tokensInput: inputTokens || void 0,
|
|
4588
4588
|
tokensCachedInput: cachedTokens || void 0,
|
|
4589
|
+
tokensCacheReadInput: cachedTokens || void 0,
|
|
4589
4590
|
tokensOutput: outputTokens || void 0,
|
|
4590
4591
|
tokensTotal: totalTokens || void 0,
|
|
4591
4592
|
modelCalls: 1
|
|
@@ -4604,6 +4605,7 @@ function modelUsageFromTrace(trace, generationIndex, totalGenerations) {
|
|
|
4604
4605
|
return {
|
|
4605
4606
|
tokensInput: inputTokens || void 0,
|
|
4606
4607
|
tokensCachedInput: cachedTokens || void 0,
|
|
4608
|
+
tokensCacheReadInput: cachedTokens || void 0,
|
|
4607
4609
|
tokensOutput: outputTokens || void 0,
|
|
4608
4610
|
tokensTotal: totalTokens || void 0,
|
|
4609
4611
|
modelCalls: totalGenerations || 1
|
|
@@ -4615,6 +4617,42 @@ function sessionIdFromTracePath(filePath) {
|
|
|
4615
4617
|
const match = path9.basename(filePath).match(/trace_([0-9a-f]{32})/);
|
|
4616
4618
|
return match?.[1] ? `codebuddy_${match[1]}` : `codebuddy_${createStableHash(filePath).slice(0, 24)}`;
|
|
4617
4619
|
}
|
|
4620
|
+
var siblingSessionIdByDir = /* @__PURE__ */ new Map();
|
|
4621
|
+
async function resolveSessionIdFromSiblingTraces(filePath) {
|
|
4622
|
+
const dir = path9.dirname(filePath);
|
|
4623
|
+
let cached = siblingSessionIdByDir.get(dir);
|
|
4624
|
+
if (!cached) {
|
|
4625
|
+
cached = (async () => {
|
|
4626
|
+
try {
|
|
4627
|
+
const entries = await readdir4(dir);
|
|
4628
|
+
for (const entry of entries) {
|
|
4629
|
+
if (!entry.startsWith("trace_") || !entry.endsWith(".json")) {
|
|
4630
|
+
continue;
|
|
4631
|
+
}
|
|
4632
|
+
const siblingPath = path9.join(dir, entry);
|
|
4633
|
+
if (siblingPath === filePath) {
|
|
4634
|
+
continue;
|
|
4635
|
+
}
|
|
4636
|
+
try {
|
|
4637
|
+
const text = await readFile5(siblingPath, "utf8");
|
|
4638
|
+
const data = JSON.parse(text);
|
|
4639
|
+
if (isPlainObject(data) && isPlainObject(data.trace)) {
|
|
4640
|
+
const sid = stringField(data.trace, "sessionId");
|
|
4641
|
+
if (sid) {
|
|
4642
|
+
return sid;
|
|
4643
|
+
}
|
|
4644
|
+
}
|
|
4645
|
+
} catch {
|
|
4646
|
+
}
|
|
4647
|
+
}
|
|
4648
|
+
} catch {
|
|
4649
|
+
}
|
|
4650
|
+
return void 0;
|
|
4651
|
+
})();
|
|
4652
|
+
siblingSessionIdByDir.set(dir, cached);
|
|
4653
|
+
}
|
|
4654
|
+
return cached;
|
|
4655
|
+
}
|
|
4618
4656
|
function resolveHome(options) {
|
|
4619
4657
|
return options.home ? path9.resolve(String(options.home)) : process.env.HOME || __require("node:os").homedir();
|
|
4620
4658
|
}
|
package/package.json
CHANGED