failproofai 1.0.14 → 1.0.16-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 +23 -23
- package/.next/standalone/.next/prerender-manifest.json +4 -4
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
- 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 +22 -21
- 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 +3 -3
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js +4 -3
- 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 +4 -4
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js +8 -7
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +8 -8
- package/.next/standalone/.next/server/app/settings/page.js +8 -7
- 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/[root-of-the-server]__048f1wnr8pysf._.js +4 -4
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1oclamblhzhrf._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0tovk6q0miud6._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0trp3ycqv17cl._.js +1 -1
- package/.next/standalone/.next/server/chunks/_1vslkoe35wok6._.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oigsgz07._.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p77cu37y._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4vkpxxu7._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_hooks_0fmclqlaj83-2._.js +5 -0
- package/.next/standalone/.next/server/chunks/src_hooks_15j31lnj-km9r._.js +3 -0
- package/.next/standalone/.next/server/chunks/src_hooks_daemon-client_ts_0il_yu1zc0291._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08ch3staq3ejw._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bigvy9xmv2ka._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ezoipo-r7_5k._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h86bl2qf0k_o._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pia5h3p8re4c._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0t76rmc_vci18._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1vofkb2oq7p7e._.js → [root-of-the-server]__0tayeyopslkf1._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1-ey9fgesfbc0._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15usvs-ms-0hf._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__16gb3_92zvk5x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1avi2kypusyb_._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1r7drlqli-ado._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1vxwetblyf8vp._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0eoura3_9gjb-._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0f-kswpk5hx7v._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0pedwblqdoh58._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1_ozgifqv1ssi._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1djqs9i27e4kg._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1v4_ul3sj2lq_._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo5_vm5f.js +5 -5
- package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9snixb5fd-._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47q0xq5w._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_components_project-list_tsx_1ke6anr0vt64h._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x33jqb6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpcz0uxur._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h47jmhhd._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_0r9i9nq3-ei-l.js → node_modules_html-to-image_es_index_0wgfci23_yqs_.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_0bz67659f5z-3._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_1khq67j4vo9y4._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuznb72p7z._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/package_json_[json]_cjs_013tntikdft59._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1-ytegsicaf2d._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1euxn1va7c5gq._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_daemon-client_ts_0k41_i7jg6ndv._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_daemon-service_ts_0ibufora3s_bw._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_effective-reviewers_ts_1h4wtvo55j16x._.js +3 -0
- package/.next/standalone/.next/server/middleware-build-manifest.js +23 -23
- 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/preview-props.json +3 -3
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +23 -23
- package/.next/standalone/.next/static/chunks/0fqjv13piwa6z.js +1 -0
- package/.next/standalone/.next/static/chunks/{435eshlryosz1.js → 0y9qczsccrmmf.js} +1 -1
- package/.next/standalone/.next/static/chunks/{110hwwc6agsr8.js → 0z70k3nof30ws.js} +1 -1
- package/.next/standalone/.next/static/chunks/{3hk5y4kny2ktd.js → 167exo9u6npy3.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2zlfhyqvlvf7o.js → 1xwh61k4505md.js} +1 -1
- package/.next/standalone/.next/static/chunks/24nikgpkr0qas.js +1 -0
- package/.next/standalone/.next/static/chunks/{2wh64znsc_mo2.js → 2ayu58wi805x4.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0tiuj32d-qcy3.js → 2swcvie6i54dn.js} +1 -1
- package/.next/standalone/.next/static/chunks/2xx-2wehe-kwl.js +1 -0
- package/.next/standalone/.next/static/chunks/{2wye36b3mbzpa.js → 34rjkinfk6d4p.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1i9zuw01f0ogt.js → 3r-j6pmqrq4l1.js} +2 -2
- package/.next/standalone/.next/static/chunks/3tfcj166ki-08.js +1 -0
- package/.next/standalone/.next/static/chunks/3uj5quosl7j_x.js +6 -0
- package/.next/standalone/assets/logos/failproof-dark.png +0 -0
- package/.next/standalone/assets/logos/failproof-light.png +0 -0
- package/.next/standalone/fp-cloud-cli/CHANGELOG.md +24 -3
- package/.next/standalone/fp-cloud-cli/fp_cli/_version.py +1 -1
- package/.next/standalone/fp-cloud-cli/uv.lock +6 -6
- package/.next/standalone/hermes-plugin/client.py +97 -37
- package/.next/standalone/hermes-plugin/plugin.yaml +1 -1
- 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/lib/patch-incorrect-lockfile.js +3 -3
- package/.next/standalone/node_modules/next/dist/server/app-render/async-local-storage.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/base-http/node.js +7 -2
- 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/router-server.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/lib/trace/tracer.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/use-cache/use-cache-wrapper.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 +10 -10
- package/.next/standalone/package.json +10 -10
- package/.next/standalone/sdk/python/uv.lock +18 -18
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/package-lock.json +40 -40
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/package.json +1 -1
- package/.next/standalone/server.js +1 -1
- package/README.md +174 -83
- package/bin/failproofai.mjs +66 -90
- package/dist/cli.mjs +1422 -1490
- package/dist/worker.mjs +19 -4
- package/hermes-plugin/client.py +97 -37
- package/hermes-plugin/plugin.yaml +1 -1
- package/openclaw-plugin/daemon-client.js +157 -32
- package/openclaw-plugin/hooks.js +16 -1
- package/package.json +10 -10
- package/pi-extension/index.ts +2 -0
- package/src/hooks/cloud-managed-policies.ts +22 -0
- package/src/hooks/config-status.ts +34 -21
- package/src/hooks/configure-wizard.ts +16 -3
- package/src/hooks/daemon-client.ts +59 -16
- package/src/hooks/daemon-service.ts +167 -19
- package/src/hooks/delivery-health.ts +10 -0
- package/src/hooks/fp-home.ts +8 -0
- package/src/hooks/fp-reset.ts +8 -2
- package/src/hooks/gateway-restart.ts +248 -0
- package/src/hooks/handler.ts +39 -2
- package/src/hooks/hermes-update.ts +18 -2
- package/src/hooks/hook-activity-store.ts +5 -0
- package/src/hooks/manager.ts +43 -9
- package/src/hooks/shell-quote.ts +19 -0
- package/src/hooks/update-run.ts +276 -0
- package/.next/standalone/.next/server/chunks/src_hooks_0_em82s16zfym._.js +0 -5
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1xwr4hi-on27i._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0p1cb69sml__f._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_0agdmptetetdt._.js +0 -5
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_0mdwgjisv4fub._.js +0 -5
- package/.next/standalone/.next/static/chunks/107jrtkeylnrv.js +0 -6
- package/.next/standalone/.next/static/chunks/19e9khxgv8fb8.js +0 -1
- package/.next/standalone/.next/static/chunks/2codb6nb412m9.js +0 -1
- package/.next/standalone/.next/static/chunks/2maurwweshrsj.js +0 -1
- package/.next/standalone/.next/static/chunks/3v49ogp389dun.js +0 -1
- /package/.next/standalone/.next/static/{-iBiSmrLiylRKLAg77zlQ → _rnWxsoAWV0JPMURamq78}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{-iBiSmrLiylRKLAg77zlQ → _rnWxsoAWV0JPMURamq78}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{-iBiSmrLiylRKLAg77zlQ → _rnWxsoAWV0JPMURamq78}/_ssgManifest.js +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
<
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/logos/failproof-dark.png" />
|
|
5
|
+
<img src="assets/logos/failproof-light.png" alt="failproof ai" width="320" />
|
|
6
|
+
</picture>
|
|
4
7
|
|
|
5
8
|
<a href="https://trendshift.io/repositories/69722?utm_source=trendshift-badge&utm_medium=badge&utm_campaign=badge-trendshift-69722" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/69722/daily?language=TypeScript" alt="FailproofAI%2Ffailproofai | Trendshift" width="250" height="55"/></a>
|
|
6
9
|
<a href="https://trendshift.io/repositories/69722?utm_source=trendshift-badge&utm_medium=badge&utm_campaign=badge-trendshift-69722" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/69722/daily" alt="FailproofAI%2Ffailproofai | Trendshift" width="250" height="55"/></a>
|
|
@@ -15,11 +18,24 @@
|
|
|
15
18
|
|
|
16
19
|
**Translations:** [简体中文](./docs/i18n/README.zh.md) · [日本語](./docs/i18n/README.ja.md) · [한국어](./docs/i18n/README.ko.md) · [Español](./docs/i18n/README.es.md) · [Português](./docs/i18n/README.pt-br.md) · [Deutsch](./docs/i18n/README.de.md) · [Français](./docs/i18n/README.fr.md) · [Русский](./docs/i18n/README.ru.md) · [हिन्दी](./docs/i18n/README.hi.md) · [Türkçe](./docs/i18n/README.tr.md) · [Tiếng Việt](./docs/i18n/README.vi.md) · [Italiano](./docs/i18n/README.it.md) · [العربية](./docs/i18n/README.ar.md) · [עברית](./docs/i18n/README.he.md)
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
## Ship agents that never fail.
|
|
22
|
+
|
|
23
|
+
Your agent ran `rm -rf` on the wrong directory. It read `.env` into its context. It spent
|
|
24
|
+
forty minutes retrying the same broken call, then told you the task was done.
|
|
25
|
+
**Failproof lives in your agent's runtime and hears every hook event it fires**: the
|
|
26
|
+
session starting, every prompt, every tool call and its result, sub-agents spinning up,
|
|
27
|
+
context about to be compacted, the moment it tries to stop. **It can act on any of
|
|
28
|
+
them**: block the bad action before it executes, steer the agent mid-run, or send it
|
|
29
|
+
back to work when it quits too early. Then it learns from every failure, so your
|
|
30
|
+
agent's harness gets better with every run.
|
|
31
|
+
|
|
32
|
+
**37% → 69%** task success on failures a policy recognised. Same model, no fine-tuning
|
|
33
|
+
([FIRE study](https://befailproof.ai/research/runtime-policies/))<br />
|
|
34
|
+
**~0.7 ms** p50 per policy check, from a Rust daemon in the hot path<br />
|
|
35
|
+
**12 agent harnesses**, one policy API: Claude Code, Codex, Cursor, Hermes, OpenClaw and more
|
|
36
|
+
|
|
37
|
+
Open source and free to start. Install the CLI, connect Failproof Cloud, and your first
|
|
38
|
+
audit runs on your agents' real history.
|
|
23
39
|
|
|
24
40
|
</div>
|
|
25
41
|
|
|
@@ -31,16 +47,14 @@ tool calls before they execute. 40 built-in policies. Zero latency. Runs locally
|
|
|
31
47
|
|
|
32
48
|
## Supported harnesses
|
|
33
49
|
|
|
34
|
-
Twelve harnesses in two classes
|
|
35
|
-
gateways (Hermes, OpenClaw).
|
|
36
|
-
of them. What a policy can *block* is per-harness: stopping a tool call before
|
|
37
|
-
it runs is verified on all twelve, turn-end gates on eight. The
|
|
38
|
-
[per-harness matrix](https://docs.befailproof.ai/reference/harnesses#enforcement-capability)
|
|
39
|
-
lists the events each one honours.
|
|
50
|
+
Twelve harnesses in two classes: ten coding CLIs, and two chat and assistant
|
|
51
|
+
gateways (Hermes, OpenClaw).
|
|
40
52
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
Building your own agent, on any framework or none? Report its runs through the
|
|
54
|
+
[Python SDK](https://docs.befailproof.ai/reference/custom-agents) or the
|
|
55
|
+
[TypeScript SDK](https://docs.befailproof.ai/reference/custom-agents-typescript),
|
|
56
|
+
which give you tracing, sessions, evaluations and audits. Enforcement there needs a hook in
|
|
57
|
+
your own runtime. [Talk to us](mailto:support@befailproof.ai) and we'll map it.
|
|
44
58
|
|
|
45
59
|
<!-- A 6-column table instead of inline <img> runs: table columns never re-wrap,
|
|
46
60
|
so the grid stays 2×6 at any window width (scrolling on very narrow screens
|
|
@@ -136,55 +150,98 @@ your own runtime — [talk to us](mailto:support@befailproof.ai) and we'll map i
|
|
|
136
150
|
</tr>
|
|
137
151
|
</table>
|
|
138
152
|
|
|
139
|
-
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Get started: find where your agents fail, then stop it
|
|
140
156
|
|
|
141
157
|
```sh
|
|
142
158
|
npm install -g failproofai
|
|
143
|
-
failproofai config
|
|
144
|
-
failproofai
|
|
145
|
-
failproofai # dashboard on localhost:8020
|
|
159
|
+
failproofai config # hook your agents, connect to Failproof Cloud (free)
|
|
160
|
+
failproofai backfill --since 7d # bring in the last week of runs already on disk
|
|
146
161
|
```
|
|
147
162
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
with
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
163
|
+
1. **Connect.** `failproofai config` finds every agent on this machine, hooks into each
|
|
164
|
+
one, starts the background daemon, and signs you in to Failproof Cloud in your
|
|
165
|
+
browser. No account yet? Make one right there, on the free plan.
|
|
166
|
+
2. **Backfill.** Your agents have been running for weeks, and that history is already on
|
|
167
|
+
this machine. `failproofai backfill --since 7d` sends the last seven days
|
|
168
|
+
([for supported harnesses](https://docs.befailproof.ai/reference/failproof-cli#backfill-per-harness)),
|
|
169
|
+
so you start with real evidence instead of an empty dashboard.
|
|
170
|
+
3. **Audit.** The moment runs land, Cloud starts your first audit on its own. It reads
|
|
171
|
+
your sessions, clusters what went wrong into named failure modes, and turns each one
|
|
172
|
+
into an **insight**, with the sessions that prove it. The free plan includes audits
|
|
173
|
+
every month.
|
|
174
|
+
4. **Plug in policies built for your agents.** Open an insight and hit **prevent this →**.
|
|
175
|
+
Failproof drafts a policy for that exact failure and tests it against your agents' own
|
|
176
|
+
past tool calls. You then roll it out to every machine, watching first or enforcing
|
|
177
|
+
straight away.
|
|
178
|
+
|
|
179
|
+
Setting up CI, a container, or letting an agent run the install? `failproofai config`
|
|
180
|
+
notices there's no one to ask and applies the defaults without prompting.
|
|
159
181
|
|
|
160
182
|
---
|
|
161
183
|
|
|
162
|
-
##
|
|
184
|
+
## One policy, every harness
|
|
163
185
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
| `block-rm-rf` | Recursive file deletion |
|
|
172
|
-
| `block-force-push` / `block-push-master` | `git push --force`, direct pushes to `main` |
|
|
173
|
-
|
|
174
|
-
Every one of these gates the call *before* it runs, so they hold on all twelve
|
|
175
|
-
harnesses. The first four apply to any agent that can call a tool; the last
|
|
176
|
-
three are the developer favourites — coding CLIs are the harness class we cover
|
|
177
|
-
deepest. The `sanitize-*` family is separate: it runs after a tool returns, so
|
|
178
|
-
it reports a secret in tool output rather than keeping it out of the context.
|
|
179
|
-
|
|
180
|
-
→ [All 40 built-in policies](https://docs.befailproof.ai/policies/packs)
|
|
186
|
+
Every harness speaks its own dialect:
|
|
187
|
+
- Claude Code reads a JSON verdict, while Factory's droid only stops on exit code 2.
|
|
188
|
+
- Cursor forces another turn with a `followup_message`.
|
|
189
|
+
- OpenCode and OpenClaw have no shell hooks at all, only in-process plugins, and Hermes
|
|
190
|
+
loads a native Python plugin.
|
|
191
|
+
- Even the shell tool has six names: `Bash`, `terminal`, `Execute`, `shell`,
|
|
192
|
+
`run_command`, `exec`.
|
|
181
193
|
|
|
182
|
-
|
|
194
|
+
Failproof translates all of it:
|
|
195
|
+
- Every event maps onto one canonical set of 29 (`SessionStart`, `UserPromptSubmit`,
|
|
196
|
+
`PreToolUse`, `PostToolUse`, `SubagentStop`, `PreCompact`, `Stop`, …).
|
|
197
|
+
- Every tool name and argument maps onto one canonical form.
|
|
198
|
+
- Every verdict is translated back into the exact shape that harness obeys.
|
|
199
|
+
|
|
200
|
+
So a policy written once against `Bash` blocks the same command in Claude Code, Codex,
|
|
201
|
+
Hermes and Goose. A "run the tests before you stop" gate sends the agent back to work on
|
|
202
|
+
every harness that has a turn-end hook.
|
|
183
203
|
|
|
184
|
-
|
|
204
|
+
Each contract is verified against that CLI and pinned, with what it was verified on, in
|
|
205
|
+
a capability matrix the test suite checks every claim against. Blocking before a tool runs is verified on all twelve harnesses; turn-end gates
|
|
206
|
+
on eight. The [per-harness matrix](https://docs.befailproof.ai/reference/harnesses#enforcement-capability)
|
|
207
|
+
shows exactly which events each one honours.
|
|
208
|
+
|
|
209
|
+
---
|
|
185
210
|
|
|
186
|
-
|
|
187
|
-
|
|
211
|
+
## Policies, written for your agents
|
|
212
|
+
|
|
213
|
+
A policy can listen to any of those events. Before a tool call, it can block the command
|
|
214
|
+
outright. When a prompt arrives, it can add context. When the agent tries to stop, it
|
|
215
|
+
can send it back to finish the job. Whatever it decides, the agent is told why. There
|
|
216
|
+
are two kinds of policy, and you can mix them:
|
|
217
|
+
|
|
218
|
+
- **Code.** Plain JavaScript, for anything you can check exactly: paths, commands,
|
|
219
|
+
arguments, limits. It's just code, so it can call your own model too.
|
|
220
|
+
- **Decision model.** Plain-English yes/no questions that Jev, our fast classifier,
|
|
221
|
+
answers about each call against what the user actually asked for. The `rm -rf build/`
|
|
222
|
+
you asked for goes through; the `rm -rf ~` that slipped into a plan doesn't. Use it
|
|
223
|
+
for the judgment calls no regex can make.
|
|
224
|
+
|
|
225
|
+
**You don't have to write either.** Failproof authors them for you. Open an insight in
|
|
226
|
+
Cloud and hit **prevent this →**, or describe the rule in a sentence. Failproof drafts
|
|
227
|
+
the policy, tests it against your agents' own past tool calls, and rolls it out to every
|
|
228
|
+
machine, observing first or enforcing straight away.
|
|
229
|
+
|
|
230
|
+
A few examples of what a policy can catch, and what it does about it:
|
|
231
|
+
|
|
232
|
+
| Example | What it catches | Does |
|
|
233
|
+
|---|---|---|
|
|
234
|
+
| `block-env-files` | Reads of `.env` and other secret files | **Blocks** |
|
|
235
|
+
| `block-kubectl` | Unreviewed changes to live infrastructure | **Blocks** |
|
|
236
|
+
| `warn-destructive-sql` | `DROP`, `TRUNCATE`, an unbounded `DELETE` | **Warns** the agent and lets it decide |
|
|
237
|
+
| `warn-repeated-tool-calls` | The agent looping on the same failing call | **Warns** the agent to change approach |
|
|
238
|
+
| `no-refunds-over-limit` *(yours)* | A support agent approving a refund it isn't allowed to | Whatever you decide |
|
|
239
|
+
| `no-production-writes` *(yours)* | File writes and edits to production paths (the code below; shell commands aren't checked) | **Blocks** |
|
|
240
|
+
|
|
241
|
+
Prefer to write one yourself? Save it in `.failproofai/policies/` as, say,
|
|
242
|
+
`no-production-writes-policies.mjs` and it loads automatically
|
|
243
|
+
([naming rules](https://docs.befailproof.ai/reference/policy-sdk#convention-files)). Commit
|
|
244
|
+
it, and every teammate whose agents run Failproof gets it on their next pull.
|
|
188
245
|
|
|
189
246
|
```js
|
|
190
247
|
import { customPolicies, deny, allow } from "failproofai";
|
|
@@ -193,6 +250,7 @@ customPolicies.add({
|
|
|
193
250
|
name: "no-production-writes",
|
|
194
251
|
match: { events: ["PreToolUse"] },
|
|
195
252
|
fn: async (ctx) => {
|
|
253
|
+
if (!["Write", "Edit"].includes(ctx.toolName ?? "")) return allow();
|
|
196
254
|
if (ctx.toolInput?.file_path?.includes("production"))
|
|
197
255
|
return deny("Writes to production paths are blocked.");
|
|
198
256
|
return allow();
|
|
@@ -200,44 +258,76 @@ customPolicies.add({
|
|
|
200
258
|
});
|
|
201
259
|
```
|
|
202
260
|
|
|
203
|
-
|
|
261
|
+
Every policy returns one of three decisions: `allow()`, `deny(message)`, or
|
|
262
|
+
`instruct(message)`. The last is the quiet superpower. Instead of crashing the agent
|
|
263
|
+
into a wall, it steers it ("run the tests before you stop", "use the staging database")
|
|
264
|
+
and the agent corrects course on its own.
|
|
204
265
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
| `deny(message)` | Block it — message goes back to the agent |
|
|
209
|
-
| `instruct(message)` | Let it through, but add context to the agent's next prompt |
|
|
210
|
-
|
|
211
|
-
→ [Write a policy](https://docs.befailproof.ai/policies/editor)
|
|
266
|
+
→ [Write a policy](https://docs.befailproof.ai/policies/editor) ·
|
|
267
|
+
[Decision-model policies](https://docs.befailproof.ai/policies/jev) ·
|
|
268
|
+
[More examples](https://docs.befailproof.ai/policies/packs)
|
|
212
269
|
|
|
213
270
|
---
|
|
214
271
|
|
|
215
|
-
##
|
|
272
|
+
## Built for agents that run on their own
|
|
216
273
|
|
|
217
|
-
|
|
274
|
+
A check that costs nothing can run on every event, all the time. That's what lets you
|
|
275
|
+
hand an agent more autonomy, not less:
|
|
218
276
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
277
|
+
- **Sub-millisecond, on every event.** `failproofaid` is a Rust daemon with a pre-warmed
|
|
278
|
+
policy worker behind an owner-only Unix socket. A check that used to cost ~700 ms now
|
|
279
|
+
takes ~0.7 ms at p50, so policies can watch every event of every session and the agent
|
|
280
|
+
never feels it. [How we got there →](https://befailproof.ai/blog/sub-millisecond-agent-enforcement/)
|
|
281
|
+
- **Always on, even when you're not.** It runs as a system service from boot, with no
|
|
282
|
+
login needed. Overnight jobs, cron runs and detached sessions get the same protection
|
|
283
|
+
as the one in your terminal.
|
|
284
|
+
- **One daemon, always in sync.** The same process ships every run to Cloud and keeps
|
|
285
|
+
your policies current, so a policy you approve reaches every machine without a
|
|
286
|
+
redeploy.
|
|
225
287
|
|
|
226
|
-
|
|
227
|
-
[Read a trace](https://docs.befailproof.ai/sessions/read-a-trace) ·
|
|
228
|
-
[Local audit](https://docs.befailproof.ai/audits/local-audit)
|
|
288
|
+
---
|
|
229
289
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
290
|
+
## Failproof Cloud: a harness that improves itself
|
|
291
|
+
|
|
292
|
+
Generic guardrails are written for everyone's agent. Failproof Cloud is built for
|
|
293
|
+
**yours**, from **your agent's own traces**, whether you run one agent or a hundred.
|
|
294
|
+
|
|
295
|
+
Every run feeds a loop that makes the harness around your agent better:
|
|
296
|
+
|
|
297
|
+
1. **Trace.** Every prompt, model call, tool call and result, live and replayable, with
|
|
298
|
+
parallel sub-agents on their own lanes, latency, cost and context windows, and SQL
|
|
299
|
+
over all of it.
|
|
300
|
+
2. **Audit.** Audits read your sessions on a schedule and cluster what went wrong into
|
|
301
|
+
named failure modes: the loops, wrong tools and quiet give-ups that are specific to
|
|
302
|
+
your agent. Each one becomes an **insight**, backed by the sessions that prove it.
|
|
303
|
+
3. **Check.** Turn an insight into an eval and every new session is scored for it, by
|
|
304
|
+
code, the decision model, an LLM judge or an agent. When the failure comes back,
|
|
305
|
+
alerts reach you on Slack, email or a signed webhook.
|
|
306
|
+
4. **Fix.** Hit **prevent this →** and Failproof writes the policy for that exact
|
|
307
|
+
failure. It tests the policy against your agent's past tool calls, then rolls it out,
|
|
308
|
+
observing first or enforcing right away.
|
|
309
|
+
5. **Repeat.** The next audit runs on traces where that failure can't happen any more,
|
|
310
|
+
and finds the next one.
|
|
311
|
+
|
|
312
|
+
The model never changes. The harness around it learns from every failure. It's the idea
|
|
313
|
+
behind our [FIRE study](https://befailproof.ai/research/runtime-policies/), where
|
|
314
|
+
policies derived from an agent's failures took task success from **37% to 69%** on the
|
|
315
|
+
failures they recognised. Same model, no fine-tuning.
|
|
316
|
+
|
|
317
|
+
> "The audits are the part that changed how we operate. We now have fewer incidents,
|
|
318
|
+
> less compute waste, and faster shipping."
|
|
319
|
+
> — Pratheep Velicherla, CTO, Testsigma
|
|
320
|
+
|
|
321
|
+
Ask the **failproof agent** anything about your agent in plain English, or pull the same
|
|
322
|
+
data into your own tools through the [MCP server](https://docs.befailproof.ai/reference/mcp),
|
|
323
|
+
[Slack](https://docs.befailproof.ai/reference/slack) and the `fp` CLI.
|
|
324
|
+
|
|
325
|
+
Start with one agent on the free plan: 5,000 runs a month, no card. Self-hosting in your
|
|
237
326
|
own cluster is available on the Enterprise plan.
|
|
238
327
|
|
|
239
|
-
→ [
|
|
240
|
-
[
|
|
328
|
+
→ [Start free](https://app.befailproof.ai) ·
|
|
329
|
+
[Pricing](https://befailproof.ai/pricing) ·
|
|
330
|
+
[Quickstart](https://docs.befailproof.ai/start/quickstart) ·
|
|
241
331
|
[Book a demo](https://befailproof.ai/get-a-demo)
|
|
242
332
|
|
|
243
333
|
---
|
|
@@ -255,17 +345,18 @@ own cluster is available on the Enterprise plan.
|
|
|
255
345
|
| [Sessions](https://docs.befailproof.ai/sessions/overview) | Follow a run: models, tools, errors, latency |
|
|
256
346
|
| [Read a trace](https://docs.befailproof.ai/sessions/read-a-trace) | What the execution graph is telling you |
|
|
257
347
|
| [Audits](https://docs.befailproof.ai/audits/overview) | Find failure patterns across many sessions |
|
|
258
|
-
| [
|
|
348
|
+
| [Evaluations](https://docs.befailproof.ai/evaluations/overview) | Score every session with code, the decision model or an LLM judge |
|
|
259
349
|
|
|
260
350
|
| Enforce | |
|
|
261
351
|
|---|---|
|
|
262
|
-
| [
|
|
263
|
-
| [
|
|
352
|
+
| [Write a policy](https://docs.befailproof.ai/policies/editor) | From an insight, from a sentence, or in code |
|
|
353
|
+
| [Decision-model policies](https://docs.befailproof.ai/policies/jev) | Jev judges calls against what the user asked |
|
|
264
354
|
| [Configuration](https://docs.befailproof.ai/policies/local-configuration) | Config scopes, merge rules and policy parameters |
|
|
265
355
|
|
|
266
356
|
| Instrument your own agent | |
|
|
267
357
|
|---|---|
|
|
268
358
|
| [Python SDK](https://docs.befailproof.ai/reference/custom-agents) | Report runs from an agent with no harness |
|
|
359
|
+
| [TypeScript SDK](https://docs.befailproof.ai/reference/custom-agents-typescript) | The same events from a Node agent |
|
|
269
360
|
| [Policy SDK](https://docs.befailproof.ai/reference/policy-sdk) | `allow` / `deny` / `instruct` reference |
|
|
270
361
|
|
|
271
362
|
---
|
package/bin/failproofai.mjs
CHANGED
|
@@ -669,7 +669,13 @@ async function runCli() {
|
|
|
669
669
|
// test on a seeded layout-2 home, not by a unit test: nothing below the CLI
|
|
670
670
|
// entry point can see this ordering.
|
|
671
671
|
const { checkLayoutForCli } = await import("../src/hooks/fp-reset");
|
|
672
|
-
|
|
672
|
+
// Setup brings the daemon to this version itself, so it is not told to
|
|
673
|
+
// run `update` first; its other modes (--status, --pause, …) still are.
|
|
674
|
+
const setupRun =
|
|
675
|
+
args[0] === "config" &&
|
|
676
|
+
!["--status", "--pause", "--resume", "--connect", "--disconnect"].some((f) => args.includes(f)) &&
|
|
677
|
+
!(args.includes("--machine-label") && !["--token", "--oss", "--agents"].some((f) => args.includes(f)));
|
|
678
|
+
const check = await checkLayoutForCli({ daemonUpdatedByCommand: setupRun });
|
|
673
679
|
// Written rather than `console.error`, which Bun paints red on a terminal.
|
|
674
680
|
if (check.lines.length > 0) process.stderr.write(`${check.lines.join("\n")}\n`);
|
|
675
681
|
if (check.fatal) await exitAfterFlush(1);
|
|
@@ -1143,13 +1149,16 @@ async function runCli() {
|
|
|
1143
1149
|
await printHelp({
|
|
1144
1150
|
name: "update",
|
|
1145
1151
|
usage: [["npm i -g failproofai@latest && failproofai update"]],
|
|
1146
|
-
options: [
|
|
1152
|
+
options: [
|
|
1153
|
+
["--no-daemon", "Migrate everything but leave the daemon as is"],
|
|
1154
|
+
["--no-restart", "Leave running Hermes and OpenClaw gateways as they are"],
|
|
1155
|
+
],
|
|
1147
1156
|
optionsCol: 20,
|
|
1148
1157
|
});
|
|
1149
1158
|
process.exit(0);
|
|
1150
1159
|
}
|
|
1151
1160
|
|
|
1152
|
-
const KNOWN = new Set(["--no-daemon"]);
|
|
1161
|
+
const KNOWN = new Set(["--no-daemon", "--no-restart"]);
|
|
1153
1162
|
const unknown = subArgs.find((a) => a.startsWith("-") && !KNOWN.has(a));
|
|
1154
1163
|
if (unknown) {
|
|
1155
1164
|
throw new CliError(
|
|
@@ -1162,107 +1171,43 @@ async function runCli() {
|
|
|
1162
1171
|
// this file, which this command is exempt from. Reading the ledger and
|
|
1163
1172
|
// inferring "the top-level check must have done it" was the first version, and
|
|
1164
1173
|
// it is the kind of indirection that reads fine and reports the wrong thing
|
|
1165
|
-
// the moment either half moves.
|
|
1166
|
-
|
|
1167
|
-
const {
|
|
1168
|
-
const
|
|
1169
|
-
const
|
|
1174
|
+
// the moment either half moves. The steps are shared with `config`, which
|
|
1175
|
+
// runs them after the first setup on a new version (src/hooks/update-run.ts).
|
|
1176
|
+
const { runUpdateSteps, markUpdated } = await import("../src/hooks/update-run");
|
|
1177
|
+
const noDaemon = subArgs.includes("--no-daemon");
|
|
1178
|
+
const run = await runUpdateSteps({
|
|
1179
|
+
layout: true,
|
|
1180
|
+
daemon: !noDaemon,
|
|
1181
|
+
// A daemon left as it is may not serve the new plugin, so --no-daemon
|
|
1182
|
+
// leaves the gateways alone too.
|
|
1183
|
+
restart: !noDaemon && !subArgs.includes("--no-restart"),
|
|
1184
|
+
noteSkippedDaemon: noDaemon,
|
|
1185
|
+
});
|
|
1170
1186
|
|
|
1171
|
-
if (
|
|
1187
|
+
if (run.futureLayout) {
|
|
1172
1188
|
await printReport("update", [
|
|
1173
1189
|
`This machine's failproofai directory was written by a NEWER version ` +
|
|
1174
|
-
`(layout ${
|
|
1190
|
+
`(layout ${run.futureLayout.found}; this build speaks ${run.futureLayout.speaks}). This CLI is the stale half:`,
|
|
1175
1191
|
"",
|
|
1176
1192
|
" npm install -g failproofai@latest",
|
|
1177
|
-
], { ok: false, meta: `layout ${
|
|
1193
|
+
], { ok: false, meta: `layout ${run.futureLayout.found}` });
|
|
1178
1194
|
await track("cli_update", { ok: false, reason: "future_layout" });
|
|
1179
1195
|
lastSubcommand = null;
|
|
1180
1196
|
await exitAfterFlush(1);
|
|
1181
1197
|
return;
|
|
1182
1198
|
}
|
|
1183
1199
|
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
const report = [];
|
|
1188
|
-
let migrationsRan = 0;
|
|
1189
|
-
let migrationFailed = false;
|
|
1190
|
-
if (state.kind === "stale") {
|
|
1191
|
-
const run = runMigrations(state.found);
|
|
1192
|
-
migrationsRan = run.steps.length;
|
|
1193
|
-
migrationFailed = Boolean(run.failed);
|
|
1194
|
-
for (const step of run.steps) {
|
|
1195
|
-
report.push(` ${step.ok ? "migrated" : "FAILED "} layout ${step.from} → ${step.to}`);
|
|
1196
|
-
}
|
|
1197
|
-
if (run.backedUp.length > 0) report.push("", `Saved first: ${run.backedUp.join(", ")}`);
|
|
1198
|
-
// Each failing half marks its own line (the daemon's lines arrive with
|
|
1199
|
-
// their ✕ already): the report opens on whatever ran first, often a
|
|
1200
|
-
// success, and printReport's guess would put the ✕ there.
|
|
1201
|
-
if (run.failed) {
|
|
1202
|
-
report.push(
|
|
1203
|
-
"",
|
|
1204
|
-
`✕ Step ${run.failed.from} → ${run.failed.to} did not finish: ${run.failed.error}`,
|
|
1205
|
-
` The home is still marked layout ${state.found} and will be retried.`,
|
|
1206
|
-
);
|
|
1207
|
-
}
|
|
1208
|
-
} else {
|
|
1209
|
-
report.push(`Home is at layout ${LAYOUT_VERSION}; no migration was needed.`);
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
// The daemon is refreshed even when a step failed, and deliberately: the
|
|
1213
|
-
// binary and the layout are independent halves, and leaving a version-skewed
|
|
1214
|
-
// daemon behind on top of a failed migration is strictly worse than fixing
|
|
1215
|
-
// the half that can be fixed. The exit code still reports the failure.
|
|
1216
|
-
let daemonOk = true;
|
|
1217
|
-
if (subArgs.includes("--no-daemon")) {
|
|
1218
|
-
report.push("", "Skipped the daemon (--no-daemon). Its version may not match this CLI.");
|
|
1219
|
-
} else {
|
|
1220
|
-
const svc = await import("../src/hooks/daemon-service");
|
|
1221
|
-
if (!svc.isDaemonSupportedPlatform()) {
|
|
1222
|
-
report.push("", `failproofaid does not run on ${process.platform}; nothing to update.`);
|
|
1223
|
-
} else {
|
|
1224
|
-
// `refreshDaemonToCliVersion` answers "is there a service at all" itself,
|
|
1225
|
-
// so there is no separate installed check to get out of step with it.
|
|
1226
|
-
const result = await svc.refreshDaemonToCliVersion();
|
|
1227
|
-
report.push("", ...result.lines);
|
|
1228
|
-
daemonOk = result.ok;
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
// Hermes is migrated AFTER the daemon, and gated on what the daemon that is
|
|
1233
|
-
// now running can do: the native plugin needs `policyEvaluation`, which
|
|
1234
|
-
// ≤1.0.5 daemons lack, so when the swap above could not happen (a sudo
|
|
1235
|
-
// system service with no sudo) the shell hooks stay and this fails loudly.
|
|
1236
|
-
let hermesOk = true;
|
|
1237
|
-
let hermesMigrated = 0;
|
|
1238
|
-
try {
|
|
1239
|
-
const { runHermesUpdateMigration } = await import("../src/hooks/hermes-update");
|
|
1240
|
-
const svc = await import("../src/hooks/daemon-service");
|
|
1241
|
-
const hermesResult = await runHermesUpdateMigration({
|
|
1242
|
-
daemonSupportsPolicyEvaluation: () => svc.probeDaemonPolicyEvaluation(),
|
|
1243
|
-
});
|
|
1244
|
-
if (hermesResult.lines.length > 0) {
|
|
1245
|
-
// Its lines open on a "Hermes:" heading over one row per profile; on a
|
|
1246
|
-
// failure the heading carries the ✕ and the rows say which profile.
|
|
1247
|
-
const [heading, ...rest] = hermesResult.lines;
|
|
1248
|
-
report.push("", hermesResult.ok ? heading : `✕ ${heading}`, ...rest);
|
|
1249
|
-
}
|
|
1250
|
-
hermesOk = hermesResult.ok;
|
|
1251
|
-
hermesMigrated = hermesResult.profiles.filter((p) => p.status === "migrated").length;
|
|
1252
|
-
} catch (err) {
|
|
1253
|
-
report.push("", `✕ Hermes migration failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1254
|
-
hermesOk = false;
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
const updateOk = daemonOk && !migrationFailed && hermesOk;
|
|
1200
|
+
const report = run.lines;
|
|
1201
|
+
const updateOk = run.ok;
|
|
1202
|
+
if (updateOk && !noDaemon) markUpdated(version);
|
|
1258
1203
|
// No `v${version}` meta: the header already names the version.
|
|
1259
1204
|
await printReport("update", report, { ok: updateOk });
|
|
1260
1205
|
await track("cli_update", {
|
|
1261
1206
|
ok: updateOk,
|
|
1262
|
-
migrations: migrationsRan,
|
|
1263
|
-
migration_failed: migrationFailed,
|
|
1264
|
-
hermes_ok: hermesOk,
|
|
1265
|
-
hermes_migrated: hermesMigrated,
|
|
1207
|
+
migrations: run.migrationsRan,
|
|
1208
|
+
migration_failed: run.migrationFailed,
|
|
1209
|
+
hermes_ok: run.hermesOk,
|
|
1210
|
+
hermes_migrated: run.hermesMigrated,
|
|
1266
1211
|
});
|
|
1267
1212
|
lastSubcommand = null;
|
|
1268
1213
|
await exitAfterFlush(updateOk ? 0 : 1);
|
|
@@ -2074,6 +2019,8 @@ async function runCli() {
|
|
|
2074
2019
|
if (refusal) throw new CliError(refusal);
|
|
2075
2020
|
}
|
|
2076
2021
|
const { runConfigureWizard } = await import("../src/hooks/configure-wizard");
|
|
2022
|
+
const { pluggedProfiles } = await import("../src/hooks/update-run");
|
|
2023
|
+
const pluggedBefore = await pluggedProfiles().catch(() => []);
|
|
2077
2024
|
const result = await runConfigureWizard(
|
|
2078
2025
|
{},
|
|
2079
2026
|
{
|
|
@@ -2097,6 +2044,35 @@ async function runCli() {
|
|
|
2097
2044
|
labelExit = renamed.exitCode;
|
|
2098
2045
|
}
|
|
2099
2046
|
}
|
|
2047
|
+
// The first setup on a new version finishes the upgrade too: without this a
|
|
2048
|
+
// running Hermes or OpenClaw gateway kept the plugin it loaded before (or
|
|
2049
|
+
// none) until someone thought to run `update`. Setup has already brought
|
|
2050
|
+
// the daemon to this version and the entry check migrated the home.
|
|
2051
|
+
let updateExit = 0;
|
|
2052
|
+
if (result.applied) {
|
|
2053
|
+
const { runUpdateSteps, markUpdated, setupNeedsUpdateSteps, setupGatewayLine, restartNewlyPlugged } =
|
|
2054
|
+
await import("../src/hooks/update-run");
|
|
2055
|
+
const { screenKit, colorsEnabled } = await import("../src/hooks/tui");
|
|
2056
|
+
const kit = screenKit({ color: colorsEnabled(process.stdout) });
|
|
2057
|
+
if (!setupNeedsUpdateSteps(version)) {
|
|
2058
|
+
// Already updated on this version: only a profile this run plugged in
|
|
2059
|
+
// (one created since) has a gateway still running without the plugin.
|
|
2060
|
+
const gateway = setupGatewayLine(await restartNewlyPlugged(pluggedBefore).catch(() => []));
|
|
2061
|
+
if (gateway) process.stdout.write(`${gateway.ok ? kit.ok(gateway.text) : kit.caution(gateway.text)}\n`);
|
|
2062
|
+
} else {
|
|
2063
|
+
const run = await runUpdateSteps({ layout: false, daemon: false, restart: true });
|
|
2064
|
+
// One line at most, in update's own words; a Hermes failure keeps its
|
|
2065
|
+
// existing ✕ line so it is not lost.
|
|
2066
|
+
const gateway = setupGatewayLine(run.restarts);
|
|
2067
|
+
const out = [
|
|
2068
|
+
...run.lines.filter((l) => l.startsWith("✕")),
|
|
2069
|
+
...(gateway ? [gateway.ok ? kit.ok(gateway.text) : kit.caution(gateway.text)] : []),
|
|
2070
|
+
];
|
|
2071
|
+
if (out.length > 0) process.stdout.write(`${out.join("\n")}\n`);
|
|
2072
|
+
if (run.ok) markUpdated(version);
|
|
2073
|
+
else updateExit = 1;
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2100
2076
|
await warnTokenOnArgv();
|
|
2101
2077
|
await track("cli_configure_invoked", {
|
|
2102
2078
|
applied: result.applied,
|
|
@@ -2115,7 +2091,7 @@ async function runCli() {
|
|
|
2115
2091
|
// regardless discarded it: a fleet script could not tell "the user pressed
|
|
2116
2092
|
// Esc" from "this machine could not install the required daemon and is
|
|
2117
2093
|
// unconfigured". Cancelling is not a failure; the other two are.
|
|
2118
|
-
await exitAfterFlush(!result.applied && result.abort && result.abort !== "cancelled" ? 1 : labelExit);
|
|
2094
|
+
await exitAfterFlush(!result.applied && result.abort && result.abort !== "cancelled" ? 1 : labelExit || updateExit);
|
|
2119
2095
|
return;
|
|
2120
2096
|
}
|
|
2121
2097
|
|