/** * DingTalk channel for DeepSeek Harness — two modes: * * 1. Webhook push (one-way): the DingTalk group custom robot (群自定义机器人) * webhook can send text / markdown / @mention messages into a group. This * exposes a push service (`ctx.dingtalk`) for task progress, results and * alerts. * 2. Stream mode (bidirectional, zero dependencies): with `stream.clientId` * / `stream.clientSecret` set, a STOMP-over-WebSocket adapter is * registered into `dsh-connect`, so group @-mentions / DMs trigger the * agent and replies stream back. Menus are numbered text lists (the user * answers with a number); proactive pushes still use the webhook service. * * @module dsh-connect/dingtalk */ import { Service, type Context } from "@deepseek-ai/cordis"; import z from "@deepseek-ai/schemastery"; import { type DingtalkAt } from "./webhook.js"; import { type DingtalkStreamAdapterConfig } from "./adapter.js"; export { DingtalkWebhook, signDingtalk, verifyDingtalkSignature } from "./webhook.js"; export type { DingtalkAt, DingtalkBody, DingtalkResponse, DingtalkWebhookConfig } from "./webhook.js"; export { dingtalkMessages } from "./i18n.js"; export type { DingtalkMessages } from "./i18n.js"; export { DingtalkStreamAdapter } from "./adapter.js"; export type { DingtalkStreamAdapterConfig } from "./adapter.js"; export { DingtalkStreamClient, DEFAULT_STREAM_URL } from "./stream.js"; export { encodeFrame, decodeFrames, escapeHeader, unescapeHeader } from "./stomp.js"; export type { StompFrame } from "./stomp.js"; export { buildConnectBody, buildMarkdownReplyBody, buildTextReplyBody, isAtMentioned, normalizeBotMessage, INBOUND_DESTINATION, REPLY_DESTINATION, } from "./message.js"; export type { DingtalkBotMessage } from "./message.js"; /** Plugin config; secrets may come from config or the DINGTALK_* environment. */ export declare const Config: z; secret: z; language: z<"zh" | "en", "zh" | "en", "plain">; /** Optional default @-mentions for every push (mobiles / user ids / all). */ defaultAt: z; userIds: z; all: z; }>>, Schemastery.ObjectT; userIds: z; all: z; }>>, "plain">; /** Stream mode (bidirectional): the DingTalk app's Client ID / Client Secret. */ stream: z; clientSecret: z; url: z; requireMention: z; }>>, Schemastery.ObjectT; clientSecret: z; url: z; requireMention: z; }>>, "plain">; /** Access control for *this* channel; see the Feishu adapter's note on channel-specific ids. */ allowUsers: z; allowChats: z; }>>, Schemastery.ObjectT; secret: z; language: z<"zh" | "en", "zh" | "en", "plain">; /** Optional default @-mentions for every push (mobiles / user ids / all). */ defaultAt: z; userIds: z; all: z; }>>, Schemastery.ObjectT; userIds: z; all: z; }>>, "plain">; /** Stream mode (bidirectional): the DingTalk app's Client ID / Client Secret. */ stream: z; clientSecret: z; url: z; requireMention: z; }>>, Schemastery.ObjectT; clientSecret: z; url: z; requireMention: z; }>>, "plain">; /** Access control for *this* channel; see the Feishu adapter's note on channel-specific ids. */ allowUsers: z; allowChats: z; }>>, "plain">; export interface DingtalkConfig { webhookUrl?: string; secret?: string; language?: "zh" | "en"; defaultAt?: Partial; /** Stream mode (bidirectional) credentials; secrets also via DINGTALK_STREAM_CLIENT_ID / _SECRET. */ stream?: Partial; } /** * The push service exposed on the Cordis context. Other plugins can inject * `dingtalk` and call `sendMarkdown` / `sendText` to deliver into the group. */ export declare class DingtalkService extends Service { private readonly webhook; private readonly t; readonly defaultAt?: Partial; constructor(ctx: Context, config: DingtalkConfig, logger?: { warn?: (...args: unknown[]) => void; }); /** Push a markdown card into the DingTalk group. */ sendMarkdown(title: string, text: string, at?: DingtalkAt): Promise; /** Push plain text into the DingTalk group. */ sendText(content: string, at?: DingtalkAt): Promise; } interface ConnectLike { registerAdapter(adapter: unknown): void; } /** * Register and start the DingTalk channel. `connect` may be undefined: when the * stream credentials are absent, or when `connect` is not provided, DingTalk * degrades to one-way webhook push (`ctx.dingtalk`). The webhook service is * always constructed. `connect` is the already-constructed `ConnectService` * instance (passed from the merged entry, not resolved via `ctx.get`). */ export declare function register(connect: ConnectLike | undefined, config: (DingtalkConfig | null) | undefined, ctx: Context): void; /** * Compatibility shell for the old split-plugin registration path (when `connect` * is an already-active, separate plugin). The merged entry calls `register` * directly instead, because `ctx.get("connect")` returns undefined inside this * plugin's own `apply`. */ export declare function apply(ctx: Context, config?: DingtalkConfig | null): void; //# sourceMappingURL=index.d.ts.map