@hasna/hooks 0.12.22 → 0.13.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.
@@ -13,7 +13,7 @@ export declare class ClaudeSettingsRefusal extends Error {
13
13
  * as any file type. A lookup error other than ENOENT/ENOTDIR counts as present.
14
14
  * Returns the evidence found; an empty list means Skills is genuinely absent. */
15
15
  export declare function claudeSkillsUsage(before: string | null, home: string): string[];
16
- /** Every location the bundled Skills package (@hasna/skills 0.10.73, `getDataRoot`)
16
+ /** Every location the bundled Skills package (@hasna/skills 0.10.78, `getDataRoot`)
17
17
  * considers for `agent-policy.json`, in its resolution order, with the outcome
18
18
  * at each. Only called after Skills found no policy at the selected location. */
19
19
  export declare function skillsPolicyLocations(dataDir?: string): string[];
@@ -13,11 +13,21 @@ import { type HookEvent, type HookMeta } from "./registry.js";
13
13
  import { type StaleRegistration } from "./registration.js";
14
14
  import { type NativeSafetyName } from "./native-safety.js";
15
15
  import { type MementosRegistration } from "./mementos-options.js";
16
+ import { type TargetName } from "./targets.js";
17
+ import { type AdapterOptions, type AdapterRunner } from "./target-adapters.js";
16
18
  export type Scope = "global" | "project";
17
- export type Target = "claude" | "gemini" | "codewith" | "codex" | "all";
18
- type SingleTarget = Exclude<Target, "all">;
19
- export type ConcreteTarget = SingleTarget;
19
+ /**
20
+ * Every target name the CLI accepts, plus the `all` group. The names come from
21
+ * the capability model (targets.ts); `all` is not a target and keeps its
22
+ * long-standing meaning (Claude + managed Codewith fragments on install,
23
+ * Claude/Gemini/Codex on removal).
24
+ */
25
+ export type Target = TargetName | "all";
26
+ type SingleTarget = TargetName;
27
+ export type ConcreteTarget = TargetName;
20
28
  export type CodewithInstallMode = "fragment" | "write";
29
+ /** Adapter options for one scope; the test seam for the harness commands. */
30
+ export declare function adapterOptions(scope: Scope, home?: string, run?: AdapterOptions["run"]): AdapterOptions;
21
31
  export interface InstallResult {
22
32
  hook: string;
23
33
  success: boolean;
@@ -56,6 +66,12 @@ export interface InstallOptions {
56
66
  */
57
67
  beforeWrite?: () => void;
58
68
  }
69
+ /**
70
+ * The config file (or, for Muse, the plugin directory) `hooks install` writes
71
+ * for a scope + target. The path itself is the capability model's decision, so
72
+ * a harness's own layout is stated once (targets.ts) and every caller — doctor,
73
+ * install receipts and the adapters — resolves the same file.
74
+ */
59
75
  export declare function getSettingsPath(scope?: Scope, target?: SingleTarget, codewithConfigPath?: string): string;
60
76
  export declare function getHookPath(name: string): string;
61
77
  export declare function hookExists(name: string): boolean;
@@ -112,7 +128,11 @@ export declare function getRegisteredHooksForTarget(scope?: Scope, target?: Sing
112
128
  export declare function getRegisteredHooks(scope?: Scope): string[];
113
129
  /** @deprecated Use getRegisteredHooks instead */
114
130
  export declare const getInstalledHooks: typeof getRegisteredHooks;
115
- export declare function removeHook(name: string, scope?: Scope, target?: Target): boolean;
131
+ export declare function removeHook(name: string, scope?: Scope, target?: Target,
132
+ /** Test seam: the harness runner every adapter command goes through. */
133
+ options?: {
134
+ run?: AdapterRunner;
135
+ }): boolean;
116
136
  /**
117
137
  * Every settings registration for the scope whose hook name does not resolve.
118
138
  *
@@ -149,8 +169,23 @@ export interface UninstallResult {
149
169
  dbRecordRemoved: boolean;
150
170
  /** Targets whose config still registers the hook after removal (e.g. codewith TOML the caller must edit itself). */
151
171
  registrationsRemaining: string[];
172
+ /**
173
+ * Harnesses a `--target all` sweep skipped, and why. A harness that is not
174
+ * installed carries no registration, so skipping it is not a failure — but
175
+ * the skip is named rather than silent, because "removed" otherwise reads as
176
+ * "removed everywhere".
177
+ */
178
+ notes?: string[];
152
179
  error?: string;
153
180
  }
181
+ /**
182
+ * What the human `hooks remove` line says for a failed removal.
183
+ *
184
+ * It must agree with the JSON `removed` value: a removal refused by an
185
+ * unreadable harness config or by an adapter is not "not found", and printing
186
+ * that hides the exact cause the user has to repair.
187
+ */
188
+ export declare function removeFailureMessage(result: Pick<UninstallResult, "name" | "error">, hook: string, suggestions?: readonly string[]): string;
154
189
  /**
155
190
  * Lossless removal of a `hooks run <name>` entry from a Codewith config.toml.
156
191
  *
@@ -166,5 +201,9 @@ export declare function removeCodewithHookEntry(configText: string, name: string
166
201
  text: string;
167
202
  removed: boolean;
168
203
  };
169
- export declare function uninstallHook(name: string, scope?: Scope, target?: Target): UninstallResult;
204
+ export declare function uninstallHook(name: string, scope?: Scope, target?: Target,
205
+ /** Test seam: the harness runner every adapter command goes through. */
206
+ options?: {
207
+ run?: AdapterRunner;
208
+ }): UninstallResult;
170
209
  export {};
@@ -19,6 +19,23 @@ export declare const manifestSchema: z.ZodObject<{
19
19
  args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
20
20
  /** Request trusted native target dispatch as --harness, never from stdin. */
21
21
  nativeTargetDispatch: z.ZodOptional<z.ZodBoolean>;
22
+ /**
23
+ * The hook reads the assistant's final message out of its stdin payload.
24
+ *
25
+ * Install refuses a target whose payload cannot carry it (the capability
26
+ * model in targets.ts) instead of wiring a hook that would run on every turn
27
+ * and do nothing — a silent install is the failure this field prevents.
28
+ */
29
+ requires_final_message: z.ZodOptional<z.ZodBoolean>;
30
+ /**
31
+ * The hook's verdict must hold the turn open (a `block` that the harness
32
+ * honours as a continuation).
33
+ *
34
+ * Install refuses a target whose verdict cannot hold the turn (the
35
+ * capability model in targets.ts) instead of wiring a hook whose block is
36
+ * silently ignored — the same failure `requires_final_message` prevents.
37
+ */
38
+ requires_block: z.ZodOptional<z.ZodBoolean>;
22
39
  timeout_ms: z.ZodOptional<z.ZodNumber>;
23
40
  /**
24
41
  * Per-hook environment passed to the hook child (reviewer efcad315).
@@ -39,6 +56,8 @@ export declare const manifestSchema: z.ZodObject<{
39
56
  script_kind?: "inline" | "file" | undefined;
40
57
  args?: string[] | undefined;
41
58
  nativeTargetDispatch?: boolean | undefined;
59
+ requires_final_message?: boolean | undefined;
60
+ requires_block?: boolean | undefined;
42
61
  timeout_ms?: number | undefined;
43
62
  }, {
44
63
  version: string;
@@ -50,6 +69,8 @@ export declare const manifestSchema: z.ZodObject<{
50
69
  script_kind?: "inline" | "file" | undefined;
51
70
  args?: string[] | undefined;
52
71
  nativeTargetDispatch?: boolean | undefined;
72
+ requires_final_message?: boolean | undefined;
73
+ requires_block?: boolean | undefined;
53
74
  timeout_ms?: number | undefined;
54
75
  }>;
55
76
  export type HookManifest = z.infer<typeof manifestSchema>;
@@ -9,7 +9,28 @@ export interface NativeSafetyBinding {
9
9
  path: string;
10
10
  }
11
11
  export declare function isNativeSafetyName(name: string): name is NativeSafetyName;
12
+ /**
13
+ * The runtime digest cache key (HO-00038), as source embedded in the supervisor.
14
+ * It maps a bigint `fstat` of the pinned runtime to
15
+ * `dev:ino:size:mtimeNs:ctimeNs:birthtimeNs`, or to null when any component is
16
+ * missing, not a bigint, or zero where zero means "not reported" (every
17
+ * component but `dev`). A null key never reads or writes the cache, so the
18
+ * runtime is hashed in full. Exported only so tests can evaluate the same text.
19
+ */
20
+ export declare const NATIVE_SAFETY_RUNTIME_KEY_SOURCE: string;
21
+ /** The supervisor's reserved exit status for an expired internal deadline; the shell reports it as guard_timeout. */
22
+ export declare const NATIVE_SAFETY_TIMEOUT_STATUS = 93;
23
+ /** The fixed message for a verification that ran out of time. It is not a policy decision. */
24
+ export declare const NATIVE_SAFETY_TIMEOUT_MESSAGE = "Native safety guard refused (guard_timeout): verification did not finish within its time budget, so the command did not run. This is a timeout, not a policy decision; one retry is safe. If it repeats, report it and do not bypass the guard.";
25
+ /** The fixed message for every other failure, an integrity mismatch included (unchanged since v1). */
26
+ export declare const NATIVE_SAFETY_FAILURE_MESSAGE = "Native safety guard refused: verification or execution failed.";
27
+ /** Where the supervisor keeps runtime digests, relative to the binding's home. */
28
+ export declare const NATIVE_SAFETY_DIGEST_DIR = ".hasna/hooks/native/runtime-digests";
12
29
  export declare function buildNativeSafetyCommand(binding: NativeSafetyBinding): string;
30
+ /** Build `binding` on the previous template, the one the Sumi guard record keeps (see above). */
31
+ export declare function buildPreviousNativeSafetyCommand(binding: NativeSafetyBinding): string;
32
+ /** Whether `command` is an exact managed registration built with the previous (pre-HO-00038) template. */
33
+ export declare function isPreviousNativeSafetyCommand(command: string): boolean;
13
34
  export declare function nativeSafetyRegistration(command: string): NativeSafetyName | undefined;
14
35
  export declare function nativeSafetyCommandBinding(command: string): NativeSafetyBinding | undefined;
15
36
  export declare function pinEligibleFile(file: string, maximum: number, executable?: boolean): string;
@@ -19,3 +40,6 @@ export declare function pinEligibleFile(file: string, maximum: number, executabl
19
40
  export declare function nativeSafetyBindingVerified(command: string): boolean | undefined;
20
41
  /** Built-in capability only: no registry, custom source, profile or app store. */
21
42
  export declare function installedNativeSafetyCommand(name: NativeSafetyName): string;
43
+ /** The command for the Sumi guard record: the same installed binding, on the
44
+ * previous template, because every released Sumi parses only that template. */
45
+ export declare function installedSumiNativeSafetyCommand(): string;
@@ -1,6 +1,15 @@
1
+ /**
2
+ * The trusted target names a native registration may pass as `--target`.
3
+ *
4
+ * This list is the capability model's own target list (targets.ts): a harness
5
+ * gains a name here exactly when `hooks run` has a payload shape for it, so the
6
+ * settings scanner, the installer and the runner can never disagree about what
7
+ * a valid registration looks like.
8
+ */
9
+ import { type TargetName } from "./targets.js";
1
10
  /** Trusted invocation metadata, supplied by a native registration or plugin, never hook stdin. */
2
- export declare const HOOK_RUN_TARGETS: readonly ["claude", "codex", "gemini", "codewith", "sumi", "opencode"];
3
- export type HookRunTarget = typeof HOOK_RUN_TARGETS[number];
11
+ export declare const HOOK_RUN_TARGETS: readonly ["claude", "codex", "gemini", "codewith", "qwen", "muse", "kimi", "pi", "cursor", "opencode", "sumi"];
12
+ export type HookRunTarget = TargetName;
4
13
  export declare function isHookRunTarget(value: unknown): value is HookRunTarget;
5
14
  /** Existing hooks keep their arguments verbatim. Opted-in hooks require explicit native dispatch. */
6
15
  export declare function nativeTargetArgs(dispatch: boolean | undefined, target: unknown, args?: readonly string[]): string[];
@@ -8,6 +8,18 @@ export interface HookMeta {
8
8
  bundledEntry?: string;
9
9
  /** Requires the owning runner to pass the installer-selected native target. */
10
10
  nativeTargetDispatch?: boolean;
11
+ /**
12
+ * The hook reads the assistant's final message from its stdin payload.
13
+ * Install refuses a target that does not deliver one (`deliversFinalMessage`
14
+ * in the capability model) rather than wiring a hook that can never fire.
15
+ */
16
+ requiresFinalMessage?: boolean;
17
+ /**
18
+ * The hook's verdict must hold the turn open. Install refuses a target whose
19
+ * verdict cannot hold it (`canBlock` in the capability model) rather than
20
+ * wiring a hook whose block is silently ignored.
21
+ */
22
+ requiresBlock?: boolean;
11
23
  name: string;
12
24
  displayName: string;
13
25
  description: string;
@@ -10,6 +10,9 @@ export interface SumiStopReviewEnvelope {
10
10
  id: string;
11
11
  objective: string;
12
12
  status: "active" | "complete" | "paused" | "cancelled" | "blocked" | "budget_limited" | "usage_limited" | "unknown";
13
+ statusSource?: "agent";
14
+ pauseReason?: "agent";
15
+ activationEpoch?: number;
13
16
  } | null;
14
17
  goalAvailability?: "known" | "unavailable";
15
18
  runtime: {
@@ -23,6 +26,7 @@ export interface SumiStopReviewEnvelope {
23
26
  nativeContinuationAllowed: boolean;
24
27
  stopHookActive: boolean;
25
28
  continuationCount: number;
29
+ agentPauseAdmission?: "parent_final_cas";
26
30
  };
27
31
  }
28
32
  export type SumiStopClassification = "complete" | "actionable_remaining" | "blocked_permission" | "blocked_external" | "blocked_environment" | "needs_user_input" | "uncertain";
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Install adapters for harnesses whose config is not a JSON settings file.
3
+ *
4
+ * Claude, Codex, Gemini, Qwen and Codewith are settings targets: installer.ts
5
+ * writes `hooks[event][]` into a JSON/TOML settings file it owns the shape of.
6
+ * Muse, Kimi, Pi and Cursor are not: each has its own config format and its own
7
+ * idea of what a registered hook is. This module is the only writer for those
8
+ * four, so the format knowledge lives in one place and every entry still reads
9
+ * `hooks run <name> --target <harness>` — the command the capability model
10
+ * promises.
11
+ *
12
+ * Every writer here is additive and idempotent: an existing entry for the same
13
+ * hook is reported as already installed rather than duplicated, and nothing
14
+ * outside the entries Hooks owns is rewritten.
15
+ *
16
+ * Removal is honest per harness: Cursor and Kimi entries are removed from their
17
+ * own files, Pi drops the hook from the profile the bridge reads, and Muse is
18
+ * unregistered through its own `muse plugins remove <id>` — deleting our bundle
19
+ * alone would leave Muse running a plugin whose source has gone (measured on
20
+ * Muse Code 1.4.4: `muse plugins remove <id> [--delete-data] [--json]`).
21
+ *
22
+ * A config that cannot be READ is reported, never treated as an empty one: a
23
+ * hook whose state is unknown may still be registered there, so a caller gets a
24
+ * named failure with the harness and the read error instead of a silent
25
+ * success.
26
+ */
27
+ export declare const ADAPTER_TARGETS: readonly ["muse", "kimi", "pi", "cursor"];
28
+ export type AdapterTarget = typeof ADAPTER_TARGETS[number];
29
+ export declare function isAdapterTarget(value: unknown): value is AdapterTarget;
30
+ export interface RunOutcome {
31
+ status: number;
32
+ stdout: string;
33
+ stderr: string;
34
+ /** The harness binary is not on PATH. */
35
+ notFound?: boolean;
36
+ }
37
+ /** Test seam: every harness command the adapters run goes through this. */
38
+ export type AdapterRunner = (command: string, args: string[]) => RunOutcome;
39
+ export interface AdapterOptions {
40
+ scope: "global" | "project";
41
+ home?: string;
42
+ cwd?: string;
43
+ env?: NodeJS.ProcessEnv;
44
+ /** Hook metadata copied into a Muse plugin manifest. */
45
+ version?: string;
46
+ description?: string;
47
+ run?: AdapterRunner;
48
+ }
49
+ /** One registration the harness's own config currently carries. */
50
+ export interface AdapterRegistration {
51
+ hook: string;
52
+ command: string;
53
+ }
54
+ /**
55
+ * What one adapter's own config says, and whether it could be read at all.
56
+ *
57
+ * `unverified` is not `[]`: an unreadable config may still carry the hook, so a
58
+ * caller must report the read failure rather than conclude "not registered".
59
+ */
60
+ export interface AdapterReadState {
61
+ status: "verified" | "unverified";
62
+ registrations: AdapterRegistration[];
63
+ /** Always present when status is "unverified"; names the file or command and the error. */
64
+ reason?: string;
65
+ /**
66
+ * The harness itself is not installed here, so it carries no registration:
67
+ * an unverified read whose cause is absence, not an unreadable store. Only
68
+ * Muse can answer this — Kimi, Pi and Cursor keep the registration in the
69
+ * file that would be missing, and a missing file is a verified empty read.
70
+ */
71
+ absent?: boolean;
72
+ }
73
+ /** Muse's own plugin store: the registrations it will actually run. */
74
+ export interface MuseState extends AdapterReadState {
75
+ /** Installed by Muse but not enabled (approval pending), so it never runs. */
76
+ inactive: string[];
77
+ /** The authority this state was read from. */
78
+ source: string;
79
+ }
80
+ export interface AdapterInstallOutcome {
81
+ ok: boolean;
82
+ /** The file (or, for Muse, the bundle directory) the adapter owns. */
83
+ configPath: string;
84
+ /** What the receipt must say honestly; never a claim that the harness runs it. */
85
+ note?: string;
86
+ /** Why the install did not complete, with the exact command that would finish it. */
87
+ error?: string;
88
+ }
89
+ export interface AdapterRemoveOutcome {
90
+ removed: boolean;
91
+ reason?: string;
92
+ /**
93
+ * Muse only: whether the install source this removal deleted was actually
94
+ * there. Undefined means the adapter did not look, so a caller must not
95
+ * turn it into "no bundle was present".
96
+ */
97
+ bundleRemoved?: boolean;
98
+ }
99
+ /** The hook name inside a written registration command, or undefined. */
100
+ export declare function hookFromCommand(command: string): string | undefined;
101
+ /**
102
+ * The file (or, for Muse, the bundle directory) an adapter owns for a scope.
103
+ *
104
+ * Exported so removal can tell a scope-invariant store from a scope-dependent
105
+ * one: Muse, Kimi and Pi resolve to the same path for both scopes, so acting on
106
+ * both scopes would attempt the same removal twice.
107
+ */
108
+ export declare function adapterStorePath(target: AdapterTarget, options: AdapterOptions, hook?: string): string;
109
+ /**
110
+ * Muse's own registration state, read from its plugin store.
111
+ *
112
+ * A bundle under our plugin root is a file Hooks wrote; Muse's store is what
113
+ * says whether Muse carries the plugin and will run it. Every reason this
114
+ * cannot be read is returned, never flattened into "no plugins".
115
+ */
116
+ export declare function readMuseState(options: AdapterOptions, runner?: AdapterRunner): MuseState;
117
+ /**
118
+ * What one adapter's own config (or, for Muse, its plugin store) says.
119
+ *
120
+ * Never throws, and never answers `registrations: []` for a failure: a config
121
+ * that cannot be read is `unverified` with the harness and the read error, so a
122
+ * caller cannot mistake it for "not registered" and report a removal that never
123
+ * happened.
124
+ */
125
+ export declare function readAdapterState(target: AdapterTarget, options: AdapterOptions, runner?: AdapterRunner): AdapterReadState;
126
+ /**
127
+ * Every registration the harness's own config currently carries.
128
+ *
129
+ * Muse is answered from the bundle files Hooks wrote — a filesystem read that
130
+ * never spawns the harness — so hot paths stay subprocess-free. The plugin
131
+ * store is the authority and is read by `readMuseState`, which doctor and
132
+ * uninstall use. A config that cannot be read yields no registration here;
133
+ * `readAdapterState` is the call that reports why.
134
+ */
135
+ export declare function readAdapterRegistrations(target: AdapterTarget, options: AdapterOptions): AdapterRegistration[];
136
+ /**
137
+ * Whether the harness's own store carries this hook, either as a running
138
+ * registration or as one it installed but did not enable.
139
+ *
140
+ * Muse keeps a plugin it has not approved: it never runs, so it is not a
141
+ * registration, but it is still in Muse's store — a removal that read only
142
+ * the enabled plugins would leave both the plugin and its bundle behind.
143
+ */
144
+ export declare function adapterStateCarries(state: AdapterReadState, hook: string): boolean;
145
+ /**
146
+ * Write one registration into the harness's own config. `command` is the exact
147
+ * `hooks run <name> --target <harness>` string the config must carry.
148
+ */
149
+ export declare function installInAdapter(target: AdapterTarget, hook: string, command: string, options: AdapterOptions, timeoutSeconds?: number): AdapterInstallOutcome;
150
+ /** Remove one registration from the harness's own config, or say why it stays. */
151
+ export declare function removeFromAdapter(target: AdapterTarget, hook: string, options: AdapterOptions): AdapterRemoveOutcome;
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Target capability model.
3
+ *
4
+ * A target is not just a config writer: it is a promise about what a hook can
5
+ * do there. Every install/remove/doctor/run path reads this record instead of
6
+ * assuming that each harness behaves like Claude Code, so a hook can never be
7
+ * written into a config where the runtime would silently ignore it.
8
+ *
9
+ * `configPath` is resolved per scope + home; it is the file (or, for Muse, the
10
+ * plugin directory) the adapter writes.
11
+ *
12
+ * Continuation caps are per harness and are NOT ours to change: 8 consecutive
13
+ * blocks in Claude Code, Codex, Copilot, Grok and Junie; 5 follow-ups in Cursor
14
+ * and Amp. Our own stop-hook cap is 10, so a loop is bounded by the SMALLER of
15
+ * the two — the harness's number wins on every target that caps it.
16
+ */
17
+ export type TargetScope = "global" | "project";
18
+ /** Every harness the CLI can name. `all` is a group, not a target. */
19
+ export declare const TARGET_NAMES: readonly ["claude", "codex", "gemini", "codewith", "qwen", "muse", "kimi", "pi", "cursor", "opencode", "sumi"];
20
+ export type TargetName = typeof TARGET_NAMES[number];
21
+ /** Targets whose own config the CLI can write: they accept `hooks install`. */
22
+ export declare const INSTALL_TARGET_NAMES: readonly ["claude", "codex", "gemini", "codewith", "qwen", "muse", "kimi", "pi", "cursor"];
23
+ export type InstallTargetName = typeof INSTALL_TARGET_NAMES[number];
24
+ export declare function isTargetName(value: unknown): value is TargetName;
25
+ export declare function isInstallTargetName(value: unknown): value is InstallTargetName;
26
+ export interface TargetCapabilities {
27
+ /** The CLI can write this harness's own config. */
28
+ install: boolean;
29
+ /** `hooks run --target <name>` has a payload shape for this harness. */
30
+ run: boolean;
31
+ /** The harness's turn-end event name; null when the harness has none. */
32
+ stopEvent: string | null;
33
+ /** A hook can hold the turn open there. */
34
+ canBlock: boolean;
35
+ /** The hook payload carries the assistant's last message. */
36
+ deliversFinalMessage: boolean;
37
+ /** Resolved per scope + home. */
38
+ configPath: string;
39
+ }
40
+ export interface CapabilityOptions {
41
+ scope?: TargetScope;
42
+ home?: string;
43
+ cwd?: string;
44
+ env?: NodeJS.ProcessEnv;
45
+ /** Muse keeps one bundle per hook; every other target ignores it. */
46
+ hook?: string;
47
+ }
48
+ /** The capability record for one target. Unknown names return undefined. */
49
+ export declare function getTargetCapabilities(target: string, options?: CapabilityOptions): TargetCapabilities | undefined;
50
+ /** The payload field carrying the assistant's last message, when the target delivers one. */
51
+ export declare function finalMessageField(target: string): string | undefined;
52
+ /** The directory holding every Muse plugin bundle Hooks owns. */
53
+ export declare function musePluginRoot(options?: CapabilityOptions): string;
54
+ /** The honest note an install receipt carries for this target, when it has one. */
55
+ export declare function targetInstallNote(target: string): string | undefined;
56
+ /** `hooks run --target` names, in help order. */
57
+ export declare function runTargetHelp(): string;
58
+ /**
59
+ * Fail-closed refusal for `hooks run`: an unknown name has no payload shape,
60
+ * and an unparsable verdict is worse than a named refusal.
61
+ */
62
+ export declare function runTargetRefusal(target: string): string | undefined;
63
+ export interface TargetRequirement {
64
+ events: readonly string[];
65
+ /** The hook's manifest declares `requires_final_message: true`. */
66
+ requiresFinalMessage: boolean;
67
+ /** The hook's manifest declares `requires_block: true`. */
68
+ requiresBlock: boolean;
69
+ }
70
+ /**
71
+ * Refuse an install the harness can never run.
72
+ *
73
+ * Returns the exact, actionable reason — naming the harness, the missing
74
+ * capability and what would unblock it — or undefined when the target can
75
+ * honour the hook.
76
+ */
77
+ export declare function installCapabilityRefusal(hook: string, target: string, requirement: TargetRequirement, options?: CapabilityOptions): string | undefined;
78
+ export interface RunOutput {
79
+ stdout: string;
80
+ stderr: string;
81
+ exitCode: number;
82
+ }
83
+ /**
84
+ * Shape the hook's stdin for a target.
85
+ *
86
+ * Muse hands the final message back as a quoted JSON string; parsing it once
87
+ * is what makes the Claude-shaped contract hold there. Every other target gets
88
+ * the payload untouched.
89
+ */
90
+ export declare function shapeTargetInput(target: string | undefined, stdin: string): string;
91
+ /**
92
+ * Shape the hook's verdict for a target.
93
+ *
94
+ * Kimi blocks with exit 2 + stderr (once per turn) and reads no JSON verdict,
95
+ * so a `{"decision":"block","reason"}` is translated rather than written to a
96
+ * file Kimi never reads. Claude, Codex, Gemini, Codewith, Qwen, Muse, Pi and
97
+ * Cursor consume the verdict as the hook produced it.
98
+ */
99
+ export declare function shapeTargetOutput(target: string | undefined, output: RunOutput): RunOutput;
@@ -323,16 +323,16 @@ async function handleReadinessSessionStart(provider, event, dependencies = {}) {
323
323
  return readinessSessionStartOutput(await runTrashReadiness(provider, dependencies));
324
324
  }
325
325
  export {
326
- trashReadinessBindingPath,
327
- runTrashReadiness,
328
- readinessSessionStartOutput,
329
- readinessContext,
330
- readTrashReadinessBindingFile,
331
- parseTrashReadinessBinding,
332
- isReadinessProvider,
333
- handleReadinessSessionStart,
334
- checkTrashReadinessBinding,
335
- TRASH_READINESS_NATIVE_TIMEOUT_SECONDS,
326
+ TRASH_READINESS_DEFAULT_TIMEOUT_MS,
336
327
  TRASH_READINESS_MAX_TIMEOUT_MS,
337
- TRASH_READINESS_DEFAULT_TIMEOUT_MS
328
+ TRASH_READINESS_NATIVE_TIMEOUT_SECONDS,
329
+ checkTrashReadinessBinding,
330
+ handleReadinessSessionStart,
331
+ isReadinessProvider,
332
+ parseTrashReadinessBinding,
333
+ readTrashReadinessBindingFile,
334
+ readinessContext,
335
+ readinessSessionStartOutput,
336
+ runTrashReadiness,
337
+ trashReadinessBindingPath
338
338
  };