@getmarrow/mcp 3.9.98 → 3.9.100
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 +53 -343
- package/dist/cli.js +249 -47
- package/dist/cli.js.map +1 -1
- package/dist/hook-context.d.ts.map +1 -1
- package/dist/hook-context.js +142 -16
- package/dist/hook-context.js.map +1 -1
- package/dist/hook-contract.d.ts +34 -5
- package/dist/hook-contract.d.ts.map +1 -1
- package/dist/hook-contract.js +223 -15
- package/dist/hook-contract.js.map +1 -1
- package/dist/hook-pre-action.d.ts +42 -1
- package/dist/hook-pre-action.d.ts.map +1 -1
- package/dist/hook-pre-action.js +447 -58
- package/dist/hook-pre-action.js.map +1 -1
- package/dist/hook-session.d.ts.map +1 -1
- package/dist/hook-session.js +35 -3
- package/dist/hook-session.js.map +1 -1
- package/dist/hook.d.ts +12 -0
- package/dist/hook.d.ts.map +1 -1
- package/dist/hook.js +147 -7
- package/dist/hook.js.map +1 -1
- package/dist/host-approval-state.d.ts +137 -0
- package/dist/host-approval-state.d.ts.map +1 -0
- package/dist/host-approval-state.js +510 -0
- package/dist/host-approval-state.js.map +1 -0
- package/dist/host-approval.d.ts +436 -0
- package/dist/host-approval.d.ts.map +1 -0
- package/dist/host-approval.js +1417 -0
- package/dist/host-approval.js.map +1 -0
- package/dist/host-session.d.ts +104 -0
- package/dist/host-session.d.ts.map +1 -0
- package/dist/host-session.js +728 -0
- package/dist/host-session.js.map +1 -0
- package/dist/index.d.ts +150 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +748 -33
- package/dist/index.js.map +1 -1
- package/dist/lifecycle-spool.d.ts +17 -0
- package/dist/lifecycle-spool.d.ts.map +1 -1
- package/dist/lifecycle-spool.js +39 -9
- package/dist/lifecycle-spool.js.map +1 -1
- package/dist/normalized-action.d.ts +131 -0
- package/dist/normalized-action.d.ts.map +1 -0
- package/dist/normalized-action.js +1203 -0
- package/dist/normalized-action.js.map +1 -0
- package/dist/runtime-contract.d.ts +108 -4
- package/dist/runtime-contract.d.ts.map +1 -1
- package/dist/runtime-contract.js +178 -35
- package/dist/runtime-contract.js.map +1 -1
- package/dist/types.d.ts +128 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +19 -25
- package/server.json +15 -4
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { marrowAgentRuntime, marrowEnforcement } from './index';
|
|
2
|
+
import { type HoldPlan } from './host-approval';
|
|
2
3
|
import { MARROW_OUTAGE_WARNING } from './hook-contract';
|
|
4
|
+
/** A protected action with no Marrow key anywhere this machine keeps one (MARROW_API_KEY, ~/.marrow/env.local or ~/.marrow/env, owner-only). */
|
|
5
|
+
export declare const NO_KEY_TEXT = "Marrow can't find your key: run `npx @getmarrow/install` once in this machine's terminal.";
|
|
3
6
|
export { MARROW_OUTAGE_WARNING };
|
|
4
7
|
export declare const MAX_PRE_ACTION_INPUT_BYTES: number;
|
|
5
8
|
export declare const PRE_ACTION_CONTROL_TIMEOUT_MS = 8000;
|
|
@@ -7,6 +10,11 @@ export declare class PreActionControlTimeoutError extends Error {
|
|
|
7
10
|
readonly code = "request_timeout";
|
|
8
11
|
constructor();
|
|
9
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* A timeout (the hook's own budget, or a request that did not answer in time):
|
|
15
|
+
* Marrow is slow, not known to be down. It is never treated as an outage.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isMarrowControlTimeout(error: unknown): boolean;
|
|
10
18
|
export declare function isMarrowControlOutage(error: unknown): boolean;
|
|
11
19
|
export type PreToolUseEvent = {
|
|
12
20
|
session_id?: string;
|
|
@@ -20,6 +28,29 @@ export type PreToolUseEvent = {
|
|
|
20
28
|
permission_mode?: string;
|
|
21
29
|
scratchpad_dir?: string;
|
|
22
30
|
};
|
|
31
|
+
type HookHarness = 'claude-code' | 'cline' | 'codex' | 'cursor' | 'gemini' | 'grok' | 'windsurf' | 'mcp-client';
|
|
32
|
+
/** Fixed, privacy-preserving hold texts for hosts whose adapters accept only fixed strings. */
|
|
33
|
+
export declare const HOLD_OWNER_DENIAL = "Marrow is holding this action for approval. Retry it after approval.";
|
|
34
|
+
/** Marrow did not answer within the hook's time limit: an action that can be held stays held. */
|
|
35
|
+
export declare const HELD_SLOW_TEXT = "Marrow did not answer in time, so this action is held. Retry it in a moment.";
|
|
36
|
+
/** The only denial @getmarrow/install's Grok guard passes through (any other output blocks with a launch failure). */
|
|
37
|
+
export declare const GROK_FIXED_DENIAL = "Marrow blocked this protected action.";
|
|
38
|
+
/**
|
|
39
|
+
* The hook's answer for an ordinary held action, per host. A Claude Code "ask"
|
|
40
|
+
* reason is shown to the user only; a Cursor user_message is shown only in the
|
|
41
|
+
* client; neither ever reaches the agent with an approval code.
|
|
42
|
+
*/
|
|
43
|
+
export declare function heldActionHookOutput(harness: HookHarness, plan: HoldPlan, code?: string | null): Record<string, unknown> | null;
|
|
44
|
+
/**
|
|
45
|
+
* The hook's answer when the host's own approval step decides (owner rule):
|
|
46
|
+
* neutral, never an explicit allow, so the host's normal permission flow runs.
|
|
47
|
+
* Codex: no permissionDecision (only context for the agent); Cline: not
|
|
48
|
+
* cancelled; Windsurf: exit 0 (emitted by the caller). Any other host has no
|
|
49
|
+
* neutral answer here and never gets a pass plan.
|
|
50
|
+
*/
|
|
51
|
+
export declare function passHookOutput(harness: HookHarness, contextText: string): Record<string, unknown> | null;
|
|
52
|
+
/** The hook's answer when a waited hold was approved and the same action is retried. */
|
|
53
|
+
export declare function approvedHoldHookOutput(harness: HookHarness, contextText: string): Record<string, unknown> | null;
|
|
23
54
|
type PreActionControlResult = {
|
|
24
55
|
runtime: Awaited<ReturnType<typeof marrowAgentRuntime>> | null;
|
|
25
56
|
permit: Awaited<ReturnType<typeof marrowEnforcement>> | null;
|
|
@@ -27,6 +58,8 @@ type PreActionControlResult = {
|
|
|
27
58
|
enforcementError?: string;
|
|
28
59
|
failure?: 'credential_scope' | 'unavailable';
|
|
29
60
|
outage?: boolean;
|
|
61
|
+
/** Marrow did not answer inside the hook's time budget (slow, not down). */
|
|
62
|
+
timedOut?: boolean;
|
|
30
63
|
};
|
|
31
64
|
export declare function isMarrowOutage(result: PreActionControlResult): boolean;
|
|
32
65
|
export declare function controlFailureKind(error: unknown): PreActionControlResult['failure'];
|
|
@@ -34,6 +67,7 @@ export declare function controlRejectionMessage(error: unknown, agentId?: string
|
|
|
34
67
|
export type OwnerApprovalPrompt = {
|
|
35
68
|
available: boolean;
|
|
36
69
|
unavailableReason: string;
|
|
70
|
+
headless?: boolean;
|
|
37
71
|
};
|
|
38
72
|
/**
|
|
39
73
|
* Whether a PreToolUse "ask" from this hook reaches a person who can approve.
|
|
@@ -87,7 +121,9 @@ export declare function grokPreActionHookOutput(result: PreActionControlResult):
|
|
|
87
121
|
decision: 'allow' | 'deny';
|
|
88
122
|
reason?: string;
|
|
89
123
|
};
|
|
90
|
-
export declare function preActionHookOutput(result: PreActionControlResult, harness?: 'claude-code' | 'cline' | 'codex' | 'cursor' | 'gemini' | 'grok' | 'windsurf' | 'mcp-client', prompt?: OwnerApprovalPrompt
|
|
124
|
+
export declare function preActionHookOutput(result: PreActionControlResult, harness?: 'claude-code' | 'cline' | 'codex' | 'cursor' | 'gemini' | 'grok' | 'windsurf' | 'mcp-client', prompt?: OwnerApprovalPrompt,
|
|
125
|
+
/** An older service without host approvals: Claude Code asks in its dialog exactly as 3.9.98 did. */
|
|
126
|
+
legacyServiceAsk?: boolean): Record<string, unknown>;
|
|
91
127
|
type HeldDecision = {
|
|
92
128
|
decisionId: string | null;
|
|
93
129
|
gateReceiptId: string | null;
|
|
@@ -99,6 +135,11 @@ export declare const DENIED_DECISION_CLOSE_TIMEOUT_MS = 2500;
|
|
|
99
135
|
* an "ask": an approved prompt runs the action and its outcome is still open.
|
|
100
136
|
*/
|
|
101
137
|
export declare function closeDeniedDecision(apiKey: string, baseUrl: string, held: HeldDecision, reason: string, sessionId: string, agentId?: string): Promise<boolean>;
|
|
138
|
+
export declare function localApprovalCategories(action: {
|
|
139
|
+
action: string;
|
|
140
|
+
type: string;
|
|
141
|
+
surfaces: string[];
|
|
142
|
+
}): string[];
|
|
102
143
|
export declare function installPreActionHook(startDir?: string): {
|
|
103
144
|
settingsPath: string;
|
|
104
145
|
installed: boolean;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAK5G,OAAO,EAsBL,KAAK,QAAQ,EAEd,MAAM,iBAAiB,CAAC;AAiBzB,OAAO,EASL,qBAAqB,EAGtB,MAAM,iBAAiB,CAAC;AACzB,gJAAgJ;AAChJ,eAAO,MAAM,WAAW,8FAAgG,CAAC;AAEzH,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;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAM9D;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,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,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