@agentcomms/whatsapp 0.27.1 → 0.29.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 +5 -5
- package/dist/index.d.mts +307 -1
- package/dist/index.mjs +2 -2
- package/dist/{server-DzDbH6wi.mjs → server-DjDSXoQK.mjs} +5 -2
- package/dist/{stdio-entry-BH3NUqT5.mjs → stdio-entry-CSkJ5urt.mjs} +1 -1
- package/dist/{sync-qRXSK8Go.mjs → sync-NJRjuwaR.mjs} +1506 -48
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as gatedChangeAtTerminal, A as requireAccount, B as PATH_OPTIONS, Ct as CALLER, F as expandSource, G as approveChangeAtTerminal, H as absoluteSearchPath, J as cliHandoffs, K as canPrompt, L as CHANNEL_SERVERS, M as storeIdentity, N as checkStorePath, O as PLATFORM, P as defaultStorePath, Q as exemptFromUpdateNotice, R as CommsError, S as chatRefOf, St as writeResult, Tt as VERSION, U as agentMarker, W as approveAndWaitSentence, X as commandPathOf, Y as colorEnabled, Z as escapeForDisplay, _ as WhatsAppContext, _t as truncateDisplay, a as CHAT_KINDS, at as nameAvailable, b as requireSupportedNode, bt as windowsSystemProgram, c as searchMessages, ct as paint, dt as renderPrune, et as handoffSentence, f as draftMessage, ft as resolvePaths, ht as serverPruneChange, i as probeStore, it as lookupName, j as requireNamedConfig, k as newWhatsAppAccount, l as Presenter, lt as pathOverridesFromCliOptions, m as listKey, mt as serverInstallChange, nt as installExitStatus, o as listChats, ot as nameShapeProblem, p as Visibility, pt as runCommand, q as childEnvironment, r as whatsappStatus, rt as isCommsError, s as readChat, st as openCore, t as syncAccount, tt as handoffText, u as innerText, ut as renderInstall, v as WhatsAppIndex, vt as updateNoticeAtTerminal, xt as withFileLock, z as EXIT_CODES } from "./sync-
|
|
2
|
+
import { $ as gatedChangeAtTerminal, A as requireAccount, B as PATH_OPTIONS, Ct as CALLER, F as expandSource, G as approveChangeAtTerminal, H as absoluteSearchPath, J as cliHandoffs, K as canPrompt, L as CHANNEL_SERVERS, M as storeIdentity, N as checkStorePath, O as PLATFORM, P as defaultStorePath, Q as exemptFromUpdateNotice, R as CommsError, S as chatRefOf, St as writeResult, Tt as VERSION, U as agentMarker, W as approveAndWaitSentence, X as commandPathOf, Y as colorEnabled, Z as escapeForDisplay, _ as WhatsAppContext, _t as truncateDisplay, a as CHAT_KINDS, at as nameAvailable, b as requireSupportedNode, bt as windowsSystemProgram, c as searchMessages, ct as paint, dt as renderPrune, et as handoffSentence, f as draftMessage, ft as resolvePaths, ht as serverPruneChange, i as probeStore, it as lookupName, j as requireNamedConfig, k as newWhatsAppAccount, l as Presenter, lt as pathOverridesFromCliOptions, m as listKey, mt as serverInstallChange, nt as installExitStatus, o as listChats, ot as nameShapeProblem, p as Visibility, pt as runCommand, q as childEnvironment, r as whatsappStatus, rt as isCommsError, s as readChat, st as openCore, t as syncAccount, tt as handoffText, u as innerText, ut as renderInstall, v as WhatsAppIndex, vt as updateNoticeAtTerminal, xt as withFileLock, z as EXIT_CODES } from "./sync-NJRjuwaR.mjs";
|
|
3
|
+
import childProcess, { spawn } from "node:child_process";
|
|
4
|
+
import fs, { accessSync, constants } from "node:fs";
|
|
3
5
|
import { rm } from "node:fs/promises";
|
|
4
6
|
import path, { delimiter, join } from "node:path";
|
|
5
7
|
import { stripVTControlCharacters } from "node:util";
|
|
6
|
-
import fs, { accessSync, constants as constants$1 } from "node:fs";
|
|
7
|
-
import childProcess, { spawn } from "node:child_process";
|
|
8
8
|
import process$1 from "node:process";
|
|
9
9
|
import { EventEmitter } from "node:events";
|
|
10
10
|
//#region ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
@@ -3209,7 +3209,7 @@ function linkOpener(platform, env) {
|
|
|
3209
3209
|
for (const directory of absoluteSearchPath((env.PATH ?? "").split(delimiter), platform)) {
|
|
3210
3210
|
const candidate = join(directory, "xdg-open");
|
|
3211
3211
|
try {
|
|
3212
|
-
accessSync(candidate, constants
|
|
3212
|
+
accessSync(candidate, constants.X_OK);
|
|
3213
3213
|
return candidate;
|
|
3214
3214
|
} catch {}
|
|
3215
3215
|
}
|
|
@@ -3569,7 +3569,7 @@ a macOS dialog may be waiting) · 77 permission needed (macOS privacy) · 78 con
|
|
|
3569
3569
|
ran = true;
|
|
3570
3570
|
exitCode = await runCommand(output(), async () => {
|
|
3571
3571
|
requireSupportedNode();
|
|
3572
|
-
await (deps.startMcp ?? (await import("./stdio-entry-
|
|
3572
|
+
await (deps.startMcp ?? (await import("./stdio-entry-CSkJ5urt.mjs")).startWhatsAppStdioServer)({
|
|
3573
3573
|
env,
|
|
3574
3574
|
platform,
|
|
3575
3575
|
...deps,
|
package/dist/index.d.mts
CHANGED
|
@@ -2223,7 +2223,7 @@ declare const ZodReadonly: $constructor<ZodReadonly>;
|
|
|
2223
2223
|
/** @deprecated Use z.ZodType (without generics) instead. */
|
|
2224
2224
|
type ZodTypeAny<Output = unknown, Input = unknown, Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> = ZodType<Output, Input, Internals>;
|
|
2225
2225
|
//#endregion
|
|
2226
|
-
//#region ../core/dist/launcher-
|
|
2226
|
+
//#region ../core/dist/launcher-CtlslgkT.d.mts
|
|
2227
2227
|
interface RegisteredServer {
|
|
2228
2228
|
client: string;
|
|
2229
2229
|
path: string;
|
|
@@ -2774,6 +2774,290 @@ interface CliHandoffs {
|
|
|
2774
2774
|
*/
|
|
2775
2775
|
type RenameReason = "auto-read" | "type" | "no-extension";
|
|
2776
2776
|
//#endregion
|
|
2777
|
+
//#region src/activity-settings.d.ts
|
|
2778
|
+
/**
|
|
2779
|
+
* The activity log's two settings (design 2026-10-25-activity §4.1): `activity.record`, `on` or `off`, and
|
|
2780
|
+
* `activity.retentionDays`, a whole number of days from 1 to 365. Absent, they read as on and 30.
|
|
2781
|
+
*
|
|
2782
|
+
* `config.json` keeps them as `activity: { record, retentionDays }`, a key the schemas do not name, so every release
|
|
2783
|
+
* sharing the file keeps it through its writes, as it keeps `agentLabel` and `behaviour`. It is read only through
|
|
2784
|
+
* `readActivitySettings`, which reads a value it does not understand as recording nothing — never as the default.
|
|
2785
|
+
* `off` and fewer days are the tightenings, which apply at once, and `on` and more days the loosenings, which a person
|
|
2786
|
+
* approves (`classifyChange`). So a hand edit or a later release's word can only make this release record less.
|
|
2787
|
+
*
|
|
2788
|
+
* A retention it cannot read is read as the longest, 365 days, with recording off: what it cannot read must never
|
|
2789
|
+
* delete what is held. Read as one day, a typo — or a later release's word — once deleted all but a day of the log.
|
|
2790
|
+
*
|
|
2791
|
+
* `config.ts` imports this module to judge a change, so it imports nothing at all.
|
|
2792
|
+
*/
|
|
2793
|
+
declare const ACTIVITY_RECORD_SETTINGS: readonly ["on", "off"];
|
|
2794
|
+
type ActivityRecordSetting = (typeof ACTIVITY_RECORD_SETTINGS)[number];
|
|
2795
|
+
/** The settings as they apply, and what in the file could not be read as written (empty when all of it could). */
|
|
2796
|
+
interface ActivitySettings {
|
|
2797
|
+
readonly record: ActivityRecordSetting;
|
|
2798
|
+
readonly retentionDays: number;
|
|
2799
|
+
/** One sentence for each value read as something stricter than the file says — for `doctor` to show. */
|
|
2800
|
+
readonly problems: readonly string[];
|
|
2801
|
+
}
|
|
2802
|
+
//#endregion
|
|
2803
|
+
//#region src/activity.d.ts
|
|
2804
|
+
/**
|
|
2805
|
+
* The activity log (design 2026-10-25-activity, §4 with S1–S5): one line for every call an agent session makes that
|
|
2806
|
+
* reads or writes account data, tied to the session that made it — what it touched, never what it said.
|
|
2807
|
+
*
|
|
2808
|
+
* - **Where:** `<state>/activity/YYYY-MM-DD.jsonl` (the UTC day of the line), each file owner-only (600) in an
|
|
2809
|
+
* owner-only folder (700), each line appended whole with `appendPrivateLine`, as the audit log's are. Daily files,
|
|
2810
|
+
* so retention drops whole days (`prune`).
|
|
2811
|
+
* - **What a line holds:** `ActivityLine`, and nothing else. Every line is rebuilt field by field from the fields a
|
|
2812
|
+
* line has (`activityLineOf`), so a channel that hands over a whole message — body, text, HTML, attachment bytes —
|
|
2813
|
+
* still writes only its id, subject and sender: the type says so, and the copy makes it so. Subjects and names are
|
|
2814
|
+
* kept as received, cut to their bounds, and shown only inside the untrusted-content envelope.
|
|
2815
|
+
* - **Never in the way:** `append` never throws into its caller. A line that cannot be written is said once per
|
|
2816
|
+
* process on stderr, remembered for `doctor`, and the call it describes goes on (§4.6).
|
|
2817
|
+
* - **The audit log is unchanged.** It stays small, content-free and shareable; this one is private.
|
|
2818
|
+
*/
|
|
2819
|
+
/** What the call did with account data: read it, wrote it, was told of it (an event delivery, S1), or approved it. */
|
|
2820
|
+
declare const ACTIVITY_KINDS: readonly ["read", "write", "told", "approval"];
|
|
2821
|
+
type ActivityKind = (typeof ACTIVITY_KINDS)[number];
|
|
2822
|
+
/** How it ended: done, refused by a policy, an approval or a rule, or failed. */
|
|
2823
|
+
declare const ACTIVITY_OUTCOMES: readonly ["ok", "refused", "failed"];
|
|
2824
|
+
type ActivityOutcome = (typeof ACTIVITY_OUTCOMES)[number];
|
|
2825
|
+
/** Which kind of process recorded it: an MCP server, a CLI call, or the event service's own work. */
|
|
2826
|
+
declare const ACTIVITY_SURFACES: readonly ["mcp", "cli", "daemon"];
|
|
2827
|
+
type ActivitySurface = (typeof ACTIVITY_SURFACES)[number];
|
|
2828
|
+
/** An MCP client's `clientInfo`, as the client reported it: what it said, never proof of what it is (§4.3). */
|
|
2829
|
+
interface ClientInfo {
|
|
2830
|
+
readonly name: string;
|
|
2831
|
+
readonly version?: string | undefined;
|
|
2832
|
+
}
|
|
2833
|
+
/** The account a call acted on: its immutable id, and its name at the time. */
|
|
2834
|
+
interface ActivityAccount {
|
|
2835
|
+
readonly id: string;
|
|
2836
|
+
readonly alias: string;
|
|
2837
|
+
}
|
|
2838
|
+
/** Who sent a message, as its sender wrote it. */
|
|
2839
|
+
interface ActivitySender {
|
|
2840
|
+
readonly name?: string | undefined;
|
|
2841
|
+
readonly address?: string | undefined;
|
|
2842
|
+
}
|
|
2843
|
+
/**
|
|
2844
|
+
* One thing a call touched: a message, a thread, a file. Its id, and for a message its subject and sender, for a
|
|
2845
|
+
* download its file name and size, for a chat message the conversation it is in. Never a body, a preview or bytes.
|
|
2846
|
+
*/
|
|
2847
|
+
interface ActivityItem {
|
|
2848
|
+
readonly id: string;
|
|
2849
|
+
readonly subject?: string | undefined;
|
|
2850
|
+
readonly from?: ActivitySender | undefined;
|
|
2851
|
+
/** A file's name. */
|
|
2852
|
+
readonly name?: string | undefined;
|
|
2853
|
+
/** A file's size, in bytes. */
|
|
2854
|
+
readonly size?: number | undefined;
|
|
2855
|
+
/** Where it is: a Slack channel's name, say. */
|
|
2856
|
+
readonly conversation?: string | undefined;
|
|
2857
|
+
}
|
|
2858
|
+
/** A process as `ps` names it: its id, when it started (as `ps` prints it, an identity rather than a time), its name. */
|
|
2859
|
+
interface ActivityParent {
|
|
2860
|
+
readonly pid: number;
|
|
2861
|
+
readonly startedAt: string;
|
|
2862
|
+
readonly name: string;
|
|
2863
|
+
}
|
|
2864
|
+
/**
|
|
2865
|
+
* Which session made a call (S2). A session is an agent window: the processes one parent started in one folder.
|
|
2866
|
+
*
|
|
2867
|
+
* - `key` names the session: a hash of the parent's id, its start and the folder when `grouped`; otherwise a key of
|
|
2868
|
+
* this process's own, which no other process shares.
|
|
2869
|
+
* - `process` is a random id this process made when it started, and `pid` its process id.
|
|
2870
|
+
* - `folder` is the working folder, as a real path (shown with the home as `~` only at display time), or null when it
|
|
2871
|
+
* could not be read.
|
|
2872
|
+
* - `parent` is the parent that grouped it — for a CLI call that joined a window, that window's parent.
|
|
2873
|
+
* - `ancestors` (CLI calls only) names up to three processes above it, nearest first, so a person typing in a terminal
|
|
2874
|
+
* can be told from an agent's shell.
|
|
2875
|
+
*/
|
|
2876
|
+
interface ActivitySession {
|
|
2877
|
+
readonly key: string;
|
|
2878
|
+
readonly process: string;
|
|
2879
|
+
readonly pid: number;
|
|
2880
|
+
readonly client?: ClientInfo | undefined;
|
|
2881
|
+
readonly folder: string | null;
|
|
2882
|
+
readonly parent?: ActivityParent | undefined;
|
|
2883
|
+
readonly ancestors?: readonly string[] | undefined;
|
|
2884
|
+
readonly grouped: boolean;
|
|
2885
|
+
readonly surface: ActivitySurface;
|
|
2886
|
+
}
|
|
2887
|
+
/** What a `told` line says of a delivery (S1): the rule that matched and the target it reached. No sender, no payload. */
|
|
2888
|
+
interface ActivityTold {
|
|
2889
|
+
readonly rule: string;
|
|
2890
|
+
readonly target: string;
|
|
2891
|
+
}
|
|
2892
|
+
/**
|
|
2893
|
+
* One call, as the log keeps it (§4.2, S1, S2, S4). Content never: what was touched, by id, subject and sender, and
|
|
2894
|
+
* how it ended.
|
|
2895
|
+
*
|
|
2896
|
+
* - `operation` is the capability id (`gmail.search`), `channel` the channel's word (`gmail`).
|
|
2897
|
+
* - `items` lists at most fifty things touched; `count` says how many there were in all.
|
|
2898
|
+
* - `counts` holds named counts where a channel records no identities (WhatsApp's `chats` and `messages`, S4).
|
|
2899
|
+
* - `query` is a search's words — an agent wrote them, not a sender.
|
|
2900
|
+
* - `recipients` and `approvalId` are a write's, as the audit records them.
|
|
2901
|
+
* - `told` is a delivery's (S1).
|
|
2902
|
+
*/
|
|
2903
|
+
interface ActivityLine {
|
|
2904
|
+
readonly at: string;
|
|
2905
|
+
readonly channel: string;
|
|
2906
|
+
readonly account: ActivityAccount;
|
|
2907
|
+
readonly operation: string;
|
|
2908
|
+
readonly kind: ActivityKind;
|
|
2909
|
+
readonly outcome: ActivityOutcome;
|
|
2910
|
+
readonly reason?: string | undefined;
|
|
2911
|
+
readonly session: ActivitySession;
|
|
2912
|
+
readonly ms: number;
|
|
2913
|
+
readonly items?: readonly ActivityItem[] | undefined;
|
|
2914
|
+
readonly count?: number | undefined;
|
|
2915
|
+
readonly counts?: Readonly<Record<string, number>> | undefined;
|
|
2916
|
+
readonly query?: string | undefined;
|
|
2917
|
+
readonly recipients?: readonly string[] | undefined;
|
|
2918
|
+
readonly approvalId?: string | undefined;
|
|
2919
|
+
readonly told?: ActivityTold | undefined;
|
|
2920
|
+
/**
|
|
2921
|
+
* The line was cut to `MAX_ACTIVITY_LINE_BYTES`: items, then recipients, dropped from the end, and long words
|
|
2922
|
+
* shortened. `count` still says how many items there were.
|
|
2923
|
+
*/
|
|
2924
|
+
readonly truncated?: true | undefined;
|
|
2925
|
+
}
|
|
2926
|
+
/** A line to append: `at` is now when left out. */
|
|
2927
|
+
type ActivityLineInput = Omit<ActivityLine, "at"> & {
|
|
2928
|
+
readonly at?: string | undefined;
|
|
2929
|
+
};
|
|
2930
|
+
/** How many lines of each kind, and of each outcome. */
|
|
2931
|
+
interface ActivityCounts {
|
|
2932
|
+
readonly kind: Readonly<Record<ActivityKind, number>>;
|
|
2933
|
+
readonly outcome: Readonly<Record<ActivityOutcome, number>>;
|
|
2934
|
+
}
|
|
2935
|
+
/**
|
|
2936
|
+
* One session as `sessions` lists it: where and by what it ran, when it was first and last seen, how many processes
|
|
2937
|
+
* recorded lines for it, and its counts by kind and outcome. Its folder, client and parent are those of its first
|
|
2938
|
+
* server process — or of its first line, when only CLI calls recorded any.
|
|
2939
|
+
*/
|
|
2940
|
+
interface ActivitySessionSummary {
|
|
2941
|
+
readonly key: string;
|
|
2942
|
+
readonly grouped: boolean;
|
|
2943
|
+
readonly surfaces: readonly ActivitySurface[];
|
|
2944
|
+
readonly folder: string | null;
|
|
2945
|
+
readonly client: ClientInfo | null;
|
|
2946
|
+
readonly parent: ActivityParent | null;
|
|
2947
|
+
readonly firstSeen: string;
|
|
2948
|
+
readonly lastSeen: string;
|
|
2949
|
+
readonly processes: number;
|
|
2950
|
+
readonly channels: readonly string[];
|
|
2951
|
+
readonly accounts: readonly string[];
|
|
2952
|
+
readonly counts: ActivityCounts;
|
|
2953
|
+
}
|
|
2954
|
+
/** A line that could not be written: when, why, and which process — never anything the line held. */
|
|
2955
|
+
interface ActivityFailure {
|
|
2956
|
+
readonly at: string;
|
|
2957
|
+
readonly code: string;
|
|
2958
|
+
readonly message: string;
|
|
2959
|
+
readonly pid: number;
|
|
2960
|
+
}
|
|
2961
|
+
/** What `doctor` reads of the log: where it is, whether it is private and writable, and the last failure. */
|
|
2962
|
+
interface ActivityHealth {
|
|
2963
|
+
readonly directory: string;
|
|
2964
|
+
/** False when nothing was recorded yet. */
|
|
2965
|
+
readonly exists: boolean;
|
|
2966
|
+
/** False when something that is not a folder stands where it goes. */
|
|
2967
|
+
readonly isDirectory: boolean;
|
|
2968
|
+
/** Whether only its owner can read it; null where that cannot be told (Windows), or before it exists. */
|
|
2969
|
+
readonly private: boolean | null;
|
|
2970
|
+
/** Whether today's file can be written: the file when it exists, its folder otherwise. */
|
|
2971
|
+
readonly writable: boolean;
|
|
2972
|
+
/** The days held, oldest first. */
|
|
2973
|
+
readonly days: readonly string[];
|
|
2974
|
+
/** When a line was last written, from the newest file's time; null when there is none. */
|
|
2975
|
+
readonly lastWritten: string | null;
|
|
2976
|
+
/** The last failure any process recorded, or this one remembers. */
|
|
2977
|
+
readonly failure: ActivityFailure | null;
|
|
2978
|
+
}
|
|
2979
|
+
/** What `show` filters by. `account` is a name or an id; `since` an ISO time. */
|
|
2980
|
+
interface ActivityFilters {
|
|
2981
|
+
readonly kind?: ActivityKind | undefined;
|
|
2982
|
+
readonly channel?: string | undefined;
|
|
2983
|
+
readonly account?: string | undefined;
|
|
2984
|
+
readonly outcome?: ActivityOutcome | undefined;
|
|
2985
|
+
readonly since?: string | undefined;
|
|
2986
|
+
/** The most lines to return, newest first: 1000 when left out. */
|
|
2987
|
+
readonly limit?: number | undefined;
|
|
2988
|
+
}
|
|
2989
|
+
/** One session's lines, newest first, filtered; and what all of its lines in the time asked add up to. */
|
|
2990
|
+
interface ActivityShown {
|
|
2991
|
+
readonly lines: ActivityLine[];
|
|
2992
|
+
/** True when more lines matched than `limit`. */
|
|
2993
|
+
readonly more: boolean;
|
|
2994
|
+
/** The session over the time asked, before the other filters; null when it has no line there at all. */
|
|
2995
|
+
readonly summary: ActivitySessionSummary | null;
|
|
2996
|
+
}
|
|
2997
|
+
interface ActivityLogOptions {
|
|
2998
|
+
now?: (() => Date) | undefined;
|
|
2999
|
+
/**
|
|
3000
|
+
* The settings in force, read afresh for every line, so turning recording off applies at once in every process.
|
|
3001
|
+
* Left out, on and 30 days. A reader that throws — a configuration that cannot be read — is read as off.
|
|
3002
|
+
*/
|
|
3003
|
+
settings?: (() => Promise<ActivitySettings>) | undefined;
|
|
3004
|
+
/** Where the once-a-process line about a failure goes: stderr when left out. */
|
|
3005
|
+
warn?: ((line: string) => void) | undefined;
|
|
3006
|
+
}
|
|
3007
|
+
declare class ActivityLog {
|
|
3008
|
+
#private;
|
|
3009
|
+
readonly directory: string;
|
|
3010
|
+
constructor(stateDir: string, options?: ActivityLogOptions);
|
|
3011
|
+
/** The last line this process could not write, or null. */
|
|
3012
|
+
get lastFailure(): ActivityFailure | null;
|
|
3013
|
+
/**
|
|
3014
|
+
* Appends one line, unless recording is off. True when it was written. Never throws: a line that cannot be written
|
|
3015
|
+
* is said once per process (`warn`, stderr by default), recorded beside the log for `doctor`, and returns false.
|
|
3016
|
+
*
|
|
3017
|
+
* The first call a process makes on each day — this, or any read — first prunes days older than the retention in
|
|
3018
|
+
* force, whether or not recording is on: the log's daily maintenance, best effort.
|
|
3019
|
+
*/
|
|
3020
|
+
append(input: ActivityLineInput): Promise<boolean>;
|
|
3021
|
+
/** The days held, oldest first. */
|
|
3022
|
+
days(): Promise<string[]>;
|
|
3023
|
+
/**
|
|
3024
|
+
* Deletes every day whose last line is older than `retentionDays` days: a day goes once all of it is that old, so
|
|
3025
|
+
* every line is kept at least that long and at most a day longer. Whole days only; every other day is left whole.
|
|
3026
|
+
*/
|
|
3027
|
+
prune(retentionDays: number): Promise<{
|
|
3028
|
+
deleted: string[];
|
|
3029
|
+
}>;
|
|
3030
|
+
/**
|
|
3031
|
+
* Every session with a line at or after `since` (every day the retention keeps, when left out), newest first. A day
|
|
3032
|
+
* past the retention is never read, whether or not it has been deleted yet.
|
|
3033
|
+
*/
|
|
3034
|
+
sessions(options?: {
|
|
3035
|
+
since?: string | undefined;
|
|
3036
|
+
}): Promise<ActivitySessionSummary[]>;
|
|
3037
|
+
/**
|
|
3038
|
+
* One session's lines, newest first, that match every filter given; and its summary over the time asked. Only
|
|
3039
|
+
* lines whose session key is exactly `key` are ever read into the answer, and none of a day past the retention.
|
|
3040
|
+
*/
|
|
3041
|
+
show(key: string, filters?: ActivityFilters): Promise<ActivityShown>;
|
|
3042
|
+
/**
|
|
3043
|
+
* The window a CLI call belongs to (S2): the session of a server process, today or yesterday, whose parent is one of
|
|
3044
|
+
* `ancestors` — the nearest first. Null when none is. Read from each day's parents file; a day with none — written
|
|
3045
|
+
* by an earlier build — is read whole, as before.
|
|
3046
|
+
*/
|
|
3047
|
+
sessionOfAncestor(ancestors: readonly ActivityParent[]): Promise<{
|
|
3048
|
+
key: string;
|
|
3049
|
+
parent: ActivityParent;
|
|
3050
|
+
folder: string | null;
|
|
3051
|
+
} | null>;
|
|
3052
|
+
/** The last failure recorded by any process — the newer of the file beside the log and this process's own. */
|
|
3053
|
+
readFailure(): Promise<ActivityFailure | null>;
|
|
3054
|
+
/**
|
|
3055
|
+
* What `doctor` shows of the log. It creates nothing; like every read it first deletes the days past the retention,
|
|
3056
|
+
* once a day per process, so the days it lists past the retention are those that could not be deleted.
|
|
3057
|
+
*/
|
|
3058
|
+
health(): Promise<ActivityHealth>;
|
|
3059
|
+
}
|
|
3060
|
+
//#endregion
|
|
2777
3061
|
//#region src/ledger.d.ts
|
|
2778
3062
|
interface Caps {
|
|
2779
3063
|
perHour: number;
|
|
@@ -3084,6 +3368,11 @@ interface Core {
|
|
|
3084
3368
|
plans: PlanStore;
|
|
3085
3369
|
taint: TaintStore;
|
|
3086
3370
|
audit: AuditLog;
|
|
3371
|
+
/**
|
|
3372
|
+
* The activity log (design 2026-10-25-activity): one line per call an agent session makes to account data, private,
|
|
3373
|
+
* by day, under the settings in `config.json`'s `activity`. Never throws into a caller (`ActivityLog.append`).
|
|
3374
|
+
*/
|
|
3375
|
+
activity: ActivityLog;
|
|
3087
3376
|
/** Opens the config directory's one secret backend (as recorded in config, or `kind` before the first write). */
|
|
3088
3377
|
secrets(kind?: SecretStoreKind): Promise<SecretStore>;
|
|
3089
3378
|
/**
|
|
@@ -4130,6 +4419,16 @@ interface ConfigBody {
|
|
|
4130
4419
|
* keep every key they do not name, so older releases keep it too, and judged by `classifyChange`.
|
|
4131
4420
|
*/
|
|
4132
4421
|
behaviour?: unknown;
|
|
4422
|
+
/**
|
|
4423
|
+
* The activity log's settings (design 2026-10-25-activity §4.1): `{ record: 'on' | 'off', retentionDays: 1..365 }`,
|
|
4424
|
+
* on and 30 when absent.
|
|
4425
|
+
*
|
|
4426
|
+
* `unknown` here, as `agentLabel` and `behaviour` are: it is read only through `readActivitySettings`, which reads a
|
|
4427
|
+
* value it does not understand as recording less — off, and the fewest days — so a hand edit or a later release's
|
|
4428
|
+
* word can only tighten. Kept through every write as the schemas keep every key they do not name, and judged by
|
|
4429
|
+
* `classifyChange`: recording again and keeping more days are loosenings, off and fewer days tightenings.
|
|
4430
|
+
*/
|
|
4431
|
+
activity?: unknown;
|
|
4133
4432
|
}
|
|
4134
4433
|
interface ConfigV1 extends ConfigBody {
|
|
4135
4434
|
version: 1;
|
|
@@ -12064,6 +12363,11 @@ interface WhatsAppContextOptions {
|
|
|
12064
12363
|
sourceIo?: SourceIo | undefined;
|
|
12065
12364
|
sourceTimeoutMs?: number | undefined;
|
|
12066
12365
|
platform?: NodeJS.Platform | undefined;
|
|
12366
|
+
/**
|
|
12367
|
+
* What the MCP client said it is (`clientInfo`), for the activity log's session (design 2026-10-25-activity, §4.3):
|
|
12368
|
+
* a function, since the server learns it only once a client has connected. The command line has none.
|
|
12369
|
+
*/
|
|
12370
|
+
clientInfo?: (() => ClientInfo | undefined) | undefined;
|
|
12067
12371
|
}
|
|
12068
12372
|
interface ResolvedAccount {
|
|
12069
12373
|
name: string;
|
|
@@ -12082,6 +12386,8 @@ declare class WhatsAppContext {
|
|
|
12082
12386
|
readonly lists: ChatListStore;
|
|
12083
12387
|
/** The name a pinned server was started for, as given. */
|
|
12084
12388
|
readonly pinned: string | undefined;
|
|
12389
|
+
/** What the MCP client said it is, for the activity log; undefined at the command line. */
|
|
12390
|
+
readonly clientInfo: (() => ClientInfo | undefined) | undefined;
|
|
12085
12391
|
constructor(options?: WhatsAppContextOptions);
|
|
12086
12392
|
/** The spike's accounts moved in, once per process; what happened, when there was a spike file to move. */
|
|
12087
12393
|
migration(): Promise<SpikeMigration | null>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as chatKindOf, D as text, E as numeric, R as CommsError, T as kindOf, Tt as VERSION, _ as WhatsAppContext, d as composeDraft, g as visibilityUnitKey, h as statusAuthor, m as listKey, n as withCheckedCopy, p as Visibility, w as coreDataToIso, wt as PACKAGE_NAME, x as inspectSchema, y as rebuildIndex } from "./sync-
|
|
2
|
-
import { t as createWhatsAppMcpServer } from "./server-
|
|
1
|
+
import { C as chatKindOf, D as text, E as numeric, R as CommsError, T as kindOf, Tt as VERSION, _ as WhatsAppContext, d as composeDraft, g as visibilityUnitKey, h as statusAuthor, m as listKey, n as withCheckedCopy, p as Visibility, w as coreDataToIso, wt as PACKAGE_NAME, x as inspectSchema, y as rebuildIndex } from "./sync-NJRjuwaR.mjs";
|
|
2
|
+
import { t as createWhatsAppMcpServer } from "./server-DjDSXoQK.mjs";
|
|
3
3
|
//#region src/source/event-reader.ts
|
|
4
4
|
function rawFromMe(value) {
|
|
5
5
|
const number = numeric(value);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as strictToolArguments, Tt as VERSION, V as UNTRUSTED_NOTICE, _ as WhatsAppContext, a as CHAT_KINDS, c as searchMessages, f as draftMessage, gt as toCommsError, o as listChats, r as whatsappStatus, s as readChat, t as syncAccount, yt as updateToolNotice } from "./sync-
|
|
1
|
+
import { I as strictToolArguments, Tt as VERSION, V as UNTRUSTED_NOTICE, _ as WhatsAppContext, a as CHAT_KINDS, c as searchMessages, f as draftMessage, gt as toCommsError, o as listChats, r as whatsappStatus, s as readChat, t as syncAccount, yt as updateToolNotice } from "./sync-NJRjuwaR.mjs";
|
|
2
2
|
import { c as boolean, h as number, x as string } from "./iso-5-9R47LC.mjs";
|
|
3
3
|
import { t as McpServer } from "./mcp-DIH4cS6P-C1s6ZIjc.mjs";
|
|
4
4
|
//#region src/mcp/server.ts
|
|
@@ -34,15 +34,18 @@ async function buildInstructions(context) {
|
|
|
34
34
|
].join("\n");
|
|
35
35
|
}
|
|
36
36
|
async function createWhatsAppMcpServer(options = {}) {
|
|
37
|
+
const client = {};
|
|
37
38
|
const context = new WhatsAppContext({
|
|
38
39
|
...options,
|
|
39
|
-
surface: "mcp"
|
|
40
|
+
surface: "mcp",
|
|
41
|
+
clientInfo: () => client.info?.()
|
|
40
42
|
});
|
|
41
43
|
await context.checkPin();
|
|
42
44
|
const server = new McpServer({
|
|
43
45
|
name: "agent-whatsapp",
|
|
44
46
|
version: VERSION
|
|
45
47
|
}, { instructions: await buildInstructions(context) });
|
|
48
|
+
client.info = () => server.server.getClientVersion();
|
|
46
49
|
const reply = (data) => {
|
|
47
50
|
const structured = JSON.parse(JSON.stringify(data));
|
|
48
51
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createWhatsAppMcpServer } from "./server-
|
|
1
|
+
import { t as createWhatsAppMcpServer } from "./server-DjDSXoQK.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
|