failproofai 1.0.4-beta.7 → 1.0.4-beta.8
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 +3 -3
- 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/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/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/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/server-reference-manifest.json +5 -5
- 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/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/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/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/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/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/server-reference-manifest.json +5 -5
- 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/{[externals]__0v1hz15._.js → [externals]__0hmcwgg._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__1nb206a._.js → [externals]__14b7cc6._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__08dchfu._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0faqz9x._.js +22 -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]__0zyc_nm._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__1p-qi2t._.js → [root-of-the-server]__112b4go._.js} +22 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1l71g3y._.js +22 -0
- package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
- package/.next/standalone/.next/server/chunks/{_0otft92._.js → _1_eakl4._.js} +2 -2
- package/.next/standalone/.next/server/chunks/lib_openclaw-projects_ts_0gc-p24._.js +3 -0
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-4ja6q._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__00cr3xu._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1sc84bb._.js → [root-of-the-server]__00y9ww2._.js} +21 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04px77e._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0egr5s1._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0i0l1di._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0n2txhk._.js +1 -1
- 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]__0r3c1_0._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__17xnxlx._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1fvfw59._.js → [root-of-the-server]__187jks6._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ckpmkk._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__12hbpha._.js → [root-of-the-server]__1fa1jd9._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1kaotix._.js +22 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0dxf928._.js → [root-of-the-server]__1kpd1za._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0a0zlpr._.js → _00bqkhj._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_04ng_6x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_07t3jol._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_1if9ixi._.js → _14c6q09._.js} +21 -2
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +2 -2
- 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_openclaw-projects_ts_0qxq3bp._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- 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 +23 -23
- package/.next/standalone/.next/static/chunks/{2h_pcb1y8_jde.js → 0igq884ziuv-8.js} +1 -1
- package/.next/standalone/.next/static/chunks/{083fk73jtv9a0.js → 0vm4wdx3w-2_w.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0f1pznnc7zlub.js → 1302duobnz07l.js} +1 -1
- package/.next/standalone/.next/static/chunks/{15uon66hpwbgg.js → 1_x7pqemw5n_w.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0t6ea7d3bkmdv.js → 1chm9piluggc-.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2pwfrn6_mw-1u.js → 2mizt96igig1y.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1csubx9gwhsf6.js → 2n85g-crgcx5j.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0ntdfr2552x-h.js → 2ukucf6g-kbs5.js} +1 -1
- package/.next/standalone/.next/static/chunks/{27du9n7ssja7l.js → 349jkb79v5g6z.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0divvxng208xo.js → 3a4gth64hwtwf.js} +1 -1
- package/.next/standalone/lib/download-session.ts +58 -13
- package/.next/standalone/lib/openclaw-db.ts +271 -0
- package/.next/standalone/lib/openclaw-projects.ts +54 -18
- package/.next/standalone/lib/openclaw-sessions.ts +75 -17
- package/.next/standalone/package.json +9 -9
- package/.next/standalone/server.js +1 -1
- package/dist/cli.mjs +456 -261
- package/dist/worker.mjs +285 -90
- package/lib/download-session.ts +58 -13
- package/lib/openclaw-db.ts +271 -0
- package/lib/openclaw-projects.ts +54 -18
- package/lib/openclaw-sessions.ts +75 -17
- package/package.json +9 -9
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-219ec._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__04_h-a5._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1le9jqc._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1nq7ivq._.js +0 -3
- /package/.next/standalone/.next/static/{YiPsVpjrc-pEQoN7XvhZ0 → DNhaAH8iPGH0tIuxee5_2}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{YiPsVpjrc-pEQoN7XvhZ0 → DNhaAH8iPGH0tIuxee5_2}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{YiPsVpjrc-pEQoN7XvhZ0 → DNhaAH8iPGH0tIuxee5_2}/_ssgManifest.js +0 -0
package/dist/worker.mjs
CHANGED
|
@@ -3507,7 +3507,7 @@ function parsePackPolicyName(canonicalName) {
|
|
|
3507
3507
|
}
|
|
3508
3508
|
|
|
3509
3509
|
// package.json
|
|
3510
|
-
var version = "1.0.4-beta.
|
|
3510
|
+
var version = "1.0.4-beta.8";
|
|
3511
3511
|
var init_package = () => {};
|
|
3512
3512
|
|
|
3513
3513
|
// src/posthog-key.ts
|
|
@@ -6686,13 +6686,169 @@ var init_hermes_projects = __esm(() => {
|
|
|
6686
6686
|
getCachedHermesSessionsByEncodedName = runtimeCache((name) => getHermesSessionsByEncodedName(name), 2, { maxSize: 50 });
|
|
6687
6687
|
});
|
|
6688
6688
|
|
|
6689
|
+
// lib/openclaw-db.ts
|
|
6690
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
6691
|
+
import { join as join13 } from "node:path";
|
|
6692
|
+
function str(value) {
|
|
6693
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
6694
|
+
}
|
|
6695
|
+
function parseObject(value) {
|
|
6696
|
+
try {
|
|
6697
|
+
const parsed = JSON.parse(value);
|
|
6698
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : undefined;
|
|
6699
|
+
} catch {
|
|
6700
|
+
return;
|
|
6701
|
+
}
|
|
6702
|
+
}
|
|
6703
|
+
function syntheticPath(agentId, sessionId) {
|
|
6704
|
+
return `openclaw-sqlite://${encodeURIComponent(agentId)}/${sessionId}`;
|
|
6705
|
+
}
|
|
6706
|
+
function listOpenClawDatabases(home, agentIds) {
|
|
6707
|
+
const out = [];
|
|
6708
|
+
for (const agentId of agentIds) {
|
|
6709
|
+
const dbPath = join13(home, "agents", agentId, "agent", DB_NAME);
|
|
6710
|
+
if (existsSync9(dbPath))
|
|
6711
|
+
out.push({ agentId, dbPath });
|
|
6712
|
+
}
|
|
6713
|
+
return out;
|
|
6714
|
+
}
|
|
6715
|
+
function readNodeMetadata(db) {
|
|
6716
|
+
const out = new Map;
|
|
6717
|
+
let rows;
|
|
6718
|
+
try {
|
|
6719
|
+
rows = db.query(`SELECT current_session_id, entry_json, label, display_name
|
|
6720
|
+
FROM session_nodes`);
|
|
6721
|
+
} catch {
|
|
6722
|
+
return out;
|
|
6723
|
+
}
|
|
6724
|
+
for (const row of rows) {
|
|
6725
|
+
const entry = parseObject(row.entry_json) ?? {};
|
|
6726
|
+
const origin = entry.origin && typeof entry.origin === "object" && !Array.isArray(entry.origin) ? entry.origin : {};
|
|
6727
|
+
out.set(row.current_session_id, {
|
|
6728
|
+
channel: str(entry.lastChannel) ?? str(origin.provider) ?? str(origin.surface),
|
|
6729
|
+
label: str(row.label) ?? str(row.display_name) ?? str(entry.displayName) ?? str(origin.label),
|
|
6730
|
+
chatId: str(entry.lastTo) ?? str(origin.from),
|
|
6731
|
+
chatType: str(entry.chatType) ?? str(origin.chatType)
|
|
6732
|
+
});
|
|
6733
|
+
}
|
|
6734
|
+
return out;
|
|
6735
|
+
}
|
|
6736
|
+
function readConversationMetadata(db) {
|
|
6737
|
+
const out = new Map;
|
|
6738
|
+
let rows;
|
|
6739
|
+
try {
|
|
6740
|
+
rows = db.query(`SELECT sc.session_id, c.channel, c.kind, c.peer_id,
|
|
6741
|
+
c.delivery_target, c.label
|
|
6742
|
+
FROM session_conversations sc
|
|
6743
|
+
JOIN conversations c ON c.conversation_id = sc.conversation_id
|
|
6744
|
+
ORDER BY CASE sc.role WHEN 'primary' THEN 0 ELSE 1 END, sc.last_seen_at DESC`);
|
|
6745
|
+
} catch {
|
|
6746
|
+
return out;
|
|
6747
|
+
}
|
|
6748
|
+
for (const row of rows) {
|
|
6749
|
+
if (out.has(row.session_id))
|
|
6750
|
+
continue;
|
|
6751
|
+
out.set(row.session_id, {
|
|
6752
|
+
channel: str(row.channel),
|
|
6753
|
+
label: str(row.label),
|
|
6754
|
+
chatId: str(row.delivery_target) ?? str(row.peer_id),
|
|
6755
|
+
chatType: str(row.kind)
|
|
6756
|
+
});
|
|
6757
|
+
}
|
|
6758
|
+
return out;
|
|
6759
|
+
}
|
|
6760
|
+
async function listOpenClawSqliteSessions(home, agentIds) {
|
|
6761
|
+
const sessions = [];
|
|
6762
|
+
for (const { agentId, dbPath } of listOpenClawDatabases(home, agentIds)) {
|
|
6763
|
+
const db = await openSqliteReadonly(dbPath);
|
|
6764
|
+
if (!db)
|
|
6765
|
+
continue;
|
|
6766
|
+
try {
|
|
6767
|
+
let rows;
|
|
6768
|
+
try {
|
|
6769
|
+
rows = db.query(`SELECT w.session_id, w.session_key, w.updated_at,
|
|
6770
|
+
w.transcript_updated_at, w.ended_at, w.channel,
|
|
6771
|
+
w.chat_type, w.display_name,
|
|
6772
|
+
COALESCE((SELECT MAX(e.created_at)
|
|
6773
|
+
FROM transcript_events e
|
|
6774
|
+
WHERE e.session_id = w.session_id), 0) AS event_updated_at,
|
|
6775
|
+
COALESCE((SELECT SUM(length(e.event_json) + 1)
|
|
6776
|
+
FROM transcript_events e
|
|
6777
|
+
WHERE e.session_id = w.session_id), 0) AS size_bytes
|
|
6778
|
+
FROM session_windows w
|
|
6779
|
+
WHERE EXISTS (SELECT 1 FROM transcript_events e
|
|
6780
|
+
WHERE e.session_id = w.session_id)`);
|
|
6781
|
+
} catch {
|
|
6782
|
+
continue;
|
|
6783
|
+
}
|
|
6784
|
+
const nodes = readNodeMetadata(db);
|
|
6785
|
+
const conversations = readConversationMetadata(db);
|
|
6786
|
+
for (const row of rows) {
|
|
6787
|
+
const node = nodes.get(row.session_id);
|
|
6788
|
+
const conversation = conversations.get(row.session_id);
|
|
6789
|
+
sessions.push({
|
|
6790
|
+
sessionId: row.session_id,
|
|
6791
|
+
agentId,
|
|
6792
|
+
dbPath,
|
|
6793
|
+
transcriptPath: syntheticPath(agentId, row.session_id),
|
|
6794
|
+
mtimeMs: Math.max(Number(row.updated_at) || 0, Number(row.transcript_updated_at) || 0, Number(row.ended_at) || 0, Number(row.event_updated_at) || 0),
|
|
6795
|
+
sizeBytes: Number(row.size_bytes) || 0,
|
|
6796
|
+
channel: str(row.channel) ?? conversation?.channel ?? node?.channel ?? "local",
|
|
6797
|
+
label: str(row.display_name) ?? conversation?.label ?? node?.label,
|
|
6798
|
+
chatId: conversation?.chatId ?? node?.chatId,
|
|
6799
|
+
chatType: str(row.chat_type) ?? conversation?.chatType ?? node?.chatType
|
|
6800
|
+
});
|
|
6801
|
+
}
|
|
6802
|
+
} finally {
|
|
6803
|
+
db.close();
|
|
6804
|
+
}
|
|
6805
|
+
}
|
|
6806
|
+
return sessions;
|
|
6807
|
+
}
|
|
6808
|
+
async function readOpenClawSqliteTranscript(home, agentIds, sessionId) {
|
|
6809
|
+
for (const { agentId, dbPath } of listOpenClawDatabases(home, agentIds)) {
|
|
6810
|
+
const db = await openSqliteReadonly(dbPath);
|
|
6811
|
+
if (!db)
|
|
6812
|
+
continue;
|
|
6813
|
+
try {
|
|
6814
|
+
let rows;
|
|
6815
|
+
try {
|
|
6816
|
+
rows = db.query(`SELECT event_json
|
|
6817
|
+
FROM transcript_events
|
|
6818
|
+
WHERE session_id = ?
|
|
6819
|
+
ORDER BY seq ASC`, [sessionId]);
|
|
6820
|
+
} catch {
|
|
6821
|
+
continue;
|
|
6822
|
+
}
|
|
6823
|
+
if (rows.length === 0)
|
|
6824
|
+
continue;
|
|
6825
|
+
const eventJsonLines = rows.map((row) => row.event_json);
|
|
6826
|
+
const rawLines = eventJsonLines.map(parseObject).filter((line) => line !== undefined);
|
|
6827
|
+
return {
|
|
6828
|
+
agentId,
|
|
6829
|
+
dbPath,
|
|
6830
|
+
filePath: syntheticPath(agentId, sessionId),
|
|
6831
|
+
rawLines,
|
|
6832
|
+
eventJsonLines
|
|
6833
|
+
};
|
|
6834
|
+
} finally {
|
|
6835
|
+
db.close();
|
|
6836
|
+
}
|
|
6837
|
+
}
|
|
6838
|
+
return null;
|
|
6839
|
+
}
|
|
6840
|
+
var DB_NAME = "openclaw-agent.sqlite";
|
|
6841
|
+
var init_openclaw_db = __esm(() => {
|
|
6842
|
+
init_sqlite_reader();
|
|
6843
|
+
});
|
|
6844
|
+
|
|
6689
6845
|
// lib/openclaw-sessions.ts
|
|
6690
6846
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
6691
6847
|
import { readdirSync as readdirSync4, statSync as statSync6 } from "node:fs";
|
|
6692
6848
|
import { homedir as homedir11 } from "node:os";
|
|
6693
|
-
import { join as
|
|
6849
|
+
import { join as join14 } from "node:path";
|
|
6694
6850
|
function openclawHome() {
|
|
6695
|
-
return process.env.OPENCLAW_HOME ||
|
|
6851
|
+
return process.env.OPENCLAW_STATE_DIR || process.env.OPENCLAW_HOME || join14(homedir11(), ".openclaw");
|
|
6696
6852
|
}
|
|
6697
6853
|
function isPlainObject2(v) {
|
|
6698
6854
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -6779,7 +6935,11 @@ function openclawLinesToLogEntries(lines, source = "session") {
|
|
|
6779
6935
|
entries.push({
|
|
6780
6936
|
type: "assistant",
|
|
6781
6937
|
...base,
|
|
6782
|
-
message: {
|
|
6938
|
+
message: {
|
|
6939
|
+
role: "assistant",
|
|
6940
|
+
content: blocks,
|
|
6941
|
+
model: typeof m.model === "string" ? m.model : undefined
|
|
6942
|
+
}
|
|
6783
6943
|
});
|
|
6784
6944
|
continue;
|
|
6785
6945
|
}
|
|
@@ -6807,13 +6967,13 @@ function openclawLinesToLogEntries(lines, source = "session") {
|
|
|
6807
6967
|
}
|
|
6808
6968
|
function listOpenClawAgents() {
|
|
6809
6969
|
try {
|
|
6810
|
-
return readdirSync4(
|
|
6970
|
+
return readdirSync4(join14(openclawHome(), "agents"), { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name).sort();
|
|
6811
6971
|
} catch {
|
|
6812
6972
|
return [];
|
|
6813
6973
|
}
|
|
6814
6974
|
}
|
|
6815
6975
|
function listOpenClawTranscripts() {
|
|
6816
|
-
const agentsDir =
|
|
6976
|
+
const agentsDir = join14(openclawHome(), "agents");
|
|
6817
6977
|
const out = [];
|
|
6818
6978
|
let agentIds;
|
|
6819
6979
|
try {
|
|
@@ -6822,7 +6982,7 @@ function listOpenClawTranscripts() {
|
|
|
6822
6982
|
return out;
|
|
6823
6983
|
}
|
|
6824
6984
|
for (const agentId of agentIds) {
|
|
6825
|
-
const sessionsDir =
|
|
6985
|
+
const sessionsDir = join14(agentsDir, agentId, "sessions");
|
|
6826
6986
|
let files;
|
|
6827
6987
|
try {
|
|
6828
6988
|
files = readdirSync4(sessionsDir);
|
|
@@ -6835,10 +6995,16 @@ function listOpenClawTranscripts() {
|
|
|
6835
6995
|
const sessionId = file.slice(0, -".jsonl".length);
|
|
6836
6996
|
if (!OPENCLAW_SESSION_ID_RE.test(sessionId))
|
|
6837
6997
|
continue;
|
|
6838
|
-
const transcriptPath =
|
|
6998
|
+
const transcriptPath = join14(sessionsDir, file);
|
|
6839
6999
|
try {
|
|
6840
7000
|
const st = statSync6(transcriptPath);
|
|
6841
|
-
out.push({
|
|
7001
|
+
out.push({
|
|
7002
|
+
agentId,
|
|
7003
|
+
sessionId,
|
|
7004
|
+
transcriptPath,
|
|
7005
|
+
mtimeMs: st.mtimeMs,
|
|
7006
|
+
sizeBytes: st.size
|
|
7007
|
+
});
|
|
6842
7008
|
} catch {}
|
|
6843
7009
|
}
|
|
6844
7010
|
}
|
|
@@ -6854,6 +7020,25 @@ function findOpenClawTranscript(sessionId) {
|
|
|
6854
7020
|
return null;
|
|
6855
7021
|
}
|
|
6856
7022
|
async function getOpenClawSessionLog(sessionId) {
|
|
7023
|
+
if (!OPENCLAW_SESSION_ID_RE.test(sessionId))
|
|
7024
|
+
return null;
|
|
7025
|
+
const sqlite = await readOpenClawSqliteTranscript(openclawHome(), listOpenClawAgents(), sessionId);
|
|
7026
|
+
if (sqlite) {
|
|
7027
|
+
const entries = openclawLinesToLogEntries(sqlite.rawLines, "session");
|
|
7028
|
+
let cwd;
|
|
7029
|
+
for (const line of sqlite.rawLines) {
|
|
7030
|
+
if (line.type === "session" && typeof line.cwd === "string" && line.cwd.length > 0) {
|
|
7031
|
+
cwd = line.cwd;
|
|
7032
|
+
break;
|
|
7033
|
+
}
|
|
7034
|
+
}
|
|
7035
|
+
return {
|
|
7036
|
+
entries,
|
|
7037
|
+
rawLines: sqlite.rawLines,
|
|
7038
|
+
cwd,
|
|
7039
|
+
filePath: sqlite.filePath
|
|
7040
|
+
};
|
|
7041
|
+
}
|
|
6857
7042
|
const filePath = findOpenClawTranscript(sessionId);
|
|
6858
7043
|
if (!filePath)
|
|
6859
7044
|
return null;
|
|
@@ -6877,6 +7062,7 @@ async function getOpenClawSessionLog(sessionId) {
|
|
|
6877
7062
|
var OPENCLAW_SESSION_ID_RE, getCachedOpenClawSessionLog;
|
|
6878
7063
|
var init_openclaw_sessions = __esm(() => {
|
|
6879
7064
|
init_log_entries();
|
|
7065
|
+
init_openclaw_db();
|
|
6880
7066
|
OPENCLAW_SESSION_ID_RE = /^[0-9a-fA-F-]{36}$/;
|
|
6881
7067
|
getCachedOpenClawSessionLog = runtimeCache((sessionId) => getOpenClawSessionLog(sessionId), 2, { maxSize: 50 });
|
|
6882
7068
|
});
|
|
@@ -6887,13 +7073,13 @@ __export(exports_openclaw_projects, {
|
|
|
6887
7073
|
getOpenClawProjects: () => getOpenClawProjects
|
|
6888
7074
|
});
|
|
6889
7075
|
import { readFileSync as readFileSync7 } from "node:fs";
|
|
6890
|
-
import { join as
|
|
6891
|
-
function
|
|
7076
|
+
import { join as join15 } from "node:path";
|
|
7077
|
+
function str2(v) {
|
|
6892
7078
|
return typeof v === "string" && v.length > 0 ? v : undefined;
|
|
6893
7079
|
}
|
|
6894
7080
|
function readSessionsIndex(agentId) {
|
|
6895
7081
|
const out = new Map;
|
|
6896
|
-
const indexPath =
|
|
7082
|
+
const indexPath = join15(openclawHome(), "agents", agentId, "sessions", "sessions.json");
|
|
6897
7083
|
let raw;
|
|
6898
7084
|
try {
|
|
6899
7085
|
raw = JSON.parse(readFileSync7(indexPath, "utf-8"));
|
|
@@ -6906,17 +7092,17 @@ function readSessionsIndex(agentId) {
|
|
|
6906
7092
|
if (!v || typeof v !== "object")
|
|
6907
7093
|
continue;
|
|
6908
7094
|
const e = v;
|
|
6909
|
-
const sessionId =
|
|
7095
|
+
const sessionId = str2(e.sessionId);
|
|
6910
7096
|
if (!sessionId)
|
|
6911
7097
|
continue;
|
|
6912
7098
|
const origin = e.origin && typeof e.origin === "object" ? e.origin : {};
|
|
6913
7099
|
const lastMs = typeof e.lastInteractionAt === "number" ? e.lastInteractionAt : typeof e.updatedAt === "number" ? e.updatedAt : undefined;
|
|
6914
7100
|
out.set(sessionId, {
|
|
6915
7101
|
lastMs,
|
|
6916
|
-
channel:
|
|
6917
|
-
chatType:
|
|
6918
|
-
label:
|
|
6919
|
-
chatId:
|
|
7102
|
+
channel: str2(e.lastChannel) ?? str2(origin.provider) ?? str2(origin.surface),
|
|
7103
|
+
chatType: str2(e.chatType) ?? str2(origin.chatType),
|
|
7104
|
+
label: str2(origin.label),
|
|
7105
|
+
chatId: str2(e.lastTo) ?? str2(origin.from)
|
|
6920
7106
|
});
|
|
6921
7107
|
}
|
|
6922
7108
|
return out;
|
|
@@ -6924,7 +7110,7 @@ function readSessionsIndex(agentId) {
|
|
|
6924
7110
|
async function getOpenClawSessions() {
|
|
6925
7111
|
const transcripts = listOpenClawTranscripts();
|
|
6926
7112
|
const indexByAgent = new Map;
|
|
6927
|
-
const refs =
|
|
7113
|
+
const refs = new Map;
|
|
6928
7114
|
for (const t of transcripts) {
|
|
6929
7115
|
let idx = indexByAgent.get(t.agentId);
|
|
6930
7116
|
if (!idx) {
|
|
@@ -6932,7 +7118,7 @@ async function getOpenClawSessions() {
|
|
|
6932
7118
|
indexByAgent.set(t.agentId, idx);
|
|
6933
7119
|
}
|
|
6934
7120
|
const meta = idx.get(t.sessionId);
|
|
6935
|
-
refs.
|
|
7121
|
+
refs.set(`${t.agentId}\x00${t.sessionId}`, {
|
|
6936
7122
|
sessionId: t.sessionId,
|
|
6937
7123
|
agentId: t.agentId,
|
|
6938
7124
|
channel: meta?.channel ?? "local",
|
|
@@ -6944,8 +7130,11 @@ async function getOpenClawSessions() {
|
|
|
6944
7130
|
sizeBytes: t.sizeBytes
|
|
6945
7131
|
});
|
|
6946
7132
|
}
|
|
6947
|
-
|
|
6948
|
-
|
|
7133
|
+
const sqliteSessions = await listOpenClawSqliteSessions(openclawHome(), listOpenClawAgents());
|
|
7134
|
+
for (const s of sqliteSessions) {
|
|
7135
|
+
refs.set(`${s.agentId}\x00${s.sessionId}`, s);
|
|
7136
|
+
}
|
|
7137
|
+
return [...refs.values()].sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
6949
7138
|
}
|
|
6950
7139
|
function openClawProjectName(agentId, channel) {
|
|
6951
7140
|
return `openclaw-${agentId}-${channel}`;
|
|
@@ -6980,7 +7169,12 @@ async function getOpenClawProjects() {
|
|
|
6980
7169
|
prev.latest = Math.max(prev.latest, s.mtimeMs);
|
|
6981
7170
|
prev.count += 1;
|
|
6982
7171
|
} else {
|
|
6983
|
-
groups.set(key, {
|
|
7172
|
+
groups.set(key, {
|
|
7173
|
+
agentId: s.agentId,
|
|
7174
|
+
channel: s.channel,
|
|
7175
|
+
latest: s.mtimeMs,
|
|
7176
|
+
count: 1
|
|
7177
|
+
});
|
|
6984
7178
|
}
|
|
6985
7179
|
}
|
|
6986
7180
|
const out = [];
|
|
@@ -7038,6 +7232,7 @@ async function getOpenClawSessionsByEncodedName(name) {
|
|
|
7038
7232
|
var getCachedOpenClawSessions, getCachedOpenClawProjects, getCachedOpenClawSessionsByEncodedName;
|
|
7039
7233
|
var init_openclaw_projects = __esm(() => {
|
|
7040
7234
|
init_openclaw_sessions();
|
|
7235
|
+
init_openclaw_db();
|
|
7041
7236
|
getCachedOpenClawSessions = runtimeCache(getOpenClawSessions, 2);
|
|
7042
7237
|
getCachedOpenClawProjects = runtimeCache(getOpenClawProjects, 2);
|
|
7043
7238
|
getCachedOpenClawSessionsByEncodedName = runtimeCache((name) => getOpenClawSessionsByEncodedName(name), 2, { maxSize: 50 });
|
|
@@ -7047,12 +7242,12 @@ var init_openclaw_projects = __esm(() => {
|
|
|
7047
7242
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
7048
7243
|
import { readdirSync as readdirSync5, statSync as statSync7 } from "node:fs";
|
|
7049
7244
|
import { homedir as homedir12 } from "node:os";
|
|
7050
|
-
import { join as
|
|
7245
|
+
import { join as join16 } from "node:path";
|
|
7051
7246
|
function factoryHome() {
|
|
7052
|
-
return process.env.FACTORY_HOME ||
|
|
7247
|
+
return process.env.FACTORY_HOME || join16(homedir12(), ".factory");
|
|
7053
7248
|
}
|
|
7054
7249
|
function factorySessionsRoot() {
|
|
7055
|
-
return
|
|
7250
|
+
return join16(factoryHome(), "sessions");
|
|
7056
7251
|
}
|
|
7057
7252
|
function isPlainObject3(v) {
|
|
7058
7253
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -7198,7 +7393,7 @@ function listFactoryTranscripts() {
|
|
|
7198
7393
|
for (const dir of projectDirs) {
|
|
7199
7394
|
const projectName = dir.name;
|
|
7200
7395
|
const cwd = decodeFolderName(projectName);
|
|
7201
|
-
const projectPath =
|
|
7396
|
+
const projectPath = join16(root, projectName);
|
|
7202
7397
|
let files;
|
|
7203
7398
|
try {
|
|
7204
7399
|
files = readdirSync5(projectPath);
|
|
@@ -7211,7 +7406,7 @@ function listFactoryTranscripts() {
|
|
|
7211
7406
|
const sessionId = file.slice(0, -".jsonl".length);
|
|
7212
7407
|
if (!FACTORY_SESSION_ID_RE.test(sessionId))
|
|
7213
7408
|
continue;
|
|
7214
|
-
const transcriptPath =
|
|
7409
|
+
const transcriptPath = join16(projectPath, file);
|
|
7215
7410
|
try {
|
|
7216
7411
|
const st = statSync7(transcriptPath);
|
|
7217
7412
|
out.push({ projectName, cwd, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
@@ -7335,12 +7530,12 @@ var init_factory_projects = __esm(() => {
|
|
|
7335
7530
|
|
|
7336
7531
|
// lib/devin-sessions.ts
|
|
7337
7532
|
import { homedir as homedir13 } from "node:os";
|
|
7338
|
-
import { join as
|
|
7533
|
+
import { join as join17 } from "node:path";
|
|
7339
7534
|
function devinHome() {
|
|
7340
|
-
return process.env.DEVIN_HOME ||
|
|
7535
|
+
return process.env.DEVIN_HOME || join17(homedir13(), ".local", "share", "devin");
|
|
7341
7536
|
}
|
|
7342
7537
|
function devinDbPath() {
|
|
7343
|
-
return process.env.DEVIN_DB_PATH ||
|
|
7538
|
+
return process.env.DEVIN_DB_PATH || join17(devinHome(), "cli", "sessions.db");
|
|
7344
7539
|
}
|
|
7345
7540
|
function devinEpochToMs(value) {
|
|
7346
7541
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
@@ -7634,15 +7829,15 @@ var init_devin_projects = __esm(() => {
|
|
|
7634
7829
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
7635
7830
|
import { readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
|
|
7636
7831
|
import { homedir as homedir14 } from "node:os";
|
|
7637
|
-
import { join as
|
|
7832
|
+
import { join as join18 } from "node:path";
|
|
7638
7833
|
function antigravityHome() {
|
|
7639
|
-
return process.env.ANTIGRAVITY_HOME ||
|
|
7834
|
+
return process.env.ANTIGRAVITY_HOME || join18(homedir14(), ".gemini", "antigravity-cli");
|
|
7640
7835
|
}
|
|
7641
7836
|
function antigravityBrainRoot() {
|
|
7642
|
-
return
|
|
7837
|
+
return join18(antigravityHome(), "brain");
|
|
7643
7838
|
}
|
|
7644
7839
|
function antigravityTranscriptRelPath() {
|
|
7645
|
-
return
|
|
7840
|
+
return join18(".system_generated", "logs", "transcript_full.jsonl");
|
|
7646
7841
|
}
|
|
7647
7842
|
function isPlainObject5(v) {
|
|
7648
7843
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -7765,7 +7960,7 @@ function listAntigravityTranscripts() {
|
|
|
7765
7960
|
const conversationId = dir.name;
|
|
7766
7961
|
if (!ANTIGRAVITY_CONVERSATION_ID_RE.test(conversationId))
|
|
7767
7962
|
continue;
|
|
7768
|
-
const transcriptPath =
|
|
7963
|
+
const transcriptPath = join18(root, conversationId, rel);
|
|
7769
7964
|
try {
|
|
7770
7965
|
const st = statSync8(transcriptPath);
|
|
7771
7966
|
if (!st.isFile())
|
|
@@ -7778,7 +7973,7 @@ function listAntigravityTranscripts() {
|
|
|
7778
7973
|
function findAntigravityTranscript(conversationId) {
|
|
7779
7974
|
if (!ANTIGRAVITY_CONVERSATION_ID_RE.test(conversationId))
|
|
7780
7975
|
return null;
|
|
7781
|
-
const transcriptPath =
|
|
7976
|
+
const transcriptPath = join18(antigravityBrainRoot(), conversationId, antigravityTranscriptRelPath());
|
|
7782
7977
|
try {
|
|
7783
7978
|
if (statSync8(transcriptPath).isFile())
|
|
7784
7979
|
return transcriptPath;
|
|
@@ -7813,9 +8008,9 @@ var exports_antigravity_projects = {};
|
|
|
7813
8008
|
__export(exports_antigravity_projects, {
|
|
7814
8009
|
getAntigravityProjects: () => getAntigravityProjects
|
|
7815
8010
|
});
|
|
7816
|
-
import { join as
|
|
8011
|
+
import { join as join19 } from "node:path";
|
|
7817
8012
|
function antigravitySummariesDbPath() {
|
|
7818
|
-
return
|
|
8013
|
+
return join19(antigravityHome(), "conversation_summaries.db");
|
|
7819
8014
|
}
|
|
7820
8015
|
function parseWorkspaceCwd(raw) {
|
|
7821
8016
|
if (!raw)
|
|
@@ -7959,15 +8154,15 @@ var init_antigravity_projects = __esm(() => {
|
|
|
7959
8154
|
|
|
7960
8155
|
// lib/goose-sessions.ts
|
|
7961
8156
|
import { homedir as homedir15 } from "node:os";
|
|
7962
|
-
import { join as
|
|
8157
|
+
import { join as join20 } from "node:path";
|
|
7963
8158
|
function gooseHome() {
|
|
7964
8159
|
if (process.env.GOOSE_HOME)
|
|
7965
8160
|
return process.env.GOOSE_HOME;
|
|
7966
8161
|
const xdg = process.env.XDG_DATA_HOME;
|
|
7967
|
-
return
|
|
8162
|
+
return join20(xdg && xdg.length > 0 ? xdg : join20(homedir15(), ".local", "share"), "goose");
|
|
7968
8163
|
}
|
|
7969
8164
|
function gooseDbPath() {
|
|
7970
|
-
return process.env.GOOSE_DB_PATH ||
|
|
8165
|
+
return process.env.GOOSE_DB_PATH || join20(gooseHome(), "sessions", "sessions.db");
|
|
7971
8166
|
}
|
|
7972
8167
|
function gooseTimestampToMs(value) {
|
|
7973
8168
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
@@ -8230,7 +8425,7 @@ var init_goose_projects = __esm(() => {
|
|
|
8230
8425
|
|
|
8231
8426
|
// lib/projects.ts
|
|
8232
8427
|
import { readdir as readdir5, stat as stat4 } from "node:fs/promises";
|
|
8233
|
-
import { join as
|
|
8428
|
+
import { join as join21, resolve as resolve9, sep } from "node:path";
|
|
8234
8429
|
async function getMtime(path, label) {
|
|
8235
8430
|
try {
|
|
8236
8431
|
return (await stat4(path)).mtime;
|
|
@@ -8256,7 +8451,7 @@ async function getClaudeProjectFolders() {
|
|
|
8256
8451
|
if (!entries)
|
|
8257
8452
|
return [];
|
|
8258
8453
|
const settled = await batchAll(entries.filter((entry) => entry.isDirectory()).map((entry) => async () => {
|
|
8259
|
-
const folderPath =
|
|
8454
|
+
const folderPath = join21(projectsPath, entry.name);
|
|
8260
8455
|
const mtime = await getMtime(folderPath, entry.name);
|
|
8261
8456
|
return {
|
|
8262
8457
|
name: entry.name,
|
|
@@ -8383,7 +8578,7 @@ function resolveProjectPath(projectName) {
|
|
|
8383
8578
|
if (/^[/\\]/.test(projectName))
|
|
8384
8579
|
throw new RangeError("Absolute project name");
|
|
8385
8580
|
const projectsPath = resolve9(getClaudeProjectsPath());
|
|
8386
|
-
const candidate = resolve9(
|
|
8581
|
+
const candidate = resolve9(join21(projectsPath, projectName));
|
|
8387
8582
|
if (!candidate.startsWith(projectsPath + sep)) {
|
|
8388
8583
|
throw new RangeError("Project path escapes root");
|
|
8389
8584
|
}
|
|
@@ -8401,7 +8596,7 @@ async function getSessionFiles(projectPath) {
|
|
|
8401
8596
|
return [];
|
|
8402
8597
|
const jsonlEntries = entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl") && extractSessionId2(entry.name));
|
|
8403
8598
|
const settled = await batchAll(jsonlEntries.map((entry) => async () => {
|
|
8404
|
-
const filePath =
|
|
8599
|
+
const filePath = join21(projectPath, entry.name);
|
|
8405
8600
|
const mtime = await getMtime(filePath, entry.name);
|
|
8406
8601
|
return {
|
|
8407
8602
|
name: entry.name,
|
|
@@ -8430,13 +8625,13 @@ var init_projects = __esm(() => {
|
|
|
8430
8625
|
|
|
8431
8626
|
// lib/resolve-subagent-path.ts
|
|
8432
8627
|
import { access as access2 } from "fs/promises";
|
|
8433
|
-
import { join as
|
|
8628
|
+
import { join as join22, relative as relative3 } from "path";
|
|
8434
8629
|
async function resolveSubagentPath(projectsPath, projectName, sessionId, agentId) {
|
|
8435
8630
|
const fileName = `agent-${agentId}.jsonl`;
|
|
8436
8631
|
const candidatePaths = [
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8632
|
+
join22(projectsPath, projectName, fileName),
|
|
8633
|
+
join22(projectsPath, projectName, sessionId, fileName),
|
|
8634
|
+
join22(projectsPath, projectName, sessionId, "subagents", fileName)
|
|
8440
8635
|
];
|
|
8441
8636
|
for (const candidatePath of candidatePaths) {
|
|
8442
8637
|
if (relative3(projectsPath, candidatePath).startsWith("..")) {
|
|
@@ -8458,7 +8653,7 @@ var init_resolve_subagent_path = () => {};
|
|
|
8458
8653
|
|
|
8459
8654
|
// lib/log-entries.ts
|
|
8460
8655
|
import { readFile as readFile10 } from "fs/promises";
|
|
8461
|
-
import { join as
|
|
8656
|
+
import { join as join23 } from "path";
|
|
8462
8657
|
function formatTimestamp(date) {
|
|
8463
8658
|
const base = formatDate(date);
|
|
8464
8659
|
const ms = date.getMilliseconds().toString().padStart(3, "0");
|
|
@@ -8652,7 +8847,7 @@ async function parseFileContent(fileContent, source) {
|
|
|
8652
8847
|
async function parseSessionLog(projectName, sessionId) {
|
|
8653
8848
|
const projectDir = resolveProjectPath(projectName);
|
|
8654
8849
|
const projectsPath = getClaudeProjectsPath();
|
|
8655
|
-
const filePath =
|
|
8850
|
+
const filePath = join23(projectDir, `${sessionId}.jsonl`);
|
|
8656
8851
|
const fileContent = await readFile10(filePath, "utf-8");
|
|
8657
8852
|
const { entries: sessionEntries, rawLines: sessionRawLines, subagentIds } = await parseFileContent(fileContent, "session");
|
|
8658
8853
|
if (subagentIds.length === 0) {
|
|
@@ -8689,13 +8884,13 @@ var init_log_entries = __esm(() => {
|
|
|
8689
8884
|
});
|
|
8690
8885
|
|
|
8691
8886
|
// lib/codex-sessions.ts
|
|
8692
|
-
import { readFileSync as readFileSync8, readdirSync as readdirSync7, existsSync as
|
|
8887
|
+
import { readFileSync as readFileSync8, readdirSync as readdirSync7, existsSync as existsSync10, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5, statSync as statSync9 } from "node:fs";
|
|
8693
8888
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
8694
|
-
import { dirname as dirname4, join as
|
|
8889
|
+
import { dirname as dirname4, join as join24 } from "node:path";
|
|
8695
8890
|
import { homedir as homedir16 } from "node:os";
|
|
8696
8891
|
function readCache() {
|
|
8697
8892
|
try {
|
|
8698
|
-
if (!
|
|
8893
|
+
if (!existsSync10(CACHE_PATH))
|
|
8699
8894
|
return {};
|
|
8700
8895
|
return JSON.parse(readFileSync8(CACHE_PATH, "utf-8"));
|
|
8701
8896
|
} catch {
|
|
@@ -8714,7 +8909,7 @@ function dirSearch(dir, sessionId) {
|
|
|
8714
8909
|
try {
|
|
8715
8910
|
for (const f of readdirSync7(dir, { withFileTypes: true })) {
|
|
8716
8911
|
if (f.isFile() && f.name.includes(sessionId) && f.name.endsWith(".jsonl")) {
|
|
8717
|
-
return
|
|
8912
|
+
return join24(dir, f.name);
|
|
8718
8913
|
}
|
|
8719
8914
|
}
|
|
8720
8915
|
} catch {}
|
|
@@ -8723,16 +8918,16 @@ function dirSearch(dir, sessionId) {
|
|
|
8723
8918
|
function findCodexTranscript(sessionId) {
|
|
8724
8919
|
const cache = readCache();
|
|
8725
8920
|
const cached = cache[sessionId];
|
|
8726
|
-
if (cached &&
|
|
8921
|
+
if (cached && existsSync10(cached))
|
|
8727
8922
|
return cached;
|
|
8728
|
-
const root =
|
|
8923
|
+
const root = join24(homedir16(), ".codex", "sessions");
|
|
8729
8924
|
const today = new Date;
|
|
8730
8925
|
const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
|
|
8731
8926
|
const datedDirs = [today, yesterday].map((d) => {
|
|
8732
8927
|
const y = String(d.getUTCFullYear());
|
|
8733
8928
|
const m = String(d.getUTCMonth() + 1).padStart(2, "0");
|
|
8734
8929
|
const day = String(d.getUTCDate()).padStart(2, "0");
|
|
8735
|
-
return
|
|
8930
|
+
return join24(root, y, m, day);
|
|
8736
8931
|
});
|
|
8737
8932
|
for (const dir of datedDirs) {
|
|
8738
8933
|
const hit = dirSearch(dir, sessionId);
|
|
@@ -8745,13 +8940,13 @@ function findCodexTranscript(sessionId) {
|
|
|
8745
8940
|
for (const y of readdirSync7(root, { withFileTypes: true })) {
|
|
8746
8941
|
if (!y.isDirectory())
|
|
8747
8942
|
continue;
|
|
8748
|
-
for (const m of readdirSync7(
|
|
8943
|
+
for (const m of readdirSync7(join24(root, y.name), { withFileTypes: true })) {
|
|
8749
8944
|
if (!m.isDirectory())
|
|
8750
8945
|
continue;
|
|
8751
|
-
for (const d of readdirSync7(
|
|
8946
|
+
for (const d of readdirSync7(join24(root, y.name, m.name), { withFileTypes: true })) {
|
|
8752
8947
|
if (!d.isDirectory())
|
|
8753
8948
|
continue;
|
|
8754
|
-
const hit = dirSearch(
|
|
8949
|
+
const hit = dirSearch(join24(root, y.name, m.name, d.name), sessionId);
|
|
8755
8950
|
if (hit) {
|
|
8756
8951
|
writeCacheEntry(sessionId, hit);
|
|
8757
8952
|
return hit;
|
|
@@ -9027,15 +9222,15 @@ var init_resolve_permission_mode = __esm(() => {
|
|
|
9027
9222
|
});
|
|
9028
9223
|
|
|
9029
9224
|
// lib/copilot-sessions.ts
|
|
9030
|
-
import { readFileSync as readFileSync10, readdirSync as readdirSync8, existsSync as
|
|
9225
|
+
import { readFileSync as readFileSync10, readdirSync as readdirSync8, existsSync as existsSync11, statSync as statSync10 } from "node:fs";
|
|
9031
9226
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
9032
|
-
import { join as
|
|
9227
|
+
import { join as join25, resolve as resolve10, sep as sep2 } from "node:path";
|
|
9033
9228
|
import { homedir as homedir17 } from "node:os";
|
|
9034
9229
|
function getCopilotHome() {
|
|
9035
|
-
return process.env.COPILOT_HOME ||
|
|
9230
|
+
return process.env.COPILOT_HOME || join25(homedir17(), ".copilot");
|
|
9036
9231
|
}
|
|
9037
9232
|
function getCopilotSessionStateRoot2() {
|
|
9038
|
-
return
|
|
9233
|
+
return join25(getCopilotHome(), "session-state");
|
|
9039
9234
|
}
|
|
9040
9235
|
function getCopilotSessionDir(sessionId) {
|
|
9041
9236
|
if (!sessionId)
|
|
@@ -9050,19 +9245,19 @@ function resolveSessionFile(sessionId, filename) {
|
|
|
9050
9245
|
const dir = getCopilotSessionDir(sessionId);
|
|
9051
9246
|
if (!dir)
|
|
9052
9247
|
return null;
|
|
9053
|
-
return
|
|
9248
|
+
return join25(dir, filename);
|
|
9054
9249
|
}
|
|
9055
9250
|
function findCopilotTranscript(sessionId) {
|
|
9056
9251
|
const candidate = resolveSessionFile(sessionId, "events.jsonl");
|
|
9057
9252
|
if (!candidate)
|
|
9058
9253
|
return null;
|
|
9059
|
-
return
|
|
9254
|
+
return existsSync11(candidate) ? candidate : null;
|
|
9060
9255
|
}
|
|
9061
9256
|
function findCopilotWorkspace(sessionId) {
|
|
9062
9257
|
const candidate = resolveSessionFile(sessionId, "workspace.yaml");
|
|
9063
9258
|
if (!candidate)
|
|
9064
9259
|
return null;
|
|
9065
|
-
return
|
|
9260
|
+
return existsSync11(candidate) ? candidate : null;
|
|
9066
9261
|
}
|
|
9067
9262
|
function readYamlScalar(path, key) {
|
|
9068
9263
|
try {
|
|
@@ -9263,12 +9458,12 @@ var init_copilot_sessions = __esm(() => {
|
|
|
9263
9458
|
});
|
|
9264
9459
|
|
|
9265
9460
|
// lib/cursor-sessions.ts
|
|
9266
|
-
import { readFileSync as readFileSync11, readdirSync as readdirSync9, existsSync as
|
|
9461
|
+
import { readFileSync as readFileSync11, readdirSync as readdirSync9, existsSync as existsSync12, statSync as statSync11 } from "node:fs";
|
|
9267
9462
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
9268
|
-
import { basename as basename3, join as
|
|
9463
|
+
import { basename as basename3, join as join26, resolve as resolve11, sep as sep3 } from "node:path";
|
|
9269
9464
|
import { homedir as homedir18 } from "node:os";
|
|
9270
9465
|
function getCursorHome2() {
|
|
9271
|
-
return process.env.CURSOR_HOME ||
|
|
9466
|
+
return process.env.CURSOR_HOME || join26(homedir18(), ".cursor");
|
|
9272
9467
|
}
|
|
9273
9468
|
function getCursorSessionDir(sessionId) {
|
|
9274
9469
|
if (!sessionId)
|
|
@@ -9286,7 +9481,7 @@ function getCursorSessionDir(sessionId) {
|
|
|
9286
9481
|
const transcriptRoot = resolve11(projectsRoot, entry.name, NEW_AGENT_TRANSCRIPTS_DIR2);
|
|
9287
9482
|
if (candidate === transcriptRoot || !candidate.startsWith(`${transcriptRoot}${sep3}`))
|
|
9288
9483
|
continue;
|
|
9289
|
-
if (
|
|
9484
|
+
if (existsSync12(candidate))
|
|
9290
9485
|
return candidate;
|
|
9291
9486
|
}
|
|
9292
9487
|
for (const sub of LEGACY_SESSION_ROOT_CANDIDATES2) {
|
|
@@ -9294,7 +9489,7 @@ function getCursorSessionDir(sessionId) {
|
|
|
9294
9489
|
const candidate = resolve11(root, sessionId);
|
|
9295
9490
|
if (candidate === root || !candidate.startsWith(`${root}${sep3}`))
|
|
9296
9491
|
continue;
|
|
9297
|
-
if (
|
|
9492
|
+
if (existsSync12(candidate))
|
|
9298
9493
|
return candidate;
|
|
9299
9494
|
}
|
|
9300
9495
|
return null;
|
|
@@ -9303,12 +9498,12 @@ function findCursorTranscript(sessionId) {
|
|
|
9303
9498
|
const dir = getCursorSessionDir(sessionId);
|
|
9304
9499
|
if (!dir)
|
|
9305
9500
|
return null;
|
|
9306
|
-
const newCandidate =
|
|
9307
|
-
if (
|
|
9501
|
+
const newCandidate = join26(dir, `${basename3(dir)}.jsonl`);
|
|
9502
|
+
if (existsSync12(newCandidate))
|
|
9308
9503
|
return newCandidate;
|
|
9309
9504
|
for (const name of LEGACY_TRANSCRIPT_FILE_CANDIDATES2) {
|
|
9310
|
-
const candidate =
|
|
9311
|
-
if (
|
|
9505
|
+
const candidate = join26(dir, name);
|
|
9506
|
+
if (existsSync12(candidate))
|
|
9312
9507
|
return candidate;
|
|
9313
9508
|
}
|
|
9314
9509
|
return null;
|
|
@@ -9562,12 +9757,12 @@ var init_cursor_sessions = __esm(() => {
|
|
|
9562
9757
|
});
|
|
9563
9758
|
|
|
9564
9759
|
// lib/pi-sessions.ts
|
|
9565
|
-
import { readFileSync as readFileSync12, readdirSync as readdirSync10, existsSync as
|
|
9760
|
+
import { readFileSync as readFileSync12, readdirSync as readdirSync10, existsSync as existsSync13, statSync as statSync12 } from "node:fs";
|
|
9566
9761
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
9567
|
-
import { join as
|
|
9762
|
+
import { join as join27, resolve as resolve12, sep as sep4 } from "node:path";
|
|
9568
9763
|
import { homedir as homedir19 } from "node:os";
|
|
9569
9764
|
function getPiSessionStateRoot() {
|
|
9570
|
-
return process.env.PI_SESSIONS_DIR ||
|
|
9765
|
+
return process.env.PI_SESSIONS_DIR || join27(homedir19(), ".pi", "agent", "sessions");
|
|
9571
9766
|
}
|
|
9572
9767
|
function isSafeSessionId(sessionId) {
|
|
9573
9768
|
return UUID_RE.test(sessionId);
|
|
@@ -9599,7 +9794,7 @@ function findPiTranscript(sessionId) {
|
|
|
9599
9794
|
const candidate = resolve12(cwdPath, f);
|
|
9600
9795
|
if (!candidate.startsWith(`${cwdPath}${sep4}`))
|
|
9601
9796
|
continue;
|
|
9602
|
-
if (
|
|
9797
|
+
if (existsSync13(candidate))
|
|
9603
9798
|
return candidate;
|
|
9604
9799
|
}
|
|
9605
9800
|
}
|
|
@@ -9959,9 +10154,9 @@ var init_pack_failclosed = __esm(() => {
|
|
|
9959
10154
|
var init_atomic_write = () => {};
|
|
9960
10155
|
|
|
9961
10156
|
// src/hooks/session-pause.ts
|
|
9962
|
-
import { existsSync as
|
|
10157
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync6, readdirSync as readdirSync11, readFileSync as readFileSync13, rmSync as rmSync2 } from "node:fs";
|
|
9963
10158
|
import { createHash as createHash5 } from "node:crypto";
|
|
9964
|
-
import { join as
|
|
10159
|
+
import { join as join28, resolve as resolve13 } from "node:path";
|
|
9965
10160
|
function pauseStateDir() {
|
|
9966
10161
|
const override = process.env.FAILPROOFAI_STATE_DIR;
|
|
9967
10162
|
if (override)
|
|
@@ -9970,7 +10165,7 @@ function pauseStateDir() {
|
|
|
9970
10165
|
}
|
|
9971
10166
|
function pauseFilePath(sessionId) {
|
|
9972
10167
|
const digest = createHash5("sha256").update(sessionId).digest("hex").slice(0, 32);
|
|
9973
|
-
return
|
|
10168
|
+
return join28(pauseStateDir(), `${digest}.json`);
|
|
9974
10169
|
}
|
|
9975
10170
|
function parseStored(raw) {
|
|
9976
10171
|
if (!raw || typeof raw !== "object")
|
|
@@ -9999,7 +10194,7 @@ function readActivePause(sessionId, now = Date.now()) {
|
|
|
9999
10194
|
return null;
|
|
10000
10195
|
try {
|
|
10001
10196
|
const path = pauseFilePath(sessionId);
|
|
10002
|
-
if (!
|
|
10197
|
+
if (!existsSync14(path))
|
|
10003
10198
|
return null;
|
|
10004
10199
|
const stored = parseStored(JSON.parse(readFileSync13(path, "utf8")));
|
|
10005
10200
|
if (!stored)
|
|
@@ -10040,7 +10235,7 @@ var init_daemon_service = __esm(() => {
|
|
|
10040
10235
|
// src/hooks/fp-reset.ts
|
|
10041
10236
|
import {
|
|
10042
10237
|
copyFileSync,
|
|
10043
|
-
existsSync as
|
|
10238
|
+
existsSync as existsSync15,
|
|
10044
10239
|
mkdirSync as mkdirSync7,
|
|
10045
10240
|
readFileSync as readFileSync14,
|
|
10046
10241
|
readdirSync as readdirSync12,
|
|
@@ -10057,7 +10252,7 @@ function layoutWarningForHook() {
|
|
|
10057
10252
|
if (state.kind === "future") {
|
|
10058
10253
|
return `[failproofai] this directory was written by a newer version (layout ${state.found} vs ${LAYOUT_VERSION}) — policies are NOT being enforced. ` + `Upgrade failproofai.`;
|
|
10059
10254
|
}
|
|
10060
|
-
if (
|
|
10255
|
+
if (existsSync15(globalPolicyConfigFile()))
|
|
10061
10256
|
return null;
|
|
10062
10257
|
return `[failproofai] setup predates this version — global policies are NOT being enforced. ` + `Run \`failproofai config\` to re-create it.`;
|
|
10063
10258
|
}
|
|
@@ -10434,7 +10629,7 @@ var init_handler = __esm(() => {
|
|
|
10434
10629
|
|
|
10435
10630
|
// src/hooks/worker-server.ts
|
|
10436
10631
|
import { createConnection, createServer } from "node:net";
|
|
10437
|
-
import { existsSync as
|
|
10632
|
+
import { existsSync as existsSync16, unlinkSync as unlinkSync2 } from "node:fs";
|
|
10438
10633
|
function isWorkerHookRequest(msg) {
|
|
10439
10634
|
if (!msg || typeof msg !== "object")
|
|
10440
10635
|
return false;
|
|
@@ -10567,14 +10762,14 @@ function requestExistingWorkerShutdown(socketPath) {
|
|
|
10567
10762
|
function startWorkerServer(socketPath, shutdown) {
|
|
10568
10763
|
const server = createServer((socket) => handleConnection(socket, shutdown ?? (() => server.close())));
|
|
10569
10764
|
const listen = () => {
|
|
10570
|
-
if (
|
|
10765
|
+
if (existsSync16(socketPath)) {
|
|
10571
10766
|
try {
|
|
10572
10767
|
unlinkSync2(socketPath);
|
|
10573
10768
|
} catch {}
|
|
10574
10769
|
}
|
|
10575
10770
|
server.listen(socketPath);
|
|
10576
10771
|
};
|
|
10577
|
-
if (!
|
|
10772
|
+
if (!existsSync16(socketPath))
|
|
10578
10773
|
listen();
|
|
10579
10774
|
else
|
|
10580
10775
|
requestExistingWorkerShutdown(socketPath).then(listen, (err) => server.emit("error", err));
|