devrage 0.6.5 → 0.6.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.
- package/dist/cli.js +22 -17
- package/dist/cli.js.map +2 -2
- package/dist/lib/adapters/codex.d.ts.map +1 -1
- package/dist/lib/adapters/codex.js +23 -17
- package/dist/lib/adapters/codex.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -575,32 +575,37 @@ import { readdir as readdir4, stat as stat3 } from "node:fs/promises";
|
|
|
575
575
|
import { createInterface as createInterface2 } from "node:readline";
|
|
576
576
|
import { homedir as homedir4 } from "node:os";
|
|
577
577
|
import { join as join4 } from "node:path";
|
|
578
|
-
var
|
|
578
|
+
var CODEX_HOME = join4(homedir4(), ".codex");
|
|
579
|
+
var CODEX_SESSION_DIRS = [join4(CODEX_HOME, "sessions"), join4(CODEX_HOME, "archived_sessions")];
|
|
579
580
|
function codexAdapter() {
|
|
580
581
|
return {
|
|
581
582
|
name: "codex",
|
|
582
583
|
async *messages(options) {
|
|
583
|
-
for
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
584
|
+
for (const dir of CODEX_SESSION_DIRS) {
|
|
585
|
+
for await (const file of discoverCodexSessionFiles(dir)) {
|
|
586
|
+
yield* parseCodexJsonl(file.filePath, {
|
|
587
|
+
session: file.session,
|
|
588
|
+
role: options?.role ?? "user",
|
|
589
|
+
since: options?.since
|
|
590
|
+
});
|
|
591
|
+
}
|
|
589
592
|
}
|
|
590
593
|
},
|
|
591
594
|
async *usage(options) {
|
|
592
595
|
const seenUsage = /* @__PURE__ */ new Set();
|
|
593
|
-
for
|
|
594
|
-
for await (const
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
596
|
+
for (const dir of CODEX_SESSION_DIRS) {
|
|
597
|
+
for await (const file of discoverCodexSessionFiles(dir)) {
|
|
598
|
+
for await (const record of parseCodexUsageJsonl(file.filePath, {
|
|
599
|
+
session: file.session,
|
|
600
|
+
since: options?.since
|
|
601
|
+
})) {
|
|
602
|
+
const key = codexUsageRecordKey(record);
|
|
603
|
+
if (seenUsage.has(key)) {
|
|
604
|
+
continue;
|
|
605
|
+
}
|
|
606
|
+
seenUsage.add(key);
|
|
607
|
+
yield record;
|
|
601
608
|
}
|
|
602
|
-
seenUsage.add(key);
|
|
603
|
-
yield record;
|
|
604
609
|
}
|
|
605
610
|
}
|
|
606
611
|
}
|