failproofai 0.0.5 → 0.0.6-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.failproofai/policies/review-policies.mjs +112 -0
- package/.next/standalone/.failproofai/policies/workflow-policies.mjs +2 -1
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +5 -5
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/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 +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
- 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 +2 -2
- package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
- 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 +8 -8
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0okos0k._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0a~g15g._.js → [root-of-the-server]__0rh.18_._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +6 -6
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0qn95h3._.js → [root-of-the-server]__0~kmh8w._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
- package/.next/standalone/.next/server/pages/404.html +2 -2
- 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 +9 -9
- package/.next/standalone/.next/static/chunks/{0sme4lkv.tgn-.js → 01b~z8f1ws0rk.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0lgbwkfqmnsmc.js → 03rz6ykw-a2xi.js} +1 -1
- package/.next/standalone/.next/static/chunks/{17manv47o-~wp.js → 08t08igdql9yt.js} +1 -1
- package/.next/standalone/.next/static/chunks/09_k80d~cq2wg.js +4 -0
- package/.next/standalone/.next/static/chunks/{0ksdlt_1hucdm.js → 0bvhsa6zva2o..js} +1 -1
- package/.next/standalone/.next/static/chunks/{09ikntpt2-o9b.js → 0gbf4cphy8ksq.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0yumumfzx_f27.js → 0v.yd0kg_ld3r.js} +1 -1
- package/.next/standalone/.next/static/chunks/{13juklu.vksks.js → 0wlyoif4_kj_t.js} +1 -1
- package/.next/standalone/.next/static/chunks/{09e7drilkf1sn.js → 12simlrcfk3g2.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0em7tspi4kylh.js → 12~yi9oj8av8p.js} +2 -2
- package/.next/standalone/.next/static/chunks/{turbopack-0r26pc8h0y_-e.js → turbopack-0o7k.hakttp4k.js} +1 -1
- package/.next/standalone/CHANGELOG.md +13 -0
- package/.next/standalone/README.md +2 -2
- package/.next/standalone/bun.lock +43 -85
- package/.next/standalone/dist/cli.mjs +107 -3
- package/.next/standalone/docs/ar/architecture.mdx +65 -64
- package/.next/standalone/docs/ar/configuration.mdx +42 -42
- package/.next/standalone/docs/ar/custom-policies.mdx +62 -64
- package/.next/standalone/docs/built-in-policies.mdx +37 -0
- package/.next/standalone/docs/custom-policies.mdx +1 -1
- package/.next/standalone/docs/de/architecture.mdx +92 -92
- package/.next/standalone/docs/de/configuration.mdx +34 -34
- package/.next/standalone/docs/de/custom-policies.mdx +49 -50
- package/.next/standalone/docs/es/architecture.mdx +72 -72
- package/.next/standalone/docs/es/configuration.mdx +25 -25
- package/.next/standalone/docs/es/custom-policies.mdx +48 -49
- package/.next/standalone/docs/examples.mdx +54 -0
- package/.next/standalone/docs/fr/architecture.mdx +53 -53
- package/.next/standalone/docs/fr/configuration.mdx +25 -25
- package/.next/standalone/docs/fr/custom-policies.mdx +42 -43
- package/.next/standalone/docs/getting-started.mdx +52 -0
- package/.next/standalone/docs/he/architecture.mdx +66 -66
- package/.next/standalone/docs/he/configuration.mdx +53 -52
- package/.next/standalone/docs/he/custom-policies.mdx +72 -73
- package/.next/standalone/docs/hi/architecture.mdx +106 -106
- package/.next/standalone/docs/hi/configuration.mdx +39 -39
- package/.next/standalone/docs/hi/custom-policies.mdx +75 -76
- package/.next/standalone/docs/i18n/README.ar.md +66 -66
- package/.next/standalone/docs/i18n/README.de.md +38 -38
- package/.next/standalone/docs/i18n/README.es.md +38 -38
- package/.next/standalone/docs/i18n/README.fr.md +42 -42
- package/.next/standalone/docs/i18n/README.he.md +67 -67
- package/.next/standalone/docs/i18n/README.hi.md +70 -70
- package/.next/standalone/docs/i18n/README.it.md +62 -62
- package/.next/standalone/docs/i18n/README.ja.md +54 -54
- package/.next/standalone/docs/i18n/README.ko.md +58 -58
- package/.next/standalone/docs/i18n/README.pt-br.md +43 -43
- package/.next/standalone/docs/i18n/README.ru.md +69 -69
- package/.next/standalone/docs/i18n/README.tr.md +76 -76
- package/.next/standalone/docs/i18n/README.vi.md +70 -70
- package/.next/standalone/docs/i18n/README.zh.md +52 -52
- package/.next/standalone/docs/it/architecture.mdx +54 -53
- package/.next/standalone/docs/it/configuration.mdx +44 -45
- package/.next/standalone/docs/it/custom-policies.mdx +76 -78
- package/.next/standalone/docs/ja/architecture.mdx +93 -93
- package/.next/standalone/docs/ja/configuration.mdx +47 -47
- package/.next/standalone/docs/ja/custom-policies.mdx +62 -63
- package/.next/standalone/docs/ko/architecture.mdx +66 -66
- package/.next/standalone/docs/ko/configuration.mdx +35 -35
- package/.next/standalone/docs/ko/custom-policies.mdx +71 -72
- package/.next/standalone/docs/pt-br/architecture.mdx +55 -55
- package/.next/standalone/docs/pt-br/configuration.mdx +35 -35
- package/.next/standalone/docs/pt-br/custom-policies.mdx +60 -61
- package/.next/standalone/docs/ru/architecture.mdx +59 -60
- package/.next/standalone/docs/ru/configuration.mdx +52 -53
- package/.next/standalone/docs/ru/custom-policies.mdx +68 -69
- package/.next/standalone/docs/tr/architecture.mdx +124 -124
- package/.next/standalone/docs/tr/configuration.mdx +45 -46
- package/.next/standalone/docs/tr/custom-policies.mdx +75 -75
- package/.next/standalone/docs/vi/architecture.mdx +65 -64
- package/.next/standalone/docs/vi/configuration.mdx +41 -41
- package/.next/standalone/docs/vi/custom-policies.mdx +68 -69
- package/.next/standalone/docs/zh/architecture.mdx +67 -67
- package/.next/standalone/docs/zh/configuration.mdx +34 -34
- package/.next/standalone/docs/zh/custom-policies.mdx +53 -54
- 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/pages-turbo.runtime.prod.js +7 -7
- package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
- package/.next/standalone/node_modules/next/dist/server/config-schema.js +10 -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/start-server.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/render.js +27 -20
- package/.next/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.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 +15 -15
- package/.next/standalone/package.json +2 -2
- package/.next/standalone/server.js +1 -1
- package/.next/standalone/src/hooks/builtin-policies.ts +131 -0
- package/README.md +2 -2
- package/dist/cli.mjs +107 -3
- package/package.json +2 -2
- package/src/hooks/builtin-policies.ts +131 -0
- package/.next/standalone/.next/static/chunks/0_yayar~bpphd.js +0 -4
- /package/.next/standalone/.next/static/{hYQM6iCWnF1W5XDpsIRhV → CkmOT-ZvDN-sVULinGVKT}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{hYQM6iCWnF1W5XDpsIRhV → CkmOT-ZvDN-sVULinGVKT}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{hYQM6iCWnF1W5XDpsIRhV → CkmOT-ZvDN-sVULinGVKT}/_ssgManifest.js +0 -0
|
@@ -21,23 +21,23 @@
|
|
|
21
21
|
[](https://github.com/exospherehost/failproofai/actions)
|
|
22
22
|
[](https://join.slack.com/t/failproofai/shared_invite/zt-3v63b7k5e-O3NBHmj8X6n9gZSGDx6ggQ)
|
|
23
23
|
|
|
24
|
-
**
|
|
24
|
+
**Bản dịch**: [简体中文](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)
|
|
25
25
|
|
|
26
|
-
Cách dễ nhất để quản lý các chính sách
|
|
26
|
+
Cách dễ nhất để quản lý các chính sách giúp AI agents của bạn hoạt động đáng tin cậy, tập trung vào nhiệm vụ và chạy tự động - cho **Claude Code** & **Agents SDK**.
|
|
27
27
|
|
|
28
|
-
- **30 Chính sách tích hợp sẵn** - Bắt các lỗi phổ biến của agent ngay
|
|
29
|
-
- **Chính sách tùy chỉnh** - Viết các quy tắc độ tin cậy của riêng bạn bằng JavaScript. Sử dụng API `allow`/`deny`/`instruct` để thực thi các quy ước, ngăn chặn sự
|
|
30
|
-
- **Cấu hình dễ dàng** -
|
|
31
|
-
- **Agent Monitor** - Xem những gì
|
|
28
|
+
- **30 Chính sách tích hợp sẵn** - Bắt các chế độ lỗi phổ biến của agent ngay lập tức. Chặn các lệnh nguy hiểm, ngăn chặn rò rỉ bí mật, giữ agents trong ranh giới dự án, phát hiện vòng lặp, và nhiều hơn nữa.
|
|
29
|
+
- **Chính sách tùy chỉnh** - Viết các quy tắc độ tin cậy của riêng bạn bằng JavaScript. Sử dụng API `allow`/`deny`/`instruct` để thực thi các quy ước, ngăn chặn sự lệch lạc, kiểm soát các hoạt động, hoặc tích hợp với các hệ thống bên ngoài.
|
|
30
|
+
- **Cấu hình dễ dàng** - Tinh chỉnh bất kỳ chính sách nào mà không cần viết code. Đặt danh sách cho phép, nhánh được bảo vệ, ngưỡng cho mỗi dự án hoặc toàn cục. Ba phạm vi cấu hình tự động hợp nhất.
|
|
31
|
+
- **Agent Monitor** - Xem những gì agents của bạn đã làm khi bạn vắng mặt. Duyệt các phiên làm việc, kiểm tra từng lệnh gọi công cụ, và xem xét chính xác nơi các chính sách được áp dụng.
|
|
32
32
|
|
|
33
|
-
Mọi thứ chạy cục bộ - không có dữ liệu nào rời khỏi máy
|
|
33
|
+
Mọi thứ chạy cục bộ - không có dữ liệu nào rời khỏi máy của bạn.
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
37
|
## Yêu cầu
|
|
38
38
|
|
|
39
39
|
- Node.js >= 20.9.0
|
|
40
|
-
- Bun >= 1.3.0 (tùy chọn - chỉ cần thiết
|
|
40
|
+
- Bun >= 1.3.0 (tùy chọn - chỉ cần thiết cho phát triển / xây dựng từ nguồn)
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
@@ -53,7 +53,7 @@ bun add -g failproofai
|
|
|
53
53
|
|
|
54
54
|
## Bắt đầu nhanh
|
|
55
55
|
|
|
56
|
-
### 1. Bật chính sách
|
|
56
|
+
### 1. Bật chính sách toàn cục
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
59
|
failproofai policies --install
|
|
@@ -61,13 +61,13 @@ failproofai policies --install
|
|
|
61
61
|
|
|
62
62
|
Ghi các mục hook vào `~/.claude/settings.json`. Claude Code sẽ gọi failproofai trước và sau mỗi lệnh gọi công cụ.
|
|
63
63
|
|
|
64
|
-
### 2. Khởi
|
|
64
|
+
### 2. Khởi động bảng điều khiển
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
67
|
failproofai
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
Mở `http://localhost:8020` - duyệt các phiên, kiểm tra nhật ký, quản lý chính sách.
|
|
70
|
+
Mở `http://localhost:8020` - duyệt các phiên làm việc, kiểm tra nhật ký, quản lý chính sách.
|
|
71
71
|
|
|
72
72
|
### 3. Kiểm tra những gì đang hoạt động
|
|
73
73
|
|
|
@@ -81,9 +81,9 @@ failproofai policies
|
|
|
81
81
|
|
|
82
82
|
### Phạm vi
|
|
83
83
|
|
|
84
|
-
| Phạm vi | Lệnh | Nơi
|
|
85
|
-
|
|
86
|
-
| Toàn
|
|
84
|
+
| Phạm vi | Lệnh | Nơi ghi |
|
|
85
|
+
|--------|------|---------|
|
|
86
|
+
| Toàn cục (mặc định) | `failproofai policies --install` | `~/.claude/settings.json` |
|
|
87
87
|
| Dự án | `failproofai policies --install --scope project` | `.claude/settings.json` |
|
|
88
88
|
| Cục bộ | `failproofai policies --install --scope local` | `.claude/settings.local.json` |
|
|
89
89
|
|
|
@@ -105,7 +105,7 @@ failproofai policies --uninstall --scope project
|
|
|
105
105
|
|
|
106
106
|
## Cấu hình
|
|
107
107
|
|
|
108
|
-
Cấu hình chính sách nằm trong `~/.failproofai/policies-config.json` (toàn
|
|
108
|
+
Cấu hình chính sách nằm trong `~/.failproofai/policies-config.json` (toàn cục) hoặc `.failproofai/policies-config.json` trong dự án của bạn (theo dự án).
|
|
109
109
|
|
|
110
110
|
```json
|
|
111
111
|
{
|
|
@@ -120,15 +120,15 @@ Cấu hình chính sách nằm trong `~/.failproofai/policies-config.json` (toà
|
|
|
120
120
|
"policyParams": {
|
|
121
121
|
"block-sudo": {
|
|
122
122
|
"allowPatterns": ["sudo systemctl status", "sudo journalctl"],
|
|
123
|
-
"hint": "
|
|
123
|
+
"hint": "Use apt-get directly without sudo."
|
|
124
124
|
},
|
|
125
125
|
"block-push-master": {
|
|
126
126
|
"protectedBranches": ["main", "release", "prod"],
|
|
127
|
-
"hint": "
|
|
127
|
+
"hint": "Try creating a fresh branch instead."
|
|
128
128
|
},
|
|
129
129
|
"sanitize-api-keys": {
|
|
130
130
|
"additionalPatterns": [
|
|
131
|
-
{ "regex": "myco_[A-Za-z0-9]{32}", "label": "
|
|
131
|
+
{ "regex": "myco_[A-Za-z0-9]{32}", "label": "MyCo API key" }
|
|
132
132
|
]
|
|
133
133
|
},
|
|
134
134
|
"warn-large-file-write": {
|
|
@@ -138,39 +138,39 @@ Cấu hình chính sách nằm trong `~/.failproofai/policies-config.json` (toà
|
|
|
138
138
|
}
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
**Ba phạm vi cấu hình** được hợp nhất tự động (dự án → cục bộ → toàn
|
|
141
|
+
**Ba phạm vi cấu hình** được hợp nhất tự động (dự án → cục bộ → toàn cục). Xem [docs/configuration.mdx](docs/configuration.mdx) để biết các quy tắc hợp nhất đầy đủ.
|
|
142
142
|
|
|
143
143
|
---
|
|
144
144
|
|
|
145
145
|
## Chính sách tích hợp sẵn
|
|
146
146
|
|
|
147
147
|
| Chính sách | Mô tả | Có thể cấu hình |
|
|
148
|
-
|
|
149
|
-
| `block-sudo` | Ngăn
|
|
150
|
-
| `block-rm-rf` | Ngăn
|
|
151
|
-
| `block-curl-pipe-sh` | Ngăn
|
|
152
|
-
| `block-failproofai-commands` | Ngăn
|
|
153
|
-
| `sanitize-jwt` | Dừng các mã
|
|
154
|
-
| `sanitize-api-keys` | Dừng các khóa API
|
|
155
|
-
| `sanitize-connection-strings` | Dừng thông tin xác thực cơ sở dữ liệu
|
|
156
|
-
| `sanitize-private-key-content` | Che
|
|
157
|
-
| `sanitize-bearer-tokens` | Che
|
|
158
|
-
| `block-env-files` |
|
|
159
|
-
| `protect-env-vars` | Ngăn
|
|
160
|
-
| `block-read-outside-cwd` | Giữ
|
|
161
|
-
| `block-secrets-write` | Ngăn
|
|
162
|
-
| `block-push-master` | Ngăn
|
|
163
|
-
| `block-work-on-main` | Giữ
|
|
164
|
-
| `block-force-push` | Ngăn
|
|
165
|
-
| `warn-git-amend` | Nhắc nhở
|
|
166
|
-
| `warn-git-stash-drop` | Nhắc nhở
|
|
148
|
+
|-----------|-------|:---:|
|
|
149
|
+
| `block-sudo` | Ngăn agents chạy các lệnh hệ thống có đặc quyền | `allowPatterns` |
|
|
150
|
+
| `block-rm-rf` | Ngăn xóa tệp đệ quy vô tình | `allowPaths` |
|
|
151
|
+
| `block-curl-pipe-sh` | Ngăn agents đưa các tập lệnh không đáng tin cậy vào shell | |
|
|
152
|
+
| `block-failproofai-commands` | Ngăn tự gỡ cài đặt | |
|
|
153
|
+
| `sanitize-jwt` | Dừng các mã JWT rò rỉ vào ngữ cảnh agent | |
|
|
154
|
+
| `sanitize-api-keys` | Dừng các khóa API rò rỉ vào ngữ cảnh agent | `additionalPatterns` |
|
|
155
|
+
| `sanitize-connection-strings` | Dừng thông tin xác thực cơ sở dữ liệu rò rỉ vào ngữ cảnh agent | |
|
|
156
|
+
| `sanitize-private-key-content` | Che mờ các khối khóa riêng PEM khỏi đầu ra | |
|
|
157
|
+
| `sanitize-bearer-tokens` | Che mờ các mã Authorization Bearer từ đầu ra | |
|
|
158
|
+
| `block-env-files` | Giữ agents không đọc các tệp .env | |
|
|
159
|
+
| `protect-env-vars` | Ngăn agents in các biến môi trường | |
|
|
160
|
+
| `block-read-outside-cwd` | Giữ agents trong ranh giới dự án | `allowPaths` |
|
|
161
|
+
| `block-secrets-write` | Ngăn ghi vào các tệp khóa riêng và chứng chỉ | `additionalPatterns` |
|
|
162
|
+
| `block-push-master` | Ngăn đẩy vô tình tới main/master | `protectedBranches` |
|
|
163
|
+
| `block-work-on-main` | Giữ agents không hoạt động trên các nhánh được bảo vệ | `protectedBranches` |
|
|
164
|
+
| `block-force-push` | Ngăn `git push --force` | |
|
|
165
|
+
| `warn-git-amend` | Nhắc nhở agents trước khi sửa đổi commit | |
|
|
166
|
+
| `warn-git-stash-drop` | Nhắc nhở agents trước khi xóa stash | |
|
|
167
167
|
| `warn-all-files-staged` | Bắt `git add -A` vô tình | |
|
|
168
|
-
| `warn-destructive-sql` | Bắt DROP/DELETE
|
|
169
|
-
| `warn-schema-alteration` | Bắt ALTER TABLE trước khi thực
|
|
170
|
-
| `warn-large-file-write` | Bắt ghi tệp lớn bất ngờ | `thresholdKb` |
|
|
168
|
+
| `warn-destructive-sql` | Bắt SQL DROP/DELETE trước khi thực hiện | |
|
|
169
|
+
| `warn-schema-alteration` | Bắt ALTER TABLE trước khi thực hiện | |
|
|
170
|
+
| `warn-large-file-write` | Bắt các lần ghi tệp lớn bất ngờ | `thresholdKb` |
|
|
171
171
|
| `warn-package-publish` | Bắt `npm publish` vô tình | |
|
|
172
|
-
| `warn-background-process` | Bắt khởi chạy
|
|
173
|
-
| `warn-global-package-install` | Bắt cài đặt gói toàn
|
|
172
|
+
| `warn-background-process` | Bắt khởi chạy quy trình nền không dự định | |
|
|
173
|
+
| `warn-global-package-install` | Bắt cài đặt gói toàn cục không dự định | |
|
|
174
174
|
| …và nhiều hơn nữa | | |
|
|
175
175
|
|
|
176
176
|
Chi tiết chính sách đầy đủ và tham chiếu tham số: [docs/built-in-policies.mdx](docs/built-in-policies.mdx)
|
|
@@ -179,19 +179,19 @@ Chi tiết chính sách đầy đủ và tham chiếu tham số: [docs/built-in-
|
|
|
179
179
|
|
|
180
180
|
## Chính sách tùy chỉnh
|
|
181
181
|
|
|
182
|
-
Viết chính sách của riêng bạn để giữ
|
|
182
|
+
Viết các chính sách của riêng bạn để giữ agents đáng tin cậy và tập trung vào nhiệm vụ:
|
|
183
183
|
|
|
184
184
|
```js
|
|
185
185
|
import { customPolicies, allow, deny, instruct } from "failproofai";
|
|
186
186
|
|
|
187
187
|
customPolicies.add({
|
|
188
188
|
name: "no-production-writes",
|
|
189
|
-
description: "
|
|
189
|
+
description: "Block writes to paths containing 'production'",
|
|
190
190
|
match: { events: ["PreToolUse"] },
|
|
191
191
|
fn: async (ctx) => {
|
|
192
192
|
if (!["Write", "Edit"].includes(ctx.toolName ?? "")) return allow();
|
|
193
193
|
const path = ctx.toolInput?.file_path ?? "";
|
|
194
|
-
if (path.includes("production")) return deny("
|
|
194
|
+
if (path.includes("production")) return deny("Writes to production paths are blocked");
|
|
195
195
|
return allow();
|
|
196
196
|
},
|
|
197
197
|
});
|
|
@@ -205,49 +205,49 @@ failproofai policies --install --custom ./my-policies.js
|
|
|
205
205
|
|
|
206
206
|
### Trợ giúp quyết định
|
|
207
207
|
|
|
208
|
-
| Hàm | Hiệu
|
|
208
|
+
| Hàm | Hiệu quả |
|
|
209
209
|
|-----|---------|
|
|
210
210
|
| `allow()` | Cho phép thao tác |
|
|
211
|
-
| `allow(message)` | Cho phép và gửi
|
|
212
|
-
| `deny(message)` | Chặn thao tác;
|
|
213
|
-
| `instruct(message)` | Thêm
|
|
211
|
+
| `allow(message)` | Cho phép và gửi bối cảnh thông tin đến Claude |
|
|
212
|
+
| `deny(message)` | Chặn thao tác; tin nhắn được hiển thị cho Claude |
|
|
213
|
+
| `instruct(message)` | Thêm bối cảnh vào lời nhắc của Claude; không chặn |
|
|
214
214
|
|
|
215
215
|
### Đối tượng ngữ cảnh (`ctx`)
|
|
216
216
|
|
|
217
217
|
| Trường | Loại | Mô tả |
|
|
218
|
-
|
|
218
|
+
|-------|------|-------|
|
|
219
219
|
| `eventType` | `string` | `"PreToolUse"`, `"PostToolUse"`, `"Notification"`, `"Stop"` |
|
|
220
220
|
| `toolName` | `string` | Công cụ được gọi (`"Bash"`, `"Write"`, `"Read"`, …) |
|
|
221
|
-
| `toolInput` | `object` |
|
|
222
|
-
| `payload` | `object` |
|
|
221
|
+
| `toolInput` | `object` | Các tham số đầu vào của công cụ |
|
|
222
|
+
| `payload` | `object` | Toàn bộ trọng tải sự kiện thô |
|
|
223
223
|
| `session.cwd` | `string` | Thư mục làm việc của phiên Claude Code |
|
|
224
|
-
| `session.sessionId` | `string` |
|
|
224
|
+
| `session.sessionId` | `string` | Định danh phiên |
|
|
225
225
|
| `session.transcriptPath` | `string` | Đường dẫn đến tệp phiên ghi âm |
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
Hook tùy chỉnh hỗ trợ nhập cục bộ chuyển tiếp, async/await, và truy cập vào `process.env`. Các lỗi mở không kiểm soát được (ghi vào `~/.failproofai/hook.log`, các chính sách tích hợp sẵn tiếp tục). Xem [docs/custom-hooks.mdx](docs/custom-hooks.mdx) để biết hướng dẫn đầy đủ.
|
|
228
228
|
|
|
229
229
|
### Chính sách dựa trên quy ước
|
|
230
230
|
|
|
231
|
-
|
|
231
|
+
Bỏ các tệp `*policies.{js,mjs,ts}` vào `.failproofai/policies/` và chúng sẽ tự động được tải — không cần cờ `--custom` hoặc thay đổi cấu hình. Hoạt động giống như git hooks: bỏ một tệp, nó chỉ hoạt động.
|
|
232
232
|
|
|
233
233
|
```text
|
|
234
|
-
# Cấp
|
|
234
|
+
# Cấp dự án — được commit vào git, chia sẻ với đội
|
|
235
235
|
.failproofai/policies/security-policies.mjs
|
|
236
236
|
.failproofai/policies/workflow-policies.mjs
|
|
237
237
|
|
|
238
|
-
# Cấp
|
|
238
|
+
# Cấp người dùng — cá nhân, áp dụng cho tất cả các dự án
|
|
239
239
|
~/.failproofai/policies/my-policies.mjs
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
-
Cả hai cấp
|
|
242
|
+
Cả hai cấp tải (hợp nhất). Các tệp được tải theo thứ tự bảng chữ cái trong mỗi thư mục. Tiền tố bằng `01-`, `02-`, v.v. để kiểm soát thứ tự. Xem [examples/convention-policies/](examples/convention-policies/) để biết các ví dụ sẵn sàng sử dụng.
|
|
243
243
|
|
|
244
244
|
---
|
|
245
245
|
|
|
246
|
-
##
|
|
246
|
+
## Telemetry
|
|
247
247
|
|
|
248
|
-
Failproof AI thu thập telemetry sử dụng ẩn danh thông qua PostHog để hiểu
|
|
248
|
+
Failproof AI thu thập telemetry sử dụng ẩn danh thông qua PostHog để hiểu mức độ sử dụng tính năng. Nội dung phiên, tên tệp, đầu vào công cụ hoặc thông tin cá nhân không bao giờ được gửi.
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
Vô hiệu hóa nó:
|
|
251
251
|
|
|
252
252
|
```bash
|
|
253
253
|
FAILPROOFAI_TELEMETRY_DISABLED=1 failproofai
|
|
@@ -258,14 +258,14 @@ FAILPROOFAI_TELEMETRY_DISABLED=1 failproofai
|
|
|
258
258
|
## Tài liệu
|
|
259
259
|
|
|
260
260
|
| Hướng dẫn | Mô tả |
|
|
261
|
-
|
|
261
|
+
|---------|-------|
|
|
262
262
|
| [Getting Started](docs/getting-started.mdx) | Cài đặt và các bước đầu tiên |
|
|
263
263
|
| [Built-in Policies](docs/built-in-policies.mdx) | Tất cả 30 chính sách tích hợp sẵn với các tham số |
|
|
264
|
-
| [Custom Policies](docs/custom-policies.mdx) | Viết chính sách của riêng bạn |
|
|
264
|
+
| [Custom Policies](docs/custom-policies.mdx) | Viết các chính sách của riêng bạn |
|
|
265
265
|
| [Configuration](docs/configuration.mdx) | Định dạng tệp cấu hình và hợp nhất phạm vi |
|
|
266
266
|
| [Dashboard](docs/dashboard.mdx) | Giám sát các phiên và xem xét hoạt động chính sách |
|
|
267
267
|
| [Architecture](docs/architecture.mdx) | Cách hệ thống hook hoạt động |
|
|
268
|
-
| [Testing](docs/testing.mdx) | Chạy
|
|
268
|
+
| [Testing](docs/testing.mdx) | Chạy bài kiểm tra và viết các bài mới |
|
|
269
269
|
|
|
270
270
|
### Chạy tài liệu cục bộ
|
|
271
271
|
|
|
@@ -274,7 +274,7 @@ docker build -f Dockerfile.docs -t failproofai-docs .
|
|
|
274
274
|
docker run --rm -p 3000:3000 failproofai-docs
|
|
275
275
|
```
|
|
276
276
|
|
|
277
|
-
Mở trang Mintlify
|
|
277
|
+
Mở trang web tài liệu Mintlify tại `http://localhost:3000`. Container theo dõi các thay đổi nếu bạn gắn thư mục tài liệu:
|
|
278
278
|
|
|
279
279
|
```bash
|
|
280
280
|
docker run --rm -p 3000:3000 -v $(pwd)/docs:/app/docs failproofai-docs
|
|
@@ -282,11 +282,11 @@ docker run --rm -p 3000:3000 -v $(pwd)/docs:/app/docs failproofai-docs
|
|
|
282
282
|
|
|
283
283
|
---
|
|
284
284
|
|
|
285
|
-
##
|
|
285
|
+
## Lưu ý cho những người đóng góp failproofai
|
|
286
286
|
|
|
287
|
-
|
|
287
|
+
`.claude/settings.json` của repo này sử dụng `bun ./bin/failproofai.mjs --hook <EventType>` thay vì lệnh `npx -y failproofai` tiêu chuẩn. Điều này là vì chạy `npx -y failproofai` bên trong chính dự án failproofai tạo ra một xung đột tự tham chiếu.
|
|
288
288
|
|
|
289
|
-
Đối với tất cả các
|
|
289
|
+
Đối với tất cả các repo khác, phương pháp được khuyến nghị là `npx -y failproofai`, được cài đặt thông qua:
|
|
290
290
|
|
|
291
291
|
```bash
|
|
292
292
|
failproofai policies --install --scope project
|
|
@@ -304,5 +304,5 @@ Xem [LICENSE](LICENSE).
|
|
|
304
304
|
|
|
305
305
|
---
|
|
306
306
|
|
|
307
|
-
Được xây dựng và duy trì bởi **ExosphereHost: Phòng thí nghiệm nghiên cứu độ tin cậy cho
|
|
307
|
+
Được xây dựng và duy trì bởi **ExosphereHost: Phòng thí nghiệm nghiên cứu độ tin cậy cho Agents của bạn**. Chúng tôi giúp các doanh nghiệp và startup cải thiện độ tin cậy của các AI agents của họ thông qua các agents, phần mềm và chuyên môn của chính chúng tôi. Tìm hiểu thêm tại [exosphere.host](https://exosphere.host).
|
|
308
308
|
```
|
|
@@ -21,23 +21,23 @@
|
|
|
21
21
|
[](https://github.com/exospherehost/failproofai/actions)
|
|
22
22
|
[](https://join.slack.com/t/failproofai/shared_invite/zt-3v63b7k5e-O3NBHmj8X6n9gZSGDx6ggQ)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
**语言版本**: [简体中文](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)
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
管理策略的最简方式,让你的 AI 智能体保持可靠、专注任务、自主运行 —— 适用于 **Claude Code** 和 **Agents SDK**。
|
|
27
27
|
|
|
28
|
-
- **30 条内置策略** -
|
|
29
|
-
- **自定义策略** - 用 JavaScript 编写你自己的可靠性规则。使用 `allow`/`deny`/`instruct` API
|
|
30
|
-
-
|
|
31
|
-
- **智能体监控** -
|
|
28
|
+
- **30 条内置策略** - 开箱即用,捕捉常见的智能体故障模式。阻止破坏性命令、防止密钥泄露、将智能体限制在项目边界内、检测死循环等。
|
|
29
|
+
- **自定义策略** - 用 JavaScript 编写你自己的可靠性规则。使用 `allow`/`deny`/`instruct` API 来执行规范、防止偏差、管控操作,或与外部系统集成。
|
|
30
|
+
- **简便配置** - 无需编写代码即可调整任意策略。可按项目或全局设置白名单、受保护分支、阈值。三级配置作用域自动合并。
|
|
31
|
+
- **智能体监控** - 查看智能体在你离开时的所有操作。浏览会话记录、检查每次工具调用,精确回溯策略触发位置。
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
所有内容均在本地运行 —— 数据不会离开你的机器。
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
-
##
|
|
37
|
+
## 环境要求
|
|
38
38
|
|
|
39
39
|
- Node.js >= 20.9.0
|
|
40
|
-
- Bun >= 1.3.0
|
|
40
|
+
- Bun >= 1.3.0(可选 —— 仅在开发或从源码构建时需要)
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
@@ -59,7 +59,7 @@ bun add -g failproofai
|
|
|
59
59
|
failproofai policies --install
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
将 hook 条目写入 `~/.claude/settings.json
|
|
62
|
+
将 hook 条目写入 `~/.claude/settings.json`。此后 Claude Code 将在每次工具调用前后自动调用 failproofai。
|
|
63
63
|
|
|
64
64
|
### 2. 启动控制台
|
|
65
65
|
|
|
@@ -67,7 +67,7 @@ failproofai policies --install
|
|
|
67
67
|
failproofai
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
打开 `http://localhost:8020
|
|
70
|
+
打开 `http://localhost:8020` —— 浏览会话记录、查看日志、管理策略。
|
|
71
71
|
|
|
72
72
|
### 3. 查看当前启用的策略
|
|
73
73
|
|
|
@@ -82,12 +82,12 @@ failproofai policies
|
|
|
82
82
|
### 作用域
|
|
83
83
|
|
|
84
84
|
| 作用域 | 命令 | 写入位置 |
|
|
85
|
-
|
|
85
|
+
|--------|------|----------|
|
|
86
86
|
| 全局(默认) | `failproofai policies --install` | `~/.claude/settings.json` |
|
|
87
87
|
| 项目级 | `failproofai policies --install --scope project` | `.claude/settings.json` |
|
|
88
88
|
| 本地级 | `failproofai policies --install --scope local` | `.claude/settings.local.json` |
|
|
89
89
|
|
|
90
|
-
###
|
|
90
|
+
### 安装特定策略
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
93
|
failproofai policies --install block-sudo block-rm-rf sanitize-api-keys
|
|
@@ -105,7 +105,7 @@ failproofai policies --uninstall --scope project
|
|
|
105
105
|
|
|
106
106
|
## 配置
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
策略配置文件位于全局的 `~/.failproofai/policies-config.json`,或项目级的 `.failproofai/policies-config.json`。
|
|
109
109
|
|
|
110
110
|
```json
|
|
111
111
|
{
|
|
@@ -138,32 +138,32 @@ failproofai policies --uninstall --scope project
|
|
|
138
138
|
}
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
**三级配置作用域**自动合并(项目级 → 本地级 →
|
|
141
|
+
**三级配置作用域**自动合并(项目级 → 本地级 → 全局)。完整合并规则请参阅 [docs/configuration.mdx](docs/configuration.mdx)。
|
|
142
142
|
|
|
143
143
|
---
|
|
144
144
|
|
|
145
145
|
## 内置策略
|
|
146
146
|
|
|
147
147
|
| 策略 | 说明 | 可配置项 |
|
|
148
|
-
|
|
148
|
+
|------|------|:--------:|
|
|
149
149
|
| `block-sudo` | 阻止智能体运行特权系统命令 | `allowPatterns` |
|
|
150
150
|
| `block-rm-rf` | 防止意外递归删除文件 | `allowPaths` |
|
|
151
|
-
| `block-curl-pipe-sh` |
|
|
152
|
-
| `block-failproofai-commands` |
|
|
153
|
-
| `sanitize-jwt` |
|
|
154
|
-
| `sanitize-api-keys` |
|
|
155
|
-
| `sanitize-connection-strings` |
|
|
156
|
-
| `sanitize-private-key-content` |
|
|
157
|
-
| `sanitize-bearer-tokens` |
|
|
151
|
+
| `block-curl-pipe-sh` | 阻止智能体将不可信脚本通过管道传入 shell | |
|
|
152
|
+
| `block-failproofai-commands` | 防止自卸载 | |
|
|
153
|
+
| `sanitize-jwt` | 阻止 JWT 令牌泄露到智能体上下文中 | |
|
|
154
|
+
| `sanitize-api-keys` | 阻止 API 密钥泄露到智能体上下文中 | `additionalPatterns` |
|
|
155
|
+
| `sanitize-connection-strings` | 阻止数据库凭据泄露到智能体上下文中 | |
|
|
156
|
+
| `sanitize-private-key-content` | 从输出中脱敏 PEM 私钥块 | |
|
|
157
|
+
| `sanitize-bearer-tokens` | 从输出中脱敏 Authorization Bearer 令牌 | |
|
|
158
158
|
| `block-env-files` | 阻止智能体读取 .env 文件 | |
|
|
159
|
-
| `protect-env-vars` |
|
|
159
|
+
| `protect-env-vars` | 防止智能体打印环境变量 | |
|
|
160
160
|
| `block-read-outside-cwd` | 将智能体限制在项目边界内 | `allowPaths` |
|
|
161
|
-
| `block-secrets-write` |
|
|
162
|
-
| `block-push-master` | 防止意外推送到 main/master | `protectedBranches` |
|
|
163
|
-
| `block-work-on-main` |
|
|
161
|
+
| `block-secrets-write` | 防止向私钥和证书文件写入内容 | `additionalPatterns` |
|
|
162
|
+
| `block-push-master` | 防止意外推送到 main/master 分支 | `protectedBranches` |
|
|
163
|
+
| `block-work-on-main` | 阻止智能体在受保护分支上操作 | `protectedBranches` |
|
|
164
164
|
| `block-force-push` | 阻止 `git push --force` | |
|
|
165
165
|
| `warn-git-amend` | 在修改提交前提醒智能体 | |
|
|
166
|
-
| `warn-git-stash-drop` |
|
|
166
|
+
| `warn-git-stash-drop` | 在丢弃 stash 前提醒智能体 | |
|
|
167
167
|
| `warn-all-files-staged` | 捕获意外的 `git add -A` | |
|
|
168
168
|
| `warn-destructive-sql` | 在执行前捕获 DROP/DELETE SQL | |
|
|
169
169
|
| `warn-schema-alteration` | 在执行前捕获 ALTER TABLE | |
|
|
@@ -171,7 +171,7 @@ failproofai policies --uninstall --scope project
|
|
|
171
171
|
| `warn-package-publish` | 捕获意外的 `npm publish` | |
|
|
172
172
|
| `warn-background-process` | 捕获意外启动的后台进程 | |
|
|
173
173
|
| `warn-global-package-install` | 捕获意外的全局包安装 | |
|
|
174
|
-
|
|
|
174
|
+
| ……以及更多 | | |
|
|
175
175
|
|
|
176
176
|
完整策略详情和参数参考:[docs/built-in-policies.mdx](docs/built-in-policies.mdx)
|
|
177
177
|
|
|
@@ -179,7 +179,7 @@ failproofai policies --uninstall --scope project
|
|
|
179
179
|
|
|
180
180
|
## 自定义策略
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
编写你自己的策略,让智能体保持可靠和专注:
|
|
183
183
|
|
|
184
184
|
```js
|
|
185
185
|
import { customPolicies, allow, deny, instruct } from "failproofai";
|
|
@@ -197,7 +197,7 @@ customPolicies.add({
|
|
|
197
197
|
});
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
安装方式:
|
|
201
201
|
|
|
202
202
|
```bash
|
|
203
203
|
failproofai policies --install --custom ./my-policies.js
|
|
@@ -208,44 +208,44 @@ failproofai policies --install --custom ./my-policies.js
|
|
|
208
208
|
| 函数 | 效果 |
|
|
209
209
|
|------|------|
|
|
210
210
|
| `allow()` | 允许该操作 |
|
|
211
|
-
| `allow(message)` |
|
|
212
|
-
| `deny(message)` |
|
|
213
|
-
| `instruct(message)` | 向 Claude
|
|
211
|
+
| `allow(message)` | 允许操作,并向 Claude 发送信息性上下文 |
|
|
212
|
+
| `deny(message)` | 阻止操作;消息将显示给 Claude |
|
|
213
|
+
| `instruct(message)` | 向 Claude 的提示词中添加上下文;不阻止操作 |
|
|
214
214
|
|
|
215
215
|
### 上下文对象(`ctx`)
|
|
216
216
|
|
|
217
217
|
| 字段 | 类型 | 说明 |
|
|
218
218
|
|------|------|------|
|
|
219
219
|
| `eventType` | `string` | `"PreToolUse"`、`"PostToolUse"`、`"Notification"`、`"Stop"` |
|
|
220
|
-
| `toolName` | `string` | 被调用的工具(`"Bash"`、`"Write"`、`"Read"
|
|
220
|
+
| `toolName` | `string` | 被调用的工具(`"Bash"`、`"Write"`、`"Read"`……) |
|
|
221
221
|
| `toolInput` | `object` | 工具的输入参数 |
|
|
222
|
-
| `payload` | `object` |
|
|
222
|
+
| `payload` | `object` | 完整的原始事件负载 |
|
|
223
223
|
| `session.cwd` | `string` | Claude Code 会话的工作目录 |
|
|
224
224
|
| `session.sessionId` | `string` | 会话标识符 |
|
|
225
|
-
| `session.transcriptPath` | `string` |
|
|
225
|
+
| `session.transcriptPath` | `string` | 会话记录文件路径 |
|
|
226
226
|
|
|
227
|
-
自定义 hook
|
|
227
|
+
自定义 hook 支持传递式本地导入、async/await,以及访问 `process.env`。错误采用开放失败策略(记录到 `~/.failproofai/hook.log`,内置策略继续执行)。完整指南请参阅 [docs/custom-hooks.mdx](docs/custom-hooks.mdx)。
|
|
228
228
|
|
|
229
229
|
### 基于约定的策略
|
|
230
230
|
|
|
231
|
-
将 `*policies.{js,mjs,ts}` 文件放入 `.failproofai/policies/`
|
|
231
|
+
将 `*policies.{js,mjs,ts}` 文件放入 `.failproofai/policies/` 目录,它们会被自动加载 —— 无需 `--custom` 标志或任何配置变更。就像 git hooks 一样:放入文件即可生效。
|
|
232
232
|
|
|
233
233
|
```text
|
|
234
|
-
#
|
|
234
|
+
# 项目级 —— 提交到 git,与团队共享
|
|
235
235
|
.failproofai/policies/security-policies.mjs
|
|
236
236
|
.failproofai/policies/workflow-policies.mjs
|
|
237
237
|
|
|
238
|
-
#
|
|
238
|
+
# 用户级 —— 个人专属,适用于所有项目
|
|
239
239
|
~/.failproofai/policies/my-policies.mjs
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
-
|
|
242
|
+
两个级别均会加载(取并集)。同一目录内的文件按字母顺序加载。可使用 `01-`、`02-` 等前缀控制加载顺序。开箱即用的示例请参阅 [examples/convention-policies/](examples/convention-policies/)。
|
|
243
243
|
|
|
244
244
|
---
|
|
245
245
|
|
|
246
246
|
## 遥测
|
|
247
247
|
|
|
248
|
-
Failproof AI 通过 PostHog
|
|
248
|
+
Failproof AI 通过 PostHog 收集匿名使用遥测数据,以了解功能使用情况。我们从不发送任何会话内容、文件名、工具输入或个人信息。
|
|
249
249
|
|
|
250
250
|
禁用遥测:
|
|
251
251
|
|
|
@@ -259,8 +259,8 @@ FAILPROOFAI_TELEMETRY_DISABLED=1 failproofai
|
|
|
259
259
|
|
|
260
260
|
| 指南 | 说明 |
|
|
261
261
|
|------|------|
|
|
262
|
-
| [
|
|
263
|
-
| [内置策略](docs/built-in-policies.mdx) | 全部 30
|
|
262
|
+
| [入门指南](docs/getting-started.mdx) | 安装与初步使用 |
|
|
263
|
+
| [内置策略](docs/built-in-policies.mdx) | 全部 30 条内置策略及参数说明 |
|
|
264
264
|
| [自定义策略](docs/custom-policies.mdx) | 编写你自己的策略 |
|
|
265
265
|
| [配置](docs/configuration.mdx) | 配置文件格式与作用域合并规则 |
|
|
266
266
|
| [控制台](docs/dashboard.mdx) | 监控会话并查看策略活动 |
|
|
@@ -274,7 +274,7 @@ docker build -f Dockerfile.docs -t failproofai-docs .
|
|
|
274
274
|
docker run --rm -p 3000:3000 failproofai-docs
|
|
275
275
|
```
|
|
276
276
|
|
|
277
|
-
在 `http://localhost:3000` 打开 Mintlify
|
|
277
|
+
在 `http://localhost:3000` 打开 Mintlify 文档站点。如果挂载 docs 目录,容器将监听文件变更:
|
|
278
278
|
|
|
279
279
|
```bash
|
|
280
280
|
docker run --rm -p 3000:3000 -v $(pwd)/docs:/app/docs failproofai-docs
|
|
@@ -282,26 +282,26 @@ docker run --rm -p 3000:3000 -v $(pwd)/docs:/app/docs failproofai-docs
|
|
|
282
282
|
|
|
283
283
|
---
|
|
284
284
|
|
|
285
|
-
##
|
|
285
|
+
## failproofai 贡献者须知
|
|
286
286
|
|
|
287
287
|
本仓库的 `.claude/settings.json` 使用 `bun ./bin/failproofai.mjs --hook <EventType>` 而非标准的 `npx -y failproofai` 命令。这是因为在 failproofai 项目内部运行 `npx -y failproofai` 会产生自引用冲突。
|
|
288
288
|
|
|
289
|
-
|
|
289
|
+
对于所有其他仓库,推荐使用 `npx -y failproofai`,通过以下命令安装:
|
|
290
290
|
|
|
291
291
|
```bash
|
|
292
292
|
failproofai policies --install --scope project
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
-
##
|
|
295
|
+
## 参与贡献
|
|
296
296
|
|
|
297
|
-
|
|
297
|
+
请参阅 [CONTRIBUTING.md](CONTRIBUTING.md)。
|
|
298
298
|
|
|
299
299
|
---
|
|
300
300
|
|
|
301
301
|
## 许可证
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
请参阅 [LICENSE](LICENSE)。
|
|
304
304
|
|
|
305
305
|
---
|
|
306
306
|
|
|
307
|
-
由 **ExosphereHost: 智能体可靠性研究实验室** 构建与维护。我们通过自研智能体、软件和专业知识,帮助企业和初创公司提升 AI
|
|
307
|
+
由 **ExosphereHost: 智能体可靠性研究实验室** 构建与维护。我们通过自研智能体、软件和专业知识,帮助企业和初创公司提升 AI 智能体的可靠性。了解更多请访问 [exosphere.host](https://exosphere.host)。
|