@nexrall/code-core 1.4.66 → 1.4.68
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/dist/agent/agentRegistry.d.ts +27 -0
- package/dist/agent/agentRegistry.d.ts.map +1 -1
- package/dist/agent/agentRegistry.js +45 -0
- package/dist/agent/agentTypes.d.ts +6 -2
- package/dist/agent/agentTypes.d.ts.map +1 -1
- package/dist/agent/agentTypes.js +13 -4
- package/dist/agent/askOnce.d.ts +12 -0
- package/dist/agent/askOnce.d.ts.map +1 -0
- package/dist/agent/askOnce.js +41 -0
- package/dist/agent/compaction.d.ts +244 -0
- package/dist/agent/compaction.d.ts.map +1 -0
- package/dist/agent/compaction.js +976 -0
- package/dist/agent/fileLocks.d.ts +34 -0
- package/dist/agent/fileLocks.d.ts.map +1 -0
- package/dist/agent/fileLocks.js +114 -0
- package/dist/agent/hooks.d.ts +331 -0
- package/dist/agent/hooks.d.ts.map +1 -0
- package/dist/agent/hooks.js +1239 -0
- package/dist/agent/iterationPolicy.d.ts +121 -0
- package/dist/agent/iterationPolicy.d.ts.map +1 -0
- package/dist/agent/iterationPolicy.js +297 -0
- package/dist/agent/lifecycleHost.d.ts +55 -0
- package/dist/agent/lifecycleHost.d.ts.map +1 -0
- package/dist/agent/lifecycleHost.js +294 -0
- package/dist/agent/loop.d.ts +39 -491
- package/dist/agent/loop.d.ts.map +1 -1
- package/dist/agent/loop.js +538 -3069
- package/dist/agent/planMode.d.ts.map +1 -1
- package/dist/agent/planMode.js +1 -0
- package/dist/agent/sharedTasks.d.ts +7 -0
- package/dist/agent/sharedTasks.d.ts.map +1 -1
- package/dist/agent/sharedTasks.js +16 -0
- package/dist/agent/subAgentBudget.d.ts +65 -0
- package/dist/agent/subAgentBudget.d.ts.map +1 -0
- package/dist/agent/subAgentBudget.js +269 -0
- package/dist/agent/subTask.d.ts +15 -0
- package/dist/agent/subTask.d.ts.map +1 -0
- package/dist/agent/subTask.js +730 -0
- package/dist/agent/subTaskSupport.d.ts +167 -0
- package/dist/agent/subTaskSupport.d.ts.map +1 -0
- package/dist/agent/subTaskSupport.js +425 -0
- package/dist/agent/toolDescriptions.d.ts +3 -0
- package/dist/agent/toolDescriptions.d.ts.map +1 -0
- package/dist/agent/toolDescriptions.js +116 -0
- package/dist/api/client.d.ts +41 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +173 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/mcp/client.d.ts +104 -0
- package/dist/mcp/client.d.ts.map +1 -1
- package/dist/mcp/client.js +136 -2
- package/dist/mcp/httpClient.d.ts +17 -1
- package/dist/mcp/httpClient.d.ts.map +1 -1
- package/dist/mcp/httpClient.js +120 -19
- package/dist/mcp/manager.d.ts +77 -2
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +275 -9
- package/dist/mcp/server.d.ts +39 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +189 -0
- package/dist/mcp/sseClient.d.ts +7 -1
- package/dist/mcp/sseClient.d.ts.map +1 -1
- package/dist/mcp/sseClient.js +45 -1
- package/dist/mcp/stats.d.ts +41 -0
- package/dist/mcp/stats.d.ts.map +1 -0
- package/dist/mcp/stats.js +108 -0
- package/dist/permissions/destructive.d.ts +2 -0
- package/dist/permissions/destructive.d.ts.map +1 -1
- package/dist/permissions/destructive.js +6 -2
- package/dist/permissions/destructiveTokens.d.ts +5 -0
- package/dist/permissions/destructiveTokens.d.ts.map +1 -1
- package/dist/permissions/destructiveTokens.js +9 -3
- package/dist/permissions/modePolicy.d.ts.map +1 -1
- package/dist/permissions/modePolicy.js +5 -2
- package/dist/permissions/rules.d.ts +4 -1
- package/dist/permissions/rules.d.ts.map +1 -1
- package/dist/permissions/rules.js +29 -0
- package/dist/plugins/data.d.ts +23 -0
- package/dist/plugins/data.d.ts.map +1 -0
- package/dist/plugins/data.js +141 -0
- package/dist/plugins/index.d.ts +14 -2
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +45 -4
- package/dist/plugins/installer.d.ts +83 -0
- package/dist/plugins/installer.d.ts.map +1 -1
- package/dist/plugins/installer.js +207 -1
- package/dist/types.d.ts +45 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const _fileLocks: Map<string, Promise<void>>;
|
|
2
|
+
/**
|
|
3
|
+
* Take several locks at once, always in a globally consistent order.
|
|
4
|
+
*
|
|
5
|
+
* Needed because move_file/copy_file touch TWO paths. Locking only one of them (the
|
|
6
|
+
* old behaviour locked `source` and left `dest` unprotected) leaves exactly the race
|
|
7
|
+
* the lock exists to prevent: a `move_file{dest:'shared.ts'}` running concurrently with
|
|
8
|
+
* an `edit_file{path:'shared.ts'}` had nothing serialising them.
|
|
9
|
+
*
|
|
10
|
+
* The sort is load-bearing, not tidiness: two callers acquiring {A,B} and {B,A} at the
|
|
11
|
+
* same time would deadlock, each holding what the other waits for. Sorting means every
|
|
12
|
+
* caller in the process takes them in the same order, which makes that impossible.
|
|
13
|
+
*/
|
|
14
|
+
export declare function withFileLocks<T>(absPaths: string[], fn: () => Promise<T>): Promise<T>;
|
|
15
|
+
/**
|
|
16
|
+
* Shared lock key for bash commands that mutate repository-wide state.
|
|
17
|
+
*
|
|
18
|
+
* Not a path, because these commands do not declare one — `git commit` contends over
|
|
19
|
+
* `.git/index.lock`, `npm install` over `node_modules` and the lockfile. One key means
|
|
20
|
+
* they serialise against each other while everything else stays parallel.
|
|
21
|
+
*/
|
|
22
|
+
export declare const REPO_STATE_LOCK = "\0repo-state";
|
|
23
|
+
/**
|
|
24
|
+
* Every path a tool call will touch, so all of them can be locked.
|
|
25
|
+
*
|
|
26
|
+
* `move_file`/`copy_file` carry `source` + `destination`, the rest carry `path`. Both
|
|
27
|
+
* `dest` and `destination` are accepted because the schema has used both spellings and
|
|
28
|
+
* silently missing the key would mean silently losing the lock — a failure that shows
|
|
29
|
+
* up as corrupted content rather than an error.
|
|
30
|
+
*
|
|
31
|
+
* Exported for tests: getting this wrong is invisible until two writes race.
|
|
32
|
+
*/
|
|
33
|
+
export declare function lockPathsFor(name: string, input: Record<string, unknown>, workDir?: string): string[];
|
|
34
|
+
//# sourceMappingURL=fileLocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileLocks.d.ts","sourceRoot":"","sources":["../../src/agent/fileLocks.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU,4BAAmC,CAAC;AAiB3D;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAK3F;AAQD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,iBAAqB,CAAC;AAElD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,EAAE,CAQV"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.REPO_STATE_LOCK = exports._fileLocks = void 0;
|
|
37
|
+
exports.withFileLocks = withFileLocks;
|
|
38
|
+
exports.lockPathsFor = lockPathsFor;
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
// ─── Per-file write lock ──────────────────────────────────────────────────────
|
|
41
|
+
// When the model emits multiple tool_use blocks in one turn (executed via
|
|
42
|
+
// Promise.all), two edits to the same file race: both read the original, both
|
|
43
|
+
// write their version, and the second write silently discards the first edit.
|
|
44
|
+
// This lock serialises writes per absolute path to prevent that.
|
|
45
|
+
exports._fileLocks = new Map();
|
|
46
|
+
async function withFileLock(absPath, fn) {
|
|
47
|
+
const prev = exports._fileLocks.get(absPath) ?? Promise.resolve();
|
|
48
|
+
let releaseLock;
|
|
49
|
+
const next = new Promise((res) => { releaseLock = res; });
|
|
50
|
+
exports._fileLocks.set(absPath, prev.then(() => next));
|
|
51
|
+
try {
|
|
52
|
+
await prev; // wait for any in-flight operation on this file
|
|
53
|
+
return await fn();
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
releaseLock();
|
|
57
|
+
// Cleanup: remove the entry once the chain is idle to avoid unbounded growth
|
|
58
|
+
if (exports._fileLocks.get(absPath) === next)
|
|
59
|
+
exports._fileLocks.delete(absPath);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Take several locks at once, always in a globally consistent order.
|
|
64
|
+
*
|
|
65
|
+
* Needed because move_file/copy_file touch TWO paths. Locking only one of them (the
|
|
66
|
+
* old behaviour locked `source` and left `dest` unprotected) leaves exactly the race
|
|
67
|
+
* the lock exists to prevent: a `move_file{dest:'shared.ts'}` running concurrently with
|
|
68
|
+
* an `edit_file{path:'shared.ts'}` had nothing serialising them.
|
|
69
|
+
*
|
|
70
|
+
* The sort is load-bearing, not tidiness: two callers acquiring {A,B} and {B,A} at the
|
|
71
|
+
* same time would deadlock, each holding what the other waits for. Sorting means every
|
|
72
|
+
* caller in the process takes them in the same order, which makes that impossible.
|
|
73
|
+
*/
|
|
74
|
+
async function withFileLocks(absPaths, fn) {
|
|
75
|
+
const unique = [...new Set(absPaths.filter(Boolean))].sort();
|
|
76
|
+
if (unique.length === 0)
|
|
77
|
+
return fn();
|
|
78
|
+
const [first, ...rest] = unique;
|
|
79
|
+
return withFileLock(first, () => (rest.length ? withFileLocks(rest, fn) : fn()));
|
|
80
|
+
}
|
|
81
|
+
/** Tools that mutate the filesystem and must be serialised per path. */
|
|
82
|
+
const WRITE_TOOLS = new Set([
|
|
83
|
+
'write_file', 'write_docx', 'write_xlsx', 'write_pptx',
|
|
84
|
+
'edit_file', 'multi_edit', 'delete_file', 'move_file', 'copy_file', 'notebook_edit',
|
|
85
|
+
]);
|
|
86
|
+
/**
|
|
87
|
+
* Shared lock key for bash commands that mutate repository-wide state.
|
|
88
|
+
*
|
|
89
|
+
* Not a path, because these commands do not declare one — `git commit` contends over
|
|
90
|
+
* `.git/index.lock`, `npm install` over `node_modules` and the lockfile. One key means
|
|
91
|
+
* they serialise against each other while everything else stays parallel.
|
|
92
|
+
*/
|
|
93
|
+
exports.REPO_STATE_LOCK = '\u0000repo-state';
|
|
94
|
+
/**
|
|
95
|
+
* Every path a tool call will touch, so all of them can be locked.
|
|
96
|
+
*
|
|
97
|
+
* `move_file`/`copy_file` carry `source` + `destination`, the rest carry `path`. Both
|
|
98
|
+
* `dest` and `destination` are accepted because the schema has used both spellings and
|
|
99
|
+
* silently missing the key would mean silently losing the lock — a failure that shows
|
|
100
|
+
* up as corrupted content rather than an error.
|
|
101
|
+
*
|
|
102
|
+
* Exported for tests: getting this wrong is invisible until two writes race.
|
|
103
|
+
*/
|
|
104
|
+
function lockPathsFor(name, input, workDir) {
|
|
105
|
+
if (!WRITE_TOOLS.has(name))
|
|
106
|
+
return [];
|
|
107
|
+
const raw = [input.path, input.source, input.destination, input.dest]
|
|
108
|
+
.filter((p) => typeof p === 'string' && p.length > 0);
|
|
109
|
+
const abs = raw.map((p) => (workDir ? path.resolve(workDir, p) : p));
|
|
110
|
+
// Fall back to the tool name so a malformed call still serialises against itself
|
|
111
|
+
// rather than escaping the lock entirely.
|
|
112
|
+
return abs.length ? abs : [name];
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=fileLocks.js.map
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import type { ToolResult, EnvContext, AgentLoopOptions } from '../types';
|
|
2
|
+
import { type AgentHooks } from './agentTypes';
|
|
3
|
+
export interface HookDef {
|
|
4
|
+
type: 'command' | 'http' | 'prompt' | 'agent' | 'mcp_tool';
|
|
5
|
+
command?: string;
|
|
6
|
+
/** `type:"http"`: POST the hook payload here (Claude Code's HTTP hooks). */
|
|
7
|
+
url?: string;
|
|
8
|
+
/** Extra request headers. `$VAR` / `${VAR}` are filled from allowedEnvVars only. */
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
allowedEnvVars?: string[];
|
|
11
|
+
/**
|
|
12
|
+
* `type:"prompt"|"agent"`: instruction for a model that decides the outcome.
|
|
13
|
+
* `$ARGUMENTS` is replaced with the hook input JSON (`\$ARGUMENTS` escapes it).
|
|
14
|
+
* The model must answer `{"ok":true}` or `{"ok":false,"reason":"…"}`; "agent"
|
|
15
|
+
* additionally gets the read-only tools (read_file, search_files, list_directory,
|
|
16
|
+
* glob) so it can inspect the repo before deciding. A decisive `ok:false` behaves
|
|
17
|
+
* exactly like exit code 2. NOTE: this calls a model, so it BILLS the session.
|
|
18
|
+
*/
|
|
19
|
+
prompt?: string;
|
|
20
|
+
/** `type:"prompt"|"agent"`: model override; defaults to the session's model. */
|
|
21
|
+
model?: string;
|
|
22
|
+
/** Seconds (Claude Code) — the loader converts it to timeout_ms. */
|
|
23
|
+
timeout?: number;
|
|
24
|
+
timeout_ms?: number;
|
|
25
|
+
/**
|
|
26
|
+
* `type:"command"`: start the hook and CONTINUE without waiting (Claude Code's
|
|
27
|
+
* `async`). No timeout is enforced, the hook cannot block or veto anything, and a
|
|
28
|
+
* JSON directive on stdout (`additionalContext` / `systemMessage`) is delivered to
|
|
29
|
+
* the model ahead of its next request.
|
|
30
|
+
*/
|
|
31
|
+
async?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* `type:"command"`: like `async`, but exit code 2 WAKES the model with the hook's
|
|
34
|
+
* stderr (or stdout when stderr is empty) as a system reminder. Unlike plain `async`,
|
|
35
|
+
* the `timeout` IS enforced here.
|
|
36
|
+
*/
|
|
37
|
+
asyncRewake?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Run the hook once per session — after its first SUCCESSFUL run (exit 0) it is
|
|
40
|
+
* skipped; a failure, exit 2 or a timeout leaves it armed. Claude Code only honours
|
|
41
|
+
* this in skill frontmatter; Nexrall honours it wherever the hook is declared.
|
|
42
|
+
*/
|
|
43
|
+
once?: boolean;
|
|
44
|
+
/** Spinner text shown in the UI while the hook runs (Claude Code's `statusMessage`). */
|
|
45
|
+
statusMessage?: string;
|
|
46
|
+
/** `type:"mcp_tool"`: the connected MCP server to call. */
|
|
47
|
+
server?: string;
|
|
48
|
+
/** `type:"mcp_tool"`: the tool on that server. Its text output is treated like stdout. */
|
|
49
|
+
tool?: string;
|
|
50
|
+
/**
|
|
51
|
+
* `type:"mcp_tool"`: the tool's arguments. String values may embed `${path.to.value}`
|
|
52
|
+
* from the hook's input JSON — `${tool_input.file_path}` (Claude Code spelling) and
|
|
53
|
+
* `${input.file_path}` both resolve; a value that is exactly one `${…}` keeps its
|
|
54
|
+
* original type.
|
|
55
|
+
*/
|
|
56
|
+
input?: Record<string, unknown>;
|
|
57
|
+
/**
|
|
58
|
+
* Which plugin this handler came from (stamped by the loader when it merges a
|
|
59
|
+
* plugin's hooks.json — see pluginHooks in ../plugins/index). Its processes are
|
|
60
|
+
* then started with NEXRALL_PLUGIN_DATA pointing at that plugin's OWN persistent
|
|
61
|
+
* data directory, the one place it may keep files across plugin updates.
|
|
62
|
+
*/
|
|
63
|
+
plugin?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface HookEntry {
|
|
66
|
+
matcher?: string;
|
|
67
|
+
hooks: HookDef[];
|
|
68
|
+
}
|
|
69
|
+
export interface HooksConfig {
|
|
70
|
+
PreToolUse?: HookEntry[];
|
|
71
|
+
PostToolUse?: HookEntry[];
|
|
72
|
+
PostMessageComplete?: HookDef[];
|
|
73
|
+
OnError?: HookDef[];
|
|
74
|
+
OnStop?: HookDef[];
|
|
75
|
+
/** Runs when a SUB-AGENT finishes (Claude Code's SubagentStop). OnStop is main-agent only. */
|
|
76
|
+
SubagentStop?: HookDef[];
|
|
77
|
+
/** Once per session, before its first turn. May return additionalContext. */
|
|
78
|
+
SessionStart?: Array<HookEntry | HookDef>;
|
|
79
|
+
/** Before each user prompt is processed. Exit 2 / decision:"block" rejects it; additionalContext is appended to it. */
|
|
80
|
+
UserPromptSubmit?: Array<HookEntry | HookDef>;
|
|
81
|
+
/** Right before a conversation is auto-compacted (history is about to be summarised). */
|
|
82
|
+
PreCompact?: Array<HookEntry | HookDef>;
|
|
83
|
+
/** About to ask the user for permission. A hook may answer: {"decision":"allow"|"deny"} (exit 2 = deny). Matcher = tool name. */
|
|
84
|
+
PermissionRequest?: Array<HookEntry | HookDef>;
|
|
85
|
+
/** The agent is waiting on the user (a permission prompt). Fire-and-forget. */
|
|
86
|
+
Notification?: Array<HookEntry | HookDef>;
|
|
87
|
+
/** A tool call came back with an error. Matcher = tool name. Exit 2 / additionalContext feed the model. */
|
|
88
|
+
PostToolUseFailure?: Array<HookEntry | HookDef>;
|
|
89
|
+
/** A sub-agent is about to start. Matcher = agent type. Observer; additionalContext is added to its brief. */
|
|
90
|
+
SubagentStart?: Array<HookEntry | HookDef>;
|
|
91
|
+
/** Right after a conversation was compacted. Observer. */
|
|
92
|
+
PostCompact?: Array<HookEntry | HookDef>;
|
|
93
|
+
/** The main agent's turn run is ending (reason: completed | aborted | error | max_iterations …). Observer. */
|
|
94
|
+
SessionEnd?: Array<HookEntry | HookDef>;
|
|
95
|
+
/**
|
|
96
|
+
* A watched literal file in the working directory changed on disk (Claude Code's
|
|
97
|
+
* FileChanged). Matcher = filename(s), "a.txt|b.txt" — it both builds the watch list
|
|
98
|
+
* and selects which groups run for THAT file. Observer; a hook answering with
|
|
99
|
+
* {"watchPaths":[…]} replaces the dynamic watch list — a dynamic file had no matcher
|
|
100
|
+
* naming it, so it notifies EVERY FileChanged group — and {"systemMessage":"…"} is shown.
|
|
101
|
+
*/
|
|
102
|
+
FileChanged?: Array<HookEntry | HookDef>;
|
|
103
|
+
/**
|
|
104
|
+
* Instruction files were loaded for this session (nexrall.md, memory). Matcher =
|
|
105
|
+
* load reason ("session_start"). Observer; output and exit code are ignored.
|
|
106
|
+
*/
|
|
107
|
+
InstructionsLoaded?: Array<HookEntry | HookDef>;
|
|
108
|
+
/**
|
|
109
|
+
* The turn ended because of an API error (Claude Code's StopFailure — fires INSTEAD
|
|
110
|
+
* of a clean stop). Matcher = error type (rate_limit, overloaded, authentication_failed,
|
|
111
|
+
* billing_error, invalid_request, model_not_found, server_error, max_output_tokens,
|
|
112
|
+
* unknown). Observer: output and exit code are ignored.
|
|
113
|
+
*/
|
|
114
|
+
StopFailure?: Array<HookEntry | HookDef>;
|
|
115
|
+
/** The permission gate REFUSED a tool call (rule, mode, plan lock, destructive guard, dontAsk). Matcher = tool name. Observer. */
|
|
116
|
+
PermissionDenied?: Array<HookEntry | HookDef>;
|
|
117
|
+
/** About to switch model (/model, picker, fallback). Matcher = new model id. Observer — it cannot veto the switch. */
|
|
118
|
+
PreModelSwitch?: Array<HookEntry | HookDef>;
|
|
119
|
+
/** The model was switched. Matcher = new model id. Observer. */
|
|
120
|
+
PostModelSwitch?: Array<HookEntry | HookDef>;
|
|
121
|
+
/** The session's working directory changed. Observer. */
|
|
122
|
+
CwdChanged?: Array<HookEntry | HookDef>;
|
|
123
|
+
/** An extra working directory was added (--add-dir, /add-dir). Observer. */
|
|
124
|
+
DirectoryAdded?: Array<HookEntry | HookDef>;
|
|
125
|
+
/** A setting changed in-session (/config, /theme, /output-style …). Matcher = the setting key. Observer. */
|
|
126
|
+
ConfigChange?: Array<HookEntry | HookDef>;
|
|
127
|
+
/** A git worktree was created for this session. Observer. */
|
|
128
|
+
WorktreeCreate?: Array<HookEntry | HookDef>;
|
|
129
|
+
/** A session worktree was removed. Observer. */
|
|
130
|
+
WorktreeRemove?: Array<HookEntry | HookDef>;
|
|
131
|
+
/** Once, on startup, when the CLI is run with --init / --maintenance style setup (matcher "init" | "maintenance"). Observer. */
|
|
132
|
+
Setup?: Array<HookEntry | HookDef>;
|
|
133
|
+
/**
|
|
134
|
+
* After EVERY tool call of a batch resolved, ONCE, before the next model call (Claude
|
|
135
|
+
* Code's PostToolBatch — PostToolUse fires per tool, this fires per batch). Payload:
|
|
136
|
+
* `tool_calls: [{tool_name, tool_input, tool_use_id, tool_response}]` where tool_response
|
|
137
|
+
* is the text the model receives. `additionalContext` is injected with the tool results;
|
|
138
|
+
* exit 2 / `decision:"block"` stops the turn before the next model call (the reason stays
|
|
139
|
+
* in the conversation). No matcher.
|
|
140
|
+
*/
|
|
141
|
+
PostToolBatch?: Array<HookEntry | HookDef>;
|
|
142
|
+
/**
|
|
143
|
+
* A shared task was just created (`create_shared_task`). Payload: `task_id`,
|
|
144
|
+
* `task_subject`, `task_description?`, `teammate_name?`. Exit 2 / `decision:"block"`
|
|
145
|
+
* DELETES the task and returns the reason to the model as the tool's error — exactly
|
|
146
|
+
* Claude Code's contract, so a veto always leaves no task behind. No matcher.
|
|
147
|
+
*/
|
|
148
|
+
TaskCreated?: Array<HookEntry | HookDef>;
|
|
149
|
+
/**
|
|
150
|
+
* A shared task is about to be marked completed (`update_shared_task_status`). Payload:
|
|
151
|
+
* `task_id`, `task_subject`, `task_description?`, `teammate_name?`. Exit 2 /
|
|
152
|
+
* `decision:"block"` refuses the completion and feeds the reason back to the model, so
|
|
153
|
+
* the task stays open. No matcher.
|
|
154
|
+
*/
|
|
155
|
+
TaskCompleted?: Array<HookEntry | HookDef>;
|
|
156
|
+
/**
|
|
157
|
+
* An MCP server asked the user for input mid-tool-call (its `elicitation/create`
|
|
158
|
+
* request). Runs BEFORE the interactive dialog: a hook whose stdout carries
|
|
159
|
+
* `hookSpecificOutput:{action:"accept"|"decline"|"cancel", content:{…}}` answers
|
|
160
|
+
* outright, so a CI can fill a form nobody is there to type — the first hook that
|
|
161
|
+
* answers wins and the dialog is skipped. Exit 2 = decline. Matcher = MCP server
|
|
162
|
+
* name. Input includes `message`, `mode` ('form'|'url'), `requested_schema` (form),
|
|
163
|
+
* `url` + `elicitation_id` (url mode).
|
|
164
|
+
*/
|
|
165
|
+
Elicitation?: Array<HookEntry | HookDef>;
|
|
166
|
+
/**
|
|
167
|
+
* After an elicitation was answered (by a hook or by the user), before the response
|
|
168
|
+
* is sent back to the server. Same `hookSpecificOutput` shape may OVERRIDE the
|
|
169
|
+
* answer — overrides apply in order, the last one wins; a hook that accepts without
|
|
170
|
+
* `content` keeps the existing values. Exit 2 blocks the response, which means
|
|
171
|
+
* 'decline' with the content dropped. Matcher = MCP server name. Input includes
|
|
172
|
+
* `action`, `content?`, `mode`, `elicitation_id?`.
|
|
173
|
+
*/
|
|
174
|
+
ElicitationResult?: Array<HookEntry | HookDef>;
|
|
175
|
+
}
|
|
176
|
+
export declare function withAgentHooks(base: HooksConfig, agent?: AgentHooks): HooksConfig;
|
|
177
|
+
export declare function loadHooks(workDir: string): HooksConfig;
|
|
178
|
+
/** Events a host fires purely to tell hooks something happened. Their output and exit code are ignored. */
|
|
179
|
+
export type ObserverEvent = 'PermissionDenied' | 'PreModelSwitch' | 'PostModelSwitch' | 'CwdChanged' | 'DirectoryAdded' | 'ConfigChange' | 'WorktreeCreate' | 'WorktreeRemove' | 'Setup';
|
|
180
|
+
export interface HookOutcome {
|
|
181
|
+
/** PermissionRequest only: a hook answered "allow" (block = answered "deny"). */
|
|
182
|
+
allow?: boolean;
|
|
183
|
+
block: boolean;
|
|
184
|
+
reason?: string;
|
|
185
|
+
context?: string;
|
|
186
|
+
/** FileChanged only: replace the dynamic watch list (Claude Code's watchPaths). */
|
|
187
|
+
watchPaths?: string[];
|
|
188
|
+
/** FileChanged only: a one-line notice to show the user (systemMessage). */
|
|
189
|
+
systemMessage?: string;
|
|
190
|
+
}
|
|
191
|
+
export interface HookDelivery {
|
|
192
|
+
/** 'context' = feed the model before its next request; 'wake' = start a turn NOW. */
|
|
193
|
+
kind: 'context' | 'wake';
|
|
194
|
+
text: string;
|
|
195
|
+
/** Which hook produced it, e.g. `PostToolUse (Bash) · asyncRewake`. */
|
|
196
|
+
source: string;
|
|
197
|
+
}
|
|
198
|
+
/** Called (if set) the moment a wake lands, so an idle host can react at once. */
|
|
199
|
+
export declare function setHookWakeListener(fn: (() => void) | null): void;
|
|
200
|
+
/** Where `statusMessage` goes. The message is null when no hook is running. */
|
|
201
|
+
export declare function setHookStatusListener(fn: ((message: string | null) => void) | null): void;
|
|
202
|
+
/** Everything queued so far — the loop calls this before each request. */
|
|
203
|
+
export declare function drainHookDeliveries(): HookDelivery[];
|
|
204
|
+
/** Only the wakes — an idle host must not start a turn just for async context. */
|
|
205
|
+
export declare function takeHookWakes(): HookDelivery[];
|
|
206
|
+
export declare function hasPendingHookWake(): boolean;
|
|
207
|
+
/** The text a delivery batch becomes in the conversation — the same envelope sync hooks use. */
|
|
208
|
+
export declare function formatHookDeliveries(list: HookDelivery[]): string;
|
|
209
|
+
/** Forget which `once` hooks have run (a new session: /clear, a fresh run). */
|
|
210
|
+
export declare function resetHookOnceState(): void;
|
|
211
|
+
/** What a `type:"mcp_tool"` handler calls — the host wires one from its MCP manager. */
|
|
212
|
+
export type HookMcpCaller = (server: string, tool: string, input: Record<string, unknown>) => Promise<{
|
|
213
|
+
text: string;
|
|
214
|
+
} | {
|
|
215
|
+
error: string;
|
|
216
|
+
}>;
|
|
217
|
+
/** Hosts with connected MCP servers register their caller once; null = mcp_tool hooks report "no MCP client". */
|
|
218
|
+
export declare function setHookMcpCaller(fn: HookMcpCaller | null): void;
|
|
219
|
+
/** One lifecycle record for a single hook run — hosts format/stream these. */
|
|
220
|
+
export interface HookLifecycleEvent {
|
|
221
|
+
kind: 'started' | 'progress' | 'response';
|
|
222
|
+
/** Stable for one run: the same id on its started, progress and response records. */
|
|
223
|
+
hookId: string;
|
|
224
|
+
/** Display name of the handler — its command, url, `server:tool`, or handler type. */
|
|
225
|
+
hookName: string;
|
|
226
|
+
/** The event that fired it: 'PreToolUse', 'SessionStart', … */
|
|
227
|
+
hookEvent: string;
|
|
228
|
+
/** Progress: output since the previous progress record. Response: the full output. */
|
|
229
|
+
stdout?: string;
|
|
230
|
+
stderr?: string;
|
|
231
|
+
/** Response: stdout+stderr as one string; progress: this record's stdout+stderr. */
|
|
232
|
+
output?: string;
|
|
233
|
+
/** Response only, and only when the hook actually exited. */
|
|
234
|
+
exitCode?: number;
|
|
235
|
+
/** Response only: 0 → success; killed/never-exited → cancelled; anything else → error. */
|
|
236
|
+
outcome?: 'success' | 'error' | 'cancelled';
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Install (or clear) the sink that receives every hook run's lifecycle records.
|
|
240
|
+
* One per process: hooks fire from the loop, the lifecycle host and the permission
|
|
241
|
+
* gate, but they all belong to the same session's stream.
|
|
242
|
+
*/
|
|
243
|
+
export declare function setHookEventListener(fn: ((evt: HookLifecycleEvent) => void) | null): void;
|
|
244
|
+
/** True when a sink is installed, for hosts skipping work that would only feed the stream. */
|
|
245
|
+
export declare function hasHookEventListener(): boolean;
|
|
246
|
+
/** Pull the decision object out of a model reply: first {...} block, fences tolerated. */
|
|
247
|
+
export declare function parsePromptHookReply(reply: string): {
|
|
248
|
+
ok?: boolean;
|
|
249
|
+
reason?: string;
|
|
250
|
+
additionalContext?: string;
|
|
251
|
+
decision?: string;
|
|
252
|
+
} | null;
|
|
253
|
+
/** Model / env / abort for prompt+agent hooks, taken from the run that fires them. */
|
|
254
|
+
export declare function hookRunOptsFor(options: AgentLoopOptions): HookRunOpts;
|
|
255
|
+
/**
|
|
256
|
+
* Map a stream/API error onto Claude Code's StopFailure error types, so a matcher
|
|
257
|
+
* written for one works here: rate_limit, overloaded, authentication_failed,
|
|
258
|
+
* billing_error, invalid_request, model_not_found, server_error, max_output_tokens,
|
|
259
|
+
* cloud_credential_error, account_on_hold, unknown.
|
|
260
|
+
*
|
|
261
|
+
* Only what the error actually carries is used (HTTP status, then code) — no guessing
|
|
262
|
+
* from message text, which would misfile e.g. a user-facing "rate limit" in a tool error.
|
|
263
|
+
*/
|
|
264
|
+
export declare function classifyStopFailure(err: unknown): {
|
|
265
|
+
error: string;
|
|
266
|
+
error_details?: string;
|
|
267
|
+
};
|
|
268
|
+
/** The same mapping for stops that ended the loop WITHOUT a throw. */
|
|
269
|
+
export declare function apiFailureForStopReason(stopReason: string): {
|
|
270
|
+
error: string;
|
|
271
|
+
error_details?: string;
|
|
272
|
+
} | null;
|
|
273
|
+
export declare function runToolHooks(entries: HookEntry[] | undefined, phase: 'PreToolUse' | 'PostToolUse', toolName: string, input: Record<string, unknown>, workDir: string, result?: ToolResult, hookOpts?: HookRunOpts): Promise<HookOutcome>;
|
|
274
|
+
export declare function runSimpleHooks(defs: HookDef[] | undefined, workDir: string, extraEnv?: Record<string, string>, hookOpts?: HookRunOpts, event?: string): Promise<void>;
|
|
275
|
+
/** Model / env / abort threaded from the run so prompt+agent hooks can call a model. */
|
|
276
|
+
interface HookRunOpts {
|
|
277
|
+
model?: string;
|
|
278
|
+
abortSignal?: {
|
|
279
|
+
aborted: boolean;
|
|
280
|
+
};
|
|
281
|
+
hookEnv?: EnvContext;
|
|
282
|
+
}
|
|
283
|
+
export declare function runLifecycleHooks(items: Array<HookEntry | HookDef> | undefined, event: string, workDir: string, payload: Record<string, unknown>, matchValue?: string, hookOpts?: HookRunOpts): Promise<HookOutcome>;
|
|
284
|
+
/**
|
|
285
|
+
* For hosts that show their own permission prompt: ask PermissionRequest hooks first.
|
|
286
|
+
* 'allow' / 'deny' = a hook answered, so the human is not asked; null = nobody answered,
|
|
287
|
+
* ask as usual. A DENY wins over an allow (a stricter hook is never overruled by a looser one),
|
|
288
|
+
* and a hook that crashes or times out answers nothing — it can never silently approve.
|
|
289
|
+
*/
|
|
290
|
+
export declare function runPermissionRequestHooks(workDir: string, tool: string, input: Record<string, unknown>, sessionId?: string): Promise<{
|
|
291
|
+
answer: 'allow' | 'deny' | null;
|
|
292
|
+
reason?: string;
|
|
293
|
+
}>;
|
|
294
|
+
export type ElicitationAction = 'accept' | 'decline' | 'cancel';
|
|
295
|
+
export interface ElicitationAnswer {
|
|
296
|
+
action: ElicitationAction;
|
|
297
|
+
content?: Record<string, unknown>;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Ask Elicitation hooks before the user sees the dialog. Returns the answer a hook
|
|
301
|
+
* supplied, or null when none did (the caller then asks the human). Exit 2 = decline.
|
|
302
|
+
* The FIRST hook that answers wins — later hooks are not consulted, so two hooks can
|
|
303
|
+
* never fight over one dialog. A background (`async`) hook cannot answer by design.
|
|
304
|
+
*/
|
|
305
|
+
export declare function runElicitationHooks(workDir: string, server: string, input: Record<string, unknown>, sessionId?: string): Promise<ElicitationAnswer | null>;
|
|
306
|
+
/**
|
|
307
|
+
* Run ElicitationResult hooks after an elicitation was answered and override the answer
|
|
308
|
+
* with whatever they return (exit 2 = decline, content dropped). Always returns an answer
|
|
309
|
+
* safe to send to the server, so a throw inside a hook can never turn one into none.
|
|
310
|
+
*/
|
|
311
|
+
export declare function runElicitationResultHooks(workDir: string, server: string, answer: ElicitationAnswer, meta?: {
|
|
312
|
+
sessionId?: string;
|
|
313
|
+
mode?: string;
|
|
314
|
+
elicitationId?: string;
|
|
315
|
+
}): Promise<ElicitationAnswer>;
|
|
316
|
+
/**
|
|
317
|
+
* Tell hooks that something happened. Awaitable, but it can NEVER block, throw or change the
|
|
318
|
+
* outcome: an observer event is a notification, so a hook that exits 2, prints a decision or
|
|
319
|
+
* crashes is ignored. `matchValue` is the event's selector (tool name, model id, setting key).
|
|
320
|
+
* Returns how many handler groups were configured, so a caller/test can tell "nothing
|
|
321
|
+
* listening" from "ran".
|
|
322
|
+
*/
|
|
323
|
+
export declare function fireObserverHook(workDir: string, event: ObserverEvent, payload: Record<string, unknown>, matchValue?: string): Promise<number>;
|
|
324
|
+
/** For hosts (the CLI) that show the prompt themselves: run Notification hooks, never blocking. */
|
|
325
|
+
export declare function fireNotificationHooks(workDir: string, message: string, type?: string): void;
|
|
326
|
+
/** For hosts that run their own manual /compact: fire PreCompact (trigger "manual"), awaited, never blocking. */
|
|
327
|
+
/** The manual /compact counterpart of the auto PostCompact hook (trigger "manual"). */
|
|
328
|
+
export declare function fireManualPostCompactHook(workDir: string, sessionId: string, messagesSummarized: number): Promise<void>;
|
|
329
|
+
export declare function fireManualPreCompactHook(workDir: string, sessionId: string, messagesToSummarize: number): Promise<void>;
|
|
330
|
+
export {};
|
|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