@downcity/plugins 1.0.35 → 1.0.38

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 (57) hide show
  1. package/bin/auth/Plugin.js +2 -2
  2. package/bin/auth/Plugin.js.map +1 -1
  3. package/bin/chat/accounts/ChannelAccountManager.d.ts +3 -3
  4. package/bin/chat/accounts/ChannelAccountManager.js +6 -6
  5. package/bin/chat/accounts/ChannelAccountManager.js.map +1 -1
  6. package/bin/chat/accounts/Crypto.d.ts +1 -1
  7. package/bin/chat/accounts/Crypto.js +1 -1
  8. package/bin/chat/accounts/Store.d.ts +8 -8
  9. package/bin/chat/accounts/Store.js +13 -13
  10. package/bin/chat/accounts/Store.js.map +1 -1
  11. package/bin/chat/channels/feishu/Configuration.d.ts +1 -1
  12. package/bin/chat/channels/feishu/Configuration.js +5 -5
  13. package/bin/chat/channels/feishu/Configuration.js.map +1 -1
  14. package/bin/chat/channels/qq/Configuration.d.ts +1 -1
  15. package/bin/chat/channels/qq/Configuration.js +5 -5
  16. package/bin/chat/channels/qq/Configuration.js.map +1 -1
  17. package/bin/chat/channels/telegram/BotInfo.d.ts +1 -1
  18. package/bin/chat/channels/telegram/BotInfo.js +1 -1
  19. package/bin/chat/channels/telegram/Configuration.d.ts +1 -1
  20. package/bin/chat/channels/telegram/Configuration.js +5 -5
  21. package/bin/chat/channels/telegram/Configuration.js.map +1 -1
  22. package/bin/chat/runtime/ChatChannelCore.d.ts +1 -1
  23. package/bin/chat/runtime/ChatChannelCore.js +1 -1
  24. package/bin/chat/runtime/ChatChannelLifecycle.js +1 -1
  25. package/bin/chat/runtime/ChatChannelLifecycle.js.map +1 -1
  26. package/bin/chat/runtime/ChatPluginSystem.d.ts +2 -2
  27. package/bin/chat/runtime/ChatPluginSystem.js +1 -1
  28. package/bin/chat/runtime/ChatPromptAssets.d.ts +1 -1
  29. package/bin/chat/runtime/ChatPromptAssets.js +1 -1
  30. package/bin/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
  31. package/bin/chat/runtime/ChatQueueWorker.js +12 -33
  32. package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
  33. package/bin/chat/types/BotInfo.d.ts +2 -2
  34. package/bin/chat/types/BotInfo.js +1 -1
  35. package/bin/chat/types/ChannelAccount.d.ts +12 -12
  36. package/bin/chat/types/ChannelAccount.js +2 -2
  37. package/bin/chat/types/ChannelConfiguration.d.ts +2 -2
  38. package/bin/chat/types/FeishuPost.d.ts +1 -1
  39. package/bin/chat/types/FeishuPost.js +1 -1
  40. package/package.json +2 -2
  41. package/src/auth/Plugin.ts +2 -2
  42. package/src/chat/accounts/ChannelAccountManager.ts +6 -6
  43. package/src/chat/accounts/Crypto.ts +1 -1
  44. package/src/chat/accounts/Store.ts +13 -13
  45. package/src/chat/channels/feishu/Configuration.ts +5 -5
  46. package/src/chat/channels/qq/Configuration.ts +5 -5
  47. package/src/chat/channels/telegram/BotInfo.ts +1 -1
  48. package/src/chat/channels/telegram/Configuration.ts +5 -5
  49. package/src/chat/runtime/ChatChannelCore.ts +1 -1
  50. package/src/chat/runtime/ChatChannelLifecycle.ts +1 -1
  51. package/src/chat/runtime/ChatPluginSystem.ts +2 -2
  52. package/src/chat/runtime/ChatPromptAssets.ts +1 -1
  53. package/src/chat/runtime/ChatQueueWorker.ts +12 -39
  54. package/src/chat/types/BotInfo.ts +2 -2
  55. package/src/chat/types/ChannelAccount.ts +12 -12
  56. package/src/chat/types/ChannelConfiguration.ts +2 -3
  57. package/src/chat/types/FeishuPost.ts +1 -1
@@ -44,7 +44,6 @@ type TurnObservation = {
44
44
  turnId: string;
45
45
  sessionId: string;
46
46
  messageId?: string;
47
- assistantStepDispatched: boolean;
48
47
  typing: { stop: () => void };
49
48
  };
50
49
 
@@ -342,13 +341,18 @@ export class ChatQueueWorker {
342
341
  if (event.visibility === "internal") return;
343
342
  const stepText = String(event.text || "").trim();
344
343
  if (!stepText) return;
345
- const dispatched = await this.dispatchAssistantStepMessage({
346
- sessionId: observation.sessionId,
347
- text: stepText,
348
- messageId: observation.messageId,
349
- });
350
- if (dispatched) {
351
- observation.assistantStepDispatched = true;
344
+
345
+ try {
346
+ await this.dispatchAssistantStepMessage({
347
+ sessionId: observation.sessionId,
348
+ text: stepText,
349
+ messageId: observation.messageId,
350
+ });
351
+ } catch (error) {
352
+ this.logger.warn("ChatQueueWorker assistant step dispatch failed", {
353
+ sessionId: observation.sessionId,
354
+ error: String(error),
355
+ });
352
356
  }
353
357
  }
354
358
 
@@ -369,7 +373,6 @@ export class ChatQueueWorker {
369
373
  turnId: turn.id,
370
374
  sessionId: item.sessionId,
371
375
  messageId: item.messageId,
372
- assistantStepDispatched: false,
373
376
  typing: this.startTypingHeartbeat(item),
374
377
  };
375
378
  params.lane.turnObservers.set(turn.id, observation);
@@ -437,36 +440,6 @@ export class ChatQueueWorker {
437
440
  });
438
441
  return;
439
442
  }
440
-
441
- if (observation.assistantStepDispatched) {
442
- return;
443
- }
444
-
445
- const finalAssistantText =
446
- pickLastSuccessfulChatSendText(result.assistantMessage) || result.text;
447
- if (!finalAssistantText) {
448
- return;
449
- }
450
-
451
- const dispatchedDirectly = await dispatchAssistantTextDirect({
452
- logger: this.logger,
453
- context: this.context,
454
- sessionId: observation.sessionId,
455
- assistantText: finalAssistantText,
456
- phase: "final",
457
- });
458
- if (dispatchedDirectly) {
459
- return;
460
- }
461
-
462
- await dispatchTextToChannel({
463
- logger: this.logger,
464
- context: this.context,
465
- sessionId: observation.sessionId,
466
- text: finalAssistantText,
467
- messageId: observation.messageId,
468
- phase: "final",
469
- });
470
443
  }
471
444
 
472
445
  /**
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * 关键点(中文)
5
5
  * - 将“凭据 -> bot 基础信息”的探测输入输出结构标准化。
6
- * - Console、Channel Account 存储、后续自动化流程都复用该结构。
6
+ * - Console、Chat Account 存储、后续自动化流程都复用该结构。
7
7
  */
8
8
 
9
9
  import type { ChatChannelName } from "@/chat/types/ChannelStatus.js";
@@ -77,7 +77,7 @@ export interface ChatBotInfoResult {
77
77
  */
78
78
  botUserId?: string;
79
79
  /**
80
- * 建议用于生成 channel account id 的稳定种子。
80
+ * 建议用于生成 chat account id 的稳定种子。
81
81
  */
82
82
  idSeed?: string;
83
83
  /**
@@ -1,24 +1,24 @@
1
1
  /**
2
- * Chat channel account 管理类型。
2
+ * Chat account 管理类型。
3
3
  *
4
4
  * 关键点(中文)
5
- * - 这些类型描述 agent 运行时内部的 chat channel account 管理输入输出。
5
+ * - 这些类型描述 agent 运行时内部的 chat account 管理输入输出。
6
6
  * - 凭据明文只允许出现在写入输入中,读取结果必须是脱敏后的安全视图。
7
7
  */
8
8
 
9
9
  import type { StoredChannelAccountChannel } from "@downcity/agent/internal/types/platform/Store.js";
10
10
 
11
11
  /**
12
- * 支持的 chat channel account 类型。
12
+ * 支持的 chat account 平台类型。
13
13
  */
14
14
  export type ChatChannelAccountChannel = StoredChannelAccountChannel;
15
15
 
16
16
  /**
17
- * Channel account 探测结果。
17
+ * Chat account 探测结果。
18
18
  */
19
19
  export interface ChatChannelAccountProbeResult {
20
20
  /**
21
- * 账号所属 chat channel
21
+ * 账号所属 chat platform
22
22
  */
23
23
  channel: ChatChannelAccountChannel;
24
24
  /**
@@ -52,7 +52,7 @@ export interface ChatChannelAccountProbeResult {
52
52
  }
53
53
 
54
54
  /**
55
- * Channel account 列表中的安全视图。
55
+ * Chat account 列表中的安全视图。
56
56
  */
57
57
  export interface ChatChannelAccountListItem {
58
58
  /**
@@ -60,7 +60,7 @@ export interface ChatChannelAccountListItem {
60
60
  */
61
61
  id: string;
62
62
  /**
63
- * 账号所属 chat channel
63
+ * 账号所属 chat platform
64
64
  */
65
65
  channel: ChatChannelAccountChannel;
66
66
  /**
@@ -122,7 +122,7 @@ export interface ChatChannelAccountListItem {
122
122
  }
123
123
 
124
124
  /**
125
- * Channel account 列表结果。
125
+ * Chat account 列表结果。
126
126
  */
127
127
  export interface ChatChannelAccountListResult {
128
128
  /**
@@ -132,7 +132,7 @@ export interface ChatChannelAccountListResult {
132
132
  }
133
133
 
134
134
  /**
135
- * Channel account 写入输入。
135
+ * Chat account 写入输入。
136
136
  */
137
137
  export interface ChatChannelAccountUpsertInput {
138
138
  /**
@@ -140,7 +140,7 @@ export interface ChatChannelAccountUpsertInput {
140
140
  */
141
141
  id: string;
142
142
  /**
143
- * 账号所属 chat channel
143
+ * 账号所属 chat platform
144
144
  */
145
145
  channel: string;
146
146
  /**
@@ -194,11 +194,11 @@ export interface ChatChannelAccountUpsertInput {
194
194
  }
195
195
 
196
196
  /**
197
- * Channel account 凭据创建输入。
197
+ * Chat account 凭据创建输入。
198
198
  */
199
199
  export interface ChatChannelAccountCreateInput {
200
200
  /**
201
- * 账号所属 chat channel
201
+ * 账号所属 chat platform
202
202
  */
203
203
  channel: string;
204
204
  /**
@@ -70,7 +70,7 @@ export interface ChatChannelConfigurationField {
70
70
  */
71
71
  type: ChatChannelConfigurationFieldType;
72
72
  /**
73
- * 字段值来源(downcity.json / channel account / env fallback)。
73
+ * 字段值来源(downcity.json / chat account / env fallback)。
74
74
  */
75
75
  source: ChatChannelConfigurationFieldSource;
76
76
  /**
@@ -132,7 +132,7 @@ export interface ChatChannelConfigurationDescriptor {
132
132
  */
133
133
  canToggleEnabled: boolean;
134
134
  /**
135
- * 是否支持 channel account 绑定。
135
+ * 是否支持 chat account 绑定。
136
136
  */
137
137
  canBindChannelAccount: boolean;
138
138
  /**
@@ -158,4 +158,3 @@ export interface ChatChannelConfigurationDescriptor {
158
158
  envFallback: ChatChannelConfigurationField[];
159
159
  };
160
160
  }
161
-
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * 关键点(中文)
5
5
  * - 统一描述飞书 `msg_type=post` 的核心结构,供入站解析与出站构建复用。
6
- * - 这里只保留当前 chat channel 真正会消费的字段,避免把平台超大 schema 整体引入运行时。
6
+ * - 这里只保留当前 chat platform 真正会消费的字段,避免把平台超大 schema 整体引入运行时。
7
7
  */
8
8
 
9
9
  /**