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
|
@@ -15,6 +15,8 @@ import { ownerResolver } from './ownership/owner-resolver.js';
|
|
|
15
15
|
import { AgentInitializationService, InitializationStateError, initializationErrorCode, readInitialization } from '../cli/agent-create.js';
|
|
16
16
|
import { getAidStore, loadClient } from '../aun/aid/store.js';
|
|
17
17
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
18
|
+
import { readPreparedTemplateIdentity } from '../agent-template/runtime.js';
|
|
19
|
+
import { readAgentCreationClaim } from './agent-creation-claim.js';
|
|
18
20
|
export function loadStartupAgentRegistry(agentRegistry) {
|
|
19
21
|
agentRegistry.loadAll();
|
|
20
22
|
const agentInfos = agentRegistry.list();
|
|
@@ -343,11 +345,19 @@ export function createAgentReloadRuntime({ agentRegistry, agentLoader, sessionMa
|
|
|
343
345
|
await new Promise(resolve => setTimeout(resolve, 25));
|
|
344
346
|
}
|
|
345
347
|
},
|
|
346
|
-
acquireWorkGate: async (aid) => {
|
|
348
|
+
acquireWorkGate: async (aid, token) => {
|
|
347
349
|
await awaitStartupAgent?.(aid);
|
|
348
350
|
const agentName = agentRegistry.get(aid)?.name;
|
|
349
351
|
if (!agentName)
|
|
350
352
|
return;
|
|
353
|
+
if (token) {
|
|
354
|
+
const release = messageQueue.holdAgent(agentName, token);
|
|
355
|
+
return () => {
|
|
356
|
+
if (agentRegistry.get(aid)?.status === 'disabled')
|
|
357
|
+
messageQueue.muteAgent(agentName);
|
|
358
|
+
release();
|
|
359
|
+
};
|
|
360
|
+
}
|
|
351
361
|
const inheritedReloadMute = reloadOwnedMutes.delete(agentName);
|
|
352
362
|
const alreadyMuted = messageQueue.isAgentMuted(agentName);
|
|
353
363
|
const ownsMute = inheritedReloadMute || !alreadyMuted;
|
|
@@ -401,14 +411,23 @@ export async function checkInitializationOwner(aid, expectedOwnerAid, expectedRe
|
|
|
401
411
|
};
|
|
402
412
|
return { status: 'pending', ...(checkedAt !== undefined ? { checkedAt } : {}), ...details };
|
|
403
413
|
}
|
|
404
|
-
export function createAgentInitializationRuntime({ agentRegistry, agentMap, channelInstances, hotLoad, activate, }) {
|
|
414
|
+
export function createAgentInitializationRuntime({ agentRegistry, agentMap, channelInstances, hotLoad, activate, activatePrepared, }) {
|
|
405
415
|
const isConnected = (aid) => channelInstances.some(instance => instance.channelType === 'aun'
|
|
406
416
|
&& instance.channel.getAidState?.()?.aid === aid
|
|
407
417
|
&& instance.channel.getAidState?.()?.status === 'connected');
|
|
408
418
|
return new AgentInitializationService({
|
|
419
|
+
preparedIdentity: (aid, ownerAid) => {
|
|
420
|
+
return readAgentCreationClaim(aid)?.teamJobId ? readPreparedTemplateIdentity(aid, ownerAid) : undefined;
|
|
421
|
+
},
|
|
409
422
|
ownershipBeforePublication: true,
|
|
410
423
|
register: async (aid, ownerAid, mode) => {
|
|
411
424
|
assertAgentAidAvailable(aid);
|
|
425
|
+
const claim = (await import('./agent-creation-claim.js')).readAgentCreationClaim(aid);
|
|
426
|
+
if (claim?.teamJobId) {
|
|
427
|
+
const { readPreparedTemplateIdentity } = await import('../agent-template/runtime.js');
|
|
428
|
+
readPreparedTemplateIdentity(aid, ownerAid);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
412
431
|
const { aidCreateIdentityOnly } = await import('../aun/aid/identity.js');
|
|
413
432
|
const { assertAgentIdentityReusable } = await import('../aun/aid/agentmd.js');
|
|
414
433
|
const created = await aidCreateIdentityOnly(aid, { type: 'agent' });
|
|
@@ -426,6 +445,11 @@ export function createAgentInitializationRuntime({ agentRegistry, agentMap, chan
|
|
|
426
445
|
}
|
|
427
446
|
},
|
|
428
447
|
bindOwner: async (aid, ownerAid) => {
|
|
448
|
+
const claim = (await import('./agent-creation-claim.js')).readAgentCreationClaim(aid);
|
|
449
|
+
if (claim?.teamJobId) {
|
|
450
|
+
const { readPreparedTemplateIdentity } = await import('../agent-template/runtime.js');
|
|
451
|
+
return readPreparedTemplateIdentity(aid, ownerAid).bindingTask;
|
|
452
|
+
}
|
|
429
453
|
// Initialization happens before the new Agent is hot-loaded. Use a
|
|
430
454
|
// short-lived client for both modes; the long-lived resolver requires a
|
|
431
455
|
// connected subject and therefore cannot bind a freshly registered AID.
|
|
@@ -468,6 +492,7 @@ export function createAgentInitializationRuntime({ agentRegistry, agentMap, chan
|
|
|
468
492
|
throw Object.assign(new Error('AUN connection unavailable'), { code: 'INITIALIZE_CHANNEL_UNAVAILABLE' });
|
|
469
493
|
},
|
|
470
494
|
activate,
|
|
495
|
+
activatePrepared,
|
|
471
496
|
usable: aid => {
|
|
472
497
|
const agent = agentRegistry.get(aid);
|
|
473
498
|
return !!agent && agent.config.enabled !== false && agentMap.has(`${aid}::${agent.baseagent}`) && isConnected(aid);
|
|
@@ -481,7 +506,7 @@ export function recoverIncompleteAgentInitializations(service, agentsDir = resol
|
|
|
481
506
|
continue;
|
|
482
507
|
try {
|
|
483
508
|
const record = readInitialization(entry.name);
|
|
484
|
-
if (record?.status === 'in_progress') {
|
|
509
|
+
if (record?.status === 'in_progress' && !record.teamJobId) {
|
|
485
510
|
service.resume(entry.name, record.actor, record.mode === 'one_shot' ? record.clientRequestId : undefined);
|
|
486
511
|
}
|
|
487
512
|
}
|
|
@@ -563,6 +588,57 @@ export function createAgentRuntimeOperations({ agentRegistry, agentLoader, sessi
|
|
|
563
588
|
handoffRuntime.resumeAgent(aid);
|
|
564
589
|
}
|
|
565
590
|
};
|
|
591
|
+
const unload = async (aid, options = {}) => {
|
|
592
|
+
if (!isValidAid(aid))
|
|
593
|
+
throw Object.assign(new Error('Invalid Agent AID'), { code: 'INVALID_ARGS' });
|
|
594
|
+
return reloadCoordinator.runExclusive(aid, async () => {
|
|
595
|
+
if (await options.prepare?.() === false)
|
|
596
|
+
return false;
|
|
597
|
+
const runtimeAgent = agentRegistry.get(aid);
|
|
598
|
+
if (!runtimeAgent)
|
|
599
|
+
return false;
|
|
600
|
+
let removed = false;
|
|
601
|
+
handoffRuntime.pauseAgent(aid);
|
|
602
|
+
try {
|
|
603
|
+
await handoffRuntime.drainAgent(aid);
|
|
604
|
+
await triggerSchedulers.remove(aid);
|
|
605
|
+
for (const channelName of runtimeAgent.channelInstanceNames()) {
|
|
606
|
+
const instance = channelInstances.find(candidate => candidate.adapter.channelName === channelName);
|
|
607
|
+
if (instance) {
|
|
608
|
+
await instance.disconnect();
|
|
609
|
+
const index = channelInstances.indexOf(instance);
|
|
610
|
+
if (index >= 0)
|
|
611
|
+
channelInstances.splice(index, 1);
|
|
612
|
+
}
|
|
613
|
+
unregisterRuntimeChannel(channelName);
|
|
614
|
+
}
|
|
615
|
+
runtimeAgent.channels?.clear();
|
|
616
|
+
for (const [key, runner] of agentMap) {
|
|
617
|
+
if (!key.startsWith(`${aid}::`))
|
|
618
|
+
continue;
|
|
619
|
+
await runner.dispose?.();
|
|
620
|
+
agentMap.delete(key);
|
|
621
|
+
}
|
|
622
|
+
const { globalSkillWatcher } = await import('./skill/global-watcher.js');
|
|
623
|
+
await globalSkillWatcher.unwatchAgent(aid);
|
|
624
|
+
agentRegistry.remove(aid);
|
|
625
|
+
messageQueue.clearByAgent(runtimeAgent.name);
|
|
626
|
+
removed = true;
|
|
627
|
+
return true;
|
|
628
|
+
}
|
|
629
|
+
catch (error) {
|
|
630
|
+
runtimeAgent.status = 'error';
|
|
631
|
+
runtimeAgent.error = `Unload failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
632
|
+
agentRegistry.channelIndex.clear();
|
|
633
|
+
agentRegistry.buildChannelIndex();
|
|
634
|
+
throw error;
|
|
635
|
+
}
|
|
636
|
+
finally {
|
|
637
|
+
if (!removed)
|
|
638
|
+
handoffRuntime.resumeAgent(aid);
|
|
639
|
+
}
|
|
640
|
+
}, options);
|
|
641
|
+
};
|
|
566
642
|
let resyncInFlight;
|
|
567
643
|
const resync = async () => {
|
|
568
644
|
if (resyncInFlight)
|
|
@@ -576,40 +652,11 @@ export function createAgentRuntimeOperations({ agentRegistry, agentLoader, sessi
|
|
|
576
652
|
const diskCfg = diskAgents.find(agent => agent.aid === aid);
|
|
577
653
|
if (!diskCfg || diskCfg.enabled === false) {
|
|
578
654
|
try {
|
|
579
|
-
const offlined = await
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
return false;
|
|
583
|
-
|
|
584
|
-
if (!runtimeAgent)
|
|
585
|
-
return false;
|
|
586
|
-
let removed = false;
|
|
587
|
-
handoffRuntime.pauseAgent(aid);
|
|
588
|
-
try {
|
|
589
|
-
await handoffRuntime.drainAgent(aid);
|
|
590
|
-
await triggerSchedulers.remove(aid);
|
|
591
|
-
for (const channelName of runtimeAgent.channelInstanceNames()) {
|
|
592
|
-
const instance = channelInstances.find(candidate => candidate.adapter.channelName === channelName);
|
|
593
|
-
if (instance) {
|
|
594
|
-
try {
|
|
595
|
-
await instance.disconnect();
|
|
596
|
-
}
|
|
597
|
-
catch { }
|
|
598
|
-
const index = channelInstances.indexOf(instance);
|
|
599
|
-
if (index >= 0)
|
|
600
|
-
channelInstances.splice(index, 1);
|
|
601
|
-
}
|
|
602
|
-
unregisterRuntimeChannel(channelName);
|
|
603
|
-
}
|
|
604
|
-
agentRegistry.agents.delete(aid);
|
|
605
|
-
messageQueue.clearByAgent(runtimeAgent.name);
|
|
606
|
-
removed = true;
|
|
607
|
-
return true;
|
|
608
|
-
}
|
|
609
|
-
finally {
|
|
610
|
-
if (!removed)
|
|
611
|
-
handoffRuntime.resumeAgent(aid);
|
|
612
|
-
}
|
|
655
|
+
const offlined = await unload(aid, {
|
|
656
|
+
prepare: () => {
|
|
657
|
+
const latestDiskCfg = readConfig(ConfigTarget.Agent, { self: aid }, { cache: false });
|
|
658
|
+
return !latestDiskCfg || latestDiskCfg.enabled === false;
|
|
659
|
+
},
|
|
613
660
|
});
|
|
614
661
|
if (offlined)
|
|
615
662
|
results.push(`- ${aid} (offline)`);
|
|
@@ -668,7 +715,7 @@ export function createAgentRuntimeOperations({ agentRegistry, agentLoader, sessi
|
|
|
668
715
|
resyncInFlight = undefined;
|
|
669
716
|
}
|
|
670
717
|
};
|
|
671
|
-
return { hotLoad, resync };
|
|
718
|
+
return { hotLoad, unload, resync };
|
|
672
719
|
}
|
|
673
720
|
// Audited fastaun start()/capture() only read and verify documents. All writes
|
|
674
721
|
// and notifications occur in execute(), which converts transport failures to
|
|
@@ -4,6 +4,7 @@ import crypto from 'crypto';
|
|
|
4
4
|
import { authorizeOperation, buildAuthSubject } from './auth-gateway.js';
|
|
5
5
|
import { refreshOwnershipForAuthorization } from '../ownership/owner-resolver.js';
|
|
6
6
|
import { formatPeerKey, parsePeerKey } from '../relation/peer-identity.js';
|
|
7
|
+
import { prepareSameOwnerProof } from '../relation/same-owner-proof.js';
|
|
7
8
|
import { logger } from '../../utils/logger.js';
|
|
8
9
|
import { canonicalizeEvolcoreCommandArgv } from '../permission/ec-command-parser.js';
|
|
9
10
|
import { MAIN_CLI_BIN } from '../../product.js';
|
|
@@ -447,6 +448,10 @@ export async function authorizeDelegatedAunMsgSend(registry, input) {
|
|
|
447
448
|
await refreshOwnershipForAuthorization(grant.selfAid, {
|
|
448
449
|
allowTransient: true, includeDaemon: hasTrustedFullAccessDelegation(grant),
|
|
449
450
|
});
|
|
451
|
+
if (grant.channelType === 'aun' && grant.chatType === 'private') {
|
|
452
|
+
// 审批到执行之间证明可能过期;按来源主体刷新,不能借发送目标改变角色。
|
|
453
|
+
await prepareSameOwnerProof(grant.selfAid, grant.actorId);
|
|
454
|
+
}
|
|
450
455
|
const builtSubject = buildAuthSubject({
|
|
451
456
|
selfAid: grant.selfAid,
|
|
452
457
|
actorId: grant.actorId,
|
|
@@ -8,7 +8,7 @@ import { formatPeerKey, parsePeerKey } from '../relation/peer-identity.js';
|
|
|
8
8
|
import { sameGroupAid } from '../../aun/group/index.js';
|
|
9
9
|
import { ownerResolver } from '../ownership/owner-resolver.js';
|
|
10
10
|
const DAEMON_OWNER_PROCESS_OPERATIONS = new Set([
|
|
11
|
-
...['inspect', 'build', 'push', 'pull', 'deploy', '
|
|
11
|
+
...['inspect', 'build', 'push', 'pull', 'preview', 'deploy', 'status', 'resume', 'cancel', 'capabilities'].map(action => 'agent.template.' + action),
|
|
12
12
|
'model.provider.catalog',
|
|
13
13
|
'agent.list',
|
|
14
14
|
'agent.create',
|
|
@@ -167,6 +167,7 @@ const OPERATIONS = [
|
|
|
167
167
|
['event.subscribers.list', 'List event subscribers'],
|
|
168
168
|
['event.stats.current', 'Read event publication statistics'],
|
|
169
169
|
['event.publishStats.current', 'Read per-pack event publication statistics'],
|
|
170
|
+
['event.timeline.list', 'Read event publication timeline'],
|
|
170
171
|
['event.records.list', 'Read event delivery records'],
|
|
171
172
|
].map(([id, description]) => ({
|
|
172
173
|
id,
|
|
@@ -228,10 +229,9 @@ const OPERATIONS = [
|
|
|
228
229
|
description: '启动、停止、重载或守护本地服务',
|
|
229
230
|
sources: ['agent-tool'],
|
|
230
231
|
},
|
|
231
|
-
|
|
232
|
-
...['inspect', 'build', 'push', 'pull', 'deploy', 'query'].map(action => ({
|
|
232
|
+
...['inspect', 'build', 'push', 'pull', 'preview', 'deploy', 'status', 'resume', 'cancel', 'capabilities'].map(action => ({
|
|
233
233
|
id: 'agent.template.' + action, category: 'process',
|
|
234
|
-
dangerous: !['
|
|
234
|
+
dangerous: !['status', 'capabilities'].includes(action), defaultScopes: ['process'],
|
|
235
235
|
description: 'Agent template ' + action, sources: ['menu', 'control', 'agent-tool', 'ecweb'],
|
|
236
236
|
})),
|
|
237
237
|
{ id: 'model.provider.catalog', category: 'process', dangerous: false, defaultScopes: ['process'],
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { hasSuppliedInitialization } from '../cli/agent-create.js';
|
|
2
|
+
import { templateInstallationGate } from '../agent-template/jobs.js';
|
|
2
3
|
import { ownerResolver, OWNERSHIP_AUTHORIZATION_MAX_AGE_MS } from './ownership/owner-resolver.js';
|
|
3
4
|
import fs from 'fs';
|
|
4
5
|
import path from 'path';
|
|
@@ -17,6 +18,8 @@ import * as outbox from '../aun/outbox.js';
|
|
|
17
18
|
import { chatDirPath } from './session/session-fs-store.js';
|
|
18
19
|
/** Coordinate the write-ahead completion welcome with the lifecycle commit. */
|
|
19
20
|
export async function completeBootstrapWithWelcome(service, aid, welcome, sessions) {
|
|
21
|
+
if (templateInstallationGate(aid).blocked)
|
|
22
|
+
return { ok: false, code: 'TEAM_NOT_COMMITTED', error: 'Team creation has not committed', reloaded: false };
|
|
20
23
|
const lifecycle = service.lifecycleOf(aid);
|
|
21
24
|
const config = loadAgent(aid);
|
|
22
25
|
const suppliedOwnerPending = lifecycle === 'ownerpending' && config?.initialization?.mode === 'supplied';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConfigTarget, read, write } from '../../config/config-manager.js';
|
|
2
|
+
import { resolveProjectDefaultPath } from '../../utils/project-path.js';
|
|
2
3
|
import { ClaudeCapabilityProvider } from './providers/claude-capability-provider.js';
|
|
3
4
|
import { CodexCapabilityProvider } from './providers/codex-capability-provider.js';
|
|
4
5
|
import { GeminiCapabilityProvider } from './providers/gemini-capability-provider.js';
|
|
@@ -23,7 +24,8 @@ export function resolveCapabilityContext(input) {
|
|
|
23
24
|
const aid = input.aid || input.config?.aid;
|
|
24
25
|
if (!aid)
|
|
25
26
|
return { error: '当前 channel 无绑定 agent', code: 'FORBIDDEN' };
|
|
26
|
-
const projectPath = input.config?.projects?.defaultPath
|
|
27
|
+
const projectPath = resolveProjectDefaultPath(input.config?.projects?.defaultPath)
|
|
28
|
+
|| input.projectPath || input.sessionProjectPath || null;
|
|
27
29
|
if (!projectPath)
|
|
28
30
|
return { error: '无法解析当前 agent projectPath', code: 'NO_PROJECT' };
|
|
29
31
|
const baseagent = resolveBaseagent(input);
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import { logger } from '../utils/logger.js';
|
|
9
9
|
import { assertAgentAidAvailable } from '../config/config-manager.js';
|
|
10
10
|
import { PluginHandle } from './plugin-lifecycle.js';
|
|
11
|
-
import { ContactBindRegistry } from './contact-bind-registry.js';
|
|
12
11
|
/**
|
|
13
12
|
* 进程退出时给 AUN 渠道的 WebSocket 关闭握手留的时间。
|
|
14
13
|
*
|
|
@@ -178,7 +177,7 @@ export class ChannelLoader {
|
|
|
178
177
|
buildContext(agent) {
|
|
179
178
|
return {
|
|
180
179
|
agentName: agent.aid,
|
|
181
|
-
defaultProjectPath: agent.
|
|
180
|
+
defaultProjectPath: agent.projectPath,
|
|
182
181
|
debug: this.processDebug,
|
|
183
182
|
aunDefaultEncrypt: this.aunDefaultEncrypt,
|
|
184
183
|
};
|
|
@@ -549,7 +548,7 @@ export function buildReloadHooks(deps) {
|
|
|
549
548
|
}
|
|
550
549
|
const ctx = {
|
|
551
550
|
agentName: agent.aid ?? agent.config?.aid,
|
|
552
|
-
defaultProjectPath: agent.
|
|
551
|
+
defaultProjectPath: agent.projectPath,
|
|
553
552
|
debug: channelLoader.processDebug,
|
|
554
553
|
aunDefaultEncrypt: channelLoader.aunDefaultEncrypt,
|
|
555
554
|
};
|
|
@@ -593,3 +592,30 @@ export function buildReloadHooks(deps) {
|
|
|
593
592
|
},
|
|
594
593
|
};
|
|
595
594
|
}
|
|
595
|
+
export class ContactBindRegistry {
|
|
596
|
+
providers = new Map();
|
|
597
|
+
register(channelType, provider) {
|
|
598
|
+
const normalizedType = channelType.trim().toLowerCase();
|
|
599
|
+
if (!normalizedType)
|
|
600
|
+
throw new Error('Contact-bind channel type must not be empty');
|
|
601
|
+
if (this.providers.has(normalizedType)) {
|
|
602
|
+
throw new Error(`Contact-bind provider '${normalizedType}' already registered`);
|
|
603
|
+
}
|
|
604
|
+
this.providers.set(normalizedType, provider);
|
|
605
|
+
}
|
|
606
|
+
get(channelType) {
|
|
607
|
+
return this.providers.get(channelType.trim().toLowerCase());
|
|
608
|
+
}
|
|
609
|
+
channelTypes() {
|
|
610
|
+
return [...this.providers.keys()];
|
|
611
|
+
}
|
|
612
|
+
handle(channelType, context) {
|
|
613
|
+
return this.get(channelType)?.handle(context) ?? { handled: false };
|
|
614
|
+
}
|
|
615
|
+
registerPending(channelType, request) {
|
|
616
|
+
const provider = this.get(channelType);
|
|
617
|
+
return provider
|
|
618
|
+
? provider.register(request)
|
|
619
|
+
: { ok: false, error: `contact bind provider not configured for channel '${channelType}'` };
|
|
620
|
+
}
|
|
621
|
+
}
|
|
@@ -100,7 +100,7 @@ export function createChannelConnectionRuntime(dependencies) {
|
|
|
100
100
|
const type = instance.channelType || name;
|
|
101
101
|
dependencies.eventBus.publish({ type: 'channel:connected', channel: type.toLowerCase(), channelName: name, timestamp: Date.now() });
|
|
102
102
|
const agent = dependencies.resolveOwningAgent(key, name);
|
|
103
|
-
if (instance.channelType === 'aun' && agent && !dependencies.isStartupRecoveryPending()) {
|
|
103
|
+
if (instance.channelType === 'aun' && agent && !dependencies.isStartupRecoveryPending(agent.aid)) {
|
|
104
104
|
void queuePendingObserverHints(agent.aid, key)
|
|
105
105
|
.catch(error => logger.warn(`[ObserverHint] reconnect recovery failed for ${agent.aid}: ${error}`));
|
|
106
106
|
}
|
|
@@ -14,7 +14,7 @@ import { uploadAvatar, uploadAvatarUrl } from '../../utils/avatar-upload.js';
|
|
|
14
14
|
import { agentmdGet, agentmdPut, updateAgentMdFrontmatterName } from '../../aun/aid/agentmd.js';
|
|
15
15
|
import { isValidAid } from '../../aun/aid/validation.js';
|
|
16
16
|
import { isSupportedBaseagent } from '../../agents/baseagent.js';
|
|
17
|
-
import { resolveProviderServiceForBaseagent } from '../../config/providers.js';
|
|
17
|
+
import { assertProviderModelAllowed, resolveProviderServiceForBaseagent } from '../../config/providers.js';
|
|
18
18
|
import { claimAgentCreationAsync, removeAgentCreationClaim } from '../agent-creation-claim.js';
|
|
19
19
|
/** Enabled by default; an explicit 0 retains the host-scoped rollback switch. */
|
|
20
20
|
export function appOneShotCreateEnabled(env = process.env) {
|
|
@@ -858,8 +858,8 @@ export async function execAgentAction(action, args, peerId, eventBus, service, s
|
|
|
858
858
|
if (provider) {
|
|
859
859
|
try {
|
|
860
860
|
const resolved = resolveProviderServiceForBaseagent(provider, a.baseagent);
|
|
861
|
-
if (model
|
|
862
|
-
|
|
861
|
+
if (model)
|
|
862
|
+
assertProviderModelAllowed(model, resolved);
|
|
863
863
|
}
|
|
864
864
|
catch (error) {
|
|
865
865
|
return { error: error.message || String(error), code: 'INVALID_ARGS' };
|
|
@@ -938,7 +938,7 @@ export async function execAgentAction(action, args, peerId, eventBus, service, s
|
|
|
938
938
|
? await service.delete(a.aid, false)
|
|
939
939
|
: await agentDelete(a.aid, false);
|
|
940
940
|
if (!('ok' in res) || res.ok !== true)
|
|
941
|
-
return { error: res.error, code: classifyError(res.error) };
|
|
941
|
+
return { error: res.error, code: res.code || classifyError(res.error) };
|
|
942
942
|
eventBus?.publish({ type: 'agent:deleted', aid: res.aid, purged: res.purged, timestamp: Date.now() });
|
|
943
943
|
return { data: { aid: res.aid, purged: res.purged } };
|
|
944
944
|
}
|
|
@@ -961,7 +961,8 @@ export async function execAgentAction(action, args, peerId, eventBus, service, s
|
|
|
961
961
|
reloaded: res.reloaded,
|
|
962
962
|
timestamp: Date.now(),
|
|
963
963
|
});
|
|
964
|
-
return { data: { aid: res.aid, enabled: res.enabled, reloaded: res.reloaded
|
|
964
|
+
return { data: { aid: res.aid, enabled: res.enabled, reloaded: res.reloaded,
|
|
965
|
+
...('configMissing' in res ? { configMissing: res.configMissing } : {}) } };
|
|
965
966
|
}
|
|
966
967
|
if (action === 'reload') {
|
|
967
968
|
if (!a.aid)
|
|
@@ -1,101 +1,37 @@
|
|
|
1
|
-
import { isValidAid } from '../../aun/aid/validation.js';
|
|
2
1
|
import { getAgentTemplateService } from '../../agent-template/service.js';
|
|
3
2
|
import { TEMPLATE_ACTIONS, templateError } from '../../agent-template/types.js';
|
|
4
3
|
import { authorizeFreshOperation } from '../auth/auth-gateway.js';
|
|
5
4
|
import { getProviderCatalog } from '../model/model-catalog.js';
|
|
5
|
+
const templateContract = await import(new URL('../../../scripts/agent-template/shared/template-contract.mjs', import.meta.url).href);
|
|
6
6
|
export function isTemplateRequest(request) {
|
|
7
|
-
return
|
|
8
|
-
&& (TEMPLATE_ACTIONS.includes(request.action) || request.args?.view === 'template-job');
|
|
7
|
+
return request.name === 'template' || request.cmd === '/template';
|
|
9
8
|
}
|
|
10
9
|
export function isProviderModelCatalog(request) {
|
|
11
10
|
return (request.name === 'model' || request.cmd === '/model') && request.args?.view === 'catalog' && request.args?.scope === 'process';
|
|
12
11
|
}
|
|
12
|
+
export function templateMenuAction(request) {
|
|
13
|
+
const args = { ...request.args };
|
|
14
|
+
let action = request.action;
|
|
15
|
+
if (request.type === 'menu.query') {
|
|
16
|
+
action = args.view === 'job' ? 'status' : args.view === 'capabilities' ? 'capabilities' : undefined;
|
|
17
|
+
delete args.view;
|
|
18
|
+
}
|
|
19
|
+
else if (request.type !== 'menu.action' || ['status', 'capabilities'].includes(action)) {
|
|
20
|
+
throw templateError('INVALID_ARGUMENT', 'Use the defined template Menu action or query');
|
|
21
|
+
}
|
|
22
|
+
if (!TEMPLATE_ACTIONS.includes(action))
|
|
23
|
+
throw templateError('INVALID_ARGUMENT', 'Unknown template action');
|
|
24
|
+
const normalize = templateContract.normalizeTemplateRequest;
|
|
25
|
+
if (!normalize)
|
|
26
|
+
throw templateError('RECOVERY_REQUIRED', 'Template contract update is in progress');
|
|
27
|
+
const normalized = normalize({ requestId: request.id ?? 'validation', action, args });
|
|
28
|
+
return { action, args: normalized.args };
|
|
29
|
+
}
|
|
13
30
|
export function validateTemplateRequest(request) {
|
|
14
31
|
try {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (value.providers !== undefined && !record(value.providers)
|
|
19
|
-
|| value.externalAids !== undefined && (!record(value.externalAids)
|
|
20
|
-
|| Object.entries(value.externalAids).some(([from, to]) => !isValidAid(from) || typeof to !== 'string' || !isValidAid(to)))) {
|
|
21
|
-
throw new Error('Invalid member Provider or external AID selections');
|
|
22
|
-
}
|
|
23
|
-
for (const [name, selection] of Object.entries(value.providers ?? {})) {
|
|
24
|
-
if (!['claude', 'codex', 'ecagent', 'gemini'].includes(name) || !record(selection)
|
|
25
|
-
|| Object.keys(selection).some(k => !['provider', 'model', 'effort'].includes(k))
|
|
26
|
-
|| !/^provider-\d{8}$/.test(selection.provider) || selection.model !== undefined && (typeof selection.model !== 'string' || !selection.model.trim())
|
|
27
|
-
|| selection.effort !== undefined && selection.effort !== null && !['low', 'medium', 'high', 'xhigh', 'max'].includes(selection.effort)) {
|
|
28
|
-
throw new Error('Invalid Provider/model/effort selection');
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const args = request.args;
|
|
33
|
-
if (!args || typeof args !== 'object' || Array.isArray(args))
|
|
34
|
-
throw new Error('args object required');
|
|
35
|
-
let allowed;
|
|
36
|
-
if (args.view === 'template-job') {
|
|
37
|
-
if (request.type !== 'menu.query' || !!args.jobId === !!args.requestId)
|
|
38
|
-
throw new Error('Use query with jobId or requestId');
|
|
39
|
-
if (args.jobId !== undefined && !/^job_[a-f0-9-]{36}$/.test(args.jobId)
|
|
40
|
-
|| args.requestId !== undefined && (typeof args.requestId !== 'string' || !args.requestId.trim() || args.requestId.length > 200))
|
|
41
|
-
throw new Error('Invalid task identifier');
|
|
42
|
-
allowed = ['view', 'jobId', 'requestId'];
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
if (request.type !== 'menu.action')
|
|
46
|
-
throw new Error('Template actions use menu.action');
|
|
47
|
-
const fields = { inspect: ['aid'], build: ['aid', 'template', 'include'],
|
|
48
|
-
push: ['buildId', 'ownerAid', 'targetPath', 'releasedFindings'], pull: ['location', 'download', 'digest', 'targetAid', 'targets'],
|
|
49
|
-
deploy: ['pullId', 'providers', 'externalAids', 'members'] };
|
|
50
|
-
allowed = fields[request.action];
|
|
51
|
-
if (!allowed)
|
|
52
|
-
throw new Error('Unsupported template action');
|
|
53
|
-
if (['inspect', 'build'].includes(request.action) && !isValidAid(args.aid))
|
|
54
|
-
throw new Error('aid required');
|
|
55
|
-
if (request.action === 'build' && (!args.template?.version || !args.template?.name || !args.include))
|
|
56
|
-
throw new Error('template.version/name and include required');
|
|
57
|
-
if (request.action === 'pull' && (!isValidAid(args.location?.aid)
|
|
58
|
-
|| typeof args.location?.path !== 'string' || !args.location.path.startsWith('/templates/')
|
|
59
|
-
|| !/^[A-Za-z0-9]{10}$/.test(args.download?.shareId) || !/^sha256:[a-f0-9]{64}$/.test(args.digest)))
|
|
60
|
-
throw new Error('Invalid package location, shareId, digest or targetAid');
|
|
61
|
-
if (request.action === 'pull') {
|
|
62
|
-
if (args.targets === undefined) {
|
|
63
|
-
if (!isValidAid(args.targetAid))
|
|
64
|
-
throw new Error('targetAid or targets mapping required');
|
|
65
|
-
}
|
|
66
|
-
else if (args.targetAid !== undefined || !record(args.targets) || !Object.keys(args.targets).length
|
|
67
|
-
|| Object.entries(args.targets).some(([key, aid]) => !memberKey(key) || typeof aid !== 'string' || !isValidAid(aid))
|
|
68
|
-
|| new Set(Object.values(args.targets)).size !== Object.keys(args.targets).length) {
|
|
69
|
-
throw new Error('Map members to distinct existing Agent AIDs; do not mix targetAid and targets');
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (request.action === 'push' && (!/^build_[a-f0-9-]{36}$/.test(args.buildId) || !isValidAid(args.ownerAid)
|
|
73
|
-
|| typeof args.targetPath !== 'string' || !args.targetPath.startsWith('/templates/')
|
|
74
|
-
|| args.releasedFindings !== undefined && (!Array.isArray(args.releasedFindings) || !args.releasedFindings.every((f) => typeof f === 'string'))))
|
|
75
|
-
throw new Error('Invalid push arguments');
|
|
76
|
-
if (request.action === 'deploy' && (!/^pull_[a-f0-9-]{36}$/.test(args.pullId)
|
|
77
|
-
|| args.providers !== undefined && (!args.providers || typeof args.providers !== 'object' || Array.isArray(args.providers))
|
|
78
|
-
|| args.externalAids !== undefined && (!args.externalAids || typeof args.externalAids !== 'object' || Array.isArray(args.externalAids)
|
|
79
|
-
|| Object.entries(args.externalAids).some(([from, to]) => !isValidAid(from) || typeof to !== 'string' || !isValidAid(to)))))
|
|
80
|
-
throw new Error('Invalid deploy arguments');
|
|
81
|
-
if (request.action === 'deploy') {
|
|
82
|
-
validateSelections(args);
|
|
83
|
-
if (args.members !== undefined) {
|
|
84
|
-
if (!record(args.members) || args.providers !== undefined || args.externalAids !== undefined)
|
|
85
|
-
throw new Error('Use members or single-Agent selections');
|
|
86
|
-
for (const [key, selection] of Object.entries(args.members)) {
|
|
87
|
-
if (!memberKey(key) || !record(selection) || Object.keys(selection).some(k => !['providers', 'externalAids'].includes(k))) {
|
|
88
|
-
throw new Error('Invalid member selection');
|
|
89
|
-
}
|
|
90
|
-
validateSelections(selection);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (Object.keys(args).some(k => !allowed.includes(k)))
|
|
96
|
-
throw new Error('Unknown template argument');
|
|
97
|
-
if (request.agent !== undefined)
|
|
98
|
-
throw new Error('Use action target fields, not top-level agent');
|
|
32
|
+
if (!isTemplateRequest(request) || request.agent !== undefined)
|
|
33
|
+
throw templateError('INVALID_ARGUMENT', 'Template is a process operation');
|
|
34
|
+
templateMenuAction(request);
|
|
99
35
|
return null;
|
|
100
36
|
}
|
|
101
37
|
catch (error) {
|
|
@@ -104,24 +40,23 @@ export function validateTemplateRequest(request) {
|
|
|
104
40
|
}
|
|
105
41
|
export async function executeTemplateMenu(request, subject, source) {
|
|
106
42
|
try {
|
|
107
|
-
const
|
|
108
|
-
if (invalid)
|
|
109
|
-
throw templateError(invalid.code, invalid.message);
|
|
43
|
+
const { action, args } = templateMenuAction(request);
|
|
110
44
|
if (!subject?.fromControlChannel || !subject.isDaemonOwner || !subject.principalId
|
|
111
45
|
|| subject.processRole === 'daemon-service' || !subject.ecwebManagement && subject.menuEncrypted !== true) {
|
|
112
|
-
throw templateError('NOT_ALLOWED', 'Template operations require an encrypted DaemonOwner Control request'
|
|
46
|
+
throw templateError('NOT_ALLOWED', 'Template operations require an encrypted DaemonOwner Control request');
|
|
113
47
|
}
|
|
114
|
-
|
|
48
|
+
if (Object.values(args.members ?? {}).some((member) => member.source?.kind === 'directory')
|
|
49
|
+
|| args.source?.kind === 'file')
|
|
50
|
+
throw templateError('INVALID_ARGUMENT', 'Remote template calls cannot read host paths');
|
|
115
51
|
const decision = await authorizeFreshOperation({ source, subject,
|
|
116
|
-
intent: { operation, scope: 'process', source, args
|
|
52
|
+
intent: { operation: 'agent.template.' + action, scope: 'process', source, args } });
|
|
117
53
|
if (!decision.allow)
|
|
118
54
|
throw templateError('NOT_ALLOWED', 'Template operation denied');
|
|
119
|
-
|
|
120
|
-
return { data: request.type === 'menu.query' ? await service.query(subject.principalId, request.args)
|
|
121
|
-
: await service.action(subject.principalId, request.id, request.action, request.args) };
|
|
55
|
+
return { data: await getAgentTemplateService().action(subject.principalId, request.id, action, args) };
|
|
122
56
|
}
|
|
123
57
|
catch (error) {
|
|
124
|
-
return { error: error.message, code: error.code ?? 'TEMPLATE_FAILED',
|
|
58
|
+
return { error: error.message, code: error.code ?? 'TEMPLATE_FAILED',
|
|
59
|
+
...(error.details ? { data: error.details } : {}) };
|
|
125
60
|
}
|
|
126
61
|
}
|
|
127
62
|
export async function executeProviderModelCatalog(request, subject, source) {
|