failproofai 1.0.4 → 1.0.5-beta.1
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 +6 -6
- package/.next/standalone/.next/prerender-manifest.json +4 -4
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +13 -13
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js +4 -4
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +13 -13
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js +2 -2
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +4 -4
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__0-9ti7z._.js → [externals]__1_bftcl._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__0u3wrvq._.js → [externals]__1msfs-h._.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/{_1-akg6w._.js → _1c3k-8x._.js} +2 -2
- package/.next/standalone/.next/server/chunks/_1ek68ln._.js +1 -1
- 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]__00y9ww2._.js +22 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013jr2b._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01wy8d-._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02npjtd._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__09flfsx._.js → [root-of-the-server]__05g1k7_._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da85px._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ftmoxc._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oa1lav._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p-5p8u._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s740oi._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0sz_5na._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ctpynv._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1kaotix._.js +22 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1p2otjt._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1u6sn69._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_02yoeej._.js → _0iv28v5._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_1if9ixi._.js → _14c6q09._.js} +21 -2
- package/.next/standalone/.next/server/chunks/ssr/{_04rbnaq._.js → _17noq1a._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_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_codex-projects_ts_0pqlw37._.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 +6 -6
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +19 -19
- package/.next/standalone/.next/static/chunks/{3tjji451hrgc0.js → 074xcclgow3yh.js} +1 -1
- package/.next/standalone/.next/static/chunks/{31u94yukw9fz-.js → 0qytob94jbzs6.js} +1 -1
- package/.next/standalone/.next/static/chunks/25cn9xpv4r1ow.js +1 -0
- package/.next/standalone/.next/static/chunks/{1j6o9min_6qa9.js → 26tf_lpco5n-v.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0-tyrpwuc3lla.js → 2b014kj28p0vz.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2lwipmv5etc8m.js → 3_fnbc-v5r-9e.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1c6aptmytnu6q.js → 3kltzmx9k_t6x.js} +1 -1
- package/.next/standalone/.next/static/chunks/{27cl8h-c2w7cd.js → 3pmi7qhtmniku.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2u8vh73tpw28_.js → 3q1rji38vuvr4.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0ca7octhod0g2.js → 3qxl_gibq3bas.js} +1 -1
- package/.next/standalone/.next/static/chunks/{3p9_8x5ezce-9.js → 3vjaz4hld9oo8.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2zafgs90r_leq.js → 41ejnuj2d9g7_.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-3p73obe0xmrxm.js → turbopack-1xgsp63yhrdu5.js} +1 -1
- package/.next/standalone/fp-cloud-cli/CHANGELOG.md +7 -0
- package/.next/standalone/fp-cloud-cli/fp_cli/_version.py +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/sdk/python/CHANGELOG.md +38 -8
- package/.next/standalone/sdk/python/failproofai_sdk/_events.py +20 -0
- package/.next/standalone/sdk/python/failproofai_sdk/_redact.py +233 -0
- package/.next/standalone/sdk/python/failproofai_sdk/_version.py +1 -1
- package/.next/standalone/sdk/python/failproofai_sdk/_writer.py +4 -1
- package/.next/standalone/sdk/python/failproofai_sdk/integrations/llama_index.py +5 -5
- package/.next/standalone/sdk/python/tests/integrations/test_llama_index.py +2 -2
- package/.next/standalone/sdk/python/tests/test_redaction.py +140 -0
- package/.next/standalone/sdk/python/tests/test_sdk.py +87 -0
- package/.next/standalone/sdk/python/tests/test_server_contract.py +60 -0
- package/.next/standalone/sdk/python/tests/test_site_docs.py +2 -2
- package/.next/standalone/server.js +1 -1
- package/dist/cli.mjs +466 -255
- package/dist/worker.mjs +301 -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/openclaw-plugin/index.js +10 -6
- package/openclaw-plugin/instruct-retry-gate.js +89 -0
- package/package.json +9 -9
- package/src/hooks/policy-evaluator.ts +22 -3
- 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]__00-s7h8._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__190won8._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1nq7ivq._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1sc84bb._.js +0 -3
- package/.next/standalone/.next/static/chunks/2pd16tn5qmx13.js +0 -1
- /package/.next/standalone/.next/static/{dg8VQ7Ejlo0Qsh_x92oIt → Qexks15mjEoPt6cN3D2jb}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{dg8VQ7Ejlo0Qsh_x92oIt → Qexks15mjEoPt6cN3D2jb}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{dg8VQ7Ejlo0Qsh_x92oIt → Qexks15mjEoPt6cN3D2jb}/_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.
|
|
32
|
+
var version2 = "1.0.5-beta.1", 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.
|
|
158
|
-
"@failproofai/failproofaid-linux-arm64": "1.0.
|
|
159
|
-
"@failproofai/failproofaid-darwin-x64": "1.0.
|
|
160
|
-
"@failproofai/failproofaid-darwin-arm64": "1.0.
|
|
157
|
+
"@failproofai/failproofaid-linux-x64": "1.0.5-beta.1",
|
|
158
|
+
"@failproofai/failproofaid-linux-arm64": "1.0.5-beta.1",
|
|
159
|
+
"@failproofai/failproofaid-darwin-x64": "1.0.5-beta.1",
|
|
160
|
+
"@failproofai/failproofaid-darwin-arm64": "1.0.5-beta.1"
|
|
161
161
|
},
|
|
162
162
|
failproofaidBinaries: {
|
|
163
|
-
"linux-x64": "
|
|
164
|
-
"linux-arm64": "
|
|
165
|
-
"darwin-x64": "
|
|
166
|
-
"darwin-arm64": "
|
|
163
|
+
"linux-x64": "c782c8d7c8522bf8af6f776640cae80fa671affa5b92d8c09e646c8f381d7fd4",
|
|
164
|
+
"linux-arm64": "6e9717ef40872a530501ad17cc6bc9743546968e11acf45f87f35488d1563e28",
|
|
165
|
+
"darwin-x64": "b47adb286e2cf08370ec2e1293ea3ed42891c7d2a8a1bece3da8e3e2b0d72f7a",
|
|
166
|
+
"darwin-arm64": "a5095522dc3f2518fc8177e9e2a3048062540958e3b623b198b401a7d6a2ddd5"
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
169
|
});
|
|
@@ -15856,6 +15856,22 @@ You MUST complete the above action(s) NOW. Do NOT ask the user for confirmation
|
|
|
15856
15856
|
decision: "instruct"
|
|
15857
15857
|
};
|
|
15858
15858
|
}
|
|
15859
|
+
if (eventType === "PreToolUse") {
|
|
15860
|
+
return {
|
|
15861
|
+
exitCode: 0,
|
|
15862
|
+
stdout: JSON.stringify({
|
|
15863
|
+
permission: "instruct",
|
|
15864
|
+
reason: `Instruction from failproofai: ${combined}`,
|
|
15865
|
+
policyName: policyNames[0],
|
|
15866
|
+
policyNames
|
|
15867
|
+
}),
|
|
15868
|
+
stderr: "",
|
|
15869
|
+
policyName: policyNames[0],
|
|
15870
|
+
policyNames,
|
|
15871
|
+
reason: combined,
|
|
15872
|
+
decision: "instruct"
|
|
15873
|
+
};
|
|
15874
|
+
}
|
|
15859
15875
|
const stderrMsg = instructEntries.map((e) => `[failproofai] ${e.policyName}: ${e.reason}`).join(`
|
|
15860
15876
|
`);
|
|
15861
15877
|
return {
|
|
@@ -17814,13 +17830,169 @@ var init_hermes_projects = __esm(() => {
|
|
|
17814
17830
|
getCachedHermesSessionsByEncodedName = runtimeCache((name) => getHermesSessionsByEncodedName(name), 2, { maxSize: 50 });
|
|
17815
17831
|
});
|
|
17816
17832
|
|
|
17833
|
+
// lib/openclaw-db.ts
|
|
17834
|
+
import { existsSync as existsSync12 } from "node:fs";
|
|
17835
|
+
import { join as join14 } from "node:path";
|
|
17836
|
+
function str(value) {
|
|
17837
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
17838
|
+
}
|
|
17839
|
+
function parseObject(value) {
|
|
17840
|
+
try {
|
|
17841
|
+
const parsed = JSON.parse(value);
|
|
17842
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : undefined;
|
|
17843
|
+
} catch {
|
|
17844
|
+
return;
|
|
17845
|
+
}
|
|
17846
|
+
}
|
|
17847
|
+
function syntheticPath(agentId, sessionId) {
|
|
17848
|
+
return `openclaw-sqlite://${encodeURIComponent(agentId)}/${sessionId}`;
|
|
17849
|
+
}
|
|
17850
|
+
function listOpenClawDatabases(home, agentIds) {
|
|
17851
|
+
const out = [];
|
|
17852
|
+
for (const agentId of agentIds) {
|
|
17853
|
+
const dbPath = join14(home, "agents", agentId, "agent", DB_NAME);
|
|
17854
|
+
if (existsSync12(dbPath))
|
|
17855
|
+
out.push({ agentId, dbPath });
|
|
17856
|
+
}
|
|
17857
|
+
return out;
|
|
17858
|
+
}
|
|
17859
|
+
function readNodeMetadata(db) {
|
|
17860
|
+
const out = new Map;
|
|
17861
|
+
let rows;
|
|
17862
|
+
try {
|
|
17863
|
+
rows = db.query(`SELECT current_session_id, entry_json, label, display_name
|
|
17864
|
+
FROM session_nodes`);
|
|
17865
|
+
} catch {
|
|
17866
|
+
return out;
|
|
17867
|
+
}
|
|
17868
|
+
for (const row of rows) {
|
|
17869
|
+
const entry = parseObject(row.entry_json) ?? {};
|
|
17870
|
+
const origin = entry.origin && typeof entry.origin === "object" && !Array.isArray(entry.origin) ? entry.origin : {};
|
|
17871
|
+
out.set(row.current_session_id, {
|
|
17872
|
+
channel: str(entry.lastChannel) ?? str(origin.provider) ?? str(origin.surface),
|
|
17873
|
+
label: str(row.label) ?? str(row.display_name) ?? str(entry.displayName) ?? str(origin.label),
|
|
17874
|
+
chatId: str(entry.lastTo) ?? str(origin.from),
|
|
17875
|
+
chatType: str(entry.chatType) ?? str(origin.chatType)
|
|
17876
|
+
});
|
|
17877
|
+
}
|
|
17878
|
+
return out;
|
|
17879
|
+
}
|
|
17880
|
+
function readConversationMetadata(db) {
|
|
17881
|
+
const out = new Map;
|
|
17882
|
+
let rows;
|
|
17883
|
+
try {
|
|
17884
|
+
rows = db.query(`SELECT sc.session_id, c.channel, c.kind, c.peer_id,
|
|
17885
|
+
c.delivery_target, c.label
|
|
17886
|
+
FROM session_conversations sc
|
|
17887
|
+
JOIN conversations c ON c.conversation_id = sc.conversation_id
|
|
17888
|
+
ORDER BY CASE sc.role WHEN 'primary' THEN 0 ELSE 1 END, sc.last_seen_at DESC`);
|
|
17889
|
+
} catch {
|
|
17890
|
+
return out;
|
|
17891
|
+
}
|
|
17892
|
+
for (const row of rows) {
|
|
17893
|
+
if (out.has(row.session_id))
|
|
17894
|
+
continue;
|
|
17895
|
+
out.set(row.session_id, {
|
|
17896
|
+
channel: str(row.channel),
|
|
17897
|
+
label: str(row.label),
|
|
17898
|
+
chatId: str(row.delivery_target) ?? str(row.peer_id),
|
|
17899
|
+
chatType: str(row.kind)
|
|
17900
|
+
});
|
|
17901
|
+
}
|
|
17902
|
+
return out;
|
|
17903
|
+
}
|
|
17904
|
+
async function listOpenClawSqliteSessions(home, agentIds) {
|
|
17905
|
+
const sessions = [];
|
|
17906
|
+
for (const { agentId, dbPath } of listOpenClawDatabases(home, agentIds)) {
|
|
17907
|
+
const db = await openSqliteReadonly(dbPath);
|
|
17908
|
+
if (!db)
|
|
17909
|
+
continue;
|
|
17910
|
+
try {
|
|
17911
|
+
let rows;
|
|
17912
|
+
try {
|
|
17913
|
+
rows = db.query(`SELECT w.session_id, w.session_key, w.updated_at,
|
|
17914
|
+
w.transcript_updated_at, w.ended_at, w.channel,
|
|
17915
|
+
w.chat_type, w.display_name,
|
|
17916
|
+
COALESCE((SELECT MAX(e.created_at)
|
|
17917
|
+
FROM transcript_events e
|
|
17918
|
+
WHERE e.session_id = w.session_id), 0) AS event_updated_at,
|
|
17919
|
+
COALESCE((SELECT SUM(length(e.event_json) + 1)
|
|
17920
|
+
FROM transcript_events e
|
|
17921
|
+
WHERE e.session_id = w.session_id), 0) AS size_bytes
|
|
17922
|
+
FROM session_windows w
|
|
17923
|
+
WHERE EXISTS (SELECT 1 FROM transcript_events e
|
|
17924
|
+
WHERE e.session_id = w.session_id)`);
|
|
17925
|
+
} catch {
|
|
17926
|
+
continue;
|
|
17927
|
+
}
|
|
17928
|
+
const nodes = readNodeMetadata(db);
|
|
17929
|
+
const conversations = readConversationMetadata(db);
|
|
17930
|
+
for (const row of rows) {
|
|
17931
|
+
const node = nodes.get(row.session_id);
|
|
17932
|
+
const conversation = conversations.get(row.session_id);
|
|
17933
|
+
sessions.push({
|
|
17934
|
+
sessionId: row.session_id,
|
|
17935
|
+
agentId,
|
|
17936
|
+
dbPath,
|
|
17937
|
+
transcriptPath: syntheticPath(agentId, row.session_id),
|
|
17938
|
+
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),
|
|
17939
|
+
sizeBytes: Number(row.size_bytes) || 0,
|
|
17940
|
+
channel: str(row.channel) ?? conversation?.channel ?? node?.channel ?? "local",
|
|
17941
|
+
label: str(row.display_name) ?? conversation?.label ?? node?.label,
|
|
17942
|
+
chatId: conversation?.chatId ?? node?.chatId,
|
|
17943
|
+
chatType: str(row.chat_type) ?? conversation?.chatType ?? node?.chatType
|
|
17944
|
+
});
|
|
17945
|
+
}
|
|
17946
|
+
} finally {
|
|
17947
|
+
db.close();
|
|
17948
|
+
}
|
|
17949
|
+
}
|
|
17950
|
+
return sessions;
|
|
17951
|
+
}
|
|
17952
|
+
async function readOpenClawSqliteTranscript(home, agentIds, sessionId) {
|
|
17953
|
+
for (const { agentId, dbPath } of listOpenClawDatabases(home, agentIds)) {
|
|
17954
|
+
const db = await openSqliteReadonly(dbPath);
|
|
17955
|
+
if (!db)
|
|
17956
|
+
continue;
|
|
17957
|
+
try {
|
|
17958
|
+
let rows;
|
|
17959
|
+
try {
|
|
17960
|
+
rows = db.query(`SELECT event_json
|
|
17961
|
+
FROM transcript_events
|
|
17962
|
+
WHERE session_id = ?
|
|
17963
|
+
ORDER BY seq ASC`, [sessionId]);
|
|
17964
|
+
} catch {
|
|
17965
|
+
continue;
|
|
17966
|
+
}
|
|
17967
|
+
if (rows.length === 0)
|
|
17968
|
+
continue;
|
|
17969
|
+
const eventJsonLines = rows.map((row) => row.event_json);
|
|
17970
|
+
const rawLines = eventJsonLines.map(parseObject).filter((line) => line !== undefined);
|
|
17971
|
+
return {
|
|
17972
|
+
agentId,
|
|
17973
|
+
dbPath,
|
|
17974
|
+
filePath: syntheticPath(agentId, sessionId),
|
|
17975
|
+
rawLines,
|
|
17976
|
+
eventJsonLines
|
|
17977
|
+
};
|
|
17978
|
+
} finally {
|
|
17979
|
+
db.close();
|
|
17980
|
+
}
|
|
17981
|
+
}
|
|
17982
|
+
return null;
|
|
17983
|
+
}
|
|
17984
|
+
var DB_NAME = "openclaw-agent.sqlite";
|
|
17985
|
+
var init_openclaw_db = __esm(() => {
|
|
17986
|
+
init_sqlite_reader();
|
|
17987
|
+
});
|
|
17988
|
+
|
|
17817
17989
|
// lib/openclaw-sessions.ts
|
|
17818
17990
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
17819
17991
|
import { readdirSync as readdirSync5, statSync as statSync7 } from "node:fs";
|
|
17820
17992
|
import { homedir as homedir12 } from "node:os";
|
|
17821
|
-
import { join as
|
|
17993
|
+
import { join as join15 } from "node:path";
|
|
17822
17994
|
function openclawHome() {
|
|
17823
|
-
return process.env.OPENCLAW_HOME ||
|
|
17995
|
+
return process.env.OPENCLAW_STATE_DIR || process.env.OPENCLAW_HOME || join15(homedir12(), ".openclaw");
|
|
17824
17996
|
}
|
|
17825
17997
|
function isPlainObject3(v) {
|
|
17826
17998
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -17907,7 +18079,11 @@ function openclawLinesToLogEntries(lines, source = "session") {
|
|
|
17907
18079
|
entries.push({
|
|
17908
18080
|
type: "assistant",
|
|
17909
18081
|
...base,
|
|
17910
|
-
message: {
|
|
18082
|
+
message: {
|
|
18083
|
+
role: "assistant",
|
|
18084
|
+
content: blocks,
|
|
18085
|
+
model: typeof m.model === "string" ? m.model : undefined
|
|
18086
|
+
}
|
|
17911
18087
|
});
|
|
17912
18088
|
continue;
|
|
17913
18089
|
}
|
|
@@ -17935,13 +18111,13 @@ function openclawLinesToLogEntries(lines, source = "session") {
|
|
|
17935
18111
|
}
|
|
17936
18112
|
function listOpenClawAgents() {
|
|
17937
18113
|
try {
|
|
17938
|
-
return readdirSync5(
|
|
18114
|
+
return readdirSync5(join15(openclawHome(), "agents"), { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name).sort();
|
|
17939
18115
|
} catch {
|
|
17940
18116
|
return [];
|
|
17941
18117
|
}
|
|
17942
18118
|
}
|
|
17943
18119
|
function listOpenClawTranscripts() {
|
|
17944
|
-
const agentsDir =
|
|
18120
|
+
const agentsDir = join15(openclawHome(), "agents");
|
|
17945
18121
|
const out = [];
|
|
17946
18122
|
let agentIds;
|
|
17947
18123
|
try {
|
|
@@ -17950,7 +18126,7 @@ function listOpenClawTranscripts() {
|
|
|
17950
18126
|
return out;
|
|
17951
18127
|
}
|
|
17952
18128
|
for (const agentId of agentIds) {
|
|
17953
|
-
const sessionsDir =
|
|
18129
|
+
const sessionsDir = join15(agentsDir, agentId, "sessions");
|
|
17954
18130
|
let files;
|
|
17955
18131
|
try {
|
|
17956
18132
|
files = readdirSync5(sessionsDir);
|
|
@@ -17963,10 +18139,16 @@ function listOpenClawTranscripts() {
|
|
|
17963
18139
|
const sessionId = file.slice(0, -".jsonl".length);
|
|
17964
18140
|
if (!OPENCLAW_SESSION_ID_RE.test(sessionId))
|
|
17965
18141
|
continue;
|
|
17966
|
-
const transcriptPath =
|
|
18142
|
+
const transcriptPath = join15(sessionsDir, file);
|
|
17967
18143
|
try {
|
|
17968
18144
|
const st = statSync7(transcriptPath);
|
|
17969
|
-
out.push({
|
|
18145
|
+
out.push({
|
|
18146
|
+
agentId,
|
|
18147
|
+
sessionId,
|
|
18148
|
+
transcriptPath,
|
|
18149
|
+
mtimeMs: st.mtimeMs,
|
|
18150
|
+
sizeBytes: st.size
|
|
18151
|
+
});
|
|
17970
18152
|
} catch {}
|
|
17971
18153
|
}
|
|
17972
18154
|
}
|
|
@@ -17982,6 +18164,25 @@ function findOpenClawTranscript(sessionId) {
|
|
|
17982
18164
|
return null;
|
|
17983
18165
|
}
|
|
17984
18166
|
async function getOpenClawSessionLog(sessionId) {
|
|
18167
|
+
if (!OPENCLAW_SESSION_ID_RE.test(sessionId))
|
|
18168
|
+
return null;
|
|
18169
|
+
const sqlite = await readOpenClawSqliteTranscript(openclawHome(), listOpenClawAgents(), sessionId);
|
|
18170
|
+
if (sqlite) {
|
|
18171
|
+
const entries = openclawLinesToLogEntries(sqlite.rawLines, "session");
|
|
18172
|
+
let cwd;
|
|
18173
|
+
for (const line of sqlite.rawLines) {
|
|
18174
|
+
if (line.type === "session" && typeof line.cwd === "string" && line.cwd.length > 0) {
|
|
18175
|
+
cwd = line.cwd;
|
|
18176
|
+
break;
|
|
18177
|
+
}
|
|
18178
|
+
}
|
|
18179
|
+
return {
|
|
18180
|
+
entries,
|
|
18181
|
+
rawLines: sqlite.rawLines,
|
|
18182
|
+
cwd,
|
|
18183
|
+
filePath: sqlite.filePath
|
|
18184
|
+
};
|
|
18185
|
+
}
|
|
17985
18186
|
const filePath = findOpenClawTranscript(sessionId);
|
|
17986
18187
|
if (!filePath)
|
|
17987
18188
|
return null;
|
|
@@ -18005,6 +18206,7 @@ async function getOpenClawSessionLog(sessionId) {
|
|
|
18005
18206
|
var OPENCLAW_SESSION_ID_RE, getCachedOpenClawSessionLog;
|
|
18006
18207
|
var init_openclaw_sessions = __esm(() => {
|
|
18007
18208
|
init_log_entries();
|
|
18209
|
+
init_openclaw_db();
|
|
18008
18210
|
OPENCLAW_SESSION_ID_RE = /^[0-9a-fA-F-]{36}$/;
|
|
18009
18211
|
getCachedOpenClawSessionLog = runtimeCache((sessionId) => getOpenClawSessionLog(sessionId), 2, { maxSize: 50 });
|
|
18010
18212
|
});
|
|
@@ -18017,13 +18219,13 @@ __export(exports_openclaw_projects, {
|
|
|
18017
18219
|
openClawProjectPath: () => openClawProjectPath
|
|
18018
18220
|
});
|
|
18019
18221
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
18020
|
-
import { join as
|
|
18021
|
-
function
|
|
18222
|
+
import { join as join16 } from "node:path";
|
|
18223
|
+
function str2(v) {
|
|
18022
18224
|
return typeof v === "string" && v.length > 0 ? v : undefined;
|
|
18023
18225
|
}
|
|
18024
18226
|
function readSessionsIndex(agentId) {
|
|
18025
18227
|
const out = new Map;
|
|
18026
|
-
const indexPath =
|
|
18228
|
+
const indexPath = join16(openclawHome(), "agents", agentId, "sessions", "sessions.json");
|
|
18027
18229
|
let raw;
|
|
18028
18230
|
try {
|
|
18029
18231
|
raw = JSON.parse(readFileSync9(indexPath, "utf-8"));
|
|
@@ -18036,17 +18238,17 @@ function readSessionsIndex(agentId) {
|
|
|
18036
18238
|
if (!v || typeof v !== "object")
|
|
18037
18239
|
continue;
|
|
18038
18240
|
const e = v;
|
|
18039
|
-
const sessionId =
|
|
18241
|
+
const sessionId = str2(e.sessionId);
|
|
18040
18242
|
if (!sessionId)
|
|
18041
18243
|
continue;
|
|
18042
18244
|
const origin = e.origin && typeof e.origin === "object" ? e.origin : {};
|
|
18043
18245
|
const lastMs = typeof e.lastInteractionAt === "number" ? e.lastInteractionAt : typeof e.updatedAt === "number" ? e.updatedAt : undefined;
|
|
18044
18246
|
out.set(sessionId, {
|
|
18045
18247
|
lastMs,
|
|
18046
|
-
channel:
|
|
18047
|
-
chatType:
|
|
18048
|
-
label:
|
|
18049
|
-
chatId:
|
|
18248
|
+
channel: str2(e.lastChannel) ?? str2(origin.provider) ?? str2(origin.surface),
|
|
18249
|
+
chatType: str2(e.chatType) ?? str2(origin.chatType),
|
|
18250
|
+
label: str2(origin.label),
|
|
18251
|
+
chatId: str2(e.lastTo) ?? str2(origin.from)
|
|
18050
18252
|
});
|
|
18051
18253
|
}
|
|
18052
18254
|
return out;
|
|
@@ -18054,7 +18256,7 @@ function readSessionsIndex(agentId) {
|
|
|
18054
18256
|
async function getOpenClawSessions() {
|
|
18055
18257
|
const transcripts = listOpenClawTranscripts();
|
|
18056
18258
|
const indexByAgent = new Map;
|
|
18057
|
-
const refs =
|
|
18259
|
+
const refs = new Map;
|
|
18058
18260
|
for (const t of transcripts) {
|
|
18059
18261
|
let idx = indexByAgent.get(t.agentId);
|
|
18060
18262
|
if (!idx) {
|
|
@@ -18062,7 +18264,7 @@ async function getOpenClawSessions() {
|
|
|
18062
18264
|
indexByAgent.set(t.agentId, idx);
|
|
18063
18265
|
}
|
|
18064
18266
|
const meta = idx.get(t.sessionId);
|
|
18065
|
-
refs.
|
|
18267
|
+
refs.set(`${t.agentId}\x00${t.sessionId}`, {
|
|
18066
18268
|
sessionId: t.sessionId,
|
|
18067
18269
|
agentId: t.agentId,
|
|
18068
18270
|
channel: meta?.channel ?? "local",
|
|
@@ -18074,8 +18276,11 @@ async function getOpenClawSessions() {
|
|
|
18074
18276
|
sizeBytes: t.sizeBytes
|
|
18075
18277
|
});
|
|
18076
18278
|
}
|
|
18077
|
-
|
|
18078
|
-
|
|
18279
|
+
const sqliteSessions = await listOpenClawSqliteSessions(openclawHome(), listOpenClawAgents());
|
|
18280
|
+
for (const s of sqliteSessions) {
|
|
18281
|
+
refs.set(`${s.agentId}\x00${s.sessionId}`, s);
|
|
18282
|
+
}
|
|
18283
|
+
return [...refs.values()].sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
18079
18284
|
}
|
|
18080
18285
|
function openClawProjectName(agentId, channel) {
|
|
18081
18286
|
return `openclaw-${agentId}-${channel}`;
|
|
@@ -18110,7 +18315,12 @@ async function getOpenClawProjects() {
|
|
|
18110
18315
|
prev.latest = Math.max(prev.latest, s.mtimeMs);
|
|
18111
18316
|
prev.count += 1;
|
|
18112
18317
|
} else {
|
|
18113
|
-
groups.set(key, {
|
|
18318
|
+
groups.set(key, {
|
|
18319
|
+
agentId: s.agentId,
|
|
18320
|
+
channel: s.channel,
|
|
18321
|
+
latest: s.mtimeMs,
|
|
18322
|
+
count: 1
|
|
18323
|
+
});
|
|
18114
18324
|
}
|
|
18115
18325
|
}
|
|
18116
18326
|
const out = [];
|
|
@@ -18168,6 +18378,7 @@ async function getOpenClawSessionsByEncodedName(name) {
|
|
|
18168
18378
|
var getCachedOpenClawSessions, getCachedOpenClawProjects, getCachedOpenClawSessionsByEncodedName;
|
|
18169
18379
|
var init_openclaw_projects = __esm(() => {
|
|
18170
18380
|
init_openclaw_sessions();
|
|
18381
|
+
init_openclaw_db();
|
|
18171
18382
|
getCachedOpenClawSessions = runtimeCache(getOpenClawSessions, 2);
|
|
18172
18383
|
getCachedOpenClawProjects = runtimeCache(getOpenClawProjects, 2);
|
|
18173
18384
|
getCachedOpenClawSessionsByEncodedName = runtimeCache((name) => getOpenClawSessionsByEncodedName(name), 2, { maxSize: 50 });
|
|
@@ -18177,12 +18388,12 @@ var init_openclaw_projects = __esm(() => {
|
|
|
18177
18388
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
18178
18389
|
import { readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
|
|
18179
18390
|
import { homedir as homedir13 } from "node:os";
|
|
18180
|
-
import { join as
|
|
18391
|
+
import { join as join17 } from "node:path";
|
|
18181
18392
|
function factoryHome() {
|
|
18182
|
-
return process.env.FACTORY_HOME ||
|
|
18393
|
+
return process.env.FACTORY_HOME || join17(homedir13(), ".factory");
|
|
18183
18394
|
}
|
|
18184
18395
|
function factorySessionsRoot() {
|
|
18185
|
-
return
|
|
18396
|
+
return join17(factoryHome(), "sessions");
|
|
18186
18397
|
}
|
|
18187
18398
|
function isPlainObject4(v) {
|
|
18188
18399
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -18328,7 +18539,7 @@ function listFactoryTranscripts() {
|
|
|
18328
18539
|
for (const dir of projectDirs) {
|
|
18329
18540
|
const projectName = dir.name;
|
|
18330
18541
|
const cwd = decodeFolderName(projectName);
|
|
18331
|
-
const projectPath =
|
|
18542
|
+
const projectPath = join17(root, projectName);
|
|
18332
18543
|
let files;
|
|
18333
18544
|
try {
|
|
18334
18545
|
files = readdirSync6(projectPath);
|
|
@@ -18341,7 +18552,7 @@ function listFactoryTranscripts() {
|
|
|
18341
18552
|
const sessionId = file.slice(0, -".jsonl".length);
|
|
18342
18553
|
if (!FACTORY_SESSION_ID_RE.test(sessionId))
|
|
18343
18554
|
continue;
|
|
18344
|
-
const transcriptPath =
|
|
18555
|
+
const transcriptPath = join17(projectPath, file);
|
|
18345
18556
|
try {
|
|
18346
18557
|
const st = statSync8(transcriptPath);
|
|
18347
18558
|
out.push({ projectName, cwd, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
@@ -18465,12 +18676,12 @@ var init_factory_projects = __esm(() => {
|
|
|
18465
18676
|
|
|
18466
18677
|
// lib/devin-sessions.ts
|
|
18467
18678
|
import { homedir as homedir14 } from "node:os";
|
|
18468
|
-
import { join as
|
|
18679
|
+
import { join as join18 } from "node:path";
|
|
18469
18680
|
function devinHome() {
|
|
18470
|
-
return process.env.DEVIN_HOME ||
|
|
18681
|
+
return process.env.DEVIN_HOME || join18(homedir14(), ".local", "share", "devin");
|
|
18471
18682
|
}
|
|
18472
18683
|
function devinDbPath() {
|
|
18473
|
-
return process.env.DEVIN_DB_PATH ||
|
|
18684
|
+
return process.env.DEVIN_DB_PATH || join18(devinHome(), "cli", "sessions.db");
|
|
18474
18685
|
}
|
|
18475
18686
|
function devinEpochToMs(value) {
|
|
18476
18687
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
@@ -18765,15 +18976,15 @@ var init_devin_projects = __esm(() => {
|
|
|
18765
18976
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
18766
18977
|
import { readdirSync as readdirSync7, statSync as statSync9 } from "node:fs";
|
|
18767
18978
|
import { homedir as homedir15 } from "node:os";
|
|
18768
|
-
import { join as
|
|
18979
|
+
import { join as join19 } from "node:path";
|
|
18769
18980
|
function antigravityHome() {
|
|
18770
|
-
return process.env.ANTIGRAVITY_HOME ||
|
|
18981
|
+
return process.env.ANTIGRAVITY_HOME || join19(homedir15(), ".gemini", "antigravity-cli");
|
|
18771
18982
|
}
|
|
18772
18983
|
function antigravityBrainRoot() {
|
|
18773
|
-
return
|
|
18984
|
+
return join19(antigravityHome(), "brain");
|
|
18774
18985
|
}
|
|
18775
18986
|
function antigravityTranscriptRelPath() {
|
|
18776
|
-
return
|
|
18987
|
+
return join19(".system_generated", "logs", "transcript_full.jsonl");
|
|
18777
18988
|
}
|
|
18778
18989
|
function isPlainObject6(v) {
|
|
18779
18990
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -18896,7 +19107,7 @@ function listAntigravityTranscripts() {
|
|
|
18896
19107
|
const conversationId = dir.name;
|
|
18897
19108
|
if (!ANTIGRAVITY_CONVERSATION_ID_RE.test(conversationId))
|
|
18898
19109
|
continue;
|
|
18899
|
-
const transcriptPath =
|
|
19110
|
+
const transcriptPath = join19(root, conversationId, rel);
|
|
18900
19111
|
try {
|
|
18901
19112
|
const st = statSync9(transcriptPath);
|
|
18902
19113
|
if (!st.isFile())
|
|
@@ -18909,7 +19120,7 @@ function listAntigravityTranscripts() {
|
|
|
18909
19120
|
function findAntigravityTranscript(conversationId) {
|
|
18910
19121
|
if (!ANTIGRAVITY_CONVERSATION_ID_RE.test(conversationId))
|
|
18911
19122
|
return null;
|
|
18912
|
-
const transcriptPath =
|
|
19123
|
+
const transcriptPath = join19(antigravityBrainRoot(), conversationId, antigravityTranscriptRelPath());
|
|
18913
19124
|
try {
|
|
18914
19125
|
if (statSync9(transcriptPath).isFile())
|
|
18915
19126
|
return transcriptPath;
|
|
@@ -18945,9 +19156,9 @@ __export(exports_antigravity_projects, {
|
|
|
18945
19156
|
getAntigravityIndex: () => getAntigravityIndex,
|
|
18946
19157
|
getAntigravityProjects: () => getAntigravityProjects
|
|
18947
19158
|
});
|
|
18948
|
-
import { join as
|
|
19159
|
+
import { join as join20 } from "node:path";
|
|
18949
19160
|
function antigravitySummariesDbPath() {
|
|
18950
|
-
return
|
|
19161
|
+
return join20(antigravityHome(), "conversation_summaries.db");
|
|
18951
19162
|
}
|
|
18952
19163
|
function parseWorkspaceCwd(raw) {
|
|
18953
19164
|
if (!raw)
|
|
@@ -19091,15 +19302,15 @@ var init_antigravity_projects = __esm(() => {
|
|
|
19091
19302
|
|
|
19092
19303
|
// lib/goose-sessions.ts
|
|
19093
19304
|
import { homedir as homedir16 } from "node:os";
|
|
19094
|
-
import { join as
|
|
19305
|
+
import { join as join21 } from "node:path";
|
|
19095
19306
|
function gooseHome() {
|
|
19096
19307
|
if (process.env.GOOSE_HOME)
|
|
19097
19308
|
return process.env.GOOSE_HOME;
|
|
19098
19309
|
const xdg = process.env.XDG_DATA_HOME;
|
|
19099
|
-
return
|
|
19310
|
+
return join21(xdg && xdg.length > 0 ? xdg : join21(homedir16(), ".local", "share"), "goose");
|
|
19100
19311
|
}
|
|
19101
19312
|
function gooseDbPath() {
|
|
19102
|
-
return process.env.GOOSE_DB_PATH ||
|
|
19313
|
+
return process.env.GOOSE_DB_PATH || join21(gooseHome(), "sessions", "sessions.db");
|
|
19103
19314
|
}
|
|
19104
19315
|
function gooseTimestampToMs(value) {
|
|
19105
19316
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
@@ -19363,7 +19574,7 @@ var init_goose_projects = __esm(() => {
|
|
|
19363
19574
|
|
|
19364
19575
|
// lib/projects.ts
|
|
19365
19576
|
import { readdir as readdir5, stat as stat4 } from "node:fs/promises";
|
|
19366
|
-
import { join as
|
|
19577
|
+
import { join as join22, resolve as resolve11, sep } from "node:path";
|
|
19367
19578
|
async function getMtime(path, label) {
|
|
19368
19579
|
try {
|
|
19369
19580
|
return (await stat4(path)).mtime;
|
|
@@ -19389,7 +19600,7 @@ async function getClaudeProjectFolders() {
|
|
|
19389
19600
|
if (!entries)
|
|
19390
19601
|
return [];
|
|
19391
19602
|
const settled = await batchAll(entries.filter((entry) => entry.isDirectory()).map((entry) => async () => {
|
|
19392
|
-
const folderPath =
|
|
19603
|
+
const folderPath = join22(projectsPath, entry.name);
|
|
19393
19604
|
const mtime = await getMtime(folderPath, entry.name);
|
|
19394
19605
|
return {
|
|
19395
19606
|
name: entry.name,
|
|
@@ -19516,7 +19727,7 @@ function resolveProjectPath(projectName) {
|
|
|
19516
19727
|
if (/^[/\\]/.test(projectName))
|
|
19517
19728
|
throw new RangeError("Absolute project name");
|
|
19518
19729
|
const projectsPath = resolve11(getClaudeProjectsPath());
|
|
19519
|
-
const candidate = resolve11(
|
|
19730
|
+
const candidate = resolve11(join22(projectsPath, projectName));
|
|
19520
19731
|
if (!candidate.startsWith(projectsPath + sep)) {
|
|
19521
19732
|
throw new RangeError("Project path escapes root");
|
|
19522
19733
|
}
|
|
@@ -19534,7 +19745,7 @@ async function getSessionFiles(projectPath) {
|
|
|
19534
19745
|
return [];
|
|
19535
19746
|
const jsonlEntries = entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl") && extractSessionId2(entry.name));
|
|
19536
19747
|
const settled = await batchAll(jsonlEntries.map((entry) => async () => {
|
|
19537
|
-
const filePath =
|
|
19748
|
+
const filePath = join22(projectPath, entry.name);
|
|
19538
19749
|
const mtime = await getMtime(filePath, entry.name);
|
|
19539
19750
|
return {
|
|
19540
19751
|
name: entry.name,
|
|
@@ -19563,13 +19774,13 @@ var init_projects = __esm(() => {
|
|
|
19563
19774
|
|
|
19564
19775
|
// lib/resolve-subagent-path.ts
|
|
19565
19776
|
import { access as access2 } from "fs/promises";
|
|
19566
|
-
import { join as
|
|
19777
|
+
import { join as join23, relative as relative3 } from "path";
|
|
19567
19778
|
async function resolveSubagentPath(projectsPath, projectName, sessionId, agentId) {
|
|
19568
19779
|
const fileName = `agent-${agentId}.jsonl`;
|
|
19569
19780
|
const candidatePaths = [
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
|
|
19781
|
+
join23(projectsPath, projectName, fileName),
|
|
19782
|
+
join23(projectsPath, projectName, sessionId, fileName),
|
|
19783
|
+
join23(projectsPath, projectName, sessionId, "subagents", fileName)
|
|
19573
19784
|
];
|
|
19574
19785
|
for (const candidatePath of candidatePaths) {
|
|
19575
19786
|
if (relative3(projectsPath, candidatePath).startsWith("..")) {
|
|
@@ -19591,7 +19802,7 @@ var init_resolve_subagent_path = () => {};
|
|
|
19591
19802
|
|
|
19592
19803
|
// lib/log-entries.ts
|
|
19593
19804
|
import { readFile as readFile10 } from "fs/promises";
|
|
19594
|
-
import { join as
|
|
19805
|
+
import { join as join24 } from "path";
|
|
19595
19806
|
function formatTimestamp(date) {
|
|
19596
19807
|
const base = formatDate(date);
|
|
19597
19808
|
const ms = date.getMilliseconds().toString().padStart(3, "0");
|
|
@@ -19789,7 +20000,7 @@ async function parseLogContent(fileContent, source = "session") {
|
|
|
19789
20000
|
async function parseSessionLog(projectName, sessionId) {
|
|
19790
20001
|
const projectDir = resolveProjectPath(projectName);
|
|
19791
20002
|
const projectsPath = getClaudeProjectsPath();
|
|
19792
|
-
const filePath =
|
|
20003
|
+
const filePath = join24(projectDir, `${sessionId}.jsonl`);
|
|
19793
20004
|
const fileContent = await readFile10(filePath, "utf-8");
|
|
19794
20005
|
const { entries: sessionEntries, rawLines: sessionRawLines, subagentIds } = await parseFileContent(fileContent, "session");
|
|
19795
20006
|
if (subagentIds.length === 0) {
|
|
@@ -19826,13 +20037,13 @@ var init_log_entries = __esm(() => {
|
|
|
19826
20037
|
});
|
|
19827
20038
|
|
|
19828
20039
|
// lib/codex-sessions.ts
|
|
19829
|
-
import { readFileSync as readFileSync10, readdirSync as readdirSync8, existsSync as
|
|
20040
|
+
import { readFileSync as readFileSync10, readdirSync as readdirSync8, existsSync as existsSync13, writeFileSync as writeFileSync6, mkdirSync as mkdirSync7, statSync as statSync10 } from "node:fs";
|
|
19830
20041
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
19831
|
-
import { dirname as dirname7, join as
|
|
20042
|
+
import { dirname as dirname7, join as join25 } from "node:path";
|
|
19832
20043
|
import { homedir as homedir17 } from "node:os";
|
|
19833
20044
|
function readCache() {
|
|
19834
20045
|
try {
|
|
19835
|
-
if (!
|
|
20046
|
+
if (!existsSync13(CACHE_PATH))
|
|
19836
20047
|
return {};
|
|
19837
20048
|
return JSON.parse(readFileSync10(CACHE_PATH, "utf-8"));
|
|
19838
20049
|
} catch {
|
|
@@ -19851,7 +20062,7 @@ function dirSearch(dir, sessionId) {
|
|
|
19851
20062
|
try {
|
|
19852
20063
|
for (const f of readdirSync8(dir, { withFileTypes: true })) {
|
|
19853
20064
|
if (f.isFile() && f.name.includes(sessionId) && f.name.endsWith(".jsonl")) {
|
|
19854
|
-
return
|
|
20065
|
+
return join25(dir, f.name);
|
|
19855
20066
|
}
|
|
19856
20067
|
}
|
|
19857
20068
|
} catch {}
|
|
@@ -19860,16 +20071,16 @@ function dirSearch(dir, sessionId) {
|
|
|
19860
20071
|
function findCodexTranscript(sessionId) {
|
|
19861
20072
|
const cache = readCache();
|
|
19862
20073
|
const cached = cache[sessionId];
|
|
19863
|
-
if (cached &&
|
|
20074
|
+
if (cached && existsSync13(cached))
|
|
19864
20075
|
return cached;
|
|
19865
|
-
const root =
|
|
20076
|
+
const root = join25(homedir17(), ".codex", "sessions");
|
|
19866
20077
|
const today = new Date;
|
|
19867
20078
|
const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
|
|
19868
20079
|
const datedDirs = [today, yesterday].map((d) => {
|
|
19869
20080
|
const y = String(d.getUTCFullYear());
|
|
19870
20081
|
const m = String(d.getUTCMonth() + 1).padStart(2, "0");
|
|
19871
20082
|
const day = String(d.getUTCDate()).padStart(2, "0");
|
|
19872
|
-
return
|
|
20083
|
+
return join25(root, y, m, day);
|
|
19873
20084
|
});
|
|
19874
20085
|
for (const dir of datedDirs) {
|
|
19875
20086
|
const hit = dirSearch(dir, sessionId);
|
|
@@ -19882,13 +20093,13 @@ function findCodexTranscript(sessionId) {
|
|
|
19882
20093
|
for (const y of readdirSync8(root, { withFileTypes: true })) {
|
|
19883
20094
|
if (!y.isDirectory())
|
|
19884
20095
|
continue;
|
|
19885
|
-
for (const m of readdirSync8(
|
|
20096
|
+
for (const m of readdirSync8(join25(root, y.name), { withFileTypes: true })) {
|
|
19886
20097
|
if (!m.isDirectory())
|
|
19887
20098
|
continue;
|
|
19888
|
-
for (const d of readdirSync8(
|
|
20099
|
+
for (const d of readdirSync8(join25(root, y.name, m.name), { withFileTypes: true })) {
|
|
19889
20100
|
if (!d.isDirectory())
|
|
19890
20101
|
continue;
|
|
19891
|
-
const hit = dirSearch(
|
|
20102
|
+
const hit = dirSearch(join25(root, y.name, m.name, d.name), sessionId);
|
|
19892
20103
|
if (hit) {
|
|
19893
20104
|
writeCacheEntry(sessionId, hit);
|
|
19894
20105
|
return hit;
|
|
@@ -20154,15 +20365,15 @@ var init_resolve_permission_mode = __esm(() => {
|
|
|
20154
20365
|
});
|
|
20155
20366
|
|
|
20156
20367
|
// lib/copilot-sessions.ts
|
|
20157
|
-
import { readFileSync as readFileSync12, readdirSync as readdirSync9, existsSync as
|
|
20368
|
+
import { readFileSync as readFileSync12, readdirSync as readdirSync9, existsSync as existsSync14, statSync as statSync11 } from "node:fs";
|
|
20158
20369
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
20159
|
-
import { join as
|
|
20370
|
+
import { join as join26, resolve as resolve12, sep as sep2 } from "node:path";
|
|
20160
20371
|
import { homedir as homedir18 } from "node:os";
|
|
20161
20372
|
function getCopilotHome() {
|
|
20162
|
-
return process.env.COPILOT_HOME ||
|
|
20373
|
+
return process.env.COPILOT_HOME || join26(homedir18(), ".copilot");
|
|
20163
20374
|
}
|
|
20164
20375
|
function getCopilotSessionStateRoot2() {
|
|
20165
|
-
return
|
|
20376
|
+
return join26(getCopilotHome(), "session-state");
|
|
20166
20377
|
}
|
|
20167
20378
|
function getCopilotSessionDir(sessionId) {
|
|
20168
20379
|
if (!sessionId)
|
|
@@ -20177,19 +20388,19 @@ function resolveSessionFile(sessionId, filename) {
|
|
|
20177
20388
|
const dir = getCopilotSessionDir(sessionId);
|
|
20178
20389
|
if (!dir)
|
|
20179
20390
|
return null;
|
|
20180
|
-
return
|
|
20391
|
+
return join26(dir, filename);
|
|
20181
20392
|
}
|
|
20182
20393
|
function findCopilotTranscript(sessionId) {
|
|
20183
20394
|
const candidate = resolveSessionFile(sessionId, "events.jsonl");
|
|
20184
20395
|
if (!candidate)
|
|
20185
20396
|
return null;
|
|
20186
|
-
return
|
|
20397
|
+
return existsSync14(candidate) ? candidate : null;
|
|
20187
20398
|
}
|
|
20188
20399
|
function findCopilotWorkspace(sessionId) {
|
|
20189
20400
|
const candidate = resolveSessionFile(sessionId, "workspace.yaml");
|
|
20190
20401
|
if (!candidate)
|
|
20191
20402
|
return null;
|
|
20192
|
-
return
|
|
20403
|
+
return existsSync14(candidate) ? candidate : null;
|
|
20193
20404
|
}
|
|
20194
20405
|
function readYamlScalar(path, key) {
|
|
20195
20406
|
try {
|
|
@@ -20371,12 +20582,12 @@ var init_copilot_sessions = __esm(() => {
|
|
|
20371
20582
|
});
|
|
20372
20583
|
|
|
20373
20584
|
// lib/cursor-sessions.ts
|
|
20374
|
-
import { readFileSync as readFileSync13, readdirSync as readdirSync10, existsSync as
|
|
20585
|
+
import { readFileSync as readFileSync13, readdirSync as readdirSync10, existsSync as existsSync15, statSync as statSync12 } from "node:fs";
|
|
20375
20586
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
20376
|
-
import { basename as basename3, join as
|
|
20587
|
+
import { basename as basename3, join as join27, resolve as resolve13, sep as sep3 } from "node:path";
|
|
20377
20588
|
import { homedir as homedir19 } from "node:os";
|
|
20378
20589
|
function getCursorHome2() {
|
|
20379
|
-
return process.env.CURSOR_HOME ||
|
|
20590
|
+
return process.env.CURSOR_HOME || join27(homedir19(), ".cursor");
|
|
20380
20591
|
}
|
|
20381
20592
|
function getCursorSessionDir(sessionId) {
|
|
20382
20593
|
if (!sessionId)
|
|
@@ -20394,7 +20605,7 @@ function getCursorSessionDir(sessionId) {
|
|
|
20394
20605
|
const transcriptRoot = resolve13(projectsRoot, entry.name, NEW_AGENT_TRANSCRIPTS_DIR2);
|
|
20395
20606
|
if (candidate === transcriptRoot || !candidate.startsWith(`${transcriptRoot}${sep3}`))
|
|
20396
20607
|
continue;
|
|
20397
|
-
if (
|
|
20608
|
+
if (existsSync15(candidate))
|
|
20398
20609
|
return candidate;
|
|
20399
20610
|
}
|
|
20400
20611
|
for (const sub of LEGACY_SESSION_ROOT_CANDIDATES2) {
|
|
@@ -20402,7 +20613,7 @@ function getCursorSessionDir(sessionId) {
|
|
|
20402
20613
|
const candidate = resolve13(root, sessionId);
|
|
20403
20614
|
if (candidate === root || !candidate.startsWith(`${root}${sep3}`))
|
|
20404
20615
|
continue;
|
|
20405
|
-
if (
|
|
20616
|
+
if (existsSync15(candidate))
|
|
20406
20617
|
return candidate;
|
|
20407
20618
|
}
|
|
20408
20619
|
return null;
|
|
@@ -20411,12 +20622,12 @@ function findCursorTranscript(sessionId) {
|
|
|
20411
20622
|
const dir = getCursorSessionDir(sessionId);
|
|
20412
20623
|
if (!dir)
|
|
20413
20624
|
return null;
|
|
20414
|
-
const newCandidate =
|
|
20415
|
-
if (
|
|
20625
|
+
const newCandidate = join27(dir, `${basename3(dir)}.jsonl`);
|
|
20626
|
+
if (existsSync15(newCandidate))
|
|
20416
20627
|
return newCandidate;
|
|
20417
20628
|
for (const name of LEGACY_TRANSCRIPT_FILE_CANDIDATES2) {
|
|
20418
|
-
const candidate =
|
|
20419
|
-
if (
|
|
20629
|
+
const candidate = join27(dir, name);
|
|
20630
|
+
if (existsSync15(candidate))
|
|
20420
20631
|
return candidate;
|
|
20421
20632
|
}
|
|
20422
20633
|
return null;
|
|
@@ -20627,12 +20838,12 @@ var init_cursor_sessions = __esm(() => {
|
|
|
20627
20838
|
});
|
|
20628
20839
|
|
|
20629
20840
|
// lib/pi-sessions.ts
|
|
20630
|
-
import { readFileSync as readFileSync14, readdirSync as readdirSync11, existsSync as
|
|
20841
|
+
import { readFileSync as readFileSync14, readdirSync as readdirSync11, existsSync as existsSync16, statSync as statSync13 } from "node:fs";
|
|
20631
20842
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
20632
|
-
import { join as
|
|
20843
|
+
import { join as join28, resolve as resolve14, sep as sep4 } from "node:path";
|
|
20633
20844
|
import { homedir as homedir20 } from "node:os";
|
|
20634
20845
|
function getPiSessionStateRoot() {
|
|
20635
|
-
return process.env.PI_SESSIONS_DIR ||
|
|
20846
|
+
return process.env.PI_SESSIONS_DIR || join28(homedir20(), ".pi", "agent", "sessions");
|
|
20636
20847
|
}
|
|
20637
20848
|
function isSafeSessionId(sessionId) {
|
|
20638
20849
|
return UUID_RE.test(sessionId);
|
|
@@ -20664,7 +20875,7 @@ function findPiTranscript(sessionId) {
|
|
|
20664
20875
|
const candidate = resolve14(cwdPath, f);
|
|
20665
20876
|
if (!candidate.startsWith(`${cwdPath}${sep4}`))
|
|
20666
20877
|
continue;
|
|
20667
|
-
if (
|
|
20878
|
+
if (existsSync16(candidate))
|
|
20668
20879
|
return candidate;
|
|
20669
20880
|
}
|
|
20670
20881
|
}
|
|
@@ -21070,7 +21281,7 @@ var init_pack_failclosed = __esm(() => {
|
|
|
21070
21281
|
// lib/atomic-write.ts
|
|
21071
21282
|
import {
|
|
21072
21283
|
chmodSync as chmodSync2,
|
|
21073
|
-
existsSync as
|
|
21284
|
+
existsSync as existsSync17,
|
|
21074
21285
|
mkdirSync as mkdirSync8,
|
|
21075
21286
|
renameSync as renameSync4,
|
|
21076
21287
|
rmSync as rmSync3,
|
|
@@ -21083,7 +21294,7 @@ function writeJsonAtomically(filePath, value, opts = {}) {
|
|
|
21083
21294
|
const mode = opts.mode ?? 384;
|
|
21084
21295
|
const dirMode = opts.dirMode ?? 448;
|
|
21085
21296
|
const dir = dirname8(filePath);
|
|
21086
|
-
if (!
|
|
21297
|
+
if (!existsSync17(dir))
|
|
21087
21298
|
mkdirSync8(dir, { recursive: true, mode: dirMode });
|
|
21088
21299
|
const tmp = `${filePath}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`;
|
|
21089
21300
|
try {
|
|
@@ -21107,9 +21318,9 @@ function writeJsonAtomically(filePath, value, opts = {}) {
|
|
|
21107
21318
|
var init_atomic_write = () => {};
|
|
21108
21319
|
|
|
21109
21320
|
// src/hooks/session-pause.ts
|
|
21110
|
-
import { existsSync as
|
|
21321
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync9, readdirSync as readdirSync12, readFileSync as readFileSync15, rmSync as rmSync4 } from "node:fs";
|
|
21111
21322
|
import { createHash as createHash6 } from "node:crypto";
|
|
21112
|
-
import { join as
|
|
21323
|
+
import { join as join29, resolve as resolve15 } from "node:path";
|
|
21113
21324
|
function pauseStateDir() {
|
|
21114
21325
|
const override = process.env.FAILPROOFAI_STATE_DIR;
|
|
21115
21326
|
if (override)
|
|
@@ -21118,7 +21329,7 @@ function pauseStateDir() {
|
|
|
21118
21329
|
}
|
|
21119
21330
|
function pauseFilePath(sessionId) {
|
|
21120
21331
|
const digest = createHash6("sha256").update(sessionId).digest("hex").slice(0, 32);
|
|
21121
|
-
return
|
|
21332
|
+
return join29(pauseStateDir(), `${digest}.json`);
|
|
21122
21333
|
}
|
|
21123
21334
|
function parsePauseDuration(input, ceilingMs = PAUSE_CEILING_MS) {
|
|
21124
21335
|
if (input === undefined || input === "")
|
|
@@ -21174,7 +21385,7 @@ function readActivePause(sessionId, now = Date.now()) {
|
|
|
21174
21385
|
return null;
|
|
21175
21386
|
try {
|
|
21176
21387
|
const path = pauseFilePath(sessionId);
|
|
21177
|
-
if (!
|
|
21388
|
+
if (!existsSync18(path))
|
|
21178
21389
|
return null;
|
|
21179
21390
|
const stored = parseStored(JSON.parse(readFileSync15(path, "utf8")));
|
|
21180
21391
|
if (!stored)
|
|
@@ -21205,7 +21416,7 @@ function writePause(opts) {
|
|
|
21205
21416
|
}
|
|
21206
21417
|
function clearPause(sessionId) {
|
|
21207
21418
|
const path = pauseFilePath(sessionId);
|
|
21208
|
-
if (!
|
|
21419
|
+
if (!existsSync18(path))
|
|
21209
21420
|
return false;
|
|
21210
21421
|
try {
|
|
21211
21422
|
rmSync4(path);
|
|
@@ -21216,7 +21427,7 @@ function clearPause(sessionId) {
|
|
|
21216
21427
|
}
|
|
21217
21428
|
function listActivePauses(now = Date.now()) {
|
|
21218
21429
|
const dir = pauseStateDir();
|
|
21219
|
-
if (!
|
|
21430
|
+
if (!existsSync18(dir))
|
|
21220
21431
|
return [];
|
|
21221
21432
|
const out = [];
|
|
21222
21433
|
let names;
|
|
@@ -21229,7 +21440,7 @@ function listActivePauses(now = Date.now()) {
|
|
|
21229
21440
|
if (!name.endsWith(".json"))
|
|
21230
21441
|
continue;
|
|
21231
21442
|
try {
|
|
21232
|
-
const stored = parseStored(JSON.parse(readFileSync15(
|
|
21443
|
+
const stored = parseStored(JSON.parse(readFileSync15(join29(dir, name), "utf8")));
|
|
21233
21444
|
if (!stored || stored.expiresAt <= now)
|
|
21234
21445
|
continue;
|
|
21235
21446
|
const { schemaVersion: _ignored, ...pause } = stored;
|
|
@@ -21270,7 +21481,7 @@ var init_session_pause = __esm(() => {
|
|
|
21270
21481
|
import { createHash as createHash7 } from "node:crypto";
|
|
21271
21482
|
import {
|
|
21272
21483
|
chmodSync as chmodSync3,
|
|
21273
|
-
existsSync as
|
|
21484
|
+
existsSync as existsSync19,
|
|
21274
21485
|
mkdirSync as mkdirSync10,
|
|
21275
21486
|
readdirSync as readdirSync13,
|
|
21276
21487
|
readFileSync as readFileSync16,
|
|
@@ -21322,7 +21533,7 @@ function platformPackageBinary(dir) {
|
|
|
21322
21533
|
return null;
|
|
21323
21534
|
}
|
|
21324
21535
|
const candidate = resolve16(dir, "bin", "failproofaid");
|
|
21325
|
-
return
|
|
21536
|
+
return existsSync19(candidate) ? candidate : null;
|
|
21326
21537
|
}
|
|
21327
21538
|
function pruneOldDaemonBinaries(keep = 2) {
|
|
21328
21539
|
const removed = [];
|
|
@@ -21400,7 +21611,7 @@ function digestFor2(manifest, assetName) {
|
|
|
21400
21611
|
}
|
|
21401
21612
|
async function downloadFailproofaidBinary(key) {
|
|
21402
21613
|
const target = installedBinaryPath();
|
|
21403
|
-
if (
|
|
21614
|
+
if (existsSync19(target))
|
|
21404
21615
|
return { path: target };
|
|
21405
21616
|
if (process.env.FAILPROOFAI_NO_DOWNLOAD) {
|
|
21406
21617
|
return { error: "daemon downloads are disabled (FAILPROOFAI_NO_DOWNLOAD)" };
|
|
@@ -21434,10 +21645,10 @@ var init_daemon_download = __esm(() => {
|
|
|
21434
21645
|
|
|
21435
21646
|
// src/hooks/daemon-client.ts
|
|
21436
21647
|
import { createConnection as createConnection2 } from "node:net";
|
|
21437
|
-
import { existsSync as
|
|
21648
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
21438
21649
|
function daemonSocketPresent() {
|
|
21439
21650
|
try {
|
|
21440
|
-
return
|
|
21651
|
+
return existsSync20(socketPath2());
|
|
21441
21652
|
} catch {
|
|
21442
21653
|
return false;
|
|
21443
21654
|
}
|
|
@@ -21563,7 +21774,7 @@ var init_daemon_client2 = __esm(() => {
|
|
|
21563
21774
|
|
|
21564
21775
|
// src/hooks/daemon-service.ts
|
|
21565
21776
|
import {
|
|
21566
|
-
existsSync as
|
|
21777
|
+
existsSync as existsSync21,
|
|
21567
21778
|
mkdirSync as mkdirSync11,
|
|
21568
21779
|
mkdtempSync,
|
|
21569
21780
|
readFileSync as readFileSync17,
|
|
@@ -21594,13 +21805,13 @@ function resolveFailproofaidBinaryPath() {
|
|
|
21594
21805
|
if (process.env.FAILPROOFAI_DAEMON_BINARY)
|
|
21595
21806
|
return process.env.FAILPROOFAI_DAEMON_BINARY;
|
|
21596
21807
|
const downloaded = installedBinaryPath();
|
|
21597
|
-
if (
|
|
21808
|
+
if (existsSync21(downloaded))
|
|
21598
21809
|
return downloaded;
|
|
21599
21810
|
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT;
|
|
21600
21811
|
if (packageRoot) {
|
|
21601
21812
|
for (const profile of ["release", "debug"]) {
|
|
21602
21813
|
const candidate = resolve17(packageRoot, "target", profile, "failproofaid");
|
|
21603
|
-
if (
|
|
21814
|
+
if (existsSync21(candidate))
|
|
21604
21815
|
return candidate;
|
|
21605
21816
|
}
|
|
21606
21817
|
}
|
|
@@ -21631,7 +21842,7 @@ function resolveWorkerCommand() {
|
|
|
21631
21842
|
if (!packageRoot)
|
|
21632
21843
|
return null;
|
|
21633
21844
|
const workerScript = resolve17(packageRoot, "dist", "worker.mjs");
|
|
21634
|
-
if (!
|
|
21845
|
+
if (!existsSync21(workerScript))
|
|
21635
21846
|
return null;
|
|
21636
21847
|
return `${shellQuote(process.execPath)} ${shellQuote(workerScript)}`;
|
|
21637
21848
|
}
|
|
@@ -21642,7 +21853,7 @@ function resolveCliCommand() {
|
|
|
21642
21853
|
if (!packageRoot)
|
|
21643
21854
|
return null;
|
|
21644
21855
|
const cliScript = resolve17(packageRoot, "dist", "cli.mjs");
|
|
21645
|
-
if (!
|
|
21856
|
+
if (!existsSync21(cliScript))
|
|
21646
21857
|
return null;
|
|
21647
21858
|
return `${shellQuote(process.execPath)} ${shellQuote(cliScript)}`;
|
|
21648
21859
|
}
|
|
@@ -21656,7 +21867,7 @@ function workerScriptPath() {
|
|
|
21656
21867
|
if (!packageRoot)
|
|
21657
21868
|
return null;
|
|
21658
21869
|
const workerScript = resolve17(packageRoot, "dist", "worker.mjs");
|
|
21659
|
-
return
|
|
21870
|
+
return existsSync21(workerScript) ? workerScript : null;
|
|
21660
21871
|
}
|
|
21661
21872
|
function assertUnitSafe(value, field) {
|
|
21662
21873
|
if (UNIT_UNSAFE_RE.test(value)) {
|
|
@@ -21755,7 +21966,7 @@ function removeLegacyUserService() {
|
|
|
21755
21966
|
try {
|
|
21756
21967
|
if (process.platform === "linux") {
|
|
21757
21968
|
const legacy = legacySystemdUserUnitPath();
|
|
21758
|
-
if (!
|
|
21969
|
+
if (!existsSync21(legacy))
|
|
21759
21970
|
return;
|
|
21760
21971
|
try {
|
|
21761
21972
|
execFileSync2("systemctl", ["--user", "disable", "--now", "failproofaid.service"], {
|
|
@@ -21772,7 +21983,7 @@ function removeLegacyUserService() {
|
|
|
21772
21983
|
} catch {}
|
|
21773
21984
|
} else {
|
|
21774
21985
|
const legacyAgent = legacyLaunchAgentPlistPath();
|
|
21775
|
-
if (
|
|
21986
|
+
if (existsSync21(legacyAgent)) {
|
|
21776
21987
|
try {
|
|
21777
21988
|
execFileSync2("launchctl", ["unload", "-w", legacyAgent], {
|
|
21778
21989
|
stdio: "ignore",
|
|
@@ -21782,7 +21993,7 @@ function removeLegacyUserService() {
|
|
|
21782
21993
|
unlinkSync3(legacyAgent);
|
|
21783
21994
|
}
|
|
21784
21995
|
const legacyDaemon = legacySharedLaunchDaemonPath();
|
|
21785
|
-
if (
|
|
21996
|
+
if (existsSync21(legacyDaemon)) {
|
|
21786
21997
|
try {
|
|
21787
21998
|
runPrivileged("launchctl", ["unload", "-w", legacyDaemon]);
|
|
21788
21999
|
} catch {}
|
|
@@ -21799,7 +22010,7 @@ function systemdUnitContents(binaryPath, workerCmd, cliCmd = null) {
|
|
|
21799
22010
|
const user = assertUnitSafe(serviceUser(), "User");
|
|
21800
22011
|
assertUnitSafe(binaryPath, "ExecStart");
|
|
21801
22012
|
assertUnitSafe(homedir21(), "HOME");
|
|
21802
|
-
const conditionPaths = [binaryPath, workerScriptPath()].filter((p) => typeof p === "string" &&
|
|
22013
|
+
const conditionPaths = [binaryPath, workerScriptPath()].filter((p) => typeof p === "string" && existsSync21(p));
|
|
21803
22014
|
const conditionLines = conditionPaths.map((p) => `ConditionPathExists=${assertUnitSafe(p, "ConditionPathExists")}
|
|
21804
22015
|
`).join("");
|
|
21805
22016
|
return `[Unit]
|
|
@@ -21994,7 +22205,7 @@ function readInstalledServiceDefinition() {
|
|
|
21994
22205
|
if (!isDaemonSupportedPlatform())
|
|
21995
22206
|
return null;
|
|
21996
22207
|
const path = daemonServiceFilePath();
|
|
21997
|
-
if (!path || !
|
|
22208
|
+
if (!path || !existsSync21(path))
|
|
21998
22209
|
return null;
|
|
21999
22210
|
try {
|
|
22000
22211
|
return readFileSync17(path, "utf8");
|
|
@@ -22130,7 +22341,7 @@ async function uninstallDaemonService() {
|
|
|
22130
22341
|
try {
|
|
22131
22342
|
if (process.platform === "linux") {
|
|
22132
22343
|
const unitPath = systemdUnitPath();
|
|
22133
|
-
if (!
|
|
22344
|
+
if (!existsSync21(unitPath))
|
|
22134
22345
|
return;
|
|
22135
22346
|
try {
|
|
22136
22347
|
runPrivileged("systemctl", ["disable", "--now", systemdUnitName()]);
|
|
@@ -22141,7 +22352,7 @@ async function uninstallDaemonService() {
|
|
|
22141
22352
|
} catch {}
|
|
22142
22353
|
} else {
|
|
22143
22354
|
const plistPath = launchdPlistPath();
|
|
22144
|
-
if (!
|
|
22355
|
+
if (!existsSync21(plistPath))
|
|
22145
22356
|
return;
|
|
22146
22357
|
try {
|
|
22147
22358
|
runPrivileged("launchctl", ["unload", "-w", plistPath]);
|
|
@@ -22158,7 +22369,7 @@ function daemonVersionSkew() {
|
|
|
22158
22369
|
const recorded = readVersionFile()?.daemon;
|
|
22159
22370
|
if (!recorded)
|
|
22160
22371
|
return null;
|
|
22161
|
-
if (!
|
|
22372
|
+
if (!existsSync21(installedBinaryPath(recorded)))
|
|
22162
22373
|
return null;
|
|
22163
22374
|
return recorded === version2 ? null : { installed: recorded, expected: version2 };
|
|
22164
22375
|
}
|
|
@@ -22176,7 +22387,7 @@ function daemonServiceStatus() {
|
|
|
22176
22387
|
if (!isDaemonSupportedPlatform())
|
|
22177
22388
|
return "unsupported-platform";
|
|
22178
22389
|
if (process.platform === "linux") {
|
|
22179
|
-
if (!
|
|
22390
|
+
if (!existsSync21(systemdUnitPath()))
|
|
22180
22391
|
return "not-installed";
|
|
22181
22392
|
try {
|
|
22182
22393
|
const out = execFileSync2("systemctl", ["is-active", systemdUnitName()], {
|
|
@@ -22189,7 +22400,7 @@ function daemonServiceStatus() {
|
|
|
22189
22400
|
}
|
|
22190
22401
|
}
|
|
22191
22402
|
const plistPath = launchdPlistPath();
|
|
22192
|
-
if (!
|
|
22403
|
+
if (!existsSync21(plistPath))
|
|
22193
22404
|
return "not-installed";
|
|
22194
22405
|
try {
|
|
22195
22406
|
const root = typeof process.getuid === "function" && process.getuid() === 0;
|
|
@@ -22221,7 +22432,7 @@ var init_daemon_service = __esm(() => {
|
|
|
22221
22432
|
// src/hooks/fp-reset.ts
|
|
22222
22433
|
import {
|
|
22223
22434
|
copyFileSync,
|
|
22224
|
-
existsSync as
|
|
22435
|
+
existsSync as existsSync22,
|
|
22225
22436
|
mkdirSync as mkdirSync12,
|
|
22226
22437
|
readFileSync as readFileSync18,
|
|
22227
22438
|
readdirSync as readdirSync14,
|
|
@@ -22234,7 +22445,7 @@ import {
|
|
|
22234
22445
|
import { dirname as dirname10, isAbsolute as isAbsolute3, relative as relative4, resolve as resolve18 } from "node:path";
|
|
22235
22446
|
function migrateConventionPolicies() {
|
|
22236
22447
|
const from = legacy.customPoliciesDir();
|
|
22237
|
-
if (!
|
|
22448
|
+
if (!existsSync22(from))
|
|
22238
22449
|
return [];
|
|
22239
22450
|
const moved = [];
|
|
22240
22451
|
const mergeInto = (dir, dest, prefix) => {
|
|
@@ -22255,7 +22466,7 @@ function migrateConventionPolicies() {
|
|
|
22255
22466
|
const source = resolve18(dir, entry.name);
|
|
22256
22467
|
const target = resolve18(dest, entry.name);
|
|
22257
22468
|
const name = `${prefix}${entry.name}`;
|
|
22258
|
-
if (!
|
|
22469
|
+
if (!existsSync22(target)) {
|
|
22259
22470
|
try {
|
|
22260
22471
|
renameSync6(source, target);
|
|
22261
22472
|
moved.push(name);
|
|
@@ -22282,7 +22493,7 @@ function migrateLegacySpool() {
|
|
|
22282
22493
|
[legacy.spoolDir(), spoolDir()],
|
|
22283
22494
|
[legacy.failedDir(), failedDir()]
|
|
22284
22495
|
]) {
|
|
22285
|
-
if (!
|
|
22496
|
+
if (!existsSync22(from))
|
|
22286
22497
|
continue;
|
|
22287
22498
|
try {
|
|
22288
22499
|
mkdirSync12(to, { recursive: true });
|
|
@@ -22291,7 +22502,7 @@ function migrateLegacySpool() {
|
|
|
22291
22502
|
continue;
|
|
22292
22503
|
let name = entry.name;
|
|
22293
22504
|
let n = 0;
|
|
22294
|
-
while (
|
|
22505
|
+
while (existsSync22(resolve18(to, name)))
|
|
22295
22506
|
name = `legacy-${n++}-${entry.name}`;
|
|
22296
22507
|
try {
|
|
22297
22508
|
renameSync6(resolve18(from, entry.name), resolve18(to, name));
|
|
@@ -22309,7 +22520,7 @@ function migrateLegacySpool() {
|
|
|
22309
22520
|
}
|
|
22310
22521
|
function migrateHookActivity() {
|
|
22311
22522
|
const from = legacy.hookActivityDir();
|
|
22312
|
-
if (!
|
|
22523
|
+
if (!existsSync22(from))
|
|
22313
22524
|
return [];
|
|
22314
22525
|
const moved = [];
|
|
22315
22526
|
try {
|
|
@@ -22324,7 +22535,7 @@ function migrateHookActivity() {
|
|
|
22324
22535
|
const source = resolve18(from, entry.name);
|
|
22325
22536
|
let name = entry.name === "current.jsonl" ? `page-${stamp}-${seq++}.jsonl` : entry.name;
|
|
22326
22537
|
let target = resolve18(to, name);
|
|
22327
|
-
while (
|
|
22538
|
+
while (existsSync22(target)) {
|
|
22328
22539
|
name = `page-${stamp}-${seq++}.jsonl`;
|
|
22329
22540
|
target = resolve18(to, name);
|
|
22330
22541
|
}
|
|
@@ -22375,7 +22586,7 @@ function retirePolicyConfigKeys() {
|
|
|
22375
22586
|
}
|
|
22376
22587
|
function readCarriedPolicyConfig() {
|
|
22377
22588
|
const from = resolve18(legacy.localPoliciesDir(), "policies-config.json");
|
|
22378
|
-
if (!
|
|
22589
|
+
if (!existsSync22(from))
|
|
22379
22590
|
return null;
|
|
22380
22591
|
let parsed;
|
|
22381
22592
|
try {
|
|
@@ -22439,7 +22650,7 @@ function writeCarriedPolicyConfig(carried) {
|
|
|
22439
22650
|
}
|
|
22440
22651
|
function readCarriedTelemetryOptOut() {
|
|
22441
22652
|
const from = legacy.configToml();
|
|
22442
|
-
if (!
|
|
22653
|
+
if (!existsSync22(from))
|
|
22443
22654
|
return false;
|
|
22444
22655
|
try {
|
|
22445
22656
|
const text = readFileSync18(from, "utf8");
|
|
@@ -22494,7 +22705,7 @@ function parseLegacyToml(text) {
|
|
|
22494
22705
|
}
|
|
22495
22706
|
function readCarriedLegacyConfig() {
|
|
22496
22707
|
const from = legacy.configToml();
|
|
22497
|
-
if (!
|
|
22708
|
+
if (!existsSync22(from))
|
|
22498
22709
|
return null;
|
|
22499
22710
|
try {
|
|
22500
22711
|
return projectConfig(parseLegacyToml(readFileSync18(from, "utf8")));
|
|
@@ -22504,7 +22715,7 @@ function readCarriedLegacyConfig() {
|
|
|
22504
22715
|
}
|
|
22505
22716
|
function readCarriedLegacyCredentials() {
|
|
22506
22717
|
const toml = legacy.credentialsToml();
|
|
22507
|
-
if (
|
|
22718
|
+
if (existsSync22(toml)) {
|
|
22508
22719
|
try {
|
|
22509
22720
|
const creds = projectCredentials(parseLegacyToml(readFileSync18(toml, "utf8")));
|
|
22510
22721
|
if (Object.keys(creds).length > 0)
|
|
@@ -22547,7 +22758,7 @@ function resetHome(from, to = LAYOUT_VERSION) {
|
|
|
22547
22758
|
const spooled = migrateLegacySpool();
|
|
22548
22759
|
const removed = [];
|
|
22549
22760
|
for (const path of resettablePaths()) {
|
|
22550
|
-
if (!
|
|
22761
|
+
if (!existsSync22(path))
|
|
22551
22762
|
continue;
|
|
22552
22763
|
try {
|
|
22553
22764
|
rmSync7(path, { recursive: true, force: true });
|
|
@@ -22572,7 +22783,7 @@ function layoutWarningForHook() {
|
|
|
22572
22783
|
if (state.kind === "future") {
|
|
22573
22784
|
return `[failproofai] this directory was written by a newer version (layout ${state.found} vs ${LAYOUT_VERSION}) — policies are NOT being enforced. ` + `Upgrade failproofai.`;
|
|
22574
22785
|
}
|
|
22575
|
-
if (
|
|
22786
|
+
if (existsSync22(globalPolicyConfigFile()))
|
|
22576
22787
|
return null;
|
|
22577
22788
|
return `[failproofai] setup predates this version — global policies are NOT being enforced. ` + `Run \`failproofai config\` to re-create it.`;
|
|
22578
22789
|
}
|
|
@@ -23620,17 +23831,17 @@ var init_collector_config = __esm(() => {
|
|
|
23620
23831
|
});
|
|
23621
23832
|
|
|
23622
23833
|
// src/hooks/flush-cli.ts
|
|
23623
|
-
import { existsSync as
|
|
23624
|
-
import { dirname as dirname11, join as
|
|
23834
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync13, writeFileSync as writeFileSync11, readdirSync as readdirSync15 } from "node:fs";
|
|
23835
|
+
import { dirname as dirname11, join as join30 } from "node:path";
|
|
23625
23836
|
function flushRequestPath(home) {
|
|
23626
|
-
return
|
|
23837
|
+
return join30(failproofaiHome(home), "state", "flush-request.json");
|
|
23627
23838
|
}
|
|
23628
23839
|
function spoolDirs(home) {
|
|
23629
23840
|
const root = spoolDir(home);
|
|
23630
|
-
if (!
|
|
23841
|
+
if (!existsSync23(root))
|
|
23631
23842
|
return [];
|
|
23632
23843
|
try {
|
|
23633
|
-
return readdirSync15(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) =>
|
|
23844
|
+
return readdirSync15(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join30(root, e.name));
|
|
23634
23845
|
} catch {
|
|
23635
23846
|
return [];
|
|
23636
23847
|
}
|
|
@@ -23731,14 +23942,14 @@ var init_flush_cli = __esm(() => {
|
|
|
23731
23942
|
import {
|
|
23732
23943
|
chmodSync as chmodSync4,
|
|
23733
23944
|
copyFileSync as copyFileSync2,
|
|
23734
|
-
existsSync as
|
|
23945
|
+
existsSync as existsSync24,
|
|
23735
23946
|
mkdirSync as mkdirSync14,
|
|
23736
23947
|
readFileSync as readFileSync19,
|
|
23737
23948
|
renameSync as renameSync7,
|
|
23738
23949
|
rmSync as rmSync8,
|
|
23739
23950
|
writeFileSync as writeFileSync12
|
|
23740
23951
|
} from "node:fs";
|
|
23741
|
-
import { basename as basename4, dirname as dirname12, join as
|
|
23952
|
+
import { basename as basename4, dirname as dirname12, join as join31, resolve as resolve19 } from "node:path";
|
|
23742
23953
|
function migrateToLayout4() {
|
|
23743
23954
|
const moves = [
|
|
23744
23955
|
{ from: legacy.authJson(), to: auditSessionFile() },
|
|
@@ -23747,16 +23958,16 @@ function migrateToLayout4() {
|
|
|
23747
23958
|
];
|
|
23748
23959
|
const authDirOverride = process.env.FAILPROOFAI_AUTH_DIR;
|
|
23749
23960
|
if (authDirOverride) {
|
|
23750
|
-
moves.push({ from:
|
|
23751
|
-
from:
|
|
23752
|
-
to:
|
|
23961
|
+
moves.push({ from: join31(authDirOverride, "auth.json"), to: join31(authDirOverride, "session.json") }, {
|
|
23962
|
+
from: join31(authDirOverride, "next-audit.json"),
|
|
23963
|
+
to: join31(authDirOverride, "reminder.json")
|
|
23753
23964
|
});
|
|
23754
23965
|
}
|
|
23755
23966
|
const migrated = [];
|
|
23756
23967
|
for (const { from, to } of moves) {
|
|
23757
|
-
if (!
|
|
23968
|
+
if (!existsSync24(from))
|
|
23758
23969
|
continue;
|
|
23759
|
-
if (
|
|
23970
|
+
if (existsSync24(to)) {
|
|
23760
23971
|
rmSync8(from, { force: true });
|
|
23761
23972
|
continue;
|
|
23762
23973
|
}
|
|
@@ -23777,7 +23988,7 @@ function migrateToLayout4() {
|
|
|
23777
23988
|
migrated.push(`${basename4(from)} → audit/${basename4(to)}`);
|
|
23778
23989
|
}
|
|
23779
23990
|
for (const secret of [auditSessionFile()]) {
|
|
23780
|
-
if (!
|
|
23991
|
+
if (!existsSync24(secret))
|
|
23781
23992
|
continue;
|
|
23782
23993
|
try {
|
|
23783
23994
|
chmodSync4(secret, 384);
|
|
@@ -23825,10 +24036,10 @@ function pruneMigratedCredentials(from) {
|
|
|
23825
24036
|
for (let layout = from;layout < LAYOUT_VERSION; layout++) {
|
|
23826
24037
|
for (const { as, landsAt } of PRUNED_AFTER_SUCCESS) {
|
|
23827
24038
|
try {
|
|
23828
|
-
if (!
|
|
24039
|
+
if (!existsSync24(landsAt()))
|
|
23829
24040
|
continue;
|
|
23830
24041
|
const copy = resolve19(migrationBackupDir(layout), as);
|
|
23831
|
-
if (!
|
|
24042
|
+
if (!existsSync24(copy))
|
|
23832
24043
|
continue;
|
|
23833
24044
|
rmSync8(copy, { force: true });
|
|
23834
24045
|
pruned.push(as);
|
|
@@ -23841,7 +24052,7 @@ function filesToBackUp() {
|
|
|
23841
24052
|
const seen = new Map;
|
|
23842
24053
|
for (const f of [...BACKED_UP, ...BACKED_UP_LEGACY]) {
|
|
23843
24054
|
const path = f.at();
|
|
23844
|
-
if (
|
|
24055
|
+
if (existsSync24(path))
|
|
23845
24056
|
seen.set(path, backupNameOf(f));
|
|
23846
24057
|
}
|
|
23847
24058
|
return [...seen].map(([path, as]) => ({ path, as }));
|
|
@@ -24149,13 +24360,13 @@ import { createHmac, randomUUID as randomUUID2 } from "node:crypto";
|
|
|
24149
24360
|
import { execSync as execSync5 } from "node:child_process";
|
|
24150
24361
|
import { readFileSync as readFileSync20, writeFileSync as writeFileSync13, mkdirSync as mkdirSync15 } from "node:fs";
|
|
24151
24362
|
import { homedir as homedir22, platform, arch, hostname, cpus } from "node:os";
|
|
24152
|
-
import { join as
|
|
24363
|
+
import { join as join32 } from "node:path";
|
|
24153
24364
|
function hashToId3(raw) {
|
|
24154
24365
|
return createHmac("sha256", NAMESPACE3).update(raw).digest("hex");
|
|
24155
24366
|
}
|
|
24156
24367
|
function getInstanceId3() {
|
|
24157
|
-
const idDir =
|
|
24158
|
-
const idFile =
|
|
24368
|
+
const idDir = join32(homedir22(), ".failproofai");
|
|
24369
|
+
const idFile = join32(idDir, "instance-id");
|
|
24159
24370
|
try {
|
|
24160
24371
|
const existing = readFileSync20(idFile, "utf-8").trim();
|
|
24161
24372
|
if (existing)
|
|
@@ -24231,7 +24442,7 @@ var NAMESPACE3 = "failproofai-telemetry-v1", API_KEY3 = "phc_Ac1Ww1GqKc0z1SyrRWb
|
|
|
24231
24442
|
var init_install_telemetry = () => {};
|
|
24232
24443
|
|
|
24233
24444
|
// lib/install-check.ts
|
|
24234
|
-
import { existsSync as
|
|
24445
|
+
import { existsSync as existsSync25, readFileSync as readFileSync21, writeFileSync as writeFileSync14, mkdirSync as mkdirSync16 } from "node:fs";
|
|
24235
24446
|
import { dirname as dirname13, resolve as resolve20 } from "node:path";
|
|
24236
24447
|
import { platform as platform2, arch as arch2, release, homedir as homedir23, hostname as hostname2 } from "node:os";
|
|
24237
24448
|
import { createHmac as createHmac2 } from "node:crypto";
|
|
@@ -24287,7 +24498,7 @@ function compareSemver(a, b) {
|
|
|
24287
24498
|
}
|
|
24288
24499
|
function checkHooks() {
|
|
24289
24500
|
const hooksConfigPath = globalPolicyConfigFile();
|
|
24290
|
-
if (!
|
|
24501
|
+
if (!existsSync25(hooksConfigPath)) {
|
|
24291
24502
|
return { configured: false, registered: false, policyCount: 0 };
|
|
24292
24503
|
}
|
|
24293
24504
|
let config;
|
|
@@ -24301,7 +24512,7 @@ function checkHooks() {
|
|
|
24301
24512
|
}
|
|
24302
24513
|
const policyCount = config.enabledPolicies.length;
|
|
24303
24514
|
const settingsPath = resolve20(homedir23(), ".claude", "settings.json");
|
|
24304
|
-
if (!
|
|
24515
|
+
if (!existsSync25(settingsPath))
|
|
24305
24516
|
return { configured: true, registered: false, policyCount };
|
|
24306
24517
|
let settings;
|
|
24307
24518
|
try {
|
|
@@ -24329,7 +24540,7 @@ async function maybeReportInstall(version) {
|
|
|
24329
24540
|
const versionFile = lastVersionPath();
|
|
24330
24541
|
let previousVersion = null;
|
|
24331
24542
|
try {
|
|
24332
|
-
if (
|
|
24543
|
+
if (existsSync25(versionFile)) {
|
|
24333
24544
|
previousVersion = readFileSync21(versionFile, "utf8").trim() || null;
|
|
24334
24545
|
}
|
|
24335
24546
|
} catch {}
|
|
@@ -24417,7 +24628,7 @@ var init_cli_error = __esm(() => {
|
|
|
24417
24628
|
|
|
24418
24629
|
// src/hooks/manager.ts
|
|
24419
24630
|
import { execSync as execSync6 } from "node:child_process";
|
|
24420
|
-
import { existsSync as
|
|
24631
|
+
import { existsSync as existsSync26 } from "node:fs";
|
|
24421
24632
|
import { resolve as resolve21, basename as basename5 } from "node:path";
|
|
24422
24633
|
import { platform as platform3, arch as arch3, release as release2, hostname as hostname3 } from "node:os";
|
|
24423
24634
|
function getSettingsPath(scope, cwd) {
|
|
@@ -24639,7 +24850,7 @@ async function installHooksImpl(policyNames, scope = "user", cwd, includeBeta =
|
|
|
24639
24850
|
} else if (customPoliciesPath && (typeof customPoliciesPath === "string" || customPoliciesPath.length > 0)) {
|
|
24640
24851
|
const incoming = (typeof customPoliciesPath === "string" ? [customPoliciesPath] : customPoliciesPath).map((path) => resolve21(path));
|
|
24641
24852
|
const carried = (previousConfig.customPoliciesPaths ?? (previousConfig.customPoliciesPath ? [previousConfig.customPoliciesPath] : [])).map((path) => resolve21(path)).filter((path) => {
|
|
24642
|
-
if (
|
|
24853
|
+
if (existsSync26(path))
|
|
24643
24854
|
return true;
|
|
24644
24855
|
console.log(`Dropping custom policies path (file no longer exists): ${path}`);
|
|
24645
24856
|
return false;
|
|
@@ -24862,7 +25073,7 @@ async function removeHooks(policyNames, scope = "user", cwd, opts) {
|
|
|
24862
25073
|
const scopesToRemove = scope === "all" ? [...integration.scopes] : integration.scopes.includes(scope) ? [scope] : [];
|
|
24863
25074
|
for (const s of scopesToRemove) {
|
|
24864
25075
|
const settingsPaths = settingsPathsFor(integration, s, cwd);
|
|
24865
|
-
const existing = settingsPaths.filter((p) =>
|
|
25076
|
+
const existing = settingsPaths.filter((p) => existsSync26(p));
|
|
24866
25077
|
if (existing.length === 0) {
|
|
24867
25078
|
if (scope !== "all" && selectedClis.length === 1) {
|
|
24868
25079
|
console.log("No settings file found. Nothing to remove.");
|
|
@@ -24965,7 +25176,7 @@ var DEFAULT_FETCH_TIMEOUT_MS = 15000;
|
|
|
24965
25176
|
|
|
24966
25177
|
// src/hooks/cloud-enrollment.ts
|
|
24967
25178
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
24968
|
-
import { existsSync as
|
|
25179
|
+
import { existsSync as existsSync27, readFileSync as readFileSync22, rmSync as rmSync9 } from "node:fs";
|
|
24969
25180
|
import { hostname as hostname4 } from "node:os";
|
|
24970
25181
|
function cloudCredentialPath() {
|
|
24971
25182
|
return process.env.FAILPROOFAI_CLOUD_CREDENTIALS ?? credentialsFile();
|
|
@@ -25004,7 +25215,7 @@ function readCloudCredentials() {
|
|
|
25004
25215
|
if (!usingJsonOverride())
|
|
25005
25216
|
return readCredentials().cloud ?? null;
|
|
25006
25217
|
const path = cloudCredentialPath();
|
|
25007
|
-
if (!
|
|
25218
|
+
if (!existsSync27(path))
|
|
25008
25219
|
return null;
|
|
25009
25220
|
try {
|
|
25010
25221
|
const raw = JSON.parse(readFileSync22(path, "utf8"));
|
|
@@ -25046,7 +25257,7 @@ function resolveMachineLabel(explicit) {
|
|
|
25046
25257
|
function clearCloudCredentials() {
|
|
25047
25258
|
if (usingJsonOverride()) {
|
|
25048
25259
|
const path = cloudCredentialPath();
|
|
25049
|
-
if (!
|
|
25260
|
+
if (!existsSync27(path))
|
|
25050
25261
|
return false;
|
|
25051
25262
|
try {
|
|
25052
25263
|
rmSync9(path);
|
|
@@ -25297,7 +25508,7 @@ var init_cloud_connection = __esm(() => {
|
|
|
25297
25508
|
});
|
|
25298
25509
|
|
|
25299
25510
|
// src/hooks/setup-state.ts
|
|
25300
|
-
import { existsSync as
|
|
25511
|
+
import { existsSync as existsSync28, realpathSync as realpathSync2, statSync as statSync17 } from "node:fs";
|
|
25301
25512
|
import { dirname as dirname14, resolve as resolve22 } from "node:path";
|
|
25302
25513
|
import { homedir as homedir24 } from "node:os";
|
|
25303
25514
|
function globalConfigPath(home = homedir24()) {
|
|
@@ -25354,10 +25565,10 @@ function detectSetupState(cwd = process.cwd(), home = homedir24()) {
|
|
|
25354
25565
|
cwd: resolvedCwd,
|
|
25355
25566
|
home: resolvedHome,
|
|
25356
25567
|
projectRoot,
|
|
25357
|
-
hasGlobalConfig:
|
|
25358
|
-
hasProjectConfig: projectRoot !== resolvedHome &&
|
|
25568
|
+
hasGlobalConfig: existsSync28(globalConfigPath(resolvedHome)),
|
|
25569
|
+
hasProjectConfig: projectRoot !== resolvedHome && existsSync28(projectConfigPath(projectRoot)),
|
|
25359
25570
|
hasGlobalHooks: hasGlobalHooksInstalled(),
|
|
25360
|
-
hasLegacyMarker:
|
|
25571
|
+
hasLegacyMarker: existsSync28(legacyMarkerPath(resolvedHome)),
|
|
25361
25572
|
inHomeDir: resolvedCwd === resolvedHome
|
|
25362
25573
|
};
|
|
25363
25574
|
}
|
|
@@ -25374,11 +25585,11 @@ var init_setup_state = __esm(() => {
|
|
|
25374
25585
|
});
|
|
25375
25586
|
|
|
25376
25587
|
// src/hooks/onboarding-attempt.ts
|
|
25377
|
-
import { existsSync as
|
|
25588
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync17, readFileSync as readFileSync23, rmSync as rmSync10, writeFileSync as writeFileSync15 } from "node:fs";
|
|
25378
25589
|
import { dirname as dirname15 } from "node:path";
|
|
25379
25590
|
function readOnboardingAttempt() {
|
|
25380
25591
|
const path = onboardingAttemptFile();
|
|
25381
|
-
if (!
|
|
25592
|
+
if (!existsSync29(path))
|
|
25382
25593
|
return null;
|
|
25383
25594
|
try {
|
|
25384
25595
|
const raw = JSON.parse(readFileSync23(path, "utf8"));
|
|
@@ -25511,8 +25722,8 @@ var init_onboarding_lock = __esm(() => {
|
|
|
25511
25722
|
});
|
|
25512
25723
|
|
|
25513
25724
|
// lib/claude-sessions.ts
|
|
25514
|
-
import { readdirSync as readdirSync16, statSync as statSync18, existsSync as
|
|
25515
|
-
import { join as
|
|
25725
|
+
import { readdirSync as readdirSync16, statSync as statSync18, existsSync as existsSync30 } from "node:fs";
|
|
25726
|
+
import { join as join33, basename as basename6 } from "node:path";
|
|
25516
25727
|
function getClaudeProjectsRoot() {
|
|
25517
25728
|
return getClaudeProjectsPath();
|
|
25518
25729
|
}
|
|
@@ -25527,7 +25738,7 @@ function listClaudeProjects() {
|
|
|
25527
25738
|
return entries.filter((e) => e.isDirectory()).map((e) => ({
|
|
25528
25739
|
name: e.name,
|
|
25529
25740
|
cwd: decodeFolderName(e.name),
|
|
25530
|
-
path:
|
|
25741
|
+
path: join33(root, e.name)
|
|
25531
25742
|
}));
|
|
25532
25743
|
}
|
|
25533
25744
|
function listClaudeTranscripts(project) {
|
|
@@ -25543,7 +25754,7 @@ function listClaudeTranscripts(project) {
|
|
|
25543
25754
|
const sessionId = entry.name.slice(0, -".jsonl".length);
|
|
25544
25755
|
if (!UUID_RE2.test(sessionId))
|
|
25545
25756
|
continue;
|
|
25546
|
-
const transcriptPath =
|
|
25757
|
+
const transcriptPath = join33(project.path, entry.name);
|
|
25547
25758
|
try {
|
|
25548
25759
|
const s = statSync18(transcriptPath);
|
|
25549
25760
|
out.push({
|
|
@@ -25557,8 +25768,8 @@ function listClaudeTranscripts(project) {
|
|
|
25557
25768
|
});
|
|
25558
25769
|
} catch {}
|
|
25559
25770
|
} else if (entry.isDirectory() && UUID_RE2.test(entry.name)) {
|
|
25560
|
-
const subDir =
|
|
25561
|
-
if (!
|
|
25771
|
+
const subDir = join33(project.path, entry.name, "subagents");
|
|
25772
|
+
if (!existsSync30(subDir))
|
|
25562
25773
|
continue;
|
|
25563
25774
|
let subEntries;
|
|
25564
25775
|
try {
|
|
@@ -25570,7 +25781,7 @@ function listClaudeTranscripts(project) {
|
|
|
25570
25781
|
if (!sub.isFile() || !sub.name.endsWith(".jsonl"))
|
|
25571
25782
|
continue;
|
|
25572
25783
|
const agentId = sub.name.slice(0, -".jsonl".length);
|
|
25573
|
-
const transcriptPath =
|
|
25784
|
+
const transcriptPath = join33(subDir, sub.name);
|
|
25574
25785
|
try {
|
|
25575
25786
|
const s = statSync18(transcriptPath);
|
|
25576
25787
|
out.push({
|
|
@@ -26901,8 +27112,8 @@ var init_features = __esm(() => {
|
|
|
26901
27112
|
|
|
26902
27113
|
// src/audit/cache.ts
|
|
26903
27114
|
import { createHash as createHash8 } from "node:crypto";
|
|
26904
|
-
import { existsSync as
|
|
26905
|
-
import { join as
|
|
27115
|
+
import { existsSync as existsSync31, mkdirSync as mkdirSync19, readFileSync as readFileSync25, writeFileSync as writeFileSync17, chmodSync as chmodSync5, openSync, readSync, closeSync } from "node:fs";
|
|
27116
|
+
import { join as join34 } from "node:path";
|
|
26906
27117
|
function getEngineVersion() {
|
|
26907
27118
|
if (cachedEngineVersion)
|
|
26908
27119
|
return cachedEngineVersion;
|
|
@@ -26922,7 +27133,7 @@ function getDetectorVersion() {
|
|
|
26922
27133
|
function getCachePathFor(transcriptPath) {
|
|
26923
27134
|
const root = auditCacheDir();
|
|
26924
27135
|
const key = createHash8("sha1").update(transcriptPath).digest("hex");
|
|
26925
|
-
return
|
|
27136
|
+
return join34(root, `${key}.json`);
|
|
26926
27137
|
}
|
|
26927
27138
|
function encodeDetectorState(state) {
|
|
26928
27139
|
return JSON.stringify(state, (_k, v) => v instanceof Map ? { __map: [...v.entries()] } : v);
|
|
@@ -26962,7 +27173,7 @@ function readCachedTranscript(transcriptPath, mtimeMs, sizeBytes) {
|
|
|
26962
27173
|
if (sizeBytes === 0)
|
|
26963
27174
|
return null;
|
|
26964
27175
|
const cachePath = getCachePathFor(transcriptPath);
|
|
26965
|
-
if (!
|
|
27176
|
+
if (!existsSync31(cachePath))
|
|
26966
27177
|
return null;
|
|
26967
27178
|
try {
|
|
26968
27179
|
const raw = readFileSync25(cachePath, "utf-8");
|
|
@@ -27582,7 +27793,7 @@ var init_audit_lock = __esm(() => {
|
|
|
27582
27793
|
});
|
|
27583
27794
|
|
|
27584
27795
|
// src/audit/dashboard-cache.ts
|
|
27585
|
-
import { existsSync as
|
|
27796
|
+
import { existsSync as existsSync32, readFileSync as readFileSync27 } from "node:fs";
|
|
27586
27797
|
function getCachePath() {
|
|
27587
27798
|
return auditDashboardFile();
|
|
27588
27799
|
}
|
|
@@ -27602,7 +27813,7 @@ function writeDashboardCache(params, result) {
|
|
|
27602
27813
|
}
|
|
27603
27814
|
function readDashboardCacheMeta() {
|
|
27604
27815
|
const cachePath = getCachePath();
|
|
27605
|
-
if (!
|
|
27816
|
+
if (!existsSync32(cachePath))
|
|
27606
27817
|
return null;
|
|
27607
27818
|
try {
|
|
27608
27819
|
const raw = readFileSync27(cachePath, "utf-8");
|
|
@@ -27829,15 +28040,15 @@ var init_api_server_client = __esm(() => {
|
|
|
27829
28040
|
});
|
|
27830
28041
|
|
|
27831
28042
|
// lib/auth/auth-store.ts
|
|
27832
|
-
import { existsSync as
|
|
27833
|
-
import { join as
|
|
28043
|
+
import { existsSync as existsSync33, readFileSync as readFileSync28, readdirSync as readdirSync17, rmSync as rmSync12 } from "node:fs";
|
|
28044
|
+
import { join as join35, resolve as resolve23 } from "node:path";
|
|
27834
28045
|
function getAuthFilePath() {
|
|
27835
28046
|
const override = process.env.FAILPROOFAI_AUTH_DIR;
|
|
27836
|
-
return override ?
|
|
28047
|
+
return override ? join35(override, "session.json") : auditSessionFile();
|
|
27837
28048
|
}
|
|
27838
28049
|
function readAuth() {
|
|
27839
28050
|
const p = getAuthFilePath();
|
|
27840
|
-
if (!
|
|
28051
|
+
if (!existsSync33(p))
|
|
27841
28052
|
return null;
|
|
27842
28053
|
try {
|
|
27843
28054
|
const raw = readFileSync28(p, "utf-8");
|
|
@@ -27864,17 +28075,17 @@ function writeAuth(auth) {
|
|
|
27864
28075
|
}
|
|
27865
28076
|
function deleteAuth() {
|
|
27866
28077
|
const p = getAuthFilePath();
|
|
27867
|
-
if (
|
|
28078
|
+
if (existsSync33(p))
|
|
27868
28079
|
rmSync12(p, { force: true });
|
|
27869
28080
|
try {
|
|
27870
28081
|
const root = migrationsDir();
|
|
27871
|
-
if (!
|
|
28082
|
+
if (!existsSync33(root))
|
|
27872
28083
|
return;
|
|
27873
28084
|
for (const entry of readdirSync17(root)) {
|
|
27874
28085
|
if (!entry.startsWith("backup-layout"))
|
|
27875
28086
|
continue;
|
|
27876
28087
|
const copy = resolve23(root, entry, "auth.json");
|
|
27877
|
-
if (
|
|
28088
|
+
if (existsSync33(copy))
|
|
27878
28089
|
rmSync12(copy, { force: true });
|
|
27879
28090
|
}
|
|
27880
28091
|
} catch {}
|
|
@@ -28125,12 +28336,12 @@ var init_harm_report = __esm(() => {
|
|
|
28125
28336
|
});
|
|
28126
28337
|
|
|
28127
28338
|
// src/audit/machine-store.ts
|
|
28128
|
-
import { existsSync as
|
|
28339
|
+
import { existsSync as existsSync34, readFileSync as readFileSync29, rmSync as rmSync13 } from "node:fs";
|
|
28129
28340
|
import { hostname as hostname5 } from "node:os";
|
|
28130
28341
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
28131
28342
|
function readMachineIdentity(home) {
|
|
28132
28343
|
const path = auditMachineFile(home);
|
|
28133
|
-
if (!
|
|
28344
|
+
if (!existsSync34(path))
|
|
28134
28345
|
return null;
|
|
28135
28346
|
try {
|
|
28136
28347
|
const parsed = JSON.parse(readFileSync29(path, "utf8"));
|
|
@@ -28455,7 +28666,7 @@ var init_cli = __esm(() => {
|
|
|
28455
28666
|
});
|
|
28456
28667
|
|
|
28457
28668
|
// src/hooks/configure-wizard.ts
|
|
28458
|
-
import { existsSync as
|
|
28669
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync21, writeFileSync as writeFileSync19, readFileSync as readFileSync30 } from "node:fs";
|
|
28459
28670
|
import { homedir as homedir27 } from "node:os";
|
|
28460
28671
|
import { dirname as dirname16, resolve as resolve24, sep as sep5 } from "node:path";
|
|
28461
28672
|
async function emit(event, props) {
|
|
@@ -28480,7 +28691,7 @@ function setCustomPoliciesEnabled(scope, cwd, enabled) {
|
|
|
28480
28691
|
const path = getConfigPathForScope(scope, cwd);
|
|
28481
28692
|
let config = {};
|
|
28482
28693
|
try {
|
|
28483
|
-
if (
|
|
28694
|
+
if (existsSync35(path))
|
|
28484
28695
|
config = JSON.parse(readFileSync30(path, "utf8"));
|
|
28485
28696
|
} catch {
|
|
28486
28697
|
return;
|
|
@@ -29117,17 +29328,17 @@ var init_configure_wizard = __esm(() => {
|
|
|
29117
29328
|
});
|
|
29118
29329
|
|
|
29119
29330
|
// src/hooks/flush-cli.ts
|
|
29120
|
-
import { existsSync as
|
|
29121
|
-
import { dirname as dirname17, join as
|
|
29331
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync22, writeFileSync as writeFileSync20, readdirSync as readdirSync18 } from "node:fs";
|
|
29332
|
+
import { dirname as dirname17, join as join36 } from "node:path";
|
|
29122
29333
|
function flushRequestPath2(home) {
|
|
29123
|
-
return
|
|
29334
|
+
return join36(failproofaiHome(home), "state", "flush-request.json");
|
|
29124
29335
|
}
|
|
29125
29336
|
function spoolDirs2(home) {
|
|
29126
29337
|
const root = spoolDir(home);
|
|
29127
|
-
if (!
|
|
29338
|
+
if (!existsSync36(root))
|
|
29128
29339
|
return [];
|
|
29129
29340
|
try {
|
|
29130
|
-
return readdirSync18(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) =>
|
|
29341
|
+
return readdirSync18(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join36(root, e.name));
|
|
29131
29342
|
} catch {
|
|
29132
29343
|
return [];
|
|
29133
29344
|
}
|
|
@@ -29225,16 +29436,16 @@ var init_flush_cli2 = __esm(() => {
|
|
|
29225
29436
|
});
|
|
29226
29437
|
|
|
29227
29438
|
// src/hooks/backfill-cli.ts
|
|
29228
|
-
import { existsSync as
|
|
29229
|
-
import { dirname as dirname18, join as
|
|
29439
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync23, writeFileSync as writeFileSync21, readdirSync as readdirSync19, statSync as statSync23 } from "node:fs";
|
|
29440
|
+
import { dirname as dirname18, join as join37 } from "node:path";
|
|
29230
29441
|
function backfillRequestPath(home) {
|
|
29231
|
-
return
|
|
29442
|
+
return join37(failproofaiHome(home), "state", "backfill-request.json");
|
|
29232
29443
|
}
|
|
29233
29444
|
function surveySessions(sinceMs, homeDir) {
|
|
29234
29445
|
const out = [];
|
|
29235
29446
|
for (const { cli, dir } of SESSION_DIRS) {
|
|
29236
|
-
const root =
|
|
29237
|
-
if (!
|
|
29447
|
+
const root = join37(homeDir, dir);
|
|
29448
|
+
if (!existsSync37(root))
|
|
29238
29449
|
continue;
|
|
29239
29450
|
let files = 0;
|
|
29240
29451
|
let newest = 0;
|
|
@@ -29248,7 +29459,7 @@ function surveySessions(sinceMs, homeDir) {
|
|
|
29248
29459
|
return;
|
|
29249
29460
|
}
|
|
29250
29461
|
for (const e of entries) {
|
|
29251
|
-
const p =
|
|
29462
|
+
const p = join37(d, e.name);
|
|
29252
29463
|
if (e.isDirectory()) {
|
|
29253
29464
|
walk(p, depth + 1);
|
|
29254
29465
|
continue;
|
|
@@ -29272,7 +29483,7 @@ function runBackfillCommand(opts = {}) {
|
|
|
29272
29483
|
const now = opts.now ?? Date.now();
|
|
29273
29484
|
const sinceMs = opts.sinceMs ?? now - DEFAULT_BACKFILL_DAYS * 24 * 60 * 60 * 1000;
|
|
29274
29485
|
const home = failproofaiHome();
|
|
29275
|
-
if (!
|
|
29486
|
+
if (!existsSync37(home)) {
|
|
29276
29487
|
return {
|
|
29277
29488
|
exitCode: 1,
|
|
29278
29489
|
lines: [`No failproofai home at ${home}. Run \`failproofai config\` first.`]
|
|
@@ -29603,7 +29814,7 @@ var init_harness_cli = __esm(() => {
|
|
|
29603
29814
|
});
|
|
29604
29815
|
|
|
29605
29816
|
// src/hooks/fp-config.ts
|
|
29606
|
-
import { chmodSync as chmodSync6, existsSync as
|
|
29817
|
+
import { chmodSync as chmodSync6, existsSync as existsSync38, mkdirSync as mkdirSync24, readFileSync as readFileSync31, statSync as statSync24, writeFileSync as writeFileSync22 } from "node:fs";
|
|
29607
29818
|
function detectLayout2() {
|
|
29608
29819
|
const raw = readVersionFile2();
|
|
29609
29820
|
if (raw) {
|
|
@@ -29611,17 +29822,17 @@ function detectLayout2() {
|
|
|
29611
29822
|
return { kind: "current", version: raw };
|
|
29612
29823
|
return raw.layout > LAYOUT_VERSION ? { kind: "future", found: raw.layout } : { kind: "stale", found: raw.layout };
|
|
29613
29824
|
}
|
|
29614
|
-
if (
|
|
29825
|
+
if (existsSync38(configFile())) {
|
|
29615
29826
|
const layoutThreePositions = [
|
|
29616
29827
|
legacy.authJson(),
|
|
29617
29828
|
legacy.nextAudit(),
|
|
29618
29829
|
legacy.auditSchedule()
|
|
29619
29830
|
];
|
|
29620
|
-
if (layoutThreePositions.some((p) =>
|
|
29831
|
+
if (layoutThreePositions.some((p) => existsSync38(p)))
|
|
29621
29832
|
return { kind: "stale", found: 3 };
|
|
29622
29833
|
return { kind: "current", version: { layout: LAYOUT_VERSION, cli: "" }, inferred: true };
|
|
29623
29834
|
}
|
|
29624
|
-
if (
|
|
29835
|
+
if (existsSync38(legacy.configToml()))
|
|
29625
29836
|
return { kind: "stale", found: 2 };
|
|
29626
29837
|
const layoutOneMarkers = [
|
|
29627
29838
|
legacy.policyConfig(),
|
|
@@ -29632,7 +29843,7 @@ function detectLayout2() {
|
|
|
29632
29843
|
legacy.ingestCredentials(),
|
|
29633
29844
|
legacy.auditDashboard()
|
|
29634
29845
|
];
|
|
29635
|
-
return layoutOneMarkers.some((p) =>
|
|
29846
|
+
return layoutOneMarkers.some((p) => existsSync38(p)) ? { kind: "stale", found: 1 } : { kind: "absent" };
|
|
29636
29847
|
}
|
|
29637
29848
|
function readLegacyTomlVersion2(text) {
|
|
29638
29849
|
const layout = Number(/^\s*layout\s*=\s*(\d+)\s*$/m.exec(text)?.[1]);
|
|
@@ -29675,14 +29886,14 @@ var init_fp_home2 = () => {};
|
|
|
29675
29886
|
import {
|
|
29676
29887
|
chmodSync as chmodSync7,
|
|
29677
29888
|
copyFileSync as copyFileSync3,
|
|
29678
|
-
existsSync as
|
|
29889
|
+
existsSync as existsSync39,
|
|
29679
29890
|
mkdirSync as mkdirSync25,
|
|
29680
29891
|
readFileSync as readFileSync32,
|
|
29681
29892
|
renameSync as renameSync8,
|
|
29682
29893
|
rmSync as rmSync14,
|
|
29683
29894
|
writeFileSync as writeFileSync23
|
|
29684
29895
|
} from "node:fs";
|
|
29685
|
-
import { basename as basename7, dirname as dirname19, join as
|
|
29896
|
+
import { basename as basename7, dirname as dirname19, join as join38, resolve as resolve26 } from "node:path";
|
|
29686
29897
|
function migrateToLayout42() {
|
|
29687
29898
|
const moves = [
|
|
29688
29899
|
{ from: legacy.authJson(), to: auditSessionFile() },
|
|
@@ -29691,16 +29902,16 @@ function migrateToLayout42() {
|
|
|
29691
29902
|
];
|
|
29692
29903
|
const authDirOverride = process.env.FAILPROOFAI_AUTH_DIR;
|
|
29693
29904
|
if (authDirOverride) {
|
|
29694
|
-
moves.push({ from:
|
|
29695
|
-
from:
|
|
29696
|
-
to:
|
|
29905
|
+
moves.push({ from: join38(authDirOverride, "auth.json"), to: join38(authDirOverride, "session.json") }, {
|
|
29906
|
+
from: join38(authDirOverride, "next-audit.json"),
|
|
29907
|
+
to: join38(authDirOverride, "reminder.json")
|
|
29697
29908
|
});
|
|
29698
29909
|
}
|
|
29699
29910
|
const migrated = [];
|
|
29700
29911
|
for (const { from, to } of moves) {
|
|
29701
|
-
if (!
|
|
29912
|
+
if (!existsSync39(from))
|
|
29702
29913
|
continue;
|
|
29703
|
-
if (
|
|
29914
|
+
if (existsSync39(to)) {
|
|
29704
29915
|
rmSync14(from, { force: true });
|
|
29705
29916
|
continue;
|
|
29706
29917
|
}
|
|
@@ -29721,7 +29932,7 @@ function migrateToLayout42() {
|
|
|
29721
29932
|
migrated.push(`${basename7(from)} → audit/${basename7(to)}`);
|
|
29722
29933
|
}
|
|
29723
29934
|
for (const secret of [auditSessionFile()]) {
|
|
29724
|
-
if (!
|
|
29935
|
+
if (!existsSync39(secret))
|
|
29725
29936
|
continue;
|
|
29726
29937
|
try {
|
|
29727
29938
|
chmodSync7(secret, 384);
|
|
@@ -29769,10 +29980,10 @@ function pruneMigratedCredentials2(from) {
|
|
|
29769
29980
|
for (let layout = from;layout < LAYOUT_VERSION; layout++) {
|
|
29770
29981
|
for (const { as, landsAt } of PRUNED_AFTER_SUCCESS2) {
|
|
29771
29982
|
try {
|
|
29772
|
-
if (!
|
|
29983
|
+
if (!existsSync39(landsAt()))
|
|
29773
29984
|
continue;
|
|
29774
29985
|
const copy = resolve26(migrationBackupDir(layout), as);
|
|
29775
|
-
if (!
|
|
29986
|
+
if (!existsSync39(copy))
|
|
29776
29987
|
continue;
|
|
29777
29988
|
rmSync14(copy, { force: true });
|
|
29778
29989
|
pruned.push(as);
|
|
@@ -29785,7 +29996,7 @@ function filesToBackUp2() {
|
|
|
29785
29996
|
const seen = new Map;
|
|
29786
29997
|
for (const f of [...BACKED_UP2, ...BACKED_UP_LEGACY2]) {
|
|
29787
29998
|
const path = f.at();
|
|
29788
|
-
if (
|
|
29999
|
+
if (existsSync39(path))
|
|
29789
30000
|
seen.set(path, backupNameOf2(f));
|
|
29790
30001
|
}
|
|
29791
30002
|
return [...seen].map(([path, as]) => ({ path, as }));
|
|
@@ -29939,7 +30150,7 @@ var init_migrations2 = __esm(() => {
|
|
|
29939
30150
|
|
|
29940
30151
|
// src/hooks/daemon-service.ts
|
|
29941
30152
|
import {
|
|
29942
|
-
existsSync as
|
|
30153
|
+
existsSync as existsSync40,
|
|
29943
30154
|
mkdirSync as mkdirSync26,
|
|
29944
30155
|
mkdtempSync as mkdtempSync2,
|
|
29945
30156
|
readFileSync as readFileSync33,
|
|
@@ -29964,13 +30175,13 @@ function resolveFailproofaidBinaryPath2() {
|
|
|
29964
30175
|
if (process.env.FAILPROOFAI_DAEMON_BINARY)
|
|
29965
30176
|
return process.env.FAILPROOFAI_DAEMON_BINARY;
|
|
29966
30177
|
const downloaded = installedBinaryPath();
|
|
29967
|
-
if (
|
|
30178
|
+
if (existsSync40(downloaded))
|
|
29968
30179
|
return downloaded;
|
|
29969
30180
|
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT;
|
|
29970
30181
|
if (packageRoot) {
|
|
29971
30182
|
for (const profile of ["release", "debug"]) {
|
|
29972
30183
|
const candidate = resolve27(packageRoot, "target", profile, "failproofaid");
|
|
29973
|
-
if (
|
|
30184
|
+
if (existsSync40(candidate))
|
|
29974
30185
|
return candidate;
|
|
29975
30186
|
}
|
|
29976
30187
|
}
|
|
@@ -30001,7 +30212,7 @@ function resolveWorkerCommand2() {
|
|
|
30001
30212
|
if (!packageRoot)
|
|
30002
30213
|
return null;
|
|
30003
30214
|
const workerScript = resolve27(packageRoot, "dist", "worker.mjs");
|
|
30004
|
-
if (!
|
|
30215
|
+
if (!existsSync40(workerScript))
|
|
30005
30216
|
return null;
|
|
30006
30217
|
return `${shellQuote2(process.execPath)} ${shellQuote2(workerScript)}`;
|
|
30007
30218
|
}
|
|
@@ -30012,7 +30223,7 @@ function resolveCliCommand2() {
|
|
|
30012
30223
|
if (!packageRoot)
|
|
30013
30224
|
return null;
|
|
30014
30225
|
const cliScript = resolve27(packageRoot, "dist", "cli.mjs");
|
|
30015
|
-
if (!
|
|
30226
|
+
if (!existsSync40(cliScript))
|
|
30016
30227
|
return null;
|
|
30017
30228
|
return `${shellQuote2(process.execPath)} ${shellQuote2(cliScript)}`;
|
|
30018
30229
|
}
|
|
@@ -30026,7 +30237,7 @@ function workerScriptPath2() {
|
|
|
30026
30237
|
if (!packageRoot)
|
|
30027
30238
|
return null;
|
|
30028
30239
|
const workerScript = resolve27(packageRoot, "dist", "worker.mjs");
|
|
30029
|
-
return
|
|
30240
|
+
return existsSync40(workerScript) ? workerScript : null;
|
|
30030
30241
|
}
|
|
30031
30242
|
function assertUnitSafe2(value, field) {
|
|
30032
30243
|
if (UNIT_UNSAFE_RE2.test(value)) {
|
|
@@ -30115,7 +30326,7 @@ function removeLegacyUserService2() {
|
|
|
30115
30326
|
try {
|
|
30116
30327
|
if (process.platform === "linux") {
|
|
30117
30328
|
const legacy = legacySystemdUserUnitPath2();
|
|
30118
|
-
if (!
|
|
30329
|
+
if (!existsSync40(legacy))
|
|
30119
30330
|
return;
|
|
30120
30331
|
try {
|
|
30121
30332
|
execFileSync3("systemctl", ["--user", "disable", "--now", "failproofaid.service"], {
|
|
@@ -30132,7 +30343,7 @@ function removeLegacyUserService2() {
|
|
|
30132
30343
|
} catch {}
|
|
30133
30344
|
} else {
|
|
30134
30345
|
const legacyAgent = legacyLaunchAgentPlistPath2();
|
|
30135
|
-
if (
|
|
30346
|
+
if (existsSync40(legacyAgent)) {
|
|
30136
30347
|
try {
|
|
30137
30348
|
execFileSync3("launchctl", ["unload", "-w", legacyAgent], {
|
|
30138
30349
|
stdio: "ignore",
|
|
@@ -30142,7 +30353,7 @@ function removeLegacyUserService2() {
|
|
|
30142
30353
|
unlinkSync5(legacyAgent);
|
|
30143
30354
|
}
|
|
30144
30355
|
const legacyDaemon = legacySharedLaunchDaemonPath2();
|
|
30145
|
-
if (
|
|
30356
|
+
if (existsSync40(legacyDaemon)) {
|
|
30146
30357
|
try {
|
|
30147
30358
|
runPrivileged2("launchctl", ["unload", "-w", legacyDaemon]);
|
|
30148
30359
|
} catch {}
|
|
@@ -30159,7 +30370,7 @@ function systemdUnitContents2(binaryPath, workerCmd, cliCmd = null) {
|
|
|
30159
30370
|
const user = assertUnitSafe2(serviceUser2(), "User");
|
|
30160
30371
|
assertUnitSafe2(binaryPath, "ExecStart");
|
|
30161
30372
|
assertUnitSafe2(homedir29(), "HOME");
|
|
30162
|
-
const conditionPaths = [binaryPath, workerScriptPath2()].filter((p) => typeof p === "string" &&
|
|
30373
|
+
const conditionPaths = [binaryPath, workerScriptPath2()].filter((p) => typeof p === "string" && existsSync40(p));
|
|
30163
30374
|
const conditionLines = conditionPaths.map((p) => `ConditionPathExists=${assertUnitSafe2(p, "ConditionPathExists")}
|
|
30164
30375
|
`).join("");
|
|
30165
30376
|
return `[Unit]
|
|
@@ -30364,7 +30575,7 @@ function daemonServiceStatus2() {
|
|
|
30364
30575
|
if (!isDaemonSupportedPlatform2())
|
|
30365
30576
|
return "unsupported-platform";
|
|
30366
30577
|
if (process.platform === "linux") {
|
|
30367
|
-
if (!
|
|
30578
|
+
if (!existsSync40(systemdUnitPath2()))
|
|
30368
30579
|
return "not-installed";
|
|
30369
30580
|
try {
|
|
30370
30581
|
const out = execFileSync3("systemctl", ["is-active", systemdUnitName2()], {
|
|
@@ -30377,7 +30588,7 @@ function daemonServiceStatus2() {
|
|
|
30377
30588
|
}
|
|
30378
30589
|
}
|
|
30379
30590
|
const plistPath = launchdPlistPath2();
|
|
30380
|
-
if (!
|
|
30591
|
+
if (!existsSync40(plistPath))
|
|
30381
30592
|
return "not-installed";
|
|
30382
30593
|
try {
|
|
30383
30594
|
const root = typeof process.getuid === "function" && process.getuid() === 0;
|
|
@@ -30407,7 +30618,7 @@ var init_daemon_service2 = __esm(() => {
|
|
|
30407
30618
|
});
|
|
30408
30619
|
|
|
30409
30620
|
// src/hooks/uninstall-cli.ts
|
|
30410
|
-
import { existsSync as
|
|
30621
|
+
import { existsSync as existsSync41, rmSync as rmSync16 } from "node:fs";
|
|
30411
30622
|
function survey(cwd) {
|
|
30412
30623
|
const clis = [];
|
|
30413
30624
|
for (const id of listInstallableIds()) {
|
|
@@ -30428,9 +30639,9 @@ function survey(cwd) {
|
|
|
30428
30639
|
return {
|
|
30429
30640
|
clis,
|
|
30430
30641
|
servicePath,
|
|
30431
|
-
serviceInstalled: !!servicePath &&
|
|
30642
|
+
serviceInstalled: !!servicePath && existsSync41(servicePath),
|
|
30432
30643
|
daemonConfigured,
|
|
30433
|
-
homeExists:
|
|
30644
|
+
homeExists: existsSync41(failproofaiHome())
|
|
30434
30645
|
};
|
|
30435
30646
|
}
|
|
30436
30647
|
async function runUninstallCommand(opts = {}) {
|
|
@@ -30528,7 +30739,7 @@ async function runUninstallCommand(opts = {}) {
|
|
|
30528
30739
|
} catch {}
|
|
30529
30740
|
try {
|
|
30530
30741
|
await uninstallDaemonService();
|
|
30531
|
-
if (found.servicePath &&
|
|
30742
|
+
if (found.servicePath && existsSync41(found.servicePath)) {
|
|
30532
30743
|
failures.push(`the service at ${found.servicePath} is still there (most often: no sudo). ` + `Remove it with the commands below.`);
|
|
30533
30744
|
} else {
|
|
30534
30745
|
lines.push(`✓ stopped and removed the daemon service`);
|
|
@@ -30551,7 +30762,7 @@ async function runUninstallCommand(opts = {}) {
|
|
|
30551
30762
|
lines.push(``, `Not everything could be removed:`);
|
|
30552
30763
|
for (const f of failures)
|
|
30553
30764
|
lines.push(` ✗ ${f}`);
|
|
30554
|
-
if (found.servicePath &&
|
|
30765
|
+
if (found.servicePath && existsSync41(found.servicePath)) {
|
|
30555
30766
|
lines.push(``, `To remove the service by hand:`, ...manualServiceRemoval(found.servicePath), ``, `(\`${daemonStatusCommand()}\` shows its current state.)`);
|
|
30556
30767
|
}
|
|
30557
30768
|
return { exitCode: 1, lines, planLines, purged };
|
|
@@ -30585,8 +30796,8 @@ var init_uninstall_cli = __esm(() => {
|
|
|
30585
30796
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
30586
30797
|
import { homedir as homedir30, tmpdir as tmpdir4 } from "node:os";
|
|
30587
30798
|
import { createHash as createHash9 } from "node:crypto";
|
|
30588
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
30589
|
-
import { basename as basename8, dirname as dirname20, isAbsolute as isAbsolute4, join as
|
|
30799
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync42, mkdirSync as mkdirSync27, mkdtempSync as mkdtempSync3, readFileSync as readFileSync34, readdirSync as readdirSync20, realpathSync as realpathSync3, rmSync as rmSync17, statSync as statSync25, writeFileSync as writeFileSync25 } from "node:fs";
|
|
30800
|
+
import { basename as basename8, dirname as dirname20, isAbsolute as isAbsolute4, join as join39, relative as relative5, resolve as resolve28, sep as sep6 } from "node:path";
|
|
30590
30801
|
function parseList(rest, flag) {
|
|
30591
30802
|
const idx = rest.findIndex((a) => a === flag || a.startsWith(`${flag}=`));
|
|
30592
30803
|
if (idx === -1)
|
|
@@ -30700,7 +30911,7 @@ async function build(rest) {
|
|
|
30700
30911
|
return fail2([err instanceof Error ? err.message : String(err)]);
|
|
30701
30912
|
}
|
|
30702
30913
|
const entryPath = resolve28(entry);
|
|
30703
|
-
if (!
|
|
30914
|
+
if (!existsSync42(entryPath))
|
|
30704
30915
|
return fail2([`No such file: ${entryPath}`]);
|
|
30705
30916
|
const source = readFileSync34(entryPath, "utf8");
|
|
30706
30917
|
const localImport = /(?:^|\n)\s*(?:import|export)[^;\n]*from\s+["'](\.[^"']*)["']/.exec(source);
|
|
@@ -30895,7 +31106,7 @@ async function scaffold(target) {
|
|
|
30895
31106
|
chosen = answer.trim();
|
|
30896
31107
|
}
|
|
30897
31108
|
const path = resolve28(withPolicyExtension(chosen ?? "my-policies"));
|
|
30898
|
-
if (
|
|
31109
|
+
if (existsSync42(path)) {
|
|
30899
31110
|
return fail2([`${path} already exists — name a different file, or edit that one.`]);
|
|
30900
31111
|
}
|
|
30901
31112
|
mkdirSync27(resolve28(path, ".."), { recursive: true });
|
|
@@ -31347,7 +31558,7 @@ function pushExistingHistory(dir, owner, name, token) {
|
|
|
31347
31558
|
const branch = git(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
31348
31559
|
if (!branch || branch === "HEAD" || !git(["rev-parse", "--verify", "HEAD"]))
|
|
31349
31560
|
return false;
|
|
31350
|
-
const askpass =
|
|
31561
|
+
const askpass = join39(mkdtempSync3(join39(tmpdir4(), "fpai-askpass-")), "askpass.sh");
|
|
31351
31562
|
try {
|
|
31352
31563
|
writeFileSync25(askpass, `#!/bin/sh
|
|
31353
31564
|
case "$1" in
|
|
@@ -32393,7 +32604,7 @@ var init_install_prompt = __esm(() => {
|
|
|
32393
32604
|
|
|
32394
32605
|
// src/hooks/manager.ts
|
|
32395
32606
|
import { execSync as execSync7 } from "node:child_process";
|
|
32396
|
-
import { existsSync as
|
|
32607
|
+
import { existsSync as existsSync43 } from "node:fs";
|
|
32397
32608
|
import { resolve as resolve29, basename as basename9 } from "node:path";
|
|
32398
32609
|
import { platform as platform4, arch as arch4, release as release3, hostname as hostname6 } from "node:os";
|
|
32399
32610
|
function getSettingsPath2(scope, cwd) {
|
|
@@ -32615,7 +32826,7 @@ async function installHooksImpl2(policyNames, scope = "user", cwd, includeBeta =
|
|
|
32615
32826
|
} else if (customPoliciesPath && (typeof customPoliciesPath === "string" || customPoliciesPath.length > 0)) {
|
|
32616
32827
|
const incoming = (typeof customPoliciesPath === "string" ? [customPoliciesPath] : customPoliciesPath).map((path) => resolve29(path));
|
|
32617
32828
|
const carried = (previousConfig.customPoliciesPaths ?? (previousConfig.customPoliciesPath ? [previousConfig.customPoliciesPath] : [])).map((path) => resolve29(path)).filter((path) => {
|
|
32618
|
-
if (
|
|
32829
|
+
if (existsSync43(path))
|
|
32619
32830
|
return true;
|
|
32620
32831
|
console.log(`Dropping custom policies path (file no longer exists): ${path}`);
|
|
32621
32832
|
return false;
|
|
@@ -32838,7 +33049,7 @@ async function removeHooks2(policyNames, scope = "user", cwd, opts) {
|
|
|
32838
33049
|
const scopesToRemove = scope === "all" ? [...integration.scopes] : integration.scopes.includes(scope) ? [scope] : [];
|
|
32839
33050
|
for (const s of scopesToRemove) {
|
|
32840
33051
|
const settingsPaths = settingsPathsFor(integration, s, cwd);
|
|
32841
|
-
const existing = settingsPaths.filter((p) =>
|
|
33052
|
+
const existing = settingsPaths.filter((p) => existsSync43(p));
|
|
32842
33053
|
if (existing.length === 0) {
|
|
32843
33054
|
if (scope !== "all" && selectedClis.length === 1) {
|
|
32844
33055
|
console.log("No settings file found. Nothing to remove.");
|
|
@@ -32984,7 +33195,7 @@ async function listHooks(cwd) {
|
|
|
32984
33195
|
for (const path of explicitPaths) {
|
|
32985
33196
|
const absPath = resolve29(findProjectConfigDir(cwd ?? process.cwd()), path);
|
|
32986
33197
|
groups.push(note(absPath, opts));
|
|
32987
|
-
if (!
|
|
33198
|
+
if (!existsSync43(absPath)) {
|
|
32988
33199
|
groups.push(warning([`file not found: ${absPath}`], opts));
|
|
32989
33200
|
continue;
|
|
32990
33201
|
}
|
|
@@ -33546,19 +33757,19 @@ function parseScriptArgs(argv) {
|
|
|
33546
33757
|
var init_parse_script_args = () => {};
|
|
33547
33758
|
|
|
33548
33759
|
// scripts/install-diagnosis.mjs
|
|
33549
|
-
import { existsSync as
|
|
33760
|
+
import { existsSync as existsSync44, readFileSync as readFileSync36, realpathSync as realpathSync4 } from "node:fs";
|
|
33550
33761
|
import { dirname as dirname21, resolve as resolve31 } from "node:path";
|
|
33551
33762
|
import { homedir as homedir31, platform as platform5 } from "node:os";
|
|
33552
33763
|
import { spawnSync } from "node:child_process";
|
|
33553
33764
|
function findPackageRoot(start) {
|
|
33554
33765
|
try {
|
|
33555
33766
|
let dir = realpathSync4(start);
|
|
33556
|
-
if (
|
|
33767
|
+
if (existsSync44(dir) && !existsSync44(resolve31(dir, "package.json"))) {
|
|
33557
33768
|
dir = dirname21(dir);
|
|
33558
33769
|
}
|
|
33559
33770
|
while (true) {
|
|
33560
33771
|
const pkgPath = resolve31(dir, "package.json");
|
|
33561
|
-
if (
|
|
33772
|
+
if (existsSync44(pkgPath)) {
|
|
33562
33773
|
try {
|
|
33563
33774
|
const pkg = JSON.parse(readFileSync36(pkgPath, "utf8"));
|
|
33564
33775
|
if (pkg.name === PKG_NAME)
|
|
@@ -33605,7 +33816,7 @@ function locateNpmGlobal() {
|
|
|
33605
33816
|
if (!root)
|
|
33606
33817
|
return null;
|
|
33607
33818
|
const candidate = resolve31(root, PKG_NAME);
|
|
33608
|
-
return
|
|
33819
|
+
return existsSync44(resolve31(candidate, "package.json")) ? candidate : null;
|
|
33609
33820
|
} catch {
|
|
33610
33821
|
return null;
|
|
33611
33822
|
}
|
|
@@ -33613,7 +33824,7 @@ function locateNpmGlobal() {
|
|
|
33613
33824
|
function locateBunGlobal() {
|
|
33614
33825
|
try {
|
|
33615
33826
|
const candidate = resolve31(homedir31(), ".bun", "install", "global", "node_modules", PKG_NAME);
|
|
33616
|
-
return
|
|
33827
|
+
return existsSync44(resolve31(candidate, "package.json")) ? candidate : null;
|
|
33617
33828
|
} catch {
|
|
33618
33829
|
return null;
|
|
33619
33830
|
}
|
|
@@ -33716,7 +33927,7 @@ var init_dashboard_host = __esm(() => {
|
|
|
33716
33927
|
|
|
33717
33928
|
// scripts/launch.ts
|
|
33718
33929
|
import { spawn as spawn2 } from "child_process";
|
|
33719
|
-
import { realpathSync as realpathSync5, existsSync as
|
|
33930
|
+
import { realpathSync as realpathSync5, existsSync as existsSync45 } from "node:fs";
|
|
33720
33931
|
import { resolve as resolve32, dirname as dirname22 } from "node:path";
|
|
33721
33932
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
33722
33933
|
import { createInterface } from "node:readline";
|
|
@@ -33743,7 +33954,7 @@ function launch(mode) {
|
|
|
33743
33954
|
cmd = "node";
|
|
33744
33955
|
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve32(dirname22(realpathSync5(fileURLToPath2(import.meta.url))), "..");
|
|
33745
33956
|
const serverJsPath = resolve32(packageRoot, ".next/standalone/server.js");
|
|
33746
|
-
if (!
|
|
33957
|
+
if (!existsSync45(serverJsPath)) {
|
|
33747
33958
|
let shadowMessage = null;
|
|
33748
33959
|
try {
|
|
33749
33960
|
const diag = diagnoseShadow({ selfPackageRoot: packageRoot, selfVersion: version2 });
|
|
@@ -34498,7 +34709,7 @@ var init_session_pause_cli = __esm(() => {
|
|
|
34498
34709
|
|
|
34499
34710
|
// scripts/launch.ts
|
|
34500
34711
|
import { spawn as spawn3 } from "child_process";
|
|
34501
|
-
import { realpathSync as realpathSync6, existsSync as
|
|
34712
|
+
import { realpathSync as realpathSync6, existsSync as existsSync46 } from "node:fs";
|
|
34502
34713
|
import { resolve as resolve33, dirname as dirname23 } from "node:path";
|
|
34503
34714
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
34504
34715
|
import { createInterface as createInterface2 } from "node:readline";
|
|
@@ -34525,7 +34736,7 @@ function launch2(mode) {
|
|
|
34525
34736
|
cmd = "node";
|
|
34526
34737
|
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve33(dirname23(realpathSync6(fileURLToPath3(import.meta.url))), "..");
|
|
34527
34738
|
const serverJsPath = resolve33(packageRoot, ".next/standalone/server.js");
|
|
34528
|
-
if (!
|
|
34739
|
+
if (!existsSync46(serverJsPath)) {
|
|
34529
34740
|
let shadowMessage = null;
|
|
34530
34741
|
try {
|
|
34531
34742
|
const diag = diagnoseShadow({ selfPackageRoot: packageRoot, selfVersion: version2 });
|
|
@@ -34625,7 +34836,7 @@ import { realpathSync as realpathSync7 } from "fs";
|
|
|
34625
34836
|
import { dirname as dirname24, resolve as resolve34 } from "path";
|
|
34626
34837
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
34627
34838
|
// package.json
|
|
34628
|
-
var version = "1.0.
|
|
34839
|
+
var version = "1.0.5-beta.1";
|
|
34629
34840
|
|
|
34630
34841
|
// bin/failproofai.mjs
|
|
34631
34842
|
if (!process.env.FAILPROOFAI_PACKAGE_ROOT) {
|