@humwick/runner 0.0.0-stage → 0.130.0

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 (293) hide show
  1. package/LICENSE +167 -0
  2. package/agent-bin/agent-relay-browser +10 -0
  3. package/agent-bin/humwick +10 -0
  4. package/hooks/fff-search-redirect/fff-search-redirect.cjs +161 -0
  5. package/hooks/fff-search-redirect/hooks.json +13 -0
  6. package/hooks/rg-r-guard/hooks.json +18 -0
  7. package/hooks/rg-r-guard/rg-r-guard.cjs +144 -0
  8. package/hooks/web-tools-redirect/hooks.json +13 -0
  9. package/hooks/web-tools-redirect/web-tools-redirect.cjs +84 -0
  10. package/node_modules/@humwick/offload/LICENSE +167 -0
  11. package/node_modules/@humwick/offload/README.md +57 -0
  12. package/node_modules/@humwick/offload/dist/async-runner.d.ts +18 -0
  13. package/node_modules/@humwick/offload/dist/async-runner.d.ts.map +1 -0
  14. package/node_modules/@humwick/offload/dist/async-runner.js +158 -0
  15. package/node_modules/@humwick/offload/dist/async-runner.js.map +1 -0
  16. package/node_modules/@humwick/offload/dist/envelope.d.ts +25 -0
  17. package/node_modules/@humwick/offload/dist/envelope.d.ts.map +1 -0
  18. package/node_modules/@humwick/offload/dist/envelope.js +80 -0
  19. package/node_modules/@humwick/offload/dist/envelope.js.map +1 -0
  20. package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts +10 -0
  21. package/node_modules/@humwick/offload/dist/fixtures/worker-task.d.ts.map +1 -0
  22. package/node_modules/@humwick/offload/dist/fixtures/worker-task.js +59 -0
  23. package/node_modules/@humwick/offload/dist/fixtures/worker-task.js.map +1 -0
  24. package/node_modules/@humwick/offload/dist/index.d.ts +5 -0
  25. package/node_modules/@humwick/offload/dist/index.d.ts.map +1 -0
  26. package/node_modules/@humwick/offload/dist/index.js +5 -0
  27. package/node_modules/@humwick/offload/dist/index.js.map +1 -0
  28. package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts +62 -0
  29. package/node_modules/@humwick/offload/dist/subprocess-runner.d.ts.map +1 -0
  30. package/node_modules/@humwick/offload/dist/subprocess-runner.js +295 -0
  31. package/node_modules/@humwick/offload/dist/subprocess-runner.js.map +1 -0
  32. package/node_modules/@humwick/offload/dist/types.d.ts +111 -0
  33. package/node_modules/@humwick/offload/dist/types.d.ts.map +1 -0
  34. package/node_modules/@humwick/offload/dist/types.js +176 -0
  35. package/node_modules/@humwick/offload/dist/types.js.map +1 -0
  36. package/node_modules/@humwick/offload/dist/worker-pool.d.ts +23 -0
  37. package/node_modules/@humwick/offload/dist/worker-pool.d.ts.map +1 -0
  38. package/node_modules/@humwick/offload/dist/worker-pool.js +435 -0
  39. package/node_modules/@humwick/offload/dist/worker-pool.js.map +1 -0
  40. package/node_modules/@humwick/offload/dist/worker-runtime.d.ts +2 -0
  41. package/node_modules/@humwick/offload/dist/worker-runtime.d.ts.map +1 -0
  42. package/node_modules/@humwick/offload/dist/worker-runtime.js +27 -0
  43. package/node_modules/@humwick/offload/dist/worker-runtime.js.map +1 -0
  44. package/node_modules/@humwick/offload/dist/worker.d.ts +5 -0
  45. package/node_modules/@humwick/offload/dist/worker.d.ts.map +1 -0
  46. package/node_modules/@humwick/offload/dist/worker.js +1 -0
  47. package/node_modules/@humwick/offload/dist/worker.js.map +1 -0
  48. package/node_modules/@humwick/offload/package.json +46 -0
  49. package/node_modules/@humwick/offload/src/async-runner.ts +170 -0
  50. package/node_modules/@humwick/offload/src/envelope.ts +92 -0
  51. package/node_modules/@humwick/offload/src/fixtures/worker-task.ts +49 -0
  52. package/node_modules/@humwick/offload/src/index.ts +4 -0
  53. package/node_modules/@humwick/offload/src/subprocess-runner.ts +334 -0
  54. package/node_modules/@humwick/offload/src/types.ts +235 -0
  55. package/node_modules/@humwick/offload/src/worker-pool.ts +463 -0
  56. package/node_modules/@humwick/offload/src/worker-runtime.ts +32 -0
  57. package/node_modules/@humwick/offload/src/worker.ts +5 -0
  58. package/package.json +47 -4
  59. package/plugins/browser/skills/playwright-cli/SKILL.md +53 -0
  60. package/plugins/claude/.claude-plugin/plugin.json +8 -0
  61. package/plugins/claude/claude-statusline-probe.cjs +144 -0
  62. package/plugins/claude/hooks/gate-run-guard.provisioned.mjs +914 -0
  63. package/plugins/claude/hooks/gate-run-guard.sh +9 -0
  64. package/plugins/claude/hooks/gate-run-guard.ts +237 -0
  65. package/plugins/claude/hooks/hooks.json +158 -0
  66. package/plugins/claude/hooks/kill-guard.provisioned.mjs +7027 -0
  67. package/plugins/claude/hooks/kill-guard.sh +341 -0
  68. package/plugins/claude/hooks/kill-guard.ts +337 -0
  69. package/plugins/claude/hooks/permission-request.sh +22 -0
  70. package/plugins/claude/hooks/post-compact.sh +10 -0
  71. package/plugins/claude/hooks/post-tool-use.sh +8 -0
  72. package/plugins/claude/hooks/pre-compact.sh +12 -0
  73. package/plugins/claude/hooks/read-only-bash-guard.sh +587 -0
  74. package/plugins/claude/hooks/relay-status.sh +373 -0
  75. package/plugins/claude/hooks/session-end.sh +26 -0
  76. package/plugins/claude/hooks/session-start.sh +31 -0
  77. package/plugins/claude/hooks/shell-trust.ts +28 -0
  78. package/plugins/claude/hooks/stop-failure.sh +47 -0
  79. package/plugins/claude/hooks/stop.sh +48 -0
  80. package/plugins/claude/hooks/subagent-guard.cjs +26 -0
  81. package/plugins/claude/hooks/subagent-skill-policy.cjs +160 -0
  82. package/plugins/claude/hooks/subagent-start.sh +13 -0
  83. package/plugins/claude/hooks/subagent-stop.sh +19 -0
  84. package/plugins/claude/hooks/user-prompt-submit.sh +18 -0
  85. package/plugins/claude/hooks/wait-loop-guard.ts +120 -0
  86. package/plugins/claude/monitors/monitors.json +7 -0
  87. package/plugins/claude/monitors/relay-monitor.provisioned.mjs +786 -0
  88. package/plugins/claude/monitors/relay-monitor.ts +58 -0
  89. package/plugins/claude/skills/disconnect/SKILL.md +16 -0
  90. package/plugins/claude/skills/label/SKILL.md +23 -0
  91. package/plugins/claude/skills/message/SKILL.md +40 -0
  92. package/plugins/claude/skills/pair/SKILL.md +30 -0
  93. package/plugins/claude/skills/react/SKILL.md +18 -0
  94. package/plugins/claude/skills/read-message/SKILL.md +24 -0
  95. package/plugins/claude/skills/reply/SKILL.md +44 -0
  96. package/plugins/claude/skills/send-claimable/SKILL.md +39 -0
  97. package/plugins/claude/skills/slice-first/SKILL.md +32 -0
  98. package/plugins/claude/skills/slice-first/references/plan-recipe.md +46 -0
  99. package/plugins/claude/skills/status/SKILL.md +16 -0
  100. package/plugins/claude/skills/tags/SKILL.md +25 -0
  101. package/plugins/claude/skills/task/SKILL.md +28 -0
  102. package/plugins/claude-output-style/.claude-plugin/plugin.json +5 -0
  103. package/plugins/claude-output-style/output-styles/agent-relay.md +5 -0
  104. package/plugins/codex/skills/disconnect/SKILL.md +15 -0
  105. package/plugins/codex/skills/guide/SKILL.md +15 -0
  106. package/plugins/codex/skills/label/SKILL.md +22 -0
  107. package/plugins/codex/skills/message/SKILL.md +40 -0
  108. package/plugins/codex/skills/pair/SKILL.md +29 -0
  109. package/plugins/codex/skills/react/SKILL.md +17 -0
  110. package/plugins/codex/skills/read-message/SKILL.md +23 -0
  111. package/plugins/codex/skills/reply/SKILL.md +44 -0
  112. package/plugins/codex/skills/send-claimable/SKILL.md +39 -0
  113. package/plugins/codex/skills/slice-first/SKILL.md +32 -0
  114. package/plugins/codex/skills/slice-first/references/plan-recipe.md +46 -0
  115. package/plugins/codex/skills/status/SKILL.md +15 -0
  116. package/plugins/codex/skills/tags/SKILL.md +24 -0
  117. package/plugins/codex/skills/task/SKILL.md +28 -0
  118. package/src/adapter.ts +1061 -0
  119. package/src/adapters/__fixtures__/codex-app-server.ts +47 -0
  120. package/src/adapters/claude-api.ts +243 -0
  121. package/src/adapters/claude-context-command.ts +16 -0
  122. package/src/adapters/claude-credentials.ts +22 -0
  123. package/src/adapters/claude-delivery-lanes.ts +28 -0
  124. package/src/adapters/claude-delivery.ts +166 -0
  125. package/src/adapters/claude-effort.ts +94 -0
  126. package/src/adapters/claude-exit.ts +290 -0
  127. package/src/adapters/claude-headless-mirror.ts +88 -0
  128. package/src/adapters/claude-headless-refusal.ts +51 -0
  129. package/src/adapters/claude-headless.ts +617 -0
  130. package/src/adapters/claude-monitor-delivery-plan.ts +317 -0
  131. package/src/adapters/claude-permission.ts +243 -0
  132. package/src/adapters/claude-prompt-gates.ts +269 -0
  133. package/src/adapters/claude-prompt-hook.ts +145 -0
  134. package/src/adapters/claude-session-capture.ts +293 -0
  135. package/src/adapters/claude-session-probe.ts +414 -0
  136. package/src/adapters/claude-shutdown.ts +190 -0
  137. package/src/adapters/claude-status-detectors.ts +426 -0
  138. package/src/adapters/claude-subagents.ts +93 -0
  139. package/src/adapters/claude-submit-confirmation.ts +287 -0
  140. package/src/adapters/claude-tmux.ts +548 -0
  141. package/src/adapters/claude-token-usage-capture.ts +253 -0
  142. package/src/adapters/claude-tool-policy.ts +165 -0
  143. package/src/adapters/claude-transcript-tail.ts +193 -0
  144. package/src/adapters/claude-transcript.ts +812 -0
  145. package/src/adapters/claude.ts +1097 -0
  146. package/src/adapters/codex-agent-message-capture.ts +189 -0
  147. package/src/adapters/codex-app-server.ts +70 -0
  148. package/src/adapters/codex-client.ts +362 -0
  149. package/src/adapters/codex-effective-config.ts +87 -0
  150. package/src/adapters/codex-launch-config.ts +153 -0
  151. package/src/adapters/codex-rollout-context.ts +272 -0
  152. package/src/adapters/codex-skill-discovery.ts +18 -0
  153. package/src/adapters/codex-token-usage-capture.ts +163 -0
  154. package/src/adapters/codex-tool-output.ts +53 -0
  155. package/src/adapters/codex-turn-outcome.ts +27 -0
  156. package/src/adapters/codex-version.ts +64 -0
  157. package/src/adapters/codex.ts +1442 -0
  158. package/src/adapters/incremental-file.ts +110 -0
  159. package/src/adapters/opencode-api.ts +71 -0
  160. package/src/adapters/opencode-context.ts +277 -0
  161. package/src/adapters/opencode-model-registry.ts +126 -0
  162. package/src/adapters/opencode-provider.ts +169 -0
  163. package/src/adapters/opencode-server-retry.ts +50 -0
  164. package/src/adapters/opencode-soft-steer.ts +302 -0
  165. package/src/adapters/opencode-spawn.ts +145 -0
  166. package/src/adapters/opencode-subscribe.ts +62 -0
  167. package/src/adapters/opencode-token-usage-capture.ts +187 -0
  168. package/src/adapters/opencode-tool-events.ts +302 -0
  169. package/src/adapters/opencode-tools-config.ts +17 -0
  170. package/src/adapters/opencode.ts +2264 -0
  171. package/src/adapters/project-shell.ts +80 -0
  172. package/src/adapters/provider-launch-config.ts +21 -0
  173. package/src/adapters/provider-quota-harvest.ts +127 -0
  174. package/src/adapters/service-access.ts +153 -0
  175. package/src/adapters/tmux-offload.ts +207 -0
  176. package/src/adapters/tool-summary.ts +214 -0
  177. package/src/agent-redact.ts +75 -0
  178. package/src/agent-runner/commands/dispatch.ts +185 -0
  179. package/src/agent-runner/commands/lifecycle.ts +84 -0
  180. package/src/agent-runner/commands/prompt.ts +284 -0
  181. package/src/agent-runner/credentials.ts +208 -0
  182. package/src/agent-runner/http-liveness.ts +85 -0
  183. package/src/agent-runner/lifecycle-milestones.ts +207 -0
  184. package/src/agent-runner/lifecycle-phase.ts +80 -0
  185. package/src/agent-runner/registration.ts +163 -0
  186. package/src/agent-runner/runner-context.ts +158 -0
  187. package/src/agent-runner/session-mirror.ts +278 -0
  188. package/src/agent-runner/task-claims.ts +116 -0
  189. package/src/agent-runner/token-usage-coverage.ts +54 -0
  190. package/src/agent-runner/turn-report.ts +269 -0
  191. package/src/api-budget-accounting.ts +91 -0
  192. package/src/area-memory.ts +255 -0
  193. package/src/artifact-path-materialize.ts +52 -0
  194. package/src/async-guard.ts +35 -0
  195. package/src/attachment-cache-sweep.ts +31 -0
  196. package/src/attachment-cache.ts +195 -0
  197. package/src/background-script-reconcile.ts +106 -0
  198. package/src/bounded-log.ts +59 -0
  199. package/src/bounded-spawn-sync.ts +18 -0
  200. package/src/busy-reconciler.ts +282 -0
  201. package/src/claim-tracker.ts +140 -0
  202. package/src/claude-settings.ts +167 -0
  203. package/src/claude-workspace-trust.ts +289 -0
  204. package/src/config.ts +547 -0
  205. package/src/context-boundary.ts +101 -0
  206. package/src/context-command.ts +151 -0
  207. package/src/context-probe-state.ts +6 -0
  208. package/src/continuation-archive.ts +179 -0
  209. package/src/control-server.ts +730 -0
  210. package/src/delivery-policy.ts +9 -0
  211. package/src/delivery-result.ts +24 -0
  212. package/src/effort-command.ts +125 -0
  213. package/src/empty-turn.ts +816 -0
  214. package/src/free-port.ts +25 -0
  215. package/src/fs-offload.ts +26 -0
  216. package/src/gate-run-config.ts +35 -0
  217. package/src/gate-run-lease-probe.ts +38 -0
  218. package/src/host-asset-plan.ts +450 -0
  219. package/src/host-claude-config-worker.ts +34 -0
  220. package/src/host-sources.ts +40 -0
  221. package/src/inbox-carrier.ts +7 -0
  222. package/src/index.ts +386 -0
  223. package/src/launch-assembly.ts +955 -0
  224. package/src/liveness.ts +105 -0
  225. package/src/logger.ts +108 -0
  226. package/src/mcp-outbox.ts +204 -0
  227. package/src/mcp-preflight.ts +86 -0
  228. package/src/mcp-source-selection.ts +54 -0
  229. package/src/mcp-tool-deferral.ts +35 -0
  230. package/src/mcp-vault-env.ts +25 -0
  231. package/src/message-body-config/config.ts +16 -0
  232. package/src/message-body-config.ts +1 -0
  233. package/src/mid-turn-delivery.ts +43 -0
  234. package/src/native-memory-lever.ts +329 -0
  235. package/src/native-self-resume.ts +244 -0
  236. package/src/outbox.ts +453 -0
  237. package/src/park-post.ts +17 -0
  238. package/src/pending-permission-store.ts +148 -0
  239. package/src/process-meta.ts +9 -0
  240. package/src/profile-home.ts +419 -0
  241. package/src/profile-projection.ts +411 -0
  242. package/src/project-hooks.ts +65 -0
  243. package/src/project-instructions.ts +119 -0
  244. package/src/provider-double.ts +59 -0
  245. package/src/provider-hold.ts +228 -0
  246. package/src/provider-home-marker.ts +3 -0
  247. package/src/provider-home-tombstone.ts +4 -0
  248. package/src/provider-input-queue.ts +134 -0
  249. package/src/provider-integration.ts +93 -0
  250. package/src/provider-processes.ts +17 -0
  251. package/src/provider-submit-failure.ts +15 -0
  252. package/src/providers.ts +35 -0
  253. package/src/provisioning.ts +703 -0
  254. package/src/question-decision.ts +18 -0
  255. package/src/quota.ts +22 -0
  256. package/src/rate-limit.ts +351 -0
  257. package/src/refused-prompt-store.ts +36 -0
  258. package/src/relay-injection-events.ts +161 -0
  259. package/src/relay-instructions.ts +107 -0
  260. package/src/relay-mcp-proxy.long-turn-e2e.ts +183 -0
  261. package/src/relay-mcp-proxy.ts +704 -0
  262. package/src/relay-mcp.ts +583 -0
  263. package/src/reply-obligation-cache.ts +211 -0
  264. package/src/response-capture-report.ts +111 -0
  265. package/src/response-routing.ts +6 -0
  266. package/src/runner-core.ts +2955 -0
  267. package/src/runner-exit.ts +12 -0
  268. package/src/runner-helpers.ts +582 -0
  269. package/src/runner-insights.ts +105 -0
  270. package/src/runner-mcp-proxy.ts +46 -0
  271. package/src/runner-spawn-config.ts +68 -0
  272. package/src/runner-stale-scratch-sweep.ts +21 -0
  273. package/src/runner.ts +9 -0
  274. package/src/runtime-token-file.ts +45 -0
  275. package/src/runtime-token-remint.ts +56 -0
  276. package/src/service-access.ts +88 -0
  277. package/src/session-destroy.ts +27 -0
  278. package/src/session-insights.ts +118 -0
  279. package/src/session-scratch.ts +296 -0
  280. package/src/spawn-input.ts +147 -0
  281. package/src/startup-config-fetch.ts +48 -0
  282. package/src/subreaper.ts +113 -0
  283. package/src/template-resolver.ts +29 -0
  284. package/src/test-run-dedup.ts +435 -0
  285. package/src/transcript-context.ts +99 -0
  286. package/src/transport-errors.ts +48 -0
  287. package/src/turn-opener.ts +55 -0
  288. package/src/turn-reconcile-event.ts +88 -0
  289. package/src/vault-proxy-hop.ts +99 -0
  290. package/src/version.ts +44 -0
  291. package/src/web-tool-call-proxy.ts +128 -0
  292. package/src/web-tools.ts +59 -0
  293. package/README.md +0 -3
package/LICENSE ADDED
@@ -0,0 +1,167 @@
1
+ # PolyForm Shield License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/shield/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Noncompete
53
+
54
+ Any purpose is a permitted purpose, except for providing any
55
+ product that competes with the software or any product the
56
+ licensor or any of its affiliates provides using the software.
57
+
58
+ ## Competition
59
+
60
+ Goods and services compete even when they provide functionality
61
+ through different kinds of interfaces or for different technical
62
+ platforms. Applications can compete with services, libraries
63
+ with plugins, frameworks with development tools, and so on,
64
+ even if they're written in different programming languages
65
+ or for different computer architectures. Goods and services
66
+ compete even when provided free of charge. If you market a
67
+ product as a practical substitute for the software or another
68
+ product, it definitely competes.
69
+
70
+ ## New Products
71
+
72
+ If you are using the software to provide a product that does
73
+ not compete, but the licensor or any of its affiliates brings
74
+ your product into competition by providing a new version of
75
+ the software or another product using the software, you may
76
+ continue using versions of the software available under these
77
+ terms beforehand to provide your competing product, but not
78
+ any later versions.
79
+
80
+ ## Discontinued Products
81
+
82
+ You may begin using the software to compete with a product
83
+ or service that the licensor or any of its affiliates has
84
+ stopped providing, unless the licensor includes a plain-text
85
+ line beginning with `Licensor Line of Business:` with the
86
+ software that mentions that line of business. For example:
87
+
88
+ > Licensor Line of Business: YoyodyneCMS Content Management
89
+ System (http://example.com/cms)
90
+
91
+ ## Sales of Business
92
+
93
+ If the licensor or any of its affiliates sells a line of
94
+ business developing the software or using the software
95
+ to provide a product, the buyer can also enforce
96
+ [Noncompete](#noncompete) for that product.
97
+
98
+ ## Fair Use
99
+
100
+ You may have "fair use" rights for the software under the
101
+ law. These terms do not limit them.
102
+
103
+ ## No Other Rights
104
+
105
+ These terms do not allow you to sublicense or transfer any of
106
+ your licenses to anyone else, or prevent the licensor from
107
+ granting licenses to anyone else. These terms do not imply
108
+ any other licenses.
109
+
110
+ ## Patent Defense
111
+
112
+ If you make any written claim that the software infringes or
113
+ contributes to infringement of any patent, your patent license
114
+ for the software granted under these terms ends immediately. If
115
+ your company makes such a claim, your patent license ends
116
+ immediately for work on behalf of your company.
117
+
118
+ ## Violations
119
+
120
+ The first time you are notified in writing that you have
121
+ violated any of these terms, or done anything with the software
122
+ not covered by your licenses, your licenses can nonetheless
123
+ continue if you come into full compliance with these terms,
124
+ and take practical steps to correct past violations, within
125
+ 32 days of receiving notice. Otherwise, all your licenses
126
+ end immediately.
127
+
128
+ ## No Liability
129
+
130
+ ***As far as the law allows, the software comes as is, without
131
+ any warranty or condition, and the licensor will not be liable
132
+ to you for any damages arising out of these terms or the use
133
+ or nature of the software, under any kind of legal claim.***
134
+
135
+ ## Definitions
136
+
137
+ The **licensor** is the individual or entity offering these
138
+ terms, and the **software** is the software the licensor makes
139
+ available under these terms.
140
+
141
+ A **product** can be a good or service, or a combination
142
+ of them.
143
+
144
+ **You** refers to the individual or entity agreeing to these
145
+ terms.
146
+
147
+ **Your company** is any legal entity, sole proprietorship,
148
+ or other kind of organization that you work for, plus all
149
+ its affiliates.
150
+
151
+ **Affiliates** means the other organizations than an
152
+ organization has control over, is under the control of, or is
153
+ under common control with.
154
+
155
+ **Control** means ownership of substantially all the assets of
156
+ an entity, or the power to direct its management and policies
157
+ by vote, contract, or otherwise. Control can be direct or
158
+ indirect.
159
+
160
+ **Your licenses** are all the licenses granted to you for the
161
+ software under these terms.
162
+
163
+ **Use** means anything you do with the software requiring one
164
+ of your licenses.
165
+
166
+ Required Notice: Copyright 2026 Exelerus AB
167
+ Licensor Line of Business: provider-independent runtimes and coordination software for teams of AI agents
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ # Humwick #3489: `humwick browser` from the release this agent's runner belongs to, never an older
3
+ # install a login shell puts first on PATH. Checkout: <root>/runner/agent-bin -> <root>/src;
4
+ # npm: node_modules/@humwick/runner/agent-bin -> node_modules/@humwick/server/src.
5
+ here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P) || exit 1
6
+ for cli in "$here/../../src/index.ts" "$here/../../server/src/index.ts"; do
7
+ if [ -f "$cli" ]; then exec "${AGENT_RELAY_BUN_BIN:-bun}" run --no-env-file "$cli" browser "$@"; fi
8
+ done
9
+ echo "agent-relay-browser: no Humwick CLI next to $here" >&2
10
+ exit 127
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ # Humwick #3470: `humwick browser` from the release this agent's runner belongs to, never an older
3
+ # install a login shell puts first on PATH. Checkout: <root>/runner/agent-bin -> <root>/src;
4
+ # npm: node_modules/@humwick/runner/agent-bin -> node_modules/@humwick/server/src.
5
+ here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P) || exit 1
6
+ for cli in "$here/../../src/index.ts" "$here/../../server/src/index.ts"; do
7
+ if [ -f "$cli" ]; then exec "${AGENT_RELAY_BUN_BIN:-bun}" run --no-env-file "$cli" "$@"; fi
8
+ done
9
+ echo "humwick: no CLI next to $here" >&2
10
+ exit 127
@@ -0,0 +1,161 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { accessSync, constants, realpathSync } = require("node:fs");
5
+ const { spawnSync } = require("node:child_process");
6
+ const { isAbsolute, relative, resolve } = require("node:path");
7
+
8
+ // Intentionally conservative: uncertain shell syntax, option parsing, paths, or
9
+ // repository detection always leaves Bash alone.
10
+ function wordsOf(command) {
11
+ if (command.length > 8192 || /[\n`$]/.test(command)) return null;
12
+ const words = [];
13
+ let word = "";
14
+ let quote = "";
15
+ let active = false;
16
+ for (let i = 0; i < command.length; i += 1) {
17
+ const ch = command[i];
18
+ if (!quote && /[|;&<>(){}]/.test(ch)) return null;
19
+ if (ch === "\\") {
20
+ if (++i >= command.length) return null;
21
+ word += command[i];
22
+ active = true;
23
+ } else if (quote) {
24
+ if (ch === quote) quote = "";
25
+ else word += ch;
26
+ } else if (ch === "'" || ch === '"') {
27
+ quote = ch;
28
+ active = true;
29
+ } else if (/\s/.test(ch)) {
30
+ if (active) words.push(word);
31
+ word = "";
32
+ active = false;
33
+ } else {
34
+ word += ch;
35
+ active = true;
36
+ }
37
+ }
38
+ if (quote) return null;
39
+ if (active) words.push(word);
40
+ return words.length && words.length <= 100 ? words : null;
41
+ }
42
+
43
+ function repoPath(target, cwd, root) {
44
+ if (!target || /[?*\[\]{}]/.test(target) || target === "-") return false;
45
+ try {
46
+ const realRoot = realpathSync(root);
47
+ const realTarget = realpathSync(isAbsolute(target) ? target : resolve(cwd, target));
48
+ const rel = relative(realRoot, realTarget);
49
+ return rel === "" || (!rel.startsWith("..") && !isAbsolute(rel));
50
+ } catch {
51
+ return false;
52
+ }
53
+ }
54
+
55
+ function candidateWords(command) {
56
+ const words = wordsOf(command);
57
+ return words && ["grep", "rg", "find"].includes(words[0]) ? words : null;
58
+ }
59
+
60
+ function classifyStandaloneSearch(command, cwd, root, words = candidateWords(command)) {
61
+ if (!words) return null;
62
+ const [program, ...args] = words;
63
+ if (program === "find") {
64
+ const expressionAt = args.findIndex((arg) => arg.startsWith("-") || arg === "!" || arg === "(");
65
+ const paths = expressionAt < 0 ? args : args.slice(0, expressionAt);
66
+ const expression = expressionAt < 0 ? [] : args.slice(expressionAt);
67
+ if (!paths.length || !expression.some((arg) => ["-name", "-iname", "-path", "-ipath"].includes(arg))) return null;
68
+ if (expression.some((arg) => ["-exec", "-execdir", "-delete", "-ok", "-okdir", "-fprint", "-fprintf"].includes(arg))) return null;
69
+ return paths.every((path) => repoPath(path, cwd, root)) ? "mcp__fff__find_files" : null;
70
+ }
71
+ let recursive = program === "rg";
72
+ let files = false;
73
+ let patterns = 0;
74
+ const positionals = [];
75
+ const values = new Set(program === "grep" ? ["-e", "--regexp", "-A", "-B", "-C", "--include", "--exclude", "--exclude-dir"] : ["-e", "--regexp", "-g", "--glob", "-t", "--type", "-A", "-B", "-C"]);
76
+ const flags = program === "grep" ? /^[rRinHhIlLqsvwxoEcF]+$/ : /^[niHlLqsvwocF]+$/;
77
+ for (let i = 0; i < args.length; i += 1) {
78
+ const arg = args[i];
79
+ if (arg === "--") { positionals.push(...args.slice(i + 1)); break; }
80
+ if (values.has(arg)) {
81
+ if (++i >= args.length) return null;
82
+ if (arg === "-e" || arg === "--regexp") patterns += 1;
83
+ continue;
84
+ }
85
+ if (arg === "--files" && program === "rg") { files = true; continue; }
86
+ if (arg.startsWith("--")) {
87
+ if (/^--(line-number|ignore-case|files-with-matches|no-heading|hidden|fixed-strings|recursive)$/.test(arg)) {
88
+ if (arg === "--recursive") recursive = true;
89
+ continue;
90
+ }
91
+ if (/^--(glob|type|regexp|include|exclude)=/.test(arg)) {
92
+ if (arg.startsWith("--regexp=")) patterns += 1;
93
+ continue;
94
+ }
95
+ return null;
96
+ }
97
+ if (arg.startsWith("-") && arg !== "-") {
98
+ if (!flags.test(arg.slice(1))) return null;
99
+ if (program === "grep" && /[rR]/.test(arg)) recursive = true;
100
+ continue;
101
+ }
102
+ positionals.push(arg);
103
+ }
104
+ if (!recursive) return null;
105
+ if (files) return (positionals.length ? positionals : ["."]).every((path) => repoPath(path, cwd, root)) ? "mcp__fff__find_files" : null;
106
+ if (!patterns && !positionals.length) return null;
107
+ const paths = patterns ? positionals : positionals.slice(1);
108
+ if (program === "grep" && !paths.length) return null;
109
+ if (!paths.every((path) => repoPath(path, cwd, root))) return null;
110
+ return patterns > 1 ? "mcp__fff__multi_grep" : "mcp__fff__grep";
111
+ }
112
+
113
+ function fffBinary(env) { return env.AGENT_RELAY_FFF_MCP_BINARY; }
114
+
115
+ function decide(payload, env = process.env, runGit = spawnSync) {
116
+ try {
117
+ if (payload?.tool_name !== "Bash" || typeof payload?.tool_input?.command !== "string") return null;
118
+ const command = payload.tool_input.command;
119
+ const words = candidateWords(command);
120
+ if (!words) return null;
121
+ const binary = fffBinary(env);
122
+ if (!binary || !isAbsolute(binary)) return null;
123
+ try { accessSync(binary, constants.X_OK); } catch { return null; }
124
+ const cwd = payload.cwd;
125
+ if (typeof cwd !== "string") return null;
126
+ const git = runGit("git", ["rev-parse", "--show-toplevel"], { cwd, encoding: "utf8", timeout: 300, stdio: ["ignore", "pipe", "ignore"] });
127
+ if (git.status !== 0 || !git.stdout?.trim()) return null;
128
+ const tool = classifyStandaloneSearch(command, cwd, git.stdout.trim(), words);
129
+ if (!tool) return null;
130
+ return {
131
+ hookSpecificOutput: {
132
+ hookEventName: "PreToolUse",
133
+ permissionDecision: "deny",
134
+ permissionDecisionReason: `Use ${tool} for this repository search (load with ToolSearch select:mcp__fff__find_files,mcp__fff__grep,mcp__fff__multi_grep).`,
135
+ },
136
+ };
137
+ } catch {
138
+ return null;
139
+ }
140
+ }
141
+
142
+ if (require.main === module) {
143
+ // Finish before Claude's five-second hook deadline even if stdin stalls.
144
+ setTimeout(() => process.exit(0), 4500).unref();
145
+ let input = "";
146
+ process.stdin.setEncoding("utf8");
147
+ process.stdin.on("data", (chunk) => {
148
+ input += chunk;
149
+ if (input.length > 131072) process.exit(0);
150
+ });
151
+ process.stdin.on("end", () => {
152
+ try {
153
+ const decision = decide(JSON.parse(input));
154
+ if (decision) process.stdout.write(JSON.stringify(decision) + "\n");
155
+ } catch {
156
+ // Never trap Bash on a malformed provider payload or hook failure.
157
+ }
158
+ });
159
+ }
160
+
161
+ module.exports = { classifyStandaloneSearch, decide };
@@ -0,0 +1,13 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [{
4
+ "matcher": "Bash",
5
+ "hooks": [{
6
+ "type": "command",
7
+ "command": "node \"${HOOK_DIR}/fff-search-redirect.cjs\"",
8
+ "timeout": 5,
9
+ "suppressOutput": true
10
+ }]
11
+ }]
12
+ }
13
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Bash",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "node \"${HOOK_DIR}/rg-r-guard.cjs\"",
10
+ "timeout": 5,
11
+ "statusMessage": "Checking ripgrep replace guard",
12
+ "suppressOutput": true
13
+ }
14
+ ]
15
+ }
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ let input = "";
5
+ process.stdin.setEncoding("utf8");
6
+ process.stdin.on("data", (chunk) => {
7
+ input += chunk;
8
+ });
9
+ process.stdin.on("end", () => {
10
+ let payload;
11
+ try {
12
+ payload = JSON.parse(input || "{}");
13
+ } catch {
14
+ return;
15
+ }
16
+
17
+ const toolName = String(payload.tool_name || payload.toolName || "").toLowerCase();
18
+ const command = String(payload.tool_input?.command || payload.toolInput?.command || "");
19
+ if (toolName !== "bash" || !command || !containsRipgrepReplaceFootgun(command)) return;
20
+
21
+ const reason = "Blocked: `rg -r` is ripgrep replace, not recursive search. Use `rg PATTERN PATH` for search, or `rg --replace REPLACEMENT PATTERN` only when replacement output is intentional.";
22
+ process.stdout.write(JSON.stringify({
23
+ hookSpecificOutput: {
24
+ hookEventName: "PreToolUse",
25
+ permissionDecision: "deny",
26
+ permissionDecisionReason: reason,
27
+ },
28
+ }));
29
+ process.stdout.write("\n");
30
+ });
31
+
32
+ function containsRipgrepReplaceFootgun(command) {
33
+ for (const segment of splitShellSegments(command)) {
34
+ const words = shellWords(segment);
35
+ for (let i = 0; i < words.length; i += 1) {
36
+ const word = basename(words[i] || "");
37
+ if (word !== "rg" && word !== "ripgrep") continue;
38
+ if (ripgrepArgsUseReplace(words.slice(i + 1))) return true;
39
+ }
40
+ }
41
+ return false;
42
+ }
43
+
44
+ function ripgrepArgsUseReplace(args) {
45
+ for (let i = 0; i < args.length; i += 1) {
46
+ const arg = args[i] || "";
47
+ if (arg === "--") return false;
48
+ if (arg === "--replace" || arg.startsWith("--replace=")) return true;
49
+ if (arg === "-r") return true;
50
+ if (/^-([A-Za-z]*r[A-Za-z]*|[A-Za-z]*r=.+)$/.test(arg)) return true;
51
+ }
52
+ return false;
53
+ }
54
+
55
+ function splitShellSegments(text) {
56
+ const segments = [];
57
+ let current = "";
58
+ let quote = "";
59
+ let escaped = false;
60
+ for (let i = 0; i < text.length; i += 1) {
61
+ const ch = text[i];
62
+ if (escaped) {
63
+ current += ch;
64
+ escaped = false;
65
+ continue;
66
+ }
67
+ if (ch === "\\") {
68
+ current += ch;
69
+ escaped = true;
70
+ continue;
71
+ }
72
+ if (quote) {
73
+ current += ch;
74
+ if (ch === quote) quote = "";
75
+ continue;
76
+ }
77
+ if (ch === "'" || ch === "\"") {
78
+ quote = ch;
79
+ current += ch;
80
+ continue;
81
+ }
82
+ // Command-substitution + grouping boundaries (`$(rg -r …)`, backtick `` `rg -r …` ``,
83
+ // subshells) split into their own segments so the inner command is scanned on its own
84
+ // (basename of `$(rg` ≠ rg otherwise) and its args never bleed into the outer command's
85
+ // scan. Only fires OUTSIDE quotes — a single/double-quoted literal is left intact, matching
86
+ // the tokenizer's existing quote handling. Known gap: substitution inside double quotes
87
+ // ("$(rg -r x)") is still treated as an opaque quoted word.
88
+ if (ch === "(" || ch === ")" || ch === "`") {
89
+ if (current.trim()) segments.push(current);
90
+ current = "";
91
+ continue;
92
+ }
93
+ if (ch === ";" || ch === "|" || ch === "&" || ch === "\n") {
94
+ if (current.trim()) segments.push(current);
95
+ current = "";
96
+ continue;
97
+ }
98
+ current += ch;
99
+ }
100
+ if (current.trim()) segments.push(current);
101
+ return segments;
102
+ }
103
+
104
+ function shellWords(text) {
105
+ const words = [];
106
+ let current = "";
107
+ let quote = "";
108
+ let escaped = false;
109
+ for (let i = 0; i < text.length; i += 1) {
110
+ const ch = text[i];
111
+ if (escaped) {
112
+ current += ch;
113
+ escaped = false;
114
+ continue;
115
+ }
116
+ if (ch === "\\") {
117
+ escaped = true;
118
+ continue;
119
+ }
120
+ if (quote) {
121
+ if (ch === quote) quote = "";
122
+ else current += ch;
123
+ continue;
124
+ }
125
+ if (ch === "'" || ch === "\"") {
126
+ quote = ch;
127
+ continue;
128
+ }
129
+ if (/\s/.test(ch)) {
130
+ if (current) {
131
+ words.push(current);
132
+ current = "";
133
+ }
134
+ continue;
135
+ }
136
+ current += ch;
137
+ }
138
+ if (current) words.push(current);
139
+ return words;
140
+ }
141
+
142
+ function basename(value) {
143
+ return value.split("/").pop() || value;
144
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [{
4
+ "matcher": "WebSearch|WebFetch",
5
+ "hooks": [{
6
+ "type": "command",
7
+ "command": "node \"${HOOK_DIR}/web-tools-redirect.cjs\"",
8
+ "timeout": 5,
9
+ "suppressOutput": true
10
+ }]
11
+ }]
12
+ }
13
+ }
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { createHash } = require("node:crypto");
5
+ const { readFileSync, writeFileSync } = require("node:fs");
6
+ const { tmpdir } = require("node:os");
7
+ const { join } = require("node:path");
8
+
9
+ // Answers built-in WebSearch/WebFetch with a redirect to Relay search/the local-first page reader.
10
+ // Only provisioned tools are redirected. Page reads may retry natively; search stays on Relay.
11
+ const REDIRECTS = {
12
+ WebSearch: {
13
+ tool: "brave",
14
+ use: "Relay web_search on the agent-relay MCP server (Tavily first, budget-capped Brave fallback)",
15
+ load: ["web_search"],
16
+ },
17
+ WebFetch: {
18
+ tool: "jina",
19
+ use: "the self-hosted page reader mcp__callmux__fetch__fetch first (max_length and start_index for chunks). Only if it fails or returns unusable JS-heavy content, use keyless Jina mcp__callmux__jina__read_url with url only (no question or API key)",
20
+ load: ["mcp__callmux__fetch__fetch", "mcp__callmux__jina__read_url"],
21
+ },
22
+ };
23
+ const MAX_REMEMBERED = 100;
24
+
25
+ function enabledTools(env) {
26
+ return new Set(String(env.AGENT_RELAY_WEB_TOOLS || "").split(",").map((part) => part.trim()).filter(Boolean));
27
+ }
28
+
29
+ function stateFile(env, sessionId) {
30
+ const safe = typeof sessionId !== "string" ? "" : sessionId.replace(/[^A-Za-z0-9_-]/g, "").slice(0, 80);
31
+ return safe ? join(env.AGENT_RELAY_SCRATCH_DIR || tmpdir(), `web-tools-redirect-${safe}.json`) : null;
32
+ }
33
+
34
+ function decide(payload, env = process.env) {
35
+ try {
36
+ const redirect = REDIRECTS[payload?.tool_name];
37
+ if (!redirect || !enabledTools(env).has(redirect.tool)) return null;
38
+ if (payload.tool_name === "WebSearch") return {
39
+ hookSpecificOutput: {
40
+ hookEventName: "PreToolUse", permissionDecision: "deny",
41
+ permissionDecisionReason: `Use ${redirect.use} instead (discover with ToolSearch web_search). Report a Relay search error if unavailable.`,
42
+ },
43
+ };
44
+ const file = stateFile(env, payload.session_id);
45
+ if (!file) return null;
46
+ const key = createHash("sha256").update(`${payload.tool_name}\0${JSON.stringify(payload.tool_input ?? null)}`).digest("hex").slice(0, 32);
47
+ let seen = [];
48
+ try { seen = JSON.parse(readFileSync(file, "utf8")); } catch {}
49
+ if (!Array.isArray(seen)) seen = [];
50
+ if (seen.includes(key)) return null;
51
+ // Unrecorded means the retry could never pass: allow rather than trap the agent.
52
+ writeFileSync(file, JSON.stringify([...seen, key].slice(-MAX_REMEMBERED)), { mode: 0o600 });
53
+ return {
54
+ hookSpecificOutput: {
55
+ hookEventName: "PreToolUse",
56
+ permissionDecision: "deny",
57
+ permissionDecisionReason: `Use ${redirect.use} instead (load with ToolSearch select:${redirect.load.join(",")}). If it fails or is unavailable, repeat this exact ${payload.tool_name} call and it will run.`,
58
+ },
59
+ };
60
+ } catch {
61
+ return null;
62
+ }
63
+ }
64
+
65
+ if (require.main === module) {
66
+ // Finish before Claude's five-second hook deadline even if stdin stalls.
67
+ setTimeout(() => process.exit(0), 4500).unref();
68
+ let input = "";
69
+ process.stdin.setEncoding("utf8");
70
+ process.stdin.on("data", (chunk) => {
71
+ input += chunk;
72
+ if (input.length > 131072) process.exit(0);
73
+ });
74
+ process.stdin.on("end", () => {
75
+ try {
76
+ const decision = decide(JSON.parse(input));
77
+ if (decision) process.stdout.write(JSON.stringify(decision) + "\n");
78
+ } catch {
79
+ // Never trap a web call on a malformed provider payload or hook failure.
80
+ }
81
+ });
82
+ }
83
+
84
+ module.exports = { decide, REDIRECTS };