@agentcomms/whatsapp 0.8.0 → 0.9.0

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/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { $ as withFileLock, A as CommsError, B as installExitStatus, C as checkStorePath, F as canPrompt, G as paint, H as lookupName, I as channelManifest, J as runCommand, K as renderInstall, L as colorEnabled, M as agentMarker, N as approvalKind, O as CHANNELS, P as approveChangeAtTerminal, Q as truncateDisplay, R as escapeForDisplay, S as storeIdentity, T as expandSource, U as nameAvailable, V as isCommsError, W as nameShapeProblem, X as serverPruneChange, Y as serverInstallChange, _ as chatRefOf, a as listChats, b as requireAccount, c as Presenter, d as draftMessage, et as writeResult, f as Visibility, g as requireSupportedNode, h as WhatsAppIndex, i as CHAT_KINDS, j as EXIT_CODES, k as CHANNEL_SERVERS, l as innerText, m as WhatsAppContext, n as whatsappStatus, o as readChat, p as listKey, q as renderPrune, r as probeStore, s as searchMessages, t as syncAccount, tt as VERSION, v as PLATFORM, w as defaultStorePath, x as requireNamedConfig, y as newWhatsAppAccount, z as gatedChangeAtTerminal } from "./sync-BcshklLi.mjs";
2
+ import { $ as serverInstallChange, A as CommsError, B as escapeForDisplay, C as checkStorePath, F as approveChangeAtTerminal, G as lookupName, H as gatedChangeAtTerminal, I as canPrompt, J as openCore, K as nameAvailable, L as channelManifest, M as agentMarker, N as approvalKind, O as CHANNELS, P as approvalsOf, Q as runCommand, R as colorEnabled, S as storeIdentity, T as expandSource, U as installExitStatus, V as exemptFromUpdateGate, W as isCommsError, X as renderInstall, Y as paint, Z as renderPrune, _ as chatRefOf, a as listChats, at as withFileLock, b as requireAccount, c as Presenter, d as draftMessage, et as serverPruneChange, f as Visibility, g as requireSupportedNode, h as WhatsAppIndex, i as CHAT_KINDS, j as EXIT_CODES, k as CHANNEL_SERVERS, l as innerText, m as WhatsAppContext, n as whatsappStatus, nt as truncateDisplay, o as readChat, ot as writeResult, p as listKey, q as nameShapeProblem, r as probeStore, rt as updateGateAtTerminal, s as searchMessages, st as VERSION, t as syncAccount, v as PLATFORM, w as defaultStorePath, x as requireNamedConfig, y as newWhatsAppAccount, z as commandPathOf } from "./sync-DU_KB2pO.mjs";
3
3
  import { rm } from "node:fs/promises";
4
4
  import path from "node:path";
5
- import { stripVTControlCharacters } from "node:util";
6
5
  import childProcess, { spawn } from "node:child_process";
6
+ import { stripVTControlCharacters } from "node:util";
7
7
  import fs from "node:fs";
8
8
  import process$1 from "node:process";
9
9
  import { EventEmitter } from "node:events";
@@ -3345,7 +3345,8 @@ Getting started (a person, in a terminal):
3345
3345
 
3346
3346
  Nothing here connects to WhatsApp or any other server, and nothing here can send. Needs Node 22.16 or newer.
3347
3347
 
3348
- Exit codes: 0 ok · 1 unexpected · 10 only a person may do that, or a change needs approval · 64 usage
3348
+ Exit codes: 0 ok · 1 unexpected · 10 only a person may do that, or a change needs approval · 11 an update
3349
+ is out: update first, or put it off (agentcomms update, agentcomms update --later) · 64 usage
3349
3350
  · 65 bad data (a store whose layout changed) · 66 not found · 69 unavailable · 75 temporary (retry;
3350
3351
  a macOS dialog may be waiting) · 77 permission needed (macOS privacy) · 78 configuration problem.`).exitOverride();
3351
3352
  const output = () => {
@@ -3360,9 +3361,35 @@ a macOS dialog may be waiting) · 77 permission needed (macOS privacy) · 78 con
3360
3361
  * start — where the result *is* the output and `--json` must still print one envelope.
3361
3362
  */
3362
3363
  let softExit = null;
3364
+ let gated = null;
3365
+ program.hook("preAction", async (_program, command) => {
3366
+ const path = commandPathOf(command);
3367
+ if (exemptFromUpdateGate(path, ["status"])) return;
3368
+ const core = openCore({ env });
3369
+ let ended = null;
3370
+ const code = await runCommand(output(), async () => {
3371
+ ended = await updateGateAtTerminal({
3372
+ core,
3373
+ env,
3374
+ binary: "agent-whatsapp",
3375
+ channel: "whatsapp",
3376
+ running: VERSION,
3377
+ output: output(),
3378
+ noInput: false,
3379
+ streams,
3380
+ approveCommand: "agent-whatsapp approve",
3381
+ approvals: approvalsOf(command)
3382
+ });
3383
+ }, streams);
3384
+ gated = code !== 0 ? code : ended;
3385
+ });
3363
3386
  const act = (body) => async (...args) => {
3364
3387
  ran = true;
3365
3388
  softExit = null;
3389
+ if (gated !== null) {
3390
+ exitCode = gated;
3391
+ return;
3392
+ }
3366
3393
  exitCode = await runCommand(output(), async () => {
3367
3394
  requireSupportedNode();
3368
3395
  await body(new WhatsAppContext({
@@ -3495,7 +3522,7 @@ a macOS dialog may be waiting) · 77 permission needed (macOS privacy) · 78 con
3495
3522
  ran = true;
3496
3523
  exitCode = await runCommand(output(), async () => {
3497
3524
  requireSupportedNode();
3498
- const { startWhatsAppStdioServer } = await import("./stdio-entry-Dmwsi_a0.mjs");
3525
+ const { startWhatsAppStdioServer } = await import("./stdio-entry-Blz5voaW.mjs");
3499
3526
  await startWhatsAppStdioServer({
3500
3527
  env,
3501
3528
  ...flags.account ? { account: String(flags.account) } : {}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { tt as VERSION, u as composeDraft } from "./sync-BcshklLi.mjs";
2
- import { t as createWhatsAppMcpServer } from "./server-BZiPPNbS.mjs";
1
+ import { st as VERSION, u as composeDraft } from "./sync-DU_KB2pO.mjs";
2
+ import { t as createWhatsAppMcpServer } from "./server-3qn7im60.mjs";
3
3
  //#region src/index.ts
4
4
  /**
5
5
  * The library entry of `@agentcomms/whatsapp`.
@@ -1,4 +1,4 @@
1
- import { D as strictToolArguments, E as UNTRUSTED_NOTICE, Z as toCommsError, a as listChats, d as draftMessage, i as CHAT_KINDS, m as WhatsAppContext, n as whatsappStatus, o as readChat, s as searchMessages, t as syncAccount, tt as VERSION } from "./sync-BcshklLi.mjs";
1
+ import { D as strictToolArguments, E as UNTRUSTED_NOTICE, a as listChats, d as draftMessage, i as CHAT_KINDS, it as updateToolGate, m as WhatsAppContext, n as whatsappStatus, o as readChat, s as searchMessages, st as VERSION, t as syncAccount, tt as toCommsError } from "./sync-DU_KB2pO.mjs";
2
2
  import { c as boolean, h as number, x as string } from "./schemas-DiGKNDNq.mjs";
3
3
  import { t as McpServer } from "./mcp-DXXb3Vv3-Co5BzjYe.mjs";
4
4
  //#region src/mcp/server.ts
@@ -70,7 +70,15 @@ async function createWhatsAppMcpServer(options = {}) {
70
70
  }]
71
71
  };
72
72
  };
73
- strictToolArguments(server, fail);
73
+ strictToolArguments(server, fail, updateToolGate({
74
+ core: context.core,
75
+ env: context.env,
76
+ server: "agent-whatsapp",
77
+ channel: "whatsapp",
78
+ running: VERSION,
79
+ exempt: ["whatsapp_status"],
80
+ now: context.now
81
+ }));
74
82
  const readsLocal = {
75
83
  readOnlyHint: true,
76
84
  openWorldHint: false
@@ -1,4 +1,4 @@
1
- import { t as createWhatsAppMcpServer } from "./server-BZiPPNbS.mjs";
1
+ import { t as createWhatsAppMcpServer } from "./server-3qn7im60.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