@agentcomms/whatsapp 0.16.0 → 0.18.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/index.d.mts CHANGED
@@ -4277,7 +4277,7 @@ declare namespace external_d_exports {
4277
4277
  export { $brand, $input, $output, BRAND, CompileOptions, GlobalMeta, INVALID, Infer$1 as Infer, IssueData, JSONType, NEVER, $RefinementCtx as RefinementCtx, SafeExtendShape, Schema, TimePrecision, TypeOf, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCoercedBigInt, ZodCoercedBoolean, ZodCoercedDate, ZodCoercedNumber, ZodCoercedString, ZodCompileAsyncError, ZodCompileUnsupportedError, ZodCreditCard, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodErrorMap, ZodExactOptional, ZodFile, ZodFirstPartySchemaTypes, ZodFirstPartyTypeKind, ZodFlattenedError, ZodFloat32, ZodFloat64, ZodFormattedError, ZodFunction, ZodGUID, ZodIBAN, ZodIPv4, ZodIPv6, ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime, ZodInstanceOf, ZodInt, ZodInt32, ZodInt64, ZodIntersection, ZodIssue, ZodIssueCode, ZodJSONSchema, ZodJSONSchemaInternals, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMAC, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPreprocess, ZodPromise, ZodRawShape$1 as ZodRawShape, ZodReadonly, ZodRealError, ZodRecord, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, ZodSchema, ZodSet, ZodStandardSchemaWithJSON, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodType, ZodTypeAny, ZodUInt32, ZodUInt64, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, ZodXor, _ZodBigInt, _ZodBoolean, _ZodDate, _ZodNumber, _ZodString, _ZodType, _default, _function, any, array, base64, base64url, bigint$1 as bigint, boolean$1 as boolean, _catch as catch, check, cidrv4, cidrv6, clone, codec, coerce_d_exports as coerce, compile, config, index_d_exports$1 as core, creditCard, cuid, cuid2, currencyCode, custom, date$2 as date, decode, decodeAsync, deepPartial, describe, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _endsWith as endsWith, _enum as enum, exactOptional, file, flattenError, float32, float64, formatError, fromJSONSchema, _function as function, getDiscriminatedOption, getErrorMap, globalRegistry, _gt as gt, _gte as gte, guid, hash, hex, hostname, httpUrl, iban, _includes as includes, output$1 as infer, inferFlattenedErrors, inferFormattedError, input, _instanceof as instanceof, int, int32, int64, intersection, invertCodec, ipv4, ipv6, iso_d_exports as iso, json, jwt, keyof, ksuid, lazy, _length as length, literal, index_d_exports$2 as locales, looseObject, looseRecord, _lowercase as lowercase, _lt as lt, _lte as lte, mac, map, _maxLength as maxLength, _maxSize as maxSize, memoizer, meta, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, nan, nanoid, nativeEnum, _negative as negative, never, _nonnegative as nonnegative, nonoptional, _nonpositive as nonpositive, _normalize as normalize, _null as null, nullable, nullish, number$1 as number, object, optional, output, _overwrite as overwrite, parse, parseAsync, partialRecord, pipe, _positive as positive, prefault, preprocess, prettifyError, promise, _properties as properties, _property as property, readonly, record, refine, _regex as regex, regexes_d_exports as regexes, registry, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, setErrorMap, _size as size, _slugify as slugify, _startsWith as startsWith, strictObject, string$1 as string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, toJSONSchema, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, toZod, transform, treeifyError, _trim as trim, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, _uppercase as uppercase, url, util_d_exports as util, uuid, uuidv4, uuidv6, uuidv7, validate, validateAsync, _void as void, withParser, xid, xor };
4278
4278
  }
4279
4279
  //#endregion
4280
- //#region ../core/dist/change-flow-B_bGbrkO.d.mts
4280
+ //#region ../core/dist/change-flow-j65bYTxL.d.mts
4281
4281
  //#region src/config-hooks.d.ts
4282
4282
  /**
4283
4283
  * Test-only pauses inside `ConfigStore.convertToVersion3`, for the tests that prove a write racing the conversion is
@@ -4383,6 +4383,25 @@ declare class CommsError extends Error {
4383
4383
  get exitCode(): number;
4384
4384
  get retryable(): boolean;
4385
4385
  }
4386
+ /**
4387
+ * The file operations a lock is made of, one method each, so a test can count and interrupt every one of them: the
4388
+ * create that is the attempt, the read that checks a holder, the touch that renews, the unlink that releases.
4389
+ * `withFileLock` uses the real ones; `tryFileLock` takes another for a caller whose every step is counted.
4390
+ */
4391
+ interface LockIo {
4392
+ /** Creates `path` exclusively (`wx`, 0600) holding `body`: the one attempt to take the lock. */
4393
+ create(path: string, body: string): Promise<void>;
4394
+ /** The lock file's text: a holder's body. */
4395
+ read(path: string): Promise<string>;
4396
+ /** The lock file's modification time, in milliseconds: where a renewal shows. */
4397
+ mtime(path: string): Promise<number>;
4398
+ /** Sets the lock file's times to now: a renewal. */
4399
+ touch(path: string): Promise<void>;
4400
+ rename(from: string, to: string): Promise<void>;
4401
+ link(from: string, to: string): Promise<void>;
4402
+ /** Removes a lock file, or one moved aside; a missing one is no error. */
4403
+ remove(path: string): Promise<void>;
4404
+ }
4386
4405
  //#endregion
4387
4406
  //#region src/cli-command.d.ts
4388
4407
  /**
@@ -4420,9 +4439,10 @@ declare class PrintedCommand {
4420
4439
  #private;
4421
4440
  /** The words, as the program is to receive them: this Node, its flags, the entry, then the CLI's own words. */
4422
4441
  readonly words: readonly string[];
4423
- /** The line to paste; null when one of the words has no printing that every Windows shell passes on alike. */
4442
+ /** The line to paste; null when no supported common or labelled shell rendering is safe. */
4424
4443
  readonly line: string | null;
4425
4444
  readonly platform: NodeJS.Platform;
4445
+ readonly shell?: "powershell" | undefined;
4426
4446
  constructor(gate: typeof GATE$1, words: readonly string[], platform: NodeJS.Platform, entry: string);
4427
4447
  /**
4428
4448
  * The real path of the file it runs, as it was checked when the command was located: a fact about then (D6). The
@@ -5027,25 +5047,6 @@ interface DisclosureBinding {
5027
5047
  * change to no owner at all, stored with `inboxId: ''`.
5028
5048
  */
5029
5049
  type OwnerScope = "owner" | "prospective" | "global";
5030
- /**
5031
- * The file operations a lock is made of, one method each, so a test can count and interrupt every one of them: the
5032
- * create that is the attempt, the read that checks a holder, the touch that renews, the unlink that releases.
5033
- * `withFileLock` uses the real ones; `tryFileLock` takes another for a caller whose every step is counted.
5034
- */
5035
- interface LockIo {
5036
- /** Creates `path` exclusively (`wx`, 0600) holding `body`: the one attempt to take the lock. */
5037
- create(path: string, body: string): Promise<void>;
5038
- /** The lock file's text: a holder's body. */
5039
- read(path: string): Promise<string>;
5040
- /** The lock file's modification time, in milliseconds: where a renewal shows. */
5041
- mtime(path: string): Promise<number>;
5042
- /** Sets the lock file's times to now: a renewal. */
5043
- touch(path: string): Promise<void>;
5044
- rename(from: string, to: string): Promise<void>;
5045
- link(from: string, to: string): Promise<void>;
5046
- /** Removes a lock file, or one moved aside; a missing one is no error. */
5047
- remove(path: string): Promise<void>;
5048
- }
5049
5050
  //#endregion
5050
5051
  //#region src/approval-io.d.ts
5051
5052
  /**
@@ -6235,7 +6236,7 @@ interface Core {
6235
6236
  /** This package's name, as its manifest has it. */
6236
6237
  export declare const PACKAGE_NAME = "@agentcomms/whatsapp";
6237
6238
  //#endregion
6238
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+server@2.0.0/node_modules/@modelcontextprotocol/server/dist/types-DUs7mGBv.d.mts
6239
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/server/dist/types-DUs7mGBv.d.mts
6239
6240
  //#region ../../node_modules/.pnpm/json-schema-typed@8.0.2/node_modules/json-schema-typed/draft_2020_12.d.ts
6240
6241
  type MaybeReadonlyArray<T> = Array<T> | ReadonlyArray<T>;
6241
6242
  type ValueOf<T> = T[keyof T];
@@ -7334,7 +7335,7 @@ declare namespace index_d_exports {
7334
7335
  export { $brand, $input, $output, BRAND, CompileOptions, GlobalMeta, INVALID, Infer$1 as Infer, IssueData, JSONType, NEVER, $RefinementCtx as RefinementCtx, SafeExtendShape, Schema, TimePrecision, TypeOf, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCoercedBigInt, ZodCoercedBoolean, ZodCoercedDate, ZodCoercedNumber, ZodCoercedString, ZodCompileAsyncError, ZodCompileUnsupportedError, ZodCreditCard, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodErrorMap, ZodExactOptional, ZodFile, ZodFirstPartySchemaTypes, ZodFirstPartyTypeKind, ZodFlattenedError, ZodFloat32, ZodFloat64, ZodFormattedError, ZodFunction, ZodGUID, ZodIBAN, ZodIPv4, ZodIPv6, ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime, ZodInstanceOf, ZodInt, ZodInt32, ZodInt64, ZodIntersection, ZodIssue, ZodIssueCode, ZodJSONSchema, ZodJSONSchemaInternals, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMAC, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPreprocess, ZodPromise, ZodRawShape$1 as ZodRawShape, ZodReadonly, ZodRealError, ZodRecord, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, ZodSchema, ZodSet, ZodStandardSchemaWithJSON, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodType, ZodTypeAny, ZodUInt32, ZodUInt64, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, ZodXor, _ZodBigInt, _ZodBoolean, _ZodDate, _ZodNumber, _ZodString, _ZodType, _default, _function, any, array, base64, base64url, bigint$1 as bigint, boolean$1 as boolean, _catch as catch, check, cidrv4, cidrv6, clone, codec, coerce_d_exports as coerce, compile, config, index_d_exports$1 as core, creditCard, cuid, cuid2, currencyCode, custom, date$2 as date, decode, decodeAsync, deepPartial, external_d_exports as default, describe, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _endsWith as endsWith, _enum as enum, exactOptional, file, flattenError, float32, float64, formatError, fromJSONSchema, _function as function, getDiscriminatedOption, getErrorMap, globalRegistry, _gt as gt, _gte as gte, guid, hash, hex, hostname, httpUrl, iban, _includes as includes, output$1 as infer, inferFlattenedErrors, inferFormattedError, input, _instanceof as instanceof, int, int32, int64, intersection, invertCodec, ipv4, ipv6, iso_d_exports as iso, json, jwt, keyof, ksuid, lazy, _length as length, literal, index_d_exports$2 as locales, looseObject, looseRecord, _lowercase as lowercase, _lt as lt, _lte as lte, mac, map, _maxLength as maxLength, _maxSize as maxSize, memoizer, meta, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, nan, nanoid, nativeEnum, _negative as negative, never, _nonnegative as nonnegative, nonoptional, _nonpositive as nonpositive, _normalize as normalize, _null as null, nullable, nullish, number$1 as number, object, optional, output, _overwrite as overwrite, parse, parseAsync, partialRecord, pipe, _positive as positive, prefault, preprocess, prettifyError, promise, _properties as properties, _property as property, readonly, record, refine, _regex as regex, regexes_d_exports as regexes, registry, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, setErrorMap, _size as size, _slugify as slugify, _startsWith as startsWith, strictObject, string$1 as string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, toJSONSchema, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, toZod, transform, treeifyError, _trim as trim, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, _uppercase as uppercase, url, util_d_exports as util, uuid, uuidv4, uuidv6, uuidv7, validate, validateAsync, _void as void, withParser, xid, xor, external_d_exports as z };
7335
7336
  }
7336
7337
  //#endregion
7337
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+core@2.0.0/node_modules/@modelcontextprotocol/core/dist/auth-BWdKR39I.d.mts
7338
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+core@2.3.1/node_modules/@modelcontextprotocol/core/dist/auth-Anm-lwWi.d.mts
7338
7339
  //#region src/types.d.ts
7339
7340
  type JSONValue = string | number | boolean | null | JSONObject | JSONArray;
7340
7341
  type JSONObject = {
@@ -7387,6 +7388,33 @@ declare const NotificationSchema: ZodObject<{
7387
7388
  }, $loose>>;
7388
7389
  }, $loose>>;
7389
7390
  }, $strip>;
7391
+ /**
7392
+ * The contents of a result's `_meta` field (the 2026-07-28 `ResultMetaObject`).
7393
+ * Loose — implementation-specific keys pass through.
7394
+ *
7395
+ * The serverInfo key identifies the server software producing the response
7396
+ * (servers SHOULD include it on every response; the value is self-reported
7397
+ * and intended for display, logging, and debugging). The getter defers the
7398
+ * `ImplementationSchema` reference, which is declared later in this file.
7399
+ */
7400
+ declare const ResultMetaObjectSchema: ZodObject<{
7401
+ readonly "io.modelcontextprotocol/serverInfo": ZodCatch<ZodOptional<ZodObject<{
7402
+ version: ZodString;
7403
+ websiteUrl: ZodOptional<ZodString>;
7404
+ description: ZodOptional<ZodString>;
7405
+ icons: ZodOptional<ZodArray<ZodObject<{
7406
+ src: ZodString;
7407
+ mimeType: ZodOptional<ZodString>;
7408
+ sizes: ZodOptional<ZodArray<ZodString>>;
7409
+ theme: ZodOptional<ZodEnum<{
7410
+ light: "light";
7411
+ dark: "dark";
7412
+ }>>;
7413
+ }, $strip>>>;
7414
+ name: ZodString;
7415
+ title: ZodOptional<ZodString>;
7416
+ }, $strip>>>;
7417
+ }, $loose>;
7390
7418
  declare const ResultSchema: ZodObject<{
7391
7419
  /**
7392
7420
  * See [MCP specification](https://modelcontextprotocol.io/specification/2026-07-28/basic/index#general-fields)
@@ -11065,7 +11093,7 @@ declare const ServerNotificationSchema: ZodUnion<readonly [ZodObject<{
11065
11093
  }, $strip>;
11066
11094
  }, $strip>]>;
11067
11095
  //#endregion
11068
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+server@2.0.0/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-CLhGwQTn.d.mts
11096
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-D4NN8WsG.d.mts
11069
11097
  //#endregion
11070
11098
  //#region ../core-internal/src/errors/sdkErrors.d.ts
11071
11099
  /**
@@ -11191,7 +11219,17 @@ declare class SdkError extends Error {
11191
11219
  * silently matching nothing).
11192
11220
  */
11193
11221
  static isInstance<T$1 extends abstract new (...args: never[]) => unknown>(this: T$1, value: unknown): value is InstanceType<T$1>;
11194
- constructor(code: SdkErrorCode, message: string, data?: unknown | undefined);
11222
+ /**
11223
+ * @param code - Stable string code identifying the failure ({@linkcode SdkErrorCode}).
11224
+ * @param message - Human-readable description.
11225
+ * @param data - Optional structured payload (for example the HTTP status carried by
11226
+ * {@linkcode SdkHttpError}). Opaque to the SDK: a `cause` key inside `data` is not
11227
+ * promoted to `Error.cause`.
11228
+ * @param options - Standard `ErrorOptions`, forwarded to `Error`. Pass the underlying
11229
+ * failure as `{ cause }` so it is reachable through the `Error.cause` chain that
11230
+ * loggers and error trackers walk.
11231
+ */
11232
+ constructor(code: SdkErrorCode, message: string, data?: unknown | undefined, options?: ErrorOptions);
11195
11233
  }
11196
11234
  type Primitive = string | number | boolean | bigint | null | undefined;
11197
11235
  type Flatten<T$1> = T$1 extends Primitive ? T$1 : T$1 extends Array<infer U> ? Array<Flatten<U>> : T$1 extends Set<infer U> ? Set<Flatten<U>> : T$1 extends Map<infer K, infer V> ? Map<Flatten<K>, Flatten<V>> : T$1 extends object ? { [K in keyof T$1]: Flatten<T$1[K]>; } : T$1;
@@ -11449,6 +11487,18 @@ interface AuthInfo {
11449
11487
  * If set, this MUST match the MCP server's resource identifier (minus hash fragment).
11450
11488
  */
11451
11489
  resource?: URL;
11490
+ /**
11491
+ * URL of the RFC 9728 Protected Resource Metadata document for the
11492
+ * resource server that accepted this token.
11493
+ *
11494
+ * The bearer-auth helpers stamp their configured `resourceMetadataUrl`
11495
+ * here when verification succeeds, so challenge responses built after
11496
+ * authentication (for example per-operation `insufficient_scope` scope
11497
+ * challenges) can advertise the same document as the authentication
11498
+ * gate's own challenges without separate configuration. Verifiers may
11499
+ * also populate it directly; a verifier-set value wins.
11500
+ */
11501
+ resourceMetadataUrl?: string;
11452
11502
  /**
11453
11503
  * Additional data associated with the token.
11454
11504
  * This field should be used for any additional data that needs to be attached to the auth info.
@@ -11507,6 +11557,11 @@ interface MessageExtraInfo {
11507
11557
  */
11508
11558
  closeStandaloneSSEStream?: () => void;
11509
11559
  }
11560
+ /**
11561
+ * The contents of a result's `_meta` field (the 2026-07-28 `ResultMetaObject`):
11562
+ * loose, with the optional self-reported serverInfo key typed when present.
11563
+ */
11564
+ type ResultMetaObject = Infer<typeof ResultMetaObjectSchema>;
11510
11565
  /**
11511
11566
  * {@linkcode CreateMessageRequestParams} without tools - for backwards-compatible overload.
11512
11567
  * Excludes tools/toolChoice to indicate they should not be provided.
@@ -11600,6 +11655,8 @@ type DecodedResult = {
11600
11655
  */
11601
11656
  inputRequests: Record<string, unknown>;
11602
11657
  requestState?: string;
11658
+ /** Result-level `_meta`, carried through so a manual caller sees it. */
11659
+ _meta?: ResultMetaObject;
11603
11660
  } | {
11604
11661
  kind: 'invalid';
11605
11662
  error: SdkError;
@@ -12215,6 +12272,8 @@ declare abstract class Protocol<ContextT extends BaseContext> {
12215
12272
  private _transport?;
12216
12273
  private _requestMessageId;
12217
12274
  private _requestHandlers;
12275
+ /** Methods registered with an explicit schema; the era gate in `_onrequest` reads it for the Tasks extension names. */
12276
+ private _customSchemaRequestMethods;
12218
12277
  private _requestHandlerAbortControllers;
12219
12278
  private _notificationHandlers;
12220
12279
  private _responseHandlers;
@@ -12598,6 +12657,20 @@ declare class UriTemplate {
12598
12657
  match(uri: string): Variables | null;
12599
12658
  }
12600
12659
  //#endregion
12660
+ //#region src/server/scopeChallenge.d.ts
12661
+ /** OAuth scopes to request before handling an MCP request. */
12662
+ interface ScopeChallenge {
12663
+ /** The exact, complete scope set to include in the challenge. Each scope must satisfy the OAuth `scope-token` grammar. */
12664
+ scopes: readonly [string, ...string[]];
12665
+ /** Optional human-readable detail satisfying the RFC 6750 `error-description` grammar. */
12666
+ errorDescription?: string;
12667
+ }
12668
+ /** Determines whether an MCP request needs an OAuth scope challenge. */
12669
+ type ScopeChallengeHandler = (context: {
12670
+ request: JSONRPCRequest;
12671
+ authInfo?: AuthInfo;
12672
+ }) => ScopeChallenge | undefined | Promise<ScopeChallenge | undefined>;
12673
+ //#endregion
12601
12674
  //#region src/server/server.d.ts
12602
12675
  type ServerOptions = ProtocolOptions & {
12603
12676
  /**
@@ -12739,6 +12812,8 @@ declare class Server extends Protocol<ServerContext> {
12739
12812
  * Initializes this server with the given name and version information.
12740
12813
  */
12741
12814
  constructor(_serverInfo: Implementation, options?: ServerOptions);
12815
+ /** Attaches to the given transport; rejects while this instance is connected to another one. */
12816
+ connect(transport: Transport): Promise<void>;
12742
12817
  /**
12743
12818
  * Registers the built-in `logging/setLevel` request handler.
12744
12819
  *
@@ -12997,6 +13072,16 @@ declare class Server extends Protocol<ServerContext> {
12997
13072
  }
12998
13073
  //#endregion
12999
13074
  //#region src/server/mcp.d.ts
13075
+ /**
13076
+ * Options for {@linkcode McpServer}: everything {@linkcode ServerOptions} accepts, plus `maxToolInputElements`.
13077
+ */
13078
+ type McpServerOptions = ServerOptions & {
13079
+ /**
13080
+ * Largest combined number of array elements and object members a single `tools/call` `arguments` payload may contain.
13081
+ * A number of at least 1; unset or `Infinity` means no limit.
13082
+ */
13083
+ maxToolInputElements?: number;
13084
+ };
13000
13085
  /**
13001
13086
  * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
13002
13087
  * For advanced usage (like sending notifications or setting custom request handlers), use the underlying
@@ -13015,16 +13100,12 @@ declare class McpServer {
13015
13100
  * The underlying {@linkcode Server} instance, useful for advanced operations like sending notifications.
13016
13101
  */
13017
13102
  readonly server: Server;
13103
+ private readonly _maxToolInputElements;
13018
13104
  private _registeredResources;
13019
13105
  private _registeredResourceTemplates;
13020
13106
  private _registeredTools;
13021
13107
  private _registeredPrompts;
13022
- /**
13023
- * Per-tool JSON-converted `inputSchema`, memoized so the SEP-2243
13024
- * registration-time scan and the pre-dispatch validation step share one
13025
- * conversion instead of paying it twice per request under the
13026
- * per-request-factory `createMcpHandler` model.
13027
- */
13108
+ /** Per-tool JSON-converted `inputSchema`, filled on first use by `toolInputSchemaJson()`. */
13028
13109
  private _toolInputSchemaJson;
13029
13110
  /**
13030
13111
  * The JSON-serialized `inputSchema` of a registered tool, or `undefined`
@@ -13035,7 +13116,7 @@ declare class McpServer {
13035
13116
  * @internal
13036
13117
  */
13037
13118
  toolInputSchemaJson(name: string): Record<string, unknown> | undefined;
13038
- constructor(serverInfo: Implementation, options?: ServerOptions);
13119
+ constructor(serverInfo: Implementation, options?: McpServerOptions);
13039
13120
  /**
13040
13121
  * Attaches to the given transport, starts it, and starts listening for messages.
13041
13122
  *
@@ -13053,6 +13134,8 @@ declare class McpServer {
13053
13134
  * Closes the connection.
13054
13135
  */
13055
13136
  close(): Promise<void>;
13137
+ /** @internal */
13138
+ resolveScopeChallenge: ScopeChallengeHandler;
13056
13139
  private _toolHandlersInitialized;
13057
13140
  private setToolRequestHandlers;
13058
13141
  /**
@@ -13103,9 +13186,11 @@ declare class McpServer {
13103
13186
  */
13104
13187
  registerResource(name: string, uriOrTemplate: string, config: ResourceMetadata & {
13105
13188
  cacheHint?: CacheHint;
13189
+ scopeChallenge?: ScopeChallengeHandler;
13106
13190
  }, readCallback: ReadResourceCallback): RegisteredResource;
13107
13191
  registerResource(name: string, uriOrTemplate: ResourceTemplate, config: ResourceMetadata & {
13108
13192
  cacheHint?: CacheHint;
13193
+ scopeChallenge?: ScopeChallengeHandler;
13109
13194
  }, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate;
13110
13195
  private _createRegisteredResource;
13111
13196
  private _createRegisteredResourceTemplate;
@@ -13144,6 +13229,8 @@ declare class McpServer {
13144
13229
  outputSchema?: OutputArgs;
13145
13230
  annotations?: ToolAnnotations;
13146
13231
  icons?: Icon[];
13232
+ /** Determines whether this tool call needs an OAuth scope challenge. */
13233
+ scopeChallenge?: ScopeChallengeHandler;
13147
13234
  _meta?: Record<string, unknown>;
13148
13235
  }, cb: ToolCallback<InputArgs>): RegisteredTool;
13149
13236
  /** @deprecated Wrap with `z.object({...})` instead. Raw-shape form: `inputSchema`/`outputSchema` may be a plain `{ field: z.string() }` record; it is auto-wrapped with `z.object()`. */
@@ -13154,6 +13241,7 @@ declare class McpServer {
13154
13241
  outputSchema?: OutputArgs;
13155
13242
  annotations?: ToolAnnotations;
13156
13243
  icons?: Icon[];
13244
+ scopeChallenge?: ScopeChallengeHandler;
13157
13245
  _meta?: Record<string, unknown>;
13158
13246
  }, cb: LegacyToolCallback<InputArgs>): RegisteredTool;
13159
13247
  /**
@@ -13182,11 +13270,22 @@ declare class McpServer {
13182
13270
  * );
13183
13271
  * ```
13184
13272
  */
13273
+ registerPrompt(name: string, config: {
13274
+ title?: string;
13275
+ description?: string;
13276
+ argsSchema?: undefined;
13277
+ icons?: Icon[];
13278
+ /** Determines whether this prompt retrieval needs an OAuth scope challenge. */
13279
+ scopeChallenge?: ScopeChallengeHandler;
13280
+ _meta?: Record<string, unknown>;
13281
+ }, cb: PromptCallback): RegisteredPrompt;
13185
13282
  registerPrompt<Args extends StandardSchemaWithJSON>(name: string, config: {
13186
13283
  title?: string;
13187
13284
  description?: string;
13188
13285
  argsSchema?: Args;
13189
13286
  icons?: Icon[];
13287
+ /** Determines whether this prompt retrieval needs an OAuth scope challenge. */
13288
+ scopeChallenge?: ScopeChallengeHandler;
13190
13289
  _meta?: Record<string, unknown>;
13191
13290
  }, cb: PromptCallback<Args>): RegisteredPrompt;
13192
13291
  /** @deprecated Wrap with `z.object({...})` instead. Raw-shape form: `argsSchema` may be a plain `{ field: z.string() }` record; it is auto-wrapped with `z.object()`. */
@@ -13195,6 +13294,7 @@ declare class McpServer {
13195
13294
  description?: string;
13196
13295
  argsSchema?: Args;
13197
13296
  icons?: Icon[];
13297
+ scopeChallenge?: ScopeChallengeHandler;
13198
13298
  _meta?: Record<string, unknown>;
13199
13299
  }, cb: LegacyPromptCallback<Args>): RegisteredPrompt;
13200
13300
  /**
@@ -13305,7 +13405,7 @@ type RegisteredTool = {
13305
13405
  outputSchema?: StandardSchemaWithJSON;
13306
13406
  /**
13307
13407
  * @hidden
13308
- * The converted JSON Schema of `outputSchema`, memoised at registration (and on
13408
+ * The converted JSON Schema of `outputSchema`, memoised on first use (and on
13309
13409
  * `update({outputSchema})`) so the `tools/call` handler passes the SAME advertised schema
13310
13410
  * `tools/list` emits to the wire codec's `projectCallToolResult` — the SEP-2106 `{result:…}`
13311
13411
  * wrap predicate follows the schema's root, never the runtime value shape. `undefined` when
@@ -13315,6 +13415,7 @@ type RegisteredTool = {
13315
13415
  annotations?: ToolAnnotations;
13316
13416
  icons?: Icon[];
13317
13417
  execution?: ToolExecution;
13418
+ scopeChallenge?: ScopeChallengeHandler;
13318
13419
  _meta?: Record<string, unknown>;
13319
13420
  handler: AnyToolHandler<StandardSchemaWithJSON | undefined>;
13320
13421
  /** @hidden */
@@ -13330,6 +13431,7 @@ type RegisteredTool = {
13330
13431
  outputSchema?: StandardSchemaWithJSON;
13331
13432
  annotations?: ToolAnnotations;
13332
13433
  icons?: Icon[];
13434
+ scopeChallenge?: ScopeChallengeHandler | null;
13333
13435
  _meta?: Record<string, unknown>;
13334
13436
  callback?: ToolCallback<StandardSchemaWithJSON>;
13335
13437
  enabled?: boolean;
@@ -13354,6 +13456,7 @@ type RegisteredResource = {
13354
13456
  metadata?: ResourceMetadata;
13355
13457
  /** Cache hint applied to this resource's `resources/read` results on the 2026-07-28 revision. */
13356
13458
  cacheHint?: CacheHint;
13459
+ scopeChallenge?: ScopeChallengeHandler;
13357
13460
  readCallback: ReadResourceCallback;
13358
13461
  enabled: boolean;
13359
13462
  enable(): void;
@@ -13363,6 +13466,7 @@ type RegisteredResource = {
13363
13466
  title?: string;
13364
13467
  uri?: string | null;
13365
13468
  metadata?: ResourceMetadata;
13469
+ scopeChallenge?: ScopeChallengeHandler | null;
13366
13470
  callback?: ReadResourceCallback;
13367
13471
  enabled?: boolean;
13368
13472
  }): void;
@@ -13378,6 +13482,7 @@ type RegisteredResourceTemplate = {
13378
13482
  metadata?: ResourceMetadata;
13379
13483
  /** Cache hint applied to this template's `resources/read` results on the 2026-07-28 revision. */
13380
13484
  cacheHint?: CacheHint;
13485
+ scopeChallenge?: ScopeChallengeHandler;
13381
13486
  readCallback: ReadResourceTemplateCallback;
13382
13487
  enabled: boolean;
13383
13488
  enable(): void;
@@ -13387,6 +13492,7 @@ type RegisteredResourceTemplate = {
13387
13492
  title?: string;
13388
13493
  template?: ResourceTemplate;
13389
13494
  metadata?: ResourceMetadata;
13495
+ scopeChallenge?: ScopeChallengeHandler | null;
13390
13496
  callback?: ReadResourceTemplateCallback;
13391
13497
  enabled?: boolean;
13392
13498
  }): void;
@@ -13403,6 +13509,7 @@ type RegisteredPrompt = {
13403
13509
  description?: string;
13404
13510
  argsSchema?: StandardSchemaWithJSON;
13405
13511
  icons?: Icon[];
13512
+ scopeChallenge?: ScopeChallengeHandler;
13406
13513
  _meta?: Record<string, unknown>;
13407
13514
  /** @hidden */
13408
13515
  handler: PromptHandler;
@@ -13415,6 +13522,7 @@ type RegisteredPrompt = {
13415
13522
  description?: string;
13416
13523
  argsSchema?: Args;
13417
13524
  icons?: Icon[];
13525
+ scopeChallenge?: ScopeChallengeHandler | null;
13418
13526
  _meta?: Record<string, unknown>;
13419
13527
  callback?: PromptCallback<Args>;
13420
13528
  enabled?: boolean;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { C as chatKindOf, D as text, E as numeric, Et as VERSION, R as CommsError, T as kindOf, Tt as PACKAGE_NAME, _ as WhatsAppContext, d as composeDraft, g as visibilityUnitKey, h as statusAuthor, m as listKey, n as withCheckedCopy, p as Visibility, w as coreDataToIso, x as inspectSchema, y as rebuildIndex } from "./sync-Dx4QM1gQ.mjs";
2
- import { t as createWhatsAppMcpServer } from "./server-Du5WnAAo.mjs";
1
+ import { C as chatKindOf, D as text, E as numeric, Et as VERSION, R as CommsError, T as kindOf, Tt as PACKAGE_NAME, _ as WhatsAppContext, d as composeDraft, g as visibilityUnitKey, h as statusAuthor, m as listKey, n as withCheckedCopy, p as Visibility, w as coreDataToIso, x as inspectSchema, y as rebuildIndex } from "./sync-BMpRzu1W.mjs";
2
+ import { t as createWhatsAppMcpServer } from "./server-CIrWEJNB.mjs";
3
3
  //#region src/source/event-reader.ts
4
4
  function rawFromMe(value) {
5
5
  const number = numeric(value);