evolcore 0.0.43-test.8 → 0.0.46
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 +75 -0
- package/bin/ecmsg.js +33 -23
- package/dist/ability/application-service.js +1 -2
- package/dist/ability/package.js +28 -0
- package/dist/agent-template/jobs.js +158 -36
- package/dist/agent-template/runtime.js +401 -34
- package/dist/agent-template/service.js +764 -369
- package/dist/agent-template/tool-runner.js +35 -17
- package/dist/agent-template/types.js +7 -4
- package/dist/agents/baseagent.js +10 -9
- package/dist/agents/claude-runner.js +13 -5
- package/dist/agents/codex/app-server-client.js +2 -4
- package/dist/agents/codex/diagnostics.js +18 -1
- package/dist/agents/codex-runner.js +3 -1
- package/dist/agents/ecagent-runner.js +3 -1
- package/dist/agents/gemini-runner.js +2 -1
- package/dist/aun/menu/client.js +142 -182
- package/dist/aun/rpc/client.js +33 -17
- package/dist/aun/service-proxy.js +6 -23
- package/dist/channels/aun.js +656 -112
- package/dist/cli/agent-create.js +37 -10
- package/dist/cli/agent-template.js +105 -84
- package/dist/cli/agent.js +31 -18
- package/dist/cli/daemon-commands.js +15 -17
- package/dist/cli/daemon-lifecycle-client.js +40 -18
- package/dist/cli/directory.js +12 -4
- package/dist/cli/ecmsg-gateway.js +5 -2
- package/dist/cli/events-command.js +2 -1
- package/dist/cli/init.js +50 -20
- package/dist/cli/integrity-command.js +2 -0
- package/dist/cli/managed-command-guard.js +20 -1
- package/dist/cli/menu-client.js +7 -5
- package/dist/cli/restart-monitor.js +33 -20
- package/dist/cli/services-command.js +28 -5
- package/dist/config/config-field-policy.js +24 -0
- package/dist/config/config-manager.js +20 -2
- package/dist/config/peer-book-store.js +152 -120
- package/dist/config/peer-role-resolver.js +24 -4
- package/dist/config/provider-identity-migration.js +1 -1
- package/dist/config/provider-identity.js +10 -4
- package/dist/config/provider-ipc-service.js +10 -2
- package/dist/config/provider-local-sync.js +2 -2
- package/dist/config/providers-config.js +95 -10
- package/dist/config/providers-import.js +4 -6
- package/dist/config/providers.js +14 -3
- package/dist/config/role-store.js +1 -1
- package/dist/config-store.js +9 -1
- package/dist/core/agent-application-service.js +56 -29
- package/dist/core/agent-create-status.js +3 -1
- package/dist/core/agent-creation-claim.js +1 -0
- package/dist/core/agent-ipc-registration.js +2 -2
- package/dist/core/agent-reload-coordinator.js +38 -1
- package/dist/core/agent-runtime.js +85 -38
- package/dist/core/auth/agent-delegation.js +5 -0
- package/dist/core/auth/operation-authorizer.js +1 -1
- package/dist/core/auth/operation-catalog.js +3 -3
- package/dist/core/bootstrap-service.js +3 -0
- package/dist/core/capability/capability-manager.js +3 -1
- package/dist/core/channel-loader.js +29 -3
- package/dist/core/channel-runtime.js +1 -1
- package/dist/core/command/agent-control.js +6 -5
- package/dist/core/command/agent-template-menu.js +32 -97
- package/dist/core/command/eventcenter-menu.js +61 -13
- package/dist/core/command/menu-catalog.js +11 -4
- package/dist/core/command/menu-handler.js +35 -8
- package/dist/core/command/menu-protocol.js +8 -16
- package/dist/core/command/skill-slash.js +6 -2
- package/dist/core/command/team-workspace-bootstrap.js +1 -2
- package/dist/core/command/team-workspace-management-store.js +83 -0
- package/dist/core/command/team-workspace-management.js +1 -2
- package/dist/core/command/team-workspace-team.js +26 -3
- package/dist/core/daemon-control.js +3 -4
- package/dist/core/daemon-lifecycle.js +146 -110
- package/dist/core/evolagent-registry.js +42 -0
- package/dist/core/evolagent.js +2 -1
- package/dist/core/file-integrity/read.js +9 -16
- package/dist/core/file-integrity/store.js +94 -34
- package/dist/core/handoff/dispatcher.js +33 -7
- package/dist/core/handoff/runtime.js +8 -0
- package/dist/core/inference/text-inference.js +12 -2
- package/dist/core/invoke/invoke-service.js +24 -3
- package/dist/core/ipc-registration.js +3 -0
- package/dist/core/message/aun-ipc-sender.js +109 -7
- package/dist/core/message/contact-admission.js +6 -2
- package/dist/core/message/message-bridge.js +13 -0
- package/dist/core/message/message-queue.js +131 -30
- package/dist/core/message/pending-hints.js +8 -0
- package/dist/core/message/response-engine.js +48 -2
- package/dist/core/message/send-routing.js +3 -12
- package/dist/core/model/catalog-service.js +13 -0
- package/dist/core/model/model-catalog.js +57 -18
- package/dist/core/pack-auth.js +163 -31
- package/dist/core/pack-install.js +42 -1
- package/dist/{services/ledger.js → core/pack-ledger.js} +17 -6
- package/dist/core/permission/ec-command-parser.js +3 -1
- package/dist/core/permission/shell-environment.js +23 -0
- package/dist/core/rate-window.js +6 -1
- package/dist/core/session/session-idle-monitor.js +0 -1
- package/dist/core/session/session-manager.js +14 -0
- package/dist/core/session/session-title.js +26 -6
- package/dist/core/skill/index-generator.js +3 -4
- package/dist/core/thread/thread-service.js +0 -1
- package/dist/core/thread/topic-id.js +8 -0
- package/dist/directory/owner-directory-admission.js +17 -0
- package/dist/directory/owner-directory-cache.js +3 -1
- package/dist/directory/owner-directory-markdown.js +145 -23
- package/dist/directory/owner-directory-policy.js +23 -0
- package/dist/directory/owner-directory-query-operation.js +20 -6
- package/dist/directory/owner-directory-search.js +47 -0
- package/dist/eck/message-renderer.js +171 -32
- package/dist/ecweb/basic-settings-service.js +7 -3
- package/dist/ecweb/providers-service.js +17 -10
- package/dist/ecweb/runtime/lifecycle.js +1 -1
- package/dist/ecweb/runtime/supervisor.js +77 -35
- package/dist/event-center/admission-materializer.js +1 -1
- package/dist/event-center/bus-gate.js +48 -4
- package/dist/event-center/bus-host.js +3 -3
- package/dist/event-center/center-config.js +57 -28
- package/dist/event-center/dispatcher.js +8 -0
- package/dist/event-center/event-log.js +69 -27
- package/dist/event-center/index-generator.js +6 -1
- package/dist/event-center/ipc-operation.js +66 -25
- package/dist/event-center/pack-loader.js +12 -55
- package/dist/event-center/pack-manager.js +5 -3
- package/dist/event-center/registry.js +48 -52
- package/dist/event-center/runtime.js +219 -81
- package/dist/event-center/script-runner.js +18 -7
- package/dist/event-center/types.js +9 -1
- package/dist/event-center/validation.js +33 -4
- package/dist/index.js +96 -42
- package/dist/ipc.js +33 -7
- package/dist/product.js +1 -0
- package/dist/proxy/manager.js +52 -11
- package/dist/proxy/service-supervisor.js +265 -67
- package/dist/services/dispatcher.js +26 -3
- package/dist/services/idempotency.js +128 -0
- package/dist/services/identity.js +3 -27
- package/dist/services/index-generator.js +5 -1
- package/dist/services/index.js +244 -45
- package/dist/services/ipc-operation.js +164 -20
- package/dist/services/pack-manager.js +37 -9
- package/dist/services/router.js +100 -31
- package/dist/services/script-runner.js +15 -4
- package/dist/services/service-payload.js +50 -2
- package/dist/services/validation.js +107 -3
- package/dist/trigger/scheduler.js +14 -4
- package/dist/trigger/script-sandbox.js +39 -2
- package/dist/utils/cross-platform.js +35 -11
- package/dist/utils/error-utils.js +13 -1
- package/dist/utils/instance-registry.js +33 -35
- package/dist/utils/process-introspect.js +35 -20
- package/dist/utils/project-path.js +47 -3
- package/dist/utils/windows-shell-trust.js +174 -68
- package/kits/docs/context-assembly.md +3 -3
- package/kits/docs/evolcore/agent.md +28 -10
- package/kits/docs/evolcore/config.md +22 -0
- package/kits/docs/evolcore/directory.md +46 -12
- package/kits/docs/evolcore/event-center.md +6 -6
- package/kits/docs/evolcore/group-collaboration.md +1 -1
- package/kits/docs/evolcore/menu-client.md +7 -5
- package/kits/docs/evolcore/menu-protocol.md +5 -3
- package/kits/docs/evolcore/msg.md +10 -3
- package/kits/docs/evolcore/provider.md +7 -3
- package/kits/docs/evolcore/services.md +145 -12
- package/kits/docs/evolcore/thread-chain.md +17 -9
- package/kits/docs/prompt-loading-architecture.md +4 -4
- package/kits/eck_message_manifest.json +46 -3
- package/kits/rules/04-relation.md +10 -2
- package/kits/rules/06-channel.md +2 -1
- package/kits/schemas/providers.schema.2.json +1 -0
- package/kits/skills/ec-group/SKILL.md +4 -0
- package/kits/skills/ec-skill/scripts/cli.mjs +1 -1
- package/kits/skills/ec-skill/scripts/skill.mjs +13 -2
- package/kits/skills/thread-ops/SKILL.md +8 -5
- package/kits/templates/message-fragments/group-batch-item.md +3 -0
- package/kits/templates/message-fragments/group-batch.md +1 -0
- package/kits/templates/message-fragments/item-group.md +4 -0
- package/kits/templates/message-fragments/item-private.md +4 -0
- package/kits/templates/message-fragments/thread-context.md +1 -1
- package/kits/templates/system-fragments/commands.md +5 -5
- package/kits/templates/system-fragments/managed-runtime.md +1 -1
- package/kits/templates/system-fragments/relation.md +11 -7
- package/package.json +3 -2
- package/scripts/agent-template/index.mjs +9 -4
- package/scripts/agent-template/inspect.mjs +16 -9
- package/scripts/agent-template/shared/plan.mjs +3 -33
- package/scripts/agent-template/shared/template-contract.mjs +186 -3
- package/scripts/agent-template/shared/template-package.mjs +119 -10
- package/scripts/agent-template/shared/template-runtime.mjs +49 -6
- package/scripts/agent-template/shared/template.mjs +5 -5
- package/scripts/agent-template/team-pack.mjs +245 -0
- package/scripts/agent-template/team-preview.mjs +111 -0
- package/scripts/aid-batch/identity-batch.mjs +143 -0
- package/dist/ability/versions.js +0 -32
- package/dist/aun/model-headers.js +0 -17
- package/dist/channels/builtin-plugins.js +0 -19
- package/dist/core/command/team-workspace-initializer.js +0 -2
- package/dist/core/command/team-workspace-job-store.js +0 -88
- package/dist/core/command/team-workspace-management-service.js +0 -2
- package/dist/core/contact-bind-registry.js +0 -27
- package/dist/event-center/ledger.js +0 -52
- package/dist/services/reply.js +0 -55
- package/kits/templates/message-fragments/item.md +0 -3
- package/scripts/agent-template/pack.mjs +0 -169
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { execFile } from 'node:child_process';
|
|
4
|
-
import { promisify } from 'node:util';
|
|
5
4
|
import { getPackageRoot } from '../paths.js';
|
|
6
5
|
import { templateError } from './types.js';
|
|
7
|
-
|
|
8
|
-
export async function runTemplateTool(command, options) {
|
|
6
|
+
export async function runTemplateTool(command, options, control = {}) {
|
|
9
7
|
const base = process.env.TMPDIR;
|
|
10
8
|
if (!base || !path.isAbsolute(base))
|
|
11
9
|
throw templateError('TEMP_UNAVAILABLE', 'Template tools require absolute TMPDIR');
|
|
@@ -14,19 +12,39 @@ export async function runTemplateTool(command, options) {
|
|
|
14
12
|
const input = path.join(temporary, 'input.json');
|
|
15
13
|
fs.writeFileSync(input, JSON.stringify({ ...options, packageRoot: getPackageRoot() }), { mode: 0o600 });
|
|
16
14
|
try {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
const stdout = await new Promise((resolve, reject) => {
|
|
16
|
+
if (control.signal?.aborted) {
|
|
17
|
+
reject(templateError('CONFLICT', 'Template job was cancelled'));
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const child = execFile(process.execPath, [path.join(getPackageRoot(), 'scripts', 'agent-template', 'index.mjs'),
|
|
21
|
+
command, '--options-file', input], { env: { ...process.env }, maxBuffer: 32 * 1024 * 1024,
|
|
22
|
+
timeout: 5 * 60_000, killSignal: 'SIGKILL' }, (error, output) => {
|
|
23
|
+
control.signal?.removeEventListener('abort', abort);
|
|
24
|
+
try {
|
|
25
|
+
control.onExit?.();
|
|
26
|
+
}
|
|
27
|
+
catch (exitError) {
|
|
28
|
+
reject(exitError);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (error && !output)
|
|
32
|
+
reject(templateError('TOOL_FAILED', 'Template tool stopped before returning a result'));
|
|
33
|
+
else
|
|
34
|
+
resolve(output);
|
|
35
|
+
});
|
|
36
|
+
const abort = () => { child.kill('SIGKILL'); };
|
|
37
|
+
control.signal?.addEventListener('abort', abort, { once: true });
|
|
38
|
+
try {
|
|
39
|
+
if (child.pid)
|
|
40
|
+
control.onSpawn?.({ pid: child.pid, input, generation: path.basename(temporary) });
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
child.kill('SIGKILL');
|
|
44
|
+
reject(error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const result = stdout.split(/\r?\n/).filter(Boolean).map(line => { try {
|
|
30
48
|
return JSON.parse(line);
|
|
31
49
|
}
|
|
32
50
|
catch {
|
|
@@ -36,7 +54,7 @@ export async function runTemplateTool(command, options) {
|
|
|
36
54
|
if (!result)
|
|
37
55
|
throw templateError('TOOL_FAILED', 'Template tool returned no structured result');
|
|
38
56
|
if (!result.ok)
|
|
39
|
-
throw templateError(result.code ?? 'TOOL_FAILED', result.message, result.data);
|
|
57
|
+
throw templateError(result.code ?? 'TOOL_FAILED', result.message, result.details ?? result.data);
|
|
40
58
|
return result.data;
|
|
41
59
|
}
|
|
42
60
|
finally {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export const TEMPLATE_ACTIONS = ['inspect', 'build', 'push', 'pull', 'deploy'
|
|
2
|
-
|
|
3
|
-
export function
|
|
4
|
-
return Object.
|
|
1
|
+
export const TEMPLATE_ACTIONS = ['inspect', 'build', 'push', 'pull', 'preview', 'deploy',
|
|
2
|
+
'status', 'resume', 'cancel', 'capabilities'];
|
|
3
|
+
export function templateJobAids(job) {
|
|
4
|
+
return Object.values(job.members).flatMap(member => member.aid ? [member.aid] : []);
|
|
5
|
+
}
|
|
6
|
+
export function templateError(code, message, details) {
|
|
7
|
+
return Object.assign(new Error(message), { code, ...(details === undefined ? {} : { details }) });
|
|
5
8
|
}
|
package/dist/agents/baseagent.js
CHANGED
|
@@ -17,7 +17,7 @@ import { buildCliLaunchCommand, commandExists, isWindows, resolvePowerShellShimP
|
|
|
17
17
|
import { execFileSync } from 'child_process';
|
|
18
18
|
import { parse as parseToml } from 'smol-toml';
|
|
19
19
|
import { readRuntimeEnvironmentVariable } from '../config/runtime-env.js';
|
|
20
|
-
import { resolveProviderServiceForBaseagent, resolveProviderService } from '../config/providers.js';
|
|
20
|
+
import { providerModelEnabled, resolveProviderServiceForBaseagent, resolveProviderService } from '../config/providers.js';
|
|
21
21
|
/** Resolve the installed Codex CLI entrypoint, including npm shims on Windows. */
|
|
22
22
|
export function resolveCodexCliPath() {
|
|
23
23
|
return resolveProbePath('codex');
|
|
@@ -232,18 +232,18 @@ export async function resolveRuntimeBaseagentModelSelection(baseagent, configure
|
|
|
232
232
|
const { getProviderCatalog, assertCatalogSelectable } = await import('../core/model/model-catalog.js');
|
|
233
233
|
const catalog = await getProviderCatalog(configured.provider, undefined, false, false, 'ecagent');
|
|
234
234
|
assertCatalogSelectable(catalog);
|
|
235
|
-
model = catalog.models.find(item => item.verification === 'listed' && /deepseek.*flash/iu.test(item.id))?.id;
|
|
235
|
+
model = catalog.models.find(item => (item.verification === 'listed' || catalog.source === 'manual') && /deepseek.*flash/iu.test(item.id))?.id;
|
|
236
236
|
}
|
|
237
237
|
else {
|
|
238
238
|
const connection = resolveOpenaiConfig({ agents: { codex: configured } }, configured);
|
|
239
|
+
const provider = connection.providerId ? resolveProviderServiceForBaseagent(connection.providerId, 'codex') : undefined;
|
|
239
240
|
const { codexNativeCatalog } = await import('./codex/catalog.js');
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
&& overrides[item.id]?.enabled !== false && item.supportsTools !== false)?.id;
|
|
241
|
+
const { getProviderCatalog } = await import('../core/model/model-catalog.js');
|
|
242
|
+
const models = provider?.modelPolicy === 'manual'
|
|
243
|
+
? (await getProviderCatalog(provider.providerId, 'codex')).models
|
|
244
|
+
: await codexNativeCatalog({ ...connection, scope: '<runtime-default>', baseagent: 'codex' }, { allowCliFallback: false });
|
|
245
|
+
model = models?.find(item => (item.verification === 'listed' || provider?.modelPolicy === 'manual') && /^gpt.*terra/iu.test(item.id)
|
|
246
|
+
&& providerModelEnabled(item.id, provider?.modelOverrides, provider?.modelPolicy) && item.supportsTools !== false)?.id;
|
|
247
247
|
}
|
|
248
248
|
if (!model)
|
|
249
249
|
throw defaultModelUnavailable(canonical);
|
|
@@ -675,6 +675,7 @@ export function resolveEcagentConfig(config, override) {
|
|
|
675
675
|
providerServiceType: provider.serviceType,
|
|
676
676
|
providerStyle: provider.style,
|
|
677
677
|
modelOverrides: provider.modelOverrides,
|
|
678
|
+
modelPolicy: provider.modelPolicy,
|
|
678
679
|
};
|
|
679
680
|
}
|
|
680
681
|
const isPlaceholder = (value) => !value
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getRunnerCatalog, peekRunnerCatalog, catalogEfforts, resolveCatalogModel, assertCatalogSelectable } from '../core/model/model-catalog.js';
|
|
1
|
+
import { assertRunnerModelAllowed, getRunnerCatalog, peekRunnerCatalog, catalogEfforts, resolveCatalogModel, assertCatalogSelectable } from '../core/model/model-catalog.js';
|
|
2
2
|
import { query, forkSession as sdkForkSession, getSessionMessages as sdkGetSessionMessages, resolveSettings as sdkResolveSettings, } from '@anthropic-ai/claude-agent-sdk';
|
|
3
3
|
import { spawn } from 'child_process';
|
|
4
4
|
import { createRequire } from 'module';
|
|
5
5
|
import { ensureDir } from '../utils/atomic-write.js';
|
|
6
6
|
import { resolveAnthropicConfig } from './baseagent.js';
|
|
7
|
-
import { resolveProviderService } from '../config/providers.js';
|
|
7
|
+
import { hasExplicitProviderModelPolicy, resolveProviderService } from '../config/providers.js';
|
|
8
8
|
import { buildModelRequestHeaders } from './request-identity.js';
|
|
9
9
|
import { DEFAULT_PERMISSION_MODE } from '../types.js';
|
|
10
10
|
import { renderActionAsText } from '../core/interaction-router.js';
|
|
@@ -16,6 +16,7 @@ import { assertOwnershipAuthorization } from '../core/ownership/owner-resolver.j
|
|
|
16
16
|
import os from 'os';
|
|
17
17
|
import crypto from 'crypto';
|
|
18
18
|
import { logger } from '../utils/logger.js';
|
|
19
|
+
import { resolveProjectDefaultPath } from '../utils/project-path.js';
|
|
19
20
|
import { createClaudeStartupArgumentsTooLongError, isClaudeStartupArgumentsTooLong, createClaudeCodeStartupError, isClaudeCodeStartupProcessError, } from '../utils/error-utils.js';
|
|
20
21
|
import { requestDangerousCommandPermission } from '../core/permission/approval-gateway.js';
|
|
21
22
|
import { checkBashDescription, checkDangerousCommand, checkReadonly, evaluateToolPreflight } from '../core/permission/tool-policy.js';
|
|
@@ -668,7 +669,7 @@ export class AgentRunner {
|
|
|
668
669
|
}
|
|
669
670
|
}
|
|
670
671
|
getRuntimeGatewayScope(projectPath) {
|
|
671
|
-
const configuredProjectPath = this.agentConfig?.projects?.defaultPath;
|
|
672
|
+
const configuredProjectPath = resolveProjectDefaultPath(this.agentConfig?.projects?.defaultPath);
|
|
672
673
|
return {
|
|
673
674
|
...(this.agentAid ? { agentAid: this.agentAid } : {}),
|
|
674
675
|
...(typeof projectPath === 'string' && projectPath.trim()
|
|
@@ -2093,7 +2094,9 @@ export class AgentRunner {
|
|
|
2093
2094
|
// 同步用户级配置到内存
|
|
2094
2095
|
this.syncFromUserSettings();
|
|
2095
2096
|
// Run preparation and model menus resolve aliases from the same snapshot.
|
|
2096
|
-
const runCatalog =
|
|
2097
|
+
const runCatalog = modelOverride?.provider && hasExplicitProviderModelPolicy(modelOverride.provider, 'claude')
|
|
2098
|
+
? await getRunnerCatalog('claude', undefined, { providerId: modelOverride.provider })
|
|
2099
|
+
: await this.getModelCatalog();
|
|
2097
2100
|
if (this.baseUrl) {
|
|
2098
2101
|
// 顺带预热网关价格缓存(1h TTL),让本轮结束写库时已就绪
|
|
2099
2102
|
void getSharedGatewayPricing(this.baseUrl, this.apiKey, this.customHeaders);
|
|
@@ -2759,6 +2762,7 @@ export class AgentRunner {
|
|
|
2759
2762
|
// 本次调用使用的模型/强度:优先 modelOverride(response-engine 取 Agent 级配置后传入),
|
|
2760
2763
|
// 缺省回落 agent 级 this.model。作为 per-call 入参传入,无共享状态,多对端并发互不污染。
|
|
2761
2764
|
const callModel = modelOverride?.model || this.model;
|
|
2765
|
+
await assertRunnerModelAllowed('claude', callModel, { providerId: modelOverride?.provider ?? this.catalogConnection().providerId });
|
|
2762
2766
|
const callEffort = (modelOverride?.effortMode === 'model_default'
|
|
2763
2767
|
? undefined
|
|
2764
2768
|
: modelOverride?.effort ?? this.effort);
|
|
@@ -3369,7 +3373,11 @@ export class AgentRunner {
|
|
|
3369
3373
|
const callEffort = (modelOverride?.effortMode === 'model_default'
|
|
3370
3374
|
? undefined
|
|
3371
3375
|
: modelOverride?.effort ?? (useModel ? this.effort : undefined));
|
|
3372
|
-
const catalog = useModel ?
|
|
3376
|
+
const catalog = useModel ? modelOverride?.provider && hasExplicitProviderModelPolicy(modelOverride.provider, 'claude')
|
|
3377
|
+
? await getRunnerCatalog('claude', undefined, { providerId: modelOverride.provider })
|
|
3378
|
+
: await this.getModelCatalog() : undefined;
|
|
3379
|
+
if (callModel)
|
|
3380
|
+
await assertRunnerModelAllowed('claude', callModel, { providerId: modelOverride?.provider ?? this.catalogConnection().providerId });
|
|
3373
3381
|
if (catalog)
|
|
3374
3382
|
assertCatalogSelectable(catalog);
|
|
3375
3383
|
const resolvedModel = catalog && callModel
|
|
@@ -10,6 +10,7 @@ import path from 'path';
|
|
|
10
10
|
import { ensureProcessManagedTempDir } from '../../cli/task-context.js';
|
|
11
11
|
import { getPackageRoot, resolvePaths } from '../../paths.js';
|
|
12
12
|
import { killProcess } from '../../utils/cross-platform.js';
|
|
13
|
+
import { isCurrentManagedHookLauncher } from './diagnostics.js';
|
|
13
14
|
import { registerCodexAppServerProcess, unregisterCodexAppServerProcess, } from './app-server-registry.js';
|
|
14
15
|
const BUILT_IN_CODEX_PROVIDER_IDS = new Set(['openai']);
|
|
15
16
|
export const CODEX_THREAD_ACTIVE_WRITER = 'THREAD_ACTIVE_WRITER';
|
|
@@ -726,10 +727,7 @@ export class CodexAppServerClient {
|
|
|
726
727
|
const currentHookLauncher = !!expectedHookPath && (() => {
|
|
727
728
|
try {
|
|
728
729
|
const source = fs.readFileSync(expectedHookPath, 'utf8');
|
|
729
|
-
|
|
730
|
-
return source.includes('EVOLCORE_MANAGED_HOOK_LAUNCHER')
|
|
731
|
-
&& (source.includes(expectedPackageRoot)
|
|
732
|
-
|| (process.platform === 'win32' && source.toLowerCase().includes(expectedPackageRoot.toLowerCase())));
|
|
730
|
+
return isCurrentManagedHookLauncher(source, getPackageRoot());
|
|
733
731
|
}
|
|
734
732
|
catch {
|
|
735
733
|
return false;
|
|
@@ -7,12 +7,20 @@ import { createRequire } from 'node:module';
|
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
import { parse as parseToml } from 'smol-toml';
|
|
9
9
|
import { TARGET_PACKAGE_ROOT_ENV } from '../../product.js';
|
|
10
|
+
import { resolveProjectDefaultPath } from '../../utils/project-path.js';
|
|
10
11
|
export function checkCodexProjectPath(value, options = {}) {
|
|
11
12
|
const configured = typeof value === 'string' ? value.trim() : '';
|
|
12
13
|
if (!configured) {
|
|
13
14
|
return { status: 'invalid', path: configured, warnings: [], reason: 'projects.defaultPath is not configured' };
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
let resolved;
|
|
17
|
+
try {
|
|
18
|
+
resolved = resolveProjectDefaultPath(configured, options);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return { status: 'invalid', path: configured, warnings: [], reason: error.message };
|
|
22
|
+
}
|
|
23
|
+
const projectPath = path.resolve(resolved);
|
|
16
24
|
const warnings = [];
|
|
17
25
|
if ((options.platform ?? process.platform) === 'win32') {
|
|
18
26
|
if (projectPath.length >= 240) {
|
|
@@ -241,6 +249,15 @@ function runtimeFileMayExist(file) {
|
|
|
241
249
|
return !['ENOENT', 'ENOTDIR'].includes(error?.code || '');
|
|
242
250
|
}
|
|
243
251
|
}
|
|
252
|
+
/** Verify the canonical launcher and share startup's npm-link path comparison. */
|
|
253
|
+
export function isCurrentManagedHookLauncher(launcher, packageRoot) {
|
|
254
|
+
const installer = fileURLToPath(new URL('../../../bin/install-codex-managed-hooks.mjs', import.meta.url));
|
|
255
|
+
const managedHookInstaller = createRequire(import.meta.url)(installer);
|
|
256
|
+
const embeddedPackageRoot = managedHookInstaller.launcherPackageRoot(launcher);
|
|
257
|
+
return !!embeddedPackageRoot && path.isAbsolute(embeddedPackageRoot)
|
|
258
|
+
&& launcher.replaceAll('\r\n', '\n') === managedHookInstaller.managedHookLauncher(embeddedPackageRoot)
|
|
259
|
+
&& samePackageRoot(embeddedPackageRoot, packageRoot);
|
|
260
|
+
}
|
|
244
261
|
/** Read-only inspection of the machine-wide Windows Codex managed hook. */
|
|
245
262
|
export function inspectCodexManagedHook(options = {}) {
|
|
246
263
|
const paths = codexManagedHookPaths(options);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRunnerCatalog, catalogEfforts, assertCatalogSelectable } from '../core/model/model-catalog.js';
|
|
1
|
+
import { assertRunnerModelAllowed, getRunnerCatalog, catalogEfforts, assertCatalogSelectable } from '../core/model/model-catalog.js';
|
|
2
2
|
// Codex/OpenAI API 不认识 Claude Code SDK 的窗口后缀,必须传入基础模型 ID。
|
|
3
3
|
import { parseModelId, stripContextWindowSuffix } from '../core/model/context-window-suffix.js';
|
|
4
4
|
import { formatAsyncQuestionAnswer, hasTrustedFullAccessContext, parseAsyncUserQuestions, unsettledInterruptError, withInterruptDeadline } from './runner-types.js';
|
|
@@ -2295,6 +2295,7 @@ export class CodexRunner {
|
|
|
2295
2295
|
await this.assertInterruptSettled(sessionId, agentSessionId);
|
|
2296
2296
|
let resumingThread = !!agentSessionId;
|
|
2297
2297
|
const modelContextId = modelOverride?.model || this.modelContextId;
|
|
2298
|
+
await assertRunnerModelAllowed('codex', modelContextId, this.currentProviderConfig(modelOverride?.provider));
|
|
2298
2299
|
const callModel = stripContextWindowSuffix(modelContextId);
|
|
2299
2300
|
const callEffort = modelOverride?.effortMode === 'model_default'
|
|
2300
2301
|
? undefined
|
|
@@ -3063,6 +3064,7 @@ export class CodexRunner {
|
|
|
3063
3064
|
const release = await this.acquireThreadOperation(this.threadOperationKey(agentSessionId, _sessionId), 'compact');
|
|
3064
3065
|
let compactAppServer;
|
|
3065
3066
|
try {
|
|
3067
|
+
await assertRunnerModelAllowed('codex', modelOverride?.model || this.modelContextId, this.currentProviderConfig(modelOverride?.provider));
|
|
3066
3068
|
const compactMode = normalizeExecutionPermissionMode(modelOverride?.permissionMode ?? this.chatModes.get(_sessionId) ?? this.currentMode);
|
|
3067
3069
|
const appServer = this.getAppServerClient(compactMode === 'fullaccess', modelOverride?.provider);
|
|
3068
3070
|
compactAppServer = appServer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRunnerCatalog, catalogEfforts, assertCatalogSelectable, resolveCatalogModel, } from '../core/model/model-catalog.js';
|
|
1
|
+
import { assertRunnerModelAllowed, getRunnerCatalog, catalogEfforts, assertCatalogSelectable, resolveCatalogModel, } from '../core/model/model-catalog.js';
|
|
2
2
|
// Ecagent/OpenAI API 不认识 Claude Code SDK 的窗口后缀,必须传入基础模型 ID。
|
|
3
3
|
import { stripContextWindowSuffix } from '../core/model/context-window-suffix.js';
|
|
4
4
|
import fs from 'fs';
|
|
@@ -876,6 +876,7 @@ export class EcagentRunner {
|
|
|
876
876
|
providerServiceType: provider.serviceType,
|
|
877
877
|
providerStyle: provider.style,
|
|
878
878
|
modelOverrides: provider.modelOverrides,
|
|
879
|
+
modelPolicy: provider.modelPolicy,
|
|
879
880
|
};
|
|
880
881
|
}
|
|
881
882
|
listModes() {
|
|
@@ -890,6 +891,7 @@ export class EcagentRunner {
|
|
|
890
891
|
return getRunnerCatalog('ecagent', this.agentAid, this.currentProviderConfig());
|
|
891
892
|
}
|
|
892
893
|
async resolveRunModel(modelId, connection) {
|
|
894
|
+
await assertRunnerModelAllowed('ecagent', modelId, connection);
|
|
893
895
|
const catalog = await getRunnerCatalog('ecagent', undefined, connection);
|
|
894
896
|
assertCatalogSelectable(catalog);
|
|
895
897
|
const canonicalModel = resolveCatalogModel(catalog, modelId);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRunnerCatalog, assertCatalogSelectable } from '../core/model/model-catalog.js';
|
|
1
|
+
import { assertRunnerModelAllowed, getRunnerCatalog, assertCatalogSelectable } from '../core/model/model-catalog.js';
|
|
2
2
|
// Gemini API 不认识 Claude Code SDK 的窗口后缀,必须传入基础模型 ID。
|
|
3
3
|
import { stripContextWindowSuffix } from '../core/model/context-window-suffix.js';
|
|
4
4
|
/**
|
|
@@ -449,6 +449,7 @@ export class GeminiRunner {
|
|
|
449
449
|
: undefined;
|
|
450
450
|
const permissionProfile = resolveGeminiPermissionProfile(requestedPermissionMode, !!bootstrapAgentMdPath);
|
|
451
451
|
const callModel = modelOverride?.model || this.model;
|
|
452
|
+
await assertRunnerModelAllowed('gemini', callModel, resolved);
|
|
452
453
|
const managedTaskTmpDir = getManagedTaskTempDir(runtimeEnv);
|
|
453
454
|
const runtimeDir = managedTaskTmpDir ?? runtimeEnv?.EVOLCORE_SESSION_RUNTIME_DIR;
|
|
454
455
|
const managedTmpDir = runtimeDir ?? process.env.TMPDIR;
|