@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
package/src/contact/Action.ts
CHANGED
|
@@ -97,21 +97,21 @@ export type ContactActionHandlers = {
|
|
|
97
97
|
export function createContactActions(handlers: ContactActionHandlers): PluginActions {
|
|
98
98
|
return {
|
|
99
99
|
link: createAction({
|
|
100
|
-
description: "
|
|
100
|
+
description: "Create a one-time contact link code for another agent to approve.",
|
|
101
101
|
input_schema: {
|
|
102
102
|
zod: z.object({ ttlSeconds: z.number().optional() }),
|
|
103
103
|
json_schema: {
|
|
104
104
|
type: "object",
|
|
105
105
|
properties: {
|
|
106
|
-
ttlSeconds: { type: "number", description: "
|
|
106
|
+
ttlSeconds: { type: "number", description: "Link expiration in seconds, defaulting to 600." },
|
|
107
107
|
},
|
|
108
108
|
},
|
|
109
109
|
},
|
|
110
|
-
examples: [{ title: "
|
|
110
|
+
examples: [{ title: "Create default link", payload: {} }],
|
|
111
111
|
command: {
|
|
112
|
-
description: "
|
|
112
|
+
description: "Create a one-time contact link code for another agent to approve.",
|
|
113
113
|
configure(command) {
|
|
114
|
-
command.option("--ttl-seconds <seconds>", "
|
|
114
|
+
command.option("--ttl-seconds <seconds>", "Link expiration in seconds, defaulting to 600.", Number);
|
|
115
115
|
},
|
|
116
116
|
mapInput({ opts }) {
|
|
117
117
|
const payload: JsonObject = {};
|
|
@@ -128,7 +128,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
128
128
|
}),
|
|
129
129
|
}),
|
|
130
130
|
approve: createAction({
|
|
131
|
-
description: "
|
|
131
|
+
description: "Use a contact link code to establish a peer-to-peer contact.",
|
|
132
132
|
input_schema: {
|
|
133
133
|
zod: z.object({
|
|
134
134
|
code: z.string(),
|
|
@@ -139,7 +139,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
139
139
|
required: ["code"],
|
|
140
140
|
properties: {
|
|
141
141
|
code: { type: "string", description: "link code" },
|
|
142
|
-
name: { type: "string", description: "
|
|
142
|
+
name: { type: "string", description: "Local contact alias." },
|
|
143
143
|
},
|
|
144
144
|
},
|
|
145
145
|
},
|
|
@@ -147,11 +147,11 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
147
147
|
{ title: "approve link", payload: { code: "abc123", name: "alice" } },
|
|
148
148
|
],
|
|
149
149
|
command: {
|
|
150
|
-
description: "
|
|
150
|
+
description: "Use a contact link code to establish a peer-to-peer contact.",
|
|
151
151
|
configure(command) {
|
|
152
152
|
command
|
|
153
153
|
.argument("<code>")
|
|
154
|
-
.option("--name <alias>", "
|
|
154
|
+
.option("--name <alias>", "Local contact alias.");
|
|
155
155
|
},
|
|
156
156
|
mapInput({ args, opts }) {
|
|
157
157
|
const code = String(args[0] || "").trim();
|
|
@@ -170,14 +170,14 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
170
170
|
}),
|
|
171
171
|
}),
|
|
172
172
|
list: createAction({
|
|
173
|
-
description: "
|
|
173
|
+
description: "List established contacts.",
|
|
174
174
|
input_schema: {
|
|
175
175
|
zod: z.object({}).passthrough(),
|
|
176
176
|
json_schema: { type: "object", properties: {} },
|
|
177
177
|
},
|
|
178
|
-
examples: [{ title: "
|
|
178
|
+
examples: [{ title: "List contacts", payload: {} }],
|
|
179
179
|
command: {
|
|
180
|
-
description: "
|
|
180
|
+
description: "List established contacts.",
|
|
181
181
|
mapInput() {
|
|
182
182
|
return {};
|
|
183
183
|
},
|
|
@@ -190,7 +190,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
190
190
|
}),
|
|
191
191
|
}),
|
|
192
192
|
check: createAction({
|
|
193
|
-
description: "
|
|
193
|
+
description: "Check whether a contact or endpoint is currently online and reachable.",
|
|
194
194
|
input_schema: {
|
|
195
195
|
zod: z.object({
|
|
196
196
|
target: z.string().optional(),
|
|
@@ -199,21 +199,21 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
199
199
|
json_schema: {
|
|
200
200
|
type: "object",
|
|
201
201
|
properties: {
|
|
202
|
-
target: { type: "string", description: "
|
|
203
|
-
endpoint: { type: "string", description: "
|
|
202
|
+
target: { type: "string", description: "Saved contact name." },
|
|
203
|
+
endpoint: { type: "string", description: "Endpoint to check directly." },
|
|
204
204
|
},
|
|
205
205
|
},
|
|
206
206
|
},
|
|
207
207
|
examples: [
|
|
208
|
-
{ title: "
|
|
209
|
-
{ title: "
|
|
208
|
+
{ title: "Check contact", payload: { target: "alice" } },
|
|
209
|
+
{ title: "Check endpoint", payload: { endpoint: "https://example.com" } },
|
|
210
210
|
],
|
|
211
211
|
command: {
|
|
212
|
-
description: "
|
|
212
|
+
description: "Check whether a contact or endpoint is currently online and reachable.",
|
|
213
213
|
configure(command) {
|
|
214
214
|
command
|
|
215
215
|
.argument("[target]")
|
|
216
|
-
.option("--to <endpoint>", "
|
|
216
|
+
.option("--to <endpoint>", "Directly check an unsaved endpoint.");
|
|
217
217
|
},
|
|
218
218
|
mapInput({ args, opts }) {
|
|
219
219
|
const payload: JsonObject = {};
|
|
@@ -232,7 +232,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
232
232
|
}),
|
|
233
233
|
}),
|
|
234
234
|
chat: createAction({
|
|
235
|
-
description: "
|
|
235
|
+
description: "Chat with a contact in its long-lived conversation thread, or read conversation history.",
|
|
236
236
|
input_schema: {
|
|
237
237
|
zod: z.object({
|
|
238
238
|
to: z.string(),
|
|
@@ -242,19 +242,19 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
242
242
|
type: "object",
|
|
243
243
|
required: ["to"],
|
|
244
244
|
properties: {
|
|
245
|
-
to: { type: "string", description: "
|
|
246
|
-
message: { type: "string", description: "
|
|
245
|
+
to: { type: "string", description: "Target contact." },
|
|
246
|
+
message: { type: "string", description: "Message to send." },
|
|
247
247
|
},
|
|
248
248
|
},
|
|
249
249
|
},
|
|
250
250
|
examples: [
|
|
251
|
-
{ title: "
|
|
252
|
-
{ title: "
|
|
251
|
+
{ title: "Send message", payload: { to: "alice", message: "hello" } },
|
|
252
|
+
{ title: "Read history", payload: { to: "alice" } },
|
|
253
253
|
],
|
|
254
254
|
command: {
|
|
255
|
-
description: "
|
|
255
|
+
description: "Chat with a contact in its long-lived conversation thread.",
|
|
256
256
|
configure(command) {
|
|
257
|
-
command.requiredOption("--to <contact>", "
|
|
257
|
+
command.requiredOption("--to <contact>", "Target contact.").argument("[message...]");
|
|
258
258
|
},
|
|
259
259
|
mapInput({ args, opts }) {
|
|
260
260
|
const payload: JsonObject = {
|
|
@@ -274,7 +274,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
274
274
|
}),
|
|
275
275
|
}),
|
|
276
276
|
share: createAction({
|
|
277
|
-
description: "
|
|
277
|
+
description: "Share text, links, files, or directories with a contact.",
|
|
278
278
|
input_schema: {
|
|
279
279
|
zod: z.object({
|
|
280
280
|
to: z.string(),
|
|
@@ -286,26 +286,26 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
286
286
|
type: "object",
|
|
287
287
|
required: ["to"],
|
|
288
288
|
properties: {
|
|
289
|
-
to: { type: "string", description: "
|
|
290
|
-
text: { type: "string", description: "
|
|
291
|
-
links: { type: "array", items: { type: "string" }, description: "
|
|
292
|
-
paths: { type: "array", items: { type: "string" }, description: "
|
|
289
|
+
to: { type: "string", description: "Target contact." },
|
|
290
|
+
text: { type: "string", description: "Text to share." },
|
|
291
|
+
links: { type: "array", items: { type: "string" }, description: "Links to share." },
|
|
292
|
+
paths: { type: "array", items: { type: "string" }, description: "File or directory paths to share." },
|
|
293
293
|
},
|
|
294
294
|
},
|
|
295
295
|
},
|
|
296
296
|
examples: [
|
|
297
297
|
{
|
|
298
|
-
title: "
|
|
298
|
+
title: "Share text",
|
|
299
299
|
payload: { to: "alice", text: "看看这个" },
|
|
300
300
|
},
|
|
301
301
|
],
|
|
302
302
|
command: {
|
|
303
|
-
description: "
|
|
303
|
+
description: "Share text, links, files, or directories with a contact.",
|
|
304
304
|
configure(command) {
|
|
305
305
|
command
|
|
306
|
-
.requiredOption("--to <contact>", "
|
|
307
|
-
.option("--text <text>", "
|
|
308
|
-
.option("--link <url...>", "
|
|
306
|
+
.requiredOption("--to <contact>", "Target contact.")
|
|
307
|
+
.option("--text <text>", "Text to share.")
|
|
308
|
+
.option("--link <url...>", "Links to share.")
|
|
309
309
|
.argument("[paths...]");
|
|
310
310
|
},
|
|
311
311
|
mapInput({ args, opts }) {
|
|
@@ -331,14 +331,14 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
331
331
|
}),
|
|
332
332
|
}),
|
|
333
333
|
inbox: createAction({
|
|
334
|
-
description: "
|
|
334
|
+
description: "View the contact inbox.",
|
|
335
335
|
input_schema: {
|
|
336
336
|
zod: z.object({}).passthrough(),
|
|
337
337
|
json_schema: { type: "object", properties: {} },
|
|
338
338
|
},
|
|
339
|
-
examples: [{ title: "
|
|
339
|
+
examples: [{ title: "View inbox", payload: {} }],
|
|
340
340
|
command: {
|
|
341
|
-
description: "
|
|
341
|
+
description: "View the contact inbox.",
|
|
342
342
|
mapInput() {
|
|
343
343
|
return {};
|
|
344
344
|
},
|
|
@@ -351,20 +351,20 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
351
351
|
}),
|
|
352
352
|
}),
|
|
353
353
|
receive: createAction({
|
|
354
|
-
description: "
|
|
354
|
+
description: "Receive a share from the inbox.",
|
|
355
355
|
input_schema: {
|
|
356
356
|
zod: z.object({ shareId: z.string() }),
|
|
357
357
|
json_schema: {
|
|
358
358
|
type: "object",
|
|
359
359
|
required: ["shareId"],
|
|
360
360
|
properties: {
|
|
361
|
-
shareId: { type: "string", description: "
|
|
361
|
+
shareId: { type: "string", description: "Share ID from the inbox." },
|
|
362
362
|
},
|
|
363
363
|
},
|
|
364
364
|
},
|
|
365
|
-
examples: [{ title: "
|
|
365
|
+
examples: [{ title: "Receive share", payload: { shareId: "share_1" } }],
|
|
366
366
|
command: {
|
|
367
|
-
description: "
|
|
367
|
+
description: "Receive a share from the inbox.",
|
|
368
368
|
configure(command) {
|
|
369
369
|
command.argument("<shareId>");
|
|
370
370
|
},
|
|
@@ -383,7 +383,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
383
383
|
}),
|
|
384
384
|
}),
|
|
385
385
|
remoteping: createAction({
|
|
386
|
-
description: "
|
|
386
|
+
description: "Handle a remote ping request (internal endpoint).",
|
|
387
387
|
execute: async (params) => ({
|
|
388
388
|
success: true,
|
|
389
389
|
data: (await handlers.remotePing(
|
|
@@ -393,7 +393,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
393
393
|
}),
|
|
394
394
|
}),
|
|
395
395
|
remoteapprove: createAction({
|
|
396
|
-
description: "
|
|
396
|
+
description: "Handle a remote approve request (internal endpoint).",
|
|
397
397
|
execute: async (params) => ({
|
|
398
398
|
success: true,
|
|
399
399
|
data: (await handlers.remoteApprove(
|
|
@@ -403,7 +403,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
403
403
|
}),
|
|
404
404
|
}),
|
|
405
405
|
remoteconfirm: createAction({
|
|
406
|
-
description: "
|
|
406
|
+
description: "Handle a remote confirm request (internal endpoint).",
|
|
407
407
|
execute: async (params) => ({
|
|
408
408
|
success: true,
|
|
409
409
|
data: (await handlers.remoteConfirm(
|
|
@@ -413,7 +413,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
413
413
|
}),
|
|
414
414
|
}),
|
|
415
415
|
remotechat: createAction({
|
|
416
|
-
description: "
|
|
416
|
+
description: "Handle a remote chat request (internal endpoint).",
|
|
417
417
|
execute: async (params) => {
|
|
418
418
|
const payload = readContactObject(params.input);
|
|
419
419
|
const body = readContactObject(payload.body);
|
|
@@ -428,7 +428,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
428
428
|
},
|
|
429
429
|
}),
|
|
430
430
|
remoteshare: createAction({
|
|
431
|
-
description: "
|
|
431
|
+
description: "Handle a remote share request (internal endpoint).",
|
|
432
432
|
execute: async (params) => ({
|
|
433
433
|
success: true,
|
|
434
434
|
data: (await handlers.remoteShare(params.context, params.input)) as unknown as JsonValue,
|
package/src/contact/PROMPT.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Source: src/contact/PROMPT.ts.txt
|
|
7
|
-
const TEXT_MODULE_CONTENT = "Contact
|
|
7
|
+
const TEXT_MODULE_CONTENT = "# Contact Plugin\n\nThe contact plugin manages ways to reach other agents. A contact represents an established remote-agent relationship and owns one long-lived conversation history. A contact may be one-way: as long as this agent can reach the other agent, it can `check`, `chat`, and `share`.\n\nAvailable actions:\n- `link`: create a one-time contact code for another agent.\n- `approve`: use a contact code from another agent to establish a contact.\n- `list`: view saved agent contacts.\n- `check`: check whether the other agent is online and reachable.\n- `chat`: talk with a contact.\n- `share`: share text, links, files, or directories.\n- `inbox`: view received shares.\n- `receive`: receive a share.\n\nBoundaries:\n- Use `chat` for conversation and `share` for handing over materials.\n- The notes returned by the `link` action explain whether a contact code is suitable for local-machine, LAN, or public agents. A localhost contact code must not be given to a server agent for `approve`.\n- A public-looking endpoint may still be blocked by firewall or NAT. Trust the returned notes, and do not promise that public access is guaranteed.\n- The Agent runtime writes `DOWNCITY_PUBLIC_HOST` when available for contact links. This is not a token or endpoint that the user must configure manually.\n- The `approve` action first establishes a one-way relationship. The other agent then pings back to this agent, and only a successful ping upgrades the relationship to bidirectional.\n- When a local/private agent connects to a public agent, the connection is usually outbound-only. Do not describe it as bidirectional.\n- Contact tokens are exchanged automatically by `link` and `approve`. Do not ask the user to manually configure token environment variables.\n- `Contact link not found` means the request reached an agent runtime that does not have this link record. First check whether the endpoint, port, and agent match. Expiration is reported explicitly as `Contact link expired`.\n- `receive` only receives content. It does not execute anything, install skills, or modify project business files automatically.\n- Do not automatically approve or receive unless the user explicitly asks.\n";
|
|
8
8
|
|
|
9
9
|
export default TEXT_MODULE_CONTENT;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
Contact
|
|
1
|
+
# Contact Plugin
|
|
2
2
|
|
|
3
|
-
contact plugin
|
|
3
|
+
The contact plugin manages ways to reach other agents. A contact represents an established remote-agent relationship and owns one long-lived conversation history. A contact may be one-way: as long as this agent can reach the other agent, it can `check`, `chat`, and `share`.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- `link
|
|
7
|
-
- `approve
|
|
8
|
-
- `list
|
|
9
|
-
- `check
|
|
10
|
-
- `chat
|
|
11
|
-
- `share
|
|
12
|
-
- `inbox
|
|
13
|
-
- `receive
|
|
5
|
+
Available actions:
|
|
6
|
+
- `link`: create a one-time contact code for another agent.
|
|
7
|
+
- `approve`: use a contact code from another agent to establish a contact.
|
|
8
|
+
- `list`: view saved agent contacts.
|
|
9
|
+
- `check`: check whether the other agent is online and reachable.
|
|
10
|
+
- `chat`: talk with a contact.
|
|
11
|
+
- `share`: share text, links, files, or directories.
|
|
12
|
+
- `inbox`: view received shares.
|
|
13
|
+
- `receive`: receive a share.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
- chat
|
|
17
|
-
- `link` action
|
|
18
|
-
- public-looking endpoint
|
|
19
|
-
- Agent runtime
|
|
20
|
-
- `approve` action
|
|
21
|
-
- local/private agent
|
|
22
|
-
-
|
|
23
|
-
- `Contact link not found`
|
|
24
|
-
- receive
|
|
25
|
-
-
|
|
15
|
+
Boundaries:
|
|
16
|
+
- Use `chat` for conversation and `share` for handing over materials.
|
|
17
|
+
- The notes returned by the `link` action explain whether a contact code is suitable for local-machine, LAN, or public agents. A localhost contact code must not be given to a server agent for `approve`.
|
|
18
|
+
- A public-looking endpoint may still be blocked by firewall or NAT. Trust the returned notes, and do not promise that public access is guaranteed.
|
|
19
|
+
- The Agent runtime writes `DOWNCITY_PUBLIC_HOST` when available for contact links. This is not a token or endpoint that the user must configure manually.
|
|
20
|
+
- The `approve` action first establishes a one-way relationship. The other agent then pings back to this agent, and only a successful ping upgrades the relationship to bidirectional.
|
|
21
|
+
- When a local/private agent connects to a public agent, the connection is usually outbound-only. Do not describe it as bidirectional.
|
|
22
|
+
- Contact tokens are exchanged automatically by `link` and `approve`. Do not ask the user to manually configure token environment variables.
|
|
23
|
+
- `Contact link not found` means the request reached an agent runtime that does not have this link record. First check whether the endpoint, port, and agent match. Expiration is reported explicitly as `Contact link expired`.
|
|
24
|
+
- `receive` only receives content. It does not execute anything, install skills, or modify project business files automatically.
|
|
25
|
+
- Do not automatically approve or receive unless the user explicitly asks.
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
import type { AgentContext } from "@downcity/agent/internal/types/runtime/agent/AgentContext.js";
|
|
10
10
|
import type { ContactChatResponse } from "@/contact/types/ContactChat.js";
|
|
11
|
-
import type {
|
|
11
|
+
import type { SessionRecordV1 } from "@downcity/agent/internal/executor/types/SessionRecords.js";
|
|
12
12
|
import {
|
|
13
13
|
appendContactMessage,
|
|
14
14
|
findContactByInboundToken,
|
|
15
15
|
} from "./ContactStore.js";
|
|
16
16
|
|
|
17
|
-
function extractMessageText(message:
|
|
17
|
+
function extractMessageText(message: SessionRecordV1 | null | undefined): string {
|
|
18
18
|
const parts = Array.isArray((message as { parts?: unknown } | null)?.parts)
|
|
19
19
|
? ((message as { parts: unknown[] }).parts)
|
|
20
20
|
: [];
|
package/src/image/ImagePlugin.ts
CHANGED
|
@@ -535,31 +535,31 @@ export class ImagePlugin extends BasePlugin {
|
|
|
535
535
|
"",
|
|
536
536
|
"## Actions",
|
|
537
537
|
"",
|
|
538
|
-
"- `models
|
|
539
|
-
"
|
|
540
|
-
"- `image_create
|
|
541
|
-
" -
|
|
542
|
-
" -
|
|
543
|
-
" `[{ type: \"text\", text }, { type: \"image\", url }]
|
|
544
|
-
" -
|
|
545
|
-
" - `url`
|
|
546
|
-
"
|
|
547
|
-
" - `model`
|
|
548
|
-
"- `image_result
|
|
549
|
-
" -
|
|
550
|
-
" -
|
|
551
|
-
" - `succeeded
|
|
552
|
-
" -
|
|
553
|
-
" - `failed
|
|
538
|
+
"- `models`: list currently available image models and return `{ models }`.",
|
|
539
|
+
" Call this first when you do not know which model to use and the plugin has no default image model. Let the user or current task context specify the model ID.",
|
|
540
|
+
"- `image_create`: create an async image job after explicit user confirmation, returning `{ job_id, status }`.",
|
|
541
|
+
" - Text-only generation: pass `prompt` as a string.",
|
|
542
|
+
" - Edits or reference images: pass `content` in this shape:",
|
|
543
|
+
" `[{ type: \"text\", text }, { type: \"image\", url }]`. Multiple text parts and images may appear in any order.",
|
|
544
|
+
" - If both `content` and `prompt` are provided, `content` takes effect and `prompt` is ignored.",
|
|
545
|
+
" - `url` supports three forms: online URL, absolute local path, or a relative path from the Agent project root.",
|
|
546
|
+
" Do not pass base64/data URLs, and do not use the legacy `messages` field.",
|
|
547
|
+
" - `model` is optional. If omitted, the plugin-configured default image model is used. Optional parameters include `aspect_ratio` such as `16:9`, `size` such as `1024x1024`, `quality`, and `seed`.",
|
|
548
|
+
"- `image_result`: read job status by `job_id`.",
|
|
549
|
+
" - By default, read once. If the status is `queued` or `running`, save the `job_id` and check again in a later turn; do not repeatedly poll in the same turn.",
|
|
550
|
+
" - To wait for the image directly, pass `until_done: true` with optional `max_wait_ms` (default 60000, max 600000) and `poll_interval_ms` (default 1500). If the wait times out, the latest intermediate status is returned.",
|
|
551
|
+
" - `succeeded`: returned image file parts are automatically written to disk and attached to the next assistant message. You do not need to assemble the image manually.",
|
|
552
|
+
" - When replying to the user, you can render images with Markdown image syntax: ``.",
|
|
553
|
+
" - `failed`: report the `error` truthfully to the user. Do not invent image results.",
|
|
554
554
|
"",
|
|
555
555
|
"## Flow",
|
|
556
556
|
"",
|
|
557
|
-
"1.
|
|
558
|
-
"2.
|
|
559
|
-
"3.
|
|
560
|
-
"4. `image_result
|
|
557
|
+
"1. If the plugin has no default image model, confirm the model ID first; call `models` when model selection is needed.",
|
|
558
|
+
"2. Explain to the user that image generation will consume image quota, and wait for explicit confirmation.",
|
|
559
|
+
"3. After the user confirms, call `image_create` to get a `job_id`.",
|
|
560
|
+
"4. Query with `image_result`; short jobs may use `until_done: true` to get the result in one call, while long jobs should save the `job_id` and check again in a later turn.",
|
|
561
561
|
"",
|
|
562
|
-
"
|
|
562
|
+
"When unsure, use `plugin_read { plugin: \"image\", action: \"...\" }` to inspect each action's complete input schema and examples.",
|
|
563
563
|
].join("\n");
|
|
564
564
|
}
|
|
565
565
|
|
package/src/memory/Action.ts
CHANGED
|
@@ -268,9 +268,9 @@ export async function digestMemoryAction(
|
|
|
268
268
|
? Math.max(1, Math.floor(payload.maxMessages as number))
|
|
269
269
|
: 30;
|
|
270
270
|
const historyStore = context.session.get(sessionId).getHistoryStore();
|
|
271
|
-
const total = await historyStore.
|
|
271
|
+
const total = await historyStore.record_count();
|
|
272
272
|
const start = Math.max(0, total - maxMessages);
|
|
273
|
-
const messages = await historyStore.
|
|
273
|
+
const messages = await historyStore.slice_records(start, total);
|
|
274
274
|
const lines = messages
|
|
275
275
|
.map((msg) => extractReadableLine(msg))
|
|
276
276
|
.filter((line) => line.length > 0);
|