granttap-mcp 0.8.128 → 0.8.129

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.
@@ -23,6 +23,8 @@ import { confirmPendingController } from "../../pairing/controllers";
23
23
  import { recordControllerName } from "../../pairing/presence";
24
24
  import { startPublishLoop } from "./publish-loop";
25
25
  import { openChatUpdates, OPEN_CHAT_INTERVAL_MS } from "../../session-catalog/open-chat-updates";
26
+ import { refreshObservedCatalog } from "../../session-catalog/observed-state";
27
+ import { hasPendingDeliveries } from "../../reply";
26
28
  import { singleFlightPublisher } from "./single-flight";
27
29
  import { publishedCatalog, rememberPublishedCatalog, resumePublishedChats,
28
30
  publishCatalogHeads, stopCatalogHeads } from "../../session-catalog";
@@ -151,7 +153,7 @@ async function publishMonitorTick(input: {
151
153
  const includeHistory = forceHistory || (!initial && Date.now() - lastHistoryPublishedAt >= HISTORY_INTERVAL_MS);
152
154
  const snapshot = await monitorSnapshot({ includeHistory, forceHistory, subscriptions, history });
153
155
  if (!input.active()) return { lastHistoryPublishedAt };
154
- const status = decorateTaskOriginCatalog(snapshot, client.room);
156
+ const status = decorateTaskOriginCatalog(refreshObservedCatalog(snapshot), client.room);
155
157
  rememberPublishedCatalog(client, status);
156
158
  await client.send(status, "phone", { ttlMs: INTERVAL_MS * 24, reliable: false });
157
159
  // Provider review is independent of task visibility; a hung hook RPC must
@@ -179,7 +181,7 @@ export function startSessionMonitor(client: RelayClient): SessionMonitor {
179
181
  let historyRead: Promise<SessionsStatus["sessions"]> | undefined;
180
182
  let lastHistoryPublishedAt = 0;
181
183
  let closed = false;
182
- const work = runtimeWorkTracker(() => approvalsStatus().pending.length > 0 || providerLogins.active() || deviceManagementWorkActive());
184
+ const work = runtimeWorkTracker(() => hasPendingDeliveries() || approvalsStatus().pending.length > 0 || providerLogins.active() || deviceManagementWorkActive());
183
185
  const loadLoop = monitorLoadLoop(client, leadership);
184
186
 
185
187
  const history = (force = false): Promise<SessionsStatus["sessions"]> => {
@@ -37,6 +37,9 @@ 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
+ /** Acknowledging a message does not finish the provider turn or permit a runtime handoff. */
41
+ export function hasPendingDeliveries(): boolean { return inFlight.size > 0; }
42
+
40
43
  /** Request a stop for owned processes; confirmation arrives only on process exit. */
41
44
  export function stopDeliveries(sessionId: string): number {
42
45
  try { localRoutingRequests().cancel(sessionId); } catch { /* The native stop still runs when storage is unavailable. */ }
@@ -39,3 +39,7 @@ remain single-flight and bounded to eight chats per pass. Claude end-turn and
39
39
  Codex turn events update execution state immediately after observation. The same
40
40
  native observation releases queued messages without waiting for full discovery.
41
41
  A fresh chat does not advance the observation clock of unrelated catalog rows.
42
+ Full discoveries recheck known native execution state immediately before sending
43
+ their catalog, so a scan started during a turn cannot restore stale Working after
44
+ an independently delivered completion. Runtime handoff also waits for owned
45
+ provider turns to settle, including work already acknowledged to the phone.
@@ -1,7 +1,7 @@
1
1
  import {statSync} from 'node:fs';
2
2
  import {join} from 'node:path';
3
3
  import {homedir} from 'node:os';
4
- import type {SessionInfo} from '../../../../packages/protocol/schema';
4
+ import type {SessionInfo, SessionsStatus} from '../../../../packages/protocol/schema';
5
5
  import {localTaskTransfers} from '../task-transfer';
6
6
  import {nativeTranscriptSource} from '../sessions/native-source';
7
7
  import {claudeLogPath} from '../sessions/scan/claude/shared';
@@ -16,6 +16,12 @@ type NativeClock={revision:string;lastActivityAt:number;claude:ClaudeTurnClock;c
16
16
  const clocks=new Map<string,NativeClock>();
17
17
  export type SessionObservation={session:SessionInfo;revision:string};
18
18
 
19
+ /** Discovery may have started before an open chat finished its turn. Recheck before publication. */
20
+ export function refreshObservedCatalog(status: SessionsStatus): SessionsStatus {
21
+ const refresh = (session: SessionInfo) => observeSessionExecution(session)?.session ?? session;
22
+ return {...status, sessions: status.sessions.map(refresh), history: status.history?.map(refresh)};
23
+ }
24
+
19
25
  /** A known chat uses one bounded native tail, never discovery across unrelated projects. */
20
26
  export function observeSessionExecution(input:SessionInfo):SessionObservation|undefined {
21
27
  const native=localTaskTransfers().nativeSession(input);
@@ -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.128
13
+ npm install -g granttap-mcp@0.8.129
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.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"
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.129\";\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.128";
10
+ const PACKAGE = "granttap-mcp@0.8.129";
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.128",
3
+ "version": "0.8.129",
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": {