granttap-mcp 0.8.127 → 0.8.128

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.
@@ -1,6 +1,7 @@
1
1
  import type { SessionInfo, SessionsStatus } from "../../../../../packages/protocol/schema";
2
2
  import type { RelayClient } from "../../../../../packages/core/relay-client";
3
3
  import { sendSessionPayload } from "../../host/session-keys";
4
+ import { observeSessionExecution } from "../../session-catalog/observed-state";
4
5
  import { cachedSessionActivity } from "../support/session-activity";
5
6
  import { readTranscriptHistory } from "../../transcript-history";
6
7
  import { publishedSession } from "../../session-catalog";
@@ -84,11 +85,13 @@ async function sendTranscript(
84
85
  threadId?: string,
85
86
  history?: { history?: boolean; historyCursor?: string; peerPublicKey?: string },
86
87
  ): Promise<boolean> {
87
- const session = resolveSession(client, sessionId, status);
88
- if (!session) return false;
88
+ const known = resolveSession(client, sessionId, status);
89
+ if (!known) return false;
90
+ const observation = observeSessionExecution(known);
91
+ const session = observation?.session ?? known;
89
92
  const activity = threadId ? scanThreadActivity(session, threadId)
90
93
  : (history?.history ? readTranscriptHistory(session, history.historyCursor) : undefined)
91
- ?? cachedSessionActivity(session);
94
+ ?? cachedSessionActivity(session, false, observation?.revision);
92
95
  await sendSessionPayload(client, activityWithImages(activity), sessionId, "phone", {
93
96
  ttlMs: INTERVAL_MS * 24,
94
97
  reliable: false,
@@ -22,6 +22,7 @@ import { HEARTBEAT_INTERVAL_MS, publishHeartbeat } from "./heartbeat";
22
22
  import { confirmPendingController } from "../../pairing/controllers";
23
23
  import { recordControllerName } from "../../pairing/presence";
24
24
  import { startPublishLoop } from "./publish-loop";
25
+ import { openChatUpdates, OPEN_CHAT_INTERVAL_MS } from "../../session-catalog/open-chat-updates";
25
26
  import { singleFlightPublisher } from "./single-flight";
26
27
  import { publishedCatalog, rememberPublishedCatalog, resumePublishedChats,
27
28
  publishCatalogHeads, stopCatalogHeads } from "../../session-catalog";
@@ -234,6 +235,15 @@ export function startSessionMonitor(client: RelayClient): SessionMonitor {
234
235
  publish: () => publishHeartbeat(client).catch(() => {}),
235
236
  });
236
237
  const stopQuestions = startQuestionLoop(client, leadership, subscriptions);
238
+ const stopChats = startPublishLoop({
239
+ connected: () => client.isConnected,
240
+ intervalMs: OPEN_CHAT_INTERVAL_MS,
241
+ publish: openChatUpdates({
242
+ catalog: () => publishedCatalog(client), subscriptions,
243
+ active: () => !closed && client.isConnected && leadership.acquire(),
244
+ publish: (id, status) => publishSessionEvents(client, id, status),
245
+ }),
246
+ });
237
247
 
238
248
  return {
239
249
  publish: () => publish(false),
@@ -248,6 +258,7 @@ export function startSessionMonitor(client: RelayClient): SessionMonitor {
248
258
  stopMonitorMeshes(client);
249
259
  stopHeartbeat();
250
260
  stopQuestions();
261
+ stopChats();
251
262
  loadLoop.stop();
252
263
  off();
253
264
  subscriptions.clear();
@@ -28,10 +28,10 @@ function cacheKey(session: SessionInfo): string {
28
28
  export function sessionActivityCache(
29
29
  read: ActivityReader,
30
30
  capacity = 64,
31
- ): (session: SessionInfo, forceScan?: boolean) => SessionActivity {
31
+ ): (session: SessionInfo, forceScan?: boolean, sourceRevision?: string) => SessionActivity {
32
32
  const cache = new Map<string, SessionActivity>();
33
- return (session, forceScan = false) => {
34
- const key = cacheKey(session);
33
+ return (session, forceScan = false, sourceRevision = "") => {
34
+ const key = `${cacheKey(session)}\0${sourceRevision}`;
35
35
  if (!forceScan) {
36
36
  const hit = cache.get(key);
37
37
  // Refresh recency so a chat the user keeps open is never the eviction
@@ -32,3 +32,10 @@ and metadata caches serve synchronous CLI readers and cooperative live-monitor
32
32
  readers. Checkout observations are scoped to one asynchronous scan, so unrelated
33
33
  requests cannot inherit an old directory result. Socket recovery immediately
34
34
  republishes the current catalog instead of waiting for the next periodic tick.
35
+
36
+ Open and working chats follow a separate two-second loop of known native sources.
37
+ Only changed source revisions send encrypted transcript heads; reads and sends
38
+ remain single-flight and bounded to eight chats per pass. Claude end-turn and
39
+ Codex turn events update execution state immediately after observation. The same
40
+ native observation releases queued messages without waiting for full discovery.
41
+ A fresh chat does not advance the observation clock of unrelated catalog rows.
@@ -0,0 +1,59 @@
1
+ import {statSync} from 'node:fs';
2
+ import {join} from 'node:path';
3
+ import {homedir} from 'node:os';
4
+ import type {SessionInfo} from '../../../../packages/protocol/schema';
5
+ import {localTaskTransfers} from '../task-transfer';
6
+ import {nativeTranscriptSource} from '../sessions/native-source';
7
+ import {claudeLogPath} from '../sessions/scan/claude/shared';
8
+ import {previousNativeLines} from '../transcript-history/native-lines';
9
+ import {observeClaudeTurn,claudeTurnState,type ClaudeTurnClock} from '../sessions/scan/claude/turn-state';
10
+ import {observeCodexTurn,codexTurnState,type CodexTurnClock} from '../sessions/scan/codex/turn-state';
11
+ import {ts} from '../sessions/support/common';
12
+ import {grokResumeActivity} from '../providers/grok-activity';
13
+ import {cursorConversationSession} from '../sessions/cursor';
14
+
15
+ type NativeClock={revision:string;lastActivityAt:number;claude:ClaudeTurnClock;codex:CodexTurnClock};
16
+ const clocks=new Map<string,NativeClock>();
17
+ export type SessionObservation={session:SessionInfo;revision:string};
18
+
19
+ /** A known chat uses one bounded native tail, never discovery across unrelated projects. */
20
+ export function observeSessionExecution(input:SessionInfo):SessionObservation|undefined {
21
+ const native=localTaskTransfers().nativeSession(input);
22
+ if(native.agent==='cursor'){
23
+ const current=cursorConversationSession(native.sessionId);
24
+ return current?{session:{...input,state:current.state,lastActivityAt:current.lastActivityAt},revision:`${current.lastActivityAt}:${current.state}`}:undefined;
25
+ }
26
+ if(native.agent==='grok'){
27
+ const live=grokResumeActivity(native);
28
+ if(!native.cwd||!live)return;
29
+ const root=process.env.GRANTTAP_GROK_SESSIONS_DIR??join(process.env.GROK_HOME??join(homedir(),'.grok'),'sessions');
30
+ try{
31
+ const stat=statSync(join(root,encodeURIComponent(native.cwd),native.sessionId,'updates.jsonl'));
32
+ return {session:{...input,state:live.state,lastActivityAt:Math.max(input.lastActivityAt,live.updatedAt)},revision:`${stat.ino}:${stat.size}:${stat.mtimeMs}:${live.state}`};
33
+ }catch{return;}
34
+ }
35
+ if(native.agent!=='claude'&&native.agent!=='codex')return;
36
+ const path=nativeTranscriptSource(native)??(native.agent==='claude'?claudeLogPath(native.sessionId):undefined);
37
+ if(!path)return;
38
+ try{
39
+ const stat=statSync(path),revision=`${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeMs}`;
40
+ const key=`${native.agent}:${native.sessionId}:${path}`;
41
+ let clock=clocks.get(key);
42
+ if(clock?.revision!==revision){
43
+ const window=previousNativeLines(path,native.sessionId);if(!window)return;
44
+ clock={revision,lastActivityAt:0,claude:{},codex:{}};
45
+ for(const line of window.lines){
46
+ let row;try{row=JSON.parse(line.text)}catch{continue}
47
+ if(row.isSidechain===true||row.sessionId&&row.sessionId!==native.sessionId)continue;
48
+ clock.lastActivityAt=Math.max(clock.lastActivityAt,ts(row.timestamp));
49
+ if(native.agent==='claude')observeClaudeTurn(row,clock.claude);else observeCodexTurn(row,clock.codex);
50
+ }
51
+ clocks.delete(key);clocks.set(key,clock);
52
+ while(clocks.size>256)clocks.delete(clocks.keys().next().value!);
53
+ }
54
+ const at=Math.max(input.lastActivityAt,clock!.lastActivityAt);
55
+ const state=native.agent==='claude'?claudeTurnState(clock!.claude,at,input.state)
56
+ :clock!.codex.startedAt||clock!.codex.endedAt?codexTurnState(clock!.codex,at):input.state;
57
+ return {session:{...input,state,lastActivityAt:at},revision:`${revision}:${state}`};
58
+ }catch{return;}
59
+ }
@@ -0,0 +1,52 @@
1
+ import type {SessionInfo, SessionsStatus} from '../../../../packages/protocol/schema';
2
+ import {observeSessionExecution, type SessionObservation} from './observed-state';
3
+
4
+ export const OPEN_CHAT_INTERVAL_MS = 2_000;
5
+
6
+ /** Follow known native files independently of discovery, without rereading unchanged heads. */
7
+ export function openChatUpdates(options: {
8
+ catalog: () => SessionsStatus | undefined;
9
+ subscriptions: ReadonlySet<string>;
10
+ active: () => boolean;
11
+ publish: (sessionId: string, status: SessionsStatus) => Promise<boolean>;
12
+ observe?: (session: SessionInfo) => SessionObservation | undefined;
13
+ }): () => Promise<void> {
14
+ const revisions = new Map<string, string>();
15
+ const observe = options.observe ?? observeSessionExecution;
16
+ let cursor = 0, openCursor = 0, running = false;
17
+ return async () => {
18
+ if (running || !options.active()) return;
19
+ const status = options.catalog();
20
+ if (!status) return;
21
+ const known = new Map([...status.sessions, ...(status.history ?? [])]
22
+ .map(session => [session.sessionId, session]));
23
+ const ids = [...new Set([...options.subscriptions,
24
+ ...status.sessions.filter(session => session.state === 'working').map(session => session.sessionId)])]
25
+ .filter(id => known.has(id));
26
+ const activeIds = new Set(ids);
27
+ for (const id of revisions.keys()) if (!activeIds.has(id)) revisions.delete(id);
28
+ if (!ids.length) return;
29
+ const opened = ids.filter(id => options.subscriptions.has(id));
30
+ const background = ids.filter(id => !options.subscriptions.has(id));
31
+ const selected = Array.from({length: Math.min(8, opened.length)}, (_, offset) => opened[(openCursor + offset) % opened.length]!);
32
+ openCursor = opened.length ? (openCursor + selected.length) % opened.length : 0;
33
+ const remaining = Math.min(8 - selected.length, background.length);
34
+ selected.push(...Array.from({length: remaining}, (_, offset) => background[(cursor + offset) % background.length]!));
35
+ cursor = background.length ? (cursor + remaining) % background.length : 0;
36
+ running = true;
37
+ try {
38
+ for (const id of selected) {
39
+ await new Promise<void>(resolve => setImmediate(resolve));
40
+ if (!options.active()) break;
41
+ let observed: SessionObservation | undefined;
42
+ try { observed = observe(known.get(id)!); } catch { continue; }
43
+ if (!observed || revisions.get(id) === observed.revision) continue;
44
+ // Keep the full catalog's clock: one fresh chat cannot refresh unrelated chats.
45
+ const fresh = {...status, sessions: [observed.session], history: undefined};
46
+ try {
47
+ if (await options.publish(id, fresh)) revisions.set(id, observed.revision);
48
+ } catch { /* Retry the same revision after a failed encrypted send. */ }
49
+ }
50
+ } finally { running = false; }
51
+ };
52
+ }
@@ -4,6 +4,7 @@ import { basename } from "node:path";
4
4
  import type { ChildThreadInfo, SessionInfo } from "../../../../../../packages/protocol/schema";
5
5
  import { aggregateChildThreads, childTitle } from "../../support/child-threads";
6
6
  import { rememberCapabilityObservation } from "../../telemetry";
7
+ import { observeClaudeTurn } from "./turn-state";
7
8
  import { safeParse, stateFor, ts } from "../../support/common";
8
9
  import { claudeCapabilityUsage } from "./activity";
9
10
  import { claudeRepositoryPaths } from "./repository-observation";
@@ -35,18 +36,8 @@ type ClaudeParseState = {
35
36
  turnEnded: boolean;
36
37
  };
37
38
 
38
- /** Stop reasons after which Claude Code waits for the person's next prompt. */
39
- const FINISHED_TURN = new Set(["end_turn", "stop_sequence", "max_tokens"]);
40
-
41
- /** Metadata, progress and subagent lines do not start or end the chat's own turn. */
42
- function noteTurnBoundary(d: any, state: ClaudeParseState): void {
43
- if (d.isSidechain === true) return;
44
- if (d.type === "user" || d.type === "queue-operation") state.turnEnded = false;
45
- else if (d.type === "assistant") state.turnEnded = FINISHED_TURN.has(d.message?.stop_reason);
46
- }
47
-
48
39
  function applyClaudeLine(d: any, state: ClaudeParseState): void {
49
- noteTurnBoundary(d, state);
40
+ observeClaudeTurn(d, state);
50
41
  if (d.isSidechain !== true) state.repositoryPaths.push(...claudeRepositoryPaths(d));
51
42
  state.repositoryPaths = state.repositoryPaths.slice(-64);
52
43
  if (d.sessionId && !state.sessionId) state.sessionId = String(d.sessionId);
@@ -0,0 +1,9 @@
1
+ # Claude turn state
2
+
3
+ Root turn boundaries are shared by full discovery and bounded live observations.
4
+ An assistant end-turn record ends Working immediately; sidechain and progress
5
+ records do not reopen that root turn. A later user or queued turn reopens it.
6
+
7
+ Covered by sessions/tests/claude-turn-state.test.ts and session-catalog freshness tests.
8
+
9
+ This module uses the GrantTap Commercial Source License.
@@ -0,0 +1,17 @@
1
+ import {stateFor} from '../../../support/common';
2
+ import type {SessionInfo} from '../../../../../../../packages/protocol/schema';
3
+
4
+ export type ClaudeTurnClock = {turnEnded?: boolean};
5
+ const finished = new Set(['end_turn','stop_sequence','max_tokens']);
6
+
7
+ /** Root turn boundaries only; progress and sidechain records cannot resume a finished turn. */
8
+ export function observeClaudeTurn(row: any, clock: ClaudeTurnClock): void {
9
+ if (row.isSidechain === true) return;
10
+ if (row.type === 'user' || row.type === 'queue-operation') clock.turnEnded = false;
11
+ else if (row.type === 'assistant') clock.turnEnded = finished.has(row.message?.stop_reason);
12
+ }
13
+
14
+ export function claudeTurnState(clock: ClaudeTurnClock, lastActivityAt: number,
15
+ fallback: SessionInfo['state']): SessionInfo['state'] {
16
+ return clock.turnEnded === undefined ? fallback : clock.turnEnded ? 'idle' : stateFor(lastActivityAt);
17
+ }
@@ -9,10 +9,8 @@ import { TaskDispatchInbox } from '../index';
9
9
  import { TaskDispatchWorker } from './index';
10
10
  import { relayTaskJobRemote } from './remote';
11
11
  import { NativeTaskQueueSender } from '../sender';
12
- import { queuedCatalogRefreshDue, taskDispatchReady } from './readiness';
12
+ import { dispatchSessionObservation, queuedCatalogRefreshDue, taskDispatchReady } from './readiness';
13
13
  import { localTaskOrigins, resolveTaskOriginJob } from '../../task-origins';
14
- import { grokResumeActivity } from '../../providers/grok-activity';
15
- import { localTaskTransfers } from '../../task-transfer';
16
14
 
17
15
  /** Only the persistent monitor advertises durable submission capability. */
18
16
  export function startTaskDispatchMonitor(input: {
@@ -45,10 +43,7 @@ export function startTaskDispatchMonitor(input: {
45
43
  const catalog = publishedCatalog(input.client);
46
44
  const session = [...(catalog?.sessions ?? []), ...(catalog?.history ?? [])]
47
45
  .find(item => item.sessionId === job.sessionId);
48
- const nativeState = session?.agent === 'grok'
49
- ? grokResumeActivity(localTaskTransfers().nativeSession(session))?.state : undefined;
50
- const observation = { session, generatedAt: catalog?.generatedAt,
51
- nativeState,
46
+ const observation = { ...dispatchSessionObservation(session, catalog?.generatedAt),
52
47
  inFlight: isDeliveryInFlight(job.sessionId ?? `__new_${job.operation.agent ?? 'codex'}_task__`),
53
48
  paused: !!job.sessionId && isSessionPaused(job.sessionId) };
54
49
  const ready = taskDispatchReady(job, observation);
@@ -1,4 +1,12 @@
1
1
  import type { SessionInfo, TaskDispatch } from '../../../../../packages/protocol/schema';
2
+ import { observeSessionExecution } from '../../session-catalog/observed-state';
3
+
4
+ /** A known native tail can release a queued turn before the next full discovery. */
5
+ export function dispatchSessionObservation(session: SessionInfo | undefined, generatedAt?: number) {
6
+ const fresh = session && observeSessionExecution(session);
7
+ return { session: fresh?.session ?? session, generatedAt: fresh ? Date.now() : generatedAt,
8
+ nativeState: fresh?.session.state };
9
+ }
2
10
 
3
11
  /** Manual release bypasses busy state only. Pause, native admission and policy still win. */
4
12
  export function taskDispatchReady(job: TaskDispatch, observation: {
@@ -1,3 +1,4 @@
1
+ import { observeSessionExecution } from "../session-catalog/observed-state";
1
2
  import { localTaskTransfers, transferHistory } from "../task-transfer";
2
3
  import type { ActivityEntry, SessionActivity, SessionInfo } from "../../../../packages/protocol/schema";
3
4
  import { appendCodexActivity, codexCapabilityUsage } from "../sessions/scan/codex/activity";
@@ -8,7 +9,6 @@ import { recordedFileChanges } from "./changes";
8
9
  import { recordedToolDetails } from "./tool-details";
9
10
  import { completedTurnChanges } from "./turn-changes";
10
11
  import { cursorActivity, cursorConversationHistory } from "../sessions/cursor";
11
- import { parseCodexFile } from '../sessions/scan/codex/parse';
12
12
  export { nativeImageLines } from "./images";
13
13
  export { nativeTranscriptImage } from './images/native';
14
14
  export { nativeTranscriptEntry } from './images/advertised-entry';
@@ -94,7 +94,7 @@ export function readTranscriptHistory(input: SessionInfo, cursor?: string): Sess
94
94
  : window.lines[0]?.offset ?? window.start;
95
95
  const prior = input.sessionId !== session.sessionId && offset === 0 ? transferHistory(input) : undefined;
96
96
  return { type: "session.activity", sessionId: input.sessionId, agent: session.agent,
97
- state: session.agent === 'codex' ? parseCodexFile(path)?.session.state ?? session.state : session.state,
97
+ state: cursor ? session.state : observeSessionExecution(input)?.session.state ?? session.state,
98
98
  entries, generatedAt: Date.now(), history: {
99
99
  hasMore: offset > 0 || Boolean(prior?.entries.length),
100
100
  ...(offset > 0 ? { cursor: window.cursorAt(offset) }
@@ -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.127
13
+ npm install -g granttap-mcp@0.8.128
14
14
  granttap setup
15
15
  granttap status
16
16
  ```
@@ -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.127\";\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"
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.128\";\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.127";
10
+ const PACKAGE = "granttap-mcp@0.8.128";
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "granttap-mcp",
3
- "version": "0.8.127",
3
+ "version": "0.8.128",
4
4
  "description": "Commercial computer runtime connecting local coding agents to GrantTap on Mac, iPhone, iPad and Apple Watch.",
5
5
  "type": "module",
6
6
  "bin": {