failproofai 1.0.2-beta.0 → 1.0.2-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.
Files changed (133) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +5 -5
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +1 -1
  5. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
  6. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  11. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
  12. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  13. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
  15. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  16. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
  20. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  21. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +13 -13
  22. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/audit/page/build-manifest.json +2 -2
  32. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  33. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  35. package/.next/standalone/.next/server/app/index.html +1 -1
  36. package/.next/standalone/.next/server/app/index.rsc +14 -14
  37. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +13 -13
  38. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
  39. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  40. package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
  41. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  42. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  44. package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
  45. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
  46. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  48. package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
  49. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  50. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  52. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
  53. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  54. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  55. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  57. package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
  58. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  59. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  61. package/.next/standalone/.next/server/app/settings/page/build-manifest.json +2 -2
  62. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +4 -4
  63. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  65. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
  66. package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
  67. package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
  68. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  69. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013jr2b._.js +2 -2
  70. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01wy8d-._.js +2 -2
  71. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02npjtd._.js +2 -2
  72. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__07gm3zl._.js +14 -14
  73. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__090sxxw._.js +3 -0
  74. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da85px._.js +2 -2
  75. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ftmoxc._.js +2 -2
  76. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oa1lav._.js +1 -1
  77. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p-5p8u._.js +2 -2
  78. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s740oi._.js +2 -2
  79. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1p2otjt._.js +2 -2
  80. package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
  81. package/.next/standalone/.next/server/chunks/ssr/_0wb8osu._.js +23 -0
  82. package/.next/standalone/.next/server/chunks/ssr/{_12l4a_k._.js → _1oggjel._.js} +1 -1
  83. package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.js +1 -1
  84. package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
  85. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
  86. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  87. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
  88. package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +1 -1
  89. package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
  90. package/.next/standalone/.next/server/pages/404.html +1 -1
  91. package/.next/standalone/.next/server/pages/500.html +1 -1
  92. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  93. package/.next/standalone/.next/server/server-reference-manifest.json +19 -19
  94. package/.next/standalone/.next/static/chunks/{3y54nw0i7dsjl.js → 0nnbtp0w4sxrr.js} +1 -1
  95. package/.next/standalone/.next/static/chunks/{0sa9v5mhc8861.js → 0ykd_go4oahan.js} +1 -1
  96. package/.next/standalone/.next/static/chunks/{0eqky-7n7dgdm.js → 140ip21rqmelt.js} +1 -1
  97. package/.next/standalone/.next/static/chunks/{2i2yt3hzjredm.js → 1da5a_a-3btas.js} +1 -1
  98. package/.next/standalone/.next/static/chunks/{1oml7c7env4-g.js → 1fac8krph-zgp.js} +1 -1
  99. package/.next/standalone/.next/static/chunks/{2hs7ycvsav7v2.js → 1nzy5jc_vf9e0.js} +1 -1
  100. package/.next/standalone/.next/static/chunks/{1sl2xmn9inx3y.js → 1yw71gn8vqco1.js} +1 -1
  101. package/.next/standalone/.next/static/chunks/{1nuqytbta44af.js → 29eh4k77otcw6.js} +1 -1
  102. package/.next/standalone/.next/static/chunks/{2aawsjld9ied_.js → 2axi5ehjbld9h.js} +1 -1
  103. package/.next/standalone/.next/static/chunks/{2gn7ut4svofm2.js → 2fzxl7n717pbc.js} +1 -1
  104. package/.next/standalone/.next/static/chunks/{35xg6retpe6rp.js → 3jjmdqqzem21x.js} +1 -1
  105. package/.next/standalone/.next/static/chunks/{turbopack-3kjgdgwci4tqf.js → turbopack-2vqpa-dts1gy4.js} +1 -1
  106. package/.next/standalone/app/actions/pack-actions.ts +21 -11
  107. package/.next/standalone/app/policies/hooks-client.tsx +3 -4
  108. package/.next/standalone/fp-cloud-cli/fp_cli/_version.py +1 -1
  109. package/.next/standalone/package.json +10 -11
  110. package/.next/standalone/sdk/python/failproofai_sdk/_version.py +1 -1
  111. package/.next/standalone/server.js +1 -1
  112. package/bin/failproofai.mjs +455 -316
  113. package/dist/cli.mjs +2374 -1873
  114. package/dist/worker.mjs +3 -13
  115. package/package.json +10 -11
  116. package/src/hooks/configure-wizard.ts +67 -444
  117. package/src/hooks/fp-reset.ts +10 -19
  118. package/src/hooks/handler.ts +2 -2
  119. package/src/hooks/manager.ts +58 -24
  120. package/src/hooks/pack-cli.ts +488 -43
  121. package/src/hooks/pack-failclosed.ts +1 -1
  122. package/src/hooks/pack-manifest.ts +14 -6
  123. package/src/hooks/pack-store.ts +89 -128
  124. package/src/hooks/tui.ts +150 -48
  125. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0zig5sv._.js +0 -3
  126. package/.next/standalone/.next/server/chunks/ssr/_00e9tnf._.js +0 -23
  127. package/policy-pack/SHA256SUMS +0 -2
  128. package/policy-pack/failproofai-pack.json +0 -732
  129. package/policy-pack/failproofai-pack.mjs +0 -2017
  130. package/src/hooks/policy-presets.ts +0 -137
  131. /package/.next/standalone/.next/static/{nwbyWT06Ud0XdXOrVJyvS → A7czO1PZdTcNzLGa_H1sm}/_buildManifest.js +0 -0
  132. /package/.next/standalone/.next/static/{nwbyWT06Ud0XdXOrVJyvS → A7czO1PZdTcNzLGa_H1sm}/_clientMiddlewareManifest.js +0 -0
  133. /package/.next/standalone/.next/static/{nwbyWT06Ud0XdXOrVJyvS → A7czO1PZdTcNzLGa_H1sm}/_ssgManifest.js +0 -0
@@ -323,7 +323,7 @@ export async function evaluateHookEvent(
323
323
  if (legacyNames.length > 0) {
324
324
  hookLogWarn(
325
325
  `enforcing ${legacyNames.length} policies from this build because no pack is installed — ` +
326
- `run \`failproofai update\` to move them into the pack that ships with it`,
326
+ `run \`failproofai policies add core\` to move them into a real pack`,
327
327
  );
328
328
  }
329
329
  // What actually registered, for the pack-duplicate check below. A paused
@@ -432,7 +432,7 @@ export async function evaluateHookEvent(
432
432
  // A pack policy whose name is an ENABLED BUILTIN is the same guard
433
433
  // twice. The two register under different keys — `failproofai/block-sudo`
434
434
  // and `pack/<id>@<version>/block-sudo` — so nothing deduped them, and
435
- // the bundled pack carries the builtins under exactly these names.
435
+ // the core pack carries the builtins under exactly these names.
436
436
  //
437
437
  // A deny hides it (the first verdict short-circuits) but an INSTRUCT does
438
438
  // not: instructions accumulate and are joined, so the agent received the
@@ -26,7 +26,7 @@ import { CliError } from "../cli-error";
26
26
  import { hookLogWarn } from "./hook-logger";
27
27
  import { customPoliciesDir, globalPolicyConfigFile } from "./fp-home";
28
28
  import { readActiveCloudManagedPolicies } from "./cloud-managed-policies";
29
- import { installBundledPack, setPackPolicyEnabled } from "./pack-store";
29
+ import { CORE_SOURCE, addPack, setPackPolicyEnabled } from "./pack-store";
30
30
  import type { ResolvedPack } from "./pack-manifest";
31
31
  import { hasInstalledPacks, readInstalledPacks } from "./pack-manifest";
32
32
  import {
@@ -480,7 +480,7 @@ async function installHooksImpl(
480
480
  // would leave a freshly set-up machine enforcing nothing at all — which is
481
481
  // the failure mode this whole product exists to prevent.
482
482
  //
483
- // Installed from the copy vendored in the package: no network, so setup
483
+ // Fetched from the pack's GitHub release: there is no copy in this package,
484
484
  // cannot fail behind a proxy, and the machine is guarded the moment it is
485
485
  // configured rather than the moment it next reaches github.com.
486
486
  // The always-on guard is excluded: a pack may not declare `alwaysOn`, so the
@@ -489,7 +489,7 @@ async function installHooksImpl(
489
489
  const alwaysOnNames = new Set(BUILTIN_POLICIES.filter((p) => p.alwaysOn).map((p) => p.name));
490
490
  const fromPack = selectedPolicies.filter((name) => !alwaysOnNames.has(name));
491
491
  if (fromPack.length > 0) {
492
- // ONLY when there is no pack yet. Installing the bundled pack with
492
+ // ONLY when there is no pack yet. Fetching the core pack with
493
493
  // `only: <selection>` REPLACES whatever the machine had chosen, and
494
494
  // `selectedPolicies` is derived from `enabledPolicies` — which is empty on a
495
495
  // machine whose pack came from `pack add core`. `policy add block-rm-rf`
@@ -499,11 +499,17 @@ async function installHooksImpl(
499
499
  // With a pack already installed the names are switched on individually
500
500
  // instead, which is additive and touches nothing else.
501
501
  if (!hasInstalledPacks()) {
502
- const bundled = installBundledPack({ only: fromPack });
503
- if (!bundled.installed) {
502
+ // Fetched, not unpacked from this package: there is no copy in here any
503
+ // more. That makes this the one path in `policies --install` that needs
504
+ // the network, so its failure is reported rather than thrown — the names
505
+ // are already written to config, and the no-pack fallback enforces them
506
+ // until a pack arrives.
507
+ try {
508
+ await addPack(CORE_SOURCE, { only: fromPack });
509
+ } catch (err) {
504
510
  console.log(
505
- `\nWarning: could not install the policy pack (${bundled.reason}).\n` +
506
- `Nothing is enforcing yet — run \`failproofai pack add core\` once that is fixed.`,
511
+ `\nWarning: could not fetch the policy pack (${err instanceof Error ? err.message : String(err)}).\n` +
512
+ `Run \`failproofai policies add core\` once you are online.`,
507
513
  );
508
514
  }
509
515
  } else {
@@ -861,25 +867,53 @@ export async function listHooks(cwd?: string): Promise<void> {
861
867
  return 0;
862
868
  }
863
869
  })();
864
- groups.push(
865
- title(
866
- "failproofai policies",
867
- installedScopes.length === 0
868
- ? "not installed"
869
- : `${installedScopes.join(" + ")} · ${packCount} on`,
870
- opts,
871
- ),
872
- );
870
+ // `installedScopes` is about HOOKS — whether any agent CLI is wired to call
871
+ // us — and it says nothing about whether policies exist. Reporting it as
872
+ // "not installed" above a listing of an installed pack was a flat
873
+ // contradiction, and it hid the state that actually matters: a machine can
874
+ // hold thirty-eight policies and enforce none of them, because nothing is
875
+ // calling failproofai at all. That is the worst of the three states and it
876
+ // used to read like the emptiest.
877
+ const packsPresent = (() => {
878
+ try {
879
+ return readInstalledPacks().packs.length > 0;
880
+ } catch {
881
+ return false;
882
+ }
883
+ })();
884
+ const subtitle =
885
+ installedScopes.length > 0
886
+ ? `${installedScopes.join(" + ")} · ${packCount} on`
887
+ : packsPresent
888
+ ? `${packCount} on · NOT ENFORCING`
889
+ : "nothing installed";
890
+ groups.push(title("failproofai policies", subtitle, opts));
873
891
 
874
892
  if (installedScopes.length === 0) {
875
893
  groups.push(
876
- nextStep(
877
- "failproofai policies --install",
878
- config.enabledPolicies.length > 0
879
- ? "These are configured but NOT installed no hook is running them:"
880
- : "Nothing is installed yet. Get started with:",
881
- opts,
882
- ),
894
+ packsPresent
895
+ ? warning(
896
+ [
897
+ // ONE string, not four hand-broken ones. `warning` wraps each
898
+ // element to the terminal, so pre-wrapped prose keeps its author's
899
+ // line breaks as paragraph breaks and then wraps again inside
900
+ // them — which at 60 columns left the word "them." alone on a
901
+ // line. The command stays separate because it is not prose and
902
+ // must never be split across a wrap.
903
+ "These policies are installed but NOTHING is running them. No agent " +
904
+ "CLI on this machine is wired to call failproofai, so every policy " +
905
+ "below is inert. Wire it up with:",
906
+ " failproofai config",
907
+ ],
908
+ opts,
909
+ )
910
+ : nextStep(
911
+ "failproofai config",
912
+ config.enabledPolicies.length > 0
913
+ ? "These are configured but NOT installed — no hook is running them:"
914
+ : "Nothing is set up yet. Get started with:",
915
+ opts,
916
+ ),
883
917
  );
884
918
  }
885
919
  // Held back to the end rather than printed here. Everything below this point
@@ -1034,7 +1068,7 @@ export async function listHooks(cwd?: string): Promise<void> {
1034
1068
  }
1035
1069
 
1036
1070
  // Installed packs. They enforce on this machine exactly like every section
1037
- // above, and until now the only way to see one was `failproofai pack list` —
1071
+ // above, and until now the only way to see one was `failproofai policies` —
1038
1072
  // so the command that answers "what is enforcing here?" answered it with a
1039
1073
  // subset, for the one source a person had to go out of their way to install.
1040
1074
  try {