@yhong91/vibetime 0.1.29 → 0.1.30

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 +63 -9
  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.29" : "0.1.1";
1931
+ var PACKAGE_VERSION = true ? "0.1.30" : "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;
@@ -7390,11 +7390,13 @@ function parseQoderCnPaths(filePath) {
7390
7390
  let sessionId = "";
7391
7391
  let projectName = "";
7392
7392
  let configDir2 = "";
7393
+ let mainTranscriptPath;
7393
7394
  if (subagentsIdx > 2) {
7394
7395
  sessionId = parts[subagentsIdx - 1];
7395
7396
  projectName = parts[subagentsIdx - 2];
7396
7397
  const projectsIdx = parts.lastIndexOf("projects");
7397
7398
  configDir2 = parts.slice(0, projectsIdx).join(path16.sep);
7399
+ mainTranscriptPath = [...parts.slice(0, subagentsIdx - 1), `${sessionId}.jsonl`].join(path16.sep);
7398
7400
  } else {
7399
7401
  const filename = parts.at(-1) || "";
7400
7402
  sessionId = path16.basename(filename, ".jsonl");
@@ -7402,7 +7404,24 @@ function parseQoderCnPaths(filePath) {
7402
7404
  const projectsIdx = parts.lastIndexOf("projects");
7403
7405
  configDir2 = parts.slice(0, projectsIdx).join(path16.sep);
7404
7406
  }
7405
- return { configDir: configDir2, projectName, sessionId };
7407
+ return { configDir: configDir2, projectName, sessionId, mainTranscriptPath };
7408
+ }
7409
+ function rebuildEventIdentity2(event) {
7410
+ const importKey = createImportKey([
7411
+ event.source,
7412
+ event.refs?.sourcePathHash,
7413
+ event.refs?.sourceLine,
7414
+ event.type,
7415
+ event.refs?.sourceId
7416
+ ]);
7417
+ return {
7418
+ ...event,
7419
+ id: createStableEventId(importKey),
7420
+ refs: {
7421
+ ...event.refs,
7422
+ importKey
7423
+ }
7424
+ };
7406
7425
  }
7407
7426
  async function loadQoderCnModelNames(configDir2) {
7408
7427
  try {
@@ -7752,9 +7771,17 @@ async function parseQoderCnSessionFile(filePath, options) {
7752
7771
  }
7753
7772
  const validEvents = state.events.filter((event) => validateCanonicalEvent(event).valid);
7754
7773
  if (isSubagentSession) {
7755
- const parentSessionId = parseQoderCnPaths(filePath).sessionId;
7756
- if (parentSessionId) {
7757
- return validEvents.map((event) => ({ ...event, sessionId: parentSessionId }));
7774
+ const { sessionId: parentSessionId, mainTranscriptPath } = parseQoderCnPaths(filePath);
7775
+ if (parentSessionId && mainTranscriptPath) {
7776
+ const parentSourcePathHash = `sha256:${createStableHash(mainTranscriptPath)}`;
7777
+ return validEvents.map((event) => {
7778
+ const mapped = {
7779
+ ...event,
7780
+ sessionId: parentSessionId,
7781
+ refs: { ...event.refs, sourcePathHash: parentSourcePathHash }
7782
+ };
7783
+ return rebuildEventIdentity2(mapped);
7784
+ });
7758
7785
  }
7759
7786
  }
7760
7787
  return validEvents;
@@ -8133,11 +8160,13 @@ function parseQoderPaths(filePath) {
8133
8160
  let sessionId = "";
8134
8161
  let projectName = "";
8135
8162
  let configDir2 = "";
8163
+ let mainTranscriptPath;
8136
8164
  if (subagentsIdx > 2) {
8137
8165
  sessionId = parts[subagentsIdx - 1];
8138
8166
  projectName = parts[subagentsIdx - 2];
8139
8167
  const projectsIdx = parts.lastIndexOf("projects");
8140
8168
  configDir2 = parts.slice(0, projectsIdx).join(path17.sep);
8169
+ mainTranscriptPath = [...parts.slice(0, subagentsIdx - 1), `${sessionId}.jsonl`].join(path17.sep);
8141
8170
  } else {
8142
8171
  const filename = parts.at(-1) || "";
8143
8172
  sessionId = path17.basename(filename, ".jsonl");
@@ -8145,7 +8174,24 @@ function parseQoderPaths(filePath) {
8145
8174
  const projectsIdx = parts.lastIndexOf("projects");
8146
8175
  configDir2 = parts.slice(0, projectsIdx).join(path17.sep);
8147
8176
  }
8148
- return { configDir: configDir2, projectName, sessionId };
8177
+ return { configDir: configDir2, projectName, sessionId, mainTranscriptPath };
8178
+ }
8179
+ function rebuildEventIdentity3(event) {
8180
+ const importKey = createImportKey([
8181
+ event.source,
8182
+ event.refs?.sourcePathHash,
8183
+ event.refs?.sourceLine,
8184
+ event.type,
8185
+ event.refs?.sourceId
8186
+ ]);
8187
+ return {
8188
+ ...event,
8189
+ id: createStableEventId(importKey),
8190
+ refs: {
8191
+ ...event.refs,
8192
+ importKey
8193
+ }
8194
+ };
8149
8195
  }
8150
8196
  async function loadQoderModelNames(configDir2) {
8151
8197
  try {
@@ -8495,9 +8541,17 @@ async function parseQoderSessionFile(filePath, options) {
8495
8541
  }
8496
8542
  const validEvents = state.events.filter((event) => validateCanonicalEvent(event).valid);
8497
8543
  if (isSubagentSession) {
8498
- const parentSessionId = parseQoderPaths(filePath).sessionId;
8499
- if (parentSessionId) {
8500
- return validEvents.map((event) => ({ ...event, sessionId: parentSessionId }));
8544
+ const { sessionId: parentSessionId, mainTranscriptPath } = parseQoderPaths(filePath);
8545
+ if (parentSessionId && mainTranscriptPath) {
8546
+ const parentSourcePathHash = `sha256:${createStableHash(mainTranscriptPath)}`;
8547
+ return validEvents.map((event) => {
8548
+ const mapped = {
8549
+ ...event,
8550
+ sessionId: parentSessionId,
8551
+ refs: { ...event.refs, sourcePathHash: parentSourcePathHash }
8552
+ };
8553
+ return rebuildEventIdentity3(mapped);
8554
+ });
8501
8555
  }
8502
8556
  }
8503
8557
  return validEvents;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yhong91/vibetime",
3
3
  "type": "module",
4
- "version": "0.1.29",
4
+ "version": "0.1.30",
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": {