granttap-mcp 0.8.157 → 0.8.159

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.
@@ -2767,3 +2767,68 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2767
2767
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2768
2768
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2769
2769
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2770
+
2771
+
2772
+ marked 18.1.3 — MIT
2773
+ Source: https://www.npmjs.com/package/marked/v/18.1.3
2774
+
2775
+ # License information
2776
+
2777
+ ## Contribution License Agreement
2778
+
2779
+ If you contribute code to this project, you are implicitly allowing your code
2780
+ to be distributed under the MIT license. You are also implicitly verifying that
2781
+ all code is your original work. `</legalese>`
2782
+
2783
+ ## Marked
2784
+
2785
+ Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
2786
+ Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
2787
+
2788
+ Permission is hereby granted, free of charge, to any person obtaining a copy
2789
+ of this software and associated documentation files (the "Software"), to deal
2790
+ in the Software without restriction, including without limitation the rights
2791
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2792
+ copies of the Software, and to permit persons to whom the Software is
2793
+ furnished to do so, subject to the following conditions:
2794
+
2795
+ The above copyright notice and this permission notice shall be included in
2796
+ all copies or substantial portions of the Software.
2797
+
2798
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2799
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2800
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2801
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2802
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2803
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2804
+ THE SOFTWARE.
2805
+
2806
+ ## Markdown
2807
+
2808
+ Copyright © 2004, John Gruber
2809
+ http://daringfireball.net/
2810
+ All rights reserved.
2811
+
2812
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
2813
+
2814
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2815
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
2816
+ * Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
2817
+
2818
+ This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
2819
+
2820
+
2821
+ entities 9.0.0 — BSD-2-Clause
2822
+ Source: https://www.npmjs.com/package/entities/v/9.0.0
2823
+
2824
+ Copyright (c) Felix Böhm
2825
+ All rights reserved.
2826
+
2827
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
2828
+
2829
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2830
+
2831
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
2832
+
2833
+ THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
2834
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -21,6 +21,8 @@ boundaries and upstream grants remain separate from GrantTap's first-party comme
21
21
  | `ws` | MIT |
22
22
  | `zod` | MIT |
23
23
  | `smol-toml` | BSD-3-Clause |
24
+ | `marked` | MIT, with the original Markdown notice retained |
25
+ | `entities` | BSD-2-Clause |
24
26
 
25
27
  The unpublished Rust workspace also depends on separately licensed components,
26
28
  including `mcport` (MIT), `blazingly-json` (MIT), `serde` (MIT OR Apache-2.0), and
@@ -24,13 +24,13 @@ An uncertain or crashed dispatch is not replayed. A native receipt produces no
24
24
  synthetic assistant reply or completed-run digest; the existing transcript carries
25
25
  the actual work. Pause sends the user's stop request to the same owner. Document
26
26
  attachments remain in private staging for up to a day after admission; the monitor
27
- removes expired stages. Image-only stages are removed once native admission has
28
- consumed them. Tests exercise native delivery, framing, socket trust, durable
27
+ removes expired stages. Image-only stages have the same retention because
28
+ admission precedes attachment consumption. Tests exercise framing, socket trust, durable
29
29
  deduplication, and refusal without launching the CLI.
30
30
 
31
31
  License: GrantTap Commercial Source License in the repository-root `LICENSE`.
32
32
 
33
- Document staging for a native-only question keeps the file note inside its
33
+ Document staging for a correlated question keeps the file note inside its
34
34
  original answer envelope. The host's native question and all paired controllers
35
35
  therefore observe the same question item as answered; document paths remain
36
36
  available to the admitted turn. Ordinary chat text is unchanged.
@@ -39,3 +39,9 @@ The bounded native admission deadline leaves time for the installed router’s
39
39
  ten-second owner discovery window. A five-second client cap otherwise reports
40
40
  healthy CLI conversations unavailable before discovery can finish. Missing-owner
41
41
  confirmation preserves CLI continuation; uncertain dispatch remains unreplayed.
42
+
43
+ `continueCodexQuestion`, exported through `index.ts`, reserves the same durable
44
+ question identity for an ownerless CLI continuation. Its caller must first
45
+ obtain a definitive absent-owner result inside the existing per-chat queue.
46
+ The original native envelope is preserved, and another controller cannot retry
47
+ an uncertain dispatch or replace an already accepted answer.
@@ -8,6 +8,8 @@ import { DesktopConnection } from './connection';
8
8
  import { DesktopReceipt } from './receipts';
9
9
  import { desktopSocketPath } from './socket-path';
10
10
  export { interruptCodexDesktop } from './controls';
11
+ export { continueCodexQuestion } from './question-continuation';
12
+ export { nativeQuestionAttachmentEnvelope } from './question-attachment-envelope';
11
13
 
12
14
  const UNAVAILABLE = 'Codex desktop is not ready to receive this message. Keep the original chat open and try again.';
13
15
  const UNCERTAIN = 'Codex has not confirmed this message. Check the original chat before sending it again.';
@@ -73,7 +75,8 @@ function turnRequest(input: { session: SessionInfo; text: string; images: string
73
75
  networkAccess: false, excludeTmpdirEnvVar: false, excludeSlashTmp: false }
74
76
  : access === 'full' ? { type: 'dangerFullAccess' } : undefined;
75
77
  return { threadId: session.sessionId, clientUserMessageId: options.messageId ?? randomUUID(),
76
- input: [{ type: 'text', text: options.nativeOnly ? nativeQuestionAttachmentEnvelope(text) : text, text_elements: [] }, ...images.map(path => ({ type: 'localImage', path }))],
78
+ input: [{ type: 'text', text: options.nativeOnly || options.questionReply
79
+ ? nativeQuestionAttachmentEnvelope(text) : text, text_elements: [] }, ...images.map(path => ({ type: 'localImage', path }))],
77
80
  ...(options.model ? { model: options.model } : {}), ...(effort ? { effort } : {}),
78
81
  ...(sandboxPolicy ? { sandboxPolicy } : {}) };
79
82
  }
@@ -0,0 +1,10 @@
1
+ # Ownerless question continuation
2
+
3
+ `continueCodexQuestion`, exported by the parent `index.ts`, reserves the original
4
+ question's durable admission identity before a serialized CLI continuation.
5
+ Call only after native owner discovery returns definitive absence. Pending or
6
+ uncertain admissions are never retried, including from another controller.
7
+ Public delivery integration tests live in
8
+ `../../codex-questions/continuation/tests/cli-delivery.test.ts`.
9
+
10
+ License: [GrantTap Commercial Source License](../../../../../LICENSE).
@@ -0,0 +1,28 @@
1
+ import type { DeliveryOptions, ReplyResult } from '../../reply/payload/types';
2
+ import { DesktopReceipt } from '../receipts';
3
+
4
+ /** Called inside the chat queue only after desktop discovery proves no owner exists. */
5
+ export async function continueCodexQuestion(sessionId: string, options: DeliveryOptions,
6
+ run: () => Promise<ReplyResult>): Promise<ReplyResult> {
7
+ if (!options.messageId || !options.intentDigest) {
8
+ return { ok: false, error: 'The question answer has no stable delivery identity.' };
9
+ }
10
+ try {
11
+ // Share the native admission journal: neither a second controller nor a
12
+ // later desktop owner may submit another answer for this question.
13
+ const receipt = new DesktopReceipt(sessionId, options.messageId, options.intentDigest);
14
+ const state = receipt.begin();
15
+ if (state === 'accepted') return { ok: true, text: '', sessionId, delivery: 'native' };
16
+ if (state === 'conflict') return { ok: false, error: 'This message ID belongs to a different Codex delivery.' };
17
+ if (state !== 'new') return uncertain();
18
+ const result = await run();
19
+ if (!result.ok) return { ...result, delivery: 'native' };
20
+ receipt.accept('cli:' + sessionId);
21
+ return result;
22
+ } catch { return uncertain(); }
23
+ }
24
+
25
+ function uncertain(): ReplyResult {
26
+ return { ok: false, delivery: 'native',
27
+ error: 'Codex has not confirmed this answer. Check the original chat before sending it again.' };
28
+ }
@@ -17,9 +17,15 @@ Replies use the original host question item ID and normal scoped phone delivery,
17
17
  including current provider, pause and Task policy. Native admission uses one
18
18
  stable delivery ID per question, so concurrent controllers cannot submit two
19
19
  different answers. The phone's own message ID still receives its receipts.
20
- If the desktop owner is unavailable, question replies do not launch a separate
21
- CLI writer. An uncertain admission is not replayed or described as a confirmed
22
- native answer. Native transcript files are read without modification.
20
+ When discovery confirms there is no desktop owner, an answer resumes the same
21
+ CLI conversation through the existing per-chat queue. It waits for a running
22
+ delivery, preserves the original question envelope and attachments, and shares
23
+ the durable native admission identity across controllers. An uncertain native
24
+ or CLI dispatch is never replayed. Native transcript files remain read-only.
25
+
26
+ The public `presentation/index.ts` boundary extracts human answers for run journals
27
+ and Task progress before truncation. Unknown or truncated question envelopes
28
+ show a neutral reply label; ordinary messages and quoted examples stay intact.
23
29
 
24
30
  Tests under `tests/` cover publication, reconnect replay, native acknowledgement,
25
31
  scope rejection, expiry and delivery through an isolated native IPC fixture.
@@ -108,7 +108,7 @@ export async function handleCodexQuestionReply(client: RelayClient, message: Use
108
108
  return deliver(client, { ...message, requestId: undefined,
109
109
  messageId: message.messageId ?? 'codex-answer-' + record.requestId,
110
110
  text: nativeAnswerEnvelope(record, message.text) }, publish, peerPublicKey,
111
- { messageId: record.requestId, nativeOnly: true });
111
+ { messageId: record.requestId, questionReply: true });
112
112
  }
113
113
 
114
114
  function resolveQuestion(client: RelayClient, record: QuestionRecord, peerPublicKey?: string, expired = false) {
@@ -0,0 +1,9 @@
1
+ # Question answer presentation
2
+
3
+ Public entry: `questionAnswerPresentation` in `index.ts`. Run journals and Task
4
+ progress show human answers before storage limits truncate them. Presentation
5
+ does not alter the native envelope used for delivery or transcript confirmation.
6
+ Malformed or truncated envelopes use a neutral label. Tests cover normal text,
7
+ quoted examples, multiple answers, document staging notes, and invalid envelopes.
8
+
9
+ License: [GrantTap Commercial Source License](../../../../../LICENSE).
@@ -0,0 +1,22 @@
1
+ import { stripAttachmentNote } from '../../sessions/support/activity-helpers';
2
+
3
+ /** Public presentation boundary; never changes the original native delivery payload. */
4
+ export function questionAnswerPresentation(text: string): string {
5
+ const opening = '<send_user_message_question_reply>';
6
+ const closing = '</send_user_message_question_reply>';
7
+ const wrapped = text.trim();
8
+ if (!wrapped.startsWith(opening)) return text;
9
+ if (!wrapped.endsWith(closing)) return 'Question reply';
10
+ try {
11
+ const rows = JSON.parse(wrapped.slice(opening.length, -closing.length));
12
+ if (!Array.isArray(rows) || !rows.length || rows.length > 4) return 'Question reply';
13
+ const answers = rows.map(row => {
14
+ const id = JSON.parse(row.questionItemId);
15
+ if (!Array.isArray(id) || id.length !== 3 || id[0] !== 'request_user_input_async'
16
+ || typeof id[1] !== 'string' || !/^[a-zA-Z0-9_-]{1,180}$/.test(id[1])
17
+ || !Number.isInteger(id[2]) || id[2] < 0 || id[2] > 3 || typeof row.answer !== 'string') throw Error('Invalid reply');
18
+ return stripAttachmentNote(row.answer).trim();
19
+ });
20
+ return answers.filter(Boolean).join('; ') || 'Question reply';
21
+ } catch { return 'Question reply'; }
22
+ }
@@ -12,6 +12,7 @@
12
12
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
13
13
  import { join } from "node:path";
14
14
  import { configDir } from "../../config/runtime/paths";
15
+ import { questionAnswerPresentation } from '../../codex-questions/presentation';
15
16
 
16
17
  export type RunRecord = {
17
18
  /** Stable id for this run. Start time is not a confirmation key. */
@@ -87,7 +88,7 @@ export function recordRun(sessionId: string, record: RunRecord): void {
87
88
  const bounded: RunRecord = {
88
89
  ...record,
89
90
  runId: record.runId || `run:${record.at}`,
90
- prompt: compactText(record.prompt, MAX_PROMPT_CHARS),
91
+ prompt: compactText(questionAnswerPresentation(record.prompt), MAX_PROMPT_CHARS),
91
92
  outcome: compactText(record.outcome, MAX_OUTCOME_CHARS),
92
93
  files: record.files.slice(0, MAX_FILES),
93
94
  };
@@ -141,7 +142,7 @@ export type RunDescriptionLimits = { files?: number; outcome?: number };
141
142
  /** One line a person or a model can read: what was asked, what happened, what it touched. */
142
143
  export function describeRun(record: RunRecord, limits: RunDescriptionLimits = {}): string {
143
144
  const outcome = limits.outcome == null ? record.outcome : compactText(record.outcome, limits.outcome);
144
- const parts = [`«${record.prompt}» → ${record.ok ? "" : "failed: "}${outcome}`];
145
+ const parts = [`«${questionAnswerPresentation(record.prompt)}» → ${record.ok ? "" : "failed: "}${outcome}`];
145
146
  const files = limits.files ?? 6;
146
147
  if (record.files.length > 0 && files > 0) {
147
148
  const shown = record.files.slice(0, files).join(", ");
@@ -123,7 +123,7 @@ export async function handleUserMessage(
123
123
  message: UserMessage,
124
124
  onProcessing?: () => Promise<void>,
125
125
  peerPublicKey?: string,
126
- native?: { messageId: string; nativeOnly: true },
126
+ native?: { messageId: string; questionReply: true },
127
127
  onRefusal?: (error: string) => Promise<void>,
128
128
  ): Promise<"accepted" | "rejected"> {
129
129
  const say = (text: string, sessionId?: string, wake = false, kind: "status" | "response" = "response") => {
@@ -176,7 +176,7 @@ export async function handleUserMessage(
176
176
  const startedAt = Date.now();
177
177
  const run = deliverToSession(target, message.text, PHONE_RUN_LIMIT_MS, attachments, {
178
178
  messageId: native?.messageId ?? message.messageId,
179
- nativeOnly: native?.nativeOnly,
179
+ questionReply: native?.questionReply,
180
180
  onAgentActivity: () => reportMessageAgentActivity(client, message, peerPublicKey),
181
181
  preferredMcp: message.preferredMcp,
182
182
  skill: message.skill,
@@ -11,7 +11,7 @@ export async function handleInboundUserMessage(
11
11
  client: RelayClient, payload: Extract<Payload, { type: "user.message" }>,
12
12
  publish: (forceHistory?: boolean) => Promise<void>,
13
13
  peerPublicKey?: string,
14
- native?: { messageId: string; nativeOnly: true },
14
+ native?: { messageId: string; questionReply: true },
15
15
  ): Promise<boolean> {
16
16
  if (payload.requestId) return false;
17
17
  let deliveryStarted = false;
@@ -9,6 +9,8 @@ export type DeliveryOptions = {
9
9
  messageId?: string;
10
10
  /** Native host questions must never fall back to a second CLI conversation. */
11
11
  nativeOnly?: boolean;
12
+ /** Correlated question answer; use serialized resume only when no desktop owner exists. */
13
+ questionReply?: boolean;
12
14
  /** Computer-generated identity before temporary attachment paths are inserted. */
13
15
  intentDigest?: string;
14
16
  preferredMcp?: string;
@@ -4,7 +4,7 @@ import { resolveCodexBinary } from "../../providers/codex-bin";
4
4
  import { runProcess } from ".";
5
5
  import { providerEffortArgs } from "./provider-effort";
6
6
  import type { DeliveryOptions, ReplyResult } from "../payload/types";
7
- import { deliverToCodexDesktop } from '../../codex-desktop';
7
+ import { continueCodexQuestion, deliverToCodexDesktop, nativeQuestionAttachmentEnvelope } from '../../codex-desktop';
8
8
 
9
9
  function parseCodexJsonl(stdout: string, fallbackSessionId?: string): ReplyResult {
10
10
  let lastMessage = "";
@@ -55,6 +55,13 @@ export async function runCodex(
55
55
  const native = await deliverToCodexDesktop({ session, text, images, options, timeoutMs });
56
56
  if (native) return native;
57
57
  if (options.nativeOnly) return { ok: false, error: 'Open this conversation in Codex to answer its question.' };
58
+ if (options.questionReply) return continueCodexQuestion(session.sessionId, options,
59
+ () => resumeCodex(session, nativeQuestionAttachmentEnvelope(text), timeoutMs, images, options));
60
+ return resumeCodex(session, text, timeoutMs, images, options);
61
+ }
62
+
63
+ async function resumeCodex(session: SessionInfo, text: string, timeoutMs: number,
64
+ images: string[], options: DeliveryOptions): Promise<ReplyResult> {
58
65
  const configured = loadRuntimeConfig().sessionAccess[session.sessionId];
59
66
  const disabledMcp = loadRuntimeConfig().sessionMcpDisabled[session.sessionId] ?? [];
60
67
  const sandbox = configured === "read-only"
@@ -0,0 +1,14 @@
1
+ # Plain catalog previews
2
+
3
+ `plainPreview` turns a complete visible assistant message into a bounded catalog
4
+ summary. Markdown is tokenized before the display limit is applied, so a long
5
+ link destination or emphasis span cannot leave a broken delimiter in a task
6
+ card. Blocks retain word boundaries; code punctuation stays literal. No HTML is
7
+ rendered, links followed, or original transcript text rewritten.
8
+
9
+ The Codex and Claude scanners use this entry point for summaries. Shared title
10
+ projection also parses before its existing display limit. Full transcript
11
+ messages retain their original Markdown. Tests cover scanner output and the
12
+ plain-text projection independently.
13
+
14
+ Licensed under the GrantTap Commercial Source License. See LICENSE and NOTICE.
@@ -0,0 +1,41 @@
1
+ import { Lexer, type Token, type Tokens } from 'marked';
2
+ import { decodeHTML } from 'entities';
3
+ import { stripTranscriptMarkup } from '../support/activity-helpers';
4
+
5
+ function inline(tokens: readonly Token[]): string {
6
+ return tokens.map(readToken).join('');
7
+ }
8
+
9
+ function children(token: Token): string {
10
+ if ('tokens' in token && Array.isArray(token.tokens)) return inline(token.tokens);
11
+ return 'text' in token ? String(token.text) : '';
12
+ }
13
+
14
+ function tableText(token: Tokens.Table): string {
15
+ return [token.header, ...token.rows].map(row =>
16
+ row.map(cell => inline(cell.tokens)).join(' | ')).join('\n') + '\n';
17
+ }
18
+
19
+ /** Read text from parsed tokens, never rendered HTML or executable content. */
20
+ function readToken(token: Token): string {
21
+ switch (token.type) {
22
+ case 'space': case 'br': case 'hr': return '\n';
23
+ case 'def': return '';
24
+ case 'table': return tableText(token as Tokens.Table);
25
+ case 'list': return '\n' + (token as Tokens.List).items.map(item => inline(item.tokens)).join('\n') + '\n';
26
+ case 'paragraph': case 'heading': case 'blockquote': return children(token) + '\n';
27
+ case 'code': return String(token.text) + '\n';
28
+ case 'codespan': case 'escape': return String(token.text);
29
+ case 'html': return decodeHTML(String(token.text).replace(/<[^>]*>/g, ''));
30
+ case 'text': case 'image':
31
+ return 'tokens' in token && Array.isArray(token.tokens) ? inline(token.tokens) : decodeHTML(String(token.text));
32
+ default: return children(token);
33
+ }
34
+ }
35
+
36
+ /** Catalog summaries are display text. Parse complete Markdown before shortening it. */
37
+ export function plainPreview(value: unknown, limit = 160): string | undefined {
38
+ const source = stripTranscriptMarkup(value);
39
+ const visible = inline(Lexer.lex(source, { gfm: true })).replace(/\s+/g, ' ').trim();
40
+ return visible ? Array.from(visible).slice(0, limit).join('') : undefined;
41
+ }
@@ -3,6 +3,7 @@ import { mergeRecordedClaudeUsage, recordedClaudeUsageIsCurrent } from './record
3
3
  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
+ import { plainPreview } from '../../plain-preview';
6
7
  import { rememberCapabilityObservation } from "../../telemetry";
7
8
  import { observeClaudeTurn } from "./turn-state";
8
9
  import { claudeContextReport } from "../../context-usage";
@@ -104,11 +105,11 @@ function applyClaudeLine(d: any, state: ClaudeParseState): void {
104
105
  if (d.message?.role === "assistant") {
105
106
  const content = d.message.content;
106
107
  if (typeof content === "string" && content.trim()) {
107
- state.summary = childTitle(content)?.slice(0, 180);
108
+ state.summary = plainPreview(content);
108
109
  } else if (Array.isArray(content)) {
109
110
  for (const block of content) {
110
111
  if (block?.type === "text" && typeof block.text === "string" && block.text.trim()) {
111
- state.summary = childTitle(block.text)?.slice(0, 180);
112
+ state.summary = plainPreview(block.text);
112
113
  }
113
114
  }
114
115
  }
@@ -19,6 +19,7 @@ import { codexHeadRequest, isProvisionalPageTitle } from "../../support/codex-he
19
19
  import { heartbeatDisplayText } from '../../host-heartbeat';
20
20
  import { codexContextReport } from "../../context-usage";
21
21
  import { codexRequestTitle } from '../../native-task-titles';
22
+ import { plainPreview } from '../../plain-preview';
22
23
 
23
24
  type CodexParseState = {
24
25
  sessionId: string;
@@ -113,7 +114,7 @@ function applyCodexLine(d: any, state: CodexParseState): void {
113
114
  if (d.type === "event_msg" && d.payload?.type === "agent_message") {
114
115
  const raw = d.payload.message ?? d.payload.text;
115
116
  const visible = heartbeatDisplayText(raw, 'message') ?? raw;
116
- if (visible) state.summary = childTitle(visible)?.slice(0, 180);
117
+ if (visible) state.summary = plainPreview(visible);
117
118
  }
118
119
  if (
119
120
  d.type === "response_item" &&
@@ -124,7 +125,7 @@ function applyCodexLine(d: any, state: CodexParseState): void {
124
125
  for (const block of d.payload.content) {
125
126
  if (["output_text", "text"].includes(block?.type) && typeof block.text === "string") {
126
127
  const visible = heartbeatDisplayText(block.text, 'message') ?? block.text;
127
- if (visible) state.summary = childTitle(visible)?.slice(0, 180);
128
+ if (visible) state.summary = plainPreview(visible);
128
129
  }
129
130
  }
130
131
  }
@@ -3,15 +3,14 @@ import type {
3
3
  ChildThreadInfo,
4
4
  SessionInfo,
5
5
  } from "../../../../../packages/protocol/schema";
6
- import { stripTranscriptMarkup } from "./activity-helpers";
6
+ import { plainPreview } from '../plain-preview';
7
7
 
8
8
  /** Protocol and UI share this hard ceiling; provider logs can contain thousands. */
9
9
  export const MAX_CHILD_THREADS = 32;
10
10
  export const MAX_CHILD_THREAD_TITLE = 160;
11
11
 
12
12
  export function childTitle(value: unknown): string | undefined {
13
- const text = stripTranscriptMarkup(value).replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
14
- return text ? text.slice(0, MAX_CHILD_THREAD_TITLE) : undefined;
13
+ return plainPreview(value, MAX_CHILD_THREAD_TITLE);
15
14
  }
16
15
 
17
16
  /** Keep the most recently active children while returning them chronologically. */
@@ -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.157
13
+ npm install -g granttap-mcp@0.8.159
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.157\";\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.159\";\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.157";
10
+ const PACKAGE = "granttap-mcp@0.8.159";
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.157",
3
+ "version": "0.8.159",
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": {
@@ -37,7 +37,9 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@modelcontextprotocol/sdk": "^1.32.1",
40
+ "entities": "9.0.0",
40
41
  "express": "^5.2.1",
42
+ "marked": "18.1.3",
41
43
  "qrcode": "^1.5.4",
42
44
  "smol-toml": "1.9.1",
43
45
  "tsx": "^4.23.4",