@smeltjs/core 0.2.0 → 0.3.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.
- package/README.md +3 -3
- package/dist/apply.d.ts.map +1 -1
- package/dist/apply.js.map +1 -1
- package/dist/cache/prefix.d.ts.map +1 -1
- package/dist/cache/prefix.js.map +1 -1
- package/dist/cli/args.d.ts +16 -70
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +18 -338
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/bin.d.ts.map +1 -1
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/config.d.ts +40 -0
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +55 -1
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/hooks.d.ts +33 -38
- package/dist/cli/hooks.d.ts.map +1 -1
- package/dist/cli/hooks.js +140 -485
- package/dist/cli/hooks.js.map +1 -1
- package/dist/cli/init.d.ts +30 -15
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +167 -38
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/report.d.ts.map +1 -1
- package/dist/cli/report.js +2 -2
- package/dist/cli/report.js.map +1 -1
- package/dist/cli/run.d.ts +25 -88
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +32 -341
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/shell.d.ts +106 -0
- package/dist/cli/shell.d.ts.map +1 -0
- package/dist/cli/shell.js +100 -0
- package/dist/cli/shell.js.map +1 -0
- package/dist/cli/subcommands/flags.d.ts +141 -0
- package/dist/cli/subcommands/flags.d.ts.map +1 -0
- package/dist/cli/subcommands/flags.js +208 -0
- package/dist/cli/subcommands/flags.js.map +1 -0
- package/dist/cli/subcommands/hooks.d.ts +18 -0
- package/dist/cli/subcommands/hooks.d.ts.map +1 -0
- package/dist/cli/subcommands/hooks.js +64 -0
- package/dist/cli/subcommands/hooks.js.map +1 -0
- package/dist/cli/subcommands/init.d.ts +19 -0
- package/dist/cli/subcommands/init.d.ts.map +1 -0
- package/dist/cli/subcommands/init.js +44 -0
- package/dist/cli/subcommands/init.js.map +1 -0
- package/dist/cli/subcommands/map.d.ts +75 -0
- package/dist/cli/subcommands/map.d.ts.map +1 -0
- package/dist/cli/subcommands/map.js +132 -0
- package/dist/cli/subcommands/map.js.map +1 -0
- package/dist/cli/subcommands/registry.d.ts +80 -0
- package/dist/cli/subcommands/registry.d.ts.map +1 -0
- package/dist/cli/subcommands/registry.js +138 -0
- package/dist/cli/subcommands/registry.js.map +1 -0
- package/dist/cli/subcommands/retrieve.d.ts +74 -0
- package/dist/cli/subcommands/retrieve.d.ts.map +1 -0
- package/dist/cli/subcommands/retrieve.js +84 -0
- package/dist/cli/subcommands/retrieve.js.map +1 -0
- package/dist/cli/subcommands/smelt.d.ts +107 -0
- package/dist/cli/subcommands/smelt.d.ts.map +1 -0
- package/dist/cli/subcommands/smelt.js +304 -0
- package/dist/cli/subcommands/smelt.js.map +1 -0
- package/dist/cli/subcommands/stats.d.ts +43 -0
- package/dist/cli/subcommands/stats.d.ts.map +1 -0
- package/dist/cli/subcommands/stats.js +62 -0
- package/dist/cli/subcommands/stats.js.map +1 -0
- package/dist/cli/subcommands/subcommand.d.ts +113 -0
- package/dist/cli/subcommands/subcommand.d.ts.map +1 -0
- package/dist/cli/subcommands/subcommand.js +3 -0
- package/dist/cli/subcommands/subcommand.js.map +1 -0
- package/dist/cli/usage.d.ts +3 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +95 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/detect.d.ts.map +1 -1
- package/dist/detect.js.map +1 -1
- package/dist/errors.d.ts +21 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +33 -1
- package/dist/errors.js.map +1 -1
- package/dist/harness/aider.d.ts +10 -0
- package/dist/harness/aider.d.ts.map +1 -0
- package/dist/harness/aider.js +21 -0
- package/dist/harness/aider.js.map +1 -0
- package/dist/harness/claude-code.d.ts +3 -0
- package/dist/harness/claude-code.d.ts.map +1 -0
- package/dist/harness/claude-code.js +68 -0
- package/dist/harness/claude-code.js.map +1 -0
- package/dist/harness/cline.d.ts +3 -0
- package/dist/harness/cline.d.ts.map +1 -0
- package/dist/harness/cline.js +54 -0
- package/dist/harness/cline.js.map +1 -0
- package/dist/harness/codex.d.ts +3 -0
- package/dist/harness/codex.d.ts.map +1 -0
- package/dist/harness/codex.js +91 -0
- package/dist/harness/codex.js.map +1 -0
- package/dist/harness/cursor.d.ts +3 -0
- package/dist/harness/cursor.d.ts.map +1 -0
- package/dist/harness/cursor.js +54 -0
- package/dist/harness/cursor.js.map +1 -0
- package/dist/harness/gemini.d.ts +3 -0
- package/dist/harness/gemini.d.ts.map +1 -0
- package/dist/harness/gemini.js +59 -0
- package/dist/harness/gemini.js.map +1 -0
- package/dist/harness/grok.d.ts +3 -0
- package/dist/harness/grok.d.ts.map +1 -0
- package/dist/harness/grok.js +46 -0
- package/dist/harness/grok.js.map +1 -0
- package/dist/harness/hermes.d.ts +3 -0
- package/dist/harness/hermes.d.ts.map +1 -0
- package/dist/harness/hermes.js +71 -0
- package/dist/harness/hermes.js.map +1 -0
- package/dist/harness/kilocode.d.ts +3 -0
- package/dist/harness/kilocode.d.ts.map +1 -0
- package/dist/harness/kilocode.js +35 -0
- package/dist/harness/kilocode.js.map +1 -0
- package/dist/harness/opencode.d.ts +3 -0
- package/dist/harness/opencode.d.ts.map +1 -0
- package/dist/harness/opencode.js +97 -0
- package/dist/harness/opencode.js.map +1 -0
- package/dist/harness/paths.d.ts +17 -0
- package/dist/harness/paths.d.ts.map +1 -0
- package/dist/harness/paths.js +45 -0
- package/dist/harness/paths.js.map +1 -0
- package/dist/harness/profile.d.ts +184 -0
- package/dist/harness/profile.d.ts.map +1 -0
- package/dist/harness/profile.js +26 -0
- package/dist/harness/profile.js.map +1 -0
- package/dist/harness/registry.d.ts +51 -0
- package/dist/harness/registry.d.ts.map +1 -0
- package/dist/harness/registry.js +87 -0
- package/dist/harness/registry.js.map +1 -0
- package/dist/harness/snippet.d.ts +19 -0
- package/dist/harness/snippet.d.ts.map +1 -0
- package/dist/harness/snippet.js +41 -0
- package/dist/harness/snippet.js.map +1 -0
- package/dist/hash.d.ts.map +1 -1
- package/dist/hash.js.map +1 -1
- package/dist/hooks/guard-core.d.ts +14 -14
- package/dist/hooks/guard-core.d.ts.map +1 -1
- package/dist/hooks/guard-core.js +15 -37
- package/dist/hooks/guard-core.js.map +1 -1
- package/dist/hooks/shim.d.ts +95 -4
- package/dist/hooks/shim.d.ts.map +1 -1
- package/dist/hooks/shim.js +87 -2
- package/dist/hooks/shim.js.map +1 -1
- package/dist/hooks/shims/claude-code.d.ts +5 -18
- package/dist/hooks/shims/claude-code.d.ts.map +1 -1
- package/dist/hooks/shims/claude-code.js +9 -56
- package/dist/hooks/shims/claude-code.js.map +1 -1
- package/dist/hooks/shims/cline.d.ts +5 -12
- package/dist/hooks/shims/cline.d.ts.map +1 -1
- package/dist/hooks/shims/cline.js +9 -34
- package/dist/hooks/shims/cline.js.map +1 -1
- package/dist/hooks/shims/codex.d.ts +5 -18
- package/dist/hooks/shims/codex.d.ts.map +1 -1
- package/dist/hooks/shims/codex.js +9 -51
- package/dist/hooks/shims/codex.js.map +1 -1
- package/dist/hooks/shims/cursor.d.ts +5 -14
- package/dist/hooks/shims/cursor.d.ts.map +1 -1
- package/dist/hooks/shims/cursor.js +9 -42
- package/dist/hooks/shims/cursor.js.map +1 -1
- package/dist/hooks/shims/gemini.d.ts +5 -18
- package/dist/hooks/shims/gemini.d.ts.map +1 -1
- package/dist/hooks/shims/gemini.js +9 -48
- package/dist/hooks/shims/gemini.js.map +1 -1
- package/dist/hooks/shims/grok.d.ts +5 -13
- package/dist/hooks/shims/grok.d.ts.map +1 -1
- package/dist/hooks/shims/grok.js +9 -32
- package/dist/hooks/shims/grok.js.map +1 -1
- package/dist/hooks/shims/hermes.d.ts +5 -17
- package/dist/hooks/shims/hermes.d.ts.map +1 -1
- package/dist/hooks/shims/hermes.js +9 -45
- package/dist/hooks/shims/hermes.js.map +1 -1
- package/dist/index.d.ts +33 -76
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -67
- package/dist/index.js.map +1 -1
- package/dist/lang/bash.d.ts.map +1 -1
- package/dist/lang/bash.js.map +1 -1
- package/dist/lang/c.d.ts.map +1 -1
- package/dist/lang/c.js.map +1 -1
- package/dist/lang/c_sharp.d.ts.map +1 -1
- package/dist/lang/c_sharp.js.map +1 -1
- package/dist/lang/cpp.d.ts.map +1 -1
- package/dist/lang/cpp.js.map +1 -1
- package/dist/lang/go.d.ts.map +1 -1
- package/dist/lang/go.js.map +1 -1
- package/dist/lang/java.d.ts.map +1 -1
- package/dist/lang/java.js.map +1 -1
- package/dist/lang/javascript.d.ts.map +1 -1
- package/dist/lang/javascript.js.map +1 -1
- package/dist/lang/kotlin.d.ts.map +1 -1
- package/dist/lang/kotlin.js.map +1 -1
- package/dist/lang/php.d.ts.map +1 -1
- package/dist/lang/php.js.map +1 -1
- package/dist/lang/profile.d.ts.map +1 -1
- package/dist/lang/profile.js.map +1 -1
- package/dist/lang/python.d.ts.map +1 -1
- package/dist/lang/python.js.map +1 -1
- package/dist/lang/registry.d.ts.map +1 -1
- package/dist/lang/registry.js.map +1 -1
- package/dist/lang/ruby.d.ts.map +1 -1
- package/dist/lang/ruby.js.map +1 -1
- package/dist/lang/rust.d.ts.map +1 -1
- package/dist/lang/rust.js.map +1 -1
- package/dist/lang/swift.d.ts.map +1 -1
- package/dist/lang/swift.js.map +1 -1
- package/dist/lang/tsx.d.ts.map +1 -1
- package/dist/lang/tsx.js.map +1 -1
- package/dist/lang/typescript.d.ts.map +1 -1
- package/dist/lang/typescript.js.map +1 -1
- package/dist/net/policy.d.ts +18 -1
- package/dist/net/policy.d.ts.map +1 -1
- package/dist/net/policy.js +6 -4
- package/dist/net/policy.js.map +1 -1
- package/dist/ops/index.d.ts +39 -0
- package/dist/ops/index.d.ts.map +1 -0
- package/dist/ops/index.js +37 -0
- package/dist/ops/index.js.map +1 -0
- package/dist/ops/inputs.d.ts +170 -0
- package/dist/ops/inputs.d.ts.map +1 -0
- package/dist/ops/inputs.js +142 -0
- package/dist/ops/inputs.js.map +1 -0
- package/dist/ops/verbs.d.ts +136 -0
- package/dist/ops/verbs.d.ts.map +1 -0
- package/dist/ops/verbs.js +76 -0
- package/dist/ops/verbs.js.map +1 -0
- package/dist/plan/auto.d.ts +69 -0
- package/dist/plan/auto.d.ts.map +1 -0
- package/dist/plan/auto.js +70 -0
- package/dist/plan/auto.js.map +1 -0
- package/dist/plan/budget.d.ts +21 -0
- package/dist/plan/budget.d.ts.map +1 -0
- package/dist/plan/budget.js +26 -0
- package/dist/plan/budget.js.map +1 -0
- package/dist/plan/grammar.d.ts +14 -0
- package/dist/plan/grammar.d.ts.map +1 -1
- package/dist/plan/grammar.js +47 -6
- package/dist/plan/grammar.js.map +1 -1
- package/dist/plan/lexical.d.ts.map +1 -1
- package/dist/plan/lexical.js +1 -7
- package/dist/plan/lexical.js.map +1 -1
- package/dist/plan/planners.d.ts +35 -2
- package/dist/plan/planners.d.ts.map +1 -1
- package/dist/plan/planners.js +35 -2
- package/dist/plan/planners.js.map +1 -1
- package/dist/plan/structural.d.ts +19 -5
- package/dist/plan/structural.d.ts.map +1 -1
- package/dist/plan/structural.js +180 -33
- package/dist/plan/structural.js.map +1 -1
- package/dist/repomap/cache.d.ts +48 -0
- package/dist/repomap/cache.d.ts.map +1 -1
- package/dist/repomap/cache.js +112 -13
- package/dist/repomap/cache.js.map +1 -1
- package/dist/repomap/io.d.ts +24 -0
- package/dist/repomap/io.d.ts.map +1 -0
- package/dist/repomap/io.js +34 -0
- package/dist/repomap/io.js.map +1 -0
- package/dist/repomap/map.d.ts +69 -6
- package/dist/repomap/map.d.ts.map +1 -1
- package/dist/repomap/map.js +104 -22
- package/dist/repomap/map.js.map +1 -1
- package/dist/repomap/rank.d.ts +26 -2
- package/dist/repomap/rank.d.ts.map +1 -1
- package/dist/repomap/rank.js +20 -0
- package/dist/repomap/rank.js.map +1 -1
- package/dist/repomap/reader.d.ts +73 -0
- package/dist/repomap/reader.d.ts.map +1 -0
- package/dist/repomap/reader.js +30 -0
- package/dist/repomap/reader.js.map +1 -0
- package/dist/repomap/tags.d.ts.map +1 -1
- package/dist/repomap/tags.js.map +1 -1
- package/dist/retrieve.d.ts +8 -0
- package/dist/retrieve.d.ts.map +1 -1
- package/dist/retrieve.js +12 -1
- package/dist/retrieve.js.map +1 -1
- package/dist/smelter.d.ts +79 -0
- package/dist/smelter.d.ts.map +1 -0
- package/dist/smelter.js +65 -0
- package/dist/smelter.js.map +1 -0
- package/dist/stages.d.ts.map +1 -1
- package/dist/stages.js +2 -2
- package/dist/stages.js.map +1 -1
- package/dist/stats.d.ts +2 -1
- package/dist/stats.d.ts.map +1 -1
- package/dist/stats.js +2 -1
- package/dist/stats.js.map +1 -1
- package/dist/store-dir.d.ts +43 -4
- package/dist/store-dir.d.ts.map +1 -1
- package/dist/store-dir.js +48 -5
- package/dist/store-dir.js.map +1 -1
- package/dist/store.d.ts +6 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +6 -0
- package/dist/store.js.map +1 -1
- package/dist/types.d.ts +35 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/grammars/tree-sitter-bash.wasm +0 -0
- package/grammars/tree-sitter-c.wasm +0 -0
- package/grammars/tree-sitter-c_sharp.wasm +0 -0
- package/grammars/tree-sitter-cpp.wasm +0 -0
- package/grammars/tree-sitter-go.wasm +0 -0
- package/grammars/tree-sitter-java.wasm +0 -0
- package/grammars/tree-sitter-javascript.wasm +0 -0
- package/grammars/tree-sitter-kotlin.wasm +0 -0
- package/grammars/tree-sitter-php.wasm +0 -0
- package/grammars/tree-sitter-python.wasm +0 -0
- package/grammars/tree-sitter-ruby.wasm +0 -0
- package/grammars/tree-sitter-rust.wasm +0 -0
- package/grammars/tree-sitter-swift.wasm +0 -0
- package/grammars/tree-sitter-tsx.wasm +0 -0
- package/grammars/tree-sitter-typescript.wasm +0 -0
- package/package.json +11 -11
- package/dist/cli/resolve.d.ts +0 -103
- package/dist/cli/resolve.d.ts.map +0 -1
- package/dist/cli/resolve.js +0 -106
- package/dist/cli/resolve.js.map +0 -1
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
import type { ShimAdapter } from '../shim.ts';
|
|
2
2
|
/**
|
|
3
|
-
* Claude Code shim — VERIFIED tier.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - stdin: `{ hook_event_name: "PreToolUse", tool_name, tool_input, cwd }`. For
|
|
9
|
-
* `Read`, `tool_input.file_path` is already absolute and `offset`/`limit` mark a
|
|
10
|
-
* windowed read; for `Bash`, `tool_input.command` is the full command string, and
|
|
11
|
-
* a relative path in it resolves against the payload's `cwd` — the *session's*
|
|
12
|
-
* working directory, which after the model `cd`s differs from this hook
|
|
13
|
-
* process's own cwd.
|
|
14
|
-
* - deny: `hookSpecificOutput.permissionDecision: "deny"` with
|
|
15
|
-
* `permissionDecisionReason` — which is **shown to the model**, so the guard's
|
|
16
|
-
* reason (the exact replacement command, the `smelt retrieve` contract) lands in
|
|
17
|
-
* the transcript as steering.
|
|
18
|
-
* - rewrite (opt-in, `hooks.enforcement: "rewrite"`): `updatedInput` replaces the
|
|
19
|
-
* entire input object of the *same* tool (v2.0.10+), so a Bash command can be
|
|
20
|
-
* substituted but a Read can never become a Bash call — Reads deny in every mode.
|
|
3
|
+
* Claude Code shim — VERIFIED tier. The runnable front door only: every fact about this
|
|
4
|
+
* harness, its hook schema included, lives in its profile
|
|
5
|
+
* (`src/harness/claude-code.ts`), and `shimFromSchema` turns that schema into the
|
|
6
|
+
* adapter below. The installer wires `node dist/hooks/shims/claude-code.js` as the
|
|
7
|
+
* harness's hook command; this file is what that runs.
|
|
21
8
|
*/
|
|
22
9
|
export declare const adapter: ShimAdapter;
|
|
23
10
|
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/claude-code.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/claude-code.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,WAAuC,CAAC","sourcesContent":["import { claudeCode } from '../../harness/claude-code.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Claude Code shim — VERIFIED tier. The runnable front door only: every fact about this\n * harness, its hook schema included, lives in its profile\n * (`src/harness/claude-code.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/claude-code.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(claudeCode);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|
|
@@ -1,61 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { claudeCode } from '../../harness/claude-code.js';
|
|
2
|
+
import { shimAdapterOf } from '../../harness/profile.js';
|
|
3
|
+
import { isMainModule, runShimMain } from '../shim.js';
|
|
2
4
|
/**
|
|
3
|
-
* Claude Code shim — VERIFIED tier.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - stdin: `{ hook_event_name: "PreToolUse", tool_name, tool_input, cwd }`. For
|
|
9
|
-
* `Read`, `tool_input.file_path` is already absolute and `offset`/`limit` mark a
|
|
10
|
-
* windowed read; for `Bash`, `tool_input.command` is the full command string, and
|
|
11
|
-
* a relative path in it resolves against the payload's `cwd` — the *session's*
|
|
12
|
-
* working directory, which after the model `cd`s differs from this hook
|
|
13
|
-
* process's own cwd.
|
|
14
|
-
* - deny: `hookSpecificOutput.permissionDecision: "deny"` with
|
|
15
|
-
* `permissionDecisionReason` — which is **shown to the model**, so the guard's
|
|
16
|
-
* reason (the exact replacement command, the `smelt retrieve` contract) lands in
|
|
17
|
-
* the transcript as steering.
|
|
18
|
-
* - rewrite (opt-in, `hooks.enforcement: "rewrite"`): `updatedInput` replaces the
|
|
19
|
-
* entire input object of the *same* tool (v2.0.10+), so a Bash command can be
|
|
20
|
-
* substituted but a Read can never become a Bash call — Reads deny in every mode.
|
|
5
|
+
* Claude Code shim — VERIFIED tier. The runnable front door only: every fact about this
|
|
6
|
+
* harness, its hook schema included, lives in its profile
|
|
7
|
+
* (`src/harness/claude-code.ts`), and `shimFromSchema` turns that schema into the
|
|
8
|
+
* adapter below. The installer wires `node dist/hooks/shims/claude-code.js` as the
|
|
9
|
+
* harness's hook command; this file is what that runs.
|
|
21
10
|
*/
|
|
22
|
-
export const adapter =
|
|
23
|
-
toRequest: (raw) => {
|
|
24
|
-
const fields = asRecord(raw);
|
|
25
|
-
return toolCallRequest(fields['tool_name'], fields['tool_input'], {
|
|
26
|
-
read: ['Read'],
|
|
27
|
-
bash: ['Bash'],
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
cwd: (raw) => {
|
|
31
|
-
const cwd = asRecord(raw)['cwd'];
|
|
32
|
-
return typeof cwd === 'string' && cwd !== '' ? cwd : undefined;
|
|
33
|
-
},
|
|
34
|
-
pass: () => ({ stdout: '', exitCode: 0 }),
|
|
35
|
-
deny: (_raw, _request, decision) => ({
|
|
36
|
-
stdout: `${JSON.stringify({
|
|
37
|
-
hookSpecificOutput: {
|
|
38
|
-
hookEventName: 'PreToolUse',
|
|
39
|
-
permissionDecision: 'deny',
|
|
40
|
-
permissionDecisionReason: decision.reason ?? 'denied by the smelt guard',
|
|
41
|
-
},
|
|
42
|
-
})}\n`,
|
|
43
|
-
exitCode: 0,
|
|
44
|
-
}),
|
|
45
|
-
rewrite: (raw, _request, decision) => ({
|
|
46
|
-
stdout: `${JSON.stringify({
|
|
47
|
-
hookSpecificOutput: {
|
|
48
|
-
hookEventName: 'PreToolUse',
|
|
49
|
-
permissionDecision: 'allow',
|
|
50
|
-
permissionDecisionReason: `smelt rewrote this command (hooks.enforcement: "rewrite"): ` +
|
|
51
|
-
`${decision.suggestion ?? ''}`,
|
|
52
|
-
// updatedInput replaces the whole input object — unchanged fields ride along.
|
|
53
|
-
updatedInput: { ...asRecord(asRecord(raw)['tool_input']), command: decision.suggestion },
|
|
54
|
-
},
|
|
55
|
-
})}\n`,
|
|
56
|
-
exitCode: 0,
|
|
57
|
-
}),
|
|
58
|
-
};
|
|
11
|
+
export const adapter = shimAdapterOf(claudeCode);
|
|
59
12
|
if (isMainModule(import.meta.url))
|
|
60
13
|
runShimMain(adapter);
|
|
61
14
|
//# sourceMappingURL=claude-code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../../src/hooks/shims/claude-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../../src/hooks/shims/claude-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAgB,aAAa,CAAC,UAAU,CAAC,CAAC;AAE9D,IAAI,YAAY,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC;IAAE,WAAW,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import { claudeCode } from '../../harness/claude-code.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Claude Code shim — VERIFIED tier. The runnable front door only: every fact about this\n * harness, its hook schema included, lives in its profile\n * (`src/harness/claude-code.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/claude-code.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(claudeCode);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import type { ShimAdapter } from '../shim.ts';
|
|
2
2
|
/**
|
|
3
|
-
* Cline shim — EXPERIMENTAL tier
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - event: `PreToolUse`, delivered to an executable under `.clinerules/hooks/`;
|
|
9
|
-
* stdin carries the tool call (accepted spellings: `tool_name`/`tool_input`,
|
|
10
|
-
* `toolName`/`toolInput`, or nested under `preToolUse`).
|
|
11
|
-
* - deny: `{ "cancel": true, "errorMessage": … }`. **Deny-only**: the response
|
|
12
|
-
* schema has no input-modification field, so under
|
|
13
|
-
* `hooks.enforcement: "rewrite"` this harness falls back to the deny, whose
|
|
14
|
-
* reason still carries the exact replacement pipeline.
|
|
3
|
+
* Cline shim — EXPERIMENTAL tier. The runnable front door only: every fact about this
|
|
4
|
+
* harness, its hook schema included, lives in its profile
|
|
5
|
+
* (`src/harness/cline.ts`), and `shimFromSchema` turns that schema into the
|
|
6
|
+
* adapter below. The installer wires `node dist/hooks/shims/cline.js` as the
|
|
7
|
+
* harness's hook command; this file is what that runs.
|
|
15
8
|
*/
|
|
16
9
|
export declare const adapter: ShimAdapter;
|
|
17
10
|
//# sourceMappingURL=cline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cline.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/cline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cline.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/cline.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,WAAkC,CAAC","sourcesContent":["import { cline } from '../../harness/cline.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Cline shim — EXPERIMENTAL tier. The runnable front door only: every fact about this\n * harness, its hook schema included, lives in its profile\n * (`src/harness/cline.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/cline.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(cline);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|
|
@@ -1,39 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cline } from '../../harness/cline.js';
|
|
2
|
+
import { shimAdapterOf } from '../../harness/profile.js';
|
|
3
|
+
import { isMainModule, runShimMain } from '../shim.js';
|
|
2
4
|
/**
|
|
3
|
-
* Cline shim — EXPERIMENTAL tier
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - event: `PreToolUse`, delivered to an executable under `.clinerules/hooks/`;
|
|
9
|
-
* stdin carries the tool call (accepted spellings: `tool_name`/`tool_input`,
|
|
10
|
-
* `toolName`/`toolInput`, or nested under `preToolUse`).
|
|
11
|
-
* - deny: `{ "cancel": true, "errorMessage": … }`. **Deny-only**: the response
|
|
12
|
-
* schema has no input-modification field, so under
|
|
13
|
-
* `hooks.enforcement: "rewrite"` this harness falls back to the deny, whose
|
|
14
|
-
* reason still carries the exact replacement pipeline.
|
|
5
|
+
* Cline shim — EXPERIMENTAL tier. The runnable front door only: every fact about this
|
|
6
|
+
* harness, its hook schema included, lives in its profile
|
|
7
|
+
* (`src/harness/cline.ts`), and `shimFromSchema` turns that schema into the
|
|
8
|
+
* adapter below. The installer wires `node dist/hooks/shims/cline.js` as the
|
|
9
|
+
* harness's hook command; this file is what that runs.
|
|
15
10
|
*/
|
|
16
|
-
export const adapter =
|
|
17
|
-
toRequest: (raw) => {
|
|
18
|
-
const fields = asRecord(raw);
|
|
19
|
-
const nested = asRecord(fields['preToolUse']);
|
|
20
|
-
const name = fields['tool_name'] ?? fields['toolName'] ?? nested['toolName'] ?? nested['tool'];
|
|
21
|
-
const input = fields['tool_input'] ?? fields['toolInput'] ?? nested['toolInput'] ?? nested['input'];
|
|
22
|
-
return toolCallRequest(name, input, {
|
|
23
|
-
read: ['Read', 'read_file', 'readFile'],
|
|
24
|
-
bash: ['Bash', 'execute_command', 'executeCommand', 'shell'],
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
pass: () => ({ stdout: '', exitCode: 0 }),
|
|
28
|
-
deny: (_raw, _request, decision) => ({
|
|
29
|
-
stdout: `${JSON.stringify({
|
|
30
|
-
cancel: true,
|
|
31
|
-
errorMessage: decision.reason ?? 'denied by the smelt guard',
|
|
32
|
-
})}\n`,
|
|
33
|
-
exitCode: 0,
|
|
34
|
-
}),
|
|
35
|
-
// No `rewrite`: Cline's PreToolUse response cannot modify tool input (deny-only).
|
|
36
|
-
};
|
|
11
|
+
export const adapter = shimAdapterOf(cline);
|
|
37
12
|
if (isMainModule(import.meta.url))
|
|
38
13
|
runShimMain(adapter);
|
|
39
14
|
//# sourceMappingURL=cline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cline.js","sourceRoot":"","sources":["../../../src/hooks/shims/cline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cline.js","sourceRoot":"","sources":["../../../src/hooks/shims/cline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAgB,aAAa,CAAC,KAAK,CAAC,CAAC;AAEzD,IAAI,YAAY,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC;IAAE,WAAW,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import { cline } from '../../harness/cline.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Cline shim — EXPERIMENTAL tier. The runnable front door only: every fact about this\n * harness, its hook schema included, lives in its profile\n * (`src/harness/cline.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/cline.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(cline);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
import type { ShimAdapter } from '../shim.ts';
|
|
2
2
|
/**
|
|
3
|
-
* Codex CLI shim — VERIFIED tier.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* <https://developers.openai.com/codex/hooks>:
|
|
9
|
-
*
|
|
10
|
-
* - stdin: `{ tool_name, tool_input }`; shell input arrives as `tool_name: "Bash"`,
|
|
11
|
-
* `tool_input.command`.
|
|
12
|
-
* - deny: `hookSpecificOutput.permissionDecision: "deny"` + reason (or exit 2).
|
|
13
|
-
* - rewrite: `permissionDecision: "allow"` with `updatedInput` — for Bash,
|
|
14
|
-
* `updatedInput` **must include a string `command` field**, which this shim's
|
|
15
|
-
* rewrite always does.
|
|
16
|
-
*
|
|
17
|
-
* Two documented differences from Claude Code, both honoured here:
|
|
18
|
-
* `permissionDecision: "ask"` is NOT supported (a parse error — the tool proceeds),
|
|
19
|
-
* and this shim never emits it; project-layer hooks only run once the project is
|
|
20
|
-
* trusted, which the installer's output says out loud.
|
|
3
|
+
* Codex CLI shim — VERIFIED tier. The runnable front door only: every fact about this
|
|
4
|
+
* harness, its hook schema included, lives in its profile
|
|
5
|
+
* (`src/harness/codex.ts`), and `shimFromSchema` turns that schema into the
|
|
6
|
+
* adapter below. The installer wires `node dist/hooks/shims/codex.js` as the
|
|
7
|
+
* harness's hook command; this file is what that runs.
|
|
21
8
|
*/
|
|
22
9
|
export declare const adapter: ShimAdapter;
|
|
23
10
|
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/codex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/codex.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,WAAkC,CAAC","sourcesContent":["import { codex } from '../../harness/codex.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Codex CLI shim — VERIFIED tier. The runnable front door only: every fact about this\n * harness, its hook schema included, lives in its profile\n * (`src/harness/codex.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/codex.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(codex);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|
|
@@ -1,56 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { codex } from '../../harness/codex.js';
|
|
2
|
+
import { shimAdapterOf } from '../../harness/profile.js';
|
|
3
|
+
import { isMainModule, runShimMain } from '../shim.js';
|
|
2
4
|
/**
|
|
3
|
-
* Codex CLI shim — VERIFIED tier.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* <https://developers.openai.com/codex/hooks>:
|
|
9
|
-
*
|
|
10
|
-
* - stdin: `{ tool_name, tool_input }`; shell input arrives as `tool_name: "Bash"`,
|
|
11
|
-
* `tool_input.command`.
|
|
12
|
-
* - deny: `hookSpecificOutput.permissionDecision: "deny"` + reason (or exit 2).
|
|
13
|
-
* - rewrite: `permissionDecision: "allow"` with `updatedInput` — for Bash,
|
|
14
|
-
* `updatedInput` **must include a string `command` field**, which this shim's
|
|
15
|
-
* rewrite always does.
|
|
16
|
-
*
|
|
17
|
-
* Two documented differences from Claude Code, both honoured here:
|
|
18
|
-
* `permissionDecision: "ask"` is NOT supported (a parse error — the tool proceeds),
|
|
19
|
-
* and this shim never emits it; project-layer hooks only run once the project is
|
|
20
|
-
* trusted, which the installer's output says out loud.
|
|
5
|
+
* Codex CLI shim — VERIFIED tier. The runnable front door only: every fact about this
|
|
6
|
+
* harness, its hook schema included, lives in its profile
|
|
7
|
+
* (`src/harness/codex.ts`), and `shimFromSchema` turns that schema into the
|
|
8
|
+
* adapter below. The installer wires `node dist/hooks/shims/codex.js` as the
|
|
9
|
+
* harness's hook command; this file is what that runs.
|
|
21
10
|
*/
|
|
22
|
-
export const adapter =
|
|
23
|
-
toRequest: (raw) => {
|
|
24
|
-
const fields = asRecord(raw);
|
|
25
|
-
return toolCallRequest(fields['tool_name'], fields['tool_input'], {
|
|
26
|
-
read: ['Read'],
|
|
27
|
-
bash: ['Bash', 'shell'],
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
pass: () => ({ stdout: '', exitCode: 0 }),
|
|
31
|
-
deny: (_raw, _request, decision) => ({
|
|
32
|
-
stdout: `${JSON.stringify({
|
|
33
|
-
hookSpecificOutput: {
|
|
34
|
-
hookEventName: 'PreToolUse',
|
|
35
|
-
permissionDecision: 'deny',
|
|
36
|
-
permissionDecisionReason: decision.reason ?? 'denied by the smelt guard',
|
|
37
|
-
},
|
|
38
|
-
})}\n`,
|
|
39
|
-
exitCode: 0,
|
|
40
|
-
}),
|
|
41
|
-
rewrite: (raw, _request, decision) => ({
|
|
42
|
-
stdout: `${JSON.stringify({
|
|
43
|
-
hookSpecificOutput: {
|
|
44
|
-
hookEventName: 'PreToolUse',
|
|
45
|
-
permissionDecision: 'allow',
|
|
46
|
-
permissionDecisionReason: `smelt rewrote this command (hooks.enforcement: "rewrite"): ` +
|
|
47
|
-
`${decision.suggestion ?? ''}`,
|
|
48
|
-
updatedInput: { ...asRecord(asRecord(raw)['tool_input']), command: decision.suggestion },
|
|
49
|
-
},
|
|
50
|
-
})}\n`,
|
|
51
|
-
exitCode: 0,
|
|
52
|
-
}),
|
|
53
|
-
};
|
|
11
|
+
export const adapter = shimAdapterOf(codex);
|
|
54
12
|
if (isMainModule(import.meta.url))
|
|
55
13
|
runShimMain(adapter);
|
|
56
14
|
//# sourceMappingURL=codex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/hooks/shims/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/hooks/shims/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAgB,aAAa,CAAC,KAAK,CAAC,CAAC;AAEzD,IAAI,YAAY,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC;IAAE,WAAW,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import { codex } from '../../harness/codex.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Codex CLI shim — VERIFIED tier. The runnable front door only: every fact about this\n * harness, its hook schema included, lives in its profile\n * (`src/harness/codex.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/codex.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(codex);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import type { ShimAdapter } from '../shim.ts';
|
|
2
2
|
/**
|
|
3
|
-
* Cursor
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - event: `preToolUse` (the broad hook — unlike `beforeShellExecution`, it
|
|
9
|
-
* supports input rewrite); stdin `{ tool_name, tool_input }`.
|
|
10
|
-
* - deny: `{ "permission": "deny", "agentMessage": … }` — `agentMessage` reaches
|
|
11
|
-
* the model, `userMessage` the human; the guard's steering text goes to the model.
|
|
12
|
-
* - rewrite: `{ "permission": "allow", "updated_input": { … } }` (snake_case, the
|
|
13
|
-
* whole input object).
|
|
14
|
-
*
|
|
15
|
-
* Cursor has no static permission-config file — gating is entirely hook code — so
|
|
16
|
-
* this shim plus the instruction file is the whole enforcement story there.
|
|
3
|
+
* Cursor shim — EXPERIMENTAL tier. The runnable front door only: every fact about this
|
|
4
|
+
* harness, its hook schema included, lives in its profile
|
|
5
|
+
* (`src/harness/cursor.ts`), and `shimFromSchema` turns that schema into the
|
|
6
|
+
* adapter below. The installer wires `node dist/hooks/shims/cursor.js` as the
|
|
7
|
+
* harness's hook command; this file is what that runs.
|
|
17
8
|
*/
|
|
18
9
|
export declare const adapter: ShimAdapter;
|
|
19
10
|
//# sourceMappingURL=cursor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/cursor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/cursor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,WAAmC,CAAC","sourcesContent":["import { cursor } from '../../harness/cursor.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Cursor shim — EXPERIMENTAL tier. The runnable front door only: every fact about this\n * harness, its hook schema included, lives in its profile\n * (`src/harness/cursor.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/cursor.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(cursor);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|
|
@@ -1,47 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cursor } from '../../harness/cursor.js';
|
|
2
|
+
import { shimAdapterOf } from '../../harness/profile.js';
|
|
3
|
+
import { isMainModule, runShimMain } from '../shim.js';
|
|
2
4
|
/**
|
|
3
|
-
* Cursor
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - event: `preToolUse` (the broad hook — unlike `beforeShellExecution`, it
|
|
9
|
-
* supports input rewrite); stdin `{ tool_name, tool_input }`.
|
|
10
|
-
* - deny: `{ "permission": "deny", "agentMessage": … }` — `agentMessage` reaches
|
|
11
|
-
* the model, `userMessage` the human; the guard's steering text goes to the model.
|
|
12
|
-
* - rewrite: `{ "permission": "allow", "updated_input": { … } }` (snake_case, the
|
|
13
|
-
* whole input object).
|
|
14
|
-
*
|
|
15
|
-
* Cursor has no static permission-config file — gating is entirely hook code — so
|
|
16
|
-
* this shim plus the instruction file is the whole enforcement story there.
|
|
5
|
+
* Cursor shim — EXPERIMENTAL tier. The runnable front door only: every fact about this
|
|
6
|
+
* harness, its hook schema included, lives in its profile
|
|
7
|
+
* (`src/harness/cursor.ts`), and `shimFromSchema` turns that schema into the
|
|
8
|
+
* adapter below. The installer wires `node dist/hooks/shims/cursor.js` as the
|
|
9
|
+
* harness's hook command; this file is what that runs.
|
|
17
10
|
*/
|
|
18
|
-
export const adapter =
|
|
19
|
-
toRequest: (raw) => {
|
|
20
|
-
const fields = asRecord(raw);
|
|
21
|
-
return toolCallRequest(fields['tool_name'], fields['tool_input'], {
|
|
22
|
-
read: ['read_file', 'Read', 'ReadFile'],
|
|
23
|
-
bash: ['run_terminal_cmd', 'Shell', 'Bash', 'shell'],
|
|
24
|
-
});
|
|
25
|
-
},
|
|
26
|
-
pass: () => ({ stdout: '', exitCode: 0 }),
|
|
27
|
-
deny: (_raw, _request, decision) => ({
|
|
28
|
-
stdout: `${JSON.stringify({
|
|
29
|
-
permission: 'deny',
|
|
30
|
-
agentMessage: decision.reason ?? 'denied by the smelt guard',
|
|
31
|
-
})}\n`,
|
|
32
|
-
exitCode: 0,
|
|
33
|
-
}),
|
|
34
|
-
rewrite: (raw, _request, decision) => ({
|
|
35
|
-
stdout: `${JSON.stringify({
|
|
36
|
-
permission: 'allow',
|
|
37
|
-
updated_input: { ...asRecord(asRecord(raw)['tool_input']), command: decision.suggestion },
|
|
38
|
-
})}\n`,
|
|
39
|
-
// The allow/updated_input shape carries no message field — announce on stderr.
|
|
40
|
-
stderr: `smelt guard (rewrite mode): substituted the command in-flight with ` +
|
|
41
|
-
`\`${decision.suggestion ?? ''}\`. ${decision.reason ?? ''}\n`,
|
|
42
|
-
exitCode: 0,
|
|
43
|
-
}),
|
|
44
|
-
};
|
|
11
|
+
export const adapter = shimAdapterOf(cursor);
|
|
45
12
|
if (isMainModule(import.meta.url))
|
|
46
13
|
runShimMain(adapter);
|
|
47
14
|
//# sourceMappingURL=cursor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/hooks/shims/cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/hooks/shims/cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAgB,aAAa,CAAC,MAAM,CAAC,CAAC;AAE1D,IAAI,YAAY,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC;IAAE,WAAW,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import { cursor } from '../../harness/cursor.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Cursor shim — EXPERIMENTAL tier. The runnable front door only: every fact about this\n * harness, its hook schema included, lives in its profile\n * (`src/harness/cursor.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/cursor.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(cursor);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
import type { ShimAdapter } from '../shim.ts';
|
|
2
2
|
/**
|
|
3
|
-
* Gemini CLI shim — EXPERIMENTAL tier
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* verification pass): the BeforeTool stdin payload is `{ tool_name, tool_input }`,
|
|
9
|
-
* `read_file` takes `file_path` with `start_line`/`end_line` windows, the shell
|
|
10
|
-
* tool is `run_shell_command` with `command`, denial is `{ "decision": "deny",
|
|
11
|
-
* "reason": … }`, and `hookSpecificOutput.tool_input` substitutes the input. What
|
|
12
|
-
* has NOT run is a live end-to-end session (needs credentials this environment does
|
|
13
|
-
* not have), so the tier stays experimental — treat surprises as shim bugs and
|
|
14
|
-
* please report them.
|
|
15
|
-
*
|
|
16
|
-
* Carried caveat from the matrix: Gemini's policy engine has an open bug where an
|
|
17
|
-
* `allow` policy is ignored in non-interactive runs
|
|
18
|
-
* (<https://github.com/google-gemini/gemini-cli/issues/20469>) — this preset uses
|
|
19
|
-
* hooks, not the policy engine, but non-interactive behaviour is the least-tested
|
|
20
|
-
* corner; verify before relying on it in CI.
|
|
3
|
+
* Gemini CLI shim — EXPERIMENTAL tier. The runnable front door only: every fact about this
|
|
4
|
+
* harness, its hook schema included, lives in its profile
|
|
5
|
+
* (`src/harness/gemini.ts`), and `shimFromSchema` turns that schema into the
|
|
6
|
+
* adapter below. The installer wires `node dist/hooks/shims/gemini.js` as the
|
|
7
|
+
* harness's hook command; this file is what that runs.
|
|
21
8
|
*/
|
|
22
9
|
export declare const adapter: ShimAdapter;
|
|
23
10
|
//# sourceMappingURL=gemini.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/gemini.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/gemini.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,WAAmC,CAAC","sourcesContent":["import { gemini } from '../../harness/gemini.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Gemini CLI shim — EXPERIMENTAL tier. The runnable front door only: every fact about this\n * harness, its hook schema included, lives in its profile\n * (`src/harness/gemini.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/gemini.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(gemini);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|
|
@@ -1,53 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { gemini } from '../../harness/gemini.js';
|
|
2
|
+
import { shimAdapterOf } from '../../harness/profile.js';
|
|
3
|
+
import { isMainModule, runShimMain } from '../shim.js';
|
|
2
4
|
/**
|
|
3
|
-
* Gemini CLI shim — EXPERIMENTAL tier
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* verification pass): the BeforeTool stdin payload is `{ tool_name, tool_input }`,
|
|
9
|
-
* `read_file` takes `file_path` with `start_line`/`end_line` windows, the shell
|
|
10
|
-
* tool is `run_shell_command` with `command`, denial is `{ "decision": "deny",
|
|
11
|
-
* "reason": … }`, and `hookSpecificOutput.tool_input` substitutes the input. What
|
|
12
|
-
* has NOT run is a live end-to-end session (needs credentials this environment does
|
|
13
|
-
* not have), so the tier stays experimental — treat surprises as shim bugs and
|
|
14
|
-
* please report them.
|
|
15
|
-
*
|
|
16
|
-
* Carried caveat from the matrix: Gemini's policy engine has an open bug where an
|
|
17
|
-
* `allow` policy is ignored in non-interactive runs
|
|
18
|
-
* (<https://github.com/google-gemini/gemini-cli/issues/20469>) — this preset uses
|
|
19
|
-
* hooks, not the policy engine, but non-interactive behaviour is the least-tested
|
|
20
|
-
* corner; verify before relying on it in CI.
|
|
5
|
+
* Gemini CLI shim — EXPERIMENTAL tier. The runnable front door only: every fact about this
|
|
6
|
+
* harness, its hook schema included, lives in its profile
|
|
7
|
+
* (`src/harness/gemini.ts`), and `shimFromSchema` turns that schema into the
|
|
8
|
+
* adapter below. The installer wires `node dist/hooks/shims/gemini.js` as the
|
|
9
|
+
* harness's hook command; this file is what that runs.
|
|
21
10
|
*/
|
|
22
|
-
export const adapter =
|
|
23
|
-
toRequest: (raw) => {
|
|
24
|
-
const fields = asRecord(raw);
|
|
25
|
-
return toolCallRequest(fields['tool_name'], fields['tool_input'], {
|
|
26
|
-
read: ['read_file', 'ReadFile', 'Read'],
|
|
27
|
-
bash: ['run_shell_command', 'Shell', 'Bash'],
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
pass: () => ({ stdout: '', exitCode: 0 }),
|
|
31
|
-
deny: (_raw, _request, decision) => ({
|
|
32
|
-
stdout: `${JSON.stringify({
|
|
33
|
-
decision: 'deny',
|
|
34
|
-
reason: decision.reason ?? 'denied by the smelt guard',
|
|
35
|
-
})}\n`,
|
|
36
|
-
exitCode: 0,
|
|
37
|
-
}),
|
|
38
|
-
rewrite: (raw, _request, decision) => ({
|
|
39
|
-
stdout: `${JSON.stringify({
|
|
40
|
-
hookSpecificOutput: {
|
|
41
|
-
hookEventName: 'BeforeTool',
|
|
42
|
-
tool_input: { ...asRecord(asRecord(raw)['tool_input']), command: decision.suggestion },
|
|
43
|
-
},
|
|
44
|
-
})}\n`,
|
|
45
|
-
// The BeforeTool rewrite shape carries no reason field — announce on stderr.
|
|
46
|
-
stderr: `smelt guard (rewrite mode): substituted the command in-flight with ` +
|
|
47
|
-
`\`${decision.suggestion ?? ''}\`. ${decision.reason ?? ''}\n`,
|
|
48
|
-
exitCode: 0,
|
|
49
|
-
}),
|
|
50
|
-
};
|
|
11
|
+
export const adapter = shimAdapterOf(gemini);
|
|
51
12
|
if (isMainModule(import.meta.url))
|
|
52
13
|
runShimMain(adapter);
|
|
53
14
|
//# sourceMappingURL=gemini.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../src/hooks/shims/gemini.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../src/hooks/shims/gemini.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAgB,aAAa,CAAC,MAAM,CAAC,CAAC;AAE1D,IAAI,YAAY,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC;IAAE,WAAW,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import { gemini } from '../../harness/gemini.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Gemini CLI shim — EXPERIMENTAL tier. The runnable front door only: every fact about this\n * harness, its hook schema included, lives in its profile\n * (`src/harness/gemini.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/gemini.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(gemini);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import type { ShimAdapter } from '../shim.ts';
|
|
2
2
|
/**
|
|
3
|
-
* Grok CLI shim — EXPERIMENTAL tier
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* clone with a different hook surface.
|
|
9
|
-
*
|
|
10
|
-
* - event: `PreToolUse`; stdin `{ tool_name, tool_input }` (Claude-Code-like tool
|
|
11
|
-
* names).
|
|
12
|
-
* - deny: `{ "decision": "deny", "reason": … }` or exit 2. **Deny-only**: the input
|
|
13
|
-
* is read-only to hooks, so there is no rewrite here — under
|
|
14
|
-
* `hooks.enforcement: "rewrite"` this harness falls back to the deny, whose
|
|
15
|
-
* reason still carries the exact replacement pipeline.
|
|
3
|
+
* Grok CLI shim — EXPERIMENTAL tier. The runnable front door only: every fact about this
|
|
4
|
+
* harness, its hook schema included, lives in its profile
|
|
5
|
+
* (`src/harness/grok.ts`), and `shimFromSchema` turns that schema into the
|
|
6
|
+
* adapter below. The installer wires `node dist/hooks/shims/grok.js` as the
|
|
7
|
+
* harness's hook command; this file is what that runs.
|
|
16
8
|
*/
|
|
17
9
|
export declare const adapter: ShimAdapter;
|
|
18
10
|
//# sourceMappingURL=grok.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grok.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/grok.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"grok.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/grok.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,WAAiC,CAAC","sourcesContent":["import { grok } from '../../harness/grok.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Grok CLI shim — EXPERIMENTAL tier. The runnable front door only: every fact about this\n * harness, its hook schema included, lives in its profile\n * (`src/harness/grok.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/grok.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(grok);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|