@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.
- package/bin/auth/Plugin.js +2 -2
- package/bin/auth/Plugin.js.map +1 -1
- package/bin/chat/accounts/ChannelAccountManager.d.ts +3 -3
- package/bin/chat/accounts/ChannelAccountManager.js +6 -6
- package/bin/chat/accounts/ChannelAccountManager.js.map +1 -1
- package/bin/chat/accounts/Crypto.d.ts +1 -1
- package/bin/chat/accounts/Crypto.js +1 -1
- package/bin/chat/accounts/Store.d.ts +8 -8
- package/bin/chat/accounts/Store.js +13 -13
- package/bin/chat/accounts/Store.js.map +1 -1
- package/bin/chat/channels/feishu/Configuration.d.ts +1 -1
- package/bin/chat/channels/feishu/Configuration.js +5 -5
- package/bin/chat/channels/feishu/Configuration.js.map +1 -1
- package/bin/chat/channels/qq/Configuration.d.ts +1 -1
- package/bin/chat/channels/qq/Configuration.js +5 -5
- package/bin/chat/channels/qq/Configuration.js.map +1 -1
- package/bin/chat/channels/telegram/BotInfo.d.ts +1 -1
- package/bin/chat/channels/telegram/BotInfo.js +1 -1
- package/bin/chat/channels/telegram/Configuration.d.ts +1 -1
- package/bin/chat/channels/telegram/Configuration.js +5 -5
- package/bin/chat/channels/telegram/Configuration.js.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.d.ts +1 -1
- package/bin/chat/runtime/ChatChannelCore.js +1 -1
- package/bin/chat/runtime/ChatChannelLifecycle.js +1 -1
- package/bin/chat/runtime/ChatChannelLifecycle.js.map +1 -1
- package/bin/chat/runtime/ChatPluginSystem.d.ts +2 -2
- package/bin/chat/runtime/ChatPluginSystem.js +1 -1
- package/bin/chat/runtime/ChatPromptAssets.d.ts +1 -1
- package/bin/chat/runtime/ChatPromptAssets.js +1 -1
- package/bin/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.js +12 -33
- package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
- package/bin/chat/types/BotInfo.d.ts +2 -2
- package/bin/chat/types/BotInfo.js +1 -1
- package/bin/chat/types/ChannelAccount.d.ts +12 -12
- package/bin/chat/types/ChannelAccount.js +2 -2
- package/bin/chat/types/ChannelConfiguration.d.ts +2 -2
- package/bin/chat/types/FeishuPost.d.ts +1 -1
- package/bin/chat/types/FeishuPost.js +1 -1
- package/package.json +2 -2
- package/src/auth/Plugin.ts +2 -2
- package/src/chat/accounts/ChannelAccountManager.ts +6 -6
- package/src/chat/accounts/Crypto.ts +1 -1
- package/src/chat/accounts/Store.ts +13 -13
- package/src/chat/channels/feishu/Configuration.ts +5 -5
- package/src/chat/channels/qq/Configuration.ts +5 -5
- package/src/chat/channels/telegram/BotInfo.ts +1 -1
- package/src/chat/channels/telegram/Configuration.ts +5 -5
- package/src/chat/runtime/ChatChannelCore.ts +1 -1
- package/src/chat/runtime/ChatChannelLifecycle.ts +1 -1
- package/src/chat/runtime/ChatPluginSystem.ts +2 -2
- package/src/chat/runtime/ChatPromptAssets.ts +1 -1
- package/src/chat/runtime/ChatQueueWorker.ts +12 -39
- package/src/chat/types/BotInfo.ts +2 -2
- package/src/chat/types/ChannelAccount.ts +12 -12
- package/src/chat/types/ChannelConfiguration.ts +2 -3
- 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
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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、
|
|
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
|
-
* 建议用于生成
|
|
80
|
+
* 建议用于生成 chat account id 的稳定种子。
|
|
81
81
|
*/
|
|
82
82
|
idSeed?: string;
|
|
83
83
|
/**
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Chat
|
|
2
|
+
* Chat account 管理类型。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - 这些类型描述 agent 运行时内部的 chat
|
|
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
|
|
12
|
+
* 支持的 chat account 平台类型。
|
|
13
13
|
*/
|
|
14
14
|
export type ChatChannelAccountChannel = StoredChannelAccountChannel;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Chat account 探测结果。
|
|
18
18
|
*/
|
|
19
19
|
export interface ChatChannelAccountProbeResult {
|
|
20
20
|
/**
|
|
21
|
-
* 账号所属 chat
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
197
|
+
* Chat account 凭据创建输入。
|
|
198
198
|
*/
|
|
199
199
|
export interface ChatChannelAccountCreateInput {
|
|
200
200
|
/**
|
|
201
|
-
* 账号所属 chat
|
|
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 /
|
|
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
|
-
* 是否支持
|
|
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
|
-
|