@hasna/hooks 0.13.0 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -733,7 +733,7 @@ Local mode is answered BEFORE the resolver runs (so an unhosted run touches neit
733
733
 
734
734
  **Hosted is a route, not just admission (owner ruling 2026-09-07).** Once a registry credential resolves — the env pair, the Keychain item, or the credentials file — the on-box SQLite store is refused for the whole process: `hooks log *`, `hooks storage *`, the MCP `hooks_log_*` / `storage_*` / `send_feedback` tools and the hook-event writer answer `REMOTE_COMMAND_UNSUPPORTED` (naming the opt-in) instead of reading or creating `~/.hasna/hooks/hooks.db`. Pins and trust keep working on the hosted route through `hooks.lock` alone; the SQLite `hooks` table is a local-mode mirror.
735
735
 
736
- **`hooks run` decides its route like every other client verb.** Under the explicit opt-in it executes the hook and records the event in the on-box store (the child hook sees `HOOKS_LOCAL`); on the hosted route it executes the hook but refuses the event write loudly (one stderr line — the hosted registry has no event route); with nothing configured it prints a `REMOTE_API_CONFIG_MISSING` error naming the credential tiers and the opt-in, creates nothing, and exits non-zero. For a bundled hook whose only event is PreToolUse (including a credential that is present but refused) it exits 2 and adds a "Blocked:" line, so the agent refuses the tool call instead of running it; every other hook exits 1, which agents treat as a non-blocking error. The same exit 2 applies whenever `hooks run` cannot run such a guard and so decides nothing: a missing script, an unreadable script or trust record (such as a malformed `hooks.lock`), a script changed since it was trusted, invalid run options (including an unknown option or a missing option value), an invalid native target, or a failure to start such as a read-only install refusing the temporary copy. The `hook-` alias of a guard's name counts as the guard; a custom hook installed under a guard's name takes precedence and keeps exit 1. Bundled hooks have no `hooks run` timeout, so a hung guard is bounded by the agent's own hook timeout. Before 0.12.21 an unconfigured PreToolUse guard also exited 1, and the guarded command ran. Agents that wire `hooks run <name>` into their settings on an unconfigured machine therefore need either a registry credential or `HASNA_HOOKS_LOCAL=1` in the hook's environment.
736
+ **`hooks run` decides its route like every other client verb.** Under the explicit opt-in it executes the hook and records the event in the on-box store (the child hook sees `HOOKS_LOCAL`); on the hosted route it executes the hook but refuses the event write loudly (one stderr line — the hosted registry has no event route). `hooks run` uses no registry credential, so when the Keychain item `hasna.credentials.hooks.api-key` (or `.api-url`) exists but this session may not read it (`security` exit 36: a locked login keychain, or a session without access to it, such as one started over SSH), it still takes the hosted route and runs the hook pinned in `hooks.lock`. It does not read the disk file or the environment in the Keychain's place, and it does not open `hooks.db`; every other command, and every other Keychain failure, still fails closed. With nothing configured it prints a `REMOTE_API_CONFIG_MISSING` error naming the credential tiers and the opt-in, creates nothing, and exits non-zero. For a bundled hook whose only event is PreToolUse (including a credential that is present but refused, other than the exit-36 Keychain case above) it exits 2 and adds a "Blocked:" line, so the agent refuses the tool call instead of running it; every other hook exits 1, which agents treat as a non-blocking error. The same exit 2 applies whenever `hooks run` cannot run such a guard and so decides nothing: a missing script, an unreadable script or trust record (such as a malformed `hooks.lock`), a script changed since it was trusted, invalid run options (including an unknown option or a missing option value), an invalid native target, or a failure to start such as a read-only install refusing the temporary copy. The `hook-` alias of a guard's name counts as the guard; a custom hook installed under a guard's name takes precedence and keeps exit 1. Bundled hooks have no `hooks run` timeout, so a hung guard is bounded by the agent's own hook timeout. Before 0.12.21 an unconfigured PreToolUse guard also exited 1, and the guarded command ran. Agents that wire `hooks run <name>` into their settings on an unconfigured machine therefore need either a registry credential or `HASNA_HOOKS_LOCAL=1` in the hook's environment.
737
737
 
738
738
  Surfaces that never open the client store and are server/operator-only by design need neither setting: `serve` (`hooks-serve`), `cf`, `migrate`, `init`, `profile-export`/`profile-import`, `channels`, `events`, and `--help`/`--version`. `hooks mcp` and the `hooks-mcp` bin decide their authority themselves before any transport connects (below).
739
739
 
@@ -492,10 +492,10 @@ async function main(argv = process.argv.slice(2), env = process.env, io = proces
492
492
  if (import.meta.main)
493
493
  await main();
494
494
  export {
495
- main,
496
- readHookInput,
497
- resolveScratchpadScript,
498
- rootStation,
495
+ withBudget,
499
496
  scratchpadRunner,
500
- withBudget
497
+ rootStation,
498
+ resolveScratchpadScript,
499
+ readHookInput,
500
+ main
501
501
  };
@@ -1276,6 +1276,6 @@ async function main(argv = process.argv.slice(2), env = process.env) {
1276
1276
  if (import.meta.main)
1277
1277
  await main();
1278
1278
  export {
1279
- main,
1280
- readHookInput
1279
+ readHookInput,
1280
+ main
1281
1281
  };