failproofai 1.0.5 → 1.0.6-beta.0
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 +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +13 -13
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +13 -13
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js.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 +1 -1
- 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]__0sds_16._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
- package/.next/standalone/.next/server/chunks/_09dz7xv._.js +3 -3
- 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/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/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]__0s740oi._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__15k-dqb._.js → [root-of-the-server]__1i26dsw._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0sz_5na._.js → [root-of-the-server]__1ouobn4._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1p2otjt._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qapotl._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0-yi74u._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_1b78kcp._.js → _09hs6ms._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0guaevg._.js → _0lbwa8m._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0wso5d3._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1-3unkg._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1ddpc5g._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1es2j7i._.js +3 -3
- package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +3 -3
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_components_project-list_tsx_1ke6anr._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +2 -2
- 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_1hl81y4._.js +3 -0
- 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/middleware-build-manifest.js +5 -5
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +19 -19
- package/.next/standalone/.next/static/chunks/{3w46euc60dx39.js → 03n_qjih7-w6q.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2zafgs90r_leq.js → 06jxjnw8bfczc.js} +1 -1
- package/.next/standalone/.next/static/chunks/{252xreaecy80h.js → 0vanab2g65op_.js} +1 -1
- package/.next/standalone/.next/static/chunks/17pjz_h45j10c.js +1 -0
- package/.next/standalone/.next/static/chunks/1ekh-hj_iom84.js +1 -0
- package/.next/standalone/.next/static/chunks/{021ydrq6rhpsi.js → 1so_3s0q4c4j1.js} +1 -1
- package/.next/standalone/.next/static/chunks/1xacnwjkbekn7.js +1 -0
- package/.next/standalone/.next/static/chunks/2hg_bp8z_vm2g.js +1 -0
- package/.next/standalone/.next/static/chunks/{3bleyy40s99f2.js → 2u0kol_boahtv.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1vb33xa6j9y2q.js → 3_vesf83-0903.js} +1 -1
- package/.next/standalone/.next/static/chunks/3d3hzhcnns6ww.js +1 -0
- package/.next/standalone/.next/static/chunks/3iasus89n8mg1.js +6 -0
- package/.next/standalone/.next/static/chunks/{11s_v03ub6nss.js → 44_cj1_i_aa2z.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-3p73obe0xmrxm.js → turbopack-38nzuvp95_2rv.js} +1 -1
- package/.next/standalone/fp-cloud-cli/uv.lock +3 -3
- package/.next/standalone/hermes-plugin/README.md +133 -0
- package/.next/standalone/hermes-plugin/__init__.py +248 -0
- package/.next/standalone/hermes-plugin/client.py +134 -0
- package/.next/standalone/hermes-plugin/ledger.py +187 -0
- package/.next/standalone/hermes-plugin/plugin.yaml +37 -0
- 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/lib/patch-incorrect-lockfile.js +3 -3
- package/.next/standalone/node_modules/next/dist/server/app-render/create-component-styles-and-scripts.js +2 -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/image-optimizer.js +14 -0
- package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/lib/disk-lru-cache.external.js +7 -1
- package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/use-cache/use-cache-wrapper.js +6 -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 +10 -10
- package/.next/standalone/node_modules/react/cjs/react.development.js +92 -46
- package/.next/standalone/node_modules/react/cjs/react.production.js +112 -89
- package/.next/standalone/node_modules/react/package.json +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +1165 -790
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +1171 -791
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.production.js +1294 -862
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.edge.production.js +1305 -868
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.node.production.js +1315 -896
- package/.next/standalone/node_modules/react-dom/cjs/react-dom.production.js +24 -5
- package/.next/standalone/node_modules/react-dom/package.json +4 -4
- package/.next/standalone/package.json +13 -12
- package/.next/standalone/sdk/python/uv.lock +18 -18
- package/.next/standalone/server.js +1 -1
- package/README.md +29 -13
- package/bin/failproofai.mjs +3 -1
- package/dist/cli.mjs +420 -178
- package/dist/worker.mjs +17 -3
- package/hermes-plugin/README.md +133 -0
- package/hermes-plugin/__init__.py +248 -0
- package/hermes-plugin/client.py +134 -0
- package/hermes-plugin/ledger.py +187 -0
- package/hermes-plugin/plugin.yaml +37 -0
- package/package.json +13 -12
- package/scripts/translate-docs/validate-translation.ts +48 -0
- package/src/hooks/handler.ts +29 -1
- package/src/hooks/integrations.ts +264 -73
- package/src/hooks/manager.ts +17 -5
- package/src/hooks/types.ts +8 -8
- package/src/hooks/worker-server.ts +1 -0
- package/.next/standalone/.next/server/chunks/[externals]__157pf8j._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/node_modules_13n822a._.js +0 -3
- package/.next/standalone/.next/static/chunks/0y8_1s45gbqmn.js +0 -6
- package/.next/standalone/.next/static/chunks/14b3ezufe5411.js +0 -1
- package/.next/standalone/.next/static/chunks/1oskk7pdo8aon.js +0 -1
- package/.next/standalone/.next/static/chunks/2xycd6mjg00fb.js +0 -1
- package/.next/standalone/.next/static/chunks/3l36d73kj18zw.js +0 -1
- package/.next/standalone/.next/static/chunks/40lpt2o2b283e.js +0 -1
- /package/.next/standalone/.next/static/{uFpAs_vIXSo6qBzmkXPWD → -7OT2NwGPxAu-skEL_Xee}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{uFpAs_vIXSo6qBzmkXPWD → -7OT2NwGPxAu-skEL_Xee}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{uFpAs_vIXSo6qBzmkXPWD → -7OT2NwGPxAu-skEL_Xee}/_ssgManifest.js +0 -0
package/dist/cli.mjs
CHANGED
|
@@ -29,7 +29,7 @@ var __esm = (fn, res, err) => () => {
|
|
|
29
29
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
30
30
|
|
|
31
31
|
// package.json
|
|
32
|
-
var version2 = "1.0.
|
|
32
|
+
var version2 = "1.0.6-beta.0", package_default;
|
|
33
33
|
var init_package = __esm(() => {
|
|
34
34
|
package_default = {
|
|
35
35
|
name: "failproofai",
|
|
@@ -45,6 +45,7 @@ var init_package = __esm(() => {
|
|
|
45
45
|
"scripts/",
|
|
46
46
|
"lib/",
|
|
47
47
|
"pi-extension/",
|
|
48
|
+
"hermes-plugin/",
|
|
48
49
|
"openclaw-plugin/",
|
|
49
50
|
".next/standalone/",
|
|
50
51
|
"dist/",
|
|
@@ -113,15 +114,15 @@ var init_package = __esm(() => {
|
|
|
113
114
|
access: "public"
|
|
114
115
|
},
|
|
115
116
|
devDependencies: {
|
|
116
|
-
"@anthropic-ai/sdk": "^0.
|
|
117
|
+
"@anthropic-ai/sdk": "^0.125.0",
|
|
117
118
|
"@mdx-js/mdx": "^3.1.1",
|
|
118
119
|
"@tailwindcss/postcss": "^4.3.1",
|
|
119
120
|
"@tanstack/react-virtual": "^3.14.10",
|
|
120
121
|
"@testing-library/jest-dom": "^7.0.0",
|
|
121
122
|
"@testing-library/react": "^16.3.2",
|
|
122
123
|
"@testing-library/user-event": "^14.6.5",
|
|
123
|
-
"@types/node": "26.
|
|
124
|
-
"@types/react": "19.
|
|
124
|
+
"@types/node": "26.5.1",
|
|
125
|
+
"@types/react": "19.3.0",
|
|
125
126
|
"@types/react-dom": "^19.2.3",
|
|
126
127
|
"@vitejs/plugin-react": "^6.1.0",
|
|
127
128
|
clsx: "^2.1.1",
|
|
@@ -154,16 +155,16 @@ var init_package = __esm(() => {
|
|
|
154
155
|
browserslist: "4.28.8"
|
|
155
156
|
},
|
|
156
157
|
optionalDependencies: {
|
|
157
|
-
"@failproofai/failproofaid-linux-x64": "1.0.
|
|
158
|
-
"@failproofai/failproofaid-linux-arm64": "1.0.
|
|
159
|
-
"@failproofai/failproofaid-darwin-x64": "1.0.
|
|
160
|
-
"@failproofai/failproofaid-darwin-arm64": "1.0.
|
|
158
|
+
"@failproofai/failproofaid-linux-x64": "1.0.6-beta.0",
|
|
159
|
+
"@failproofai/failproofaid-linux-arm64": "1.0.6-beta.0",
|
|
160
|
+
"@failproofai/failproofaid-darwin-x64": "1.0.6-beta.0",
|
|
161
|
+
"@failproofai/failproofaid-darwin-arm64": "1.0.6-beta.0"
|
|
161
162
|
},
|
|
162
163
|
failproofaidBinaries: {
|
|
163
|
-
"linux-x64": "
|
|
164
|
-
"linux-arm64": "
|
|
165
|
-
"darwin-x64": "
|
|
166
|
-
"darwin-arm64": "
|
|
164
|
+
"linux-x64": "38637a91db9a0e5683bbfbfffbba3d65e421960c3135510f23541df5f9d60478",
|
|
165
|
+
"linux-arm64": "b9a2d9126fb9816b7743ec5b068d36d6515fa3a93fc2e3801fbe3a7a1b2143bf",
|
|
166
|
+
"darwin-x64": "a06675cd28b3d2f54d45a28f527643841a69006dd68f989dad654806b190948b",
|
|
167
|
+
"darwin-arm64": "6ef65b956ebff944c38cf2d65b6dc1066384aba7952d7d19c4805c1f1ba593ba"
|
|
167
168
|
}
|
|
168
169
|
};
|
|
169
170
|
});
|
|
@@ -5101,36 +5102,38 @@ var require_Alias = __commonJS(function(exports) {
|
|
|
5101
5102
|
if (node.anchor === this.source)
|
|
5102
5103
|
found = node;
|
|
5103
5104
|
}
|
|
5105
|
+
if (found && ctx) {
|
|
5106
|
+
const { anchors, doc, maxAliasCount } = ctx;
|
|
5107
|
+
let data = anchors.get(found);
|
|
5108
|
+
if (!data) {
|
|
5109
|
+
toJS.toJS(found, null, ctx);
|
|
5110
|
+
data = anchors.get(found);
|
|
5111
|
+
}
|
|
5112
|
+
if (data?.res === undefined) {
|
|
5113
|
+
const msg = "This should not happen: Alias anchor was not resolved?";
|
|
5114
|
+
throw new ReferenceError(msg);
|
|
5115
|
+
}
|
|
5116
|
+
if (maxAliasCount >= 0) {
|
|
5117
|
+
data.count += 1;
|
|
5118
|
+
if (data.aliasCount === 0)
|
|
5119
|
+
data.aliasCount = getAliasCount(doc, found, anchors);
|
|
5120
|
+
if (data.count * data.aliasCount > maxAliasCount) {
|
|
5121
|
+
const msg = "Excessive alias count indicates a resource exhaustion attack";
|
|
5122
|
+
throw new ReferenceError(msg);
|
|
5123
|
+
}
|
|
5124
|
+
}
|
|
5125
|
+
}
|
|
5104
5126
|
return found;
|
|
5105
5127
|
}
|
|
5106
5128
|
toJSON(_arg, ctx) {
|
|
5107
5129
|
if (!ctx)
|
|
5108
5130
|
return { source: this.source };
|
|
5109
|
-
const
|
|
5110
|
-
const source = this.resolve(doc, ctx);
|
|
5131
|
+
const source = this.resolve(ctx.doc, ctx);
|
|
5111
5132
|
if (!source) {
|
|
5112
5133
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
5113
5134
|
throw new ReferenceError(msg);
|
|
5114
5135
|
}
|
|
5115
|
-
|
|
5116
|
-
if (!data) {
|
|
5117
|
-
toJS.toJS(source, null, ctx);
|
|
5118
|
-
data = anchors.get(source);
|
|
5119
|
-
}
|
|
5120
|
-
if (data?.res === undefined) {
|
|
5121
|
-
const msg = "This should not happen: Alias anchor was not resolved?";
|
|
5122
|
-
throw new ReferenceError(msg);
|
|
5123
|
-
}
|
|
5124
|
-
if (maxAliasCount >= 0) {
|
|
5125
|
-
data.count += 1;
|
|
5126
|
-
if (data.aliasCount === 0)
|
|
5127
|
-
data.aliasCount = getAliasCount(doc, source, anchors);
|
|
5128
|
-
if (data.count * data.aliasCount > maxAliasCount) {
|
|
5129
|
-
const msg = "Excessive alias count indicates a resource exhaustion attack";
|
|
5130
|
-
throw new ReferenceError(msg);
|
|
5131
|
-
}
|
|
5132
|
-
}
|
|
5133
|
-
return data.res;
|
|
5136
|
+
return ctx.anchors.get(source).res;
|
|
5134
5137
|
}
|
|
5135
5138
|
toString(ctx, _onComment, _onChompKeep) {
|
|
5136
5139
|
const src = `*${this.source}`;
|
|
@@ -8892,33 +8895,32 @@ var require_resolve_flow_scalar = __commonJS(function(exports) {
|
|
|
8892
8895
|
}
|
|
8893
8896
|
if (badChar)
|
|
8894
8897
|
onError(0, "BAD_SCALAR_START", `Plain value cannot start with ${badChar}`);
|
|
8895
|
-
return
|
|
8898
|
+
return unfoldLines(source);
|
|
8896
8899
|
}
|
|
8897
8900
|
function singleQuotedValue(source, onError) {
|
|
8898
8901
|
if (source[source.length - 1] !== "'" || source.length === 1)
|
|
8899
8902
|
onError(source.length, "MISSING_CHAR", "Missing closing 'quote");
|
|
8900
|
-
return
|
|
8903
|
+
return unfoldLines(source.slice(1, -1)).replace(/''/g, "'");
|
|
8901
8904
|
}
|
|
8902
|
-
function
|
|
8903
|
-
|
|
8905
|
+
function unfoldLines(source) {
|
|
8906
|
+
const line = /(.*?)\r?\n/sy;
|
|
8907
|
+
let match = line.exec(source);
|
|
8908
|
+
if (!match)
|
|
8909
|
+
return source;
|
|
8910
|
+
let trimEnd, trimBoth;
|
|
8904
8911
|
try {
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
line = new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
8908
|
-
`, "sy");
|
|
8912
|
+
trimEnd = new RegExp("(?<![ \t])[ \t]+$");
|
|
8913
|
+
trimBoth = new RegExp("^[ \t]+|(?<![ \t])[ \t]+$", "g");
|
|
8909
8914
|
} catch {
|
|
8910
|
-
|
|
8911
|
-
|
|
8915
|
+
trimEnd = /[ \t]+$/;
|
|
8916
|
+
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
8912
8917
|
}
|
|
8913
|
-
let
|
|
8914
|
-
if (!match)
|
|
8915
|
-
return source;
|
|
8916
|
-
let res = match[1];
|
|
8918
|
+
let res = match[1].replace(trimEnd, "");
|
|
8917
8919
|
let sep = " ";
|
|
8918
|
-
let pos =
|
|
8919
|
-
line.lastIndex = pos;
|
|
8920
|
+
let pos = line.lastIndex;
|
|
8920
8921
|
while (match = line.exec(source)) {
|
|
8921
|
-
|
|
8922
|
+
const lm = match[1].replace(trimBoth, "");
|
|
8923
|
+
if (lm === "") {
|
|
8922
8924
|
if (sep === `
|
|
8923
8925
|
`)
|
|
8924
8926
|
res += sep;
|
|
@@ -8926,7 +8928,7 @@ var require_resolve_flow_scalar = __commonJS(function(exports) {
|
|
|
8926
8928
|
sep = `
|
|
8927
8929
|
`;
|
|
8928
8930
|
} else {
|
|
8929
|
-
res += sep +
|
|
8931
|
+
res += sep + lm;
|
|
8930
8932
|
sep = " ";
|
|
8931
8933
|
}
|
|
8932
8934
|
pos = line.lastIndex;
|
|
@@ -11619,7 +11621,17 @@ var init_openclaw_profiles = () => {};
|
|
|
11619
11621
|
|
|
11620
11622
|
// src/hooks/integrations.ts
|
|
11621
11623
|
import { execSync as execSync3 } from "node:child_process";
|
|
11622
|
-
import {
|
|
11624
|
+
import {
|
|
11625
|
+
cpSync,
|
|
11626
|
+
readFileSync as readFileSync5,
|
|
11627
|
+
writeFileSync as writeFileSync3,
|
|
11628
|
+
existsSync as existsSync7,
|
|
11629
|
+
lstatSync,
|
|
11630
|
+
mkdirSync as mkdirSync4,
|
|
11631
|
+
renameSync as renameSync2,
|
|
11632
|
+
rmSync as rmSync2,
|
|
11633
|
+
unlinkSync
|
|
11634
|
+
} from "node:fs";
|
|
11623
11635
|
import { resolve as resolve8, dirname as dirname5 } from "node:path";
|
|
11624
11636
|
import { fileURLToPath } from "node:url";
|
|
11625
11637
|
import { homedir as homedir6 } from "node:os";
|
|
@@ -11921,19 +11933,125 @@ function makePiProjectRelativeEntry(extPath) {
|
|
|
11921
11933
|
}
|
|
11922
11934
|
return extResolved;
|
|
11923
11935
|
}
|
|
11924
|
-
function
|
|
11925
|
-
|
|
11926
|
-
|
|
11936
|
+
function getHermesPluginSourcePath() {
|
|
11937
|
+
const fromEnv = process.env.FAILPROOFAI_PACKAGE_ROOT;
|
|
11938
|
+
if (fromEnv)
|
|
11939
|
+
return resolve8(fromEnv, "hermes-plugin");
|
|
11940
|
+
return resolve8(fileURLToPath(import.meta.url), "..", "..", "..", "hermes-plugin");
|
|
11941
|
+
}
|
|
11942
|
+
function hermesPluginPathForSettings(settingsPath) {
|
|
11943
|
+
return resolve8(dirname5(settingsPath), "plugins", HERMES_PLUGIN_ID);
|
|
11944
|
+
}
|
|
11945
|
+
function hasManagedHermesPlugin(settingsPath) {
|
|
11946
|
+
const pluginPath = hermesPluginPathForSettings(settingsPath);
|
|
11927
11947
|
try {
|
|
11928
|
-
|
|
11929
|
-
const js = doc.toJS() ?? {};
|
|
11930
|
-
const hooks = js.hooks;
|
|
11931
|
-
if (!hooks || typeof hooks !== "object")
|
|
11948
|
+
if (lstatSync(pluginPath).isSymbolicLink())
|
|
11932
11949
|
return false;
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11950
|
+
if (!existsSync7(resolve8(pluginPath, HERMES_PLUGIN_MARKER)))
|
|
11951
|
+
return false;
|
|
11952
|
+
return HERMES_PLUGIN_FILES.every((file) => existsSync7(resolve8(pluginPath, file)));
|
|
11953
|
+
} catch {
|
|
11954
|
+
return false;
|
|
11955
|
+
}
|
|
11956
|
+
}
|
|
11957
|
+
function hasHermesPluginMarker(settingsPath) {
|
|
11958
|
+
const pluginPath = hermesPluginPathForSettings(settingsPath);
|
|
11959
|
+
try {
|
|
11960
|
+
return !lstatSync(pluginPath).isSymbolicLink() && existsSync7(resolve8(pluginPath, HERMES_PLUGIN_MARKER));
|
|
11961
|
+
} catch {
|
|
11962
|
+
return false;
|
|
11963
|
+
}
|
|
11964
|
+
}
|
|
11965
|
+
function installHermesPlugin(settingsPath) {
|
|
11966
|
+
const source = getHermesPluginSourcePath();
|
|
11967
|
+
for (const file of HERMES_PLUGIN_FILES) {
|
|
11968
|
+
if (!existsSync7(resolve8(source, file))) {
|
|
11969
|
+
throw new Error(`Hermes plugin asset is missing from the failproofai package: ${file}`);
|
|
11936
11970
|
}
|
|
11971
|
+
}
|
|
11972
|
+
const destination = hermesPluginPathForSettings(settingsPath);
|
|
11973
|
+
if (existsSync7(destination)) {
|
|
11974
|
+
if (lstatSync(destination).isSymbolicLink() || !existsSync7(resolve8(destination, HERMES_PLUGIN_MARKER))) {
|
|
11975
|
+
throw new Error(`Refusing to overwrite an unmanaged Hermes plugin at ${destination}. ` + `Move it aside or install FailproofAI under a different Hermes profile.`);
|
|
11976
|
+
}
|
|
11977
|
+
}
|
|
11978
|
+
mkdirSync4(dirname5(destination), { recursive: true });
|
|
11979
|
+
const suffix = `${process.pid}-${Date.now()}`;
|
|
11980
|
+
const temporary = `${destination}.install-${suffix}`;
|
|
11981
|
+
const backup = `${destination}.backup-${suffix}`;
|
|
11982
|
+
let movedExisting = false;
|
|
11983
|
+
try {
|
|
11984
|
+
mkdirSync4(temporary, { recursive: true });
|
|
11985
|
+
for (const file of HERMES_PLUGIN_FILES) {
|
|
11986
|
+
cpSync(resolve8(source, file), resolve8(temporary, file));
|
|
11987
|
+
}
|
|
11988
|
+
writeFileSync3(resolve8(temporary, HERMES_PLUGIN_MARKER), "Managed by failproofai. Remove with `failproofai policies --uninstall --cli hermes`.\n", { encoding: "utf8", mode: 384 });
|
|
11989
|
+
if (existsSync7(destination)) {
|
|
11990
|
+
renameSync2(destination, backup);
|
|
11991
|
+
movedExisting = true;
|
|
11992
|
+
}
|
|
11993
|
+
renameSync2(temporary, destination);
|
|
11994
|
+
if (movedExisting)
|
|
11995
|
+
rmSync2(backup, { recursive: true, force: true });
|
|
11996
|
+
} catch (err) {
|
|
11997
|
+
rmSync2(temporary, { recursive: true, force: true });
|
|
11998
|
+
if (movedExisting && !existsSync7(destination) && existsSync7(backup)) {
|
|
11999
|
+
renameSync2(backup, destination);
|
|
12000
|
+
}
|
|
12001
|
+
throw err;
|
|
12002
|
+
}
|
|
12003
|
+
}
|
|
12004
|
+
function removeManagedHermesPlugin(settingsPath) {
|
|
12005
|
+
const pluginPath = hermesPluginPathForSettings(settingsPath);
|
|
12006
|
+
if (!hasHermesPluginMarker(settingsPath))
|
|
12007
|
+
return false;
|
|
12008
|
+
rmSync2(pluginPath, { recursive: true, force: true });
|
|
12009
|
+
return true;
|
|
12010
|
+
}
|
|
12011
|
+
function removeLegacyHermesHooks(doc) {
|
|
12012
|
+
const js = doc.toJS() ?? {};
|
|
12013
|
+
const hooks = js.hooks;
|
|
12014
|
+
let removed = 0;
|
|
12015
|
+
if (hooks && typeof hooks === "object") {
|
|
12016
|
+
for (const eventType of Object.keys(hooks)) {
|
|
12017
|
+
const entries = hooks[eventType];
|
|
12018
|
+
if (!Array.isArray(entries))
|
|
12019
|
+
continue;
|
|
12020
|
+
const before = entries.length;
|
|
12021
|
+
const filtered = entries.filter((hook) => !isMarkedHook(hook));
|
|
12022
|
+
removed += before - filtered.length;
|
|
12023
|
+
if (filtered.length === 0)
|
|
12024
|
+
delete hooks[eventType];
|
|
12025
|
+
else
|
|
12026
|
+
hooks[eventType] = filtered;
|
|
12027
|
+
}
|
|
12028
|
+
if (Object.keys(hooks).length === 0) {
|
|
12029
|
+
doc.delete("hooks");
|
|
12030
|
+
if (removed > 0)
|
|
12031
|
+
doc.delete("hooks_auto_accept");
|
|
12032
|
+
} else {
|
|
12033
|
+
doc.set("hooks", hooks);
|
|
12034
|
+
}
|
|
12035
|
+
}
|
|
12036
|
+
return removed;
|
|
12037
|
+
}
|
|
12038
|
+
function hermesConfigState(settingsPath) {
|
|
12039
|
+
if (!existsSync7(settingsPath)) {
|
|
12040
|
+
return { pluginEnabled: false, legacyShellHookPresent: false };
|
|
12041
|
+
}
|
|
12042
|
+
const doc = readYamlDoc(settingsPath);
|
|
12043
|
+
const js = doc.toJS() ?? {};
|
|
12044
|
+
const enabled = js.plugins?.enabled;
|
|
12045
|
+
const legacyShellHookPresent = !!js.hooks && typeof js.hooks === "object" && Object.values(js.hooks).some((entries) => Array.isArray(entries) && entries.some((entry) => isMarkedHook(entry)));
|
|
12046
|
+
return {
|
|
12047
|
+
pluginEnabled: Array.isArray(enabled) && enabled.includes(HERMES_PLUGIN_ID),
|
|
12048
|
+
legacyShellHookPresent
|
|
12049
|
+
};
|
|
12050
|
+
}
|
|
12051
|
+
function hermesConfigHasHooks(settingsPath) {
|
|
12052
|
+
try {
|
|
12053
|
+
const state = hermesConfigState(settingsPath);
|
|
12054
|
+
return state.pluginEnabled && hasManagedHermesPlugin(settingsPath) && !state.legacyShellHookPresent;
|
|
11937
12055
|
} catch {}
|
|
11938
12056
|
return false;
|
|
11939
12057
|
}
|
|
@@ -11967,7 +12085,7 @@ function listInstallableIds() {
|
|
|
11967
12085
|
function detectInstalledClis() {
|
|
11968
12086
|
return INTEGRATION_TYPES.filter((id) => INTEGRATIONS[id]?.detectInstalled());
|
|
11969
12087
|
}
|
|
11970
|
-
var claudeCode, codex, copilot, cursor, OPENCODE_PLUGIN_REL_PATH = "./plugins/failproofai.mjs", opencode, pi, hermes, OPENCLAW_PLUGIN_ID = "failproofai", openclaw, factory, devin, ANTIGRAVITY_HOOK_NAME = "failproofai", ANTIGRAVITY_TOOL_EVENTS, antigravity, goose, INTEGRATIONS;
|
|
12088
|
+
var claudeCode, codex, copilot, cursor, OPENCODE_PLUGIN_REL_PATH = "./plugins/failproofai.mjs", opencode, pi, HERMES_PLUGIN_ID = "failproofai", HERMES_PLUGIN_MARKER = ".failproofai-managed", HERMES_PLUGIN_FILES, hermes, OPENCLAW_PLUGIN_ID = "failproofai", openclaw, factory, devin, ANTIGRAVITY_HOOK_NAME = "failproofai", ANTIGRAVITY_TOOL_EVENTS, antigravity, goose, INTEGRATIONS;
|
|
11971
12089
|
var init_integrations = __esm(() => {
|
|
11972
12090
|
init_dist();
|
|
11973
12091
|
init_hermes_profiles();
|
|
@@ -12620,6 +12738,7 @@ var init_integrations = __esm(() => {
|
|
|
12620
12738
|
return binaryExists("pi");
|
|
12621
12739
|
}
|
|
12622
12740
|
};
|
|
12741
|
+
HERMES_PLUGIN_FILES = ["plugin.yaml", "__init__.py", "client.py", "ledger.py"];
|
|
12623
12742
|
hermes = {
|
|
12624
12743
|
id: "hermes",
|
|
12625
12744
|
displayName: "Hermes",
|
|
@@ -12637,62 +12756,62 @@ var init_integrations = __esm(() => {
|
|
|
12637
12756
|
writeSettings(settingsPath, settings) {
|
|
12638
12757
|
writeYamlDoc(settingsPath, settings);
|
|
12639
12758
|
},
|
|
12640
|
-
|
|
12641
|
-
|
|
12759
|
+
prepareInstall(settingsPath) {
|
|
12760
|
+
installHermesPlugin(settingsPath);
|
|
12761
|
+
},
|
|
12762
|
+
buildHookEntry(_binaryPath, _eventType, _scope) {
|
|
12642
12763
|
return {
|
|
12643
|
-
|
|
12644
|
-
|
|
12645
|
-
[FAILPROOFAI_HOOK_MARKER]: true
|
|
12764
|
+
[FAILPROOFAI_HOOK_MARKER]: true,
|
|
12765
|
+
_hermesPluginPath: getHermesPluginSourcePath()
|
|
12646
12766
|
};
|
|
12647
12767
|
},
|
|
12648
12768
|
isFailproofaiHook: isMarkedHook,
|
|
12649
|
-
writeHookEntries(settings
|
|
12769
|
+
writeHookEntries(settings) {
|
|
12650
12770
|
const doc = settings;
|
|
12771
|
+
removeLegacyHermesHooks(doc);
|
|
12651
12772
|
const js = doc.toJS() ?? {};
|
|
12652
|
-
const
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
|
-
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
doc.set("hooks", hooks);
|
|
12664
|
-
doc.set("hooks_auto_accept", true);
|
|
12773
|
+
const plugins = js.plugins && typeof js.plugins === "object" ? js.plugins : {};
|
|
12774
|
+
const enabled = Array.isArray(plugins.enabled) ? [...plugins.enabled] : [];
|
|
12775
|
+
if (!enabled.includes(HERMES_PLUGIN_ID))
|
|
12776
|
+
enabled.push(HERMES_PLUGIN_ID);
|
|
12777
|
+
plugins.enabled = enabled;
|
|
12778
|
+
if (Array.isArray(plugins.disabled)) {
|
|
12779
|
+
plugins.disabled = plugins.disabled.filter((name) => name !== HERMES_PLUGIN_ID);
|
|
12780
|
+
if (plugins.disabled.length === 0)
|
|
12781
|
+
delete plugins.disabled;
|
|
12782
|
+
}
|
|
12783
|
+
doc.set("plugins", plugins);
|
|
12665
12784
|
},
|
|
12666
12785
|
removeHooksFromFile(settingsPath) {
|
|
12667
|
-
if (!existsSync7(settingsPath))
|
|
12668
|
-
return 0;
|
|
12669
12786
|
const doc = readYamlDoc(settingsPath);
|
|
12787
|
+
let removed = removeLegacyHermesHooks(doc);
|
|
12670
12788
|
const js = doc.toJS() ?? {};
|
|
12671
|
-
const
|
|
12672
|
-
let
|
|
12673
|
-
if (
|
|
12674
|
-
|
|
12675
|
-
const
|
|
12676
|
-
|
|
12677
|
-
|
|
12678
|
-
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
if (
|
|
12682
|
-
delete
|
|
12683
|
-
else
|
|
12684
|
-
hooks[eventType] = filtered;
|
|
12789
|
+
const plugins = js.plugins;
|
|
12790
|
+
let configChanged = removed > 0;
|
|
12791
|
+
if (plugins && typeof plugins === "object") {
|
|
12792
|
+
if (Array.isArray(plugins.enabled)) {
|
|
12793
|
+
const before = plugins.enabled.length;
|
|
12794
|
+
plugins.enabled = plugins.enabled.filter((name) => name !== HERMES_PLUGIN_ID);
|
|
12795
|
+
if (plugins.enabled.length !== before) {
|
|
12796
|
+
removed += 1;
|
|
12797
|
+
configChanged = true;
|
|
12798
|
+
}
|
|
12799
|
+
if (plugins.enabled.length === 0)
|
|
12800
|
+
delete plugins.enabled;
|
|
12685
12801
|
}
|
|
12686
|
-
if (
|
|
12687
|
-
|
|
12688
|
-
|
|
12689
|
-
else
|
|
12690
|
-
doc.set("hooks", hooks);
|
|
12802
|
+
if (plugins.entries && HERMES_PLUGIN_ID in plugins.entries) {
|
|
12803
|
+
delete plugins.entries[HERMES_PLUGIN_ID];
|
|
12804
|
+
configChanged = true;
|
|
12691
12805
|
}
|
|
12806
|
+
if (Object.keys(plugins).length === 0)
|
|
12807
|
+
doc.delete("plugins");
|
|
12808
|
+
else
|
|
12809
|
+
doc.set("plugins", plugins);
|
|
12692
12810
|
}
|
|
12693
|
-
|
|
12694
|
-
if (removed > 0 || droppedAutoAccept)
|
|
12811
|
+
if (configChanged)
|
|
12695
12812
|
writeYamlDoc(settingsPath, doc);
|
|
12813
|
+
if (removeManagedHermesPlugin(settingsPath))
|
|
12814
|
+
removed += 1;
|
|
12696
12815
|
return removed;
|
|
12697
12816
|
},
|
|
12698
12817
|
hooksInstalledInSettings(scope, cwd) {
|
|
@@ -14883,7 +15002,7 @@ var init_pack_cli = __esm(() => {
|
|
|
14883
15002
|
|
|
14884
15003
|
// src/hooks/pack-store.ts
|
|
14885
15004
|
import { createHash as createHash5 } from "node:crypto";
|
|
14886
|
-
import { existsSync as existsSync9, mkdirSync as mkdirSync5, readFileSync as readFileSync6, renameSync as
|
|
15005
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync5, readFileSync as readFileSync6, renameSync as renameSync3, rmSync as rmSync3, writeFileSync as writeFileSync4 } from "node:fs";
|
|
14887
15006
|
import { dirname as dirname7, resolve as resolve11 } from "node:path";
|
|
14888
15007
|
function baseUrl() {
|
|
14889
15008
|
return (process.env.FAILPROOFAI_PACK_BASE_URL || DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
@@ -15057,9 +15176,9 @@ function writeAtomic(target, bytes) {
|
|
|
15057
15176
|
try {
|
|
15058
15177
|
mkdirSync5(dirname7(target), { recursive: true });
|
|
15059
15178
|
writeFileSync4(tempPath, bytes);
|
|
15060
|
-
|
|
15179
|
+
renameSync3(tempPath, target);
|
|
15061
15180
|
} catch (err) {
|
|
15062
|
-
|
|
15181
|
+
rmSync3(tempPath, { force: true });
|
|
15063
15182
|
throw err;
|
|
15064
15183
|
}
|
|
15065
15184
|
}
|
|
@@ -16178,7 +16297,7 @@ import {
|
|
|
16178
16297
|
readFileSync as readFileSync7,
|
|
16179
16298
|
writeFileSync as writeFileSync5,
|
|
16180
16299
|
appendFileSync as appendFileSync2,
|
|
16181
|
-
renameSync as
|
|
16300
|
+
renameSync as renameSync4,
|
|
16182
16301
|
readdirSync as readdirSync4,
|
|
16183
16302
|
mkdirSync as mkdirSync6,
|
|
16184
16303
|
existsSync as existsSync10,
|
|
@@ -16243,7 +16362,7 @@ function persistHookActivity(entry) {
|
|
|
16243
16362
|
function rotate(currentPath, countPath) {
|
|
16244
16363
|
const archiveName = `page-${Date.now()}-${rotateSeq++}.jsonl`;
|
|
16245
16364
|
const archivePath = join6(storeDirValue(), archiveName);
|
|
16246
|
-
|
|
16365
|
+
renameSync4(currentPath, archivePath);
|
|
16247
16366
|
writeCount(countPath, 0);
|
|
16248
16367
|
}
|
|
16249
16368
|
function readCount(countPath) {
|
|
@@ -16289,7 +16408,7 @@ function writeStoredStats(s) {
|
|
|
16289
16408
|
const tmpPath = join6(storeDirValue(), `stats.json.${process.pid}.tmp`);
|
|
16290
16409
|
try {
|
|
16291
16410
|
writeFileSync5(tmpPath, JSON.stringify(s), "utf-8");
|
|
16292
|
-
|
|
16411
|
+
renameSync4(tmpPath, join6(storeDirValue(), STATS_FILE));
|
|
16293
16412
|
return true;
|
|
16294
16413
|
} catch {
|
|
16295
16414
|
try {
|
|
@@ -21444,8 +21563,8 @@ import {
|
|
|
21444
21563
|
chmodSync as chmodSync2,
|
|
21445
21564
|
existsSync as existsSync18,
|
|
21446
21565
|
mkdirSync as mkdirSync8,
|
|
21447
|
-
renameSync as
|
|
21448
|
-
rmSync as
|
|
21566
|
+
renameSync as renameSync5,
|
|
21567
|
+
rmSync as rmSync4,
|
|
21449
21568
|
statSync as statSync15,
|
|
21450
21569
|
writeFileSync as writeFileSync7
|
|
21451
21570
|
} from "node:fs";
|
|
@@ -21464,14 +21583,14 @@ function writeJsonAtomically(filePath, value, opts = {}) {
|
|
|
21464
21583
|
if ((statSync15(tmp).mode & 63) !== 0)
|
|
21465
21584
|
chmodSync2(tmp, mode);
|
|
21466
21585
|
} catch {}
|
|
21467
|
-
|
|
21586
|
+
renameSync5(tmp, filePath);
|
|
21468
21587
|
try {
|
|
21469
21588
|
if ((statSync15(filePath).mode & 63) !== 0)
|
|
21470
21589
|
chmodSync2(filePath, mode);
|
|
21471
21590
|
} catch {}
|
|
21472
21591
|
} catch (err) {
|
|
21473
21592
|
try {
|
|
21474
|
-
|
|
21593
|
+
rmSync4(tmp, { force: true });
|
|
21475
21594
|
} catch {}
|
|
21476
21595
|
throw err;
|
|
21477
21596
|
}
|
|
@@ -21479,7 +21598,7 @@ function writeJsonAtomically(filePath, value, opts = {}) {
|
|
|
21479
21598
|
var init_atomic_write = () => {};
|
|
21480
21599
|
|
|
21481
21600
|
// src/hooks/session-pause.ts
|
|
21482
|
-
import { existsSync as existsSync19, mkdirSync as mkdirSync9, readdirSync as readdirSync13, readFileSync as readFileSync15, rmSync as
|
|
21601
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync9, readdirSync as readdirSync13, readFileSync as readFileSync15, rmSync as rmSync5 } from "node:fs";
|
|
21483
21602
|
import { createHash as createHash6 } from "node:crypto";
|
|
21484
21603
|
import { join as join30, resolve as resolve16 } from "node:path";
|
|
21485
21604
|
function pauseStateDir() {
|
|
@@ -21580,7 +21699,7 @@ function clearPause(sessionId) {
|
|
|
21580
21699
|
if (!existsSync19(path))
|
|
21581
21700
|
return false;
|
|
21582
21701
|
try {
|
|
21583
|
-
|
|
21702
|
+
rmSync5(path);
|
|
21584
21703
|
return true;
|
|
21585
21704
|
} catch {
|
|
21586
21705
|
return false;
|
|
@@ -21646,8 +21765,8 @@ import {
|
|
|
21646
21765
|
mkdirSync as mkdirSync10,
|
|
21647
21766
|
readdirSync as readdirSync14,
|
|
21648
21767
|
readFileSync as readFileSync16,
|
|
21649
|
-
renameSync as
|
|
21650
|
-
rmSync as
|
|
21768
|
+
renameSync as renameSync6,
|
|
21769
|
+
rmSync as rmSync6,
|
|
21651
21770
|
statSync as statSync16,
|
|
21652
21771
|
writeFileSync as writeFileSync8
|
|
21653
21772
|
} from "node:fs";
|
|
@@ -21706,7 +21825,7 @@ function pruneOldDaemonBinaries(keep = 2) {
|
|
|
21706
21825
|
}).sort((a, b) => b.mtime - a.mtime);
|
|
21707
21826
|
for (const stale of entries.slice(keep)) {
|
|
21708
21827
|
try {
|
|
21709
|
-
|
|
21828
|
+
rmSync6(stale.full, { force: true });
|
|
21710
21829
|
removed.push(stale.full);
|
|
21711
21830
|
} catch {}
|
|
21712
21831
|
}
|
|
@@ -21720,10 +21839,10 @@ function installBinaryBytes(binary) {
|
|
|
21720
21839
|
mkdirSync10(daemonBinaryDir(), { recursive: true });
|
|
21721
21840
|
writeFileSync8(tempPath, binary);
|
|
21722
21841
|
chmodSync3(tempPath, 493);
|
|
21723
|
-
|
|
21842
|
+
renameSync6(tempPath, target);
|
|
21724
21843
|
return target;
|
|
21725
21844
|
} catch (err) {
|
|
21726
|
-
|
|
21845
|
+
rmSync6(tempPath, { force: true });
|
|
21727
21846
|
throw err;
|
|
21728
21847
|
}
|
|
21729
21848
|
}
|
|
@@ -21941,7 +22060,7 @@ import {
|
|
|
21941
22060
|
readFileSync as readFileSync17,
|
|
21942
22061
|
writeFileSync as writeFileSync9,
|
|
21943
22062
|
unlinkSync as unlinkSync3,
|
|
21944
|
-
rmSync as
|
|
22063
|
+
rmSync as rmSync7
|
|
21945
22064
|
} from "node:fs";
|
|
21946
22065
|
import { homedir as homedir22, tmpdir as tmpdir2, userInfo } from "node:os";
|
|
21947
22066
|
import { resolve as resolve18 } from "node:path";
|
|
@@ -22120,7 +22239,7 @@ function writePrivilegedFile(destination, contents, mode = "0644") {
|
|
|
22120
22239
|
writeFileSync9(staging, contents, "utf8");
|
|
22121
22240
|
runPrivileged("install", ["-m", mode, staging, destination]);
|
|
22122
22241
|
} finally {
|
|
22123
|
-
|
|
22242
|
+
rmSync7(stagingDir, { recursive: true, force: true });
|
|
22124
22243
|
}
|
|
22125
22244
|
}
|
|
22126
22245
|
function removeLegacyUserService() {
|
|
@@ -22597,8 +22716,8 @@ import {
|
|
|
22597
22716
|
mkdirSync as mkdirSync12,
|
|
22598
22717
|
readFileSync as readFileSync18,
|
|
22599
22718
|
readdirSync as readdirSync15,
|
|
22600
|
-
renameSync as
|
|
22601
|
-
rmSync as
|
|
22719
|
+
renameSync as renameSync7,
|
|
22720
|
+
rmSync as rmSync8,
|
|
22602
22721
|
rmdirSync,
|
|
22603
22722
|
statSync as statSync17,
|
|
22604
22723
|
writeFileSync as writeFileSync10
|
|
@@ -22629,7 +22748,7 @@ function migrateConventionPolicies() {
|
|
|
22629
22748
|
const name = `${prefix}${entry.name}`;
|
|
22630
22749
|
if (!existsSync23(target)) {
|
|
22631
22750
|
try {
|
|
22632
|
-
|
|
22751
|
+
renameSync7(source, target);
|
|
22633
22752
|
moved.push(name);
|
|
22634
22753
|
} catch {}
|
|
22635
22754
|
continue;
|
|
@@ -22666,7 +22785,7 @@ function migrateLegacySpool() {
|
|
|
22666
22785
|
while (existsSync23(resolve19(to, name)))
|
|
22667
22786
|
name = `legacy-${n++}-${entry.name}`;
|
|
22668
22787
|
try {
|
|
22669
|
-
|
|
22788
|
+
renameSync7(resolve19(from, entry.name), resolve19(to, name));
|
|
22670
22789
|
moved.push(name);
|
|
22671
22790
|
} catch {
|
|
22672
22791
|
try {
|
|
@@ -22701,7 +22820,7 @@ function migrateHookActivity() {
|
|
|
22701
22820
|
target = resolve19(to, name);
|
|
22702
22821
|
}
|
|
22703
22822
|
try {
|
|
22704
|
-
|
|
22823
|
+
renameSync7(source, target);
|
|
22705
22824
|
moved.push(name);
|
|
22706
22825
|
} catch {
|
|
22707
22826
|
try {
|
|
@@ -22736,7 +22855,7 @@ function retirePolicyConfigKeys() {
|
|
|
22736
22855
|
delete parsed[key];
|
|
22737
22856
|
try {
|
|
22738
22857
|
if (Object.keys(parsed).length === 0)
|
|
22739
|
-
|
|
22858
|
+
rmSync8(at, { force: true });
|
|
22740
22859
|
else
|
|
22741
22860
|
writeFileSync10(at, JSON.stringify(parsed, null, 2) + `
|
|
22742
22861
|
`, "utf8");
|
|
@@ -22922,7 +23041,7 @@ function resetHome(from, to = LAYOUT_VERSION) {
|
|
|
22922
23041
|
if (!existsSync23(path))
|
|
22923
23042
|
continue;
|
|
22924
23043
|
try {
|
|
22925
|
-
|
|
23044
|
+
rmSync8(path, { recursive: true, force: true });
|
|
22926
23045
|
removed.push(path);
|
|
22927
23046
|
} catch {}
|
|
22928
23047
|
}
|
|
@@ -23293,7 +23412,20 @@ async function evaluateHookEvent(eventType, cli = "claude", stdinPayload, opts)
|
|
|
23293
23412
|
}
|
|
23294
23413
|
} catch {}
|
|
23295
23414
|
}
|
|
23296
|
-
return {
|
|
23415
|
+
return {
|
|
23416
|
+
exitCode: result.exitCode,
|
|
23417
|
+
stdout: result.stdout,
|
|
23418
|
+
stderr: result.stderr,
|
|
23419
|
+
evaluation: {
|
|
23420
|
+
decision: result.decision,
|
|
23421
|
+
policyName: result.policyName,
|
|
23422
|
+
policyNames: result.policyNames ?? (result.policyName ? [result.policyName] : []),
|
|
23423
|
+
reason: result.reason,
|
|
23424
|
+
matchedPolicies,
|
|
23425
|
+
durationMs,
|
|
23426
|
+
toolName: parsed.tool_name ?? null
|
|
23427
|
+
}
|
|
23428
|
+
};
|
|
23297
23429
|
} finally {
|
|
23298
23430
|
if (opts?.awaitTelemetryFlush ?? true) {
|
|
23299
23431
|
await flushHookTelemetry2();
|
|
@@ -24106,8 +24238,8 @@ import {
|
|
|
24106
24238
|
existsSync as existsSync25,
|
|
24107
24239
|
mkdirSync as mkdirSync14,
|
|
24108
24240
|
readFileSync as readFileSync19,
|
|
24109
|
-
renameSync as
|
|
24110
|
-
rmSync as
|
|
24241
|
+
renameSync as renameSync8,
|
|
24242
|
+
rmSync as rmSync9,
|
|
24111
24243
|
writeFileSync as writeFileSync12
|
|
24112
24244
|
} from "node:fs";
|
|
24113
24245
|
import { basename as basename5, dirname as dirname13, join as join32, resolve as resolve20 } from "node:path";
|
|
@@ -24129,22 +24261,22 @@ function migrateToLayout4() {
|
|
|
24129
24261
|
if (!existsSync25(from))
|
|
24130
24262
|
continue;
|
|
24131
24263
|
if (existsSync25(to)) {
|
|
24132
|
-
|
|
24264
|
+
rmSync9(from, { force: true });
|
|
24133
24265
|
continue;
|
|
24134
24266
|
}
|
|
24135
24267
|
mkdirSync14(dirname13(to), { recursive: true });
|
|
24136
24268
|
try {
|
|
24137
|
-
|
|
24269
|
+
renameSync8(from, to);
|
|
24138
24270
|
} catch {
|
|
24139
24271
|
try {
|
|
24140
24272
|
copyFileSync2(from, to);
|
|
24141
24273
|
} catch (err) {
|
|
24142
24274
|
try {
|
|
24143
|
-
|
|
24275
|
+
rmSync9(to, { force: true });
|
|
24144
24276
|
} catch {}
|
|
24145
24277
|
throw err;
|
|
24146
24278
|
}
|
|
24147
|
-
|
|
24279
|
+
rmSync9(from, { force: true });
|
|
24148
24280
|
}
|
|
24149
24281
|
migrated.push(`${basename5(from)} → audit/${basename5(to)}`);
|
|
24150
24282
|
}
|
|
@@ -24202,7 +24334,7 @@ function pruneMigratedCredentials(from) {
|
|
|
24202
24334
|
const copy = resolve20(migrationBackupDir(layout), as);
|
|
24203
24335
|
if (!existsSync25(copy))
|
|
24204
24336
|
continue;
|
|
24205
|
-
|
|
24337
|
+
rmSync9(copy, { force: true });
|
|
24206
24338
|
pruned.push(as);
|
|
24207
24339
|
} catch {}
|
|
24208
24340
|
}
|
|
@@ -24222,7 +24354,7 @@ function backupBeforeMigrating(from) {
|
|
|
24222
24354
|
const dir = migrationBackupDir(from);
|
|
24223
24355
|
const saved = [];
|
|
24224
24356
|
try {
|
|
24225
|
-
|
|
24357
|
+
rmSync9(dir, { recursive: true, force: true });
|
|
24226
24358
|
mkdirSync14(dir, { recursive: true });
|
|
24227
24359
|
} catch {
|
|
24228
24360
|
return [];
|
|
@@ -25087,6 +25219,7 @@ Enabled ${selectedPolicies.length} policy(ies): ${selectedPolicies.join(", ")}
|
|
|
25087
25219
|
const settingsPaths = settingsPathsFor(integration, scope, cwd);
|
|
25088
25220
|
try {
|
|
25089
25221
|
for (const settingsPath of settingsPaths) {
|
|
25222
|
+
integration.prepareInstall?.(settingsPath);
|
|
25090
25223
|
const settings = integration.readSettings(settingsPath);
|
|
25091
25224
|
integration.writeHookEntries(settings, binaryPath, scope);
|
|
25092
25225
|
integration.writeSettings(settingsPath, settings);
|
|
@@ -25143,7 +25276,11 @@ Enabled ${selectedPolicies.length} policy(ies): ${selectedPolicies.join(", ")}
|
|
|
25143
25276
|
} catch {}
|
|
25144
25277
|
for (const { cli: cliId, path } of writtenSettingsPaths) {
|
|
25145
25278
|
const integration = getIntegration(cliId);
|
|
25146
|
-
|
|
25279
|
+
if (cliId === "hermes") {
|
|
25280
|
+
console.log(`Failproof AI native plugin installed for ${integration.displayName} ` + `(8 registered hooks, scope: ${scope}).`);
|
|
25281
|
+
} else {
|
|
25282
|
+
console.log(`Failproof AI hooks installed for ${integration.displayName} ` + `(${integration.eventTypes.length} event types, scope: ${scope}).`);
|
|
25283
|
+
}
|
|
25147
25284
|
console.log(`Settings: ${path}`);
|
|
25148
25285
|
}
|
|
25149
25286
|
if (scope === "project") {
|
|
@@ -25234,7 +25371,7 @@ async function removeHooks(policyNames, scope = "user", cwd, opts) {
|
|
|
25234
25371
|
const scopesToRemove = scope === "all" ? [...integration.scopes] : integration.scopes.includes(scope) ? [scope] : [];
|
|
25235
25372
|
for (const s of scopesToRemove) {
|
|
25236
25373
|
const settingsPaths = settingsPathsFor(integration, s, cwd);
|
|
25237
|
-
const existing = settingsPaths.filter((p) => existsSync27(p));
|
|
25374
|
+
const existing = cliId === "hermes" ? settingsPaths : settingsPaths.filter((p) => existsSync27(p));
|
|
25238
25375
|
if (existing.length === 0) {
|
|
25239
25376
|
if (scope !== "all" && selectedClis.length === 1) {
|
|
25240
25377
|
console.log("No settings file found. Nothing to remove.");
|
|
@@ -25337,7 +25474,7 @@ var DEFAULT_FETCH_TIMEOUT_MS = 15000;
|
|
|
25337
25474
|
|
|
25338
25475
|
// src/hooks/cloud-enrollment.ts
|
|
25339
25476
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
25340
|
-
import { existsSync as existsSync28, readFileSync as readFileSync22, rmSync as
|
|
25477
|
+
import { existsSync as existsSync28, readFileSync as readFileSync22, rmSync as rmSync10 } from "node:fs";
|
|
25341
25478
|
import { hostname as hostname4 } from "node:os";
|
|
25342
25479
|
function cloudCredentialPath() {
|
|
25343
25480
|
return process.env.FAILPROOFAI_CLOUD_CREDENTIALS ?? credentialsFile();
|
|
@@ -25421,7 +25558,7 @@ function clearCloudCredentials() {
|
|
|
25421
25558
|
if (!existsSync28(path))
|
|
25422
25559
|
return false;
|
|
25423
25560
|
try {
|
|
25424
|
-
|
|
25561
|
+
rmSync10(path);
|
|
25425
25562
|
return true;
|
|
25426
25563
|
} catch {
|
|
25427
25564
|
return false;
|
|
@@ -25746,7 +25883,7 @@ var init_setup_state = __esm(() => {
|
|
|
25746
25883
|
});
|
|
25747
25884
|
|
|
25748
25885
|
// src/hooks/onboarding-attempt.ts
|
|
25749
|
-
import { existsSync as existsSync30, mkdirSync as mkdirSync17, readFileSync as readFileSync23, rmSync as
|
|
25886
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync17, readFileSync as readFileSync23, rmSync as rmSync11, writeFileSync as writeFileSync15 } from "node:fs";
|
|
25750
25887
|
import { dirname as dirname16 } from "node:path";
|
|
25751
25888
|
function readOnboardingAttempt() {
|
|
25752
25889
|
const path = onboardingAttemptFile();
|
|
@@ -25785,7 +25922,7 @@ function recordOnboardingAttempt(reason, cliVersion, daemonStatus, now = Date.no
|
|
|
25785
25922
|
}
|
|
25786
25923
|
function clearOnboardingAttempt() {
|
|
25787
25924
|
try {
|
|
25788
|
-
|
|
25925
|
+
rmSync11(onboardingAttemptFile(), { force: true });
|
|
25789
25926
|
} catch {}
|
|
25790
25927
|
}
|
|
25791
25928
|
function blockerCleared(attempt, probe) {
|
|
@@ -25827,7 +25964,7 @@ var init_onboarding_attempt = __esm(() => {
|
|
|
25827
25964
|
});
|
|
25828
25965
|
|
|
25829
25966
|
// src/hooks/onboarding-lock.ts
|
|
25830
|
-
import { mkdirSync as mkdirSync18, readFileSync as readFileSync24, rmSync as
|
|
25967
|
+
import { mkdirSync as mkdirSync18, readFileSync as readFileSync24, rmSync as rmSync12, writeFileSync as writeFileSync16 } from "node:fs";
|
|
25831
25968
|
import { homedir as homedir26 } from "node:os";
|
|
25832
25969
|
function onboardingLockPath(home = homedir26()) {
|
|
25833
25970
|
return onboardingLockFile(home);
|
|
@@ -25870,7 +26007,7 @@ function acquireOnboardingLock(home = homedir26()) {
|
|
|
25870
26007
|
try {
|
|
25871
26008
|
const current = readLock(path);
|
|
25872
26009
|
if (!current || current.pid === process.pid)
|
|
25873
|
-
|
|
26010
|
+
rmSync12(path, { force: true });
|
|
25874
26011
|
} catch {}
|
|
25875
26012
|
}
|
|
25876
26013
|
};
|
|
@@ -28201,7 +28338,7 @@ var init_api_server_client = __esm(() => {
|
|
|
28201
28338
|
});
|
|
28202
28339
|
|
|
28203
28340
|
// lib/auth/auth-store.ts
|
|
28204
|
-
import { existsSync as existsSync34, readFileSync as readFileSync28, readdirSync as readdirSync18, rmSync as
|
|
28341
|
+
import { existsSync as existsSync34, readFileSync as readFileSync28, readdirSync as readdirSync18, rmSync as rmSync13 } from "node:fs";
|
|
28205
28342
|
import { join as join36, resolve as resolve24 } from "node:path";
|
|
28206
28343
|
function getAuthFilePath() {
|
|
28207
28344
|
const override = process.env.FAILPROOFAI_AUTH_DIR;
|
|
@@ -28237,7 +28374,7 @@ function writeAuth(auth) {
|
|
|
28237
28374
|
function deleteAuth() {
|
|
28238
28375
|
const p = getAuthFilePath();
|
|
28239
28376
|
if (existsSync34(p))
|
|
28240
|
-
|
|
28377
|
+
rmSync13(p, { force: true });
|
|
28241
28378
|
try {
|
|
28242
28379
|
const root = migrationsDir();
|
|
28243
28380
|
if (!existsSync34(root))
|
|
@@ -28247,7 +28384,7 @@ function deleteAuth() {
|
|
|
28247
28384
|
continue;
|
|
28248
28385
|
const copy = resolve24(root, entry, "auth.json");
|
|
28249
28386
|
if (existsSync34(copy))
|
|
28250
|
-
|
|
28387
|
+
rmSync13(copy, { force: true });
|
|
28251
28388
|
}
|
|
28252
28389
|
} catch {}
|
|
28253
28390
|
}
|
|
@@ -28497,7 +28634,7 @@ var init_harm_report = __esm(() => {
|
|
|
28497
28634
|
});
|
|
28498
28635
|
|
|
28499
28636
|
// src/audit/machine-store.ts
|
|
28500
|
-
import { existsSync as existsSync35, readFileSync as readFileSync29, rmSync as
|
|
28637
|
+
import { existsSync as existsSync35, readFileSync as readFileSync29, rmSync as rmSync14 } from "node:fs";
|
|
28501
28638
|
import { hostname as hostname5 } from "node:os";
|
|
28502
28639
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
28503
28640
|
function readMachineIdentity(home) {
|
|
@@ -30050,8 +30187,8 @@ import {
|
|
|
30050
30187
|
existsSync as existsSync40,
|
|
30051
30188
|
mkdirSync as mkdirSync25,
|
|
30052
30189
|
readFileSync as readFileSync32,
|
|
30053
|
-
renameSync as
|
|
30054
|
-
rmSync as
|
|
30190
|
+
renameSync as renameSync9,
|
|
30191
|
+
rmSync as rmSync15,
|
|
30055
30192
|
writeFileSync as writeFileSync23
|
|
30056
30193
|
} from "node:fs";
|
|
30057
30194
|
import { basename as basename8, dirname as dirname20, join as join39, resolve as resolve27 } from "node:path";
|
|
@@ -30073,22 +30210,22 @@ function migrateToLayout42() {
|
|
|
30073
30210
|
if (!existsSync40(from))
|
|
30074
30211
|
continue;
|
|
30075
30212
|
if (existsSync40(to)) {
|
|
30076
|
-
|
|
30213
|
+
rmSync15(from, { force: true });
|
|
30077
30214
|
continue;
|
|
30078
30215
|
}
|
|
30079
30216
|
mkdirSync25(dirname20(to), { recursive: true });
|
|
30080
30217
|
try {
|
|
30081
|
-
|
|
30218
|
+
renameSync9(from, to);
|
|
30082
30219
|
} catch {
|
|
30083
30220
|
try {
|
|
30084
30221
|
copyFileSync3(from, to);
|
|
30085
30222
|
} catch (err) {
|
|
30086
30223
|
try {
|
|
30087
|
-
|
|
30224
|
+
rmSync15(to, { force: true });
|
|
30088
30225
|
} catch {}
|
|
30089
30226
|
throw err;
|
|
30090
30227
|
}
|
|
30091
|
-
|
|
30228
|
+
rmSync15(from, { force: true });
|
|
30092
30229
|
}
|
|
30093
30230
|
migrated.push(`${basename8(from)} → audit/${basename8(to)}`);
|
|
30094
30231
|
}
|
|
@@ -30146,7 +30283,7 @@ function pruneMigratedCredentials2(from) {
|
|
|
30146
30283
|
const copy = resolve27(migrationBackupDir(layout), as);
|
|
30147
30284
|
if (!existsSync40(copy))
|
|
30148
30285
|
continue;
|
|
30149
|
-
|
|
30286
|
+
rmSync15(copy, { force: true });
|
|
30150
30287
|
pruned.push(as);
|
|
30151
30288
|
} catch {}
|
|
30152
30289
|
}
|
|
@@ -30166,7 +30303,7 @@ function backupBeforeMigrating2(from) {
|
|
|
30166
30303
|
const dir = migrationBackupDir(from);
|
|
30167
30304
|
const saved = [];
|
|
30168
30305
|
try {
|
|
30169
|
-
|
|
30306
|
+
rmSync15(dir, { recursive: true, force: true });
|
|
30170
30307
|
mkdirSync25(dir, { recursive: true });
|
|
30171
30308
|
} catch {
|
|
30172
30309
|
return [];
|
|
@@ -30317,7 +30454,7 @@ import {
|
|
|
30317
30454
|
readFileSync as readFileSync33,
|
|
30318
30455
|
writeFileSync as writeFileSync24,
|
|
30319
30456
|
unlinkSync as unlinkSync5,
|
|
30320
|
-
rmSync as
|
|
30457
|
+
rmSync as rmSync16
|
|
30321
30458
|
} from "node:fs";
|
|
30322
30459
|
import { homedir as homedir30, tmpdir as tmpdir3, userInfo as userInfo2 } from "node:os";
|
|
30323
30460
|
import { resolve as resolve28 } from "node:path";
|
|
@@ -30480,7 +30617,7 @@ function writePrivilegedFile2(destination, contents, mode = "0644") {
|
|
|
30480
30617
|
writeFileSync24(staging, contents, "utf8");
|
|
30481
30618
|
runPrivileged2("install", ["-m", mode, staging, destination]);
|
|
30482
30619
|
} finally {
|
|
30483
|
-
|
|
30620
|
+
rmSync16(stagingDir, { recursive: true, force: true });
|
|
30484
30621
|
}
|
|
30485
30622
|
}
|
|
30486
30623
|
function removeLegacyUserService2() {
|
|
@@ -30779,7 +30916,7 @@ var init_daemon_service2 = __esm(() => {
|
|
|
30779
30916
|
});
|
|
30780
30917
|
|
|
30781
30918
|
// src/hooks/uninstall-cli.ts
|
|
30782
|
-
import { existsSync as existsSync42, rmSync as
|
|
30919
|
+
import { existsSync as existsSync42, rmSync as rmSync17 } from "node:fs";
|
|
30783
30920
|
function survey(cwd) {
|
|
30784
30921
|
const clis = [];
|
|
30785
30922
|
for (const id of listInstallableIds()) {
|
|
@@ -30912,7 +31049,7 @@ async function runUninstallCommand(opts = {}) {
|
|
|
30912
31049
|
}
|
|
30913
31050
|
if (opts.purge && found.homeExists) {
|
|
30914
31051
|
try {
|
|
30915
|
-
|
|
31052
|
+
rmSync17(failproofaiHome(), { recursive: true, force: true });
|
|
30916
31053
|
purged = true;
|
|
30917
31054
|
lines.push(`✓ deleted ${failproofaiHome()}`);
|
|
30918
31055
|
} catch (err) {
|
|
@@ -30957,7 +31094,7 @@ var init_uninstall_cli = __esm(() => {
|
|
|
30957
31094
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
30958
31095
|
import { homedir as homedir31, tmpdir as tmpdir4 } from "node:os";
|
|
30959
31096
|
import { createHash as createHash9 } from "node:crypto";
|
|
30960
|
-
import { copyFileSync as copyFileSync4, existsSync as existsSync43, mkdirSync as mkdirSync27, mkdtempSync as mkdtempSync3, readFileSync as readFileSync34, readdirSync as readdirSync21, realpathSync as realpathSync3, rmSync as
|
|
31097
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync43, mkdirSync as mkdirSync27, mkdtempSync as mkdtempSync3, readFileSync as readFileSync34, readdirSync as readdirSync21, realpathSync as realpathSync3, rmSync as rmSync18, statSync as statSync26, writeFileSync as writeFileSync25 } from "node:fs";
|
|
30961
31098
|
import { basename as basename9, dirname as dirname21, isAbsolute as isAbsolute4, join as join40, relative as relative5, resolve as resolve29, sep as sep6 } from "node:path";
|
|
30962
31099
|
function parseList(rest, flag) {
|
|
30963
31100
|
const idx = rest.findIndex((a) => a === flag || a.startsWith(`${flag}=`));
|
|
@@ -31741,7 +31878,7 @@ esac
|
|
|
31741
31878
|
return true;
|
|
31742
31879
|
} finally {
|
|
31743
31880
|
try {
|
|
31744
|
-
|
|
31881
|
+
rmSync18(dirname21(askpass), { recursive: true, force: true });
|
|
31745
31882
|
} catch {}
|
|
31746
31883
|
}
|
|
31747
31884
|
}
|
|
@@ -33063,6 +33200,7 @@ Enabled ${selectedPolicies.length} policy(ies): ${selectedPolicies.join(", ")}
|
|
|
33063
33200
|
const settingsPaths = settingsPathsFor(integration, scope, cwd);
|
|
33064
33201
|
try {
|
|
33065
33202
|
for (const settingsPath of settingsPaths) {
|
|
33203
|
+
integration.prepareInstall?.(settingsPath);
|
|
33066
33204
|
const settings = integration.readSettings(settingsPath);
|
|
33067
33205
|
integration.writeHookEntries(settings, binaryPath, scope);
|
|
33068
33206
|
integration.writeSettings(settingsPath, settings);
|
|
@@ -33119,7 +33257,11 @@ Enabled ${selectedPolicies.length} policy(ies): ${selectedPolicies.join(", ")}
|
|
|
33119
33257
|
} catch {}
|
|
33120
33258
|
for (const { cli: cliId, path } of writtenSettingsPaths) {
|
|
33121
33259
|
const integration = getIntegration(cliId);
|
|
33122
|
-
|
|
33260
|
+
if (cliId === "hermes") {
|
|
33261
|
+
console.log(`Failproof AI native plugin installed for ${integration.displayName} ` + `(8 registered hooks, scope: ${scope}).`);
|
|
33262
|
+
} else {
|
|
33263
|
+
console.log(`Failproof AI hooks installed for ${integration.displayName} ` + `(${integration.eventTypes.length} event types, scope: ${scope}).`);
|
|
33264
|
+
}
|
|
33123
33265
|
console.log(`Settings: ${path}`);
|
|
33124
33266
|
}
|
|
33125
33267
|
if (scope === "project") {
|
|
@@ -33210,7 +33352,7 @@ async function removeHooks2(policyNames, scope = "user", cwd, opts) {
|
|
|
33210
33352
|
const scopesToRemove = scope === "all" ? [...integration.scopes] : integration.scopes.includes(scope) ? [scope] : [];
|
|
33211
33353
|
for (const s of scopesToRemove) {
|
|
33212
33354
|
const settingsPaths = settingsPathsFor(integration, s, cwd);
|
|
33213
|
-
const existing = settingsPaths.filter((p) => existsSync44(p));
|
|
33355
|
+
const existing = cliId === "hermes" ? settingsPaths : settingsPaths.filter((p) => existsSync44(p));
|
|
33214
33356
|
if (existing.length === 0) {
|
|
33215
33357
|
if (scope !== "all" && selectedClis.length === 1) {
|
|
33216
33358
|
console.log("No settings file found. Nothing to remove.");
|
|
@@ -34868,10 +35010,108 @@ var init_session_pause_cli = __esm(() => {
|
|
|
34868
35010
|
init_tui();
|
|
34869
35011
|
});
|
|
34870
35012
|
|
|
35013
|
+
// src/hooks/integrations.ts
|
|
35014
|
+
import {
|
|
35015
|
+
cpSync as cpSync2,
|
|
35016
|
+
readFileSync as readFileSync37,
|
|
35017
|
+
writeFileSync as writeFileSync26,
|
|
35018
|
+
existsSync as existsSync47,
|
|
35019
|
+
lstatSync as lstatSync2,
|
|
35020
|
+
mkdirSync as mkdirSync28,
|
|
35021
|
+
renameSync as renameSync10,
|
|
35022
|
+
rmSync as rmSync19,
|
|
35023
|
+
unlinkSync as unlinkSync6
|
|
35024
|
+
} from "node:fs";
|
|
35025
|
+
import { resolve as resolve34, dirname as dirname24 } from "node:path";
|
|
35026
|
+
function readYamlDoc2(path) {
|
|
35027
|
+
try {
|
|
35028
|
+
return existsSync47(path) ? $parseDocument(readFileSync37(path, "utf8")) : $parseDocument("");
|
|
35029
|
+
} catch {
|
|
35030
|
+
return $parseDocument("");
|
|
35031
|
+
}
|
|
35032
|
+
}
|
|
35033
|
+
function isMarkedHook2(hook) {
|
|
35034
|
+
if (!hook || typeof hook !== "object")
|
|
35035
|
+
return false;
|
|
35036
|
+
const h = hook;
|
|
35037
|
+
if (h[FAILPROOFAI_HOOK_MARKER] === true)
|
|
35038
|
+
return true;
|
|
35039
|
+
const cmd = typeof h.command === "string" ? h.command : "";
|
|
35040
|
+
return cmd.includes("failproofai") && cmd.includes("--hook");
|
|
35041
|
+
}
|
|
35042
|
+
function hermesPluginPathForSettings2(settingsPath) {
|
|
35043
|
+
return resolve34(dirname24(settingsPath), "plugins", HERMES_PLUGIN_ID2);
|
|
35044
|
+
}
|
|
35045
|
+
function hasManagedHermesPlugin2(settingsPath) {
|
|
35046
|
+
const pluginPath = hermesPluginPathForSettings2(settingsPath);
|
|
35047
|
+
try {
|
|
35048
|
+
if (lstatSync2(pluginPath).isSymbolicLink())
|
|
35049
|
+
return false;
|
|
35050
|
+
if (!existsSync47(resolve34(pluginPath, HERMES_PLUGIN_MARKER2)))
|
|
35051
|
+
return false;
|
|
35052
|
+
return HERMES_PLUGIN_FILES2.every((file) => existsSync47(resolve34(pluginPath, file)));
|
|
35053
|
+
} catch {
|
|
35054
|
+
return false;
|
|
35055
|
+
}
|
|
35056
|
+
}
|
|
35057
|
+
function hermesConfigState2(settingsPath) {
|
|
35058
|
+
if (!existsSync47(settingsPath)) {
|
|
35059
|
+
return { pluginEnabled: false, legacyShellHookPresent: false };
|
|
35060
|
+
}
|
|
35061
|
+
const doc = readYamlDoc2(settingsPath);
|
|
35062
|
+
const js = doc.toJS() ?? {};
|
|
35063
|
+
const enabled = js.plugins?.enabled;
|
|
35064
|
+
const legacyShellHookPresent = !!js.hooks && typeof js.hooks === "object" && Object.values(js.hooks).some((entries) => Array.isArray(entries) && entries.some((entry) => isMarkedHook2(entry)));
|
|
35065
|
+
return {
|
|
35066
|
+
pluginEnabled: Array.isArray(enabled) && enabled.includes(HERMES_PLUGIN_ID2),
|
|
35067
|
+
legacyShellHookPresent
|
|
35068
|
+
};
|
|
35069
|
+
}
|
|
35070
|
+
function hermesProfileHealth() {
|
|
35071
|
+
return listHermesProfiles().map((profile) => {
|
|
35072
|
+
const settingsPath = resolve34(profile.home, "config.yaml");
|
|
35073
|
+
const config = hermesConfigState2(settingsPath);
|
|
35074
|
+
const pluginInstalled = hasManagedHermesPlugin2(settingsPath);
|
|
35075
|
+
return {
|
|
35076
|
+
name: profile.name,
|
|
35077
|
+
home: profile.home,
|
|
35078
|
+
settingsPath,
|
|
35079
|
+
pluginInstalled,
|
|
35080
|
+
pluginEnabled: config.pluginEnabled,
|
|
35081
|
+
legacyShellHookPresent: config.legacyShellHookPresent,
|
|
35082
|
+
healthy: pluginInstalled && config.pluginEnabled && !config.legacyShellHookPresent
|
|
35083
|
+
};
|
|
35084
|
+
});
|
|
35085
|
+
}
|
|
35086
|
+
function hermesProfileStatusRows() {
|
|
35087
|
+
return hermesProfileHealth().filter((profile) => existsSync47(profile.home)).map((profile) => {
|
|
35088
|
+
const problems = [];
|
|
35089
|
+
if (!profile.pluginInstalled)
|
|
35090
|
+
problems.push("plugin files missing or incomplete");
|
|
35091
|
+
if (!profile.pluginEnabled)
|
|
35092
|
+
problems.push("plugin not enabled");
|
|
35093
|
+
if (profile.legacyShellHookPresent)
|
|
35094
|
+
problems.push("legacy shell hook also present");
|
|
35095
|
+
return [
|
|
35096
|
+
"hermes/" + profile.name,
|
|
35097
|
+
problems.length === 0 ? "native plugin enabled" : "UNHEALTHY — " + problems.join("; ")
|
|
35098
|
+
];
|
|
35099
|
+
});
|
|
35100
|
+
}
|
|
35101
|
+
var HERMES_PLUGIN_ID2 = "failproofai", HERMES_PLUGIN_MARKER2 = ".failproofai-managed", HERMES_PLUGIN_FILES2, ANTIGRAVITY_TOOL_EVENTS2;
|
|
35102
|
+
var init_integrations2 = __esm(() => {
|
|
35103
|
+
init_dist();
|
|
35104
|
+
init_hermes_profiles();
|
|
35105
|
+
init_openclaw_profiles();
|
|
35106
|
+
init_types();
|
|
35107
|
+
HERMES_PLUGIN_FILES2 = ["plugin.yaml", "__init__.py", "client.py", "ledger.py"];
|
|
35108
|
+
ANTIGRAVITY_TOOL_EVENTS2 = new Set(["PreToolUse", "PostToolUse"]);
|
|
35109
|
+
});
|
|
35110
|
+
|
|
34871
35111
|
// scripts/launch.ts
|
|
34872
35112
|
import { spawn as spawn3 } from "child_process";
|
|
34873
|
-
import { realpathSync as realpathSync6, existsSync as
|
|
34874
|
-
import { resolve as
|
|
35113
|
+
import { realpathSync as realpathSync6, existsSync as existsSync48 } from "node:fs";
|
|
35114
|
+
import { resolve as resolve35, dirname as dirname25 } from "node:path";
|
|
34875
35115
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
34876
35116
|
import { createInterface as createInterface2 } from "node:readline";
|
|
34877
35117
|
function launch2(mode) {
|
|
@@ -34895,9 +35135,9 @@ function launch2(mode) {
|
|
|
34895
35135
|
process.env.PORT = port;
|
|
34896
35136
|
process.env.HOSTNAME = bindHost;
|
|
34897
35137
|
cmd = "node";
|
|
34898
|
-
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ??
|
|
34899
|
-
const serverJsPath =
|
|
34900
|
-
if (!
|
|
35138
|
+
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve35(dirname25(realpathSync6(fileURLToPath3(import.meta.url))), "..");
|
|
35139
|
+
const serverJsPath = resolve35(packageRoot, ".next/standalone/server.js");
|
|
35140
|
+
if (!existsSync48(serverJsPath)) {
|
|
34901
35141
|
let shadowMessage = null;
|
|
34902
35142
|
try {
|
|
34903
35143
|
const diag = diagnoseShadow({ selfPackageRoot: packageRoot, selfVersion: version2 });
|
|
@@ -34994,17 +35234,17 @@ var init_cli_error2 = __esm(() => {
|
|
|
34994
35234
|
|
|
34995
35235
|
// bin/failproofai.mjs
|
|
34996
35236
|
import { realpathSync as realpathSync7 } from "fs";
|
|
34997
|
-
import { dirname as
|
|
35237
|
+
import { dirname as dirname26, resolve as resolve36 } from "path";
|
|
34998
35238
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
34999
35239
|
// package.json
|
|
35000
|
-
var version = "1.0.
|
|
35240
|
+
var version = "1.0.6-beta.0";
|
|
35001
35241
|
|
|
35002
35242
|
// bin/failproofai.mjs
|
|
35003
35243
|
if (!process.env.FAILPROOFAI_PACKAGE_ROOT) {
|
|
35004
|
-
process.env.FAILPROOFAI_PACKAGE_ROOT =
|
|
35244
|
+
process.env.FAILPROOFAI_PACKAGE_ROOT = resolve36(dirname26(realpathSync7(fileURLToPath4(import.meta.url))), "..");
|
|
35005
35245
|
}
|
|
35006
35246
|
if (!process.env.FAILPROOFAI_DIST_PATH) {
|
|
35007
|
-
process.env.FAILPROOFAI_DIST_PATH =
|
|
35247
|
+
process.env.FAILPROOFAI_DIST_PATH = resolve36(dirname26(realpathSync7(fileURLToPath4(import.meta.url))), "..", "dist");
|
|
35008
35248
|
}
|
|
35009
35249
|
var args = process.argv.slice(2);
|
|
35010
35250
|
if (args[0] === "p" || args[0] === "policy")
|
|
@@ -36580,7 +36820,9 @@ Run \`failproofai policies --help\` for usage.`);
|
|
|
36580
36820
|
await Promise.resolve().then(() => init_tui2());
|
|
36581
36821
|
const opts = optsFor2(process.stdout);
|
|
36582
36822
|
const report = connectionStatusReport();
|
|
36583
|
-
|
|
36823
|
+
await Promise.resolve().then(() => init_integrations2());
|
|
36824
|
+
const hermesRows = hermesProfileStatusRows();
|
|
36825
|
+
printBlock2(process.stdout, stack2(title2("failproofai config", versionStatusLines()[0], opts), rows2([...report.rows, ...hermesRows, ...result.rows ?? []], opts), report.warnings.length > 0 ? warning2(report.warnings, opts) : null, result.rows ? result.trailer ?? null : result.lines));
|
|
36584
36826
|
} else {
|
|
36585
36827
|
await printLines(result.lines, result.exitCode === 0);
|
|
36586
36828
|
}
|