failproofai 1.0.13-beta.2 → 1.0.13-beta.3

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 (110) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  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/server-reference-manifest.json +1 -1
  6. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +2 -2
  10. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  11. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.rsc +3 -3
  18. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  20. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  21. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  30. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  32. package/.next/standalone/.next/server/app/index.html +1 -1
  33. package/.next/standalone/.next/server/app/index.rsc +3 -3
  34. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  35. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  36. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  37. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  38. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  40. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
  41. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  43. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  44. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  47. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  48. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  50. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  51. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  53. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +8 -8
  54. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  56. package/.next/standalone/.next/server/chunks/_0tovk6q0miud6._.js +1 -1
  57. package/.next/standalone/.next/server/chunks/_0trp3ycqv17cl._.js +1 -1
  58. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4vkpxxu7._.js +1 -1
  59. package/.next/standalone/.next/server/chunks/src_hooks_0_em82s16zfym._.js +1 -1
  60. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__19nvo1qfswchs._.js → [root-of-the-server]__070rqh7scntiu._.js} +2 -2
  61. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08ch3staq3ejw._.js +1 -1
  62. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bigvy9xmv2ka._.js +1 -1
  63. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h86bl2qf0k_o._.js +1 -1
  64. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pia5h3p8re4c._.js +1 -1
  65. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1-ey9fgesfbc0._.js +1 -1
  66. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15usvs-ms-0hf._.js +1 -1
  67. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__16gb3_92zvk5x._.js +1 -1
  68. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1avi2kypusyb_._.js +1 -1
  69. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1r7drlqli-ado._.js +1 -1
  70. package/.next/standalone/.next/server/chunks/ssr/_0eoura3_9gjb-._.js +1 -1
  71. package/.next/standalone/.next/server/chunks/ssr/_0pedwblqdoh58._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/ssr/_1djqs9i27e4kg._.js +1 -1
  73. package/.next/standalone/.next/server/chunks/ssr/{_1nvqg4si0splb._.js → _1tcvpgd7hugnx._.js} +2 -2
  74. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo5_vm5f.js +2 -2
  75. package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9snixb5fd-._.js +1 -1
  76. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47q0xq5w._.js +1 -1
  77. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x33jqb6._.js +1 -1
  78. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpcz0uxur._.js +1 -1
  79. package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h47jmhhd._.js +1 -1
  80. package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_1gk40bvx2bftt.js → node_modules_html-to-image_es_index_1p-is71j0j7fb.js} +1 -1
  81. package/.next/standalone/.next/server/chunks/ssr/package_json_[json]_cjs_013tntikdft59._.js +1 -1
  82. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  83. package/.next/standalone/.next/server/pages/404.html +1 -1
  84. package/.next/standalone/.next/server/pages/500.html +1 -1
  85. package/.next/standalone/.next/server/preview-props.json +3 -3
  86. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  87. package/.next/standalone/.next/server/server-reference-manifest.json +23 -23
  88. package/.next/standalone/.next/static/chunks/{3lgxb73wehfv2.js → 095l2av-xsus2.js} +1 -1
  89. package/.next/standalone/.next/static/chunks/{44rukkkzacqkl.js → 0h7mkux811w5b.js} +2 -2
  90. package/.next/standalone/.next/static/chunks/{2q-6h4rclnu98.js → 19l5hbzn475am.js} +1 -1
  91. package/.next/standalone/.next/static/chunks/{1l9lji2he-mbw.js → 1s__s2o5zcfcy.js} +1 -1
  92. package/.next/standalone/.next/static/chunks/{2f9-xdgd1o3r5.js → 1uxq_gbvdti30.js} +1 -1
  93. package/.next/standalone/.next/static/chunks/{1mkf3bas1g5ka.js → 2sthn8c56n9m_.js} +1 -1
  94. package/.next/standalone/.next/static/chunks/{2xox4fr0q-ftn.js → 3eonfpk9jyceg.js} +1 -1
  95. package/.next/standalone/.next/static/chunks/{061bksch79zq2.js → 3m9g1l6-yh0s3.js} +1 -1
  96. package/.next/standalone/.next/static/chunks/{2x-77r0k0xm3b.js → 3uaguc-tbu_ik.js} +1 -1
  97. package/.next/standalone/.next/static/chunks/{22gs9785ug-vp.js → 3zwff_ax3hust.js} +1 -1
  98. package/.next/standalone/hermes-plugin/plugin.yaml +1 -1
  99. package/.next/standalone/package.json +9 -9
  100. package/.next/standalone/server.js +1 -1
  101. package/dist/cli.mjs +224 -371
  102. package/dist/worker.mjs +5 -4
  103. package/hermes-plugin/plugin.yaml +1 -1
  104. package/package.json +9 -9
  105. package/src/hooks/daemon-service.ts +3 -168
  106. package/src/hooks/types.ts +20 -17
  107. package/src/hooks/uninstall-cli.ts +0 -3
  108. /package/.next/standalone/.next/static/{TdOlUedz_AHC-0Ops67a_ → fHR90vZ5ls7d-K8cH9hxe}/_buildManifest.js +0 -0
  109. /package/.next/standalone/.next/static/{TdOlUedz_AHC-0Ops67a_ → fHR90vZ5ls7d-K8cH9hxe}/_clientMiddlewareManifest.js +0 -0
  110. /package/.next/standalone/.next/static/{TdOlUedz_AHC-0Ops67a_ → fHR90vZ5ls7d-K8cH9hxe}/_ssgManifest.js +0 -0
package/dist/worker.mjs CHANGED
@@ -209,6 +209,7 @@ var init_types = __esm(() => {
209
209
  ANTIGRAVITY_TOOL_MAP = {
210
210
  run_command: "Bash",
211
211
  write_to_file: "Write",
212
+ write_file: "Write",
212
213
  read_file: "Read",
213
214
  view_file: "Read",
214
215
  edit_file: "Edit",
@@ -221,9 +222,9 @@ var init_types = __esm(() => {
221
222
  };
222
223
  ANTIGRAVITY_TOOL_INPUT_MAP = {
223
224
  Bash: { CommandLine: "command", Cwd: "cwd" },
224
- Write: { TargetFile: "file_path", CodeContent: "content" },
225
- Edit: { TargetFile: "file_path" },
226
- Read: { TargetFile: "file_path", AbsolutePath: "file_path", File: "file_path" }
225
+ Write: { Path: "file_path", Content: "content", TargetFile: "file_path", CodeContent: "content" },
226
+ Edit: { Path: "file_path", Target: "old_string", Replacement: "new_string", TargetFile: "file_path" },
227
+ Read: { Path: "file_path", TargetFile: "file_path", AbsolutePath: "file_path", File: "file_path" }
227
228
  };
228
229
  GOOSE_TOOL_MAP = {
229
230
  shell: "Bash",
@@ -1166,7 +1167,7 @@ function instruct(reason) {
1166
1167
  }
1167
1168
 
1168
1169
  // package.json
1169
- var version = "1.0.13-beta.2";
1170
+ var version = "1.0.13-beta.3";
1170
1171
  var init_package = () => {};
1171
1172
 
1172
1173
  // src/hooks/agent-targets.ts
@@ -1,5 +1,5 @@
1
1
  name: failproofai
2
- version: 1.0.13-beta.2
2
+ version: 1.0.13-beta.3
3
3
  description: Real-time FailproofAI policy enforcement for Hermes
4
4
  manifest_version: 2
5
5
  api_version: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "failproofai",
3
- "version": "1.0.13-beta.2",
3
+ "version": "1.0.13-beta.3",
4
4
  "description": "Observability and enforcement for AI agent harnesses. 40 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",
5
5
  "bin": {
6
6
  "failproofai": "./dist/cli.mjs",
@@ -126,15 +126,15 @@
126
126
  "browserslist": "4.28.8"
127
127
  },
128
128
  "optionalDependencies": {
129
- "@failproofai/failproofaid-linux-x64": "1.0.13-beta.2",
130
- "@failproofai/failproofaid-linux-arm64": "1.0.13-beta.2",
131
- "@failproofai/failproofaid-darwin-x64": "1.0.13-beta.2",
132
- "@failproofai/failproofaid-darwin-arm64": "1.0.13-beta.2"
129
+ "@failproofai/failproofaid-linux-x64": "1.0.13-beta.3",
130
+ "@failproofai/failproofaid-linux-arm64": "1.0.13-beta.3",
131
+ "@failproofai/failproofaid-darwin-x64": "1.0.13-beta.3",
132
+ "@failproofai/failproofaid-darwin-arm64": "1.0.13-beta.3"
133
133
  },
134
134
  "failproofaidBinaries": {
135
- "linux-x64": "8301567948ddf752b6db30ed5998e62139df4c7e1669b280159a83a9b951b94c",
136
- "linux-arm64": "ad53ec24d7c09b2dbc07b792c0739dc1e5f443fdb9a795174d3a40453f90bbcf",
137
- "darwin-x64": "e4e65a1071a5793bafb73625dc49d211ff19d7e0d8c03c804959d1357aebea1e",
138
- "darwin-arm64": "78aa90272e2ace07ac3648a419b961f8d8bfe56c7fd3a0193d3579085d77e9cb"
135
+ "linux-x64": "86f8b544b95d33b3464c916dff72e1a1436340d98c480dc8f83d1696dda1e5fe",
136
+ "linux-arm64": "d09376e5608e1379c247087386473f4ff1fcaa264022e570cc00f2cbb66b09fb",
137
+ "darwin-x64": "95f485247270fef7f4676e383ec586e339451c87dcd0480e1a12d721a62bec4b",
138
+ "darwin-arm64": "f8c0d43dba6d78facb00a0a265c188238e50223aedab2c17b3e66c202edacf5d"
139
139
  }
140
140
  }
@@ -13,14 +13,12 @@ import {
13
13
  mkdirSync,
14
14
  mkdtempSync,
15
15
  readFileSync,
16
- readdirSync,
17
- statSync,
18
16
  writeFileSync,
19
17
  unlinkSync,
20
18
  rmSync,
21
19
  } from "node:fs";
22
20
  import { homedir, tmpdir, userInfo } from "node:os";
23
- import { dirname, resolve } from "node:path";
21
+ import { resolve } from "node:path";
24
22
  import { execFileSync } from "node:child_process";
25
23
  import { hookLogWarn } from "./hook-logger";
26
24
  import { downloadFailproofaidBinary, installFromNpmPackage, installedBinaryPath } from "./daemon-download";
@@ -415,142 +413,6 @@ function systemdUnitPath(user: string = serviceUser()): string {
415
413
  return resolve(systemdUnitDir(), systemdUnitName(user));
416
414
  }
417
415
 
418
- /**
419
- * Where a Linux install puts the copy of the daemon that systemd actually runs:
420
- * `/opt/failproofai/<user>/bin/failproofaid-<version>`, root-owned.
421
- *
422
- * The binary is downloaded into `~/.failproofai/bin`, and a unit whose
423
- * `ExecStart` points there works on Debian, Ubuntu and Mint — and on Fedora,
424
- * RHEL, Rocky and Alma it never starts. Those ship SELinux enforcing, a file
425
- * under a home directory is labelled `user_home_t`, and the targeted policy
426
- * gives systemd (`init_t`) no execute permission on that type at all. The unit
427
- * fails `203/EXEC Permission denied`, `waitForDaemonRunning()` times out, and
428
- * `failproofai config` aborts at its very last step.
429
- *
430
- * The policy's generic `/opt/(.*\/)?bin(/.*)?` rule labels this path `bin_t`,
431
- * which systemd may execute, and executing it moves the daemon into
432
- * `unconfined_service_t` — the domain that may in turn run the worker's node
433
- * from `~/.nvm` (also `user_home_t`) and accept hooks on the socket. So only
434
- * the daemon binary moves; the worker command, the socket and the state under
435
- * `~/.failproofai` stay where they are. Not `/usr/local/libexec`: both
436
- * policies label that `usr_t`, which starts the daemon only through a
437
- * secondary `init_t usr_t → unconfined_service_t` rule, where `bin_t` is the
438
- * type the policy means for programs. Not `/usr/libexec` either: `/usr` is the
439
- * package manager's, and read-only on Silverblue and CoreOS. All checked
440
- * against the shipped policy on Fedora 41 and Rocky 9 with `matchpathcon` and
441
- * `sesearch`.
442
- *
443
- * Per user for the same reason the unit name is: two people on one box may run
444
- * different versions, and one's uninstall must not delete the other's binary.
445
- * The `~/.failproofai/bin` copy is kept — `daemonVersionSkew()` and
446
- * `refreshDaemonToCliVersion()` read the installed version from it.
447
- *
448
- * Redirectable for tests ONLY, like the unit directory.
449
- */
450
- function systemBinaryRoot(user: string = serviceUser()): string {
451
- return resolve(process.env.FAILPROOFAI_SYSTEM_BIN_DIR || "/opt/failproofai", user);
452
- }
453
-
454
- function systemBinaryDir(): string {
455
- return resolve(systemBinaryRoot(), "bin");
456
- }
457
-
458
- /** The system binary directory on Linux, for the manual-removal instructions. */
459
- export function daemonSystemBinaryDir(): string | null {
460
- return process.platform === "linux" ? systemBinaryRoot() : null;
461
- }
462
-
463
- /**
464
- * The path systemd should start for `binaryPath`, or null when it should start
465
- * `binaryPath` itself.
466
- *
467
- * Only a real file is copied. `FAILPROOFAI_DAEMON_BINARY` is "someone named a
468
- * binary explicitly" and may be a command with arguments (this repo's own
469
- * systemd tests use `/usr/bin/sleep infinity`), so it is started as given.
470
- */
471
- export function systemBinaryTarget(binaryPath: string): string | null {
472
- if (process.platform !== "linux" || process.env.FAILPROOFAI_DAEMON_BINARY) return null;
473
- try {
474
- if (!statSync(binaryPath).isFile()) return null;
475
- } catch {
476
- return null;
477
- }
478
- return resolve(systemBinaryDir(), `failproofaid-${version}`);
479
- }
480
-
481
- /**
482
- * Whether this kernel has SELinux enabled. `/sys/fs/selinux` is mounted only
483
- * when it is, enforcing or permissive.
484
- */
485
- function selinuxEnabled(): boolean {
486
- return existsSync("/sys/fs/selinux/enforce");
487
- }
488
-
489
- /**
490
- * Copies the daemon binary into the system directory and returns the path the
491
- * unit should start. Privileged; throws when the copy fails, which the caller
492
- * reports as a failed install before any unit is written.
493
- *
494
- * Staged under a temp name and renamed into place, so a reinstall of the same
495
- * version never writes into the file a running daemon was started from.
496
- *
497
- * `restorecon` afterwards, because a new file inherits the label of the
498
- * directory it is created in, not the one the policy assigns to its path: the
499
- * directories `install -d` creates under `/opt` (`usr_t`) come out `usr_t`
500
- * too, never the `bin_t` the policy names for them.
501
- */
502
- function stageSystemBinary(binaryPath: string): string {
503
- const target = systemBinaryTarget(binaryPath);
504
- if (!target) return binaryPath;
505
- const dir = systemBinaryDir();
506
- const staging = `${target}.${process.pid}.tmp`;
507
- runPrivileged("install", ["-d", "-m", "0755", dir]);
508
- try {
509
- runPrivileged("install", ["-m", "0755", binaryPath, staging]);
510
- runPrivileged("mv", ["-f", staging, target]);
511
- } catch (err) {
512
- try {
513
- runPrivileged("rm", ["-f", staging]);
514
- } catch {
515
- /* best-effort */
516
- }
517
- throw err;
518
- }
519
- if (selinuxEnabled()) {
520
- const root = systemBinaryRoot();
521
- try {
522
- runPrivileged("restorecon", ["-R", root]);
523
- } catch (err) {
524
- // Not fatal here: a wrong label still surfaces as the daemon not
525
- // reaching a running state, which fails the install with its status.
526
- hookLogWarn(`restorecon on ${root} failed: ${err instanceof Error ? err.message : String(err)}`);
527
- }
528
- }
529
- return target;
530
- }
531
-
532
- /**
533
- * Removes system copies other than `current` and the most recent one before
534
- * it — the same keep-one-for-rollback rule `pruneOldDaemonBinaries()` applies
535
- * to `~/.failproofai/bin`. Best-effort; only called once the service runs
536
- * `current`.
537
- */
538
- function pruneSystemBinaries(current: string): void {
539
- try {
540
- const dir = systemBinaryDir();
541
- const stale = readdirSync(dir)
542
- .filter((f) => f.startsWith("failproofaid-"))
543
- .map((f) => resolve(dir, f))
544
- .filter((p) => p !== current)
545
- .map((p) => ({ p, mtime: statSync(p).mtimeMs }))
546
- .sort((a, b) => b.mtime - a.mtime)
547
- .slice(1);
548
- for (const { p } of stale) runPrivileged("rm", ["-f", p]);
549
- } catch {
550
- // Nothing to prune, or no elevation left — leaving a file costs disk only.
551
- }
552
- }
553
-
554
416
  /**
555
417
  * The pre-1.0.0-beta.1 user-scope unit. Still removed on install and
556
418
  * uninstall: it holds the same flock the new service needs, so leaving one
@@ -930,18 +792,8 @@ function daemonInstallCommands(
930
792
  cliCmd: string | null,
931
793
  ): string[] {
932
794
  if (process.platform === "linux") {
933
- const target = systemBinaryTarget(binaryPath);
934
- const dir = systemBinaryDir();
935
- const stage = target
936
- ? [
937
- `sudo install -d -m 0755 ${dir}`,
938
- `sudo install -m 0755 ${binaryPath} ${target}`,
939
- `{ sudo restorecon -R ${systemBinaryRoot()} 2>/dev/null || true; }`,
940
- ]
941
- : [];
942
795
  return [
943
- ...stage,
944
- `sudo tee ${systemdUnitPath()} <<'EOF'\n${systemdUnitContents(target ?? binaryPath, workerCmd, cliCmd)}EOF`,
796
+ `sudo tee ${systemdUnitPath()} <<'EOF'\n${systemdUnitContents(binaryPath, workerCmd, cliCmd)}EOF`,
945
797
  "sudo systemctl daemon-reload",
946
798
  `sudo systemctl enable ${systemdUnitName()}`,
947
799
  // `restart`, not `enable --now`, for the reason the install path gives:
@@ -1013,13 +865,9 @@ export async function installDaemonService(): Promise<DaemonInstallResult> {
1013
865
  // never came up. Clear it first, every time.
1014
866
  removeLegacyUserService();
1015
867
 
1016
- let execPath = binaryPath;
1017
868
  try {
1018
869
  if (process.platform === "linux") {
1019
- // Before the unit is written, so a copy that fails leaves the previous
1020
- // unit and the daemon it runs untouched. See `systemBinaryDir()`.
1021
- execPath = stageSystemBinary(binaryPath);
1022
- writePrivilegedFile(systemdUnitPath(), systemdUnitContents(execPath, workerCmd, cliCmd));
870
+ writePrivilegedFile(systemdUnitPath(), systemdUnitContents(binaryPath, workerCmd, cliCmd));
1023
871
  runPrivileged("systemctl", ["daemon-reload"]);
1024
872
  // `enable` for boot persistence, then `restart` — NOT `enable --now`.
1025
873
  //
@@ -1079,7 +927,6 @@ export async function installDaemonService(): Promise<DaemonInstallResult> {
1079
927
  hookLogWarn(`daemon service install failed: ${reason}`);
1080
928
  return { installed: false, reason };
1081
929
  }
1082
- if (execPath !== binaryPath) pruneSystemBinaries(execPath);
1083
930
 
1084
931
  // NOTE: this reports that the SERVICE is installed and running, which is all
1085
932
  // it can honestly claim. Whether the daemon can actually evaluate a hook is a
@@ -1836,18 +1683,6 @@ export async function uninstallDaemonService(): Promise<void> {
1836
1683
  } catch {
1837
1684
  // Best-effort.
1838
1685
  }
1839
- // The copy systemd ran. After the unit is gone, so nothing enabled is
1840
- // left pointing at a deleted file. The shared parent goes only if no
1841
- // other user's directory is in it.
1842
- const binRoot = systemBinaryRoot();
1843
- if (existsSync(binRoot)) {
1844
- runPrivileged("rm", ["-rf", binRoot]);
1845
- try {
1846
- runPrivileged("rmdir", [dirname(binRoot)]);
1847
- } catch {
1848
- // Not empty — another user's daemon lives there.
1849
- }
1850
- }
1851
1686
  } else {
1852
1687
  const plistPath = launchdPlistPath();
1853
1688
  if (!existsSync(plistPath)) return;
@@ -863,16 +863,19 @@ export const ANTIGRAVITY_EVENT_MAP: Record<AntigravityHookEventType, HookEventTy
863
863
  /**
864
864
  * Antigravity's tool names → Claude PascalCase canonical names so existing
865
865
  * builtin policies (which match `toolName === "Bash"`, etc.) fire unchanged.
866
- * Tool names VERIFIED against the agy binary's tool registry + live transcripts:
867
- * the file tool is `write_to_file` (NOT `write_file`), listing is `list_dir`
868
- * (NOT `list_directory`), and glob is `find_by_name` (NOT `find_filepath`) — the
869
- * earlier best-effort names were wrong, so `block-env-files`/`block-secrets-write`
870
- * silently no-op'd on Antigravity file writes. Unknown tools pass through via the
871
- * `?? raw` fallback.
866
+ * Tool names VERIFIED against live recorder-hook captures, and they have moved
867
+ * once: agy 1.4.9 and 1.4.12 deliver `read_file`/`write_file`/`edit_file`, with
868
+ * listing and search reached through `read_file` on a directory and `run_command`.
869
+ * Earlier builds delivered `view_file`/`write_to_file`/`replace_file_content`/
870
+ * `list_dir`/`find_by_name`/`grep_search`; those stay mapped for installs that
871
+ * have not updated. A file tool missing here is not an error anywhere: every
872
+ * policy matching on the canonical name silently allows it. Unknown tools pass
873
+ * through via the `?? raw` fallback.
872
874
  */
873
875
  export const ANTIGRAVITY_TOOL_MAP: Record<string, string> = {
874
876
  run_command: "Bash",
875
877
  write_to_file: "Write",
878
+ write_file: "Write",
876
879
  read_file: "Read",
877
880
  view_file: "Read",
878
881
  edit_file: "Edit",
@@ -886,20 +889,20 @@ export const ANTIGRAVITY_TOOL_MAP: Record<string, string> = {
886
889
 
887
890
  /**
888
891
  * Antigravity tool args are PascalCase. Keyed by the CANONICAL tool name
889
- * (canonicalizeToolInput runs after canonicalizeToolName). VERIFIED live:
890
- * `run_command` delivers `CommandLine`/`Cwd`; `write_to_file` delivers the path
891
- * as `TargetFile` and body as `CodeContent`. Without the Write/Edit/Read entries
892
- * the path/content builtins (`block-env-files`, `block-secrets-write`,
893
- * `block-read-outside-cwd`) never saw a `file_path` and silently no-op'd on
894
- * Antigravity file operations. Read/Edit path keys are best-effort within the
895
- * same tool family (all file tools operate on `TargetFile`); extra keys are
896
- * harmless (only remapped when present).
892
+ * (canonicalizeToolInput runs after canonicalizeToolName). VERIFIED live against
893
+ * agy 1.4.12: `run_command` delivers `CommandLine`; `read_file` delivers `Path`;
894
+ * `write_file` delivers `Path`/`Content`; `edit_file` delivers
895
+ * `Path`/`Target`/`Replacement`. Earlier builds delivered `AbsolutePath` on
896
+ * `view_file` and `TargetFile`/`CodeContent` on `write_to_file`, kept because
897
+ * extra keys are harmless (only remapped when present). Without these entries
898
+ * the path/content builtins, and the always-on guard over failproofai's own
899
+ * state, never see a `file_path` and silently allow the call.
897
900
  */
898
901
  export const ANTIGRAVITY_TOOL_INPUT_MAP: Record<string, Record<string, string>> = {
899
902
  Bash: { CommandLine: "command", Cwd: "cwd" },
900
- Write: { TargetFile: "file_path", CodeContent: "content" },
901
- Edit: { TargetFile: "file_path" },
902
- Read: { TargetFile: "file_path", AbsolutePath: "file_path", File: "file_path" },
903
+ Write: { Path: "file_path", Content: "content", TargetFile: "file_path", CodeContent: "content" },
904
+ Edit: { Path: "file_path", Target: "old_string", Replacement: "new_string", TargetFile: "file_path" },
905
+ Read: { Path: "file_path", TargetFile: "file_path", AbsolutePath: "file_path", File: "file_path" },
903
906
  };
904
907
 
905
908
  // ── Goose (codename goose, Block) ────────────────────────────────────────────
@@ -39,7 +39,6 @@ import {
39
39
  daemonServiceFilePath,
40
40
  daemonServiceStatus,
41
41
  daemonStatusCommand,
42
- daemonSystemBinaryDir,
43
42
  isDaemonSupportedPlatform,
44
43
  primeElevation,
45
44
  setDaemonConfigured,
@@ -418,12 +417,10 @@ function manualServiceRemoval(servicePath: string): string[] {
418
417
  return [`sudo launchctl unload -w ${servicePath}`, `sudo rm -f ${servicePath}`];
419
418
  }
420
419
  const unit = servicePath.split("/").pop() ?? servicePath;
421
- const binDir = daemonSystemBinaryDir();
422
420
  return [
423
421
  `sudo systemctl disable --now ${unit}`,
424
422
  `sudo rm -f ${servicePath}`,
425
423
  `sudo systemctl daemon-reload`,
426
- ...(binDir ? [`sudo rm -rf ${binDir}`] : []),
427
424
  ];
428
425
  }
429
426