evolcore 0.0.49 → 0.0.50
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 +64 -1
- package/bin/ecmsg.js +9 -4
- package/dist/ability/caller/authorization.js +21 -0
- package/dist/ability/caller/command.js +164 -0
- package/dist/ability/caller/contract.js +102 -0
- package/dist/ability/caller/daemon.js +158 -0
- package/dist/ability/caller/service.js +380 -0
- package/dist/ability/command-contract.js +5 -0
- package/dist/ability/daemon.js +5 -1
- package/dist/ability/interop-v1.js +10 -3
- package/dist/ability/management.js +1 -0
- package/dist/agent-template/jobs.js +173 -1
- package/dist/agent-template/runtime.js +280 -6
- package/dist/agent-template/service.js +1159 -40
- package/dist/agent-template/types.js +2 -1
- package/dist/agents/baseagent-availability.js +27 -3
- package/dist/agents/baseagent-capability-adapter.js +102 -0
- package/dist/agents/baseagent-plugin-descriptor.js +274 -0
- package/dist/agents/baseagent-plugin-loader.js +145 -0
- package/dist/agents/baseagent.js +68 -2
- package/dist/agents/claude-gateway/agent-registration.js +389 -0
- package/dist/agents/claude-gateway/binding.js +96 -0
- package/dist/agents/claude-gateway/inbox.js +138 -0
- package/dist/agents/claude-gateway/index.js +125 -0
- package/dist/agents/claude-gateway/listing.js +330 -0
- package/dist/agents/claude-gateway/router.js +328 -0
- package/dist/agents/claude-gateway/sessions.js +128 -0
- package/dist/agents/claude-gateway/terminal.js +250 -0
- package/dist/agents/claude-gateway/transcript.js +272 -0
- package/dist/agents/claude-gateway/types.js +14 -0
- package/dist/agents/claude-runner.js +6 -10
- package/dist/agents/codex-runner.js +4 -1
- package/dist/agents/{gemini-runner.js → gemini/gemini-runner.js} +17 -17
- package/dist/{core/session/adapters → agents/gemini}/gemini-session-file-adapter.js +2 -2
- package/dist/agents/gemini/index.js +51 -0
- package/dist/aun/aid/control-aid.js +52 -32
- package/dist/aun/group/invite-service.js +6 -36
- package/dist/aun/group/operations.js +6 -0
- package/dist/aun/msg/mention-schema.js +1 -1
- package/dist/aun/msg/p2p.js +29 -1
- package/dist/aun/msg/upload.js +126 -3
- package/dist/build-identity.json +1 -1
- package/dist/channels/aun.js +537 -189
- package/dist/cli/ability-command.js +42 -0
- package/dist/cli/agent-command.js +20 -1
- package/dist/cli/agent-create.js +78 -18
- package/dist/cli/agent-template.js +5 -3
- package/dist/cli/agent.js +91 -0
- package/dist/cli/aun-commands.js +92 -34
- package/dist/cli/bench.js +5 -2
- package/dist/cli/config.js +22 -6
- package/dist/cli/daemon-commands.js +245 -101
- package/dist/cli/ecmsg-gateway.js +11 -9
- package/dist/cli/index.js +23 -4
- package/dist/cli/init.js +39 -63
- package/dist/cli/managed-command-guard.js +1 -0
- package/dist/cli/menu-client.js +32 -7
- package/dist/cli/pay-command.js +30 -0
- package/dist/cli/provider-command.js +6 -2
- package/dist/cli/restart-monitor.js +2 -2
- package/dist/cli/services-command.js +11 -9
- package/dist/cli/thread-command.js +78 -12
- package/dist/config/access-policy.js +16 -3
- package/dist/config/config-field-policy.js +17 -8
- package/dist/config/config-manager.js +86 -46
- package/dist/config/config-operation-service.js +22 -1
- package/dist/config/gateway-config.js +9 -8
- package/dist/config/owner-config.js +0 -16
- package/dist/config/peer-role-resolver.js +1 -7
- package/dist/config/providers-config.js +99 -16
- package/dist/config/providers-management.js +35 -19
- package/dist/config/resolved-config-op.js +1 -42
- package/dist/config/schema-migration.js +78 -5
- package/dist/config/schema-registry.js +52 -7
- package/dist/config-store.js +1309 -17
- package/dist/core/agent-application-service.js +220 -1
- package/dist/core/agent-ipc-registration.js +19 -2
- package/dist/core/agent-reload-coordinator.js +5 -0
- package/dist/core/agent-runtime.js +198 -54
- package/dist/core/auth/agent-delegation.js +14 -0
- package/dist/core/auth/operation-authorizer.js +16 -1
- package/dist/core/auth/operation-catalog.js +50 -7
- package/dist/core/baseagent-loader.js +30 -3
- package/dist/core/capability/capability-manager.js +16 -7
- package/dist/core/channel-runtime.js +4 -2
- package/dist/core/command/agent-control.js +20 -2
- package/dist/core/command/agent-template-menu.js +4 -3
- package/dist/core/command/cli-intent-parser.js +15 -0
- package/dist/core/command/menu-catalog.js +20 -4
- package/dist/core/command/menu-file-path.js +70 -0
- package/dist/core/command/menu-handler.js +91 -72
- package/dist/core/command/menu-protocol.js +5 -0
- package/dist/core/command/menu-query-batch.js +2 -2
- package/dist/core/command/private-mention-menu.js +71 -0
- package/dist/core/command/slash-handler.js +17 -26
- package/dist/core/command/team-workspace-bootstrap.js +2 -1
- package/dist/core/command/topic-slash.js +7 -1
- package/dist/core/daemon-bootstrap.js +0 -4
- package/dist/core/daemon-control.js +2 -1
- package/dist/core/daemon-lifecycle.js +13 -5
- package/dist/core/evolagent-registry.js +12 -7
- package/dist/core/handoff/runtime.js +1 -1
- package/dist/core/host-snapshot.js +8 -3
- package/dist/core/initialization/service.js +3 -0
- package/dist/core/interaction-router.js +130 -0
- package/dist/core/ipc-registration.js +4 -0
- package/dist/core/memory/consolidation-context.js +2 -1
- package/dist/core/memory/consolidation.js +35 -64
- package/dist/core/message/aun-ipc-sender.js +98 -21
- package/dist/core/message/aun-request-registry.js +31 -0
- package/dist/core/message/message-bridge.js +105 -6
- package/dist/core/message/message-log.js +8 -0
- package/dist/core/message/message-queue.js +5 -3
- package/dist/core/message/peer-mode.js +15 -4
- package/dist/core/message/response-engine.js +23 -8
- package/dist/core/message/send-options.js +37 -3
- package/dist/core/message/send-routing.js +11 -7
- package/dist/core/model/model-catalog.js +5 -5
- package/dist/core/ownership/owner-resolver.js +12 -86
- package/dist/core/pack-auth.js +4 -0
- package/dist/core/permission/ec-command-parser.js +182 -58
- package/dist/core/permission/protected-paths.js +64 -9
- package/dist/core/permission/services-path-acl.js +9 -2
- package/dist/core/permission/tool-policy.js +21 -9
- package/dist/core/session/adapters/claude-session-file-adapter.js +6 -2
- package/dist/core/session/adapters/codex-session-file-adapter.js +4 -0
- package/dist/core/session/session-manager.js +47 -10
- package/dist/core/session/session-mapper.js +16 -0
- package/dist/core/skill/index-generator.js +2 -3
- package/dist/core/skill/switch-resolver.js +3 -0
- package/dist/core/thread/command-parser.js +4 -1
- package/dist/core/thread/ipc-operation.js +4 -2
- package/dist/core/thread/thread-operation.js +25 -10
- package/dist/core/thread/thread-service.js +294 -55
- package/dist/core/thread/topic-id.js +52 -2
- package/dist/core/thread/types.js +15 -1
- package/dist/eck/kit-renderer.js +2 -1
- package/dist/ecweb/basic-settings-service.js +5 -9
- package/dist/ecweb/providers-service.js +4 -2
- package/dist/index.js +116 -41
- package/dist/ipc.js +58 -2
- package/dist/paths.js +48 -1
- package/dist/pay/command.js +38 -0
- package/dist/pay/protocol.js +136 -0
- package/dist/pay/runtime.js +188 -0
- package/dist/pay/service.js +384 -0
- package/dist/pay/store.js +81 -0
- package/dist/response-system/engines/v1/proactive-flow.js +29 -2
- package/dist/services/dispatcher.js +23 -5
- package/dist/services/host/main.js +388 -0
- package/dist/services/host/protocol.js +118 -0
- package/dist/services/host/resident.js +310 -0
- package/dist/services/host-client.js +386 -0
- package/dist/services/host-deploy.js +180 -0
- package/dist/services/host-launch.js +117 -0
- package/dist/services/host-recycle.js +203 -0
- package/dist/services/host-runtime.js +802 -0
- package/dist/services/idempotency.js +44 -86
- package/dist/services/index-generator.js +4 -3
- package/dist/services/index.js +176 -18
- package/dist/services/ipc-operation.js +204 -44
- package/dist/services/script-runner.js +515 -83
- package/dist/services/validation.js +109 -4
- package/dist/trigger/application-service.js +6 -4
- package/dist/trigger/local-files.js +19 -9
- package/dist/trigger/scheduler.js +22 -12
- package/dist/trigger/script-sandbox.js +51 -20
- package/dist/utils/aid-bind.js +3 -0
- package/dist/utils/evolcore-version.js +2 -2
- package/dist/utils/host-info.js +73 -0
- package/dist/utils/logger.js +2 -2
- package/dist/utils/media-cache.js +190 -43
- package/dist/utils/restart-safety.js +14 -1
- package/dist/utils/system-memory.js +113 -25
- package/dist/utils/systemd-lifecycle.js +154 -0
- package/dist/utils/windows-shell-trust.js +7 -3
- package/kits/docs/INDEX.md +3 -2
- package/kits/docs/aun/AUN/346/266/210/346/201/257/347/261/273/345/236/213/344/270/216/345/261/236/346/200/247.md +1 -0
- package/kits/docs/channels/aun.md +1 -1
- package/kits/docs/evolcore/INDEX.md +7 -6
- package/kits/docs/evolcore/agent.md +36 -1
- package/kits/docs/evolcore/aid.md +20 -3
- package/kits/docs/evolcore/config.md +1 -1
- package/kits/docs/evolcore/group.md +2 -1
- package/kits/docs/evolcore/memory-tags.md +2 -0
- package/kits/docs/evolcore/menu-client.md +3 -3
- package/kits/docs/evolcore/menu-protocol.md +7 -0
- package/kits/docs/evolcore/model.md +3 -0
- package/kits/docs/evolcore/msg.md +68 -10
- package/kits/docs/evolcore/pay.md +34 -0
- package/kits/docs/evolcore/provider.md +21 -0
- package/kits/docs/evolcore/services.md +46 -18
- package/kits/docs/evolcore/thread-chain.md +2 -0
- package/kits/docs/evolcore/tool-authorization.md +10 -0
- package/kits/rules/01-overview.md +11 -32
- package/kits/rules/02-navigation.md +7 -0
- package/kits/rules/06-channel.md +3 -3
- package/kits/schemas/_meta.json +38 -5
- package/kits/schemas/agent-config.schema.21.json +974 -0
- package/kits/schemas/agent-config.schema.22.json +977 -0
- package/kits/schemas/agent-config.schema.23.json +958 -0
- package/kits/schemas/daemon.schema.10.json +373 -0
- package/kits/schemas/daemon.schema.9.json +12 -0
- package/kits/schemas/defaults.schema.7.json +472 -0
- package/kits/schemas/providers.schema.3.json +18 -2
- package/kits/schemas/relation-config.schema.13.json +289 -0
- package/kits/skills/.switches.json +13 -1
- package/kits/skills/ability/SKILL.md +229 -34
- package/kits/skills/ability/STRUCTURE.md +333 -0
- package/kits/skills/ability/references/cli.md +208 -0
- package/kits/skills/ability/references/development.md +107 -37
- package/kits/skills/ability/references/management.md +106 -46
- package/kits/skills/ability/references/runtime-protocol.md +65 -63
- package/kits/skills/agent-output-cards/SKILL.md +12 -5
- package/kits/skills/ec-group/SKILL.md +8 -6
- package/kits/skills/ec-group/TASK.md +186 -0
- package/kits/skills/ec-group/WORKLOG.md +180 -0
- package/kits/skills/ec-group-collaboration/SKILL.md +3 -3
- package/kits/skills/ec-pay/SKILL.md +101 -0
- package/kits/skills/ec-pay/references/pay-cli.md +110 -0
- package/kits/skills/ec-provider/SKILL.md +1 -1
- package/kits/skills/{ec-service-proxy → ec-proxy}/SKILL.md +8 -5
- package/kits/skills/ec-service-call/SKILL.md +135 -0
- package/kits/skills/ec-service-pack/SKILL.md +277 -0
- package/kits/skills/ec-trigger/SKILL.md +1 -1
- package/kits/templates/memory-consolidation/notes.md +2 -2
- package/kits/templates/memory-consolidation/workflow.md +46 -0
- package/kits/templates/system-fragments/channel.md +13 -4
- package/kits/templates/system-fragments/commands.md +4 -3
- package/kits/templates/system-fragments/reply.md +1 -0
- package/kits/templates/system-fragments/session.md +1 -1
- package/kits/templates/system-fragments/thread.md +27 -129
- package/kits/templates/system-fragments/venue.md +16 -0
- package/package.json +4 -5
- package/scripts/agent-template/inspect.mjs +37 -23
- package/scripts/agent-template/overlay.mjs +20 -2
- package/scripts/agent-template/shared/common.mjs +16 -4
- package/scripts/agent-template/shared/team-schema.json +20 -4
- package/scripts/agent-template/shared/template-contract.mjs +53 -13
- package/scripts/agent-template/shared/template-package.mjs +90 -26
- package/scripts/agent-template/shared/template-runtime.mjs +111 -1
- package/scripts/agent-template/shared/template.mjs +65 -7
- package/scripts/agent-template/team-pack.mjs +89 -33
- package/scripts/agent-template/team-preview.mjs +249 -5
- package/kits/docs/aun/ABILITY_CALLING.md +0 -280
- package/kits/docs/evolcore/ability.md +0 -185
- package/kits/skills/ability/references/calling.md +0 -56
- package/kits/skills/ability/references/contract-checklist.md +0 -37
- package/kits/skills/ability/references/recovery.md +0 -27
- /package/dist/{core/capability/providers → agents/gemini}/gemini-capability-provider.js +0 -0
package/dist/cli/aun-commands.js
CHANGED
|
@@ -6,7 +6,7 @@ import { normalizeGroupAid } from '../aun/group/index.js';
|
|
|
6
6
|
import { getArgValue, isHelpFlag, wantsHelp } from './help.js';
|
|
7
7
|
import { daemonUnavailableMessage, queryDaemon } from './help.js';
|
|
8
8
|
import { isValidAid as validSendAid } from '../aun/aid/validation.js';
|
|
9
|
-
import { MANAGED_SEND_BOOLEAN_FLAGS, MANAGED_SEND_VALUE_FLAGS } from '../core/message/send-options.js';
|
|
9
|
+
import { isValidEncryptMode, MANAGED_SEND_BOOLEAN_FLAGS, MANAGED_SEND_TRISTATE_FLAGS, MANAGED_SEND_VALUE_FLAGS, resolveEncryptFlagValue, } from '../core/message/send-options.js';
|
|
10
10
|
import { AGENT_DELEGATION_TOKEN_ENV, CODEX_SESSION_TOKEN_ENV, readDelegationCredential, } from '../core/auth/agent-delegation.js';
|
|
11
11
|
import { MAIN_CLI_BIN, SELF_AID_ENV, SESSION_ID_ENV } from '../product.js';
|
|
12
12
|
import { isTrustedFullAccessRuntimeContext, readBestTaskRuntimeContext, readVerifiedTaskRuntimeContext, RUNTIME_LOCK_DIR_ENV, SESSION_RUNTIME_DIR_ENV, TASK_RUNTIME_CONTEXT_ENV, } from './task-context.js';
|
|
@@ -1786,7 +1786,7 @@ export async function cmdMsg(args) {
|
|
|
1786
1786
|
Commands:
|
|
1787
1787
|
send <from> <to> <text> 发送文本
|
|
1788
1788
|
send <from> <to> --text-from-file <path> 从文件读取文本内容
|
|
1789
|
-
send <from> <to> --file <path> [--as <type>]
|
|
1789
|
+
send <from> <to> --file <path> [--as <type>] 发送文件或 WidgetCard
|
|
1790
1790
|
send <from> <to> --link <url> [--title T] 发送链接卡片
|
|
1791
1791
|
send <from> <to> --payload <json> 发送自定义 payload
|
|
1792
1792
|
send <from> <to> --payload-file <path> 从 UTF-8 文件读取自定义 payload
|
|
@@ -1813,8 +1813,8 @@ Options:
|
|
|
1813
1813
|
--return none|required 是否等待关联响应(required 建立请求记录)
|
|
1814
1814
|
--device-id <id> 定向到能力目录中的一台设备(protocol/discover 和 device/status 查询不指定;其他业务能力必填,不写入 payload)
|
|
1815
1815
|
--timeout <duration> required 的等待期限和 AUN volatile TTL,如 30s、60s、2m(默认 60s,最大 3600s)
|
|
1816
|
-
--encrypt
|
|
1817
|
-
|
|
1816
|
+
--encrypt yes|no|auto 加密三态:yes 强制加密 / no 强制明文 / auto 跟随入站消息
|
|
1817
|
+
不带此参数时默认 auto
|
|
1818
1818
|
--thread <id> 指定目标话题 ID(话题必须存在于本端索引;from/to 可省略)
|
|
1819
1819
|
--session <latest|all|id> 按 EvolCore 逻辑会话过滤历史(默认 latest)
|
|
1820
1820
|
--before <time> 只返回该时间之前的历史
|
|
@@ -1830,7 +1830,7 @@ Options:
|
|
|
1830
1830
|
Trigger 名:check-<目标threadId>-from-<来源threadId>-<唯一后缀>
|
|
1831
1831
|
结束/调整用返回的 trigger_id(trig_…),show/update/delete 只认 id
|
|
1832
1832
|
--content-type <mime> 显式覆盖 MIME(仅 --file 模式)
|
|
1833
|
-
--as <type> 附件类型:image|video|voice|file(仅 --file 模式)
|
|
1833
|
+
--as <type> 附件类型:image|video|voice|file|widget_card(仅 --file 模式)
|
|
1834
1834
|
--text <说明> 附件说明文字(仅 --file 模式)
|
|
1835
1835
|
--transcript <text> 语音转写(仅 --as voice)
|
|
1836
1836
|
--title <text> 链接标题(仅 --link 模式)
|
|
@@ -1838,6 +1838,13 @@ Options:
|
|
|
1838
1838
|
-- end-of-options:其后所有参数按正文处理
|
|
1839
1839
|
(用于发送恰好等于某 flag 的文本,如 send a b -- --encrypt)
|
|
1840
1840
|
|
|
1841
|
+
回执字段:
|
|
1842
|
+
to=<AID>(<来源>) 实际收件人;来源取 会话 / 传入 / 推导
|
|
1843
|
+
thread=<id>(<来源>) 实际落点话题;主话题回显 main
|
|
1844
|
+
跨话题自派时额外带 to=<本端AID>(跨话题自派) recipient=self topicPeer=<话题对端>
|
|
1845
|
+
核对规则: 出现 to=<本端AID> 但没有 recipient=self,说明该话题对端就是本端,属残缺结构;
|
|
1846
|
+
此时不会出现 topicPeer= 字段,消息也无人接收
|
|
1847
|
+
|
|
1841
1848
|
示例:
|
|
1842
1849
|
ec msg send alice.agentid.pub bob.agentid.pub "hello"
|
|
1843
1850
|
ec msg send alice.agentid.pub bob.agentid.pub --text-from-file long-message.txt
|
|
@@ -2221,6 +2228,7 @@ Options:
|
|
|
2221
2228
|
contentType: getArgValue(args, '--content-type'),
|
|
2222
2229
|
text: getArgValue(args, '--text'),
|
|
2223
2230
|
transcript: getArgValue(args, '--transcript'),
|
|
2231
|
+
title: getArgValue(args, '--title'),
|
|
2224
2232
|
};
|
|
2225
2233
|
}
|
|
2226
2234
|
else if (textFromFileVal) {
|
|
@@ -2282,10 +2290,6 @@ Options:
|
|
|
2282
2290
|
}
|
|
2283
2291
|
body = { mode: 'text', text };
|
|
2284
2292
|
}
|
|
2285
|
-
// 显式 flag 覆盖 daemon 默认值;未指定时保留 undefined。
|
|
2286
|
-
const encrypt = args.includes('--no-encrypt')
|
|
2287
|
-
? false
|
|
2288
|
-
: args.includes('--encrypt') ? true : undefined;
|
|
2289
2293
|
const thread = getArgValue(args, '--thread');
|
|
2290
2294
|
// P1b.6.5: 话题存在性校验 — 引用必须能解析成本端已存在的话题
|
|
2291
2295
|
let threadEntry;
|
|
@@ -2330,6 +2334,8 @@ Options:
|
|
|
2330
2334
|
const triggerPromptExtra = getArgValue(args, '--trigger-prompt');
|
|
2331
2335
|
let checkEveryDurationMs;
|
|
2332
2336
|
const runtime = await readBestTaskRuntimeContext();
|
|
2337
|
+
// 三态加密:不写 `--encrypt` 就是默认 auto,auto 需要本轮的入站加密态来解析。
|
|
2338
|
+
const encrypt = readTristateEncrypt(args, runtime?.inboundEncrypted);
|
|
2333
2339
|
if (thread && runtime?.sessionId) {
|
|
2334
2340
|
const parsedCheck = parseCheckEveryArgs(checkEveryRaw, hasCheckEvery);
|
|
2335
2341
|
if ('error' in parsedCheck) {
|
|
@@ -2659,8 +2665,8 @@ Options:
|
|
|
2659
2665
|
--app <name> 指定应用 slot(独立消费通道,不影响 daemon)
|
|
2660
2666
|
--aun-path <path> 指定 AUN keystore 根
|
|
2661
2667
|
--format json 输出 JSON 格式
|
|
2662
|
-
--encrypt
|
|
2663
|
-
|
|
2668
|
+
--encrypt yes|no|auto 加密三态:yes 强制加密 / no 强制明文 / auto 跟随入站消息(仅 send)
|
|
2669
|
+
不带此参数时默认 auto
|
|
2664
2670
|
--thread <id> 指定话题 ID(仅 send;话题必须存在于本端索引)
|
|
2665
2671
|
--check-every <时长|none> 跨话题发送(带 --thread)时**必填**,创建跨话题复查(如 5m/30m/2h);none = 不建复查
|
|
2666
2672
|
到期向**目标话题**投递【跨话题复查】通知,不新建会话
|
|
@@ -2671,7 +2677,7 @@ Options:
|
|
|
2671
2677
|
(如 --mention 'alice.agentid.pub,bob.agentid.pub'),可多次传入
|
|
2672
2678
|
--mention-all 发送时 @ 所有人
|
|
2673
2679
|
--content-type <mime> 显式覆盖 MIME(仅 --file 模式)
|
|
2674
|
-
--as <type> 附件类型:image|video|voice|file(仅 --file 模式)
|
|
2680
|
+
--as <type> 附件类型:image|video|voice|file|widget_card(仅 --file 模式)
|
|
2675
2681
|
--text <说明> 附件说明文字(仅 --file 模式)
|
|
2676
2682
|
--transcript <text> 语音转写(仅 --as voice)
|
|
2677
2683
|
--group-id <aid> 指定自定义群 AID(仅 create);省略时生成 g- 加五位随机数字
|
|
@@ -2931,9 +2937,6 @@ g- 是名称的一部分,会完整保留;默认命名格式为 g-10000 至 g
|
|
|
2931
2937
|
index++;
|
|
2932
2938
|
}
|
|
2933
2939
|
}
|
|
2934
|
-
if (optionArgs.includes('--encrypt') && optionArgs.includes('--no-encrypt')) {
|
|
2935
|
-
failManagedGroup(formatJson, 'INVALID_ARGUMENT', '--encrypt 与 --no-encrypt 不能同时使用');
|
|
2936
|
-
}
|
|
2937
2940
|
if ([fileVal, payloadVal, payloadFileVal].filter(Boolean).length > 1) {
|
|
2938
2941
|
failManagedGroup(formatJson, 'INVALID_ARGUMENT', '--file, --payload and --payload-file are mutually exclusive');
|
|
2939
2942
|
}
|
|
@@ -2946,8 +2949,8 @@ g- 是名称的一部分,会完整保留;默认命名格式为 g-10000 至 g
|
|
|
2946
2949
|
let body;
|
|
2947
2950
|
if (fileVal) {
|
|
2948
2951
|
const attachmentType = getSendArgValue('--as');
|
|
2949
|
-
if (attachmentType && !['image', 'video', 'voice', 'file'].includes(attachmentType)) {
|
|
2950
|
-
failManagedGroup(formatJson, 'INVALID_ARGUMENT', `--as 仅支持 image|video|voice|file: ${attachmentType}`);
|
|
2952
|
+
if (attachmentType && !['image', 'video', 'voice', 'file', 'widget_card'].includes(attachmentType)) {
|
|
2953
|
+
failManagedGroup(formatJson, 'INVALID_ARGUMENT', `--as 仅支持 image|video|voice|file|widget_card: ${attachmentType}`);
|
|
2951
2954
|
}
|
|
2952
2955
|
const transcript = getSendArgValue('--transcript');
|
|
2953
2956
|
if (transcript !== undefined && attachmentType !== 'voice') {
|
|
@@ -2960,6 +2963,7 @@ g- 是名称的一部分,会完整保留;默认命名格式为 g-10000 至 g
|
|
|
2960
2963
|
contentType: getSendArgValue('--content-type'),
|
|
2961
2964
|
text: getSendArgValue('--text'),
|
|
2962
2965
|
transcript,
|
|
2966
|
+
title: getSendArgValue('--title'),
|
|
2963
2967
|
};
|
|
2964
2968
|
}
|
|
2965
2969
|
else if (payloadVal) {
|
|
@@ -2990,10 +2994,9 @@ g- 是名称的一部分,会完整保留;默认命名格式为 g-10000 至 g
|
|
|
2990
2994
|
body = { mode: 'text', text };
|
|
2991
2995
|
}
|
|
2992
2996
|
const mentions = collectMentions();
|
|
2993
|
-
//
|
|
2994
|
-
const
|
|
2995
|
-
|
|
2996
|
-
: args.includes('--encrypt') ? true : undefined;
|
|
2997
|
+
// 三态加密:不写 `--encrypt` 就是默认 auto,auto 需要本轮的入站加密态来解析。
|
|
2998
|
+
const groupRuntime = await readBestTaskRuntimeContext();
|
|
2999
|
+
const encryptGroup = readTristateEncrypt(args, groupRuntime?.inboundEncrypted);
|
|
2997
3000
|
const thread = getSendArgValue('--thread');
|
|
2998
3001
|
// M2: 群话题跨话题发送与私聊同样必须指定 --check-every,并同样创建复查 Trigger + 写 inbox。
|
|
2999
3002
|
const groupCheckEveryRaw = getSendArgValue('--check-every');
|
|
@@ -3615,17 +3618,20 @@ async function runManagedSend(argv, formatJson) {
|
|
|
3615
3618
|
process.stderr.write(`⚠ 复查 Trigger 未创建: ${result.trigger_error}(消息已发出,需要复查请手动 ec trigger create)\n`);
|
|
3616
3619
|
}
|
|
3617
3620
|
}
|
|
3621
|
+
// 这些示例直接进模型上下文(门禁与 CLI 的拒绝提示都会引用),因此统一给
|
|
3622
|
+
// `ecmsg send` 写法:本端恒为会话本端,目标用 --to。`ec msg send <from> <to>`
|
|
3623
|
+
// 仍可用(宿主终端与历史脚本),只是不再作为提示内容教给模型。
|
|
3618
3624
|
const SEND_BODY_MODE_USAGE = {
|
|
3619
3625
|
msg: {
|
|
3620
|
-
'--file': "
|
|
3621
|
-
'--text-from-file': '
|
|
3622
|
-
'--link': "
|
|
3623
|
-
'--payload': "
|
|
3624
|
-
'--payload-file': '
|
|
3626
|
+
'--file': "ecmsg send --to <对端AID> --file <path> [--as <type>] [--text '<说明>']",
|
|
3627
|
+
'--text-from-file': 'ecmsg send --to <对端AID> --text-from-file <path>',
|
|
3628
|
+
'--link': "ecmsg send --to <对端AID> --link <url> [--title '<title>'] [--description '<desc>']",
|
|
3629
|
+
'--payload': "ecmsg send --to <对端AID> --payload '<json>'",
|
|
3630
|
+
'--payload-file': 'ecmsg send --to <对端AID> --payload-file <path>',
|
|
3625
3631
|
},
|
|
3626
3632
|
group: {
|
|
3627
|
-
'--file': "
|
|
3628
|
-
'--payload': "
|
|
3633
|
+
'--file': "ecmsg send --to <群AID> --file <path> [--as <type>] [--text '<说明>']",
|
|
3634
|
+
'--payload': "ecmsg send --to <群AID> --payload '<json>'",
|
|
3629
3635
|
},
|
|
3630
3636
|
};
|
|
3631
3637
|
function sendBodyModeConflict(scope, modes, hasPositionText) {
|
|
@@ -3668,12 +3674,23 @@ export function resolveManagedSendArgv(argv, routing) {
|
|
|
3668
3674
|
const mentions = [];
|
|
3669
3675
|
const valueFlags = new Set(MANAGED_SEND_VALUE_FLAGS);
|
|
3670
3676
|
const booleanFlags = new Set(MANAGED_SEND_BOOLEAN_FLAGS);
|
|
3677
|
+
const tristateFlags = new Set(MANAGED_SEND_TRISTATE_FLAGS);
|
|
3678
|
+
let encrypt;
|
|
3671
3679
|
for (let index = bodyStart; index < argv.length; index++) {
|
|
3672
3680
|
const flag = argv[index];
|
|
3673
3681
|
if (flag === '--') {
|
|
3674
3682
|
text.push(...argv.slice(index + 1));
|
|
3675
3683
|
break;
|
|
3676
3684
|
}
|
|
3685
|
+
if (tristateFlags.has(flag)) {
|
|
3686
|
+
// 三态取值,必须带 yes|no|auto;裸写是参数错误。
|
|
3687
|
+
const mode = argv[++index];
|
|
3688
|
+
if (!isValidEncryptMode(mode)) {
|
|
3689
|
+
throw new Error(`--encrypt 只接受 yes|no|auto${mode === undefined ? '' : `,收到 ${mode}`}`);
|
|
3690
|
+
}
|
|
3691
|
+
encrypt = mode === 'auto' ? 'auto' : resolveEncryptFlagValue(mode);
|
|
3692
|
+
continue;
|
|
3693
|
+
}
|
|
3677
3694
|
// `--to` / `--from` 是网关选项,托管发送用位置参数表达 from/to。它们不在
|
|
3678
3695
|
// 取值表里,落到下面就会进 text —— 正文会变成「--to x.agentid.cn 你好」,
|
|
3679
3696
|
// 消息照常送达,于是没人发现发错了。这里明确拒绝,让调用方改写法。
|
|
@@ -3682,6 +3699,10 @@ export function resolveManagedSendArgv(argv, routing) {
|
|
|
3682
3699
|
}
|
|
3683
3700
|
if (flag === '--app' || flag === '--aun-path')
|
|
3684
3701
|
throw new Error(`${flag} is not allowed for managed sends`);
|
|
3702
|
+
// 未知 `--flag` 会落到下面的 text.push,进而把整串参数当成正文静默发出去。
|
|
3703
|
+
if (flag.startsWith('--') && !valueFlags.has(flag) && !booleanFlags.has(flag) && !tristateFlags.has(flag)) {
|
|
3704
|
+
throw new Error(`未知发送参数:${flag}`);
|
|
3705
|
+
}
|
|
3685
3706
|
if (booleanFlags.has(flag))
|
|
3686
3707
|
booleans.add(flag);
|
|
3687
3708
|
else if (valueFlags.has(flag)) {
|
|
@@ -3704,8 +3725,6 @@ export function resolveManagedSendArgv(argv, routing) {
|
|
|
3704
3725
|
else
|
|
3705
3726
|
text.push(flag);
|
|
3706
3727
|
}
|
|
3707
|
-
if (booleans.has('--encrypt') && booleans.has('--no-encrypt'))
|
|
3708
|
-
throw new Error('Encryption options are mutually exclusive');
|
|
3709
3728
|
if (values.has('--format') && values.get('--format') !== 'json')
|
|
3710
3729
|
throw new Error('--format only supports json');
|
|
3711
3730
|
const returnPolicy = values.get('--return');
|
|
@@ -3783,11 +3802,13 @@ export function resolveManagedSendArgv(argv, routing) {
|
|
|
3783
3802
|
const payloadFile = values.get('--payload-file');
|
|
3784
3803
|
if (values.has('--file')) {
|
|
3785
3804
|
const as = values.get('--as');
|
|
3786
|
-
if (as && !['image', 'video', 'voice', 'file'].includes(as))
|
|
3805
|
+
if (as && !['image', 'video', 'voice', 'file', 'widget_card'].includes(as))
|
|
3787
3806
|
throw new Error('Invalid attachment type');
|
|
3788
3807
|
if (values.has('--transcript') && as !== 'voice')
|
|
3789
3808
|
throw new Error('--transcript requires --as voice');
|
|
3790
|
-
file = { filePath: values.get('--file'), as, contentType: values.get('--content-type'), text: values.get('--text'), transcript: values.get('--transcript') };
|
|
3809
|
+
file = { filePath: values.get('--file'), as, contentType: values.get('--content-type'), text: values.get('--text'), transcript: values.get('--transcript'), title: values.get('--title') };
|
|
3810
|
+
if (as === 'widget_card' && returnPolicy === 'required')
|
|
3811
|
+
throw new Error('WidgetCard replies use widget_card_reply, not --return required');
|
|
3791
3812
|
}
|
|
3792
3813
|
else if (values.has('--payload')) {
|
|
3793
3814
|
payload = parseJsonObjectArgument(values.get('--payload'));
|
|
@@ -3809,7 +3830,7 @@ export function resolveManagedSendArgv(argv, routing) {
|
|
|
3809
3830
|
const deviceId = resolveAunSendDevice(values.get('--device-id'), scope, payload);
|
|
3810
3831
|
return { aid, to, scope, payload, rawPayload: values.has('--payload') || values.has('--payload-file'), file, textFile: values.get('--text-from-file'), payloadFile,
|
|
3811
3832
|
deviceId,
|
|
3812
|
-
encrypt
|
|
3833
|
+
encrypt,
|
|
3813
3834
|
thread, checkEvery, checkEveryMs: checkEveryMs ?? undefined, triggerPromptExtra, returnPolicy: returnPolicy, timeoutMs, handoffContext,
|
|
3814
3835
|
mentions: mentions.length ? mentions : undefined };
|
|
3815
3836
|
}
|
|
@@ -3838,8 +3859,40 @@ const VALUE_FLAGS = new Set([
|
|
|
3838
3859
|
'--check-every', '--trigger-prompt',
|
|
3839
3860
|
]);
|
|
3840
3861
|
const BOOLEAN_FLAGS = new Set([
|
|
3841
|
-
'--
|
|
3862
|
+
'--mention-all', '--clear',
|
|
3842
3863
|
]);
|
|
3864
|
+
/** 三态取值选项:取值必须显式给出,随 flag 一起跳过。 */
|
|
3865
|
+
const TRISTATE_FLAGS = new Set(['--encrypt']);
|
|
3866
|
+
/**
|
|
3867
|
+
* 从 argv 读取 `--encrypt yes|no|auto`。
|
|
3868
|
+
*
|
|
3869
|
+
* 只有三态:裸写是参数错误。不写 `--encrypt` 时返回 undefined,
|
|
3870
|
+
* 语义就是默认值 `auto`——由调用方按「本轮是否被对端消息触发」解析,
|
|
3871
|
+
* 不能当成明文,更不能当成 `yes`。
|
|
3872
|
+
*/
|
|
3873
|
+
function readTristateEncrypt(args, inboundEncrypted) {
|
|
3874
|
+
for (let index = 0; index < args.length; index++) {
|
|
3875
|
+
if (args[index] === '--')
|
|
3876
|
+
break;
|
|
3877
|
+
if (args[index] !== '--encrypt')
|
|
3878
|
+
continue;
|
|
3879
|
+
const mode = args[++index];
|
|
3880
|
+
if (!isValidEncryptMode(mode)) {
|
|
3881
|
+
throw new Error(`--encrypt 只接受 yes|no|auto${mode === undefined ? '' : `,收到 ${mode}`}`);
|
|
3882
|
+
}
|
|
3883
|
+
return mode === 'auto' ? resolveAutoEncrypt(inboundEncrypted) : resolveEncryptFlagValue(mode);
|
|
3884
|
+
}
|
|
3885
|
+
// 完全没写 --encrypt:默认 auto。
|
|
3886
|
+
return resolveAutoEncrypt(inboundEncrypted);
|
|
3887
|
+
}
|
|
3888
|
+
/**
|
|
3889
|
+
* `auto` 的解析:被对端消息触发时沿用该消息的加密状态,否则明文。
|
|
3890
|
+
*
|
|
3891
|
+
* 与 `resolveSendRoute` 的 auto 语义一致;这里只服务不走网关的老命令。
|
|
3892
|
+
*/
|
|
3893
|
+
function resolveAutoEncrypt(inboundEncrypted) {
|
|
3894
|
+
return inboundEncrypted === true;
|
|
3895
|
+
}
|
|
3843
3896
|
function collectPositional(args, startIdx, extraValueFlags) {
|
|
3844
3897
|
const out = [];
|
|
3845
3898
|
let endOfFlags = false;
|
|
@@ -3857,6 +3910,11 @@ function collectPositional(args, startIdx, extraValueFlags) {
|
|
|
3857
3910
|
i++;
|
|
3858
3911
|
continue;
|
|
3859
3912
|
} // 精确匹配取值 flag:跳过其值
|
|
3913
|
+
if (TRISTATE_FLAGS.has(a)) { // 三态 flag:其取值既不是正文,也不参与位置参数
|
|
3914
|
+
if (isValidEncryptMode(args[i + 1]))
|
|
3915
|
+
i++;
|
|
3916
|
+
continue;
|
|
3917
|
+
}
|
|
3860
3918
|
if (BOOLEAN_FLAGS.has(a)) {
|
|
3861
3919
|
continue;
|
|
3862
3920
|
} // 精确匹配开关 flag:仅跳过自身
|
package/dist/cli/bench.js
CHANGED
|
@@ -488,9 +488,12 @@ Options:
|
|
|
488
488
|
console.log(warn(`仅 ${usableAids.length} 个可用,需创建 ${need} 个新 AID`));
|
|
489
489
|
const daemonConfig = loadDaemonConfig();
|
|
490
490
|
const aidDomain = resolveControlAidDomain(daemonConfig.aun?.defaultAidDomain);
|
|
491
|
-
|
|
491
|
+
// Owner comes from the ownership protocol; daemon.json no longer holds one.
|
|
492
|
+
const owner = daemonConfig.aid
|
|
493
|
+
? (await import('../core/ownership/owner-resolver.js')).getProtocolOwner(daemonConfig.aid)
|
|
494
|
+
: undefined;
|
|
492
495
|
if (!owner) {
|
|
493
|
-
console.error(`${RED} ✗ 创建 benchmark AID
|
|
496
|
+
console.error(`${RED} ✗ 创建 benchmark AID 需要已确认的控制 Owner;请先完成 ownership 绑定${RST}`);
|
|
494
497
|
process.exit(1);
|
|
495
498
|
}
|
|
496
499
|
for (let i = 0; i < need; i++) {
|
package/dist/cli/config.js
CHANGED
|
@@ -35,11 +35,15 @@ function getResultPayload(result) {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
function getResultLine(result) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
// 来源标签只由 source 决定,schemaDefault 单独标注。两者可能同时成立
|
|
39
|
+
// (对象配了一部分、缺的叶子回落默认),此时两个信息都得给出,
|
|
40
|
+
// 否则文本与 --format json 的 source+schemaDefault 字段读数不一致。
|
|
41
|
+
const sourceLabel = result.schemaDefault
|
|
42
|
+
? `schema default${result.source ? ` (over ${result.source.target})` : ''}`
|
|
43
|
+
: result.source?.target;
|
|
44
|
+
const head = sourceLabel
|
|
45
|
+
? `${result.field} = ${JSON.stringify(result.value)} [source: ${sourceLabel}]`
|
|
46
|
+
: `${result.field} = ${JSON.stringify(result.value)} (${result.scope})`;
|
|
43
47
|
const role = result.roleDetails
|
|
44
48
|
? `\n role: explicit=${JSON.stringify(result.roleDetails.explicitRole)} effective=${JSON.stringify(result.roleDetails.effectiveRole)} [${result.roleDetails.effectiveRoleSource}]`
|
|
45
49
|
: '';
|
|
@@ -179,10 +183,22 @@ function renderBatchGet(results, formatJson) {
|
|
|
179
183
|
}
|
|
180
184
|
async function runDirectBatchGet(fields, rest, formatJson) {
|
|
181
185
|
const results = await Promise.all(fields.map(async (field) => {
|
|
186
|
+
// 与单条路径共用同一个解析 + 执行组合,批量只是把同一字段重复 N 次;
|
|
187
|
+
// 选项(roleContext)也必须一致,否则 role 字段在单条/批量下会给出不同结论。
|
|
182
188
|
const resolved = resolveConfigCommand(['config', 'get', field, ...rest]);
|
|
183
189
|
if (!resolved.ok)
|
|
184
190
|
return { ok: false, field, code: resolved.code, error: resolved.reason };
|
|
185
|
-
const result = await executeResolvedConfigCommandAsync(resolved.command, {
|
|
191
|
+
const result = await executeResolvedConfigCommandAsync(resolved.command, {
|
|
192
|
+
role: process.env[AUTHENTICATED_CONFIG_ROLE_ENV],
|
|
193
|
+
roleContext: {
|
|
194
|
+
self: resolved.command.self || '',
|
|
195
|
+
actorRole: process.env[AUTHENTICATED_CONFIG_ROLE_ENV] || 'owner',
|
|
196
|
+
actorRoleSource: 'local-cli',
|
|
197
|
+
isDaemonOwner: false,
|
|
198
|
+
fromControlChannel: false,
|
|
199
|
+
aunAvailable: true,
|
|
200
|
+
},
|
|
201
|
+
});
|
|
186
202
|
if (!result.ok)
|
|
187
203
|
return { ok: false, field, code: result.code, error: result.error };
|
|
188
204
|
if (result.subcommand === 'get')
|