evolcore 0.0.1 → 0.0.2
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 +813 -0
- package/LICENSE +21 -0
- package/MIGRATION-0.5.0.md +378 -0
- package/README.md +318 -14
- package/ROLE_ACCESS_CONTROL.md +174 -0
- package/assets/.env.template +4 -0
- package/assets/brand/evolcore/README.md +19 -0
- package/assets/brand/evolcore/evolcore-app-icon.png +0 -0
- package/assets/brand/evolcore/evolcore-app-icon.svg +13 -0
- package/assets/brand/evolcore/evolcore-brand-board.png +0 -0
- package/assets/brand/evolcore/evolcore-brand-board.svg +126 -0
- package/assets/brand/evolcore/evolcore-logo-kit.zip +0 -0
- package/assets/brand/evolcore/evolcore-logo-reverse.png +0 -0
- package/assets/brand/evolcore/evolcore-logo-reverse.svg +14 -0
- package/assets/brand/evolcore/evolcore-logo.png +0 -0
- package/assets/brand/evolcore/evolcore-logo.svg +14 -0
- package/assets/brand/evolcore/evolcore-mark.png +0 -0
- package/assets/brand/evolcore/evolcore-mark.svg +10 -0
- package/bin/ec-safe-output.js +161 -0
- package/bin/ec.js +29 -0
- package/dist/agents/baseagent.js +163 -0
- package/dist/agents/claude-runner.js +2385 -0
- package/dist/agents/codex-app-server-client.js +448 -0
- package/dist/agents/codex-runner.js +2639 -0
- package/dist/agents/gemini-runner.js +666 -0
- package/dist/agents/runner-types.js +75 -0
- package/dist/aun/aid/agentmd.js +216 -0
- package/dist/aun/aid/client.js +132 -0
- package/dist/aun/aid/control-aid.js +91 -0
- package/dist/aun/aid/identity.js +518 -0
- package/dist/aun/aid/index.js +4 -0
- package/dist/aun/aid/store.js +74 -0
- package/dist/aun/aid/types.js +1 -0
- package/dist/aun/aid/validation.js +21 -0
- package/dist/aun/group-identity.js +10 -0
- package/dist/aun/msg/group-index.js +6 -0
- package/dist/aun/msg/group.js +1231 -0
- package/dist/aun/msg/history.js +123 -0
- package/dist/aun/msg/index.js +5 -0
- package/dist/aun/msg/p2p.js +393 -0
- package/dist/aun/msg/payload-type.js +27 -0
- package/dist/aun/msg/upload.js +137 -0
- package/dist/aun/outbox.js +160 -0
- package/dist/aun/rpc/caller.js +42 -0
- package/dist/aun/rpc/connection.js +25 -0
- package/dist/aun/rpc/index.js +2 -0
- package/dist/aun/service-proxy.js +225 -0
- package/dist/aun/storage/download.js +29 -0
- package/dist/aun/storage/index.js +3 -0
- package/dist/aun/storage/manage.js +10 -0
- package/dist/aun/storage/upload.js +68 -0
- package/dist/channels/aun.js +4147 -0
- package/dist/channels/daemon.js +422 -0
- package/dist/channels/dingtalk.js +649 -0
- package/dist/channels/feishu.js +1789 -0
- package/dist/channels/qqbot.js +409 -0
- package/dist/channels/wechat.js +817 -0
- package/dist/channels/wecom.js +565 -0
- package/dist/cli/agent-command.js +641 -0
- package/dist/cli/agent.js +1059 -0
- package/dist/cli/aun-commands.js +1948 -0
- package/dist/cli/bench.js +1228 -0
- package/dist/cli/cli-argv.js +66 -0
- package/dist/cli/code-stats.js +329 -0
- package/dist/cli/command-log.js +82 -0
- package/dist/cli/config-selector.js +69 -0
- package/dist/cli/config.js +261 -0
- package/dist/cli/ctl-command.js +62 -0
- package/dist/cli/daemon-commands.js +2887 -0
- package/dist/cli/fs-command.js +1447 -0
- package/dist/cli/handoff-command.js +302 -0
- package/dist/cli/help.js +31 -0
- package/dist/cli/index.js +358 -0
- package/dist/cli/init-channel.js +1377 -0
- package/dist/cli/init.js +553 -0
- package/dist/cli/link-rules.js +240 -0
- package/dist/cli/model.js +590 -0
- package/dist/cli/net-check.js +723 -0
- package/dist/cli/queue-command.js +126 -0
- package/dist/cli/response.js +345 -0
- package/dist/cli/restart-monitor.js +456 -0
- package/dist/cli/stats.js +607 -0
- package/dist/cli/task-context.js +80 -0
- package/dist/cli/trigger-command.js +505 -0
- package/dist/cli/version.js +88 -0
- package/dist/cli/watch-logs.js +33 -0
- package/dist/cli/watch-msg.js +673 -0
- package/dist/config/boot-log.js +266 -0
- package/dist/config/builtin-role-templates.js +30 -0
- package/dist/config/builtin-roles.js +85 -0
- package/dist/config/config-batch-get.js +11 -0
- package/dist/config/config-field-policy.js +261 -0
- package/dist/config/config-manager.js +916 -0
- package/dist/config/config-operation-service.js +384 -0
- package/dist/config/contact-book.js +371 -0
- package/dist/config/gateway-config.js +858 -0
- package/dist/config/lifecycle.js +17 -0
- package/dist/config/mention-mode.js +27 -0
- package/dist/config/merge.js +161 -0
- package/dist/config/owner-policy.js +4 -0
- package/dist/config/peer-role-resolver.js +139 -0
- package/dist/config/resolved-config-op.js +483 -0
- package/dist/config/role-config-v4-startup.js +32 -0
- package/dist/config/role-config-v5-startup.js +27 -0
- package/dist/config/role-schema.js +105 -0
- package/dist/config/role-service.js +159 -0
- package/dist/config/role-store.js +204 -0
- package/dist/config/roles.js +55 -0
- package/dist/config/schema-registry.js +154 -0
- package/dist/config/snapshot.js +598 -0
- package/dist/config-store.js +503 -0
- package/dist/core/auth/agent-delegation.js +111 -0
- package/dist/core/auth/auth-gateway.js +166 -0
- package/dist/core/auth/authenticated-actor.js +6 -0
- package/dist/core/auth/authorization-audit.js +110 -0
- package/dist/core/auth/operation-authorizer.js +718 -0
- package/dist/core/auth/operation-catalog.js +675 -0
- package/dist/core/baseagent-loader.js +54 -0
- package/dist/core/bootstrap-service.js +175 -0
- package/dist/core/capability/capability-manager.js +316 -0
- package/dist/core/capability/providers/claude-capability-provider.js +176 -0
- package/dist/core/capability/providers/codex-capability-provider.js +148 -0
- package/dist/core/capability/providers/gemini-capability-provider.js +10 -0
- package/dist/core/capability/types.js +27 -0
- package/dist/core/causation/audit.js +103 -0
- package/dist/core/causation/aun-association.js +111 -0
- package/dist/core/causation/context.js +93 -0
- package/dist/core/causation/index.js +4 -0
- package/dist/core/causation/types.js +2 -0
- package/dist/core/channel-loader.js +277 -0
- package/dist/core/command/agent-control.js +616 -0
- package/dist/core/command/cli-intent-parser.js +225 -0
- package/dist/core/command/command-handler.js +1638 -0
- package/dist/core/command/menu-handler.js +3354 -0
- package/dist/core/command/menu-protocol.js +247 -0
- package/dist/core/command/role-menu.js +1524 -0
- package/dist/core/command/slash-gate.js +148 -0
- package/dist/core/command/slash-handler.js +3056 -0
- package/dist/core/daemon-file-cache.js +216 -0
- package/dist/core/event-bus.js +32 -0
- package/dist/core/event-catalog.js +740 -0
- package/dist/core/evolagent-registry.js +546 -0
- package/dist/core/evolagent.js +331 -0
- package/dist/core/handoff/dispatcher.js +229 -0
- package/dist/core/handoff/mutex.js +46 -0
- package/dist/core/handoff/runtime.js +324 -0
- package/dist/core/handoff/store.js +537 -0
- package/dist/core/handoff/types.js +12 -0
- package/dist/core/inference/text-inference.js +173 -0
- package/dist/core/interaction-registration.js +10 -0
- package/dist/core/interaction-router.js +278 -0
- package/dist/core/message/create-status.js +67 -0
- package/dist/core/message/im-renderer.js +657 -0
- package/dist/core/message/items-formatter.js +76 -0
- package/dist/core/message/logical-queue-bridge.js +123 -0
- package/dist/core/message/message-bridge.js +803 -0
- package/dist/core/message/message-cache.js +56 -0
- package/dist/core/message/message-log.js +339 -0
- package/dist/core/message/message-processor.js +4 -0
- package/dist/core/message/message-queue.js +1436 -0
- package/dist/core/message/message-utils.js +70 -0
- package/dist/core/message/peer-mode.js +105 -0
- package/dist/core/message/pending-hints.js +232 -0
- package/dist/core/message/response-depth.js +33 -0
- package/dist/core/message/response-engine.js +3776 -0
- package/dist/core/message/response-snapshot.js +83 -0
- package/dist/core/message/stream-debouncer.js +130 -0
- package/dist/core/message/stream-idle-monitor.js +124 -0
- package/dist/core/model/config-scope.js +162 -0
- package/dist/core/model/field-scope.js +78 -0
- package/dist/core/model/model-catalog.js +227 -0
- package/dist/core/model/model-diagnostics.js +182 -0
- package/dist/core/model/model-permission.js +90 -0
- package/dist/core/permission/approval-gateway.js +1017 -0
- package/dist/core/permission/ec-command-parser.js +347 -0
- package/dist/core/permission/execution-sandbox.js +16 -0
- package/dist/core/permission/index.js +6 -0
- package/dist/core/permission/mode.js +24 -0
- package/dist/core/permission/sandbox-runtime.js +265 -0
- package/dist/core/permission/tool-policy.js +987 -0
- package/dist/core/permission/unix-socket-policy.js +99 -0
- package/dist/core/protected-paths.js +330 -0
- package/dist/core/relation/peer-identity.js +222 -0
- package/dist/core/relation/peer-key.js +1 -0
- package/dist/core/role/runtime-policy.js +141 -0
- package/dist/core/session/adapters/claude-session-file-adapter.js +218 -0
- package/dist/core/session/adapters/codex-session-file-adapter.js +333 -0
- package/dist/core/session/adapters/gemini-session-file-adapter.js +181 -0
- package/dist/core/session/session-file-adapter.js +7 -0
- package/dist/core/session/session-file-health.js +45 -0
- package/dist/core/session/session-fs-store.js +232 -0
- package/dist/core/session/session-key.js +24 -0
- package/dist/core/session/session-manager.js +1587 -0
- package/dist/core/session/session-mapper.js +100 -0
- package/dist/core/session/session-renew.js +314 -0
- package/dist/core/session/session-title.js +128 -0
- package/dist/core/session/session-turn-coordinator.js +205 -0
- package/dist/core/session/session-turns.js +67 -0
- package/dist/core/system-channels.js +29 -0
- package/dist/eck/baseagent-caps.js +18 -0
- package/dist/eck/detect.js +47 -0
- package/dist/eck/group-rules-sync.js +345 -0
- package/dist/eck/init.js +77 -0
- package/dist/eck/kit-renderer.js +359 -0
- package/dist/eck/manifest-engine.js +446 -0
- package/dist/eck/message-renderer.js +199 -0
- package/dist/eck/rules-loader.js +28 -0
- package/dist/index.js +2870 -4
- package/dist/ipc.js +748 -0
- package/dist/paths.js +262 -0
- package/dist/product.js +18 -0
- package/dist/response-system/context-builder.js +71 -0
- package/dist/response-system/coordinator.js +117 -0
- package/dist/response-system/decision-executor.js +86 -0
- package/dist/response-system/engines/v1/index.js +21 -0
- package/dist/response-system/engines/v1/interactive-flow.js +27 -0
- package/dist/response-system/engines/v1/proactive-flow.js +137 -0
- package/dist/response-system/engines/v1/types.js +1 -0
- package/dist/response-system/extensions.js +41 -0
- package/dist/response-system/index.js +6 -0
- package/dist/response-system/modes/index.js +7 -0
- package/dist/response-system/modes/single-session/index.js +72 -0
- package/dist/response-system/queues/fifo-queue.js +44 -0
- package/dist/response-system/queues/index.js +6 -0
- package/dist/response-system/queues/lifo-queue.js +42 -0
- package/dist/response-system/queues/priority-queue.js +63 -0
- package/dist/response-system/registry.js +97 -0
- package/dist/response-system/resolver.js +37 -0
- package/dist/response-system/selector.js +23 -0
- package/dist/response-system/types.js +7 -0
- package/dist/stats/billing.js +151 -0
- package/dist/stats/budget.js +93 -0
- package/dist/stats/db.js +403 -0
- package/dist/stats/eck-vars.js +89 -0
- package/dist/stats/index.js +11 -0
- package/dist/stats/normalizer.js +80 -0
- package/dist/stats/price-resolver.js +138 -0
- package/dist/stats/query.js +763 -0
- package/dist/stats/role-budget.js +168 -0
- package/dist/stats/writer.js +151 -0
- package/dist/trigger/anomaly-store.js +258 -0
- package/dist/trigger/audit.js +152 -0
- package/dist/trigger/event-source.js +119 -0
- package/dist/trigger/feedback.js +685 -0
- package/dist/trigger/history.js +290 -0
- package/dist/trigger/manager.js +291 -0
- package/dist/trigger/parser.js +520 -0
- package/dist/trigger/patch.js +148 -0
- package/dist/trigger/scheduler.js +1600 -0
- package/dist/trigger/script-executor.js +155 -0
- package/dist/trigger/state.js +145 -0
- package/dist/trigger/types.js +1 -0
- package/dist/trigger/validation.js +621 -0
- package/dist/types.js +12 -0
- package/dist/utils/aid-bind.js +299 -0
- package/dist/utils/atomic-write.js +95 -0
- package/dist/utils/avatar-upload.js +123 -0
- package/dist/utils/cross-platform.js +297 -0
- package/dist/utils/ecweb-utils.js +73 -0
- package/dist/utils/error-dict.json +153 -0
- package/dist/utils/error-utils.js +349 -0
- package/dist/utils/instance-registry.js +437 -0
- package/dist/utils/locale.js +21 -0
- package/dist/utils/log-writer.js +224 -0
- package/dist/utils/logger.js +89 -0
- package/dist/utils/markdown-to-plain-text.js +20 -0
- package/dist/utils/media-cache.js +271 -0
- package/dist/utils/model-prices.jsonl +17 -0
- package/dist/utils/npm-ops.js +210 -0
- package/dist/utils/process-introspect.js +133 -0
- package/dist/utils/process-tree-stats.js +271 -0
- package/dist/utils/project-path.js +74 -0
- package/dist/utils/stats.js +410 -0
- package/dist/utils/tool-summary.js +284 -0
- package/dist/utils/welcome.js +268 -0
- package/kits/docs/GUIDE.md +20 -0
- package/kits/docs/INDEX.md +65 -0
- package/kits/docs/aun/CHEATSHEET.md +19 -0
- package/kits/docs/aun/SYNC_PROTOCOL.md +15 -0
- package/kits/docs/channels/aun.md +65 -0
- package/kits/docs/channels/feishu.md +56 -0
- package/kits/docs/context-assembly.md +366 -0
- package/kits/docs/eck_templates/GUIDE.template.md +22 -0
- package/kits/docs/eck_templates/INDEX.template.md +28 -0
- package/kits/docs/eck_templates/path-registry.template.md +33 -0
- package/kits/docs/eck_templates/runtime.template.md +19 -0
- package/kits/docs/evolcore/INDEX.md +66 -0
- package/kits/docs/evolcore/agent.md +69 -0
- package/kits/docs/evolcore/aid.md +49 -0
- package/kits/docs/evolcore/config.md +149 -0
- package/kits/docs/evolcore/ctl.md +46 -0
- package/kits/docs/evolcore/event.md +216 -0
- package/kits/docs/evolcore/fs-architecture.md +1215 -0
- package/kits/docs/evolcore/fs.md +101 -0
- package/kits/docs/evolcore/group-fs.md +17 -0
- package/kits/docs/evolcore/group-rules.md +226 -0
- package/kits/docs/evolcore/group.md +141 -0
- package/kits/docs/evolcore/model.md +47 -0
- package/kits/docs/evolcore/msg.md +130 -0
- package/kits/docs/evolcore/response.md +80 -0
- package/kits/docs/evolcore/rpc.md +35 -0
- package/kits/docs/evolcore/self-summary.md +29 -0
- package/kits/docs/evolcore/stats.md +70 -0
- package/kits/docs/evolcore/storage.md +49 -0
- package/kits/docs/evolcore/trigger.md +524 -0
- package/kits/docs/identity/AID_PROFILE_SPEC.md +26 -0
- package/kits/docs/identity/PATH_OPS.md +16 -0
- package/kits/docs/identity/ROLE_DETAIL.md +23 -0
- package/kits/docs/identity/identity-tools.md +26 -0
- package/kits/docs/path-registry.md +43 -0
- package/kits/docs/prompt-loading-architecture.md +266 -0
- package/kits/docs/venues/aun-group.md +45 -0
- package/kits/docs/venues/aun-private.md +10 -0
- package/kits/docs/venues/client-desktop.md +10 -0
- package/kits/docs/venues/client-mobile.md +10 -0
- package/kits/docs/venues/feishu-group.md +13 -0
- package/kits/docs/venues/feishu-private.md +9 -0
- package/kits/docs/venues/group.md +25 -0
- package/kits/docs/venues/private.md +10 -0
- package/kits/eck_manifest.auxiliary.json +43 -0
- package/kits/eck_manifest.json +191 -0
- package/kits/eck_message_manifest.json +63 -0
- package/kits/migrations/README-role-config-v4.md +32 -0
- package/kits/migrations/migrate-role-config-v4.mjs +623 -0
- package/kits/migrations/migrate-role-config-v5.mjs +346 -0
- package/kits/migrations/rename-config-file.mjs +99 -0
- package/kits/rules/01-overview.md +142 -0
- package/kits/rules/02-navigation.md +76 -0
- package/kits/rules/03-identity.md +34 -0
- package/kits/rules/04-relation.md +59 -0
- package/kits/rules/05-venue.md +44 -0
- package/kits/rules/06-channel.md +59 -0
- package/kits/schemas/_meta.json +29 -0
- package/kits/schemas/agent-config.schema.1.json +177 -0
- package/kits/schemas/agent-config.schema.2.json +239 -0
- package/kits/schemas/agent-config.schema.3.json +119 -0
- package/kits/schemas/agent-config.schema.4.json +208 -0
- package/kits/schemas/agent-config.schema.5.json +326 -0
- package/kits/schemas/contact-book.schema.1.json +36 -0
- package/kits/schemas/daemon.schema.1.json +90 -0
- package/kits/schemas/defaults.schema.1.json +81 -0
- package/kits/schemas/menu-exec-schema-commands.md +208 -0
- package/kits/schemas/migrations/README.md +28 -0
- package/kits/schemas/relation-config.schema.1.json +158 -0
- package/kits/schemas/relation-config.schema.2.json +73 -0
- package/kits/schemas/relation-config.schema.3.json +50 -0
- package/kits/schemas/relation-config.schema.4.json +47 -0
- package/kits/schemas/role-config.schema.1.json +200 -0
- package/kits/schemas/role-registry.schema.1.json +35 -0
- package/kits/schemas/single-session.schema.1.json +31 -0
- package/kits/templates/bootstrap-welcome.md +15 -0
- package/kits/templates/message-fragments/handoff-request-to-target.md +13 -0
- package/kits/templates/message-fragments/handoff-response-to-origin.md +10 -0
- package/kits/templates/message-fragments/inject-default.md +2 -0
- package/kits/templates/message-fragments/item.md +2 -0
- package/kits/templates/roles/admin.json +8 -0
- package/kits/templates/roles/member.json +40 -0
- package/kits/templates/roles/owner.json +8 -0
- package/kits/templates/roles/visitor.json +39 -0
- package/kits/templates/system-fragments/baseagent.md +14 -0
- package/kits/templates/system-fragments/bootstrap.md +16 -0
- package/kits/templates/system-fragments/channel.md +48 -0
- package/kits/templates/system-fragments/commands.md +26 -0
- package/kits/templates/system-fragments/identity.md +11 -0
- package/kits/templates/system-fragments/relation.md +19 -0
- package/kits/templates/system-fragments/session.md +53 -0
- package/kits/templates/system-fragments/venue.md +31 -0
- package/package.json +50 -15
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { resolvePaths } from '../paths.js';
|
|
2
|
+
import { ipcQuery } from '../ipc.js';
|
|
3
|
+
import { isHelpFlag } from './help.js';
|
|
4
|
+
export async function cmdQueue(args) {
|
|
5
|
+
if (args.length === 0 || isHelpFlag(args[0])) {
|
|
6
|
+
console.log(`用法: ec queue --agent <aid> [选项]
|
|
7
|
+
|
|
8
|
+
查询与操作 EvolAgent 的消息队列。
|
|
9
|
+
|
|
10
|
+
查询:
|
|
11
|
+
--agent <aid> 必填,目标 agent(如 mybot.agentid.pub)
|
|
12
|
+
--showid 显示 messageId
|
|
13
|
+
--full 显示完整消息内容(不截断)
|
|
14
|
+
--format json 以 JSON 格式输出
|
|
15
|
+
|
|
16
|
+
操作:
|
|
17
|
+
--clear 清空该 agent 的所有待处理消息
|
|
18
|
+
--cancel <messageId> 取消指定消息
|
|
19
|
+
--interrupt --sessionkey <key> 打断指定 session 的处理中任务
|
|
20
|
+
|
|
21
|
+
示例:
|
|
22
|
+
ec queue --agent mybot.agentid.pub
|
|
23
|
+
ec queue --agent mybot.agentid.pub --showid
|
|
24
|
+
ec queue --agent mybot.agentid.pub --clear
|
|
25
|
+
ec queue --agent mybot.agentid.pub --cancel msg_d4e5f6
|
|
26
|
+
ec queue --agent mybot.agentid.pub --interrupt --sessionkey feishu#oc_abc123#main`);
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
29
|
+
// 解析参数
|
|
30
|
+
const agentIdx = args.indexOf('--agent');
|
|
31
|
+
if (agentIdx === -1 || agentIdx + 1 >= args.length) {
|
|
32
|
+
console.error('❌ 缺少 --agent <aid> 参数');
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
const agent = args[agentIdx + 1];
|
|
36
|
+
const showId = args.includes('--showid');
|
|
37
|
+
const full = args.includes('--full');
|
|
38
|
+
const formatJson = args.includes('--format json');
|
|
39
|
+
const clear = args.includes('--clear');
|
|
40
|
+
const cancelIdx = args.indexOf('--cancel');
|
|
41
|
+
const cancelMsgId = cancelIdx >= 0 && cancelIdx + 1 < args.length ? args[cancelIdx + 1] : undefined;
|
|
42
|
+
const interrupt = args.includes('--interrupt');
|
|
43
|
+
const sessionKeyIdx = args.indexOf('--sessionkey');
|
|
44
|
+
const sessionKey = sessionKeyIdx >= 0 && sessionKeyIdx + 1 < args.length ? args[sessionKeyIdx + 1] : undefined;
|
|
45
|
+
// 构建 IPC 请求
|
|
46
|
+
const action = clear ? 'clear'
|
|
47
|
+
: cancelMsgId ? 'cancel'
|
|
48
|
+
: interrupt ? 'interrupt'
|
|
49
|
+
: undefined;
|
|
50
|
+
const socketPath = resolvePaths().socket;
|
|
51
|
+
const result = await ipcQuery(socketPath, {
|
|
52
|
+
type: 'queue-snapshot',
|
|
53
|
+
agent,
|
|
54
|
+
action,
|
|
55
|
+
messageId: cancelMsgId,
|
|
56
|
+
sessionKey,
|
|
57
|
+
});
|
|
58
|
+
if (!result) {
|
|
59
|
+
console.error('错误: 无法连接 evolcore 服务');
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
const r = result;
|
|
63
|
+
// 操作结果
|
|
64
|
+
if (action) {
|
|
65
|
+
if (r.ok) {
|
|
66
|
+
if (action === 'clear')
|
|
67
|
+
console.log(`✅ 已清空 ${r.cleared ?? 0} 条待处理消息`);
|
|
68
|
+
else if (action === 'cancel')
|
|
69
|
+
console.log(`✅ 已取消消息`);
|
|
70
|
+
else if (action === 'interrupt')
|
|
71
|
+
console.log(`✅ 已打断处理中任务`);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
console.error(r.error || '执行失败');
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// 查询结果
|
|
80
|
+
const items = r.items || [];
|
|
81
|
+
if (formatJson) {
|
|
82
|
+
console.log(JSON.stringify({ items }, null, 2));
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
console.log(renderQueueItemsCli(items, showId, full, agent));
|
|
86
|
+
}
|
|
87
|
+
function renderQueueItemsCli(items, showId, full, aid) {
|
|
88
|
+
const lines = [`${aid} — 队列 (${items.length} 条)`, ''];
|
|
89
|
+
if (items.length === 0) {
|
|
90
|
+
lines.push('(无队列消息)');
|
|
91
|
+
return lines.join('\n');
|
|
92
|
+
}
|
|
93
|
+
// 计算列宽
|
|
94
|
+
const maxSessionKeyLen = Math.max(...items.map(i => i.sessionKey.length));
|
|
95
|
+
const maxIdLen = showId ? Math.max(...items.map(i => i.messageId?.length ?? 0)) : 0;
|
|
96
|
+
const maxNameLen = Math.max(...items.map(i => (i.peerName ? `[${i.peerName}]`.length : 0)));
|
|
97
|
+
const elapsedColWidth = 5;
|
|
98
|
+
for (const item of items) {
|
|
99
|
+
const parts = [' '];
|
|
100
|
+
// 状态列
|
|
101
|
+
const status = item.status === 'active' ? '[active]' : '[pending]';
|
|
102
|
+
parts.push(` ${status.padEnd(10)} `);
|
|
103
|
+
// sessionKey 列
|
|
104
|
+
parts.push(` ${item.sessionKey.padEnd(maxSessionKeyLen)} `);
|
|
105
|
+
// messageId 列(可选)
|
|
106
|
+
if (showId) {
|
|
107
|
+
parts.push(` ${(item.messageId || '').padEnd(maxIdLen)} `);
|
|
108
|
+
}
|
|
109
|
+
// 发送者列
|
|
110
|
+
if (item.peerName) {
|
|
111
|
+
parts.push(` [${item.peerName}]`.padEnd(maxNameLen + 2) + ' ');
|
|
112
|
+
}
|
|
113
|
+
// 时长列
|
|
114
|
+
let elapsed = '—';
|
|
115
|
+
if (item.elapsedMs != null) {
|
|
116
|
+
const sec = Math.round(item.elapsedMs / 1000);
|
|
117
|
+
elapsed = sec >= 60 ? `${Math.floor(sec / 60)}m${sec % 60}s` : `${sec}s`;
|
|
118
|
+
}
|
|
119
|
+
parts.push(` ${elapsed.padEnd(elapsedColWidth)} `);
|
|
120
|
+
// 内容列
|
|
121
|
+
const content = full ? item.preview.replace(/\.\.\.$/, '') : item.preview;
|
|
122
|
+
parts.push(`"${content}"`);
|
|
123
|
+
lines.push(parts.join(''));
|
|
124
|
+
}
|
|
125
|
+
return lines.join('\n');
|
|
126
|
+
}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ec response` —— 响应模式管理命令集。
|
|
3
|
+
*
|
|
4
|
+
* 查看/切换/配置会话的响应模式。作用域由 --self/--peer 决定。
|
|
5
|
+
*
|
|
6
|
+
* 三级作用域(越具体越优先:关系 > agent > 全局):
|
|
7
|
+
* (无) → 全局 defaults.json
|
|
8
|
+
* --self → agent config.json
|
|
9
|
+
* --self --peer → 关系 relations/<peerKey>/config.json
|
|
10
|
+
*
|
|
11
|
+
* 改某作用域后,对应范围所有会话的下一条消息即时生效。
|
|
12
|
+
* 设计见 docs/response-system/command-reference.md。
|
|
13
|
+
*/
|
|
14
|
+
import { isHelpFlag, wantsHelp, getArgValue } from './help.js';
|
|
15
|
+
import { readField, writeField, determineFieldScope, normalizePeer, ModelScopeError, } from '../core/model/field-scope.js';
|
|
16
|
+
import { readFieldWithSource, resolveAgentConfig, ConfigTarget } from '../config/config-manager.js';
|
|
17
|
+
import { ResponseModeRegistry } from '../response-system/registry.js';
|
|
18
|
+
import { registerBuiltinModes } from '../response-system/modes/index.js';
|
|
19
|
+
const RESPONSE_MODE_FIELD = 'responseMode';
|
|
20
|
+
const RESPONSE_MODE_PARAMS_FIELD = 'responseModeParams';
|
|
21
|
+
/**
|
|
22
|
+
* CLI 侧的响应模式清单 = 真实注册表(registerBuiltinModes 纯函数、无 daemon 依赖)。
|
|
23
|
+
* 保证 ec response list/info/set 看到的与运行时实际注册的一致。
|
|
24
|
+
*/
|
|
25
|
+
function buildRegistry() {
|
|
26
|
+
const reg = new ResponseModeRegistry();
|
|
27
|
+
registerBuiltinModes(reg);
|
|
28
|
+
return reg;
|
|
29
|
+
}
|
|
30
|
+
/** 从模式实例提取展示用元数据(供 list/info 输出)。 */
|
|
31
|
+
function modeMeta(m) {
|
|
32
|
+
return {
|
|
33
|
+
id: m.id,
|
|
34
|
+
displayName: m.displayName,
|
|
35
|
+
description: m.description,
|
|
36
|
+
applicableScenes: m.applicableScenes,
|
|
37
|
+
type: m.type,
|
|
38
|
+
configSchema: m.configSchema,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function emit(formatJson, payload, textFn) {
|
|
42
|
+
if (formatJson) {
|
|
43
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.log(textFn());
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function fail(formatJson, code, message) {
|
|
50
|
+
if (formatJson) {
|
|
51
|
+
console.log(JSON.stringify({ ok: false, code, error: message }, null, 2));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
console.error(`❌ ${message} (${code})`);
|
|
55
|
+
}
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
/** 解析 --self / --peer 为作用域选择器 */
|
|
59
|
+
function parseSelector(args, formatJson) {
|
|
60
|
+
const self = getArgValue(args, '--self');
|
|
61
|
+
const peerRaw = getArgValue(args, '--peer');
|
|
62
|
+
let peerKey;
|
|
63
|
+
if (peerRaw !== undefined) {
|
|
64
|
+
try {
|
|
65
|
+
peerKey = normalizePeer(peerRaw);
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
if (e instanceof ModelScopeError)
|
|
69
|
+
fail(formatJson, e.code, e.message);
|
|
70
|
+
throw e;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (peerKey && !self) {
|
|
74
|
+
fail(formatJson, 'PEER_WITHOUT_SELF', '--peer 必须配合 --self 使用');
|
|
75
|
+
}
|
|
76
|
+
return { self, peerKey };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 写操作的作用域解析:要求至少 agent 级(--self)。
|
|
80
|
+
* responseMode 是行为参数,不落 defaults(与 model 命令一致,全局作用域已退场)。
|
|
81
|
+
*/
|
|
82
|
+
function parseWriteSelector(args, formatJson) {
|
|
83
|
+
const sel = parseSelector(args, formatJson);
|
|
84
|
+
if (!sel.self) {
|
|
85
|
+
fail(formatJson, 'SELF_REQUIRED', 'responseMode 从 agent 级起:写操作必须提供 --self(全局默认不承载行为参数)');
|
|
86
|
+
}
|
|
87
|
+
return sel;
|
|
88
|
+
}
|
|
89
|
+
/** 统一捕获写入异常(ConfigError / ModelScopeError),显示友好错误 */
|
|
90
|
+
function safeWrite(formatJson, fn) {
|
|
91
|
+
try {
|
|
92
|
+
fn();
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
const code = e?.code ?? 'WRITE_FAILED';
|
|
96
|
+
const msg = e?.message ?? String(e);
|
|
97
|
+
fail(formatJson, code, msg);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 解析**生效**的 responseMode(标量,合并链 relation > agent > defaults)。
|
|
102
|
+
*
|
|
103
|
+
* 与运行时 ResponseModeResolver、`ec config get responseMode` 同源:都走合并链,而不是
|
|
104
|
+
* 只读当前作用域的单个文件。返回命中的值 + 来源层(未命中任何层返回空对象)。
|
|
105
|
+
*/
|
|
106
|
+
function resolveResponseMode(sel) {
|
|
107
|
+
const hit = readFieldWithSource(RESPONSE_MODE_FIELD, sel, { cache: true });
|
|
108
|
+
return hit ? { mode: hit.value, source: hit.source.target } : {};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 解析**生效**的 responseModeParams(字典,按模式 id 分桶 dict 合并链)。
|
|
112
|
+
* 复用 ConfigManager 的合并(唯一合并点),与运行时一致。
|
|
113
|
+
*/
|
|
114
|
+
function resolveResponseModeParams(sel) {
|
|
115
|
+
const merged = resolveAgentConfig(sel, { cache: true });
|
|
116
|
+
return merged.responseModeParams;
|
|
117
|
+
}
|
|
118
|
+
/** 中文展示用的来源标签 */
|
|
119
|
+
function sourceLabel(target) {
|
|
120
|
+
switch (target) {
|
|
121
|
+
case ConfigTarget.Relation: return '关系级';
|
|
122
|
+
case ConfigTarget.Agent: return 'agent 级';
|
|
123
|
+
case ConfigTarget.Defaults: return '全局默认';
|
|
124
|
+
default: return String(target);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const HELP = `用法: ec response <command> [options]
|
|
128
|
+
|
|
129
|
+
Commands:
|
|
130
|
+
list 列出所有响应模式(内置 + 元数据)
|
|
131
|
+
current 显示当前作用域生效的模式 + 参数
|
|
132
|
+
info <mode-id> 查看单个模式详情(场景/配置参数)
|
|
133
|
+
set <mode-id> 设置响应模式
|
|
134
|
+
reset 清除指定作用域的 responseMode 设置
|
|
135
|
+
config <mode-id> 查看指定模式的配置参数
|
|
136
|
+
config set <k> <v> 修改模式配置参数(--mode 指定模式)
|
|
137
|
+
|
|
138
|
+
作用域(由参数决定,越具体越优先:关系 > agent):
|
|
139
|
+
--self <aid> agent级 → config.json
|
|
140
|
+
--self <aid> --peer <X> 关系级 → relations/<peerKey>/config.json
|
|
141
|
+
|
|
142
|
+
Options:
|
|
143
|
+
--self <aid> 本端 AID
|
|
144
|
+
--peer <X> 对端:channelType#channelId 或裸 aid(裸 aid 视为 aun#<aid>)
|
|
145
|
+
--mode <id> 模式 id(config set 专用)
|
|
146
|
+
--format json 输出 JSON
|
|
147
|
+
--help, -h 各子命令均支持
|
|
148
|
+
|
|
149
|
+
示例:
|
|
150
|
+
ec response list
|
|
151
|
+
ec response current --self bot.agentid.pub
|
|
152
|
+
ec response info dual-session
|
|
153
|
+
ec response set single-session --self bot.agentid.pub
|
|
154
|
+
ec response set workflow --self bot.agentid.pub --peer aun#team.group.com
|
|
155
|
+
ec response config dual-session --self bot.agentid.pub
|
|
156
|
+
ec response config set debounceMs 5000 --mode dual-session --self bot.agentid.pub
|
|
157
|
+
ec response reset --self bot.agentid.pub --peer alice.agentid.pub`;
|
|
158
|
+
// ── list ────────────────────────────────────────────────────────────────
|
|
159
|
+
function cmdList(args, formatJson) {
|
|
160
|
+
if (wantsHelp(args)) {
|
|
161
|
+
console.log(HELP);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const reg = buildRegistry();
|
|
165
|
+
const preferred = reg.getPreferredId();
|
|
166
|
+
const modes = reg.list().map(modeMeta);
|
|
167
|
+
emit(formatJson, { ok: true, modes, preferred }, () => {
|
|
168
|
+
const lines = ['已注册响应模式:'];
|
|
169
|
+
for (const m of modes) {
|
|
170
|
+
const scenes = m.applicableScenes.join(', ');
|
|
171
|
+
const star = m.id === preferred ? ' ★首选' : '';
|
|
172
|
+
lines.push(` ${m.id.padEnd(20)} ${m.displayName.padEnd(14)} [${scenes}]${star}`);
|
|
173
|
+
lines.push(` ${' '.repeat(20)} ${m.description}`);
|
|
174
|
+
}
|
|
175
|
+
return lines.join('\n');
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
// ── current ─────────────────────────────────────────────────────────────
|
|
179
|
+
function cmdCurrent(args, formatJson) {
|
|
180
|
+
if (wantsHelp(args)) {
|
|
181
|
+
console.log(HELP);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const sel = parseSelector(args, formatJson);
|
|
185
|
+
const scope = determineFieldScope(sel);
|
|
186
|
+
// 生效值走合并链(relation > agent > defaults),与运行时 resolver / `ec config get` 一致。
|
|
187
|
+
// 无任何层设值时,回落注册表首选——这才是运行时真正生效的模式。
|
|
188
|
+
const { mode: configuredMode, source } = resolveResponseMode(sel);
|
|
189
|
+
const preferred = buildRegistry().getPreferredId();
|
|
190
|
+
const effectiveMode = configuredMode ?? preferred;
|
|
191
|
+
const params = resolveResponseModeParams(sel);
|
|
192
|
+
emit(formatJson, {
|
|
193
|
+
ok: true,
|
|
194
|
+
scope,
|
|
195
|
+
responseMode: effectiveMode ?? null,
|
|
196
|
+
source: configuredMode ? 'config' : 'preferred',
|
|
197
|
+
sourceTarget: source ?? null,
|
|
198
|
+
responseModeParams: params ?? null,
|
|
199
|
+
}, () => {
|
|
200
|
+
const lines = [`响应模式配置(作用域: ${scope}):`];
|
|
201
|
+
if (configuredMode) {
|
|
202
|
+
lines.push(` 当前模式: ${configuredMode}(来源: ${source ? sourceLabel(source) : '配置'})`);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
lines.push(` 当前模式: ${effectiveMode ?? '(无)'}(来源: 注册表首选,各层均未设置)`);
|
|
206
|
+
}
|
|
207
|
+
if (params && Object.keys(params).length) {
|
|
208
|
+
lines.push(' 模式参数:');
|
|
209
|
+
for (const [modeId, cfg] of Object.entries(params)) {
|
|
210
|
+
lines.push(` ${modeId}: ${JSON.stringify(cfg)}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return lines.join('\n');
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
// ── info ────────────────────────────────────────────────────────────────
|
|
217
|
+
function cmdInfo(args, formatJson) {
|
|
218
|
+
if (wantsHelp(args)) {
|
|
219
|
+
console.log(HELP);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const id = args.find(a => !a.startsWith('--') && a !== 'info');
|
|
223
|
+
if (!id)
|
|
224
|
+
fail(formatJson, 'MISSING_ID', 'info 需要模式 id');
|
|
225
|
+
const mode = buildRegistry().get(id);
|
|
226
|
+
if (!mode)
|
|
227
|
+
fail(formatJson, 'UNKNOWN_MODE', `未知模式: ${id}`);
|
|
228
|
+
const meta = modeMeta(mode);
|
|
229
|
+
emit(formatJson, { ok: true, mode: meta }, () => {
|
|
230
|
+
const lines = [
|
|
231
|
+
`模式: ${meta.id}`,
|
|
232
|
+
`显示名: ${meta.displayName}`,
|
|
233
|
+
`类型: ${meta.type}`,
|
|
234
|
+
`描述: ${meta.description}`,
|
|
235
|
+
`适用场景: ${meta.applicableScenes.join(', ')}`,
|
|
236
|
+
];
|
|
237
|
+
const props = meta.configSchema?.properties;
|
|
238
|
+
if (props && Object.keys(props).length) {
|
|
239
|
+
lines.push('配置参数:');
|
|
240
|
+
for (const [k, v] of Object.entries(props)) {
|
|
241
|
+
const def = v.default !== undefined ? ` 默认: ${JSON.stringify(v.default)}` : '';
|
|
242
|
+
lines.push(` ${k.padEnd(22)} (${v.type}) ${v.description ?? ''}${def}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return lines.join('\n');
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
// ── set ─────────────────────────────────────────────────────────────────
|
|
249
|
+
function cmdSet(args, formatJson) {
|
|
250
|
+
if (wantsHelp(args)) {
|
|
251
|
+
console.log(HELP);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const id = args.find(a => !a.startsWith('--') && a !== 'set');
|
|
255
|
+
if (!id)
|
|
256
|
+
fail(formatJson, 'MISSING_ID', 'set 需要模式 id');
|
|
257
|
+
if (!buildRegistry().has(id))
|
|
258
|
+
fail(formatJson, 'UNKNOWN_MODE', `未知模式: ${id}`);
|
|
259
|
+
const sel = parseWriteSelector(args, formatJson);
|
|
260
|
+
const scope = determineFieldScope(sel);
|
|
261
|
+
safeWrite(formatJson, () => writeField(scope, sel, RESPONSE_MODE_FIELD, id));
|
|
262
|
+
emit(formatJson, { ok: true, scope, mode: id }, () => `✓ 已设置响应模式为 ${id}(作用域: ${scope})`);
|
|
263
|
+
}
|
|
264
|
+
// ── reset ───────────────────────────────────────────────────────────────
|
|
265
|
+
function cmdReset(args, formatJson) {
|
|
266
|
+
if (wantsHelp(args)) {
|
|
267
|
+
console.log(HELP);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const sel = parseWriteSelector(args, formatJson);
|
|
271
|
+
const scope = determineFieldScope(sel);
|
|
272
|
+
safeWrite(formatJson, () => {
|
|
273
|
+
writeField(scope, sel, RESPONSE_MODE_FIELD, undefined);
|
|
274
|
+
writeField(scope, sel, RESPONSE_MODE_PARAMS_FIELD, undefined);
|
|
275
|
+
});
|
|
276
|
+
emit(formatJson, { ok: true, scope }, () => `✓ 已清除响应模式配置(作用域: ${scope})`);
|
|
277
|
+
}
|
|
278
|
+
// ── config ──────────────────────────────────────────────────────────────
|
|
279
|
+
function cmdConfig(args, formatJson) {
|
|
280
|
+
if (wantsHelp(args)) {
|
|
281
|
+
console.log(HELP);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
// config set <key> <value>
|
|
285
|
+
if (args[1] === 'set') {
|
|
286
|
+
return cmdConfigSet(args, formatJson);
|
|
287
|
+
}
|
|
288
|
+
// config [<mode-id>]:查看**生效**模式配置(合并链,与运行时一致)
|
|
289
|
+
const modeId = args.find(a => !a.startsWith('--') && a !== 'config');
|
|
290
|
+
const sel = parseSelector(args, formatJson);
|
|
291
|
+
const params = resolveResponseModeParams(sel) ?? {};
|
|
292
|
+
if (modeId) {
|
|
293
|
+
emit(formatJson, { ok: true, mode: modeId, config: params[modeId] ?? {} }, () => `${modeId} 配置: ${JSON.stringify(params[modeId] ?? {}, null, 2)}`);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
emit(formatJson, { ok: true, responseModeParams: params }, () => `所有模式配置: ${JSON.stringify(params, null, 2)}`);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function cmdConfigSet(args, formatJson) {
|
|
300
|
+
// args: ['config', 'set', '<key>', '<value>', ...flags]
|
|
301
|
+
const key = args[2];
|
|
302
|
+
const rawValue = args[3];
|
|
303
|
+
const modeId = getArgValue(args, '--mode');
|
|
304
|
+
if (!modeId)
|
|
305
|
+
fail(formatJson, 'MISSING_MODE', 'config set 需要 --mode <id>');
|
|
306
|
+
if (!key || rawValue === undefined)
|
|
307
|
+
fail(formatJson, 'MISSING_KV', 'config set 需要 <key> <value>');
|
|
308
|
+
if (!buildRegistry().has(modeId))
|
|
309
|
+
fail(formatJson, 'UNKNOWN_MODE', `未知模式: ${modeId}`);
|
|
310
|
+
// 值解析:尝试 JSON(数字/布尔/数组),失败则当字符串
|
|
311
|
+
let value = rawValue;
|
|
312
|
+
try {
|
|
313
|
+
value = JSON.parse(rawValue);
|
|
314
|
+
}
|
|
315
|
+
catch { /* keep string */ }
|
|
316
|
+
const sel = parseWriteSelector(args, formatJson);
|
|
317
|
+
const scope = determineFieldScope(sel);
|
|
318
|
+
// 写路径是 read-modify-write:只读**目标层自身**的桶,绝不能读合并链——否则会把
|
|
319
|
+
// 继承来的父层参数一并写进本层文件,污染覆盖关系。
|
|
320
|
+
const params = (readField(scope, sel, RESPONSE_MODE_PARAMS_FIELD) || {});
|
|
321
|
+
if (!params[modeId])
|
|
322
|
+
params[modeId] = {};
|
|
323
|
+
params[modeId][key] = value;
|
|
324
|
+
safeWrite(formatJson, () => writeField(scope, sel, RESPONSE_MODE_PARAMS_FIELD, params));
|
|
325
|
+
emit(formatJson, { ok: true, scope, mode: modeId, key, value }, () => `✓ 已设置 ${modeId}.${key} = ${JSON.stringify(value)}(作用域: ${scope})`);
|
|
326
|
+
}
|
|
327
|
+
// ── dispatch ──────────────────────────────────────────────────────────────
|
|
328
|
+
export async function cmdResponse(args) {
|
|
329
|
+
const sub = args[0];
|
|
330
|
+
const formatJson = getArgValue(args, '--format') === 'json';
|
|
331
|
+
if (!sub || isHelpFlag(sub)) {
|
|
332
|
+
console.log(HELP);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
switch (sub) {
|
|
336
|
+
case 'list': return cmdList(args, formatJson);
|
|
337
|
+
case 'current': return cmdCurrent(args, formatJson);
|
|
338
|
+
case 'info': return cmdInfo(args, formatJson);
|
|
339
|
+
case 'set': return cmdSet(args, formatJson);
|
|
340
|
+
case 'reset': return cmdReset(args, formatJson);
|
|
341
|
+
case 'config': return cmdConfig(args, formatJson);
|
|
342
|
+
default:
|
|
343
|
+
fail(formatJson, 'UNKNOWN_SUBCOMMAND', `未知子命令: ${sub}(response --help 查看用法)`);
|
|
344
|
+
}
|
|
345
|
+
}
|