ping-a-human 0.1.3 → 0.1.5

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.
@@ -104,9 +104,14 @@ export class TelegramChannel {
104
104
  respondent: this.respondentFrom(msg.from),
105
105
  };
106
106
  }
107
- // Inline-button tap.
107
+ // Inline-button tap. Note: a callback_query's `message` is the bot's
108
+ // OWN question (the message the buttons are attached to), so its
109
+ // message_id equals the question's id — applying the isStale anchor
110
+ // here would wrongly drop every tap (id <= sinceRef) and leave the
111
+ // human's spinner loading forever. Taps are inherently post-question
112
+ // (the button only exists on a message we just sent), so accept them.
108
113
  const cb = update.callback_query;
109
- if (cb && !isStale(cb.message?.message_id)) {
114
+ if (cb) {
110
115
  // Best-effort: clear the client's loading spinner.
111
116
  try {
112
117
  await this.api("answerCallbackQuery", { callback_query_id: cb.id });
package/dist/index.d.ts CHANGED
@@ -1,12 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { type CreateChannelOptions } from "./channel-factory.js";
4
- /**
5
- * Build the MCP server with notify_human and ask_human registered.
6
- *
7
- * The Channel is resolved lazily (per tool call) via {@link createChannel} so
8
- * the server still boots without configuration; a missing/invalid config
9
- * surfaces as a tool error result instead of crashing at startup. Tests inject
10
- * a stub Channel through `channelOptions.channel`.
11
- */
12
4
  export declare function createServer(channelOptions?: CreateChannelOptions): McpServer;
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import { realpathSync } from "node:fs";
4
+ import { readFileSync, realpathSync } from "node:fs";
5
+ import { dirname, join } from "node:path";
5
6
  import { fileURLToPath } from "node:url";
6
7
  import { z } from "zod";
7
8
  import { createChannel } from "./channel-factory.js";
@@ -15,8 +16,20 @@ import { runSetup } from "./setup.js";
15
16
  * surfaces as a tool error result instead of crashing at startup. Tests inject
16
17
  * a stub Channel through `channelOptions.channel`.
17
18
  */
19
+ /** Read this package's version from package.json so MCP serverInfo never drifts. */
20
+ function packageVersion() {
21
+ try {
22
+ const here = dirname(fileURLToPath(import.meta.url));
23
+ // dist/index.js -> ../package.json
24
+ const pkg = JSON.parse(readFileSync(join(here, "..", "package.json"), "utf8"));
25
+ return pkg.version ?? "0.0.0";
26
+ }
27
+ catch {
28
+ return "0.0.0";
29
+ }
30
+ }
18
31
  export function createServer(channelOptions = {}) {
19
- const server = new McpServer({ name: "ping-a-human", version: "0.1.0" });
32
+ const server = new McpServer({ name: "ping-a-human", version: packageVersion() });
20
33
  const resolveChannel = () => createChannel(channelOptions);
21
34
  // 1.x registerTool: inputSchema is a ZodRawShape (plain object), NOT z.object(...).
22
35
  server.registerTool("notify_human", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ping-a-human",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "An MCP server that adds a human-in-the-loop step to any AI pipeline by reaching a human on their own messaging app (Telegram first).",
5
5
  "type": "module",
6
6
  "bin": {