failproofai 0.0.6-beta.1 → 0.0.6-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.failproofai/policies/review-policies.mjs +4 -3
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- 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/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/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/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/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/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/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/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]__0~kmh8w._.js → [root-of-the-server]__05akje6._.js} +2 -2
- 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]__0rh.18_._.js → [root-of-the-server]__0i5kvry._.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]__0w6l33k._.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 +3 -3
- 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/{08t08igdql9yt.js → 00j0rr7rh8ef8.js} +1 -1
- package/.next/standalone/.next/static/chunks/{12~yi9oj8av8p.js → 05j1px0r8yzh6.js} +2 -2
- package/.next/standalone/.next/static/chunks/{09_k80d~cq2wg.js → 0badv41uxa56..js} +1 -1
- package/.next/standalone/.next/static/chunks/{0wlyoif4_kj_t.js → 0ijk_kek9_wyx.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0bvhsa6zva2o..js → 0ksdlt_1hucdm.js} +1 -1
- package/.next/standalone/.next/static/chunks/{03rz6ykw-a2xi.js → 0npb~873.wvg3.js} +1 -1
- package/.next/standalone/.next/static/chunks/{01b~z8f1ws0rk.js → 0xpl.oscrakvx.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0gbf4cphy8ksq.js → 1052sguyd-.ka.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0v.yd0kg_ld3r.js → 14cl9poem30dq.js} +1 -1
- package/.next/standalone/CHANGELOG.md +11 -0
- package/.next/standalone/dist/cli.mjs +3 -3
- package/.next/standalone/docs/ar/built-in-policies.mdx +124 -87
- package/.next/standalone/docs/ar/custom-policies.mdx +72 -72
- package/.next/standalone/docs/ar/examples.mdx +86 -33
- package/.next/standalone/docs/ar/getting-started.mdx +82 -29
- package/.next/standalone/docs/built-in-policies.mdx +1 -1
- package/.next/standalone/docs/de/built-in-policies.mdx +93 -56
- package/.next/standalone/docs/de/custom-policies.mdx +56 -56
- package/.next/standalone/docs/de/examples.mdx +72 -18
- package/.next/standalone/docs/de/getting-started.mdx +72 -20
- package/.next/standalone/docs/es/built-in-policies.mdx +115 -78
- package/.next/standalone/docs/es/custom-policies.mdx +55 -55
- package/.next/standalone/docs/es/examples.mdx +73 -19
- package/.next/standalone/docs/es/getting-started.mdx +72 -20
- package/.next/standalone/docs/fr/built-in-policies.mdx +83 -46
- package/.next/standalone/docs/fr/custom-policies.mdx +51 -51
- package/.next/standalone/docs/fr/examples.mdx +78 -24
- package/.next/standalone/docs/fr/getting-started.mdx +65 -13
- package/.next/standalone/docs/he/built-in-policies.mdx +156 -117
- package/.next/standalone/docs/he/custom-policies.mdx +75 -75
- package/.next/standalone/docs/he/examples.mdx +87 -33
- package/.next/standalone/docs/he/getting-started.mdx +84 -33
- package/.next/standalone/docs/hi/built-in-policies.mdx +101 -60
- package/.next/standalone/docs/hi/custom-policies.mdx +71 -70
- package/.next/standalone/docs/hi/examples.mdx +90 -36
- package/.next/standalone/docs/hi/getting-started.mdx +80 -27
- package/.next/standalone/docs/i18n/README.ar.md +69 -69
- package/.next/standalone/docs/i18n/README.de.md +46 -46
- package/.next/standalone/docs/i18n/README.es.md +42 -42
- package/.next/standalone/docs/i18n/README.fr.md +39 -39
- package/.next/standalone/docs/i18n/README.he.md +83 -83
- package/.next/standalone/docs/i18n/README.hi.md +69 -69
- package/.next/standalone/docs/i18n/README.it.md +72 -72
- package/.next/standalone/docs/i18n/README.ja.md +71 -71
- package/.next/standalone/docs/i18n/README.ko.md +52 -52
- package/.next/standalone/docs/i18n/README.pt-br.md +44 -44
- package/.next/standalone/docs/i18n/README.ru.md +66 -66
- package/.next/standalone/docs/i18n/README.tr.md +82 -83
- package/.next/standalone/docs/i18n/README.vi.md +70 -71
- package/.next/standalone/docs/i18n/README.zh.md +51 -51
- package/.next/standalone/docs/it/built-in-policies.mdx +118 -81
- package/.next/standalone/docs/it/custom-policies.mdx +69 -69
- package/.next/standalone/docs/it/examples.mdx +93 -39
- package/.next/standalone/docs/it/getting-started.mdx +73 -21
- package/.next/standalone/docs/ja/built-in-policies.mdx +98 -61
- package/.next/standalone/docs/ja/custom-policies.mdx +71 -71
- package/.next/standalone/docs/ja/examples.mdx +76 -22
- package/.next/standalone/docs/ja/getting-started.mdx +65 -13
- package/.next/standalone/docs/ko/built-in-policies.mdx +137 -100
- package/.next/standalone/docs/ko/custom-policies.mdx +67 -67
- package/.next/standalone/docs/ko/examples.mdx +87 -33
- package/.next/standalone/docs/ko/getting-started.mdx +61 -9
- package/.next/standalone/docs/pt-br/built-in-policies.mdx +94 -57
- package/.next/standalone/docs/pt-br/custom-policies.mdx +56 -56
- package/.next/standalone/docs/pt-br/examples.mdx +78 -24
- package/.next/standalone/docs/pt-br/getting-started.mdx +64 -12
- package/.next/standalone/docs/ru/built-in-policies.mdx +142 -105
- package/.next/standalone/docs/ru/custom-policies.mdx +82 -81
- package/.next/standalone/docs/ru/examples.mdx +77 -22
- package/.next/standalone/docs/ru/getting-started.mdx +74 -22
- package/.next/standalone/docs/tr/built-in-policies.mdx +104 -67
- package/.next/standalone/docs/tr/custom-policies.mdx +59 -60
- package/.next/standalone/docs/tr/examples.mdx +97 -42
- package/.next/standalone/docs/tr/getting-started.mdx +75 -23
- package/.next/standalone/docs/vi/built-in-policies.mdx +110 -72
- package/.next/standalone/docs/vi/custom-policies.mdx +68 -68
- package/.next/standalone/docs/vi/examples.mdx +93 -38
- package/.next/standalone/docs/vi/getting-started.mdx +74 -22
- package/.next/standalone/docs/zh/built-in-policies.mdx +132 -95
- package/.next/standalone/docs/zh/custom-policies.mdx +49 -49
- package/.next/standalone/docs/zh/examples.mdx +90 -36
- package/.next/standalone/docs/zh/getting-started.mdx +73 -21
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/server.js +1 -1
- package/.next/standalone/src/hooks/builtin-policies.ts +5 -1
- package/dist/cli.mjs +3 -3
- package/package.json +1 -1
- package/src/hooks/builtin-policies.ts +5 -1
- /package/.next/standalone/.next/static/{CkmOT-ZvDN-sVULinGVKT → A9pNTZdoYJTVyPAYwQMx5}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{CkmOT-ZvDN-sVULinGVKT → A9pNTZdoYJTVyPAYwQMx5}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{CkmOT-ZvDN-sVULinGVKT → A9pNTZdoYJTVyPAYwQMx5}/_ssgManifest.js +0 -0
|
@@ -21,14 +21,14 @@
|
|
|
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
|
+
**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)
|
|
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ữ cho các AI agent của bạn đáng tin cậy, tập trung vào mục tiêu và chạy tự động - cho **Claude Code** & **Agents SDK**.
|
|
27
27
|
|
|
28
|
-
- **30 Chính sách tích hợp
|
|
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
|
|
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** - Bắt các chế độ lỗi phổ biến của agent ngay lập tức. Chặn các lệnh phá hoại, ngăn chặn rò rỉ bí mật, giữ các agent trong ranh giới dự án, phát hiện vòng lặp, v.v.
|
|
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 sai lệch, gating 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** - Điều chỉnh bất kỳ chính sách nào mà không cần viết mã. Đặt danh sách cho phép, các nhánh được bảo vệ, ngưỡng cho mỗi dự án hoặc toàn cầu. Ba cấu hình phạm vi hợp nhất tự động.
|
|
31
|
+
- **Agent Monitor** - Xem những gì các agent của bạn đã làm khi bạn vắng mặt. Duyệt qua các phiên, kiểm tra từng lệnh gọi công cụ, và xem lại chính xác nơi các chính sách đã kích hoạt.
|
|
32
32
|
|
|
33
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
|
|
|
@@ -53,23 +53,23 @@ bun add -g failproofai
|
|
|
53
53
|
|
|
54
54
|
## Bắt đầu nhanh
|
|
55
55
|
|
|
56
|
-
### 1. Bật chính sách toàn
|
|
56
|
+
### 1. Bật chính sách toàn cầu
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
59
|
failproofai policies --install
|
|
60
60
|
```
|
|
61
61
|
|
|
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ụ.
|
|
62
|
+
Ghi các mục hook vào `~/.claude/settings.json`. Claude Code sẽ bây giờ 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 chạy 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
|
|
70
|
+
Mở `http://localhost:8020` - duyệt qua các phiên, kiểm tra nhật ký, quản lý chính sách.
|
|
71
71
|
|
|
72
|
-
### 3. Kiểm tra
|
|
72
|
+
### 3. Kiểm tra cái gì đang hoạt động
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
75
|
failproofai policies
|
|
@@ -83,17 +83,17 @@ failproofai policies
|
|
|
83
83
|
|
|
84
84
|
| Phạm vi | Lệnh | Nơi ghi |
|
|
85
85
|
|--------|------|---------|
|
|
86
|
-
| Toàn
|
|
86
|
+
| Toàn cầu (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
|
|
|
90
|
-
### Cài đặt chính sách cụ thể
|
|
90
|
+
### Cài đặt các chính sách cụ thể
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
93
|
failproofai policies --install block-sudo block-rm-rf sanitize-api-keys
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
###
|
|
96
|
+
### Xóa chính sách
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
99
|
failproofai policies --uninstall
|
|
@@ -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ầu) hoặc `.failproofai/policies-config.json` trong dự án của bạn (cho mỗi dự án).
|
|
109
109
|
|
|
110
110
|
```json
|
|
111
111
|
{
|
|
@@ -120,11 +120,11 @@ 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": "Sử dụng apt-get trực tiếp mà không cần sudo."
|
|
124
124
|
},
|
|
125
125
|
"block-push-master": {
|
|
126
126
|
"protectedBranches": ["main", "release", "prod"],
|
|
127
|
-
"hint": "
|
|
127
|
+
"hint": "Hãy thử tạo một nhánh mới thay thế."
|
|
128
128
|
},
|
|
129
129
|
"sanitize-api-keys": {
|
|
130
130
|
"additionalPatterns": [
|
|
@@ -138,40 +138,40 @@ 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 (
|
|
141
|
+
**Ba phạm vi cấu hình** được hợp nhất tự động (project → local → global). 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
|
-
## Chính sách tích hợp
|
|
145
|
+
## Chính sách tích hợp
|
|
146
146
|
|
|
147
147
|
| Chính sách | Mô tả | Có thể cấu hình |
|
|
148
148
|
|-----------|-------|:---:|
|
|
149
|
-
| `block-sudo` | Ngăn
|
|
150
|
-
| `block-rm-rf` | Ngăn xóa tệp đệ quy
|
|
151
|
-
| `block-curl-pipe-sh` | Ngăn
|
|
152
|
-
| `block-failproofai-commands` | Ngăn tự gỡ cài đặt | |
|
|
153
|
-
| `sanitize-jwt` | Dừng các mã JWT rò rỉ vào
|
|
154
|
-
| `sanitize-api-keys` | Dừng các khóa API rò rỉ vào
|
|
155
|
-
| `sanitize-connection-strings` | Dừng thông tin xác thực cơ sở dữ liệu rò rỉ vào
|
|
156
|
-
| `sanitize-private-key-content` | Che
|
|
157
|
-
| `sanitize-bearer-tokens` | Che
|
|
158
|
-
| `block-env-files` | Giữ
|
|
159
|
-
| `protect-env-vars` | Ngăn
|
|
160
|
-
| `block-read-outside-cwd` | Giữ
|
|
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
|
|
163
|
-
| `block-work-on-main` | Giữ
|
|
164
|
-
| `block-force-push` | Ngăn `git push --force` | |
|
|
165
|
-
| `warn-git-amend` | Nhắc nhở
|
|
166
|
-
| `warn-git-stash-drop` | Nhắc nhở
|
|
167
|
-
| `warn-all-files-staged` | Bắt `git add -A`
|
|
168
|
-
| `warn-destructive-sql` | Bắt
|
|
169
|
-
| `warn-schema-alteration` | Bắt ALTER TABLE trước khi thực
|
|
170
|
-
| `warn-large-file-write` | Bắt
|
|
171
|
-
| `warn-package-publish` | Bắt `npm publish`
|
|
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
|
|
174
|
-
| …và
|
|
149
|
+
| `block-sudo` | Ngăn chặn các agent chạy các lệnh hệ thống có đặc quyền | `allowPatterns` |
|
|
150
|
+
| `block-rm-rf` | Ngăn chặn việc xóa tệp đệ quy ngẫu nhiên | `allowPaths` |
|
|
151
|
+
| `block-curl-pipe-sh` | Ngăn chặn các agent từ piping các tập lệnh không tin cậy vào shell | |
|
|
152
|
+
| `block-failproofai-commands` | Ngăn chặn tự gỡ cài đặt | |
|
|
153
|
+
| `sanitize-jwt` | Dừng các mã thông báo JWT rò rỉ vào bối cảnh agent | |
|
|
154
|
+
| `sanitize-api-keys` | Dừng các khóa API rò rỉ vào bối 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 bối cảnh agent | |
|
|
156
|
+
| `sanitize-private-key-content` | Che đi các khối khóa riêng PEM khỏi đầu ra | |
|
|
157
|
+
| `sanitize-bearer-tokens` | Che đi các mã thông báo Authorization Bearer khỏi đầu ra | |
|
|
158
|
+
| `block-env-files` | Giữ các agent khỏi đọc các tệp .env | |
|
|
159
|
+
| `protect-env-vars` | Ngăn chặn các agent từ in các biến môi trường | |
|
|
160
|
+
| `block-read-outside-cwd` | Giữ các agent bên trong ranh giới dự án | `allowPaths` |
|
|
161
|
+
| `block-secrets-write` | Ngăn chặn ghi vào các tệp khóa riêng và chứng chỉ | `additionalPatterns` |
|
|
162
|
+
| `block-push-master` | Ngăn chặn các push ngẫu nhiên vào main/master | `protectedBranches` |
|
|
163
|
+
| `block-work-on-main` | Giữ các agent khỏi các nhánh được bảo vệ | `protectedBranches` |
|
|
164
|
+
| `block-force-push` | Ngăn chặn `git push --force` | |
|
|
165
|
+
| `warn-git-amend` | Nhắc nhở các agent trước khi sửa đổi commit | |
|
|
166
|
+
| `warn-git-stash-drop` | Nhắc nhở các agent trước khi bỏ stash | |
|
|
167
|
+
| `warn-all-files-staged` | Bắt `git add -A` ngẫu nhiên | |
|
|
168
|
+
| `warn-destructive-sql` | Bắt DROP/DELETE SQL trước khi thực thi | |
|
|
169
|
+
| `warn-schema-alteration` | Bắt ALTER TABLE trước khi thực thi | |
|
|
170
|
+
| `warn-large-file-write` | Bắt ghi tệp lớn ngoài dự kiến | `thresholdKb` |
|
|
171
|
+
| `warn-package-publish` | Bắt `npm publish` ngẫu nhiên | |
|
|
172
|
+
| `warn-background-process` | Bắt các khởi chạy quy trình nền không dự định | |
|
|
173
|
+
| `warn-global-package-install` | Bắt các cài đặt gói toàn cầu không dự định | |
|
|
174
|
+
| …và 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)
|
|
177
177
|
|
|
@@ -179,25 +179,25 @@ 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 các 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ữ cho các agent đáng tin cậy và tập trung vào mục tiêu:
|
|
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: "Chặn ghi vào các đường dẫn chứa '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("Ghi vào các đường dẫn production bị chặn");
|
|
195
195
|
return allow();
|
|
196
196
|
},
|
|
197
197
|
});
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
Cài đặt
|
|
200
|
+
Cài đặt bằng:
|
|
201
201
|
|
|
202
202
|
```bash
|
|
203
203
|
failproofai policies --install --custom ./my-policies.js
|
|
@@ -205,47 +205,47 @@ 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 ứng |
|
|
209
209
|
|-----|---------|
|
|
210
|
-
| `allow()` | Cho phép
|
|
211
|
-
| `allow(message)` | Cho phép và gửi bối cảnh thông tin
|
|
212
|
-
| `deny(message)` | Chặn
|
|
210
|
+
| `allow()` | Cho phép hoạt động |
|
|
211
|
+
| `allow(message)` | Cho phép và gửi bối cảnh thông tin tới Claude |
|
|
212
|
+
| `deny(message)` | Chặn hoạt động; tin nhắn được hiển thị cho Claude |
|
|
213
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
|
-
### Đối tượng
|
|
215
|
+
### Đối tượng bối 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
221
|
| `toolInput` | `object` | Các tham số đầu vào của công cụ |
|
|
222
|
-
| `payload` | `object` | Toàn bộ trọng
|
|
222
|
+
| `payload` | `object` | Toàn bộ tải trọng sự kiện thô |
|
|
223
223
|
| `session.cwd` | `string` | Thư mục làm việc của phiên Claude Code |
|
|
224
224
|
| `session.sessionId` | `string` | Định danh phiên |
|
|
225
|
-
| `session.transcriptPath` | `string` | Đường dẫn
|
|
225
|
+
| `session.transcriptPath` | `string` | Đường dẫn tới tệp bảng lưu ý phiên |
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
Các hook tùy chỉnh hỗ trợ nhập cục bộ chuyên chở, async/await, và truy cập vào `process.env`. Các lỗi được mở rộng (ghi vào `~/.failproofai/hook.log`, các chính sách tích hợp 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
|
+
Thả các tệp `*policies.{js,mjs,ts}` vào `.failproofai/policies/` và chúng sẽ được tự động tải - không cần cờ hoặc thay đổi cấu hình. Cam kết thư mục vào git và mọi thành viên trong nhóm sẽ tự động có được cùng tiêu chuẩn chất lượng.
|
|
232
232
|
|
|
233
233
|
```text
|
|
234
|
-
# Cấp dự án —
|
|
234
|
+
# Cấp độ dự án — cam kết vào git, chia sẻ với nhóm
|
|
235
235
|
.failproofai/policies/security-policies.mjs
|
|
236
236
|
.failproofai/policies/workflow-policies.mjs
|
|
237
237
|
|
|
238
|
-
# Cấp người dùng — cá nhân, áp dụng cho tất cả
|
|
238
|
+
# Cấp độ người dùng — cá nhân, áp dụng cho tất cả dự án
|
|
239
239
|
~/.failproofai/policies/my-policies.mjs
|
|
240
240
|
```
|
|
241
241
|
|
|
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ố
|
|
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ố với `01-`, `02-`, v.v. để kiểm soát thứ tự. Khi nhóm của bạn khám phá ra các chế độ lỗi mới, hãy thêm một chính sách và đẩy - mọi người sẽ nhận được cập nhật trên pull tiếp theo của họ. 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
|
+
## Viễn thông
|
|
247
247
|
|
|
248
|
-
Failproof AI thu thập telemetry sử dụng ẩn danh
|
|
248
|
+
Failproof AI thu thập telemetry sử dụng ẩn danh qua PostHog để hiểu cách sử dụng tính năng. Không bao giờ gửi nội dung phiên, tên tệp, đầu vào công cụ hoặc thông tin cá nhân.
|
|
249
249
|
|
|
250
250
|
Vô hiệu hóa nó:
|
|
251
251
|
|
|
@@ -260,12 +260,12 @@ FAILPROOFAI_TELEMETRY_DISABLED=1 failproofai
|
|
|
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
|
-
| [Built-in Policies](docs/built-in-policies.mdx) | Tất cả 30 chính sách tích hợp
|
|
263
|
+
| [Built-in Policies](docs/built-in-policies.mdx) | Tất cả 30 chính sách tích hợp với các tham số |
|
|
264
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
|
-
| [Dashboard](docs/dashboard.mdx) | Giám sát
|
|
266
|
+
| [Dashboard](docs/dashboard.mdx) | Giám sát phiên và xem lại 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 bài kiểm tra và viết các bài mới |
|
|
268
|
+
| [Testing](docs/testing.mdx) | Chạy các bài kiểm tra và viết các bài kiểm tra 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 web
|
|
277
|
+
Mở trang web Mintlify docs tại `http://localhost:3000`. Container sẽ theo dõi các thay đổi nếu bạn gắn thư mục docs:
|
|
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
|
+
## Ghi chú 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 repo khác,
|
|
289
|
+
Đối với tất cả các repo khác, cách tiếp cận được khuyến nghị là `npx -y failproofai`, được cài đặt qua:
|
|
290
290
|
|
|
291
291
|
```bash
|
|
292
292
|
failproofai policies --install --scope project
|
|
@@ -304,5 +304,4 @@ Xem [LICENSE](LICENSE).
|
|
|
304
304
|
|
|
305
305
|
---
|
|
306
306
|
|
|
307
|
-
Được xây dựng và
|
|
308
|
-
```
|
|
307
|
+
Được xây dựng và Bảo trì bởi **ExosphereHost: Reliability Research Lab cho các Agent của bạn**. Chúng tôi giúp các doanh nghiệp và startups cải thiện độ tin cậy của các AI agent của họ thông qua các agent, phần mềm và chuyên môn của riêng chúng tôi. Tìm hiểu thêm tại [exosphere.host](https://exosphere.host).
|
|
@@ -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
|
-
管理策略的最简方式,让你的 AI
|
|
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,17 +59,17 @@ bun add -g failproofai
|
|
|
59
59
|
failproofai policies --install
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
将 hook
|
|
62
|
+
将 hook 配置写入 `~/.claude/settings.json`。此后 Claude Code 将在每次工具调用前后自动触发 failproofai。
|
|
63
63
|
|
|
64
|
-
### 2.
|
|
64
|
+
### 2. 启动控制面板
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
67
|
failproofai
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
打开 `http://localhost:8020
|
|
70
|
+
打开 `http://localhost:8020`——浏览会话、检查日志、管理策略。
|
|
71
71
|
|
|
72
|
-
### 3.
|
|
72
|
+
### 3. 查看当前生效的策略
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
75
|
failproofai policies
|
|
@@ -84,8 +84,8 @@ failproofai policies
|
|
|
84
84
|
| 作用域 | 命令 | 写入位置 |
|
|
85
85
|
|--------|------|----------|
|
|
86
86
|
| 全局(默认) | `failproofai policies --install` | `~/.claude/settings.json` |
|
|
87
|
-
|
|
|
88
|
-
|
|
|
87
|
+
| 项目 | `failproofai policies --install --scope project` | `.claude/settings.json` |
|
|
88
|
+
| 本地 | `failproofai policies --install --scope local` | `.claude/settings.local.json` |
|
|
89
89
|
|
|
90
90
|
### 安装特定策略
|
|
91
91
|
|
|
@@ -97,7 +97,7 @@ failproofai policies --install block-sudo block-rm-rf sanitize-api-keys
|
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
99
|
failproofai policies --uninstall
|
|
100
|
-
#
|
|
100
|
+
# 或指定作用域:
|
|
101
101
|
failproofai policies --uninstall --scope project
|
|
102
102
|
```
|
|
103
103
|
|
|
@@ -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,48 +138,48 @@ 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
|
-
| `block-sudo` |
|
|
150
|
-
| `block-rm-rf` |
|
|
151
|
-
| `block-curl-pipe-sh` | 阻止智能体将不可信脚本通过管道传入 shell | |
|
|
152
|
-
| `block-failproofai-commands` |
|
|
153
|
-
| `sanitize-jwt` | 阻止 JWT
|
|
154
|
-
| `sanitize-api-keys` | 阻止 API
|
|
155
|
-
| `sanitize-connection-strings` |
|
|
149
|
+
| `block-sudo` | 阻止智能体执行特权系统命令 | `allowPatterns` |
|
|
150
|
+
| `block-rm-rf` | 防止误操作递归删除文件 | `allowPaths` |
|
|
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
156
|
| `sanitize-private-key-content` | 从输出中脱敏 PEM 私钥块 | |
|
|
157
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` |
|
|
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` |
|
|
167
|
-
| `warn-all-files-staged` |
|
|
166
|
+
| `warn-git-stash-drop` | 在丢弃暂存前提醒智能体 | |
|
|
167
|
+
| `warn-all-files-staged` | 捕获误操作的 `git add -A` | |
|
|
168
168
|
| `warn-destructive-sql` | 在执行前捕获 DROP/DELETE SQL | |
|
|
169
169
|
| `warn-schema-alteration` | 在执行前捕获 ALTER TABLE | |
|
|
170
170
|
| `warn-large-file-write` | 捕获意外的大文件写入 | `thresholdKb` |
|
|
171
171
|
| `warn-package-publish` | 捕获意外的 `npm publish` | |
|
|
172
|
-
| `warn-background-process` |
|
|
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
|
|
|
178
178
|
---
|
|
179
179
|
|
|
180
180
|
## 自定义策略
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
编写你自己的策略,让智能体保持可靠并专注于任务:
|
|
183
183
|
|
|
184
184
|
```js
|
|
185
185
|
import { customPolicies, allow, deny, instruct } from "failproofai";
|
|
@@ -209,43 +209,43 @@ failproofai policies --install --custom ./my-policies.js
|
|
|
209
209
|
|------|------|
|
|
210
210
|
| `allow()` | 允许该操作 |
|
|
211
211
|
| `allow(message)` | 允许操作,并向 Claude 发送信息性上下文 |
|
|
212
|
-
| `deny(message)` |
|
|
213
|
-
| `instruct(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
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 支持传递式本地导入、async/await,以及访问 `process.env
|
|
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/` 目录,它们会被自动加载——无需任何参数或配置变更。将该目录提交到 git,团队所有成员即可自动获得相同的质量标准。
|
|
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
|
|
|
@@ -257,13 +257,13 @@ FAILPROOFAI_TELEMETRY_DISABLED=1 failproofai
|
|
|
257
257
|
|
|
258
258
|
## 文档
|
|
259
259
|
|
|
260
|
-
| 指南 |
|
|
260
|
+
| 指南 | 描述 |
|
|
261
261
|
|------|------|
|
|
262
|
-
| [
|
|
262
|
+
| [快速入门](docs/getting-started.mdx) | 安装与初始步骤 |
|
|
263
263
|
| [内置策略](docs/built-in-policies.mdx) | 全部 30 条内置策略及参数说明 |
|
|
264
264
|
| [自定义策略](docs/custom-policies.mdx) | 编写你自己的策略 |
|
|
265
265
|
| [配置](docs/configuration.mdx) | 配置文件格式与作用域合并规则 |
|
|
266
|
-
| [
|
|
266
|
+
| [控制面板](docs/dashboard.mdx) | 监控会话与审查策略活动 |
|
|
267
267
|
| [架构](docs/architecture.mdx) | hook 系统的工作原理 |
|
|
268
268
|
| [测试](docs/testing.mdx) | 运行测试与编写新测试 |
|
|
269
269
|
|
|
@@ -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 文档站点。如果挂载 docs
|
|
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
|
|
@@ -286,7 +286,7 @@ docker run --rm -p 3000:3000 -v $(pwd)/docs:/app/docs failproofai-docs
|
|
|
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
|
|
@@ -304,4 +304,4 @@ failproofai policies --install --scope project
|
|
|
304
304
|
|
|
305
305
|
---
|
|
306
306
|
|
|
307
|
-
由 **ExosphereHost
|
|
307
|
+
由 **ExosphereHost:智能体可靠性研究实验室** 构建与维护。我们通过自主研发的智能体、软件和专业知识,帮助企业和初创公司提升 AI 智能体的可靠性。了解更多请访问 [exosphere.host](https://exosphere.host)。
|