@excitedjs/feishu-channel 0.0.1
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 +29 -0
- package/dist/inbound.d.ts +54 -0
- package/dist/inbound.d.ts.map +1 -0
- package/dist/inbound.js +297 -0
- package/dist/inbound.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @excitedjs/feishu-channel
|
|
2
|
+
|
|
3
|
+
The **dreamux-side channel layer**: stateful orchestration on top of
|
|
4
|
+
[`@excitedjs/feishu-transport`](../feishu-transport).
|
|
5
|
+
|
|
6
|
+
> **Status: PR0 scaffold.** No business logic yet. See
|
|
7
|
+
> [issue #25](https://github.com/excitedjs/dreamux/issues/25).
|
|
8
|
+
|
|
9
|
+
## Scope (when filled in by later PRs)
|
|
10
|
+
|
|
11
|
+
- **① Filter** — @-mention gate (`isBotAddressed`) + access gate (allowlist),
|
|
12
|
+
orchestrating the core's pure `gate()`.
|
|
13
|
+
- **② Map + forward** — conversation→Codex-thread mapping (`conversationKey` →
|
|
14
|
+
thread) and forwarding inbound to the engine / outbound back to Feishu.
|
|
15
|
+
|
|
16
|
+
This is dreamux's counterpart of claudemux's proxy/daemon. The two are
|
|
17
|
+
symmetric but **never depend on each other** — both depend only on
|
|
18
|
+
`@excitedjs/feishu-transport`. The engine (`DispatcherRuntime`) stays in
|
|
19
|
+
`@excitedjs/dreamux` and implements this layer's `InboundSink` / `OutboundPort`
|
|
20
|
+
interfaces, so there is no dependency cycle.
|
|
21
|
+
|
|
22
|
+
## Build / test
|
|
23
|
+
|
|
24
|
+
Built via rush in topological order (core first):
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
node common/scripts/install-run-rush.js update
|
|
28
|
+
node common/scripts/install-run-rush.js build
|
|
29
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { FeishuMessageResourceFetcher, InboundResource, Mention } from '@excitedjs/feishu-transport';
|
|
2
|
+
export declare const FEISHU_SKILL_FALLBACK_NOTE = "Parser note: message text may be incomplete. Use the Feishu skill with the chat_id and message_id above to fetch the original message when needed.";
|
|
3
|
+
export type FeishuAttachmentReason = 'no_key' | 'missing_scope' | 'too_large' | 'timeout' | 'api_error' | 'unsupported_type' | 'cache_error';
|
|
4
|
+
export type FeishuAttachmentStatus = 'downloaded' | 'not_downloaded';
|
|
5
|
+
export interface FeishuChannelMessage {
|
|
6
|
+
messageId: string;
|
|
7
|
+
chatId: string;
|
|
8
|
+
chatType: string;
|
|
9
|
+
senderId: string;
|
|
10
|
+
senderType: string;
|
|
11
|
+
senderName: string;
|
|
12
|
+
messageType: string;
|
|
13
|
+
rawContent: string;
|
|
14
|
+
parsedText: string;
|
|
15
|
+
mentions: Mention[];
|
|
16
|
+
createTime: string;
|
|
17
|
+
resources?: InboundResource[];
|
|
18
|
+
}
|
|
19
|
+
export interface FeishuPeerBot {
|
|
20
|
+
openId: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface FormatFeishuMessageOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Trusted peer bots to surface once, as a `<group_bots>` block (issue #69).
|
|
26
|
+
* Injected only on the first delivered group message after an `/introduce`
|
|
27
|
+
* (or bot-added) so the model can map a bot open_id to a name. Trusted only.
|
|
28
|
+
*/
|
|
29
|
+
trustedBots?: FeishuPeerBot[];
|
|
30
|
+
/** Per-dispatcher cache directory owned by the host. Required for downloads. */
|
|
31
|
+
cacheDir?: string;
|
|
32
|
+
/** Raw Feishu resource fetcher from the transport boundary. */
|
|
33
|
+
resourceFetcher?: FeishuMessageResourceFetcher;
|
|
34
|
+
/** Defaults to 25 MiB per resource. */
|
|
35
|
+
maxBytes?: number;
|
|
36
|
+
/** Defaults to 20 seconds per resource. */
|
|
37
|
+
timeoutMs?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface FormattedFeishuAttachment {
|
|
40
|
+
type: 'file' | 'image';
|
|
41
|
+
name?: string;
|
|
42
|
+
key?: string;
|
|
43
|
+
path?: string;
|
|
44
|
+
status: FeishuAttachmentStatus;
|
|
45
|
+
reason?: FeishuAttachmentReason;
|
|
46
|
+
}
|
|
47
|
+
export interface FormatFeishuMessageResult {
|
|
48
|
+
formattedText: string;
|
|
49
|
+
attachments: FormattedFeishuAttachment[];
|
|
50
|
+
diagnostics: string[];
|
|
51
|
+
}
|
|
52
|
+
export declare function formatFeishuMessageForCodex(event: FeishuChannelMessage, options?: FormatFeishuMessageOptions): Promise<FormatFeishuMessageResult>;
|
|
53
|
+
export declare function formatFeishuCreateTime(value: string): string;
|
|
54
|
+
//# sourceMappingURL=inbound.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbound.d.ts","sourceRoot":"","sources":["../src/inbound.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,4BAA4B,EAC5B,eAAe,EACf,OAAO,EACR,MAAM,6BAA6B,CAAC;AAErC,eAAO,MAAM,0BAA0B,uJAC+G,CAAC;AAEvJ,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,eAAe,GACf,WAAW,GACX,SAAS,GACT,WAAW,GACX,kBAAkB,GAClB,aAAa,CAAC;AAElB,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAErE,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,4BAA4B,CAAC;IAC/C,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACjC;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,yBAAyB,EAAE,CAAC;IACzC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAKD,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,oBAAoB,EAC3B,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,yBAAyB,CAAC,CAmCpC;AAeD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB5D"}
|
package/dist/inbound.js
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { chmod, mkdir, rename, rm, stat, writeFile, } from 'node:fs/promises';
|
|
3
|
+
import { basename, resolve } from 'node:path';
|
|
4
|
+
export const FEISHU_SKILL_FALLBACK_NOTE = 'Parser note: message text may be incomplete. Use the Feishu skill with the chat_id and message_id above to fetch the original message when needed.';
|
|
5
|
+
const DEFAULT_MAX_RESOURCE_BYTES = 25 * 1024 * 1024;
|
|
6
|
+
const DEFAULT_RESOURCE_TIMEOUT_MS = 20_000;
|
|
7
|
+
export async function formatFeishuMessageForCodex(event, options = {}) {
|
|
8
|
+
const attachments = await resolveAttachments(event, options);
|
|
9
|
+
const attrs = [
|
|
10
|
+
['chat_id', event.chatId],
|
|
11
|
+
['chat_type', event.chatType],
|
|
12
|
+
['message_id', event.messageId],
|
|
13
|
+
['sender_id', event.senderId],
|
|
14
|
+
['sender_name', event.senderName],
|
|
15
|
+
['create_time', formatFeishuCreateTime(event.createTime)],
|
|
16
|
+
];
|
|
17
|
+
const body = renderMessageBody(event);
|
|
18
|
+
const fallback = shouldAddFallbackNote(event)
|
|
19
|
+
? `\n\n${FEISHU_SKILL_FALLBACK_NOTE}`
|
|
20
|
+
: '';
|
|
21
|
+
const attachmentBlock = renderAttachments(event.messageId, attachments);
|
|
22
|
+
const groupBots = renderGroupBots(options.trustedBots ?? []);
|
|
23
|
+
const attrLines = attrs.map(([key, value]) => ` ${key}="${escapeXmlAttribute(value)}"`);
|
|
24
|
+
attrLines[attrLines.length - 1] = `${attrLines[attrLines.length - 1]}>`;
|
|
25
|
+
return {
|
|
26
|
+
formattedText: [
|
|
27
|
+
'<feishu_message',
|
|
28
|
+
...attrLines,
|
|
29
|
+
`${body}${fallback}${attachmentBlock}${groupBots}`,
|
|
30
|
+
'</feishu_message>',
|
|
31
|
+
].join('\n'),
|
|
32
|
+
attachments,
|
|
33
|
+
diagnostics: attachments
|
|
34
|
+
.filter((attachment) => attachment.status === 'not_downloaded')
|
|
35
|
+
.map((attachment) => `attachment ${attachment.type} was not downloaded: ${attachment.reason ?? 'api_error'}`),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function renderGroupBots(trustedBots) {
|
|
39
|
+
if (trustedBots.length === 0)
|
|
40
|
+
return '';
|
|
41
|
+
const lines = trustedBots.map((bot) => {
|
|
42
|
+
const name = bot.name ?? '';
|
|
43
|
+
return ` <bot name="${escapeXmlAttribute(name)}" open_id="${escapeXmlAttribute(bot.openId)}" />`;
|
|
44
|
+
});
|
|
45
|
+
return [
|
|
46
|
+
'\n\n<group_bots note="trusted bots in this group; a bot speaks without @-mentioning us">',
|
|
47
|
+
...lines,
|
|
48
|
+
'</group_bots>',
|
|
49
|
+
].join('\n');
|
|
50
|
+
}
|
|
51
|
+
export function formatFeishuCreateTime(value) {
|
|
52
|
+
const trimmed = value.trim();
|
|
53
|
+
if (trimmed === '')
|
|
54
|
+
return '';
|
|
55
|
+
const numeric = Number(trimmed);
|
|
56
|
+
if (Number.isFinite(numeric)) {
|
|
57
|
+
const epochMs = Math.abs(numeric) < 1_000_000_000_000
|
|
58
|
+
? numeric * 1000
|
|
59
|
+
: numeric;
|
|
60
|
+
const date = new Date(epochMs);
|
|
61
|
+
if (!Number.isNaN(date.getTime()))
|
|
62
|
+
return date.toISOString();
|
|
63
|
+
}
|
|
64
|
+
const date = new Date(trimmed);
|
|
65
|
+
if (!Number.isNaN(date.getTime()))
|
|
66
|
+
return date.toISOString();
|
|
67
|
+
return trimmed;
|
|
68
|
+
}
|
|
69
|
+
function renderMessageBody(event) {
|
|
70
|
+
const rawText = extractRawText(event);
|
|
71
|
+
if (rawText !== null) {
|
|
72
|
+
return renderTextWithMentions(rawText, event.mentions);
|
|
73
|
+
}
|
|
74
|
+
return escapeXmlText(event.parsedText);
|
|
75
|
+
}
|
|
76
|
+
function extractRawText(event) {
|
|
77
|
+
if (event.messageType !== 'text')
|
|
78
|
+
return null;
|
|
79
|
+
let parsed;
|
|
80
|
+
try {
|
|
81
|
+
parsed = JSON.parse(event.rawContent);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
const text = parsed['text'];
|
|
90
|
+
return typeof text === 'string' ? text : null;
|
|
91
|
+
}
|
|
92
|
+
function renderTextWithMentions(text, mentions) {
|
|
93
|
+
let out = escapeXmlText(text);
|
|
94
|
+
for (const mention of mentions) {
|
|
95
|
+
const id = mention.id?.open_id ?? mention.id?.union_id ?? mention.id?.user_id;
|
|
96
|
+
if (mention.key === '' || id === undefined || mention.name === undefined) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
out = out.split(escapeXmlText(mention.key)).join(`<at id="${escapeXmlAttribute(id)}">${escapeXmlText(mention.name)}</at>`);
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
function shouldAddFallbackNote(event) {
|
|
104
|
+
if (event.parsedText === '(unparseable message)')
|
|
105
|
+
return true;
|
|
106
|
+
if (event.messageType === 'text' && extractRawText(event) === null)
|
|
107
|
+
return true;
|
|
108
|
+
return event.parsedText === `(${event.messageType} message)`;
|
|
109
|
+
}
|
|
110
|
+
async function resolveAttachments(event, options) {
|
|
111
|
+
const resources = event.resources ?? [];
|
|
112
|
+
const out = [];
|
|
113
|
+
for (const resource of resources) {
|
|
114
|
+
out.push(await resolveAttachment(event.messageId, resource, options));
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
async function resolveAttachment(messageId, resource, options) {
|
|
119
|
+
const base = {
|
|
120
|
+
type: resource.type,
|
|
121
|
+
...(resource.name !== undefined ? { name: resource.name } : {}),
|
|
122
|
+
...(resource.key !== undefined ? { key: resource.key } : {}),
|
|
123
|
+
status: 'not_downloaded',
|
|
124
|
+
};
|
|
125
|
+
if (resource.key === undefined || resource.key === '') {
|
|
126
|
+
return { ...base, reason: 'no_key' };
|
|
127
|
+
}
|
|
128
|
+
if (options.cacheDir === undefined || options.resourceFetcher === undefined) {
|
|
129
|
+
return { ...base, reason: 'unsupported_type' };
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const cacheRoot = resolve(options.cacheDir);
|
|
133
|
+
const path = attachmentPath(cacheRoot, resource);
|
|
134
|
+
if (await fileExists(path))
|
|
135
|
+
return { ...base, status: 'downloaded', path };
|
|
136
|
+
await mkdir(cacheRoot, { recursive: true, mode: 0o700 });
|
|
137
|
+
const response = await options.resourceFetcher.fetchMessageResource({
|
|
138
|
+
messageId,
|
|
139
|
+
fileKey: resource.key,
|
|
140
|
+
type: resource.type,
|
|
141
|
+
});
|
|
142
|
+
const bytes = await readStreamWithLimit(response.stream, options.maxBytes ?? DEFAULT_MAX_RESOURCE_BYTES, options.timeoutMs ?? DEFAULT_RESOURCE_TIMEOUT_MS);
|
|
143
|
+
const tmpPath = `${path}.tmp-${globalThis.process.pid}-${Date.now()}`;
|
|
144
|
+
try {
|
|
145
|
+
await writeFile(tmpPath, bytes, { mode: 0o600 });
|
|
146
|
+
await chmod(tmpPath, 0o600);
|
|
147
|
+
await rename(tmpPath, path);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
await rm(tmpPath, { force: true });
|
|
151
|
+
throw err;
|
|
152
|
+
}
|
|
153
|
+
return { ...base, status: 'downloaded', path };
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
return { ...base, reason: reasonFromError(err) };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function renderAttachments(messageId, attachments) {
|
|
160
|
+
if (attachments.length === 0)
|
|
161
|
+
return '';
|
|
162
|
+
return attachments.map((attachment) => renderAttachment(messageId, attachment)).join('');
|
|
163
|
+
}
|
|
164
|
+
function renderAttachment(messageId, attachment) {
|
|
165
|
+
const attrs = [
|
|
166
|
+
['type', attachment.type],
|
|
167
|
+
...(attachment.name !== undefined ? [['name', attachment.name]] : []),
|
|
168
|
+
...(attachment.key !== undefined ? [['key', attachment.key]] : []),
|
|
169
|
+
...(attachment.path !== undefined ? [['path', attachment.path]] : []),
|
|
170
|
+
['status', attachment.status],
|
|
171
|
+
...(attachment.reason !== undefined ? [['reason', attachment.reason]] : []),
|
|
172
|
+
];
|
|
173
|
+
const attrText = attrs
|
|
174
|
+
.map(([key, value]) => `${key}="${escapeXmlAttribute(value)}"`)
|
|
175
|
+
.join(' ');
|
|
176
|
+
if (attachment.status === 'downloaded') {
|
|
177
|
+
return `\n\n<attachment ${attrText} />`;
|
|
178
|
+
}
|
|
179
|
+
const key = attachment.key ?? `${attachment.type.toUpperCase()}_KEY`;
|
|
180
|
+
const outputName = attachment.type === 'image'
|
|
181
|
+
? 'feishu-attachment-image'
|
|
182
|
+
: 'feishu-attachment-file';
|
|
183
|
+
const command = [
|
|
184
|
+
'lark-cli im +messages-resources-download',
|
|
185
|
+
`--message-id ${shellArg(messageId)}`,
|
|
186
|
+
`--file-key ${shellArg(key)}`,
|
|
187
|
+
`--type ${attachment.type}`,
|
|
188
|
+
`--output ./${outputName}`,
|
|
189
|
+
].join(' ');
|
|
190
|
+
return [
|
|
191
|
+
`\n\n<attachment ${attrText}>`,
|
|
192
|
+
'Use lark-cli to fetch it if needed:',
|
|
193
|
+
escapeXmlText(command),
|
|
194
|
+
'</attachment>',
|
|
195
|
+
].join('\n');
|
|
196
|
+
}
|
|
197
|
+
function attachmentPath(cacheRoot, resource) {
|
|
198
|
+
const key = resource.key ?? 'missing-key';
|
|
199
|
+
const digest = createHash('sha256').update(key).digest('hex').slice(0, 16);
|
|
200
|
+
const displayName = sanitizeFileName(resource.name ?? `${resource.type}.bin`);
|
|
201
|
+
const path = resolve(cacheRoot, `${resource.type}-${digest}-${displayName}`);
|
|
202
|
+
if (!isInside(cacheRoot, path))
|
|
203
|
+
throw new CachePathError();
|
|
204
|
+
return path;
|
|
205
|
+
}
|
|
206
|
+
function sanitizeFileName(value) {
|
|
207
|
+
const safeBase = basename(value)
|
|
208
|
+
.replace(/[\u0000-\u001f\u007f]/g, '')
|
|
209
|
+
.replace(/[^A-Za-z0-9._-]+/g, '_')
|
|
210
|
+
.replace(/^[-.]+/, '')
|
|
211
|
+
.slice(0, 80);
|
|
212
|
+
return safeBase === '' ? 'attachment.bin' : safeBase;
|
|
213
|
+
}
|
|
214
|
+
function isInside(root, path) {
|
|
215
|
+
return path === root || path.startsWith(`${root}/`);
|
|
216
|
+
}
|
|
217
|
+
async function fileExists(path) {
|
|
218
|
+
try {
|
|
219
|
+
const info = await stat(path);
|
|
220
|
+
return info.isFile();
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
async function readStreamWithLimit(stream, maxBytes, timeoutMs) {
|
|
227
|
+
const chunks = [];
|
|
228
|
+
let total = 0;
|
|
229
|
+
let timedOut = false;
|
|
230
|
+
const timer = setTimeout(() => {
|
|
231
|
+
timedOut = true;
|
|
232
|
+
stream.destroy(new DownloadTimeoutError());
|
|
233
|
+
}, timeoutMs);
|
|
234
|
+
try {
|
|
235
|
+
for await (const chunk of stream) {
|
|
236
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
237
|
+
total += bytes.byteLength;
|
|
238
|
+
if (total > maxBytes) {
|
|
239
|
+
stream.destroy(new DownloadTooLargeError());
|
|
240
|
+
throw new DownloadTooLargeError();
|
|
241
|
+
}
|
|
242
|
+
chunks.push(bytes);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
catch (err) {
|
|
246
|
+
if (timedOut)
|
|
247
|
+
throw new DownloadTimeoutError();
|
|
248
|
+
throw err;
|
|
249
|
+
}
|
|
250
|
+
finally {
|
|
251
|
+
clearTimeout(timer);
|
|
252
|
+
}
|
|
253
|
+
return Buffer.concat(chunks, total);
|
|
254
|
+
}
|
|
255
|
+
function reasonFromError(err) {
|
|
256
|
+
if (err instanceof DownloadTooLargeError)
|
|
257
|
+
return 'too_large';
|
|
258
|
+
if (err instanceof DownloadTimeoutError)
|
|
259
|
+
return 'timeout';
|
|
260
|
+
if (err instanceof CachePathError)
|
|
261
|
+
return 'cache_error';
|
|
262
|
+
if (err instanceof Error && looksLikeMissingScope(err))
|
|
263
|
+
return 'missing_scope';
|
|
264
|
+
return 'api_error';
|
|
265
|
+
}
|
|
266
|
+
function looksLikeMissingScope(err) {
|
|
267
|
+
const message = err.message.toLowerCase();
|
|
268
|
+
return message.includes('scope') || message.includes('permission');
|
|
269
|
+
}
|
|
270
|
+
class DownloadTooLargeError extends Error {
|
|
271
|
+
constructor() {
|
|
272
|
+
super('Feishu resource exceeds configured byte cap');
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
class DownloadTimeoutError extends Error {
|
|
276
|
+
constructor() {
|
|
277
|
+
super('Feishu resource download timed out');
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
class CachePathError extends Error {
|
|
281
|
+
constructor() {
|
|
282
|
+
super('Feishu resource cache path escaped cache root');
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function escapeXmlAttribute(value) {
|
|
286
|
+
return escapeXmlText(value).replaceAll('"', '"');
|
|
287
|
+
}
|
|
288
|
+
function shellArg(value) {
|
|
289
|
+
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
290
|
+
}
|
|
291
|
+
function escapeXmlText(value) {
|
|
292
|
+
return value
|
|
293
|
+
.replaceAll('&', '&')
|
|
294
|
+
.replaceAll('<', '<')
|
|
295
|
+
.replaceAll('>', '>');
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=inbound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbound.js","sourceRoot":"","sources":["../src/inbound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,EAAE,EACF,IAAI,EACJ,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,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,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,qBAAsB,SAAQ,KAAK;IACvC;QACE,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACvD,CAAC;CACF;AAED,MAAM,oBAAqB,SAAQ,KAAK;IACtC;QACE,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAC9C,CAAC;CACF;AAED,MAAM,cAAe,SAAQ,KAAK;IAChC;QACE,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACzD,CAAC;CACF;AAED,SAAS,kBAAkB,CAAC,KAAa;IACvC,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC;AAC/C,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,KAAK;SACT,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAC7B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { FEISHU_TRANSPORT_PACKAGE } from '@excitedjs/feishu-transport';
|
|
2
|
+
export { FEISHU_SKILL_FALLBACK_NOTE, formatFeishuCreateTime, formatFeishuMessageForCodex, type FeishuAttachmentReason, type FeishuAttachmentStatus, type FeishuChannelMessage, type FeishuPeerBot, type FormatFeishuMessageOptions, type FormatFeishuMessageResult, type FormattedFeishuAttachment, } from './inbound.js';
|
|
3
|
+
/** Package identity marker. */
|
|
4
|
+
export declare const FEISHU_CHANNEL_PACKAGE = "@excitedjs/feishu-channel";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,2BAA2B,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,GAC/B,MAAM,cAAc,CAAC;AAEtB,+BAA+B;AAC/B,eAAO,MAAM,sBAAsB,8BAA8B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { FEISHU_TRANSPORT_PACKAGE } from '@excitedjs/feishu-transport';
|
|
2
|
+
export { FEISHU_SKILL_FALLBACK_NOTE, formatFeishuCreateTime, formatFeishuMessageForCodex, } from './inbound.js';
|
|
3
|
+
/** Package identity marker. */
|
|
4
|
+
export const FEISHU_CHANNEL_PACKAGE = '@excitedjs/feishu-channel';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,2BAA2B,GAQ5B,MAAM,cAAc,CAAC;AAEtB,+BAA+B;AAC/B,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@excitedjs/feishu-channel",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "dreamux-side Feishu channel layer (inbound filter + conversation→thread mapping + forwarding) on top of @excitedjs/feishu-transport. PR0 scaffold (issue excitedjs/dreamux#25).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/excitedjs/dreamux.git",
|
|
9
|
+
"directory": "packages/channel/feishu-channel"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=22.7"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc -p tsconfig.json",
|
|
30
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
31
|
+
"lint": "eslint .",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"test:watch": "vitest",
|
|
34
|
+
"clean": "rm -rf dist",
|
|
35
|
+
"prepublishOnly": "npm run build"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@excitedjs/feishu-transport": "workspace:*"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@excitedjs/eslint-config": "workspace:*",
|
|
42
|
+
"@types/node": "^22.10.0",
|
|
43
|
+
"eslint": "^9.39.0",
|
|
44
|
+
"typescript": "^5.7.0",
|
|
45
|
+
"vitest": "^2.1.0"
|
|
46
|
+
}
|
|
47
|
+
}
|