@yhong91/vibetime 0.1.55 → 0.1.56
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 +53 -7
- 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.56" : "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;
|
|
@@ -8154,6 +8154,29 @@ import { readdir as readdir7, readFile as readFile10, stat as stat8 } from "node
|
|
|
8154
8154
|
import os7 from "node:os";
|
|
8155
8155
|
import path16 from "node:path";
|
|
8156
8156
|
init_fs();
|
|
8157
|
+
function piHostSessionIdFromBasename(basename) {
|
|
8158
|
+
const withoutExt = basename.endsWith(".jsonl") ? basename.slice(0, -".jsonl".length) : basename;
|
|
8159
|
+
if (!withoutExt || withoutExt === "session") {
|
|
8160
|
+
return void 0;
|
|
8161
|
+
}
|
|
8162
|
+
const underscore = withoutExt.indexOf("_");
|
|
8163
|
+
if (underscore <= 0 || underscore === withoutExt.length - 1) {
|
|
8164
|
+
return withoutExt;
|
|
8165
|
+
}
|
|
8166
|
+
return withoutExt.slice(underscore + 1);
|
|
8167
|
+
}
|
|
8168
|
+
function resolvePiBackfillGroupId(filePath) {
|
|
8169
|
+
const normalized = filePath.replaceAll("\\", "/");
|
|
8170
|
+
const base = path16.basename(filePath);
|
|
8171
|
+
const nest = normalized.match(/([^/]+)\/[^/]+\/run-\d+\/session\.jsonl$/);
|
|
8172
|
+
if (nest) {
|
|
8173
|
+
return piHostSessionIdFromBasename(nest[1]);
|
|
8174
|
+
}
|
|
8175
|
+
if (base.endsWith(".jsonl") && base !== "session.jsonl") {
|
|
8176
|
+
return piHostSessionIdFromBasename(base);
|
|
8177
|
+
}
|
|
8178
|
+
return void 0;
|
|
8179
|
+
}
|
|
8157
8180
|
function parsePiSubagentLink(filePath, headerParentSession) {
|
|
8158
8181
|
if (headerParentSession) {
|
|
8159
8182
|
const parentFile = path16.isAbsolute(headerParentSession) ? headerParentSession : void 0;
|
|
@@ -8805,6 +8828,17 @@ function piSessionDir(home, env) {
|
|
|
8805
8828
|
function piWorkflowProjectsDir(home) {
|
|
8806
8829
|
return path16.join(home, ".pi", "workflows", "projects");
|
|
8807
8830
|
}
|
|
8831
|
+
async function workflowRunGroupId(filePath) {
|
|
8832
|
+
try {
|
|
8833
|
+
const raw = JSON.parse(await readFile10(filePath, "utf8"));
|
|
8834
|
+
if (!isPlainObject(raw)) {
|
|
8835
|
+
return void 0;
|
|
8836
|
+
}
|
|
8837
|
+
return stringField(raw, "sessionId");
|
|
8838
|
+
} catch {
|
|
8839
|
+
return void 0;
|
|
8840
|
+
}
|
|
8841
|
+
}
|
|
8808
8842
|
async function piBackfillFiles(sourceRoot, home = os7.homedir(), env) {
|
|
8809
8843
|
const lists = sourceRoot ? [await listFilesByExtensions(sourceRoot, [".jsonl", ".json"])] : await Promise.all([
|
|
8810
8844
|
listFilesByExtensions(piSessionDir(home, env), [".jsonl"]),
|
|
@@ -8813,7 +8847,15 @@ async function piBackfillFiles(sourceRoot, home = os7.homedir(), env) {
|
|
|
8813
8847
|
const files = lists.flat().sort();
|
|
8814
8848
|
return Promise.all(files.map(async (filePath) => {
|
|
8815
8849
|
const info = await stat8(filePath);
|
|
8816
|
-
|
|
8850
|
+
let groupId = resolvePiBackfillGroupId(filePath);
|
|
8851
|
+
if (!groupId && filePath.endsWith(".json")) {
|
|
8852
|
+
groupId = await workflowRunGroupId(filePath);
|
|
8853
|
+
}
|
|
8854
|
+
return {
|
|
8855
|
+
path: filePath,
|
|
8856
|
+
modifiedAt: info.mtime.toISOString(),
|
|
8857
|
+
...groupId ? { groupId } : {}
|
|
8858
|
+
};
|
|
8817
8859
|
}));
|
|
8818
8860
|
}
|
|
8819
8861
|
function createPiAdapter() {
|
|
@@ -9532,10 +9574,11 @@ async function parseQoderCnSessionFile(filePath, options) {
|
|
|
9532
9574
|
const { sessionId: parentSessionId, mainTranscriptPath } = parseQoderCnPaths(filePath);
|
|
9533
9575
|
if (parentSessionId && mainTranscriptPath) {
|
|
9534
9576
|
const parentSourcePathHash = `sha256:${createStableHash(mainTranscriptPath)}`;
|
|
9535
|
-
return validEvents.map((event) => {
|
|
9577
|
+
return withoutSubagentTurnEvents(validEvents).map((event) => {
|
|
9536
9578
|
const mapped = {
|
|
9537
9579
|
...event,
|
|
9538
9580
|
sessionId: parentSessionId,
|
|
9581
|
+
turnId: void 0,
|
|
9539
9582
|
refs: {
|
|
9540
9583
|
...event.refs,
|
|
9541
9584
|
sourcePathHash: parentSourcePathHash,
|
|
@@ -9550,9 +9593,10 @@ async function parseQoderCnSessionFile(filePath, options) {
|
|
|
9550
9593
|
if (dbModelCalls.rootSessionId) {
|
|
9551
9594
|
const parentPath = path18.join(path18.dirname(filePath), `${dbModelCalls.rootSessionId}.jsonl`);
|
|
9552
9595
|
const parentSourcePathHash = `sha256:${createStableHash(parentPath)}`;
|
|
9553
|
-
return validEvents.map((event) => rebuildEventIdentity3({
|
|
9596
|
+
return withoutSubagentTurnEvents(validEvents).map((event) => rebuildEventIdentity3({
|
|
9554
9597
|
...event,
|
|
9555
9598
|
sessionId: dbModelCalls.rootSessionId,
|
|
9599
|
+
turnId: void 0,
|
|
9556
9600
|
refs: {
|
|
9557
9601
|
...event.refs,
|
|
9558
9602
|
sourcePathHash: parentSourcePathHash,
|
|
@@ -10386,10 +10430,11 @@ async function parseQoderSessionFile(filePath, options) {
|
|
|
10386
10430
|
const { sessionId: parentSessionId, mainTranscriptPath } = parseQoderPaths(filePath);
|
|
10387
10431
|
if (parentSessionId && mainTranscriptPath) {
|
|
10388
10432
|
const parentSourcePathHash = `sha256:${createStableHash(mainTranscriptPath)}`;
|
|
10389
|
-
return validEvents.map((event) => {
|
|
10433
|
+
return withoutSubagentTurnEvents(validEvents).map((event) => {
|
|
10390
10434
|
const mapped = {
|
|
10391
10435
|
...event,
|
|
10392
10436
|
sessionId: parentSessionId,
|
|
10437
|
+
turnId: void 0,
|
|
10393
10438
|
refs: {
|
|
10394
10439
|
...event.refs,
|
|
10395
10440
|
sourcePathHash: parentSourcePathHash,
|
|
@@ -10404,9 +10449,10 @@ async function parseQoderSessionFile(filePath, options) {
|
|
|
10404
10449
|
if (dbModelCalls.rootSessionId) {
|
|
10405
10450
|
const parentPath = path19.join(path19.dirname(filePath), `${dbModelCalls.rootSessionId}.jsonl`);
|
|
10406
10451
|
const parentSourcePathHash = `sha256:${createStableHash(parentPath)}`;
|
|
10407
|
-
return validEvents.map((event) => rebuildEventIdentity4({
|
|
10452
|
+
return withoutSubagentTurnEvents(validEvents).map((event) => rebuildEventIdentity4({
|
|
10408
10453
|
...event,
|
|
10409
10454
|
sessionId: dbModelCalls.rootSessionId,
|
|
10455
|
+
turnId: void 0,
|
|
10410
10456
|
refs: {
|
|
10411
10457
|
...event.refs,
|
|
10412
10458
|
sourcePathHash: parentSourcePathHash,
|
|
@@ -13205,7 +13251,7 @@ async function deleteMachine(remote, id) {
|
|
|
13205
13251
|
}
|
|
13206
13252
|
|
|
13207
13253
|
// src/lib/types.ts
|
|
13208
|
-
var BACKFILL_STATE_SCHEMA_VERSION =
|
|
13254
|
+
var BACKFILL_STATE_SCHEMA_VERSION = 7;
|
|
13209
13255
|
|
|
13210
13256
|
// src/cli.ts
|
|
13211
13257
|
function createRegistry() {
|
package/package.json
CHANGED