@agentcomms/whatsapp 0.13.1 → 0.14.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 +4 -6
- package/dist/index.d.mts +749 -95
- package/dist/index.mjs +2 -2
- package/dist/{server-DNyMO_pq.mjs → server-B0AHo-sF.mjs} +1 -1
- package/dist/{stdio-entry-vXXVDpnA.mjs → stdio-entry-DE2KP-So.mjs} +1 -1
- package/dist/{sync-DrWJVoXp.mjs → sync-DQHqQIgH.mjs} +6426 -4088
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as paint, A as PATH_OPTIONS, B as colorEnabled, C as checkStorePath, D as CHANNEL_SERVERS, F as
|
|
2
|
+
import { $ as paint, A as PATH_OPTIONS, B as colorEnabled, C as checkStorePath, D as CHANNEL_SERVERS, F as approveAndWaitSentence, G as handoffSentence, H as escapeForDisplay, I as approveChangeAtTerminal, J as isCommsError, K as handoffText, L as canPrompt, M as absoluteSearchPath, N as agentMarker, O as CommsError, P as approvalsOf, Q as openCore, R as childEnvironment, S as storeIdentity, T as expandSource, U as exemptFromUpdateGate, V as commandPathOf, W as gatedChangeAtTerminal, X as nameAvailable, Y as lookupName, Z as nameShapeProblem, _ as chatRefOf, a as listChats, at as serverInstallChange, b as requireAccount, c as Presenter, ct as truncateDisplay, d as draftMessage, dt as windowsSystemProgram, et as pathOverridesFromCliOptions, f as Visibility, ft as withFileLock, g as requireSupportedNode, gt as VERSION, h as WhatsAppIndex, i as CHAT_KINDS, it as runCommand, k as EXIT_CODES, l as innerText, lt as updateGateAtTerminal, m as WhatsAppContext, mt as CALLER, n as whatsappStatus, nt as renderPrune, o as readChat, ot as serverPruneChange, p as listKey, pt as writeResult, q as installExitStatus, r as probeStore, rt as resolvePaths, s as searchMessages, t as syncAccount, tt as renderInstall, v as PLATFORM, w as defaultStorePath, x as requireNamedConfig, y as newWhatsAppAccount, z as cliHandoffs } from "./sync-DQHqQIgH.mjs";
|
|
3
3
|
import { rm } from "node:fs/promises";
|
|
4
4
|
import path, { delimiter, join } from "node:path";
|
|
5
5
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -3558,13 +3558,10 @@ a macOS dialog may be waiting) · 77 permission needed (macOS privacy) · 78 con
|
|
|
3558
3558
|
program.command("approve <approvalId>").description("approve a change at this terminal — registering or pruning this server — by reading it and typing the code back; WhatsApp never sends, so there is no message to approve").action(act(async (context, options, approvalId) => {
|
|
3559
3559
|
const marker = agentMarker(env);
|
|
3560
3560
|
if (marker) throw new CommsError("APPROVAL_REQUIRED", "only a person can approve a change, not an agent", {
|
|
3561
|
-
hint:
|
|
3561
|
+
hint: approveAndWaitSentence(context.handoffs, "cli", approvalId, (command, wait) => wait === void 0 ? `Ask the person to run ${command} in their own terminal.` : `Ask the person to run ${command} in their own terminal; learn when they have with ${wait}.`),
|
|
3562
3562
|
details: { marker }
|
|
3563
3563
|
});
|
|
3564
3564
|
if (!canPrompt(env, streams, { json: options.json })) throw new CommsError("APPROVAL_REQUIRED", "approving a change needs an interactive terminal", { hint: handoffSentence(context.handoffs.own(["approve", approvalId]), (command) => `Run ${command} directly in a terminal.`) });
|
|
3565
|
-
const pending = await context.core.approvals.get(approvalId);
|
|
3566
|
-
if (!pending) throw new CommsError("NOT_FOUND", `no approval ${approvalId}`, { hint: "It may have expired, been used, or been cancelled. Prepare the change again." });
|
|
3567
|
-
if (approvalKind(pending) !== "change") throw new CommsError("USAGE", `approval ${approvalId} is for a send, and WhatsApp never sends`, { hint: sendApprovesHint(await context.handoffs.registered(), approvalId) });
|
|
3568
3565
|
const outcome = await approveChangeAtTerminal(context.core, approvalId, env, {
|
|
3569
3566
|
json: options.json,
|
|
3570
3567
|
color: options.color,
|
|
@@ -3574,6 +3571,7 @@ a macOS dialog may be waiting) · 77 permission needed (macOS privacy) · 78 con
|
|
|
3574
3571
|
}));
|
|
3575
3572
|
/** A change at this terminal; `rerun` is this command's words after the program, run again with its approval. */
|
|
3576
3573
|
const changeAt = (context, change, flags, rerun) => gatedChangeAtTerminal(context.core, change, {
|
|
3574
|
+
channel: "whatsapp",
|
|
3577
3575
|
approvalId: flags.approval === void 0 ? void 0 : String(flags.approval),
|
|
3578
3576
|
env,
|
|
3579
3577
|
output: output(),
|
|
@@ -3584,7 +3582,7 @@ a macOS dialog may be waiting) · 77 permission needed (macOS privacy) · 78 con
|
|
|
3584
3582
|
ran = true;
|
|
3585
3583
|
exitCode = await runCommand(output(), async () => {
|
|
3586
3584
|
requireSupportedNode();
|
|
3587
|
-
await (deps.startMcp ?? (await import("./stdio-entry-
|
|
3585
|
+
await (deps.startMcp ?? (await import("./stdio-entry-DE2KP-So.mjs")).startWhatsAppStdioServer)({
|
|
3588
3586
|
env,
|
|
3589
3587
|
platform,
|
|
3590
3588
|
...deps,
|