evolcore 0.0.39 → 0.0.41-test.0
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/CHANGELOG.md +93 -0
- package/README.md +31 -20
- package/bin/codex-managed-hook.mjs +11 -0
- package/bin/ec-safe-output.js +25 -3
- package/dist/agents/baseagent-availability.js +1 -0
- package/dist/agents/claude-runner.js +53 -152
- package/dist/agents/codex-runner.js +485 -241
- package/dist/agents/ecagent-runner.js +48 -18
- package/dist/agents/gemini-runner.js +27 -8
- package/dist/agents/runner-types.js +39 -9
- package/dist/aun/ability-device-routing.js +26 -0
- package/dist/aun/aid/client.js +1 -1
- package/dist/aun/aid/control-aid.js +23 -98
- package/dist/aun/aid/ownership-operation.js +1 -3
- package/dist/aun/group/identity.js +8 -0
- package/dist/aun/group/invite-service.js +6 -0
- package/dist/aun/msg/managed-operation.js +4 -4
- package/dist/aun/msg/p2p.js +28 -12
- package/dist/aun/storage/download.js +30 -0
- package/dist/aun/storage/index.js +14 -6
- package/dist/channels/aun.js +99 -52
- package/dist/channels/daemon.js +24 -4
- package/dist/channels/dingtalk.js +8 -2
- package/dist/channels/feishu.js +6 -1
- package/dist/channels/wecom.js +7 -3
- package/dist/cli/agent-command.js +2 -0
- package/dist/cli/agent-create.js +121 -23
- package/dist/cli/agent.js +10 -3
- package/dist/cli/aid-bind-command.js +4 -1
- package/dist/cli/aun-commands.js +82 -22
- package/dist/cli/daemon-commands.js +260 -26
- package/dist/cli/index.js +25 -13
- package/dist/cli/memory-command.js +33 -14
- package/dist/cli/restart-monitor.js +52 -13
- package/dist/cli/session-command.js +128 -13
- package/dist/cli/stats.js +60 -4
- package/dist/cli/task-context.js +1 -0
- package/dist/cli/trigger-command.js +2 -2
- package/dist/config/access-policy.js +2 -0
- package/dist/config/config-field-policy.js +1 -0
- package/dist/config/config-operation-service.js +17 -6
- package/dist/config/gateway-config.js +1 -1
- package/dist/config/peer-role-resolver.js +10 -8
- package/dist/contracts/ecweb-service-protocol.js +44 -0
- package/dist/core/agent-application-service.js +11 -1
- package/dist/core/agent-ipc-registration.js +4 -0
- package/dist/core/agent-runtime.js +6 -0
- package/dist/core/auth/agent-delegation.js +87 -9
- package/dist/core/auth/auth-gateway.js +3 -1
- package/dist/core/auth/authorization-audit.js +25 -4
- package/dist/core/auth/debug-context.js +5 -1
- package/dist/core/auth/operation-catalog.js +24 -0
- package/dist/core/command/agent-control.js +91 -12
- package/dist/core/command/command-handler.js +64 -47
- package/dist/core/command/connect-menu.js +23 -2
- package/dist/core/command/menu-catalog.js +49 -12
- package/dist/core/command/menu-handler.js +110 -105
- package/dist/core/command/menu-protocol.js +29 -3
- package/dist/core/command/role-menu.js +7 -6
- package/dist/core/command/slash-gate.js +22 -5
- package/dist/core/command/slash-handler.js +121 -102
- package/dist/core/event-catalog.js +17 -0
- package/dist/core/interaction-router.js +2 -1
- package/dist/core/ipc-registration.js +44 -8
- package/dist/core/memory/batch-meta.js +2 -0
- package/dist/core/memory/consolidation-context.js +42 -51
- package/dist/core/memory/consolidation-ops-records.js +39 -7
- package/dist/core/memory/consolidation-trigger.js +72 -65
- package/dist/core/memory/consolidation.js +226 -20
- package/dist/core/memory/memory-writer.js +160 -34
- package/dist/core/memory/relation-idle-monitor.js +287 -0
- package/dist/core/memory/relation-sweep.js +206 -0
- package/dist/core/message/aun-ipc-sender.js +31 -5
- package/dist/core/message/aun-request-registry.js +97 -3
- package/dist/core/message/im-renderer.js +4 -0
- package/dist/core/message/message-admission.js +8 -4
- package/dist/core/message/message-bridge.js +96 -53
- package/dist/core/message/message-log.js +72 -0
- package/dist/core/message/message-queue.js +11 -5
- package/dist/core/message/outbound.js +70 -0
- package/dist/core/message/peer-mode.js +7 -2
- package/dist/core/message/response-engine.js +633 -191
- package/dist/core/model/model-catalog.js +7 -6
- package/dist/core/ownership/owner-resolver.js +384 -178
- package/dist/core/permission/ec-command-parser.js +129 -8
- package/dist/core/permission/tool-policy.js +35 -14
- package/dist/core/role/runtime-policy.js +64 -0
- package/dist/core/session/session-capsule.js +197 -0
- package/dist/core/session/session-manager.js +172 -18
- package/dist/core/session/session-mapper.js +2 -0
- package/dist/core/system-session/memory.js +3 -18
- package/dist/ecweb/basic-settings-service.js +709 -0
- package/dist/ecweb/providers-service.js +172 -0
- package/dist/index.js +95 -7
- package/dist/ipc.js +100 -19
- package/dist/stats/budget.js +1 -1
- package/dist/stats/db.js +48 -0
- package/dist/stats/index.js +3 -3
- package/dist/stats/price-resolver.js +304 -5
- package/dist/stats/query.js +328 -3
- package/dist/stats/writer.js +79 -6
- package/dist/trigger/application-service.js +12 -0
- package/dist/trigger/authorization.js +2 -2
- package/dist/trigger/feedback.js +18 -7
- package/dist/trigger/history.js +36 -0
- package/dist/trigger/manager.js +20 -3
- package/dist/trigger/parser.js +6 -3
- package/dist/trigger/patch.js +1 -1
- package/dist/trigger/scheduler.js +3 -0
- package/dist/trigger/system-definitions.js +43 -7
- package/dist/trigger/validation.js +13 -5
- package/dist/utils/ecweb-supervisor.js +31 -10
- package/dist/utils/error-utils.js +22 -4
- package/dist/utils/evolcore-version.js +3 -2
- package/dist/utils/host-info.js +52 -0
- package/dist/utils/npm-ops.js +2 -1
- package/dist/utils/package-version-info.js +1 -1
- package/dist/utils/upgrade-jobs.js +45 -5
- package/ecagent/dist/harness/agent-harness.js +4 -1
- package/kits/docs/INDEX.md +1 -1
- package/kits/docs/aun/ABILITY_CALLING.md +20 -2
- package/kits/docs/evolcore/INDEX.md +3 -2
- package/kits/docs/evolcore/agent-create.md +3 -2
- package/kits/docs/evolcore/agent.md +1 -1
- package/kits/docs/evolcore/aid.md +29 -12
- package/kits/docs/evolcore/config.md +9 -7
- package/kits/docs/evolcore/event.md +1 -0
- package/kits/docs/evolcore/fs.md +5 -0
- package/kits/docs/evolcore/memory-architecture.md +3 -4
- package/kits/docs/evolcore/memory-consolidation.md +28 -7
- package/kits/docs/evolcore/memory-tags.md +1 -1
- package/kits/docs/evolcore/memory.md +1 -1
- package/kits/docs/evolcore/menu-client.md +1 -1
- package/kits/docs/evolcore/menu-protocol.md +38 -0
- package/kits/docs/evolcore/msg.md +18 -2
- package/kits/docs/evolcore/session.md +14 -0
- package/kits/eck_manifest.json +3 -3
- package/kits/rules/04-relation.md +3 -2
- package/kits/schemas/agent-config.schema.13.json +20 -1
- package/kits/skills/aid-ability/SKILL.md +35 -6
- package/kits/templates/memory-consolidation/generalize.md +32 -4
- package/kits/templates/memory-consolidation/notes.md +2 -2
- package/kits/templates/memory-consolidation/promote.md +10 -2
- package/kits/templates/session-capsule/recovery.md +5 -0
- package/kits/templates/session-capsule/renew.md +5 -0
- package/kits/templates/system-fragments/baseagent.md +5 -0
- package/kits/templates/system-fragments/bootstrap.md +6 -6
- package/kits/templates/system-fragments/channel.md +1 -1
- package/kits/templates/system-fragments/memory.md +12 -3
- package/kits/templates/system-fragments/session.md +1 -1
- package/kits/{rules/07-memory-and-thread.md → templates/system-fragments/thread.md} +17 -80
- package/package.json +3 -3
- package/dist/stats/billing.js +0 -215
package/dist/aun/msg/p2p.js
CHANGED
|
@@ -10,8 +10,10 @@ import { resolvePaths } from '../../paths.js';
|
|
|
10
10
|
import { ipcQuery } from '../../ipc.js';
|
|
11
11
|
import { readDelegationCredential } from '../../core/auth/agent-delegation.js';
|
|
12
12
|
import { loadDaemonConfig } from '../../config-store.js';
|
|
13
|
+
import { formatPeerKey } from '../../core/relation/peer-identity.js';
|
|
13
14
|
import { normalizeAunMentionEntries, withAunAttention } from './mention-schema.js';
|
|
14
15
|
import { isTopicThreadId } from '../../core/thread/topic-id.js';
|
|
16
|
+
import { resolveAunSendDevice } from '../ability-device-routing.js';
|
|
15
17
|
const DAEMON_SEND_TIMEOUT_GRACE_MS = 10_000;
|
|
16
18
|
const DEFAULT_IDLE_TIMEOUT_MS = 120_000;
|
|
17
19
|
const MAX_TIMER_MS = 2_147_483_647;
|
|
@@ -60,9 +62,6 @@ function buildSimplePayload(body) {
|
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
|
-
function isRawPayloadBody(body) {
|
|
64
|
-
return body.mode === 'payload';
|
|
65
|
-
}
|
|
66
65
|
function messageLogContent(body) {
|
|
67
66
|
return body.mode === 'text' ? body.text
|
|
68
67
|
: body.mode === 'link' ? `[link] ${body.url}`
|
|
@@ -100,7 +99,9 @@ function msgSendLogMetadata(args, payload, runtimeContext) {
|
|
|
100
99
|
const isInSession = !!process.env.EVOLCORE_SESSION_ID || !!runtimeContext;
|
|
101
100
|
const source = isInSession ? 'msg' : 'cli';
|
|
102
101
|
const classified = payload === undefined ? undefined : classifyAunPayloadForLog(payload);
|
|
103
|
-
const threadId =
|
|
102
|
+
const threadId = args.body.mode === 'payload'
|
|
103
|
+
? args.thread
|
|
104
|
+
: msgSendThreadId(args, payload && typeof payload === 'object' ? payload : undefined, runtimeContext);
|
|
104
105
|
const sessionId = runtimeContext?.channel === 'aun'
|
|
105
106
|
&& runtimeContext.chatType === 'private'
|
|
106
107
|
&& runtimeContext.selfAid === args.from
|
|
@@ -134,12 +135,15 @@ async function tryDaemonMsgSend(args, payload, runtimeContext, file) {
|
|
|
134
135
|
if (args.slotId || args.aunPath) {
|
|
135
136
|
return { ok: false, code: 'INVALID_DELEGATION', error: 'Task sends cannot override the daemon AUN connection' };
|
|
136
137
|
}
|
|
137
|
-
const thread = args.body.mode === 'payload'
|
|
138
|
+
const thread = args.body.mode === 'payload'
|
|
139
|
+
? args.thread
|
|
140
|
+
: msgSendThreadId(args, payload, runtimeContext);
|
|
138
141
|
const response = await ipcQuery(resolvePaths().socket, {
|
|
139
142
|
type: 'aun-msg-send',
|
|
140
143
|
aid: args.from,
|
|
141
144
|
to: args.to,
|
|
142
145
|
scope: 'msg',
|
|
146
|
+
deviceId: args.deviceId,
|
|
143
147
|
...(payload ? { payload } : { file }),
|
|
144
148
|
rawPayload: args.body.mode === 'payload',
|
|
145
149
|
encrypt: args.encrypt,
|
|
@@ -171,8 +175,9 @@ async function daemonMsgSendResult(args, payload, runtimeContext, daemonResult)
|
|
|
171
175
|
};
|
|
172
176
|
}
|
|
173
177
|
const completedRequest = args.returnPolicy === 'required' && !!daemonResult.request_id
|
|
174
|
-
&& daemonResult.request_state === 'completed'
|
|
175
|
-
&& typeof daemonResult.response === 'object' && !Array.isArray(daemonResult.response)
|
|
178
|
+
&& daemonResult.request_state === 'completed'
|
|
179
|
+
&& ((!!daemonResult.response && typeof daemonResult.response === 'object' && !Array.isArray(daemonResult.response))
|
|
180
|
+
|| (Array.isArray(daemonResult.responses) && daemonResult.responses.length > 0));
|
|
176
181
|
if (!daemonResult.message_id && !daemonResult.handoff_id && !completedRequest) {
|
|
177
182
|
return { ok: false, error: 'daemon AUN message send returned no message_id' };
|
|
178
183
|
}
|
|
@@ -188,6 +193,8 @@ async function daemonMsgSendResult(args, payload, runtimeContext, daemonResult)
|
|
|
188
193
|
request_id: daemonResult.request_id,
|
|
189
194
|
request_state: daemonResult.request_state,
|
|
190
195
|
response: daemonResult.response,
|
|
196
|
+
responses: daemonResult.responses,
|
|
197
|
+
request_diagnostics: daemonResult.request_diagnostics,
|
|
191
198
|
transport_error: daemonResult.transport_error,
|
|
192
199
|
};
|
|
193
200
|
if (sent.message_id && !daemonResult.handoff_id && !daemonResult.log_written) {
|
|
@@ -234,6 +241,12 @@ async function appendMsgSendOutboundLog(args, result, opts) {
|
|
|
234
241
|
catch { /* daemon 不在或 IPC 失败都忽略 */ }
|
|
235
242
|
}
|
|
236
243
|
export async function msgSend(args) {
|
|
244
|
+
try {
|
|
245
|
+
resolveAunSendDevice(args.deviceId, 'msg', args.body.mode === 'payload' ? args.body.payload : undefined);
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
return { ok: false, code: error.code, error: error.message };
|
|
249
|
+
}
|
|
237
250
|
if (args.handoffContext !== undefined && (!process.env.EVOLCORE_SESSION_ID
|
|
238
251
|
|| !args.handoffContext.trim() || args.handoffContext.length > 64 * 1024)) {
|
|
239
252
|
return { ok: false, code: 'INVALID_HANDOFF_CONTEXT', error: 'handoff context requires a managed session and 1–65536 characters' };
|
|
@@ -254,8 +267,9 @@ export async function msgSend(args) {
|
|
|
254
267
|
if (args.body.mode !== 'payload' && Object.prototype.hasOwnProperty.call(payload, 'mentions')) {
|
|
255
268
|
payload.mentions = normalizeAunMentionEntries(payload.mentions);
|
|
256
269
|
}
|
|
257
|
-
if (
|
|
270
|
+
if (args.body.mode !== 'payload') {
|
|
258
271
|
applyRoutingPayloadFields(payload, args, runtimeContext, false);
|
|
272
|
+
}
|
|
259
273
|
const daemonResult = await tryDaemonMsgSend(args, payload, runtimeContext);
|
|
260
274
|
if (daemonResult)
|
|
261
275
|
return daemonMsgSendResult(args, payload, runtimeContext, daemonResult);
|
|
@@ -327,7 +341,10 @@ export async function msgSend(args) {
|
|
|
327
341
|
}).effectiveRole;
|
|
328
342
|
}
|
|
329
343
|
catch { /* 角色解析失败时按未知处理(proactive) */ }
|
|
330
|
-
const chatmode = chatmodeForPeerIdentity(peerIdentity, peerRole
|
|
344
|
+
const chatmode = chatmodeForPeerIdentity(peerIdentity, peerRole, {
|
|
345
|
+
self: args.from,
|
|
346
|
+
peerKey: formatPeerKey('aun', args.to),
|
|
347
|
+
});
|
|
331
348
|
// 3. 构建 payload
|
|
332
349
|
if (!payload) {
|
|
333
350
|
payload = buildSimplePayload(args.body);
|
|
@@ -337,8 +354,6 @@ export async function msgSend(args) {
|
|
|
337
354
|
payload.chatmode = chatmode;
|
|
338
355
|
// 5. 写入 payload.thread_id/ref_message_id(如果指定)
|
|
339
356
|
if (args.body.mode !== 'payload') {
|
|
340
|
-
if (!isRawPayloadBody(args.body))
|
|
341
|
-
applyRoutingPayloadFields(payload, args, runtimeContext, false);
|
|
342
357
|
applyRoutingPayloadFields(payload, args, runtimeContext);
|
|
343
358
|
}
|
|
344
359
|
if (args.body.mode !== 'payload' && Object.prototype.hasOwnProperty.call(payload, 'mentions')) {
|
|
@@ -347,7 +362,8 @@ export async function msgSend(args) {
|
|
|
347
362
|
const encrypt = resolveAunMessageEncrypt(args.encrypt);
|
|
348
363
|
if (args.body.mode !== 'payload')
|
|
349
364
|
payload = withAunAttention(payload);
|
|
350
|
-
const sendParams = { to: args.to, payload, encrypt
|
|
365
|
+
const sendParams = { to: args.to, payload, encrypt,
|
|
366
|
+
...(args.deviceId ? { device_id: args.deviceId } : {}) };
|
|
351
367
|
const result = await conn.call('message.send', sendParams);
|
|
352
368
|
const messageId = typeof result?.message_id === 'string' && result.message_id.trim()
|
|
353
369
|
? result.message_id
|
|
@@ -27,3 +27,33 @@ export async function storageDownload(aid, url, localPath, opts) {
|
|
|
27
27
|
fs.writeFileSync(outPath, buffer);
|
|
28
28
|
return { ok: true, localPath: outPath, size: buffer.length };
|
|
29
29
|
}
|
|
30
|
+
export async function storageGetByShare(aid, shareId, localPath, opts) {
|
|
31
|
+
const shareResult = await rpcCall(aid, 'storage.get_by_share', { share_id: shareId }, { aunPath: opts?.aunPath });
|
|
32
|
+
if (!shareResult.ok) {
|
|
33
|
+
return { ok: false, localPath: '', size: 0, error: JSON.stringify(shareResult.error) };
|
|
34
|
+
}
|
|
35
|
+
const res = shareResult.result;
|
|
36
|
+
const objectKey = typeof res.object_key === 'string' ? res.object_key : '';
|
|
37
|
+
const contentType = typeof res.content_type === 'string' ? res.content_type : undefined;
|
|
38
|
+
const sha256 = typeof res.sha256 === 'string' ? res.sha256 : undefined;
|
|
39
|
+
// Small object: content is inlined as base64
|
|
40
|
+
if (typeof res.content === 'string') {
|
|
41
|
+
const buffer = Buffer.from(res.content, 'base64');
|
|
42
|
+
const outPath = localPath ?? (objectKey ? path.basename(objectKey) : `share-${shareId}`);
|
|
43
|
+
fs.writeFileSync(outPath, buffer);
|
|
44
|
+
return { ok: true, localPath: outPath, size: buffer.length, objectKey, contentType, sha256 };
|
|
45
|
+
}
|
|
46
|
+
// Large object: download_url provided
|
|
47
|
+
const downloadUrl = typeof res.download_url === 'string' ? res.download_url : undefined;
|
|
48
|
+
if (!downloadUrl) {
|
|
49
|
+
return { ok: false, localPath: '', size: 0, error: 'storage.get_by_share returned neither content nor download_url' };
|
|
50
|
+
}
|
|
51
|
+
const resp = await fetch(downloadUrl);
|
|
52
|
+
if (!resp.ok) {
|
|
53
|
+
return { ok: false, localPath: '', size: 0, error: `HTTP GET failed: ${resp.status}` };
|
|
54
|
+
}
|
|
55
|
+
const buffer = Buffer.from(await resp.arrayBuffer());
|
|
56
|
+
const outPath = localPath ?? (objectKey ? path.basename(objectKey) : `share-${shareId}`);
|
|
57
|
+
fs.writeFileSync(outPath, buffer);
|
|
58
|
+
return { ok: true, localPath: outPath, size: buffer.length, objectKey, contentType, sha256 };
|
|
59
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { storageUpload, storageUploadBuffer, storageLs, storageRm, storageQuota } from './client.js';
|
|
2
|
-
export { storageDownload } from './download.js';
|
|
2
|
+
export { storageDownload, storageGetByShare } from './download.js';
|
|
3
3
|
import { isValidAid } from '../aid/validation.js';
|
|
4
4
|
export function resolveStorageCommandArgv(argv) {
|
|
5
5
|
if (argv[0] !== 'storage')
|
|
@@ -18,14 +18,22 @@ export function resolveStorageCommandArgv(argv) {
|
|
|
18
18
|
positionals.push(value);
|
|
19
19
|
}
|
|
20
20
|
const [sub, aid, source, destination] = positionals;
|
|
21
|
-
const operation = {
|
|
21
|
+
const operation = {
|
|
22
|
+
upload: 'storage.upload', download: 'storage.download', ls: 'storage.list',
|
|
23
|
+
rm: 'storage.delete', quota: 'storage.quota', 'get-by-share': 'storage.get_by_share',
|
|
24
|
+
}[sub];
|
|
22
25
|
if (!operation || !aid || !isValidAid(aid))
|
|
23
26
|
throw new Error('Invalid storage command or AID');
|
|
24
|
-
const counts = {
|
|
27
|
+
const counts = {
|
|
28
|
+
upload: [4], download: [3, 4], ls: [2, 3], rm: [3], quota: [2], 'get-by-share': [3, 4],
|
|
29
|
+
};
|
|
25
30
|
if (!counts[sub].includes(positionals.length) || (isPublic && sub !== 'upload'))
|
|
26
31
|
throw new Error('Invalid storage arguments');
|
|
27
|
-
return { sub, aid, operation, isPublic,
|
|
32
|
+
return { sub, aid, operation, isPublic,
|
|
33
|
+
localFile: sub === 'upload' ? source : undefined,
|
|
28
34
|
remotePath: sub === 'upload' ? destination : sub === 'rm' ? source : undefined,
|
|
29
|
-
url: sub === 'download' ? source : undefined,
|
|
30
|
-
|
|
35
|
+
url: sub === 'download' ? source : undefined,
|
|
36
|
+
localPath: sub === 'download' ? destination : sub === 'get-by-share' ? destination : undefined,
|
|
37
|
+
prefix: sub === 'ls' ? source ?? '' : undefined,
|
|
38
|
+
shareId: sub === 'get-by-share' ? source : undefined };
|
|
31
39
|
}
|
package/dist/channels/aun.js
CHANGED
|
@@ -12,6 +12,7 @@ import { middleOutputModePolicy, resolveShowActivities, showActivitiesPolicy } f
|
|
|
12
12
|
import { DEFAULT_FLUSH_DELAY_SECONDS } from '../types.js';
|
|
13
13
|
import { resolvePaths, agentDir as agentDirPath, resolveRoot, channelStatePath } from '../paths.js';
|
|
14
14
|
import { getAunRequestRegistry, MAX_AUN_VOLATILE_TTL_SECONDS } from '../core/message/aun-request-registry.js';
|
|
15
|
+
import { resolveAunSendDevice } from '../aun/ability-device-routing.js';
|
|
15
16
|
import { saveToUploads, saveRelationAttachment, sanitizeFileName, bufferToInboundImage, safeFetch } from '../utils/media-cache.js';
|
|
16
17
|
import { appendAidEvent } from '../utils/instance-registry.js';
|
|
17
18
|
import { appendMessageLog, appendMessageLogStrict, buildOutboundEntry, buildInboundEntry, classifyAunPayloadForLog, findLatestMessageLogOperation, findMessageLogOperationMessageId, hasMessageLogOperation } from '../core/message/message-log.js';
|
|
@@ -568,23 +569,36 @@ function setIfDefined(target, key, value) {
|
|
|
568
569
|
if (value !== undefined)
|
|
569
570
|
target[key] = value;
|
|
570
571
|
}
|
|
571
|
-
function
|
|
572
|
+
function rawErrorText(raw) {
|
|
572
573
|
if (typeof raw !== 'string' || !raw.trim())
|
|
573
574
|
return undefined;
|
|
574
575
|
const text = raw.trim();
|
|
575
576
|
const htmlStart = text.toLowerCase().indexOf('<html');
|
|
576
577
|
return htmlStart >= 0 ? text.slice(0, htmlStart).trimEnd() : text;
|
|
577
578
|
}
|
|
578
|
-
function projectedRawError(raw, displayRaw) {
|
|
579
|
-
if (typeof raw !== 'string')
|
|
580
|
-
return raw;
|
|
581
|
-
return raw.trim() ? displayRaw : raw;
|
|
582
|
-
}
|
|
583
579
|
function appendRawErrorText(text, raw) {
|
|
584
|
-
const
|
|
585
|
-
if (!
|
|
580
|
+
const rawText = rawErrorText(raw);
|
|
581
|
+
if (!rawText || text.includes(rawText))
|
|
586
582
|
return text;
|
|
587
|
-
return `${text}\n原因:${
|
|
583
|
+
return `${text}\n原因:${rawText}`;
|
|
584
|
+
}
|
|
585
|
+
function structuredErrorSendReceipt(envelope, result, threadId) {
|
|
586
|
+
if (result.messageId)
|
|
587
|
+
return sentReceipt(envelope, [result.messageId], threadId);
|
|
588
|
+
const operationId = envelope.operationId ?? envelope.taskId;
|
|
589
|
+
if ((result.status === 'retry' || result.queued) && result.outboxId) {
|
|
590
|
+
return {
|
|
591
|
+
status: 'queued', operationId, messages: [], outboxId: result.outboxId,
|
|
592
|
+
...(result.error !== undefined ? { error: result.error } : {}),
|
|
593
|
+
...(result.code !== undefined ? { code: result.code } : {}),
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
return {
|
|
597
|
+
status: 'failed', operationId, messages: [],
|
|
598
|
+
...(result.outboxId !== undefined ? { outboxId: result.outboxId } : {}),
|
|
599
|
+
error: result.error ?? 'AUN structured error send returned no delivery receipt',
|
|
600
|
+
code: result.code ?? 'MISSING_SEND_RECEIPT',
|
|
601
|
+
};
|
|
588
602
|
}
|
|
589
603
|
/**
|
|
590
604
|
* 把 AUNChannel 投递的 opts 映射成渠道无关的 InboundMessage。
|
|
@@ -2539,6 +2553,7 @@ export class AUNChannel {
|
|
|
2539
2553
|
const responseRecord = getAunRequestRegistry().resolveIncoming({
|
|
2540
2554
|
selfAid: this._aid || this.config.aid,
|
|
2541
2555
|
fromAid,
|
|
2556
|
+
fromDeviceId: typeof msg.sender_device_id === 'string' ? msg.sender_device_id : undefined,
|
|
2542
2557
|
messageId,
|
|
2543
2558
|
payload,
|
|
2544
2559
|
});
|
|
@@ -2763,6 +2778,7 @@ export class AUNChannel {
|
|
|
2763
2778
|
const responseRecord = getAunRequestRegistry().resolveIncoming({
|
|
2764
2779
|
selfAid: this._aid || this.config.aid,
|
|
2765
2780
|
fromAid: senderAid,
|
|
2781
|
+
fromDeviceId: typeof msg.sender_device_id === 'string' ? msg.sender_device_id : undefined,
|
|
2766
2782
|
messageId,
|
|
2767
2783
|
payload,
|
|
2768
2784
|
});
|
|
@@ -4045,6 +4061,9 @@ export class AUNChannel {
|
|
|
4045
4061
|
finalPayload.task_id = context.metadata.taskId;
|
|
4046
4062
|
if (context?.metadata?.chatmode && !finalPayload.chatmode)
|
|
4047
4063
|
finalPayload.chatmode = context.metadata.chatmode;
|
|
4064
|
+
// 结构化/通知类 payload 与文本路径共用同一份诊断字典;缺省不带,sentAt 由发送时刻盖戳。
|
|
4065
|
+
if (context?.debug)
|
|
4066
|
+
finalPayload.debug = { ...context.debug, sentAt: localTimestamp() };
|
|
4048
4067
|
return finalPayload;
|
|
4049
4068
|
}
|
|
4050
4069
|
/**
|
|
@@ -4299,15 +4318,17 @@ export class AUNChannel {
|
|
|
4299
4318
|
const now = Date.now();
|
|
4300
4319
|
const mapTtl = typeof action.expiresAt === 'number' && Number.isFinite(action.expiresAt)
|
|
4301
4320
|
? Math.max(0, action.expiresAt - now)
|
|
4302
|
-
:
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4321
|
+
: undefined;
|
|
4322
|
+
if (mapTtl !== undefined) {
|
|
4323
|
+
const mapTimer = setTimeout(() => {
|
|
4324
|
+
this.cardMessageIdMap.delete(messageId);
|
|
4325
|
+
const ids = this.interactionCardMessageIds.get(action.requestId);
|
|
4326
|
+
ids?.delete(messageId);
|
|
4327
|
+
if (ids && ids.size === 0)
|
|
4328
|
+
this.interactionCardMessageIds.delete(action.requestId);
|
|
4329
|
+
}, mapTtl);
|
|
4330
|
+
mapTimer.unref?.();
|
|
4331
|
+
}
|
|
4311
4332
|
const ownedTimer = setTimeout(() => {
|
|
4312
4333
|
this.ownedCardMsgIds.delete(messageId);
|
|
4313
4334
|
this.ownedCardTopics.delete(messageId);
|
|
@@ -4492,6 +4513,7 @@ export class AUNChannel {
|
|
|
4492
4513
|
channelId,
|
|
4493
4514
|
delivery,
|
|
4494
4515
|
dedupeKey: opts.dedupeKey,
|
|
4516
|
+
critical: opts.critical,
|
|
4495
4517
|
type: 'payload',
|
|
4496
4518
|
contentKind: opts.contentKind,
|
|
4497
4519
|
payload: finalPayload,
|
|
@@ -4801,6 +4823,12 @@ export class AUNChannel {
|
|
|
4801
4823
|
return seqInTurn;
|
|
4802
4824
|
}
|
|
4803
4825
|
async sendDaemonMsg(args) {
|
|
4826
|
+
try {
|
|
4827
|
+
resolveAunSendDevice(args.deviceId, 'msg', args.payload);
|
|
4828
|
+
}
|
|
4829
|
+
catch (error) {
|
|
4830
|
+
return { ok: false, code: error.code, error: error.message };
|
|
4831
|
+
}
|
|
4804
4832
|
if (!args.to) {
|
|
4805
4833
|
return { ok: false, error: 'aun-msg-send requires a private target', code: 'UNSUPPORTED_TARGET' };
|
|
4806
4834
|
}
|
|
@@ -4865,7 +4893,10 @@ export class AUNChannel {
|
|
|
4865
4893
|
}).effectiveRole;
|
|
4866
4894
|
}
|
|
4867
4895
|
catch { /* 角色解析失败按未知处理 */ }
|
|
4868
|
-
chatmode = chatmodeForPeerIdentity({ isMachine: info.type !== 'human', type: info.type ?? undefined }, peerRole
|
|
4896
|
+
chatmode = chatmodeForPeerIdentity({ isMachine: info.type !== 'human', type: info.type ?? undefined }, peerRole, {
|
|
4897
|
+
self: this.config.aid,
|
|
4898
|
+
peerKey: formatPeerKey('aun', args.to),
|
|
4899
|
+
});
|
|
4869
4900
|
}
|
|
4870
4901
|
if (chatmode && !finalPayload.chatmode)
|
|
4871
4902
|
finalPayload.chatmode = chatmode;
|
|
@@ -4883,6 +4914,7 @@ export class AUNChannel {
|
|
|
4883
4914
|
to: args.to,
|
|
4884
4915
|
payload: preserveRawPayload ? finalPayload : this.truncatePayloadIfNeeded(finalPayload, 'msg-send-ipc'),
|
|
4885
4916
|
encrypt,
|
|
4917
|
+
...(args.deviceId ? { device_id: args.deviceId } : {}),
|
|
4886
4918
|
...(args.ttl !== undefined ? { ttl: args.ttl } : {}),
|
|
4887
4919
|
};
|
|
4888
4920
|
try {
|
|
@@ -6604,26 +6636,36 @@ export class AUNChannelPlugin {
|
|
|
6604
6636
|
}
|
|
6605
6637
|
const taskBase = () => channel.buildTaskPayloadBase(envelope, replyCtx);
|
|
6606
6638
|
switch (payload.kind) {
|
|
6607
|
-
case 'result.text':
|
|
6608
|
-
case 'command.result':
|
|
6609
6639
|
case 'command.error': {
|
|
6640
|
+
const raw = rawErrorText(payload.raw) ?? payload.text;
|
|
6641
|
+
const errorPayload = {
|
|
6642
|
+
type: 'error',
|
|
6643
|
+
...taskBase(),
|
|
6644
|
+
subtype: payload.kind,
|
|
6645
|
+
text: appendRawErrorText(payload.text, raw),
|
|
6646
|
+
message: payload.text,
|
|
6647
|
+
user_message: payload.text,
|
|
6648
|
+
raw,
|
|
6649
|
+
recoverable: true,
|
|
6650
|
+
};
|
|
6651
|
+
for (const key of ['format', 'reason', 'reasonCode', 'nextStep']) {
|
|
6652
|
+
setIfDefined(errorPayload, key, payload[key]);
|
|
6653
|
+
}
|
|
6654
|
+
await channel.sendReliableStructured(channelId, errorPayload, { ...(replyCtx ?? {}), suppressPeerMention: true }, payload.text);
|
|
6655
|
+
return;
|
|
6656
|
+
}
|
|
6657
|
+
case 'result.text':
|
|
6658
|
+
case 'command.result': {
|
|
6610
6659
|
// Group command feedback is control traffic, not model input for
|
|
6611
6660
|
// the other agents in the conversation.
|
|
6612
|
-
if (delivery.chatType === 'group'
|
|
6613
|
-
&& (payload.kind === 'command.result' || payload.kind === 'command.error')) {
|
|
6614
|
-
const isError = payload.kind === 'command.error';
|
|
6661
|
+
if (delivery.chatType === 'group' && payload.kind === 'command.result') {
|
|
6615
6662
|
const feedback = {
|
|
6616
|
-
type:
|
|
6663
|
+
type: 'notice',
|
|
6617
6664
|
...taskBase(),
|
|
6618
6665
|
subtype: payload.kind,
|
|
6619
6666
|
text: payload.text,
|
|
6620
|
-
|
|
6621
|
-
? { message: payload.text, user_message: payload.text, recoverable: true }
|
|
6622
|
-
: { severity: 'info' }),
|
|
6667
|
+
severity: 'info',
|
|
6623
6668
|
};
|
|
6624
|
-
for (const key of ['format', 'reason', 'reasonCode', 'nextStep']) {
|
|
6625
|
-
setIfDefined(feedback, key, payload[key]);
|
|
6626
|
-
}
|
|
6627
6669
|
await channel.sendReliableStructured(channelId, feedback, { ...(replyCtx ?? {}), suppressPeerMention: true }, payload.text);
|
|
6628
6670
|
return;
|
|
6629
6671
|
}
|
|
@@ -6699,37 +6741,32 @@ export class AUNChannelPlugin {
|
|
|
6699
6741
|
return;
|
|
6700
6742
|
}
|
|
6701
6743
|
case 'system.error': {
|
|
6702
|
-
const raw =
|
|
6703
|
-
const projectedRaw = projectedRawError(payload.raw, raw);
|
|
6744
|
+
const raw = rawErrorText(payload.raw) ?? payload.text;
|
|
6704
6745
|
const errorPayload = {
|
|
6705
|
-
type:
|
|
6746
|
+
type: 'error',
|
|
6706
6747
|
...taskBase(),
|
|
6707
6748
|
subtype: payload.subtype,
|
|
6708
|
-
text: payload.
|
|
6709
|
-
|
|
6710
|
-
: appendRawErrorText(payload.text, raw),
|
|
6711
|
-
...(projectedRaw !== undefined ? { raw: projectedRaw } : {}),
|
|
6749
|
+
text: appendRawErrorText(payload.text, raw),
|
|
6750
|
+
raw,
|
|
6712
6751
|
...(payload.reason !== undefined ? { reason: payload.reason } : {}),
|
|
6713
|
-
...(payload.recoverable
|
|
6714
|
-
? { severity: 'warn' }
|
|
6715
|
-
: { recoverable: false }),
|
|
6752
|
+
...(payload.recoverable !== undefined ? { recoverable: payload.recoverable } : {}),
|
|
6716
6753
|
};
|
|
6717
|
-
await channel.sendReliableStructured(channelId, errorPayload, { ...(replyCtx ?? {}), suppressPeerMention: true }, payload.text);
|
|
6718
|
-
return;
|
|
6754
|
+
const result = await channel.sendReliableStructured(channelId, errorPayload, { ...(replyCtx ?? {}), suppressPeerMention: true }, payload.text);
|
|
6755
|
+
return structuredErrorSendReceipt(envelope, result, replyCtx?.threadId);
|
|
6719
6756
|
}
|
|
6720
6757
|
case 'result.error': {
|
|
6721
|
-
const raw =
|
|
6722
|
-
const projectedRaw = projectedRawError(payload.raw, raw);
|
|
6758
|
+
const raw = rawErrorText(payload.raw) ?? payload.text;
|
|
6723
6759
|
const errorPayload = {
|
|
6724
6760
|
type: 'error',
|
|
6725
6761
|
...taskBase(),
|
|
6726
6762
|
text: appendRawErrorText(payload.text, raw),
|
|
6763
|
+
raw,
|
|
6727
6764
|
};
|
|
6728
6765
|
setIfDefined(errorPayload, 'subtype', payload.subtype);
|
|
6729
6766
|
setIfDefined(errorPayload, 'reason', payload.reason);
|
|
6730
|
-
setIfDefined(errorPayload, '
|
|
6731
|
-
await channel.sendReliableStructured(channelId, errorPayload, { ...(replyCtx ?? {}), suppressPeerMention: true }, payload.text);
|
|
6732
|
-
return;
|
|
6767
|
+
setIfDefined(errorPayload, 'recoverable', payload.recoverable);
|
|
6768
|
+
const result = await channel.sendReliableStructured(channelId, errorPayload, { ...(replyCtx ?? {}), suppressPeerMention: true }, payload.text);
|
|
6769
|
+
return structuredErrorSendReceipt(envelope, result, replyCtx?.threadId);
|
|
6733
6770
|
}
|
|
6734
6771
|
case 'result.file': {
|
|
6735
6772
|
const fileCtx = payload.correlationId
|
|
@@ -6859,9 +6896,10 @@ export class AUNChannelPlugin {
|
|
|
6859
6896
|
case 'interaction': {
|
|
6860
6897
|
const req = payload.interaction;
|
|
6861
6898
|
const cardTtlMs = AUN_INTERACTION_CARD_TTL_MS;
|
|
6899
|
+
const indefiniteBlockingInteraction = req.blocking === true && req.expiresAt === undefined;
|
|
6862
6900
|
const cardExpiresAt = typeof req.expiresAt === 'number' && Number.isFinite(req.expiresAt)
|
|
6863
6901
|
? req.expiresAt
|
|
6864
|
-
: Date.now() + cardTtlMs;
|
|
6902
|
+
: indefiniteBlockingInteraction ? undefined : Date.now() + cardTtlMs;
|
|
6865
6903
|
const toInteractionReceipt = (result) => {
|
|
6866
6904
|
if ((result.status === undefined || result.status === 'sent') && result.messageId) {
|
|
6867
6905
|
return sentReceipt(envelope, [result.messageId], replyCtx?.threadId);
|
|
@@ -6903,15 +6941,21 @@ export class AUNChannelPlugin {
|
|
|
6903
6941
|
const aunCard = withAunAttention({
|
|
6904
6942
|
type: 'action_card',
|
|
6905
6943
|
title: action.title,
|
|
6944
|
+
...(req.blocking === true ? { blocking: true } : {}),
|
|
6945
|
+
...(action.recommendedOption ? { recommended_option: action.recommendedOption } : {}),
|
|
6906
6946
|
actions: action.buttons.map(btn => ({
|
|
6907
|
-
label:
|
|
6947
|
+
label: action.recommendedOption === btn.key ? `💡 ${btn.label}` : btn.label,
|
|
6948
|
+
value: btn.key, style: btn.style ?? 'default', behavior: 'reply',
|
|
6908
6949
|
})),
|
|
6909
6950
|
});
|
|
6910
6951
|
// AUN action_card 以 compose behavior 声明自由文本动作。新版客户端
|
|
6911
6952
|
// 在卡片内采集并确认;旧版客户端可继续从主编辑器采集。两者都结构化
|
|
6912
6953
|
// 回传 action_card_reply{behavior:"compose"},Core 不拦截普通消息队列。
|
|
6913
6954
|
if (action.allowCustomInput) {
|
|
6914
|
-
aunCard.actions.push({
|
|
6955
|
+
aunCard.actions.push({
|
|
6956
|
+
label: '✏️ 手动输入', style: 'default', behavior: 'compose',
|
|
6957
|
+
...(cardExpiresAt !== undefined ? { compose_timeout_ms: Math.max(0, cardExpiresAt - Date.now()) } : {}),
|
|
6958
|
+
});
|
|
6915
6959
|
}
|
|
6916
6960
|
if (action.body) {
|
|
6917
6961
|
aunCard.text = action.body;
|
|
@@ -6928,7 +6972,10 @@ export class AUNChannelPlugin {
|
|
|
6928
6972
|
contentKind: 'card',
|
|
6929
6973
|
context: cardReplyContext,
|
|
6930
6974
|
dedupeKey: req.id.startsWith('gir-') || isAsyncQuestion ? operationId : undefined,
|
|
6931
|
-
|
|
6975
|
+
...(isAsyncQuestion && cardExpiresAt !== undefined
|
|
6976
|
+
? { ttl: Math.max(0, cardExpiresAt - Date.now()) }
|
|
6977
|
+
: {}),
|
|
6978
|
+
...(indefiniteBlockingInteraction ? { critical: true } : {}),
|
|
6932
6979
|
logText: action.title ? `[card] ${action.title}` : '[card]',
|
|
6933
6980
|
postSend: {
|
|
6934
6981
|
type: 'register_interaction_card',
|
package/dist/channels/daemon.js
CHANGED
|
@@ -187,11 +187,11 @@ export class DaemonChannel {
|
|
|
187
187
|
slot.acc.files.push({ path: payload.filePath, name: payload.fileName });
|
|
188
188
|
break;
|
|
189
189
|
case 'result.error':
|
|
190
|
-
slot.acc.error = { reason: payload.reason, text: payload.text, recoverable: payload.recoverable };
|
|
190
|
+
slot.acc.error = { reason: payload.reason, subtype: payload.subtype, text: payload.text, raw: payload.raw, recoverable: payload.recoverable };
|
|
191
191
|
this.finish(runId, 'error', { errorType: payload.reason ?? 'result_error' });
|
|
192
192
|
break;
|
|
193
193
|
case 'system.error':
|
|
194
|
-
slot.acc.error = { reason: payload.subtype, text: payload.text, recoverable: payload.recoverable };
|
|
194
|
+
slot.acc.error = { reason: payload.reason ?? payload.subtype, subtype: payload.subtype, text: payload.text, raw: payload.raw, recoverable: payload.recoverable };
|
|
195
195
|
this.finish(runId, 'error', { errorType: payload.subtype });
|
|
196
196
|
break;
|
|
197
197
|
case 'status.progress':
|
|
@@ -221,8 +221,10 @@ export class DaemonChannel {
|
|
|
221
221
|
case 'status.error':
|
|
222
222
|
if (payload.metadata?.message) {
|
|
223
223
|
slot.acc.error = {
|
|
224
|
-
reason: payload.metadata.errorType ?? 'status_error',
|
|
224
|
+
reason: payload.metadata.reason ?? payload.metadata.errorType ?? 'status_error',
|
|
225
|
+
subtype: payload.metadata.errorType,
|
|
225
226
|
text: payload.metadata.message,
|
|
227
|
+
raw: payload.metadata.raw,
|
|
226
228
|
recoverable: payload.metadata.recoverable,
|
|
227
229
|
};
|
|
228
230
|
}
|
|
@@ -236,6 +238,16 @@ export class DaemonChannel {
|
|
|
236
238
|
this.finish(runId, 'interrupted', payload.metadata);
|
|
237
239
|
break;
|
|
238
240
|
case 'status.timeout':
|
|
241
|
+
slot.acc.error = {
|
|
242
|
+
reason: payload.metadata?.reason ?? payload.metadata?.errorType ?? 'timeout',
|
|
243
|
+
subtype: payload.metadata?.errorType,
|
|
244
|
+
text: payload.metadata?.message
|
|
245
|
+
?? (payload.metadata?.idleSec
|
|
246
|
+
? `任务超时(${payload.metadata.idleSec}秒无响应),已自动中断`
|
|
247
|
+
: '任务超时,已自动中断'),
|
|
248
|
+
recoverable: payload.metadata?.recoverable,
|
|
249
|
+
raw: payload.metadata?.raw,
|
|
250
|
+
};
|
|
239
251
|
this.finish(runId, 'timeout', payload.metadata);
|
|
240
252
|
break;
|
|
241
253
|
}
|
|
@@ -424,9 +436,13 @@ export class DaemonChannel {
|
|
|
424
436
|
slot.acc.error = {
|
|
425
437
|
reason: 'daemon_watchdog_timeout',
|
|
426
438
|
text: `daemon conversation watchdog timed out after ${this.watchdogMs}ms`,
|
|
439
|
+
recoverable: true,
|
|
427
440
|
};
|
|
428
|
-
if (!this.claimTerminal(slot, '
|
|
441
|
+
if (!this.claimTerminal(slot, 'timeout', {
|
|
429
442
|
errorType: 'daemon_watchdog_timeout',
|
|
443
|
+
reason: 'daemon_watchdog_timeout',
|
|
444
|
+
message: slot.acc.error.text,
|
|
445
|
+
recoverable: true,
|
|
430
446
|
watchdogMs: this.watchdogMs,
|
|
431
447
|
}))
|
|
432
448
|
return;
|
|
@@ -448,9 +464,13 @@ export class DaemonChannel {
|
|
|
448
464
|
slot.acc.error = {
|
|
449
465
|
reason: 'daemon_total_execution_timeout',
|
|
450
466
|
text: `daemon conversation exceeded total execution limit of ${totalExecutionMs}ms`,
|
|
467
|
+
recoverable: true,
|
|
451
468
|
};
|
|
452
469
|
if (!this.claimTerminal(slot, 'timeout', {
|
|
453
470
|
errorType: 'daemon_total_execution_timeout',
|
|
471
|
+
reason: 'daemon_total_execution_timeout',
|
|
472
|
+
message: slot.acc.error.text,
|
|
473
|
+
recoverable: true,
|
|
454
474
|
totalExecutionMs,
|
|
455
475
|
}))
|
|
456
476
|
return;
|
|
@@ -88,7 +88,13 @@ export function buildDingtalkCardParamMap(interaction, state, status = '') {
|
|
|
88
88
|
};
|
|
89
89
|
for (let i = 0; i < DINGTALK_CARD_MAX_BUTTONS; i++) {
|
|
90
90
|
const button = interaction.kind.buttons[i];
|
|
91
|
-
map[`button_${i}_text`] = button
|
|
91
|
+
map[`button_${i}_text`] = button
|
|
92
|
+
? (interaction.kind.kind === 'action'
|
|
93
|
+
&& 'key' in button
|
|
94
|
+
&& interaction.kind.recommendedOption === button.key
|
|
95
|
+
? `💡 ${button.label}`
|
|
96
|
+
: button.label)
|
|
97
|
+
: '';
|
|
92
98
|
map[`button_${i}_style`] = button?.style || 'default';
|
|
93
99
|
map[`button_${i}_visible`] = button ? 'true' : 'false';
|
|
94
100
|
map[`button_${i}_disabled`] = state !== 'pending' || !!(button && 'disabled' in button && button.disabled)
|
|
@@ -1005,7 +1011,7 @@ export class DingtalkChannel {
|
|
|
1005
1011
|
continue;
|
|
1006
1012
|
}
|
|
1007
1013
|
const expired = (entry.interaction.expiresAt != null && entry.interaction.expiresAt <= now)
|
|
1008
|
-
|| entry.createdAt <= now - DINGTALK_CARD_PENDING_TTL_MS;
|
|
1014
|
+
|| (entry.interaction.blocking !== true && entry.createdAt <= now - DINGTALK_CARD_PENDING_TTL_MS);
|
|
1009
1015
|
if (!expired)
|
|
1010
1016
|
continue;
|
|
1011
1017
|
entry.invalidated = true;
|
package/dist/channels/feishu.js
CHANGED
|
@@ -1399,7 +1399,12 @@ export function buildCardV2(interaction, opts) {
|
|
|
1399
1399
|
buttons.forEach((btn, idx) => {
|
|
1400
1400
|
const buttonEl = {
|
|
1401
1401
|
tag: 'button',
|
|
1402
|
-
text: {
|
|
1402
|
+
text: {
|
|
1403
|
+
tag: 'plain_text',
|
|
1404
|
+
content: kind.kind === 'action' && kind.recommendedOption === btn.key
|
|
1405
|
+
? `💡 ${btn.label}`
|
|
1406
|
+
: btn.label,
|
|
1407
|
+
},
|
|
1403
1408
|
type: btn.style === 'danger' ? 'danger' : btn.style === 'primary' ? 'primary' : 'default',
|
|
1404
1409
|
action_type: 'form_submit',
|
|
1405
1410
|
name: `btn_${idx}`,
|
package/dist/channels/wecom.js
CHANGED
|
@@ -257,8 +257,9 @@ export class PersistentWecomCardStore {
|
|
|
257
257
|
let changed = false;
|
|
258
258
|
for (const [taskId, record] of this.records) {
|
|
259
259
|
const terminalExpiry = record.updatedAt + DEFAULT_CARD_RETENTION_MS;
|
|
260
|
-
const pendingExpiry =
|
|
261
|
-
|
|
260
|
+
const pendingExpiry = record.interaction.blocking === true
|
|
261
|
+
? Number.POSITIVE_INFINITY
|
|
262
|
+
: (record.expiresAt ?? record.createdAt + 7 * DEFAULT_CARD_RETENTION_MS) + DEFAULT_CARD_RETENTION_MS;
|
|
262
263
|
const expiresAt = record.status === 'pending' ? pendingExpiry : terminalExpiry;
|
|
263
264
|
if (now > expiresAt) {
|
|
264
265
|
this.records.delete(taskId);
|
|
@@ -322,7 +323,10 @@ export function buildWecomInteractionCard(interaction, taskId) {
|
|
|
322
323
|
.filter(({ button }) => !('disabled' in button) || !button.disabled)
|
|
323
324
|
.slice(0, 6)
|
|
324
325
|
.map(({ button, index }) => ({
|
|
325
|
-
text: truncate(
|
|
326
|
+
text: truncate(interaction.kind.kind === 'action' && 'key' in button
|
|
327
|
+
&& interaction.kind.recommendedOption === button.key
|
|
328
|
+
? `💡 ${button.label}`
|
|
329
|
+
: button.label, 10) || `选项 ${index + 1}`,
|
|
326
330
|
style: buttonStyle(button.style),
|
|
327
331
|
key: interaction.kind.kind === 'command-card' ? `cmd_${index}` : `act_${index}`,
|
|
328
332
|
})),
|
|
@@ -82,6 +82,8 @@ function printAgentNewHelp() {
|
|
|
82
82
|
--project <path> 默认: 当前目录
|
|
83
83
|
--baseagent <claude|codex|gemini|ecagent>
|
|
84
84
|
默认: defaults 配置,否则检测本机可用基座
|
|
85
|
+
--model <id> 初始化可选;须在主机当前基座的可见模型目录中
|
|
86
|
+
--effort <level> 初始化可选;需同时指定 model,auto 使用默认强度
|
|
85
87
|
--owner <aid> 必填;初始协议 Owner 绑定意图
|
|
86
88
|
--name <display-name> 初始化必填;Bootstrap 默认取项目名称
|
|
87
89
|
--description <text> 初始化必填;Bootstrap 默认取项目描述
|