@itphx/synth-backend 0.7.3 → 0.8.3
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/dist/app.d.ts +1 -2
- package/dist/app.js +241 -85
- package/dist/auth/middleware.d.ts +0 -1
- package/dist/auth/middleware.js +0 -1
- package/dist/auth/oidc.d.ts +0 -1
- package/dist/auth/oidc.js +0 -1
- package/dist/events/hub.d.ts +0 -1
- package/dist/events/hub.js +0 -1
- package/dist/lib/app-config.d.ts +0 -1
- package/dist/lib/app-config.js +0 -1
- package/dist/lib/defaults-store.d.ts +0 -1
- package/dist/lib/defaults-store.js +0 -1
- package/dist/lib/i18n-config.d.ts +0 -1
- package/dist/lib/i18n-config.js +0 -1
- package/dist/lib/i18n.d.ts +0 -1
- package/dist/lib/i18n.js +2 -1
- package/dist/lib/recalc-can-summarize.d.ts +15 -0
- package/dist/lib/recalc-can-summarize.js +47 -0
- package/dist/main.d.ts +0 -1
- package/dist/main.js +0 -1
- package/dist/middleware/rate-limiter.d.ts +0 -1
- package/dist/middleware/rate-limiter.js +0 -1
- package/dist/routes/agents.d.ts +8 -4
- package/dist/routes/agents.js +18 -155
- package/dist/routes/audit.d.ts +0 -1
- package/dist/routes/audit.js +0 -1
- package/dist/routes/auth.d.ts +0 -1
- package/dist/routes/auth.js +0 -1
- package/dist/routes/context.d.ts +0 -1
- package/dist/routes/context.js +0 -1
- package/dist/routes/debug.d.ts +0 -1
- package/dist/routes/debug.js +0 -1
- package/dist/routes/gateway-patterns.d.ts +0 -1
- package/dist/routes/gateway-patterns.js +0 -1
- package/dist/routes/llm.d.ts +0 -1
- package/dist/routes/llm.js +0 -1
- package/dist/routes/logs.d.ts +0 -1
- package/dist/routes/logs.js +0 -1
- package/dist/routes/mcp-registry.d.ts +16 -0
- package/dist/routes/mcp-registry.js +359 -0
- package/dist/routes/mcp.d.ts +9 -14
- package/dist/routes/mcp.js +10 -383
- package/dist/routes/messages.d.ts +5 -1
- package/dist/routes/messages.js +15 -154
- package/dist/routes/models.d.ts +3 -3
- package/dist/routes/models.js +7 -169
- package/dist/routes/projects.d.ts +24 -4
- package/dist/routes/projects.js +53 -217
- package/dist/routes/providers.d.ts +1 -2
- package/dist/routes/providers.js +0 -1
- package/dist/routes/queue.d.ts +4 -1
- package/dist/routes/queue.js +11 -139
- package/dist/routes/sessions.d.ts +1 -2
- package/dist/routes/sessions.js +4 -2
- package/dist/routes/users.d.ts +0 -1
- package/dist/routes/users.js +0 -1
- package/package.json +4 -5
- package/dist/app.d.ts.map +0 -1
- package/dist/app.js.map +0 -1
- package/dist/auth/middleware.d.ts.map +0 -1
- package/dist/auth/middleware.js.map +0 -1
- package/dist/auth/oidc.d.ts.map +0 -1
- package/dist/auth/oidc.js.map +0 -1
- package/dist/auth/oidc.test.d.ts +0 -2
- package/dist/auth/oidc.test.d.ts.map +0 -1
- package/dist/auth/oidc.test.js +0 -39
- package/dist/auth/oidc.test.js.map +0 -1
- package/dist/events/hub.d.ts.map +0 -1
- package/dist/events/hub.js.map +0 -1
- package/dist/events/hub.test.d.ts +0 -2
- package/dist/events/hub.test.d.ts.map +0 -1
- package/dist/events/hub.test.js +0 -74
- package/dist/events/hub.test.js.map +0 -1
- package/dist/integration/hybrid.integration.test.d.ts +0 -2
- package/dist/integration/hybrid.integration.test.d.ts.map +0 -1
- package/dist/integration/hybrid.integration.test.js +0 -289
- package/dist/integration/hybrid.integration.test.js.map +0 -1
- package/dist/lib/app-config.d.ts.map +0 -1
- package/dist/lib/app-config.js.map +0 -1
- package/dist/lib/defaults-store.d.ts.map +0 -1
- package/dist/lib/defaults-store.js.map +0 -1
- package/dist/lib/defaults-store.test.d.ts +0 -2
- package/dist/lib/defaults-store.test.d.ts.map +0 -1
- package/dist/lib/defaults-store.test.js +0 -168
- package/dist/lib/defaults-store.test.js.map +0 -1
- package/dist/lib/git-service.d.ts +0 -15
- package/dist/lib/git-service.d.ts.map +0 -1
- package/dist/lib/git-service.js +0 -215
- package/dist/lib/git-service.js.map +0 -1
- package/dist/lib/i18n-config.d.ts.map +0 -1
- package/dist/lib/i18n-config.js.map +0 -1
- package/dist/lib/i18n.d.ts.map +0 -1
- package/dist/lib/i18n.js.map +0 -1
- package/dist/lib/orchestrator-workspace.test.d.ts +0 -2
- package/dist/lib/orchestrator-workspace.test.d.ts.map +0 -1
- package/dist/lib/orchestrator-workspace.test.js +0 -85
- package/dist/lib/orchestrator-workspace.test.js.map +0 -1
- package/dist/lib/workspace-resolver.d.ts +0 -26
- package/dist/lib/workspace-resolver.d.ts.map +0 -1
- package/dist/lib/workspace-resolver.js +0 -249
- package/dist/lib/workspace-resolver.js.map +0 -1
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js.map +0 -1
- package/dist/middleware/rate-limiter.d.ts.map +0 -1
- package/dist/middleware/rate-limiter.js.map +0 -1
- package/dist/routes/agents.d.ts.map +0 -1
- package/dist/routes/agents.js.map +0 -1
- package/dist/routes/agents.test.d.ts +0 -2
- package/dist/routes/agents.test.d.ts.map +0 -1
- package/dist/routes/agents.test.js +0 -211
- package/dist/routes/agents.test.js.map +0 -1
- package/dist/routes/audit.d.ts.map +0 -1
- package/dist/routes/audit.js.map +0 -1
- package/dist/routes/audit.test.d.ts +0 -2
- package/dist/routes/audit.test.d.ts.map +0 -1
- package/dist/routes/audit.test.js +0 -285
- package/dist/routes/audit.test.js.map +0 -1
- package/dist/routes/auth.d.ts.map +0 -1
- package/dist/routes/auth.js.map +0 -1
- package/dist/routes/auth.test.d.ts +0 -2
- package/dist/routes/auth.test.d.ts.map +0 -1
- package/dist/routes/auth.test.js +0 -63
- package/dist/routes/auth.test.js.map +0 -1
- package/dist/routes/context.d.ts.map +0 -1
- package/dist/routes/context.js.map +0 -1
- package/dist/routes/debug.d.ts.map +0 -1
- package/dist/routes/debug.js.map +0 -1
- package/dist/routes/debug.test.d.ts +0 -2
- package/dist/routes/debug.test.d.ts.map +0 -1
- package/dist/routes/debug.test.js +0 -102
- package/dist/routes/debug.test.js.map +0 -1
- package/dist/routes/fs.d.ts +0 -5
- package/dist/routes/fs.d.ts.map +0 -1
- package/dist/routes/fs.js +0 -391
- package/dist/routes/fs.js.map +0 -1
- package/dist/routes/gateway-patterns.d.ts.map +0 -1
- package/dist/routes/gateway-patterns.js.map +0 -1
- package/dist/routes/gateway-patterns.test.d.ts +0 -2
- package/dist/routes/gateway-patterns.test.d.ts.map +0 -1
- package/dist/routes/gateway-patterns.test.js +0 -176
- package/dist/routes/gateway-patterns.test.js.map +0 -1
- package/dist/routes/git.d.ts +0 -5
- package/dist/routes/git.d.ts.map +0 -1
- package/dist/routes/git.js +0 -105
- package/dist/routes/git.js.map +0 -1
- package/dist/routes/llm.d.ts.map +0 -1
- package/dist/routes/llm.js.map +0 -1
- package/dist/routes/llm.test.d.ts +0 -2
- package/dist/routes/llm.test.d.ts.map +0 -1
- package/dist/routes/llm.test.js +0 -629
- package/dist/routes/llm.test.js.map +0 -1
- package/dist/routes/logs.d.ts.map +0 -1
- package/dist/routes/logs.js.map +0 -1
- package/dist/routes/logs.test.d.ts +0 -2
- package/dist/routes/logs.test.d.ts.map +0 -1
- package/dist/routes/logs.test.js +0 -269
- package/dist/routes/logs.test.js.map +0 -1
- package/dist/routes/mcp-network-policy.integration.test.d.ts +0 -2
- package/dist/routes/mcp-network-policy.integration.test.d.ts.map +0 -1
- package/dist/routes/mcp-network-policy.integration.test.js +0 -44
- package/dist/routes/mcp-network-policy.integration.test.js.map +0 -1
- package/dist/routes/mcp-registry.test.d.ts +0 -2
- package/dist/routes/mcp-registry.test.d.ts.map +0 -1
- package/dist/routes/mcp-registry.test.js +0 -247
- package/dist/routes/mcp-registry.test.js.map +0 -1
- package/dist/routes/mcp.d.ts.map +0 -1
- package/dist/routes/mcp.js.map +0 -1
- package/dist/routes/mcp.test.d.ts +0 -2
- package/dist/routes/mcp.test.d.ts.map +0 -1
- package/dist/routes/mcp.test.js +0 -388
- package/dist/routes/mcp.test.js.map +0 -1
- package/dist/routes/messages.d.ts.map +0 -1
- package/dist/routes/messages.js.map +0 -1
- package/dist/routes/models.d.ts.map +0 -1
- package/dist/routes/models.js.map +0 -1
- package/dist/routes/models.test.d.ts +0 -2
- package/dist/routes/models.test.d.ts.map +0 -1
- package/dist/routes/models.test.js +0 -449
- package/dist/routes/models.test.js.map +0 -1
- package/dist/routes/projects-mcp.test.d.ts +0 -6
- package/dist/routes/projects-mcp.test.d.ts.map +0 -1
- package/dist/routes/projects-mcp.test.js +0 -160
- package/dist/routes/projects-mcp.test.js.map +0 -1
- package/dist/routes/projects.d.ts.map +0 -1
- package/dist/routes/projects.js.map +0 -1
- package/dist/routes/projects.test.d.ts +0 -2
- package/dist/routes/projects.test.d.ts.map +0 -1
- package/dist/routes/projects.test.js +0 -250
- package/dist/routes/projects.test.js.map +0 -1
- package/dist/routes/providers.d.ts.map +0 -1
- package/dist/routes/providers.js.map +0 -1
- package/dist/routes/providers.test.d.ts +0 -2
- package/dist/routes/providers.test.d.ts.map +0 -1
- package/dist/routes/providers.test.js +0 -211
- package/dist/routes/providers.test.js.map +0 -1
- package/dist/routes/queue.d.ts.map +0 -1
- package/dist/routes/queue.js.map +0 -1
- package/dist/routes/queue.test.d.ts +0 -2
- package/dist/routes/queue.test.d.ts.map +0 -1
- package/dist/routes/queue.test.js +0 -224
- package/dist/routes/queue.test.js.map +0 -1
- package/dist/routes/sessions-mcp.test.d.ts +0 -6
- package/dist/routes/sessions-mcp.test.d.ts.map +0 -1
- package/dist/routes/sessions-mcp.test.js +0 -182
- package/dist/routes/sessions-mcp.test.js.map +0 -1
- package/dist/routes/sessions.d.ts.map +0 -1
- package/dist/routes/sessions.js.map +0 -1
- package/dist/routes/sessions.test.d.ts +0 -2
- package/dist/routes/sessions.test.d.ts.map +0 -1
- package/dist/routes/sessions.test.js +0 -602
- package/dist/routes/sessions.test.js.map +0 -1
- package/dist/routes/settings.test.d.ts +0 -2
- package/dist/routes/settings.test.d.ts.map +0 -1
- package/dist/routes/settings.test.js +0 -184
- package/dist/routes/settings.test.js.map +0 -1
- package/dist/routes/users.d.ts.map +0 -1
- package/dist/routes/users.js.map +0 -1
- package/dist/storage/json-store.d.ts +0 -20
- package/dist/storage/json-store.d.ts.map +0 -1
- package/dist/storage/json-store.js +0 -100
- package/dist/storage/json-store.js.map +0 -1
- package/dist/storage/json-store.test.d.ts +0 -2
- package/dist/storage/json-store.test.d.ts.map +0 -1
- package/dist/storage/json-store.test.js +0 -59
- package/dist/storage/json-store.test.js.map +0 -1
- package/dist/storage/project-store.d.ts +0 -30
- package/dist/storage/project-store.d.ts.map +0 -1
- package/dist/storage/project-store.js +0 -109
- package/dist/storage/project-store.js.map +0 -1
package/dist/main.d.ts
CHANGED
package/dist/main.js
CHANGED
package/dist/routes/agents.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
import type { AuthKit } from '../auth/middleware.js';
|
|
3
|
-
import { JsonStore } from '
|
|
3
|
+
import { JsonStore } from '@itphx/synth-core';
|
|
4
4
|
import type { AgentDefinition } from '@itphx/synth-shared';
|
|
5
|
-
import type { AgentRegistry
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import type { AgentRegistry } from '@itphx/synth-core';
|
|
6
|
+
/**
|
|
7
|
+
* Backend-обёртка над core-фабрикой агентов: добавляет только RBAC
|
|
8
|
+
* (админ-эндпоинты — ADMIN) и i18n-сообщения. Логика роутов
|
|
9
|
+
* (GET /, GET /all, POST /, GET /:id, DELETE /:id, PATCH /:id/enabled) — в core.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createAgentRoutes(kit: AuthKit, agentStore: JsonStore<AgentDefinition>, agentRegistry?: AgentRegistry, getDefaultAgentId?: () => string | Promise<string>): Hono;
|
package/dist/routes/agents.js
CHANGED
|
@@ -1,160 +1,23 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
-
import {
|
|
2
|
+
import { createAgentRoutes as createCoreAgentRoutes } from '@itphx/synth-core';
|
|
3
3
|
import { t } from '../lib/i18n.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const override = await agentStore.load(builtin.id);
|
|
11
|
-
if (!override)
|
|
12
|
-
return builtin;
|
|
13
|
-
return { ...builtin, ...override, isOverridden: true };
|
|
14
|
-
}
|
|
15
|
-
const AGENT_FIELDS = (a) => ({
|
|
16
|
-
id: a.id,
|
|
17
|
-
display_name: a.displayName,
|
|
18
|
-
capabilities: a.capabilities,
|
|
19
|
-
enabled: a.enabled,
|
|
20
|
-
icon: a.icon || null,
|
|
21
|
-
color: a.color || null,
|
|
22
|
-
description: a.description || null,
|
|
23
|
-
available: true,
|
|
24
|
-
mode: 'simple',
|
|
25
|
-
agent_mode: normalizeAgentModes(a.agentMode),
|
|
26
|
-
subagent_prompt: a.subagentPrompt || null,
|
|
27
|
-
max_steps: a.maxSteps ?? null,
|
|
28
|
-
provider: a.provider || null,
|
|
29
|
-
model: a.model || null,
|
|
30
|
-
reasoning_level: a.reasoningLevel ?? null,
|
|
31
|
-
context_file: a.contextFile || null,
|
|
32
|
-
is_builtin: BUILTIN_IDS.has(a.id),
|
|
33
|
-
is_overridden: a.isOverridden,
|
|
34
|
-
});
|
|
35
|
-
export function createAgentRoutes(kit, agentStore, sessionManager, agentRegistry, getDefaultAgentId) {
|
|
4
|
+
/**
|
|
5
|
+
* Backend-обёртка над core-фабрикой агентов: добавляет только RBAC
|
|
6
|
+
* (админ-эндпоинты — ADMIN) и i18n-сообщения. Логика роутов
|
|
7
|
+
* (GET /, GET /all, POST /, GET /:id, DELETE /:id, PATCH /:id/enabled) — в core.
|
|
8
|
+
*/
|
|
9
|
+
export function createAgentRoutes(kit, agentStore, agentRegistry, getDefaultAgentId) {
|
|
36
10
|
const app = new Hono();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
// GET /api/v2/agents/all — все агенты (для админки).
|
|
50
|
-
// ВАЖНО: регистрируется ДО app.get('/:id', ...), иначе 'all' попадёт в :id.
|
|
51
|
-
app.get('/all', kit.requireAdmin, async (c) => {
|
|
52
|
-
const agents = await resolveAgents();
|
|
53
|
-
return c.json({
|
|
54
|
-
agents: agents.map(AGENT_FIELDS),
|
|
55
|
-
default_agent: (await getDefaultAgentId?.()) ?? DEFAULT_AGENT_ID,
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
// GET /api/v2/agents — только основные агенты (класс primary)
|
|
59
|
-
app.get('/', kit.requireAuth, async (c) => {
|
|
60
|
-
const agents = await resolveAgents();
|
|
61
|
-
return c.json({
|
|
62
|
-
agents: agents
|
|
63
|
-
.filter((a) => normalizeAgentModes(a.agentMode).includes('primary'))
|
|
64
|
-
.map(AGENT_FIELDS),
|
|
65
|
-
default_agent: (await getDefaultAgentId?.()) ?? DEFAULT_AGENT_ID,
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
// POST /api/v2/agents — создать/обновить агента (admin)
|
|
69
|
-
app.post('/', kit.requireAdmin, async (c) => {
|
|
70
|
-
const body = await c.req.json().catch(() => ({}));
|
|
71
|
-
const id = body.id?.trim();
|
|
72
|
-
if (!id) {
|
|
73
|
-
return c.json({ error: { code: 'VALIDATION_ERROR', message: t('errors.validation.idRequired', undefined, c) } }, 400);
|
|
74
|
-
}
|
|
75
|
-
if (!AGENT_ID_REGEX.test(id)) {
|
|
76
|
-
return c.json({ error: { code: 'VALIDATION_ERROR', message: t('errors.validation.invalidAgentId', undefined, c) } }, 400);
|
|
77
|
-
}
|
|
78
|
-
const builtins = getBuiltInAgents();
|
|
79
|
-
const builtin = builtins.find((a) => a.id === id);
|
|
80
|
-
const existing = await agentStore.load(id);
|
|
81
|
-
const agent = {
|
|
82
|
-
id,
|
|
83
|
-
displayName: body.display_name ?? body.displayName ?? existing?.displayName ?? builtin?.displayName ?? id,
|
|
84
|
-
contextFile: body.context_file ?? body.contextFile ?? existing?.contextFile,
|
|
85
|
-
capabilities: body.capabilities ?? existing?.capabilities ?? builtin?.capabilities ?? [],
|
|
86
|
-
enabled: body.enabled ?? existing?.enabled ?? builtin?.enabled ?? true,
|
|
87
|
-
provider: body.provider ?? existing?.provider,
|
|
88
|
-
model: body.model ?? existing?.model,
|
|
89
|
-
temperature: body.temperature ?? existing?.temperature,
|
|
90
|
-
topP: body.top_p ?? body.topP ?? existing?.topP,
|
|
91
|
-
topK: body.top_k ?? body.topK ?? existing?.topK,
|
|
92
|
-
reasoningLevel: body.reasoning_level ?? body.reasoningLevel ?? existing?.reasoningLevel ?? builtin?.reasoningLevel,
|
|
93
|
-
sshKeys: body.ssh_keys ?? body.sshKeys ?? existing?.sshKeys ?? [],
|
|
94
|
-
isOverridden: true,
|
|
95
|
-
icon: body.icon ?? existing?.icon,
|
|
96
|
-
color: body.color ?? existing?.color,
|
|
97
|
-
description: body.description ?? existing?.description,
|
|
98
|
-
agentMode: normalizeAgentModes(body.agent_mode ?? body.agentMode ?? existing?.agentMode ?? builtin?.agentMode),
|
|
99
|
-
subagentPrompt: body.subagent_prompt ?? body.subagentPrompt ?? existing?.subagentPrompt,
|
|
100
|
-
maxSteps: body.max_steps ?? body.maxSteps ?? existing?.maxSteps,
|
|
101
|
-
};
|
|
102
|
-
await agentStore.save(id, agent);
|
|
103
|
-
agentRegistry?.register(agent);
|
|
104
|
-
return c.json(agent, existing ? 200 : 201);
|
|
105
|
-
});
|
|
106
|
-
// GET /api/v2/agents/:id — получить агента
|
|
107
|
-
app.get('/:id', kit.requireAdmin, async (c) => {
|
|
108
|
-
const id = c.req.param('id');
|
|
109
|
-
const override = await agentStore.load(id);
|
|
110
|
-
const builtins = getBuiltInAgents();
|
|
111
|
-
const builtin = builtins.find((a) => a.id === id);
|
|
112
|
-
if (!override && !builtin) {
|
|
113
|
-
return c.json({ error: { code: 'NOT_FOUND', message: t('errors.notFound.agent', undefined, c) } }, 404);
|
|
114
|
-
}
|
|
115
|
-
const agent = override ? { ...builtin, ...override } : builtin;
|
|
116
|
-
return c.json(agent);
|
|
117
|
-
});
|
|
118
|
-
// DELETE /api/v2/agents/:id — удалить custom / сбросить built-in (admin)
|
|
119
|
-
app.delete('/:id', kit.requireAdmin, async (c) => {
|
|
120
|
-
const id = c.req.param('id');
|
|
121
|
-
const isBuiltin = BUILTIN_IDS.has(id);
|
|
122
|
-
const exists = await agentStore.exists(id);
|
|
123
|
-
if (isBuiltin) {
|
|
124
|
-
if (exists) {
|
|
125
|
-
await agentStore.delete(id);
|
|
126
|
-
const builtin = getBuiltInAgents().find((a) => a.id === id);
|
|
127
|
-
if (builtin)
|
|
128
|
-
agentRegistry?.register(builtin);
|
|
129
|
-
return c.json({ status: 'reset' });
|
|
130
|
-
}
|
|
131
|
-
return c.json({ error: { code: 'NOT_FOUND', message: t('errors.notFound.agentOverride', undefined, c) } }, 404);
|
|
132
|
-
}
|
|
133
|
-
if (exists) {
|
|
134
|
-
await agentStore.delete(id);
|
|
135
|
-
agentRegistry?.unregister(id);
|
|
136
|
-
return c.json({ status: 'deleted' });
|
|
137
|
-
}
|
|
138
|
-
return c.json({ error: { code: 'NOT_FOUND', message: t('errors.notFound.agent', undefined, c) } }, 404);
|
|
139
|
-
});
|
|
140
|
-
// PATCH /api/v2/agents/:id/enabled — переключить enabled (admin)
|
|
141
|
-
app.patch('/:id/enabled', kit.requireAdmin, async (c) => {
|
|
142
|
-
const id = c.req.param('id');
|
|
143
|
-
const body = await c.req.json().catch(() => ({}));
|
|
144
|
-
const enabled = body.enabled ?? true;
|
|
145
|
-
const builtins = getBuiltInAgents();
|
|
146
|
-
const builtin = builtins.find((a) => a.id === id);
|
|
147
|
-
const existing = await agentStore.load(id);
|
|
148
|
-
if (!builtin && !existing) {
|
|
149
|
-
return c.json({ error: { code: 'NOT_FOUND', message: t('errors.notFound.agent', undefined, c) } }, 404);
|
|
150
|
-
}
|
|
151
|
-
const agent = existing
|
|
152
|
-
? { ...existing, enabled }
|
|
153
|
-
: { ...builtin, enabled, isOverridden: true };
|
|
154
|
-
await agentStore.save(id, agent);
|
|
155
|
-
agentRegistry?.register(agent);
|
|
156
|
-
return c.json({ id, enabled });
|
|
157
|
-
});
|
|
11
|
+
app.route('/', createCoreAgentRoutes({ requireAuth: kit.requireAuth }, agentStore, agentRegistry, getDefaultAgentId, {
|
|
12
|
+
writeGuard: kit.requireAdmin,
|
|
13
|
+
allGuard: kit.requireAdmin,
|
|
14
|
+
detailGuard: kit.requireAdmin,
|
|
15
|
+
messages: {
|
|
16
|
+
idRequired: (c) => t('errors.validation.idRequired', undefined, c),
|
|
17
|
+
invalidAgentId: (c) => t('errors.validation.invalidAgentId', undefined, c),
|
|
18
|
+
agentNotFound: (c) => t('errors.notFound.agent', undefined, c),
|
|
19
|
+
agentOverrideNotFound: (c) => t('errors.notFound.agentOverride', undefined, c),
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
158
22
|
return app;
|
|
159
23
|
}
|
|
160
|
-
//# sourceMappingURL=agents.js.map
|
package/dist/routes/audit.d.ts
CHANGED
package/dist/routes/audit.js
CHANGED
package/dist/routes/auth.d.ts
CHANGED
|
@@ -4,4 +4,3 @@ import type { AuthConfig } from '@itphx/synth-shared';
|
|
|
4
4
|
import type { ProfileStore } from '@itphx/synth-shared';
|
|
5
5
|
import type { DefaultsStore } from '../lib/defaults-store.js';
|
|
6
6
|
export declare function createAuthRoutes(kit: AuthKit, config: AuthConfig, profiles?: ProfileStore, dataDir?: string, defaultsStore?: DefaultsStore | null): Hono;
|
|
7
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/dist/routes/auth.js
CHANGED
package/dist/routes/context.d.ts
CHANGED
package/dist/routes/context.js
CHANGED
package/dist/routes/debug.d.ts
CHANGED
package/dist/routes/debug.js
CHANGED
|
@@ -7,4 +7,3 @@ import type { SecretPatternStore } from '@itphx/synth-core';
|
|
|
7
7
|
* DELETE сбрасывает к встроенным паттернам. Только ADMIN.
|
|
8
8
|
*/
|
|
9
9
|
export declare function createGatewayPatternsRoutes(kit: AuthKit, store: SecretPatternStore): Hono;
|
|
10
|
-
//# sourceMappingURL=gateway-patterns.d.ts.map
|
package/dist/routes/llm.d.ts
CHANGED
package/dist/routes/llm.js
CHANGED
package/dist/routes/logs.d.ts
CHANGED
package/dist/routes/logs.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import type { AuthKit } from '../auth/middleware.js';
|
|
3
|
+
import type { SessionManager, McpManager, McpRegistryStore } from '@itphx/synth-core';
|
|
4
|
+
import type { McpNetworkPolicy } from '@itphx/synth-shared';
|
|
5
|
+
export interface McpRoutesOptions {
|
|
6
|
+
/** AD-071 §2.5: единый реестр MCP-серверов (источник истины для `/servers` и `/registry`). */
|
|
7
|
+
registry: McpRegistryStore;
|
|
8
|
+
/** AD-071 §2.3.1: политика сетевого доступа HTTP-серверов. */
|
|
9
|
+
networkPolicy?: McpNetworkPolicy;
|
|
10
|
+
/**
|
|
11
|
+
* AD-071 §2.3.1: динамический источник политики (runtime-настройка из админки).
|
|
12
|
+
* Приоритетнее статической `networkPolicy`; читается на каждый запрос.
|
|
13
|
+
*/
|
|
14
|
+
getNetworkPolicy?: () => McpNetworkPolicy | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function createMcpRegistryRoutes(kit: AuthKit, mcpManager: McpManager | null, sessionManager: SessionManager | null, options: McpRoutesOptions): Hono;
|