@itphx/synth-backend 0.12.4 → 0.13.8

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.
Files changed (57) hide show
  1. package/dist/app/deps.d.ts +15 -1
  2. package/dist/app/deps.js +553 -34
  3. package/dist/app/listen.js +56 -7
  4. package/dist/app/mount-routes.js +273 -32
  5. package/dist/app/public-routes.d.ts +2 -0
  6. package/dist/app/public-routes.js +11 -0
  7. package/dist/app/sse-events.d.ts +4 -0
  8. package/dist/app/sse-events.js +53 -6
  9. package/dist/app.d.ts +3 -1
  10. package/dist/app.js +33 -0
  11. package/dist/auth/api-key.d.ts +19 -0
  12. package/dist/auth/api-key.js +56 -0
  13. package/dist/auth/middleware.js +7 -3
  14. package/dist/events/hub.d.ts +17 -0
  15. package/dist/events/hub.js +50 -15
  16. package/dist/init.d.ts +1 -0
  17. package/dist/init.js +96 -0
  18. package/dist/lib/app-config.d.ts +4 -0
  19. package/dist/lib/app-config.js +16 -3
  20. package/dist/lib/bind-host.d.ts +10 -0
  21. package/dist/lib/bind-host.js +32 -0
  22. package/dist/lib/defaults-store.d.ts +1 -1
  23. package/dist/lib/defaults-store.js +1 -1
  24. package/dist/lib/i18n.js +26 -0
  25. package/dist/lib/recalc-can-summarize.js +8 -3
  26. package/dist/main.js +7 -2
  27. package/dist/middleware/rate-limiter.d.ts +4 -1
  28. package/dist/middleware/rate-limiter.js +15 -2
  29. package/dist/routes/agents.js +1 -0
  30. package/dist/routes/auth.js +29 -16
  31. package/dist/routes/llm.js +92 -12
  32. package/dist/routes/mcp-remote.d.ts +23 -0
  33. package/dist/routes/mcp-remote.js +152 -0
  34. package/dist/routes/mcp.d.ts +11 -6
  35. package/dist/routes/mcp.js +35 -6
  36. package/dist/routes/messages.js +2 -0
  37. package/dist/routes/projects.d.ts +9 -3
  38. package/dist/routes/projects.js +32 -3
  39. package/dist/routes/providers.d.ts +4 -1
  40. package/dist/routes/providers.js +19 -99
  41. package/dist/routes/queue.d.ts +4 -1
  42. package/dist/routes/queue.js +4 -1
  43. package/dist/routes/sessions.d.ts +49 -9
  44. package/dist/routes/sessions.js +299 -256
  45. package/package.json +6 -6
  46. package/dist/routes/audit.d.ts +0 -17
  47. package/dist/routes/audit.js +0 -64
  48. package/dist/routes/context.d.ts +0 -4
  49. package/dist/routes/context.js +0 -93
  50. package/dist/routes/debug.d.ts +0 -3
  51. package/dist/routes/debug.js +0 -30
  52. package/dist/routes/gateway-patterns.d.ts +0 -9
  53. package/dist/routes/gateway-patterns.js +0 -57
  54. package/dist/routes/logs.d.ts +0 -24
  55. package/dist/routes/logs.js +0 -100
  56. package/dist/routes/mcp-registry.d.ts +0 -28
  57. package/dist/routes/mcp-registry.js +0 -483
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@itphx/synth-backend",
3
- "version": "0.12.4",
3
+ "version": "0.13.8",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
9
9
  "dependencies": {
10
- "@hono/node-server": "^1.18.0",
11
- "@itphx/synth-core": "0.12.4",
12
- "@itphx/synth-shared": "0.12.4",
10
+ "@hono/node-server": "^2.1.3",
11
+ "@itphx/synth-core": "0.13.8",
12
+ "@itphx/synth-shared": "0.13.8",
13
13
  "hono": "^4.9.0",
14
14
  "hono-rate-limiter": "^0.5.3",
15
15
  "jose": "^6.2.3",
16
- "js-yaml": "^4.1.1",
16
+ "js-yaml": "^4.3.2",
17
17
  "ws": "^8.20.1",
18
18
  "zod": "^4.6.7"
19
19
  },
@@ -29,7 +29,7 @@
29
29
  "start": "node dist/main.js",
30
30
  "build": "rm -rf dist && tsc -p tsconfig.build.json",
31
31
  "typecheck": "tsc --noEmit",
32
- "lint": "eslint src/",
32
+ "lint": "eslint src/ --max-warnings 178",
33
33
  "test": "vitest run",
34
34
  "test:watch": "vitest",
35
35
  "clean": "rm -rf dist"
@@ -1,17 +0,0 @@
1
- import { Hono } from 'hono';
2
- import type { AuthKit } from '../auth/middleware.js';
3
- import { AuditLogger } from '@itphx/synth-core';
4
- export interface AuditRoutesDeps {
5
- /** Путь к append-only JSONL файлу аудита LLM Gateway. */
6
- auditLogPath: string;
7
- /** Проверка существования сессии (для POST /api/v2/audit/revealed). */
8
- sessionExists: (sessionId: string) => Promise<boolean>;
9
- /** Логгер записи событий аудита (тот же JSONL-файл, что читает GET /api/v2/audit). */
10
- logger: AuditLogger;
11
- }
12
- /**
13
- * GET /api/v2/audit — просмотр аудита LLM Gateway (ADR-036).
14
- * RBAC: только ADMIN/AUDITOR.
15
- * Фильтры: userId, sessionId, since/until (ISO), limit (дефолт 100, макс 500).
16
- */
17
- export declare function createAuditRoutes(kit: AuthKit, deps: AuditRoutesDeps): Hono;
@@ -1,64 +0,0 @@
1
- import { Hono } from 'hono';
2
- import { readAuditLog, PLACEHOLDER_PATTERN } from '@itphx/synth-core';
3
- const MAX_LIMIT = 500;
4
- const DEFAULT_LIMIT = 100;
5
- function toInt(value, fallback) {
6
- if (value === undefined)
7
- return fallback;
8
- const n = parseInt(value, 10);
9
- return Number.isFinite(n) ? n : fallback;
10
- }
11
- /**
12
- * GET /api/v2/audit — просмотр аудита LLM Gateway (ADR-036).
13
- * RBAC: только ADMIN/AUDITOR.
14
- * Фильтры: userId, sessionId, since/until (ISO), limit (дефолт 100, макс 500).
15
- */
16
- export function createAuditRoutes(kit, deps) {
17
- const app = new Hono();
18
- app.get('/', kit.requirePermission('ADMIN', 'AUDITOR'), async (c) => {
19
- const query = c.req.query();
20
- const limit = Math.min(Math.max(toInt(query['limit'], DEFAULT_LIMIT), 1), MAX_LIMIT);
21
- const { entries, total } = await readAuditLog(deps.auditLogPath, {
22
- userId: query['userId'] || undefined,
23
- sessionId: query['sessionId'] || undefined,
24
- since: query['since'] || undefined,
25
- until: query['until'] || undefined,
26
- limit,
27
- });
28
- return c.json({ entries, total });
29
- });
30
- /**
31
- * POST /api/v2/audit/revealed — логирование раскрытия плейсхолдера (ADR-036).
32
- * RBAC: любой авторизованный (клик по бейджу SecretPlaceholder делает
33
- * пользователь сессии), userId фиксируется из токена.
34
- * Тело: { sessionId, placeholder } (placeholder вида ⟦SYNTH_SECRET_N⟧).
35
- */
36
- app.post('/revealed', kit.requireAuth, async (c) => {
37
- const body = await c.req.json().catch(() => ({}));
38
- const sessionId = typeof body.sessionId === 'string' ? body.sessionId.trim() : '';
39
- const placeholder = typeof body.placeholder === 'string' ? body.placeholder.trim() : '';
40
- if (!sessionId || !placeholder) {
41
- return c.json({
42
- error: { code: 'VALIDATION_ERROR', message: 'sessionId и placeholder обязательны' },
43
- }, 400);
44
- }
45
- if (!PLACEHOLDER_PATTERN.test(placeholder)) {
46
- return c.json({
47
- error: { code: 'VALIDATION_ERROR', message: 'placeholder должен соответствовать формату ⟦SYNTH_SECRET_N⟧' },
48
- }, 400);
49
- }
50
- if (!(await deps.sessionExists(sessionId))) {
51
- return c.json({ error: { code: 'NOT_FOUND', message: 'Сессия не найдена' } }, 404);
52
- }
53
- const user = await kit.getCurrentUser(c);
54
- await deps.logger.append({
55
- ts: new Date().toISOString(),
56
- type: 'revealed',
57
- sessionId,
58
- userId: user?.id ?? 'unknown',
59
- placeholder,
60
- });
61
- return c.json({ ok: true });
62
- });
63
- return app;
64
- }
@@ -1,4 +0,0 @@
1
- import { Hono } from 'hono';
2
- import type { AuthKit } from '../auth/middleware.js';
3
- import type { ContextFileRepository } from '@itphx/synth-core';
4
- export declare function createContextRoutes(kit: AuthKit, config: ContextFileRepository): Hono;
@@ -1,93 +0,0 @@
1
- import { Hono } from 'hono';
2
- import { t } from '../lib/i18n.js';
3
- const VALID_CATEGORIES = new Set(['user', 'role', 'system']);
4
- function parseCategory(s) {
5
- if (s && VALID_CATEGORIES.has(s))
6
- return s;
7
- return 'user';
8
- }
9
- export function createContextRoutes(kit, config) {
10
- const app = new Hono();
11
- // GET /api/v2/context/files — список контекстных файлов
12
- app.get('/files', kit.requireAdmin, (c) => {
13
- const category = c.req.query('category');
14
- const allFiles = config.listAllFiles();
15
- const filtered = category
16
- ? allFiles.filter((f) => f.category === category)
17
- : allFiles;
18
- return c.json({
19
- files: filtered.map((f) => ({
20
- name: f.filename,
21
- category: f.category,
22
- is_system: f.isSystem,
23
- is_overridden: f.isOverridden,
24
- enabled: f.enabled ?? true,
25
- size: f.size,
26
- })),
27
- });
28
- });
29
- // GET /api/v2/context/files/:name — содержимое файла
30
- app.get('/files/:name', kit.requireAdmin, (c) => {
31
- const name = c.req.param('name');
32
- const category = parseCategory(c.req.query('category'));
33
- const file = config.getFile(name, category);
34
- if (!file) {
35
- return c.json({ error: { code: 'NOT_FOUND', message: t('errors.notFound.file', undefined, c) } }, 404);
36
- }
37
- return c.json({
38
- name: file.filename,
39
- content: file.content,
40
- category: file.category,
41
- is_system: file.isSystem,
42
- is_overridden: file.isOverridden,
43
- });
44
- });
45
- // POST /api/v2/context/files/:name — сохранить / переключить enabled
46
- app.post('/files/:name', kit.requireAdmin, async (c) => {
47
- const name = c.req.param('name');
48
- const body = await c.req.json().catch(() => ({}));
49
- if (body.action === 'toggle') {
50
- const enabled = config.getEnabledFiles();
51
- const idx = enabled.indexOf(name);
52
- if (idx >= 0) {
53
- enabled.splice(idx, 1);
54
- }
55
- else {
56
- enabled.push(name);
57
- }
58
- config.setEnabledFiles(enabled);
59
- return c.json({ name, enabled: idx < 0 });
60
- }
61
- const category = parseCategory(body.category);
62
- await config.saveFile(name, body.content || '', category);
63
- return c.json({ name, category, saved: true });
64
- });
65
- // DELETE /api/v2/context/files/:name — удалить
66
- app.delete('/files/:name', kit.requireAdmin, async (c) => {
67
- const name = c.req.param('name');
68
- const category = parseCategory(c.req.query('category'));
69
- await config.deleteFile(name, category);
70
- return c.body(null, 204);
71
- });
72
- // POST /api/v2/context/files/:name/restore_to_default — восстановить
73
- app.post('/files/:name/restore_to_default', kit.requireAdmin, async (c) => {
74
- const name = c.req.param('name');
75
- const category = parseCategory(c.req.query('category'));
76
- await config.restoreFile(name, category);
77
- return c.json({ status: 'restored' });
78
- });
79
- // GET /api/v2/context/enabled — список включённых
80
- app.get('/enabled', kit.requireAdmin, (c) => {
81
- return c.json({ enabled: config.getEnabledFiles() });
82
- });
83
- // POST /api/v2/context/enabled — установить включённые
84
- app.post('/enabled', kit.requireAdmin, async (c) => {
85
- const body = await c.req.json().catch(() => ({}));
86
- if (Array.isArray(body.files)) {
87
- config.setEnabledFiles(body.files);
88
- return c.json({ enabled: config.getEnabledFiles() });
89
- }
90
- return c.json({ error: { code: 'VALIDATION_ERROR', message: t('errors.validation.expectedFilesArray', undefined, c) } }, 400);
91
- });
92
- return app;
93
- }
@@ -1,3 +0,0 @@
1
- import { Hono } from 'hono';
2
- import type { AuthKit } from '../auth/middleware.js';
3
- export declare function createDebugRoutes(kit: AuthKit): Hono;
@@ -1,30 +0,0 @@
1
- import { Hono } from 'hono';
2
- import { getAllGroups, setGroups, LOG_LEVEL_NAMES } from '@itphx/synth-core';
3
- import { t } from '../lib/i18n.js';
4
- export function createDebugRoutes(kit) {
5
- const app = new Hono();
6
- // GET /api/v2/admin/debug/config — получить конфигурацию групп логирования
7
- app.get('/config', kit.requireAdmin, async (c) => {
8
- return c.json({
9
- groups: getAllGroups(),
10
- available_levels: LOG_LEVEL_NAMES,
11
- });
12
- });
13
- // POST /api/v2/admin/debug/config — сохранить конфигурацию групп логирования
14
- app.post('/config', kit.requireAdmin, async (c) => {
15
- const body = await c.req.json().catch(() => ({ groups: undefined }));
16
- if (!body.groups) {
17
- return c.json({ error: { code: 'VALIDATION_ERROR', message: t('errors.validation.groupsRequired', undefined, c) } }, 400);
18
- }
19
- try {
20
- setGroups(body.groups);
21
- return c.json({ status: 'saved' });
22
- }
23
- catch (err) {
24
- return c.json({
25
- error: { code: 'VALIDATION_ERROR', message: err instanceof Error ? err.message : t('errors.generic', undefined, c) },
26
- }, 400);
27
- }
28
- });
29
- return app;
30
- }
@@ -1,9 +0,0 @@
1
- import { Hono } from 'hono';
2
- import type { AuthKit } from '../auth/middleware.js';
3
- import type { SecretPatternRepository } from '@itphx/synth-core';
4
- /**
5
- * LLM Gateway (ADR-036) — управление regex-паттернами детекции секретов.
6
- * Схема «системный + override»: пользовательский список полностью заменяет дефолтный,
7
- * DELETE сбрасывает к встроенным паттернам. Только ADMIN.
8
- */
9
- export declare function createGatewayPatternsRoutes(kit: AuthKit, store: SecretPatternRepository): Hono;
@@ -1,57 +0,0 @@
1
- import { Hono } from 'hono';
2
- function isValidPattern(p) {
3
- if (typeof p !== 'object' || p === null)
4
- return false;
5
- const { type, regex } = p;
6
- if (typeof type !== 'string' || type.trim() === '')
7
- return false;
8
- if (typeof regex !== 'string')
9
- return false;
10
- try {
11
- new RegExp(regex);
12
- return true;
13
- }
14
- catch {
15
- return false;
16
- }
17
- }
18
- /**
19
- * LLM Gateway (ADR-036) — управление regex-паттернами детекции секретов.
20
- * Схема «системный + override»: пользовательский список полностью заменяет дефолтный,
21
- * DELETE сбрасывает к встроенным паттернам. Только ADMIN.
22
- */
23
- export function createGatewayPatternsRoutes(kit, store) {
24
- const app = new Hono();
25
- // GET /api/v2/gateway/patterns — текущий список + признак override + дефолт
26
- app.get('/patterns', kit.requireAdmin, (c) => {
27
- const raw = store.getRawPatterns();
28
- return c.json({
29
- patterns: raw.patterns,
30
- is_overridden: raw.isOverridden,
31
- default_patterns: raw.defaultPatterns,
32
- });
33
- });
34
- // PUT /api/v2/gateway/patterns — сохранить override-список
35
- app.put('/patterns', kit.requireAdmin, async (c) => {
36
- const body = await c.req.json().catch(() => ({}));
37
- const patterns = body?.patterns;
38
- if (!Array.isArray(patterns) || !patterns.every(isValidPattern)) {
39
- return c.json({
40
- error: { code: 'VALIDATION_ERROR', message: 'patterns должен быть массивом элементов {type: string, regex: string}' },
41
- }, 400);
42
- }
43
- const ok = await store.savePatterns(patterns);
44
- if (!ok) {
45
- return c.json({
46
- error: { code: 'VALIDATION_ERROR', message: 'Не удалось сохранить паттерны обфускации' },
47
- }, 400);
48
- }
49
- return c.json({ patterns: store.getPatterns(), is_overridden: true, saved: true });
50
- });
51
- // DELETE /api/v2/gateway/patterns — сброс к дефолтным паттернам
52
- app.delete('/patterns', kit.requireAdmin, async (c) => {
53
- await store.reset();
54
- return c.json({ status: 'restored' });
55
- });
56
- return app;
57
- }
@@ -1,24 +0,0 @@
1
- import { Hono } from 'hono';
2
- import type { AuthKit } from '../auth/middleware.js';
3
- export interface LogsRoutesDeps {
4
- /** Каталог лог-файлов ({logDir}/{name}.log). */
5
- logDir: string;
6
- /** Путь к JSONL полного лога запросов/ответов LLM (llm-payloads.jsonl). */
7
- payloadLogPath?: string;
8
- }
9
- /**
10
- * Резолвит каталог логов: env SYNTH_LOG_DIR приоритетнее, иначе ищет существующий
11
- * tmp-каталог с лог-файлами (cwd/tmp или cwd/../tmp — dev.sh пишет логи в ROOT/tmp,
12
- * а backend-процесс запускается из $SYNTH). Финальный fallback — cwd/tmp.
13
- */
14
- export declare function resolveLogDir(): string;
15
- /**
16
- * GET /api/v2/logs/:name?tail=N&search=...
17
- * Чтение хвоста лог-файлов сервисов (core/ui/backend). Только ADMIN/AUDITOR.
18
- * - :name — строго из whitelist, иначе 404. Path traversal невозможен.
19
- * - tail — int, дефолт 200, минимум 1, максимум 2000 (clamp).
20
- * - search — необязательная подстрока, case-insensitive фильтр по строкам.
21
- * Ответ: { name, file, total, tail, lines } — lines это последние tail строк
22
- * после фильтра search, total — сколько строк подходит под фильтр (до tail).
23
- */
24
- export declare function createLogsRoutes(kit: AuthKit, deps: LogsRoutesDeps): Hono;
@@ -1,100 +0,0 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { statSync } from 'node:fs';
3
- import { join } from 'node:path';
4
- import { Hono } from 'hono';
5
- import { readPayloadLog } from '@itphx/synth-core';
6
- /** Имена лог-файлов, доступные для чтения. Строгий whitelist — никакого path traversal. */
7
- const LOG_WHITELIST = ['core', 'ui', 'backend'];
8
- const DEFAULT_TAIL = 200;
9
- const MIN_TAIL = 1;
10
- const MAX_TAIL = 2000;
11
- function toInt(value, fallback) {
12
- if (value === undefined)
13
- return fallback;
14
- const n = parseInt(value, 10);
15
- return Number.isFinite(n) ? n : fallback;
16
- }
17
- /**
18
- * Резолвит каталог логов: env SYNTH_LOG_DIR приоритетнее, иначе ищет существующий
19
- * tmp-каталог с лог-файлами (cwd/tmp или cwd/../tmp — dev.sh пишет логи в ROOT/tmp,
20
- * а backend-процесс запускается из $SYNTH). Финальный fallback — cwd/tmp.
21
- */
22
- export function resolveLogDir() {
23
- if (process.env.SYNTH_LOG_DIR)
24
- return process.env.SYNTH_LOG_DIR;
25
- const candidates = [join(process.cwd(), 'tmp'), join(process.cwd(), '..', 'tmp')];
26
- for (const dir of candidates) {
27
- for (const name of LOG_WHITELIST) {
28
- try {
29
- if (statSync(join(dir, `${name}.log`)).isFile())
30
- return dir;
31
- }
32
- catch {
33
- // файла нет — пробуем следующий каталог
34
- }
35
- }
36
- }
37
- return candidates[0];
38
- }
39
- /**
40
- * GET /api/v2/logs/:name?tail=N&search=...
41
- * Чтение хвоста лог-файлов сервисов (core/ui/backend). Только ADMIN/AUDITOR.
42
- * - :name — строго из whitelist, иначе 404. Path traversal невозможен.
43
- * - tail — int, дефолт 200, минимум 1, максимум 2000 (clamp).
44
- * - search — необязательная подстрока, case-insensitive фильтр по строкам.
45
- * Ответ: { name, file, total, tail, lines } — lines это последние tail строк
46
- * после фильтра search, total — сколько строк подходит под фильтр (до tail).
47
- */
48
- export function createLogsRoutes(kit, deps) {
49
- const app = new Hono();
50
- /**
51
- * GET /api/v2/logs/llm?sessionId=&limit= — полный лог запросов/ответов LLM
52
- * (после обфускации). Только ADMIN/AUDITOR. Если логирование выключено или
53
- * файла нет — возвращается { entries: [], total: 0 }.
54
- * Регистрируется до /:name (статический маршрут имеет приоритет).
55
- */
56
- app.get('/llm', kit.requirePermission('ADMIN', 'AUDITOR'), async (c) => {
57
- if (!deps.payloadLogPath) {
58
- return c.json({ entries: [], total: 0 });
59
- }
60
- const query = c.req.query();
61
- const limit = Math.min(Math.max(toInt(query['limit'], 100), 1), 500);
62
- const { entries, total } = await readPayloadLog(deps.payloadLogPath, {
63
- sessionId: query['sessionId'] || undefined,
64
- limit,
65
- });
66
- return c.json({ entries, total });
67
- });
68
- app.get('/:name', kit.requirePermission('ADMIN', 'AUDITOR'), async (c) => {
69
- const name = c.req.param('name');
70
- if (!LOG_WHITELIST.includes(name)) {
71
- return c.json({ error: { code: 'NOT_FOUND', message: `Лог «${name}» не найден` } }, 404);
72
- }
73
- const query = c.req.query();
74
- const tail = Math.min(Math.max(toInt(query['tail'], DEFAULT_TAIL), MIN_TAIL), MAX_TAIL);
75
- const search = (query['search'] ?? '').trim();
76
- const file = join(deps.logDir, `${name}.log`);
77
- let raw;
78
- try {
79
- raw = await readFile(file, 'utf8');
80
- }
81
- catch (e) {
82
- if (e.code === 'ENOENT') {
83
- return c.json({ error: { code: 'NOT_FOUND', message: `Файл лога не найден: ${file}` } }, 404);
84
- }
85
- throw e;
86
- }
87
- let lines = raw.split('\n');
88
- // убираем хвостовую пустую строку от завершающего \n
89
- if (lines.length > 0 && lines[lines.length - 1] === '')
90
- lines = lines.slice(0, -1);
91
- if (search) {
92
- const needle = search.toLowerCase();
93
- lines = lines.filter((line) => line.toLowerCase().includes(needle));
94
- }
95
- const total = lines.length;
96
- const result = lines.slice(-tail);
97
- return c.json({ name, file, total, tail, lines: result });
98
- });
99
- return app;
100
- }
@@ -1,28 +0,0 @@
1
- import { Hono } from 'hono';
2
- import type { Context } from 'hono';
3
- import type { AuthKit } from '../auth/middleware.js';
4
- import type { SessionManager, McpManager, McpRegistryRepository, ExternalCredentialRepository } from '@itphx/synth-core';
5
- import type { McpNetworkPolicy } from '@itphx/synth-shared';
6
- export interface McpRoutesOptions {
7
- /** ADR-071 §2.5: единый реестр MCP-серверов (источник истины для `/servers` и `/registry`). */
8
- registry: McpRegistryRepository;
9
- /** ADR-071 §2.3.1: политика сетевого доступа HTTP-серверов. */
10
- networkPolicy?: McpNetworkPolicy;
11
- /**
12
- * ADR-071 §2.3.1: динамический источник политики (runtime-настройка из админки).
13
- * Приоритетнее статической `networkPolicy`; читается на каждый запрос.
14
- */
15
- getNetworkPolicy?: () => Promise<McpNetworkPolicy | undefined>;
16
- /**
17
- * ADR-105 (Ф3): порт слоя внешних доступов — право привязать доступ
18
- * к коннектору проверяется на границе (инвариант 16). Не задан — привязка
19
- * запрещена (fail-closed).
20
- */
21
- credentials?: ExternalCredentialRepository;
22
- /**
23
- * ADR-105 (Ф3): право участника проекта **изменять содержимое** проекта
24
- * (`OWNER`/`EDITOR`, а также `LEAD`/`ADMIN`) — для доступа уровня проекта.
25
- */
26
- canEditProject?: (c: Context, projectId: string) => boolean | Promise<boolean>;
27
- }
28
- export declare function createMcpRegistryRoutes(kit: AuthKit, mcpManager: McpManager | null, sessionManager: SessionManager | null, options: McpRoutesOptions): Hono;