evolcore 0.0.43-test.3 → 0.0.43-test.5
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 +82 -0
- package/bin/ecmsg.js +492 -0
- package/bin/install-codex-managed-hooks.mjs +130 -8
- package/dist/ability/application-service.js +37 -0
- package/dist/ability/resources.js +28 -0
- package/dist/ability/runtime.js +6 -1
- package/dist/agents/claude-runner.js +7 -5
- package/dist/agents/codex/app-server-client.js +0 -12
- package/dist/agents/codex-runner.js +12 -54
- package/dist/agents/ecagent-runner.js +130 -35
- package/dist/aun/aid/agentmd.js +56 -12
- package/dist/aun/aid/control-aid.js +15 -0
- package/dist/aun/aid/identity.js +8 -0
- package/dist/aun/aid/ownership-operation.js +12 -3
- package/dist/aun/menu/client.js +8 -7
- package/dist/aun/menu/index.js +1 -1
- package/dist/aun/menu/transport.js +8 -5
- package/dist/aun/service-proxy.js +3 -0
- package/dist/channels/aun.js +56 -22
- package/dist/channels/daemon.js +12 -4
- package/dist/cli/agent-command.js +5 -0
- package/dist/cli/agent-create.js +32 -8
- package/dist/cli/agent.js +9 -3
- package/dist/cli/aid-bind-command.js +3 -0
- package/dist/cli/aun-commands.js +12 -5
- package/dist/cli/code-stats.js +451 -213
- package/dist/cli/ctl-command.js +1 -3
- package/dist/cli/daemon-commands.js +42 -21
- package/dist/cli/directory.js +7 -8
- package/dist/cli/ecmsg-gateway.js +204 -0
- package/dist/cli/getmeta-command.js +2 -1
- package/dist/cli/index.js +6 -0
- package/dist/cli/init.js +58 -18
- package/dist/cli/provider-command.js +82 -5
- package/dist/cli/restart-monitor.js +11 -19
- package/dist/cli/stats.js +8 -1
- package/dist/cli/task-context.js +3 -0
- package/dist/cli/trigger-command.js +20 -14
- package/dist/config/boot-log.js +23 -2
- package/dist/config/config-field-policy.js +2 -0
- package/dist/config/config-manager.js +13 -17
- package/dist/config/daemon-services.js +1 -0
- package/dist/config/peer-role-resolver.js +6 -6
- package/dist/config/provider-identity-migration.js +202 -0
- package/dist/config/provider-identity.js +37 -0
- package/dist/config/provider-ipc-service.js +40 -3
- package/dist/config/provider-local-sync.js +153 -0
- package/dist/config/providers-config.js +32 -4
- package/dist/config/providers-management.js +144 -68
- package/dist/config/providers.js +4 -1
- package/dist/config/role-schema.js +3 -3
- package/dist/config/schema-migration.js +188 -3
- package/dist/core/agent-application-service.js +11 -0
- package/dist/core/agent-ipc-registration.js +2 -0
- package/dist/core/agent-runtime.js +45 -11
- package/dist/core/auth/auth-gateway.js +8 -6
- package/dist/core/auth/delegation-diagnostics.js +6 -2
- package/dist/core/auth/operation-authorizer.js +5 -2
- package/dist/core/auth/operation-catalog.js +6 -4
- package/dist/core/baseagent-loader.js +11 -3
- package/dist/core/bootstrap-service.js +8 -0
- package/dist/core/channel-loader.js +61 -23
- package/dist/core/command/agent-control.js +4 -1
- package/dist/core/command/chatmode-config.js +46 -0
- package/dist/core/command/cli-intent-parser.js +2 -1
- package/dist/core/command/command-handler.js +16 -20
- package/dist/core/command/daemon-diagnostics.js +2 -1
- package/dist/core/command/menu-catalog.js +1 -1
- package/dist/core/command/menu-handler.js +16 -16
- package/dist/core/command/menu-protocol.js +4 -2
- package/dist/core/command/provider-menu.js +4 -2
- package/dist/core/command/role-menu.js +2 -2
- package/dist/core/command/slash-handler.js +56 -42
- package/dist/core/daemon-lifecycle.js +35 -17
- package/dist/core/event-catalog.js +19 -0
- package/dist/core/evolagent-registry.js +3 -0
- package/dist/core/handoff/runtime.js +9 -3
- package/dist/core/initialization/service.js +4 -3
- package/dist/core/ipc-registration.js +6 -0
- package/dist/core/message/aun-ipc-sender.js +81 -3
- package/dist/core/message/im-renderer.js +24 -19
- package/dist/core/message/message-admission.js +13 -2
- package/dist/core/message/response-engine.js +40 -41
- package/dist/core/message/send-options.js +40 -0
- package/dist/core/message/send-routing.js +310 -0
- package/dist/core/model/model-capabilities.js +37 -0
- package/dist/core/model/model-catalog.js +6 -2
- package/dist/core/ownership/owner-resolver.js +117 -14
- package/dist/core/permission/ec-command-parser.js +195 -27
- package/dist/core/permission/readonly-shell-query.js +66 -7
- package/dist/core/permission/tool-error-code.js +13 -1
- package/dist/core/permission/tool-policy.js +74 -20
- package/dist/core/plugin-lifecycle.js +6 -2
- package/dist/core/relation/pa-team.js +7 -2
- package/dist/core/relation/same-owner-proof.js +131 -0
- package/dist/core/session/session-idle-monitor.js +94 -16
- package/dist/core/session/session-manager.js +69 -16
- package/dist/core/thread/thread-route.js +5 -2
- package/dist/directory/owner-directory-cache.js +690 -99
- package/dist/directory/owner-directory-markdown.js +146 -36
- package/dist/directory/owner-directory-query-operation.js +7 -9
- package/dist/directory/owner-directory-scope.js +12 -0
- package/dist/directory/owner-directory-search.js +5 -1
- package/dist/directory/owner-directory-store.js +28 -0
- package/dist/ecweb/basic-settings-service.js +15 -1
- package/dist/ecweb/message-context-service.js +2 -2
- package/dist/ecweb/providers-service.js +3 -1
- package/dist/ecweb/runtime/lifecycle.js +38 -5
- package/dist/ecweb/runtime/supervisor.js +157 -49
- package/dist/index.js +202 -38
- package/dist/paths.js +2 -1
- package/dist/proxy/manager.js +2 -0
- package/dist/proxy/service-supervisor.js +379 -143
- package/dist/response-system/engines/v1/proactive-flow.js +4 -0
- package/dist/trigger/application-service.js +1 -0
- package/dist/trigger/audit.js +3 -2
- package/dist/trigger/authorization.js +2 -3
- package/dist/trigger/event-source.js +4 -0
- package/dist/trigger/feedback.js +26 -2
- package/dist/trigger/history.js +4 -3
- package/dist/trigger/ipc-service.js +24 -19
- package/dist/trigger/manager.js +3 -5
- package/dist/trigger/parser.js +4 -21
- package/dist/trigger/patch.js +3 -15
- package/dist/trigger/scheduler.js +48 -13
- package/dist/trigger/system-definitions.js +2 -2
- package/dist/trigger/validation.js +4 -13
- package/dist/utils/autostart.js +2 -2
- package/dist/utils/cross-platform.js +36 -8
- package/dist/utils/error-utils.js +8 -0
- package/dist/utils/macos-autostart.js +31 -0
- package/dist/utils/model-prices.jsonl +15 -8
- package/dist/utils/process-introspect.js +21 -1
- package/dist/utils/public-suffix.js +5811 -0
- package/dist/utils/startup-trace.js +7 -1
- package/dist/utils/windows-autostart.js +42 -7
- package/ecagent/dist/harness/compaction/branch-summarization.js +1 -1
- package/ecagent/dist/harness/compaction/compaction.js +4 -4
- package/ecagent/dist/harness/env/nodejs.js +46 -2
- package/kits/docs/aun/ABILITY_CALLING.md +3 -3
- package/kits/docs/channels/aun.md +1 -1
- package/kits/docs/channels/feishu.md +2 -2
- package/kits/docs/context-assembly.md +20 -4
- package/kits/docs/evolcore/INDEX.md +3 -2
- package/kits/docs/evolcore/agent.md +2 -2
- package/kits/docs/evolcore/aid.md +8 -2
- package/kits/docs/evolcore/ctl.md +13 -4
- package/kits/docs/evolcore/directory.md +48 -15
- package/kits/docs/evolcore/file-navigation.md +63 -49
- package/kits/docs/evolcore/group.md +6 -6
- package/kits/docs/evolcore/memory-consolidation.md +1 -1
- package/kits/docs/evolcore/menu-protocol.md +33 -3
- package/kits/docs/evolcore/model.md +5 -3
- package/kits/docs/evolcore/msg.md +28 -27
- package/kits/docs/evolcore/provider.md +39 -5
- package/kits/docs/evolcore/response.md +3 -1
- package/kits/docs/evolcore/thread-chain.md +12 -14
- package/kits/docs/evolcore/tool-authorization.md +21 -1
- package/kits/docs/evolcore/trigger.md +12 -9
- package/kits/docs/identity/ROLE_DETAIL.md +1 -1
- package/kits/docs/prompt-loading-architecture.md +30 -20
- package/kits/eck_manifest.auxiliary.json +5 -5
- package/kits/eck_manifest.json +28 -49
- package/kits/eck_manifest.memory.json +18 -18
- package/kits/rules/01-overview.md +43 -45
- package/kits/rules/02-navigation.md +44 -53
- package/kits/rules/03-identity.md +21 -25
- package/kits/rules/04-relation.md +23 -33
- package/kits/rules/05-venue.md +24 -25
- package/kits/rules/06-channel.md +3 -3
- package/kits/schemas/_meta.json +20 -27
- package/kits/schemas/agent-config.schema.19.json +10 -6
- package/kits/schemas/providers.schema.2.json +74 -0
- package/kits/schemas/relation-config.schema.12.json +2 -2
- package/kits/schemas/role-config.schema.2.json +5 -5
- package/kits/schemas/role-registry.schema.1.json +1 -1
- package/kits/skills/ec-agent-create/SKILL.md +1 -0
- package/kits/skills/ec-service-proxy/SKILL.md +3 -0
- package/kits/skills/ec-trigger/SKILL.md +4 -4
- package/kits/skills/ec-trigger/references/examples.md +1 -1
- package/kits/templates/system-fragments/channel.md +5 -5
- package/kits/templates/system-fragments/commands.md +3 -2
- package/kits/templates/system-fragments/directory-contacts.md +10 -3
- package/kits/templates/system-fragments/identity.md +0 -1
- package/kits/templates/system-fragments/personal-assistant.md +22 -3
- package/kits/templates/system-fragments/reply.md +47 -28
- package/kits/templates/system-fragments/session.md +2 -9
- package/kits/templates/system-fragments/thread.md +5 -5
- package/package.json +17 -13
- package/kits/schemas/agent-config.schema.20.json +0 -925
- package/kits/schemas/relation-config.schema.13.json +0 -289
- package/kits/schemas/role-config.schema.3.json +0 -1038
|
@@ -195,7 +195,8 @@ function prepareCliProbe(command, args, options = {}) {
|
|
|
195
195
|
const identity = `${probeInstallationIdentity(command, executable)}|${cliFileIdentity(launch.launcherPath)}`;
|
|
196
196
|
const key = JSON.stringify([command, args]);
|
|
197
197
|
let entry = cliProbeCache.get(key);
|
|
198
|
-
if (!entry || entry.identity !== identity || (entry.retryAt !== undefined && Date.now() >= entry.retryAt)
|
|
198
|
+
if (!entry || entry.identity !== identity || (entry.retryAt !== undefined && Date.now() >= entry.retryAt)
|
|
199
|
+
|| (entry.output !== undefined && options.validateOutput && !options.validateOutput(entry.output))) {
|
|
199
200
|
entry = { identity };
|
|
200
201
|
cliProbeCache.set(key, entry);
|
|
201
202
|
}
|
|
@@ -207,10 +208,23 @@ function prepareCliProbe(command, args, options = {}) {
|
|
|
207
208
|
};
|
|
208
209
|
}
|
|
209
210
|
function failCliProbe(entry, error) {
|
|
211
|
+
entry.output = undefined;
|
|
210
212
|
entry.error = error;
|
|
211
213
|
entry.retryAt = Date.now() + CLI_PROBE_FAILURE_BACKOFF_MS;
|
|
212
214
|
throw error;
|
|
213
215
|
}
|
|
216
|
+
function validateCliProbeOutput(output, stderr, options) {
|
|
217
|
+
if (options.validateOutput && !options.validateOutput(output)) {
|
|
218
|
+
throw Object.assign(new Error('CLI probe returned invalid output'), {
|
|
219
|
+
code: 'INVALID_PROBE_OUTPUT', status: 0, stdout: output, stderr,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return output;
|
|
223
|
+
}
|
|
224
|
+
function isRetryableCliProbeError(error) {
|
|
225
|
+
const code = error?.code;
|
|
226
|
+
return code === 'ETIMEDOUT' || code === 'INVALID_PROBE_OUTPUT';
|
|
227
|
+
}
|
|
214
228
|
export function probeCliSync(command, args, options = {}) {
|
|
215
229
|
const request = prepareCliProbe(command, args, options);
|
|
216
230
|
if (request.entry.output !== undefined)
|
|
@@ -220,15 +234,16 @@ export function probeCliSync(command, args, options = {}) {
|
|
|
220
234
|
for (const [index, timeout] of cliProbeTimeouts(command, options).entries()) {
|
|
221
235
|
const startedAt = Date.now();
|
|
222
236
|
try {
|
|
223
|
-
|
|
237
|
+
const output = execFileSync(request.command, request.args, {
|
|
224
238
|
encoding: 'utf8', timeout, windowsHide: true,
|
|
225
239
|
windowsVerbatimArguments: request.launch.windowsVerbatimArguments,
|
|
226
240
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
227
241
|
});
|
|
242
|
+
return request.entry.output = validateCliProbeOutput(output, undefined, options);
|
|
228
243
|
}
|
|
229
244
|
catch (error) {
|
|
230
245
|
options.onFailure?.(args, startedAt, error, timeout, request.launch);
|
|
231
|
-
if (error
|
|
246
|
+
if (!isRetryableCliProbeError(error) || index === cliProbeTimeouts(command, options).length - 1)
|
|
232
247
|
return failCliProbe(request.entry, error);
|
|
233
248
|
}
|
|
234
249
|
}
|
|
@@ -240,8 +255,15 @@ export async function probeCli(command, args, options = {}) {
|
|
|
240
255
|
return request.entry.output;
|
|
241
256
|
if (request.entry.error !== undefined)
|
|
242
257
|
throw request.entry.error;
|
|
243
|
-
if (request.entry.pending)
|
|
244
|
-
|
|
258
|
+
if (request.entry.pending) {
|
|
259
|
+
const output = await request.entry.pending;
|
|
260
|
+
try {
|
|
261
|
+
return validateCliProbeOutput(output, undefined, options);
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
return failCliProbe(request.entry, error);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
245
267
|
const run = async () => {
|
|
246
268
|
const timeouts = cliProbeTimeouts(command, options);
|
|
247
269
|
for (const [index, timeout] of timeouts.entries()) {
|
|
@@ -258,8 +280,14 @@ export async function probeCli(command, args, options = {}) {
|
|
|
258
280
|
Object.assign(error, { stdout, stderr, path: request.command, spawnargs: request.args });
|
|
259
281
|
reject(error);
|
|
260
282
|
}
|
|
261
|
-
else
|
|
262
|
-
|
|
283
|
+
else {
|
|
284
|
+
try {
|
|
285
|
+
resolve(validateCliProbeOutput(stdout, stderr, options));
|
|
286
|
+
}
|
|
287
|
+
catch (validationError) {
|
|
288
|
+
reject(validationError);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
263
291
|
});
|
|
264
292
|
child.stdin?.end();
|
|
265
293
|
});
|
|
@@ -267,7 +295,7 @@ export async function probeCli(command, args, options = {}) {
|
|
|
267
295
|
}
|
|
268
296
|
catch (error) {
|
|
269
297
|
options.onFailure?.(args, startedAt, error, timeout, request.launch);
|
|
270
|
-
if (error
|
|
298
|
+
if (!isRetryableCliProbeError(error) || index === timeouts.length - 1)
|
|
271
299
|
return failCliProbe(request.entry, error);
|
|
272
300
|
}
|
|
273
301
|
}
|
|
@@ -99,6 +99,7 @@ export var ErrorType;
|
|
|
99
99
|
ErrorType["STREAM_ERROR"] = "stream_error";
|
|
100
100
|
ErrorType["MAX_OUTPUT_TOKENS"] = "max_output_tokens";
|
|
101
101
|
ErrorType["CONTEXT_TOO_LONG"] = "context_too_long";
|
|
102
|
+
ErrorType["COMPACTION_FAILED"] = "compaction_failed";
|
|
102
103
|
ErrorType["MODEL_UNAVAILABLE"] = "model_unavailable";
|
|
103
104
|
ErrorType["SESSION_UNAVAILABLE"] = "session_unavailable";
|
|
104
105
|
ErrorType["SANDBOX_INITIALIZATION_FAILED"] = "sandbox_initialization_failed";
|
|
@@ -493,6 +494,9 @@ export function classifyError(error) {
|
|
|
493
494
|
if (error?.code === 'TOPIC_BACKEND_UNAVAILABLE') {
|
|
494
495
|
return ErrorType.SESSION_UNAVAILABLE;
|
|
495
496
|
}
|
|
497
|
+
if (msg.includes('summarization failed') || msg.includes('turn prefix summarization failed')) {
|
|
498
|
+
return ErrorType.COMPACTION_FAILED;
|
|
499
|
+
}
|
|
496
500
|
// Startup-size failures are deterministic local failures and must win over
|
|
497
501
|
// dictionary rules that would otherwise turn them into generic retries.
|
|
498
502
|
if (isClaudeStartupArgumentsTooLong(error)) {
|
|
@@ -559,6 +563,8 @@ export function isRetryableError(error) {
|
|
|
559
563
|
const lower = msg.toLowerCase();
|
|
560
564
|
if (lower.includes('invalid jsonl session file') || lower.includes('invalid session file'))
|
|
561
565
|
return false;
|
|
566
|
+
if (lower.includes('summarization failed') || lower.includes('turn prefix summarization failed'))
|
|
567
|
+
return false;
|
|
562
568
|
if (lower.includes('context_compact_failed') || isContextTooLongText(getErrorRawText(error)))
|
|
563
569
|
return false;
|
|
564
570
|
// The idle watchdog emits this exact terminal error when a runner stops
|
|
@@ -640,6 +646,8 @@ export function getErrorMessage(error, terminalReason, includeEmoji = true) {
|
|
|
640
646
|
return `${warnPrefix}API 限流中,请稍后重试`;
|
|
641
647
|
case 'context_compact_failed':
|
|
642
648
|
return `${warnPrefix}上下文过长,自动压缩失败,请手动输入 /compact 重试`;
|
|
649
|
+
case ErrorType.COMPACTION_FAILED:
|
|
650
|
+
return `${warnPrefix}会话压缩的摘要请求失败,已停止自动重试以避免重复压缩;检查模型网关后可重试`;
|
|
643
651
|
case 'model_error':
|
|
644
652
|
return `${prefix}模型服务异常,请稍后重试`;
|
|
645
653
|
case 'tool_error':
|
|
@@ -110,6 +110,37 @@ export function configureMacosAutostart(enabled, runtimeRoot) {
|
|
|
110
110
|
}
|
|
111
111
|
const file = plistPath();
|
|
112
112
|
if (!enabled) {
|
|
113
|
+
try {
|
|
114
|
+
const stat = fs.lstatSync(file);
|
|
115
|
+
if (!stat.isFile() || stat.isSymbolicLink()) {
|
|
116
|
+
return { ok: false, enabled: true, error: `登录自启配置不是普通文件,已保留: ${file}` };
|
|
117
|
+
}
|
|
118
|
+
const read = spawnSync('/usr/bin/plutil', ['-convert', 'json', '-o', '-', file], { encoding: 'utf8', timeout: 15_000 });
|
|
119
|
+
if (read.status !== 0) {
|
|
120
|
+
return { ok: false, enabled: true, error: commandError(read, '无法校验 macOS 登录自启归属,已保留配置') };
|
|
121
|
+
}
|
|
122
|
+
const plist = JSON.parse(read.stdout);
|
|
123
|
+
const args = plist.ProgramArguments;
|
|
124
|
+
if (plist.Label !== MACOS_AUTOSTART_LABEL
|
|
125
|
+
|| typeof plist.EnvironmentVariables?.EVOLCORE_HOME !== 'string'
|
|
126
|
+
|| path.resolve(plist.EnvironmentVariables.EVOLCORE_HOME) !== path.resolve(runtimeRoot)
|
|
127
|
+
|| !Array.isArray(args) || args.length !== 4
|
|
128
|
+
|| args[1] !== '--no-warnings=ExperimentalWarning'
|
|
129
|
+
|| typeof args[2] !== 'string'
|
|
130
|
+
|| path.resolve(args[2]) !== path.join(getPackageRoot(), 'dist', 'cli', 'index.js')
|
|
131
|
+
|| args[3] !== 'start') {
|
|
132
|
+
return { ok: true, enabled: false, warning: `同名 LaunchAgent 不属于当前 EvolCore 安装或运行目录,已保留: ${file}` };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
if (error?.code === 'ENOENT') {
|
|
137
|
+
if (macosAutostartInstalled()) {
|
|
138
|
+
return { ok: false, enabled: true, error: 'LaunchAgent 正在运行但 plist 缺失,无法核验归属,已保留。' };
|
|
139
|
+
}
|
|
140
|
+
return { ok: true, enabled: false };
|
|
141
|
+
}
|
|
142
|
+
return { ok: false, enabled: true, error: `校验 macOS 登录自启归属失败,已保留配置: ${error instanceof Error ? error.message : String(error)}` };
|
|
143
|
+
}
|
|
113
144
|
const result = launchctl(['bootout', `${domain}/${MACOS_AUTOSTART_LABEL}`]);
|
|
114
145
|
if (result.status !== 0 && macosAutostartInstalled()) {
|
|
115
146
|
return {
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
+
{"model":"claude-opus-5-5","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":4,"price_output":20,"price_cache_creation":5,"price_cache_read":0.2,"context_window":1000000,"max_input_tokens":900000,"max_output_tokens":131072,"supports_cache":true,"supports_vision":true}
|
|
2
|
+
{"model":"claude-sonnet-5-5","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":2,"price_output":10,"price_cache_creation":2.5,"price_cache_read":0.1,"context_window":1000000,"max_input_tokens":900000,"max_output_tokens":131072,"supports_cache":true,"supports_vision":true}
|
|
3
|
+
{"model":"claude-haiku-5-5","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":0.1,"price_output":0.5,"price_cache_creation":0.125,"price_cache_read":0.01,"context_window":1000000,"max_input_tokens":900000,"max_output_tokens":131072,"supports_cache":true,"supports_vision":true}
|
|
4
|
+
{"model":"claude-fable-5-1","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":10,"price_output":50,"price_cache_creation":12.5,"price_cache_read":1,"context_window":1000000,"max_input_tokens":900000,"max_output_tokens":131072,"supports_cache":true,"supports_vision":true}
|
|
1
5
|
{"model":"claude-opus-4-8","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":15,"price_output":75,"price_cache_creation":18.75,"price_cache_read":1.5,"context_window":1000000,"max_input_tokens":900000,"max_output_tokens":32768,"supports_cache":true,"supports_vision":true}
|
|
2
6
|
{"model":"claude-opus-4-7","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":15,"price_output":75,"price_cache_creation":18.75,"price_cache_read":1.5,"context_window":1000000,"max_input_tokens":900000,"max_output_tokens":32768,"supports_cache":true,"supports_vision":true}
|
|
3
7
|
{"model":"claude-opus-4-6","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":15,"price_output":75,"price_cache_creation":18.75,"price_cache_read":1.5,"context_window":1000000,"max_input_tokens":900000,"max_output_tokens":32768,"supports_cache":true,"supports_vision":true}
|
|
4
8
|
{"model":"claude-sonnet-4-6","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":3,"price_output":15,"price_cache_creation":3.75,"price_cache_read":0.3,"context_window":200000,"max_input_tokens":180000,"max_output_tokens":16384,"supports_cache":true,"supports_vision":true}
|
|
5
9
|
{"model":"claude-haiku-4-5-20251001","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":0.8,"price_output":4,"price_cache_creation":1,"price_cache_read":0.08,"context_window":200000,"max_input_tokens":180000,"max_output_tokens":16384,"supports_cache":true,"supports_vision":false}
|
|
6
|
-
{"model":"gpt-
|
|
7
|
-
{"model":"gpt-
|
|
8
|
-
{"model":"gpt-
|
|
9
|
-
{"model":"gpt-5.
|
|
10
|
-
{"model":"gpt-5.
|
|
11
|
-
{"model":"
|
|
12
|
-
{"model":"
|
|
13
|
-
{"model":"
|
|
10
|
+
{"model":"gpt-6.1-sol","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":2,"price_output":10,"price_cache_creation":0,"price_cache_read":0.1,"context_window":1050000,"max_input_tokens":1000000,"max_output_tokens":32768,"supports_cache":true}
|
|
11
|
+
{"model":"gpt-6.1-terra","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":1,"price_output":5,"price_cache_creation":0,"price_cache_read":0.05,"context_window":1050000,"max_input_tokens":1000000,"max_output_tokens":32768,"supports_cache":true}
|
|
12
|
+
{"model":"gpt-6-astra","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":10,"price_output":50,"price_cache_creation":12.5,"price_cache_read":1,"context_window":1050000,"max_input_tokens":1000000,"max_output_tokens":32768,"supports_cache":true}
|
|
13
|
+
{"model":"gpt-5.6-sol","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":4,"price_output":20,"price_cache_creation":5,"price_cache_read":0.4,"context_window":200000,"max_input_tokens":180000,"max_output_tokens":16384,"supports_cache":true}
|
|
14
|
+
{"model":"gpt-5.6-cyber","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":12.5,"price_output":75,"price_cache_creation":15.625,"price_cache_read":1.25,"context_window":200000,"max_input_tokens":180000,"max_output_tokens":16384,"supports_cache":true}
|
|
15
|
+
{"model":"chat-latest","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":5,"price_output":30,"price_cache_creation":0,"price_cache_read":0.5,"context_window":200000,"max_input_tokens":180000,"max_output_tokens":16384,"supports_cache":true}
|
|
16
|
+
{"model":"gpt-5.3-codex","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":1.75,"price_output":14,"price_cache_creation":0,"price_cache_read":0.175,"context_window":200000,"max_input_tokens":180000,"max_output_tokens":16384,"supports_cache":true}
|
|
17
|
+
{"model":"gpt-rosalind-research","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":5,"price_output":25,"price_cache_creation":0,"price_cache_read":0.5,"context_window":128000,"max_input_tokens":120000,"max_output_tokens":8192,"supports_cache":true}
|
|
18
|
+
{"model":"gpt-rosalind-discovery","effective_from":0,"billing_fn":"per_token_v1","currency":"USD","price_input":5,"price_output":25,"price_cache_creation":0,"price_cache_read":0.5,"context_window":128000,"max_input_tokens":120000,"max_output_tokens":8192,"supports_cache":true}
|
|
19
|
+
{"model":"deepseek-v4-pro","effective_from":0,"billing_fn":"per_token_deepseek_v1","currency":"CNY","price_cache_hit":0.022,"price_cache_miss":0.66,"price_output":1.98,"context_window":1000000,"max_input_tokens":950000,"max_output_tokens":8192,"supports_cache":true,"notes":"off-peak rates, peak 2x"}
|
|
20
|
+
{"model":"deepseek-v4.1-flash","effective_from":0,"billing_fn":"per_token_deepseek_v1","currency":"CNY","price_cache_hit":0.015,"price_cache_miss":0.15,"price_output":0.6,"context_window":1000000,"max_input_tokens":950000,"max_output_tokens":8192,"supports_cache":true,"notes":"off-peak rates, peak 2x"}
|
|
14
21
|
{"model":"deepseek-v3.2","effective_from":0,"billing_fn":"per_token_deepseek_v1","currency":"CNY","price_cache_hit":0.5,"price_cache_miss":2,"price_output":8,"context_window":128000,"max_input_tokens":120000,"max_output_tokens":8192,"supports_cache":true}
|
|
15
22
|
{"model":"kimi-k2.6","effective_from":0,"billing_fn":"per_token_v1","currency":"CNY","price_input":2,"price_output":8,"price_cache_creation":0,"price_cache_read":0,"context_window":128000,"max_input_tokens":120000,"max_output_tokens":8192}
|
|
16
23
|
{"model":"kimi-k2.5","effective_from":0,"billing_fn":"per_token_v1","currency":"CNY","price_input":2,"price_output":8,"price_cache_creation":0,"price_cache_read":0,"context_window":128000,"max_input_tokens":120000,"max_output_tokens":8192}
|
|
@@ -43,6 +43,15 @@ function approximateSelfStartTime() {
|
|
|
43
43
|
const uptimeMs = Math.round(process.uptime() * 1000);
|
|
44
44
|
return uptimeMs > 0 ? Date.now() - uptimeMs : Date.now();
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* 身份校验路径上同一个 PID 会被连着查两三次(`sameProcess()` 在优雅停止前后各查一次,
|
|
48
|
+
* 端口候选还要再查一次),Windows 上每次都是一整个 PowerShell 进程(约 0.5–1s)。
|
|
49
|
+
* 启动时间对同一个 PID 是常量,缓存复用没有语义风险;PID 复用要落到同一个缓存槽里
|
|
50
|
+
* 需要在一个 TTL 内退出并复刻出同一个 PID,实际不可能,且 `startTimeMatches` 本身
|
|
51
|
+
* 有 2s 容差。TTL 取短一些,避免让「进程已换人」的判断比容差更迟钝。
|
|
52
|
+
*/
|
|
53
|
+
const START_TIME_CACHE_TTL_MS = 5000;
|
|
54
|
+
const startTimeCache = new Map();
|
|
46
55
|
/**
|
|
47
56
|
* 获取进程启动时间(Unix 毫秒)。
|
|
48
57
|
* 拿不到时返回 null,调用方应保守处理(不杀该 PID)。
|
|
@@ -54,11 +63,22 @@ export function getProcessStartTime(pid) {
|
|
|
54
63
|
selfStartTime = approximateSelfStartTime();
|
|
55
64
|
return selfStartTime;
|
|
56
65
|
}
|
|
57
|
-
|
|
66
|
+
const cached = startTimeCache.get(pid);
|
|
67
|
+
const now = Date.now();
|
|
68
|
+
if (cached && now - cached.at < START_TIME_CACHE_TTL_MS)
|
|
69
|
+
return cached.startedAt;
|
|
70
|
+
const startedAt = readProcessStartTime(pid);
|
|
71
|
+
// 只缓存成功结果:查不到往往是权限或瞬时失败,缓存成 null 会掩盖后续可查到的情形。
|
|
72
|
+
if (startedAt === null)
|
|
73
|
+
startTimeCache.delete(pid);
|
|
74
|
+
else
|
|
75
|
+
startTimeCache.set(pid, { at: now, startedAt });
|
|
76
|
+
return startedAt;
|
|
58
77
|
}
|
|
59
78
|
/** 测试用:清掉自身启动时间缓存。 */
|
|
60
79
|
export function resetSelfStartTimeCache() {
|
|
61
80
|
selfStartTime = null;
|
|
81
|
+
startTimeCache.clear();
|
|
62
82
|
}
|
|
63
83
|
function readProcessStartTime(pid) {
|
|
64
84
|
try {
|