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/cli.mjs
CHANGED
|
@@ -29,7 +29,7 @@ var __esm = (fn, res, err) => () => {
|
|
|
29
29
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
30
30
|
|
|
31
31
|
// package.json
|
|
32
|
-
var version2 = "1.0.4-beta.
|
|
32
|
+
var version2 = "1.0.4-beta.8", package_default;
|
|
33
33
|
var init_package = __esm(() => {
|
|
34
34
|
package_default = {
|
|
35
35
|
name: "failproofai",
|
|
@@ -154,16 +154,16 @@ var init_package = __esm(() => {
|
|
|
154
154
|
browserslist: "4.28.8"
|
|
155
155
|
},
|
|
156
156
|
optionalDependencies: {
|
|
157
|
-
"@failproofai/failproofaid-linux-x64": "1.0.4-beta.
|
|
158
|
-
"@failproofai/failproofaid-linux-arm64": "1.0.4-beta.
|
|
159
|
-
"@failproofai/failproofaid-darwin-x64": "1.0.4-beta.
|
|
160
|
-
"@failproofai/failproofaid-darwin-arm64": "1.0.4-beta.
|
|
157
|
+
"@failproofai/failproofaid-linux-x64": "1.0.4-beta.8",
|
|
158
|
+
"@failproofai/failproofaid-linux-arm64": "1.0.4-beta.8",
|
|
159
|
+
"@failproofai/failproofaid-darwin-x64": "1.0.4-beta.8",
|
|
160
|
+
"@failproofai/failproofaid-darwin-arm64": "1.0.4-beta.8"
|
|
161
161
|
},
|
|
162
162
|
failproofaidBinaries: {
|
|
163
|
-
"linux-x64": "
|
|
164
|
-
"linux-arm64": "
|
|
165
|
-
"darwin-x64": "
|
|
166
|
-
"darwin-arm64": "
|
|
163
|
+
"linux-x64": "17274c1da30675b49de74953a4ce2777e09ba07b9da79250ab155e5fdb316a0a",
|
|
164
|
+
"linux-arm64": "a07b228d899914baca1c75024be19c0319eb4fc40c6d5a303ba733bf6721924a",
|
|
165
|
+
"darwin-x64": "d170fd5604cb419bc83f4a5ab1a6cb5be2f9aec957aed99ce237990aa5d3966f",
|
|
166
|
+
"darwin-arm64": "0e2bde5bd0762641fa072a6640e485c637b2102f2fb6c1afeca679f005e89679"
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
169
|
});
|
|
@@ -17905,13 +17905,169 @@ var init_hermes_projects = __esm(() => {
|
|
|
17905
17905
|
getCachedHermesSessionsByEncodedName = runtimeCache((name) => getHermesSessionsByEncodedName(name), 2, { maxSize: 50 });
|
|
17906
17906
|
});
|
|
17907
17907
|
|
|
17908
|
+
// lib/openclaw-db.ts
|
|
17909
|
+
import { existsSync as existsSync12 } from "node:fs";
|
|
17910
|
+
import { join as join14 } from "node:path";
|
|
17911
|
+
function str(value) {
|
|
17912
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
17913
|
+
}
|
|
17914
|
+
function parseObject(value) {
|
|
17915
|
+
try {
|
|
17916
|
+
const parsed = JSON.parse(value);
|
|
17917
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : undefined;
|
|
17918
|
+
} catch {
|
|
17919
|
+
return;
|
|
17920
|
+
}
|
|
17921
|
+
}
|
|
17922
|
+
function syntheticPath(agentId, sessionId) {
|
|
17923
|
+
return `openclaw-sqlite://${encodeURIComponent(agentId)}/${sessionId}`;
|
|
17924
|
+
}
|
|
17925
|
+
function listOpenClawDatabases(home, agentIds) {
|
|
17926
|
+
const out = [];
|
|
17927
|
+
for (const agentId of agentIds) {
|
|
17928
|
+
const dbPath = join14(home, "agents", agentId, "agent", DB_NAME);
|
|
17929
|
+
if (existsSync12(dbPath))
|
|
17930
|
+
out.push({ agentId, dbPath });
|
|
17931
|
+
}
|
|
17932
|
+
return out;
|
|
17933
|
+
}
|
|
17934
|
+
function readNodeMetadata(db) {
|
|
17935
|
+
const out = new Map;
|
|
17936
|
+
let rows;
|
|
17937
|
+
try {
|
|
17938
|
+
rows = db.query(`SELECT current_session_id, entry_json, label, display_name
|
|
17939
|
+
FROM session_nodes`);
|
|
17940
|
+
} catch {
|
|
17941
|
+
return out;
|
|
17942
|
+
}
|
|
17943
|
+
for (const row of rows) {
|
|
17944
|
+
const entry = parseObject(row.entry_json) ?? {};
|
|
17945
|
+
const origin = entry.origin && typeof entry.origin === "object" && !Array.isArray(entry.origin) ? entry.origin : {};
|
|
17946
|
+
out.set(row.current_session_id, {
|
|
17947
|
+
channel: str(entry.lastChannel) ?? str(origin.provider) ?? str(origin.surface),
|
|
17948
|
+
label: str(row.label) ?? str(row.display_name) ?? str(entry.displayName) ?? str(origin.label),
|
|
17949
|
+
chatId: str(entry.lastTo) ?? str(origin.from),
|
|
17950
|
+
chatType: str(entry.chatType) ?? str(origin.chatType)
|
|
17951
|
+
});
|
|
17952
|
+
}
|
|
17953
|
+
return out;
|
|
17954
|
+
}
|
|
17955
|
+
function readConversationMetadata(db) {
|
|
17956
|
+
const out = new Map;
|
|
17957
|
+
let rows;
|
|
17958
|
+
try {
|
|
17959
|
+
rows = db.query(`SELECT sc.session_id, c.channel, c.kind, c.peer_id,
|
|
17960
|
+
c.delivery_target, c.label
|
|
17961
|
+
FROM session_conversations sc
|
|
17962
|
+
JOIN conversations c ON c.conversation_id = sc.conversation_id
|
|
17963
|
+
ORDER BY CASE sc.role WHEN 'primary' THEN 0 ELSE 1 END, sc.last_seen_at DESC`);
|
|
17964
|
+
} catch {
|
|
17965
|
+
return out;
|
|
17966
|
+
}
|
|
17967
|
+
for (const row of rows) {
|
|
17968
|
+
if (out.has(row.session_id))
|
|
17969
|
+
continue;
|
|
17970
|
+
out.set(row.session_id, {
|
|
17971
|
+
channel: str(row.channel),
|
|
17972
|
+
label: str(row.label),
|
|
17973
|
+
chatId: str(row.delivery_target) ?? str(row.peer_id),
|
|
17974
|
+
chatType: str(row.kind)
|
|
17975
|
+
});
|
|
17976
|
+
}
|
|
17977
|
+
return out;
|
|
17978
|
+
}
|
|
17979
|
+
async function listOpenClawSqliteSessions(home, agentIds) {
|
|
17980
|
+
const sessions = [];
|
|
17981
|
+
for (const { agentId, dbPath } of listOpenClawDatabases(home, agentIds)) {
|
|
17982
|
+
const db = await openSqliteReadonly(dbPath);
|
|
17983
|
+
if (!db)
|
|
17984
|
+
continue;
|
|
17985
|
+
try {
|
|
17986
|
+
let rows;
|
|
17987
|
+
try {
|
|
17988
|
+
rows = db.query(`SELECT w.session_id, w.session_key, w.updated_at,
|
|
17989
|
+
w.transcript_updated_at, w.ended_at, w.channel,
|
|
17990
|
+
w.chat_type, w.display_name,
|
|
17991
|
+
COALESCE((SELECT MAX(e.created_at)
|
|
17992
|
+
FROM transcript_events e
|
|
17993
|
+
WHERE e.session_id = w.session_id), 0) AS event_updated_at,
|
|
17994
|
+
COALESCE((SELECT SUM(length(e.event_json) + 1)
|
|
17995
|
+
FROM transcript_events e
|
|
17996
|
+
WHERE e.session_id = w.session_id), 0) AS size_bytes
|
|
17997
|
+
FROM session_windows w
|
|
17998
|
+
WHERE EXISTS (SELECT 1 FROM transcript_events e
|
|
17999
|
+
WHERE e.session_id = w.session_id)`);
|
|
18000
|
+
} catch {
|
|
18001
|
+
continue;
|
|
18002
|
+
}
|
|
18003
|
+
const nodes = readNodeMetadata(db);
|
|
18004
|
+
const conversations = readConversationMetadata(db);
|
|
18005
|
+
for (const row of rows) {
|
|
18006
|
+
const node = nodes.get(row.session_id);
|
|
18007
|
+
const conversation = conversations.get(row.session_id);
|
|
18008
|
+
sessions.push({
|
|
18009
|
+
sessionId: row.session_id,
|
|
18010
|
+
agentId,
|
|
18011
|
+
dbPath,
|
|
18012
|
+
transcriptPath: syntheticPath(agentId, row.session_id),
|
|
18013
|
+
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),
|
|
18014
|
+
sizeBytes: Number(row.size_bytes) || 0,
|
|
18015
|
+
channel: str(row.channel) ?? conversation?.channel ?? node?.channel ?? "local",
|
|
18016
|
+
label: str(row.display_name) ?? conversation?.label ?? node?.label,
|
|
18017
|
+
chatId: conversation?.chatId ?? node?.chatId,
|
|
18018
|
+
chatType: str(row.chat_type) ?? conversation?.chatType ?? node?.chatType
|
|
18019
|
+
});
|
|
18020
|
+
}
|
|
18021
|
+
} finally {
|
|
18022
|
+
db.close();
|
|
18023
|
+
}
|
|
18024
|
+
}
|
|
18025
|
+
return sessions;
|
|
18026
|
+
}
|
|
18027
|
+
async function readOpenClawSqliteTranscript(home, agentIds, sessionId) {
|
|
18028
|
+
for (const { agentId, dbPath } of listOpenClawDatabases(home, agentIds)) {
|
|
18029
|
+
const db = await openSqliteReadonly(dbPath);
|
|
18030
|
+
if (!db)
|
|
18031
|
+
continue;
|
|
18032
|
+
try {
|
|
18033
|
+
let rows;
|
|
18034
|
+
try {
|
|
18035
|
+
rows = db.query(`SELECT event_json
|
|
18036
|
+
FROM transcript_events
|
|
18037
|
+
WHERE session_id = ?
|
|
18038
|
+
ORDER BY seq ASC`, [sessionId]);
|
|
18039
|
+
} catch {
|
|
18040
|
+
continue;
|
|
18041
|
+
}
|
|
18042
|
+
if (rows.length === 0)
|
|
18043
|
+
continue;
|
|
18044
|
+
const eventJsonLines = rows.map((row) => row.event_json);
|
|
18045
|
+
const rawLines = eventJsonLines.map(parseObject).filter((line) => line !== undefined);
|
|
18046
|
+
return {
|
|
18047
|
+
agentId,
|
|
18048
|
+
dbPath,
|
|
18049
|
+
filePath: syntheticPath(agentId, sessionId),
|
|
18050
|
+
rawLines,
|
|
18051
|
+
eventJsonLines
|
|
18052
|
+
};
|
|
18053
|
+
} finally {
|
|
18054
|
+
db.close();
|
|
18055
|
+
}
|
|
18056
|
+
}
|
|
18057
|
+
return null;
|
|
18058
|
+
}
|
|
18059
|
+
var DB_NAME = "openclaw-agent.sqlite";
|
|
18060
|
+
var init_openclaw_db = __esm(() => {
|
|
18061
|
+
init_sqlite_reader();
|
|
18062
|
+
});
|
|
18063
|
+
|
|
17908
18064
|
// lib/openclaw-sessions.ts
|
|
17909
18065
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
17910
18066
|
import { readdirSync as readdirSync5, statSync as statSync7 } from "node:fs";
|
|
17911
18067
|
import { homedir as homedir12 } from "node:os";
|
|
17912
|
-
import { join as
|
|
18068
|
+
import { join as join15 } from "node:path";
|
|
17913
18069
|
function openclawHome() {
|
|
17914
|
-
return process.env.OPENCLAW_HOME ||
|
|
18070
|
+
return process.env.OPENCLAW_STATE_DIR || process.env.OPENCLAW_HOME || join15(homedir12(), ".openclaw");
|
|
17915
18071
|
}
|
|
17916
18072
|
function isPlainObject3(v) {
|
|
17917
18073
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -17998,7 +18154,11 @@ function openclawLinesToLogEntries(lines, source = "session") {
|
|
|
17998
18154
|
entries.push({
|
|
17999
18155
|
type: "assistant",
|
|
18000
18156
|
...base,
|
|
18001
|
-
message: {
|
|
18157
|
+
message: {
|
|
18158
|
+
role: "assistant",
|
|
18159
|
+
content: blocks,
|
|
18160
|
+
model: typeof m.model === "string" ? m.model : undefined
|
|
18161
|
+
}
|
|
18002
18162
|
});
|
|
18003
18163
|
continue;
|
|
18004
18164
|
}
|
|
@@ -18026,13 +18186,13 @@ function openclawLinesToLogEntries(lines, source = "session") {
|
|
|
18026
18186
|
}
|
|
18027
18187
|
function listOpenClawAgents() {
|
|
18028
18188
|
try {
|
|
18029
|
-
return readdirSync5(
|
|
18189
|
+
return readdirSync5(join15(openclawHome(), "agents"), { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name).sort();
|
|
18030
18190
|
} catch {
|
|
18031
18191
|
return [];
|
|
18032
18192
|
}
|
|
18033
18193
|
}
|
|
18034
18194
|
function listOpenClawTranscripts() {
|
|
18035
|
-
const agentsDir =
|
|
18195
|
+
const agentsDir = join15(openclawHome(), "agents");
|
|
18036
18196
|
const out = [];
|
|
18037
18197
|
let agentIds;
|
|
18038
18198
|
try {
|
|
@@ -18041,7 +18201,7 @@ function listOpenClawTranscripts() {
|
|
|
18041
18201
|
return out;
|
|
18042
18202
|
}
|
|
18043
18203
|
for (const agentId of agentIds) {
|
|
18044
|
-
const sessionsDir =
|
|
18204
|
+
const sessionsDir = join15(agentsDir, agentId, "sessions");
|
|
18045
18205
|
let files;
|
|
18046
18206
|
try {
|
|
18047
18207
|
files = readdirSync5(sessionsDir);
|
|
@@ -18054,10 +18214,16 @@ function listOpenClawTranscripts() {
|
|
|
18054
18214
|
const sessionId = file.slice(0, -".jsonl".length);
|
|
18055
18215
|
if (!OPENCLAW_SESSION_ID_RE.test(sessionId))
|
|
18056
18216
|
continue;
|
|
18057
|
-
const transcriptPath =
|
|
18217
|
+
const transcriptPath = join15(sessionsDir, file);
|
|
18058
18218
|
try {
|
|
18059
18219
|
const st = statSync7(transcriptPath);
|
|
18060
|
-
out.push({
|
|
18220
|
+
out.push({
|
|
18221
|
+
agentId,
|
|
18222
|
+
sessionId,
|
|
18223
|
+
transcriptPath,
|
|
18224
|
+
mtimeMs: st.mtimeMs,
|
|
18225
|
+
sizeBytes: st.size
|
|
18226
|
+
});
|
|
18061
18227
|
} catch {}
|
|
18062
18228
|
}
|
|
18063
18229
|
}
|
|
@@ -18073,6 +18239,25 @@ function findOpenClawTranscript(sessionId) {
|
|
|
18073
18239
|
return null;
|
|
18074
18240
|
}
|
|
18075
18241
|
async function getOpenClawSessionLog(sessionId) {
|
|
18242
|
+
if (!OPENCLAW_SESSION_ID_RE.test(sessionId))
|
|
18243
|
+
return null;
|
|
18244
|
+
const sqlite = await readOpenClawSqliteTranscript(openclawHome(), listOpenClawAgents(), sessionId);
|
|
18245
|
+
if (sqlite) {
|
|
18246
|
+
const entries = openclawLinesToLogEntries(sqlite.rawLines, "session");
|
|
18247
|
+
let cwd;
|
|
18248
|
+
for (const line of sqlite.rawLines) {
|
|
18249
|
+
if (line.type === "session" && typeof line.cwd === "string" && line.cwd.length > 0) {
|
|
18250
|
+
cwd = line.cwd;
|
|
18251
|
+
break;
|
|
18252
|
+
}
|
|
18253
|
+
}
|
|
18254
|
+
return {
|
|
18255
|
+
entries,
|
|
18256
|
+
rawLines: sqlite.rawLines,
|
|
18257
|
+
cwd,
|
|
18258
|
+
filePath: sqlite.filePath
|
|
18259
|
+
};
|
|
18260
|
+
}
|
|
18076
18261
|
const filePath = findOpenClawTranscript(sessionId);
|
|
18077
18262
|
if (!filePath)
|
|
18078
18263
|
return null;
|
|
@@ -18096,6 +18281,7 @@ async function getOpenClawSessionLog(sessionId) {
|
|
|
18096
18281
|
var OPENCLAW_SESSION_ID_RE, getCachedOpenClawSessionLog;
|
|
18097
18282
|
var init_openclaw_sessions = __esm(() => {
|
|
18098
18283
|
init_log_entries();
|
|
18284
|
+
init_openclaw_db();
|
|
18099
18285
|
OPENCLAW_SESSION_ID_RE = /^[0-9a-fA-F-]{36}$/;
|
|
18100
18286
|
getCachedOpenClawSessionLog = runtimeCache((sessionId) => getOpenClawSessionLog(sessionId), 2, { maxSize: 50 });
|
|
18101
18287
|
});
|
|
@@ -18108,13 +18294,13 @@ __export(exports_openclaw_projects, {
|
|
|
18108
18294
|
openClawProjectPath: () => openClawProjectPath
|
|
18109
18295
|
});
|
|
18110
18296
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
18111
|
-
import { join as
|
|
18112
|
-
function
|
|
18297
|
+
import { join as join16 } from "node:path";
|
|
18298
|
+
function str2(v) {
|
|
18113
18299
|
return typeof v === "string" && v.length > 0 ? v : undefined;
|
|
18114
18300
|
}
|
|
18115
18301
|
function readSessionsIndex(agentId) {
|
|
18116
18302
|
const out = new Map;
|
|
18117
|
-
const indexPath =
|
|
18303
|
+
const indexPath = join16(openclawHome(), "agents", agentId, "sessions", "sessions.json");
|
|
18118
18304
|
let raw;
|
|
18119
18305
|
try {
|
|
18120
18306
|
raw = JSON.parse(readFileSync9(indexPath, "utf-8"));
|
|
@@ -18127,17 +18313,17 @@ function readSessionsIndex(agentId) {
|
|
|
18127
18313
|
if (!v || typeof v !== "object")
|
|
18128
18314
|
continue;
|
|
18129
18315
|
const e = v;
|
|
18130
|
-
const sessionId =
|
|
18316
|
+
const sessionId = str2(e.sessionId);
|
|
18131
18317
|
if (!sessionId)
|
|
18132
18318
|
continue;
|
|
18133
18319
|
const origin = e.origin && typeof e.origin === "object" ? e.origin : {};
|
|
18134
18320
|
const lastMs = typeof e.lastInteractionAt === "number" ? e.lastInteractionAt : typeof e.updatedAt === "number" ? e.updatedAt : undefined;
|
|
18135
18321
|
out.set(sessionId, {
|
|
18136
18322
|
lastMs,
|
|
18137
|
-
channel:
|
|
18138
|
-
chatType:
|
|
18139
|
-
label:
|
|
18140
|
-
chatId:
|
|
18323
|
+
channel: str2(e.lastChannel) ?? str2(origin.provider) ?? str2(origin.surface),
|
|
18324
|
+
chatType: str2(e.chatType) ?? str2(origin.chatType),
|
|
18325
|
+
label: str2(origin.label),
|
|
18326
|
+
chatId: str2(e.lastTo) ?? str2(origin.from)
|
|
18141
18327
|
});
|
|
18142
18328
|
}
|
|
18143
18329
|
return out;
|
|
@@ -18145,7 +18331,7 @@ function readSessionsIndex(agentId) {
|
|
|
18145
18331
|
async function getOpenClawSessions() {
|
|
18146
18332
|
const transcripts = listOpenClawTranscripts();
|
|
18147
18333
|
const indexByAgent = new Map;
|
|
18148
|
-
const refs =
|
|
18334
|
+
const refs = new Map;
|
|
18149
18335
|
for (const t of transcripts) {
|
|
18150
18336
|
let idx = indexByAgent.get(t.agentId);
|
|
18151
18337
|
if (!idx) {
|
|
@@ -18153,7 +18339,7 @@ async function getOpenClawSessions() {
|
|
|
18153
18339
|
indexByAgent.set(t.agentId, idx);
|
|
18154
18340
|
}
|
|
18155
18341
|
const meta = idx.get(t.sessionId);
|
|
18156
|
-
refs.
|
|
18342
|
+
refs.set(`${t.agentId}\x00${t.sessionId}`, {
|
|
18157
18343
|
sessionId: t.sessionId,
|
|
18158
18344
|
agentId: t.agentId,
|
|
18159
18345
|
channel: meta?.channel ?? "local",
|
|
@@ -18165,8 +18351,11 @@ async function getOpenClawSessions() {
|
|
|
18165
18351
|
sizeBytes: t.sizeBytes
|
|
18166
18352
|
});
|
|
18167
18353
|
}
|
|
18168
|
-
|
|
18169
|
-
|
|
18354
|
+
const sqliteSessions = await listOpenClawSqliteSessions(openclawHome(), listOpenClawAgents());
|
|
18355
|
+
for (const s of sqliteSessions) {
|
|
18356
|
+
refs.set(`${s.agentId}\x00${s.sessionId}`, s);
|
|
18357
|
+
}
|
|
18358
|
+
return [...refs.values()].sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
18170
18359
|
}
|
|
18171
18360
|
function openClawProjectName(agentId, channel) {
|
|
18172
18361
|
return `openclaw-${agentId}-${channel}`;
|
|
@@ -18201,7 +18390,12 @@ async function getOpenClawProjects() {
|
|
|
18201
18390
|
prev.latest = Math.max(prev.latest, s.mtimeMs);
|
|
18202
18391
|
prev.count += 1;
|
|
18203
18392
|
} else {
|
|
18204
|
-
groups.set(key, {
|
|
18393
|
+
groups.set(key, {
|
|
18394
|
+
agentId: s.agentId,
|
|
18395
|
+
channel: s.channel,
|
|
18396
|
+
latest: s.mtimeMs,
|
|
18397
|
+
count: 1
|
|
18398
|
+
});
|
|
18205
18399
|
}
|
|
18206
18400
|
}
|
|
18207
18401
|
const out = [];
|
|
@@ -18259,6 +18453,7 @@ async function getOpenClawSessionsByEncodedName(name) {
|
|
|
18259
18453
|
var getCachedOpenClawSessions, getCachedOpenClawProjects, getCachedOpenClawSessionsByEncodedName;
|
|
18260
18454
|
var init_openclaw_projects = __esm(() => {
|
|
18261
18455
|
init_openclaw_sessions();
|
|
18456
|
+
init_openclaw_db();
|
|
18262
18457
|
getCachedOpenClawSessions = runtimeCache(getOpenClawSessions, 2);
|
|
18263
18458
|
getCachedOpenClawProjects = runtimeCache(getOpenClawProjects, 2);
|
|
18264
18459
|
getCachedOpenClawSessionsByEncodedName = runtimeCache((name) => getOpenClawSessionsByEncodedName(name), 2, { maxSize: 50 });
|
|
@@ -18268,12 +18463,12 @@ var init_openclaw_projects = __esm(() => {
|
|
|
18268
18463
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
18269
18464
|
import { readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
|
|
18270
18465
|
import { homedir as homedir13 } from "node:os";
|
|
18271
|
-
import { join as
|
|
18466
|
+
import { join as join17 } from "node:path";
|
|
18272
18467
|
function factoryHome() {
|
|
18273
|
-
return process.env.FACTORY_HOME ||
|
|
18468
|
+
return process.env.FACTORY_HOME || join17(homedir13(), ".factory");
|
|
18274
18469
|
}
|
|
18275
18470
|
function factorySessionsRoot() {
|
|
18276
|
-
return
|
|
18471
|
+
return join17(factoryHome(), "sessions");
|
|
18277
18472
|
}
|
|
18278
18473
|
function isPlainObject4(v) {
|
|
18279
18474
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -18419,7 +18614,7 @@ function listFactoryTranscripts() {
|
|
|
18419
18614
|
for (const dir of projectDirs) {
|
|
18420
18615
|
const projectName = dir.name;
|
|
18421
18616
|
const cwd = decodeFolderName(projectName);
|
|
18422
|
-
const projectPath =
|
|
18617
|
+
const projectPath = join17(root, projectName);
|
|
18423
18618
|
let files;
|
|
18424
18619
|
try {
|
|
18425
18620
|
files = readdirSync6(projectPath);
|
|
@@ -18432,7 +18627,7 @@ function listFactoryTranscripts() {
|
|
|
18432
18627
|
const sessionId = file.slice(0, -".jsonl".length);
|
|
18433
18628
|
if (!FACTORY_SESSION_ID_RE.test(sessionId))
|
|
18434
18629
|
continue;
|
|
18435
|
-
const transcriptPath =
|
|
18630
|
+
const transcriptPath = join17(projectPath, file);
|
|
18436
18631
|
try {
|
|
18437
18632
|
const st = statSync8(transcriptPath);
|
|
18438
18633
|
out.push({ projectName, cwd, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
@@ -18556,12 +18751,12 @@ var init_factory_projects = __esm(() => {
|
|
|
18556
18751
|
|
|
18557
18752
|
// lib/devin-sessions.ts
|
|
18558
18753
|
import { homedir as homedir14 } from "node:os";
|
|
18559
|
-
import { join as
|
|
18754
|
+
import { join as join18 } from "node:path";
|
|
18560
18755
|
function devinHome() {
|
|
18561
|
-
return process.env.DEVIN_HOME ||
|
|
18756
|
+
return process.env.DEVIN_HOME || join18(homedir14(), ".local", "share", "devin");
|
|
18562
18757
|
}
|
|
18563
18758
|
function devinDbPath() {
|
|
18564
|
-
return process.env.DEVIN_DB_PATH ||
|
|
18759
|
+
return process.env.DEVIN_DB_PATH || join18(devinHome(), "cli", "sessions.db");
|
|
18565
18760
|
}
|
|
18566
18761
|
function devinEpochToMs(value) {
|
|
18567
18762
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
@@ -18856,15 +19051,15 @@ var init_devin_projects = __esm(() => {
|
|
|
18856
19051
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
18857
19052
|
import { readdirSync as readdirSync7, statSync as statSync9 } from "node:fs";
|
|
18858
19053
|
import { homedir as homedir15 } from "node:os";
|
|
18859
|
-
import { join as
|
|
19054
|
+
import { join as join19 } from "node:path";
|
|
18860
19055
|
function antigravityHome() {
|
|
18861
|
-
return process.env.ANTIGRAVITY_HOME ||
|
|
19056
|
+
return process.env.ANTIGRAVITY_HOME || join19(homedir15(), ".gemini", "antigravity-cli");
|
|
18862
19057
|
}
|
|
18863
19058
|
function antigravityBrainRoot() {
|
|
18864
|
-
return
|
|
19059
|
+
return join19(antigravityHome(), "brain");
|
|
18865
19060
|
}
|
|
18866
19061
|
function antigravityTranscriptRelPath() {
|
|
18867
|
-
return
|
|
19062
|
+
return join19(".system_generated", "logs", "transcript_full.jsonl");
|
|
18868
19063
|
}
|
|
18869
19064
|
function isPlainObject6(v) {
|
|
18870
19065
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -18987,7 +19182,7 @@ function listAntigravityTranscripts() {
|
|
|
18987
19182
|
const conversationId = dir.name;
|
|
18988
19183
|
if (!ANTIGRAVITY_CONVERSATION_ID_RE.test(conversationId))
|
|
18989
19184
|
continue;
|
|
18990
|
-
const transcriptPath =
|
|
19185
|
+
const transcriptPath = join19(root, conversationId, rel);
|
|
18991
19186
|
try {
|
|
18992
19187
|
const st = statSync9(transcriptPath);
|
|
18993
19188
|
if (!st.isFile())
|
|
@@ -19000,7 +19195,7 @@ function listAntigravityTranscripts() {
|
|
|
19000
19195
|
function findAntigravityTranscript(conversationId) {
|
|
19001
19196
|
if (!ANTIGRAVITY_CONVERSATION_ID_RE.test(conversationId))
|
|
19002
19197
|
return null;
|
|
19003
|
-
const transcriptPath =
|
|
19198
|
+
const transcriptPath = join19(antigravityBrainRoot(), conversationId, antigravityTranscriptRelPath());
|
|
19004
19199
|
try {
|
|
19005
19200
|
if (statSync9(transcriptPath).isFile())
|
|
19006
19201
|
return transcriptPath;
|
|
@@ -19036,9 +19231,9 @@ __export(exports_antigravity_projects, {
|
|
|
19036
19231
|
getAntigravityIndex: () => getAntigravityIndex,
|
|
19037
19232
|
getAntigravityProjects: () => getAntigravityProjects
|
|
19038
19233
|
});
|
|
19039
|
-
import { join as
|
|
19234
|
+
import { join as join20 } from "node:path";
|
|
19040
19235
|
function antigravitySummariesDbPath() {
|
|
19041
|
-
return
|
|
19236
|
+
return join20(antigravityHome(), "conversation_summaries.db");
|
|
19042
19237
|
}
|
|
19043
19238
|
function parseWorkspaceCwd(raw) {
|
|
19044
19239
|
if (!raw)
|
|
@@ -19182,15 +19377,15 @@ var init_antigravity_projects = __esm(() => {
|
|
|
19182
19377
|
|
|
19183
19378
|
// lib/goose-sessions.ts
|
|
19184
19379
|
import { homedir as homedir16 } from "node:os";
|
|
19185
|
-
import { join as
|
|
19380
|
+
import { join as join21 } from "node:path";
|
|
19186
19381
|
function gooseHome() {
|
|
19187
19382
|
if (process.env.GOOSE_HOME)
|
|
19188
19383
|
return process.env.GOOSE_HOME;
|
|
19189
19384
|
const xdg = process.env.XDG_DATA_HOME;
|
|
19190
|
-
return
|
|
19385
|
+
return join21(xdg && xdg.length > 0 ? xdg : join21(homedir16(), ".local", "share"), "goose");
|
|
19191
19386
|
}
|
|
19192
19387
|
function gooseDbPath() {
|
|
19193
|
-
return process.env.GOOSE_DB_PATH ||
|
|
19388
|
+
return process.env.GOOSE_DB_PATH || join21(gooseHome(), "sessions", "sessions.db");
|
|
19194
19389
|
}
|
|
19195
19390
|
function gooseTimestampToMs(value) {
|
|
19196
19391
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
@@ -19454,7 +19649,7 @@ var init_goose_projects = __esm(() => {
|
|
|
19454
19649
|
|
|
19455
19650
|
// lib/projects.ts
|
|
19456
19651
|
import { readdir as readdir5, stat as stat4 } from "node:fs/promises";
|
|
19457
|
-
import { join as
|
|
19652
|
+
import { join as join22, resolve as resolve11, sep } from "node:path";
|
|
19458
19653
|
async function getMtime(path, label) {
|
|
19459
19654
|
try {
|
|
19460
19655
|
return (await stat4(path)).mtime;
|
|
@@ -19480,7 +19675,7 @@ async function getClaudeProjectFolders() {
|
|
|
19480
19675
|
if (!entries)
|
|
19481
19676
|
return [];
|
|
19482
19677
|
const settled = await batchAll(entries.filter((entry) => entry.isDirectory()).map((entry) => async () => {
|
|
19483
|
-
const folderPath =
|
|
19678
|
+
const folderPath = join22(projectsPath, entry.name);
|
|
19484
19679
|
const mtime = await getMtime(folderPath, entry.name);
|
|
19485
19680
|
return {
|
|
19486
19681
|
name: entry.name,
|
|
@@ -19607,7 +19802,7 @@ function resolveProjectPath(projectName) {
|
|
|
19607
19802
|
if (/^[/\\]/.test(projectName))
|
|
19608
19803
|
throw new RangeError("Absolute project name");
|
|
19609
19804
|
const projectsPath = resolve11(getClaudeProjectsPath());
|
|
19610
|
-
const candidate = resolve11(
|
|
19805
|
+
const candidate = resolve11(join22(projectsPath, projectName));
|
|
19611
19806
|
if (!candidate.startsWith(projectsPath + sep)) {
|
|
19612
19807
|
throw new RangeError("Project path escapes root");
|
|
19613
19808
|
}
|
|
@@ -19625,7 +19820,7 @@ async function getSessionFiles(projectPath) {
|
|
|
19625
19820
|
return [];
|
|
19626
19821
|
const jsonlEntries = entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl") && extractSessionId2(entry.name));
|
|
19627
19822
|
const settled = await batchAll(jsonlEntries.map((entry) => async () => {
|
|
19628
|
-
const filePath =
|
|
19823
|
+
const filePath = join22(projectPath, entry.name);
|
|
19629
19824
|
const mtime = await getMtime(filePath, entry.name);
|
|
19630
19825
|
return {
|
|
19631
19826
|
name: entry.name,
|
|
@@ -19654,13 +19849,13 @@ var init_projects = __esm(() => {
|
|
|
19654
19849
|
|
|
19655
19850
|
// lib/resolve-subagent-path.ts
|
|
19656
19851
|
import { access as access2 } from "fs/promises";
|
|
19657
|
-
import { join as
|
|
19852
|
+
import { join as join23, relative as relative3 } from "path";
|
|
19658
19853
|
async function resolveSubagentPath(projectsPath, projectName, sessionId, agentId) {
|
|
19659
19854
|
const fileName = `agent-${agentId}.jsonl`;
|
|
19660
19855
|
const candidatePaths = [
|
|
19661
|
-
|
|
19662
|
-
|
|
19663
|
-
|
|
19856
|
+
join23(projectsPath, projectName, fileName),
|
|
19857
|
+
join23(projectsPath, projectName, sessionId, fileName),
|
|
19858
|
+
join23(projectsPath, projectName, sessionId, "subagents", fileName)
|
|
19664
19859
|
];
|
|
19665
19860
|
for (const candidatePath of candidatePaths) {
|
|
19666
19861
|
if (relative3(projectsPath, candidatePath).startsWith("..")) {
|
|
@@ -19682,7 +19877,7 @@ var init_resolve_subagent_path = () => {};
|
|
|
19682
19877
|
|
|
19683
19878
|
// lib/log-entries.ts
|
|
19684
19879
|
import { readFile as readFile10 } from "fs/promises";
|
|
19685
|
-
import { join as
|
|
19880
|
+
import { join as join24 } from "path";
|
|
19686
19881
|
function formatTimestamp(date) {
|
|
19687
19882
|
const base = formatDate(date);
|
|
19688
19883
|
const ms = date.getMilliseconds().toString().padStart(3, "0");
|
|
@@ -19880,7 +20075,7 @@ async function parseLogContent(fileContent, source = "session") {
|
|
|
19880
20075
|
async function parseSessionLog(projectName, sessionId) {
|
|
19881
20076
|
const projectDir = resolveProjectPath(projectName);
|
|
19882
20077
|
const projectsPath = getClaudeProjectsPath();
|
|
19883
|
-
const filePath =
|
|
20078
|
+
const filePath = join24(projectDir, `${sessionId}.jsonl`);
|
|
19884
20079
|
const fileContent = await readFile10(filePath, "utf-8");
|
|
19885
20080
|
const { entries: sessionEntries, rawLines: sessionRawLines, subagentIds } = await parseFileContent(fileContent, "session");
|
|
19886
20081
|
if (subagentIds.length === 0) {
|
|
@@ -19917,13 +20112,13 @@ var init_log_entries = __esm(() => {
|
|
|
19917
20112
|
});
|
|
19918
20113
|
|
|
19919
20114
|
// lib/codex-sessions.ts
|
|
19920
|
-
import { readFileSync as readFileSync10, readdirSync as readdirSync8, existsSync as
|
|
20115
|
+
import { readFileSync as readFileSync10, readdirSync as readdirSync8, existsSync as existsSync13, writeFileSync as writeFileSync6, mkdirSync as mkdirSync7, statSync as statSync10 } from "node:fs";
|
|
19921
20116
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
19922
|
-
import { dirname as dirname7, join as
|
|
20117
|
+
import { dirname as dirname7, join as join25 } from "node:path";
|
|
19923
20118
|
import { homedir as homedir17 } from "node:os";
|
|
19924
20119
|
function readCache() {
|
|
19925
20120
|
try {
|
|
19926
|
-
if (!
|
|
20121
|
+
if (!existsSync13(CACHE_PATH))
|
|
19927
20122
|
return {};
|
|
19928
20123
|
return JSON.parse(readFileSync10(CACHE_PATH, "utf-8"));
|
|
19929
20124
|
} catch {
|
|
@@ -19942,7 +20137,7 @@ function dirSearch(dir, sessionId) {
|
|
|
19942
20137
|
try {
|
|
19943
20138
|
for (const f of readdirSync8(dir, { withFileTypes: true })) {
|
|
19944
20139
|
if (f.isFile() && f.name.includes(sessionId) && f.name.endsWith(".jsonl")) {
|
|
19945
|
-
return
|
|
20140
|
+
return join25(dir, f.name);
|
|
19946
20141
|
}
|
|
19947
20142
|
}
|
|
19948
20143
|
} catch {}
|
|
@@ -19951,16 +20146,16 @@ function dirSearch(dir, sessionId) {
|
|
|
19951
20146
|
function findCodexTranscript(sessionId) {
|
|
19952
20147
|
const cache = readCache();
|
|
19953
20148
|
const cached = cache[sessionId];
|
|
19954
|
-
if (cached &&
|
|
20149
|
+
if (cached && existsSync13(cached))
|
|
19955
20150
|
return cached;
|
|
19956
|
-
const root =
|
|
20151
|
+
const root = join25(homedir17(), ".codex", "sessions");
|
|
19957
20152
|
const today = new Date;
|
|
19958
20153
|
const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
|
|
19959
20154
|
const datedDirs = [today, yesterday].map((d) => {
|
|
19960
20155
|
const y = String(d.getUTCFullYear());
|
|
19961
20156
|
const m = String(d.getUTCMonth() + 1).padStart(2, "0");
|
|
19962
20157
|
const day = String(d.getUTCDate()).padStart(2, "0");
|
|
19963
|
-
return
|
|
20158
|
+
return join25(root, y, m, day);
|
|
19964
20159
|
});
|
|
19965
20160
|
for (const dir of datedDirs) {
|
|
19966
20161
|
const hit = dirSearch(dir, sessionId);
|
|
@@ -19973,13 +20168,13 @@ function findCodexTranscript(sessionId) {
|
|
|
19973
20168
|
for (const y of readdirSync8(root, { withFileTypes: true })) {
|
|
19974
20169
|
if (!y.isDirectory())
|
|
19975
20170
|
continue;
|
|
19976
|
-
for (const m of readdirSync8(
|
|
20171
|
+
for (const m of readdirSync8(join25(root, y.name), { withFileTypes: true })) {
|
|
19977
20172
|
if (!m.isDirectory())
|
|
19978
20173
|
continue;
|
|
19979
|
-
for (const d of readdirSync8(
|
|
20174
|
+
for (const d of readdirSync8(join25(root, y.name, m.name), { withFileTypes: true })) {
|
|
19980
20175
|
if (!d.isDirectory())
|
|
19981
20176
|
continue;
|
|
19982
|
-
const hit = dirSearch(
|
|
20177
|
+
const hit = dirSearch(join25(root, y.name, m.name, d.name), sessionId);
|
|
19983
20178
|
if (hit) {
|
|
19984
20179
|
writeCacheEntry(sessionId, hit);
|
|
19985
20180
|
return hit;
|
|
@@ -20255,15 +20450,15 @@ var init_resolve_permission_mode = __esm(() => {
|
|
|
20255
20450
|
});
|
|
20256
20451
|
|
|
20257
20452
|
// lib/copilot-sessions.ts
|
|
20258
|
-
import { readFileSync as readFileSync12, readdirSync as readdirSync9, existsSync as
|
|
20453
|
+
import { readFileSync as readFileSync12, readdirSync as readdirSync9, existsSync as existsSync14, statSync as statSync11 } from "node:fs";
|
|
20259
20454
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
20260
|
-
import { join as
|
|
20455
|
+
import { join as join26, resolve as resolve12, sep as sep2 } from "node:path";
|
|
20261
20456
|
import { homedir as homedir18 } from "node:os";
|
|
20262
20457
|
function getCopilotHome() {
|
|
20263
|
-
return process.env.COPILOT_HOME ||
|
|
20458
|
+
return process.env.COPILOT_HOME || join26(homedir18(), ".copilot");
|
|
20264
20459
|
}
|
|
20265
20460
|
function getCopilotSessionStateRoot2() {
|
|
20266
|
-
return
|
|
20461
|
+
return join26(getCopilotHome(), "session-state");
|
|
20267
20462
|
}
|
|
20268
20463
|
function getCopilotSessionDir(sessionId) {
|
|
20269
20464
|
if (!sessionId)
|
|
@@ -20278,19 +20473,19 @@ function resolveSessionFile(sessionId, filename) {
|
|
|
20278
20473
|
const dir = getCopilotSessionDir(sessionId);
|
|
20279
20474
|
if (!dir)
|
|
20280
20475
|
return null;
|
|
20281
|
-
return
|
|
20476
|
+
return join26(dir, filename);
|
|
20282
20477
|
}
|
|
20283
20478
|
function findCopilotTranscript(sessionId) {
|
|
20284
20479
|
const candidate = resolveSessionFile(sessionId, "events.jsonl");
|
|
20285
20480
|
if (!candidate)
|
|
20286
20481
|
return null;
|
|
20287
|
-
return
|
|
20482
|
+
return existsSync14(candidate) ? candidate : null;
|
|
20288
20483
|
}
|
|
20289
20484
|
function findCopilotWorkspace(sessionId) {
|
|
20290
20485
|
const candidate = resolveSessionFile(sessionId, "workspace.yaml");
|
|
20291
20486
|
if (!candidate)
|
|
20292
20487
|
return null;
|
|
20293
|
-
return
|
|
20488
|
+
return existsSync14(candidate) ? candidate : null;
|
|
20294
20489
|
}
|
|
20295
20490
|
function readYamlScalar(path, key) {
|
|
20296
20491
|
try {
|
|
@@ -20491,12 +20686,12 @@ var init_copilot_sessions = __esm(() => {
|
|
|
20491
20686
|
});
|
|
20492
20687
|
|
|
20493
20688
|
// lib/cursor-sessions.ts
|
|
20494
|
-
import { readFileSync as readFileSync13, readdirSync as readdirSync10, existsSync as
|
|
20689
|
+
import { readFileSync as readFileSync13, readdirSync as readdirSync10, existsSync as existsSync15, statSync as statSync12 } from "node:fs";
|
|
20495
20690
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
20496
|
-
import { basename as basename3, join as
|
|
20691
|
+
import { basename as basename3, join as join27, resolve as resolve13, sep as sep3 } from "node:path";
|
|
20497
20692
|
import { homedir as homedir19 } from "node:os";
|
|
20498
20693
|
function getCursorHome2() {
|
|
20499
|
-
return process.env.CURSOR_HOME ||
|
|
20694
|
+
return process.env.CURSOR_HOME || join27(homedir19(), ".cursor");
|
|
20500
20695
|
}
|
|
20501
20696
|
function getCursorSessionDir(sessionId) {
|
|
20502
20697
|
if (!sessionId)
|
|
@@ -20514,7 +20709,7 @@ function getCursorSessionDir(sessionId) {
|
|
|
20514
20709
|
const transcriptRoot = resolve13(projectsRoot, entry.name, NEW_AGENT_TRANSCRIPTS_DIR2);
|
|
20515
20710
|
if (candidate === transcriptRoot || !candidate.startsWith(`${transcriptRoot}${sep3}`))
|
|
20516
20711
|
continue;
|
|
20517
|
-
if (
|
|
20712
|
+
if (existsSync15(candidate))
|
|
20518
20713
|
return candidate;
|
|
20519
20714
|
}
|
|
20520
20715
|
for (const sub of LEGACY_SESSION_ROOT_CANDIDATES2) {
|
|
@@ -20522,7 +20717,7 @@ function getCursorSessionDir(sessionId) {
|
|
|
20522
20717
|
const candidate = resolve13(root, sessionId);
|
|
20523
20718
|
if (candidate === root || !candidate.startsWith(`${root}${sep3}`))
|
|
20524
20719
|
continue;
|
|
20525
|
-
if (
|
|
20720
|
+
if (existsSync15(candidate))
|
|
20526
20721
|
return candidate;
|
|
20527
20722
|
}
|
|
20528
20723
|
return null;
|
|
@@ -20531,12 +20726,12 @@ function findCursorTranscript(sessionId) {
|
|
|
20531
20726
|
const dir = getCursorSessionDir(sessionId);
|
|
20532
20727
|
if (!dir)
|
|
20533
20728
|
return null;
|
|
20534
|
-
const newCandidate =
|
|
20535
|
-
if (
|
|
20729
|
+
const newCandidate = join27(dir, `${basename3(dir)}.jsonl`);
|
|
20730
|
+
if (existsSync15(newCandidate))
|
|
20536
20731
|
return newCandidate;
|
|
20537
20732
|
for (const name of LEGACY_TRANSCRIPT_FILE_CANDIDATES2) {
|
|
20538
|
-
const candidate =
|
|
20539
|
-
if (
|
|
20733
|
+
const candidate = join27(dir, name);
|
|
20734
|
+
if (existsSync15(candidate))
|
|
20540
20735
|
return candidate;
|
|
20541
20736
|
}
|
|
20542
20737
|
return null;
|
|
@@ -20790,12 +20985,12 @@ var init_cursor_sessions = __esm(() => {
|
|
|
20790
20985
|
});
|
|
20791
20986
|
|
|
20792
20987
|
// lib/pi-sessions.ts
|
|
20793
|
-
import { readFileSync as readFileSync14, readdirSync as readdirSync11, existsSync as
|
|
20988
|
+
import { readFileSync as readFileSync14, readdirSync as readdirSync11, existsSync as existsSync16, statSync as statSync13 } from "node:fs";
|
|
20794
20989
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
20795
|
-
import { join as
|
|
20990
|
+
import { join as join28, resolve as resolve14, sep as sep4 } from "node:path";
|
|
20796
20991
|
import { homedir as homedir20 } from "node:os";
|
|
20797
20992
|
function getPiSessionStateRoot() {
|
|
20798
|
-
return process.env.PI_SESSIONS_DIR ||
|
|
20993
|
+
return process.env.PI_SESSIONS_DIR || join28(homedir20(), ".pi", "agent", "sessions");
|
|
20799
20994
|
}
|
|
20800
20995
|
function isSafeSessionId(sessionId) {
|
|
20801
20996
|
return UUID_RE.test(sessionId);
|
|
@@ -20827,7 +21022,7 @@ function findPiTranscript(sessionId) {
|
|
|
20827
21022
|
const candidate = resolve14(cwdPath, f);
|
|
20828
21023
|
if (!candidate.startsWith(`${cwdPath}${sep4}`))
|
|
20829
21024
|
continue;
|
|
20830
|
-
if (
|
|
21025
|
+
if (existsSync16(candidate))
|
|
20831
21026
|
return candidate;
|
|
20832
21027
|
}
|
|
20833
21028
|
}
|
|
@@ -21233,7 +21428,7 @@ var init_pack_failclosed = __esm(() => {
|
|
|
21233
21428
|
// lib/atomic-write.ts
|
|
21234
21429
|
import {
|
|
21235
21430
|
chmodSync as chmodSync2,
|
|
21236
|
-
existsSync as
|
|
21431
|
+
existsSync as existsSync17,
|
|
21237
21432
|
mkdirSync as mkdirSync8,
|
|
21238
21433
|
renameSync as renameSync4,
|
|
21239
21434
|
rmSync as rmSync3,
|
|
@@ -21246,7 +21441,7 @@ function writeJsonAtomically(filePath, value, opts = {}) {
|
|
|
21246
21441
|
const mode = opts.mode ?? 384;
|
|
21247
21442
|
const dirMode = opts.dirMode ?? 448;
|
|
21248
21443
|
const dir = dirname8(filePath);
|
|
21249
|
-
if (!
|
|
21444
|
+
if (!existsSync17(dir))
|
|
21250
21445
|
mkdirSync8(dir, { recursive: true, mode: dirMode });
|
|
21251
21446
|
const tmp = `${filePath}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`;
|
|
21252
21447
|
try {
|
|
@@ -21270,9 +21465,9 @@ function writeJsonAtomically(filePath, value, opts = {}) {
|
|
|
21270
21465
|
var init_atomic_write = () => {};
|
|
21271
21466
|
|
|
21272
21467
|
// src/hooks/session-pause.ts
|
|
21273
|
-
import { existsSync as
|
|
21468
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync9, readdirSync as readdirSync12, readFileSync as readFileSync15, rmSync as rmSync4 } from "node:fs";
|
|
21274
21469
|
import { createHash as createHash6 } from "node:crypto";
|
|
21275
|
-
import { join as
|
|
21470
|
+
import { join as join29, resolve as resolve15 } from "node:path";
|
|
21276
21471
|
function pauseStateDir() {
|
|
21277
21472
|
const override = process.env.FAILPROOFAI_STATE_DIR;
|
|
21278
21473
|
if (override)
|
|
@@ -21281,7 +21476,7 @@ function pauseStateDir() {
|
|
|
21281
21476
|
}
|
|
21282
21477
|
function pauseFilePath(sessionId) {
|
|
21283
21478
|
const digest = createHash6("sha256").update(sessionId).digest("hex").slice(0, 32);
|
|
21284
|
-
return
|
|
21479
|
+
return join29(pauseStateDir(), `${digest}.json`);
|
|
21285
21480
|
}
|
|
21286
21481
|
function parsePauseDuration(input, ceilingMs = PAUSE_CEILING_MS) {
|
|
21287
21482
|
if (input === undefined || input === "")
|
|
@@ -21337,7 +21532,7 @@ function readActivePause(sessionId, now = Date.now()) {
|
|
|
21337
21532
|
return null;
|
|
21338
21533
|
try {
|
|
21339
21534
|
const path = pauseFilePath(sessionId);
|
|
21340
|
-
if (!
|
|
21535
|
+
if (!existsSync18(path))
|
|
21341
21536
|
return null;
|
|
21342
21537
|
const stored = parseStored(JSON.parse(readFileSync15(path, "utf8")));
|
|
21343
21538
|
if (!stored)
|
|
@@ -21368,7 +21563,7 @@ function writePause(opts) {
|
|
|
21368
21563
|
}
|
|
21369
21564
|
function clearPause(sessionId) {
|
|
21370
21565
|
const path = pauseFilePath(sessionId);
|
|
21371
|
-
if (!
|
|
21566
|
+
if (!existsSync18(path))
|
|
21372
21567
|
return false;
|
|
21373
21568
|
try {
|
|
21374
21569
|
rmSync4(path);
|
|
@@ -21379,7 +21574,7 @@ function clearPause(sessionId) {
|
|
|
21379
21574
|
}
|
|
21380
21575
|
function listActivePauses(now = Date.now()) {
|
|
21381
21576
|
const dir = pauseStateDir();
|
|
21382
|
-
if (!
|
|
21577
|
+
if (!existsSync18(dir))
|
|
21383
21578
|
return [];
|
|
21384
21579
|
const out = [];
|
|
21385
21580
|
let names;
|
|
@@ -21392,7 +21587,7 @@ function listActivePauses(now = Date.now()) {
|
|
|
21392
21587
|
if (!name.endsWith(".json"))
|
|
21393
21588
|
continue;
|
|
21394
21589
|
try {
|
|
21395
|
-
const stored = parseStored(JSON.parse(readFileSync15(
|
|
21590
|
+
const stored = parseStored(JSON.parse(readFileSync15(join29(dir, name), "utf8")));
|
|
21396
21591
|
if (!stored || stored.expiresAt <= now)
|
|
21397
21592
|
continue;
|
|
21398
21593
|
const { schemaVersion: _ignored, ...pause } = stored;
|
|
@@ -21433,7 +21628,7 @@ var init_session_pause = __esm(() => {
|
|
|
21433
21628
|
import { createHash as createHash7 } from "node:crypto";
|
|
21434
21629
|
import {
|
|
21435
21630
|
chmodSync as chmodSync3,
|
|
21436
|
-
existsSync as
|
|
21631
|
+
existsSync as existsSync19,
|
|
21437
21632
|
mkdirSync as mkdirSync10,
|
|
21438
21633
|
readdirSync as readdirSync13,
|
|
21439
21634
|
readFileSync as readFileSync16,
|
|
@@ -21485,7 +21680,7 @@ function platformPackageBinary(dir) {
|
|
|
21485
21680
|
return null;
|
|
21486
21681
|
}
|
|
21487
21682
|
const candidate = resolve16(dir, "bin", "failproofaid");
|
|
21488
|
-
return
|
|
21683
|
+
return existsSync19(candidate) ? candidate : null;
|
|
21489
21684
|
}
|
|
21490
21685
|
function pruneOldDaemonBinaries(keep = 2) {
|
|
21491
21686
|
const removed = [];
|
|
@@ -21563,7 +21758,7 @@ function digestFor2(manifest, assetName) {
|
|
|
21563
21758
|
}
|
|
21564
21759
|
async function downloadFailproofaidBinary(key) {
|
|
21565
21760
|
const target = installedBinaryPath();
|
|
21566
|
-
if (
|
|
21761
|
+
if (existsSync19(target))
|
|
21567
21762
|
return { path: target };
|
|
21568
21763
|
if (process.env.FAILPROOFAI_NO_DOWNLOAD) {
|
|
21569
21764
|
return { error: "daemon downloads are disabled (FAILPROOFAI_NO_DOWNLOAD)" };
|
|
@@ -21597,10 +21792,10 @@ var init_daemon_download = __esm(() => {
|
|
|
21597
21792
|
|
|
21598
21793
|
// src/hooks/daemon-client.ts
|
|
21599
21794
|
import { createConnection as createConnection2 } from "node:net";
|
|
21600
|
-
import { existsSync as
|
|
21795
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
21601
21796
|
function daemonSocketPresent() {
|
|
21602
21797
|
try {
|
|
21603
|
-
return
|
|
21798
|
+
return existsSync20(socketPath2());
|
|
21604
21799
|
} catch {
|
|
21605
21800
|
return false;
|
|
21606
21801
|
}
|
|
@@ -21726,7 +21921,7 @@ var init_daemon_client2 = __esm(() => {
|
|
|
21726
21921
|
|
|
21727
21922
|
// src/hooks/daemon-service.ts
|
|
21728
21923
|
import {
|
|
21729
|
-
existsSync as
|
|
21924
|
+
existsSync as existsSync21,
|
|
21730
21925
|
mkdirSync as mkdirSync11,
|
|
21731
21926
|
mkdtempSync,
|
|
21732
21927
|
readFileSync as readFileSync17,
|
|
@@ -21757,13 +21952,13 @@ function resolveFailproofaidBinaryPath() {
|
|
|
21757
21952
|
if (process.env.FAILPROOFAI_DAEMON_BINARY)
|
|
21758
21953
|
return process.env.FAILPROOFAI_DAEMON_BINARY;
|
|
21759
21954
|
const downloaded = installedBinaryPath();
|
|
21760
|
-
if (
|
|
21955
|
+
if (existsSync21(downloaded))
|
|
21761
21956
|
return downloaded;
|
|
21762
21957
|
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT;
|
|
21763
21958
|
if (packageRoot) {
|
|
21764
21959
|
for (const profile of ["release", "debug"]) {
|
|
21765
21960
|
const candidate = resolve17(packageRoot, "target", profile, "failproofaid");
|
|
21766
|
-
if (
|
|
21961
|
+
if (existsSync21(candidate))
|
|
21767
21962
|
return candidate;
|
|
21768
21963
|
}
|
|
21769
21964
|
}
|
|
@@ -21794,7 +21989,7 @@ function resolveWorkerCommand() {
|
|
|
21794
21989
|
if (!packageRoot)
|
|
21795
21990
|
return null;
|
|
21796
21991
|
const workerScript = resolve17(packageRoot, "dist", "worker.mjs");
|
|
21797
|
-
if (!
|
|
21992
|
+
if (!existsSync21(workerScript))
|
|
21798
21993
|
return null;
|
|
21799
21994
|
return `${shellQuote(process.execPath)} ${shellQuote(workerScript)}`;
|
|
21800
21995
|
}
|
|
@@ -21805,7 +22000,7 @@ function resolveCliCommand() {
|
|
|
21805
22000
|
if (!packageRoot)
|
|
21806
22001
|
return null;
|
|
21807
22002
|
const cliScript = resolve17(packageRoot, "dist", "cli.mjs");
|
|
21808
|
-
if (!
|
|
22003
|
+
if (!existsSync21(cliScript))
|
|
21809
22004
|
return null;
|
|
21810
22005
|
return `${shellQuote(process.execPath)} ${shellQuote(cliScript)}`;
|
|
21811
22006
|
}
|
|
@@ -21819,7 +22014,7 @@ function workerScriptPath() {
|
|
|
21819
22014
|
if (!packageRoot)
|
|
21820
22015
|
return null;
|
|
21821
22016
|
const workerScript = resolve17(packageRoot, "dist", "worker.mjs");
|
|
21822
|
-
return
|
|
22017
|
+
return existsSync21(workerScript) ? workerScript : null;
|
|
21823
22018
|
}
|
|
21824
22019
|
function assertUnitSafe(value, field) {
|
|
21825
22020
|
if (UNIT_UNSAFE_RE.test(value)) {
|
|
@@ -21918,7 +22113,7 @@ function removeLegacyUserService() {
|
|
|
21918
22113
|
try {
|
|
21919
22114
|
if (process.platform === "linux") {
|
|
21920
22115
|
const legacy = legacySystemdUserUnitPath();
|
|
21921
|
-
if (!
|
|
22116
|
+
if (!existsSync21(legacy))
|
|
21922
22117
|
return;
|
|
21923
22118
|
try {
|
|
21924
22119
|
execFileSync2("systemctl", ["--user", "disable", "--now", "failproofaid.service"], {
|
|
@@ -21935,7 +22130,7 @@ function removeLegacyUserService() {
|
|
|
21935
22130
|
} catch {}
|
|
21936
22131
|
} else {
|
|
21937
22132
|
const legacyAgent = legacyLaunchAgentPlistPath();
|
|
21938
|
-
if (
|
|
22133
|
+
if (existsSync21(legacyAgent)) {
|
|
21939
22134
|
try {
|
|
21940
22135
|
execFileSync2("launchctl", ["unload", "-w", legacyAgent], {
|
|
21941
22136
|
stdio: "ignore",
|
|
@@ -21945,7 +22140,7 @@ function removeLegacyUserService() {
|
|
|
21945
22140
|
unlinkSync3(legacyAgent);
|
|
21946
22141
|
}
|
|
21947
22142
|
const legacyDaemon = legacySharedLaunchDaemonPath();
|
|
21948
|
-
if (
|
|
22143
|
+
if (existsSync21(legacyDaemon)) {
|
|
21949
22144
|
try {
|
|
21950
22145
|
runPrivileged("launchctl", ["unload", "-w", legacyDaemon]);
|
|
21951
22146
|
} catch {}
|
|
@@ -21962,7 +22157,7 @@ function systemdUnitContents(binaryPath, workerCmd, cliCmd = null) {
|
|
|
21962
22157
|
const user = assertUnitSafe(serviceUser(), "User");
|
|
21963
22158
|
assertUnitSafe(binaryPath, "ExecStart");
|
|
21964
22159
|
assertUnitSafe(homedir21(), "HOME");
|
|
21965
|
-
const conditionPaths = [binaryPath, workerScriptPath()].filter((p) => typeof p === "string" &&
|
|
22160
|
+
const conditionPaths = [binaryPath, workerScriptPath()].filter((p) => typeof p === "string" && existsSync21(p));
|
|
21966
22161
|
const conditionLines = conditionPaths.map((p) => `ConditionPathExists=${assertUnitSafe(p, "ConditionPathExists")}
|
|
21967
22162
|
`).join("");
|
|
21968
22163
|
return `[Unit]
|
|
@@ -22157,7 +22352,7 @@ function readInstalledServiceDefinition() {
|
|
|
22157
22352
|
if (!isDaemonSupportedPlatform())
|
|
22158
22353
|
return null;
|
|
22159
22354
|
const path = daemonServiceFilePath();
|
|
22160
|
-
if (!path || !
|
|
22355
|
+
if (!path || !existsSync21(path))
|
|
22161
22356
|
return null;
|
|
22162
22357
|
try {
|
|
22163
22358
|
return readFileSync17(path, "utf8");
|
|
@@ -22293,7 +22488,7 @@ async function uninstallDaemonService() {
|
|
|
22293
22488
|
try {
|
|
22294
22489
|
if (process.platform === "linux") {
|
|
22295
22490
|
const unitPath = systemdUnitPath();
|
|
22296
|
-
if (!
|
|
22491
|
+
if (!existsSync21(unitPath))
|
|
22297
22492
|
return;
|
|
22298
22493
|
try {
|
|
22299
22494
|
runPrivileged("systemctl", ["disable", "--now", systemdUnitName()]);
|
|
@@ -22304,7 +22499,7 @@ async function uninstallDaemonService() {
|
|
|
22304
22499
|
} catch {}
|
|
22305
22500
|
} else {
|
|
22306
22501
|
const plistPath = launchdPlistPath();
|
|
22307
|
-
if (!
|
|
22502
|
+
if (!existsSync21(plistPath))
|
|
22308
22503
|
return;
|
|
22309
22504
|
try {
|
|
22310
22505
|
runPrivileged("launchctl", ["unload", "-w", plistPath]);
|
|
@@ -22321,7 +22516,7 @@ function daemonVersionSkew() {
|
|
|
22321
22516
|
const recorded = readVersionFile()?.daemon;
|
|
22322
22517
|
if (!recorded)
|
|
22323
22518
|
return null;
|
|
22324
|
-
if (!
|
|
22519
|
+
if (!existsSync21(installedBinaryPath(recorded)))
|
|
22325
22520
|
return null;
|
|
22326
22521
|
return recorded === version2 ? null : { installed: recorded, expected: version2 };
|
|
22327
22522
|
}
|
|
@@ -22339,7 +22534,7 @@ function daemonServiceStatus() {
|
|
|
22339
22534
|
if (!isDaemonSupportedPlatform())
|
|
22340
22535
|
return "unsupported-platform";
|
|
22341
22536
|
if (process.platform === "linux") {
|
|
22342
|
-
if (!
|
|
22537
|
+
if (!existsSync21(systemdUnitPath()))
|
|
22343
22538
|
return "not-installed";
|
|
22344
22539
|
try {
|
|
22345
22540
|
const out = execFileSync2("systemctl", ["is-active", systemdUnitName()], {
|
|
@@ -22352,7 +22547,7 @@ function daemonServiceStatus() {
|
|
|
22352
22547
|
}
|
|
22353
22548
|
}
|
|
22354
22549
|
const plistPath = launchdPlistPath();
|
|
22355
|
-
if (!
|
|
22550
|
+
if (!existsSync21(plistPath))
|
|
22356
22551
|
return "not-installed";
|
|
22357
22552
|
try {
|
|
22358
22553
|
const root = typeof process.getuid === "function" && process.getuid() === 0;
|
|
@@ -22384,7 +22579,7 @@ var init_daemon_service = __esm(() => {
|
|
|
22384
22579
|
// src/hooks/fp-reset.ts
|
|
22385
22580
|
import {
|
|
22386
22581
|
copyFileSync,
|
|
22387
|
-
existsSync as
|
|
22582
|
+
existsSync as existsSync22,
|
|
22388
22583
|
mkdirSync as mkdirSync12,
|
|
22389
22584
|
readFileSync as readFileSync18,
|
|
22390
22585
|
readdirSync as readdirSync14,
|
|
@@ -22397,7 +22592,7 @@ import {
|
|
|
22397
22592
|
import { dirname as dirname10, isAbsolute as isAbsolute3, relative as relative4, resolve as resolve18 } from "node:path";
|
|
22398
22593
|
function migrateConventionPolicies() {
|
|
22399
22594
|
const from = legacy.customPoliciesDir();
|
|
22400
|
-
if (!
|
|
22595
|
+
if (!existsSync22(from))
|
|
22401
22596
|
return [];
|
|
22402
22597
|
const moved = [];
|
|
22403
22598
|
const mergeInto = (dir, dest, prefix) => {
|
|
@@ -22418,7 +22613,7 @@ function migrateConventionPolicies() {
|
|
|
22418
22613
|
const source = resolve18(dir, entry.name);
|
|
22419
22614
|
const target = resolve18(dest, entry.name);
|
|
22420
22615
|
const name = `${prefix}${entry.name}`;
|
|
22421
|
-
if (!
|
|
22616
|
+
if (!existsSync22(target)) {
|
|
22422
22617
|
try {
|
|
22423
22618
|
renameSync6(source, target);
|
|
22424
22619
|
moved.push(name);
|
|
@@ -22445,7 +22640,7 @@ function migrateLegacySpool() {
|
|
|
22445
22640
|
[legacy.spoolDir(), spoolDir()],
|
|
22446
22641
|
[legacy.failedDir(), failedDir()]
|
|
22447
22642
|
]) {
|
|
22448
|
-
if (!
|
|
22643
|
+
if (!existsSync22(from))
|
|
22449
22644
|
continue;
|
|
22450
22645
|
try {
|
|
22451
22646
|
mkdirSync12(to, { recursive: true });
|
|
@@ -22454,7 +22649,7 @@ function migrateLegacySpool() {
|
|
|
22454
22649
|
continue;
|
|
22455
22650
|
let name = entry.name;
|
|
22456
22651
|
let n = 0;
|
|
22457
|
-
while (
|
|
22652
|
+
while (existsSync22(resolve18(to, name)))
|
|
22458
22653
|
name = `legacy-${n++}-${entry.name}`;
|
|
22459
22654
|
try {
|
|
22460
22655
|
renameSync6(resolve18(from, entry.name), resolve18(to, name));
|
|
@@ -22472,7 +22667,7 @@ function migrateLegacySpool() {
|
|
|
22472
22667
|
}
|
|
22473
22668
|
function migrateHookActivity() {
|
|
22474
22669
|
const from = legacy.hookActivityDir();
|
|
22475
|
-
if (!
|
|
22670
|
+
if (!existsSync22(from))
|
|
22476
22671
|
return [];
|
|
22477
22672
|
const moved = [];
|
|
22478
22673
|
try {
|
|
@@ -22487,7 +22682,7 @@ function migrateHookActivity() {
|
|
|
22487
22682
|
const source = resolve18(from, entry.name);
|
|
22488
22683
|
let name = entry.name === "current.jsonl" ? `page-${stamp}-${seq++}.jsonl` : entry.name;
|
|
22489
22684
|
let target = resolve18(to, name);
|
|
22490
|
-
while (
|
|
22685
|
+
while (existsSync22(target)) {
|
|
22491
22686
|
name = `page-${stamp}-${seq++}.jsonl`;
|
|
22492
22687
|
target = resolve18(to, name);
|
|
22493
22688
|
}
|
|
@@ -22538,7 +22733,7 @@ function retirePolicyConfigKeys() {
|
|
|
22538
22733
|
}
|
|
22539
22734
|
function readCarriedPolicyConfig() {
|
|
22540
22735
|
const from = resolve18(legacy.localPoliciesDir(), "policies-config.json");
|
|
22541
|
-
if (!
|
|
22736
|
+
if (!existsSync22(from))
|
|
22542
22737
|
return null;
|
|
22543
22738
|
let parsed;
|
|
22544
22739
|
try {
|
|
@@ -22602,7 +22797,7 @@ function writeCarriedPolicyConfig(carried) {
|
|
|
22602
22797
|
}
|
|
22603
22798
|
function readCarriedTelemetryOptOut() {
|
|
22604
22799
|
const from = legacy.configToml();
|
|
22605
|
-
if (!
|
|
22800
|
+
if (!existsSync22(from))
|
|
22606
22801
|
return false;
|
|
22607
22802
|
try {
|
|
22608
22803
|
const text = readFileSync18(from, "utf8");
|
|
@@ -22657,7 +22852,7 @@ function parseLegacyToml(text) {
|
|
|
22657
22852
|
}
|
|
22658
22853
|
function readCarriedLegacyConfig() {
|
|
22659
22854
|
const from = legacy.configToml();
|
|
22660
|
-
if (!
|
|
22855
|
+
if (!existsSync22(from))
|
|
22661
22856
|
return null;
|
|
22662
22857
|
try {
|
|
22663
22858
|
return projectConfig(parseLegacyToml(readFileSync18(from, "utf8")));
|
|
@@ -22667,7 +22862,7 @@ function readCarriedLegacyConfig() {
|
|
|
22667
22862
|
}
|
|
22668
22863
|
function readCarriedLegacyCredentials() {
|
|
22669
22864
|
const toml = legacy.credentialsToml();
|
|
22670
|
-
if (
|
|
22865
|
+
if (existsSync22(toml)) {
|
|
22671
22866
|
try {
|
|
22672
22867
|
const creds = projectCredentials(parseLegacyToml(readFileSync18(toml, "utf8")));
|
|
22673
22868
|
if (Object.keys(creds).length > 0)
|
|
@@ -22710,7 +22905,7 @@ function resetHome(from, to = LAYOUT_VERSION) {
|
|
|
22710
22905
|
const spooled = migrateLegacySpool();
|
|
22711
22906
|
const removed = [];
|
|
22712
22907
|
for (const path of resettablePaths()) {
|
|
22713
|
-
if (!
|
|
22908
|
+
if (!existsSync22(path))
|
|
22714
22909
|
continue;
|
|
22715
22910
|
try {
|
|
22716
22911
|
rmSync7(path, { recursive: true, force: true });
|
|
@@ -22735,7 +22930,7 @@ function layoutWarningForHook() {
|
|
|
22735
22930
|
if (state.kind === "future") {
|
|
22736
22931
|
return `[failproofai] this directory was written by a newer version (layout ${state.found} vs ${LAYOUT_VERSION}) — policies are NOT being enforced. ` + `Upgrade failproofai.`;
|
|
22737
22932
|
}
|
|
22738
|
-
if (
|
|
22933
|
+
if (existsSync22(globalPolicyConfigFile()))
|
|
22739
22934
|
return null;
|
|
22740
22935
|
return `[failproofai] setup predates this version — global policies are NOT being enforced. ` + `Run \`failproofai config\` to re-create it.`;
|
|
22741
22936
|
}
|
|
@@ -23783,17 +23978,17 @@ var init_collector_config = __esm(() => {
|
|
|
23783
23978
|
});
|
|
23784
23979
|
|
|
23785
23980
|
// src/hooks/flush-cli.ts
|
|
23786
|
-
import { existsSync as
|
|
23787
|
-
import { dirname as dirname11, join as
|
|
23981
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync13, writeFileSync as writeFileSync11, readdirSync as readdirSync15 } from "node:fs";
|
|
23982
|
+
import { dirname as dirname11, join as join30 } from "node:path";
|
|
23788
23983
|
function flushRequestPath(home) {
|
|
23789
|
-
return
|
|
23984
|
+
return join30(failproofaiHome(home), "state", "flush-request.json");
|
|
23790
23985
|
}
|
|
23791
23986
|
function spoolDirs(home) {
|
|
23792
23987
|
const root = spoolDir(home);
|
|
23793
|
-
if (!
|
|
23988
|
+
if (!existsSync23(root))
|
|
23794
23989
|
return [];
|
|
23795
23990
|
try {
|
|
23796
|
-
return readdirSync15(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) =>
|
|
23991
|
+
return readdirSync15(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join30(root, e.name));
|
|
23797
23992
|
} catch {
|
|
23798
23993
|
return [];
|
|
23799
23994
|
}
|
|
@@ -23894,14 +24089,14 @@ var init_flush_cli = __esm(() => {
|
|
|
23894
24089
|
import {
|
|
23895
24090
|
chmodSync as chmodSync4,
|
|
23896
24091
|
copyFileSync as copyFileSync2,
|
|
23897
|
-
existsSync as
|
|
24092
|
+
existsSync as existsSync24,
|
|
23898
24093
|
mkdirSync as mkdirSync14,
|
|
23899
24094
|
readFileSync as readFileSync19,
|
|
23900
24095
|
renameSync as renameSync7,
|
|
23901
24096
|
rmSync as rmSync8,
|
|
23902
24097
|
writeFileSync as writeFileSync12
|
|
23903
24098
|
} from "node:fs";
|
|
23904
|
-
import { basename as basename4, dirname as dirname12, join as
|
|
24099
|
+
import { basename as basename4, dirname as dirname12, join as join31, resolve as resolve19 } from "node:path";
|
|
23905
24100
|
function migrateToLayout4() {
|
|
23906
24101
|
const moves = [
|
|
23907
24102
|
{ from: legacy.authJson(), to: auditSessionFile() },
|
|
@@ -23910,16 +24105,16 @@ function migrateToLayout4() {
|
|
|
23910
24105
|
];
|
|
23911
24106
|
const authDirOverride = process.env.FAILPROOFAI_AUTH_DIR;
|
|
23912
24107
|
if (authDirOverride) {
|
|
23913
|
-
moves.push({ from:
|
|
23914
|
-
from:
|
|
23915
|
-
to:
|
|
24108
|
+
moves.push({ from: join31(authDirOverride, "auth.json"), to: join31(authDirOverride, "session.json") }, {
|
|
24109
|
+
from: join31(authDirOverride, "next-audit.json"),
|
|
24110
|
+
to: join31(authDirOverride, "reminder.json")
|
|
23916
24111
|
});
|
|
23917
24112
|
}
|
|
23918
24113
|
const migrated = [];
|
|
23919
24114
|
for (const { from, to } of moves) {
|
|
23920
|
-
if (!
|
|
24115
|
+
if (!existsSync24(from))
|
|
23921
24116
|
continue;
|
|
23922
|
-
if (
|
|
24117
|
+
if (existsSync24(to)) {
|
|
23923
24118
|
rmSync8(from, { force: true });
|
|
23924
24119
|
continue;
|
|
23925
24120
|
}
|
|
@@ -23940,7 +24135,7 @@ function migrateToLayout4() {
|
|
|
23940
24135
|
migrated.push(`${basename4(from)} → audit/${basename4(to)}`);
|
|
23941
24136
|
}
|
|
23942
24137
|
for (const secret of [auditSessionFile()]) {
|
|
23943
|
-
if (!
|
|
24138
|
+
if (!existsSync24(secret))
|
|
23944
24139
|
continue;
|
|
23945
24140
|
try {
|
|
23946
24141
|
chmodSync4(secret, 384);
|
|
@@ -23988,10 +24183,10 @@ function pruneMigratedCredentials(from) {
|
|
|
23988
24183
|
for (let layout = from;layout < LAYOUT_VERSION; layout++) {
|
|
23989
24184
|
for (const { as, landsAt } of PRUNED_AFTER_SUCCESS) {
|
|
23990
24185
|
try {
|
|
23991
|
-
if (!
|
|
24186
|
+
if (!existsSync24(landsAt()))
|
|
23992
24187
|
continue;
|
|
23993
24188
|
const copy = resolve19(migrationBackupDir(layout), as);
|
|
23994
|
-
if (!
|
|
24189
|
+
if (!existsSync24(copy))
|
|
23995
24190
|
continue;
|
|
23996
24191
|
rmSync8(copy, { force: true });
|
|
23997
24192
|
pruned.push(as);
|
|
@@ -24004,7 +24199,7 @@ function filesToBackUp() {
|
|
|
24004
24199
|
const seen = new Map;
|
|
24005
24200
|
for (const f of [...BACKED_UP, ...BACKED_UP_LEGACY]) {
|
|
24006
24201
|
const path = f.at();
|
|
24007
|
-
if (
|
|
24202
|
+
if (existsSync24(path))
|
|
24008
24203
|
seen.set(path, backupNameOf(f));
|
|
24009
24204
|
}
|
|
24010
24205
|
return [...seen].map(([path, as]) => ({ path, as }));
|
|
@@ -24312,13 +24507,13 @@ import { createHmac, randomUUID as randomUUID2 } from "node:crypto";
|
|
|
24312
24507
|
import { execSync as execSync5 } from "node:child_process";
|
|
24313
24508
|
import { readFileSync as readFileSync20, writeFileSync as writeFileSync13, mkdirSync as mkdirSync15 } from "node:fs";
|
|
24314
24509
|
import { homedir as homedir22, platform, arch, hostname, cpus } from "node:os";
|
|
24315
|
-
import { join as
|
|
24510
|
+
import { join as join32 } from "node:path";
|
|
24316
24511
|
function hashToId3(raw) {
|
|
24317
24512
|
return createHmac("sha256", NAMESPACE3).update(raw).digest("hex");
|
|
24318
24513
|
}
|
|
24319
24514
|
function getInstanceId3() {
|
|
24320
|
-
const idDir =
|
|
24321
|
-
const idFile =
|
|
24515
|
+
const idDir = join32(homedir22(), ".failproofai");
|
|
24516
|
+
const idFile = join32(idDir, "instance-id");
|
|
24322
24517
|
try {
|
|
24323
24518
|
const existing = readFileSync20(idFile, "utf-8").trim();
|
|
24324
24519
|
if (existing)
|
|
@@ -24394,7 +24589,7 @@ var NAMESPACE3 = "failproofai-telemetry-v1", API_KEY3 = "phc_Ac1Ww1GqKc0z1SyrRWb
|
|
|
24394
24589
|
var init_install_telemetry = () => {};
|
|
24395
24590
|
|
|
24396
24591
|
// lib/install-check.ts
|
|
24397
|
-
import { existsSync as
|
|
24592
|
+
import { existsSync as existsSync25, readFileSync as readFileSync21, writeFileSync as writeFileSync14, mkdirSync as mkdirSync16 } from "node:fs";
|
|
24398
24593
|
import { dirname as dirname13, resolve as resolve20 } from "node:path";
|
|
24399
24594
|
import { platform as platform2, arch as arch2, release, homedir as homedir23, hostname as hostname2 } from "node:os";
|
|
24400
24595
|
import { createHmac as createHmac2 } from "node:crypto";
|
|
@@ -24450,7 +24645,7 @@ function compareSemver(a, b) {
|
|
|
24450
24645
|
}
|
|
24451
24646
|
function checkHooks() {
|
|
24452
24647
|
const hooksConfigPath = globalPolicyConfigFile();
|
|
24453
|
-
if (!
|
|
24648
|
+
if (!existsSync25(hooksConfigPath)) {
|
|
24454
24649
|
return { configured: false, registered: false, policyCount: 0 };
|
|
24455
24650
|
}
|
|
24456
24651
|
let config;
|
|
@@ -24464,7 +24659,7 @@ function checkHooks() {
|
|
|
24464
24659
|
}
|
|
24465
24660
|
const policyCount = config.enabledPolicies.length;
|
|
24466
24661
|
const settingsPath = resolve20(homedir23(), ".claude", "settings.json");
|
|
24467
|
-
if (!
|
|
24662
|
+
if (!existsSync25(settingsPath))
|
|
24468
24663
|
return { configured: true, registered: false, policyCount };
|
|
24469
24664
|
let settings;
|
|
24470
24665
|
try {
|
|
@@ -24492,7 +24687,7 @@ async function maybeReportInstall(version) {
|
|
|
24492
24687
|
const versionFile = lastVersionPath();
|
|
24493
24688
|
let previousVersion = null;
|
|
24494
24689
|
try {
|
|
24495
|
-
if (
|
|
24690
|
+
if (existsSync25(versionFile)) {
|
|
24496
24691
|
previousVersion = readFileSync21(versionFile, "utf8").trim() || null;
|
|
24497
24692
|
}
|
|
24498
24693
|
} catch {}
|
|
@@ -24580,7 +24775,7 @@ var init_cli_error = __esm(() => {
|
|
|
24580
24775
|
|
|
24581
24776
|
// src/hooks/manager.ts
|
|
24582
24777
|
import { execSync as execSync6 } from "node:child_process";
|
|
24583
|
-
import { existsSync as
|
|
24778
|
+
import { existsSync as existsSync26 } from "node:fs";
|
|
24584
24779
|
import { resolve as resolve21, basename as basename5 } from "node:path";
|
|
24585
24780
|
import { platform as platform3, arch as arch3, release as release2, hostname as hostname3 } from "node:os";
|
|
24586
24781
|
function getSettingsPath(scope, cwd) {
|
|
@@ -24802,7 +24997,7 @@ async function installHooksImpl(policyNames, scope = "user", cwd, includeBeta =
|
|
|
24802
24997
|
} else if (customPoliciesPath && (typeof customPoliciesPath === "string" || customPoliciesPath.length > 0)) {
|
|
24803
24998
|
const incoming = (typeof customPoliciesPath === "string" ? [customPoliciesPath] : customPoliciesPath).map((path) => resolve21(path));
|
|
24804
24999
|
const carried = (previousConfig.customPoliciesPaths ?? (previousConfig.customPoliciesPath ? [previousConfig.customPoliciesPath] : [])).map((path) => resolve21(path)).filter((path) => {
|
|
24805
|
-
if (
|
|
25000
|
+
if (existsSync26(path))
|
|
24806
25001
|
return true;
|
|
24807
25002
|
console.log(`Dropping custom policies path (file no longer exists): ${path}`);
|
|
24808
25003
|
return false;
|
|
@@ -25025,7 +25220,7 @@ async function removeHooks(policyNames, scope = "user", cwd, opts) {
|
|
|
25025
25220
|
const scopesToRemove = scope === "all" ? [...integration.scopes] : integration.scopes.includes(scope) ? [scope] : [];
|
|
25026
25221
|
for (const s of scopesToRemove) {
|
|
25027
25222
|
const settingsPaths = settingsPathsFor(integration, s, cwd);
|
|
25028
|
-
const existing = settingsPaths.filter((p) =>
|
|
25223
|
+
const existing = settingsPaths.filter((p) => existsSync26(p));
|
|
25029
25224
|
if (existing.length === 0) {
|
|
25030
25225
|
if (scope !== "all" && selectedClis.length === 1) {
|
|
25031
25226
|
console.log("No settings file found. Nothing to remove.");
|
|
@@ -25190,7 +25385,7 @@ var init_leak_fingerprint = __esm(() => {
|
|
|
25190
25385
|
|
|
25191
25386
|
// src/audit/macos-notifier.ts
|
|
25192
25387
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
25193
|
-
import { chmodSync as chmodSync5, existsSync as
|
|
25388
|
+
import { chmodSync as chmodSync5, existsSync as existsSync27, mkdirSync as mkdirSync17, readdirSync as readdirSync16, renameSync as renameSync8, rmSync as rmSync9, writeFileSync as writeFileSync15 } from "node:fs";
|
|
25194
25389
|
import { homedir as homedir24 } from "node:os";
|
|
25195
25390
|
import { resolve as resolve22 } from "node:path";
|
|
25196
25391
|
function macNotifierAppPath(home) {
|
|
@@ -25315,12 +25510,12 @@ ${body.replace(/\s+/g, " ")}
|
|
|
25315
25510
|
}
|
|
25316
25511
|
}
|
|
25317
25512
|
function macNotifierInstalled(home) {
|
|
25318
|
-
return
|
|
25513
|
+
return existsSync27(macNotifierPlistPath()) && existsSync27(macNotifierRunnerPath(home));
|
|
25319
25514
|
}
|
|
25320
25515
|
function pruneMacNotifyQueue(home, maxAgeMs = 7 * 86400000) {
|
|
25321
25516
|
try {
|
|
25322
25517
|
const dir = macNotifyDir(home);
|
|
25323
|
-
if (!
|
|
25518
|
+
if (!existsSync27(dir))
|
|
25324
25519
|
return;
|
|
25325
25520
|
const { statSync } = __require("node:fs");
|
|
25326
25521
|
for (const name of readdirSync16(dir)) {
|
|
@@ -25354,7 +25549,7 @@ var DEFAULT_FETCH_TIMEOUT_MS = 15000;
|
|
|
25354
25549
|
|
|
25355
25550
|
// src/hooks/cloud-enrollment.ts
|
|
25356
25551
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
25357
|
-
import { existsSync as
|
|
25552
|
+
import { existsSync as existsSync28, readFileSync as readFileSync22, rmSync as rmSync10 } from "node:fs";
|
|
25358
25553
|
import { hostname as hostname4 } from "node:os";
|
|
25359
25554
|
function cloudCredentialPath() {
|
|
25360
25555
|
return process.env.FAILPROOFAI_CLOUD_CREDENTIALS ?? credentialsFile();
|
|
@@ -25393,7 +25588,7 @@ function readCloudCredentials() {
|
|
|
25393
25588
|
if (!usingJsonOverride())
|
|
25394
25589
|
return readCredentials().cloud ?? null;
|
|
25395
25590
|
const path = cloudCredentialPath();
|
|
25396
|
-
if (!
|
|
25591
|
+
if (!existsSync28(path))
|
|
25397
25592
|
return null;
|
|
25398
25593
|
try {
|
|
25399
25594
|
const raw = JSON.parse(readFileSync22(path, "utf8"));
|
|
@@ -25435,7 +25630,7 @@ function resolveMachineLabel(explicit) {
|
|
|
25435
25630
|
function clearCloudCredentials() {
|
|
25436
25631
|
if (usingJsonOverride()) {
|
|
25437
25632
|
const path = cloudCredentialPath();
|
|
25438
|
-
if (!
|
|
25633
|
+
if (!existsSync28(path))
|
|
25439
25634
|
return false;
|
|
25440
25635
|
try {
|
|
25441
25636
|
rmSync10(path);
|
|
@@ -25686,7 +25881,7 @@ var init_cloud_connection = __esm(() => {
|
|
|
25686
25881
|
});
|
|
25687
25882
|
|
|
25688
25883
|
// src/hooks/setup-state.ts
|
|
25689
|
-
import { existsSync as
|
|
25884
|
+
import { existsSync as existsSync29, realpathSync as realpathSync2, statSync as statSync17 } from "node:fs";
|
|
25690
25885
|
import { dirname as dirname14, resolve as resolve23 } from "node:path";
|
|
25691
25886
|
import { homedir as homedir25 } from "node:os";
|
|
25692
25887
|
function globalConfigPath(home = homedir25()) {
|
|
@@ -25743,10 +25938,10 @@ function detectSetupState(cwd = process.cwd(), home = homedir25()) {
|
|
|
25743
25938
|
cwd: resolvedCwd,
|
|
25744
25939
|
home: resolvedHome,
|
|
25745
25940
|
projectRoot,
|
|
25746
|
-
hasGlobalConfig:
|
|
25747
|
-
hasProjectConfig: projectRoot !== resolvedHome &&
|
|
25941
|
+
hasGlobalConfig: existsSync29(globalConfigPath(resolvedHome)),
|
|
25942
|
+
hasProjectConfig: projectRoot !== resolvedHome && existsSync29(projectConfigPath(projectRoot)),
|
|
25748
25943
|
hasGlobalHooks: hasGlobalHooksInstalled(),
|
|
25749
|
-
hasLegacyMarker:
|
|
25944
|
+
hasLegacyMarker: existsSync29(legacyMarkerPath(resolvedHome)),
|
|
25750
25945
|
inHomeDir: resolvedCwd === resolvedHome
|
|
25751
25946
|
};
|
|
25752
25947
|
}
|
|
@@ -25763,11 +25958,11 @@ var init_setup_state = __esm(() => {
|
|
|
25763
25958
|
});
|
|
25764
25959
|
|
|
25765
25960
|
// src/hooks/onboarding-attempt.ts
|
|
25766
|
-
import { existsSync as
|
|
25961
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync18, readFileSync as readFileSync23, rmSync as rmSync11, writeFileSync as writeFileSync16 } from "node:fs";
|
|
25767
25962
|
import { dirname as dirname15 } from "node:path";
|
|
25768
25963
|
function readOnboardingAttempt() {
|
|
25769
25964
|
const path = onboardingAttemptFile();
|
|
25770
|
-
if (!
|
|
25965
|
+
if (!existsSync30(path))
|
|
25771
25966
|
return null;
|
|
25772
25967
|
try {
|
|
25773
25968
|
const raw = JSON.parse(readFileSync23(path, "utf8"));
|
|
@@ -25900,8 +26095,8 @@ var init_onboarding_lock = __esm(() => {
|
|
|
25900
26095
|
});
|
|
25901
26096
|
|
|
25902
26097
|
// lib/claude-sessions.ts
|
|
25903
|
-
import { readdirSync as readdirSync17, statSync as statSync18, existsSync as
|
|
25904
|
-
import { join as
|
|
26098
|
+
import { readdirSync as readdirSync17, statSync as statSync18, existsSync as existsSync31 } from "node:fs";
|
|
26099
|
+
import { join as join33, basename as basename6 } from "node:path";
|
|
25905
26100
|
function getClaudeProjectsRoot() {
|
|
25906
26101
|
return getClaudeProjectsPath();
|
|
25907
26102
|
}
|
|
@@ -25916,7 +26111,7 @@ function listClaudeProjects() {
|
|
|
25916
26111
|
return entries.filter((e) => e.isDirectory()).map((e) => ({
|
|
25917
26112
|
name: e.name,
|
|
25918
26113
|
cwd: decodeFolderName(e.name),
|
|
25919
|
-
path:
|
|
26114
|
+
path: join33(root, e.name)
|
|
25920
26115
|
}));
|
|
25921
26116
|
}
|
|
25922
26117
|
function collectSubagentTranscripts(dir, relPrefix, project, out, depth) {
|
|
@@ -25932,13 +26127,13 @@ function collectSubagentTranscripts(dir, relPrefix, project, out, depth) {
|
|
|
25932
26127
|
if (entry.isSymbolicLink())
|
|
25933
26128
|
continue;
|
|
25934
26129
|
if (entry.isDirectory()) {
|
|
25935
|
-
collectSubagentTranscripts(
|
|
26130
|
+
collectSubagentTranscripts(join33(dir, entry.name), relPrefix ? `${relPrefix}__${entry.name}` : entry.name, project, out, depth + 1);
|
|
25936
26131
|
continue;
|
|
25937
26132
|
}
|
|
25938
26133
|
if (!entry.isFile() || !entry.name.endsWith(".jsonl"))
|
|
25939
26134
|
continue;
|
|
25940
26135
|
const stem = entry.name.slice(0, -".jsonl".length);
|
|
25941
|
-
const transcriptPath =
|
|
26136
|
+
const transcriptPath = join33(dir, entry.name);
|
|
25942
26137
|
try {
|
|
25943
26138
|
const s = statSync18(transcriptPath);
|
|
25944
26139
|
out.push({
|
|
@@ -25966,7 +26161,7 @@ function listClaudeTranscripts(project) {
|
|
|
25966
26161
|
const sessionId = entry.name.slice(0, -".jsonl".length);
|
|
25967
26162
|
if (!UUID_RE2.test(sessionId))
|
|
25968
26163
|
continue;
|
|
25969
|
-
const transcriptPath =
|
|
26164
|
+
const transcriptPath = join33(project.path, entry.name);
|
|
25970
26165
|
try {
|
|
25971
26166
|
const s = statSync18(transcriptPath);
|
|
25972
26167
|
out.push({
|
|
@@ -25980,8 +26175,8 @@ function listClaudeTranscripts(project) {
|
|
|
25980
26175
|
});
|
|
25981
26176
|
} catch {}
|
|
25982
26177
|
} else if (entry.isDirectory() && UUID_RE2.test(entry.name)) {
|
|
25983
|
-
const subDir =
|
|
25984
|
-
if (!
|
|
26178
|
+
const subDir = join33(project.path, entry.name, "subagents");
|
|
26179
|
+
if (!existsSync31(subDir))
|
|
25985
26180
|
continue;
|
|
25986
26181
|
collectSubagentTranscripts(subDir, entry.name, project, out, 0);
|
|
25987
26182
|
}
|
|
@@ -27483,11 +27678,11 @@ var MAX_SIGHTINGS = 5, FINDING_TTL_DAYS = 90, MAX_FINDINGS = 500, LEAK_RECORD_SC
|
|
|
27483
27678
|
|
|
27484
27679
|
// src/audit/leak-store.ts
|
|
27485
27680
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
27486
|
-
import { existsSync as
|
|
27681
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync20, readFileSync as readFileSync26 } from "node:fs";
|
|
27487
27682
|
import { dirname as dirname16 } from "node:path";
|
|
27488
27683
|
function readJson(path) {
|
|
27489
27684
|
try {
|
|
27490
|
-
if (!
|
|
27685
|
+
if (!existsSync32(path))
|
|
27491
27686
|
return null;
|
|
27492
27687
|
return JSON.parse(readFileSync26(path, "utf8"));
|
|
27493
27688
|
} catch {
|
|
@@ -27722,8 +27917,8 @@ var init_redact_example = __esm(() => {
|
|
|
27722
27917
|
|
|
27723
27918
|
// src/audit/cache.ts
|
|
27724
27919
|
import { createHash as createHash8 } from "node:crypto";
|
|
27725
|
-
import { existsSync as
|
|
27726
|
-
import { join as
|
|
27920
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync21, readFileSync as readFileSync27, writeFileSync as writeFileSync18, chmodSync as chmodSync6, openSync, readSync, closeSync } from "node:fs";
|
|
27921
|
+
import { join as join34 } from "node:path";
|
|
27727
27922
|
function getEngineVersion() {
|
|
27728
27923
|
if (cachedEngineVersion)
|
|
27729
27924
|
return cachedEngineVersion;
|
|
@@ -27743,7 +27938,7 @@ function getDetectorVersion() {
|
|
|
27743
27938
|
function getCachePathFor(transcriptPath) {
|
|
27744
27939
|
const root = auditCacheDir();
|
|
27745
27940
|
const key = createHash8("sha1").update(transcriptPath).digest("hex");
|
|
27746
|
-
return
|
|
27941
|
+
return join34(root, `${key}.json`);
|
|
27747
27942
|
}
|
|
27748
27943
|
function encodeDetectorState(state) {
|
|
27749
27944
|
return JSON.stringify(state, (_k, v) => v instanceof Map ? { __map: [...v.entries()] } : v);
|
|
@@ -27783,7 +27978,7 @@ function readCachedTranscript(transcriptPath, mtimeMs, sizeBytes) {
|
|
|
27783
27978
|
if (sizeBytes === 0)
|
|
27784
27979
|
return null;
|
|
27785
27980
|
const cachePath = getCachePathFor(transcriptPath);
|
|
27786
|
-
if (!
|
|
27981
|
+
if (!existsSync33(cachePath))
|
|
27787
27982
|
return null;
|
|
27788
27983
|
try {
|
|
27789
27984
|
const raw = readFileSync27(cachePath, "utf-8");
|
|
@@ -28547,7 +28742,7 @@ var init_audit_lock = __esm(() => {
|
|
|
28547
28742
|
});
|
|
28548
28743
|
|
|
28549
28744
|
// src/audit/dashboard-cache.ts
|
|
28550
|
-
import { existsSync as
|
|
28745
|
+
import { existsSync as existsSync34, readFileSync as readFileSync29 } from "node:fs";
|
|
28551
28746
|
function getCachePath() {
|
|
28552
28747
|
return auditDashboardFile();
|
|
28553
28748
|
}
|
|
@@ -28567,7 +28762,7 @@ function writeDashboardCache(params, result) {
|
|
|
28567
28762
|
}
|
|
28568
28763
|
function readDashboardCacheMeta() {
|
|
28569
28764
|
const cachePath = getCachePath();
|
|
28570
|
-
if (!
|
|
28765
|
+
if (!existsSync34(cachePath))
|
|
28571
28766
|
return null;
|
|
28572
28767
|
try {
|
|
28573
28768
|
const raw = readFileSync29(cachePath, "utf-8");
|
|
@@ -28794,15 +28989,15 @@ var init_api_server_client = __esm(() => {
|
|
|
28794
28989
|
});
|
|
28795
28990
|
|
|
28796
28991
|
// lib/auth/auth-store.ts
|
|
28797
|
-
import { existsSync as
|
|
28798
|
-
import { join as
|
|
28992
|
+
import { existsSync as existsSync35, readFileSync as readFileSync30, readdirSync as readdirSync18, rmSync as rmSync13 } from "node:fs";
|
|
28993
|
+
import { join as join35, resolve as resolve24 } from "node:path";
|
|
28799
28994
|
function getAuthFilePath() {
|
|
28800
28995
|
const override = process.env.FAILPROOFAI_AUTH_DIR;
|
|
28801
|
-
return override ?
|
|
28996
|
+
return override ? join35(override, "session.json") : auditSessionFile();
|
|
28802
28997
|
}
|
|
28803
28998
|
function readAuth() {
|
|
28804
28999
|
const p = getAuthFilePath();
|
|
28805
|
-
if (!
|
|
29000
|
+
if (!existsSync35(p))
|
|
28806
29001
|
return null;
|
|
28807
29002
|
try {
|
|
28808
29003
|
const raw = readFileSync30(p, "utf-8");
|
|
@@ -28829,17 +29024,17 @@ function writeAuth(auth) {
|
|
|
28829
29024
|
}
|
|
28830
29025
|
function deleteAuth() {
|
|
28831
29026
|
const p = getAuthFilePath();
|
|
28832
|
-
if (
|
|
29027
|
+
if (existsSync35(p))
|
|
28833
29028
|
rmSync13(p, { force: true });
|
|
28834
29029
|
try {
|
|
28835
29030
|
const root = migrationsDir();
|
|
28836
|
-
if (!
|
|
29031
|
+
if (!existsSync35(root))
|
|
28837
29032
|
return;
|
|
28838
29033
|
for (const entry of readdirSync18(root)) {
|
|
28839
29034
|
if (!entry.startsWith("backup-layout"))
|
|
28840
29035
|
continue;
|
|
28841
29036
|
const copy = resolve24(root, entry, "auth.json");
|
|
28842
|
-
if (
|
|
29037
|
+
if (existsSync35(copy))
|
|
28843
29038
|
rmSync13(copy, { force: true });
|
|
28844
29039
|
}
|
|
28845
29040
|
} catch {}
|
|
@@ -29019,12 +29214,12 @@ var init_harm_report = __esm(() => {
|
|
|
29019
29214
|
});
|
|
29020
29215
|
|
|
29021
29216
|
// src/audit/machine-store.ts
|
|
29022
|
-
import { existsSync as
|
|
29217
|
+
import { existsSync as existsSync36, readFileSync as readFileSync31, rmSync as rmSync14 } from "node:fs";
|
|
29023
29218
|
import { hostname as hostname5 } from "node:os";
|
|
29024
29219
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
29025
29220
|
function readMachineIdentity(home) {
|
|
29026
29221
|
const path = auditMachineFile(home);
|
|
29027
|
-
if (!
|
|
29222
|
+
if (!existsSync36(path))
|
|
29028
29223
|
return null;
|
|
29029
29224
|
try {
|
|
29030
29225
|
const parsed = JSON.parse(readFileSync31(path, "utf8"));
|
|
@@ -29623,7 +29818,7 @@ var init_cli = __esm(() => {
|
|
|
29623
29818
|
});
|
|
29624
29819
|
|
|
29625
29820
|
// src/hooks/configure-wizard.ts
|
|
29626
|
-
import { existsSync as
|
|
29821
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync23, writeFileSync as writeFileSync20, readFileSync as readFileSync32 } from "node:fs";
|
|
29627
29822
|
import { homedir as homedir28 } from "node:os";
|
|
29628
29823
|
import { dirname as dirname17, resolve as resolve25, sep as sep5 } from "node:path";
|
|
29629
29824
|
async function emit(event, props) {
|
|
@@ -29648,7 +29843,7 @@ function setCustomPoliciesEnabled(scope, cwd, enabled) {
|
|
|
29648
29843
|
const path = getConfigPathForScope(scope, cwd);
|
|
29649
29844
|
let config = {};
|
|
29650
29845
|
try {
|
|
29651
|
-
if (
|
|
29846
|
+
if (existsSync37(path))
|
|
29652
29847
|
config = JSON.parse(readFileSync32(path, "utf8"));
|
|
29653
29848
|
} catch {
|
|
29654
29849
|
return;
|
|
@@ -30303,17 +30498,17 @@ var init_configure_wizard = __esm(() => {
|
|
|
30303
30498
|
});
|
|
30304
30499
|
|
|
30305
30500
|
// src/hooks/flush-cli.ts
|
|
30306
|
-
import { existsSync as
|
|
30307
|
-
import { dirname as dirname18, join as
|
|
30501
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync24, writeFileSync as writeFileSync21, readdirSync as readdirSync19 } from "node:fs";
|
|
30502
|
+
import { dirname as dirname18, join as join36 } from "node:path";
|
|
30308
30503
|
function flushRequestPath2(home) {
|
|
30309
|
-
return
|
|
30504
|
+
return join36(failproofaiHome(home), "state", "flush-request.json");
|
|
30310
30505
|
}
|
|
30311
30506
|
function spoolDirs2(home) {
|
|
30312
30507
|
const root = spoolDir(home);
|
|
30313
|
-
if (!
|
|
30508
|
+
if (!existsSync38(root))
|
|
30314
30509
|
return [];
|
|
30315
30510
|
try {
|
|
30316
|
-
return readdirSync19(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) =>
|
|
30511
|
+
return readdirSync19(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join36(root, e.name));
|
|
30317
30512
|
} catch {
|
|
30318
30513
|
return [];
|
|
30319
30514
|
}
|
|
@@ -30411,16 +30606,16 @@ var init_flush_cli2 = __esm(() => {
|
|
|
30411
30606
|
});
|
|
30412
30607
|
|
|
30413
30608
|
// src/hooks/backfill-cli.ts
|
|
30414
|
-
import { existsSync as
|
|
30415
|
-
import { dirname as dirname19, join as
|
|
30609
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync25, writeFileSync as writeFileSync22, readdirSync as readdirSync20, statSync as statSync23 } from "node:fs";
|
|
30610
|
+
import { dirname as dirname19, join as join37 } from "node:path";
|
|
30416
30611
|
function backfillRequestPath(home) {
|
|
30417
|
-
return
|
|
30612
|
+
return join37(failproofaiHome(home), "state", "backfill-request.json");
|
|
30418
30613
|
}
|
|
30419
30614
|
function surveySessions(sinceMs, homeDir) {
|
|
30420
30615
|
const out = [];
|
|
30421
30616
|
for (const { cli, dir } of SESSION_DIRS) {
|
|
30422
|
-
const root =
|
|
30423
|
-
if (!
|
|
30617
|
+
const root = join37(homeDir, dir);
|
|
30618
|
+
if (!existsSync39(root))
|
|
30424
30619
|
continue;
|
|
30425
30620
|
let files = 0;
|
|
30426
30621
|
let newest = 0;
|
|
@@ -30434,7 +30629,7 @@ function surveySessions(sinceMs, homeDir) {
|
|
|
30434
30629
|
return;
|
|
30435
30630
|
}
|
|
30436
30631
|
for (const e of entries) {
|
|
30437
|
-
const p =
|
|
30632
|
+
const p = join37(d, e.name);
|
|
30438
30633
|
if (e.isDirectory()) {
|
|
30439
30634
|
walk(p, depth + 1);
|
|
30440
30635
|
continue;
|
|
@@ -30458,7 +30653,7 @@ function runBackfillCommand(opts = {}) {
|
|
|
30458
30653
|
const now = opts.now ?? Date.now();
|
|
30459
30654
|
const sinceMs = opts.sinceMs ?? now - DEFAULT_BACKFILL_DAYS * 24 * 60 * 60 * 1000;
|
|
30460
30655
|
const home = failproofaiHome();
|
|
30461
|
-
if (!
|
|
30656
|
+
if (!existsSync39(home)) {
|
|
30462
30657
|
return {
|
|
30463
30658
|
exitCode: 1,
|
|
30464
30659
|
lines: [`No failproofai home at ${home}. Run \`failproofai config\` first.`]
|
|
@@ -30789,7 +30984,7 @@ var init_harness_cli = __esm(() => {
|
|
|
30789
30984
|
});
|
|
30790
30985
|
|
|
30791
30986
|
// src/hooks/fp-config.ts
|
|
30792
|
-
import { chmodSync as chmodSync7, existsSync as
|
|
30987
|
+
import { chmodSync as chmodSync7, existsSync as existsSync40, mkdirSync as mkdirSync26, readFileSync as readFileSync33, statSync as statSync24, writeFileSync as writeFileSync23 } from "node:fs";
|
|
30793
30988
|
function detectLayout2() {
|
|
30794
30989
|
const raw = readVersionFile2();
|
|
30795
30990
|
if (raw) {
|
|
@@ -30797,17 +30992,17 @@ function detectLayout2() {
|
|
|
30797
30992
|
return { kind: "current", version: raw };
|
|
30798
30993
|
return raw.layout > LAYOUT_VERSION ? { kind: "future", found: raw.layout } : { kind: "stale", found: raw.layout };
|
|
30799
30994
|
}
|
|
30800
|
-
if (
|
|
30995
|
+
if (existsSync40(configFile())) {
|
|
30801
30996
|
const layoutThreePositions = [
|
|
30802
30997
|
legacy.authJson(),
|
|
30803
30998
|
legacy.nextAudit(),
|
|
30804
30999
|
legacy.auditSchedule()
|
|
30805
31000
|
];
|
|
30806
|
-
if (layoutThreePositions.some((p) =>
|
|
31001
|
+
if (layoutThreePositions.some((p) => existsSync40(p)))
|
|
30807
31002
|
return { kind: "stale", found: 3 };
|
|
30808
31003
|
return { kind: "current", version: { layout: LAYOUT_VERSION, cli: "" }, inferred: true };
|
|
30809
31004
|
}
|
|
30810
|
-
if (
|
|
31005
|
+
if (existsSync40(legacy.configToml()))
|
|
30811
31006
|
return { kind: "stale", found: 2 };
|
|
30812
31007
|
const layoutOneMarkers = [
|
|
30813
31008
|
legacy.policyConfig(),
|
|
@@ -30818,7 +31013,7 @@ function detectLayout2() {
|
|
|
30818
31013
|
legacy.ingestCredentials(),
|
|
30819
31014
|
legacy.auditDashboard()
|
|
30820
31015
|
];
|
|
30821
|
-
return layoutOneMarkers.some((p) =>
|
|
31016
|
+
return layoutOneMarkers.some((p) => existsSync40(p)) ? { kind: "stale", found: 1 } : { kind: "absent" };
|
|
30822
31017
|
}
|
|
30823
31018
|
function readLegacyTomlVersion2(text) {
|
|
30824
31019
|
const layout = Number(/^\s*layout\s*=\s*(\d+)\s*$/m.exec(text)?.[1]);
|
|
@@ -30861,14 +31056,14 @@ var init_fp_home2 = () => {};
|
|
|
30861
31056
|
import {
|
|
30862
31057
|
chmodSync as chmodSync8,
|
|
30863
31058
|
copyFileSync as copyFileSync3,
|
|
30864
|
-
existsSync as
|
|
31059
|
+
existsSync as existsSync41,
|
|
30865
31060
|
mkdirSync as mkdirSync27,
|
|
30866
31061
|
readFileSync as readFileSync34,
|
|
30867
31062
|
renameSync as renameSync9,
|
|
30868
31063
|
rmSync as rmSync15,
|
|
30869
31064
|
writeFileSync as writeFileSync24
|
|
30870
31065
|
} from "node:fs";
|
|
30871
|
-
import { basename as basename7, dirname as dirname20, join as
|
|
31066
|
+
import { basename as basename7, dirname as dirname20, join as join38, resolve as resolve27 } from "node:path";
|
|
30872
31067
|
function migrateToLayout42() {
|
|
30873
31068
|
const moves = [
|
|
30874
31069
|
{ from: legacy.authJson(), to: auditSessionFile() },
|
|
@@ -30877,16 +31072,16 @@ function migrateToLayout42() {
|
|
|
30877
31072
|
];
|
|
30878
31073
|
const authDirOverride = process.env.FAILPROOFAI_AUTH_DIR;
|
|
30879
31074
|
if (authDirOverride) {
|
|
30880
|
-
moves.push({ from:
|
|
30881
|
-
from:
|
|
30882
|
-
to:
|
|
31075
|
+
moves.push({ from: join38(authDirOverride, "auth.json"), to: join38(authDirOverride, "session.json") }, {
|
|
31076
|
+
from: join38(authDirOverride, "next-audit.json"),
|
|
31077
|
+
to: join38(authDirOverride, "reminder.json")
|
|
30883
31078
|
});
|
|
30884
31079
|
}
|
|
30885
31080
|
const migrated = [];
|
|
30886
31081
|
for (const { from, to } of moves) {
|
|
30887
|
-
if (!
|
|
31082
|
+
if (!existsSync41(from))
|
|
30888
31083
|
continue;
|
|
30889
|
-
if (
|
|
31084
|
+
if (existsSync41(to)) {
|
|
30890
31085
|
rmSync15(from, { force: true });
|
|
30891
31086
|
continue;
|
|
30892
31087
|
}
|
|
@@ -30907,7 +31102,7 @@ function migrateToLayout42() {
|
|
|
30907
31102
|
migrated.push(`${basename7(from)} → audit/${basename7(to)}`);
|
|
30908
31103
|
}
|
|
30909
31104
|
for (const secret of [auditSessionFile()]) {
|
|
30910
|
-
if (!
|
|
31105
|
+
if (!existsSync41(secret))
|
|
30911
31106
|
continue;
|
|
30912
31107
|
try {
|
|
30913
31108
|
chmodSync8(secret, 384);
|
|
@@ -30955,10 +31150,10 @@ function pruneMigratedCredentials2(from) {
|
|
|
30955
31150
|
for (let layout = from;layout < LAYOUT_VERSION; layout++) {
|
|
30956
31151
|
for (const { as, landsAt } of PRUNED_AFTER_SUCCESS2) {
|
|
30957
31152
|
try {
|
|
30958
|
-
if (!
|
|
31153
|
+
if (!existsSync41(landsAt()))
|
|
30959
31154
|
continue;
|
|
30960
31155
|
const copy = resolve27(migrationBackupDir(layout), as);
|
|
30961
|
-
if (!
|
|
31156
|
+
if (!existsSync41(copy))
|
|
30962
31157
|
continue;
|
|
30963
31158
|
rmSync15(copy, { force: true });
|
|
30964
31159
|
pruned.push(as);
|
|
@@ -30971,7 +31166,7 @@ function filesToBackUp2() {
|
|
|
30971
31166
|
const seen = new Map;
|
|
30972
31167
|
for (const f of [...BACKED_UP2, ...BACKED_UP_LEGACY2]) {
|
|
30973
31168
|
const path = f.at();
|
|
30974
|
-
if (
|
|
31169
|
+
if (existsSync41(path))
|
|
30975
31170
|
seen.set(path, backupNameOf2(f));
|
|
30976
31171
|
}
|
|
30977
31172
|
return [...seen].map(([path, as]) => ({ path, as }));
|
|
@@ -31125,7 +31320,7 @@ var init_migrations2 = __esm(() => {
|
|
|
31125
31320
|
|
|
31126
31321
|
// src/hooks/daemon-service.ts
|
|
31127
31322
|
import {
|
|
31128
|
-
existsSync as
|
|
31323
|
+
existsSync as existsSync42,
|
|
31129
31324
|
mkdirSync as mkdirSync28,
|
|
31130
31325
|
mkdtempSync as mkdtempSync2,
|
|
31131
31326
|
readFileSync as readFileSync35,
|
|
@@ -31150,13 +31345,13 @@ function resolveFailproofaidBinaryPath2() {
|
|
|
31150
31345
|
if (process.env.FAILPROOFAI_DAEMON_BINARY)
|
|
31151
31346
|
return process.env.FAILPROOFAI_DAEMON_BINARY;
|
|
31152
31347
|
const downloaded = installedBinaryPath();
|
|
31153
|
-
if (
|
|
31348
|
+
if (existsSync42(downloaded))
|
|
31154
31349
|
return downloaded;
|
|
31155
31350
|
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT;
|
|
31156
31351
|
if (packageRoot) {
|
|
31157
31352
|
for (const profile of ["release", "debug"]) {
|
|
31158
31353
|
const candidate = resolve28(packageRoot, "target", profile, "failproofaid");
|
|
31159
|
-
if (
|
|
31354
|
+
if (existsSync42(candidate))
|
|
31160
31355
|
return candidate;
|
|
31161
31356
|
}
|
|
31162
31357
|
}
|
|
@@ -31187,7 +31382,7 @@ function resolveWorkerCommand2() {
|
|
|
31187
31382
|
if (!packageRoot)
|
|
31188
31383
|
return null;
|
|
31189
31384
|
const workerScript = resolve28(packageRoot, "dist", "worker.mjs");
|
|
31190
|
-
if (!
|
|
31385
|
+
if (!existsSync42(workerScript))
|
|
31191
31386
|
return null;
|
|
31192
31387
|
return `${shellQuote2(process.execPath)} ${shellQuote2(workerScript)}`;
|
|
31193
31388
|
}
|
|
@@ -31198,7 +31393,7 @@ function resolveCliCommand2() {
|
|
|
31198
31393
|
if (!packageRoot)
|
|
31199
31394
|
return null;
|
|
31200
31395
|
const cliScript = resolve28(packageRoot, "dist", "cli.mjs");
|
|
31201
|
-
if (!
|
|
31396
|
+
if (!existsSync42(cliScript))
|
|
31202
31397
|
return null;
|
|
31203
31398
|
return `${shellQuote2(process.execPath)} ${shellQuote2(cliScript)}`;
|
|
31204
31399
|
}
|
|
@@ -31212,7 +31407,7 @@ function workerScriptPath2() {
|
|
|
31212
31407
|
if (!packageRoot)
|
|
31213
31408
|
return null;
|
|
31214
31409
|
const workerScript = resolve28(packageRoot, "dist", "worker.mjs");
|
|
31215
|
-
return
|
|
31410
|
+
return existsSync42(workerScript) ? workerScript : null;
|
|
31216
31411
|
}
|
|
31217
31412
|
function assertUnitSafe2(value, field) {
|
|
31218
31413
|
if (UNIT_UNSAFE_RE2.test(value)) {
|
|
@@ -31301,7 +31496,7 @@ function removeLegacyUserService2() {
|
|
|
31301
31496
|
try {
|
|
31302
31497
|
if (process.platform === "linux") {
|
|
31303
31498
|
const legacy = legacySystemdUserUnitPath2();
|
|
31304
|
-
if (!
|
|
31499
|
+
if (!existsSync42(legacy))
|
|
31305
31500
|
return;
|
|
31306
31501
|
try {
|
|
31307
31502
|
execFileSync4("systemctl", ["--user", "disable", "--now", "failproofaid.service"], {
|
|
@@ -31318,7 +31513,7 @@ function removeLegacyUserService2() {
|
|
|
31318
31513
|
} catch {}
|
|
31319
31514
|
} else {
|
|
31320
31515
|
const legacyAgent = legacyLaunchAgentPlistPath2();
|
|
31321
|
-
if (
|
|
31516
|
+
if (existsSync42(legacyAgent)) {
|
|
31322
31517
|
try {
|
|
31323
31518
|
execFileSync4("launchctl", ["unload", "-w", legacyAgent], {
|
|
31324
31519
|
stdio: "ignore",
|
|
@@ -31328,7 +31523,7 @@ function removeLegacyUserService2() {
|
|
|
31328
31523
|
unlinkSync5(legacyAgent);
|
|
31329
31524
|
}
|
|
31330
31525
|
const legacyDaemon = legacySharedLaunchDaemonPath2();
|
|
31331
|
-
if (
|
|
31526
|
+
if (existsSync42(legacyDaemon)) {
|
|
31332
31527
|
try {
|
|
31333
31528
|
runPrivileged2("launchctl", ["unload", "-w", legacyDaemon]);
|
|
31334
31529
|
} catch {}
|
|
@@ -31345,7 +31540,7 @@ function systemdUnitContents2(binaryPath, workerCmd, cliCmd = null) {
|
|
|
31345
31540
|
const user = assertUnitSafe2(serviceUser2(), "User");
|
|
31346
31541
|
assertUnitSafe2(binaryPath, "ExecStart");
|
|
31347
31542
|
assertUnitSafe2(homedir30(), "HOME");
|
|
31348
|
-
const conditionPaths = [binaryPath, workerScriptPath2()].filter((p) => typeof p === "string" &&
|
|
31543
|
+
const conditionPaths = [binaryPath, workerScriptPath2()].filter((p) => typeof p === "string" && existsSync42(p));
|
|
31349
31544
|
const conditionLines = conditionPaths.map((p) => `ConditionPathExists=${assertUnitSafe2(p, "ConditionPathExists")}
|
|
31350
31545
|
`).join("");
|
|
31351
31546
|
return `[Unit]
|
|
@@ -31550,7 +31745,7 @@ function daemonServiceStatus2() {
|
|
|
31550
31745
|
if (!isDaemonSupportedPlatform2())
|
|
31551
31746
|
return "unsupported-platform";
|
|
31552
31747
|
if (process.platform === "linux") {
|
|
31553
|
-
if (!
|
|
31748
|
+
if (!existsSync42(systemdUnitPath2()))
|
|
31554
31749
|
return "not-installed";
|
|
31555
31750
|
try {
|
|
31556
31751
|
const out = execFileSync4("systemctl", ["is-active", systemdUnitName2()], {
|
|
@@ -31563,7 +31758,7 @@ function daemonServiceStatus2() {
|
|
|
31563
31758
|
}
|
|
31564
31759
|
}
|
|
31565
31760
|
const plistPath = launchdPlistPath2();
|
|
31566
|
-
if (!
|
|
31761
|
+
if (!existsSync42(plistPath))
|
|
31567
31762
|
return "not-installed";
|
|
31568
31763
|
try {
|
|
31569
31764
|
const root = typeof process.getuid === "function" && process.getuid() === 0;
|
|
@@ -31593,7 +31788,7 @@ var init_daemon_service2 = __esm(() => {
|
|
|
31593
31788
|
});
|
|
31594
31789
|
|
|
31595
31790
|
// src/hooks/uninstall-cli.ts
|
|
31596
|
-
import { existsSync as
|
|
31791
|
+
import { existsSync as existsSync43, rmSync as rmSync17 } from "node:fs";
|
|
31597
31792
|
function survey(cwd) {
|
|
31598
31793
|
const clis = [];
|
|
31599
31794
|
for (const id of listInstallableIds()) {
|
|
@@ -31614,9 +31809,9 @@ function survey(cwd) {
|
|
|
31614
31809
|
return {
|
|
31615
31810
|
clis,
|
|
31616
31811
|
servicePath,
|
|
31617
|
-
serviceInstalled: !!servicePath &&
|
|
31812
|
+
serviceInstalled: !!servicePath && existsSync43(servicePath),
|
|
31618
31813
|
daemonConfigured,
|
|
31619
|
-
homeExists:
|
|
31814
|
+
homeExists: existsSync43(failproofaiHome())
|
|
31620
31815
|
};
|
|
31621
31816
|
}
|
|
31622
31817
|
async function runUninstallCommand(opts = {}) {
|
|
@@ -31715,7 +31910,7 @@ async function runUninstallCommand(opts = {}) {
|
|
|
31715
31910
|
} catch {}
|
|
31716
31911
|
try {
|
|
31717
31912
|
await uninstallDaemonService();
|
|
31718
|
-
if (found.servicePath &&
|
|
31913
|
+
if (found.servicePath && existsSync43(found.servicePath)) {
|
|
31719
31914
|
failures.push(`the service at ${found.servicePath} is still there (most often: no sudo). ` + `Remove it with the commands below.`);
|
|
31720
31915
|
} else {
|
|
31721
31916
|
lines.push(`✓ stopped and removed the daemon service`);
|
|
@@ -31741,7 +31936,7 @@ async function runUninstallCommand(opts = {}) {
|
|
|
31741
31936
|
lines.push(``, `Not everything could be removed:`);
|
|
31742
31937
|
for (const f of failures)
|
|
31743
31938
|
lines.push(` ✗ ${f}`);
|
|
31744
|
-
if (found.servicePath &&
|
|
31939
|
+
if (found.servicePath && existsSync43(found.servicePath)) {
|
|
31745
31940
|
lines.push(``, `To remove the service by hand:`, ...manualServiceRemoval(found.servicePath), ``, `(\`${daemonStatusCommand()}\` shows its current state.)`);
|
|
31746
31941
|
}
|
|
31747
31942
|
return { exitCode: 1, lines, planLines, purged };
|
|
@@ -31776,8 +31971,8 @@ var init_uninstall_cli = __esm(() => {
|
|
|
31776
31971
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
31777
31972
|
import { homedir as homedir31, tmpdir as tmpdir4 } from "node:os";
|
|
31778
31973
|
import { createHash as createHash9 } from "node:crypto";
|
|
31779
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
31780
|
-
import { basename as basename8, dirname as dirname21, isAbsolute as isAbsolute4, join as
|
|
31974
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync44, mkdirSync as mkdirSync29, mkdtempSync as mkdtempSync3, readFileSync as readFileSync36, readdirSync as readdirSync21, realpathSync as realpathSync3, rmSync as rmSync18, statSync as statSync25, writeFileSync as writeFileSync26 } from "node:fs";
|
|
31975
|
+
import { basename as basename8, dirname as dirname21, isAbsolute as isAbsolute4, join as join39, relative as relative5, resolve as resolve29, sep as sep6 } from "node:path";
|
|
31781
31976
|
function parseList(rest, flag) {
|
|
31782
31977
|
const idx = rest.findIndex((a) => a === flag || a.startsWith(`${flag}=`));
|
|
31783
31978
|
if (idx === -1)
|
|
@@ -31891,7 +32086,7 @@ async function build(rest) {
|
|
|
31891
32086
|
return fail2([err instanceof Error ? err.message : String(err)]);
|
|
31892
32087
|
}
|
|
31893
32088
|
const entryPath = resolve29(entry);
|
|
31894
|
-
if (!
|
|
32089
|
+
if (!existsSync44(entryPath))
|
|
31895
32090
|
return fail2([`No such file: ${entryPath}`]);
|
|
31896
32091
|
const source = readFileSync36(entryPath, "utf8");
|
|
31897
32092
|
const localImport = /(?:^|\n)\s*(?:import|export)[^;\n]*from\s+["'](\.[^"']*)["']/.exec(source);
|
|
@@ -32086,7 +32281,7 @@ async function scaffold(target) {
|
|
|
32086
32281
|
chosen = answer.trim();
|
|
32087
32282
|
}
|
|
32088
32283
|
const path = resolve29(withPolicyExtension(chosen ?? "my-policies"));
|
|
32089
|
-
if (
|
|
32284
|
+
if (existsSync44(path)) {
|
|
32090
32285
|
return fail2([`${path} already exists — name a different file, or edit that one.`]);
|
|
32091
32286
|
}
|
|
32092
32287
|
mkdirSync29(resolve29(path, ".."), { recursive: true });
|
|
@@ -32538,7 +32733,7 @@ function pushExistingHistory(dir, owner, name, token) {
|
|
|
32538
32733
|
const branch = git(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
32539
32734
|
if (!branch || branch === "HEAD" || !git(["rev-parse", "--verify", "HEAD"]))
|
|
32540
32735
|
return false;
|
|
32541
|
-
const askpass =
|
|
32736
|
+
const askpass = join39(mkdtempSync3(join39(tmpdir4(), "fpai-askpass-")), "askpass.sh");
|
|
32542
32737
|
try {
|
|
32543
32738
|
writeFileSync26(askpass, `#!/bin/sh
|
|
32544
32739
|
case "$1" in
|
|
@@ -33584,7 +33779,7 @@ var init_install_prompt = __esm(() => {
|
|
|
33584
33779
|
|
|
33585
33780
|
// src/hooks/manager.ts
|
|
33586
33781
|
import { execSync as execSync7 } from "node:child_process";
|
|
33587
|
-
import { existsSync as
|
|
33782
|
+
import { existsSync as existsSync45 } from "node:fs";
|
|
33588
33783
|
import { resolve as resolve30, basename as basename9 } from "node:path";
|
|
33589
33784
|
import { platform as platform4, arch as arch4, release as release3, hostname as hostname6 } from "node:os";
|
|
33590
33785
|
function getSettingsPath2(scope, cwd) {
|
|
@@ -33806,7 +34001,7 @@ async function installHooksImpl2(policyNames, scope = "user", cwd, includeBeta =
|
|
|
33806
34001
|
} else if (customPoliciesPath && (typeof customPoliciesPath === "string" || customPoliciesPath.length > 0)) {
|
|
33807
34002
|
const incoming = (typeof customPoliciesPath === "string" ? [customPoliciesPath] : customPoliciesPath).map((path) => resolve30(path));
|
|
33808
34003
|
const carried = (previousConfig.customPoliciesPaths ?? (previousConfig.customPoliciesPath ? [previousConfig.customPoliciesPath] : [])).map((path) => resolve30(path)).filter((path) => {
|
|
33809
|
-
if (
|
|
34004
|
+
if (existsSync45(path))
|
|
33810
34005
|
return true;
|
|
33811
34006
|
console.log(`Dropping custom policies path (file no longer exists): ${path}`);
|
|
33812
34007
|
return false;
|
|
@@ -34029,7 +34224,7 @@ async function removeHooks2(policyNames, scope = "user", cwd, opts) {
|
|
|
34029
34224
|
const scopesToRemove = scope === "all" ? [...integration.scopes] : integration.scopes.includes(scope) ? [scope] : [];
|
|
34030
34225
|
for (const s of scopesToRemove) {
|
|
34031
34226
|
const settingsPaths = settingsPathsFor(integration, s, cwd);
|
|
34032
|
-
const existing = settingsPaths.filter((p) =>
|
|
34227
|
+
const existing = settingsPaths.filter((p) => existsSync45(p));
|
|
34033
34228
|
if (existing.length === 0) {
|
|
34034
34229
|
if (scope !== "all" && selectedClis.length === 1) {
|
|
34035
34230
|
console.log("No settings file found. Nothing to remove.");
|
|
@@ -34175,7 +34370,7 @@ async function listHooks(cwd) {
|
|
|
34175
34370
|
for (const path of explicitPaths) {
|
|
34176
34371
|
const absPath = resolve30(findProjectConfigDir(cwd ?? process.cwd()), path);
|
|
34177
34372
|
groups.push(note(absPath, opts));
|
|
34178
|
-
if (!
|
|
34373
|
+
if (!existsSync45(absPath)) {
|
|
34179
34374
|
groups.push(warning([`file not found: ${absPath}`], opts));
|
|
34180
34375
|
continue;
|
|
34181
34376
|
}
|
|
@@ -34753,19 +34948,19 @@ function parseScriptArgs(argv) {
|
|
|
34753
34948
|
var init_parse_script_args = () => {};
|
|
34754
34949
|
|
|
34755
34950
|
// scripts/install-diagnosis.mjs
|
|
34756
|
-
import { existsSync as
|
|
34951
|
+
import { existsSync as existsSync46, readFileSync as readFileSync38, realpathSync as realpathSync4 } from "node:fs";
|
|
34757
34952
|
import { dirname as dirname22, resolve as resolve32 } from "node:path";
|
|
34758
34953
|
import { homedir as homedir32, platform as platform5 } from "node:os";
|
|
34759
34954
|
import { spawnSync } from "node:child_process";
|
|
34760
34955
|
function findPackageRoot(start) {
|
|
34761
34956
|
try {
|
|
34762
34957
|
let dir = realpathSync4(start);
|
|
34763
|
-
if (
|
|
34958
|
+
if (existsSync46(dir) && !existsSync46(resolve32(dir, "package.json"))) {
|
|
34764
34959
|
dir = dirname22(dir);
|
|
34765
34960
|
}
|
|
34766
34961
|
while (true) {
|
|
34767
34962
|
const pkgPath = resolve32(dir, "package.json");
|
|
34768
|
-
if (
|
|
34963
|
+
if (existsSync46(pkgPath)) {
|
|
34769
34964
|
try {
|
|
34770
34965
|
const pkg = JSON.parse(readFileSync38(pkgPath, "utf8"));
|
|
34771
34966
|
if (pkg.name === PKG_NAME)
|
|
@@ -34812,7 +35007,7 @@ function locateNpmGlobal() {
|
|
|
34812
35007
|
if (!root)
|
|
34813
35008
|
return null;
|
|
34814
35009
|
const candidate = resolve32(root, PKG_NAME);
|
|
34815
|
-
return
|
|
35010
|
+
return existsSync46(resolve32(candidate, "package.json")) ? candidate : null;
|
|
34816
35011
|
} catch {
|
|
34817
35012
|
return null;
|
|
34818
35013
|
}
|
|
@@ -34820,7 +35015,7 @@ function locateNpmGlobal() {
|
|
|
34820
35015
|
function locateBunGlobal() {
|
|
34821
35016
|
try {
|
|
34822
35017
|
const candidate = resolve32(homedir32(), ".bun", "install", "global", "node_modules", PKG_NAME);
|
|
34823
|
-
return
|
|
35018
|
+
return existsSync46(resolve32(candidate, "package.json")) ? candidate : null;
|
|
34824
35019
|
} catch {
|
|
34825
35020
|
return null;
|
|
34826
35021
|
}
|
|
@@ -34923,7 +35118,7 @@ var init_dashboard_host = __esm(() => {
|
|
|
34923
35118
|
|
|
34924
35119
|
// scripts/launch.ts
|
|
34925
35120
|
import { spawn as spawn2 } from "child_process";
|
|
34926
|
-
import { realpathSync as realpathSync5, existsSync as
|
|
35121
|
+
import { realpathSync as realpathSync5, existsSync as existsSync47 } from "node:fs";
|
|
34927
35122
|
import { resolve as resolve33, dirname as dirname23 } from "node:path";
|
|
34928
35123
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
34929
35124
|
import { createInterface } from "node:readline";
|
|
@@ -34950,7 +35145,7 @@ function launch(mode) {
|
|
|
34950
35145
|
cmd = "node";
|
|
34951
35146
|
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve33(dirname23(realpathSync5(fileURLToPath2(import.meta.url))), "..");
|
|
34952
35147
|
const serverJsPath = resolve33(packageRoot, ".next/standalone/server.js");
|
|
34953
|
-
if (!
|
|
35148
|
+
if (!existsSync47(serverJsPath)) {
|
|
34954
35149
|
let shadowMessage = null;
|
|
34955
35150
|
try {
|
|
34956
35151
|
const diag = diagnoseShadow({ selfPackageRoot: packageRoot, selfVersion: version2 });
|
|
@@ -35760,7 +35955,7 @@ var init_session_pause_cli = __esm(() => {
|
|
|
35760
35955
|
|
|
35761
35956
|
// scripts/launch.ts
|
|
35762
35957
|
import { spawn as spawn3 } from "child_process";
|
|
35763
|
-
import { realpathSync as realpathSync6, existsSync as
|
|
35958
|
+
import { realpathSync as realpathSync6, existsSync as existsSync48 } from "node:fs";
|
|
35764
35959
|
import { resolve as resolve34, dirname as dirname24 } from "node:path";
|
|
35765
35960
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
35766
35961
|
import { createInterface as createInterface2 } from "node:readline";
|
|
@@ -35787,7 +35982,7 @@ function launch2(mode) {
|
|
|
35787
35982
|
cmd = "node";
|
|
35788
35983
|
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve34(dirname24(realpathSync6(fileURLToPath3(import.meta.url))), "..");
|
|
35789
35984
|
const serverJsPath = resolve34(packageRoot, ".next/standalone/server.js");
|
|
35790
|
-
if (!
|
|
35985
|
+
if (!existsSync48(serverJsPath)) {
|
|
35791
35986
|
let shadowMessage = null;
|
|
35792
35987
|
try {
|
|
35793
35988
|
const diag = diagnoseShadow({ selfPackageRoot: packageRoot, selfVersion: version2 });
|
|
@@ -35887,7 +36082,7 @@ import { realpathSync as realpathSync7 } from "fs";
|
|
|
35887
36082
|
import { dirname as dirname25, resolve as resolve35 } from "path";
|
|
35888
36083
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
35889
36084
|
// package.json
|
|
35890
|
-
var version = "1.0.4-beta.
|
|
36085
|
+
var version = "1.0.4-beta.8";
|
|
35891
36086
|
|
|
35892
36087
|
// bin/failproofai.mjs
|
|
35893
36088
|
if (!process.env.FAILPROOFAI_PACKAGE_ROOT) {
|