fix(cline): mirror transactional Node adapter
This commit is contained in:
1 parent
3ca5d701de
commit
4ad139c60a
13 files changed
+1122
-626
No files matched your search
@@ -6,6 +6,8 @@ The provider-level contract represents the default stable runtime. `contract_var
|
||||
|
||||
Grok Build adapters write exact `PreToolUse`, `PostToolUse`, and `PostToolUseFailure` groups under `$GROK_HOME/hooks` or `~/.grok/hooks`. The native camelCase payload includes `toolUseId`, `toolInputTruncated`, and `toolResult`; explicit denials use JSON stdout plus exit code `2`, while hook crashes and timeouts fail open. Project `.grok/hooks` files require `/hooks-trust` or `--trust`; `hooks-paths`, plugin, Claude Code, and Cursor sources remain read-only for Elydora.
|
||||
|
||||
Cline CLI 3 and Cline IDE use separate file-hook loaders. SDK adapters target CLI 3, write only `$CLINE_DIR/hooks`, preserve its hybrid `tool_call`/`preToolUse` and `tool_result`/`postToolUse` payload, and emit pure JSON cancellation controls. The IDE variant discovers runtime `--hooks-dir`, Documents, and `.clinerules/hooks` roots; Windows selects exact `.ps1` files and macOS/Linux select executable extensionless files. Both runtimes continue after hook crashes, timeouts, and invalid controls while recording the failure.
|
||||
|
||||
GitHub Copilot command `preToolUse` hooks deny on crashes and every non-zero exit. Command timeouts continue through the normal permission flow, so `timeout_failure_mode` records that explicit exception when it differs from `failure_mode`.
|
||||
|
||||
Cursor uses the same `preToolUse` and `postToolUse` contract across its CLI and IDE. User, project, and enterprise hook sources merge by documented priority; command exit code `2` denies an action, while per-script `failClosed` controls crash, timeout, and invalid-output behavior.
|
||||
|
||||
@@ -69,8 +69,37 @@
|
||||
".cline/hooks/"
|
||||
],
|
||||
"events": { "before_tool": "PreToolUse", "after_tool": "PostToolUse" },
|
||||
"event_fields": { "name": "tool_call.name/tool_result.name", "input": "tool_call.input/tool_result.input", "session": "taskId" },
|
||||
"event_fields": {
|
||||
"name": "tool_call.name/preToolUse.toolName/tool_result.name/postToolUse.toolName",
|
||||
"input": "tool_call.input/preToolUse.parameters/tool_result.input/postToolUse.parameters",
|
||||
"session": "taskId",
|
||||
"call_id": "tool_call.id/tool_result.id",
|
||||
"output": "tool_result.output/postToolUse.result",
|
||||
"error": "tool_result.error"
|
||||
},
|
||||
"blocking": { "mechanism": "json_stdout_cancel", "failure_mode": "fail_open" },
|
||||
"contract_variants": [
|
||||
{
|
||||
"id": "idefilehooks",
|
||||
"release_channel": "stable",
|
||||
"activation": "Hooks enabled in Cline IDE settings; Windows uses <HookName>.ps1 and macOS/Linux use executable extensionless files",
|
||||
"config_format": "script",
|
||||
"config_paths": [
|
||||
"--hooks-dir <path>",
|
||||
"~/Documents/Cline/Hooks/",
|
||||
".clinerules/hooks/"
|
||||
],
|
||||
"events": { "before_tool": "PreToolUse", "after_tool": "PostToolUse" },
|
||||
"event_fields": {
|
||||
"name": "preToolUse.toolName/postToolUse.toolName",
|
||||
"input": "preToolUse.parameters/postToolUse.parameters",
|
||||
"session": "taskId",
|
||||
"output": "postToolUse.result"
|
||||
},
|
||||
"blocking": { "mechanism": "json_stdout_cancel", "failure_mode": "fail_open" },
|
||||
"source_url": "https://github.com/cline/cline/blob/main/apps/vscode/src/core/hooks/hook-factory.ts"
|
||||
}
|
||||
],
|
||||
"adapters": { "node": true, "python": true, "go": true },
|
||||
"delivery_state": "available",
|
||||
"source_url": "https://github.com/cline/cline/blob/main/sdk/examples/hooks/README.md"
|
||||
|
||||
Reference in new issue
Block a user