@yhong91/vibetime 0.1.35 → 0.1.37

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 +36 -32
  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.35" : "0.1.1";
1931
+ var PACKAGE_VERSION = true ? "0.1.37" : "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;
@@ -4208,8 +4208,9 @@ async function parseCodebuddyTraceFile(filePath, options) {
4208
4208
  if (isTrivial) {
4209
4209
  return [];
4210
4210
  }
4211
- const sessionId = trace.sessionId || sessionIdFromTracePath(filePath);
4212
- let cwd = await cwdFromSessionFile(trace.workerPid, trace.sessionId, options);
4211
+ const sessionMeta = await readCodebuddySessionMeta(trace.workerPid, trace.sessionId, options);
4212
+ const sessionId = trace.sessionId || sessionMeta.sessionId || sessionIdFromTracePath(filePath);
4213
+ let cwd = sessionMeta.cwd;
4213
4214
  if (!cwd && trace.startedAt) {
4214
4215
  cwd = await cwdFromHistoryFile(trace.startedAt, options);
4215
4216
  }
@@ -4248,7 +4249,7 @@ async function parseCodebuddyTraceFile(filePath, options) {
4248
4249
  confidence: "partial"
4249
4250
  }), 0, "trace");
4250
4251
  }
4251
- if (trace.prompt && traceStartedAt) {
4252
+ if (traceStartedAt) {
4252
4253
  const turnId = `turn_${createStableHash([sessionId, trace.traceId]).slice(0, 24)}`;
4253
4254
  push(baseEvent({
4254
4255
  ts: traceStartedAt,
@@ -4260,23 +4261,25 @@ async function parseCodebuddyTraceFile(filePath, options) {
4260
4261
  model,
4261
4262
  confidence: "partial"
4262
4263
  }), 0, "trace");
4263
- push(baseEvent({
4264
- ts: traceStartedAt,
4265
- type: "prompt.submitted",
4266
- sessionId,
4267
- turnId,
4268
- cwd,
4269
- project,
4270
- model,
4271
- confidence: "partial",
4272
- metrics: {
4273
- prompts: 1,
4274
- promptChars: trace.prompt.length
4275
- },
4276
- refs: stringRefs({
4277
- promptHash: trace.prompt ? `sha256:${createStableHash(trace.prompt)}` : void 0
4278
- })
4279
- }), 0, "trace");
4264
+ if (trace.prompt) {
4265
+ push(baseEvent({
4266
+ ts: traceStartedAt,
4267
+ type: "prompt.submitted",
4268
+ sessionId,
4269
+ turnId,
4270
+ cwd,
4271
+ project,
4272
+ model,
4273
+ confidence: "partial",
4274
+ metrics: {
4275
+ prompts: 1,
4276
+ promptChars: trace.prompt.length
4277
+ },
4278
+ refs: stringRefs({
4279
+ promptHash: `sha256:${createStableHash(trace.prompt)}`
4280
+ })
4281
+ }), 0, "trace");
4282
+ }
4280
4283
  if (traceEndedAt) {
4281
4284
  push(baseEvent({
4282
4285
  ts: traceEndedAt,
@@ -4625,20 +4628,21 @@ async function readCwdFromSession(sessionPath, matchSessionId) {
4625
4628
  if (matchSessionId && session.sessionId !== matchSessionId) {
4626
4629
  return void 0;
4627
4630
  }
4628
- if (typeof session.cwd === "string") {
4629
- return session.cwd;
4630
- }
4631
+ return {
4632
+ cwd: typeof session.cwd === "string" ? session.cwd : void 0,
4633
+ sessionId: typeof session.sessionId === "string" ? session.sessionId : void 0
4634
+ };
4631
4635
  } catch {
4632
4636
  }
4633
4637
  return void 0;
4634
4638
  }
4635
- async function cwdFromSessionFile(pid, traceSessionId, options) {
4639
+ async function readCodebuddySessionMeta(pid, traceSessionId, options) {
4636
4640
  const home = resolveHome(options);
4637
4641
  const sessionsDir = path9.join(home, ".codebuddy", "sessions");
4638
4642
  if (pid) {
4639
- const cwd = await readCwdFromSession(path9.join(sessionsDir, `${pid}.json`));
4640
- if (cwd) {
4641
- return cwd;
4643
+ const meta = await readCwdFromSession(path9.join(sessionsDir, `${pid}.json`));
4644
+ if (meta) {
4645
+ return meta;
4642
4646
  }
4643
4647
  }
4644
4648
  if (traceSessionId) {
@@ -4648,18 +4652,18 @@ async function cwdFromSessionFile(pid, traceSessionId, options) {
4648
4652
  if (!f.endsWith(".json")) {
4649
4653
  continue;
4650
4654
  }
4651
- const cwd = await readCwdFromSession(
4655
+ const meta = await readCwdFromSession(
4652
4656
  path9.join(sessionsDir, f),
4653
4657
  traceSessionId
4654
4658
  );
4655
- if (cwd) {
4656
- return cwd;
4659
+ if (meta) {
4660
+ return meta;
4657
4661
  }
4658
4662
  }
4659
4663
  } catch {
4660
4664
  }
4661
4665
  }
4662
- return void 0;
4666
+ return {};
4663
4667
  }
4664
4668
  async function cwdFromHistoryFile(traceStartedAt, options) {
4665
4669
  const home = resolveHome(options);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yhong91/vibetime",
3
3
  "type": "module",
4
- "version": "0.1.35",
4
+ "version": "0.1.37",
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": {