granttap-mcp 0.8.142 → 0.8.143

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.
@@ -3,7 +3,7 @@ import { createClaudeUsageRecorder } from './recorded-usage';
3
3
  import { readFileSync, statSync } from "node:fs";
4
4
  import type { ActivityEntry, ChildThreadInfo, SessionInfo } from "../../../../../../packages/protocol/schema";
5
5
  import { safeParse, ts } from "../../support/common";
6
- import { classifyTool, estimateTokens, pastedImageLabel, pushEntry as appendEntry, type PushEntryInput, toolDescription, toolSummary } from "../../support/activity-helpers";
6
+ import { claudeTranscriptRecord, classifyTool, estimateTokens, pastedImageLabel, pushEntry as appendEntry, type PushEntryInput, toolDescription, toolSummary } from "../../support/activity-helpers";
7
7
  import { childEntryFields } from "../../support/child-threads";
8
8
  import { diffPreviewFromInput, patchStatsByToolUse, sensitivePath, statsFromInput } from "../../support/edit-stats";
9
9
  import { redactSecrets } from "../../telemetry/command-preview";
@@ -246,7 +246,7 @@ export function appendClaudeActivity(input: {
246
246
  const patches = patchStatsByToolUse(lines, safeParse, redactSecrets);
247
247
  lines.forEach((line, index) => {
248
248
  const d = safeParse(line);
249
- if (!d) return;
249
+ if (!d || !claudeTranscriptRecord(d)) return;
250
250
  const createdAt = ts(d.timestamp) || session.lastActivityAt;
251
251
  const content = d.message?.content;
252
252
  if (d.type === "user" || d.message?.role === "user") {
@@ -8,7 +8,7 @@ import { observeClaudeTurn } from "./turn-state";
8
8
  import { LIVE_MS, safeParse, stateFor, ts } from "../../support/common";
9
9
  import { finishScan } from "../../cooperative-scan";
10
10
  import { claudeCapabilityUsage, createClaudeCapabilityCollector } from "./activity";
11
- import { pastedImageLabel } from "../../support/activity-helpers";
11
+ import { claudeTranscriptRecord, pastedImageLabel } from "../../support/activity-helpers";
12
12
  import { claudeChangedPaths, claudeCheckout, claudeRepositoryPaths } from "./repository-observation";
13
13
  import {
14
14
  childLogsFingerprint,
@@ -40,6 +40,7 @@ type ClaudeParseState = {
40
40
  };
41
41
 
42
42
  function applyClaudeLine(d: any, state: ClaudeParseState): void {
43
+ if (!claudeTranscriptRecord(d)) return;
43
44
  observeClaudeTurn(d, state);
44
45
  if (d.isSidechain !== true) {
45
46
  state.repositoryPaths.push(...claudeRepositoryPaths(d));
@@ -23,6 +23,7 @@ import {
23
23
  type Scan,
24
24
  } from "../../support/common";
25
25
  import {
26
+ claudeTranscriptRecord,
26
27
  classifyTool,
27
28
  estimateTokens,
28
29
  pastedImageLabel,
@@ -105,7 +106,7 @@ export function claudeChildSummary(
105
106
  let tokensLastTurn = 0;
106
107
  for (const line of lines) {
107
108
  const row = safeParse(line);
108
- if (!row) continue;
109
+ if (!row || !claudeTranscriptRecord(row)) continue;
109
110
  if (typeof row.agentId === "string" && row.agentId) threadId = row.agentId;
110
111
  const at = ts(row.timestamp);
111
112
  if (at) {
@@ -55,6 +55,15 @@ const IMAGE_LABEL = /^\[Image(?: #\d+|: source: .+|: original .+)\]$/;
55
55
  * (`[Image: source: /private/tmp/…]`, `[Image #1]`). With the image itself in
56
56
  * the same message, a block of only such labels is not something anyone typed.
57
57
  */
58
+ /**
59
+ * Claude Code also journals a copy of each API request (`api-request-blob`).
60
+ * Its user-role content repeats tool results and host notes such as
61
+ * "Tool loaded."; it is not a turn the person wrote or the agent took.
62
+ */
63
+ export function claudeTranscriptRecord(d: any): boolean {
64
+ return d?.type !== "api-request-blob";
65
+ }
66
+
58
67
  export function pastedImageLabel(block: any, content: readonly any[]): boolean {
59
68
  if (block?.type !== "text" || typeof block.text !== "string") return false;
60
69
  const lines = block.text.split("\n").map((line: string) => line.trim()).filter(Boolean);
@@ -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.142
13
+ npm install -g granttap-mcp@0.8.143
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.142\";\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.143\";\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.142";
10
+ const PACKAGE = "granttap-mcp@0.8.143";
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.142",
3
+ "version": "0.8.143",
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": {