granttap-mcp 0.8.132 → 0.8.133
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/apps/bridge/src/bin/hooks/claude-hook.ts +3 -3
- package/apps/bridge/src/policy/README.md +5 -3
- package/apps/bridge/src/policy/index.ts +4 -1
- package/apps/bridge/src/reply/index.ts +9 -4
- package/apps/bridge/src/task-dispatch/worker/index.ts +2 -2
- package/apps/bridge/src/task-dispatch/worker/monitor.ts +9 -6
- package/cursor-plugin/README.md +1 -1
- package/cursor-plugin/mcp.json +1 -1
- package/cursor-plugin/stdio-bootstrap.cjs +1 -1
- package/package.json +1 -1
|
@@ -100,9 +100,9 @@ async function handlePreToolUse(input: HookInput): Promise<void> {
|
|
|
100
100
|
}
|
|
101
101
|
const legacyFlow = legacyGrantTapFlowAllowed(projectDecision);
|
|
102
102
|
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
if (
|
|
103
|
+
// The person gave this chat unconditional tool access, so nothing here waits
|
|
104
|
+
// for their phone. Project DENY returned above and stays binding.
|
|
105
|
+
if (input.permission_mode === "bypassPermissions" && input.tool_name !== "AskUserQuestion") return;
|
|
106
106
|
|
|
107
107
|
// Gating paused, or this session is exempt → abstain (empty output = Claude
|
|
108
108
|
// uses its normal permission flow, exactly as if GrantTap weren't installed).
|
|
@@ -8,9 +8,11 @@ disabled or the engine cannot answer.
|
|
|
8
8
|
|
|
9
9
|
`capability-fingerprint.ts` turns provider tool metadata into a bounded
|
|
10
10
|
capability fingerprint. It never copies raw tool arguments, commands, secrets,
|
|
11
|
-
or absolute file paths into the fingerprint. Project `DENY`
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
or absolute file paths into the fingerprint. Project `DENY` is a parent boundary
|
|
12
|
+
for every chat. Claude `bypassPermissions` passes a Project `ASK` because the
|
|
13
|
+
person gave that chat unconditional access; paused gating and auto-accept may run
|
|
14
|
+
only after an `ALLOW` or `INHERIT` result. A chat's auto-accept rule can narrow an
|
|
15
|
+
explicit Project level; a Project without its own level sets no ceiling for it.
|
|
14
16
|
|
|
15
17
|
Codex `PreToolUse` never waits for a phone. A Project `ASK` creates an owner-only
|
|
16
18
|
30-second marker bound to the exact session, `tool_use_id`, tool, and normalized
|
|
@@ -127,8 +127,11 @@ export function resolveAutoAcceptLevel(opts: {
|
|
|
127
127
|
const sid = opts.sessionId;
|
|
128
128
|
const projectId = opts.projectId;
|
|
129
129
|
if (projectId) {
|
|
130
|
-
const
|
|
130
|
+
const explicitProjectLevel = opts.byProject?.[projectId];
|
|
131
131
|
const taskLevel = sid ? opts.bySession?.[sid] : undefined;
|
|
132
|
+
// A Project without its own rule sets no ceiling for a chat rule the person chose.
|
|
133
|
+
if (!explicitProjectLevel && taskLevel) return taskLevel;
|
|
134
|
+
const projectLevel = explicitProjectLevel ?? opts.defaultLevel ?? "ask";
|
|
132
135
|
if (!taskLevel) return projectLevel;
|
|
133
136
|
// A native-session override can narrow Project automation, never enlarge
|
|
134
137
|
// it. More permissive exceptions require a separate governed operation.
|
|
@@ -37,6 +37,11 @@ const inFlight = new Map<string, Promise<ReplyResult | null>>();
|
|
|
37
37
|
|
|
38
38
|
export function isDeliveryInFlight(sessionId: string): boolean { return inFlight.has(sessionId); }
|
|
39
39
|
|
|
40
|
+
/** New tasks are separate conversations: one long run must not hold back the next. */
|
|
41
|
+
export function newTaskDeliveryKey(agent: string, operationKey?: string): string {
|
|
42
|
+
return `__new_${agent}_task__${operationKey ? `:${operationKey}` : ''}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
/** Acknowledging a message does not finish the provider turn or permit a runtime handoff. */
|
|
41
46
|
export function hasPendingDeliveries(): boolean { return inFlight.size > 0; }
|
|
42
47
|
|
|
@@ -109,7 +114,7 @@ export function createCodexSession(
|
|
|
109
114
|
effort?: string,
|
|
110
115
|
): Promise<ReplyResult> {
|
|
111
116
|
const workspace = resolveAgentWorkspace(cwd, "codex");
|
|
112
|
-
return queued("
|
|
117
|
+
return queued(newTaskDeliveryKey("codex", operationKey), () => withAttachments(attachments, text, (prepared) =>
|
|
113
118
|
runCodexNew(prepared.prompt, workspace, timeoutMs, prepared.images, model, operationKey, effort),
|
|
114
119
|
));
|
|
115
120
|
}
|
|
@@ -125,7 +130,7 @@ export function createClaudeSession(
|
|
|
125
130
|
effort?: string,
|
|
126
131
|
): Promise<ReplyResult> {
|
|
127
132
|
const workspace = resolveAgentWorkspace(cwd, "claude");
|
|
128
|
-
return queued("
|
|
133
|
+
return queued(newTaskDeliveryKey("claude", operationKey), () => withAttachments(attachments, text, (prepared) =>
|
|
129
134
|
runClaudeNew(prepared.claudePrompt, workspace, timeoutMs, model, operationKey, effort),
|
|
130
135
|
));
|
|
131
136
|
}
|
|
@@ -141,7 +146,7 @@ export function createCursorSession(
|
|
|
141
146
|
onNativeSession?: (sessionId: string) => void,
|
|
142
147
|
): Promise<ReplyResult> {
|
|
143
148
|
const workspace = resolveAgentWorkspace(cwd, "cursor");
|
|
144
|
-
return queued("
|
|
149
|
+
return queued(newTaskDeliveryKey("cursor", operationKey), () => withAttachments(attachments, text, (prepared) =>
|
|
145
150
|
runCursorNew(prepared.claudePrompt, workspace, timeoutMs, model, operationKey, effort, onNativeSession),
|
|
146
151
|
));
|
|
147
152
|
}
|
|
@@ -157,7 +162,7 @@ export function createGrokSession(
|
|
|
157
162
|
onNativeSession?: (sessionId: string) => void,
|
|
158
163
|
): Promise<ReplyResult> {
|
|
159
164
|
const workspace = resolveAgentWorkspace(cwd, "grok");
|
|
160
|
-
return queued("
|
|
165
|
+
return queued(newTaskDeliveryKey("grok", operationKey), () => withAttachments(attachments, text, (prepared) =>
|
|
161
166
|
runGrokNew(prepared.claudePrompt, workspace, timeoutMs, model, operationKey, effort, onNativeSession),
|
|
162
167
|
));
|
|
163
168
|
}
|
|
@@ -10,7 +10,7 @@ export interface TaskJobRemote {
|
|
|
10
10
|
export type WorkerOptions = {
|
|
11
11
|
inbox: TaskDispatchInbox; remote: TaskJobRemote;
|
|
12
12
|
onTerminal?: (job: TaskDispatch) => void;
|
|
13
|
-
onError?: () => void;
|
|
13
|
+
onError?: (error: unknown) => void;
|
|
14
14
|
connected: () => boolean; authorized: (peer: string) => boolean;
|
|
15
15
|
conversationKey?: (job: TaskDispatch, peer: string) => string;
|
|
16
16
|
validationCode?: (job: TaskDispatch, peer: string) => string | undefined;
|
|
@@ -37,7 +37,7 @@ export class TaskDispatchWorker {
|
|
|
37
37
|
?? record.job.sessionId ?? `new:${record.job.operation.agent ?? 'codex'}`;
|
|
38
38
|
if (this.conversations.has(key)) continue;
|
|
39
39
|
this.conversations.add(key);
|
|
40
|
-
const work = this.process(record).catch(
|
|
40
|
+
const work = this.process(record).catch(error => { this.options.onError?.(error); }).finally(() => {
|
|
41
41
|
this.active.delete(record.job.jobId); this.conversations.delete(key);
|
|
42
42
|
});
|
|
43
43
|
this.active.set(record.job.jobId, work); launched.push(work);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import type { PeerConfig, RelayClient } from '../../../../../packages/core/relay-client';
|
|
3
3
|
import { configDir, isSessionPaused } from '../../config';
|
|
4
|
-
import { isDeliveryInFlight } from '../../reply';
|
|
4
|
+
import { isDeliveryInFlight, newTaskDeliveryKey } from '../../reply';
|
|
5
5
|
import { publishedCatalog } from '../../session-catalog';
|
|
6
6
|
import { handleUserMessage } from '../../monitor/handlers/user-message';
|
|
7
7
|
import { handleTaskCreate } from '../../monitor/handlers/task-create';
|
|
@@ -29,7 +29,7 @@ export function startTaskDispatchMonitor(input: {
|
|
|
29
29
|
connected: () => !stopped && input.client.isConnected && input.isLeader(),
|
|
30
30
|
authorized: peerAllowed,
|
|
31
31
|
onTerminal: job => sender.confirmReceiverOutcome(job),
|
|
32
|
-
onError:
|
|
32
|
+
onError: error => reportFailure(error),
|
|
33
33
|
conversationKey: (job, peer) => resolve(job, peer).job?.sessionId
|
|
34
34
|
?? (job.operation.type === 'user.message.continue'
|
|
35
35
|
? JSON.stringify([peer, job.operation.originMessageId]) : `new:${job.operation.agent ?? 'codex'}`),
|
|
@@ -45,7 +45,8 @@ export function startTaskDispatchMonitor(input: {
|
|
|
45
45
|
const session = [...(catalog?.sessions ?? []), ...(catalog?.history ?? [])]
|
|
46
46
|
.find(item => item.sessionId === job.sessionId);
|
|
47
47
|
const observation = { ...dispatchSessionObservation(session, catalog?.generatedAt),
|
|
48
|
-
inFlight: isDeliveryInFlight(job.sessionId ??
|
|
48
|
+
inFlight: isDeliveryInFlight(job.sessionId ?? newTaskDeliveryKey(job.operation.agent ?? 'codex',
|
|
49
|
+
job.operation.type === 'project.task.create' ? job.operation.operationId : undefined)),
|
|
49
50
|
paused: !!job.sessionId && isSessionPaused(job.sessionId) };
|
|
50
51
|
const ready = taskDispatchReady(job, observation);
|
|
51
52
|
if (!ready && queuedCatalogRefreshDue(job, observation, refreshedAt)) {
|
|
@@ -65,10 +66,12 @@ export function startTaskDispatchMonitor(input: {
|
|
|
65
66
|
return outcome;
|
|
66
67
|
},
|
|
67
68
|
});
|
|
68
|
-
const reportFailure = () => {
|
|
69
|
+
const reportFailure = (error: unknown) => {
|
|
69
70
|
if (Date.now() - reportedAt < 60_000) return;
|
|
70
71
|
reportedAt = Date.now();
|
|
71
|
-
|
|
72
|
+
// Storage and relay errors name a status or a path, never a prompt.
|
|
73
|
+
const cause = error instanceof Error ? `${error.name}: ${error.message}`.slice(0, 200) : 'unknown';
|
|
74
|
+
process.stderr.write(`[monitor] Durable task queue needs storage or relay recovery (${cause}). No prompt was replayed.\n`);
|
|
72
75
|
};
|
|
73
76
|
const tick = () => {
|
|
74
77
|
if (Date.now() - maintainedAt > 3_600_000) {
|
|
@@ -80,7 +83,7 @@ export function startTaskDispatchMonitor(input: {
|
|
|
80
83
|
const off = input.client.onTaskDispatch((job, peer) => {
|
|
81
84
|
if (stopped || !input.isLeader() || !peerAllowed(peer)) return;
|
|
82
85
|
try { if (inbox.stage(job, peer) !== 'conflict') tick(); }
|
|
83
|
-
catch { reportFailure(); }
|
|
86
|
+
catch (error) { reportFailure(error); }
|
|
84
87
|
});
|
|
85
88
|
const interval = setInterval(tick, 2_000); interval.unref();
|
|
86
89
|
tick();
|
package/cursor-plugin/README.md
CHANGED
|
@@ -10,7 +10,7 @@ keeps each phone response tied to the exact originating chat and prompt.
|
|
|
10
10
|
Install the supported CLI on this computer, then run:
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
npm install -g granttap-mcp@0.8.
|
|
13
|
+
npm install -g granttap-mcp@0.8.133
|
|
14
14
|
granttap setup
|
|
15
15
|
granttap status
|
|
16
16
|
```
|
package/cursor-plugin/mcp.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"command": "node",
|
|
5
5
|
"args": [
|
|
6
6
|
"-e",
|
|
7
|
-
"\"use strict\";\n\n// Cursor may start this MCP from any cwd. Execute JavaScript entry points with\n// Node itself: Windows batch shims require shell quoting that differs by host.\nconst { spawn } = require(\"node:child_process\");\nconst { existsSync } = require(\"node:fs\");\nconst { delimiter, dirname, join } = require(\"node:path\");\n\nconst PACKAGE = \"granttap-mcp@0.8.
|
|
7
|
+
"\"use strict\";\n\n// Cursor may start this MCP from any cwd. Execute JavaScript entry points with\n// Node itself: Windows batch shims require shell quoting that differs by host.\nconst { spawn } = require(\"node:child_process\");\nconst { existsSync } = require(\"node:fs\");\nconst { delimiter, dirname, join } = require(\"node:path\");\n\nconst PACKAGE = \"granttap-mcp@0.8.133\";\nconst dryRun = process.env.GRANTTAP_BOOTSTRAP_DRY_RUN === \"1\";\nconst platform = dryRun && process.env.GRANTTAP_BOOTSTRAP_PLATFORM\n ? process.env.GRANTTAP_BOOTSTRAP_PLATFORM : process.platform;\nconst nodeRoot = dryRun && process.env.GRANTTAP_BOOTSTRAP_NODE_ROOT\n ? process.env.GRANTTAP_BOOTSTRAP_NODE_ROOT : dirname(process.execPath);\nconst pathRoots = (process.env.PATH || \"\").split(delimiter).filter(Boolean);\nconst appData = process.env.APPDATA;\nconst roots = [nodeRoot, ...pathRoots, ...(appData ? [join(appData, \"npm\")] : [])];\nconst first = (paths) => paths.find((path) => existsSync(path));\n\nfunction launch() {\n if (platform !== \"win32\") {\n const installed = first(roots.map((root) => join(root, \"granttap-mcp\")));\n if (installed) return { command: installed, args: [] };\n const npx = first(roots.map((root) => join(root, \"npx\"))) || \"npx\";\n return { command: npx, args: [\"-y\", PACKAGE] };\n }\n const installed = first(roots.map((root) =>\n join(root, \"node_modules\", \"granttap-mcp\", \"bin\", \"granttap-mcp.mjs\")));\n if (installed) return { command: process.execPath, args: [installed] };\n const npx = first(roots.map((root) =>\n join(root, \"node_modules\", \"npm\", \"bin\", \"npx-cli.js\")));\n if (npx) return { command: process.execPath, args: [npx, \"-y\", PACKAGE] };\n throw new Error(\"Node.js/npm 22.13.0+ is required on this Windows device. Install npm and retry GrantTap.\");\n}\n\nlet target;\ntry { target = launch(); }\ncatch (error) {\n process.stderr.write(`[granttap] ${error.message}\\n`);\n process.exit(1);\n}\n\nif (dryRun) {\n process.stdout.write(JSON.stringify(target));\n process.exit(0);\n}\n\nconst child = spawn(target.command, target.args, { stdio: \"inherit\", windowsHide: true });\nchild.on(\"error\", (error) => {\n process.stderr.write(`[granttap] ${error.message}\\n`);\n process.exit(1);\n});\nchild.on(\"exit\", (code, signal) => {\n if (signal && platform !== \"win32\") {\n try { process.kill(process.pid, signal); } catch { process.exit(code ?? 1); }\n return;\n }\n process.exit(code ?? 1);\n});\n"
|
|
8
8
|
]
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -7,7 +7,7 @@ const { spawn } = require("node:child_process");
|
|
|
7
7
|
const { existsSync } = require("node:fs");
|
|
8
8
|
const { delimiter, dirname, join } = require("node:path");
|
|
9
9
|
|
|
10
|
-
const PACKAGE = "granttap-mcp@0.8.
|
|
10
|
+
const PACKAGE = "granttap-mcp@0.8.133";
|
|
11
11
|
const dryRun = process.env.GRANTTAP_BOOTSTRAP_DRY_RUN === "1";
|
|
12
12
|
const platform = dryRun && process.env.GRANTTAP_BOOTSTRAP_PLATFORM
|
|
13
13
|
? process.env.GRANTTAP_BOOTSTRAP_PLATFORM : process.platform;
|