failproofai 1.0.3 → 1.0.4-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +5 -5
- package/.next/standalone/.next/prerender-manifest.json +5 -5
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/invite/route_client-reference-manifest.js +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/run/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route_client-reference-manifest.js +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-request/route_client-reference-manifest.js +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/login-verify/route_client-reference-manifest.js +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/logout/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route_client-reference-manifest.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/api/download/[project]/[session]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/audit/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +37 -4
- package/.next/standalone/.next/server/app/audit/page.js +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 +15 -15
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +4 -4
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__0-9ti7z._.js → [externals]__1lh7m5d._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__0u3wrvq._.js → [externals]__1rqkg_y._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1adacul._.js +1 -1
- package/.next/standalone/.next/server/chunks/{_1-akg6w._.js → _08w6xzm._.js} +2 -2
- 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/_1ek68ln._.js +4 -4
- package/.next/standalone/.next/server/chunks/lib_telemetry_ts_0dctyyw._.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js +2 -2
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +2 -2
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_hooks_fp-home_ts_09kv0bn._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__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]__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]__0rgu2r3._.js +3 -0
- 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]__1p2otjt._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0-oij9d._.js +23 -0
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0l2hi_d._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0oq1dh6._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1es2j7i._.js +47 -13
- package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.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 -69
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_rerun-button_tsx_0blihgw._.js +3 -0
- 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/node_modules_13n822a._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_builtin-policies_ts_09j2ndl._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-config_ts_04t589g._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +54 -21
- package/.next/standalone/.next/static/chunks/010bv1w6j171t.js +1 -0
- package/.next/standalone/.next/static/chunks/04r6ch8uf_n8m.js +1 -0
- package/.next/standalone/.next/static/chunks/{29-iqnp9v_axt.css → 0o-hh5_turzlz.css} +1 -1
- package/.next/standalone/.next/static/chunks/{40nr6ehj4p3cw.css → 0qmsunv04x4na.css} +1 -1
- package/.next/standalone/.next/static/chunks/{0ollg-nnu3t3e.js → 0wz8yftk18ts2.js} +1 -1
- package/.next/standalone/.next/static/chunks/0zebh1n9jkfbt.js +1 -0
- package/.next/standalone/.next/static/chunks/1eyl7fzkmnkf_.js +1 -0
- package/.next/standalone/.next/static/chunks/1pb1oztsbwcss.js +1 -0
- package/.next/standalone/.next/static/chunks/{1-_zkmnm-jwei.js → 2aquitk72k2op.js} +1 -1
- package/.next/standalone/.next/static/chunks/2bi_1y0a_smt7.js +6 -0
- package/.next/standalone/.next/static/chunks/{42yfkhekx440s.js → 2ej3b8gk5ittu.js} +1 -1
- package/.next/standalone/.next/static/chunks/{354-n7p7labpn.js → 2zafgs90r_leq.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2xm5mj1d21b4n.js → 32spub4wqjem-.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1a6u7l3giejch.js → 3m4upvybtrexd.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2k9f4tyv04809.css → 3uyhmm01g64k4.css} +1 -0
- package/.next/standalone/.next/static/chunks/{turbopack-2x-o099q64i8h.js → turbopack-3s3c-u_u_l0u9.js} +1 -1
- package/.next/standalone/.opencode/plugins/failproofai.mjs +51 -27
- package/.next/standalone/app/actions/get-leaks.ts +100 -0
- package/.next/standalone/app/audit/_components/audit-dashboard.tsx +112 -33
- package/.next/standalone/app/audit/_components/audit-poster.tsx +29 -10
- package/.next/standalone/app/audit/_components/come-back-better-section.tsx +6 -1
- package/.next/standalone/app/audit/_components/empty-state.tsx +4 -1
- package/.next/standalone/app/audit/_components/how-to-improve-section.tsx +19 -5
- package/.next/standalone/app/audit/_components/leak-section.tsx +179 -0
- package/.next/standalone/app/audit/_components/share-templates.ts +110 -44
- package/.next/standalone/app/audit/audit-styles.css +114 -1
- package/.next/standalone/fp-cloud-cli/CHANGELOG.md +26 -3
- package/.next/standalone/fp-cloud-cli/fp_cli/_click_compat.py +31 -8
- package/.next/standalone/fp-cloud-cli/fp_cli/permissions.py +1 -0
- package/.next/standalone/fp-cloud-cli/pyproject.toml +9 -2
- package/.next/standalone/fp-cloud-cli/tests/test_click_compat.py +54 -0
- package/.next/standalone/fp-cloud-cli/uv.lock +9 -12
- package/.next/standalone/lib/auth/api-server-client.ts +28 -0
- package/.next/standalone/lib/claude-sessions.ts +101 -27
- package/.next/standalone/node_modules/@next/env/package.json +1 -1
- package/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +5 -5
- package/.next/standalone/node_modules/next/dist/experimental/testmode/fetch.js +10 -2
- package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
- package/.next/standalone/node_modules/next/dist/lib/typescript/runTypeScriptCli.js +2 -2
- package/.next/standalone/node_modules/next/dist/lib/verify-typescript-setup.js +3 -1
- package/.next/standalone/node_modules/next/dist/server/config.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +2 -2
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +17 -4
- package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
- package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
- package/.next/standalone/node_modules/next/package.json +11 -11
- package/.next/standalone/package.json +14 -13
- package/.next/standalone/sdk/python/CHANGELOG.md +155 -0
- package/.next/standalone/sdk/python/README.md +8 -0
- package/.next/standalone/sdk/python/examples/evaluator_worker.py +121 -0
- package/.next/standalone/sdk/python/failproofai_sdk/_version.py +1 -1
- package/.next/standalone/sdk/python/failproofai_sdk/evaluator/__init__.py +101 -0
- package/.next/standalone/sdk/python/failproofai_sdk/evaluator/__main__.py +49 -0
- package/.next/standalone/sdk/python/failproofai_sdk/evaluator/_sandbox_runner.py +63 -0
- package/.next/standalone/sdk/python/failproofai_sdk/evaluator/authoring.py +404 -0
- package/.next/standalone/sdk/python/failproofai_sdk/evaluator/client.py +299 -0
- package/.next/standalone/sdk/python/failproofai_sdk/evaluator/protocol.py +754 -0
- package/.next/standalone/sdk/python/failproofai_sdk/evaluator/runtime.py +936 -0
- package/.next/standalone/sdk/python/failproofai_sdk/evaluator/source.py +684 -0
- package/.next/standalone/sdk/python/tests/fixtures/evaluator_v2/README.md +28 -0
- package/.next/standalone/sdk/python/tests/fixtures/evaluator_v2/contract.json +252 -0
- package/.next/standalone/sdk/python/tests/test_evaluator_authoring.py +124 -0
- package/.next/standalone/sdk/python/tests/test_evaluator_client.py +253 -0
- package/.next/standalone/sdk/python/tests/test_evaluator_example.py +35 -0
- package/.next/standalone/sdk/python/tests/test_evaluator_http_e2e.py +636 -0
- package/.next/standalone/sdk/python/tests/test_evaluator_main.py +47 -0
- package/.next/standalone/sdk/python/tests/test_evaluator_protocol.py +246 -0
- package/.next/standalone/sdk/python/tests/test_evaluator_review_fixes.py +164 -0
- package/.next/standalone/sdk/python/tests/test_evaluator_runtime.py +1103 -0
- package/.next/standalone/sdk/python/tests/test_evaluator_source.py +430 -0
- package/.next/standalone/sdk/python/tests/test_zero_dependencies.py +17 -0
- package/.next/standalone/sdk/python/uv.lock +29 -29
- package/.next/standalone/server.js +1 -1
- package/README.md +13 -58
- package/dist/cli.mjs +5368 -8756
- package/dist/worker.mjs +539 -312
- package/lib/auth/api-server-client.ts +28 -0
- package/lib/claude-sessions.ts +101 -27
- package/package.json +14 -13
- package/pi-extension/index.ts +42 -4
- package/scripts/changelog-open.py +115 -0
- package/src/audit/cli.ts +134 -0
- package/src/audit/desktop-notify.ts +420 -0
- package/src/audit/harm-report.ts +101 -0
- package/src/audit/index.ts +141 -13
- package/src/audit/leak-fingerprint.ts +200 -0
- package/src/audit/leak-notice.ts +161 -0
- package/src/audit/leak-record.ts +232 -0
- package/src/audit/leak-scan.ts +292 -0
- package/src/audit/leak-store.ts +217 -0
- package/src/audit/macos-notifier.ts +310 -0
- package/src/audit/redact-example.ts +266 -14
- package/src/audit/report-harm.ts +12 -1
- package/src/audit/report.ts +6 -3
- package/src/audit/schedule-cli.ts +37 -0
- package/src/audit/scoring.ts +49 -0
- package/src/audit/types.ts +41 -0
- package/src/hooks/builtin-policies.ts +67 -2
- package/src/hooks/configure-wizard.ts +20 -0
- package/src/hooks/fp-config.ts +71 -11
- package/src/hooks/fp-home.ts +27 -0
- package/src/hooks/handler.ts +59 -1
- package/src/hooks/integrations.ts +47 -13
- package/src/hooks/notice.ts +155 -0
- package/src/hooks/uninstall-cli.ts +15 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1b5jzxr._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0j6gd_k._.js +0 -23
- package/.next/standalone/.next/server/chunks/ssr/_0v8eebd._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_1ylae7o._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/node_modules_html-to-image_es_index_1ao30b1.js +0 -3
- package/.next/standalone/.next/static/chunks/03slu0c8_71y7.js +0 -1
- package/.next/standalone/.next/static/chunks/0nm11ysn0153h.js +0 -1
- package/.next/standalone/.next/static/chunks/0u64yey446k4f.css +0 -1
- package/.next/standalone/.next/static/chunks/1r9676mkvihto.js +0 -1
- package/.next/standalone/.next/static/chunks/30pct5s734jua.js +0 -6
- package/.next/standalone/.next/static/chunks/3pibxnbhjza7n.js +0 -69
- package/.next/standalone/.next/static/chunks/3qfoeqhy5l10x.js +0 -1
- package/.next/standalone/.next/static/chunks/3zkg2s2vzxc3d.js +0 -1
- package/.next/standalone/.next/static/chunks/41b5ptaocvi_l.js +0 -1
- /package/.next/standalone/.next/static/{JBYgkXkA1PS48m9P_hKNw → aKNv4Kmv98Xpwns0Xa-C-}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{JBYgkXkA1PS48m9P_hKNw → aKNv4Kmv98Xpwns0Xa-C-}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{JBYgkXkA1PS48m9P_hKNw → aKNv4Kmv98Xpwns0Xa-C-}/_ssgManifest.js +0 -0
package/dist/worker.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __returnValue = (v) => v;
|
|
5
4
|
function __exportSetter(name, newValue) {
|
|
@@ -14,8 +13,17 @@ var __export = (target, all) => {
|
|
|
14
13
|
set: __exportSetter.bind(all, name)
|
|
15
14
|
});
|
|
16
15
|
};
|
|
17
|
-
var __esm = (fn, res) => () =>
|
|
18
|
-
|
|
16
|
+
var __esm = (fn, res, err) => () => {
|
|
17
|
+
if (fn)
|
|
18
|
+
try {
|
|
19
|
+
res = fn(fn = 0);
|
|
20
|
+
} catch (e) {
|
|
21
|
+
err = [e];
|
|
22
|
+
}
|
|
23
|
+
if (err)
|
|
24
|
+
throw err[0];
|
|
25
|
+
return res;
|
|
26
|
+
};
|
|
19
27
|
|
|
20
28
|
// src/hooks/types.ts
|
|
21
29
|
var CODEX_EVENT_MAP, CODEX_TOOL_MAP, HERMES_TOOL_MAP, HERMES_TOOL_INPUT_MAP, HERMES_EVENT_MAP, COPILOT_TOOL_MAP, COPILOT_TOOL_INPUT_MAP, CURSOR_EVENT_MAP, CURSOR_TOOL_MAP, OPENCODE_TOOL_MAP, OPENCODE_TOOL_INPUT_MAP, PI_EVENT_MAP, PI_TOOL_MAP, PI_TOOL_INPUT_MAP, OPENCLAW_EVENT_MAP, OPENCLAW_TOOL_MAP, OPENCLAW_TOOL_INPUT_MAP, FACTORY_TOOL_MAP, DEVIN_TOOL_MAP, ANTIGRAVITY_EVENT_MAP, ANTIGRAVITY_TOOL_MAP, ANTIGRAVITY_TOOL_INPUT_MAP, GOOSE_TOOL_MAP, GOOSE_TOOL_INPUT_MAP, HOOK_EVENT_TYPES, CLAUDE_INSTALL_EVENT_TYPES;
|
|
@@ -370,7 +378,7 @@ function failproofaiHome(home) {
|
|
|
370
378
|
return resolve(home, ".failproofai");
|
|
371
379
|
return process.env.FAILPROOFAI_HOME || resolve(homedir(), ".failproofai");
|
|
372
380
|
}
|
|
373
|
-
var LAYOUT_VERSION = 4, at = (...parts) => resolve(failproofaiHome(), ...parts), atHome = (home, ...parts) => home ? resolve(failproofaiHome(home), ...parts) : at(...parts), versionFile = (home) => atHome(home, "VERSION"), configFile = (home) => atHome(home, "config.json"), policiesDir = (home) => atHome(home, "policies"), customPoliciesDir, globalPolicyConfigFile = (home) => atHome(home, "policies-config.json"), cloudPoliciesDir = (home) => resolve(policiesDir(home), "cloud-policies"), packsDir = (home) => resolve(policiesDir(home), "packs"), packsInstalledFile = (home) => resolve(packsDir(home), "installed.json"), hookActivityDir = (home) => atHome(home, "hook-activity"), stateDir = (home) => atHome(home, "state"), shimsDir = (home) => resolve(stateDir(home), "shims"), sessionPauseDir = () => resolve(stateDir(), "sessions"), telemetryIdFile = (home) => resolve(stateDir(home), "telemetry-id"), codexSessionPathsFile = (home) => resolve(stateDir(home), "codex-session-paths.json"), logsDir = (home) => atHome(home, "logs"), legacy;
|
|
381
|
+
var LAYOUT_VERSION = 4, at = (...parts) => resolve(failproofaiHome(), ...parts), atHome = (home, ...parts) => home ? resolve(failproofaiHome(home), ...parts) : at(...parts), versionFile = (home) => atHome(home, "VERSION"), configFile = (home) => atHome(home, "config.json"), policiesDir = (home) => atHome(home, "policies"), customPoliciesDir, globalPolicyConfigFile = (home) => atHome(home, "policies-config.json"), cloudPoliciesDir = (home) => resolve(policiesDir(home), "cloud-policies"), packsDir = (home) => resolve(policiesDir(home), "packs"), packsInstalledFile = (home) => resolve(packsDir(home), "installed.json"), auditDir = (home) => atHome(home, "audit"), auditLeaksFile = (home) => resolve(auditDir(home), "leaks.json"), auditLeakIdentityFile = (home) => resolve(auditDir(home), "leak-identity.json"), hookActivityDir = (home) => atHome(home, "hook-activity"), stateDir = (home) => atHome(home, "state"), shimsDir = (home) => resolve(stateDir(home), "shims"), sessionPauseDir = () => resolve(stateDir(), "sessions"), telemetryIdFile = (home) => resolve(stateDir(home), "telemetry-id"), codexSessionPathsFile = (home) => resolve(stateDir(home), "codex-session-paths.json"), logsDir = (home) => atHome(home, "logs"), legacy;
|
|
374
382
|
var init_fp_home = __esm(() => {
|
|
375
383
|
customPoliciesDir = policiesDir;
|
|
376
384
|
legacy = {
|
|
@@ -1155,8 +1163,8 @@ import { statSync as statSync3 } from "node:fs";
|
|
|
1155
1163
|
import { readFile, writeFile } from "node:fs/promises";
|
|
1156
1164
|
import { execSync, execFileSync } from "node:child_process";
|
|
1157
1165
|
import { homedir as homedir3 } from "node:os";
|
|
1158
|
-
function isAgentInternalPath(
|
|
1159
|
-
const normResolved =
|
|
1166
|
+
function isAgentInternalPath(resolved) {
|
|
1167
|
+
const normResolved = resolved.replaceAll("\\", "/");
|
|
1160
1168
|
for (const dir of [".claude", ".codex", ".copilot", ".cursor", ".opencode", ".pi", ".gemini"]) {
|
|
1161
1169
|
const root = join2(homedir3(), dir).replaceAll("\\", "/");
|
|
1162
1170
|
if (normResolved === root || normResolved.startsWith(root + "/"))
|
|
@@ -1169,34 +1177,34 @@ function isAgentInternalPath(resolved2) {
|
|
|
1169
1177
|
}
|
|
1170
1178
|
return false;
|
|
1171
1179
|
}
|
|
1172
|
-
function isAgentSettingsFile(
|
|
1173
|
-
if (/[\\/]\.claude[\\/]settings(?:\.[^/\\]+)?\.json$/.test(
|
|
1180
|
+
function isAgentSettingsFile(resolved) {
|
|
1181
|
+
if (/[\\/]\.claude[\\/]settings(?:\.[^/\\]+)?\.json$/.test(resolved))
|
|
1174
1182
|
return true;
|
|
1175
|
-
if (/[\\/]\.codex[\\/]hooks\.json$/.test(
|
|
1183
|
+
if (/[\\/]\.codex[\\/]hooks\.json$/.test(resolved))
|
|
1176
1184
|
return true;
|
|
1177
|
-
if (/[\\/]\.copilot[\\/]hooks[\\/][^/\\]+\.json$/.test(
|
|
1185
|
+
if (/[\\/]\.copilot[\\/]hooks[\\/][^/\\]+\.json$/.test(resolved))
|
|
1178
1186
|
return true;
|
|
1179
|
-
if (/[\\/]\.github[\\/]hooks[\\/][^/\\]+\.json$/.test(
|
|
1187
|
+
if (/[\\/]\.github[\\/]hooks[\\/][^/\\]+\.json$/.test(resolved))
|
|
1180
1188
|
return true;
|
|
1181
|
-
if (/[\\/]\.cursor[\\/]hooks\.json$/.test(
|
|
1189
|
+
if (/[\\/]\.cursor[\\/]hooks\.json$/.test(resolved))
|
|
1182
1190
|
return true;
|
|
1183
|
-
if (/[\\/]\.opencode[\\/]opencode\.jsonc?$/.test(
|
|
1191
|
+
if (/[\\/]\.opencode[\\/]opencode\.jsonc?$/.test(resolved))
|
|
1184
1192
|
return true;
|
|
1185
|
-
if (/[\\/]\.opencode[\\/]plugins[\\/][^/\\]+\.(?:mjs|js|ts)$/.test(
|
|
1193
|
+
if (/[\\/]\.opencode[\\/]plugins[\\/][^/\\]+\.(?:mjs|js|ts)$/.test(resolved))
|
|
1186
1194
|
return true;
|
|
1187
|
-
if (/[\\/]\.config[\\/]opencode[\\/]opencode\.jsonc?$/.test(
|
|
1195
|
+
if (/[\\/]\.config[\\/]opencode[\\/]opencode\.jsonc?$/.test(resolved))
|
|
1188
1196
|
return true;
|
|
1189
|
-
if (/[\\/]\.config[\\/]opencode[\\/]config\.json$/.test(
|
|
1197
|
+
if (/[\\/]\.config[\\/]opencode[\\/]config\.json$/.test(resolved))
|
|
1190
1198
|
return true;
|
|
1191
|
-
if (/[\\/]\.config[\\/]opencode[\\/]plugins[\\/][^/\\]+\.(?:mjs|js|ts)$/.test(
|
|
1199
|
+
if (/[\\/]\.config[\\/]opencode[\\/]plugins[\\/][^/\\]+\.(?:mjs|js|ts)$/.test(resolved))
|
|
1192
1200
|
return true;
|
|
1193
|
-
if (/[\\/]\.pi[\\/](?:agent[\\/])?settings\.json$/.test(
|
|
1201
|
+
if (/[\\/]\.pi[\\/](?:agent[\\/])?settings\.json$/.test(resolved))
|
|
1194
1202
|
return true;
|
|
1195
|
-
if (/[\\/]\.pi[\\/](?:agent[\\/])?extensions[\\/]/.test(
|
|
1203
|
+
if (/[\\/]\.pi[\\/](?:agent[\\/])?extensions[\\/]/.test(resolved))
|
|
1196
1204
|
return true;
|
|
1197
|
-
if (/[\\/]\.gemini[\\/]settings\.json$/.test(
|
|
1205
|
+
if (/[\\/]\.gemini[\\/]settings\.json$/.test(resolved))
|
|
1198
1206
|
return true;
|
|
1199
|
-
if (/[\\/]\.gemini[\\/]config[\\/]hooks\.json$/.test(
|
|
1207
|
+
if (/[\\/]\.gemini[\\/]config[\\/]hooks\.json$/.test(resolved))
|
|
1200
1208
|
return true;
|
|
1201
1209
|
return false;
|
|
1202
1210
|
}
|
|
@@ -2246,20 +2254,20 @@ function blockReadOutsideCwd(ctx) {
|
|
|
2246
2254
|
if (!READ_LIKE_CMDS.test(cmd))
|
|
2247
2255
|
return allow();
|
|
2248
2256
|
const paths = extractAbsolutePaths(cmd);
|
|
2249
|
-
const
|
|
2257
|
+
const cwdWithSep = cwd.endsWith("/") ? cwd : cwd + "/";
|
|
2250
2258
|
for (const p of paths) {
|
|
2251
|
-
const
|
|
2252
|
-
if (isClaudeSettingsFile(
|
|
2253
|
-
return deny(`Reading agent settings file blocked: ${
|
|
2259
|
+
const resolved = resolve3(cwd, p);
|
|
2260
|
+
if (isClaudeSettingsFile(resolved)) {
|
|
2261
|
+
return deny(`Reading agent settings file blocked: ${resolved}`);
|
|
2254
2262
|
}
|
|
2255
|
-
if (isClaudeInternalPath(
|
|
2263
|
+
if (isClaudeInternalPath(resolved))
|
|
2256
2264
|
continue;
|
|
2257
|
-
if (
|
|
2265
|
+
if (resolved === "/dev/null")
|
|
2258
2266
|
continue;
|
|
2259
|
-
if (
|
|
2260
|
-
if (allowPaths.some((ap) =>
|
|
2267
|
+
if (resolved !== cwd && !resolved.startsWith(cwdWithSep)) {
|
|
2268
|
+
if (allowPaths.some((ap) => resolved === ap || resolved.startsWith(ap.endsWith("/") ? ap : ap + "/")))
|
|
2261
2269
|
continue;
|
|
2262
|
-
return deny(`Bash read outside project directory blocked: ${
|
|
2270
|
+
return deny(`Bash read outside project directory blocked: ${resolved}`);
|
|
2263
2271
|
}
|
|
2264
2272
|
}
|
|
2265
2273
|
return allow();
|
|
@@ -2269,19 +2277,19 @@ function blockReadOutsideCwd(ctx) {
|
|
|
2269
2277
|
const target = filePath || searchPath;
|
|
2270
2278
|
if (!target)
|
|
2271
2279
|
return allow();
|
|
2272
|
-
const
|
|
2273
|
-
if (isClaudeSettingsFile(
|
|
2274
|
-
return deny(`Reading agent settings file blocked: ${
|
|
2280
|
+
const resolved = resolve3(cwd, target);
|
|
2281
|
+
if (isClaudeSettingsFile(resolved)) {
|
|
2282
|
+
return deny(`Reading agent settings file blocked: ${resolved}`);
|
|
2275
2283
|
}
|
|
2276
|
-
if (isClaudeInternalPath(
|
|
2284
|
+
if (isClaudeInternalPath(resolved))
|
|
2277
2285
|
return allow();
|
|
2278
|
-
if (
|
|
2286
|
+
if (resolved === "/dev/null")
|
|
2279
2287
|
return allow();
|
|
2280
2288
|
const cwdWithSep = cwd.endsWith("/") ? cwd : cwd + "/";
|
|
2281
|
-
if (
|
|
2282
|
-
if (allowPaths.some((ap) =>
|
|
2289
|
+
if (resolved !== cwd && !resolved.startsWith(cwdWithSep)) {
|
|
2290
|
+
if (allowPaths.some((ap) => resolved === ap || resolved.startsWith(ap.endsWith("/") ? ap : ap + "/")))
|
|
2283
2291
|
return allow();
|
|
2284
|
-
return deny(`Access outside project directory blocked: ${
|
|
2292
|
+
return deny(`Access outside project directory blocked: ${resolved}`);
|
|
2285
2293
|
}
|
|
2286
2294
|
return allow();
|
|
2287
2295
|
}
|
|
@@ -2797,15 +2805,39 @@ var init_builtin_policies = __esm(() => {
|
|
|
2797
2805
|
SHELL_METACHAR_RE = /[;&<>`$()\\]/;
|
|
2798
2806
|
JWT_RE = /eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/;
|
|
2799
2807
|
API_KEY_PATTERNS = [
|
|
2808
|
+
[/sk-ant-api03-[A-Za-z0-9\-_]{20,}/, "Anthropic API key"],
|
|
2809
|
+
[/sk-ant-oat01-[A-Za-z0-9\-_]{20,}/, "Anthropic OAuth token"],
|
|
2800
2810
|
[/sk-ant-[A-Za-z0-9\-_]{20,}/, "Anthropic API key"],
|
|
2801
2811
|
[/sk-proj-[A-Za-z0-9\-_]{20,}/, "OpenAI project API key"],
|
|
2802
|
-
[/sk-[A-Za-z0-9]{20,}/, "OpenAI
|
|
2803
|
-
[/
|
|
2812
|
+
[/sk-svcacct-[A-Za-z0-9\-_]{20,}/, "OpenAI service-account key"],
|
|
2813
|
+
[/sk-admin-[A-Za-z0-9\-_]{20,}/, "OpenAI admin key"],
|
|
2814
|
+
[/sk-or-v1-[A-Za-z0-9\-_]{20,}/, "OpenRouter API key"],
|
|
2815
|
+
[/sk-[A-Za-z0-9]{20,}/, "OpenAI-compatible key (issuer unknown)"],
|
|
2804
2816
|
[/github_pat_[A-Za-z0-9_]{82}/, "GitHub fine-grained token"],
|
|
2817
|
+
[/ghp_[A-Za-z0-9]{36}/, "GitHub personal access token"],
|
|
2818
|
+
[/gho_[A-Za-z0-9]{36}/, "GitHub OAuth token"],
|
|
2819
|
+
[/ghu_[A-Za-z0-9]{36}/, "GitHub user-to-server token"],
|
|
2820
|
+
[/ghs_[A-Za-z0-9]{36}/, "GitHub server-to-server token"],
|
|
2821
|
+
[/ghr_[A-Za-z0-9]{36}/, "GitHub refresh token"],
|
|
2822
|
+
[/glpat-[A-Za-z0-9\-_]{20,}/, "GitLab personal access token"],
|
|
2805
2823
|
[/AKIA[A-Z0-9]{16}/, "AWS access key ID"],
|
|
2824
|
+
[/ASIA[A-Z0-9]{16}/, "AWS temporary access key ID"],
|
|
2806
2825
|
[/sk_live_[A-Za-z0-9]{24,}/, "Stripe live secret key"],
|
|
2807
2826
|
[/sk_test_[A-Za-z0-9]{24,}/, "Stripe test secret key"],
|
|
2808
|
-
[/
|
|
2827
|
+
[/rk_live_[A-Za-z0-9]{24,}/, "Stripe restricted key"],
|
|
2828
|
+
[/AIza[0-9A-Za-z\-_]{35}/, "Google API key"],
|
|
2829
|
+
[/\d{8,10}:[A-Za-z0-9_-]{35}/, "Telegram bot token"],
|
|
2830
|
+
[/xox[baprs]-[A-Za-z0-9-]{10,}/, "Slack token"],
|
|
2831
|
+
[/xapp-[0-9]-[A-Za-z0-9-]{10,}/, "Slack app-level token"],
|
|
2832
|
+
[/hf_[A-Za-z0-9]{30,}/, "Hugging Face token"],
|
|
2833
|
+
[/gsk_[A-Za-z0-9]{40,}/, "Groq API key"],
|
|
2834
|
+
[/r8_[A-Za-z0-9]{30,}/, "Replicate token"],
|
|
2835
|
+
[/xai-[A-Za-z0-9]{40,}/, "xAI API key"],
|
|
2836
|
+
[/npm_[A-Za-z0-9]{36}/, "npm access token"],
|
|
2837
|
+
[/dop_v1_[a-f0-9]{64}/, "DigitalOcean token"],
|
|
2838
|
+
[/shpat_[a-fA-F0-9]{32}/, "Shopify access token"],
|
|
2839
|
+
[/sb_secret_[A-Za-z0-9\-_]{20,}/, "Supabase secret key"],
|
|
2840
|
+
[/sbp_[a-f0-9]{40}/, "Supabase personal token"]
|
|
2809
2841
|
];
|
|
2810
2842
|
CONNECTION_STRING_RE = /(?:postgresql|postgres|mysql|mongodb(?:\+srv)?|redis|amqps?|smtps?):\/\/[^@\s]+@/;
|
|
2811
2843
|
PRIVATE_KEY_RE = /-----BEGIN (?:[A-Z]+ )?PRIVATE KEY-----/;
|
|
@@ -3302,10 +3334,10 @@ function parsePackPolicy(packId, value, index) {
|
|
|
3302
3334
|
}
|
|
3303
3335
|
const matchShape = raw.match;
|
|
3304
3336
|
for (const key of ["events", "toolNames"]) {
|
|
3305
|
-
const
|
|
3306
|
-
if (
|
|
3337
|
+
const value = matchShape[key];
|
|
3338
|
+
if (value === undefined)
|
|
3307
3339
|
continue;
|
|
3308
|
-
if (!Array.isArray(
|
|
3340
|
+
if (!Array.isArray(value) || value.some((e) => typeof e !== "string" || e.length === 0)) {
|
|
3309
3341
|
throw new Error(`${where} has a match.${key} that is not a list of names`);
|
|
3310
3342
|
}
|
|
3311
3343
|
}
|
|
@@ -3467,15 +3499,15 @@ function parsePackPolicyName(canonicalName) {
|
|
|
3467
3499
|
if (slash <= 0)
|
|
3468
3500
|
return null;
|
|
3469
3501
|
const idWithVersion = rest.slice(0, slash);
|
|
3470
|
-
const
|
|
3502
|
+
const at = idWithVersion.lastIndexOf("@");
|
|
3471
3503
|
return {
|
|
3472
|
-
packId:
|
|
3504
|
+
packId: at > 0 ? idWithVersion.slice(0, at) : idWithVersion,
|
|
3473
3505
|
name: rest.slice(slash + 1)
|
|
3474
3506
|
};
|
|
3475
3507
|
}
|
|
3476
3508
|
|
|
3477
3509
|
// package.json
|
|
3478
|
-
var version = "1.0.
|
|
3510
|
+
var version = "1.0.4-beta.2";
|
|
3479
3511
|
var init_package = () => {};
|
|
3480
3512
|
|
|
3481
3513
|
// src/posthog-key.ts
|
|
@@ -3579,7 +3611,8 @@ function projectConfig(parsed) {
|
|
|
3579
3611
|
const daemon = parsed.daemon ?? {};
|
|
3580
3612
|
const collector = parsed.collector ?? {};
|
|
3581
3613
|
const telemetry = parsed.telemetry ?? {};
|
|
3582
|
-
const
|
|
3614
|
+
const auditPresent = !!parsed.audit && typeof parsed.audit === "object" && !Array.isArray(parsed.audit);
|
|
3615
|
+
const audit = auditPresent ? parsed.audit : {};
|
|
3583
3616
|
return {
|
|
3584
3617
|
mode: mode === "cloud" ? "cloud" : "oss",
|
|
3585
3618
|
daemon: { configured: daemon.configured === true },
|
|
@@ -3594,7 +3627,8 @@ function projectConfig(parsed) {
|
|
|
3594
3627
|
},
|
|
3595
3628
|
telemetry: { enabled: telemetry.enabled !== false },
|
|
3596
3629
|
audit: {
|
|
3597
|
-
auto: audit.auto
|
|
3630
|
+
auto: auditPresent && audit.auto !== false,
|
|
3631
|
+
notify: audit.notify !== false,
|
|
3598
3632
|
intervalDays: readIntervalDays(audit.interval_days),
|
|
3599
3633
|
reportsConsentedAt: typeof audit.reports_consented_at === "number" && Number.isFinite(audit.reports_consented_at) ? audit.reports_consented_at : undefined
|
|
3600
3634
|
}
|
|
@@ -3616,7 +3650,7 @@ var init_fp_config = __esm(() => {
|
|
|
3616
3650
|
environment: "local"
|
|
3617
3651
|
},
|
|
3618
3652
|
telemetry: { enabled: true },
|
|
3619
|
-
audit: { auto: false, intervalDays: DEFAULT_AUDIT_INTERVAL_DAYS }
|
|
3653
|
+
audit: { auto: false, notify: true, intervalDays: DEFAULT_AUDIT_INTERVAL_DAYS }
|
|
3620
3654
|
};
|
|
3621
3655
|
});
|
|
3622
3656
|
|
|
@@ -4192,12 +4226,12 @@ You MUST complete the above action NOW. Do NOT ask the user for confirmation —
|
|
|
4192
4226
|
const policyNames = instructEntries.map((e) => e.policyName);
|
|
4193
4227
|
if (session?.cli === "cursor") {
|
|
4194
4228
|
if (eventType === "Stop" || eventType === "SubagentStop") {
|
|
4195
|
-
const
|
|
4229
|
+
const response = {
|
|
4196
4230
|
followup_message: `Instruction from failproofai: ${combined}`
|
|
4197
4231
|
};
|
|
4198
4232
|
return {
|
|
4199
4233
|
exitCode: 0,
|
|
4200
|
-
stdout: JSON.stringify(
|
|
4234
|
+
stdout: JSON.stringify(response),
|
|
4201
4235
|
stderr: "",
|
|
4202
4236
|
policyName: policyNames[0],
|
|
4203
4237
|
policyNames,
|
|
@@ -4205,13 +4239,13 @@ You MUST complete the above action NOW. Do NOT ask the user for confirmation —
|
|
|
4205
4239
|
decision: "instruct"
|
|
4206
4240
|
};
|
|
4207
4241
|
}
|
|
4208
|
-
const
|
|
4242
|
+
const response = {
|
|
4209
4243
|
permission: "allow",
|
|
4210
4244
|
additional_context: `Instruction from failproofai: ${combined}`
|
|
4211
4245
|
};
|
|
4212
4246
|
return {
|
|
4213
4247
|
exitCode: 0,
|
|
4214
|
-
stdout: JSON.stringify(
|
|
4248
|
+
stdout: JSON.stringify(response),
|
|
4215
4249
|
stderr: "",
|
|
4216
4250
|
policyName: policyNames[0],
|
|
4217
4251
|
policyNames,
|
|
@@ -4235,13 +4269,13 @@ You MUST complete the above action(s) NOW. Do NOT ask the user for confirmation
|
|
|
4235
4269
|
decision: "instruct"
|
|
4236
4270
|
};
|
|
4237
4271
|
}
|
|
4238
|
-
const
|
|
4272
|
+
const response = {
|
|
4239
4273
|
permission: "allow",
|
|
4240
4274
|
reason: `Instruction from failproofai: ${combined}`
|
|
4241
4275
|
};
|
|
4242
4276
|
return {
|
|
4243
4277
|
exitCode: 0,
|
|
4244
|
-
stdout: JSON.stringify(
|
|
4278
|
+
stdout: JSON.stringify(response),
|
|
4245
4279
|
stderr: "",
|
|
4246
4280
|
policyName: policyNames[0],
|
|
4247
4281
|
policyNames,
|
|
@@ -4466,12 +4500,12 @@ You MUST complete the above action(s) NOW. Do NOT ask the user for confirmation
|
|
|
4466
4500
|
permission: "allow",
|
|
4467
4501
|
additional_context: `Note from failproofai: ${combined}`
|
|
4468
4502
|
};
|
|
4469
|
-
const
|
|
4503
|
+
const stderrMsg = allowEntries.map((e) => `[failproofai] ${e.policyName}: ${e.reason}`).join(`
|
|
4470
4504
|
`);
|
|
4471
4505
|
return {
|
|
4472
4506
|
exitCode: 0,
|
|
4473
4507
|
stdout: JSON.stringify(response),
|
|
4474
|
-
stderr:
|
|
4508
|
+
stderr: stderrMsg + `
|
|
4475
4509
|
`,
|
|
4476
4510
|
policyName: policyNames[0],
|
|
4477
4511
|
policyNames,
|
|
@@ -4484,12 +4518,12 @@ You MUST complete the above action(s) NOW. Do NOT ask the user for confirmation
|
|
|
4484
4518
|
permission: "allow",
|
|
4485
4519
|
reason: `Note from failproofai: ${combined}`
|
|
4486
4520
|
};
|
|
4487
|
-
const
|
|
4521
|
+
const stderrMsg = allowEntries.map((e) => `[failproofai] ${e.policyName}: ${e.reason}`).join(`
|
|
4488
4522
|
`);
|
|
4489
4523
|
return {
|
|
4490
4524
|
exitCode: 0,
|
|
4491
4525
|
stdout: JSON.stringify(response),
|
|
4492
|
-
stderr:
|
|
4526
|
+
stderr: stderrMsg + `
|
|
4493
4527
|
`,
|
|
4494
4528
|
policyName: policyNames[0],
|
|
4495
4529
|
policyNames,
|
|
@@ -4498,7 +4532,7 @@ You MUST complete the above action(s) NOW. Do NOT ask the user for confirmation
|
|
|
4498
4532
|
};
|
|
4499
4533
|
}
|
|
4500
4534
|
if (session?.cli === "openclaw") {
|
|
4501
|
-
const
|
|
4535
|
+
const stderrMsg = allowEntries.map((e) => `[failproofai] ${e.policyName}: ${e.reason}`).join(`
|
|
4502
4536
|
`);
|
|
4503
4537
|
return {
|
|
4504
4538
|
exitCode: 0,
|
|
@@ -4506,7 +4540,7 @@ You MUST complete the above action(s) NOW. Do NOT ask the user for confirmation
|
|
|
4506
4540
|
permission: "allow",
|
|
4507
4541
|
reason: `Note from failproofai: ${combined}`
|
|
4508
4542
|
}),
|
|
4509
|
-
stderr:
|
|
4543
|
+
stderr: stderrMsg + `
|
|
4510
4544
|
`,
|
|
4511
4545
|
policyName: policyNames[0],
|
|
4512
4546
|
policyNames,
|
|
@@ -4573,21 +4607,21 @@ async function sweepStaleTmpArtifacts(dir, now = Date.now()) {
|
|
|
4573
4607
|
for (const name of await readdir(dir)) {
|
|
4574
4608
|
if (!isTmpArtifact(name))
|
|
4575
4609
|
continue;
|
|
4576
|
-
const
|
|
4610
|
+
const path = resolve6(dir, name);
|
|
4577
4611
|
try {
|
|
4578
|
-
const info = await stat(
|
|
4612
|
+
const info = await stat(path);
|
|
4579
4613
|
if (now - info.mtimeMs < TMP_SWEEP_MIN_AGE_MS)
|
|
4580
4614
|
continue;
|
|
4581
|
-
await unlink(
|
|
4615
|
+
await unlink(path);
|
|
4582
4616
|
removed++;
|
|
4583
4617
|
} catch {}
|
|
4584
4618
|
}
|
|
4585
4619
|
} catch {}
|
|
4586
4620
|
return removed;
|
|
4587
4621
|
}
|
|
4588
|
-
async function fileExists(
|
|
4622
|
+
async function fileExists(path) {
|
|
4589
4623
|
try {
|
|
4590
|
-
await access(
|
|
4624
|
+
await access(path);
|
|
4591
4625
|
return true;
|
|
4592
4626
|
} catch {
|
|
4593
4627
|
return false;
|
|
@@ -4650,8 +4684,8 @@ async function createEsmShim(_distIndex, distUrl, tmpSuffix = TMP_SUFFIX) {
|
|
|
4650
4684
|
if (!st.isDirectory() || st.isSymbolicLink() || uid !== null && st.uid !== uid || st.mode & 63) {
|
|
4651
4685
|
throw new Error(`${dir} is not a private directory owned by this user`);
|
|
4652
4686
|
}
|
|
4653
|
-
const
|
|
4654
|
-
return { shimPath
|
|
4687
|
+
const shimPath = await writeShim(dir, name, shimCode, false);
|
|
4688
|
+
return { shimPath, shimUrl: pathToFileURL(shimPath).href };
|
|
4655
4689
|
} catch (err) {
|
|
4656
4690
|
hookLogWarn(`policy shim directory unusable (${err instanceof Error ? err.message : String(err)}); falling back to ${tmpdir()}`);
|
|
4657
4691
|
}
|
|
@@ -4699,13 +4733,13 @@ async function rewriteFileTree(entryPath, distUrl, distIndex, tmpSuffix = TMP_SU
|
|
|
4699
4733
|
const specifier = match[2];
|
|
4700
4734
|
if (rewrites.has(specifier))
|
|
4701
4735
|
continue;
|
|
4702
|
-
const
|
|
4703
|
-
if (!
|
|
4736
|
+
const resolved = await resolveLocalImport(dir, specifier);
|
|
4737
|
+
if (!resolved)
|
|
4704
4738
|
continue;
|
|
4705
|
-
if (!visited.has(
|
|
4706
|
-
queue.push(
|
|
4739
|
+
if (!visited.has(resolved) && !queue.includes(resolved)) {
|
|
4740
|
+
queue.push(resolved);
|
|
4707
4741
|
}
|
|
4708
|
-
let relPath = relative2(dir,
|
|
4742
|
+
let relPath = relative2(dir, resolved + tmpSuffix).split("\\").join("/");
|
|
4709
4743
|
if (!relPath.startsWith("."))
|
|
4710
4744
|
relPath = "./" + relPath;
|
|
4711
4745
|
rewrites.set(specifier, relPath);
|
|
@@ -5021,8 +5055,8 @@ async function loadAllCustomHooks(customPoliciesPaths, opts) {
|
|
|
5021
5055
|
}
|
|
5022
5056
|
}
|
|
5023
5057
|
const packAliases = new Map;
|
|
5024
|
-
for (const [
|
|
5025
|
-
const winner = packByPath.get(
|
|
5058
|
+
for (const [path, ids] of packIdsByPath) {
|
|
5059
|
+
const winner = packByPath.get(path);
|
|
5026
5060
|
if (winner && ids.length > 1)
|
|
5027
5061
|
packAliases.set(winner.id, ids);
|
|
5028
5062
|
}
|
|
@@ -5177,6 +5211,234 @@ var init_delivery_health = __esm(() => {
|
|
|
5177
5211
|
CREDENTIAL_STATUSES = new Set([401, 403]);
|
|
5178
5212
|
});
|
|
5179
5213
|
|
|
5214
|
+
// src/hooks/notice.ts
|
|
5215
|
+
function shapeNotice(cli, notice, existingStdout = "") {
|
|
5216
|
+
const empty = { stdout: existingStdout, stderr: "" };
|
|
5217
|
+
if (!notice.trim() || !cli)
|
|
5218
|
+
return empty;
|
|
5219
|
+
const channel = NOTICE_CHANNEL[cli] ?? "none";
|
|
5220
|
+
const text = notice.length > MAX_NOTICE_CHARS ? notice.slice(0, MAX_NOTICE_CHARS - 1) + "…" : notice;
|
|
5221
|
+
switch (channel) {
|
|
5222
|
+
case "systemMessage": {
|
|
5223
|
+
if (existingStdout.trim().startsWith("{")) {
|
|
5224
|
+
try {
|
|
5225
|
+
const parsed = JSON.parse(existingStdout);
|
|
5226
|
+
parsed.systemMessage = text;
|
|
5227
|
+
return { stdout: JSON.stringify(parsed), stderr: "" };
|
|
5228
|
+
} catch {
|
|
5229
|
+
return empty;
|
|
5230
|
+
}
|
|
5231
|
+
}
|
|
5232
|
+
if (existingStdout.trim())
|
|
5233
|
+
return empty;
|
|
5234
|
+
return { stdout: JSON.stringify({ systemMessage: text }), stderr: "" };
|
|
5235
|
+
}
|
|
5236
|
+
case "stderr":
|
|
5237
|
+
return { stdout: existingStdout, stderr: text + `
|
|
5238
|
+
` };
|
|
5239
|
+
case "stdout":
|
|
5240
|
+
if (existingStdout.trim())
|
|
5241
|
+
return empty;
|
|
5242
|
+
return { stdout: text + `
|
|
5243
|
+
`, stderr: "" };
|
|
5244
|
+
default:
|
|
5245
|
+
return empty;
|
|
5246
|
+
}
|
|
5247
|
+
}
|
|
5248
|
+
function canDeliverNotice(cli) {
|
|
5249
|
+
return !!cli && (NOTICE_CHANNEL[cli] ?? "none") !== "none";
|
|
5250
|
+
}
|
|
5251
|
+
function leakNoticeText(newFindings) {
|
|
5252
|
+
const n = newFindings === 1 ? "a credential" : `${newFindings} credentials`;
|
|
5253
|
+
return `failproofai found ${n} in this project's agent transcripts.
|
|
5254
|
+
` + "Run `failproofai audit` to see the details, " + "or `failproofai audit --schedule` to get these by email.";
|
|
5255
|
+
}
|
|
5256
|
+
var NOTICE_CHANNEL, MAX_NOTICE_CHARS = 900;
|
|
5257
|
+
var init_notice = __esm(() => {
|
|
5258
|
+
NOTICE_CHANNEL = {
|
|
5259
|
+
claude: "systemMessage",
|
|
5260
|
+
codex: "systemMessage",
|
|
5261
|
+
copilot: "stderr",
|
|
5262
|
+
factory: "stdout"
|
|
5263
|
+
};
|
|
5264
|
+
});
|
|
5265
|
+
|
|
5266
|
+
// lib/atomic-write.ts
|
|
5267
|
+
import {
|
|
5268
|
+
chmodSync as chmodSync2,
|
|
5269
|
+
existsSync as existsSync8,
|
|
5270
|
+
mkdirSync as mkdirSync5,
|
|
5271
|
+
renameSync as renameSync3,
|
|
5272
|
+
rmSync as rmSync2,
|
|
5273
|
+
statSync as statSync6,
|
|
5274
|
+
writeFileSync as writeFileSync4
|
|
5275
|
+
} from "node:fs";
|
|
5276
|
+
import { dirname as dirname3 } from "node:path";
|
|
5277
|
+
import { randomBytes } from "node:crypto";
|
|
5278
|
+
function writeJsonAtomically(filePath, value, opts = {}) {
|
|
5279
|
+
const mode = opts.mode ?? 384;
|
|
5280
|
+
const dirMode = opts.dirMode ?? 448;
|
|
5281
|
+
const dir = dirname3(filePath);
|
|
5282
|
+
if (!existsSync8(dir))
|
|
5283
|
+
mkdirSync5(dir, { recursive: true, mode: dirMode });
|
|
5284
|
+
const tmp = `${filePath}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`;
|
|
5285
|
+
try {
|
|
5286
|
+
writeFileSync4(tmp, JSON.stringify(value, null, 2), { mode });
|
|
5287
|
+
try {
|
|
5288
|
+
if ((statSync6(tmp).mode & 63) !== 0)
|
|
5289
|
+
chmodSync2(tmp, mode);
|
|
5290
|
+
} catch {}
|
|
5291
|
+
renameSync3(tmp, filePath);
|
|
5292
|
+
try {
|
|
5293
|
+
if ((statSync6(filePath).mode & 63) !== 0)
|
|
5294
|
+
chmodSync2(filePath, mode);
|
|
5295
|
+
} catch {}
|
|
5296
|
+
} catch (err) {
|
|
5297
|
+
try {
|
|
5298
|
+
rmSync2(tmp, { force: true });
|
|
5299
|
+
} catch {}
|
|
5300
|
+
throw err;
|
|
5301
|
+
}
|
|
5302
|
+
}
|
|
5303
|
+
var init_atomic_write = () => {};
|
|
5304
|
+
|
|
5305
|
+
// src/audit/leak-record.ts
|
|
5306
|
+
function emptyRecord(salt, nowIso) {
|
|
5307
|
+
return {
|
|
5308
|
+
schemaVersion: LEAK_RECORD_SCHEMA_VERSION,
|
|
5309
|
+
salt,
|
|
5310
|
+
updatedAt: nowIso,
|
|
5311
|
+
findings: []
|
|
5312
|
+
};
|
|
5313
|
+
}
|
|
5314
|
+
var LEAK_RECORD_SCHEMA_VERSION = 1;
|
|
5315
|
+
|
|
5316
|
+
// src/audit/leak-fingerprint.ts
|
|
5317
|
+
function isFindingId(id) {
|
|
5318
|
+
return /^[0-9a-f]{16}$/.test(id);
|
|
5319
|
+
}
|
|
5320
|
+
var init_leak_fingerprint = () => {};
|
|
5321
|
+
|
|
5322
|
+
// src/audit/leak-store.ts
|
|
5323
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
5324
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync6, readFileSync as readFileSync6 } from "node:fs";
|
|
5325
|
+
import { dirname as dirname4 } from "node:path";
|
|
5326
|
+
function readJson(path) {
|
|
5327
|
+
try {
|
|
5328
|
+
if (!existsSync9(path))
|
|
5329
|
+
return null;
|
|
5330
|
+
return JSON.parse(readFileSync6(path, "utf8"));
|
|
5331
|
+
} catch {
|
|
5332
|
+
return null;
|
|
5333
|
+
}
|
|
5334
|
+
}
|
|
5335
|
+
function readLeakIdentity(home) {
|
|
5336
|
+
const existing = readJson(auditLeakIdentityFile(home));
|
|
5337
|
+
if (existing && typeof existing.salt === "string" && existing.salt.length >= 32) {
|
|
5338
|
+
return { salt: existing.salt, dismissed: existing.dismissed ?? [] };
|
|
5339
|
+
}
|
|
5340
|
+
const minted = { salt: randomBytes2(32).toString("hex"), dismissed: [] };
|
|
5341
|
+
writeLeakIdentity(minted, home);
|
|
5342
|
+
return minted;
|
|
5343
|
+
}
|
|
5344
|
+
function writeLeakIdentity(identity, home) {
|
|
5345
|
+
const path = auditLeakIdentityFile(home);
|
|
5346
|
+
try {
|
|
5347
|
+
mkdirSync6(dirname4(path), { recursive: true });
|
|
5348
|
+
writeJsonAtomically(path, identity, { mode: FILE_MODE });
|
|
5349
|
+
return true;
|
|
5350
|
+
} catch {
|
|
5351
|
+
return false;
|
|
5352
|
+
}
|
|
5353
|
+
}
|
|
5354
|
+
function sanitizeFinding(raw) {
|
|
5355
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
5356
|
+
return null;
|
|
5357
|
+
const f = raw;
|
|
5358
|
+
if (typeof f.id !== "string" || !isFindingId(f.id))
|
|
5359
|
+
return null;
|
|
5360
|
+
const fp = f.fingerprint;
|
|
5361
|
+
if (!fp || typeof fp !== "object" || typeof fp.display !== "string" || typeof fp.label !== "string") {
|
|
5362
|
+
return null;
|
|
5363
|
+
}
|
|
5364
|
+
const sightings = Array.isArray(f.sightings) ? f.sightings.filter((s) => {
|
|
5365
|
+
if (!s || typeof s !== "object")
|
|
5366
|
+
return false;
|
|
5367
|
+
const m = s.mechanism;
|
|
5368
|
+
return !!m && typeof m === "object" && typeof m.summary === "string";
|
|
5369
|
+
}) : [];
|
|
5370
|
+
return {
|
|
5371
|
+
...f,
|
|
5372
|
+
fingerprint: {
|
|
5373
|
+
display: fp.display,
|
|
5374
|
+
label: fp.label,
|
|
5375
|
+
length: typeof fp.length === "number" && Number.isFinite(fp.length) ? fp.length : 0,
|
|
5376
|
+
attributed: fp.attributed === true
|
|
5377
|
+
},
|
|
5378
|
+
name: typeof f.name === "string" ? f.name : null,
|
|
5379
|
+
firstSeen: typeof f.firstSeen === "string" ? f.firstSeen : "",
|
|
5380
|
+
lastSeen: typeof f.lastSeen === "string" ? f.lastSeen : "",
|
|
5381
|
+
occurrences: typeof f.occurrences === "number" && Number.isFinite(f.occurrences) ? f.occurrences : sightings.length,
|
|
5382
|
+
sightings
|
|
5383
|
+
};
|
|
5384
|
+
}
|
|
5385
|
+
function readLeakRecord(home) {
|
|
5386
|
+
const identity = readLeakIdentity(home);
|
|
5387
|
+
const raw = readJson(auditLeaksFile(home));
|
|
5388
|
+
if (!raw || raw.schemaVersion !== LEAK_RECORD_SCHEMA_VERSION || !Array.isArray(raw.findings)) {
|
|
5389
|
+
return emptyRecord(identity.salt, new Date().toISOString());
|
|
5390
|
+
}
|
|
5391
|
+
const findings = raw.findings.map(sanitizeFinding).filter((f) => f !== null);
|
|
5392
|
+
return { ...raw, findings, salt: identity.salt };
|
|
5393
|
+
}
|
|
5394
|
+
function activeFindings(record, home) {
|
|
5395
|
+
const dismissed = new Set(readLeakIdentity(home).dismissed);
|
|
5396
|
+
return record.findings.filter((f) => !dismissed.has(f.id)).sort((a, b) => a.lastSeen < b.lastSeen ? 1 : a.lastSeen > b.lastSeen ? -1 : 0);
|
|
5397
|
+
}
|
|
5398
|
+
var FILE_MODE = 384;
|
|
5399
|
+
var init_leak_store = __esm(() => {
|
|
5400
|
+
init_fp_home();
|
|
5401
|
+
init_atomic_write();
|
|
5402
|
+
init_leak_fingerprint();
|
|
5403
|
+
});
|
|
5404
|
+
|
|
5405
|
+
// src/audit/leak-notice.ts
|
|
5406
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync7, readdirSync as readdirSync3, statSync as statSync7, writeFileSync as writeFileSync5, rmSync as rmSync3 } from "node:fs";
|
|
5407
|
+
import { resolve as resolve8 } from "node:path";
|
|
5408
|
+
function pendingLeakNotice(home, channel = "cli") {
|
|
5409
|
+
try {
|
|
5410
|
+
const dir = NOTICE_DIR(home, channel);
|
|
5411
|
+
const claimed = new Set(existsSync10(dir) ? readdirSync3(dir) : []);
|
|
5412
|
+
const ids = activeFindings(readLeakRecord(home), home).map((f) => f.id).filter((id) => !claimed.has(id));
|
|
5413
|
+
return { ids, count: ids.length };
|
|
5414
|
+
} catch {
|
|
5415
|
+
return { ids: [], count: 0 };
|
|
5416
|
+
}
|
|
5417
|
+
}
|
|
5418
|
+
function markLeakNoticeDelivered(ids, home, channel = "cli") {
|
|
5419
|
+
const won = [];
|
|
5420
|
+
try {
|
|
5421
|
+
const dir = NOTICE_DIR(home, channel);
|
|
5422
|
+
mkdirSync7(dir, { recursive: true });
|
|
5423
|
+
for (const id of ids) {
|
|
5424
|
+
if (!isFindingId(id))
|
|
5425
|
+
continue;
|
|
5426
|
+
try {
|
|
5427
|
+
writeFileSync5(resolve8(dir, id), "", { flag: "wx", mode: 384 });
|
|
5428
|
+
won.push(id);
|
|
5429
|
+
} catch {}
|
|
5430
|
+
}
|
|
5431
|
+
} catch {}
|
|
5432
|
+
return won;
|
|
5433
|
+
}
|
|
5434
|
+
var NOTICE_DIR = (home, channel = "cli") => resolve8(auditDir(home), channel === "cli" ? "notified" : `notified-${channel}`), MARKER_TTL_MS;
|
|
5435
|
+
var init_leak_notice = __esm(() => {
|
|
5436
|
+
init_fp_home();
|
|
5437
|
+
init_leak_store();
|
|
5438
|
+
init_leak_fingerprint();
|
|
5439
|
+
MARKER_TTL_MS = 120 * 86400000;
|
|
5440
|
+
});
|
|
5441
|
+
|
|
5180
5442
|
// src/hooks/resolve-cwd.ts
|
|
5181
5443
|
function resolveCwd(integration, parsed) {
|
|
5182
5444
|
const direct = typeof parsed.cwd === "string" && parsed.cwd.length > 0 ? parsed.cwd : undefined;
|
|
@@ -5234,12 +5496,12 @@ function decodeFolderName(name) {
|
|
|
5234
5496
|
}
|
|
5235
5497
|
return name.replace(/-/g, "/");
|
|
5236
5498
|
}
|
|
5237
|
-
function encodeFolderName(
|
|
5238
|
-
const driveMatch = /^([A-Za-z]):[\\/](.*)$/.exec(
|
|
5499
|
+
function encodeFolderName(path) {
|
|
5500
|
+
const driveMatch = /^([A-Za-z]):[\\/](.*)$/.exec(path);
|
|
5239
5501
|
if (driveMatch) {
|
|
5240
5502
|
return driveMatch[1] + "--" + driveMatch[2].replace(/[\\/]/g, "-");
|
|
5241
5503
|
}
|
|
5242
|
-
return
|
|
5504
|
+
return path.replace(/[\\/]/g, "-");
|
|
5243
5505
|
}
|
|
5244
5506
|
function getClaudeProjectsPath() {
|
|
5245
5507
|
const envPath = process.env.CLAUDE_PROJECTS_PATH;
|
|
@@ -5312,12 +5574,7 @@ function formatDate(date) {
|
|
|
5312
5574
|
// lib/codex-projects.ts
|
|
5313
5575
|
var exports_codex_projects = {};
|
|
5314
5576
|
__export(exports_codex_projects, {
|
|
5315
|
-
|
|
5316
|
-
getCachedCodexSessionsByEncodedName: () => getCachedCodexSessionsByEncodedName,
|
|
5317
|
-
getCachedCodexSessionsForCwd: () => getCachedCodexSessionsForCwd,
|
|
5318
|
-
getCodexProjects: () => getCodexProjects,
|
|
5319
|
-
getCodexSessionsByEncodedName: () => getCodexSessionsByEncodedName,
|
|
5320
|
-
getCodexSessionsForCwd: () => getCodexSessionsForCwd
|
|
5577
|
+
getCodexProjects: () => getCodexProjects
|
|
5321
5578
|
});
|
|
5322
5579
|
import { open, readdir } from "node:fs/promises";
|
|
5323
5580
|
import { homedir as homedir5 } from "node:os";
|
|
@@ -5511,12 +5768,7 @@ var init_codex_projects = __esm(() => {
|
|
|
5511
5768
|
// lib/copilot-projects.ts
|
|
5512
5769
|
var exports_copilot_projects = {};
|
|
5513
5770
|
__export(exports_copilot_projects, {
|
|
5514
|
-
|
|
5515
|
-
getCachedCopilotSessionsByEncodedName: () => getCachedCopilotSessionsByEncodedName,
|
|
5516
|
-
getCachedCopilotSessionsForCwd: () => getCachedCopilotSessionsForCwd,
|
|
5517
|
-
getCopilotProjects: () => getCopilotProjects,
|
|
5518
|
-
getCopilotSessionsByEncodedName: () => getCopilotSessionsByEncodedName,
|
|
5519
|
-
getCopilotSessionsForCwd: () => getCopilotSessionsForCwd
|
|
5771
|
+
getCopilotProjects: () => getCopilotProjects
|
|
5520
5772
|
});
|
|
5521
5773
|
import { readdir as readdir2, readFile as readFile4, stat } from "node:fs/promises";
|
|
5522
5774
|
import { homedir as homedir6 } from "node:os";
|
|
@@ -5537,9 +5789,9 @@ function parseCwdFromWorkspace(text) {
|
|
|
5537
5789
|
return;
|
|
5538
5790
|
return m[1].replace(/^['"]|['"]$/g, "");
|
|
5539
5791
|
}
|
|
5540
|
-
async function statMtime(
|
|
5792
|
+
async function statMtime(path) {
|
|
5541
5793
|
try {
|
|
5542
|
-
return (await stat(
|
|
5794
|
+
return (await stat(path)).mtime;
|
|
5543
5795
|
} catch {
|
|
5544
5796
|
return null;
|
|
5545
5797
|
}
|
|
@@ -5659,12 +5911,7 @@ var init_copilot_projects = __esm(() => {
|
|
|
5659
5911
|
// lib/cursor-projects.ts
|
|
5660
5912
|
var exports_cursor_projects = {};
|
|
5661
5913
|
__export(exports_cursor_projects, {
|
|
5662
|
-
|
|
5663
|
-
getCachedCursorSessionsByEncodedName: () => getCachedCursorSessionsByEncodedName,
|
|
5664
|
-
getCachedCursorSessionsForCwd: () => getCachedCursorSessionsForCwd,
|
|
5665
|
-
getCursorProjects: () => getCursorProjects,
|
|
5666
|
-
getCursorSessionsByEncodedName: () => getCursorSessionsByEncodedName,
|
|
5667
|
-
getCursorSessionsForCwd: () => getCursorSessionsForCwd
|
|
5914
|
+
getCursorProjects: () => getCursorProjects
|
|
5668
5915
|
});
|
|
5669
5916
|
import { readdir as readdir3, readFile as readFile5, stat as stat2 } from "node:fs/promises";
|
|
5670
5917
|
import { homedir as homedir7 } from "node:os";
|
|
@@ -5679,9 +5926,9 @@ async function safeReaddir3(dir) {
|
|
|
5679
5926
|
return null;
|
|
5680
5927
|
}
|
|
5681
5928
|
}
|
|
5682
|
-
async function statMtime2(
|
|
5929
|
+
async function statMtime2(path) {
|
|
5683
5930
|
try {
|
|
5684
|
-
return (await stat2(
|
|
5931
|
+
return (await stat2(path)).mtime;
|
|
5685
5932
|
} catch {
|
|
5686
5933
|
return null;
|
|
5687
5934
|
}
|
|
@@ -5702,26 +5949,26 @@ function parseCwdFromMetaText(text) {
|
|
|
5702
5949
|
}
|
|
5703
5950
|
async function findFirstUsableMeta(dir, candidates) {
|
|
5704
5951
|
for (const name of candidates) {
|
|
5705
|
-
const
|
|
5706
|
-
if (await statMtime2(
|
|
5952
|
+
const path = join8(dir, name);
|
|
5953
|
+
if (await statMtime2(path) === null)
|
|
5707
5954
|
continue;
|
|
5708
5955
|
let text;
|
|
5709
5956
|
try {
|
|
5710
|
-
text = await readFile5(
|
|
5957
|
+
text = await readFile5(path, "utf-8");
|
|
5711
5958
|
} catch {
|
|
5712
5959
|
continue;
|
|
5713
5960
|
}
|
|
5714
5961
|
const cwd = parseCwdFromMetaText(text);
|
|
5715
5962
|
if (cwd)
|
|
5716
|
-
return { path
|
|
5963
|
+
return { path, cwd };
|
|
5717
5964
|
}
|
|
5718
5965
|
return null;
|
|
5719
5966
|
}
|
|
5720
5967
|
async function findFirstExistingPath(dir, candidates) {
|
|
5721
5968
|
for (const name of candidates) {
|
|
5722
|
-
const
|
|
5723
|
-
if (await statMtime2(
|
|
5724
|
-
return
|
|
5969
|
+
const path = join8(dir, name);
|
|
5970
|
+
if (await statMtime2(path) !== null)
|
|
5971
|
+
return path;
|
|
5725
5972
|
}
|
|
5726
5973
|
return null;
|
|
5727
5974
|
}
|
|
@@ -5881,7 +6128,7 @@ var init_cursor_projects = __esm(() => {
|
|
|
5881
6128
|
});
|
|
5882
6129
|
|
|
5883
6130
|
// lib/sqlite-reader.ts
|
|
5884
|
-
import { existsSync as
|
|
6131
|
+
import { existsSync as existsSync11, readFileSync as readFileSync7 } from "node:fs";
|
|
5885
6132
|
import initSqlJs from "sql.js/dist/sql-asm.js";
|
|
5886
6133
|
async function tryNodeSqlite(dbPath) {
|
|
5887
6134
|
try {
|
|
@@ -5908,7 +6155,7 @@ function loadSqlJs() {
|
|
|
5908
6155
|
async function trySqlJs(dbPath) {
|
|
5909
6156
|
try {
|
|
5910
6157
|
const SQL = await loadSqlJs();
|
|
5911
|
-
const db = new SQL.Database(
|
|
6158
|
+
const db = new SQL.Database(readFileSync7(dbPath));
|
|
5912
6159
|
return {
|
|
5913
6160
|
query(sql, params) {
|
|
5914
6161
|
const stmt = db.prepare(sql);
|
|
@@ -5932,7 +6179,7 @@ async function trySqlJs(dbPath) {
|
|
|
5932
6179
|
}
|
|
5933
6180
|
}
|
|
5934
6181
|
async function openSqliteReadonly(dbPath) {
|
|
5935
|
-
if (!
|
|
6182
|
+
if (!existsSync11(dbPath))
|
|
5936
6183
|
return null;
|
|
5937
6184
|
return await tryNodeSqlite(dbPath) ?? await trySqlJs(dbPath);
|
|
5938
6185
|
}
|
|
@@ -5972,12 +6219,7 @@ var init_opencode_db = __esm(() => {
|
|
|
5972
6219
|
// lib/opencode-projects.ts
|
|
5973
6220
|
var exports_opencode_projects = {};
|
|
5974
6221
|
__export(exports_opencode_projects, {
|
|
5975
|
-
|
|
5976
|
-
getCachedOpenCodeSessionsByEncodedName: () => getCachedOpenCodeSessionsByEncodedName,
|
|
5977
|
-
getCachedOpenCodeSessionsForCwd: () => getCachedOpenCodeSessionsForCwd,
|
|
5978
|
-
getOpenCodeProjects: () => getOpenCodeProjects,
|
|
5979
|
-
getOpenCodeSessionsByEncodedName: () => getOpenCodeSessionsByEncodedName,
|
|
5980
|
-
getOpenCodeSessionsForCwd: () => getOpenCodeSessionsForCwd
|
|
6222
|
+
getOpenCodeProjects: () => getOpenCodeProjects
|
|
5981
6223
|
});
|
|
5982
6224
|
async function readSessionRows() {
|
|
5983
6225
|
return queryOpenCodeDb("SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session ORDER BY time_updated DESC LIMIT ?", [SESSION_LIMIT]);
|
|
@@ -6017,11 +6259,11 @@ async function getOpenCodeProjects() {
|
|
|
6017
6259
|
const proj = projectMap.get(projectId);
|
|
6018
6260
|
const worktree = proj?.worktree ?? group.rows[0]?.directory ?? null;
|
|
6019
6261
|
const name = worktree ? encodeFolderName(worktree) : projectId;
|
|
6020
|
-
const
|
|
6262
|
+
const path = worktree ?? "";
|
|
6021
6263
|
const lastModified = new Date(Math.max(group.latest, proj?.time_updated ?? 0));
|
|
6022
6264
|
out.push({
|
|
6023
6265
|
name,
|
|
6024
|
-
path
|
|
6266
|
+
path,
|
|
6025
6267
|
isDirectory: true,
|
|
6026
6268
|
lastModified,
|
|
6027
6269
|
lastModifiedFormatted: formatDate(lastModified),
|
|
@@ -6106,12 +6348,7 @@ var init_opencode_projects = __esm(() => {
|
|
|
6106
6348
|
// lib/pi-projects.ts
|
|
6107
6349
|
var exports_pi_projects = {};
|
|
6108
6350
|
__export(exports_pi_projects, {
|
|
6109
|
-
|
|
6110
|
-
getCachedPiSessionsByEncodedName: () => getCachedPiSessionsByEncodedName,
|
|
6111
|
-
getCachedPiSessionsForCwd: () => getCachedPiSessionsForCwd,
|
|
6112
|
-
getPiProjects: () => getPiProjects,
|
|
6113
|
-
getPiSessionsByEncodedName: () => getPiSessionsByEncodedName,
|
|
6114
|
-
getPiSessionsForCwd: () => getPiSessionsForCwd
|
|
6351
|
+
getPiProjects: () => getPiProjects
|
|
6115
6352
|
});
|
|
6116
6353
|
import { readdir as readdir4, readFile as readFile6, stat as stat3 } from "node:fs/promises";
|
|
6117
6354
|
import { homedir as homedir9 } from "node:os";
|
|
@@ -6126,9 +6363,9 @@ async function safeReaddir4(dir) {
|
|
|
6126
6363
|
return null;
|
|
6127
6364
|
}
|
|
6128
6365
|
}
|
|
6129
|
-
async function statMtime3(
|
|
6366
|
+
async function statMtime3(path) {
|
|
6130
6367
|
try {
|
|
6131
|
-
return (await stat3(
|
|
6368
|
+
return (await stat3(path)).mtime;
|
|
6132
6369
|
} catch {
|
|
6133
6370
|
return null;
|
|
6134
6371
|
}
|
|
@@ -6277,16 +6514,16 @@ var init_pi_projects = __esm(() => {
|
|
|
6277
6514
|
});
|
|
6278
6515
|
|
|
6279
6516
|
// lib/hermes-profiles.ts
|
|
6280
|
-
import { readdirSync as
|
|
6517
|
+
import { readdirSync as readdirSync4 } from "node:fs";
|
|
6281
6518
|
import { homedir as homedir10 } from "node:os";
|
|
6282
|
-
import { basename as basename2, dirname as
|
|
6519
|
+
import { basename as basename2, dirname as dirname5, join as join11, resolve as resolve9 } from "node:path";
|
|
6283
6520
|
function hermesRoot() {
|
|
6284
6521
|
const env = (process.env.HERMES_HOME || "").trim();
|
|
6285
6522
|
if (env) {
|
|
6286
|
-
const home =
|
|
6287
|
-
const parent =
|
|
6523
|
+
const home = resolve9(env);
|
|
6524
|
+
const parent = dirname5(home);
|
|
6288
6525
|
if (basename2(parent) === PROFILES_DIR)
|
|
6289
|
-
return
|
|
6526
|
+
return dirname5(parent);
|
|
6290
6527
|
return home;
|
|
6291
6528
|
}
|
|
6292
6529
|
return join11(homedir10(), ".hermes");
|
|
@@ -6297,7 +6534,7 @@ function listHermesProfiles() {
|
|
|
6297
6534
|
const seen = new Set([HERMES_DEFAULT_PROFILE]);
|
|
6298
6535
|
let names;
|
|
6299
6536
|
try {
|
|
6300
|
-
names =
|
|
6537
|
+
names = readdirSync4(join11(root, PROFILES_DIR), { withFileTypes: true }).filter((e) => (e.isDirectory() || e.isSymbolicLink()) && !e.name.startsWith(".")).map((e) => e.name).sort();
|
|
6301
6538
|
} catch {
|
|
6302
6539
|
return out;
|
|
6303
6540
|
}
|
|
@@ -6345,9 +6582,9 @@ function formatDuration(ms) {
|
|
|
6345
6582
|
}
|
|
6346
6583
|
const totalSeconds = Math.round(ms / 1000);
|
|
6347
6584
|
if (totalSeconds < 3600) {
|
|
6348
|
-
const
|
|
6585
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
6349
6586
|
const seconds = totalSeconds % 60;
|
|
6350
|
-
return `${
|
|
6587
|
+
return `${minutes}m ${seconds}s`;
|
|
6351
6588
|
}
|
|
6352
6589
|
const totalMinutes = Math.round(ms / 60000);
|
|
6353
6590
|
const hours = Math.floor(totalMinutes / 60);
|
|
@@ -6538,12 +6775,7 @@ var init_hermes_sessions = __esm(() => {
|
|
|
6538
6775
|
// lib/hermes-projects.ts
|
|
6539
6776
|
var exports_hermes_projects = {};
|
|
6540
6777
|
__export(exports_hermes_projects, {
|
|
6541
|
-
|
|
6542
|
-
getCachedHermesSessions: () => getCachedHermesSessions,
|
|
6543
|
-
getCachedHermesSessionsByEncodedName: () => getCachedHermesSessionsByEncodedName,
|
|
6544
|
-
getHermesProjects: () => getHermesProjects,
|
|
6545
|
-
getHermesSessions: () => getHermesSessions,
|
|
6546
|
-
getHermesSessionsByEncodedName: () => getHermesSessionsByEncodedName
|
|
6778
|
+
getHermesProjects: () => getHermesProjects
|
|
6547
6779
|
});
|
|
6548
6780
|
async function getHermesSessions() {
|
|
6549
6781
|
const out = [];
|
|
@@ -6660,7 +6892,7 @@ var init_hermes_projects = __esm(() => {
|
|
|
6660
6892
|
|
|
6661
6893
|
// lib/openclaw-sessions.ts
|
|
6662
6894
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
6663
|
-
import { readdirSync as
|
|
6895
|
+
import { readdirSync as readdirSync5, statSync as statSync8 } from "node:fs";
|
|
6664
6896
|
import { homedir as homedir11 } from "node:os";
|
|
6665
6897
|
import { join as join13 } from "node:path";
|
|
6666
6898
|
function openclawHome() {
|
|
@@ -6779,7 +7011,7 @@ function openclawLinesToLogEntries(lines, source = "session") {
|
|
|
6779
7011
|
}
|
|
6780
7012
|
function listOpenClawAgents() {
|
|
6781
7013
|
try {
|
|
6782
|
-
return
|
|
7014
|
+
return readdirSync5(join13(openclawHome(), "agents"), { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name).sort();
|
|
6783
7015
|
} catch {
|
|
6784
7016
|
return [];
|
|
6785
7017
|
}
|
|
@@ -6789,7 +7021,7 @@ function listOpenClawTranscripts() {
|
|
|
6789
7021
|
const out = [];
|
|
6790
7022
|
let agentIds;
|
|
6791
7023
|
try {
|
|
6792
|
-
agentIds =
|
|
7024
|
+
agentIds = readdirSync5(agentsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
6793
7025
|
} catch {
|
|
6794
7026
|
return out;
|
|
6795
7027
|
}
|
|
@@ -6797,7 +7029,7 @@ function listOpenClawTranscripts() {
|
|
|
6797
7029
|
const sessionsDir = join13(agentsDir, agentId, "sessions");
|
|
6798
7030
|
let files;
|
|
6799
7031
|
try {
|
|
6800
|
-
files =
|
|
7032
|
+
files = readdirSync5(sessionsDir);
|
|
6801
7033
|
} catch {
|
|
6802
7034
|
continue;
|
|
6803
7035
|
}
|
|
@@ -6809,7 +7041,7 @@ function listOpenClawTranscripts() {
|
|
|
6809
7041
|
continue;
|
|
6810
7042
|
const transcriptPath = join13(sessionsDir, file);
|
|
6811
7043
|
try {
|
|
6812
|
-
const st =
|
|
7044
|
+
const st = statSync8(transcriptPath);
|
|
6813
7045
|
out.push({ agentId, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
6814
7046
|
} catch {}
|
|
6815
7047
|
}
|
|
@@ -6856,18 +7088,9 @@ var init_openclaw_sessions = __esm(() => {
|
|
|
6856
7088
|
// lib/openclaw-projects.ts
|
|
6857
7089
|
var exports_openclaw_projects = {};
|
|
6858
7090
|
__export(exports_openclaw_projects, {
|
|
6859
|
-
|
|
6860
|
-
getCachedOpenClawSessions: () => getCachedOpenClawSessions,
|
|
6861
|
-
getCachedOpenClawSessionsByEncodedName: () => getCachedOpenClawSessionsByEncodedName,
|
|
6862
|
-
getOpenClawProjects: () => getOpenClawProjects,
|
|
6863
|
-
getOpenClawSessions: () => getOpenClawSessions,
|
|
6864
|
-
getOpenClawSessionsByEncodedName: () => getOpenClawSessionsByEncodedName,
|
|
6865
|
-
openClawProjectName: () => openClawProjectName,
|
|
6866
|
-
openClawProjectNameCandidates: () => openClawProjectNameCandidates,
|
|
6867
|
-
openClawProjectPath: () => openClawProjectPath,
|
|
6868
|
-
parseOpenClawProjectName: () => parseOpenClawProjectName
|
|
7091
|
+
getOpenClawProjects: () => getOpenClawProjects
|
|
6869
7092
|
});
|
|
6870
|
-
import { readFileSync as
|
|
7093
|
+
import { readFileSync as readFileSync8 } from "node:fs";
|
|
6871
7094
|
import { join as join14 } from "node:path";
|
|
6872
7095
|
function str(v) {
|
|
6873
7096
|
return typeof v === "string" && v.length > 0 ? v : undefined;
|
|
@@ -6877,7 +7100,7 @@ function readSessionsIndex(agentId) {
|
|
|
6877
7100
|
const indexPath = join14(openclawHome(), "agents", agentId, "sessions", "sessions.json");
|
|
6878
7101
|
let raw;
|
|
6879
7102
|
try {
|
|
6880
|
-
raw = JSON.parse(
|
|
7103
|
+
raw = JSON.parse(readFileSync8(indexPath, "utf-8"));
|
|
6881
7104
|
} catch {
|
|
6882
7105
|
return out;
|
|
6883
7106
|
}
|
|
@@ -6951,9 +7174,6 @@ function openClawProjectNameCandidates(name) {
|
|
|
6951
7174
|
out.push({ agentId: null, channel: rest });
|
|
6952
7175
|
return out;
|
|
6953
7176
|
}
|
|
6954
|
-
function parseOpenClawProjectName(name) {
|
|
6955
|
-
return openClawProjectNameCandidates(name)[0] ?? null;
|
|
6956
|
-
}
|
|
6957
7177
|
async function getOpenClawProjects() {
|
|
6958
7178
|
const sessions = await getOpenClawSessions();
|
|
6959
7179
|
const groups = new Map;
|
|
@@ -7029,7 +7249,7 @@ var init_openclaw_projects = __esm(() => {
|
|
|
7029
7249
|
|
|
7030
7250
|
// lib/factory-sessions.ts
|
|
7031
7251
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
7032
|
-
import { readdirSync as
|
|
7252
|
+
import { readdirSync as readdirSync6, statSync as statSync9 } from "node:fs";
|
|
7033
7253
|
import { homedir as homedir12 } from "node:os";
|
|
7034
7254
|
import { join as join15 } from "node:path";
|
|
7035
7255
|
function factoryHome() {
|
|
@@ -7175,7 +7395,7 @@ function listFactoryTranscripts() {
|
|
|
7175
7395
|
const out = [];
|
|
7176
7396
|
let projectDirs;
|
|
7177
7397
|
try {
|
|
7178
|
-
projectDirs =
|
|
7398
|
+
projectDirs = readdirSync6(root, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
7179
7399
|
} catch {
|
|
7180
7400
|
return out;
|
|
7181
7401
|
}
|
|
@@ -7185,7 +7405,7 @@ function listFactoryTranscripts() {
|
|
|
7185
7405
|
const projectPath = join15(root, projectName);
|
|
7186
7406
|
let files;
|
|
7187
7407
|
try {
|
|
7188
|
-
files =
|
|
7408
|
+
files = readdirSync6(projectPath);
|
|
7189
7409
|
} catch {
|
|
7190
7410
|
continue;
|
|
7191
7411
|
}
|
|
@@ -7197,7 +7417,7 @@ function listFactoryTranscripts() {
|
|
|
7197
7417
|
continue;
|
|
7198
7418
|
const transcriptPath = join15(projectPath, file);
|
|
7199
7419
|
try {
|
|
7200
|
-
const st =
|
|
7420
|
+
const st = statSync9(transcriptPath);
|
|
7201
7421
|
out.push({ projectName, cwd, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
7202
7422
|
} catch {}
|
|
7203
7423
|
}
|
|
@@ -7245,10 +7465,7 @@ var init_factory_sessions = __esm(() => {
|
|
|
7245
7465
|
// lib/factory-projects.ts
|
|
7246
7466
|
var exports_factory_projects = {};
|
|
7247
7467
|
__export(exports_factory_projects, {
|
|
7248
|
-
|
|
7249
|
-
getCachedFactorySessionsByEncodedName: () => getCachedFactorySessionsByEncodedName,
|
|
7250
|
-
getFactoryProjects: () => getFactoryProjects,
|
|
7251
|
-
getFactorySessionsByEncodedName: () => getFactorySessionsByEncodedName
|
|
7468
|
+
getFactoryProjects: () => getFactoryProjects
|
|
7252
7469
|
});
|
|
7253
7470
|
async function getFactoryProjects() {
|
|
7254
7471
|
let transcripts;
|
|
@@ -7476,14 +7693,14 @@ function devinActiveConversationPath(rows) {
|
|
|
7476
7693
|
if (typeof r.node_id === "number")
|
|
7477
7694
|
byId.set(r.node_id, r);
|
|
7478
7695
|
let cur = rows.reduce((a, b) => (a.node_id ?? -1) > (b.node_id ?? -1) ? a : b);
|
|
7479
|
-
const
|
|
7696
|
+
const path = [];
|
|
7480
7697
|
const seen = new Set;
|
|
7481
7698
|
while (cur && typeof cur.node_id === "number" && !seen.has(cur.node_id)) {
|
|
7482
7699
|
seen.add(cur.node_id);
|
|
7483
|
-
|
|
7700
|
+
path.push(cur);
|
|
7484
7701
|
cur = cur.parent_node_id != null ? byId.get(cur.parent_node_id) : undefined;
|
|
7485
7702
|
}
|
|
7486
|
-
return
|
|
7703
|
+
return path.reverse();
|
|
7487
7704
|
}
|
|
7488
7705
|
function parseNodeRows(rows) {
|
|
7489
7706
|
const out = [];
|
|
@@ -7535,12 +7752,7 @@ var init_devin_sessions = __esm(() => {
|
|
|
7535
7752
|
// lib/devin-projects.ts
|
|
7536
7753
|
var exports_devin_projects = {};
|
|
7537
7754
|
__export(exports_devin_projects, {
|
|
7538
|
-
|
|
7539
|
-
getCachedDevinSessions: () => getCachedDevinSessions,
|
|
7540
|
-
getCachedDevinSessionsByEncodedName: () => getCachedDevinSessionsByEncodedName,
|
|
7541
|
-
getDevinProjects: () => getDevinProjects,
|
|
7542
|
-
getDevinSessions: () => getDevinSessions,
|
|
7543
|
-
getDevinSessionsByEncodedName: () => getDevinSessionsByEncodedName
|
|
7755
|
+
getDevinProjects: () => getDevinProjects
|
|
7544
7756
|
});
|
|
7545
7757
|
async function getDevinSessions() {
|
|
7546
7758
|
const db = await openSqliteReadonly(devinDbPath());
|
|
@@ -7624,7 +7836,7 @@ var init_devin_projects = __esm(() => {
|
|
|
7624
7836
|
|
|
7625
7837
|
// lib/antigravity-sessions.ts
|
|
7626
7838
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
7627
|
-
import { readdirSync as
|
|
7839
|
+
import { readdirSync as readdirSync7, statSync as statSync10 } from "node:fs";
|
|
7628
7840
|
import { homedir as homedir14 } from "node:os";
|
|
7629
7841
|
import { join as join17 } from "node:path";
|
|
7630
7842
|
function antigravityHome() {
|
|
@@ -7697,9 +7909,9 @@ function antigravityLinesToLogEntries(lines, source = "session") {
|
|
|
7697
7909
|
const block = { type: "tool_use", id, name, input };
|
|
7698
7910
|
blocks.push(block);
|
|
7699
7911
|
const key = name.toUpperCase();
|
|
7700
|
-
const
|
|
7701
|
-
|
|
7702
|
-
pendingByType.set(key,
|
|
7912
|
+
const queue = pendingByType.get(key) ?? [];
|
|
7913
|
+
queue.push({ block, startMs: date.getTime() });
|
|
7914
|
+
pendingByType.set(key, queue);
|
|
7703
7915
|
}
|
|
7704
7916
|
}
|
|
7705
7917
|
if (blocks.length === 0)
|
|
@@ -7749,7 +7961,7 @@ function listAntigravityTranscripts() {
|
|
|
7749
7961
|
const out = [];
|
|
7750
7962
|
let convoDirs;
|
|
7751
7963
|
try {
|
|
7752
|
-
convoDirs =
|
|
7964
|
+
convoDirs = readdirSync7(root, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
7753
7965
|
} catch {
|
|
7754
7966
|
return out;
|
|
7755
7967
|
}
|
|
@@ -7759,7 +7971,7 @@ function listAntigravityTranscripts() {
|
|
|
7759
7971
|
continue;
|
|
7760
7972
|
const transcriptPath = join17(root, conversationId, rel);
|
|
7761
7973
|
try {
|
|
7762
|
-
const st =
|
|
7974
|
+
const st = statSync10(transcriptPath);
|
|
7763
7975
|
if (!st.isFile())
|
|
7764
7976
|
continue;
|
|
7765
7977
|
out.push({ conversationId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
@@ -7772,7 +7984,7 @@ function findAntigravityTranscript(conversationId) {
|
|
|
7772
7984
|
return null;
|
|
7773
7985
|
const transcriptPath = join17(antigravityBrainRoot(), conversationId, antigravityTranscriptRelPath());
|
|
7774
7986
|
try {
|
|
7775
|
-
if (
|
|
7987
|
+
if (statSync10(transcriptPath).isFile())
|
|
7776
7988
|
return transcriptPath;
|
|
7777
7989
|
} catch {}
|
|
7778
7990
|
return null;
|
|
@@ -7803,12 +8015,7 @@ var init_antigravity_sessions = __esm(() => {
|
|
|
7803
8015
|
// lib/antigravity-projects.ts
|
|
7804
8016
|
var exports_antigravity_projects = {};
|
|
7805
8017
|
__export(exports_antigravity_projects, {
|
|
7806
|
-
|
|
7807
|
-
getAntigravityIndex: () => getAntigravityIndex,
|
|
7808
|
-
getAntigravityProjects: () => getAntigravityProjects,
|
|
7809
|
-
getAntigravitySessionsByEncodedName: () => getAntigravitySessionsByEncodedName,
|
|
7810
|
-
getCachedAntigravityProjects: () => getCachedAntigravityProjects,
|
|
7811
|
-
getCachedAntigravitySessionsByEncodedName: () => getCachedAntigravitySessionsByEncodedName
|
|
8018
|
+
getAntigravityProjects: () => getAntigravityProjects
|
|
7812
8019
|
});
|
|
7813
8020
|
import { join as join18 } from "node:path";
|
|
7814
8021
|
function antigravitySummariesDbPath() {
|
|
@@ -7900,18 +8107,18 @@ async function getAntigravityProjects() {
|
|
|
7900
8107
|
const byName = new Map;
|
|
7901
8108
|
for (const c of conversations) {
|
|
7902
8109
|
const name = c.cwd ? encodeFolderName(c.cwd) : ANTIGRAVITY_UNGROUPED;
|
|
7903
|
-
const
|
|
8110
|
+
const path = c.cwd ?? "antigravity";
|
|
7904
8111
|
const existing = byName.get(name);
|
|
7905
8112
|
if (!existing || c.mtimeMs > existing.latest) {
|
|
7906
|
-
byName.set(name, { latest: c.mtimeMs, path
|
|
8113
|
+
byName.set(name, { latest: c.mtimeMs, path });
|
|
7907
8114
|
}
|
|
7908
8115
|
}
|
|
7909
8116
|
const folders = [];
|
|
7910
|
-
for (const [name, { latest, path
|
|
8117
|
+
for (const [name, { latest, path }] of byName) {
|
|
7911
8118
|
const lastModified = new Date(latest);
|
|
7912
8119
|
folders.push({
|
|
7913
8120
|
name,
|
|
7914
|
-
path
|
|
8121
|
+
path,
|
|
7915
8122
|
isDirectory: true,
|
|
7916
8123
|
lastModified,
|
|
7917
8124
|
lastModifiedFormatted: formatDate(lastModified),
|
|
@@ -8142,12 +8349,7 @@ var init_goose_sessions = __esm(() => {
|
|
|
8142
8349
|
// lib/goose-projects.ts
|
|
8143
8350
|
var exports_goose_projects = {};
|
|
8144
8351
|
__export(exports_goose_projects, {
|
|
8145
|
-
|
|
8146
|
-
getCachedGooseSessions: () => getCachedGooseSessions,
|
|
8147
|
-
getCachedGooseSessionsByEncodedName: () => getCachedGooseSessionsByEncodedName,
|
|
8148
|
-
getGooseProjects: () => getGooseProjects,
|
|
8149
|
-
getGooseSessions: () => getGooseSessions,
|
|
8150
|
-
getGooseSessionsByEncodedName: () => getGooseSessionsByEncodedName
|
|
8352
|
+
getGooseProjects: () => getGooseProjects
|
|
8151
8353
|
});
|
|
8152
8354
|
async function getGooseSessions() {
|
|
8153
8355
|
const db = await openSqliteReadonly(gooseDbPath());
|
|
@@ -8232,10 +8434,10 @@ var init_goose_projects = __esm(() => {
|
|
|
8232
8434
|
|
|
8233
8435
|
// lib/projects.ts
|
|
8234
8436
|
import { readdir as readdir5, stat as stat4 } from "node:fs/promises";
|
|
8235
|
-
import { join as join20, resolve as
|
|
8236
|
-
async function getMtime(
|
|
8437
|
+
import { join as join20, resolve as resolve10, sep } from "node:path";
|
|
8438
|
+
async function getMtime(path, label) {
|
|
8237
8439
|
try {
|
|
8238
|
-
return (await stat4(
|
|
8440
|
+
return (await stat4(path)).mtime;
|
|
8239
8441
|
} catch (error) {
|
|
8240
8442
|
logWarn(`Failed to stat ${label}:`, error);
|
|
8241
8443
|
return new Date(0);
|
|
@@ -8306,17 +8508,17 @@ function mergeProjectFolders(...sources) {
|
|
|
8306
8508
|
}
|
|
8307
8509
|
async function getProjectFolders() {
|
|
8308
8510
|
const [
|
|
8309
|
-
{ getCodexProjects
|
|
8310
|
-
{ getCopilotProjects
|
|
8311
|
-
{ getCursorProjects
|
|
8312
|
-
{ getOpenCodeProjects
|
|
8313
|
-
{ getPiProjects
|
|
8314
|
-
{ getHermesProjects
|
|
8315
|
-
{ getOpenClawProjects
|
|
8316
|
-
{ getFactoryProjects
|
|
8317
|
-
{ getDevinProjects
|
|
8318
|
-
{ getAntigravityProjects
|
|
8319
|
-
{ getGooseProjects
|
|
8511
|
+
{ getCodexProjects },
|
|
8512
|
+
{ getCopilotProjects },
|
|
8513
|
+
{ getCursorProjects },
|
|
8514
|
+
{ getOpenCodeProjects },
|
|
8515
|
+
{ getPiProjects },
|
|
8516
|
+
{ getHermesProjects },
|
|
8517
|
+
{ getOpenClawProjects },
|
|
8518
|
+
{ getFactoryProjects },
|
|
8519
|
+
{ getDevinProjects },
|
|
8520
|
+
{ getAntigravityProjects },
|
|
8521
|
+
{ getGooseProjects }
|
|
8320
8522
|
] = await Promise.all([
|
|
8321
8523
|
Promise.resolve().then(() => (init_codex_projects(), exports_codex_projects)),
|
|
8322
8524
|
Promise.resolve().then(() => (init_copilot_projects(), exports_copilot_projects)),
|
|
@@ -8332,47 +8534,47 @@ async function getProjectFolders() {
|
|
|
8332
8534
|
]);
|
|
8333
8535
|
const [claude, codex, copilot, cursor, opencode, pi, hermes, openclaw, factory, devin, antigravity, goose] = await Promise.all([
|
|
8334
8536
|
getClaudeProjectFolders(),
|
|
8335
|
-
|
|
8537
|
+
getCodexProjects().catch((error) => {
|
|
8336
8538
|
logError("Error reading Codex projects:", error);
|
|
8337
8539
|
return [];
|
|
8338
8540
|
}),
|
|
8339
|
-
|
|
8541
|
+
getCopilotProjects().catch((error) => {
|
|
8340
8542
|
logError("Error reading Copilot projects:", error);
|
|
8341
8543
|
return [];
|
|
8342
8544
|
}),
|
|
8343
|
-
|
|
8545
|
+
getCursorProjects().catch((error) => {
|
|
8344
8546
|
logError("Error reading Cursor projects:", error);
|
|
8345
8547
|
return [];
|
|
8346
8548
|
}),
|
|
8347
|
-
|
|
8549
|
+
getOpenCodeProjects().catch((error) => {
|
|
8348
8550
|
logError("Error reading OpenCode projects:", error);
|
|
8349
8551
|
return [];
|
|
8350
8552
|
}),
|
|
8351
|
-
|
|
8553
|
+
getPiProjects().catch((error) => {
|
|
8352
8554
|
logError("Error reading Pi projects:", error);
|
|
8353
8555
|
return [];
|
|
8354
8556
|
}),
|
|
8355
|
-
|
|
8557
|
+
getHermesProjects().catch((error) => {
|
|
8356
8558
|
logError("Error reading Hermes projects:", error);
|
|
8357
8559
|
return [];
|
|
8358
8560
|
}),
|
|
8359
|
-
|
|
8561
|
+
getOpenClawProjects().catch((error) => {
|
|
8360
8562
|
logError("Error reading OpenClaw projects:", error);
|
|
8361
8563
|
return [];
|
|
8362
8564
|
}),
|
|
8363
|
-
|
|
8565
|
+
getFactoryProjects().catch((error) => {
|
|
8364
8566
|
logError("Error reading Factory projects:", error);
|
|
8365
8567
|
return [];
|
|
8366
8568
|
}),
|
|
8367
|
-
|
|
8569
|
+
getDevinProjects().catch((error) => {
|
|
8368
8570
|
logError("Error reading Devin projects:", error);
|
|
8369
8571
|
return [];
|
|
8370
8572
|
}),
|
|
8371
|
-
|
|
8573
|
+
getAntigravityProjects().catch((error) => {
|
|
8372
8574
|
logError("Error reading Antigravity projects:", error);
|
|
8373
8575
|
return [];
|
|
8374
8576
|
}),
|
|
8375
|
-
|
|
8577
|
+
getGooseProjects().catch((error) => {
|
|
8376
8578
|
logError("Error reading Goose projects:", error);
|
|
8377
8579
|
return [];
|
|
8378
8580
|
})
|
|
@@ -8384,8 +8586,8 @@ function resolveProjectPath(projectName) {
|
|
|
8384
8586
|
throw new RangeError("Empty project name");
|
|
8385
8587
|
if (/^[/\\]/.test(projectName))
|
|
8386
8588
|
throw new RangeError("Absolute project name");
|
|
8387
|
-
const projectsPath =
|
|
8388
|
-
const candidate =
|
|
8589
|
+
const projectsPath = resolve10(getClaudeProjectsPath());
|
|
8590
|
+
const candidate = resolve10(join20(projectsPath, projectName));
|
|
8389
8591
|
if (!candidate.startsWith(projectsPath + sep)) {
|
|
8390
8592
|
throw new RangeError("Project path escapes root");
|
|
8391
8593
|
}
|
|
@@ -8691,30 +8893,30 @@ var init_log_entries = __esm(() => {
|
|
|
8691
8893
|
});
|
|
8692
8894
|
|
|
8693
8895
|
// lib/codex-sessions.ts
|
|
8694
|
-
import { readFileSync as
|
|
8896
|
+
import { readFileSync as readFileSync9, readdirSync as readdirSync8, existsSync as existsSync12, writeFileSync as writeFileSync6, mkdirSync as mkdirSync8, statSync as statSync11 } from "node:fs";
|
|
8695
8897
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
8696
|
-
import { dirname as
|
|
8898
|
+
import { dirname as dirname6, join as join23 } from "node:path";
|
|
8697
8899
|
import { homedir as homedir16 } from "node:os";
|
|
8698
8900
|
function readCache() {
|
|
8699
8901
|
try {
|
|
8700
|
-
if (!
|
|
8902
|
+
if (!existsSync12(CACHE_PATH))
|
|
8701
8903
|
return {};
|
|
8702
|
-
return JSON.parse(
|
|
8904
|
+
return JSON.parse(readFileSync9(CACHE_PATH, "utf-8"));
|
|
8703
8905
|
} catch {
|
|
8704
8906
|
return {};
|
|
8705
8907
|
}
|
|
8706
8908
|
}
|
|
8707
|
-
function writeCacheEntry(sessionId,
|
|
8909
|
+
function writeCacheEntry(sessionId, path) {
|
|
8708
8910
|
try {
|
|
8709
|
-
|
|
8911
|
+
mkdirSync8(dirname6(CACHE_PATH), { recursive: true });
|
|
8710
8912
|
const cache = readCache();
|
|
8711
|
-
cache[sessionId] =
|
|
8712
|
-
|
|
8913
|
+
cache[sessionId] = path;
|
|
8914
|
+
writeFileSync6(CACHE_PATH, JSON.stringify(cache), "utf-8");
|
|
8713
8915
|
} catch {}
|
|
8714
8916
|
}
|
|
8715
8917
|
function dirSearch(dir, sessionId) {
|
|
8716
8918
|
try {
|
|
8717
|
-
for (const f of
|
|
8919
|
+
for (const f of readdirSync8(dir, { withFileTypes: true })) {
|
|
8718
8920
|
if (f.isFile() && f.name.includes(sessionId) && f.name.endsWith(".jsonl")) {
|
|
8719
8921
|
return join23(dir, f.name);
|
|
8720
8922
|
}
|
|
@@ -8725,7 +8927,7 @@ function dirSearch(dir, sessionId) {
|
|
|
8725
8927
|
function findCodexTranscript(sessionId) {
|
|
8726
8928
|
const cache = readCache();
|
|
8727
8929
|
const cached = cache[sessionId];
|
|
8728
|
-
if (cached &&
|
|
8930
|
+
if (cached && existsSync12(cached))
|
|
8729
8931
|
return cached;
|
|
8730
8932
|
const root = join23(homedir16(), ".codex", "sessions");
|
|
8731
8933
|
const today = new Date;
|
|
@@ -8744,13 +8946,13 @@ function findCodexTranscript(sessionId) {
|
|
|
8744
8946
|
}
|
|
8745
8947
|
}
|
|
8746
8948
|
try {
|
|
8747
|
-
for (const y of
|
|
8949
|
+
for (const y of readdirSync8(root, { withFileTypes: true })) {
|
|
8748
8950
|
if (!y.isDirectory())
|
|
8749
8951
|
continue;
|
|
8750
|
-
for (const m of
|
|
8952
|
+
for (const m of readdirSync8(join23(root, y.name), { withFileTypes: true })) {
|
|
8751
8953
|
if (!m.isDirectory())
|
|
8752
8954
|
continue;
|
|
8753
|
-
for (const d of
|
|
8955
|
+
for (const d of readdirSync8(join23(root, y.name, m.name), { withFileTypes: true })) {
|
|
8754
8956
|
if (!d.isDirectory())
|
|
8755
8957
|
continue;
|
|
8756
8958
|
const hit = dirSearch(join23(root, y.name, m.name, d.name), sessionId);
|
|
@@ -8979,7 +9181,7 @@ var init_codex_sessions = __esm(() => {
|
|
|
8979
9181
|
});
|
|
8980
9182
|
|
|
8981
9183
|
// src/hooks/resolve-permission-mode.ts
|
|
8982
|
-
import { readFileSync as
|
|
9184
|
+
import { readFileSync as readFileSync10 } from "node:fs";
|
|
8983
9185
|
function resolvePermissionMode(integration, parsed, sessionId) {
|
|
8984
9186
|
if (integration === "claude") {
|
|
8985
9187
|
return parsed.permission_mode ?? "default";
|
|
@@ -8991,10 +9193,10 @@ function resolvePermissionMode(integration, parsed, sessionId) {
|
|
|
8991
9193
|
}
|
|
8992
9194
|
function resolveCodexMode(sessionId) {
|
|
8993
9195
|
try {
|
|
8994
|
-
const
|
|
8995
|
-
if (!
|
|
9196
|
+
const path = findCodexTranscript(sessionId);
|
|
9197
|
+
if (!path)
|
|
8996
9198
|
return;
|
|
8997
|
-
for (const line of
|
|
9199
|
+
for (const line of readFileSync10(path, "utf-8").split(`
|
|
8998
9200
|
`)) {
|
|
8999
9201
|
if (!line.includes("turn_context"))
|
|
9000
9202
|
continue;
|
|
@@ -9019,9 +9221,9 @@ var init_resolve_permission_mode = __esm(() => {
|
|
|
9019
9221
|
});
|
|
9020
9222
|
|
|
9021
9223
|
// lib/copilot-sessions.ts
|
|
9022
|
-
import { readFileSync as
|
|
9224
|
+
import { readFileSync as readFileSync11, readdirSync as readdirSync9, existsSync as existsSync13, statSync as statSync12 } from "node:fs";
|
|
9023
9225
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
9024
|
-
import { join as join24, resolve as
|
|
9226
|
+
import { join as join24, resolve as resolve11, sep as sep2 } from "node:path";
|
|
9025
9227
|
import { homedir as homedir17 } from "node:os";
|
|
9026
9228
|
function getCopilotHome() {
|
|
9027
9229
|
return process.env.COPILOT_HOME || join24(homedir17(), ".copilot");
|
|
@@ -9032,8 +9234,8 @@ function getCopilotSessionStateRoot2() {
|
|
|
9032
9234
|
function getCopilotSessionDir(sessionId) {
|
|
9033
9235
|
if (!sessionId)
|
|
9034
9236
|
return null;
|
|
9035
|
-
const root =
|
|
9036
|
-
const candidate =
|
|
9237
|
+
const root = resolve11(getCopilotSessionStateRoot2());
|
|
9238
|
+
const candidate = resolve11(root, sessionId);
|
|
9037
9239
|
if (candidate === root || !candidate.startsWith(`${root}${sep2}`))
|
|
9038
9240
|
return null;
|
|
9039
9241
|
return candidate;
|
|
@@ -9048,17 +9250,17 @@ function findCopilotTranscript(sessionId) {
|
|
|
9048
9250
|
const candidate = resolveSessionFile(sessionId, "events.jsonl");
|
|
9049
9251
|
if (!candidate)
|
|
9050
9252
|
return null;
|
|
9051
|
-
return
|
|
9253
|
+
return existsSync13(candidate) ? candidate : null;
|
|
9052
9254
|
}
|
|
9053
9255
|
function findCopilotWorkspace(sessionId) {
|
|
9054
9256
|
const candidate = resolveSessionFile(sessionId, "workspace.yaml");
|
|
9055
9257
|
if (!candidate)
|
|
9056
9258
|
return null;
|
|
9057
|
-
return
|
|
9259
|
+
return existsSync13(candidate) ? candidate : null;
|
|
9058
9260
|
}
|
|
9059
|
-
function readYamlScalar(
|
|
9261
|
+
function readYamlScalar(path, key) {
|
|
9060
9262
|
try {
|
|
9061
|
-
const text =
|
|
9263
|
+
const text = readFileSync11(path, "utf-8");
|
|
9062
9264
|
const re = new RegExp(`^${key}\\s*:\\s*(.+?)\\s*$`, "m");
|
|
9063
9265
|
const m = text.match(re);
|
|
9064
9266
|
if (!m)
|
|
@@ -9069,10 +9271,10 @@ function readYamlScalar(path2, key) {
|
|
|
9069
9271
|
}
|
|
9070
9272
|
}
|
|
9071
9273
|
function readCopilotWorkspaceCwd(sessionId) {
|
|
9072
|
-
const
|
|
9073
|
-
if (!
|
|
9274
|
+
const path = findCopilotWorkspace(sessionId);
|
|
9275
|
+
if (!path)
|
|
9074
9276
|
return;
|
|
9075
|
-
return readYamlScalar(
|
|
9277
|
+
return readYamlScalar(path, "cwd");
|
|
9076
9278
|
}
|
|
9077
9279
|
async function parseCopilotLog(fileContent, source = "session") {
|
|
9078
9280
|
const lines = fileContent.split(`
|
|
@@ -9236,9 +9438,9 @@ var init_copilot_sessions = __esm(() => {
|
|
|
9236
9438
|
});
|
|
9237
9439
|
|
|
9238
9440
|
// lib/cursor-sessions.ts
|
|
9239
|
-
import { readFileSync as
|
|
9441
|
+
import { readFileSync as readFileSync12, readdirSync as readdirSync10, existsSync as existsSync14, statSync as statSync13 } from "node:fs";
|
|
9240
9442
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
9241
|
-
import { basename as basename3, join as join25, resolve as
|
|
9443
|
+
import { basename as basename3, join as join25, resolve as resolve12, sep as sep3 } from "node:path";
|
|
9242
9444
|
import { homedir as homedir18 } from "node:os";
|
|
9243
9445
|
function getCursorHome2() {
|
|
9244
9446
|
return process.env.CURSOR_HOME || join25(homedir18(), ".cursor");
|
|
@@ -9246,28 +9448,28 @@ function getCursorHome2() {
|
|
|
9246
9448
|
function getCursorSessionDir(sessionId) {
|
|
9247
9449
|
if (!sessionId)
|
|
9248
9450
|
return null;
|
|
9249
|
-
const home =
|
|
9250
|
-
const projectsRoot =
|
|
9451
|
+
const home = resolve12(getCursorHome2());
|
|
9452
|
+
const projectsRoot = resolve12(home, NEW_PROJECTS_DIR2);
|
|
9251
9453
|
let projectEntries = [];
|
|
9252
9454
|
try {
|
|
9253
|
-
projectEntries =
|
|
9455
|
+
projectEntries = readdirSync10(projectsRoot, { withFileTypes: true });
|
|
9254
9456
|
} catch {}
|
|
9255
9457
|
for (const entry of projectEntries) {
|
|
9256
9458
|
if (!entry.isDirectory())
|
|
9257
9459
|
continue;
|
|
9258
|
-
const candidate =
|
|
9259
|
-
const transcriptRoot =
|
|
9460
|
+
const candidate = resolve12(projectsRoot, entry.name, NEW_AGENT_TRANSCRIPTS_DIR2, sessionId);
|
|
9461
|
+
const transcriptRoot = resolve12(projectsRoot, entry.name, NEW_AGENT_TRANSCRIPTS_DIR2);
|
|
9260
9462
|
if (candidate === transcriptRoot || !candidate.startsWith(`${transcriptRoot}${sep3}`))
|
|
9261
9463
|
continue;
|
|
9262
|
-
if (
|
|
9464
|
+
if (existsSync14(candidate))
|
|
9263
9465
|
return candidate;
|
|
9264
9466
|
}
|
|
9265
9467
|
for (const sub of LEGACY_SESSION_ROOT_CANDIDATES2) {
|
|
9266
|
-
const root =
|
|
9267
|
-
const candidate =
|
|
9468
|
+
const root = resolve12(home, sub);
|
|
9469
|
+
const candidate = resolve12(root, sessionId);
|
|
9268
9470
|
if (candidate === root || !candidate.startsWith(`${root}${sep3}`))
|
|
9269
9471
|
continue;
|
|
9270
|
-
if (
|
|
9472
|
+
if (existsSync14(candidate))
|
|
9271
9473
|
return candidate;
|
|
9272
9474
|
}
|
|
9273
9475
|
return null;
|
|
@@ -9277,11 +9479,11 @@ function findCursorTranscript(sessionId) {
|
|
|
9277
9479
|
if (!dir)
|
|
9278
9480
|
return null;
|
|
9279
9481
|
const newCandidate = join25(dir, `${basename3(dir)}.jsonl`);
|
|
9280
|
-
if (
|
|
9482
|
+
if (existsSync14(newCandidate))
|
|
9281
9483
|
return newCandidate;
|
|
9282
9484
|
for (const name of LEGACY_TRANSCRIPT_FILE_CANDIDATES2) {
|
|
9283
9485
|
const candidate = join25(dir, name);
|
|
9284
|
-
if (
|
|
9486
|
+
if (existsSync14(candidate))
|
|
9285
9487
|
return candidate;
|
|
9286
9488
|
}
|
|
9287
9489
|
return null;
|
|
@@ -9492,9 +9694,9 @@ var init_cursor_sessions = __esm(() => {
|
|
|
9492
9694
|
});
|
|
9493
9695
|
|
|
9494
9696
|
// lib/pi-sessions.ts
|
|
9495
|
-
import { readFileSync as
|
|
9697
|
+
import { readFileSync as readFileSync13, readdirSync as readdirSync11, existsSync as existsSync15, statSync as statSync14 } from "node:fs";
|
|
9496
9698
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
9497
|
-
import { join as join26, resolve as
|
|
9699
|
+
import { join as join26, resolve as resolve13, sep as sep4 } from "node:path";
|
|
9498
9700
|
import { homedir as homedir19 } from "node:os";
|
|
9499
9701
|
function getPiSessionStateRoot() {
|
|
9500
9702
|
return process.env.PI_SESSIONS_DIR || join26(homedir19(), ".pi", "agent", "sessions");
|
|
@@ -9505,20 +9707,20 @@ function isSafeSessionId(sessionId) {
|
|
|
9505
9707
|
function findPiTranscript(sessionId) {
|
|
9506
9708
|
if (!isSafeSessionId(sessionId))
|
|
9507
9709
|
return null;
|
|
9508
|
-
const root =
|
|
9710
|
+
const root = resolve13(getPiSessionStateRoot());
|
|
9509
9711
|
let cwdDirs;
|
|
9510
9712
|
try {
|
|
9511
|
-
cwdDirs =
|
|
9713
|
+
cwdDirs = readdirSync11(root);
|
|
9512
9714
|
} catch {
|
|
9513
9715
|
return null;
|
|
9514
9716
|
}
|
|
9515
9717
|
for (const cwdDir of cwdDirs) {
|
|
9516
|
-
const cwdPath =
|
|
9718
|
+
const cwdPath = resolve13(root, cwdDir);
|
|
9517
9719
|
if (!cwdPath.startsWith(`${root}${sep4}`))
|
|
9518
9720
|
continue;
|
|
9519
9721
|
let files;
|
|
9520
9722
|
try {
|
|
9521
|
-
files =
|
|
9723
|
+
files = readdirSync11(cwdPath);
|
|
9522
9724
|
} catch {
|
|
9523
9725
|
continue;
|
|
9524
9726
|
}
|
|
@@ -9526,10 +9728,10 @@ function findPiTranscript(sessionId) {
|
|
|
9526
9728
|
const m = SESSION_FILE_RE2.exec(f);
|
|
9527
9729
|
if (!m || m[1].toLowerCase() !== sessionId.toLowerCase())
|
|
9528
9730
|
continue;
|
|
9529
|
-
const candidate =
|
|
9731
|
+
const candidate = resolve13(cwdPath, f);
|
|
9530
9732
|
if (!candidate.startsWith(`${cwdPath}${sep4}`))
|
|
9531
9733
|
continue;
|
|
9532
|
-
if (
|
|
9734
|
+
if (existsSync15(candidate))
|
|
9533
9735
|
return candidate;
|
|
9534
9736
|
}
|
|
9535
9737
|
}
|
|
@@ -9819,8 +10021,8 @@ function missingGuards(input) {
|
|
|
9819
10021
|
continue;
|
|
9820
10022
|
const loadFailure = input.failed.get(pack.id);
|
|
9821
10023
|
if (loadFailure && PERMANENT_LOAD_FAILURES.has(loadFailure.type)) {
|
|
9822
|
-
const
|
|
9823
|
-
const unavailable = pack.policies.filter((p) =>
|
|
10024
|
+
const taken = pack.enabled ?? pack.policies.map((p) => p.name);
|
|
10025
|
+
const unavailable = pack.policies.filter((p) => taken.includes(p.name) && !input.disabled.has(`pack:${pack.id}@${pack.version}:${p.name}`));
|
|
9824
10026
|
if (unavailable.length > 0) {
|
|
9825
10027
|
out.push({
|
|
9826
10028
|
packId: pack.id,
|
|
@@ -9885,17 +10087,14 @@ var init_pack_failclosed = __esm(() => {
|
|
|
9885
10087
|
]);
|
|
9886
10088
|
});
|
|
9887
10089
|
|
|
9888
|
-
// lib/atomic-write.ts
|
|
9889
|
-
var init_atomic_write = () => {};
|
|
9890
|
-
|
|
9891
10090
|
// src/hooks/session-pause.ts
|
|
9892
|
-
import { existsSync as
|
|
10091
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync9, readdirSync as readdirSync12, readFileSync as readFileSync14, rmSync as rmSync4 } from "node:fs";
|
|
9893
10092
|
import { createHash as createHash5 } from "node:crypto";
|
|
9894
|
-
import { join as join27, resolve as
|
|
10093
|
+
import { join as join27, resolve as resolve14 } from "node:path";
|
|
9895
10094
|
function pauseStateDir() {
|
|
9896
10095
|
const override = process.env.FAILPROOFAI_STATE_DIR;
|
|
9897
10096
|
if (override)
|
|
9898
|
-
return
|
|
10097
|
+
return resolve14(override, "sessions");
|
|
9899
10098
|
return sessionPauseDir();
|
|
9900
10099
|
}
|
|
9901
10100
|
function pauseFilePath(sessionId) {
|
|
@@ -9928,10 +10127,10 @@ function readActivePause(sessionId, now = Date.now()) {
|
|
|
9928
10127
|
if (!sessionId)
|
|
9929
10128
|
return null;
|
|
9930
10129
|
try {
|
|
9931
|
-
const
|
|
9932
|
-
if (!
|
|
10130
|
+
const path = pauseFilePath(sessionId);
|
|
10131
|
+
if (!existsSync16(path))
|
|
9933
10132
|
return null;
|
|
9934
|
-
const stored = parseStored(JSON.parse(
|
|
10133
|
+
const stored = parseStored(JSON.parse(readFileSync14(path, "utf8")));
|
|
9935
10134
|
if (!stored)
|
|
9936
10135
|
return null;
|
|
9937
10136
|
if (stored.expiresAt <= now)
|
|
@@ -9970,15 +10169,15 @@ var init_daemon_service = __esm(() => {
|
|
|
9970
10169
|
// src/hooks/fp-reset.ts
|
|
9971
10170
|
import {
|
|
9972
10171
|
copyFileSync,
|
|
9973
|
-
existsSync as
|
|
9974
|
-
mkdirSync as
|
|
9975
|
-
readFileSync as
|
|
9976
|
-
readdirSync as
|
|
9977
|
-
renameSync as
|
|
9978
|
-
rmSync as
|
|
10172
|
+
existsSync as existsSync17,
|
|
10173
|
+
mkdirSync as mkdirSync10,
|
|
10174
|
+
readFileSync as readFileSync15,
|
|
10175
|
+
readdirSync as readdirSync13,
|
|
10176
|
+
renameSync as renameSync4,
|
|
10177
|
+
rmSync as rmSync5,
|
|
9979
10178
|
rmdirSync,
|
|
9980
|
-
statSync as
|
|
9981
|
-
writeFileSync as
|
|
10179
|
+
statSync as statSync15,
|
|
10180
|
+
writeFileSync as writeFileSync7
|
|
9982
10181
|
} from "node:fs";
|
|
9983
10182
|
function layoutWarningForHook() {
|
|
9984
10183
|
const state = detectLayout();
|
|
@@ -9987,7 +10186,7 @@ function layoutWarningForHook() {
|
|
|
9987
10186
|
if (state.kind === "future") {
|
|
9988
10187
|
return `[failproofai] this directory was written by a newer version (layout ${state.found} vs ${LAYOUT_VERSION}) — policies are NOT being enforced. ` + `Upgrade failproofai.`;
|
|
9989
10188
|
}
|
|
9990
|
-
if (
|
|
10189
|
+
if (existsSync17(globalPolicyConfigFile()))
|
|
9991
10190
|
return null;
|
|
9992
10191
|
return `[failproofai] setup predates this version — global policies are NOT being enforced. ` + `Run \`failproofai config\` to re-create it.`;
|
|
9993
10192
|
}
|
|
@@ -10032,6 +10231,31 @@ function canonicalizeEventType(raw, cli) {
|
|
|
10032
10231
|
}
|
|
10033
10232
|
return raw;
|
|
10034
10233
|
}
|
|
10234
|
+
function attachLeakNotice(eventType, cli, outcome) {
|
|
10235
|
+
try {
|
|
10236
|
+
if (!canDeliverNotice(cli))
|
|
10237
|
+
return outcome;
|
|
10238
|
+
if (!cli)
|
|
10239
|
+
return outcome;
|
|
10240
|
+
const canonical = canonicalizeEventType(eventType, cli);
|
|
10241
|
+
if (canonical !== "Stop" && canonical !== "SessionStart")
|
|
10242
|
+
return outcome;
|
|
10243
|
+
const pending = pendingLeakNotice();
|
|
10244
|
+
if (pending.count === 0)
|
|
10245
|
+
return outcome;
|
|
10246
|
+
const shaped = shapeNotice(cli, leakNoticeText(pending.count), outcome.stdout);
|
|
10247
|
+
if (shaped.stdout === outcome.stdout && !shaped.stderr)
|
|
10248
|
+
return outcome;
|
|
10249
|
+
markLeakNoticeDelivered(pending.ids);
|
|
10250
|
+
return {
|
|
10251
|
+
exitCode: outcome.exitCode,
|
|
10252
|
+
stdout: shaped.stdout,
|
|
10253
|
+
stderr: outcome.stderr + shaped.stderr
|
|
10254
|
+
};
|
|
10255
|
+
} catch {
|
|
10256
|
+
return outcome;
|
|
10257
|
+
}
|
|
10258
|
+
}
|
|
10035
10259
|
async function runObserved(hook, ctx, hookName, eventType, cli) {
|
|
10036
10260
|
try {
|
|
10037
10261
|
return await Promise.race([
|
|
@@ -10196,11 +10420,11 @@ async function evaluateHookEvent(eventType, cli = "claude", stdinPayload, opts)
|
|
|
10196
10420
|
return { decision: "allow" };
|
|
10197
10421
|
}
|
|
10198
10422
|
try {
|
|
10199
|
-
const
|
|
10423
|
+
const result = await Promise.race([
|
|
10200
10424
|
hook.fn(ctx),
|
|
10201
10425
|
new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), 1e4))
|
|
10202
10426
|
]);
|
|
10203
|
-
return
|
|
10427
|
+
return result;
|
|
10204
10428
|
} catch (err) {
|
|
10205
10429
|
const msg = err instanceof Error ? err.message : String(err);
|
|
10206
10430
|
const isTimeout = msg === "timeout";
|
|
@@ -10334,7 +10558,12 @@ async function evaluateHookEvent(eventType, cli = "claude", stdinPayload, opts)
|
|
|
10334
10558
|
}
|
|
10335
10559
|
} catch {}
|
|
10336
10560
|
}
|
|
10337
|
-
|
|
10561
|
+
const withNotice = attachLeakNotice(eventType, cli, {
|
|
10562
|
+
exitCode: result.exitCode,
|
|
10563
|
+
stdout: result.stdout,
|
|
10564
|
+
stderr: result.stderr
|
|
10565
|
+
});
|
|
10566
|
+
return withNotice;
|
|
10338
10567
|
} finally {
|
|
10339
10568
|
if (opts?.awaitTelemetryFlush ?? true) {
|
|
10340
10569
|
await flushHookTelemetry();
|
|
@@ -10350,6 +10579,8 @@ var init_handler = __esm(() => {
|
|
|
10350
10579
|
init_custom_hooks_loader();
|
|
10351
10580
|
init_hook_activity_store();
|
|
10352
10581
|
init_delivery_health();
|
|
10582
|
+
init_notice();
|
|
10583
|
+
init_leak_notice();
|
|
10353
10584
|
init_hook_telemetry();
|
|
10354
10585
|
init_resolve_permission_mode();
|
|
10355
10586
|
init_resolve_transcript_path();
|
|
@@ -10363,12 +10594,8 @@ var init_handler = __esm(() => {
|
|
|
10363
10594
|
});
|
|
10364
10595
|
|
|
10365
10596
|
// src/hooks/worker-server.ts
|
|
10366
|
-
var exports_worker_server = {};
|
|
10367
|
-
__export(exports_worker_server, {
|
|
10368
|
-
startWorkerServer: () => startWorkerServer
|
|
10369
|
-
});
|
|
10370
10597
|
import { createConnection, createServer } from "node:net";
|
|
10371
|
-
import { existsSync as
|
|
10598
|
+
import { existsSync as existsSync18, unlinkSync as unlinkSync2 } from "node:fs";
|
|
10372
10599
|
function isWorkerHookRequest(msg) {
|
|
10373
10600
|
if (!msg || typeof msg !== "object")
|
|
10374
10601
|
return false;
|
|
@@ -10501,14 +10728,14 @@ function requestExistingWorkerShutdown(socketPath) {
|
|
|
10501
10728
|
function startWorkerServer(socketPath, shutdown) {
|
|
10502
10729
|
const server = createServer((socket) => handleConnection(socket, shutdown ?? (() => server.close())));
|
|
10503
10730
|
const listen = () => {
|
|
10504
|
-
if (
|
|
10731
|
+
if (existsSync18(socketPath)) {
|
|
10505
10732
|
try {
|
|
10506
10733
|
unlinkSync2(socketPath);
|
|
10507
10734
|
} catch {}
|
|
10508
10735
|
}
|
|
10509
10736
|
server.listen(socketPath);
|
|
10510
10737
|
};
|
|
10511
|
-
if (!
|
|
10738
|
+
if (!existsSync18(socketPath))
|
|
10512
10739
|
listen();
|
|
10513
10740
|
else
|
|
10514
10741
|
requestExistingWorkerShutdown(socketPath).then(listen, (err) => server.emit("error", err));
|
|
@@ -10524,21 +10751,21 @@ var init_worker_server = __esm(() => {
|
|
|
10524
10751
|
|
|
10525
10752
|
// bin/failproofai-worker.mjs
|
|
10526
10753
|
import { realpathSync as realpathSync2 } from "node:fs";
|
|
10527
|
-
import { dirname as
|
|
10754
|
+
import { dirname as dirname7, resolve as resolve15 } from "node:path";
|
|
10528
10755
|
import { fileURLToPath } from "node:url";
|
|
10529
10756
|
if (!process.env.FAILPROOFAI_PACKAGE_ROOT) {
|
|
10530
|
-
process.env.FAILPROOFAI_PACKAGE_ROOT =
|
|
10757
|
+
process.env.FAILPROOFAI_PACKAGE_ROOT = resolve15(dirname7(realpathSync2(fileURLToPath(import.meta.url))), "..");
|
|
10531
10758
|
}
|
|
10532
10759
|
if (!process.env.FAILPROOFAI_DIST_PATH) {
|
|
10533
|
-
process.env.FAILPROOFAI_DIST_PATH =
|
|
10760
|
+
process.env.FAILPROOFAI_DIST_PATH = resolve15(dirname7(realpathSync2(fileURLToPath(import.meta.url))), "..", "dist");
|
|
10534
10761
|
}
|
|
10535
10762
|
var socketPath = process.env.FAILPROOFAI_WORKER_SOCKET;
|
|
10536
10763
|
if (!socketPath) {
|
|
10537
10764
|
console.error("[failproofai-worker] FAILPROOFAI_WORKER_SOCKET is not set");
|
|
10538
10765
|
process.exit(1);
|
|
10539
10766
|
}
|
|
10540
|
-
|
|
10541
|
-
var server =
|
|
10767
|
+
await Promise.resolve().then(() => init_worker_server());
|
|
10768
|
+
var server = startWorkerServer(socketPath, shutdown);
|
|
10542
10769
|
server.on("error", (err) => {
|
|
10543
10770
|
console.error(`[failproofai-worker] server error: ${err.message}`);
|
|
10544
10771
|
process.exit(1);
|