@yhong91/vibetime 0.1.75 → 0.1.76
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 -9
- package/package.json +1 -1
package/bin/vibetime.mjs
CHANGED
|
@@ -2047,7 +2047,7 @@ function claudeStyleFileMetrics(tool, input) {
|
|
|
2047
2047
|
}
|
|
2048
2048
|
|
|
2049
2049
|
// src/lib/constants.ts
|
|
2050
|
-
var PACKAGE_VERSION = true ? "0.1.
|
|
2050
|
+
var PACKAGE_VERSION = true ? "0.1.76" : "0.1.1";
|
|
2051
2051
|
var GENERATED_MARKER = "Generated by vibetime.";
|
|
2052
2052
|
var DEFAULT_API_URL = "http://121.196.224.82:3001";
|
|
2053
2053
|
var DEFAULT_BACKFILL_BATCH_SIZE = 50;
|
|
@@ -12039,7 +12039,7 @@ async function loadQoderDbModelCalls(appDirName, sessionId, modelMap) {
|
|
|
12039
12039
|
const modelInfo = parseJsonLine(stringField(row, "model_info") || "") || {};
|
|
12040
12040
|
const modelKey = stringField(modelInfo, "model_key");
|
|
12041
12041
|
const call = {
|
|
12042
|
-
model: modelKey
|
|
12042
|
+
model: mappedQoderModel(modelKey, modelMap) || preferredModel,
|
|
12043
12043
|
inputTokens: numberField(usage, "prompt_tokens") || 0,
|
|
12044
12044
|
outputTokens: numberField(usage, "completion_tokens") || 0,
|
|
12045
12045
|
cachedTokens: numberField(usage, "cached_tokens") || 0
|
|
@@ -12075,7 +12075,14 @@ function resolveRootSessionId(db, sessionId) {
|
|
|
12075
12075
|
}
|
|
12076
12076
|
return current === sessionId ? void 0 : current;
|
|
12077
12077
|
}
|
|
12078
|
+
function mappedQoderModel(raw, modelMap) {
|
|
12079
|
+
if (!raw) {
|
|
12080
|
+
return void 0;
|
|
12081
|
+
}
|
|
12082
|
+
return modelMap[raw] || raw;
|
|
12083
|
+
}
|
|
12078
12084
|
function resolveSessionPreferredModel(db, sessionId, modelMap) {
|
|
12085
|
+
const chain = [];
|
|
12079
12086
|
let current = sessionId;
|
|
12080
12087
|
for (let depth = 0; depth < 5 && current; depth++) {
|
|
12081
12088
|
let row;
|
|
@@ -12087,15 +12094,36 @@ function resolveSessionPreferredModel(db, sessionId, modelMap) {
|
|
|
12087
12094
|
return void 0;
|
|
12088
12095
|
}
|
|
12089
12096
|
if (!row) {
|
|
12090
|
-
|
|
12097
|
+
break;
|
|
12091
12098
|
}
|
|
12099
|
+
chain.push(current);
|
|
12092
12100
|
const info = parseJsonLine(stringField(row, "preferred_model_info") || "") || {};
|
|
12093
|
-
const preferred = stringField(info, "preferred_model");
|
|
12101
|
+
const preferred = mappedQoderModel(stringField(info, "preferred_model"), modelMap);
|
|
12094
12102
|
if (preferred) {
|
|
12095
|
-
return
|
|
12103
|
+
return preferred;
|
|
12096
12104
|
}
|
|
12097
12105
|
current = stringField(row, "parent_session_id");
|
|
12098
12106
|
}
|
|
12107
|
+
return resolveModelKeyFromAncestorMessages(db, chain, modelMap);
|
|
12108
|
+
}
|
|
12109
|
+
function resolveModelKeyFromAncestorMessages(db, sessionIds, modelMap) {
|
|
12110
|
+
for (const sid of sessionIds) {
|
|
12111
|
+
let rows;
|
|
12112
|
+
try {
|
|
12113
|
+
rows = db.prepare(
|
|
12114
|
+
`select model_info from chat_message where session_id = ? and role = 'assistant' and instr(model_info, 'model_key') > 0 order by gmt_create desc limit 20`
|
|
12115
|
+
).all(sid);
|
|
12116
|
+
} catch {
|
|
12117
|
+
continue;
|
|
12118
|
+
}
|
|
12119
|
+
for (const row of rows) {
|
|
12120
|
+
const info = parseJsonLine(stringField(row, "model_info") || "") || {};
|
|
12121
|
+
const mapped = mappedQoderModel(stringField(info, "model_key"), modelMap);
|
|
12122
|
+
if (mapped) {
|
|
12123
|
+
return mapped;
|
|
12124
|
+
}
|
|
12125
|
+
}
|
|
12126
|
+
}
|
|
12099
12127
|
return void 0;
|
|
12100
12128
|
}
|
|
12101
12129
|
|
|
@@ -12208,8 +12236,8 @@ async function loadQoderCnSegmentModelCalls(filePath, isSubagentSession, modelMa
|
|
|
12208
12236
|
}
|
|
12209
12237
|
if (type === "model.response.completed") {
|
|
12210
12238
|
const ts = stringField(raw, "ts") || "";
|
|
12211
|
-
const rawModel = stringField(data, "model")
|
|
12212
|
-
const modelName = modelMap[rawModel] || rawModel;
|
|
12239
|
+
const rawModel = stringField(data, "model");
|
|
12240
|
+
const modelName = rawModel ? modelMap[rawModel] || rawModel : void 0;
|
|
12213
12241
|
modelCalls.push({
|
|
12214
12242
|
ts,
|
|
12215
12243
|
isSubagent: currentTurnIsSubagent,
|
|
@@ -13094,8 +13122,8 @@ async function loadQoderSegmentModelCalls(filePath, isSubagentSession, modelMap)
|
|
|
13094
13122
|
}
|
|
13095
13123
|
if (type === "model.response.completed") {
|
|
13096
13124
|
const ts = stringField(raw, "ts") || "";
|
|
13097
|
-
const rawModel = stringField(data, "model")
|
|
13098
|
-
const modelName = modelMap[rawModel] || rawModel;
|
|
13125
|
+
const rawModel = stringField(data, "model");
|
|
13126
|
+
const modelName = rawModel ? modelMap[rawModel] || rawModel : void 0;
|
|
13099
13127
|
modelCalls.push({
|
|
13100
13128
|
ts,
|
|
13101
13129
|
isSubagent: currentTurnIsSubagent,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yhong91/vibetime",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.76",
|
|
5
5
|
"description": "vibetime CLI — install AI-agent hooks (Claude Code, Codex, OpenCode, Pi, Cursor) and report activity to vibetime.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|