failproofai 0.0.2-beta.6 → 0.0.2-beta.8
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/.claude/settings.json +316 -0
- package/.next/standalone/.failproofai/policies/workflow-policies.mjs +62 -0
- package/.next/standalone/.failproofai/policies-config.json +39 -0
- 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]__02nt~6d._.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_05pz9._._.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]__0u_n1xe._.js → [root-of-the-server]__0.t2266._.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]__0okos0k._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0epc5zr._.js → [root-of-the-server]__0pjorff._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +8 -9
- 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/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0a_7sdg.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0ef3uwk.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0j79~gv.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0pbja1x.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0r6o0i2.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_11y81~_.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_12or2kf.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.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/{0efsuf1p-k4qe.js → 04xfyqyhdxbxz.js} +1 -1
- package/.next/standalone/.next/static/chunks/{17p200_z1ivz4.js → 07g0rbtaux_1t.js} +1 -1
- package/.next/standalone/.next/static/chunks/{031pa5~qfzt~_.js → 09e7drilkf1sn.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0tood0~87-mm8.js → 0a_xh94bt.y0j.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0rvepm.~uvks4.js → 0j752uotyfvjh.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0wkzaq-8sxss7.js → 0qi0ubup__3pj.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0kbfx4p.g9wnr.js → 0xyvis4r_y.8o.js} +2 -2
- package/.next/standalone/.next/static/chunks/{0jqg886bw85_6.js → 0zfyfi1suoteq.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0_tx_~f8pi3d7.js → 121a-0zn-knuy.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-0uc5y~g6h.n7-.js → turbopack-0r26pc8h0y_-e.js} +1 -1
- package/.next/standalone/CHANGELOG.md +88 -0
- package/.next/standalone/CLAUDE.md +14 -0
- package/.next/standalone/README.md +20 -3
- package/.next/standalone/bin/failproofai.mjs +5 -0
- package/.next/standalone/bun.lock +31 -63
- package/.next/standalone/dist/cli.mjs +268 -73
- package/.next/standalone/docs/built-in-policies.mdx +19 -3
- package/.next/standalone/docs/configuration.mdx +46 -0
- package/.next/standalone/docs/custom-policies.mdx +65 -7
- package/.next/standalone/docs/docs.json +3 -3
- package/.next/standalone/examples/convention-policies/security-policies.mjs +40 -0
- package/.next/standalone/examples/convention-policies/workflow-policies.mjs +41 -0
- package/.next/standalone/node_modules/@next/env/package.json +1 -1
- package/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/jsonwebtoken/index.js +2 -2
- 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/pages-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/config.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +7 -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 +20 -19
- 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/node_modules/react/cjs/react.development.js +1 -1
- package/.next/standalone/node_modules/react/cjs/react.production.js +1 -1
- package/.next/standalone/node_modules/react/package.json +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.edge.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.node.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/package.json +2 -2
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/server.js +1 -1
- package/.next/standalone/src/hooks/builtin-policies.ts +70 -18
- package/.next/standalone/src/hooks/custom-hooks-loader.ts +165 -21
- package/.next/standalone/src/hooks/handler.ts +32 -6
- package/.next/standalone/src/hooks/hooks-config.ts +47 -2
- package/.next/standalone/src/hooks/llm-client.ts +2 -2
- package/.next/standalone/src/hooks/loader-utils.ts +4 -4
- package/.next/standalone/src/hooks/manager.ts +57 -14
- package/.next/standalone/src/hooks/policy-evaluator.ts +35 -17
- package/README.md +20 -3
- package/bin/failproofai.mjs +5 -0
- package/dist/cli.mjs +268 -73
- package/package.json +1 -1
- package/src/hooks/builtin-policies.ts +70 -18
- package/src/hooks/custom-hooks-loader.ts +165 -21
- package/src/hooks/handler.ts +32 -6
- package/src/hooks/hooks-config.ts +47 -2
- package/src/hooks/llm-client.ts +2 -2
- package/src/hooks/loader-utils.ts +4 -4
- package/src/hooks/manager.ts +57 -14
- package/src/hooks/policy-evaluator.ts +35 -17
- /package/.next/standalone/.next/static/{gDMch26rYN-bU-9f6ftKR → itedhTSyIDln6TUf41j5X}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{gDMch26rYN-bU-9f6ftKR → itedhTSyIDln6TUf41j5X}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{gDMch26rYN-bU-9f6ftKR → itedhTSyIDln6TUf41j5X}/_ssgManifest.js +0 -0
|
@@ -8,6 +8,14 @@ import { BUILTIN_POLICIES } from "./builtin-policies";
|
|
|
8
8
|
import { getPoliciesForEvent } from "./policy-registry";
|
|
9
9
|
import { hookLogInfo, hookLogWarn } from "./hook-logger";
|
|
10
10
|
|
|
11
|
+
function appendHint(baseReason: string, hint: unknown): string {
|
|
12
|
+
const base = baseReason.trim();
|
|
13
|
+
const normalizedHint = typeof hint === "string" ? hint.trim() : "";
|
|
14
|
+
if (!normalizedHint) return base;
|
|
15
|
+
if (!base) return normalizedHint;
|
|
16
|
+
return `${base}. ${normalizedHint}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
export interface EvaluationResult {
|
|
12
20
|
exitCode: number;
|
|
13
21
|
stdout: string;
|
|
@@ -48,9 +56,8 @@ export async function evaluatePolicies(
|
|
|
48
56
|
session,
|
|
49
57
|
};
|
|
50
58
|
|
|
51
|
-
// Track
|
|
52
|
-
|
|
53
|
-
let instructReason: string | null = null;
|
|
59
|
+
// Track all instruct results (accumulated, does not short-circuit)
|
|
60
|
+
const instructEntries: Array<{ policyName: string; reason: string }> = [];
|
|
54
61
|
|
|
55
62
|
// Track informational messages from allow decisions (with policy attribution)
|
|
56
63
|
const allowEntries: Array<{ policyName: string; reason: string }> = [];
|
|
@@ -80,7 +87,10 @@ export async function evaluatePolicies(
|
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
if (result.decision === "deny") {
|
|
83
|
-
const reason =
|
|
90
|
+
const reason = appendHint(
|
|
91
|
+
result.reason ?? `Blocked by policy: ${policy.name}`,
|
|
92
|
+
config?.policyParams?.[policy.name]?.hint,
|
|
93
|
+
);
|
|
84
94
|
hookLogInfo(`deny by "${policy.name}": ${reason}`);
|
|
85
95
|
|
|
86
96
|
const displayTool = ctx.toolName ?? "unknown tool";
|
|
@@ -131,11 +141,14 @@ export async function evaluatePolicies(
|
|
|
131
141
|
};
|
|
132
142
|
}
|
|
133
143
|
|
|
134
|
-
// Accumulate
|
|
135
|
-
if (result.decision === "instruct"
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
144
|
+
// Accumulate all instruct results (does not short-circuit — later policies can still deny)
|
|
145
|
+
if (result.decision === "instruct") {
|
|
146
|
+
const reason = appendHint(
|
|
147
|
+
result.reason ?? `Instruction from policy: ${policy.name}`,
|
|
148
|
+
config?.policyParams?.[policy.name]?.hint,
|
|
149
|
+
);
|
|
150
|
+
instructEntries.push({ policyName: policy.name, reason });
|
|
151
|
+
hookLogInfo(`instruct by "${policy.name}": ${reason}`);
|
|
139
152
|
}
|
|
140
153
|
|
|
141
154
|
// Accumulate informational messages from allow decisions
|
|
@@ -144,17 +157,21 @@ export async function evaluatePolicies(
|
|
|
144
157
|
}
|
|
145
158
|
}
|
|
146
159
|
|
|
147
|
-
// No deny — check if we accumulated
|
|
148
|
-
if (
|
|
160
|
+
// No deny — check if we accumulated any instructs
|
|
161
|
+
if (instructEntries.length > 0) {
|
|
162
|
+
const combined = instructEntries.map((e) => e.reason).join("\n");
|
|
163
|
+
const policyNames = instructEntries.map((e) => e.policyName);
|
|
164
|
+
|
|
149
165
|
if (eventType === "Stop") {
|
|
150
166
|
// Stop hook: exitCode 2 blocks Claude from stopping.
|
|
151
167
|
// Reason goes to stderr so Claude Code receives it as context.
|
|
152
168
|
return {
|
|
153
169
|
exitCode: 2,
|
|
154
170
|
stdout: "",
|
|
155
|
-
stderr:
|
|
156
|
-
policyName:
|
|
157
|
-
|
|
171
|
+
stderr: combined,
|
|
172
|
+
policyName: policyNames[0],
|
|
173
|
+
policyNames,
|
|
174
|
+
reason: combined,
|
|
158
175
|
decision: "instruct",
|
|
159
176
|
};
|
|
160
177
|
}
|
|
@@ -162,15 +179,16 @@ export async function evaluatePolicies(
|
|
|
162
179
|
const response = {
|
|
163
180
|
hookSpecificOutput: {
|
|
164
181
|
hookEventName: eventType,
|
|
165
|
-
additionalContext: `Instruction from failproofai: ${
|
|
182
|
+
additionalContext: `Instruction from failproofai: ${combined}`,
|
|
166
183
|
},
|
|
167
184
|
};
|
|
168
185
|
return {
|
|
169
186
|
exitCode: 0,
|
|
170
187
|
stdout: JSON.stringify(response),
|
|
171
188
|
stderr: "",
|
|
172
|
-
policyName:
|
|
173
|
-
|
|
189
|
+
policyName: policyNames[0],
|
|
190
|
+
policyNames,
|
|
191
|
+
reason: combined,
|
|
174
192
|
decision: "instruct",
|
|
175
193
|
};
|
|
176
194
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|