evolcore 0.0.47 → 0.0.49
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 +90 -1
- package/bin/ec-build.mjs +86 -0
- package/dist/agent-template/jobs.js +12 -4
- package/dist/agent-template/runtime.js +143 -40
- package/dist/agent-template/service.js +66 -13
- package/dist/agents/baseagent.js +60 -20
- package/dist/agents/claude-runner.js +34 -17
- package/dist/agents/codex-runner.js +36 -17
- package/dist/agents/ecagent-runner.js +7 -4
- package/dist/agents/gemini-runner.js +5 -2
- package/dist/agents/runner-types.js +5 -21
- package/dist/aun/aid/agentmd.js +5 -1
- package/dist/aun/msg/p2p.js +2 -1
- package/dist/aun/service-proxy.js +4 -2
- package/dist/build-identity.json +1 -0
- package/dist/channels/aun.js +722 -295
- package/dist/channels/daemon.js +9 -25
- package/dist/cli/aun-commands.js +86 -51
- package/dist/cli/code-stats.js +19 -8
- package/dist/cli/command-log.js +1 -1
- package/dist/cli/daemon-commands.js +44 -43
- package/dist/cli/directory.js +13 -2
- package/dist/cli/ecmsg-gateway.js +5 -2
- package/dist/cli/index.js +9 -9
- package/dist/cli/init-channel.js +4 -6
- package/dist/cli/init.js +72 -50
- package/dist/cli/invoke-command.js +1 -1
- package/dist/cli/managed-command-guard.js +2 -0
- package/dist/cli/model.js +20 -5
- package/dist/cli/provider-command.js +74 -13
- package/dist/cli/quota.js +89 -0
- package/dist/cli/role.js +62 -17
- package/dist/cli/services-command.js +1 -0
- package/dist/cli/stats.js +3 -3
- package/dist/cli/team-workspace-command.js +56 -2
- package/dist/cli/thread-command.js +16 -51
- package/dist/config/boot-log.js +3 -9
- package/dist/config/builtin-roles.js +5 -7
- package/dist/config/config-field-policy.js +71 -1
- package/dist/config/config-manager.js +13 -7
- package/dist/config/daemon-services.js +30 -3
- package/dist/config/gateway-config.js +2 -2
- package/dist/config/invoke-ipc-service.js +6 -4
- package/dist/config/peer-bind-code.js +3 -4
- package/dist/config/peer-book-store.js +62 -229
- package/dist/config/peer-book.js +26 -27
- package/dist/config/peer-role-resolver.js +16 -1
- package/dist/config/provider-identity-migration.js +4 -1
- package/dist/config/provider-ipc-service.js +56 -11
- package/dist/config/provider-menu-request.js +24 -5
- package/dist/config/provider-templates.js +127 -0
- package/dist/config/providers-config.js +67 -12
- package/dist/config/providers-management.js +477 -51
- package/dist/config/resolved-config-op.js +3 -2
- package/dist/config/role-command-service.js +248 -1
- package/dist/config/schema-migration.js +105 -4
- package/dist/core/agent-application-service.js +6 -1
- package/dist/core/agent-runtime.js +4 -0
- package/dist/core/auth/agent-delegation.js +2 -1
- package/dist/core/auth/auth-gateway.js +2 -1
- package/dist/core/auth/delegation-authorization.js +36 -26
- package/dist/core/auth/operation-authorizer.js +25 -0
- package/dist/core/auth/operation-catalog.js +37 -64
- package/dist/core/capability/providers/codex-capability-provider.js +7 -8
- package/dist/core/channel-loader.js +18 -0
- package/dist/core/command/agent-control.js +32 -0
- package/dist/core/command/cli-intent-parser.js +13 -0
- package/dist/core/command/command-handler.js +126 -87
- package/dist/core/command/menu-catalog.js +1 -0
- package/dist/core/command/menu-handler.js +67 -150
- package/dist/core/command/menu-protocol.js +31 -1
- package/dist/core/command/provider-menu.js +13 -3
- package/dist/core/command/remote-shell.js +565 -0
- package/dist/core/command/role-menu.js +47 -23
- package/dist/core/command/slash-handler.js +26 -43
- package/dist/core/command/team-workspace-items.js +81 -12
- package/dist/core/command/team-workspace-team.js +9 -71
- package/dist/core/command/topic-slash.js +9 -30
- package/dist/core/daemon-bootstrap.js +8 -1
- package/dist/core/daemon-control.js +64 -8
- package/dist/core/daemon-lifecycle.js +16 -2
- package/dist/core/evolagent-registry.js +20 -3
- package/dist/core/file-integrity/store.js +2 -0
- package/dist/core/handoff/runtime.js +37 -1
- package/dist/core/inference/text-inference.js +3 -1
- package/dist/core/initialization/service.js +11 -6
- package/dist/core/interaction-router.js +3 -0
- package/dist/core/invoke/executors/text.js +72 -19
- package/dist/core/ipc-registration.js +3 -1
- package/dist/core/message/aun-ipc-sender.js +279 -107
- package/dist/core/message/contact-admission.js +91 -6
- package/dist/core/message/contact-pending-inbound.js +113 -0
- package/dist/core/message/contact-thread-approval.js +212 -0
- package/dist/core/message/im-renderer.js +41 -2
- package/dist/core/message/message-admission.js +5 -39
- package/dist/core/message/message-bridge.js +140 -370
- package/dist/core/message/message-log.js +29 -0
- package/dist/core/message/message-queue.js +119 -15
- package/dist/core/message/message-utils.js +8 -0
- package/dist/core/message/response-engine.js +580 -134
- package/dist/core/message/send-routing.js +5 -1
- package/dist/core/model/catalog-service.js +31 -11
- package/dist/core/model/config-scope.js +6 -14
- package/dist/core/model/model-capabilities.js +22 -4
- package/dist/core/model/model-catalog.js +1 -0
- package/dist/core/model/model-diagnostics.js +19 -0
- package/dist/core/model/model-fallback.js +13 -2
- package/dist/core/ownership/owner-resolver.js +328 -50
- package/dist/core/pack-auth.js +3 -0
- package/dist/core/pack-install.js +1 -1
- package/dist/core/permission/ec-command-parser.js +106 -19
- package/dist/core/permission/protected-paths.js +6 -6
- package/dist/core/permission/services-path-acl.js +451 -0
- package/dist/core/permission/tool-policy.js +5 -1
- package/dist/core/relation/peer-identity.js +36 -1
- package/dist/core/relation/same-owner-proof.js +81 -112
- package/dist/core/session/adapters/codex-session-file-adapter.js +96 -15
- package/dist/core/session/session-file-health.js +13 -7
- package/dist/core/session/session-fs-store.js +91 -35
- package/dist/core/session/session-manager.js +68 -24
- package/dist/core/session/session-mapper.js +14 -34
- package/dist/core/session/session-transcript.js +5 -1
- package/dist/core/task/task-activity-store.js +84 -0
- package/dist/core/task/task-recovery-service.js +13 -0
- package/dist/core/thread/command-parser.js +7 -12
- package/dist/core/thread/thread-context-storage.js +3 -2
- package/dist/core/thread/thread-operation.js +2 -13
- package/dist/core/thread/thread-service.js +15 -46
- package/dist/core/thread/topic-id.js +15 -0
- package/dist/directory/owner-directory-admission.js +12 -9
- package/dist/directory/owner-directory-cache.js +64 -28
- package/dist/directory/owner-directory-markdown.js +14 -2
- package/dist/directory/owner-directory-policy.js +5 -30
- package/dist/directory/owner-directory-query-operation.js +29 -3
- package/dist/directory/owner-directory-remarks.js +11 -3
- package/dist/directory/owner-directory-request-operation.js +5 -2
- package/dist/eck/kit-renderer.js +1 -1
- package/dist/eck/message-renderer.js +112 -29
- package/dist/ecweb/basic-settings-service.js +3 -1
- package/dist/ecweb/message-context-service.js +1 -1
- package/dist/ecweb/pairing.js +4 -3
- package/dist/ecweb/providers-service.js +26 -1
- package/dist/ecweb/runtime/lifecycle.js +18 -8
- package/dist/ecweb/runtime/proxy-access.js +74 -0
- package/dist/ecweb/runtime/supervisor.js +36 -6
- package/dist/event-center/center-config.js +9 -5
- package/dist/event-center/dispatcher.js +10 -1
- package/dist/event-center/ipc-operation.js +19 -0
- package/dist/event-center/registry.js +29 -3
- package/dist/event-center/runtime.js +106 -11
- package/dist/event-center/script-runner.js +5 -5
- package/dist/index.js +96 -59
- package/dist/ipc.js +38 -3
- package/dist/outputs/authorization.js +16 -0
- package/dist/outputs/cards.js +336 -0
- package/dist/outputs/events.js +63 -0
- package/dist/outputs/protocol.js +103 -0
- package/dist/outputs/service.js +266 -0
- package/dist/paths.js +3 -0
- package/dist/proxy/manager.js +43 -13
- package/dist/services/index.js +114 -5
- package/dist/services/ipc-operation.js +88 -15
- package/dist/services/pack-manager.js +13 -1
- package/dist/services/router.js +21 -6
- package/dist/services/script-runner.js +5 -4
- package/dist/services/service-payload.js +13 -7
- package/dist/services/validation.js +1 -1
- package/dist/stats/budget.js +2 -2
- package/dist/stats/db.js +19 -0
- package/dist/stats/index.js +1 -1
- package/dist/stats/{price-resolver.js → model-resolver.js} +304 -23
- package/dist/stats/normalizer.js +2 -0
- package/dist/stats/query.js +35 -27
- package/dist/stats/quota-query.js +95 -0
- package/dist/stats/role-budget.js +5 -2
- package/dist/stats/writer.js +10 -6
- package/dist/trigger/audit.js +7 -0
- package/dist/trigger/authorization.js +105 -11
- package/dist/trigger/feedback.js +10 -0
- package/dist/trigger/history.js +37 -11
- package/dist/trigger/ipc-service.js +12 -1
- package/dist/trigger/manager.js +1 -0
- package/dist/trigger/scheduler.js +7 -5
- package/dist/trigger/script-executor.js +2 -1
- package/dist/trigger/script-sandbox.js +21 -3
- package/dist/trigger/validation.js +22 -0
- package/dist/utils/atomic-write.js +22 -8
- package/dist/utils/cross-platform.js +73 -26
- package/dist/utils/error-dict.json +94 -4
- package/dist/utils/error-utils.js +27 -4
- package/dist/utils/evolcore-version.js +36 -65
- package/dist/utils/host-info.js +100 -1
- package/dist/utils/msg-diag.js +1 -0
- package/dist/utils/npm-ops.js +43 -8
- package/dist/utils/process-introspect.js +12 -7
- package/dist/utils/process-tree.js +50 -2
- package/dist/utils/windows-shell-trust.js +2 -0
- package/dist/workbench/protocol.js +80 -0
- package/dist/workbench/service.js +359 -0
- package/ecagent/dist/types.d.ts +6 -2
- package/kits/docs/context-assembly.md +1 -1
- package/kits/docs/evolcore/INDEX.md +4 -2
- package/kits/docs/evolcore/aid.md +25 -0
- package/kits/docs/evolcore/config.md +16 -1
- package/kits/docs/evolcore/directory.md +30 -12
- package/kits/docs/evolcore/ecweb-lifecycle.md +15 -0
- package/kits/docs/evolcore/model.md +10 -0
- package/kits/docs/evolcore/msg.md +9 -0
- package/kits/docs/evolcore/peer.md +19 -65
- package/kits/docs/evolcore/provider.md +124 -4
- package/kits/docs/evolcore/quota.md +54 -0
- package/kits/docs/evolcore/role.md +83 -0
- package/kits/docs/evolcore/services.md +6 -6
- package/kits/docs/evolcore/stats.md +2 -0
- package/kits/docs/evolcore/team-workspace.md +1 -1
- package/kits/docs/evolcore/thread-chain.md +14 -15
- package/kits/docs/evolcore/tool-authorization.md +5 -0
- package/kits/docs/evolcore/trigger.md +12 -0
- package/kits/eck_message_manifest.json +12 -0
- package/kits/provider-templates.json +1213 -0
- package/kits/rules/04-relation.md +3 -3
- package/kits/schemas/_meta.json +14 -2
- package/kits/schemas/agent-config.schema.20.json +24 -0
- package/kits/schemas/contact-book.schema.4.json +52 -0
- package/kits/schemas/providers.schema.3.json +200 -0
- package/kits/skills/.switches.json +8 -0
- package/kits/skills/ability/references/calling.md +1 -1
- package/kits/skills/agent-output-cards/SKILL.md +57 -0
- package/kits/skills/ec-group/SKILL.md +2 -2
- package/kits/skills/ec-identity/SKILL.md +19 -72
- package/kits/skills/ec-provider/SKILL.md +270 -0
- package/kits/skills/ec-provider/scripts/check-model.mjs +80 -0
- package/kits/skills/ec-trigger/SKILL.md +1 -1
- package/kits/skills/thread-ops/SKILL.md +34 -21
- package/kits/templates/message-fragments/group-batch-item.md +1 -1
- package/kits/templates/message-fragments/group-batch.md +1 -1
- package/kits/templates/message-fragments/inject-default.md +1 -1
- package/kits/templates/message-fragments/interrupt-insert.md +1 -0
- package/kits/templates/message-fragments/item-group.md +1 -1
- package/kits/templates/message-fragments/item-private.md +1 -1
- package/kits/templates/message-fragments/thread-context.md +1 -1
- package/kits/templates/message-fragments/trigger-session.md +1 -1
- package/kits/templates/message-fragments/trigger-thread-check.md +1 -1
- package/kits/templates/roles/admin.json +2 -19
- package/kits/templates/roles/member.json +0 -3
- package/kits/templates/roles/visitor.json +1 -0
- package/kits/templates/system-fragments/baseagent.md +6 -0
- package/kits/templates/system-fragments/commands.md +4 -3
- package/kits/templates/system-fragments/directory-contacts.md +3 -4
- package/kits/templates/system-fragments/managed-runtime.md +1 -1
- package/kits/templates/system-fragments/relation.md +1 -1
- package/kits/templates/system-fragments/thread.md +7 -5
- package/kits/templates/system-fragments/venue.md +11 -0
- package/package.json +6 -4
- package/scripts/agent-template/inspect.mjs +50 -11
- package/scripts/agent-template/shared/common.mjs +11 -6
- package/scripts/agent-template/shared/team-schema.json +6 -4
- package/scripts/agent-template/shared/template-contract.mjs +62 -11
- package/scripts/agent-template/shared/template-package.mjs +189 -21
- package/scripts/agent-template/shared/template-runtime.mjs +54 -6
- package/scripts/agent-template/shared/template.mjs +2 -2
- package/scripts/agent-template/team-pack.mjs +52 -14
- package/dist/cli/peer.js +0 -127
- package/dist/config/peer-operation-service.js +0 -132
- package/dist/config/peer-request-service.js +0 -532
- package/dist/core/command/connect-menu.js +0 -624
|
@@ -2,7 +2,8 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { TextDecoder } from 'node:util';
|
|
4
4
|
import { auditCommandAuthorization } from '../core/auth/authorization-audit.js';
|
|
5
|
-
import { createProvider, parseProviderImport, readProvidersSnapshot, updateProvider } from './providers-management.js';
|
|
5
|
+
import { applyProviderTemplate, createProvider, parseProviderImport, readProvidersSnapshot, updateProvider } from './providers-management.js';
|
|
6
|
+
import { parseProviderTemplateInput, providerTemplateDetail, readProviderTemplates } from './provider-templates.js';
|
|
6
7
|
import { resolveProviderId } from './providers-config.js';
|
|
7
8
|
import { normalizeProviderDomain } from './provider-identity.js';
|
|
8
9
|
export const PROVIDER_INPUT_LIMIT = 1024 * 1024;
|
|
@@ -20,11 +21,12 @@ export function parseProviderCommand(argv) {
|
|
|
20
21
|
providerArgumentError('provider.op requires Provider argv');
|
|
21
22
|
}
|
|
22
23
|
const operation = argv[1];
|
|
23
|
-
if (!['list', 'show', 'create', 'import', 'update', 'delete', 'sync'].includes(operation)) {
|
|
24
|
+
if (!['list', 'show', 'templates', 'create', 'import', 'update', 'delete', 'sync'].includes(operation)) {
|
|
24
25
|
providerArgumentError('Unsupported Provider command');
|
|
25
26
|
}
|
|
26
27
|
const options = new Map();
|
|
27
28
|
const positional = [];
|
|
29
|
+
const inputs = Object.create(null);
|
|
28
30
|
for (let index = 2; index < argv.length; index++) {
|
|
29
31
|
const token = argv[index];
|
|
30
32
|
if (!token.startsWith('-')) {
|
|
@@ -33,24 +35,48 @@ export function parseProviderCommand(argv) {
|
|
|
33
35
|
}
|
|
34
36
|
const separator = token.indexOf('=');
|
|
35
37
|
const name = separator < 0 ? token : token.slice(0, separator);
|
|
36
|
-
if (!['--file', '--format'
|
|
38
|
+
if (!['--file', '--format', '--template', '--api-key', '--name', '--services', '--input'].includes(name)
|
|
39
|
+
|| (name !== '--input' && options.has(name)))
|
|
37
40
|
providerArgumentError('Unknown or duplicate Provider option');
|
|
38
41
|
const value = separator < 0 ? argv[++index] : token.slice(separator + 1);
|
|
39
42
|
if (typeof value !== 'string' || !value || value.startsWith('--'))
|
|
40
43
|
providerArgumentError('Provider option requires a value');
|
|
41
|
-
|
|
44
|
+
if (name === '--input') {
|
|
45
|
+
const match = /^([A-Za-z][A-Za-z0-9_]{0,31})=(.*)$/u.exec(value);
|
|
46
|
+
if (!match || Object.hasOwn(inputs, match[1]) || ['__proto__', 'constructor', 'prototype'].includes(match[1]))
|
|
47
|
+
providerArgumentError('Invalid or duplicate template input');
|
|
48
|
+
inputs[match[1]] = match[2];
|
|
49
|
+
}
|
|
50
|
+
else
|
|
51
|
+
options.set(name, value);
|
|
42
52
|
}
|
|
43
53
|
if (options.has('--format') && options.get('--format') !== 'json')
|
|
44
54
|
providerArgumentError('Only --format json is supported');
|
|
45
55
|
const needsId = ['show', 'update', 'delete'].includes(operation);
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
56
|
+
const templateId = operation === 'templates' ? positional[0] : options.get('--template');
|
|
57
|
+
if (templateId !== undefined && !/^[a-z0-9][a-z0-9-]{0,63}$/u.test(templateId))
|
|
58
|
+
providerArgumentError('Invalid template ID');
|
|
59
|
+
if (options.has('--template') && !['create', 'update'].includes(operation))
|
|
60
|
+
providerArgumentError('--template requires create or update');
|
|
61
|
+
const inline = options.has('--api-key') || options.has('--name') || options.has('--services') || Object.keys(inputs).length > 0;
|
|
62
|
+
if (inline && (!options.has('--template') || options.has('--file')))
|
|
63
|
+
providerArgumentError('Template parameters require --template and cannot be combined with --file');
|
|
64
|
+
const needsFile = ['create', 'import', 'update'].includes(operation) && !options.has('--template');
|
|
65
|
+
if (operation === 'templates' ? positional.length > 1 : positional.length !== (needsId ? 1 : 0))
|
|
48
66
|
providerArgumentError('Unexpected or missing Provider ID');
|
|
49
67
|
if (needsId)
|
|
50
68
|
assertProviderId(positional[0]);
|
|
51
|
-
if (needsFile
|
|
52
|
-
providerArgumentError(
|
|
53
|
-
|
|
69
|
+
if (needsFile && !options.has('--file'))
|
|
70
|
+
providerArgumentError('--file is required');
|
|
71
|
+
if (options.has('--file') && !['create', 'import', 'update'].includes(operation))
|
|
72
|
+
providerArgumentError('--file is not supported by this command');
|
|
73
|
+
const templateInput = inline ? parseProviderTemplateInput({
|
|
74
|
+
...(options.has('--api-key') ? { apiKey: options.get('--api-key') } : {}),
|
|
75
|
+
...(options.has('--name') ? { name: options.get('--name') } : {}),
|
|
76
|
+
...(options.has('--services') ? { serviceTypes: options.get('--services').split(',') } : {}),
|
|
77
|
+
inputs,
|
|
78
|
+
}) : undefined;
|
|
79
|
+
return { operation, providerId: needsId ? positional[0] : undefined, file: options.get('--file'), templateId, templateInput, json: options.has('--format') };
|
|
54
80
|
}
|
|
55
81
|
export function parseProviderObject(text) {
|
|
56
82
|
if (typeof text !== 'string' || Buffer.byteLength(text, 'utf8') > PROVIDER_INPUT_LIMIT) {
|
|
@@ -74,6 +100,11 @@ export function providerFailure(error) {
|
|
|
74
100
|
return { ok: false, code: 'NOT_FOUND', error: 'Provider not found' };
|
|
75
101
|
if (failure?.code === 'PROVIDER_CONFLICT' && failure.data && typeof failure.data === 'object') {
|
|
76
102
|
const details = failure.data;
|
|
103
|
+
if (details.kind === 'provider_domain_exists' && typeof details.providerId === 'string'
|
|
104
|
+
&& /^[A-Za-z0-9_-]+$/u.test(details.providerId)) {
|
|
105
|
+
return { ok: false, code: 'PROVIDER_CONFLICT', error: 'Provider domain already exists; review the template preview and explicitly update ' + details.providerId,
|
|
106
|
+
data: { kind: details.kind, providerId: details.providerId, domain: details.domain } };
|
|
107
|
+
}
|
|
77
108
|
let domain;
|
|
78
109
|
try {
|
|
79
110
|
domain = normalizeProviderDomain(details.domain);
|
|
@@ -88,7 +119,7 @@ export function providerFailure(error) {
|
|
|
88
119
|
&& domain === details.domain
|
|
89
120
|
&& Array.isArray(details.fields) && details.fields.length > 0 && details.fields.length <= 100
|
|
90
121
|
&& details.fields.every(value => typeof value === 'string' && value.length <= 160
|
|
91
|
-
&& /^(?:common\.(?:baseUrl|apiKey|headers|queryParams)|services\.[A-Za-z0-9_-]+\.(?:path|style|models))$/u.test(value))) {
|
|
122
|
+
&& /^(?:common\.(?:baseUrl|apiKey|headers|queryParams)|services\.[A-Za-z0-9_-]+\.(?:path|catalogPath|style|models|modelPolicy|apiKey|headers|queryParams))$/u.test(value))) {
|
|
92
123
|
const data = { kind: details.kind, providerIds: details.providerIds, domain: details.domain, fields: details.fields };
|
|
93
124
|
return { ok: false, code: 'PROVIDER_CONFLICT', data,
|
|
94
125
|
error: `Provider migration conflict between ${data.providerIds.join(', ')} (${data.domain}): ${data.fields.join(', ')} differ; reconcile these fields and retry ec provider sync. Credential fields compare configured values/references, not resolved secrets. No configuration was changed` };
|
|
@@ -146,7 +177,7 @@ export async function executeProviderOperation(command) {
|
|
|
146
177
|
try {
|
|
147
178
|
const parsed = parseProviderCommand(command.argv);
|
|
148
179
|
auditCommandAuthorization({ ts: Date.now(), source: 'control', operation: 'provider.' + parsed.operation,
|
|
149
|
-
scope: 'process', dangerous:
|
|
180
|
+
scope: 'process', dangerous: !['list', 'show', 'templates'].includes(parsed.operation),
|
|
150
181
|
actorId: 'local-control', role: 'daemon-owner', processRole: 'daemon-owner', dataScope: 'daemon',
|
|
151
182
|
isDaemonOwner: true, fromControlChannel: true, decision: 'allow', executed: false,
|
|
152
183
|
argsSummary: parsed.providerId ? { providerId: parsed.providerId } : {}, matchedRule: 'local-control-token' });
|
|
@@ -159,11 +190,25 @@ export async function executeProviderOperation(command) {
|
|
|
159
190
|
/** Shared business execution; callers must authorize before reading input files. */
|
|
160
191
|
export async function executeParsedProviderOperation(parsed) {
|
|
161
192
|
try {
|
|
193
|
+
if (parsed.operation === 'templates')
|
|
194
|
+
return { ok: true, data: parsed.templateId ? providerTemplateDetail(parsed.templateId) : readProviderTemplates() };
|
|
162
195
|
if (parsed.operation === 'sync') {
|
|
163
196
|
const { syncLocalProviders } = await import('./provider-local-sync.js');
|
|
164
197
|
return { ok: true, data: await syncLocalProviders() };
|
|
165
198
|
}
|
|
166
199
|
const text = parsed.file ? readProviderInput(parsed.file) : undefined;
|
|
200
|
+
if (parsed.templateId) {
|
|
201
|
+
let config = parsed.templateInput ?? {};
|
|
202
|
+
if (text !== undefined) {
|
|
203
|
+
try {
|
|
204
|
+
config = JSON.parse(text.replace(/^\uFEFF/u, ''));
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
providerArgumentError('Template input must be valid JSON');
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return { ok: true, data: await applyProviderTemplate({ templateId: parsed.templateId, config, providerId: parsed.providerId }) };
|
|
211
|
+
}
|
|
167
212
|
const snapshot = readProvidersSnapshot();
|
|
168
213
|
if (parsed.operation === 'list')
|
|
169
214
|
return { ok: true, data: snapshot };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assertProviderId, parseProviderObject, PROVIDER_INPUT_LIMIT, providerArgumentError } from './provider-ipc-service.js';
|
|
2
|
+
import { parseProviderTemplateInput } from './provider-templates.js';
|
|
2
3
|
export function validateProviderMenuRequest(request) {
|
|
3
4
|
try {
|
|
4
5
|
if ((request.name !== undefined && request.name !== 'provider')
|
|
@@ -20,12 +21,18 @@ export function validateProviderMenuRequest(request) {
|
|
|
20
21
|
let fields;
|
|
21
22
|
if (request.type === 'menu.query' && args.view === 'list')
|
|
22
23
|
fields = ['view'];
|
|
24
|
+
else if (request.type === 'menu.query' && args.view === 'templates')
|
|
25
|
+
fields = ['view', 'templateId'];
|
|
23
26
|
else if (request.type === 'menu.query' && args.view === 'detail')
|
|
24
27
|
fields = ['view', 'providerId'];
|
|
25
28
|
else if (request.type === 'menu.update' && args.resource === 'provider')
|
|
26
29
|
fields = ['resource', 'providerId', 'expectedRevision'];
|
|
30
|
+
else if (request.type === 'menu.update' && args.resource === 'provider-template')
|
|
31
|
+
fields = ['resource', 'providerId', 'templateId', 'expectedRevision'];
|
|
32
|
+
else if (request.type === 'menu.action' && request.action === 'preview-template')
|
|
33
|
+
fields = ['templateId', 'config'];
|
|
27
34
|
else if (request.type === 'menu.action' && request.action === 'create')
|
|
28
|
-
fields = ['expectedRevision', 'provider'];
|
|
35
|
+
fields = args.templateId === undefined ? ['expectedRevision', 'provider'] : ['expectedRevision', 'templateId', 'config'];
|
|
29
36
|
else if (request.type === 'menu.action' && request.action === 'import')
|
|
30
37
|
fields = ['expectedRevision', 'text'];
|
|
31
38
|
else if (request.type === 'menu.action' && request.action === 'delete')
|
|
@@ -43,10 +50,22 @@ export function validateProviderMenuRequest(request) {
|
|
|
43
50
|
providerArgumentError('Unexpected Provider action');
|
|
44
51
|
if (request.type !== 'menu.update' && request.value !== undefined)
|
|
45
52
|
providerArgumentError('Unexpected Provider value');
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
if (request.action === '
|
|
49
|
-
|
|
53
|
+
if (args.templateId !== undefined && (typeof args.templateId !== 'string' || !/^[a-z0-9][a-z0-9-]{0,63}$/u.test(args.templateId)))
|
|
54
|
+
providerArgumentError('Invalid template ID');
|
|
55
|
+
if ((request.action === 'preview-template' || args.resource === 'provider-template') && !args.templateId)
|
|
56
|
+
providerArgumentError('Template ID is required');
|
|
57
|
+
if (args.templateId && request.type !== 'menu.query') {
|
|
58
|
+
const config = request.type === 'menu.update' ? JSON.parse(String(request.value)) : args.config;
|
|
59
|
+
if (Buffer.byteLength(JSON.stringify(config) ?? '', 'utf8') > PROVIDER_INPUT_LIMIT)
|
|
60
|
+
providerArgumentError('Template inputs exceed 1 MiB');
|
|
61
|
+
parseProviderTemplateInput(config);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
if (request.type === 'menu.update')
|
|
65
|
+
parseProviderObject(request.value);
|
|
66
|
+
if (request.action === 'create')
|
|
67
|
+
parseProviderObject(JSON.stringify(args.provider));
|
|
68
|
+
}
|
|
50
69
|
if (request.action === 'import' && (typeof args.text !== 'string' || !args.text.trim()
|
|
51
70
|
|| Buffer.byteLength(args.text, 'utf8') > PROVIDER_INPUT_LIMIT))
|
|
52
71
|
providerArgumentError('Import requires JSON text under 1 MiB');
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { kitsDir } from '../paths.js';
|
|
4
|
+
import { fileCache } from '../core/daemon-file-cache.js';
|
|
5
|
+
import { providerIdentity } from './provider-identity.js';
|
|
6
|
+
import { validateProviderName, validateProvidersFile } from './providers-config.js';
|
|
7
|
+
function invalid(message, code = 'INVALID_ARGUMENT') {
|
|
8
|
+
throw Object.assign(new Error(message), { code, statusCode: code === 'NOT_FOUND' ? 404 : code === 'CONFLICT' ? 409 : 400 });
|
|
9
|
+
}
|
|
10
|
+
function record(value) {
|
|
11
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
12
|
+
}
|
|
13
|
+
export function readProviderTemplates() {
|
|
14
|
+
const catalog = fileCache.get(path.join(kitsDir(), 'provider-templates.json'), text => {
|
|
15
|
+
if (text === null)
|
|
16
|
+
return invalid('Built-in Provider templates are unavailable', 'PROVIDER_TEMPLATES_UNAVAILABLE');
|
|
17
|
+
let parsed;
|
|
18
|
+
try {
|
|
19
|
+
parsed = JSON.parse(text);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return invalid('Invalid Provider template catalog');
|
|
23
|
+
}
|
|
24
|
+
if (!record(parsed) || parsed.version !== 1 || !Array.isArray(parsed.templates))
|
|
25
|
+
invalid('Unsupported Provider template catalog');
|
|
26
|
+
const ids = new Set();
|
|
27
|
+
for (const item of parsed.templates) {
|
|
28
|
+
if (!record(item) || typeof item.templateId !== 'string' || !/^[a-z0-9][a-z0-9-]{0,63}$/u.test(item.templateId)
|
|
29
|
+
|| ids.has(item.templateId) || !['api', 'plan'].includes(String(item.product))
|
|
30
|
+
|| typeof item.vendor !== 'string' || typeof item.label !== 'string' || !/^\d{4}-\d{2}-\d{2}$/u.test(String(item.checkedAt))
|
|
31
|
+
|| !Array.isArray(item.fields) || !record(item.provider)
|
|
32
|
+
|| !record(item.credential) || typeof item.credential.helpUrl !== 'string'
|
|
33
|
+
|| !Array.isArray(item.sources) || !item.sources.length)
|
|
34
|
+
invalid('Invalid Provider template');
|
|
35
|
+
ids.add(item.templateId);
|
|
36
|
+
const fields = new Set();
|
|
37
|
+
for (const field of item.fields) {
|
|
38
|
+
if (!field || !/^[A-Za-z][A-Za-z0-9_]{0,31}$/u.test(field.name) || fields.has(field.name)
|
|
39
|
+
|| ['constructor', 'prototype'].includes(field.name) || typeof field.label !== 'string'
|
|
40
|
+
|| !['text', 'select'].includes(field.type))
|
|
41
|
+
invalid('Invalid Provider template input field');
|
|
42
|
+
if (field.pattern)
|
|
43
|
+
new RegExp(field.pattern, 'u');
|
|
44
|
+
if (field.type === 'select' && (!Array.isArray(field.options) || !field.options.length
|
|
45
|
+
|| field.options.some(option => !option || typeof option.value !== 'string' || typeof option.label !== 'string')))
|
|
46
|
+
invalid('Invalid template choices');
|
|
47
|
+
fields.add(field.name);
|
|
48
|
+
}
|
|
49
|
+
for (const source of [...item.sources, item.credential.helpUrl]) {
|
|
50
|
+
if (typeof source !== 'string' || new URL(source).protocol !== 'https:')
|
|
51
|
+
invalid('Template sources must be HTTPS URLs');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return { revision: createHash('sha256').update(text).digest('hex'), templates: parsed.templates };
|
|
55
|
+
}, { policy: 'on-reload', group: 'kits' });
|
|
56
|
+
return structuredClone(catalog);
|
|
57
|
+
}
|
|
58
|
+
export function providerTemplateDetail(templateId) {
|
|
59
|
+
const catalog = readProviderTemplates();
|
|
60
|
+
const template = catalog.templates.find(item => item.templateId === templateId);
|
|
61
|
+
if (!template)
|
|
62
|
+
invalid('Provider template not found', 'NOT_FOUND');
|
|
63
|
+
return { ...template, revision: catalog.revision };
|
|
64
|
+
}
|
|
65
|
+
export function parseProviderTemplateInput(value) {
|
|
66
|
+
if (!record(value) || Object.keys(value).some(key => !['name', 'apiKey', 'serviceTypes', 'inputs', 'templateRevision'].includes(key))) {
|
|
67
|
+
invalid('Invalid Provider template input');
|
|
68
|
+
}
|
|
69
|
+
if (value.name !== undefined)
|
|
70
|
+
validateProviderName(value.name);
|
|
71
|
+
if (value.apiKey !== undefined && (typeof value.apiKey !== 'string' || !value.apiKey.trim() || value.apiKey.length > 16384
|
|
72
|
+
|| /[\r\n\0]/u.test(value.apiKey) || value.apiKey === '<redacted>'))
|
|
73
|
+
invalid('A valid product API key is required');
|
|
74
|
+
if (value.templateRevision !== undefined && (typeof value.templateRevision !== 'string'
|
|
75
|
+
|| !/^[a-f0-9]{64}$/u.test(value.templateRevision)))
|
|
76
|
+
invalid('Invalid template revision');
|
|
77
|
+
if (value.inputs !== undefined && (!record(value.inputs)
|
|
78
|
+
|| Object.values(value.inputs).some(item => typeof item !== 'string')))
|
|
79
|
+
invalid('Template inputs must contain strings');
|
|
80
|
+
if (value.serviceTypes !== undefined && (!Array.isArray(value.serviceTypes) || !value.serviceTypes.length
|
|
81
|
+
|| value.serviceTypes.some(item => typeof item !== 'string') || new Set(value.serviceTypes).size !== value.serviceTypes.length)) {
|
|
82
|
+
invalid('Select at least one distinct service');
|
|
83
|
+
}
|
|
84
|
+
return structuredClone(value);
|
|
85
|
+
}
|
|
86
|
+
export function generateProviderTemplate(templateId, value, defaultServices) {
|
|
87
|
+
const input = parseProviderTemplateInput(value);
|
|
88
|
+
const template = providerTemplateDetail(templateId);
|
|
89
|
+
if (input.templateRevision && input.templateRevision !== template.revision)
|
|
90
|
+
invalid('Provider templates changed; reload the preview', 'CONFLICT');
|
|
91
|
+
const fields = new Map(template.fields.map(field => [field.name, field]));
|
|
92
|
+
if (Object.keys(input.inputs ?? {}).some(name => !fields.has(name)))
|
|
93
|
+
invalid('Unknown Provider template field');
|
|
94
|
+
const values = {};
|
|
95
|
+
for (const field of template.fields) {
|
|
96
|
+
const raw = input.inputs?.[field.name] ?? field.default ?? '';
|
|
97
|
+
if (raw.length > 256 || (field.required && !raw) || (field.type === 'select' && !field.options?.some(option => option.value === raw))
|
|
98
|
+
|| (raw && field.pattern && !new RegExp(field.pattern, 'u').test(raw)))
|
|
99
|
+
invalid('Invalid template field: ' + field.name);
|
|
100
|
+
values[field.name] = raw;
|
|
101
|
+
}
|
|
102
|
+
const render = (item) => {
|
|
103
|
+
if (typeof item === 'string')
|
|
104
|
+
return item.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/gu, (_match, name) => {
|
|
105
|
+
if (!Object.hasOwn(values, name) || !values[name])
|
|
106
|
+
invalid('Missing template field: ' + name);
|
|
107
|
+
return values[name];
|
|
108
|
+
});
|
|
109
|
+
if (Array.isArray(item))
|
|
110
|
+
return item.map(render);
|
|
111
|
+
if (record(item))
|
|
112
|
+
return Object.fromEntries(Object.entries(item).map(([key, entry]) => [key, render(entry)]));
|
|
113
|
+
return item;
|
|
114
|
+
};
|
|
115
|
+
const provider = render(template.provider);
|
|
116
|
+
const selected = input.serviceTypes ?? defaultServices ?? Object.keys(provider.services ?? {});
|
|
117
|
+
if (selected.some(type => !Object.hasOwn(provider.services ?? {}, type)))
|
|
118
|
+
invalid('Template does not support a selected service');
|
|
119
|
+
provider.services = Object.fromEntries(selected.map(type => [type, provider.services[type]]));
|
|
120
|
+
if (input.name)
|
|
121
|
+
provider.name = validateProviderName(input.name);
|
|
122
|
+
if (input.apiKey !== undefined)
|
|
123
|
+
provider.common.apiKey = input.apiKey;
|
|
124
|
+
const normalized = validateProvidersFile({ providers: { template: provider } }).providers.template;
|
|
125
|
+
normalized.domain = providerIdentity(normalized).domain;
|
|
126
|
+
return { provider: normalized, templateId, templateRevision: template.revision, product: template.product };
|
|
127
|
+
}
|
|
@@ -81,13 +81,15 @@ function assertProviderEnvironmentSyntax(value, field) {
|
|
|
81
81
|
throw new Error(`${field} must use a whole-field environment reference ($VAR or \${VAR})`);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
function resolveProviderEnvironmentValue(providerId, field, value) {
|
|
84
|
+
function resolveProviderEnvironmentValue(providerId, field, value, scope = 'common') {
|
|
85
85
|
const variable = providerEnvironmentVariable(value);
|
|
86
86
|
if (!variable)
|
|
87
87
|
return value;
|
|
88
88
|
const resolved = process.env[variable];
|
|
89
89
|
if (resolved === undefined || !resolved.trim()) {
|
|
90
|
-
throw new Error(`Provider ${providerId}
|
|
90
|
+
throw Object.assign(new Error(`Provider ${providerId} ${scope}.${field} references unset or empty environment variable ${variable}`), {
|
|
91
|
+
code: field === 'baseUrl' ? 'PROVIDER_BASE_URL_MISSING' : 'PROVIDER_CONNECTION_MISSING', providerId, field,
|
|
92
|
+
});
|
|
91
93
|
}
|
|
92
94
|
return field === 'baseUrl' ? resolved.trim() : resolved;
|
|
93
95
|
}
|
|
@@ -100,6 +102,13 @@ function validProviderBaseUrl(value) {
|
|
|
100
102
|
return false;
|
|
101
103
|
}
|
|
102
104
|
}
|
|
105
|
+
export function resolveProviderBaseUrl(providerId, value) {
|
|
106
|
+
const baseUrl = resolveProviderEnvironmentValue(providerId, 'baseUrl', value);
|
|
107
|
+
if (!validProviderBaseUrl(baseUrl)) {
|
|
108
|
+
throw new Error(`Provider ${providerId} common.baseUrl must resolve to a valid http(s) URL`);
|
|
109
|
+
}
|
|
110
|
+
return baseUrl;
|
|
111
|
+
}
|
|
103
112
|
export function providerNameFromBaseUrl(baseUrl) {
|
|
104
113
|
const hostname = new URL(baseUrl).hostname.replace(/\.$/u, '');
|
|
105
114
|
if (isIP(hostname.replace(/^\[|\]$/gu, '')))
|
|
@@ -216,8 +225,19 @@ function modelOverride(value, field) {
|
|
|
216
225
|
function serviceConfig(value, field, serviceType) {
|
|
217
226
|
if (!isRecord(value))
|
|
218
227
|
throw new Error(`${field} must be an object`);
|
|
219
|
-
assertFields(value, ['path', 'style', 'models', 'modelPolicy'], field);
|
|
228
|
+
assertFields(value, ['path', 'catalogPath', 'style', 'models', 'modelPolicy', 'apiKey', 'headers', 'queryParams'], field);
|
|
220
229
|
const result = {};
|
|
230
|
+
if (value.apiKey !== undefined) {
|
|
231
|
+
if (typeof value.apiKey !== 'string')
|
|
232
|
+
throw new Error(`${field}.apiKey must be a string`);
|
|
233
|
+
assertProviderEnvironmentSyntax(value.apiKey, `${field}.apiKey`);
|
|
234
|
+
result.apiKey = value.apiKey;
|
|
235
|
+
}
|
|
236
|
+
for (const name of ['headers', 'queryParams']) {
|
|
237
|
+
const values = stringMap(value[name], `${field}.${name}`);
|
|
238
|
+
if (values !== undefined)
|
|
239
|
+
result[name] = values;
|
|
240
|
+
}
|
|
221
241
|
if (value.modelPolicy !== undefined) {
|
|
222
242
|
if (typeof value.modelPolicy !== 'string' || !['allowlist', 'denylist', 'manual'].includes(value.modelPolicy)) {
|
|
223
243
|
throw new Error(`${field}.modelPolicy must be allowlist, denylist or manual`);
|
|
@@ -232,6 +252,14 @@ function serviceConfig(value, field, serviceType) {
|
|
|
232
252
|
}
|
|
233
253
|
result.path = value.path.trim();
|
|
234
254
|
}
|
|
255
|
+
if (value.catalogPath !== undefined) {
|
|
256
|
+
if (typeof value.catalogPath !== 'string')
|
|
257
|
+
throw new Error(`${field}.catalogPath must be a string`);
|
|
258
|
+
if (/^[a-z][a-z\d+.-]*:/iu.test(value.catalogPath.trim()) || value.catalogPath.trim().startsWith('//') || /[\\\0\r\n?#]/u.test(value.catalogPath)) {
|
|
259
|
+
throw new Error(`${field}.catalogPath must be relative`);
|
|
260
|
+
}
|
|
261
|
+
result.catalogPath = value.catalogPath.trim();
|
|
262
|
+
}
|
|
235
263
|
if (value.style !== undefined)
|
|
236
264
|
result.style = nonEmpty(value.style, `${field}.style`);
|
|
237
265
|
if (value.models !== undefined) {
|
|
@@ -357,6 +385,15 @@ export function resolveProviderId(providerId, config) {
|
|
|
357
385
|
assertSafeRegistrySegment(providerId, 'provider id');
|
|
358
386
|
return config.aliases && Object.hasOwn(config.aliases, providerId) ? config.aliases[providerId] : providerId;
|
|
359
387
|
}
|
|
388
|
+
/** Raw credential selection shared by resolution, repair and import merging. */
|
|
389
|
+
export function providerServiceCredentials(provider, serviceType) {
|
|
390
|
+
const service = provider.services?.[serviceType];
|
|
391
|
+
return {
|
|
392
|
+
apiKey: service?.apiKey ?? provider.common.apiKey,
|
|
393
|
+
headers: service?.headers ?? provider.common.headers,
|
|
394
|
+
queryParams: service?.queryParams ?? provider.common.queryParams,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
360
397
|
export function resolveProviderService(providerId, serviceType, config, defaultStyle = 'systemone') {
|
|
361
398
|
providerId = resolveProviderId(providerId, config);
|
|
362
399
|
assertSafeRegistrySegment(serviceType, 'service type');
|
|
@@ -372,10 +409,7 @@ export function resolveProviderService(providerId, serviceType, config, defaultS
|
|
|
372
409
|
if (fixedStyle && service.style && service.style !== fixedStyle) {
|
|
373
410
|
throw new Error(`Provider ${providerId} service ${serviceType} must use style ${fixedStyle}`);
|
|
374
411
|
}
|
|
375
|
-
const resolvedBaseUrl =
|
|
376
|
-
if (!validProviderBaseUrl(resolvedBaseUrl)) {
|
|
377
|
-
throw new Error(`Provider ${providerId} common.baseUrl must resolve to a valid http(s) URL`);
|
|
378
|
-
}
|
|
412
|
+
const resolvedBaseUrl = resolveProviderBaseUrl(providerId, provider.common.baseUrl);
|
|
379
413
|
if (provider.domain !== undefined)
|
|
380
414
|
providerIdentity({ ...provider, common: { ...provider.common, baseUrl: resolvedBaseUrl } });
|
|
381
415
|
const base = resolvedBaseUrl.endsWith('/') ? resolvedBaseUrl : `${resolvedBaseUrl}/`;
|
|
@@ -383,19 +417,40 @@ export function resolveProviderService(providerId, serviceType, config, defaultS
|
|
|
383
417
|
if (parsed.origin !== new URL(base).origin)
|
|
384
418
|
throw new Error(`Provider ${providerId} path must stay on the common origin`);
|
|
385
419
|
const finalUrl = parsed.toString().replace(/\/+$/u, '');
|
|
386
|
-
|
|
387
|
-
const
|
|
420
|
+
// 目录地址可与 API 地址不同(见 ProviderServiceConfig.catalogPath)。
|
|
421
|
+
const catalogParsed = service.catalogPath === undefined
|
|
422
|
+
? parsed
|
|
423
|
+
: new URL(service.catalogPath, base);
|
|
424
|
+
if (catalogParsed.origin !== new URL(base).origin) {
|
|
425
|
+
throw new Error(`Provider ${providerId} catalogPath must stay on the common origin`);
|
|
426
|
+
}
|
|
427
|
+
const catalogBaseUrl = catalogParsed.toString().replace(/\/+$/u, '');
|
|
428
|
+
const catalogPath = new URL(catalogBaseUrl).pathname.replace(/\/+$/u, '');
|
|
429
|
+
const credentials = providerServiceCredentials(provider, serviceType);
|
|
430
|
+
if (service.apiKey !== undefined && service.apiKey !== provider.common.apiKey) {
|
|
431
|
+
const hasSharedAuthHeader = Object.keys(provider.common.headers ?? {})
|
|
432
|
+
.some(name => ['authorization', 'x-api-key', 'x-goog-api-key', 'api-key'].includes(name.toLowerCase()));
|
|
433
|
+
const hasSharedAuthQuery = Object.keys(provider.common.queryParams ?? {})
|
|
434
|
+
.some(name => ['key', 'api_key', 'apikey', 'access_token'].includes(name.toLowerCase()));
|
|
435
|
+
if ((service.headers === undefined && hasSharedAuthHeader) || (service.queryParams === undefined && hasSharedAuthQuery)) {
|
|
436
|
+
throw Object.assign(new Error(`Provider ${providerId} services.${serviceType} must explicitly override inherited authentication maps`), {
|
|
437
|
+
code: 'PROVIDER_CREDENTIAL_OVERRIDE_REQUIRED',
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
const apiKey = credentials.apiKey === undefined
|
|
388
442
|
? undefined
|
|
389
|
-
: resolveProviderEnvironmentValue(providerId, 'apiKey',
|
|
443
|
+
: resolveProviderEnvironmentValue(providerId, 'apiKey', credentials.apiKey, service.apiKey === undefined ? 'common' : `services.${serviceType}`);
|
|
390
444
|
return {
|
|
391
445
|
providerId,
|
|
392
446
|
serviceType,
|
|
393
447
|
style,
|
|
394
448
|
baseUrl: finalUrl,
|
|
395
449
|
catalogPath,
|
|
450
|
+
catalogBaseUrl,
|
|
396
451
|
apiKey,
|
|
397
|
-
headers:
|
|
398
|
-
queryParams:
|
|
452
|
+
headers: credentials.headers,
|
|
453
|
+
queryParams: credentials.queryParams,
|
|
399
454
|
modelOverrides: service.models ?? {},
|
|
400
455
|
...(service.modelPolicy ? { modelPolicy: service.modelPolicy } : {}),
|
|
401
456
|
};
|