@getmarrow/mcp 3.9.95 → 3.9.97
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 +11 -1
- package/dist/cli.js +64 -1
- package/dist/cli.js.map +1 -1
- package/dist/hook-contract.d.ts +2 -2
- package/dist/hook-contract.js +1 -1
- package/dist/hook-pre-action.d.ts +48 -1
- package/dist/hook-pre-action.d.ts.map +1 -1
- package/dist/hook-pre-action.js +371 -91
- package/dist/hook-pre-action.js.map +1 -1
- package/dist/hook-tool-policy.d.ts +39 -0
- package/dist/hook-tool-policy.d.ts.map +1 -1
- package/dist/hook-tool-policy.js +620 -23
- package/dist/hook-tool-policy.js.map +1 -1
- package/dist/hook.d.ts +2 -0
- package/dist/hook.d.ts.map +1 -1
- package/dist/hook.js +14 -1
- package/dist/hook.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +69 -16
- package/dist/index.js.map +1 -1
- package/dist/lifecycle-spool.d.ts +25 -0
- package/dist/lifecycle-spool.d.ts.map +1 -1
- package/dist/lifecycle-spool.js +117 -19
- package/dist/lifecycle-spool.js.map +1 -1
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/server.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { marrowAgentRuntime, marrowEnforcement } from './index';
|
|
2
2
|
import { MARROW_OUTAGE_WARNING } from './hook-contract';
|
|
3
3
|
export { MARROW_OUTAGE_WARNING };
|
|
4
|
+
export declare const MAX_PRE_ACTION_INPUT_BYTES: number;
|
|
4
5
|
export declare const PRE_ACTION_CONTROL_TIMEOUT_MS = 8000;
|
|
5
6
|
export declare class PreActionControlTimeoutError extends Error {
|
|
6
7
|
readonly code = "request_timeout";
|
|
@@ -16,15 +17,50 @@ export type PreToolUseEvent = {
|
|
|
16
17
|
tool_use_id?: string;
|
|
17
18
|
tool_name?: string;
|
|
18
19
|
tool_input?: unknown;
|
|
20
|
+
permission_mode?: string;
|
|
21
|
+
scratchpad_dir?: string;
|
|
19
22
|
};
|
|
20
23
|
type PreActionControlResult = {
|
|
21
24
|
runtime: Awaited<ReturnType<typeof marrowAgentRuntime>> | null;
|
|
22
25
|
permit: Awaited<ReturnType<typeof marrowEnforcement>> | null;
|
|
23
26
|
protectedRisk: boolean;
|
|
24
27
|
enforcementError?: string;
|
|
28
|
+
failure?: 'credential_scope' | 'unavailable';
|
|
25
29
|
outage?: boolean;
|
|
26
30
|
};
|
|
27
31
|
export declare function isMarrowOutage(result: PreActionControlResult): boolean;
|
|
32
|
+
export declare function controlFailureKind(error: unknown): PreActionControlResult['failure'];
|
|
33
|
+
export declare function controlRejectionMessage(error: unknown, agentId?: string): string;
|
|
34
|
+
export type OwnerApprovalPrompt = {
|
|
35
|
+
available: boolean;
|
|
36
|
+
unavailableReason: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Whether a PreToolUse "ask" from this hook reaches a person who can approve.
|
|
40
|
+
* Only Claude Code asks; the generic entrypoint counts as Claude Code only when
|
|
41
|
+
* Claude Code itself spawned the hook (CLAUDE_CODE_CHILD_SESSION, v2.1.172+).
|
|
42
|
+
*/
|
|
43
|
+
export declare function ownerApprovalPrompt(harness: 'claude-code' | 'cline' | 'codex' | 'cursor' | 'gemini' | 'grok' | 'windsurf' | 'mcp-client', event: Pick<PreToolUseEvent, 'permission_mode' | 'scratchpad_dir'>, env?: NodeJS.ProcessEnv): OwnerApprovalPrompt;
|
|
44
|
+
type GateVerdict = {
|
|
45
|
+
kind: 'block' | 'review' | 'arbitration_review' | 'denied';
|
|
46
|
+
reason: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* True only for the runtime's positive advisory contract. On a plan without
|
|
50
|
+
* production_action_enforcement the backend gate (agent-runtime.service.ts,
|
|
51
|
+
* the hardGateEnforcement branch) carries enforced:false with
|
|
52
|
+
* enforcement_decision:'advisory', and gate_required, owner_approval_required
|
|
53
|
+
* and gate_receipt.required are false; the slim shape the MCP client receives
|
|
54
|
+
* carries risk_gate_enforced:false instead. Missing, malformed or conflicting
|
|
55
|
+
* enforcement fields are never advisory, so a protected action fails closed.
|
|
56
|
+
*/
|
|
57
|
+
export declare function runtimeGateAdvisory(runtime: PreActionControlResult['runtime']): boolean;
|
|
58
|
+
/** Every gate is enforced unless the runtime positively declares it advisory. */
|
|
59
|
+
export declare function runtimeGateEnforced(runtime: PreActionControlResult['runtime']): boolean;
|
|
60
|
+
/** A warning for a non-allow gate the runtime does not enforce on this plan. */
|
|
61
|
+
export declare function advisoryGateNotice(runtime: PreActionControlResult['runtime']): string | null;
|
|
62
|
+
export declare function runtimeGateVerdict(runtime: PreActionControlResult['runtime']): GateVerdict | null;
|
|
63
|
+
export declare function gateDecisionMessage(verdict: GateVerdict, ask: boolean, prompt?: OwnerApprovalPrompt): string;
|
|
28
64
|
export declare function localControlAllowOutput(harness: 'claude-code' | 'cline' | 'codex' | 'cursor' | 'gemini' | 'grok' | 'windsurf' | 'mcp-client'): Record<string, unknown> | null;
|
|
29
65
|
export declare function localLoopGuardDenyOutput(harness: 'claude-code' | 'cline' | 'codex' | 'cursor' | 'gemini' | 'grok' | 'windsurf' | 'mcp-client', reason: string): Record<string, unknown> | null;
|
|
30
66
|
export declare function classifyTool(event: PreToolUseEvent): {
|
|
@@ -51,7 +87,18 @@ export declare function grokPreActionHookOutput(result: PreActionControlResult):
|
|
|
51
87
|
decision: 'allow' | 'deny';
|
|
52
88
|
reason?: string;
|
|
53
89
|
};
|
|
54
|
-
export declare function preActionHookOutput(result: PreActionControlResult, harness?: 'claude-code' | 'cline' | 'codex' | 'cursor' | 'gemini' | 'grok' | 'windsurf' | 'mcp-client'): Record<string, unknown>;
|
|
90
|
+
export declare function preActionHookOutput(result: PreActionControlResult, harness?: 'claude-code' | 'cline' | 'codex' | 'cursor' | 'gemini' | 'grok' | 'windsurf' | 'mcp-client', prompt?: OwnerApprovalPrompt): Record<string, unknown>;
|
|
91
|
+
type HeldDecision = {
|
|
92
|
+
decisionId: string | null;
|
|
93
|
+
gateReceiptId: string | null;
|
|
94
|
+
};
|
|
95
|
+
export declare const DENIED_DECISION_CLOSE_TIMEOUT_MS = 2500;
|
|
96
|
+
/**
|
|
97
|
+
* Records a decision the hook denied as a failed outcome, so it carries real
|
|
98
|
+
* outcome data instead of being swept to a NULL outcome later. Never called for
|
|
99
|
+
* an "ask": an approved prompt runs the action and its outcome is still open.
|
|
100
|
+
*/
|
|
101
|
+
export declare function closeDeniedDecision(apiKey: string, baseUrl: string, held: HeldDecision, reason: string, sessionId: string, agentId?: string): Promise<boolean>;
|
|
55
102
|
export declare function installPreActionHook(startDir?: string): {
|
|
56
103
|
settingsPath: string;
|
|
57
104
|
installed: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-pre-action.d.ts","sourceRoot":"","sources":["../src/hook-pre-action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hook-pre-action.d.ts","sourceRoot":"","sources":["../src/hook-pre-action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAgB,iBAAiB,EAAgC,MAAM,SAAS,CAAC;AAkB5G,OAAO,EASL,qBAAqB,EAGtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAIjC,eAAO,MAAM,0BAA0B,QAAkB,CAAC;AAI1D,eAAO,MAAM,6BAA6B,OAAQ,CAAC;AAmBnD,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,IAAI,qBAAqB;;CAMnC;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQ7D;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,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