failproofai 1.0.2-beta.4 → 1.0.2-beta.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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +5 -5
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +13 -13
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js +4 -4
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +13 -13
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js +2 -2
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +4 -4
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__03r-lqq._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__12021ot._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1le9jqc._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0clqfab._.js → [root-of-the-server]__1tg4pu6._.js} +2 -2
- package/.next/standalone/.next/server/chunks/_0lxbzdq._.js +1 -1
- package/.next/standalone/.next/server/chunks/{_1lbh81u._.js → _19uwam-._.js} +1 -1
- package/.next/standalone/.next/server/chunks/_1ek68ln._.js +7 -7
- package/.next/standalone/.next/server/chunks/_1zuiiy3._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_hooks_fp-home_ts_09kv0bn._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1m84s36._.js → [root-of-the-server]__00-s7h8._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013jr2b._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01wy8d-._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02npjtd._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__07gm3zl._.js +6 -6
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da85px._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ftmoxc._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oa1lav._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p-5p8u._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s740oi._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__14muoc4._.js → [root-of-the-server]__128se8m._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0jzbk4_._.js → [root-of-the-server]__190won8._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ctpynv._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1p2otjt._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0rsd3ll._.js → [root-of-the-server]__1sc84bb._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0ovx4lz._.js → _0no96tu._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_1dkh76z._.js → _11fc-hb._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_1ddpc5g._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_1db3-8n._.js → _1if9ixi._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/lib_1cf5ya2._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_opencode-projects_ts_15bjxkm._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +19 -19
- package/.next/standalone/.next/static/chunks/{0lshnlpy1m6bc.js → 0931avh-06lj5.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0k_yvjc1yz0pq.js → 0h-3zffoy-_ji.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0ds64uculrze8.js → 0p84npzxdgpc5.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0d_re32wscs0b.js → 0sdgnflvw8kta.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2dbi_x0c8n8fi.js → 0z7au3njlak0j.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1o0ahew9568ls.js → 1id7o44jjegf0.js} +1 -1
- package/.next/standalone/.next/static/chunks/{00_t-xvc59tkb.js → 276n-edifojbd.js} +2 -2
- package/.next/standalone/.next/static/chunks/{07j2u70_3qsx8.js → 2jfskwd2u8o5r.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2817_8e94ah9z.js → 2pxr7nr1nyotn.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1oz0svxwt9574.js → 3i8rg2fv9nd6e.js} +2 -2
- package/.next/standalone/.next/static/chunks/{1q76jk_1_wgjq.js → 3vu_7_eor1m-k.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-17utl_jw0wj11.js → turbopack-2x-o099q64i8h.js} +1 -1
- package/.next/standalone/lib/opencode-db.ts +77 -0
- package/.next/standalone/lib/opencode-projects.ts +37 -41
- package/.next/standalone/lib/opencode-sessions.ts +59 -36
- package/.next/standalone/package.json +9 -9
- package/.next/standalone/server.js +1 -1
- package/bin/failproofai.mjs +116 -34
- package/dist/cli.mjs +1732 -1177
- package/dist/worker.mjs +180 -165
- package/lib/opencode-db.ts +77 -0
- package/lib/opencode-projects.ts +37 -41
- package/lib/opencode-sessions.ts +59 -36
- package/package.json +9 -9
- package/src/audit/cache.ts +167 -11
- package/src/audit/cli-adapters/claude.ts +111 -1
- package/src/audit/cli-adapters/index.ts +31 -1
- package/src/audit/cli.ts +12 -0
- package/src/audit/index.ts +164 -13
- package/src/hooks/configure-wizard.ts +112 -18
- package/src/hooks/fp-reset.ts +1 -1
- package/src/hooks/handler.ts +13 -1
- package/src/hooks/manager.ts +69 -4
- package/src/hooks/onboarding-attempt.ts +4 -4
- package/src/hooks/pack-cli.ts +399 -32
- package/src/hooks/pack-store.ts +21 -8
- package/src/hooks/read-stdin.ts +78 -8
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1l-khtb._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1mhmdzs._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1qxztj-._.js +0 -3
- /package/.next/standalone/.next/static/{0iNzkTsP6rh14Rj5WL17o → mAYN9BOxWVFREnVp3yCHp}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{0iNzkTsP6rh14Rj5WL17o → mAYN9BOxWVFREnVp3yCHp}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{0iNzkTsP6rh14Rj5WL17o → mAYN9BOxWVFREnVp3yCHp}/_ssgManifest.js +0 -0
package/dist/worker.mjs
CHANGED
|
@@ -2559,7 +2559,7 @@ var init_builtin_policies = __esm(() => {
|
|
|
2559
2559
|
});
|
|
2560
2560
|
|
|
2561
2561
|
// package.json
|
|
2562
|
-
var version = "1.0.2-beta.
|
|
2562
|
+
var version = "1.0.2-beta.6";
|
|
2563
2563
|
var init_package = () => {};
|
|
2564
2564
|
|
|
2565
2565
|
// src/posthog-key.ts
|
|
@@ -4926,6 +4926,95 @@ var init_cursor_projects = __esm(() => {
|
|
|
4926
4926
|
getCachedCursorSessionsByEncodedName = runtimeCache((name) => getCursorSessionsByEncodedName(name), 30, { maxSize: 50 });
|
|
4927
4927
|
});
|
|
4928
4928
|
|
|
4929
|
+
// lib/sqlite-reader.ts
|
|
4930
|
+
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "node:fs";
|
|
4931
|
+
import initSqlJs from "sql.js/dist/sql-asm.js";
|
|
4932
|
+
async function tryNodeSqlite(dbPath) {
|
|
4933
|
+
try {
|
|
4934
|
+
const mod = await import("node:sqlite");
|
|
4935
|
+
const db = new mod.DatabaseSync(dbPath, { readOnly: true });
|
|
4936
|
+
return {
|
|
4937
|
+
query(sql, params = []) {
|
|
4938
|
+
const stmt = db.prepare(sql);
|
|
4939
|
+
return params.length ? stmt.all(...params) : stmt.all();
|
|
4940
|
+
},
|
|
4941
|
+
close() {
|
|
4942
|
+
db.close();
|
|
4943
|
+
}
|
|
4944
|
+
};
|
|
4945
|
+
} catch {
|
|
4946
|
+
return null;
|
|
4947
|
+
}
|
|
4948
|
+
}
|
|
4949
|
+
function loadSqlJs() {
|
|
4950
|
+
if (!sqlPromise)
|
|
4951
|
+
sqlPromise = initSqlJs();
|
|
4952
|
+
return sqlPromise;
|
|
4953
|
+
}
|
|
4954
|
+
async function trySqlJs(dbPath) {
|
|
4955
|
+
try {
|
|
4956
|
+
const SQL = await loadSqlJs();
|
|
4957
|
+
const db = new SQL.Database(readFileSync4(dbPath));
|
|
4958
|
+
return {
|
|
4959
|
+
query(sql, params) {
|
|
4960
|
+
const stmt = db.prepare(sql);
|
|
4961
|
+
try {
|
|
4962
|
+
if (params && params.length)
|
|
4963
|
+
stmt.bind(params);
|
|
4964
|
+
const rows = [];
|
|
4965
|
+
while (stmt.step())
|
|
4966
|
+
rows.push(stmt.getAsObject());
|
|
4967
|
+
return rows;
|
|
4968
|
+
} finally {
|
|
4969
|
+
stmt.free();
|
|
4970
|
+
}
|
|
4971
|
+
},
|
|
4972
|
+
close() {
|
|
4973
|
+
db.close();
|
|
4974
|
+
}
|
|
4975
|
+
};
|
|
4976
|
+
} catch {
|
|
4977
|
+
return null;
|
|
4978
|
+
}
|
|
4979
|
+
}
|
|
4980
|
+
async function openSqliteReadonly(dbPath) {
|
|
4981
|
+
if (!existsSync6(dbPath))
|
|
4982
|
+
return null;
|
|
4983
|
+
return await tryNodeSqlite(dbPath) ?? await trySqlJs(dbPath);
|
|
4984
|
+
}
|
|
4985
|
+
var sqlPromise = null;
|
|
4986
|
+
var init_sqlite_reader = () => {};
|
|
4987
|
+
|
|
4988
|
+
// lib/opencode-db.ts
|
|
4989
|
+
import { homedir as homedir8 } from "node:os";
|
|
4990
|
+
import { join as join9 } from "node:path";
|
|
4991
|
+
function opencodeDbPath() {
|
|
4992
|
+
if (process.env.OPENCODE_DB_PATH)
|
|
4993
|
+
return process.env.OPENCODE_DB_PATH;
|
|
4994
|
+
const home = process.env.OPENCODE_HOME ?? join9(homedir8(), ".local", "share", "opencode");
|
|
4995
|
+
return join9(home, "opencode.db");
|
|
4996
|
+
}
|
|
4997
|
+
async function withOpenCodeDb(fn) {
|
|
4998
|
+
const db = await openSqliteReadonly(opencodeDbPath());
|
|
4999
|
+
if (!db)
|
|
5000
|
+
return null;
|
|
5001
|
+
try {
|
|
5002
|
+
return fn(db);
|
|
5003
|
+
} catch {
|
|
5004
|
+
return null;
|
|
5005
|
+
} finally {
|
|
5006
|
+
try {
|
|
5007
|
+
db.close();
|
|
5008
|
+
} catch {}
|
|
5009
|
+
}
|
|
5010
|
+
}
|
|
5011
|
+
async function queryOpenCodeDb(sql, params = []) {
|
|
5012
|
+
return withOpenCodeDb((db) => db.query(sql, params));
|
|
5013
|
+
}
|
|
5014
|
+
var init_opencode_db = __esm(() => {
|
|
5015
|
+
init_sqlite_reader();
|
|
5016
|
+
});
|
|
5017
|
+
|
|
4929
5018
|
// lib/opencode-projects.ts
|
|
4930
5019
|
var exports_opencode_projects = {};
|
|
4931
5020
|
__export(exports_opencode_projects, {
|
|
@@ -4936,33 +5025,18 @@ __export(exports_opencode_projects, {
|
|
|
4936
5025
|
getOpenCodeSessionsByEncodedName: () => getOpenCodeSessionsByEncodedName,
|
|
4937
5026
|
getOpenCodeSessionsForCwd: () => getOpenCodeSessionsForCwd
|
|
4938
5027
|
});
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
try {
|
|
4942
|
-
const stdout = execFileSync2("opencode", ["db", "--format", "json", sql], {
|
|
4943
|
-
encoding: "utf8",
|
|
4944
|
-
timeout: 5000,
|
|
4945
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
4946
|
-
});
|
|
4947
|
-
if (!stdout.trim())
|
|
4948
|
-
return [];
|
|
4949
|
-
const parsed = JSON.parse(stdout);
|
|
4950
|
-
if (!Array.isArray(parsed))
|
|
4951
|
-
return null;
|
|
4952
|
-
return parsed;
|
|
4953
|
-
} catch {
|
|
4954
|
-
return null;
|
|
4955
|
-
}
|
|
4956
|
-
}
|
|
4957
|
-
function readSessionRows() {
|
|
4958
|
-
return runOpenCodeDb(`SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session ORDER BY time_updated DESC LIMIT ${SESSION_LIMIT}`);
|
|
5028
|
+
async function readSessionRows() {
|
|
5029
|
+
return queryOpenCodeDb("SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session ORDER BY time_updated DESC LIMIT ?", [SESSION_LIMIT]);
|
|
4959
5030
|
}
|
|
4960
|
-
function
|
|
4961
|
-
|
|
5031
|
+
async function readBothRows() {
|
|
5032
|
+
const rows = await withOpenCodeDb((db) => ({
|
|
5033
|
+
sessions: db.query("SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session ORDER BY time_updated DESC LIMIT ?", [SESSION_LIMIT]),
|
|
5034
|
+
projects: db.query("SELECT id, worktree, vcs, name, time_created, time_updated FROM project")
|
|
5035
|
+
}));
|
|
5036
|
+
return { sessions: rows?.sessions ?? null, projects: rows?.projects ?? null };
|
|
4962
5037
|
}
|
|
4963
5038
|
async function getOpenCodeProjects() {
|
|
4964
|
-
const sessions =
|
|
4965
|
-
const projects = readProjectRows();
|
|
5039
|
+
const { sessions, projects } = await readBothRows();
|
|
4966
5040
|
if (sessions === null && projects === null) {
|
|
4967
5041
|
return [];
|
|
4968
5042
|
}
|
|
@@ -5019,7 +5093,7 @@ async function getOpenCodeProjects() {
|
|
|
5019
5093
|
return out;
|
|
5020
5094
|
}
|
|
5021
5095
|
async function getOpenCodeSessionsForCwd(cwd) {
|
|
5022
|
-
const sessions = readSessionRows();
|
|
5096
|
+
const sessions = await readSessionRows();
|
|
5023
5097
|
if (!sessions)
|
|
5024
5098
|
return [];
|
|
5025
5099
|
const matches = sessions.filter((s) => s.directory === cwd);
|
|
@@ -5039,8 +5113,7 @@ async function getOpenCodeSessionsByEncodedName(name) {
|
|
|
5039
5113
|
let projects;
|
|
5040
5114
|
let sessions;
|
|
5041
5115
|
try {
|
|
5042
|
-
projects =
|
|
5043
|
-
sessions = readSessionRows();
|
|
5116
|
+
({ projects, sessions } = await readBothRows());
|
|
5044
5117
|
} catch (error) {
|
|
5045
5118
|
logWarn("Failed to read OpenCode DB:", error);
|
|
5046
5119
|
return { cwd: null, sessions: [] };
|
|
@@ -5068,6 +5141,7 @@ async function getOpenCodeSessionsByEncodedName(name) {
|
|
|
5068
5141
|
}
|
|
5069
5142
|
var SESSION_LIMIT = 1000, getCachedOpenCodeProjects, getCachedOpenCodeSessionsForCwd, getCachedOpenCodeSessionsByEncodedName;
|
|
5070
5143
|
var init_opencode_projects = __esm(() => {
|
|
5144
|
+
init_opencode_db();
|
|
5071
5145
|
init_paths();
|
|
5072
5146
|
init_logger();
|
|
5073
5147
|
getCachedOpenCodeProjects = runtimeCache(getOpenCodeProjects, 30);
|
|
@@ -5086,10 +5160,10 @@ __export(exports_pi_projects, {
|
|
|
5086
5160
|
getPiSessionsForCwd: () => getPiSessionsForCwd
|
|
5087
5161
|
});
|
|
5088
5162
|
import { readdir as readdir4, readFile as readFile6, stat as stat3 } from "node:fs/promises";
|
|
5089
|
-
import { homedir as
|
|
5090
|
-
import { join as
|
|
5163
|
+
import { homedir as homedir9 } from "node:os";
|
|
5164
|
+
import { join as join10 } from "node:path";
|
|
5091
5165
|
function getPiSessionsRoot() {
|
|
5092
|
-
return process.env.PI_SESSIONS_DIR ||
|
|
5166
|
+
return process.env.PI_SESSIONS_DIR || join10(homedir9(), ".pi", "agent", "sessions");
|
|
5093
5167
|
}
|
|
5094
5168
|
async function safeReaddir4(dir) {
|
|
5095
5169
|
try {
|
|
@@ -5137,7 +5211,7 @@ async function scanPiSessions() {
|
|
|
5137
5211
|
for (const cwdDir of cwdDirs) {
|
|
5138
5212
|
if (!cwdDir.isDirectory())
|
|
5139
5213
|
continue;
|
|
5140
|
-
const cwdPath =
|
|
5214
|
+
const cwdPath = join10(root, cwdDir.name);
|
|
5141
5215
|
const sessionFiles = await safeReaddir4(cwdPath);
|
|
5142
5216
|
if (!sessionFiles)
|
|
5143
5217
|
continue;
|
|
@@ -5147,7 +5221,7 @@ async function scanPiSessions() {
|
|
|
5147
5221
|
const m = SESSION_FILE_RE.exec(f.name);
|
|
5148
5222
|
if (!m)
|
|
5149
5223
|
continue;
|
|
5150
|
-
candidates.push({ sessionId: m[1], filePath:
|
|
5224
|
+
candidates.push({ sessionId: m[1], filePath: join10(cwdPath, f.name) });
|
|
5151
5225
|
}
|
|
5152
5226
|
}
|
|
5153
5227
|
if (candidates.length === 0)
|
|
@@ -5248,69 +5322,10 @@ var init_pi_projects = __esm(() => {
|
|
|
5248
5322
|
getCachedPiSessionsByEncodedName = runtimeCache((name) => getPiSessionsByEncodedName(name), 30, { maxSize: 50 });
|
|
5249
5323
|
});
|
|
5250
5324
|
|
|
5251
|
-
// lib/sqlite-reader.ts
|
|
5252
|
-
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "node:fs";
|
|
5253
|
-
import initSqlJs from "sql.js/dist/sql-asm.js";
|
|
5254
|
-
async function tryNodeSqlite(dbPath) {
|
|
5255
|
-
try {
|
|
5256
|
-
const mod = await import("node:sqlite");
|
|
5257
|
-
const db = new mod.DatabaseSync(dbPath, { readOnly: true });
|
|
5258
|
-
return {
|
|
5259
|
-
query(sql, params = []) {
|
|
5260
|
-
const stmt = db.prepare(sql);
|
|
5261
|
-
return params.length ? stmt.all(...params) : stmt.all();
|
|
5262
|
-
},
|
|
5263
|
-
close() {
|
|
5264
|
-
db.close();
|
|
5265
|
-
}
|
|
5266
|
-
};
|
|
5267
|
-
} catch {
|
|
5268
|
-
return null;
|
|
5269
|
-
}
|
|
5270
|
-
}
|
|
5271
|
-
function loadSqlJs() {
|
|
5272
|
-
if (!sqlPromise)
|
|
5273
|
-
sqlPromise = initSqlJs();
|
|
5274
|
-
return sqlPromise;
|
|
5275
|
-
}
|
|
5276
|
-
async function trySqlJs(dbPath) {
|
|
5277
|
-
try {
|
|
5278
|
-
const SQL = await loadSqlJs();
|
|
5279
|
-
const db = new SQL.Database(readFileSync4(dbPath));
|
|
5280
|
-
return {
|
|
5281
|
-
query(sql, params) {
|
|
5282
|
-
const stmt = db.prepare(sql);
|
|
5283
|
-
try {
|
|
5284
|
-
if (params && params.length)
|
|
5285
|
-
stmt.bind(params);
|
|
5286
|
-
const rows = [];
|
|
5287
|
-
while (stmt.step())
|
|
5288
|
-
rows.push(stmt.getAsObject());
|
|
5289
|
-
return rows;
|
|
5290
|
-
} finally {
|
|
5291
|
-
stmt.free();
|
|
5292
|
-
}
|
|
5293
|
-
},
|
|
5294
|
-
close() {
|
|
5295
|
-
db.close();
|
|
5296
|
-
}
|
|
5297
|
-
};
|
|
5298
|
-
} catch {
|
|
5299
|
-
return null;
|
|
5300
|
-
}
|
|
5301
|
-
}
|
|
5302
|
-
async function openSqliteReadonly(dbPath) {
|
|
5303
|
-
if (!existsSync6(dbPath))
|
|
5304
|
-
return null;
|
|
5305
|
-
return await tryNodeSqlite(dbPath) ?? await trySqlJs(dbPath);
|
|
5306
|
-
}
|
|
5307
|
-
var sqlPromise = null;
|
|
5308
|
-
var init_sqlite_reader = () => {};
|
|
5309
|
-
|
|
5310
5325
|
// lib/hermes-profiles.ts
|
|
5311
5326
|
import { readdirSync as readdirSync3 } from "node:fs";
|
|
5312
|
-
import { homedir as
|
|
5313
|
-
import { basename as basename2, dirname as dirname3, join as
|
|
5327
|
+
import { homedir as homedir10 } from "node:os";
|
|
5328
|
+
import { basename as basename2, dirname as dirname3, join as join11, resolve as resolve6 } from "node:path";
|
|
5314
5329
|
function hermesRoot() {
|
|
5315
5330
|
const env = (process.env.HERMES_HOME || "").trim();
|
|
5316
5331
|
if (env) {
|
|
@@ -5320,7 +5335,7 @@ function hermesRoot() {
|
|
|
5320
5335
|
return dirname3(parent);
|
|
5321
5336
|
return home;
|
|
5322
5337
|
}
|
|
5323
|
-
return
|
|
5338
|
+
return join11(homedir10(), ".hermes");
|
|
5324
5339
|
}
|
|
5325
5340
|
function listHermesProfiles() {
|
|
5326
5341
|
const root = hermesRoot();
|
|
@@ -5328,7 +5343,7 @@ function listHermesProfiles() {
|
|
|
5328
5343
|
const seen = new Set([HERMES_DEFAULT_PROFILE]);
|
|
5329
5344
|
let names;
|
|
5330
5345
|
try {
|
|
5331
|
-
names = readdirSync3(
|
|
5346
|
+
names = readdirSync3(join11(root, PROFILES_DIR), { withFileTypes: true }).filter((e) => (e.isDirectory() || e.isSymbolicLink()) && !e.name.startsWith(".")).map((e) => e.name).sort();
|
|
5332
5347
|
} catch {
|
|
5333
5348
|
return out;
|
|
5334
5349
|
}
|
|
@@ -5336,7 +5351,7 @@ function listHermesProfiles() {
|
|
|
5336
5351
|
if (seen.has(name))
|
|
5337
5352
|
continue;
|
|
5338
5353
|
seen.add(name);
|
|
5339
|
-
out.push({ name, home:
|
|
5354
|
+
out.push({ name, home: join11(root, PROFILES_DIR, name) });
|
|
5340
5355
|
}
|
|
5341
5356
|
return out;
|
|
5342
5357
|
}
|
|
@@ -5387,14 +5402,14 @@ function formatDuration(ms) {
|
|
|
5387
5402
|
}
|
|
5388
5403
|
|
|
5389
5404
|
// lib/hermes-sessions.ts
|
|
5390
|
-
import { join as
|
|
5405
|
+
import { join as join12 } from "node:path";
|
|
5391
5406
|
function hermesDbPaths() {
|
|
5392
5407
|
const override = process.env.HERMES_DB_PATH;
|
|
5393
5408
|
if (override)
|
|
5394
5409
|
return [{ profile: HERMES_DEFAULT_PROFILE, dbPath: override }];
|
|
5395
5410
|
return listHermesProfiles().map((p) => ({
|
|
5396
5411
|
profile: p.name,
|
|
5397
|
-
dbPath:
|
|
5412
|
+
dbPath: join12(p.home, "state.db")
|
|
5398
5413
|
}));
|
|
5399
5414
|
}
|
|
5400
5415
|
function epochToMs(value) {
|
|
@@ -5692,10 +5707,10 @@ var init_hermes_projects = __esm(() => {
|
|
|
5692
5707
|
// lib/openclaw-sessions.ts
|
|
5693
5708
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
5694
5709
|
import { readdirSync as readdirSync4, statSync as statSync6 } from "node:fs";
|
|
5695
|
-
import { homedir as
|
|
5696
|
-
import { join as
|
|
5710
|
+
import { homedir as homedir11 } from "node:os";
|
|
5711
|
+
import { join as join13 } from "node:path";
|
|
5697
5712
|
function openclawHome() {
|
|
5698
|
-
return process.env.OPENCLAW_HOME ||
|
|
5713
|
+
return process.env.OPENCLAW_HOME || join13(homedir11(), ".openclaw");
|
|
5699
5714
|
}
|
|
5700
5715
|
function isPlainObject2(v) {
|
|
5701
5716
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -5810,13 +5825,13 @@ function openclawLinesToLogEntries(lines, source = "session") {
|
|
|
5810
5825
|
}
|
|
5811
5826
|
function listOpenClawAgents() {
|
|
5812
5827
|
try {
|
|
5813
|
-
return readdirSync4(
|
|
5828
|
+
return readdirSync4(join13(openclawHome(), "agents"), { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name).sort();
|
|
5814
5829
|
} catch {
|
|
5815
5830
|
return [];
|
|
5816
5831
|
}
|
|
5817
5832
|
}
|
|
5818
5833
|
function listOpenClawTranscripts() {
|
|
5819
|
-
const agentsDir =
|
|
5834
|
+
const agentsDir = join13(openclawHome(), "agents");
|
|
5820
5835
|
const out = [];
|
|
5821
5836
|
let agentIds;
|
|
5822
5837
|
try {
|
|
@@ -5825,7 +5840,7 @@ function listOpenClawTranscripts() {
|
|
|
5825
5840
|
return out;
|
|
5826
5841
|
}
|
|
5827
5842
|
for (const agentId of agentIds) {
|
|
5828
|
-
const sessionsDir =
|
|
5843
|
+
const sessionsDir = join13(agentsDir, agentId, "sessions");
|
|
5829
5844
|
let files;
|
|
5830
5845
|
try {
|
|
5831
5846
|
files = readdirSync4(sessionsDir);
|
|
@@ -5838,7 +5853,7 @@ function listOpenClawTranscripts() {
|
|
|
5838
5853
|
const sessionId = file.slice(0, -".jsonl".length);
|
|
5839
5854
|
if (!OPENCLAW_SESSION_ID_RE.test(sessionId))
|
|
5840
5855
|
continue;
|
|
5841
|
-
const transcriptPath =
|
|
5856
|
+
const transcriptPath = join13(sessionsDir, file);
|
|
5842
5857
|
try {
|
|
5843
5858
|
const st = statSync6(transcriptPath);
|
|
5844
5859
|
out.push({ agentId, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
@@ -5899,13 +5914,13 @@ __export(exports_openclaw_projects, {
|
|
|
5899
5914
|
parseOpenClawProjectName: () => parseOpenClawProjectName
|
|
5900
5915
|
});
|
|
5901
5916
|
import { readFileSync as readFileSync5 } from "node:fs";
|
|
5902
|
-
import { join as
|
|
5917
|
+
import { join as join14 } from "node:path";
|
|
5903
5918
|
function str(v) {
|
|
5904
5919
|
return typeof v === "string" && v.length > 0 ? v : undefined;
|
|
5905
5920
|
}
|
|
5906
5921
|
function readSessionsIndex(agentId) {
|
|
5907
5922
|
const out = new Map;
|
|
5908
|
-
const indexPath =
|
|
5923
|
+
const indexPath = join14(openclawHome(), "agents", agentId, "sessions", "sessions.json");
|
|
5909
5924
|
let raw;
|
|
5910
5925
|
try {
|
|
5911
5926
|
raw = JSON.parse(readFileSync5(indexPath, "utf-8"));
|
|
@@ -6061,13 +6076,13 @@ var init_openclaw_projects = __esm(() => {
|
|
|
6061
6076
|
// lib/factory-sessions.ts
|
|
6062
6077
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
6063
6078
|
import { readdirSync as readdirSync5, statSync as statSync7 } from "node:fs";
|
|
6064
|
-
import { homedir as
|
|
6065
|
-
import { join as
|
|
6079
|
+
import { homedir as homedir12 } from "node:os";
|
|
6080
|
+
import { join as join15 } from "node:path";
|
|
6066
6081
|
function factoryHome() {
|
|
6067
|
-
return process.env.FACTORY_HOME ||
|
|
6082
|
+
return process.env.FACTORY_HOME || join15(homedir12(), ".factory");
|
|
6068
6083
|
}
|
|
6069
6084
|
function factorySessionsRoot() {
|
|
6070
|
-
return
|
|
6085
|
+
return join15(factoryHome(), "sessions");
|
|
6071
6086
|
}
|
|
6072
6087
|
function isPlainObject3(v) {
|
|
6073
6088
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -6213,7 +6228,7 @@ function listFactoryTranscripts() {
|
|
|
6213
6228
|
for (const dir of projectDirs) {
|
|
6214
6229
|
const projectName = dir.name;
|
|
6215
6230
|
const cwd = decodeFolderName(projectName);
|
|
6216
|
-
const projectPath =
|
|
6231
|
+
const projectPath = join15(root, projectName);
|
|
6217
6232
|
let files;
|
|
6218
6233
|
try {
|
|
6219
6234
|
files = readdirSync5(projectPath);
|
|
@@ -6226,7 +6241,7 @@ function listFactoryTranscripts() {
|
|
|
6226
6241
|
const sessionId = file.slice(0, -".jsonl".length);
|
|
6227
6242
|
if (!FACTORY_SESSION_ID_RE.test(sessionId))
|
|
6228
6243
|
continue;
|
|
6229
|
-
const transcriptPath =
|
|
6244
|
+
const transcriptPath = join15(projectPath, file);
|
|
6230
6245
|
try {
|
|
6231
6246
|
const st = statSync7(transcriptPath);
|
|
6232
6247
|
out.push({ projectName, cwd, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
@@ -6352,13 +6367,13 @@ var init_factory_projects = __esm(() => {
|
|
|
6352
6367
|
});
|
|
6353
6368
|
|
|
6354
6369
|
// lib/devin-sessions.ts
|
|
6355
|
-
import { homedir as
|
|
6356
|
-
import { join as
|
|
6370
|
+
import { homedir as homedir13 } from "node:os";
|
|
6371
|
+
import { join as join16 } from "node:path";
|
|
6357
6372
|
function devinHome() {
|
|
6358
|
-
return process.env.DEVIN_HOME ||
|
|
6373
|
+
return process.env.DEVIN_HOME || join16(homedir13(), ".local", "share", "devin");
|
|
6359
6374
|
}
|
|
6360
6375
|
function devinDbPath() {
|
|
6361
|
-
return process.env.DEVIN_DB_PATH ||
|
|
6376
|
+
return process.env.DEVIN_DB_PATH || join16(devinHome(), "cli", "sessions.db");
|
|
6362
6377
|
}
|
|
6363
6378
|
function devinEpochToMs(value) {
|
|
6364
6379
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
@@ -6656,16 +6671,16 @@ var init_devin_projects = __esm(() => {
|
|
|
6656
6671
|
// lib/antigravity-sessions.ts
|
|
6657
6672
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
6658
6673
|
import { readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
|
|
6659
|
-
import { homedir as
|
|
6660
|
-
import { join as
|
|
6674
|
+
import { homedir as homedir14 } from "node:os";
|
|
6675
|
+
import { join as join17 } from "node:path";
|
|
6661
6676
|
function antigravityHome() {
|
|
6662
|
-
return process.env.ANTIGRAVITY_HOME ||
|
|
6677
|
+
return process.env.ANTIGRAVITY_HOME || join17(homedir14(), ".gemini", "antigravity-cli");
|
|
6663
6678
|
}
|
|
6664
6679
|
function antigravityBrainRoot() {
|
|
6665
|
-
return
|
|
6680
|
+
return join17(antigravityHome(), "brain");
|
|
6666
6681
|
}
|
|
6667
6682
|
function antigravityTranscriptRelPath() {
|
|
6668
|
-
return
|
|
6683
|
+
return join17(".system_generated", "logs", "transcript_full.jsonl");
|
|
6669
6684
|
}
|
|
6670
6685
|
function isPlainObject5(v) {
|
|
6671
6686
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -6788,7 +6803,7 @@ function listAntigravityTranscripts() {
|
|
|
6788
6803
|
const conversationId = dir.name;
|
|
6789
6804
|
if (!ANTIGRAVITY_CONVERSATION_ID_RE.test(conversationId))
|
|
6790
6805
|
continue;
|
|
6791
|
-
const transcriptPath =
|
|
6806
|
+
const transcriptPath = join17(root, conversationId, rel);
|
|
6792
6807
|
try {
|
|
6793
6808
|
const st = statSync8(transcriptPath);
|
|
6794
6809
|
if (!st.isFile())
|
|
@@ -6801,7 +6816,7 @@ function listAntigravityTranscripts() {
|
|
|
6801
6816
|
function findAntigravityTranscript(conversationId) {
|
|
6802
6817
|
if (!ANTIGRAVITY_CONVERSATION_ID_RE.test(conversationId))
|
|
6803
6818
|
return null;
|
|
6804
|
-
const transcriptPath =
|
|
6819
|
+
const transcriptPath = join17(antigravityBrainRoot(), conversationId, antigravityTranscriptRelPath());
|
|
6805
6820
|
try {
|
|
6806
6821
|
if (statSync8(transcriptPath).isFile())
|
|
6807
6822
|
return transcriptPath;
|
|
@@ -6841,9 +6856,9 @@ __export(exports_antigravity_projects, {
|
|
|
6841
6856
|
getCachedAntigravityProjects: () => getCachedAntigravityProjects,
|
|
6842
6857
|
getCachedAntigravitySessionsByEncodedName: () => getCachedAntigravitySessionsByEncodedName
|
|
6843
6858
|
});
|
|
6844
|
-
import { join as
|
|
6859
|
+
import { join as join18 } from "node:path";
|
|
6845
6860
|
function antigravitySummariesDbPath() {
|
|
6846
|
-
return
|
|
6861
|
+
return join18(antigravityHome(), "conversation_summaries.db");
|
|
6847
6862
|
}
|
|
6848
6863
|
function parseWorkspaceCwd(raw) {
|
|
6849
6864
|
if (!raw)
|
|
@@ -6986,16 +7001,16 @@ var init_antigravity_projects = __esm(() => {
|
|
|
6986
7001
|
});
|
|
6987
7002
|
|
|
6988
7003
|
// lib/goose-sessions.ts
|
|
6989
|
-
import { homedir as
|
|
6990
|
-
import { join as
|
|
7004
|
+
import { homedir as homedir15 } from "node:os";
|
|
7005
|
+
import { join as join19 } from "node:path";
|
|
6991
7006
|
function gooseHome() {
|
|
6992
7007
|
if (process.env.GOOSE_HOME)
|
|
6993
7008
|
return process.env.GOOSE_HOME;
|
|
6994
7009
|
const xdg = process.env.XDG_DATA_HOME;
|
|
6995
|
-
return
|
|
7010
|
+
return join19(xdg && xdg.length > 0 ? xdg : join19(homedir15(), ".local", "share"), "goose");
|
|
6996
7011
|
}
|
|
6997
7012
|
function gooseDbPath() {
|
|
6998
|
-
return process.env.GOOSE_DB_PATH ||
|
|
7013
|
+
return process.env.GOOSE_DB_PATH || join19(gooseHome(), "sessions", "sessions.db");
|
|
6999
7014
|
}
|
|
7000
7015
|
function gooseTimestampToMs(value) {
|
|
7001
7016
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
@@ -7263,7 +7278,7 @@ var init_goose_projects = __esm(() => {
|
|
|
7263
7278
|
|
|
7264
7279
|
// lib/projects.ts
|
|
7265
7280
|
import { readdir as readdir5, stat as stat4 } from "node:fs/promises";
|
|
7266
|
-
import { join as
|
|
7281
|
+
import { join as join20, resolve as resolve7, sep } from "node:path";
|
|
7267
7282
|
async function getMtime(path2, label) {
|
|
7268
7283
|
try {
|
|
7269
7284
|
return (await stat4(path2)).mtime;
|
|
@@ -7289,7 +7304,7 @@ async function getClaudeProjectFolders() {
|
|
|
7289
7304
|
if (!entries)
|
|
7290
7305
|
return [];
|
|
7291
7306
|
const settled = await batchAll(entries.filter((entry) => entry.isDirectory()).map((entry) => async () => {
|
|
7292
|
-
const folderPath =
|
|
7307
|
+
const folderPath = join20(projectsPath, entry.name);
|
|
7293
7308
|
const mtime = await getMtime(folderPath, entry.name);
|
|
7294
7309
|
return {
|
|
7295
7310
|
name: entry.name,
|
|
@@ -7416,7 +7431,7 @@ function resolveProjectPath(projectName) {
|
|
|
7416
7431
|
if (/^[/\\]/.test(projectName))
|
|
7417
7432
|
throw new RangeError("Absolute project name");
|
|
7418
7433
|
const projectsPath = resolve7(getClaudeProjectsPath());
|
|
7419
|
-
const candidate = resolve7(
|
|
7434
|
+
const candidate = resolve7(join20(projectsPath, projectName));
|
|
7420
7435
|
if (!candidate.startsWith(projectsPath + sep)) {
|
|
7421
7436
|
throw new RangeError("Project path escapes root");
|
|
7422
7437
|
}
|
|
@@ -7434,7 +7449,7 @@ async function getSessionFiles(projectPath) {
|
|
|
7434
7449
|
return [];
|
|
7435
7450
|
const jsonlEntries = entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl") && extractSessionId2(entry.name));
|
|
7436
7451
|
const settled = await batchAll(jsonlEntries.map((entry) => async () => {
|
|
7437
|
-
const filePath =
|
|
7452
|
+
const filePath = join20(projectPath, entry.name);
|
|
7438
7453
|
const mtime = await getMtime(filePath, entry.name);
|
|
7439
7454
|
return {
|
|
7440
7455
|
name: entry.name,
|
|
@@ -7463,13 +7478,13 @@ var init_projects = __esm(() => {
|
|
|
7463
7478
|
|
|
7464
7479
|
// lib/resolve-subagent-path.ts
|
|
7465
7480
|
import { access as access2 } from "fs/promises";
|
|
7466
|
-
import { join as
|
|
7481
|
+
import { join as join21, relative as relative2 } from "path";
|
|
7467
7482
|
async function resolveSubagentPath(projectsPath, projectName, sessionId, agentId) {
|
|
7468
7483
|
const fileName = `agent-${agentId}.jsonl`;
|
|
7469
7484
|
const candidatePaths = [
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7485
|
+
join21(projectsPath, projectName, fileName),
|
|
7486
|
+
join21(projectsPath, projectName, sessionId, fileName),
|
|
7487
|
+
join21(projectsPath, projectName, sessionId, "subagents", fileName)
|
|
7473
7488
|
];
|
|
7474
7489
|
for (const candidatePath of candidatePaths) {
|
|
7475
7490
|
if (relative2(projectsPath, candidatePath).startsWith("..")) {
|
|
@@ -7491,7 +7506,7 @@ var init_resolve_subagent_path = () => {};
|
|
|
7491
7506
|
|
|
7492
7507
|
// lib/log-entries.ts
|
|
7493
7508
|
import { readFile as readFile10 } from "fs/promises";
|
|
7494
|
-
import { join as
|
|
7509
|
+
import { join as join22 } from "path";
|
|
7495
7510
|
function formatTimestamp(date) {
|
|
7496
7511
|
const base = formatDate(date);
|
|
7497
7512
|
const ms = date.getMilliseconds().toString().padStart(3, "0");
|
|
@@ -7685,7 +7700,7 @@ async function parseFileContent(fileContent, source) {
|
|
|
7685
7700
|
async function parseSessionLog(projectName, sessionId) {
|
|
7686
7701
|
const projectDir = resolveProjectPath(projectName);
|
|
7687
7702
|
const projectsPath = getClaudeProjectsPath();
|
|
7688
|
-
const filePath =
|
|
7703
|
+
const filePath = join22(projectDir, `${sessionId}.jsonl`);
|
|
7689
7704
|
const fileContent = await readFile10(filePath, "utf-8");
|
|
7690
7705
|
const { entries: sessionEntries, rawLines: sessionRawLines, subagentIds } = await parseFileContent(fileContent, "session");
|
|
7691
7706
|
if (subagentIds.length === 0) {
|
|
@@ -7724,8 +7739,8 @@ var init_log_entries = __esm(() => {
|
|
|
7724
7739
|
// lib/codex-sessions.ts
|
|
7725
7740
|
import { readFileSync as readFileSync6, readdirSync as readdirSync7, existsSync as existsSync7, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5, statSync as statSync9 } from "node:fs";
|
|
7726
7741
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
7727
|
-
import { dirname as dirname4, join as
|
|
7728
|
-
import { homedir as
|
|
7742
|
+
import { dirname as dirname4, join as join23 } from "node:path";
|
|
7743
|
+
import { homedir as homedir16 } from "node:os";
|
|
7729
7744
|
function readCache() {
|
|
7730
7745
|
try {
|
|
7731
7746
|
if (!existsSync7(CACHE_PATH))
|
|
@@ -7747,7 +7762,7 @@ function dirSearch(dir, sessionId) {
|
|
|
7747
7762
|
try {
|
|
7748
7763
|
for (const f of readdirSync7(dir, { withFileTypes: true })) {
|
|
7749
7764
|
if (f.isFile() && f.name.includes(sessionId) && f.name.endsWith(".jsonl")) {
|
|
7750
|
-
return
|
|
7765
|
+
return join23(dir, f.name);
|
|
7751
7766
|
}
|
|
7752
7767
|
}
|
|
7753
7768
|
} catch {}
|
|
@@ -7758,14 +7773,14 @@ function findCodexTranscript(sessionId) {
|
|
|
7758
7773
|
const cached = cache[sessionId];
|
|
7759
7774
|
if (cached && existsSync7(cached))
|
|
7760
7775
|
return cached;
|
|
7761
|
-
const root =
|
|
7776
|
+
const root = join23(homedir16(), ".codex", "sessions");
|
|
7762
7777
|
const today = new Date;
|
|
7763
7778
|
const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
|
|
7764
7779
|
const datedDirs = [today, yesterday].map((d) => {
|
|
7765
7780
|
const y = String(d.getUTCFullYear());
|
|
7766
7781
|
const m = String(d.getUTCMonth() + 1).padStart(2, "0");
|
|
7767
7782
|
const day = String(d.getUTCDate()).padStart(2, "0");
|
|
7768
|
-
return
|
|
7783
|
+
return join23(root, y, m, day);
|
|
7769
7784
|
});
|
|
7770
7785
|
for (const dir of datedDirs) {
|
|
7771
7786
|
const hit = dirSearch(dir, sessionId);
|
|
@@ -7778,13 +7793,13 @@ function findCodexTranscript(sessionId) {
|
|
|
7778
7793
|
for (const y of readdirSync7(root, { withFileTypes: true })) {
|
|
7779
7794
|
if (!y.isDirectory())
|
|
7780
7795
|
continue;
|
|
7781
|
-
for (const m of readdirSync7(
|
|
7796
|
+
for (const m of readdirSync7(join23(root, y.name), { withFileTypes: true })) {
|
|
7782
7797
|
if (!m.isDirectory())
|
|
7783
7798
|
continue;
|
|
7784
|
-
for (const d of readdirSync7(
|
|
7799
|
+
for (const d of readdirSync7(join23(root, y.name, m.name), { withFileTypes: true })) {
|
|
7785
7800
|
if (!d.isDirectory())
|
|
7786
7801
|
continue;
|
|
7787
|
-
const hit = dirSearch(
|
|
7802
|
+
const hit = dirSearch(join23(root, y.name, m.name, d.name), sessionId);
|
|
7788
7803
|
if (hit) {
|
|
7789
7804
|
writeCacheEntry(sessionId, hit);
|
|
7790
7805
|
return hit;
|
|
@@ -8052,13 +8067,13 @@ var init_resolve_permission_mode = __esm(() => {
|
|
|
8052
8067
|
// lib/copilot-sessions.ts
|
|
8053
8068
|
import { readFileSync as readFileSync8, readdirSync as readdirSync8, existsSync as existsSync8, statSync as statSync10 } from "node:fs";
|
|
8054
8069
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
8055
|
-
import { join as
|
|
8056
|
-
import { homedir as
|
|
8070
|
+
import { join as join24, resolve as resolve8, sep as sep2 } from "node:path";
|
|
8071
|
+
import { homedir as homedir17 } from "node:os";
|
|
8057
8072
|
function getCopilotHome() {
|
|
8058
|
-
return process.env.COPILOT_HOME ||
|
|
8073
|
+
return process.env.COPILOT_HOME || join24(homedir17(), ".copilot");
|
|
8059
8074
|
}
|
|
8060
8075
|
function getCopilotSessionStateRoot2() {
|
|
8061
|
-
return
|
|
8076
|
+
return join24(getCopilotHome(), "session-state");
|
|
8062
8077
|
}
|
|
8063
8078
|
function getCopilotSessionDir(sessionId) {
|
|
8064
8079
|
if (!sessionId)
|
|
@@ -8073,7 +8088,7 @@ function resolveSessionFile(sessionId, filename) {
|
|
|
8073
8088
|
const dir = getCopilotSessionDir(sessionId);
|
|
8074
8089
|
if (!dir)
|
|
8075
8090
|
return null;
|
|
8076
|
-
return
|
|
8091
|
+
return join24(dir, filename);
|
|
8077
8092
|
}
|
|
8078
8093
|
function findCopilotTranscript(sessionId) {
|
|
8079
8094
|
const candidate = resolveSessionFile(sessionId, "events.jsonl");
|
|
@@ -8269,10 +8284,10 @@ var init_copilot_sessions = __esm(() => {
|
|
|
8269
8284
|
// lib/cursor-sessions.ts
|
|
8270
8285
|
import { readFileSync as readFileSync9, readdirSync as readdirSync9, existsSync as existsSync9, statSync as statSync11 } from "node:fs";
|
|
8271
8286
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
8272
|
-
import { basename as basename3, join as
|
|
8273
|
-
import { homedir as
|
|
8287
|
+
import { basename as basename3, join as join25, resolve as resolve9, sep as sep3 } from "node:path";
|
|
8288
|
+
import { homedir as homedir18 } from "node:os";
|
|
8274
8289
|
function getCursorHome2() {
|
|
8275
|
-
return process.env.CURSOR_HOME ||
|
|
8290
|
+
return process.env.CURSOR_HOME || join25(homedir18(), ".cursor");
|
|
8276
8291
|
}
|
|
8277
8292
|
function getCursorSessionDir(sessionId) {
|
|
8278
8293
|
if (!sessionId)
|
|
@@ -8307,11 +8322,11 @@ function findCursorTranscript(sessionId) {
|
|
|
8307
8322
|
const dir = getCursorSessionDir(sessionId);
|
|
8308
8323
|
if (!dir)
|
|
8309
8324
|
return null;
|
|
8310
|
-
const newCandidate =
|
|
8325
|
+
const newCandidate = join25(dir, `${basename3(dir)}.jsonl`);
|
|
8311
8326
|
if (existsSync9(newCandidate))
|
|
8312
8327
|
return newCandidate;
|
|
8313
8328
|
for (const name of LEGACY_TRANSCRIPT_FILE_CANDIDATES2) {
|
|
8314
|
-
const candidate =
|
|
8329
|
+
const candidate = join25(dir, name);
|
|
8315
8330
|
if (existsSync9(candidate))
|
|
8316
8331
|
return candidate;
|
|
8317
8332
|
}
|
|
@@ -8525,10 +8540,10 @@ var init_cursor_sessions = __esm(() => {
|
|
|
8525
8540
|
// lib/pi-sessions.ts
|
|
8526
8541
|
import { readFileSync as readFileSync10, readdirSync as readdirSync10, existsSync as existsSync10, statSync as statSync12 } from "node:fs";
|
|
8527
8542
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
8528
|
-
import { join as
|
|
8529
|
-
import { homedir as
|
|
8543
|
+
import { join as join26, resolve as resolve10, sep as sep4 } from "node:path";
|
|
8544
|
+
import { homedir as homedir19 } from "node:os";
|
|
8530
8545
|
function getPiSessionStateRoot() {
|
|
8531
|
-
return process.env.PI_SESSIONS_DIR ||
|
|
8546
|
+
return process.env.PI_SESSIONS_DIR || join26(homedir19(), ".pi", "agent", "sessions");
|
|
8532
8547
|
}
|
|
8533
8548
|
function isSafeSessionId(sessionId) {
|
|
8534
8549
|
return UUID_RE.test(sessionId);
|
|
@@ -9171,7 +9186,7 @@ var init_atomic_write = () => {};
|
|
|
9171
9186
|
// src/hooks/session-pause.ts
|
|
9172
9187
|
import { existsSync as existsSync13, mkdirSync as mkdirSync6, readdirSync as readdirSync11, readFileSync as readFileSync13, rmSync as rmSync2 } from "node:fs";
|
|
9173
9188
|
import { createHash as createHash5 } from "node:crypto";
|
|
9174
|
-
import { join as
|
|
9189
|
+
import { join as join27, resolve as resolve13 } from "node:path";
|
|
9175
9190
|
function pauseStateDir() {
|
|
9176
9191
|
const override = process.env.FAILPROOFAI_STATE_DIR;
|
|
9177
9192
|
if (override)
|
|
@@ -9180,7 +9195,7 @@ function pauseStateDir() {
|
|
|
9180
9195
|
}
|
|
9181
9196
|
function pauseFilePath(sessionId) {
|
|
9182
9197
|
const digest = createHash5("sha256").update(sessionId).digest("hex").slice(0, 32);
|
|
9183
|
-
return
|
|
9198
|
+
return join27(pauseStateDir(), `${digest}.json`);
|
|
9184
9199
|
}
|
|
9185
9200
|
function parseStored(raw) {
|
|
9186
9201
|
if (!raw || typeof raw !== "object")
|
|
@@ -9393,7 +9408,7 @@ async function evaluateHookEvent(eventType, cli = "claude", stdinPayload, opts)
|
|
|
9393
9408
|
const legacyNames = activePause || packsInstalledHere ? [] : config.enabledPolicies;
|
|
9394
9409
|
registerBuiltinPolicies(activePause ? [] : legacyNames);
|
|
9395
9410
|
if (legacyNames.length > 0) {
|
|
9396
|
-
hookLogWarn(`enforcing ${legacyNames.length} policies from this build because no pack is installed — ` + `run \`failproofai policies add
|
|
9411
|
+
hookLogWarn(`enforcing ${legacyNames.length} policies from this build because no pack is installed — ` + `run \`failproofai policies add FailproofAI/policies\` to move them into a real pack`);
|
|
9397
9412
|
}
|
|
9398
9413
|
const enabledBuiltinNames = new Set(legacyNames);
|
|
9399
9414
|
let cloudManagedPolicies = [];
|