@yhong91/vibetime 0.1.20 → 0.1.21
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 +37 -29
- package/package.json +1 -1
package/bin/vibetime.mjs
CHANGED
|
@@ -1202,7 +1202,7 @@ function countTextLines(text) {
|
|
|
1202
1202
|
}
|
|
1203
1203
|
|
|
1204
1204
|
// src/lib/constants.ts
|
|
1205
|
-
var PACKAGE_VERSION = true ? "0.1.
|
|
1205
|
+
var PACKAGE_VERSION = true ? "0.1.21" : "0.1.1";
|
|
1206
1206
|
var DEFAULT_API_URL = "http://121.196.224.82:3001";
|
|
1207
1207
|
var DEFAULT_BACKFILL_BATCH_SIZE = 50;
|
|
1208
1208
|
var DEFAULT_BACKFILL_BATCH_BYTES = 800 * 1024;
|
|
@@ -4711,6 +4711,8 @@ async function parseCopilotSessionFile(filePath, options) {
|
|
|
4711
4711
|
let reasoningEffort;
|
|
4712
4712
|
const pendingTools = /* @__PURE__ */ new Map();
|
|
4713
4713
|
const turnTokenAccum = /* @__PURE__ */ new Map();
|
|
4714
|
+
const pendingTurnUsage = [];
|
|
4715
|
+
let emittedShutdownUsage = false;
|
|
4714
4716
|
for (const [index, line] of lines.entries()) {
|
|
4715
4717
|
const lineNumber = index + 1;
|
|
4716
4718
|
const raw = parseJsonLine(line);
|
|
@@ -4875,7 +4877,7 @@ async function parseCopilotSessionFile(filePath, options) {
|
|
|
4875
4877
|
const accum = turnId ? turnTokenAccum.get(turnId) : void 0;
|
|
4876
4878
|
if (accum && accum.tokensOutput && accum.tokensOutput > 0) {
|
|
4877
4879
|
accum.reasoningEffort = reasoningEffort;
|
|
4878
|
-
|
|
4880
|
+
pendingTurnUsage.push(baseCopilotEvent({
|
|
4879
4881
|
ts,
|
|
4880
4882
|
type: "model.usage",
|
|
4881
4883
|
sessionId,
|
|
@@ -4939,6 +4941,7 @@ async function parseCopilotSessionFile(filePath, options) {
|
|
|
4939
4941
|
modelCalls: requestCount || void 0
|
|
4940
4942
|
}
|
|
4941
4943
|
}));
|
|
4944
|
+
emittedShutdownUsage = true;
|
|
4942
4945
|
}
|
|
4943
4946
|
events.push(baseCopilotEvent({
|
|
4944
4947
|
ts,
|
|
@@ -4953,6 +4956,9 @@ async function parseCopilotSessionFile(filePath, options) {
|
|
|
4953
4956
|
}
|
|
4954
4957
|
}
|
|
4955
4958
|
}
|
|
4959
|
+
if (!emittedShutdownUsage) {
|
|
4960
|
+
events.push(...pendingTurnUsage);
|
|
4961
|
+
}
|
|
4956
4962
|
return events.filter((event) => validateCanonicalEvent(event).valid);
|
|
4957
4963
|
}
|
|
4958
4964
|
function baseCopilotEvent(event) {
|
|
@@ -5179,33 +5185,7 @@ async function parseOpenCodeSessionFile(dbPath, options) {
|
|
|
5179
5185
|
const createdTs = timeCreated;
|
|
5180
5186
|
const tokens = opencodeUsageFromInfo(info);
|
|
5181
5187
|
const cost = typeof info.cost === "number" && info.cost > 0 ? info.cost : void 0;
|
|
5182
|
-
|
|
5183
|
-
const metrics = {
|
|
5184
|
-
tokensInput: tokens.tokensInput,
|
|
5185
|
-
tokensOutput: tokens.tokensOutput,
|
|
5186
|
-
tokensReasoningOutput: tokens.tokensReasoningOutput,
|
|
5187
|
-
tokensCachedInput: tokens.tokensCachedInput,
|
|
5188
|
-
tokensCacheReadInput: tokens.tokensCacheReadInput,
|
|
5189
|
-
tokensCacheCreationInput: tokens.tokensCacheCreationInput,
|
|
5190
|
-
tokensTotal: tokens.tokensTotal,
|
|
5191
|
-
reasoningEffort
|
|
5192
|
-
};
|
|
5193
|
-
if (cost !== void 0) {
|
|
5194
|
-
metrics.costUsd = cost;
|
|
5195
|
-
}
|
|
5196
|
-
events.push(baseOpenCodeEvent({
|
|
5197
|
-
ts: msToIso(completedTs || createdTs),
|
|
5198
|
-
type: "model.usage",
|
|
5199
|
-
sessionId,
|
|
5200
|
-
turnId: currentTurnId,
|
|
5201
|
-
cwd: assistantCwd,
|
|
5202
|
-
project: assistantProject,
|
|
5203
|
-
model,
|
|
5204
|
-
provider,
|
|
5205
|
-
operation: "model usage",
|
|
5206
|
-
metrics
|
|
5207
|
-
}, assistantAgent));
|
|
5208
|
-
}
|
|
5188
|
+
let emittedStepUsage = false;
|
|
5209
5189
|
try {
|
|
5210
5190
|
const parts = db.prepare(
|
|
5211
5191
|
"SELECT data FROM part WHERE message_id = ? ORDER BY id"
|
|
@@ -5306,6 +5286,7 @@ async function parseOpenCodeSessionFile(dbPath, options) {
|
|
|
5306
5286
|
const stepTokens = opencodeUsageFromInfo(pd);
|
|
5307
5287
|
const stepCost = typeof pd.cost === "number" && pd.cost > 0 ? pd.cost : void 0;
|
|
5308
5288
|
if (stepTokens) {
|
|
5289
|
+
emittedStepUsage = true;
|
|
5309
5290
|
const stepMetrics = {
|
|
5310
5291
|
tokensInput: stepTokens.tokensInput,
|
|
5311
5292
|
tokensOutput: stepTokens.tokensOutput,
|
|
@@ -5350,6 +5331,33 @@ async function parseOpenCodeSessionFile(dbPath, options) {
|
|
|
5350
5331
|
}
|
|
5351
5332
|
} catch {
|
|
5352
5333
|
}
|
|
5334
|
+
if (!emittedStepUsage && tokens) {
|
|
5335
|
+
const metrics = {
|
|
5336
|
+
tokensInput: tokens.tokensInput,
|
|
5337
|
+
tokensOutput: tokens.tokensOutput,
|
|
5338
|
+
tokensReasoningOutput: tokens.tokensReasoningOutput,
|
|
5339
|
+
tokensCachedInput: tokens.tokensCachedInput,
|
|
5340
|
+
tokensCacheReadInput: tokens.tokensCacheReadInput,
|
|
5341
|
+
tokensCacheCreationInput: tokens.tokensCacheCreationInput,
|
|
5342
|
+
tokensTotal: tokens.tokensTotal,
|
|
5343
|
+
reasoningEffort
|
|
5344
|
+
};
|
|
5345
|
+
if (cost !== void 0) {
|
|
5346
|
+
metrics.costUsd = cost;
|
|
5347
|
+
}
|
|
5348
|
+
events.push(baseOpenCodeEvent({
|
|
5349
|
+
ts: msToIso(completedTs || createdTs),
|
|
5350
|
+
type: "model.usage",
|
|
5351
|
+
sessionId,
|
|
5352
|
+
turnId: currentTurnId,
|
|
5353
|
+
cwd: assistantCwd,
|
|
5354
|
+
project: assistantProject,
|
|
5355
|
+
model,
|
|
5356
|
+
provider,
|
|
5357
|
+
operation: "model usage",
|
|
5358
|
+
metrics
|
|
5359
|
+
}, assistantAgent));
|
|
5360
|
+
}
|
|
5353
5361
|
if (stringField(info, "finish")) {
|
|
5354
5362
|
const durationMs = completedTs && createdTs ? completedTs - createdTs : void 0;
|
|
5355
5363
|
events.push(baseOpenCodeEvent({
|
package/package.json
CHANGED