@kirkchinese/harness-forge 0.0.0-stage → 0.4.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 (246) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -2
  3. package/assets/icon.svg +12 -0
  4. package/cordis.patch.yml +28 -0
  5. package/lib/agents/presets.d.ts +91 -0
  6. package/lib/agents/presets.js +282 -0
  7. package/lib/agents/profiles.d.ts +58 -0
  8. package/lib/agents/profiles.js +278 -0
  9. package/lib/agents/row.d.ts +17 -0
  10. package/lib/agents/row.js +146 -0
  11. package/lib/client/styles.d.ts +8 -0
  12. package/lib/client/styles.js +89 -0
  13. package/lib/client/typert.d.ts +14 -0
  14. package/lib/client/typert.js +110 -0
  15. package/lib/client.js +22500 -0
  16. package/lib/commands/definition.d.ts +40 -0
  17. package/lib/commands/definition.js +113 -0
  18. package/lib/commands/output-styles.d.ts +42 -0
  19. package/lib/commands/output-styles.js +152 -0
  20. package/lib/commands/row.d.ts +9 -0
  21. package/lib/commands/row.js +157 -0
  22. package/lib/context/instructions.d.ts +32 -0
  23. package/lib/context/instructions.js +88 -0
  24. package/lib/context/row.d.ts +16 -0
  25. package/lib/context/row.js +17 -0
  26. package/lib/dsh/commands.d.ts +30 -0
  27. package/lib/dsh/commands.js +61 -0
  28. package/lib/dsh/host.d.ts +107 -0
  29. package/lib/dsh/host.js +214 -0
  30. package/lib/dsh/model-route.d.ts +21 -0
  31. package/lib/dsh/model-route.js +37 -0
  32. package/lib/dsh/session-records.d.ts +78 -0
  33. package/lib/dsh/session-records.js +36 -0
  34. package/lib/dsh/subagents.d.ts +46 -0
  35. package/lib/dsh/subagents.js +14 -0
  36. package/lib/forge/contract.d.ts +231 -0
  37. package/lib/forge/contract.js +43 -0
  38. package/lib/forge/ledger.d.ts +143 -0
  39. package/lib/forge/ledger.js +733 -0
  40. package/lib/forge/live-mounts.d.ts +45 -0
  41. package/lib/forge/live-mounts.js +78 -0
  42. package/lib/forge/marketplace-install.d.ts +3 -0
  43. package/lib/forge/marketplace-install.js +64 -0
  44. package/lib/forge/npm.d.ts +31 -0
  45. package/lib/forge/npm.js +60 -0
  46. package/lib/forge/projects.d.ts +94 -0
  47. package/lib/forge/projects.js +336 -0
  48. package/lib/forge/receipts.d.ts +5 -0
  49. package/lib/forge/receipts.js +31 -0
  50. package/lib/forge/row.d.ts +32 -0
  51. package/lib/forge/row.js +59 -0
  52. package/lib/forge/service.d.ts +105 -0
  53. package/lib/forge/service.js +274 -0
  54. package/lib/forge/settings.d.ts +41 -0
  55. package/lib/forge/settings.js +115 -0
  56. package/lib/forge/state.d.ts +69 -0
  57. package/lib/forge/state.js +150 -0
  58. package/lib/forge/trust.d.ts +48 -0
  59. package/lib/forge/trust.js +107 -0
  60. package/lib/forge/turns.d.ts +13 -0
  61. package/lib/forge/turns.js +56 -0
  62. package/lib/hooks/broker/engine.d.ts +112 -0
  63. package/lib/hooks/broker/engine.js +728 -0
  64. package/lib/hooks/broker/helpers.d.ts +10 -0
  65. package/lib/hooks/broker/helpers.js +22 -0
  66. package/lib/hooks/broker/lifecycle.d.ts +65 -0
  67. package/lib/hooks/broker/lifecycle.js +342 -0
  68. package/lib/hooks/broker/session-events.d.ts +22 -0
  69. package/lib/hooks/broker/session-events.js +196 -0
  70. package/lib/hooks/broker/tools.d.ts +52 -0
  71. package/lib/hooks/broker/tools.js +424 -0
  72. package/lib/hooks/broker/types.d.ts +262 -0
  73. package/lib/hooks/broker/types.js +1 -0
  74. package/lib/hooks/broker.d.ts +80 -0
  75. package/lib/hooks/broker.js +95 -0
  76. package/lib/hooks/codex-user.d.ts +5 -0
  77. package/lib/hooks/codex-user.js +109 -0
  78. package/lib/hooks/condition.d.ts +11 -0
  79. package/lib/hooks/condition.js +181 -0
  80. package/lib/hooks/config.d.ts +85 -0
  81. package/lib/hooks/config.js +150 -0
  82. package/lib/hooks/matcher.d.ts +20 -0
  83. package/lib/hooks/matcher.js +39 -0
  84. package/lib/hooks/notice.d.ts +17 -0
  85. package/lib/hooks/notice.js +39 -0
  86. package/lib/hooks/output.d.ts +56 -0
  87. package/lib/hooks/output.js +214 -0
  88. package/lib/hooks/permissions.d.ts +14 -0
  89. package/lib/hooks/permissions.js +109 -0
  90. package/lib/hooks/process.d.ts +47 -0
  91. package/lib/hooks/process.js +134 -0
  92. package/lib/hooks/row.d.ts +17 -0
  93. package/lib/hooks/row.js +94 -0
  94. package/lib/hooks/runner.d.ts +85 -0
  95. package/lib/hooks/runner.js +293 -0
  96. package/lib/hooks/shell-commands.d.ts +19 -0
  97. package/lib/hooks/shell-commands.js +177 -0
  98. package/lib/hooks/shell.d.ts +43 -0
  99. package/lib/hooks/shell.js +126 -0
  100. package/lib/hooks/transcript.d.ts +28 -0
  101. package/lib/hooks/transcript.js +141 -0
  102. package/lib/hooks/vocabulary.d.ts +57 -0
  103. package/lib/hooks/vocabulary.js +364 -0
  104. package/lib/index.d.ts +31 -0
  105. package/lib/index.js +287 -0
  106. package/lib/mcp/auth.d.ts +35 -0
  107. package/lib/mcp/auth.js +178 -0
  108. package/lib/mcp/catalog.d.ts +36 -0
  109. package/lib/mcp/catalog.js +61 -0
  110. package/lib/mcp/mount.d.ts +75 -0
  111. package/lib/mcp/mount.js +217 -0
  112. package/lib/mcp/remote.d.ts +45 -0
  113. package/lib/mcp/remote.js +143 -0
  114. package/lib/mcp/row.d.ts +9 -0
  115. package/lib/mcp/row.js +131 -0
  116. package/lib/mods/bundler.d.ts +38 -0
  117. package/lib/mods/bundler.js +157 -0
  118. package/lib/mods/chain.d.ts +103 -0
  119. package/lib/mods/chain.js +436 -0
  120. package/lib/mods/claude.d.ts +27 -0
  121. package/lib/mods/claude.js +56 -0
  122. package/lib/mods/engine.d.ts +160 -0
  123. package/lib/mods/engine.js +701 -0
  124. package/lib/mods/expect.d.ts +8 -0
  125. package/lib/mods/expect.js +248 -0
  126. package/lib/mods/host.d.ts +105 -0
  127. package/lib/mods/host.js +462 -0
  128. package/lib/mods/loader.d.ts +53 -0
  129. package/lib/mods/loader.js +227 -0
  130. package/lib/mods/ops.d.ts +13 -0
  131. package/lib/mods/ops.js +117 -0
  132. package/lib/mods/row.d.ts +9 -0
  133. package/lib/mods/row.js +77 -0
  134. package/lib/mods/runtime.d.ts +60 -0
  135. package/lib/mods/runtime.js +133 -0
  136. package/lib/mods/service/commands.d.ts +17 -0
  137. package/lib/mods/service/commands.js +121 -0
  138. package/lib/mods/service/drawings.d.ts +36 -0
  139. package/lib/mods/service/drawings.js +64 -0
  140. package/lib/mods/service/sessions.d.ts +63 -0
  141. package/lib/mods/service/sessions.js +345 -0
  142. package/lib/mods/service/tools.d.ts +32 -0
  143. package/lib/mods/service/tools.js +253 -0
  144. package/lib/mods/service/turns.d.ts +32 -0
  145. package/lib/mods/service/turns.js +161 -0
  146. package/lib/mods/service/types.d.ts +151 -0
  147. package/lib/mods/service/types.js +1 -0
  148. package/lib/mods/service.d.ts +72 -0
  149. package/lib/mods/service.js +104 -0
  150. package/lib/mods/surfaces.d.ts +93 -0
  151. package/lib/mods/surfaces.js +309 -0
  152. package/lib/mods/values.d.ts +30 -0
  153. package/lib/mods/values.js +95 -0
  154. package/lib/opencode/bun.d.ts +40 -0
  155. package/lib/opencode/bun.js +156 -0
  156. package/lib/opencode/convert.d.ts +53 -0
  157. package/lib/opencode/convert.js +255 -0
  158. package/lib/opencode/row.d.ts +9 -0
  159. package/lib/opencode/row.js +86 -0
  160. package/lib/opencode/runtime/core.d.ts +74 -0
  161. package/lib/opencode/runtime/core.js +249 -0
  162. package/lib/opencode/runtime/events.d.ts +80 -0
  163. package/lib/opencode/runtime/events.js +281 -0
  164. package/lib/opencode/runtime/mount.d.ts +27 -0
  165. package/lib/opencode/runtime/mount.js +283 -0
  166. package/lib/opencode/runtime/server.d.ts +27 -0
  167. package/lib/opencode/runtime/server.js +353 -0
  168. package/lib/opencode/runtime/types.d.ts +109 -0
  169. package/lib/opencode/runtime/types.js +1 -0
  170. package/lib/opencode/runtime.d.ts +55 -0
  171. package/lib/opencode/runtime.js +79 -0
  172. package/lib/porting/port-gap.d.ts +30 -0
  173. package/lib/porting/port-gap.js +122 -0
  174. package/lib/porting/port-sessions.d.ts +41 -0
  175. package/lib/porting/port-sessions.js +98 -0
  176. package/lib/porting/prompt.d.ts +23 -0
  177. package/lib/porting/prompt.js +49 -0
  178. package/lib/porting/row.d.ts +16 -0
  179. package/lib/porting/row.js +25 -0
  180. package/lib/porting/verify-port.d.ts +53 -0
  181. package/lib/porting/verify-port.js +104 -0
  182. package/lib/presets/fs-search.d.ts +25 -0
  183. package/lib/presets/fs-search.js +17 -0
  184. package/lib/presets/tool-filter.d.ts +35 -0
  185. package/lib/presets/tool-filter.js +91 -0
  186. package/lib/sessions/claude.d.ts +29 -0
  187. package/lib/sessions/claude.js +83 -0
  188. package/lib/sessions/codex.d.ts +30 -0
  189. package/lib/sessions/codex.js +303 -0
  190. package/lib/sessions/opencode.d.ts +32 -0
  191. package/lib/sessions/opencode.js +320 -0
  192. package/lib/sessions/row.d.ts +14 -0
  193. package/lib/sessions/row.js +35 -0
  194. package/lib/shared/invocation.d.ts +169 -0
  195. package/lib/shared/invocation.js +325 -0
  196. package/lib/shared/render.d.ts +72 -0
  197. package/lib/shared/render.js +588 -0
  198. package/lib/shared/util.d.ts +21 -0
  199. package/lib/shared/util.js +32 -0
  200. package/lib/skills/bundled.d.ts +3 -0
  201. package/lib/skills/bundled.js +42 -0
  202. package/lib/skills/provider.d.ts +72 -0
  203. package/lib/skills/provider.js +340 -0
  204. package/lib/skills/row.d.ts +22 -0
  205. package/lib/skills/row.js +204 -0
  206. package/lib/workbench/adapter-coverage.d.ts +47 -0
  207. package/lib/workbench/adapter-coverage.js +102 -0
  208. package/lib/workbench/model-tools.d.ts +10 -0
  209. package/lib/workbench/model-tools.js +122 -0
  210. package/lib/workbench/overview.d.ts +103 -0
  211. package/lib/workbench/overview.js +159 -0
  212. package/lib/workbench/remote.d.ts +118 -0
  213. package/lib/workbench/remote.js +422 -0
  214. package/lib/workbench/row.d.ts +15 -0
  215. package/lib/workbench/row.js +16 -0
  216. package/lib/workbench/settings.d.ts +15 -0
  217. package/lib/workbench/settings.js +56 -0
  218. package/lib/workbench/workbench.d.ts +100 -0
  219. package/lib/workbench/workbench.js +260 -0
  220. package/locale/agents/en.json +6 -0
  221. package/locale/agents/zh.json +6 -0
  222. package/locale/commands/en.json +6 -0
  223. package/locale/commands/zh.json +6 -0
  224. package/locale/context/en.json +6 -0
  225. package/locale/context/zh.json +6 -0
  226. package/locale/en.json +6 -0
  227. package/locale/hooks/en.json +6 -0
  228. package/locale/hooks/zh.json +6 -0
  229. package/locale/mcp/en.json +6 -0
  230. package/locale/mcp/zh.json +6 -0
  231. package/locale/mods/en.json +6 -0
  232. package/locale/mods/zh.json +6 -0
  233. package/locale/opencode/en.json +6 -0
  234. package/locale/opencode/zh.json +6 -0
  235. package/locale/porter/en.json +6 -0
  236. package/locale/porter/zh.json +6 -0
  237. package/locale/sessions/en.json +6 -0
  238. package/locale/sessions/zh.json +6 -0
  239. package/locale/skills/en.json +6 -0
  240. package/locale/skills/zh.json +6 -0
  241. package/locale/workbench/en.json +6 -0
  242. package/locale/workbench/zh.json +6 -0
  243. package/locale/zh.json +6 -0
  244. package/package.json +246 -3
  245. package/runtime/opencode-host.mjs +270 -0
  246. package/skills/harness-forge/SKILL.md +47 -0
@@ -0,0 +1,157 @@
1
+ /**
2
+ * The bundler of Claude Code mods: rolldown, fetched on first use into
3
+ * Harness Forge's data directory, as Bun is for OpenCode plugins.
4
+ *
5
+ * rolldown is not a dependency of Harness Forge: its native binding comes as
6
+ * platform-specific optional dependencies, and once a DSH profile's
7
+ * `node_modules` holds such a package, pnpm (11.x, hoisted) stops exiting
8
+ * after later installs, so every plugin installed after Harness Forge would
9
+ * stall. Installed here with npm, outside the profile, it never reaches pnpm.
10
+ * The install is the pinned `rolldown` and the one binding package rolldown's
11
+ * own loader picks for this machine; neither has an install script.
12
+ * @module @kirkchinese/harness-forge/mods
13
+ */
14
+ import { readFileSync } from 'node:fs';
15
+ import { createRequire } from 'node:module';
16
+ import { join } from 'node:path';
17
+ import { pathToFileURL } from 'node:url';
18
+ import { npmInstall } from '../forge/npm.js';
19
+ /** The rolldown version mods are bundled with. */
20
+ export const ROLLDOWN_VERSION = '1.3.2';
21
+ /**
22
+ * The `@rolldown/binding-*` package rolldown loads on `platform`, as its
23
+ * binding loader picks it, among those rolldown publishes (its
24
+ * `optionalDependencies`). Undefined where rolldown has no native build.
25
+ */
26
+ export function rolldownBinding(platform) {
27
+ const { os, arch } = platform;
28
+ const libc = platform.musl === true ? 'musl' : 'gnu';
29
+ const target = (() => {
30
+ switch (os) {
31
+ case 'darwin': return arch === 'x64' || arch === 'arm64' ? `darwin-${arch}` : undefined;
32
+ case 'win32': return arch === 'x64' || arch === 'arm64' ? `win32-${arch}-msvc` : undefined;
33
+ case 'freebsd': return arch === 'x64' ? 'freebsd-x64' : undefined;
34
+ case 'android': return arch === 'arm64' ? 'android-arm64' : arch === 'arm' ? 'android-arm-eabi' : undefined;
35
+ case 'openharmony': return arch === 'arm64' ? 'openharmony-arm64' : undefined;
36
+ case 'linux':
37
+ if (arch === 'x64' || arch === 'arm64')
38
+ return `linux-${arch}-${libc}`;
39
+ if (libc === 'musl')
40
+ return undefined;
41
+ if (arch === 'arm')
42
+ return 'linux-arm-gnueabihf';
43
+ if (arch === 'ppc64' || arch === 's390x')
44
+ return `linux-${arch}-gnu`;
45
+ return undefined;
46
+ default: return undefined;
47
+ }
48
+ })();
49
+ return target === undefined ? undefined : `@rolldown/binding-${target}`;
50
+ }
51
+ /** Whether this process runs on musl Linux, the way rolldown's binding loader decides it. */
52
+ function isMusl() {
53
+ if (process.platform !== 'linux')
54
+ return false;
55
+ try {
56
+ return readFileSync('/usr/bin/ldd', 'utf8').includes('musl');
57
+ }
58
+ catch {
59
+ // Fall through to the process report.
60
+ }
61
+ try {
62
+ const report = process.report?.getReport();
63
+ if (report === undefined)
64
+ return false;
65
+ if (report.header?.glibcVersionRuntime !== undefined)
66
+ return false;
67
+ return (report.sharedObjects ?? []).some(file => file.includes('libc.musl-') || file.includes('ld-musl-'));
68
+ }
69
+ catch {
70
+ return false;
71
+ }
72
+ }
73
+ /** Import rolldown and its `parseAst` from `prefix/node_modules`, by file URL. */
74
+ async function load(prefix) {
75
+ const require = createRequire(join(prefix, 'package.json'));
76
+ const url = (specifier) => pathToFileURL(require.resolve(specifier)).href;
77
+ const { build } = await import(url('rolldown'));
78
+ const { parseAst } = await import(url('rolldown/parseAst'));
79
+ if (typeof build !== 'function' || typeof parseAst !== 'function')
80
+ throw new Error(`the rolldown under ${prefix} has no build or parseAst`);
81
+ return { build, parseAst };
82
+ }
83
+ const defaultHost = {
84
+ get platform() { return { os: process.platform, arch: process.arch, musl: isMusl() }; },
85
+ install: (specs, prefix) => npmInstall(specs, prefix),
86
+ load,
87
+ };
88
+ /** The packages to install: the pinned rolldown and its binding for `platform`. */
89
+ export function bundlerSpecs(platform) {
90
+ const binding = rolldownBinding(platform);
91
+ return [`rolldown@${ROLLDOWN_VERSION}`, ...(binding !== undefined ? [`${binding}@${ROLLDOWN_VERSION}`] : [])];
92
+ }
93
+ /** Where the bundler is installed under a data root. */
94
+ export function bundlerPrefix(dataRoot) {
95
+ return join(dataRoot, 'rolldown');
96
+ }
97
+ /** Whether `prefix` holds the pinned rolldown and its binding already. */
98
+ function installed(prefix, platform) {
99
+ const version = (name) => {
100
+ try {
101
+ return JSON.parse(readFileSync(join(prefix, 'node_modules', ...name.split('/'), 'package.json'), 'utf8')).version;
102
+ }
103
+ catch {
104
+ return undefined;
105
+ }
106
+ };
107
+ const binding = rolldownBinding(platform);
108
+ return version('rolldown') === ROLLDOWN_VERSION && (binding === undefined || version(binding) === ROLLDOWN_VERSION);
109
+ }
110
+ const loading = new Map();
111
+ /**
112
+ * The bundler, installing it under `dataRoot` on first use. One install runs
113
+ * at a time per data root; a failed one is forgotten, so the next mod tries
114
+ * again.
115
+ */
116
+ export function ensureBundler(dataRoot, host = defaultHost) {
117
+ const prefix = bundlerPrefix(dataRoot);
118
+ const known = loading.get(prefix);
119
+ if (known !== undefined)
120
+ return known;
121
+ const attempt = bootstrap(prefix, host);
122
+ loading.set(prefix, attempt);
123
+ attempt.catch(() => { if (loading.get(prefix) === attempt)
124
+ loading.delete(prefix); });
125
+ return attempt;
126
+ }
127
+ /** Whether {@link ensureBundler} would answer without installing anything. */
128
+ export function bundlerInstalled(dataRoot, host = defaultHost) {
129
+ return installed(bundlerPrefix(dataRoot), host.platform);
130
+ }
131
+ async function bootstrap(prefix, host) {
132
+ const platform = host.platform;
133
+ const specs = bundlerSpecs(platform);
134
+ if (installed(prefix, platform)) {
135
+ try {
136
+ return await host.load(prefix);
137
+ }
138
+ catch {
139
+ // Install again over what is there.
140
+ }
141
+ }
142
+ let problem;
143
+ try {
144
+ if (rolldownBinding(platform) === undefined)
145
+ throw new Error(`rolldown has no native build for ${platform.os} ${platform.arch}${platform.musl === true ? ' (musl)' : ''}`);
146
+ await host.install(specs, prefix);
147
+ return await host.load(prefix);
148
+ }
149
+ catch (error) {
150
+ problem = error instanceof Error ? error.message : String(error);
151
+ }
152
+ throw new Error(`The bundler Claude Code mods need (rolldown ${ROLLDOWN_VERSION}) could not be installed automatically (${problem}). Install it by hand with \`npm install ${specs.join(' ')} --ignore-scripts\` in ${prefix}, then restart DSH.`);
153
+ }
154
+ /** For tests: forget the bundlers loaded so far. */
155
+ export function resetBundlers() {
156
+ loading.clear();
157
+ }
@@ -0,0 +1,103 @@
1
+ /** The chain's tiers, outermost first. */
2
+ export declare const TIERS: readonly ["prepend", "user", "append", "builtin", "core"];
3
+ export type Tier = typeof TIERS[number];
4
+ export type PluginTier = Exclude<Tier, 'core'>;
5
+ /** Who raised a dispatch. */
6
+ export interface Origin {
7
+ readonly plugin: string;
8
+ readonly tier: Tier;
9
+ }
10
+ export declare const ENGINE_ORIGIN: Origin;
11
+ /** A hook's own time and a `.catch` handler's grace, in milliseconds. */
12
+ export declare const HOOK_BUDGET_MS = 10000;
13
+ export declare const CATCH_BUDGET_MS = 1000;
14
+ /** Why a hook failed, as its `.catch` handler reads `next.error`. */
15
+ export interface HookFailure {
16
+ readonly kind: 'throw' | 'timeout' | 're-entry';
17
+ readonly message?: string;
18
+ readonly budget: number;
19
+ readonly cause?: 'rewritten' | 'lent';
20
+ }
21
+ /** A loaded mod, as the chain orders and names it. */
22
+ export interface ModRef {
23
+ readonly name: string;
24
+ readonly tier: PluginTier;
25
+ /** Load order within its tier. */
26
+ readonly rank: number;
27
+ }
28
+ export type HookFn = ($: unknown, e: unknown, next: unknown) => unknown;
29
+ /** One `on(...)` registration. */
30
+ export interface HookEntry {
31
+ readonly id: number;
32
+ readonly mod: ModRef;
33
+ readonly pattern: string;
34
+ readonly matcher: unknown;
35
+ readonly fn: HookFn;
36
+ /** Registration order within the mod. */
37
+ readonly seq: number;
38
+ catchFn?: HookFn;
39
+ }
40
+ export type TraceOutcome = 'caught' | 'expired' | 'kept' | 'passed' | 'rejected' | 'returned' | 'skipped';
41
+ /** One link of a dispatch, as `next.trace` lists it. */
42
+ export interface TraceEntry {
43
+ readonly index: number;
44
+ readonly plugin: string;
45
+ readonly tier: Tier;
46
+ readonly event: string;
47
+ readonly outcome: TraceOutcome;
48
+ readonly reason?: string;
49
+ readonly ms: number;
50
+ readonly received: unknown;
51
+ readonly returned: unknown;
52
+ }
53
+ /** A hook run's frame: its budget, which `$` calls pause. */
54
+ export interface HookFrame {
55
+ readonly hook: HookEntry;
56
+ readonly event: string;
57
+ readonly origin: Origin;
58
+ readonly signal: AbortSignal;
59
+ /** True until the hook (or handler) settles; `$` calls after it are the mod's own. */
60
+ readonly active: boolean;
61
+ /** Stop the hook's clock while a `$` call is in flight; returns the resume. */
62
+ pause(): () => void;
63
+ }
64
+ /** What a dispatch needs from the engine. */
65
+ export interface DispatchRequest {
66
+ readonly event: string;
67
+ readonly input: unknown;
68
+ readonly origin: Origin;
69
+ /** The hooks the pattern selects, in chain order. */
70
+ readonly hooks: readonly HookEntry[];
71
+ /** Core: the host's own behavior, or the test's stubs. */
72
+ readonly bottom: (e: unknown, signal: AbortSignal, above: HookEntry | undefined) => Promise<unknown>;
73
+ /** What a hook's `next` resolves to, as that hook sees it (engine.create's table). */
74
+ readonly received?: (hook: HookEntry, value: unknown) => unknown;
75
+ /** The event a hook passes to `next`, as the next reader gets it (kept in step with what it received). */
76
+ readonly passing?: (received: unknown, passed: unknown) => unknown;
77
+ /** Each link that answered (returned or caught), as it settles: innermost first. */
78
+ readonly observe?: (hook: HookEntry, result: unknown) => void;
79
+ /** The `$` a hook receives for this run. */
80
+ readonly api: (frame: HookFrame) => unknown;
81
+ /** Whether a hook runs for this input (matcher and per-event rules). */
82
+ readonly applies: (hook: HookEntry, e: unknown) => boolean;
83
+ /** Hooks skipped because the event came from their own `$` call. */
84
+ readonly reentry?: (hook: HookEntry) => HookFailure['cause'] | boolean;
85
+ /** Why a result is the wrong shape for this event, or undefined. */
86
+ readonly validate?: (result: unknown, called: boolean) => string | undefined;
87
+ readonly report: (line: string) => void;
88
+ readonly signal?: AbortSignal;
89
+ readonly budgetMs?: number;
90
+ readonly catchMs?: number;
91
+ }
92
+ /** Whether `pattern` (a name, `ns.*`, `*`, or `!pattern`) selects `event`. */
93
+ export declare function selects(pattern: string, event: string): boolean;
94
+ /**
95
+ * Whether a matcher accepts a value: a scalar is `===`, a RegExp tests the
96
+ * value as a string, an array is any-of, an object a partial at any depth;
97
+ * against an array value a pattern holds when some element matches.
98
+ */
99
+ export declare function matches(pattern: unknown, value: unknown): boolean;
100
+ /** Chain order: tier, then load order, then registration order. */
101
+ export declare function chainOrder(a: HookEntry, b: HookEntry): number;
102
+ /** Run one dispatch through its hooks and core. */
103
+ export declare function dispatch(request: DispatchRequest): Promise<unknown>;