@kodelyth/feishu 2026.5.42 → 2026.6.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.
Files changed (192) hide show
  1. package/klaw.plugin.json +1712 -47
  2. package/package.json +17 -4
  3. package/api.ts +0 -32
  4. package/channel-entry.ts +0 -20
  5. package/channel-plugin-api.ts +0 -1
  6. package/contract-api.ts +0 -16
  7. package/index.ts +0 -82
  8. package/runtime-api.ts +0 -52
  9. package/secret-contract-api.ts +0 -5
  10. package/security-contract-api.ts +0 -1
  11. package/session-key-api.ts +0 -1
  12. package/setup-api.ts +0 -3
  13. package/setup-entry.test.ts +0 -19
  14. package/setup-entry.ts +0 -13
  15. package/src/accounts.test.ts +0 -480
  16. package/src/accounts.ts +0 -333
  17. package/src/agent-config.ts +0 -21
  18. package/src/app-registration.ts +0 -331
  19. package/src/approval-auth.test.ts +0 -24
  20. package/src/approval-auth.ts +0 -25
  21. package/src/async.test.ts +0 -35
  22. package/src/async.ts +0 -104
  23. package/src/audio-preflight.runtime.ts +0 -9
  24. package/src/bitable.test.ts +0 -136
  25. package/src/bitable.ts +0 -762
  26. package/src/bot-content.ts +0 -485
  27. package/src/bot-group-name.test.ts +0 -116
  28. package/src/bot-runtime-api.ts +0 -12
  29. package/src/bot-sender-name.ts +0 -125
  30. package/src/bot.broadcast.test.ts +0 -523
  31. package/src/bot.card-action.test.ts +0 -552
  32. package/src/bot.checkBotMentioned.test.ts +0 -265
  33. package/src/bot.helpers.test.ts +0 -135
  34. package/src/bot.stripBotMention.test.ts +0 -126
  35. package/src/bot.test.ts +0 -3671
  36. package/src/bot.ts +0 -1703
  37. package/src/card-action.ts +0 -447
  38. package/src/card-interaction.test.ts +0 -131
  39. package/src/card-interaction.ts +0 -159
  40. package/src/card-test-helpers.ts +0 -54
  41. package/src/card-ux-approval.ts +0 -65
  42. package/src/card-ux-launcher.test.ts +0 -106
  43. package/src/card-ux-launcher.ts +0 -121
  44. package/src/card-ux-shared.ts +0 -33
  45. package/src/channel-runtime-api.ts +0 -16
  46. package/src/channel.runtime.ts +0 -47
  47. package/src/channel.test.ts +0 -1151
  48. package/src/channel.ts +0 -1423
  49. package/src/chat-schema.ts +0 -25
  50. package/src/chat.test.ts +0 -240
  51. package/src/chat.ts +0 -188
  52. package/src/client-timeout.ts +0 -42
  53. package/src/client.test.ts +0 -447
  54. package/src/client.ts +0 -262
  55. package/src/comment-dispatcher-runtime-api.ts +0 -6
  56. package/src/comment-dispatcher.test.ts +0 -185
  57. package/src/comment-dispatcher.ts +0 -107
  58. package/src/comment-handler-runtime-api.ts +0 -3
  59. package/src/comment-handler.test.ts +0 -592
  60. package/src/comment-handler.ts +0 -303
  61. package/src/comment-reaction.test.ts +0 -138
  62. package/src/comment-reaction.ts +0 -259
  63. package/src/comment-shared.test.ts +0 -183
  64. package/src/comment-shared.ts +0 -406
  65. package/src/comment-target.ts +0 -44
  66. package/src/config-schema.test.ts +0 -326
  67. package/src/config-schema.ts +0 -335
  68. package/src/conversation-id.test.ts +0 -18
  69. package/src/conversation-id.ts +0 -199
  70. package/src/dedup-runtime-api.ts +0 -1
  71. package/src/dedup.ts +0 -141
  72. package/src/dedupe-key.ts +0 -72
  73. package/src/directory.static.ts +0 -61
  74. package/src/directory.test.ts +0 -141
  75. package/src/directory.ts +0 -124
  76. package/src/doc-schema.ts +0 -182
  77. package/src/docx-batch-insert.test.ts +0 -116
  78. package/src/docx-batch-insert.ts +0 -223
  79. package/src/docx-color-text.ts +0 -154
  80. package/src/docx-table-ops.test.ts +0 -53
  81. package/src/docx-table-ops.ts +0 -316
  82. package/src/docx-types.ts +0 -38
  83. package/src/docx.account-selection.test.ts +0 -95
  84. package/src/docx.test.ts +0 -701
  85. package/src/docx.ts +0 -1596
  86. package/src/drive-schema.ts +0 -92
  87. package/src/drive.test.ts +0 -1237
  88. package/src/drive.ts +0 -829
  89. package/src/dynamic-agent.test.ts +0 -155
  90. package/src/dynamic-agent.ts +0 -143
  91. package/src/event-types.ts +0 -45
  92. package/src/external-keys.test.ts +0 -20
  93. package/src/external-keys.ts +0 -19
  94. package/src/lifecycle.test-support.ts +0 -220
  95. package/src/media.test.ts +0 -955
  96. package/src/media.ts +0 -1105
  97. package/src/mention-target.types.ts +0 -5
  98. package/src/mention.ts +0 -114
  99. package/src/message-action-contract.ts +0 -13
  100. package/src/monitor-state-runtime-api.ts +0 -7
  101. package/src/monitor-transport-runtime-api.ts +0 -10
  102. package/src/monitor.account.ts +0 -492
  103. package/src/monitor.acp-init-failure.lifecycle.test-support.ts +0 -219
  104. package/src/monitor.bot-identity.ts +0 -86
  105. package/src/monitor.bot-menu-handler.ts +0 -165
  106. package/src/monitor.bot-menu.lifecycle.test-support.ts +0 -224
  107. package/src/monitor.bot-menu.test.ts +0 -188
  108. package/src/monitor.broadcast.reply-once.lifecycle.test-support.ts +0 -264
  109. package/src/monitor.card-action.lifecycle.test-support.ts +0 -421
  110. package/src/monitor.cleanup.test.ts +0 -383
  111. package/src/monitor.comment-notice-handler.ts +0 -105
  112. package/src/monitor.comment.test.ts +0 -967
  113. package/src/monitor.comment.ts +0 -1386
  114. package/src/monitor.lifecycle.test.ts +0 -4
  115. package/src/monitor.message-handler.ts +0 -350
  116. package/src/monitor.reaction.lifecycle.test-support.ts +0 -68
  117. package/src/monitor.reaction.test.ts +0 -739
  118. package/src/monitor.startup.test.ts +0 -213
  119. package/src/monitor.startup.ts +0 -74
  120. package/src/monitor.state.defaults.test.ts +0 -46
  121. package/src/monitor.state.ts +0 -170
  122. package/src/monitor.synthetic-error.ts +0 -18
  123. package/src/monitor.test-mocks.ts +0 -46
  124. package/src/monitor.transport.ts +0 -451
  125. package/src/monitor.ts +0 -100
  126. package/src/monitor.webhook-e2e.test.ts +0 -279
  127. package/src/monitor.webhook-security.test.ts +0 -389
  128. package/src/monitor.webhook.test-helpers.ts +0 -116
  129. package/src/outbound-runtime-api.ts +0 -1
  130. package/src/outbound.test.ts +0 -1118
  131. package/src/outbound.ts +0 -785
  132. package/src/perm-schema.ts +0 -52
  133. package/src/perm.ts +0 -170
  134. package/src/pins.ts +0 -108
  135. package/src/policy.test.ts +0 -223
  136. package/src/policy.ts +0 -318
  137. package/src/post.test.ts +0 -105
  138. package/src/post.ts +0 -275
  139. package/src/probe.test.ts +0 -283
  140. package/src/probe.ts +0 -166
  141. package/src/processing-claims.ts +0 -59
  142. package/src/qr-terminal.ts +0 -1
  143. package/src/reactions.ts +0 -123
  144. package/src/reasoning-preview.test.ts +0 -113
  145. package/src/reasoning-preview.ts +0 -28
  146. package/src/reply-dispatcher-runtime-api.ts +0 -7
  147. package/src/reply-dispatcher.test.ts +0 -1513
  148. package/src/reply-dispatcher.ts +0 -748
  149. package/src/runtime.ts +0 -9
  150. package/src/secret-contract.ts +0 -145
  151. package/src/secret-input.ts +0 -1
  152. package/src/security-audit-shared.ts +0 -69
  153. package/src/security-audit.test.ts +0 -59
  154. package/src/security-audit.ts +0 -1
  155. package/src/send-result.ts +0 -80
  156. package/src/send-target.test.ts +0 -86
  157. package/src/send-target.ts +0 -35
  158. package/src/send.reply-fallback.test.ts +0 -417
  159. package/src/send.test.ts +0 -621
  160. package/src/send.ts +0 -861
  161. package/src/sequential-key.test.ts +0 -72
  162. package/src/sequential-key.ts +0 -25
  163. package/src/sequential-queue.test.ts +0 -165
  164. package/src/sequential-queue.ts +0 -86
  165. package/src/session-conversation.ts +0 -42
  166. package/src/session-route.ts +0 -48
  167. package/src/setup-core.ts +0 -51
  168. package/src/setup-surface.test.ts +0 -484
  169. package/src/setup-surface.ts +0 -618
  170. package/src/streaming-card.test.ts +0 -397
  171. package/src/streaming-card.ts +0 -571
  172. package/src/subagent-hooks.test.ts +0 -627
  173. package/src/subagent-hooks.ts +0 -413
  174. package/src/targets.ts +0 -97
  175. package/src/test-support/lifecycle-test-support.ts +0 -454
  176. package/src/thread-bindings.test.ts +0 -180
  177. package/src/thread-bindings.ts +0 -331
  178. package/src/tool-account-routing.test.ts +0 -250
  179. package/src/tool-account.test.ts +0 -44
  180. package/src/tool-account.ts +0 -93
  181. package/src/tool-factory-test-harness.ts +0 -79
  182. package/src/tool-result.test.ts +0 -32
  183. package/src/tool-result.ts +0 -16
  184. package/src/tools-config.test.ts +0 -21
  185. package/src/tools-config.ts +0 -22
  186. package/src/types.ts +0 -106
  187. package/src/typing.test.ts +0 -144
  188. package/src/typing.ts +0 -214
  189. package/src/wiki-schema.ts +0 -69
  190. package/src/wiki.ts +0 -270
  191. package/subagent-hooks-api.ts +0 -31
  192. package/tsconfig.json +0 -16
@@ -1,480 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import {
3
- FeishuSecretRefUnavailableError,
4
- inspectFeishuCredentials,
5
- listFeishuAccountIds,
6
- resolveDefaultFeishuAccountId,
7
- resolveDefaultFeishuAccountSelection,
8
- resolveFeishuAccount,
9
- resolveFeishuCredentials,
10
- resolveFeishuRuntimeAccount,
11
- } from "./accounts.js";
12
- import type { FeishuConfig } from "./types.js";
13
-
14
- function makeDefaultAndRouterAccounts() {
15
- return {
16
- default: { appId: "cli_default", appSecret: "secret_default" }, // pragma: allowlist secret
17
- "router-d": { appId: "cli_router", appSecret: "secret_router" }, // pragma: allowlist secret
18
- };
19
- }
20
-
21
- function expectExplicitDefaultAccountSelection(
22
- account: ReturnType<typeof resolveFeishuAccount>,
23
- appId: string,
24
- ) {
25
- expect(account.accountId).toBe("router-d");
26
- expect(account.selectionSource).toBe("explicit-default");
27
- expect(account.configured).toBe(true);
28
- expect(account.appId).toBe(appId);
29
- }
30
-
31
- function withEnvVar(key: string, value: string | undefined, run: () => void) {
32
- const prev = process.env[key];
33
- if (value === undefined) {
34
- delete process.env[key];
35
- } else {
36
- process.env[key] = value;
37
- }
38
- try {
39
- run();
40
- } finally {
41
- if (prev === undefined) {
42
- delete process.env[key];
43
- } else {
44
- process.env[key] = prev;
45
- }
46
- }
47
- }
48
-
49
- function asConfig(config: Partial<FeishuConfig>): FeishuConfig {
50
- return config as unknown as FeishuConfig;
51
- }
52
-
53
- function expectUnresolvedEnvSecretRefError(key: string) {
54
- expect(() =>
55
- resolveFeishuCredentials(
56
- asConfig({
57
- appId: "cli_123",
58
- appSecret: { source: "env", provider: "default", id: key } as never,
59
- }),
60
- ),
61
- ).toThrow(/unresolved SecretRef/i);
62
- }
63
-
64
- describe("resolveDefaultFeishuAccountId", () => {
65
- it("preserves top-level default account when named accounts are configured", () => {
66
- const cfg = {
67
- channels: {
68
- feishu: {
69
- appId: "cli_default",
70
- appSecret: "secret_default",
71
- accounts: {
72
- work: { enabled: false },
73
- },
74
- },
75
- },
76
- };
77
-
78
- expect(listFeishuAccountIds(cfg as never)).toEqual(["default", "work"]);
79
- expect(resolveDefaultFeishuAccountId(cfg as never)).toBe("default");
80
- });
81
-
82
- it("prefers channels.feishu.defaultAccount when configured", () => {
83
- const cfg = {
84
- channels: {
85
- feishu: {
86
- defaultAccount: "router-d",
87
- accounts: makeDefaultAndRouterAccounts(),
88
- },
89
- },
90
- };
91
-
92
- expect(resolveDefaultFeishuAccountId(cfg as never)).toBe("router-d");
93
- });
94
-
95
- it("normalizes configured defaultAccount before lookup", () => {
96
- const cfg = {
97
- channels: {
98
- feishu: {
99
- defaultAccount: "Router D",
100
- accounts: {
101
- "router-d": { appId: "cli_router", appSecret: "secret_router" }, // pragma: allowlist secret
102
- },
103
- },
104
- },
105
- };
106
-
107
- expect(resolveDefaultFeishuAccountId(cfg as never)).toBe("router-d");
108
- });
109
-
110
- it("keeps configured defaultAccount even when not present in accounts map", () => {
111
- const cfg = {
112
- channels: {
113
- feishu: {
114
- defaultAccount: "router-d",
115
- accounts: {
116
- default: { appId: "cli_default", appSecret: "secret_default" }, // pragma: allowlist secret
117
- zeta: { appId: "cli_zeta", appSecret: "secret_zeta" }, // pragma: allowlist secret
118
- },
119
- },
120
- },
121
- };
122
-
123
- expect(resolveDefaultFeishuAccountId(cfg as never)).toBe("router-d");
124
- });
125
-
126
- it("falls back to literal default account id when present", () => {
127
- const cfg = {
128
- channels: {
129
- feishu: {
130
- accounts: {
131
- default: { appId: "cli_default", appSecret: "secret_default" }, // pragma: allowlist secret
132
- zeta: { appId: "cli_zeta", appSecret: "secret_zeta" }, // pragma: allowlist secret
133
- },
134
- },
135
- },
136
- };
137
-
138
- expect(resolveDefaultFeishuAccountId(cfg as never)).toBe("default");
139
- });
140
-
141
- it("reports selection source for configured defaults and mapped defaults", () => {
142
- const explicitDefaultCfg = {
143
- channels: {
144
- feishu: {
145
- defaultAccount: "router-d",
146
- accounts: {},
147
- },
148
- },
149
- };
150
- expect(resolveDefaultFeishuAccountSelection(explicitDefaultCfg as never)).toEqual({
151
- accountId: "router-d",
152
- source: "explicit-default",
153
- });
154
-
155
- const mappedDefaultCfg = {
156
- channels: {
157
- feishu: {
158
- accounts: {
159
- default: { appId: "cli_default", appSecret: "secret_default" }, // pragma: allowlist secret
160
- },
161
- },
162
- },
163
- };
164
- expect(resolveDefaultFeishuAccountSelection(mappedDefaultCfg as never)).toEqual({
165
- accountId: "default",
166
- source: "mapped-default",
167
- });
168
- });
169
- });
170
-
171
- describe("resolveFeishuCredentials", () => {
172
- it("throws unresolved SecretRef errors by default for unsupported secret sources", () => {
173
- expect(() =>
174
- resolveFeishuCredentials(
175
- asConfig({
176
- appId: "cli_123",
177
- appSecret: { source: "file", provider: "default", id: "path/to/secret" } as never,
178
- }),
179
- ),
180
- ).toThrow(/unresolved SecretRef/i);
181
- });
182
-
183
- it("returns null (without throwing) when unresolved SecretRef is allowed", () => {
184
- const creds = resolveFeishuCredentials(
185
- asConfig({
186
- appId: "cli_123",
187
- appSecret: { source: "file", provider: "default", id: "path/to/secret" } as never,
188
- }),
189
- { allowUnresolvedSecretRef: true },
190
- );
191
-
192
- expect(creds).toBeNull();
193
- });
194
-
195
- it("supports explicit inspect mode for unresolved SecretRefs", () => {
196
- const creds = resolveFeishuCredentials(
197
- asConfig({
198
- appId: "cli_123",
199
- appSecret: { source: "file", provider: "default", id: "path/to/secret" } as never,
200
- }),
201
- { mode: "inspect" },
202
- );
203
-
204
- expect(creds).toBeNull();
205
- });
206
-
207
- it("throws unresolved SecretRef error when env SecretRef points to missing env var", () => {
208
- const key = "FEISHU_APP_SECRET_MISSING_TEST";
209
- withEnvVar(key, undefined, () => {
210
- expectUnresolvedEnvSecretRefError(key);
211
- });
212
- });
213
-
214
- it("resolves env SecretRef objects when unresolved refs are allowed", () => {
215
- const key = "FEISHU_APP_SECRET_TEST";
216
- const prev = process.env[key];
217
- process.env[key] = " secret_from_env ";
218
-
219
- try {
220
- const creds = resolveFeishuCredentials(
221
- asConfig({
222
- appId: "cli_123",
223
- appSecret: { source: "env", provider: "default", id: key } as never,
224
- }),
225
- { allowUnresolvedSecretRef: true },
226
- );
227
-
228
- expect(creds).toEqual({
229
- appId: "cli_123",
230
- appSecret: "secret_from_env", // pragma: allowlist secret
231
- encryptKey: undefined,
232
- verificationToken: undefined,
233
- domain: "feishu",
234
- });
235
- } finally {
236
- if (prev === undefined) {
237
- delete process.env[key];
238
- } else {
239
- process.env[key] = prev;
240
- }
241
- }
242
- });
243
-
244
- it("resolves env SecretRef with custom provider alias when unresolved refs are allowed", () => {
245
- const key = "FEISHU_APP_SECRET_CUSTOM_PROVIDER_TEST";
246
- const prev = process.env[key];
247
- process.env[key] = " secret_from_env_alias ";
248
-
249
- try {
250
- const creds = resolveFeishuCredentials(
251
- asConfig({
252
- appId: "cli_123",
253
- appSecret: { source: "env", provider: "corp-env", id: key } as never,
254
- }),
255
- { allowUnresolvedSecretRef: true },
256
- );
257
-
258
- expect(creds?.appSecret).toBe("secret_from_env_alias");
259
- } finally {
260
- if (prev === undefined) {
261
- delete process.env[key];
262
- } else {
263
- process.env[key] = prev;
264
- }
265
- }
266
- });
267
-
268
- it("preserves unresolved SecretRef diagnostics for env refs in default mode", () => {
269
- const key = "FEISHU_APP_SECRET_POLICY_TEST";
270
- withEnvVar(key, "secret_from_env", () => {
271
- expectUnresolvedEnvSecretRefError(key);
272
- });
273
- });
274
-
275
- it("trims and returns credentials when values are valid strings", () => {
276
- const creds = resolveFeishuCredentials(
277
- asConfig({
278
- appId: " cli_123 ",
279
- appSecret: " secret_456 ",
280
- encryptKey: " enc ",
281
- verificationToken: " vt ",
282
- }),
283
- );
284
-
285
- expect(creds).toEqual({
286
- appId: "cli_123",
287
- appSecret: "secret_456", // pragma: allowlist secret
288
- encryptKey: "enc",
289
- verificationToken: "vt",
290
- domain: "feishu",
291
- });
292
- });
293
-
294
- it("does not resolve encryptKey SecretRefs outside webhook mode", () => {
295
- const creds = resolveFeishuCredentials(
296
- asConfig({
297
- connectionMode: "websocket",
298
- appId: "cli_123",
299
- appSecret: "secret_456",
300
- encryptKey: { source: "file", provider: "default", id: "path/to/secret" } as never,
301
- }),
302
- );
303
-
304
- expect(creds).toEqual({
305
- appId: "cli_123",
306
- appSecret: "secret_456", // pragma: allowlist secret
307
- encryptKey: undefined,
308
- verificationToken: undefined,
309
- domain: "feishu",
310
- });
311
- });
312
-
313
- it("keeps required credentials when optional event SecretRefs are unresolved in inspect mode", () => {
314
- const creds = inspectFeishuCredentials(
315
- asConfig({
316
- appId: "cli_123",
317
- appSecret: "secret_456",
318
- verificationToken: { source: "file", provider: "default", id: "path/to/token" } as never,
319
- }),
320
- );
321
-
322
- expect(creds).toEqual({
323
- appId: "cli_123",
324
- appSecret: "secret_456", // pragma: allowlist secret
325
- encryptKey: undefined,
326
- verificationToken: undefined,
327
- domain: "feishu",
328
- });
329
- });
330
- });
331
-
332
- describe("resolveFeishuAccount", () => {
333
- it("uses top-level credentials with configured default account id even without account map entry", () => {
334
- const cfg = {
335
- channels: {
336
- feishu: {
337
- defaultAccount: "router-d",
338
- appId: "top_level_app",
339
- appSecret: "top_level_secret", // pragma: allowlist secret
340
- accounts: {
341
- default: { appId: "cli_default", appSecret: "secret_default" }, // pragma: allowlist secret
342
- },
343
- },
344
- },
345
- };
346
-
347
- const account = resolveFeishuAccount({ cfg: cfg as never, accountId: undefined });
348
- expectExplicitDefaultAccountSelection(account, "top_level_app");
349
- });
350
-
351
- it("uses configured default account when accountId is omitted", () => {
352
- const cfg = {
353
- channels: {
354
- feishu: {
355
- defaultAccount: "router-d",
356
- accounts: {
357
- default: { enabled: true },
358
- "router-d": { appId: "cli_router", appSecret: "secret_router", enabled: true }, // pragma: allowlist secret
359
- },
360
- },
361
- },
362
- };
363
-
364
- const account = resolveFeishuAccount({ cfg: cfg as never, accountId: undefined });
365
- expectExplicitDefaultAccountSelection(account, "cli_router");
366
- });
367
-
368
- it("keeps explicit accountId selection", () => {
369
- const cfg = {
370
- channels: {
371
- feishu: {
372
- defaultAccount: "router-d",
373
- accounts: makeDefaultAndRouterAccounts(),
374
- },
375
- },
376
- };
377
-
378
- const account = resolveFeishuAccount({ cfg: cfg as never, accountId: "default" });
379
- expect(account.accountId).toBe("default");
380
- expect(account.selectionSource).toBe("explicit");
381
- expect(account.appId).toBe("cli_default");
382
- });
383
-
384
- it("treats unresolved SecretRef as not configured in account resolution", () => {
385
- const account = resolveFeishuAccount({
386
- cfg: {
387
- channels: {
388
- feishu: {
389
- accounts: {
390
- main: {
391
- appId: "cli_123",
392
- appSecret: { source: "file", provider: "default", id: "path/to/secret" },
393
- } as never,
394
- },
395
- },
396
- },
397
- } as never,
398
- accountId: "main",
399
- });
400
- expect(account.configured).toBe(false);
401
- expect(account.appSecret).toBeUndefined();
402
- });
403
-
404
- it("keeps account configured when optional event SecretRefs are unresolved in inspect mode", () => {
405
- const account = resolveFeishuAccount({
406
- cfg: {
407
- channels: {
408
- feishu: {
409
- accounts: {
410
- main: {
411
- appId: "cli_123",
412
- appSecret: "secret_456",
413
- verificationToken: {
414
- source: "file",
415
- provider: "default",
416
- id: "path/to/token",
417
- },
418
- } as never,
419
- },
420
- },
421
- },
422
- } as never,
423
- accountId: "main",
424
- });
425
-
426
- expect(account.configured).toBe(true);
427
- expect(account.appSecret).toBe("secret_456");
428
- expect(account.verificationToken).toBeUndefined();
429
- });
430
-
431
- it("throws typed SecretRef errors in runtime account resolution", () => {
432
- let caught: unknown;
433
- try {
434
- resolveFeishuRuntimeAccount({
435
- cfg: {
436
- channels: {
437
- feishu: {
438
- accounts: {
439
- main: {
440
- appId: "cli_123",
441
- appSecret: { source: "file", provider: "default", id: "path/to/secret" },
442
- } as never,
443
- },
444
- },
445
- },
446
- } as never,
447
- accountId: "main",
448
- });
449
- } catch (error) {
450
- caught = error;
451
- }
452
-
453
- expect(caught).toBeInstanceOf(FeishuSecretRefUnavailableError);
454
- expect((caught as Error).message).toMatch(/channels\.feishu\.appSecret: unresolved SecretRef/i);
455
- });
456
-
457
- it("ignores non-string account names", () => {
458
- const account = resolveFeishuAccount({
459
- cfg: {
460
- channels: {
461
- feishu: {
462
- accounts: {
463
- main: {
464
- name: { bad: true },
465
- appId: "cli_123",
466
- appSecret: "secret_456", // pragma: allowlist secret
467
- } as never,
468
- },
469
- },
470
- },
471
- } as never,
472
- accountId: "main",
473
- });
474
-
475
- expect(account.accountId).toBe("main");
476
- expect(account.appId).toBe("cli_123");
477
- expect(account.appSecret).toBe("secret_456");
478
- expect(account.name).toBeUndefined();
479
- });
480
- });