@yhong91/vibetime 0.1.5 → 0.1.6

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.
Files changed (2) hide show
  1. package/bin/vibetime.mjs +46 -3
  2. package/package.json +1 -1
package/bin/vibetime.mjs CHANGED
@@ -1195,7 +1195,7 @@ function countTextLines(text) {
1195
1195
  }
1196
1196
 
1197
1197
  // src/lib/constants.ts
1198
- var PACKAGE_VERSION = true ? "0.1.5" : "0.1.1";
1198
+ var PACKAGE_VERSION = true ? "0.1.6" : "0.1.1";
1199
1199
  var DEFAULT_API_URL = "http://121.196.224.82:3001";
1200
1200
  var DEFAULT_BACKFILL_BATCH_SIZE = 50;
1201
1201
  var DEFAULT_BACKFILL_BATCH_BYTES = 800 * 1024;
@@ -6996,7 +6996,7 @@ function createWorkbuddyAdapter() {
6996
6996
 
6997
6997
  // src/adapters/zcode.ts
6998
6998
  import { execFile } from "node:child_process";
6999
- import { stat as stat8 } from "node:fs/promises";
6999
+ import { readFile as readFile11, stat as stat8 } from "node:fs/promises";
7000
7000
  import path15 from "node:path";
7001
7001
  import { promisify as promisify2 } from "node:util";
7002
7002
  init_fs();
@@ -7011,6 +7011,34 @@ function zcodeCliDir(home, env) {
7011
7011
  function zcodeDbPath(home, env) {
7012
7012
  return path15.join(zcodeCliDir(home, env), "db", "db.sqlite");
7013
7013
  }
7014
+ var providerNameCache = null;
7015
+ async function loadProviderNames(configPath2) {
7016
+ let fileMtime = 0;
7017
+ try {
7018
+ const info = await stat8(configPath2);
7019
+ fileMtime = info.mtimeMs;
7020
+ } catch {
7021
+ return /* @__PURE__ */ new Map();
7022
+ }
7023
+ if (providerNameCache && providerNameCache.path === configPath2 && providerNameCache.mtimeMs === fileMtime) {
7024
+ return providerNameCache.map;
7025
+ }
7026
+ const map = /* @__PURE__ */ new Map();
7027
+ try {
7028
+ const raw = await readFile11(configPath2, "utf-8");
7029
+ const config = JSON.parse(raw);
7030
+ const providers = config?.provider;
7031
+ if (isPlainObject(providers)) {
7032
+ for (const [id, entry] of Object.entries(providers)) {
7033
+ const name = stringField(entry, "name");
7034
+ if (name) map.set(id, name);
7035
+ }
7036
+ }
7037
+ } catch {
7038
+ }
7039
+ providerNameCache = { path: configPath2, mtimeMs: fileMtime, map };
7040
+ return map;
7041
+ }
7014
7042
  function sourceHash2(filePath) {
7015
7043
  return `sha256:${createStableHash(filePath)}`;
7016
7044
  }
@@ -7171,6 +7199,21 @@ async function parseZCodeDb(filePath, options) {
7171
7199
  if (rows.length === 0) {
7172
7200
  return [];
7173
7201
  }
7202
+ let candidate = path15.resolve(filePath);
7203
+ let configPath2 = "";
7204
+ for (let i = 0; i < 12; i++) {
7205
+ const probe = path15.join(candidate, ".zcode", "v2", "config.json");
7206
+ try {
7207
+ await stat8(probe);
7208
+ configPath2 = probe;
7209
+ break;
7210
+ } catch {
7211
+ const parent = path15.dirname(candidate);
7212
+ if (parent === candidate) break;
7213
+ candidate = parent;
7214
+ }
7215
+ }
7216
+ const nameMap = configPath2 ? await loadProviderNames(configPath2) : /* @__PURE__ */ new Map();
7174
7217
  const sessions = /* @__PURE__ */ new Map();
7175
7218
  for (const row of rows) {
7176
7219
  if (row.kind === "session") {
@@ -7298,7 +7341,7 @@ async function parseZCodeDb(filePath, options) {
7298
7341
  sessionId: ctx.sessionId,
7299
7342
  turnId: stringField(row, "turn_id") ? `zcode:${stringField(row, "turn_id")}` : void 0,
7300
7343
  agent: stringField(row, "agent") || "zcode",
7301
- provider: stringField(row, "provider_id"),
7344
+ provider: nameMap.get(stringField(row, "provider_id") || "") || stringField(row, "provider_id"),
7302
7345
  model: modelId,
7303
7346
  success: stringField(row, "status") === "completed",
7304
7347
  metrics: modelMetrics(row),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yhong91/vibetime",
3
3
  "type": "module",
4
- "version": "0.1.5",
4
+ "version": "0.1.6",
5
5
  "description": "vibetime CLI — install AI-agent hooks (Claude Code, Codex, OpenCode, Pi) and report activity to vibetime.",
6
6
  "license": "MIT",
7
7
  "publishConfig": {