@agentcomms/whatsapp 0.12.3 → 0.13.1

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.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { pt as VERSION, u as composeDraft } from "./sync-DJlsr6xq.mjs";
2
- import { t as createWhatsAppMcpServer } from "./server-B1EmZ6FZ.mjs";
1
+ import { _t as VERSION, gt as PACKAGE_NAME, u as composeDraft } from "./sync-DrWJVoXp.mjs";
2
+ import { t as createWhatsAppMcpServer } from "./server-DNyMO_pq.mjs";
3
3
  //#region src/index.ts
4
4
  /**
5
5
  * The library entry of `@agentcomms/whatsapp`.
@@ -7,6 +7,5 @@ import { t as createWhatsAppMcpServer } from "./server-B1EmZ6FZ.mjs";
7
7
  * Small on purpose, as the Slack package's is: the server, the draft composer and the version. Everything else is
8
8
  * reached through the `agent-whatsapp` command.
9
9
  */
10
- const PACKAGE_NAME = "@agentcomms/whatsapp";
11
10
  //#endregion
12
11
  export { PACKAGE_NAME, VERSION, composeDraft, createWhatsAppMcpServer };
@@ -1013,7 +1013,7 @@ const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468
1013
1013
  function anchor(source) {
1014
1014
  return new RegExp(`^${source}$`);
1015
1015
  }
1016
- const date = /*@__PURE__*/ anchor(dateSource);
1016
+ const date$1 = /*@__PURE__*/ anchor(dateSource);
1017
1017
  function timeSource(args) {
1018
1018
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
1019
1019
  return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
@@ -1021,7 +1021,7 @@ function timeSource(args) {
1021
1021
  function time(args) {
1022
1022
  return new RegExp(`^${timeSource(args)}$`);
1023
1023
  }
1024
- function datetime(args) {
1024
+ function datetime$1(args) {
1025
1025
  const opts = ["Z"];
1026
1026
  if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
1027
1027
  const qualified = `${timeSource({
@@ -1672,11 +1672,11 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
1672
1672
  $ZodStringFormat.init(inst, def);
1673
1673
  });
1674
1674
  const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
1675
- def.pattern ?? (def.pattern = datetime(def));
1675
+ def.pattern ?? (def.pattern = datetime$1(def));
1676
1676
  $ZodStringFormat.init(inst, def);
1677
1677
  });
1678
1678
  const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
1679
- def.pattern ?? (def.pattern = date);
1679
+ def.pattern ?? (def.pattern = date$1);
1680
1680
  $ZodStringFormat.init(inst, def);
1681
1681
  });
1682
1682
  const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
@@ -5882,4 +5882,12 @@ function preprocess(fn, schema) {
5882
5882
  });
5883
5883
  }
5884
5884
  //#endregion
5885
- export { NEVER as A, unknown as C, _coercedNumber as D, toJSONSchema as E, _isoDate as O, union as S, safeParse as T, optional as _, _null as a, strictObject as b, boolean as c, intersection as d, lazy as f, object as g, number as h, _enum as i, _isoDateTime as k, discriminatedUnion as l, looseObject as m, ZodISODateTime as n, any as o, literal as p, ZodNumber as r, array as s, ZodISODate as t, email as u, preprocess as v, url as w, string as x, record as y };
5885
+ //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/iso.js
5886
+ function datetime(params) {
5887
+ return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
5888
+ }
5889
+ function date(params) {
5890
+ return /* @__PURE__ */ _isoDate(ZodISODate, params);
5891
+ }
5892
+ //#endregion
5893
+ export { unknown as C, _coercedNumber as D, toJSONSchema as E, NEVER as O, union as S, safeParse as T, optional as _, _null as a, strictObject as b, boolean as c, intersection as d, lazy as f, object as g, number as h, _enum as i, discriminatedUnion as l, looseObject as m, datetime as n, any as o, literal as p, ZodNumber as r, array as s, date as t, email as u, preprocess as v, url as w, string as x, record as y };
@@ -1,5 +1,5 @@
1
- import { A as NEVER, C as unknown, E as toJSONSchema, S as union, T as safeParse, _ as optional, a as _null, c as boolean, d as intersection, f as lazy, g as object, h as number, i as _enum, l as discriminatedUnion, m as looseObject, o as any, p as literal, s as array, u as email, v as preprocess, w as url, x as string, y as record } from "./schemas-DiGKNDNq.mjs";
2
- import { i as ZodIssueCode, n as date, r as datetime, t as number$1 } from "./coerce-BscjcmYU.mjs";
1
+ import { C as unknown, E as toJSONSchema, O as NEVER, S as union, T as safeParse, _ as optional, a as _null, c as boolean, d as intersection, f as lazy, g as object, h as number, i as _enum, l as discriminatedUnion, m as looseObject, n as datetime, o as any, p as literal, s as array, t as date, u as email, v as preprocess, w as url, x as string, y as record } from "./iso-USuVU_sk.mjs";
2
+ import { n as ZodIssueCode, t as number$1 } from "./coerce-CqGigABD.mjs";
3
3
  import process$1 from "node:process";
4
4
  //#region ../../node_modules/.pnpm/@modelcontextprotocol+server@2.0.0/node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
5
5
  var __create = Object.create;
@@ -1,6 +1,6 @@
1
- import { D as strictToolArguments, E as UNTRUSTED_NOTICE, a as listChats, d as draftMessage, i as CHAT_KINDS, lt as updateToolGate, m as WhatsAppContext, n as whatsappStatus, o as readChat, ot as toCommsError, pt as VERSION, s as searchMessages, t as syncAccount } from "./sync-DJlsr6xq.mjs";
2
- import { c as boolean, h as number, x as string } from "./schemas-DiGKNDNq.mjs";
3
- import { t as McpServer } from "./mcp-DXXb3Vv3-Co5BzjYe.mjs";
1
+ import { E as strictToolArguments, _t as VERSION, a as listChats, ct as toCommsError, d as draftMessage, dt as updateToolGate, i as CHAT_KINDS, j as UNTRUSTED_NOTICE, m as WhatsAppContext, n as whatsappStatus, o as readChat, s as searchMessages, t as syncAccount } from "./sync-DrWJVoXp.mjs";
2
+ import { c as boolean, h as number, x as string } from "./iso-USuVU_sk.mjs";
3
+ import { t as McpServer } from "./mcp-DXXb3Vv3-kCxsVLO4.mjs";
4
4
  //#region src/mcp/server.ts
5
5
  async function buildInstructions(context) {
6
6
  let names = [];
@@ -29,7 +29,7 @@ async function buildInstructions(context) {
29
29
  ...pinned !== void 0 ? [`This server is pinned to ${pinned}: every call acts on it, \`account\` may be left out, and any other is refused.`] : [
30
30
  "Pass `account` on every call except whatsapp_status — there is no default. On whatsapp_draft it applies that",
31
31
  "account’s lists; without it, every account’s do.",
32
- names.length > 0 ? `Known accounts: ${names.slice(0, 8).join(", ")}${names.length > 8 ? `, and ${names.length - 8} more` : ""}.` : "No account is set up yet: a person runs `agent-whatsapp add <organisation>/whatsapp` in a terminal."
32
+ names.length > 0 ? `Known accounts: ${names.slice(0, 8).join(", ")}${names.length > 8 ? `, and ${names.length - 8} more` : ""}.` : "No account is set up yet: a person adds one in a terminal — whatsapp_status gives the command, as `setup`."
33
33
  ]
34
34
  ].join("\n");
35
35
  }
@@ -44,7 +44,7 @@ async function createWhatsAppMcpServer(options = {}) {
44
44
  version: VERSION
45
45
  }, { instructions: await buildInstructions(context) });
46
46
  const reply = (data) => {
47
- const structured = data;
47
+ const structured = JSON.parse(JSON.stringify(data));
48
48
  return {
49
49
  structuredContent: structured,
50
50
  content: [{
@@ -55,12 +55,12 @@ async function createWhatsAppMcpServer(options = {}) {
55
55
  };
56
56
  const fail = (error) => {
57
57
  const comms = toCommsError(error);
58
- const structured = { error: {
58
+ const structured = JSON.parse(JSON.stringify({ error: {
59
59
  code: comms.code,
60
60
  message: comms.message,
61
61
  hint: comms.hint ?? null,
62
62
  ...comms.details !== void 0 ? { details: comms.details } : {}
63
- } };
63
+ } }));
64
64
  return {
65
65
  isError: true,
66
66
  structuredContent: structured,
@@ -214,7 +214,7 @@ async function createWhatsAppMcpServer(options = {}) {
214
214
  return {
215
215
  server,
216
216
  async connectStdio() {
217
- const { StdioServerTransport } = await import("./stdio-BR8R87El.mjs");
217
+ const { StdioServerTransport } = await import("./stdio-q4c3585j.mjs");
218
218
  await server.connect(new StdioServerTransport());
219
219
  }
220
220
  };
@@ -1,5 +1,5 @@
1
- import { A as NEVER, C as unknown, E as toJSONSchema, S as union, T as safeParse, _ as optional, a as _null, c as boolean, d as intersection, f as lazy, g as object, h as number, i as _enum, l as discriminatedUnion, m as looseObject, o as any, p as literal, s as array, u as email, v as preprocess, w as url, x as string, y as record } from "./schemas-DiGKNDNq.mjs";
2
- import { i as ZodIssueCode, n as date, r as datetime, t as number$1 } from "./coerce-BscjcmYU.mjs";
1
+ import { C as unknown, E as toJSONSchema, O as NEVER, S as union, T as safeParse, _ as optional, a as _null, c as boolean, d as intersection, f as lazy, g as object, h as number, i as _enum, l as discriminatedUnion, m as looseObject, n as datetime, o as any, p as literal, s as array, t as date, u as email, v as preprocess, w as url, x as string, y as record } from "./iso-USuVU_sk.mjs";
2
+ import { n as ZodIssueCode, t as number$1 } from "./coerce-CqGigABD.mjs";
3
3
  const SUPPORTED_PROTOCOL_VERSIONS = [
4
4
  "2025-11-25",
5
5
  "2025-06-18",
@@ -1,4 +1,4 @@
1
- import { a as ReadBuffer, c as SdkErrorCode, k as serializeMessage, s as SdkError } from "./src-D_zzAWoS-BhK0GFdq-XAvBzdGB.mjs";
1
+ import { a as ReadBuffer, c as SdkErrorCode, k as serializeMessage, s as SdkError } from "./src-D_zzAWoS-BhK0GFdq-oo-8IJem.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import process$1 from "node:process";
4
4
  import { PassThrough } from "node:stream";
@@ -1,4 +1,4 @@
1
- import { t as createWhatsAppMcpServer } from "./server-B1EmZ6FZ.mjs";
1
+ import { t as createWhatsAppMcpServer } from "./server-DNyMO_pq.mjs";
2
2
  //#region src/mcp/stdio-entry.ts
3
3
  /**
4
4
  * Starting the stdio server. On stdio, stdout is the protocol, so the console is redirected to stderr first — the
@@ -1,4 +1,4 @@
1
- import { i as serializeMessage, n as process, r as ReadBuffer } from "./mcp-DXXb3Vv3-Co5BzjYe.mjs";
1
+ import { i as serializeMessage, n as process, r as ReadBuffer } from "./mcp-DXXb3Vv3-kCxsVLO4.mjs";
2
2
  //#region ../../node_modules/.pnpm/@modelcontextprotocol+server@2.0.0/node_modules/@modelcontextprotocol/server/dist/stdio.mjs
3
3
  /**
4
4
  * Server transport for stdio: this communicates with an MCP client by reading from the current process' `stdin` and writing to `stdout`.