evolcore 0.0.25 → 0.0.26
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 +607 -565
- package/LICENSE +21 -21
- package/README.md +455 -455
- package/bin/codex-managed-acl.ps1 +160 -160
- package/bin/codex-managed-hook.mjs +208 -208
- package/bin/ec-safe-output.js +327 -327
- package/bin/ec.js +40 -29
- package/bin/install-codex-managed-hooks.mjs +582 -555
- package/dist/agents/baseagent.js +96 -46
- package/dist/agents/claude-runner.js +50 -12
- package/dist/agents/codex/app-server-client.js +13 -5
- package/dist/agents/codex/catalog.js +1 -1
- package/dist/agents/codex/diagnostics.js +34 -1
- package/dist/agents/codex-runner.js +121 -38
- package/dist/agents/ecagent-runner.js +4 -9
- package/dist/agents/gemini-runner.js +2 -7
- package/dist/agents/runner-types.js +25 -17
- package/dist/aun/aid/agentmd.js +81 -8
- package/dist/aun/aid/client.js +1 -1
- package/dist/aun/aid/identity.js +1 -1
- package/dist/aun/aid/index.js +1 -1
- package/dist/aun/aid/store.js +17 -13
- package/dist/aun/menu-client.js +74 -0
- package/dist/aun/msg/group.js +1 -1
- package/dist/aun/msg/managed-operation.js +1 -1
- package/dist/aun/msg/p2p.js +6 -1
- package/dist/aun/msg/upload.js +30 -22
- package/dist/channels/aun.js +329 -94
- package/dist/cli/agent-command.js +105 -84
- package/dist/cli/agent-create.js +112 -10
- package/dist/cli/agent.js +16 -5
- package/dist/cli/aun-commands.js +297 -296
- package/dist/cli/bench.js +20 -20
- package/dist/cli/config.js +47 -28
- package/dist/cli/contact.js +70 -13
- package/dist/cli/ctl-command.js +22 -22
- package/dist/cli/daemon-commands.js +105 -40
- package/dist/cli/diag.js +31 -0
- package/dist/cli/fs-command.js +67 -67
- package/dist/cli/handoff-command.js +41 -9
- package/dist/cli/index.js +83 -77
- package/dist/cli/link-rules.js +21 -21
- package/dist/cli/managed-command-guard.js +3 -0
- package/dist/cli/menu-client.js +46 -31
- package/dist/cli/net-check.js +22 -22
- package/dist/cli/queue-command.js +29 -29
- package/dist/cli/response.js +30 -30
- package/dist/cli/restart-monitor.js +87 -40
- package/dist/cli/stats.js +51 -51
- package/dist/cli/trigger-command.js +56 -56
- package/dist/config/builtin-roles.js +1 -0
- package/dist/config/config-operation-service.js +145 -0
- package/dist/config/contact-operation-service.js +96 -7
- package/dist/config/resolved-config-op.js +27 -7
- package/dist/core/agent-application-service.js +2 -1
- package/dist/core/auth/authorization-audit.js +20 -12
- package/dist/core/auth/operation-authorizer.js +25 -4
- package/dist/core/auth/operation-catalog.js +35 -4
- package/dist/core/auth/remote-access-store.js +40 -1
- package/dist/core/bootstrap-service.js +1 -1
- package/dist/core/command/command-handler.js +83 -26
- package/dist/core/command/diag-service.js +118 -0
- package/dist/core/command/menu-catalog.js +12 -3
- package/dist/core/command/menu-handler.js +47 -26
- package/dist/core/command/menu-protocol.js +5 -0
- package/dist/core/command/menu-token-store.js +41 -8
- package/dist/core/command/slash-gate.js +34 -4
- package/dist/core/command/slash-handler.js +86 -21
- package/dist/core/handoff/runtime.js +205 -27
- package/dist/core/handoff/store.js +193 -4
- package/dist/core/message/im-renderer.js +72 -21
- package/dist/core/message/message-bridge.js +69 -9
- package/dist/core/message/message-queue.js +26 -0
- package/dist/core/message/message-utils.js +1 -0
- package/dist/core/message/response-engine.js +47 -28
- package/dist/core/model/catalog-service.js +79 -49
- package/dist/core/model/context-window-suffix.js +33 -0
- package/dist/core/model/model-catalog.js +1 -1
- package/dist/core/model/model-permission.js +12 -3
- package/dist/core/permission/ec-command-parser.js +51 -12
- package/dist/core/permission/sandbox-runtime.js +36 -14
- package/dist/core/permission/tool-policy.js +2 -1
- package/dist/index.js +280 -163
- package/dist/ipc.js +54 -2
- package/dist/response-system/engines/v1/proactive-flow.js +59 -2
- package/dist/stats/billing.js +41 -15
- package/dist/stats/db.js +159 -159
- package/dist/stats/eck-vars.js +9 -9
- package/dist/stats/price-resolver.js +28 -10
- package/dist/stats/query.js +139 -139
- package/dist/stats/role-budget.js +6 -6
- package/dist/stats/writer.js +51 -51
- package/dist/utils/cross-platform.js +30 -1
- package/dist/utils/error-dict.json +160 -160
- package/dist/utils/error-utils.js +21 -0
- package/dist/utils/evolcore-version.js +129 -0
- package/dist/utils/logger.js +3 -1
- package/dist/utils/macos-autostart.js +22 -22
- package/dist/utils/model-prices.jsonl +23 -23
- package/dist/utils/npm-ops.js +176 -35
- package/dist/utils/welcome.js +22 -22
- package/ecagent/LICENSE +21 -21
- package/ecagent/NOTICE +11 -11
- package/ecagent/README.md +61 -61
- package/ecagent/dist/harness/compaction/branch-summarization.js +30 -30
- package/ecagent/dist/harness/compaction/compaction.js +83 -83
- package/ecagent/dist/harness/messages.js +7 -7
- package/kits/docs/GUIDE.md +20 -20
- package/kits/docs/INDEX.md +66 -66
- package/kits/docs/aun/CHEATSHEET.md +19 -19
- package/kits/docs/aun/SYNC_PROTOCOL.md +15 -15
- package/kits/docs/channels/aun.md +56 -56
- package/kits/docs/channels/feishu.md +56 -56
- package/kits/docs/context-assembly.md +364 -364
- package/kits/docs/eck_templates/GUIDE.template.md +22 -22
- package/kits/docs/eck_templates/INDEX.template.md +28 -28
- package/kits/docs/eck_templates/path-registry.template.md +33 -33
- package/kits/docs/eck_templates/runtime.template.md +19 -19
- package/kits/docs/evolcore/INDEX.md +71 -71
- package/kits/docs/evolcore/agent-create.md +170 -165
- package/kits/docs/evolcore/agent.md +66 -66
- package/kits/docs/evolcore/aid.md +60 -60
- package/kits/docs/evolcore/codex-windows-sandbox.md +146 -146
- package/kits/docs/evolcore/config.md +202 -195
- package/kits/docs/evolcore/contact.md +75 -68
- package/kits/docs/evolcore/ctl.md +46 -46
- package/kits/docs/evolcore/event.md +216 -216
- package/kits/docs/evolcore/fs-architecture.md +1215 -1215
- package/kits/docs/evolcore/fs.md +110 -110
- package/kits/docs/evolcore/group-collaboration.md +243 -243
- package/kits/docs/evolcore/group-fs.md +17 -17
- package/kits/docs/evolcore/group-rules.md +251 -251
- package/kits/docs/evolcore/group.md +152 -152
- package/kits/docs/evolcore/menu-client.md +42 -34
- package/kits/docs/evolcore/model.md +50 -50
- package/kits/docs/evolcore/msg.md +166 -165
- package/kits/docs/evolcore/response.md +75 -75
- package/kits/docs/evolcore/rpc.md +37 -37
- package/kits/docs/evolcore/self-summary.md +29 -29
- package/kits/docs/evolcore/stats.md +83 -83
- package/kits/docs/evolcore/storage.md +50 -50
- package/kits/docs/evolcore/trigger.md +575 -575
- package/kits/docs/identity/AID_PROFILE_SPEC.md +26 -26
- package/kits/docs/identity/PATH_OPS.md +16 -16
- package/kits/docs/identity/ROLE_DETAIL.md +25 -25
- package/kits/docs/identity/identity-tools.md +26 -26
- package/kits/docs/path-registry.md +62 -62
- package/kits/docs/prompt-loading-architecture.md +269 -269
- package/kits/docs/venues/aun-group.md +45 -45
- package/kits/docs/venues/aun-private.md +10 -10
- package/kits/docs/venues/client-desktop.md +10 -10
- package/kits/docs/venues/client-mobile.md +10 -10
- package/kits/docs/venues/feishu-group.md +13 -13
- package/kits/docs/venues/feishu-private.md +9 -9
- package/kits/docs/venues/group.md +37 -25
- package/kits/docs/venues/private.md +10 -10
- package/kits/eck_manifest.auxiliary.json +43 -43
- package/kits/eck_manifest.json +190 -190
- package/kits/eck_message_manifest.json +74 -74
- package/kits/migrations/README-role-config-v4.md +32 -32
- package/kits/migrations/migrate-contact-book-v2.mjs +748 -748
- package/kits/migrations/migrate-role-config-v4.mjs +614 -614
- package/kits/migrations/migrate-role-config-v5.mjs +365 -365
- package/kits/migrations/rename-config-file.mjs +99 -99
- package/kits/rules/01-overview.md +162 -162
- package/kits/rules/02-navigation.md +96 -96
- package/kits/rules/03-identity.md +36 -36
- package/kits/rules/04-relation.md +75 -75
- package/kits/rules/05-venue.md +60 -60
- package/kits/rules/06-channel.md +63 -63
- package/kits/schemas/_meta.json +53 -53
- package/kits/schemas/agent-config.schema.1.json +177 -177
- package/kits/schemas/agent-config.schema.10.json +395 -395
- package/kits/schemas/agent-config.schema.11.json +421 -421
- package/kits/schemas/agent-config.schema.12.json +427 -427
- package/kits/schemas/agent-config.schema.2.json +239 -239
- package/kits/schemas/agent-config.schema.3.json +119 -119
- package/kits/schemas/agent-config.schema.4.json +208 -208
- package/kits/schemas/agent-config.schema.5.json +326 -326
- package/kits/schemas/agent-config.schema.6.json +322 -322
- package/kits/schemas/agent-config.schema.7.json +303 -303
- package/kits/schemas/agent-config.schema.8.json +304 -304
- package/kits/schemas/agent-config.schema.9.json +364 -364
- package/kits/schemas/contact-book.schema.1.json +36 -36
- package/kits/schemas/contact-book.schema.2.json +43 -43
- package/kits/schemas/contact-book.schema.3.json +67 -67
- package/kits/schemas/daemon.schema.1.json +91 -91
- package/kits/schemas/daemon.schema.2.json +101 -101
- package/kits/schemas/daemon.schema.3.json +123 -123
- package/kits/schemas/daemon.schema.4.json +136 -136
- package/kits/schemas/daemon.schema.5.json +135 -135
- package/kits/schemas/daemon.schema.6.json +131 -131
- package/kits/schemas/defaults.schema.1.json +81 -81
- package/kits/schemas/defaults.schema.2.json +85 -85
- package/kits/schemas/defaults.schema.3.json +73 -73
- package/kits/schemas/defaults.schema.4.json +107 -107
- package/kits/schemas/defaults.schema.5.json +119 -119
- package/kits/schemas/menu-exec-schema-commands.md +208 -208
- package/kits/schemas/migrations/README.md +30 -30
- package/kits/schemas/relation-config.schema.1.json +158 -158
- package/kits/schemas/relation-config.schema.2.json +73 -73
- package/kits/schemas/relation-config.schema.3.json +50 -50
- package/kits/schemas/relation-config.schema.4.json +47 -47
- package/kits/schemas/relation-config.schema.5.json +47 -47
- package/kits/schemas/relation-config.schema.6.json +46 -46
- package/kits/schemas/relation-config.schema.7.json +59 -59
- package/kits/schemas/relation-config.schema.8.json +103 -103
- package/kits/schemas/role-config.schema.1.json +201 -201
- package/kits/schemas/role-registry.schema.1.json +35 -35
- package/kits/schemas/single-session.schema.1.json +31 -31
- package/kits/schemas/single-session.schema.2.json +57 -57
- package/kits/schemas/single-session.schema.3.json +32 -32
- package/kits/templates/bootstrap-welcome.md +17 -17
- package/kits/templates/message-fragments/handoff-context-to-target.md +9 -9
- package/kits/templates/message-fragments/handoff-request-to-target.md +19 -19
- package/kits/templates/message-fragments/handoff-response-to-origin.md +9 -9
- package/kits/templates/message-fragments/inject-default.md +2 -2
- package/kits/templates/message-fragments/item.md +2 -2
- package/kits/templates/roles/admin.json +92 -92
- package/kits/templates/roles/member.json +96 -96
- package/kits/templates/roles/owner.json +9 -9
- package/kits/templates/roles/visitor.json +85 -85
- package/kits/templates/system-fragments/baseagent.md +14 -14
- package/kits/templates/system-fragments/bootstrap.md +31 -29
- package/kits/templates/system-fragments/channel.md +64 -64
- package/kits/templates/system-fragments/commands.md +28 -28
- package/kits/templates/system-fragments/identity.md +13 -13
- package/kits/templates/system-fragments/relation.md +19 -19
- package/kits/templates/system-fragments/session.md +59 -59
- package/kits/templates/system-fragments/venue.md +31 -31
- package/package.json +100 -98
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
{
|
|
2
|
-
"rules": [
|
|
3
|
-
{
|
|
4
|
-
"id": "context-too-long-cn",
|
|
5
|
-
"match": "上下文过长",
|
|
6
|
-
"action": "stop",
|
|
7
|
-
"type": "context_too_long",
|
|
8
|
-
"message": "⚠️ 上下文过长,请手动输入 /compact 压缩上下文"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"id": "context-too-long-en",
|
|
12
|
-
"match": "context too long",
|
|
13
|
-
"action": "stop",
|
|
14
|
-
"type": "context_too_long",
|
|
15
|
-
"message": "⚠️ 上下文过长,请手动输入 /compact 压缩上下文"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"id": "prompt-too-long",
|
|
19
|
-
"match": "prompt is too long",
|
|
20
|
-
"action": "stop",
|
|
21
|
-
"type": "context_too_long",
|
|
22
|
-
"message": "⚠️ 输入过长,请精简提问或使用 /compact 压缩上下文"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"id": "invalid-api-key",
|
|
26
|
-
"match": "invalid api key",
|
|
27
|
-
"action": "stop",
|
|
28
|
-
"type": "auth_error",
|
|
29
|
-
"message": "❌ API Key 无效,请检查密钥配置。使用 /status 查看当前配置"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"id": "key-not-found",
|
|
33
|
-
"match": "key_not_found",
|
|
34
|
-
"action": "stop",
|
|
35
|
-
"type": "auth_error",
|
|
36
|
-
"message": "❌ API Key 未找到,请检查密钥配置"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"id": "api-key-verifier-too-many-connections",
|
|
40
|
-
"match": "error 1040 (08004): too many connections",
|
|
41
|
-
"action": "retry",
|
|
42
|
-
"type": "api_error",
|
|
43
|
-
"message": "⚠️ API 服务繁忙,请稍后重试"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"id": "credit-query-timeout",
|
|
47
|
-
"match": "积分查询超时",
|
|
48
|
-
"action": "retry",
|
|
49
|
-
"type": "api_error",
|
|
50
|
-
"message": "⚠️ 积分查询超时,请稍后重试"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"id": "capacity-pool-switching-cn",
|
|
54
|
-
"match": "算力池切换",
|
|
55
|
-
"action": "retry",
|
|
56
|
-
"type": "api_error",
|
|
57
|
-
"message": "⚠️ 当前算力池切换中,请稍后重试"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"id": "retry-attempt-stalled",
|
|
61
|
-
"match": "retry_attempt_stalled",
|
|
62
|
-
"action": "retry",
|
|
63
|
-
"type": "api_error",
|
|
64
|
-
"message": "⚠️ API 重试调用长时间无响应"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"id": "selected-model-at-capacity",
|
|
68
|
-
"match": "selected model is at capacity",
|
|
69
|
-
"action": "retry",
|
|
70
|
-
"type": "api_error",
|
|
71
|
-
"message": "⚠️ 当前模型繁忙,请稍后重试"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"id": "api-error-400",
|
|
75
|
-
"match": "api error: 400",
|
|
76
|
-
"action": "stop",
|
|
77
|
-
"type": "api_error",
|
|
78
|
-
"message": "❌ 请求格式错误,请检查输入内容"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"id": "model-not-supported-403",
|
|
82
|
-
"match": "api error: 403 不支持该模型",
|
|
83
|
-
"action": "stop",
|
|
84
|
-
"type": "model_unavailable",
|
|
85
|
-
"message": "❌ 当前模型不受支持,请正确配置模型后重试"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"id": "api-error-403",
|
|
89
|
-
"match": "api error: 403",
|
|
90
|
-
"action": "retry",
|
|
91
|
-
"type": "api_error",
|
|
92
|
-
"message": "⚠️ API 访问受限,请稍后重试"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"id": "api-error-429",
|
|
96
|
-
"match": "api error: 429",
|
|
97
|
-
"action": "retry",
|
|
98
|
-
"type": "api_error",
|
|
99
|
-
"message": "⚠️ 请求过于频繁,请稍后重试"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"id": "api-error-500",
|
|
103
|
-
"match": "api error: 500",
|
|
104
|
-
"action": "retry",
|
|
105
|
-
"type": "api_error",
|
|
106
|
-
"message": "❌ API 服务暂时不可用,请稍后重试"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"id": "api-error-502",
|
|
110
|
-
"match": "api error: 502",
|
|
111
|
-
"action": "retry",
|
|
112
|
-
"type": "api_error"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"id": "api-error-503",
|
|
116
|
-
"match": "api error: 503",
|
|
117
|
-
"action": "retry",
|
|
118
|
-
"type": "api_error"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
"id": "api-error-504",
|
|
122
|
-
"match": "api error: 504",
|
|
123
|
-
"action": "retry",
|
|
124
|
-
"type": "api_error"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"id": "not-valid-json",
|
|
128
|
-
"match": "is not valid json",
|
|
129
|
-
"action": "retry",
|
|
130
|
-
"type": "api_error",
|
|
131
|
-
"message": "⚠️ API 返回异常响应,请稍后重试"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"id": "json-parse-error",
|
|
135
|
-
"match": "json parse error",
|
|
136
|
-
"action": "retry",
|
|
137
|
-
"type": "api_error",
|
|
138
|
-
"message": "⚠️ API 返回 JSON 解析异常,请稍后重试"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
"id": "feishu-permission",
|
|
142
|
-
"match": "im:resource",
|
|
143
|
-
"action": "stop",
|
|
144
|
-
"type": "unknown",
|
|
145
|
-
"message": "❌ 权限不足,请联系管理员配置应用权限"
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"id": "stream-error",
|
|
149
|
-
"match": "stream",
|
|
150
|
-
"action": "retry",
|
|
151
|
-
"type": "stream_error"
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
"id": "request-aborted",
|
|
155
|
-
"match": "request was aborted",
|
|
156
|
-
"action": "ignore",
|
|
157
|
-
"type": "stream_error"
|
|
158
|
-
}
|
|
159
|
-
]
|
|
160
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"rules": [
|
|
3
|
+
{
|
|
4
|
+
"id": "context-too-long-cn",
|
|
5
|
+
"match": "上下文过长",
|
|
6
|
+
"action": "stop",
|
|
7
|
+
"type": "context_too_long",
|
|
8
|
+
"message": "⚠️ 上下文过长,请手动输入 /compact 压缩上下文"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "context-too-long-en",
|
|
12
|
+
"match": "context too long",
|
|
13
|
+
"action": "stop",
|
|
14
|
+
"type": "context_too_long",
|
|
15
|
+
"message": "⚠️ 上下文过长,请手动输入 /compact 压缩上下文"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "prompt-too-long",
|
|
19
|
+
"match": "prompt is too long",
|
|
20
|
+
"action": "stop",
|
|
21
|
+
"type": "context_too_long",
|
|
22
|
+
"message": "⚠️ 输入过长,请精简提问或使用 /compact 压缩上下文"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "invalid-api-key",
|
|
26
|
+
"match": "invalid api key",
|
|
27
|
+
"action": "stop",
|
|
28
|
+
"type": "auth_error",
|
|
29
|
+
"message": "❌ API Key 无效,请检查密钥配置。使用 /status 查看当前配置"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "key-not-found",
|
|
33
|
+
"match": "key_not_found",
|
|
34
|
+
"action": "stop",
|
|
35
|
+
"type": "auth_error",
|
|
36
|
+
"message": "❌ API Key 未找到,请检查密钥配置"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "api-key-verifier-too-many-connections",
|
|
40
|
+
"match": "error 1040 (08004): too many connections",
|
|
41
|
+
"action": "retry",
|
|
42
|
+
"type": "api_error",
|
|
43
|
+
"message": "⚠️ API 服务繁忙,请稍后重试"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "credit-query-timeout",
|
|
47
|
+
"match": "积分查询超时",
|
|
48
|
+
"action": "retry",
|
|
49
|
+
"type": "api_error",
|
|
50
|
+
"message": "⚠️ 积分查询超时,请稍后重试"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "capacity-pool-switching-cn",
|
|
54
|
+
"match": "算力池切换",
|
|
55
|
+
"action": "retry",
|
|
56
|
+
"type": "api_error",
|
|
57
|
+
"message": "⚠️ 当前算力池切换中,请稍后重试"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": "retry-attempt-stalled",
|
|
61
|
+
"match": "retry_attempt_stalled",
|
|
62
|
+
"action": "retry",
|
|
63
|
+
"type": "api_error",
|
|
64
|
+
"message": "⚠️ API 重试调用长时间无响应"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"id": "selected-model-at-capacity",
|
|
68
|
+
"match": "selected model is at capacity",
|
|
69
|
+
"action": "retry",
|
|
70
|
+
"type": "api_error",
|
|
71
|
+
"message": "⚠️ 当前模型繁忙,请稍后重试"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"id": "api-error-400",
|
|
75
|
+
"match": "api error: 400",
|
|
76
|
+
"action": "stop",
|
|
77
|
+
"type": "api_error",
|
|
78
|
+
"message": "❌ 请求格式错误,请检查输入内容"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": "model-not-supported-403",
|
|
82
|
+
"match": "api error: 403 不支持该模型",
|
|
83
|
+
"action": "stop",
|
|
84
|
+
"type": "model_unavailable",
|
|
85
|
+
"message": "❌ 当前模型不受支持,请正确配置模型后重试"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id": "api-error-403",
|
|
89
|
+
"match": "api error: 403",
|
|
90
|
+
"action": "retry",
|
|
91
|
+
"type": "api_error",
|
|
92
|
+
"message": "⚠️ API 访问受限,请稍后重试"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "api-error-429",
|
|
96
|
+
"match": "api error: 429",
|
|
97
|
+
"action": "retry",
|
|
98
|
+
"type": "api_error",
|
|
99
|
+
"message": "⚠️ 请求过于频繁,请稍后重试"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "api-error-500",
|
|
103
|
+
"match": "api error: 500",
|
|
104
|
+
"action": "retry",
|
|
105
|
+
"type": "api_error",
|
|
106
|
+
"message": "❌ API 服务暂时不可用,请稍后重试"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"id": "api-error-502",
|
|
110
|
+
"match": "api error: 502",
|
|
111
|
+
"action": "retry",
|
|
112
|
+
"type": "api_error"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"id": "api-error-503",
|
|
116
|
+
"match": "api error: 503",
|
|
117
|
+
"action": "retry",
|
|
118
|
+
"type": "api_error"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"id": "api-error-504",
|
|
122
|
+
"match": "api error: 504",
|
|
123
|
+
"action": "retry",
|
|
124
|
+
"type": "api_error"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"id": "not-valid-json",
|
|
128
|
+
"match": "is not valid json",
|
|
129
|
+
"action": "retry",
|
|
130
|
+
"type": "api_error",
|
|
131
|
+
"message": "⚠️ API 返回异常响应,请稍后重试"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"id": "json-parse-error",
|
|
135
|
+
"match": "json parse error",
|
|
136
|
+
"action": "retry",
|
|
137
|
+
"type": "api_error",
|
|
138
|
+
"message": "⚠️ API 返回 JSON 解析异常,请稍后重试"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"id": "feishu-permission",
|
|
142
|
+
"match": "im:resource",
|
|
143
|
+
"action": "stop",
|
|
144
|
+
"type": "unknown",
|
|
145
|
+
"message": "❌ 权限不足,请联系管理员配置应用权限"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"id": "stream-error",
|
|
149
|
+
"match": "stream",
|
|
150
|
+
"action": "retry",
|
|
151
|
+
"type": "stream_error"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"id": "request-aborted",
|
|
155
|
+
"match": "request was aborted",
|
|
156
|
+
"action": "ignore",
|
|
157
|
+
"type": "stream_error"
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
@@ -4,6 +4,14 @@ import { getPackageRoot, resolvePaths } from '../paths.js';
|
|
|
4
4
|
import { logger } from './logger.js';
|
|
5
5
|
import { isSandboxInitializationFailure } from '../core/permission/sandbox-runtime.js';
|
|
6
6
|
export const CLAUDE_STARTUP_ARGUMENTS_TOO_LONG = 'claude_startup_arguments_too_long';
|
|
7
|
+
/** A completed provider response exhausted its output budget, rather than a transport failure. */
|
|
8
|
+
export function isOutputTokenLimitError(error) {
|
|
9
|
+
const record = error && typeof error === 'object' ? error : undefined;
|
|
10
|
+
const message = String(record?.message ?? error ?? '');
|
|
11
|
+
return record?.code === 'max_output_tokens'
|
|
12
|
+
|| /^\s*max_output_tokens\s*$/i.test(message)
|
|
13
|
+
|| /\breason["']?\s*[:=]\s*["']?max_output_tokens\b/i.test(message);
|
|
14
|
+
}
|
|
7
15
|
/** Identify a Claude process-start failure without treating ordinary tool errors as startup failures. */
|
|
8
16
|
export function isClaudeStartupArgumentsTooLong(error) {
|
|
9
17
|
const code = error && typeof error === 'object' && 'code' in error
|
|
@@ -36,6 +44,7 @@ export var ErrorType;
|
|
|
36
44
|
ErrorType["AUTH_ERROR"] = "auth_error";
|
|
37
45
|
ErrorType["FILE_CORRUPT"] = "file_corrupt";
|
|
38
46
|
ErrorType["STREAM_ERROR"] = "stream_error";
|
|
47
|
+
ErrorType["MAX_OUTPUT_TOKENS"] = "max_output_tokens";
|
|
39
48
|
ErrorType["CONTEXT_TOO_LONG"] = "context_too_long";
|
|
40
49
|
ErrorType["MODEL_UNAVAILABLE"] = "model_unavailable";
|
|
41
50
|
ErrorType["SESSION_UNAVAILABLE"] = "session_unavailable";
|
|
@@ -78,6 +87,7 @@ const NON_INFRA_SUBTYPES = new Set([
|
|
|
78
87
|
'stop',
|
|
79
88
|
]);
|
|
80
89
|
const NON_INFRA_TERMINAL_REASONS = new Set([
|
|
90
|
+
'max_output_tokens',
|
|
81
91
|
'rapid_refill_breaker',
|
|
82
92
|
'tool_deferred',
|
|
83
93
|
'stop_hook_prevented',
|
|
@@ -279,6 +289,9 @@ function hasRetryableHttpStatus(text) {
|
|
|
279
289
|
}
|
|
280
290
|
export function classifyError(error) {
|
|
281
291
|
const msg = (error?.message || '').toLowerCase();
|
|
292
|
+
// The broad dictionary rule for "stream" must not hide a provider budget limit.
|
|
293
|
+
if (isOutputTokenLimitError(error))
|
|
294
|
+
return ErrorType.MAX_OUTPUT_TOKENS;
|
|
282
295
|
if (error?.code === 'TOPIC_BACKEND_UNAVAILABLE') {
|
|
283
296
|
return ErrorType.SESSION_UNAVAILABLE;
|
|
284
297
|
}
|
|
@@ -333,6 +346,9 @@ export function classifyError(error) {
|
|
|
333
346
|
* 注意:401 认证错误不可重试(API Key 无效不会因重试恢复)
|
|
334
347
|
*/
|
|
335
348
|
export function isRetryableError(error) {
|
|
349
|
+
// Replaying the same request does not increase its output budget.
|
|
350
|
+
if (isOutputTokenLimitError(error))
|
|
351
|
+
return false;
|
|
336
352
|
const msg = error?.message || String(error);
|
|
337
353
|
const lower = msg.toLowerCase();
|
|
338
354
|
// 字典优先 — 命中则直接返回
|
|
@@ -350,6 +366,11 @@ export function isRetryableError(error) {
|
|
|
350
366
|
return false;
|
|
351
367
|
}
|
|
352
368
|
export function getErrorMessage(error, terminalReason, includeEmoji = true) {
|
|
369
|
+
if (terminalReason === 'max_output_tokens' || isOutputTokenLimitError(error)) {
|
|
370
|
+
const prefix = includeEmoji ? '⚠️ ' : '';
|
|
371
|
+
return `${prefix}模型响应达到输出上限(max_output_tokens),本轮未完成。`
|
|
372
|
+
+ '请降低推理强度或提高模型服务的输出预算,然后在原会话发送“继续,先核对已完成操作,只完成剩余工作”;无需重发原任务。';
|
|
373
|
+
}
|
|
353
374
|
if (isClaudeStartupArgumentsTooLong(error)) {
|
|
354
375
|
const prefix = includeEmoji ? '⚠️ ' : '';
|
|
355
376
|
return `${prefix}当前 Claude 启动参数过长,任务未执行`;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
1
2
|
import fs from 'fs';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
import { getPackageRoot } from '../paths.js';
|
|
4
5
|
let cachedVersion;
|
|
6
|
+
let cachedFlavor;
|
|
7
|
+
let cachedStartStamp;
|
|
8
|
+
let cachedStartedAtIso;
|
|
5
9
|
export function readInstalledEvolcoreVersion() {
|
|
6
10
|
if (cachedVersion !== undefined)
|
|
7
11
|
return cachedVersion;
|
|
@@ -16,6 +20,131 @@ export function readInstalledEvolcoreVersion() {
|
|
|
16
20
|
cachedVersion = version;
|
|
17
21
|
return version;
|
|
18
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* 区分源码仓库运行与全局安装包。`package.json` 的 `files` 白名单不含 `src/`,
|
|
25
|
+
* 所以 `src/index.ts` 的存在性可以稳定区分两者:同一个版本号在 dev 下跑的是
|
|
26
|
+
* 未发布的工作副本,排查时必须能看出来。
|
|
27
|
+
*/
|
|
28
|
+
export function readEvolcoreRuntimeFlavor() {
|
|
29
|
+
if (cachedFlavor !== undefined)
|
|
30
|
+
return cachedFlavor;
|
|
31
|
+
let flavor;
|
|
32
|
+
try {
|
|
33
|
+
flavor = fs.existsSync(path.join(getPackageRoot(), 'src', 'index.ts')) ? 'dev' : 'install';
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
flavor = 'install';
|
|
37
|
+
}
|
|
38
|
+
cachedFlavor = flavor;
|
|
39
|
+
return flavor;
|
|
40
|
+
}
|
|
41
|
+
function pad2(n) {
|
|
42
|
+
return String(n).padStart(2, '0');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 本进程启动时刻。用 `process.uptime()` 反推而非模块加载时的 `Date.now()`:
|
|
46
|
+
* 后者受 import 链耗时影响,且本模块可能被惰性加载。无 syscall,只算一次。
|
|
47
|
+
*/
|
|
48
|
+
function resolveStartedAt() {
|
|
49
|
+
return new Date(Date.now() - Math.round(process.uptime() * 1000));
|
|
50
|
+
}
|
|
51
|
+
/** 本进程启动时刻的 ISO 串,供结构化字段使用。 */
|
|
52
|
+
export function readEvolcoreStartedAtIso() {
|
|
53
|
+
if (cachedStartedAtIso !== undefined)
|
|
54
|
+
return cachedStartedAtIso;
|
|
55
|
+
cachedStartedAtIso = resolveStartedAt().toISOString();
|
|
56
|
+
return cachedStartedAtIso;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 错误标记里的启动时刻,`MMDD-HHMM` 本地时间。
|
|
60
|
+
*
|
|
61
|
+
* 用本地时间而非 UTC:读的人是对着自己的墙上时钟判断"这进程是我改完之后起的吗"。
|
|
62
|
+
* 精度到分钟——秒级对判断重启无意义,只会占长度。
|
|
63
|
+
*/
|
|
64
|
+
export function readEvolcoreStartStamp() {
|
|
65
|
+
if (cachedStartStamp !== undefined)
|
|
66
|
+
return cachedStartStamp;
|
|
67
|
+
const d = resolveStartedAt();
|
|
68
|
+
cachedStartStamp = `${pad2(d.getMonth() + 1)}${pad2(d.getDate())}-${pad2(d.getHours())}${pad2(d.getMinutes())}`;
|
|
69
|
+
return cachedStartStamp;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 用户可见错误文案的版本标记,形如 `[EC 0.0.24 dev 0915-1230]`。
|
|
73
|
+
*
|
|
74
|
+
* 带启动时刻是因为版本号不足以定位问题:dev 模式下同一个 `0.0.24` 可能是任意一份
|
|
75
|
+
* 工作副本,改完代码不重启就仍在跑旧代码——启动时刻能直接把这种情况暴露出来。
|
|
76
|
+
*/
|
|
77
|
+
export function evolcoreErrorTag() {
|
|
78
|
+
return `[EC ${readInstalledEvolcoreVersion()} ${readEvolcoreRuntimeFlavor()} ${readEvolcoreStartStamp()}]`;
|
|
79
|
+
}
|
|
80
|
+
const ERROR_TAG_PATTERN = /\[EC\s+[^\]]*\]/;
|
|
81
|
+
/**
|
|
82
|
+
* 前导 emoji / 变体选择符 / 空白:标记要插在它们之后。U+FE0F 单独列出,
|
|
83
|
+
* 它跟在 emoji 之后且不属于 Extended_Pictographic,漏掉会把 `⚠️` 拆开。
|
|
84
|
+
*/
|
|
85
|
+
const LEADING_DECORATION = /^(?:\p{Extended_Pictographic}|️|\s)+/u;
|
|
86
|
+
/**
|
|
87
|
+
* 给用户可见的错误文案打版本标记。标记走前缀而非后缀:渠道前端会截断长文案
|
|
88
|
+
* (错误卡片只显示前两行),后缀会被直接截掉。
|
|
89
|
+
*
|
|
90
|
+
* 幂等,且在整串任意位置发现既有标记就跳过——错误文案会被
|
|
91
|
+
* `formatRetryableErrorFinalMessage` 之类的包装器嵌进 `原因:…` 中段,
|
|
92
|
+
* 只检查开头会导致同一个错误被打两次标。
|
|
93
|
+
*/
|
|
94
|
+
export function tagErrorTextWithEvolcoreVersion(text) {
|
|
95
|
+
if (typeof text !== 'string' || !text.trim())
|
|
96
|
+
return text;
|
|
97
|
+
if (ERROR_TAG_PATTERN.test(text))
|
|
98
|
+
return text;
|
|
99
|
+
const decoration = text.match(LEADING_DECORATION)?.[0] ?? '';
|
|
100
|
+
return `${decoration}${evolcoreErrorTag()} ${text.slice(decoration.length)}`;
|
|
101
|
+
}
|
|
19
102
|
export function _resetInstalledEvolcoreVersionForTests() {
|
|
20
103
|
cachedVersion = undefined;
|
|
104
|
+
cachedFlavor = undefined;
|
|
105
|
+
cachedStartStamp = undefined;
|
|
106
|
+
cachedStartedAtIso = undefined;
|
|
107
|
+
}
|
|
108
|
+
function collectFiles(root, current = root, out = []) {
|
|
109
|
+
let entries;
|
|
110
|
+
try {
|
|
111
|
+
entries = fs.readdirSync(current, { withFileTypes: true });
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return out;
|
|
115
|
+
}
|
|
116
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
117
|
+
const full = path.join(current, entry.name);
|
|
118
|
+
if (entry.isDirectory())
|
|
119
|
+
collectFiles(root, full, out);
|
|
120
|
+
else if (entry.isFile())
|
|
121
|
+
out.push(path.relative(root, full));
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
/** Hash the complete compiled tree so a changed dependency module changes the ID too. */
|
|
126
|
+
export function computeBuildId(distDir) {
|
|
127
|
+
if (!fs.existsSync(distDir))
|
|
128
|
+
return null;
|
|
129
|
+
try {
|
|
130
|
+
const hash = crypto.createHash('sha256');
|
|
131
|
+
for (const relative of collectFiles(distDir)) {
|
|
132
|
+
const full = path.join(distDir, relative);
|
|
133
|
+
hash.update(relative.replaceAll(path.sep, '/'));
|
|
134
|
+
hash.update('\0');
|
|
135
|
+
hash.update(fs.readFileSync(full));
|
|
136
|
+
hash.update('\0');
|
|
137
|
+
}
|
|
138
|
+
return `sha256:${hash.digest('hex').slice(0, 24)}`;
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export function readBuildIdentity(distDir, version) {
|
|
145
|
+
return {
|
|
146
|
+
id: computeBuildId(distDir),
|
|
147
|
+
entry: path.join(distDir, 'index.js'),
|
|
148
|
+
...(version ? { version } : {}),
|
|
149
|
+
};
|
|
21
150
|
}
|
package/dist/utils/logger.js
CHANGED
|
@@ -152,7 +152,9 @@ export function normalizeStructuredLog(data) {
|
|
|
152
152
|
export function localTimestamp() {
|
|
153
153
|
const d = new Date();
|
|
154
154
|
const pad = (n) => String(n).padStart(2, '0');
|
|
155
|
-
|
|
155
|
+
const offset = -d.getTimezoneOffset();
|
|
156
|
+
const zone = `${offset >= 0 ? '+' : '-'}${pad(Math.floor(Math.abs(offset) / 60))}:${pad(Math.abs(offset) % 60)}`;
|
|
157
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}.${String(d.getMilliseconds()).padStart(3, '0')}${zone}`;
|
|
156
158
|
}
|
|
157
159
|
function log(level, ...args) {
|
|
158
160
|
if (!shouldLog(level))
|
|
@@ -51,28 +51,28 @@ function createPlist(runtimeRoot) {
|
|
|
51
51
|
const args = [process.execPath, '--no-warnings=ExperimentalWarning', cliEntry, 'start']
|
|
52
52
|
.map(value => ` <string>${xmlLiteral(value)}</string>`)
|
|
53
53
|
.join('\n');
|
|
54
|
-
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
55
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
56
|
-
<plist version="1.0">
|
|
57
|
-
<dict>
|
|
58
|
-
<key>Label</key>
|
|
59
|
-
<string>${xmlLiteral(MACOS_AUTOSTART_LABEL)}</string>
|
|
60
|
-
<key>ProgramArguments</key>
|
|
61
|
-
<array>
|
|
62
|
-
${args}
|
|
63
|
-
</array>
|
|
64
|
-
<key>EnvironmentVariables</key>
|
|
65
|
-
<dict>
|
|
66
|
-
${environmentXml}
|
|
67
|
-
</dict>
|
|
68
|
-
<key>RunAtLoad</key>
|
|
69
|
-
<true/>
|
|
70
|
-
<key>StandardOutPath</key>
|
|
71
|
-
<string>${xmlLiteral(path.join(absoluteRoot, 'logs', 'autostart.stdout.log'))}</string>
|
|
72
|
-
<key>StandardErrorPath</key>
|
|
73
|
-
<string>${xmlLiteral(path.join(absoluteRoot, 'logs', 'autostart.stderr.log'))}</string>
|
|
74
|
-
</dict>
|
|
75
|
-
</plist>
|
|
54
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
55
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
56
|
+
<plist version="1.0">
|
|
57
|
+
<dict>
|
|
58
|
+
<key>Label</key>
|
|
59
|
+
<string>${xmlLiteral(MACOS_AUTOSTART_LABEL)}</string>
|
|
60
|
+
<key>ProgramArguments</key>
|
|
61
|
+
<array>
|
|
62
|
+
${args}
|
|
63
|
+
</array>
|
|
64
|
+
<key>EnvironmentVariables</key>
|
|
65
|
+
<dict>
|
|
66
|
+
${environmentXml}
|
|
67
|
+
</dict>
|
|
68
|
+
<key>RunAtLoad</key>
|
|
69
|
+
<true/>
|
|
70
|
+
<key>StandardOutPath</key>
|
|
71
|
+
<string>${xmlLiteral(path.join(absoluteRoot, 'logs', 'autostart.stdout.log'))}</string>
|
|
72
|
+
<key>StandardErrorPath</key>
|
|
73
|
+
<string>${xmlLiteral(path.join(absoluteRoot, 'logs', 'autostart.stderr.log'))}</string>
|
|
74
|
+
</dict>
|
|
75
|
+
</plist>
|
|
76
76
|
`;
|
|
77
77
|
}
|
|
78
78
|
function restorePlist(file, previous) {
|