@solidxai/core 0.1.19 → 0.1.20-beta.1
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 +16 -0
- package/dist/controllers/agent-hub-tag.controller.d.ts +24 -0
- package/dist/controllers/agent-hub-tag.controller.d.ts.map +1 -0
- package/dist/controllers/agent-hub-tag.controller.js +175 -0
- package/dist/controllers/agent-hub-tag.controller.js.map +1 -0
- package/dist/controllers/agent-tool-registry.controller.d.ts +18 -0
- package/dist/controllers/agent-tool-registry.controller.d.ts.map +1 -1
- package/dist/controllers/agent-tool-registry.controller.js +13 -0
- package/dist/controllers/agent-tool-registry.controller.js.map +1 -1
- package/dist/dtos/create-agent-hub-tag.dto.d.ts +16 -0
- package/dist/dtos/create-agent-hub-tag.dto.d.ts.map +1 -0
- package/dist/dtos/create-agent-hub-tag.dto.js +98 -0
- package/dist/dtos/create-agent-hub-tag.dto.js.map +1 -0
- package/dist/dtos/create-agent-registry.dto.d.ts +4 -0
- package/dist/dtos/create-agent-registry.dto.d.ts.map +1 -1
- package/dist/dtos/create-agent-registry.dto.js +24 -1
- package/dist/dtos/create-agent-registry.dto.js.map +1 -1
- package/dist/dtos/create-agent-skill-registry.dto.d.ts +4 -1
- package/dist/dtos/create-agent-skill-registry.dto.d.ts.map +1 -1
- package/dist/dtos/create-agent-skill-registry.dto.js +21 -5
- package/dist/dtos/create-agent-skill-registry.dto.js.map +1 -1
- package/dist/dtos/create-agent-tool-registry.dto.d.ts +4 -1
- package/dist/dtos/create-agent-tool-registry.dto.d.ts.map +1 -1
- package/dist/dtos/create-agent-tool-registry.dto.js +24 -8
- package/dist/dtos/create-agent-tool-registry.dto.js.map +1 -1
- package/dist/dtos/create-email-template.dto.d.ts +2 -0
- package/dist/dtos/create-email-template.dto.d.ts.map +1 -1
- package/dist/dtos/create-email-template.dto.js +13 -1
- package/dist/dtos/create-email-template.dto.js.map +1 -1
- package/dist/dtos/create-sms-template.dto.d.ts +2 -0
- package/dist/dtos/create-sms-template.dto.d.ts.map +1 -1
- package/dist/dtos/create-sms-template.dto.js +13 -1
- package/dist/dtos/create-sms-template.dto.js.map +1 -1
- package/dist/dtos/update-agent-hub-tag.dto.d.ts +17 -0
- package/dist/dtos/update-agent-hub-tag.dto.d.ts.map +1 -0
- package/dist/dtos/update-agent-hub-tag.dto.js +104 -0
- package/dist/dtos/update-agent-hub-tag.dto.js.map +1 -0
- package/dist/dtos/update-agent-registry.dto.d.ts +4 -0
- package/dist/dtos/update-agent-registry.dto.d.ts.map +1 -1
- package/dist/dtos/update-agent-registry.dto.js +24 -1
- package/dist/dtos/update-agent-registry.dto.js.map +1 -1
- package/dist/dtos/update-agent-skill-registry.dto.d.ts +4 -1
- package/dist/dtos/update-agent-skill-registry.dto.d.ts.map +1 -1
- package/dist/dtos/update-agent-skill-registry.dto.js +20 -4
- package/dist/dtos/update-agent-skill-registry.dto.js.map +1 -1
- package/dist/dtos/update-agent-tool-registry.dto.d.ts +4 -1
- package/dist/dtos/update-agent-tool-registry.dto.d.ts.map +1 -1
- package/dist/dtos/update-agent-tool-registry.dto.js +24 -8
- package/dist/dtos/update-agent-tool-registry.dto.js.map +1 -1
- package/dist/entities/agent-hub-tag.entity.d.ts +11 -0
- package/dist/entities/agent-hub-tag.entity.d.ts.map +1 -0
- package/dist/entities/agent-hub-tag.entity.js +45 -0
- package/dist/entities/agent-hub-tag.entity.js.map +1 -0
- package/dist/entities/agent-human-request.entity.d.ts.map +1 -1
- package/dist/entities/agent-human-request.entity.js +2 -1
- package/dist/entities/agent-human-request.entity.js.map +1 -1
- package/dist/entities/agent-job.entity.d.ts.map +1 -1
- package/dist/entities/agent-job.entity.js +5 -4
- package/dist/entities/agent-job.entity.js.map +1 -1
- package/dist/entities/agent-process.entity.d.ts.map +1 -1
- package/dist/entities/agent-process.entity.js +4 -3
- package/dist/entities/agent-process.entity.js.map +1 -1
- package/dist/entities/agent-registry.entity.d.ts +2 -0
- package/dist/entities/agent-registry.entity.d.ts.map +1 -1
- package/dist/entities/agent-registry.entity.js +7 -1
- package/dist/entities/agent-registry.entity.js.map +1 -1
- package/dist/entities/agent-session.entity.d.ts.map +1 -1
- package/dist/entities/agent-session.entity.js +4 -3
- package/dist/entities/agent-session.entity.js.map +1 -1
- package/dist/entities/agent-skill-registry.entity.d.ts +2 -1
- package/dist/entities/agent-skill-registry.entity.d.ts.map +1 -1
- package/dist/entities/agent-skill-registry.entity.js +5 -4
- package/dist/entities/agent-skill-registry.entity.js.map +1 -1
- package/dist/entities/agent-skill.entity.d.ts.map +1 -1
- package/dist/entities/agent-skill.entity.js +2 -1
- package/dist/entities/agent-skill.entity.js.map +1 -1
- package/dist/entities/agent-tool-registry.entity.d.ts +2 -1
- package/dist/entities/agent-tool-registry.entity.d.ts.map +1 -1
- package/dist/entities/agent-tool-registry.entity.js +7 -6
- package/dist/entities/agent-tool-registry.entity.js.map +1 -1
- package/dist/entities/agent-tool.entity.d.ts.map +1 -1
- package/dist/entities/agent-tool.entity.js +2 -1
- package/dist/entities/agent-tool.entity.js.map +1 -1
- package/dist/entities/email-template.entity.d.ts +2 -0
- package/dist/entities/email-template.entity.d.ts.map +1 -1
- package/dist/entities/email-template.entity.js +8 -1
- package/dist/entities/email-template.entity.js.map +1 -1
- package/dist/entities/secret.entity.js +1 -1
- package/dist/entities/secret.entity.js.map +1 -1
- package/dist/entities/sms-template.entity.d.ts +2 -0
- package/dist/entities/sms-template.entity.d.ts.map +1 -1
- package/dist/entities/sms-template.entity.js +8 -1
- package/dist/entities/sms-template.entity.js.map +1 -1
- package/dist/helpers/typeorm-db-helper.d.ts +1 -0
- package/dist/helpers/typeorm-db-helper.d.ts.map +1 -1
- package/dist/helpers/typeorm-db-helper.js +30 -0
- package/dist/helpers/typeorm-db-helper.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/repository/agent-hub-tag.repository.d.ts +12 -0
- package/dist/repository/agent-hub-tag.repository.d.ts.map +1 -0
- package/dist/repository/agent-hub-tag.repository.js +39 -0
- package/dist/repository/agent-hub-tag.repository.js.map +1 -0
- package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.js +2 -0
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +408 -30
- package/dist/services/agent-hub-tag.service.d.ts +12 -0
- package/dist/services/agent-hub-tag.service.d.ts.map +1 -0
- package/dist/services/agent-hub-tag.service.js +38 -0
- package/dist/services/agent-hub-tag.service.js.map +1 -0
- package/dist/services/agent-tool-registry.service.d.ts +23 -1
- package/dist/services/agent-tool-registry.service.d.ts.map +1 -1
- package/dist/services/agent-tool-registry.service.js +168 -4
- package/dist/services/agent-tool-registry.service.js.map +1 -1
- package/dist/services/agent-tool-registry.service.spec.js +1 -1
- package/dist/services/agent-tool-registry.service.spec.js.map +1 -1
- package/dist/services/secret.service.d.ts +1 -0
- package/dist/services/secret.service.d.ts.map +1 -1
- package/dist/services/secret.service.js +10 -0
- package/dist/services/secret.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +8 -0
- package/dist/solid-core.module.js.map +1 -1
- package/package.json +1 -1
- package/src/controllers/agent-hub-tag.controller.ts +86 -0
- package/src/controllers/agent-tool-registry.controller.ts +6 -0
- package/src/dtos/create-agent-hub-tag.dto.ts +70 -0
- package/src/dtos/create-agent-registry.dto.ts +20 -0
- package/src/dtos/create-agent-skill-registry.dto.ts +19 -4
- package/src/dtos/create-agent-tool-registry.dto.ts +21 -6
- package/src/dtos/create-email-template.dto.ts +11 -1
- package/src/dtos/create-sms-template.dto.ts +11 -1
- package/src/dtos/update-agent-hub-tag.dto.ts +75 -0
- package/src/dtos/update-agent-registry.dto.ts +20 -0
- package/src/dtos/update-agent-skill-registry.dto.ts +17 -3
- package/src/dtos/update-agent-tool-registry.dto.ts +20 -6
- package/src/entities/agent-hub-tag.entity.ts +21 -0
- package/src/entities/agent-human-request.entity.ts +2 -1
- package/src/entities/agent-job.entity.ts +5 -4
- package/src/entities/agent-process.entity.ts +4 -3
- package/src/entities/agent-registry.entity.ts +6 -1
- package/src/entities/agent-session.entity.ts +4 -3
- package/src/entities/agent-skill-registry.entity.ts +5 -3
- package/src/entities/agent-skill.entity.ts +2 -1
- package/src/entities/agent-tool-registry.entity.ts +6 -4
- package/src/entities/agent-tool.entity.ts +2 -1
- package/src/entities/email-template.entity.ts +8 -2
- package/src/entities/secret.entity.ts +1 -1
- package/src/entities/sms-template.entity.ts +8 -2
- package/src/helpers/typeorm-db-helper.ts +34 -0
- package/src/index.ts +6 -0
- package/src/repository/agent-hub-tag.repository.ts +19 -0
- package/src/seeders/module-metadata-seeder.service.ts +6 -0
- package/src/seeders/seed-data/solid-core-metadata.json +408 -30
- package/src/services/agent-hub-tag.service.ts +19 -0
- package/src/services/agent-tool-registry.service.spec.ts +1 -1
- package/src/services/agent-tool-registry.service.ts +161 -1
- package/src/services/secret.service.ts +10 -0
- package/src/solid-core.module.ts +8 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { ModuleRef } from '@nestjs/core';
|
|
3
|
+
import { InjectEntityManager } from '@nestjs/typeorm';
|
|
4
|
+
import { EntityManager } from 'typeorm';
|
|
5
|
+
import { AgentHubTag } from '../entities/agent-hub-tag.entity';
|
|
6
|
+
import { AgentHubTagRepository } from '../repository/agent-hub-tag.repository';
|
|
7
|
+
import { CRUDService } from './crud.service';
|
|
8
|
+
|
|
9
|
+
@Injectable()
|
|
10
|
+
export class AgentHubTagService extends CRUDService<AgentHubTag> {
|
|
11
|
+
constructor(
|
|
12
|
+
@InjectEntityManager('default')
|
|
13
|
+
readonly entityManager: EntityManager,
|
|
14
|
+
readonly repo: AgentHubTagRepository,
|
|
15
|
+
readonly moduleRef: ModuleRef,
|
|
16
|
+
) {
|
|
17
|
+
super(entityManager, repo, 'agentHubTag', 'agent-hub', moduleRef);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -21,7 +21,7 @@ function fixture() {
|
|
|
21
21
|
const repo = { findOne: jest.fn(async () => ({ ...row })) };
|
|
22
22
|
const transaction = { findOne: jest.fn(async () => ({ ...row })), save: jest.fn(async (_entity, saved) => saved) };
|
|
23
23
|
const entityManager = { transaction: jest.fn(async (fn) => fn(transaction)) };
|
|
24
|
-
const service = new AgentToolRegistryService(entityManager as any, repo as any, {} as any);
|
|
24
|
+
const service = new AgentToolRegistryService(entityManager as any, repo as any, {} as any, {} as any);
|
|
25
25
|
return { row, repo, transaction, entityManager, service };
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { ConflictException, Injectable } from '@nestjs/common';
|
|
1
|
+
import { BadRequestException, ConflictException, Injectable, Logger, NotFoundException, ServiceUnavailableException } from '@nestjs/common';
|
|
2
2
|
import { InjectEntityManager } from '@nestjs/typeorm';
|
|
3
3
|
import { ModuleRef } from '@nestjs/core';
|
|
4
4
|
import { EntityManager } from 'typeorm';
|
|
5
5
|
import { createHash } from 'node:crypto';
|
|
6
|
+
import { spawn } from 'node:child_process';
|
|
7
|
+
import { existsSync } from 'node:fs';
|
|
8
|
+
import { homedir, tmpdir } from 'node:os';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { SecretService } from './secret.service';
|
|
6
11
|
import { AgentTool } from '../entities/agent-tool.entity';
|
|
7
12
|
import { AgentConfigCatalogService } from './agent-config-version.service';
|
|
8
13
|
import { AgentToolRegistry } from '../entities/agent-tool-registry.entity';
|
|
@@ -12,11 +17,14 @@ import { UpdateAgentToolRegistryDto } from '../dtos/update-agent-tool-registry.d
|
|
|
12
17
|
|
|
13
18
|
@Injectable()
|
|
14
19
|
export class AgentToolRegistryService extends AgentConfigCatalogService<AgentToolRegistry>{
|
|
20
|
+
private readonly logger = new Logger(AgentToolRegistryService.name);
|
|
21
|
+
|
|
15
22
|
constructor(
|
|
16
23
|
@InjectEntityManager("default")
|
|
17
24
|
readonly entityManager: EntityManager,
|
|
18
25
|
readonly repo: AgentToolRegistryRepository,
|
|
19
26
|
readonly moduleRef: ModuleRef,
|
|
27
|
+
readonly secretService: SecretService,
|
|
20
28
|
) {
|
|
21
29
|
super(entityManager, repo, 'agentToolRegistry', moduleRef, AgentTool, 'agentToolRegistry');
|
|
22
30
|
}
|
|
@@ -33,6 +41,158 @@ export class AgentToolRegistryService extends AgentConfigCatalogService<AgentToo
|
|
|
33
41
|
};
|
|
34
42
|
}
|
|
35
43
|
|
|
44
|
+
private lifecycleRunner(): { python: string; runtimeRoot: string; sourceRoot?: string } {
|
|
45
|
+
const binary = process.platform === 'win32' ? 'python.exe' : 'python';
|
|
46
|
+
const configuredSourceRoot = process.env.SOLIDX_AGENTHUB_RUNTIME_PATH;
|
|
47
|
+
const sourceRoot = configuredSourceRoot
|
|
48
|
+
&& existsSync(join(configuredSourceRoot, 'src', 'agenthub', 'tools', 'tool_lifecycle_check.py'))
|
|
49
|
+
? configuredSourceRoot
|
|
50
|
+
: undefined;
|
|
51
|
+
const candidates = [
|
|
52
|
+
{ root: join(homedir(), '.solidx', 'agenthub-venv'), sourceRoot },
|
|
53
|
+
...(process.env.SOLIDX_AGENTHUB_RUNTIME_PATH
|
|
54
|
+
? [{ root: join(process.env.SOLIDX_AGENTHUB_RUNTIME_PATH, '.venv'), sourceRoot }]
|
|
55
|
+
: []),
|
|
56
|
+
];
|
|
57
|
+
for (const candidate of candidates) {
|
|
58
|
+
const python = join(candidate.root, process.platform === 'win32' ? 'Scripts' : 'bin', binary);
|
|
59
|
+
if (existsSync(python)) return { python, runtimeRoot: candidate.root, sourceRoot: candidate.sourceRoot };
|
|
60
|
+
}
|
|
61
|
+
throw new ServiceUnavailableException('AgentHub runtime virtual environment was not found.');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private lifecycleDatabaseUrl(): string {
|
|
65
|
+
const options = this.entityManager.connection.options as any;
|
|
66
|
+
if (options.type !== 'postgres') {
|
|
67
|
+
throw new ServiceUnavailableException('Tool checks require Core to use PostgreSQL.');
|
|
68
|
+
}
|
|
69
|
+
if (options.url) return options.url;
|
|
70
|
+
const host = String(options.host ?? 'localhost');
|
|
71
|
+
const formattedHost = host.includes(':') && !host.startsWith('[') ? `[${host}]` : host;
|
|
72
|
+
const credentials = options.username
|
|
73
|
+
? `${encodeURIComponent(String(options.username))}:${encodeURIComponent(String(options.password ?? ''))}@`
|
|
74
|
+
: '';
|
|
75
|
+
const ssl = options.ssl ? '?sslmode=require' : '';
|
|
76
|
+
return `postgresql://${credentials}${formattedHost}:${options.port ?? 5432}/${encodeURIComponent(String(options.database))}${ssl}`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private async runLifecycleScript(request: Record<string, unknown>): Promise<Record<string, any>> {
|
|
80
|
+
const runner = this.lifecycleRunner();
|
|
81
|
+
const requestJson = JSON.stringify(request);
|
|
82
|
+
const childEnv = {
|
|
83
|
+
PATH: process.env.PATH ?? '',
|
|
84
|
+
VIRTUAL_ENV: runner.runtimeRoot,
|
|
85
|
+
HOME: homedir(),
|
|
86
|
+
DATABASE_URL: this.lifecycleDatabaseUrl(),
|
|
87
|
+
...(process.env.SYSTEMROOT ? { SYSTEMROOT: process.env.SYSTEMROOT } : {}),
|
|
88
|
+
...(runner.sourceRoot ? { PYTHONPATH: join(runner.sourceRoot, 'src') } : {}),
|
|
89
|
+
};
|
|
90
|
+
return new Promise((resolve, reject) => {
|
|
91
|
+
const child = spawn(runner.python, ['-m', 'agenthub.tools.tool_lifecycle_check'], {
|
|
92
|
+
cwd: runner.sourceRoot ?? tmpdir(),
|
|
93
|
+
env: childEnv,
|
|
94
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
95
|
+
});
|
|
96
|
+
let stdout = '';
|
|
97
|
+
let stderr = '';
|
|
98
|
+
let settled = false;
|
|
99
|
+
const finish = (callback: () => void) => {
|
|
100
|
+
if (settled) return;
|
|
101
|
+
settled = true;
|
|
102
|
+
clearTimeout(timeout);
|
|
103
|
+
callback();
|
|
104
|
+
};
|
|
105
|
+
const timeout = setTimeout(() => {
|
|
106
|
+
child.kill('SIGKILL');
|
|
107
|
+
finish(() => reject(new ServiceUnavailableException('Tool check exceeded the 20 second limit.')));
|
|
108
|
+
}, 20_000);
|
|
109
|
+
child.stdout.setEncoding('utf8');
|
|
110
|
+
child.stderr.setEncoding('utf8');
|
|
111
|
+
child.stdout.on('data', (chunk: string) => {
|
|
112
|
+
stdout += chunk;
|
|
113
|
+
if (stdout.length > 2_000_000) child.kill('SIGKILL');
|
|
114
|
+
});
|
|
115
|
+
child.stderr.on('data', (chunk: string) => {
|
|
116
|
+
if (stderr.length < 2_000_000) stderr += chunk.slice(0, 2_000_000 - stderr.length);
|
|
117
|
+
});
|
|
118
|
+
child.on('error', (error) => finish(() => reject(new ServiceUnavailableException(`Could not start AgentHub tool checker: ${error.message}`))));
|
|
119
|
+
child.on('close', (code) => finish(() => {
|
|
120
|
+
if (stdout.length > 2_000_000) {
|
|
121
|
+
reject(new BadRequestException('Tool check response was too large.'));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
const result = JSON.parse(stdout.trim());
|
|
126
|
+
if (!result || typeof result !== 'object' || Array.isArray(result)) throw new Error('Invalid response');
|
|
127
|
+
resolve(result);
|
|
128
|
+
} catch {
|
|
129
|
+
reject(new ServiceUnavailableException(`AgentHub tool checker returned an invalid response${code === 0 ? '' : ` (exit ${code})`}. ${stderr.slice(0, 500)}`));
|
|
130
|
+
}
|
|
131
|
+
}));
|
|
132
|
+
child.stdin.end(requestJson);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private async readToolConfig(tool: AgentToolRegistry, checksum: string): Promise<{ success: boolean; message: string; requiredSecrets: string[] }> {
|
|
137
|
+
const result = await this.runLifecycleScript({ tool_id: tool.id, checksum, phase: 'config' });
|
|
138
|
+
const requiredSecrets = result.required_secrets;
|
|
139
|
+
if (result.success !== true || !Array.isArray(requiredSecrets)
|
|
140
|
+
|| requiredSecrets.some((key) => typeof key !== 'string' || !key.trim())
|
|
141
|
+
|| new Set(requiredSecrets).size !== requiredSecrets.length) {
|
|
142
|
+
return { success: false, message: String(result.message ?? 'The tool returned an invalid configuration.'), requiredSecrets: [] };
|
|
143
|
+
}
|
|
144
|
+
return { success: true, message: String(result.message ?? 'Configuration declaration checked.'), requiredSecrets };
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async checkTool(id: number, phase: string, checksum: string) {
|
|
148
|
+
if (phase !== 'config' && phase !== 'init') throw new BadRequestException('Phase must be config or init.');
|
|
149
|
+
const tool = await this.repo.findOne({ where: { id } });
|
|
150
|
+
if (!tool) throw new NotFoundException(`Tool ${id} was not found.`);
|
|
151
|
+
if (!['custom', 'thirdparty'].includes(tool.type)) throw new BadRequestException('Only custom and third-party tools can be checked.');
|
|
152
|
+
const currentChecksum = createHash('sha256').update(tool.sourceCode ?? '', 'utf8').digest('hex');
|
|
153
|
+
if (!checksum || checksum !== currentChecksum) throw new ConflictException('Tool source changed. Save the tool again before running checks.');
|
|
154
|
+
|
|
155
|
+
const config = await this.readToolConfig(tool, currentChecksum);
|
|
156
|
+
if (!config.success) {
|
|
157
|
+
return {
|
|
158
|
+
toolId: id, checksum, phase,
|
|
159
|
+
config: { status: 'failed', message: config.message, requiredSecrets: [], missingSecrets: [] },
|
|
160
|
+
init: { status: 'skipped', message: 'Configuration must pass before initialization can run.' },
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const resolvedSecrets = phase === 'init'
|
|
165
|
+
? await this.secretService.resolveAvailable(config.requiredSecrets)
|
|
166
|
+
: undefined;
|
|
167
|
+
const available = phase === 'config'
|
|
168
|
+
? await this.secretService.findAvailableKeys(config.requiredSecrets)
|
|
169
|
+
: Object.keys(resolvedSecrets ?? {});
|
|
170
|
+
const missingSecrets = config.requiredSecrets.filter((key) => !available.includes(key));
|
|
171
|
+
const configStep = {
|
|
172
|
+
status: missingSecrets.length ? 'failed' : 'passed',
|
|
173
|
+
message: missingSecrets.length ? 'Configure all required active secrets before initializing this tool.' : config.message,
|
|
174
|
+
requiredSecrets: config.requiredSecrets,
|
|
175
|
+
missingSecrets,
|
|
176
|
+
};
|
|
177
|
+
if (missingSecrets.length || phase === 'config') {
|
|
178
|
+
return {
|
|
179
|
+
toolId: id, checksum, phase, config: configStep,
|
|
180
|
+
init: { status: 'skipped', message: missingSecrets.length ? 'Required secrets must be configured first.' : 'Run initialization after configuration passes.' },
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const secretValues = Object.fromEntries(Object.entries(resolvedSecrets ?? {}).map(([key, value]) => [
|
|
185
|
+
key, typeof value === 'string' ? value : JSON.stringify(value),
|
|
186
|
+
]));
|
|
187
|
+
const init = await this.runLifecycleScript({
|
|
188
|
+
tool_id: id, checksum, phase: 'init', secret_values: secretValues,
|
|
189
|
+
});
|
|
190
|
+
return {
|
|
191
|
+
toolId: id, checksum, phase, config: configStep,
|
|
192
|
+
init: { status: init.success === true ? 'passed' : 'failed', message: String(init.message ?? (init.success ? 'Initialization check passed.' : 'Initialization check failed.')) },
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
36
196
|
override async create(createDto: CreateAgentToolRegistryDto, files: Express.Multer.File[] = [], solidRequestContext: any = {}): Promise<AgentToolRegistry> {
|
|
37
197
|
return super.create(this.withChecksum({ ...createDto, status: 'inactive', lastLoadError: null }), files, solidRequestContext);
|
|
38
198
|
}
|
|
@@ -143,6 +143,16 @@ export class SecretService extends CRUDService<Secret> {
|
|
|
143
143
|
}, {} as Record<string, any>);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
async findAvailableKeys(keys: string[]): Promise<string[]> {
|
|
147
|
+
const uniqueKeys = Array.from(new Set((keys ?? []).filter(Boolean)));
|
|
148
|
+
if (uniqueKeys.length === 0) return [];
|
|
149
|
+
const secrets = await this.repo.find({
|
|
150
|
+
where: { key: In(uniqueKeys), status: "active" } as any,
|
|
151
|
+
select: { key: true } as any,
|
|
152
|
+
});
|
|
153
|
+
return secrets.map((secret) => secret.key);
|
|
154
|
+
}
|
|
155
|
+
|
|
146
156
|
/**
|
|
147
157
|
* Resolves several secrets in a single query, returning a flat map keyed by the
|
|
148
158
|
* literal keys requested.
|
package/src/solid-core.module.ts
CHANGED
|
@@ -472,6 +472,7 @@ import { SwitchNode } from './services/workflow/nodes/switch.node';
|
|
|
472
472
|
import { AgentRegistry } from "./entities/agent-registry.entity";
|
|
473
473
|
import { AgentToolRegistry } from "./entities/agent-tool-registry.entity";
|
|
474
474
|
import { AgentSkillRegistry } from "./entities/agent-skill-registry.entity";
|
|
475
|
+
import { AgentHubTag } from "./entities/agent-hub-tag.entity";
|
|
475
476
|
import { AgentTool } from "./entities/agent-tool.entity";
|
|
476
477
|
import { AgentSkill } from "./entities/agent-skill.entity";
|
|
477
478
|
import { AgentSecret } from "./entities/agent-secret.entity";
|
|
@@ -485,6 +486,7 @@ import { AgentRegistryController } from "./controllers/agent-registry.controller
|
|
|
485
486
|
import { AgentEmbedController } from './controllers/agent-embed.controller';
|
|
486
487
|
import { AgentToolRegistryController } from "./controllers/agent-tool-registry.controller";
|
|
487
488
|
import { AgentSkillRegistryController } from "./controllers/agent-skill-registry.controller";
|
|
489
|
+
import { AgentHubTagController } from "./controllers/agent-hub-tag.controller";
|
|
488
490
|
import { AgentToolController } from "./controllers/agent-tool.controller";
|
|
489
491
|
import { AgentSkillController } from "./controllers/agent-skill.controller";
|
|
490
492
|
import { AgentRoleController } from "./controllers/agent-role.controller";
|
|
@@ -507,6 +509,7 @@ import { AgentSecretRepository } from "./repository/agent-secret.repository";
|
|
|
507
509
|
import { AgentSkillRepository } from "./repository/agent-skill.repository";
|
|
508
510
|
import { AgentToolRepository } from "./repository/agent-tool.repository";
|
|
509
511
|
import { AgentSkillRegistryRepository } from "./repository/agent-skill-registry.repository";
|
|
512
|
+
import { AgentHubTagRepository } from "./repository/agent-hub-tag.repository";
|
|
510
513
|
import { AgentToolRegistryRepository } from "./repository/agent-tool-registry.repository";
|
|
511
514
|
import { AgentSessionService } from "./services/agent-session.service";
|
|
512
515
|
import { AgentJobService } from "./services/agent-job.service";
|
|
@@ -518,6 +521,7 @@ import { AgentSecretService } from "./services/agent-secret.service";
|
|
|
518
521
|
import { AgentSkillService } from "./services/agent-skill.service";
|
|
519
522
|
import { AgentToolService } from "./services/agent-tool.service";
|
|
520
523
|
import { AgentSkillRegistryService } from "./services/agent-skill-registry.service";
|
|
524
|
+
import { AgentHubTagService } from "./services/agent-hub-tag.service";
|
|
521
525
|
import { AgentToolRegistryService } from "./services/agent-tool-registry.service";
|
|
522
526
|
|
|
523
527
|
@Global()
|
|
@@ -572,6 +576,7 @@ import { AgentToolRegistryService } from "./services/agent-tool-registry.service
|
|
|
572
576
|
AgentRegistry,
|
|
573
577
|
AgentToolRegistry,
|
|
574
578
|
AgentSkillRegistry,
|
|
579
|
+
AgentHubTag,
|
|
575
580
|
AgentTool,
|
|
576
581
|
AgentSkill,
|
|
577
582
|
AgentRole,
|
|
@@ -719,6 +724,7 @@ import { AgentToolRegistryService } from "./services/agent-tool-registry.service
|
|
|
719
724
|
AgentEmbedController,
|
|
720
725
|
AgentToolRegistryController,
|
|
721
726
|
AgentSkillRegistryController,
|
|
727
|
+
AgentHubTagController,
|
|
722
728
|
AgentToolController,
|
|
723
729
|
AgentSkillController,
|
|
724
730
|
AgentRoleController,
|
|
@@ -1092,6 +1098,8 @@ import { AgentToolRegistryService } from "./services/agent-tool-registry.service
|
|
|
1092
1098
|
AgentToolRegistryRepository,
|
|
1093
1099
|
AgentSkillRegistryService,
|
|
1094
1100
|
AgentSkillRegistryRepository,
|
|
1101
|
+
AgentHubTagService,
|
|
1102
|
+
AgentHubTagRepository,
|
|
1095
1103
|
AgentToolService,
|
|
1096
1104
|
AgentToolRepository,
|
|
1097
1105
|
AgentSkillService,
|