zaileys 4.15.1 → 4.17.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/README.md CHANGED
@@ -118,20 +118,22 @@ Pick your provider → **[Choose Your Provider](https://zaileys.kejaa.id/provide
118
118
 
119
119
  ## Build with AI
120
120
 
121
- Zaileys ships an **official Agent Skill suite** so your AI assistant writes, reviews, and
122
- debugs zaileys code with best practices — it knows the exact API, common pitfalls, and how
123
- to fix errors. Install it straight from this repo:
121
+ Zaileys ships an **official Agent Skill**, `zaileys`, so your AI assistant builds, extends, debugs, reviews,
122
+ upgrades, and deploys zaileys bots with the real API instead of guessing. It covers both providers, includes
123
+ runnable templates and a read-only project doctor, and is checked against the source on every change.
124
+ Install it straight from this repo:
124
125
 
125
126
  ```bash
126
- # Claude Code (native plugin — supports auto-update)
127
+ # Claude Code plugin
127
128
  /plugin marketplace add zeative/zaileys
128
129
  /plugin install zaileys-official@zeative
129
130
 
130
- # npx skills (multi-agent: Claude Code, Codex, Cursor, OpenCode)
131
+ # npx skills (Claude Code, Codex, Cursor, OpenCode, and more)
131
132
  npx skills add zeative/zaileys # add -g for a global install
132
133
  ```
133
134
 
134
- The suite has an orchestrator that auto-routes plus focused scaffold, debug, and review skills. See the full guide → **[zaileys.kejaa.id/ai](https://zaileys.kejaa.id/ai)**.
135
+ Upgrading from the four earlier skills (`zaileys-assist`, `-scaffold`, `-debug`, `-review`)? See
136
+ **[zaileys.kejaa.id/ai](https://zaileys.kejaa.id/ai#upgrade-from-the-four-skills)**.
135
137
 
136
138
  ## Why Zaileys
137
139
 
@@ -281,7 +283,7 @@ Package managers: **npm**, **pnpm**, **yarn**, and **bun** are all supported.
281
283
  - [Recipes](https://zaileys.kejaa.id/recipes/auto-reply) — complete bots you can copy
282
284
  - [Reference](https://zaileys.kejaa.id/reference/client) — every method, option, and event
283
285
  - [Feature matrix](https://zaileys.kejaa.id/feature-matrix) — what works on which provider
284
- - 🤖 [**Build with AI**](https://zaileys.kejaa.id/ai) — official Claude Code / `npx skills` skill
286
+ - 🤖 [**Build with AI**](https://zaileys.kejaa.id/ai) — official agent skill for Claude Code, Codex, Cursor, and more
285
287
  - 📦 [**examples/**](./examples) — runnable bots: quickstart, interactive buttons, AIRich, storage adapters, broadcast
286
288
  - 🔀 [**MIGRATION.md**](./MIGRATION.md) — upgrading from v3.x to v4.0.0 (breaking changes, side-by-side snippets)
287
289
  - 🤝 [**CONTRIBUTING.md**](./CONTRIBUTING.md) — dev setup, tests, commit convention, release flow
@@ -3,6 +3,7 @@ import { type ButtonsContentOptions } from './content/buttons.js';
3
3
  import { type CarouselCard } from './content/carousel.js';
4
4
  import { type AIRichOptions } from './content/airich.js';
5
5
  import { type HtmlAppOptions } from './content/html-app.js';
6
+ import type { SafeHtml } from './html.js';
6
7
  import { type BuilderInternalState } from './state.js';
7
8
  import type { AlbumItem, AudioOptions, BuilderState, ButtonDef, DocumentOptions, EventOptions, GroupInviteOptions, GroupStatusOptions, GroupStatusRepostOptions, GroupStatusSource, ImageOptions, InteractiveButton, ListOptions, LocationOptions, MediaSource, PollOptions, ProductOptions, StickerOptions, TemplateOptions, VideoNoteOptions, VideoOptions } from './types.js';
8
9
  export interface BuilderSocketLike {
@@ -30,7 +31,8 @@ export declare class MessageBuilder<State extends BuilderState> {
30
31
  static create(socket: BuilderSocketLike, recipient: string, resolveRecipient?: (raw: string) => Promise<string>, recordSent?: (message: WAMessage) => void, inheritDisappearing?: (jid: string) => number | undefined): MessageBuilder<'init'>;
31
32
  to(this: MessageBuilder<'init'>, recipient: string): MessageBuilder<'init'>;
32
33
  text(this: MessageBuilder<'init'>, content: string, opts?: TextOptions): MessageBuilder<'content-set'>;
33
- htmlApp(this: MessageBuilder<'init'>, html: string, opts?: HtmlAppOptions): MessageBuilder<'content-set'>;
34
+ /** Sends an HTML page that runs inside the bubble on WhatsApp Android. Experimental WhatsApp format. */
35
+ htmlApp(this: MessageBuilder<'init'>, markup: string | SafeHtml, opts?: HtmlAppOptions): MessageBuilder<'content-set'>;
34
36
  image(this: MessageBuilder<'init'>, src: MediaSource, opts?: ImageOptions): MessageBuilder<'content-set'>;
35
37
  videoNote(this: MessageBuilder<'init'>, src: MediaSource, opts?: VideoNoteOptions): MessageBuilder<'content-set'>;
36
38
  video(this: MessageBuilder<'init'>, src: MediaSource, opts?: VideoOptions): MessageBuilder<'content-set'>;
@@ -77,10 +79,8 @@ export declare class MessageBuilder<State extends BuilderState> {
77
79
  private applyRelayMentions;
78
80
  private sendRelay;
79
81
  /**
80
- * Re-sends the card as an edit of itself. Without it the recipient gets WhatsApp's
81
- * "can't verify the security of this media" prompt and has to tap Download before the page renders.
82
- * The edit must sit inside `botForwardedMessage` like the original, otherwise it lands as its own
83
- * broken message instead of replacing the card.
82
+ * Re-sends the card as an edit of itself, which renders it without WhatsApp's download prompt. The edit
83
+ * must sit inside `botForwardedMessage` like the original, or it lands as its own broken message.
84
84
  */
85
85
  private relayIdenticalEdit;
86
86
  }
@@ -31,7 +31,6 @@ export type AIRichPart = {
31
31
  } | {
32
32
  type: 'html';
33
33
  html: string;
34
- trustedSources?: string[];
35
34
  height?: number;
36
35
  } | {
37
36
  type: 'suggest';
@@ -82,6 +81,6 @@ export type AIRichOptions = {
82
81
  footer?: string;
83
82
  sources?: Array<[profileUrl: string, url: string, text: string]>;
84
83
  };
85
- /** Android renders no other primitive; Web, Desktop and iOS map it to an empty section. */
84
+ /** Undocumented WhatsApp primitive; only Android renders it, and it runs with no network access. */
86
85
  export declare const AI_RICH_HTML_PRIMITIVE = "GenAIaeacdsnwHtmlPrimitive";
87
86
  export declare const buildAIRichContent: (parts: AIRichPart[], opts?: AIRichOptions) => AnyMessageContent;
@@ -1,26 +1,24 @@
1
1
  import type { AnyMessageContent } from 'baileys';
2
- export type HtmlAppDevice = 'android' | 'ios' | 'web' | 'desktop' | 'unknown';
3
- export type HtmlAppOptions = {
4
- /** From baileys' `getDevice(messageId)`. Anything but `android` takes the fallback. */
5
- device?: HtmlAppDevice;
6
- /** Where non-Android clients open the page instead. Required unless the device is android. */
7
- fallbackUrl?: string;
8
- fallbackButtonText?: string;
9
- /** Rendered above the card, and as the body of the fallback message. */
10
- text?: string;
11
- footer?: string;
12
- trustedSources?: string[];
13
- /** Pins the page height so the host stops re-measuring a bubble whose height follows its width. */
2
+ import { SafeHtml } from '../html.js';
3
+ /** Default byte ceiling for `htmlApp()` markup. */
4
+ export declare const HTML_APP_MAX_BYTES: number;
5
+ export interface HtmlAppOptions {
6
+ /** Small label shown above the card. Default: none. */
7
+ title?: string;
8
+ /** Pins the card height in CSS pixels (1–4096) so the bubble stops re-measuring. Default: the page's own height. */
14
9
  height?: number;
10
+ /** Recipient device, usually `ctx.senderDevice`; non-`'android'` sends `fallback` or throws. Default: Android. */
11
+ device?: string;
12
+ /** Plain text sent instead of the card when `device` is not Android. Default: none. */
13
+ fallback?: string;
14
+ /** Byte ceiling for the UTF-8 markup. Default 256 KB. */
15
+ maxBytes?: number;
15
16
  /**
16
- * Follows the card with an identical edit so it renders immediately instead of behind WhatsApp's
17
- * "can't verify the security of this media" prompt. Costs one extra relay and one re-render, so a
18
- * page running an animation restarts once. Defaults to on.
17
+ * Follow the card with an identical edit so it renders without WhatsApp's Download prompt. Costs one extra
18
+ * relay, and the card reloads whenever the recipient opens the keyboard. Default `true`; `false` for pages
19
+ * that keep state, such as games.
19
20
  */
20
21
  bypassDownload?: boolean;
21
- };
22
- /**
23
- * Only WhatsApp Android renders an inline HTML primitive. Every other client drops the section and
24
- * leaves an empty bubble, so they get a webview button to the same page instead.
25
- */
26
- export declare const buildHtmlAppContent: (html: string, opts?: HtmlAppOptions) => AnyMessageContent;
22
+ }
23
+ /** Builds an inline HTML card. WhatsApp renders it only on Android, with no network or storage access. */
24
+ export declare const buildHtmlAppContent: (markup: string | SafeHtml, opts?: HtmlAppOptions) => AnyMessageContent;
@@ -0,0 +1,14 @@
1
+ /** Markup that `html` inserts verbatim. Build it with `html`, `rawHtml` or `htmlJson`, never from user input. */
2
+ export declare class SafeHtml {
3
+ readonly value: string;
4
+ constructor(value: string);
5
+ toString(): string;
6
+ }
7
+ /** Escapes the characters that can open a tag or close an attribute. */
8
+ export declare const escapeHtml: (value: string) => string;
9
+ /** Marks trusted markup so `html` does not escape it. */
10
+ export declare const rawHtml: (markup: string) => SafeHtml;
11
+ /** Serialises a value for `<script>`, escaping the sequences that could close the tag early. */
12
+ export declare const htmlJson: (value: unknown) => SafeHtml;
13
+ /** Escapes interpolated values; `SafeHtml` and arrays of it pass through, `null`/`undefined`/`false` vanish. */
14
+ export declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => SafeHtml;
@@ -2,7 +2,7 @@ export * from './types.js';
2
2
  export * from './errors.js';
3
3
  export { MessageBuilder, type BuilderSocketLike, type TextOptions } from './builder.js';
4
4
  export { EditBuilder } from './edit-builder.js';
5
- export { buildHtmlAppContent, type HtmlAppDevice, type HtmlAppOptions, } from './content/html-app.js';
6
- export { AI_RICH_HTML_PRIMITIVE, type AIRichPart } from './content/airich.js';
5
+ export { HTML_APP_MAX_BYTES, type HtmlAppOptions } from './content/html-app.js';
6
+ export { SafeHtml, escapeHtml, html, htmlJson, rawHtml } from './html.js';
7
7
  export { deleteMessage, reactToMessage, forwardMessage, pinMessage, type DeleteOptions, type PinOptions, } from './mutations.js';
8
8
  export { isJid, resolveUsername, type UsernameResolveSocketLike, } from './username-resolve.js';