@fastagent-sh/fastagent 0.13.0 → 0.15.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 +5 -5
- package/dist/agent.d.ts +20 -0
- package/dist/agent.js +9 -0
- package/dist/channels/context-buffer.d.ts +30 -0
- package/dist/channels/context-buffer.js +98 -0
- package/dist/channels/control.d.ts +28 -0
- package/dist/channels/control.js +214 -0
- package/dist/channels/feishu/card.js +1 -1
- package/dist/channels/feishu/context-buffer.d.ts +43 -0
- package/dist/channels/feishu/context-buffer.js +72 -0
- package/dist/channels/feishu/crypto.d.ts +4 -2
- package/dist/channels/feishu/crypto.js +4 -2
- package/dist/channels/feishu/feishu-api.d.ts +15 -7
- package/dist/channels/feishu/feishu-api.js +22 -4
- package/dist/channels/feishu/feishu.d.ts +38 -16
- package/dist/channels/feishu/feishu.js +286 -151
- package/dist/channels/feishu/invoke-turn.d.ts +24 -31
- package/dist/channels/feishu/invoke-turn.js +61 -62
- package/dist/channels/feishu/model.d.ts +98 -0
- package/dist/channels/feishu/model.js +9 -0
- package/dist/channels/feishu/normalize.d.ts +23 -0
- package/dist/channels/feishu/normalize.js +132 -0
- package/dist/channels/feishu/owned-threads.d.ts +7 -0
- package/dist/channels/feishu/owned-threads.js +47 -0
- package/dist/channels/feishu/parse.d.ts +21 -103
- package/dist/channels/feishu/parse.js +35 -145
- package/dist/channels/feishu/preview.d.ts +4 -7
- package/dist/channels/feishu/preview.js +26 -142
- package/dist/channels/feishu/register-app.d.ts +2 -1
- package/dist/channels/feishu/register-webhook.d.ts +2 -1
- package/dist/channels/feishu/scaffold/channel.ts +10 -3
- package/dist/channels/feishu/setup-mode.d.ts +8 -0
- package/dist/channels/feishu/setup-mode.js +2 -0
- package/dist/channels/feishu/ws-ingress.d.ts +28 -0
- package/dist/channels/feishu/ws-ingress.js +136 -0
- package/dist/channels/github/github.js +8 -6
- package/dist/channels/http.d.ts +14 -0
- package/dist/channels/http.js +35 -2
- package/dist/channels/invoke-turn-kit.d.ts +65 -0
- package/dist/channels/invoke-turn-kit.js +87 -0
- package/dist/channels/lark/lark.d.ts +4 -2
- package/dist/channels/lark/lark.js +4 -1
- package/dist/channels/lark/onboard.d.ts +8 -4
- package/dist/channels/lark/onboard.js +8 -0
- package/dist/channels/lark/scaffold/channel.ts +10 -3
- package/dist/channels/preview-kit.d.ts +109 -0
- package/dist/channels/preview-kit.js +183 -0
- package/dist/channels/seen.d.ts +5 -0
- package/dist/channels/seen.js +35 -0
- package/dist/channels/slack/bot-auth.d.ts +15 -0
- package/dist/channels/slack/bot-auth.js +146 -0
- package/dist/channels/slack/config-api.d.ts +60 -0
- package/dist/channels/slack/config-api.js +149 -0
- package/dist/channels/slack/context-buffer.d.ts +24 -0
- package/dist/channels/slack/context-buffer.js +37 -0
- package/dist/channels/slack/invoke-turn.d.ts +19 -0
- package/dist/channels/slack/invoke-turn.js +63 -0
- package/dist/channels/slack/manifest.d.ts +49 -0
- package/dist/channels/slack/manifest.js +69 -0
- package/dist/channels/slack/model.d.ts +67 -0
- package/dist/channels/slack/model.js +2 -0
- package/dist/channels/slack/onboard.d.ts +41 -0
- package/dist/channels/slack/onboard.js +120 -0
- package/dist/channels/slack/onboarding-state.d.ts +31 -0
- package/dist/channels/slack/onboarding-state.js +69 -0
- package/dist/channels/slack/owned-threads.d.ts +6 -0
- package/dist/channels/slack/owned-threads.js +43 -0
- package/dist/channels/slack/parse.d.ts +23 -0
- package/dist/channels/slack/parse.js +81 -0
- package/dist/channels/slack/preview.d.ts +24 -0
- package/dist/channels/slack/preview.js +359 -0
- package/dist/channels/slack/reaction.d.ts +24 -0
- package/dist/channels/slack/reaction.js +62 -0
- package/dist/channels/slack/register-webhook.d.ts +10 -0
- package/dist/channels/slack/register-webhook.js +49 -0
- package/dist/channels/slack/scaffold/channel.ts +33 -0
- package/dist/channels/slack/scaffold/slack-send.ts +171 -0
- package/dist/channels/slack/setup-server.d.ts +17 -0
- package/dist/channels/slack/setup-server.js +103 -0
- package/dist/channels/slack/slack-api.d.ts +77 -0
- package/dist/channels/slack/slack-api.js +415 -0
- package/dist/channels/slack/slack.d.ts +58 -0
- package/dist/channels/slack/slack.js +451 -0
- package/dist/channels/slack/welcomed.d.ts +5 -0
- package/dist/channels/slack/welcomed.js +32 -0
- package/dist/channels/state.js +3 -3
- package/dist/channels/stop-command.d.ts +6 -0
- package/dist/channels/stop-command.js +36 -0
- package/dist/channels/tasks.d.ts +13 -0
- package/dist/channels/tasks.js +10 -0
- package/dist/channels/telegram/context-buffer.d.ts +8 -17
- package/dist/channels/telegram/context-buffer.js +6 -85
- package/dist/channels/telegram/invoke-turn.d.ts +5 -22
- package/dist/channels/telegram/invoke-turn.js +11 -58
- package/dist/channels/telegram/preview.d.ts +4 -7
- package/dist/channels/telegram/preview.js +24 -142
- package/dist/channels/telegram/telegram.js +23 -9
- package/dist/channels/{feishu/text.d.ts → text.d.ts} +1 -1
- package/dist/channels/{feishu/text.js → text.js} +1 -1
- package/dist/channels/turn-queue.js +1 -1
- package/dist/channels/turn-store.d.ts +1 -1
- package/dist/channels/turn-store.js +2 -3
- package/dist/cli/add-feishu.d.ts +27 -0
- package/dist/{cli-add-feishu.js → cli/add-feishu.js} +167 -44
- package/dist/cli/add-slack.d.ts +10 -0
- package/dist/cli/add-slack.js +204 -0
- package/dist/{cli-auth.d.ts → cli/auth-view.d.ts} +1 -1
- package/dist/{cli-auth.js → cli/auth-view.js} +1 -1
- package/dist/cli/commands/add.d.ts +13 -0
- package/dist/cli/commands/add.js +274 -0
- package/dist/cli/commands/attach.d.ts +82 -0
- package/dist/cli/commands/attach.js +559 -0
- package/dist/cli/commands/chat.d.ts +4 -0
- package/dist/cli/commands/chat.js +21 -0
- package/dist/cli/commands/deploy.d.ts +15 -0
- package/dist/cli/commands/deploy.js +394 -0
- package/dist/cli/commands/dev.d.ts +11 -0
- package/dist/cli/commands/dev.js +82 -0
- package/dist/cli/commands/fire.d.ts +7 -0
- package/dist/cli/commands/fire.js +45 -0
- package/dist/cli/commands/info.d.ts +7 -0
- package/dist/cli/commands/info.js +108 -0
- package/dist/cli/commands/init.d.ts +8 -0
- package/dist/cli/commands/init.js +81 -0
- package/dist/cli/commands/invoke.d.ts +7 -0
- package/dist/cli/commands/invoke.js +28 -0
- package/dist/cli/commands/login.d.ts +6 -0
- package/dist/cli/commands/login.js +52 -0
- package/dist/cli/commands/models.d.ts +1 -0
- package/dist/cli/commands/models.js +15 -0
- package/dist/cli/commands/schedule.d.ts +12 -0
- package/dist/cli/commands/schedule.js +89 -0
- package/dist/cli/commands/start.d.ts +10 -0
- package/dist/cli/commands/start.js +97 -0
- package/dist/cli/commands/tool.d.ts +1 -0
- package/dist/cli/commands/tool.js +38 -0
- package/dist/cli/fail.d.ts +17 -0
- package/dist/cli/fail.js +32 -0
- package/dist/{invoke-stream.d.ts → cli/invoke-stream.d.ts} +1 -1
- package/dist/{invoke-stream.js → cli/invoke-stream.js} +4 -0
- package/dist/cli/kernel.d.ts +90 -0
- package/dist/cli/kernel.js +190 -0
- package/dist/cli/models-view.d.ts +21 -0
- package/dist/cli/models-view.js +66 -0
- package/dist/cli/program.d.ts +11 -0
- package/dist/cli/program.js +479 -0
- package/dist/cli/serve.d.ts +48 -0
- package/dist/cli/serve.js +248 -0
- package/dist/cli/shared.d.ts +44 -0
- package/dist/cli/shared.js +246 -0
- package/dist/cli.js +8 -1329
- package/dist/collect.d.ts +14 -3
- package/dist/collect.js +24 -0
- package/dist/core.d.ts +3 -1
- package/dist/core.js +2 -0
- package/dist/deploy/docker/plan.d.ts +45 -0
- package/dist/deploy/docker/plan.js +141 -0
- package/dist/deploy/docker/run.d.ts +40 -0
- package/dist/deploy/docker/run.js +126 -0
- package/dist/deploy/fly/plan.d.ts +3 -1
- package/dist/deploy/fly/plan.js +12 -7
- package/dist/deploy/fly/run.d.ts +5 -4
- package/dist/deploy/fly/run.js +16 -5
- package/dist/deploy/preflight.d.ts +10 -4
- package/dist/deploy/preflight.js +57 -12
- package/dist/deploy/railway/plan.d.ts +3 -1
- package/dist/deploy/railway/plan.js +12 -4
- package/dist/deploy/railway/run.d.ts +5 -4
- package/dist/deploy/railway/run.js +15 -5
- package/dist/deploy/runner.d.ts +6 -2
- package/dist/deploy/runner.js +1 -0
- package/dist/deploy/secrets.d.ts +2 -1
- package/dist/deploy/secrets.js +23 -3
- package/dist/dev-supervisor.d.ts +0 -2
- package/dist/dev-supervisor.js +7 -3
- package/dist/engines/pi/auth.js +160 -46
- package/dist/engines/pi/channel.d.ts +22 -16
- package/dist/engines/pi/channel.js +90 -60
- package/dist/engines/pi/chat.d.ts +4 -16
- package/dist/engines/pi/chat.js +8 -188
- package/dist/engines/pi/config.d.ts +23 -9
- package/dist/engines/pi/config.js +35 -5
- package/dist/engines/pi/create.d.ts +36 -7
- package/dist/engines/pi/create.js +63 -22
- package/dist/engines/pi/harness.d.ts +65 -1
- package/dist/engines/pi/harness.js +166 -2
- package/dist/engines/pi/invoke.d.ts +56 -3
- package/dist/engines/pi/invoke.js +340 -20
- package/dist/engines/pi/login.d.ts +11 -0
- package/dist/engines/pi/login.js +17 -5
- package/dist/engines/pi/models.d.ts +56 -10
- package/dist/engines/pi/models.js +61 -23
- package/dist/engines/pi/search-tools.d.ts +10 -0
- package/dist/engines/pi/search-tools.js +138 -0
- package/dist/engines/pi/session-builder.d.ts +16 -0
- package/dist/engines/pi/session-builder.js +308 -0
- package/dist/engines/pi/session-control.d.ts +50 -0
- package/dist/engines/pi/session-control.js +604 -0
- package/dist/engines/pi/sessions.d.ts +17 -2
- package/dist/engines/pi/sessions.js +9 -0
- package/dist/engines/pi/tool-context.d.ts +46 -11
- package/dist/engines/pi/tool-context.js +11 -9
- package/dist/engines/pi/tool.d.ts +35 -6
- package/dist/engines/pi/tool.js +47 -1
- package/dist/engines/pi/wake-tool.d.ts +0 -3
- package/dist/engines/pi/wake-tool.js +9 -7
- package/dist/engines/pi/workspace.d.ts +56 -1
- package/dist/engines/pi/workspace.js +75 -16
- package/dist/feishu.d.ts +1 -1
- package/dist/feishu.js +1 -1
- package/dist/host/node.d.ts +23 -6
- package/dist/host/node.js +5 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lark.d.ts +1 -1
- package/dist/lark.js +1 -1
- package/dist/observe.js +3 -0
- package/dist/pi.d.ts +6 -4
- package/dist/pi.js +2 -1
- package/dist/scaffold/add-channel.d.ts +19 -6
- package/dist/scaffold/add-channel.js +127 -16
- package/dist/scaffold/templates/fastagent.config.mjs +5 -3
- package/dist/schedule/wakeups.d.ts +0 -3
- package/dist/schedule/wakeups.js +1 -1
- package/dist/session-remote.d.ts +53 -0
- package/dist/session-remote.js +336 -0
- package/dist/session.d.ts +265 -0
- package/dist/session.js +37 -0
- package/dist/slack.d.ts +2 -0
- package/dist/slack.js +2 -0
- package/dist/tunnel.d.ts +7 -4
- package/dist/tunnel.js +21 -10
- package/package.json +22 -7
- package/dist/channels/feishu/seen.d.ts +0 -5
- package/dist/channels/feishu/seen.js +0 -47
- package/dist/cli-add-feishu.d.ts +0 -8
- package/dist/cli-models.d.ts +0 -11
- package/dist/cli-models.js +0 -20
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImageRef } from "../../agent.ts";
|
|
2
2
|
import type { FeishuCloudKind } from "./cloud.ts";
|
|
3
|
-
/** Where a reply goes: a chat, optionally quote-replying a message
|
|
3
|
+
/** Where a reply goes: a chat, optionally quote-replying a message inside a platform thread. */
|
|
4
4
|
export interface FeishuTarget {
|
|
5
5
|
chatId: string;
|
|
6
6
|
/** Message to reply to (the summoning message). Set in groups so the answer threads under the asker. */
|
|
@@ -34,6 +34,11 @@ export interface FeishuApiOptions {
|
|
|
34
34
|
appId: string;
|
|
35
35
|
appSecret: string;
|
|
36
36
|
}
|
|
37
|
+
export interface FeishuAppScope {
|
|
38
|
+
name: string;
|
|
39
|
+
grantStatus: number;
|
|
40
|
+
type?: "user" | "tenant";
|
|
41
|
+
}
|
|
37
42
|
/**
|
|
38
43
|
* The Feishu Open API client: one instance per channel, holding the token cache. Every method rides the
|
|
39
44
|
* single pipeline (module header). Throws {@link FeishuApiError} on any failure.
|
|
@@ -49,12 +54,12 @@ export interface FeishuApi {
|
|
|
49
54
|
}>;
|
|
50
55
|
/** Send a message to a chat; returns the new message_id (undefined if the body carried none). */
|
|
51
56
|
sendMessage(chatId: string, msgType: string, content: string): Promise<string | undefined>;
|
|
52
|
-
/** Reply to a message
|
|
57
|
+
/** Reply to a message; `replyInThread` creates or continues its platform thread. */
|
|
53
58
|
replyMessage(messageId: string, msgType: string, content: string, opts?: {
|
|
54
59
|
replyInThread?: boolean;
|
|
55
60
|
}): Promise<string | undefined>;
|
|
56
|
-
/** Send `text`, split at the platform's size cap: ordinary groups quote only the first chunk;
|
|
57
|
-
*
|
|
61
|
+
/** Send `text`, split at the platform's size cap: ordinary groups quote only the first chunk;
|
|
62
|
+
* threaded targets use reply_in_thread on every chunk. Returns the FIRST message_id. */
|
|
58
63
|
sendText(target: FeishuTarget, text: string): Promise<string | undefined>;
|
|
59
64
|
/** Edit a sent text message in place (PUT; the platform caps edits at 20 per message). */
|
|
60
65
|
editTextMessage(messageId: string, text: string): Promise<void>;
|
|
@@ -85,6 +90,12 @@ export interface FeishuApi {
|
|
|
85
90
|
verificationToken?: string;
|
|
86
91
|
encryptionKey?: string;
|
|
87
92
|
}>;
|
|
93
|
+
/** List the app's scopes and grant state. Used by onboarding/runtime to make group visibility
|
|
94
|
+
* explicit instead of silently assuming unmentioned group events are delivered. */
|
|
95
|
+
listAppScopes(): Promise<FeishuAppScope[]>;
|
|
96
|
+
/** Add tenant scopes to the app draft through application-v7 config. Approval + version publishing
|
|
97
|
+
* remain console actions; this method only removes the error-prone manual draft edit. */
|
|
98
|
+
addAppScopes(appId: string, scopeNames: string[]): Promise<void>;
|
|
88
99
|
/** Update the app's own event subscription (application-v7 config PATCH — tenant token can only
|
|
89
100
|
* operate on itself; the request-URL change takes effect immediately, no version publish). The
|
|
90
101
|
* platform VERIFIES `requestUrl` with a url_verification challenge during this call, so the server
|
|
@@ -100,9 +111,6 @@ export interface FeishuApi {
|
|
|
100
111
|
/** Replace a card entity's content (the settle write; also flips streaming_mode off via the JSON). */
|
|
101
112
|
updateCard(cardId: string, cardJson: string, sequence: number): Promise<void>;
|
|
102
113
|
}
|
|
103
|
-
/** The platform caps a text-message request body at 150 KB; stay well under it (the content is a JSON
|
|
104
|
-
* envelope around the text, and multi-byte characters inflate the byte count). */
|
|
105
|
-
export declare const FEISHU_MAX_TEXT_BYTES: number;
|
|
106
114
|
/** Split text into chunks whose UTF-8 size fits the message cap, preferring a newline boundary. */
|
|
107
115
|
export declare function chunkFeishuText(text: string, maxBytes?: number): string[];
|
|
108
116
|
export declare function createFeishuApi(opts: FeishuApiOptions): FeishuApi;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
23
23
|
import { join } from "node:path";
|
|
24
|
-
import { utf8Prefix } from "
|
|
24
|
+
import { utf8Prefix } from "../text.js";
|
|
25
25
|
/** Per-attempt timeout for a JSON API call — small JSON round-trips, so 30s is generous. */
|
|
26
26
|
const API_TIMEOUT_MS = 30_000;
|
|
27
27
|
/** Timeout for downloading resource bytes — sized for a slow link, not a JSON call. */
|
|
@@ -79,7 +79,7 @@ export function isTransientFeishuRegistrationError(e) {
|
|
|
79
79
|
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
80
80
|
/** The platform caps a text-message request body at 150 KB; stay well under it (the content is a JSON
|
|
81
81
|
* envelope around the text, and multi-byte characters inflate the byte count). */
|
|
82
|
-
|
|
82
|
+
const FEISHU_MAX_TEXT_BYTES = 100 * 1024;
|
|
83
83
|
/** Split text into chunks whose UTF-8 size fits the message cap, preferring a newline boundary. */
|
|
84
84
|
export function chunkFeishuText(text, maxBytes = FEISHU_MAX_TEXT_BYTES) {
|
|
85
85
|
if (!Number.isSafeInteger(maxBytes) || maxBytes <= 0)
|
|
@@ -212,8 +212,8 @@ export function createFeishuApi(opts) {
|
|
|
212
212
|
let first = true;
|
|
213
213
|
for (const chunk of chunks) {
|
|
214
214
|
const content = JSON.stringify({ text: chunk });
|
|
215
|
-
// A normal group quote-replies only the first chunk — N reply-quotes would be noise. A
|
|
216
|
-
// must reply_in_thread on EVERY chunk; a plain chat send would leak continuations to
|
|
215
|
+
// A normal group quote-replies only the first chunk — N reply-quotes would be noise. A thread
|
|
216
|
+
// must reply_in_thread on EVERY chunk; a plain chat send would leak continuations to main chat.
|
|
217
217
|
const reply = target.replyTo !== undefined && (first || target.replyInThread === true);
|
|
218
218
|
const id = reply
|
|
219
219
|
? await api.replyMessage(target.replyTo, "text", content, {
|
|
@@ -296,6 +296,24 @@ export function createFeishuApi(opts) {
|
|
|
296
296
|
encryptionKey: data.data?.app?.encryption?.encryption_key,
|
|
297
297
|
};
|
|
298
298
|
},
|
|
299
|
+
async listAppScopes() {
|
|
300
|
+
const data = await call("listAppScopes", "GET", "/open-apis/application/v6/scopes");
|
|
301
|
+
return (data.data?.scopes ?? []).flatMap((scope) => {
|
|
302
|
+
if (typeof scope.scope_name !== "string" || typeof scope.grant_status !== "number")
|
|
303
|
+
return [];
|
|
304
|
+
const type = scope.scope_type === "user" || scope.scope_type === "tenant" ? scope.scope_type : undefined;
|
|
305
|
+
return [{ name: scope.scope_name, grantStatus: scope.grant_status, type }];
|
|
306
|
+
});
|
|
307
|
+
},
|
|
308
|
+
async addAppScopes(appId, scopeNames) {
|
|
309
|
+
if (scopeNames.length === 0)
|
|
310
|
+
return;
|
|
311
|
+
await call("addAppScopes", "PATCH", `/open-apis/application/v7/applications/${encodeURIComponent(appId)}/config`, {
|
|
312
|
+
scope: {
|
|
313
|
+
add_scopes: scopeNames.map((scopeName) => ({ scope_name: scopeName, token_type: "tenant" })),
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
},
|
|
299
317
|
async updateEventSubscription(appId, cfg) {
|
|
300
318
|
await call("updateEventSubscription", "PATCH", `/open-apis/application/v7/applications/${encodeURIComponent(appId)}/config`, {
|
|
301
319
|
event: { subscription_type: cfg.subscriptionType, request_url: cfg.requestUrl },
|
|
@@ -1,36 +1,58 @@
|
|
|
1
|
-
import type { ChannelModule } from "../../host/node.ts";
|
|
1
|
+
import type { ChannelModule, LongConnectionChannelModule } from "../../host/node.ts";
|
|
2
2
|
import { type FeishuCloudProfile } from "./cloud.ts";
|
|
3
3
|
import { type FeishuMessage, type FeishuMessageEvent, type FeishuRoute, defaultFeishuRoute, feishuEnvelope } from "./parse.ts";
|
|
4
4
|
import { type FeishuFailure } from "./preview.ts";
|
|
5
|
+
import { connectFeishuWs } from "./ws-ingress.ts";
|
|
5
6
|
export { defaultFeishuRoute, feishuEnvelope };
|
|
6
7
|
export type { FeishuFailure, FeishuMessage, FeishuMessageEvent, FeishuRoute };
|
|
7
|
-
|
|
8
|
+
interface FeishuChannelBaseOptions {
|
|
8
9
|
/** App ID (developer console → Credentials & Basic Info). */
|
|
9
10
|
appId: string;
|
|
10
|
-
/** App Secret (same page) — drives
|
|
11
|
+
/** App Secret (same page) — drives both ingress authentication and outbound API calls. */
|
|
11
12
|
appSecret: string;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
|
|
13
|
+
/** Direct-message context + delivery policy. `threaded` (default) gives every top-level p2p message
|
|
14
|
+
* its own session, creates a platform thread for the answer, and routes later thread messages back
|
|
15
|
+
* by root message id. `continuous` keeps one session per p2p chat and sends ordinary unquoted replies. */
|
|
16
|
+
directMessageSession?: "continuous" | "threaded";
|
|
17
|
+
/** Group-message context + delivery policy. `threaded` (default) gives every top-level summoned
|
|
18
|
+
* message its own session and platform thread; later bare user messages in that managed thread answer
|
|
19
|
+
* in the same root session, while @other-only discussion buffers. `continuous` preserves the legacy
|
|
20
|
+
* chat/topic sessions (`chat_id` / `chat_id:thread_id`). Buffering and bare continuations require
|
|
21
|
+
* `im:message.group_msg`. */
|
|
22
|
+
groupMessageSession?: "continuous" | "threaded";
|
|
20
23
|
/** Policy: whether/where to answer an event (return null to ignore). Defaults to {@link defaultFeishuRoute}. */
|
|
21
24
|
route?: (event: FeishuMessageEvent) => FeishuRoute | null;
|
|
22
25
|
/** Customer-facing failure text for the chat (the dev-facing full `details` always go to the operator
|
|
23
26
|
* log). Return a string to send it, or undefined/"" to stay silent. Default: a neutral message keyed
|
|
24
27
|
* on `retryable`. A developer's own bot can surface the raw details, e.g. `(f) => `⚠️ ${f.details}``. */
|
|
25
28
|
onError?: (failed: FeishuFailure) => string | undefined;
|
|
26
|
-
/** API origin override (tests / self-hosted gateways).
|
|
27
|
-
* `
|
|
29
|
+
/** API origin override (tests / self-hosted gateways). Feishu factories default to
|
|
30
|
+
* `https://open.feishu.cn`; Lark factories default to `https://open.larksuite.com`. Named to match
|
|
31
|
+
* the other channels (telegram/slack). */
|
|
32
|
+
apiBaseUrl?: string;
|
|
33
|
+
/** @deprecated Alias of {@link apiBaseUrl}; kept for existing feishu/lark channel files. */
|
|
28
34
|
baseUrl?: string;
|
|
29
35
|
/** How long (ms) a turn waits before its reply-quoted "⏳ Queued" card mounts. Defaults to 0
|
|
30
36
|
* (immediate); the same card is later taken over by the live preview/final answer. */
|
|
31
37
|
queueNoticeDelayMs?: number;
|
|
32
38
|
}
|
|
33
|
-
|
|
39
|
+
export interface FeishuChannelOptions extends FeishuChannelBaseOptions {
|
|
40
|
+
/** Verification Token for Request-URL authentication. */
|
|
41
|
+
verificationToken: string;
|
|
42
|
+
/** Optional webhook Encrypt Key. When set, plaintext events are rejected. */
|
|
43
|
+
encryptKey?: string;
|
|
44
|
+
}
|
|
45
|
+
export type FeishuWebSocketChannelOptions = FeishuChannelBaseOptions & {
|
|
46
|
+
verificationToken?: never;
|
|
47
|
+
encryptKey?: never;
|
|
48
|
+
};
|
|
49
|
+
/** Build the canonical Feishu Request-URL webhook channel. */
|
|
34
50
|
export declare function feishuChannel(opts: FeishuChannelOptions): ChannelModule;
|
|
35
|
-
/**
|
|
36
|
-
export declare function
|
|
51
|
+
/** Build the canonical Feishu WebSocket long-connection channel. */
|
|
52
|
+
export declare function feishuWebSocketChannel(opts: FeishuWebSocketChannelOptions): LongConnectionChannelModule;
|
|
53
|
+
/** Internal compatibility seams: protocol behavior comes from Feishu; the profile binds cloud edges. */
|
|
54
|
+
interface FeishuWebSocketChannelDeps {
|
|
55
|
+
connectWs?: typeof connectFeishuWs;
|
|
56
|
+
}
|
|
57
|
+
export declare function buildFeishuChannel(profile: FeishuCloudProfile, opts: FeishuChannelOptions, factoryName: string): ChannelModule;
|
|
58
|
+
export declare function buildFeishuWebSocketChannel(profile: FeishuCloudProfile, opts: FeishuWebSocketChannelOptions, factoryName: string, deps?: FeishuWebSocketChannelDeps): LongConnectionChannelModule;
|