@downcity/plugins 1.0.145 → 1.0.148
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/asr/Plugin.js +8 -8
- package/bin/asr/Plugin.js.map +1 -1
- package/bin/auth/types/AuthPlugin.js +3 -3
- package/bin/auth/types/AuthPlugin.js.map +1 -1
- package/bin/chat/PROMPT.direct.d.ts +1 -1
- package/bin/chat/PROMPT.direct.d.ts.map +1 -1
- package/bin/chat/PROMPT.direct.js +1 -1
- package/bin/chat/PROMPT.direct.js.map +1 -1
- package/bin/chat/channels/feishu/PROMPT.direct.d.ts +1 -1
- package/bin/chat/channels/feishu/PROMPT.direct.d.ts.map +1 -1
- package/bin/chat/channels/feishu/PROMPT.direct.js +1 -1
- package/bin/chat/channels/feishu/PROMPT.direct.js.map +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.d.ts +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.d.ts.map +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.js +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.js.map +1 -1
- package/bin/chat/runtime/ChatAuthorizationRuntime.js +5 -5
- package/bin/chat/runtime/ChatAuthorizationRuntime.js.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.js +61 -61
- package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
- package/bin/chat/runtime/ChatSessionContextComposer.d.ts +2 -2
- package/bin/chat/runtime/ChatSessionContextComposer.d.ts.map +1 -1
- package/bin/chat/runtime/ChatSessionTypes.d.ts +1 -1
- package/bin/chat/runtime/ChatSessionTypes.d.ts.map +1 -1
- package/bin/contact/Action.js +48 -48
- package/bin/contact/Action.js.map +1 -1
- package/bin/contact/PROMPT.d.ts +1 -1
- package/bin/contact/PROMPT.d.ts.map +1 -1
- package/bin/contact/PROMPT.js +1 -1
- package/bin/contact/PROMPT.js.map +1 -1
- package/bin/contact/runtime/ChatRuntime.js.map +1 -1
- package/bin/image/ImagePlugin.js +21 -21
- package/bin/image/ImagePlugin.js.map +1 -1
- package/bin/memory/Action.js +2 -2
- package/bin/memory/Action.js.map +1 -1
- package/bin/memory/MemoryPlugin.js +50 -50
- package/bin/memory/MemoryPlugin.js.map +1 -1
- package/bin/skill/PROMPT.d.ts +1 -1
- package/bin/skill/PROMPT.d.ts.map +1 -1
- package/bin/skill/PROMPT.js +1 -1
- package/bin/skill/PROMPT.js.map +1 -1
- package/bin/skill/Plugin.js +23 -23
- package/bin/skill/Plugin.js.map +1 -1
- package/bin/task/Action.js +1 -1
- package/bin/task/Action.js.map +1 -1
- package/bin/task/PROMPT.d.ts +1 -1
- package/bin/task/PROMPT.d.ts.map +1 -1
- package/bin/task/PROMPT.js +1 -1
- package/bin/task/PROMPT.js.map +1 -1
- package/bin/task/runtime/Runner.js +2 -2
- package/bin/task/runtime/Runner.js.map +1 -1
- package/bin/task/runtime/TaskPluginActionRegistry.js +73 -73
- package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
- package/bin/task/runtime/TaskRunnerProgress.js +1 -1
- package/bin/task/runtime/TaskRunnerProgress.js.map +1 -1
- package/bin/task/runtime/TaskRunnerScript.js +3 -3
- package/bin/task/runtime/TaskRunnerScript.js.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.js +3 -3
- package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
- package/bin/tts/Plugin.js +7 -7
- package/bin/tts/Plugin.js.map +1 -1
- package/bin/web/PROMPT.d.ts +1 -1
- package/bin/web/PROMPT.d.ts.map +1 -1
- package/bin/web/PROMPT.js +1 -1
- package/bin/web/PROMPT.js.map +1 -1
- package/bin/web/Plugin.js +8 -8
- package/bin/web/Plugin.js.map +1 -1
- package/bin/workboard/Plugin.js +2 -2
- package/bin/workboard/Plugin.js.map +1 -1
- package/bin/workboard/runtime/Normalizer.js +1 -1
- package/bin/workboard/runtime/Normalizer.js.map +1 -1
- package/package.json +3 -3
- package/src/asr/Plugin.ts +8 -8
- package/src/auth/types/AuthPlugin.ts +3 -3
- package/src/chat/PROMPT.direct.ts +1 -1
- package/src/chat/PROMPT.direct.ts.txt +32 -32
- package/src/chat/channels/feishu/PROMPT.direct.ts +1 -1
- package/src/chat/channels/feishu/PROMPT.direct.ts.txt +2 -2
- package/src/chat/channels/qq/PROMPT.direct.ts +1 -1
- package/src/chat/channels/qq/PROMPT.direct.ts.txt +11 -9
- package/src/chat/runtime/ChatAuthorizationRuntime.ts +5 -5
- package/src/chat/runtime/ChatPluginActionRegistry.ts +61 -61
- package/src/chat/runtime/ChatSessionContextComposer.ts +2 -2
- package/src/chat/runtime/ChatSessionTypes.ts +1 -1
- package/src/contact/Action.ts +48 -48
- package/src/contact/PROMPT.ts +1 -1
- package/src/contact/PROMPT.ts.txt +22 -22
- package/src/contact/runtime/ChatRuntime.ts +2 -2
- package/src/image/ImagePlugin.ts +21 -21
- package/src/memory/Action.ts +2 -2
- package/src/memory/MemoryPlugin.ts +50 -50
- package/src/skill/PROMPT.ts +1 -1
- package/src/skill/PROMPT.ts.txt +5 -6
- package/src/skill/Plugin.ts +23 -23
- package/src/task/Action.ts +1 -1
- package/src/task/PROMPT.ts +1 -1
- package/src/task/PROMPT.ts.txt +159 -159
- package/src/task/runtime/Runner.ts +2 -2
- package/src/task/runtime/TaskPluginActionRegistry.ts +73 -73
- package/src/task/runtime/TaskRunnerProgress.ts +1 -1
- package/src/task/runtime/TaskRunnerScript.ts +3 -3
- package/src/task/runtime/TaskRunnerSession.ts +3 -3
- package/src/tts/Plugin.ts +7 -7
- package/src/web/PROMPT.ts +1 -1
- package/src/web/PROMPT.ts.txt +31 -31
- package/src/web/Plugin.ts +8 -8
- package/src/workboard/Plugin.ts +2 -2
- package/src/workboard/runtime/Normalizer.ts +1 -1
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
# Chat Plugin
|
|
1
|
+
# Chat Plugin Instructions
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## User-Visible Reply Rules
|
|
4
4
|
|
|
5
|
-
-
|
|
5
|
+
- In the current mode, your direct assistant output is sent as a message to the user's corresponding channel.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Output Protocol
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- For a normal reply, output plain text directly. Optional frontmatter metadata may appear at the very top of the text. Field semantics match the chat plugin direct-send protocol:
|
|
10
10
|
|
|
11
|
-
- `delay` / `delayMs
|
|
12
|
-
- `time` / `sendAt` / `sendAtMs
|
|
13
|
-
- `reply
|
|
14
|
-
- `messageId
|
|
15
|
-
- `react
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
11
|
+
- `delay` / `delayMs`: delay before sending, in milliseconds.
|
|
12
|
+
- `time` / `sendAt` / `sendAtMs`: scheduled send time.
|
|
13
|
+
- `reply`: whether to send with reply semantics.
|
|
14
|
+
- `messageId`: target `message_id`, recommended for group chats.
|
|
15
|
+
- `react`: send an emoji reaction.
|
|
16
|
+
- Single string: `react: "thumbs up"`
|
|
17
|
+
- Or an object/array: `emoji/big`
|
|
18
|
+
- When `messageId` is set, `react` reuses that message as the target first.
|
|
19
|
+
- Attachments use `<file type="...">path</file>` and support `document/photo/voice/audio/video`.
|
|
20
|
+
- Attachment paths must be relative paths accessible inside the project. For multiple attachments, output multiple `<file>` tags.
|
|
21
21
|
|
|
22
|
-
###
|
|
22
|
+
### Example
|
|
23
23
|
|
|
24
24
|
```text
|
|
25
25
|
---
|
|
26
26
|
reply: true
|
|
27
27
|
messageId: "128"
|
|
28
28
|
react:
|
|
29
|
-
- emoji: "
|
|
29
|
+
- emoji: "done"
|
|
30
30
|
---
|
|
31
|
-
|
|
31
|
+
Here is today's report.
|
|
32
32
|
<file type="document">reports/daily.md</file>
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
###
|
|
35
|
+
### Protocol Constraints
|
|
36
36
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
37
|
+
- Frontmatter must be at the very beginning of the text and wrapped with `---`.
|
|
38
|
+
- Except for `<file>` attachment tags, do not use angle-bracket syntax for control parameters.
|
|
39
39
|
|
|
40
|
-
##
|
|
40
|
+
## Cross-Protocol Or Cross-Platform Operations
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
42
|
+
- For replies inside the current conversation, prefer outputting text directly. The system will send it to the current channel automatically.
|
|
43
|
+
- When a task needs cross-conversation, cross-platform, or complex routing, use chat plugin actions.
|
|
44
|
+
- If `plugin_call` is available, call `plugin_call({ plugin: "chat", action: "send", payload })` or `plugin_call({ plugin: "chat", action: "react", payload })`.
|
|
45
|
+
- Metadata applies only to direct outbound messages in the current conversation. Do not use metadata for cross-chat routing.
|
|
46
|
+
- If cross-chat routing parameters are unclear, first read the current chat context or call chat plugin query actions instead of guessing.
|
|
47
47
|
|
|
48
|
-
##
|
|
48
|
+
## Inbound Message Structure
|
|
49
49
|
|
|
50
|
-
-
|
|
51
|
-
- `<info>`
|
|
52
|
-
-
|
|
53
|
-
- `<info>`
|
|
50
|
+
- Each queued user message contains an `<info>...</info>` metadata block plus the user text.
|
|
51
|
+
- `<info>` keeps only user/request metadata such as `user_id`, `username`, `message_id`, `permissions`, and `received_at`.
|
|
52
|
+
- The current chat routing environment, such as `channel`, `session_id`, `chat_key`, and `chat_id`, is injected separately through the system prompt and is no longer mixed into `<info>`.
|
|
53
|
+
- Do not echo `<info>` back to the user.
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Source: src/chat/channels/feishu/PROMPT.direct.ts.txt
|
|
7
|
-
const TEXT_MODULE_CONTENT = "# Feishu Channel\n\n##
|
|
7
|
+
const TEXT_MODULE_CONTENT = "# Feishu Channel\n\n## Usage Constraints\n\n- Your direct output is automatically sent to the current Feishu conversation.\n";
|
|
8
8
|
|
|
9
9
|
export default TEXT_MODULE_CONTENT;
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Source: src/chat/channels/qq/PROMPT.direct.ts.txt
|
|
7
|
-
const TEXT_MODULE_CONTENT = "# QQ Adapter
|
|
7
|
+
const TEXT_MODULE_CONTENT = "# QQ Adapter Instructions (Direct Mode)\n\n## Capability Scope\n\n- Handles message ingress and sending for the official QQ bot gateway over WebSocket.\n- Inbound messages are mapped by the chat plugin runtime to an internal `sessionId`, which is randomly assigned and persisted.\n\n## Usage Constraints\n\n- In direct mode, your assistant text output is automatically sent to the current QQ conversation.\n- QQ outbound replies depend on inbound message context such as `chatType` and `messageId`. For cross-conversation sending, use chat plugin actions instead of writing `chatKey` in direct metadata.\n- Group messages are ingested in full by default and do not require an `@` mention.\n- The adapter filters bot self-loop messages and deduplicates inbound messages to avoid \"replying to itself\" loops.\n";
|
|
8
8
|
|
|
9
9
|
export default TEXT_MODULE_CONTENT;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
# QQ Adapter
|
|
1
|
+
# QQ Adapter Instructions (Direct Mode)
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
- 负责 QQ 官方机器人网关(WebSocket)消息接入与发送。
|
|
5
|
-
- 入站消息会由 chat plugin runtime 映射到内部 `sessionId`(随机分配并持久化)。
|
|
3
|
+
## Capability Scope
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
- Handles message ingress and sending for the official QQ bot gateway over WebSocket.
|
|
6
|
+
- Inbound messages are mapped by the chat plugin runtime to an internal `sessionId`, which is randomly assigned and persisted.
|
|
7
|
+
|
|
8
|
+
## Usage Constraints
|
|
9
|
+
|
|
10
|
+
- In direct mode, your assistant text output is automatically sent to the current QQ conversation.
|
|
11
|
+
- QQ outbound replies depend on inbound message context such as `chatType` and `messageId`. For cross-conversation sending, use chat plugin actions instead of writing `chatKey` in direct metadata.
|
|
12
|
+
- Group messages are ingested in full by default and do not require an `@` mention.
|
|
13
|
+
- The adapter filters bot self-loop messages and deduplicates inbound messages to avoid "replying to itself" loops.
|
|
@@ -165,7 +165,7 @@ export function createChatAuthorizationResolves(): PluginResolves {
|
|
|
165
165
|
export function createChatAuthorizationActions(): PluginActions {
|
|
166
166
|
return {
|
|
167
167
|
[CHAT_AUTHORIZATION_ACTIONS.snapshot]: createAction({
|
|
168
|
-
description: "
|
|
168
|
+
description: "Read chat authorization snapshot (catalog/config/users/chats).",
|
|
169
169
|
input_schema: {
|
|
170
170
|
zod: z.object({}).passthrough(),
|
|
171
171
|
json_schema: { type: "object", properties: {} },
|
|
@@ -181,7 +181,7 @@ export function createChatAuthorizationActions(): PluginActions {
|
|
|
181
181
|
},
|
|
182
182
|
}),
|
|
183
183
|
[CHAT_AUTHORIZATION_ACTIONS.readConfig]: createAction({
|
|
184
|
-
description: "
|
|
184
|
+
description: "Read current chat authorization config.",
|
|
185
185
|
input_schema: {
|
|
186
186
|
zod: z.object({}).passthrough(),
|
|
187
187
|
json_schema: { type: "object", properties: {} },
|
|
@@ -194,7 +194,7 @@ export function createChatAuthorizationActions(): PluginActions {
|
|
|
194
194
|
},
|
|
195
195
|
}),
|
|
196
196
|
[CHAT_AUTHORIZATION_ACTIONS.writeConfig]: createAction({
|
|
197
|
-
description: "
|
|
197
|
+
description: "Write chat authorization config as a full replacement.",
|
|
198
198
|
input_schema: {
|
|
199
199
|
zod: z.object({
|
|
200
200
|
config: z.record(z.string(), z.unknown()).optional(),
|
|
@@ -202,7 +202,7 @@ export function createChatAuthorizationActions(): PluginActions {
|
|
|
202
202
|
json_schema: {
|
|
203
203
|
type: "object",
|
|
204
204
|
properties: {
|
|
205
|
-
config: { type: "object", description: "
|
|
205
|
+
config: { type: "object", description: "Authorization config." },
|
|
206
206
|
},
|
|
207
207
|
},
|
|
208
208
|
},
|
|
@@ -225,7 +225,7 @@ export function createChatAuthorizationActions(): PluginActions {
|
|
|
225
225
|
},
|
|
226
226
|
}),
|
|
227
227
|
[CHAT_AUTHORIZATION_ACTIONS.setUserRole]: createAction({
|
|
228
|
-
description: "
|
|
228
|
+
description: "Set the role for a channel user.",
|
|
229
229
|
input_schema: {
|
|
230
230
|
zod: z.object({
|
|
231
231
|
channel: z.enum(["telegram", "feishu", "qq"]),
|
|
@@ -104,15 +104,15 @@ export function createChatPluginActions(params: {
|
|
|
104
104
|
}): PluginActions {
|
|
105
105
|
return {
|
|
106
106
|
status: createAction({
|
|
107
|
-
description: "
|
|
107
|
+
description: "View chat channel connection status.",
|
|
108
108
|
input_schema: {
|
|
109
109
|
zod: z.object({}).passthrough(),
|
|
110
110
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
111
111
|
},
|
|
112
112
|
command: {
|
|
113
|
-
description: "
|
|
113
|
+
description: "View chat channel connection status.",
|
|
114
114
|
configure(command: Command) {
|
|
115
|
-
command.option("--channel <name>", "
|
|
115
|
+
command.option("--channel <name>", "Specify channel (telegram|feishu|qq).");
|
|
116
116
|
},
|
|
117
117
|
mapInput: mapChatChannelCommandInput,
|
|
118
118
|
},
|
|
@@ -125,15 +125,15 @@ export function createChatPluginActions(params: {
|
|
|
125
125
|
},
|
|
126
126
|
}),
|
|
127
127
|
test: createAction({
|
|
128
|
-
description: "
|
|
128
|
+
description: "Test chat channel connectivity.",
|
|
129
129
|
input_schema: {
|
|
130
130
|
zod: z.object({}).passthrough(),
|
|
131
131
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
132
132
|
},
|
|
133
133
|
command: {
|
|
134
|
-
description: "
|
|
134
|
+
description: "Test chat channel connectivity.",
|
|
135
135
|
configure(command: Command) {
|
|
136
|
-
command.option("--channel <name>", "
|
|
136
|
+
command.option("--channel <name>", "Specify channel (telegram|feishu|qq).");
|
|
137
137
|
},
|
|
138
138
|
mapInput: mapChatChannelCommandInput,
|
|
139
139
|
},
|
|
@@ -146,15 +146,15 @@ export function createChatPluginActions(params: {
|
|
|
146
146
|
},
|
|
147
147
|
}),
|
|
148
148
|
reconnect: createAction({
|
|
149
|
-
description: "
|
|
149
|
+
description: "Reconnect chat channels, all by default.",
|
|
150
150
|
input_schema: {
|
|
151
151
|
zod: z.object({}).passthrough(),
|
|
152
152
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
153
153
|
},
|
|
154
154
|
command: {
|
|
155
|
-
description: "
|
|
155
|
+
description: "Reconnect chat channels, all by default.",
|
|
156
156
|
configure(command: Command) {
|
|
157
|
-
command.option("--channel <name>", "
|
|
157
|
+
command.option("--channel <name>", "Specify channel (telegram|feishu|qq).");
|
|
158
158
|
},
|
|
159
159
|
mapInput: mapChatChannelCommandInput,
|
|
160
160
|
},
|
|
@@ -167,15 +167,15 @@ export function createChatPluginActions(params: {
|
|
|
167
167
|
},
|
|
168
168
|
}),
|
|
169
169
|
open: createAction({
|
|
170
|
-
description: "
|
|
170
|
+
description: "Open and enable the specified chat channel.",
|
|
171
171
|
input_schema: {
|
|
172
172
|
zod: z.object({}).passthrough(),
|
|
173
173
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
174
174
|
},
|
|
175
175
|
command: {
|
|
176
|
-
description: "
|
|
176
|
+
description: "Open chat channel (enabled=true, and start it if configured).",
|
|
177
177
|
configure(command: Command) {
|
|
178
|
-
command.option("--channel <name>", "
|
|
178
|
+
command.option("--channel <name>", "Specify channel (telegram|feishu|qq).");
|
|
179
179
|
},
|
|
180
180
|
mapInput: mapChatChannelCommandInput,
|
|
181
181
|
},
|
|
@@ -188,15 +188,15 @@ export function createChatPluginActions(params: {
|
|
|
188
188
|
},
|
|
189
189
|
}),
|
|
190
190
|
close: createAction({
|
|
191
|
-
description: "
|
|
191
|
+
description: "Close and disable the specified chat channel.",
|
|
192
192
|
input_schema: {
|
|
193
193
|
zod: z.object({}).passthrough(),
|
|
194
194
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
195
195
|
},
|
|
196
196
|
command: {
|
|
197
|
-
description: "
|
|
197
|
+
description: "Close chat channel (enabled=false and stop runtime).",
|
|
198
198
|
configure(command: Command) {
|
|
199
|
-
command.option("--channel <name>", "
|
|
199
|
+
command.option("--channel <name>", "Specify channel (telegram|feishu|qq).");
|
|
200
200
|
},
|
|
201
201
|
mapInput: mapChatChannelCommandInput,
|
|
202
202
|
},
|
|
@@ -209,15 +209,15 @@ export function createChatPluginActions(params: {
|
|
|
209
209
|
},
|
|
210
210
|
}),
|
|
211
211
|
configuration: createAction({
|
|
212
|
-
description: "
|
|
212
|
+
description: "View chat channel configuration metadata.",
|
|
213
213
|
input_schema: {
|
|
214
214
|
zod: z.object({}).passthrough(),
|
|
215
215
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
216
216
|
},
|
|
217
217
|
command: {
|
|
218
|
-
description: "
|
|
218
|
+
description: "View chat channel configuration metadata (fields, types, descriptions).",
|
|
219
219
|
configure(command: Command) {
|
|
220
|
-
command.option("--channel <name>", "
|
|
220
|
+
command.option("--channel <name>", "Specify channel (telegram|feishu|qq).");
|
|
221
221
|
},
|
|
222
222
|
mapInput: mapChatChannelCommandInput,
|
|
223
223
|
},
|
|
@@ -229,21 +229,21 @@ export function createChatPluginActions(params: {
|
|
|
229
229
|
},
|
|
230
230
|
}),
|
|
231
231
|
configure: createAction({
|
|
232
|
-
description: "
|
|
232
|
+
description: "Update runtime parameters for a chat channel.",
|
|
233
233
|
input_schema: {
|
|
234
234
|
zod: z.object({}).passthrough(),
|
|
235
235
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
236
236
|
},
|
|
237
237
|
command: {
|
|
238
|
-
description: "
|
|
238
|
+
description: "Update runtime parameters for a chat channel, optionally restarting it immediately.",
|
|
239
239
|
configure(command: Command) {
|
|
240
240
|
command
|
|
241
|
-
.requiredOption("--channel <name>", "
|
|
241
|
+
.requiredOption("--channel <name>", "Specify channel (telegram|feishu|qq).")
|
|
242
242
|
.requiredOption(
|
|
243
243
|
"--config-json <json>",
|
|
244
|
-
"
|
|
244
|
+
"Configuration patch JSON, for example '{\"channelAccountId\":\"qq-main\",\"enabled\":true}'.",
|
|
245
245
|
)
|
|
246
|
-
.option("--restart", "
|
|
246
|
+
.option("--restart", "Restart the channel immediately after configuration.", false);
|
|
247
247
|
},
|
|
248
248
|
mapInput: mapChatConfigureCommandInput,
|
|
249
249
|
},
|
|
@@ -256,18 +256,18 @@ export function createChatPluginActions(params: {
|
|
|
256
256
|
},
|
|
257
257
|
}),
|
|
258
258
|
list: createAction({
|
|
259
|
-
description: "
|
|
259
|
+
description: "List chat conversations recorded by the current agent.",
|
|
260
260
|
input_schema: {
|
|
261
261
|
zod: z.object({}).passthrough(),
|
|
262
262
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
263
263
|
},
|
|
264
264
|
command: {
|
|
265
|
-
description: "
|
|
265
|
+
description: "List chat conversations recorded by the current agent (chatTitle/chatKey).",
|
|
266
266
|
configure(command: Command) {
|
|
267
267
|
command
|
|
268
|
-
.option("--channel <name>", "
|
|
269
|
-
.option("--limit <n>", "
|
|
270
|
-
.option("--q <text>", "
|
|
268
|
+
.option("--channel <name>", "Filter by channel (telegram|feishu|qq).")
|
|
269
|
+
.option("--limit <n>", "Return the latest N records, default 50.")
|
|
270
|
+
.option("--q <text>", "Keyword filter (title/chatId/sessionId/actor).");
|
|
271
271
|
},
|
|
272
272
|
mapInput: mapChatListCommandInput,
|
|
273
273
|
},
|
|
@@ -279,17 +279,17 @@ export function createChatPluginActions(params: {
|
|
|
279
279
|
},
|
|
280
280
|
}),
|
|
281
281
|
info: createAction({
|
|
282
|
-
description: "
|
|
282
|
+
description: "View route, paths, and context snapshot for a specified chat conversation.",
|
|
283
283
|
input_schema: {
|
|
284
284
|
zod: z.object({}).passthrough(),
|
|
285
285
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
286
286
|
},
|
|
287
287
|
command: {
|
|
288
|
-
description: "
|
|
288
|
+
description: "View specified chat conversation info (route/local paths/context snapshot).",
|
|
289
289
|
configure(command: Command) {
|
|
290
290
|
command
|
|
291
|
-
.option("--chat-key <chatKey>", "
|
|
292
|
-
.option("--session-id <sessionId>", "
|
|
291
|
+
.option("--chat-key <chatKey>", "Target chatKey; reads DC_CTX_CHAT_KEY if omitted.")
|
|
292
|
+
.option("--session-id <sessionId>", "Explicit sessionId, with higher priority.");
|
|
293
293
|
},
|
|
294
294
|
mapInput: mapChatInfoCommandInput,
|
|
295
295
|
},
|
|
@@ -301,23 +301,23 @@ export function createChatPluginActions(params: {
|
|
|
301
301
|
},
|
|
302
302
|
}),
|
|
303
303
|
send: createAction({
|
|
304
|
-
description: "
|
|
304
|
+
description: "Send a message to the target chatKey, supporting text, attachments, and delay.",
|
|
305
305
|
input_schema: {
|
|
306
306
|
zod: z.object({}).passthrough(),
|
|
307
307
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
308
308
|
},
|
|
309
309
|
command: {
|
|
310
|
-
description: "
|
|
310
|
+
description: "Send a message to the target chatKey.",
|
|
311
311
|
configure(command: Command) {
|
|
312
312
|
command
|
|
313
|
-
.option("--text <text>", "
|
|
314
|
-
.option("--stdin", "
|
|
315
|
-
.option("--text-file <file>", "
|
|
316
|
-
.option("--reply", "
|
|
317
|
-
.option("--message-id <id>", "
|
|
313
|
+
.option("--text <text>", "Message body.")
|
|
314
|
+
.option("--stdin", "Read message body from stdin.", false)
|
|
315
|
+
.option("--text-file <file>", "Read message body from a file relative to the current directory.")
|
|
316
|
+
.option("--reply", "Explicitly reply to the target message with reply_to_message.", false)
|
|
317
|
+
.option("--message-id <id>", "Explicit reply target message ID.")
|
|
318
318
|
.option(
|
|
319
319
|
"--chat-key <chatKey>",
|
|
320
|
-
"
|
|
320
|
+
"Target chatKey; reads DC_CTX_CHAT_KEY if omitted.",
|
|
321
321
|
);
|
|
322
322
|
attachCommandHelpText(command, CHAT_SEND_HELP_TEXT);
|
|
323
323
|
},
|
|
@@ -331,21 +331,21 @@ export function createChatPluginActions(params: {
|
|
|
331
331
|
},
|
|
332
332
|
}),
|
|
333
333
|
react: createAction({
|
|
334
|
-
description: "
|
|
334
|
+
description: "React to a target message, currently supported only by Telegram.",
|
|
335
335
|
input_schema: {
|
|
336
336
|
zod: z.object({}).passthrough(),
|
|
337
337
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
338
338
|
},
|
|
339
339
|
command: {
|
|
340
|
-
description: "
|
|
340
|
+
description: "React to a target message, currently supported only by Telegram.",
|
|
341
341
|
configure(command: Command) {
|
|
342
342
|
command
|
|
343
|
-
.option("--emoji <emoji>", "
|
|
344
|
-
.option("--big", "
|
|
345
|
-
.option("--message-id <id>", "
|
|
343
|
+
.option("--emoji <emoji>", "Emoji character, default thumbs-up.")
|
|
344
|
+
.option("--big", "Use large reaction effect (Telegram is_big).", false)
|
|
345
|
+
.option("--message-id <id>", "Target message ID; defaults to chat meta when available.")
|
|
346
346
|
.option(
|
|
347
347
|
"--chat-key <chatKey>",
|
|
348
|
-
"
|
|
348
|
+
"Target chatKey; reads DC_CTX_CHAT_KEY if omitted.",
|
|
349
349
|
);
|
|
350
350
|
attachCommandHelpText(command, CHAT_REACT_HELP_TEXT);
|
|
351
351
|
},
|
|
@@ -359,15 +359,15 @@ export function createChatPluginActions(params: {
|
|
|
359
359
|
},
|
|
360
360
|
}),
|
|
361
361
|
context: createAction({
|
|
362
|
-
description: "
|
|
362
|
+
description: "View current conversation context snapshot.",
|
|
363
363
|
input_schema: {
|
|
364
364
|
zod: z.object({}).passthrough(),
|
|
365
365
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
366
366
|
},
|
|
367
367
|
command: {
|
|
368
|
-
description: "
|
|
368
|
+
description: "View current conversation context snapshot.",
|
|
369
369
|
configure(command: Command) {
|
|
370
|
-
command.option("--chat-key <chatKey>", "
|
|
370
|
+
command.option("--chat-key <chatKey>", "Explicitly override chatKey.");
|
|
371
371
|
},
|
|
372
372
|
mapInput(input) {
|
|
373
373
|
const chatKey =
|
|
@@ -385,17 +385,17 @@ export function createChatPluginActions(params: {
|
|
|
385
385
|
},
|
|
386
386
|
}),
|
|
387
387
|
delete: createAction({
|
|
388
|
-
description: "
|
|
388
|
+
description: "Permanently delete a specified chat conversation, including mapping, history, and context.",
|
|
389
389
|
input_schema: {
|
|
390
390
|
zod: z.object({}).passthrough(),
|
|
391
391
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
392
392
|
},
|
|
393
393
|
command: {
|
|
394
|
-
description: "
|
|
394
|
+
description: "Permanently delete a specified chat conversation, including mapping, history, and context.",
|
|
395
395
|
configure(command: Command) {
|
|
396
396
|
command
|
|
397
|
-
.option("--chat-key <chatKey>", "
|
|
398
|
-
.option("--session-id <sessionId>", "
|
|
397
|
+
.option("--chat-key <chatKey>", "Explicit chatKey.")
|
|
398
|
+
.option("--session-id <sessionId>", "Explicit sessionId.");
|
|
399
399
|
},
|
|
400
400
|
mapInput: mapChatDeleteCommandInput,
|
|
401
401
|
},
|
|
@@ -407,24 +407,24 @@ export function createChatPluginActions(params: {
|
|
|
407
407
|
},
|
|
408
408
|
}),
|
|
409
409
|
history: createAction({
|
|
410
|
-
description: "
|
|
410
|
+
description: "Read chat history messages.",
|
|
411
411
|
input_schema: {
|
|
412
412
|
zod: z.object({}).passthrough(),
|
|
413
413
|
json_schema: { type: "object", properties: {}, additionalProperties: true },
|
|
414
414
|
},
|
|
415
415
|
command: {
|
|
416
|
-
description: "
|
|
416
|
+
description: "Read chat history messages, defaulting to the latest 30.",
|
|
417
417
|
configure(command: Command) {
|
|
418
418
|
command
|
|
419
|
-
.option("--chat-key <chatKey>", "
|
|
420
|
-
.option("--session-id <sessionId>", "
|
|
421
|
-
.option("--limit <n>", "
|
|
419
|
+
.option("--chat-key <chatKey>", "Explicitly override chatKey.")
|
|
420
|
+
.option("--session-id <sessionId>", "Explicitly override sessionId.")
|
|
421
|
+
.option("--limit <n>", "Return the latest N records, default 30.")
|
|
422
422
|
.option(
|
|
423
423
|
"--direction <direction>",
|
|
424
|
-
"
|
|
424
|
+
"Direction filter (all|inbound|outbound).",
|
|
425
425
|
)
|
|
426
|
-
.option("--before-ts <ts>", "
|
|
427
|
-
.option("--after-ts <ts>", "
|
|
426
|
+
.option("--before-ts <ts>", "Return only records with ts lower than this value, in milliseconds.")
|
|
427
|
+
.option("--after-ts <ts>", "Return only records with ts greater than this value, in milliseconds.");
|
|
428
428
|
},
|
|
429
429
|
mapInput: mapChatHistoryCommandInput,
|
|
430
430
|
},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import type { ModelMessage, Tool } from "ai";
|
|
11
11
|
import { drainInjectedUserMessages } from "@downcity/agent/internal/executor/SessionRunScope.js";
|
|
12
12
|
import { LocalSessionContextComposer } from "@downcity/agent/internal/executor/composer/context/LocalSessionContextComposer.js";
|
|
13
|
-
import type {
|
|
13
|
+
import type { SessionRecordV1 } from "@downcity/agent/internal/executor/types/SessionRecords.js";
|
|
14
14
|
import type { SessionSystemMessage } from "@downcity/agent/internal/executor/types/SessionPrompts.js";
|
|
15
15
|
import type { ChatSessionTurnState } from "@/chat/runtime/ChatSessionTypes.js";
|
|
16
16
|
|
|
@@ -49,7 +49,7 @@ export class ChatSessionContextComposer extends LocalSessionContextComposer {
|
|
|
49
49
|
input: {
|
|
50
50
|
system: SessionSystemMessage[];
|
|
51
51
|
appendMergedUserMessages: (
|
|
52
|
-
messages:
|
|
52
|
+
messages: SessionRecordV1[],
|
|
53
53
|
) => Promise<ModelMessage[]>;
|
|
54
54
|
},
|
|
55
55
|
): (input: { messages?: ModelMessage[] }) => Promise<{
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - 普通 Session 仍可复用基础 `run / append*` 能力,不强耦合 chat 语义。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { SessionUserMessageV1 } from "@downcity/agent/internal/executor/types/
|
|
9
|
+
import type { SessionUserMessageV1 } from "@downcity/agent/internal/executor/types/SessionRecords.js";
|
|
10
10
|
import type { SessionAssistantStepCallback } from "@downcity/agent/internal/executor/types/SessionRun.js";
|
|
11
11
|
|
|
12
12
|
/**
|