@smeltjs/core 0.2.0 → 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.
- package/README.md +3 -3
- package/dist/agents/guide.d.ts +68 -0
- package/dist/agents/guide.d.ts.map +1 -0
- package/dist/agents/guide.js +72 -0
- package/dist/agents/guide.js.map +1 -0
- package/dist/agents/instructions.d.ts +133 -0
- package/dist/agents/instructions.d.ts.map +1 -0
- package/dist/agents/instructions.js +212 -0
- package/dist/agents/instructions.js.map +1 -0
- package/dist/agents/lint.d.ts +154 -0
- package/dist/agents/lint.d.ts.map +1 -0
- package/dist/agents/lint.js +761 -0
- package/dist/agents/lint.js.map +1 -0
- package/dist/agents/split.d.ts +113 -0
- package/dist/agents/split.d.ts.map +1 -0
- package/dist/agents/split.js +234 -0
- package/dist/agents/split.js.map +1 -0
- 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/agents.d.ts +39 -0
- package/dist/cli/agents.d.ts.map +1 -0
- package/dist/cli/agents.js +121 -0
- package/dist/cli/agents.js.map +1 -0
- package/dist/cli/args.d.ts +17 -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 +60 -0
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +89 -2
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/hooks.d.ts +55 -51
- package/dist/cli/hooks.d.ts.map +1 -1
- package/dist/cli/hooks.js +206 -658
- 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 +23 -0
- package/dist/cli/report.d.ts.map +1 -1
- package/dist/cli/report.js +142 -4
- package/dist/cli/report.js.map +1 -1
- package/dist/cli/run.d.ts +29 -90
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +34 -342
- 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/agents.d.ts +72 -0
- package/dist/cli/subcommands/agents.d.ts.map +1 -0
- package/dist/cli/subcommands/agents.js +162 -0
- package/dist/cli/subcommands/agents.js.map +1 -0
- package/dist/cli/subcommands/flags.d.ts +144 -0
- package/dist/cli/subcommands/flags.d.ts.map +1 -0
- package/dist/cli/subcommands/flags.js +220 -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 +80 -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 +81 -0
- package/dist/cli/subcommands/registry.d.ts.map +1 -0
- package/dist/cli/subcommands/registry.js +141 -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 +92 -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 +60 -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 +47 -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 +72 -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 +209 -0
- package/dist/harness/profile.d.ts.map +1 -0
- package/dist/harness/profile.js +41 -0
- package/dist/harness/profile.js.map +1 -0
- package/dist/harness/registry.d.ts +100 -0
- package/dist/harness/registry.d.ts.map +1 -0
- package/dist/harness/registry.js +144 -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 +43 -76
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -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/text/json-edit.d.ts +71 -0
- package/dist/text/json-edit.d.ts.map +1 -0
- package/dist/text/json-edit.js +219 -0
- package/dist/text/json-edit.js.map +1 -0
- package/dist/types.d.ts +35 -14
- 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,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"]}
|
package/dist/hooks/shims/grok.js
CHANGED
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { grok } from '../../harness/grok.js';
|
|
2
|
+
import { shimAdapterOf } from '../../harness/profile.js';
|
|
3
|
+
import { isMainModule, runShimMain } from '../shim.js';
|
|
2
4
|
/**
|
|
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.
|
|
5
|
+
* Grok 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/grok.ts`), and `shimFromSchema` turns that schema into the
|
|
8
|
+
* adapter below. The installer wires `node dist/hooks/shims/grok.js` as the
|
|
9
|
+
* harness's hook command; this file is what that runs.
|
|
16
10
|
*/
|
|
17
|
-
export const adapter =
|
|
18
|
-
toRequest: (raw) => {
|
|
19
|
-
const fields = asRecord(raw);
|
|
20
|
-
return toolCallRequest(fields['tool_name'], fields['tool_input'], {
|
|
21
|
-
read: ['Read', 'read_file', 'ReadFile'],
|
|
22
|
-
bash: ['Bash', 'shell', 'run_shell_command'],
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
pass: () => ({ stdout: '', exitCode: 0 }),
|
|
26
|
-
deny: (_raw, _request, decision) => ({
|
|
27
|
-
stdout: `${JSON.stringify({
|
|
28
|
-
decision: 'deny',
|
|
29
|
-
reason: decision.reason ?? 'denied by the smelt guard',
|
|
30
|
-
})}\n`,
|
|
31
|
-
exitCode: 0,
|
|
32
|
-
}),
|
|
33
|
-
// No `rewrite`: Grok's PreToolUse cannot modify tool input (deny-only harness).
|
|
34
|
-
};
|
|
11
|
+
export const adapter = shimAdapterOf(grok);
|
|
35
12
|
if (isMainModule(import.meta.url))
|
|
36
13
|
runShimMain(adapter);
|
|
37
14
|
//# sourceMappingURL=grok.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grok.js","sourceRoot":"","sources":["../../../src/hooks/shims/grok.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"grok.js","sourceRoot":"","sources":["../../../src/hooks/shims/grok.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,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,IAAI,CAAC,CAAC;AAExD,IAAI,YAAY,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC;IAAE,WAAW,CAAC,OAAO,CAAC,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"]}
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import type { ShimAdapter } from '../shim.ts';
|
|
2
2
|
/**
|
|
3
|
-
* Hermes Agent shim — EXPERIMENTAL tier
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - event: `pre_tool_call`; stdin carries the tool name and its arguments
|
|
9
|
-
* (`tool_name` + `args`, with `tool_input` accepted as a fallback spelling).
|
|
10
|
-
* - deny: `{ "action": "block", "reason": … }`.
|
|
11
|
-
* - rewrite: `{ "action": "modify", "args": { … } }` — a **shallow merge** into the
|
|
12
|
-
* tool's arguments, so this shim sends only the `command` key and the harness
|
|
13
|
-
* keeps the rest. The modify schema has **no reason field**, so the substitution
|
|
14
|
-
* is announced on stderr — a rewrite must never be silent.
|
|
15
|
-
*
|
|
16
|
-
* Carried caveat from the matrix: Hermes has a known bypass where memory tools
|
|
17
|
-
* ignore `disabled_toolsets` (<https://github.com/NousResearch/hermes-agent/issues/46171>) —
|
|
18
|
-
* tool gating there is leaky at the edges, so treat this hook as best-effort
|
|
19
|
-
* steering, not a boundary.
|
|
3
|
+
* Hermes Agent 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/hermes.ts`), and `shimFromSchema` turns that schema into the
|
|
6
|
+
* adapter below. The installer wires `node dist/hooks/shims/hermes.js` as the
|
|
7
|
+
* harness's hook command; this file is what that runs.
|
|
20
8
|
*/
|
|
21
9
|
export declare const adapter: ShimAdapter;
|
|
22
10
|
//# sourceMappingURL=hermes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hermes.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/hermes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hermes.d.ts","sourceRoot":"","sources":["../../../src/hooks/shims/hermes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,WAAmC,CAAC","sourcesContent":["import { hermes } from '../../harness/hermes.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Hermes Agent 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/hermes.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/hermes.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(hermes);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|
|
@@ -1,50 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hermes } from '../../harness/hermes.js';
|
|
2
|
+
import { shimAdapterOf } from '../../harness/profile.js';
|
|
3
|
+
import { isMainModule, runShimMain } from '../shim.js';
|
|
2
4
|
/**
|
|
3
|
-
* Hermes Agent shim — EXPERIMENTAL tier
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - event: `pre_tool_call`; stdin carries the tool name and its arguments
|
|
9
|
-
* (`tool_name` + `args`, with `tool_input` accepted as a fallback spelling).
|
|
10
|
-
* - deny: `{ "action": "block", "reason": … }`.
|
|
11
|
-
* - rewrite: `{ "action": "modify", "args": { … } }` — a **shallow merge** into the
|
|
12
|
-
* tool's arguments, so this shim sends only the `command` key and the harness
|
|
13
|
-
* keeps the rest. The modify schema has **no reason field**, so the substitution
|
|
14
|
-
* is announced on stderr — a rewrite must never be silent.
|
|
15
|
-
*
|
|
16
|
-
* Carried caveat from the matrix: Hermes has a known bypass where memory tools
|
|
17
|
-
* ignore `disabled_toolsets` (<https://github.com/NousResearch/hermes-agent/issues/46171>) —
|
|
18
|
-
* tool gating there is leaky at the edges, so treat this hook as best-effort
|
|
19
|
-
* steering, not a boundary.
|
|
5
|
+
* Hermes Agent 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/hermes.ts`), and `shimFromSchema` turns that schema into the
|
|
8
|
+
* adapter below. The installer wires `node dist/hooks/shims/hermes.js` as the
|
|
9
|
+
* harness's hook command; this file is what that runs.
|
|
20
10
|
*/
|
|
21
|
-
export const adapter =
|
|
22
|
-
toRequest: (raw) => {
|
|
23
|
-
const fields = asRecord(raw);
|
|
24
|
-
return toolCallRequest(fields['tool_name'], fields['args'] ?? fields['tool_input'], {
|
|
25
|
-
read: ['read_file', 'Read', 'ReadFile'],
|
|
26
|
-
bash: ['execute_command', 'terminal', 'bash', 'Bash', 'shell'],
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
pass: () => ({ stdout: '', exitCode: 0 }),
|
|
30
|
-
deny: (_raw, _request, decision) => ({
|
|
31
|
-
stdout: `${JSON.stringify({
|
|
32
|
-
action: 'block',
|
|
33
|
-
reason: decision.reason ?? 'denied by the smelt guard',
|
|
34
|
-
})}\n`,
|
|
35
|
-
exitCode: 0,
|
|
36
|
-
}),
|
|
37
|
-
rewrite: (_raw, _request, decision) => ({
|
|
38
|
-
stdout: `${JSON.stringify({
|
|
39
|
-
action: 'modify',
|
|
40
|
-
args: { command: decision.suggestion },
|
|
41
|
-
})}\n`,
|
|
42
|
-
// Hermes's modify action carries no reason field — announce on stderr instead.
|
|
43
|
-
stderr: `smelt guard (rewrite mode): substituted the command in-flight with ` +
|
|
44
|
-
`\`${decision.suggestion ?? ''}\`. ${decision.reason ?? ''}\n`,
|
|
45
|
-
exitCode: 0,
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
11
|
+
export const adapter = shimAdapterOf(hermes);
|
|
48
12
|
if (isMainModule(import.meta.url))
|
|
49
13
|
runShimMain(adapter);
|
|
50
14
|
//# sourceMappingURL=hermes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hermes.js","sourceRoot":"","sources":["../../../src/hooks/shims/hermes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"hermes.js","sourceRoot":"","sources":["../../../src/hooks/shims/hermes.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 { hermes } from '../../harness/hermes.ts';\nimport { shimAdapterOf } from '../../harness/profile.ts';\nimport { isMainModule, runShimMain } from '../shim.ts';\nimport type { ShimAdapter } from '../shim.ts';\n\n/**\n * Hermes Agent 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/hermes.ts`), and `shimFromSchema` turns that schema into the\n * adapter below. The installer wires `node dist/hooks/shims/hermes.js` as the\n * harness's hook command; this file is what that runs.\n */\nexport const adapter: ShimAdapter = shimAdapterOf(hermes);\n\nif (isMainModule(import.meta.url)) runShimMain(adapter);\n"]}
|