@itphx/synth-shared 0.13.8 → 0.13.10

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 (71) hide show
  1. package/dist/config/defaults.js +74 -2
  2. package/dist/config/env-overrides.d.ts +16 -0
  3. package/dist/config/env-overrides.js +103 -3
  4. package/dist/config/execution-runtime.d.ts +89 -0
  5. package/dist/config/execution-runtime.js +506 -0
  6. package/dist/config/execution.d.ts +202 -1
  7. package/dist/config/execution.js +459 -3
  8. package/dist/config/index.d.ts +2 -0
  9. package/dist/config/index.js +2 -0
  10. package/dist/config/security.d.ts +77 -0
  11. package/dist/config/security.js +116 -0
  12. package/dist/config/types.d.ts +466 -34
  13. package/dist/config/types.js +317 -33
  14. package/dist/i18n/index.d.ts +1 -1
  15. package/dist/i18n/index.js +196 -13
  16. package/dist/index.d.ts +5 -4
  17. package/dist/index.js +15 -2
  18. package/dist/schemas/index.d.ts +156 -19
  19. package/dist/schemas/index.js +126 -15
  20. package/dist/skills/frontmatter.js +1 -1
  21. package/dist/types/agent.d.ts +29 -1
  22. package/dist/types/authority.d.ts +10 -0
  23. package/dist/types/authority.js +8 -0
  24. package/dist/types/bus-events.d.ts +87 -1
  25. package/dist/types/catalog.d.ts +1 -1
  26. package/dist/types/catalog.js +1 -1
  27. package/dist/types/command-audit.d.ts +91 -0
  28. package/dist/types/command-audit.js +44 -0
  29. package/dist/types/commands.d.ts +29 -11
  30. package/dist/types/commands.js +2 -2
  31. package/dist/types/egress.d.ts +18 -3
  32. package/dist/types/egress.js +18 -3
  33. package/dist/types/events.d.ts +23 -2
  34. package/dist/types/execution.d.ts +424 -0
  35. package/dist/types/execution.js +355 -0
  36. package/dist/types/file-kind.d.ts +3 -2
  37. package/dist/types/file-kind.js +11 -2
  38. package/dist/types/git.d.ts +48 -0
  39. package/dist/types/index.d.ts +6 -0
  40. package/dist/types/index.js +18 -2
  41. package/dist/types/mentions.d.ts +96 -0
  42. package/dist/types/mentions.js +9 -0
  43. package/dist/types/message.d.ts +24 -1
  44. package/dist/types/message.js +13 -0
  45. package/dist/types/pack.d.ts +21 -21
  46. package/dist/types/pack.js +4 -4
  47. package/dist/types/permission.d.ts +8 -1
  48. package/dist/types/pipeline.d.ts +2 -2
  49. package/dist/types/plugin-protocol.d.ts +203 -4
  50. package/dist/types/plugin-protocol.js +77 -4
  51. package/dist/types/project-access.d.ts +94 -0
  52. package/dist/types/project-access.js +140 -0
  53. package/dist/types/project.d.ts +59 -2
  54. package/dist/types/project.js +20 -0
  55. package/dist/types/schedules.d.ts +49 -3
  56. package/dist/types/schedules.js +50 -1
  57. package/dist/types/scripts.d.ts +98 -0
  58. package/dist/types/scripts.js +14 -0
  59. package/dist/types/service-keys.d.ts +12 -2
  60. package/dist/types/service-keys.js +13 -0
  61. package/dist/types/session.d.ts +60 -3
  62. package/dist/types/skills.d.ts +15 -11
  63. package/dist/types/skills.js +6 -6
  64. package/dist/types/timers.d.ts +402 -0
  65. package/dist/types/timers.js +166 -0
  66. package/dist/types/tools.d.ts +124 -1
  67. package/dist/types/tools.js +22 -0
  68. package/dist/types/user.d.ts +17 -0
  69. package/dist/version.d.ts +1 -1
  70. package/dist/version.js +1 -1
  71. package/package.json +2 -2
@@ -5,6 +5,9 @@ import { TOOLS_POLICIES, MCP_NETWORK_POLICY_MODES, COMMAND_CONFLICT_MODES, DEFAU
5
5
  import { catalogTrustLevelSchema } from '../types/trust.js';
6
6
  import { PLUGIN_HYBRID_MODES } from '../types/plugin-hybrid.js';
7
7
  import { GlobalRole } from '../types/user.js';
8
+ // ADR-135: канонические перечисления секции `execution` — browser-safe
9
+ // (`types/execution.ts`), здесь импортируются для схемы конфигурации.
10
+ import { DEFAULT_EXECUTION_BROWSER_MCP_SERVER, DEFAULT_EXECUTION_BROWSER_PROFILE, DEFAULT_EXECUTION_PROVISIONER_TIMEOUT_MS, DEFAULT_EXECUTION_TIMEOUT_MS, EXECUTION_FAIL_MODES, EXECUTION_FALLBACKS, EXECUTION_MODES, EXECUTION_POOLINGS, EXECUTION_POOL_PROVIDERS, EXECUTION_PROFILE_NETWORKS, EXECUTION_PROFILE_CLASSES, MAX_EXECUTION_BROWSER_TIMEOUT_MS, executionAffinitySchema, executionAnnotationValueSchema, executionLabelValueSchema, executionPodKeySchema, executionResourceListSchema, executionTolerationSchema, } from '../types/execution.js';
8
11
  // PROP-124: режимы инстанса для SSH-ключей (`ssh.mode`) — канонический список
9
12
  // в типах (browser-safe), чтобы UI и ядро читали один источник.
10
13
  import { SSH_MODES } from '../types/git.js';
@@ -122,32 +125,19 @@ export const storageConfigSchema = z.object({
122
125
  });
123
126
  // --- Исполнение (ADR-077) ---
124
127
  /**
125
- * ADR-077: топология исполнения — переключатель запуска (`execution.mode`).
128
+ * ADR-077/ADR-135: канонические перечисления и константы секции `execution`
129
+ * живут в **browser-safe** модуле `types/execution.ts` — их читает и ядро, и
130
+ * UI (админка «Исполнение»). Здесь — реэкспорт (обратная совместимость
131
+ * импортов `@itphx/synth-shared/config`).
126
132
  *
127
- * - `inline` (дефолт) — исполнение в процессе backend'а (прежнее поведение,
128
- * all-in-one образ);
129
- * - `remote` — отдельные исполнители (`RemoteExecutionPort` + сервис-исполнитель,
130
- * шаг 7 плана ADR-077).
131
- *
132
- * Секция — **параметр запуска**, а не runtime-настройка: смена режима — только
133
- * рестартом процесса (инвариант 24 — process-глобальные решения не
134
- * переинициализируются на лету). Значение `mode` — **fail-closed**: неизвестное
135
- * явное значение (опечатка `inlne`) валит старт, а не молча выбирает дефолт
136
- * (как `storage.backend`).
137
- */
138
- export const EXECUTION_MODES = ['inline', 'remote'];
139
- /**
140
- * Поведение при недоступном исполнителе:
141
- * - `fail` (дефолт) — fail-closed: инструмент недоступен с явной причиной;
142
- * - `inline-fallback` — backend исполняет команду сам; **только явной настройкой**
143
- * (в managed-контуре это обход изоляции).
144
- */
145
- export const EXECUTION_FAIL_MODES = ['fail', 'inline-fallback'];
146
- /**
147
- * Таймаут exec-вызова по умолчанию (30 с — как у нынешних тулов: shell/search/git).
148
- * Больший лимит для shell (до 120 с) — свойство тула, не конфига.
133
+ * Топология исполнения — переключатель запуска (`execution.mode`):
134
+ * `inline` (дефолт) — исполнение в процессе control plane; `remote` —
135
+ * отдельные исполнители (ADR-077). Секция — **параметр запуска**, а не
136
+ * runtime-настройка: смена режима — только рестартом процесса (инвариант 24).
137
+ * Значение `mode` — **fail-closed**: неизвестное явное значение (опечатка
138
+ * `inlne`) валит старт, а не молча выбирает дефолт (как `storage.backend`).
149
139
  */
150
- export const DEFAULT_EXECUTION_TIMEOUT_MS = 30_000;
140
+ export { EXECUTION_MODES, EXECUTION_FAIL_MODES, EXECUTION_POOLINGS, EXECUTION_FALLBACKS, EXECUTION_POOL_PROVIDERS, EXECUTION_PROFILE_NETWORKS, EXECUTION_PROFILE_CLASSES, DEFAULT_EXECUTION_PROVISIONER_TIMEOUT_MS, DEFAULT_EXECUTION_TIMEOUT_MS, DEFAULT_EXECUTION_BROWSER_PROFILE, DEFAULT_EXECUTION_BROWSER_MCP_SERVER, DEFAULT_EXECUTION_BROWSER_TIMEOUT_MS, MAX_EXECUTION_BROWSER_TIMEOUT_MS, } from '../types/execution.js';
151
141
  /**
152
142
  * Параметры удалённого исполнителя (`execution.remote`).
153
143
  *
@@ -168,6 +158,125 @@ export const executionRemoteConfigSchema = z.object({
168
158
  failMode: z.enum(EXECUTION_FAIL_MODES).default('fail'),
169
159
  /** Путь/ссылка на токен исполнителя (НЕ значение — инвариант 13). */
170
160
  tokenSecret: z.string().default(''),
161
+ /**
162
+ * PROP-135 Ф4a: режим пула исполнителей. `instance` — общий порт на
163
+ * процесс (прежнее поведение); `project`/`session` — порт на профиль.
164
+ */
165
+ pooling: z.enum(EXECUTION_POOLINGS).default('instance'),
166
+ /** Имя профиля по умолчанию (каталог профилей задаёт ADMIN). */
167
+ defaultProfile: z.string().default('default'),
168
+ /**
169
+ * Имя профиля для пула класса `browser` (браузер — проектный пул со своим
170
+ * образом). Используется, когда цель вызова класс `browser` и профиль не
171
+ * задан явно; `defaultProfile` для браузера **не** применяется.
172
+ */
173
+ browserProfile: z.string().default(DEFAULT_EXECUTION_BROWSER_PROFILE),
174
+ /**
175
+ * PROP-135 (браузерный контур): явный каталог **браузерных** профилей.
176
+ *
177
+ * Имена из этого списка доступны только браузерному пулу (`class: 'browser'`)
178
+ * и **исключаются** из exec-каталога (`router.profiles()`); metadata-записи в
179
+ * `execution.remote.profiles` для них остаются (описание/сеть/mcpServers для
180
+ * details). Пусто — каталог равен `[browserProfile]` (обратная совместимость).
181
+ * Env — `SYNTH_EXECUTION_BROWSER_PROFILES` (csv).
182
+ */
183
+ browserProfiles: z.array(z.string()).default([]),
184
+ /**
185
+ * Имя MCP-сервера браузера в поде исполнителя (встроенные `browser_*`-тулы
186
+ * адресуют вызов этому серверу).
187
+ */
188
+ browserMcpServer: z.string().default(DEFAULT_EXECUTION_BROWSER_MCP_SERVER),
189
+ /**
190
+ * Таймаут одного вызова браузерного MCP-инструмента, мс.
191
+ *
192
+ * У тулов `browser_*` переопределяется параметром `timeout`; потолок —
193
+ * 600 000 мс (`MAX_EXECUTION_BROWSER_TIMEOUT_MS`). Не задан — дефолт
194
+ * 120 000 мс (`DEFAULT_EXECUTION_BROWSER_TIMEOUT_MS`).
195
+ */
196
+ browserTimeoutMs: z
197
+ .number()
198
+ .int()
199
+ .min(1)
200
+ .max(MAX_EXECUTION_BROWSER_TIMEOUT_MS)
201
+ .optional(),
202
+ /**
203
+ * Каталог профилей исполнения (PROP-135 Ф4a): имя → параметры профиля.
204
+ * Профиль **поверх** общих параметров: пустой `url` наследует
205
+ * `execution.remote.url`, незаданные `timeoutMs`/`concurrency`/`failMode` —
206
+ * общие значения секции.
207
+ */
208
+ profiles: z
209
+ .record(z.string(), z.object({
210
+ url: z.array(z.string()).default([]),
211
+ timeoutMs: z.number().int().min(1).optional(),
212
+ concurrency: z.number().int().min(1).optional(),
213
+ failMode: z.enum(EXECUTION_FAIL_MODES).optional(),
214
+ /**
215
+ * Метаданные профиля (для admin-API/UI): аддитивные поля, на
216
+ * маршрутизацию и создание портов **не** влияют.
217
+ */
218
+ description: z.string().max(500).optional(),
219
+ image: z.string().optional(),
220
+ network: z.enum(EXECUTION_PROFILE_NETWORKS).optional(),
221
+ resources: z
222
+ .object({
223
+ requests: executionResourceListSchema.optional(),
224
+ limits: executionResourceListSchema.optional(),
225
+ })
226
+ .optional(),
227
+ /**
228
+ * Произвольные аннотации пода (`metadata.annotations`); служебные
229
+ * `synth.io/*` приоритетнее.
230
+ */
231
+ annotations: z
232
+ .record(executionPodKeySchema, executionAnnotationValueSchema)
233
+ .optional(),
234
+ /** Пользовательские метки пода (`metadata.labels`). */
235
+ labels: z.record(executionPodKeySchema, executionLabelValueSchema).optional(),
236
+ /** `spec.nodeSelector` пода — отбор нод по меткам. */
237
+ nodeSelector: z.record(executionPodKeySchema, executionLabelValueSchema).optional(),
238
+ /** `spec.tolerations` пода — правила размещения на «tainted» нодах. */
239
+ tolerations: z.array(executionTolerationSchema).optional(),
240
+ /** `spec.affinity` пода — passthrough (JSON, ≤8 КиБ). */
241
+ affinity: executionAffinitySchema.optional(),
242
+ runtimeClass: z.string().optional(),
243
+ /**
244
+ * Класс профиля (ADR-135, аддендум §11): `exec` (дефолт) | `browser` |
245
+ * `both`. Профиль из legacy-списка `browserProfiles` получает
246
+ * эффективный класс `browser`, если класс не задан явно.
247
+ */
248
+ class: z.enum(EXECUTION_PROFILE_CLASSES).optional(),
249
+ /** **Только имена** MCP-серверов профиля (без команд/env). */
250
+ mcpServers: z.array(z.string()).optional(),
251
+ }))
252
+ .default({}),
253
+ /**
254
+ * Поведение роутера при непригодном профиле: `instance` — откат на
255
+ * instance-порт; `fail` — fail-closed (старт прерывается).
256
+ */
257
+ fallback: z.enum(EXECUTION_FALLBACKS).default('instance'),
258
+ /**
259
+ * Провайдер пулов исполнения (PROP-135 Ф4b-1): `static` — пулы из
260
+ * конфигурации (адреса профиля, порт на старте); `http` — пулы запрашиваются
261
+ * у provisioner'а (`execution.remote.provisioner.url`).
262
+ */
263
+ provider: z.enum(EXECUTION_POOL_PROVIDERS).default('static'),
264
+ /**
265
+ * Параметры provisioner'а пулов (PROP-135 Ф4b-1).
266
+ *
267
+ * - `url` — адрес provisioner'а; пусто при `provider: http` → **fail-closed**
268
+ * на старте (провайдер задан, но куда обращаться — не указано);
269
+ * - `tokenSecret` — **путь/ссылка** на токен provisioner'а, НЕ значение
270
+ * (инвариант 13);
271
+ * - `timeoutMs` — таймаут обращения к provisioner'у.
272
+ */
273
+ provisioner: z
274
+ .object({
275
+ url: z.string().default(''),
276
+ tokenSecret: z.string().default(''),
277
+ timeoutMs: z.number().int().min(1).default(DEFAULT_EXECUTION_PROVISIONER_TIMEOUT_MS),
278
+ })
279
+ .prefault({}),
171
280
  });
172
281
  /** ADR-077: секция `execution` — топология исполнения (параметр запуска). */
173
282
  export const executionConfigSchema = z.object({
@@ -201,6 +310,17 @@ export const authConfigSchema = z.object({
201
310
  redirectUri: z.string().default('http://localhost:5002/auth/callback'),
202
311
  /** Public client_id для локального CLI/core (ROPC/device flow). Не секрет. */
203
312
  cliClientId: z.string().default('synth-cli'),
313
+ /**
314
+ * ADR-140: источник групп пользователя — claim IdP + allowlist имён.
315
+ * Секция опциональна (старые конфиги без неё валидны); пустой allowlist —
316
+ * групп нет (fail-closed).
317
+ */
318
+ groups: z
319
+ .object({
320
+ claim: z.string().min(1).default('groups'),
321
+ allow: z.array(z.string().min(1)).default([]),
322
+ })
323
+ .optional(),
204
324
  })
205
325
  .optional(),
206
326
  });
@@ -406,9 +526,9 @@ export const toolsConfigSchema = z.object({
406
526
  */
407
527
  outputMaxBytes: z.number().int().min(1).default(DEFAULT_TOOL_OUTPUT_MAX_BYTES),
408
528
  });
409
- // --- Скиллы (ADR-046) ---
529
+ // --- Скиллы (ADR-126) ---
410
530
  /**
411
- * ADR-046 §4.2/§4.4/§7.4: конфигурация механизма скиллов.
531
+ * ADR-126 §7/§4.4/§7.4: конфигурация механизма скиллов.
412
532
  * `paths` — дополнительные пользовательские каталоги; `trustedProjectDirs` —
413
533
  * доверенные проектные каталоги (бинарный trust); `inlineShell` — выключатель
414
534
  * `!`cmd`` в шаблонных командах (по умолчанию выключено).
@@ -419,24 +539,24 @@ export const toolsConfigSchema = z.object({
419
539
  * попадают, тело не грузится). Установка/доверие/подписи/`lock.json` — PROP-068.
420
540
  *
421
541
  * Внешние локальные каталоги совместимости (`.opencode`, `.claude`, `.agents`,
422
- * `~/.config/opencode`) подключаются как read-only discovery в core (ADR-046 §4.2).
542
+ * `~/.config/opencode`) подключаются как read-only discovery в core (ADR-126 §7).
423
543
  */
424
544
  export const skillsConfigSchema = z.object({
425
545
  paths: z.array(z.string()).default([]),
426
- /** ADR-046 §4.2/§4.3: удалённые каталоги — read-only индексация (`trusted: false`). */
546
+ /** ADR-126 §7/§4.3: удалённые каталоги — read-only индексация (`trusted: false`). */
427
547
  urls: z.array(z.string()).default([]),
428
548
  trustedProjectDirs: z.array(z.string()).default([]),
429
549
  inlineShell: z.boolean().default(false),
430
550
  /**
431
- * ADR-046 §3.2/§12: именованные группы тулов → capabilities. Используется
551
+ * ADR-126 §13/§12: именованные группы тулов → capabilities. Используется
432
552
  * для экспансии `metadata.synth.requires_toolsets` в проверку доступности
433
553
  * скилла (union с `requires_capabilities`).
434
554
  */
435
555
  toolsets: z.record(z.string(), z.array(z.enum(toolCapabilityValues))).prefault({}),
436
556
  });
437
- // --- Slash-команды (ADR-046 §7) ---
557
+ // --- Slash-команды (ADR-126 §1) ---
438
558
  /**
439
- * ADR-046 §7/§9.4: конфигурация slash-команд. `paths` — дополнительные каталоги
559
+ * ADR-126 §1/§9.4: конфигурация slash-команд. `paths` — дополнительные каталоги
440
560
  * шаблонных `.md`-команд; `bundlesPath` — подкаталог `{dataDir}` для YAML-бандлов;
441
561
  * `conflict` — режим разрешения конфликтов имён (см. resolver).
442
562
  */
@@ -452,6 +572,18 @@ export const commandsConfigSchema = z.object({
452
572
  maxArgumentsLength: z.number().int().min(1).default(10_000),
453
573
  maxRenderedBytes: z.number().int().min(1).default(200_000),
454
574
  });
575
+ // --- Скрипты проекта (ADR-126 §5) ---
576
+ /**
577
+ * ADR-126 §5: конфигурация реестра скриптов проекта (`!`-запуск).
578
+ *
579
+ * `paths` — дополнительные каталоги-источники деклараций `.synth/scripts`.
580
+ * Приоритет источников: проект (`{project.workspace}/.synth/scripts`) >
581
+ * инстанс (`{dataDir}/scripts`) > `config.scripts.paths` — как у команд и
582
+ * скиллов (ADR-126 §9).
583
+ */
584
+ export const scriptsConfigSchema = z.object({
585
+ paths: z.array(z.string()).prefault([]),
586
+ });
455
587
  // --- Внешние события (ADR-089) ---
456
588
  /**
457
589
  * ADR-089: конфигурация приёма внешних событий.
@@ -726,6 +858,28 @@ export const backgroundConfigSchema = z.object({
726
858
  logMaxBytes: z.number().int().min(0).default(10_485_760),
727
859
  retentionDays: z.number().int().default(7),
728
860
  });
861
+ // --- Автовосстановление прерванных ходов (PROP-142 §3) ---
862
+ /**
863
+ * Секция `recovery` — бюджет автовосстановления прерванных ходов после
864
+ * рестарта инстанса (PROP-142 §3).
865
+ *
866
+ * - `autoResume` — мастер-выключатель автовосстановления: при `false` инстанс
867
+ * не возобновляет прерванные ходы сам (деградация к «терминализировать»);
868
+ * - `maxAttempts` — максимум автовосстановлений **одного хода**: превышен →
869
+ * ход терминализируется (`failed`), владельцу уходит уведомление;
870
+ * - `crashLoop.windowMinutes` — окно детекта crash-loop (минуты);
871
+ * - `crashLoop.maxRestarts` — сколько рестартов в окне считаются crash-loop'ом.
872
+ *
873
+ * Решение владельца (2026-11-18): «попытки на ход + детект crash-loop».
874
+ */
875
+ export const recoveryConfigSchema = z.object({
876
+ autoResume: z.boolean().default(true),
877
+ maxAttempts: z.number().int().min(1).default(3),
878
+ crashLoop: z.object({
879
+ windowMinutes: z.number().int().min(1).default(10),
880
+ maxRestarts: z.number().int().min(1).default(3),
881
+ }).prefault({}),
882
+ });
729
883
  // --- Агенты: предохранители прогонов ---
730
884
  /**
731
885
  * Дефолт предохранителя по объёму промпта саб-агента
@@ -1028,6 +1182,60 @@ export const updatesConfigSchema = z.object({
1028
1182
  export const metricsConfigSchema = z.object({
1029
1183
  enabled: z.boolean().default(false),
1030
1184
  });
1185
+ // --- Терминалы (PROP-132) ---
1186
+ /**
1187
+ * PROP-132: конфигурация интерактивных терминалов.
1188
+ *
1189
+ * - `enabled` — мастер-выключатель терминального контура: `false` — весь
1190
+ * контур `/api/v2/terminals*` отвечает `403 TERMINALS_DISABLED`, живые
1191
+ * терминалы закрываются, новые не создаются.
1192
+ *
1193
+ * Флаг **необязателен** в схеме намеренно: «не задано в config.yaml» должно
1194
+ * отличаться от «явно задано `true`» — по этому различаются источники
1195
+ * значения в API (`config` против `default`). Само значение по умолчанию
1196
+ * (`enabled: true`) живёт в резолвере ядра (`DEFAULT_TERMINAL_ENABLED`).
1197
+ *
1198
+ * - `autoRestore` — восстанавливать ли терминалы после рестарта ядра из
1199
+ * снимков (`terminals/<id>/meta.json` + `terminals/<id>/output.txt` в
1200
+ * blob-хранилище, ADR-096/ADR-116): `false` — снимки не поднимаются, их
1201
+ * убирает reaper. По умолчанию `true` (`DEFAULT_TERMINAL_AUTO_RESTORE`).
1202
+ *
1203
+ * PROP-132 (параметры выполнения): секция описывает не только мастер-флаги, но
1204
+ * и **параметры выполнения** терминалов, редактируемые из админки:
1205
+ *
1206
+ * - `idleMinutes` — простой (минуты) до закрытия терминала; он же TTL
1207
+ * снимков. Границы 30…10080, дефолт `2880` (2 дня);
1208
+ * - `maxPerProject` — предел живых терминалов на проект. Границы 1…64,
1209
+ * дефолт `8`;
1210
+ * - `maxPerInstance` — предел живых терминалов на инстанс. Границы 1…256,
1211
+ * дефолт `32`;
1212
+ * - `shell` — имя программы или абсолютный путь оболочки терминала
1213
+ * (`^[A-Za-z0-9._/+-]{1,200}$`, без пробелов). **Не задано** —
1214
+ * платформенный дефолт (`$SHELL` → `/bin/bash`);
1215
+ * - `auditInput` — писать ли `terminal.input` в журнал исполнений команд
1216
+ * (ADR-136). Дефолт `true`.
1217
+ *
1218
+ * Все поля **необязательны** (без `.default()`): «не задано в config.yaml» ≠
1219
+ * «задано значение по умолчанию» — по этому различаются источники значения в
1220
+ * API (`config` против `default`). Сами дефолты, границы и нормализация живут в
1221
+ * резолвере ядра (`engine/terminal/config.ts`) — единственном источнике истины.
1222
+ *
1223
+ * Env-оверрайды — `SYNTH_TERMINAL_*` (`ENABLED`, `AUTO_RESTORE`,
1224
+ * `IDLE_MINUTES`, `MAX_PER_PROJECT`, `MAX_PER_INSTANCE`, `SHELL`,
1225
+ * `AUDIT_INPUT`; общее правило секций, ADR-023).
1226
+ */
1227
+ export const terminalConfigSchema = z.object({
1228
+ enabled: z.boolean().optional(),
1229
+ autoRestore: z.boolean().optional(),
1230
+ idleMinutes: z.number().int().min(30).max(10080).optional(),
1231
+ maxPerProject: z.number().int().min(1).max(64).optional(),
1232
+ maxPerInstance: z.number().int().min(1).max(256).optional(),
1233
+ shell: z
1234
+ .string()
1235
+ .regex(/^[A-Za-z0-9._/+-]{1,200}$/, 'terminal.shell: ожидается имя программы или абсолютный путь без пробелов (допустимы A-Za-z0-9._/+-), 1…200 символов')
1236
+ .optional(),
1237
+ auditInput: z.boolean().optional(),
1238
+ });
1031
1239
  // --- Webhooks (ADR-052, этап II) ---
1032
1240
  /**
1033
1241
  * ADR-052 (этап II): конфигурация исходящих webhooks.
@@ -1316,9 +1524,79 @@ export const securityTlsConfigSchema = z.object({
1316
1524
  /** Проверять сертификат сервера (по умолчанию `true`). */
1317
1525
  rejectUnauthorized: z.boolean().optional(),
1318
1526
  });
1527
+ /**
1528
+ * PROP-136: append-only аудит исполнений `execute_shell`/`sandbox_exec`.
1529
+ *
1530
+ * `enabled` — мастер-выключатель: выключен — журнал не пишется и команда не
1531
+ * блокируется; включён — **сбой записи блокирует выполнение** (запись `started`
1532
+ * делается до запуска). Профильный дефолт: backend/managed — включён,
1533
+ * standalone — выключен. Env:
1534
+ * `SYNTH_COMMAND_AUDIT_ENABLED`, `SYNTH_COMMAND_AUDIT_RETENTION_DAYS`
1535
+ * (читаются `resolveCommandAuditConfig` в core — приоритет env > config).
1536
+ *
1537
+ * `path` — путь журнала; пусто → `{dataDir}/audit/commands.jsonl`.
1538
+ */
1539
+ export const commandAuditConfigSchema = z.object({
1540
+ enabled: z.boolean().default(false),
1541
+ /** Срок хранения журнала, дней (`prune`); `<= 0` — без ограничения. */
1542
+ retentionDays: z.number().int().default(30),
1543
+ /** Путь журнала (пусто — `{dataDir}/audit/commands.jsonl`). */
1544
+ path: z.string().default(''),
1545
+ });
1546
+ /** PROP-136b: провайдер внешнего чекера команд (`off` — проверки нет). */
1547
+ export const COMMAND_POLICY_PROVIDERS = ['http', 'opa'];
1548
+ /** Поведение при недоступном чекере команд (PROP-136b). */
1549
+ export const COMMAND_POLICY_FAIL_MODES = ['closed', 'open'];
1550
+ /**
1551
+ * PROP-136b (слайс 136b-2a): **зеркальный** внешний чекер команд в control
1552
+ * plane (`security.commandPolicy`).
1553
+ *
1554
+ * Точка принуждения — исполнитель (`command-policy.ts` пакета executor:
1555
+ * проверка до `spawn`). Здесь — ранний отказ/UX и запись вердикта в аудит
1556
+ * исполнений: тот же чекер судит текст команды, но решение **не** является
1557
+ * границей безопасности (её нет у control plane — команда исполняется на
1558
+ * исполнителе). `enabled: false` (дефолт) — поведение прежнее, провайдер не
1559
+ * создаётся.
1560
+ *
1561
+ * `tokenSecret` — **путь** к файлу bearer-токена (инвариант 13), не значение;
1562
+ * читается `readExecutorToken` при первом обращении. `failMode` по умолчанию
1563
+ * `open` (standalone), backend/managed поднимает до `closed` профильным
1564
+ * дефолтом. `enabled: true` без `url` — ошибка старта (fail-closed).
1565
+ *
1566
+ * Env (по общему правилу ADR-023, читаются `applyObjectEnvOverrides`):
1567
+ * `SYNTH_COMMAND_POLICY_ENABLED`, `_PROVIDER`, `_URL`, `_TOKEN`, `_FAIL_MODE`,
1568
+ * `_TIMEOUT_MS`, `_OPA_PATH`.
1569
+ */
1570
+ export const commandPolicyConfigSchema = z
1571
+ .object({
1572
+ enabled: z.boolean().default(false),
1573
+ provider: z.enum(COMMAND_POLICY_PROVIDERS).default('http'),
1574
+ /** Адрес чекера (обязателен при `enabled: true`). */
1575
+ url: z.string().default(''),
1576
+ /** Путь к файлу bearer-токена чекера (не значение). */
1577
+ tokenSecret: z.string().default(''),
1578
+ failMode: z.enum(COMMAND_POLICY_FAIL_MODES).default('open'),
1579
+ /** Таймаут запроса к чекеру, мс. */
1580
+ timeoutMs: z.number().int().min(1).default(2_000),
1581
+ /** Путь OPA-решения (`provider: opa`). */
1582
+ opaPath: z.string().default('/v1/data/synth/exec/decision'),
1583
+ })
1584
+ .superRefine((cfg, ctx) => {
1585
+ if (cfg.enabled && cfg.url.trim() === '') {
1586
+ ctx.addIssue({
1587
+ code: z.ZodIssueCode.custom,
1588
+ path: ['url'],
1589
+ message: 'security.commandPolicy.url обязателен при enabled: true (fail-closed)',
1590
+ });
1591
+ }
1592
+ });
1319
1593
  export const securityConfigSchema = z.object({
1320
1594
  promptInjection: promptInjectionConfigSchema.prefault({}),
1321
1595
  protectedPaths: protectedPathsConfigSchema.prefault({}),
1596
+ /** PROP-136: журнал исполнений shell/песочных команд. */
1597
+ commandAudit: commandAuditConfigSchema.prefault({}),
1598
+ /** PROP-136b: зеркальный внешний чекер команд (опционален; выключен — прежнее поведение). */
1599
+ commandPolicy: commandPolicyConfigSchema.prefault({}),
1322
1600
  /** ADR-099: единый механизм доверия TLS/CA для исходящих соединений. */
1323
1601
  tls: securityTlsConfigSchema.optional(),
1324
1602
  /**
@@ -1451,8 +1729,8 @@ export const llmGatewayAuditConfigSchema = z.object({
1451
1729
  logPath: z.string().default(''), // по умолчанию {dataDir}/audit/llm-gateway.jsonl
1452
1730
  });
1453
1731
  export const llmGatewayConfigSchema = z.object({
1454
- /** Глобальный выключатель LLM Gateway. */
1455
- enabled: z.boolean().default(false),
1732
+ /** Глобальный выключатель LLM Gateway (ADR-147: единый дефолт — включён). */
1733
+ enabled: z.boolean().default(true),
1456
1734
  /** Режим Input Guard: obfuscate (замена на плейсхолдер) | block (запрос блокируется). */
1457
1735
  inputMode: z.enum(['obfuscate', 'block']).default('obfuscate'),
1458
1736
  /** Полное логирование запросов и ответов LLM (после обфускации) в JSONL. */
@@ -1565,6 +1843,7 @@ export const synthConfigSchema = z.object({
1565
1843
  tools: toolsConfigSchema.prefault({}),
1566
1844
  skills: skillsConfigSchema.prefault({}),
1567
1845
  commands: commandsConfigSchema.prefault({}),
1846
+ scripts: scriptsConfigSchema.prefault({}),
1568
1847
  events: eventsConfigSchema.prefault({}),
1569
1848
  scheduler: schedulerConfigSchema.prefault({}),
1570
1849
  decision: decisionConfigSchema.prefault({}),
@@ -1574,10 +1853,15 @@ export const synthConfigSchema = z.object({
1574
1853
  ssh: sshConfigSchema.prefault({}),
1575
1854
  questions: questionsConfigSchema.prefault({}),
1576
1855
  background: backgroundConfigSchema.prefault({}),
1856
+ recovery: recoveryConfigSchema.prefault({}),
1577
1857
  agents: agentsConfigSchema.prefault({}),
1578
1858
  limits: limitsConfigSchema.prefault({}),
1579
1859
  attachments: attachmentsConfigSchema.prefault({}),
1580
1860
  metrics: metricsConfigSchema.prefault({}),
1861
+ // PROP-132: секция `terminal` — мастер-выключатель терминалов. Секция
1862
+ // необязательна: отсутствие = «не задано в config.yaml» (дефолт `enabled:
1863
+ // true` живёт в резолвере ядра).
1864
+ terminal: terminalConfigSchema.optional(),
1581
1865
  updates: updatesConfigSchema.prefault({}),
1582
1866
  authority: authorityConfigSchema.prefault({}),
1583
1867
  plugins: pluginsConfigSchema.prefault({}),
@@ -11,7 +11,7 @@
11
11
  * - `ENGINE_MESSAGE_PARAMS` — для каждого ключа имена {param}-плейсхолдеров en-шаблона.
12
12
  * - `extractParams` — утилита извлечения плейсхолдеров (без логики движка).
13
13
  */
14
- export declare const ENGINE_MESSAGE_KEYS: readonly ["session.max_iterations", "session.steps_limit", "session.stopped", "session.stopped_reason_denied", "session.denied_blocked", "session.role_tool_blocked", "session.empty_response", "session.output_limit", "session.default_title", "session.reference_label", "session.reference_link", "session.retry_cancelled", "session.subtask_title", "session.list", "session.list_empty", "session.details", "session.not_found", "session.rename_ok", "session.save_error", "session.remote_truncated", "task.stopped_by_user", "task.stopped_before_completion", "task.stopped_by_deny", "task.empty_response", "task.subagent_exec_error", "task.subagent_not_found", "task.subagent_not_allowed", "task.deps_unavailable", "task.model_unavailable", "task.model_not_in_catalog", "task.subagent_exec_error_after_retries", "task.depth_limit", "task.resume_marker", "task.resume_result", "task.resume_failed", "task.resume_aborted", "task.resume_session_not_found", "task.resume_no_parent", "task.resume_parent_not_found", "task.resume_locked", "task.resume_agent_not_found", "task.resume_provider_unavailable", "task.steps_limit", "task.steps_limit_empty", "task.context_budget", "subagent.context_budget", "task.background_started", "task.background_limit", "task.background_disabled", "task.resume_foreign_child", "task.resume_child_busy", "tool.args_error", "tool.exec_error", "tool.malformed_call", "tool.not_found", "tool.permission_denied_default", "tool.doom_loop", "tool.disabled_by_step_limit", "tool.empty_output", "tool.output_truncated", "tool.output_bounded", "tool.shell_error", "tool.shell_timeout", "tool.search_timeout", "tool.command_failed_default", "tool.aborted", "tool.binary_missing", "fs.file_written", "fs.file_edited", "fs.replace_not_found", "fs.replace_multiple", "fs.no_changes", "fs.empty_old_string", "fs.mixed_line_endings", "fs.edit_binary", "fs.write_binary", "fs.file_too_large", "fs.file_not_found", "fs.dir_created", "fs.file_deleted", "fs.patch_applied", "fs.patch_file_line", "fs.patch_not_found", "fs.patch_multiple", "fs.patch_write_failed", "fs.patch_file_missing", "fs.patch_not_regular", "fs.patch_too_large", "fs.patch_binary", "fs.patch_summary", "fs.patch_file_added", "fs.patch_file_deleted", "fs.patch_file_renamed", "fs.patch_add_exists", "fs.patch_delete_missing", "fs.patch_rename_missing", "fs.patch_rename_exists", "fs.patch_path_escapes", "fsread.empty_directory", "fsread.empty_file", "fsread.no_files", "fsread.glob_error", "fsread.truncated", "fsread.directory_truncated", "fsread.line_truncated", "fsread.offset_out_of_range", "fsread.binary", "fsread.glob_truncated", "web.duckduckgo_blocked", "web.search_failed", "web.search_results", "web.fetch_args_url_required", "web.js_framework_warning", "web.low_content_warning", "web.content_truncated", "web.body_truncated", "web.block_timeout", "web.block_error", "web.fetch_all_failed", "web.no_results", "web.search_error", "web.search_rate_limited", "web.search_auth_failed", "web.ssrf_blocked", "web.too_many_redirects", "search.no_matches", "search.matches_truncated", "search.line_truncated", "search.matches_excluded", "search.rg_not_installed", "search.error", "search.path_not_found", "search.path_not_directory", "search.invalid_regex", "plan.enter_success", "plan.exit_success", "plan.session_manager_unavailable", "plan.enter_failed", "plan.exit_failed", "plan.project_store_unavailable", "plan.no_project", "plan.no_project_read", "plan.column_not_found", "plan.item_not_found", "plan.save_error", "plan.markdown_title", "plan.markdown_empty", "plan.markdown_column_empty", "plan.markdown_dependencies", "plan.default_column_backlog", "plan.default_column_todo", "plan.default_column_in_progress", "plan.default_column_done", "todo.save_error", "todo.read_error", "todo.list_empty", "todo.list", "todo.item_not_found", "todo.items_not_found", "todo.status_pending", "todo.status_in_progress", "todo.status_completed", "todo.status_cancelled", "todo.priority_high", "todo.priority_medium", "todo.priority_low", "todo.summary", "todo.line", "todo.more", "todo.added", "todo.updated", "todo.deleted", "todo.hint_priority", "todo.hint_plan", "project.deps_unavailable", "project.session_read_error", "project.query_not_found", "project.query_ambiguous", "project.list", "project.list_empty", "project.details", "project.attached_no_workspace", "project.cross_instance", "project.hybrid_ambiguous", "project.remote_unavailable", "project.remote_truncated", "project.session_not_found", "project.save_error", "project.workspace_create_error", "project.created", "project.read_error", "project.not_found", "project.attached", "project.log_no_project", "project.log_save_error", "project.log_added", "project.log_empty", "project.log_list", "project.invariants_no_project", "project.invariants_empty", "project.invariants_saved", "project.invariants_save_error", "project.write_forbidden", "project.updated", "project.updated_ok", "project.invalid_icon", "project.invalid_color", "project.no_project", "project.workspace_set", "project.workspace_invalid", "project.workspace_denied", "project.workspace_confirm_required", "project.workspace_missing", "project.repo_cloned", "project.repo_initialized", "project.repo_registered", "project.repo_fetched", "project.repo_removed", "project.repo_not_found", "projectctx.info_title", "projectctx.info_id", "projectctx.info_workspace", "projectctx.info_description", "projectctx.not_found", "projectctx.missing", "projectctx.working_dir", "projectctx.no_plan_hint", "projectctx.git_section", "projectctx.repo_branch", "projectctx.repo_remote", "projectctx.repo_state", "projectctx.repo_state_dirty", "projectctx.repo_state_clean", "projectctx.repo_last_commit", "projectctx.repos_title", "projectctx.repo_not_found", "projectctx.repos_none", "projectctx.repos_found", "projectctx.repo_destination", "projectctx.repo_name", "projectctx.repo_url", "projectctx.repo_type", "projectctx.repo_default_branch", "projectctx.repo_ssh_key", "projectctx.repo_last_fetch", "tool.classified", "reference.session_manager_unavailable", "reference.session_not_found", "reference.no_messages", "reference.session_title", "permission.yolo_auto_approved", "permission.plan_write_blocked", "permission.plan_source_mode", "permission.plan_source_strict", "permission.plan_shell_denied", "permission.mcp_unavailable", "permission.dep_unavailable", "permission.workspace_unavailable", "permission.storage_unavailable", "permission.external_directory_default", "permission.no_rules", "permission.rule_matched", "permission.rule_pattern_matched", "permission.rule_prefix_matched", "permission.rule_command_matched", "permission.ask_timeout", "permission.ask_cancelled", "permission.ask_no_subscribers", "permission.ask_denied", "permission.authority_denied_unknown", "permission.authority_denied_explicit", "permission.authority_denied_no_grant", "permission.authority_ask", "shellguard.allow_default", "shellguard.deny_prefix", "shellguard.deny_path", "shellguard.ask_path", "shellguard.ask_command", "shellguard.ask_code", "shellguard.ask_stdin_code", "shellguard.deny_dir", "protectedpaths.unresolvable", "protectedpaths.dynamic", "protectedpaths.allow_default", "security.warn_prefix", "security.injection_blocked", "gateway.input_blocked", "gateway.rate_limit_warning", "gateway.output_secrets_reason", "gateway.filter_denied", "gateway.filter_unavailable", "router.timeout", "router.network_error", "router.provider_not_found", "router.provider_disabled", "router.provider_unspecified", "router.model_disabled", "router.escalation", "router.context_length_exceeded", "router.rate_limit_exceeded", "router.no_user_query", "router.remote_auth_expired", "qc.min_length_ok", "qc.min_length_fail_detail", "qc.min_length_fail", "qc.constraint_empty", "qc.constraint_parse_error", "qc.constraint_ok", "qc.self_check_skipped", "qc.self_check_unparsed", "qc.self_check_low", "qc.self_check_low_reason", "qc.self_check_ok", "qc.self_check_error", "qc.all_passed", "micro.greeting", "micro.farewell", "micro.thanks", "micro.enum.yes", "micro.enum.no", "micro.enum.approve", "micro.enum.reject", "micro.enum.mode_plan", "micro.enum.mode_act", "micro.intent.question", "micro.intent.command", "micro.intent.review", "micro.intent.explain", "micro.intent.debug", "micro.intent.fix", "micro.intent.test", "skill.args_error", "skill.not_found", "skill.untrusted", "skill.delegation", "skill.file_not_found", "skill.scope_disabled", "command.unknown", "command.denied", "command.unavailable", "command.help", "command.list_empty", "command.skills_empty", "command.summary_enqueued", "command.summary_unavailable", "context.compression_empty", "context.compression_failed", "context.compression_template", "context.compression_output_limit", "context.summary_applied", "command.inline_shell_disabled", "command.inline_shell_denied", "command.inline_shell_failed", "command.inline_shell_truncated", "command.inline_shell_unavailable", "sshkey.not_found", "sshkey.name_exists", "sshkey.encryption_unavailable", "sshkey.decrypt_failed", "sshkey.env_failed", "ssh.access.key_not_found", "ssh.access.usage_denied", "ssh.access.agent_not_linked", "ssh.access.host_denied", "ssh.access.port_denied", "ssh.access.policy_required", "ssh.access.ambiguous", "ssh.copy.uploaded", "ssh.copy.downloaded", "ssh.tunnel.started", "ssh.tunnel.socks_unsupported", "git.ssh_key_required", "git.ssh_key_required_hint", "git.ssh_keys_none", "sshkeys.tool.header", "sshkeys.tool.empty", "sshkeys.tool.deps_unavailable", "git.repo_path_invalid", "git.repo_not_a_repo", "git.repo_exists", "git.repo_occupied_repo", "git.repo_occupied_stub", "git.repo_occupied_dir", "git.repo_path_unreadable", "git.clone_timeout", "git.fetch_timeout", "git.timeout", "worktree.directory_missing", "worktree.tool.deps_unavailable", "worktree.tool.no_project", "worktree.tool.list_empty", "worktree.tool.list_header", "worktree.tool.list_row", "worktree.tool.created", "worktree.tool.removed", "worktree.tool.pruned", "worktree.tool.force_required", "worktree.tool.busy", "worktree.tool.not_found", "event.ingested", "event.routed.bound", "event.routed.ephemeral", "event.routed.queue", "event.routed.drop", "event.binding.not_found", "event.source_not_allowed", "event.duplicate", "hook.blocked", "steer.injected", "steer.limit_exceeded", "steer.interrupted", "steer.dropped_aborted", "steer.dropped_turn_ended", "steer.requeued_aborted", "steer.requeued_turn_ended", "profile.deps_unavailable", "profile.session_read_error", "profile.session_not_found", "profile.user_unavailable", "profile.save_error", "profile.updated", "pipeline.not_found", "pipeline.not_published", "pipeline.invalid_spec", "pipeline.loop_limit", "pipeline.cancelled", "pipeline.executor_missing", "pipeline.gate_rejected", "pipeline.gate_timeout", "pipeline.step_failed", "pipeline.step_timeout", "pipeline.run_not_found", "pipeline.invalid_state", "pipeline.tool_not_found", "pipeline.tool_failed", "pipeline.script_failed", "pipeline.script_no_command", "pipeline.permission_denied", "pipeline.agent_unavailable", "pipeline.provider_not_found", "pipeline.llm_failed", "pipeline.llm_unrecoverable", "pipeline.tool.deps_unavailable", "pipeline.tool.no_project", "pipeline.tool.forbidden", "pipeline.tool.not_found", "pipeline.tool.already_running", "pipeline.tool.invalid_spec", "pipeline.tool.not_published", "pipeline.tool.run_not_found", "pipeline.tool.run_foreign", "pipeline.tool.run_not_waiting", "pipeline.tool.template_not_found", "pipeline.tool.template_unsupported", "pipeline.tool.saved", "pipeline.tool.published", "pipeline.tool.deleted", "pipeline.tool.run_started", "pipeline.tool.run_resumed", "pipeline.tool.run_cancelled", "pipeline.tool.instantiated", "pipeline.tool.list_empty", "pipeline.tool.runs_empty", "pipeline.tool.templates_empty", "schedule.tool.deps_unavailable", "schedule.tool.forbidden", "schedule.tool.not_found", "schedule.tool.invalid", "schedule.tool.saved", "schedule.tool.deleted", "schedule.tool.ran", "schedule.tool.list_empty", "schedule.tool.jobs_empty", "schedule.tool.target_forbidden", "schedule.tool.not_published", "execution.remote_url_required", "execution.remote_unavailable", "question.answered", "question.cancelled", "question.timeout", "question.deps_unavailable", "process.background_started", "process.deps_unavailable", "process.background_limit", "process.background_unsupported", "process.background_disabled", "process.detached_started", "process.tool.empty", "process.tool.not_found", "process.tool.deps_unavailable", "process.tool.header", "process.tool.no_log", "process.tool.child_history", "process.tool.not_running", "process.tool.running", "process.tool.stopping", "process.tool.deleted", "attach.message.from_workspace", "attach.tool.attached", "attach.tool.deps_unavailable", "attach.tool.delivery_unavailable", "attach.tool.disabled", "attach.tool.not_found", "attach.tool.not_a_file", "attach.tool.too_large", "attach.tool.unsupported_mime", "attach.tool.modality_unsupported", "attach.tool.unrecognized", "attach.tool.queued", "attach.tool.saved", "attach.tool.ambiguous", "attach.tool.no_attachment", "attach.tool.exists", "attach.tool.save_failed", "models.list.header", "models.list.current", "models.list.defaults", "models.list.skipped", "models.list.empty", "models.list.provider_unknown", "models.list.deps_unavailable", "models.list.unavailable", "instance.deps_unavailable", "instance.info", "instance.mcp_list", "instance.mcp_not_found", "instance.mcp_test_ok", "instance.mcp_test_failed", "instance.mcp_add.added", "instance.mcp_update.updated", "instance.mcp_remove.removed", "instance.mcp_enable.session_ok", "instance.mcp_enable.project_ok", "instance.mcp_enable.instance_ok", "instance.mcp_enable.no_project", "instance.mcp_enable.no_session", "instance.mcp_enable.session_forbidden", "instance.mcp_reconnect.ok", "instance.mcp_reconnect.failed", "instance.mcp.forbidden", "instance.mcp.instance_forbidden", "instance.mcp.project_forbidden", "instance.mcp.credential_unsupported", "instance.mcp.secret_header", "instance.mcp.network_denied", "instance.mcp.invalid_config", "instance.mcp.exists"];
14
+ export declare const ENGINE_MESSAGE_KEYS: readonly ["session.max_iterations", "session.steps_limit", "session.stopped", "session.stopped_reason_denied", "session.denied_blocked", "session.role_tool_blocked", "session.empty_response", "session.output_limit", "session.default_title", "session.reference_label", "session.reference_link", "session.retry_cancelled", "session.subtask_title", "session.list", "session.list_empty", "session.details", "session.not_found", "session.rename_ok", "session.save_error", "session.remote_truncated", "task.stopped_by_user", "task.stopped_before_completion", "task.stopped_by_deny", "task.empty_response", "task.subagent_exec_error", "task.subagent_not_found", "task.subagent_not_allowed", "task.deps_unavailable", "task.model_unavailable", "task.model_not_in_catalog", "task.subagent_exec_error_after_retries", "task.depth_limit", "task.resume_marker", "task.resume_result", "task.resume_failed", "task.resume_aborted", "task.resume_session_not_found", "task.resume_no_parent", "task.resume_parent_not_found", "task.resume_locked", "task.resume_agent_not_found", "task.resume_provider_unavailable", "task.steps_limit", "task.steps_limit_empty", "task.context_budget", "subagent.context_budget", "task.background_limit", "task.background_disabled", "task.resume_foreign_child", "task.resume_child_busy", "task.agent_switch_unsupported", "task.continuation_prompt_required", "task.delivery_rejected", "tool.args_error", "tool.exec_error", "tool.malformed_call", "tool.not_found", "tool.permission_denied_default", "tool.doom_loop", "tool.disabled_by_step_limit", "tool.empty_output", "tool.output_truncated", "tool.output_bounded", "tool.shell_error", "tool.shell_timeout", "tool.search_timeout", "tool.command_failed_default", "tool.aborted", "tool.binary_missing", "fs.file_written", "fs.file_edited", "fs.replace_not_found", "fs.replace_multiple", "fs.no_changes", "fs.empty_old_string", "fs.mixed_line_endings", "fs.edit_binary", "fs.write_binary", "fs.file_too_large", "fs.file_not_found", "fs.dir_created", "fs.file_deleted", "fs.patch_applied", "fs.patch_file_line", "fs.patch_not_found", "fs.patch_multiple", "fs.patch_write_failed", "fs.patch_file_missing", "fs.patch_not_regular", "fs.patch_too_large", "fs.patch_binary", "fs.patch_summary", "fs.patch_file_added", "fs.patch_file_deleted", "fs.patch_file_renamed", "fs.patch_add_exists", "fs.patch_delete_missing", "fs.patch_rename_missing", "fs.patch_rename_exists", "fs.patch_path_escapes", "fsread.empty_directory", "fsread.empty_file", "fsread.no_files", "fsread.glob_error", "fsread.truncated", "fsread.directory_truncated", "fsread.line_truncated", "fsread.offset_out_of_range", "fsread.binary", "fsread.glob_truncated", "web.duckduckgo_blocked", "web.search_failed", "web.search_results", "web.fetch_args_url_required", "web.js_framework_warning", "web.low_content_warning", "web.content_truncated", "web.body_truncated", "web.block_timeout", "web.block_error", "web.fetch_all_failed", "web.no_results", "web.search_error", "web.search_rate_limited", "web.search_auth_failed", "web.ssrf_blocked", "web.too_many_redirects", "search.no_matches", "search.matches_truncated", "search.line_truncated", "search.matches_excluded", "search.rg_not_installed", "search.error", "search.path_not_found", "search.path_not_directory", "search.invalid_regex", "plan.enter_success", "plan.exit_success", "plan.session_manager_unavailable", "plan.enter_failed", "plan.exit_failed", "plan.project_store_unavailable", "plan.no_project", "plan.no_project_read", "plan.column_not_found", "plan.item_not_found", "plan.save_error", "plan.markdown_title", "plan.markdown_empty", "plan.markdown_column_empty", "plan.markdown_dependencies", "plan.default_column_backlog", "plan.default_column_todo", "plan.default_column_in_progress", "plan.default_column_done", "todo.save_error", "todo.read_error", "todo.list_empty", "todo.list", "todo.item_not_found", "todo.items_not_found", "todo.status_pending", "todo.status_in_progress", "todo.status_completed", "todo.status_cancelled", "todo.priority_high", "todo.priority_medium", "todo.priority_low", "todo.summary", "todo.line", "todo.more", "todo.added", "todo.updated", "todo.deleted", "todo.hint_priority", "todo.hint_plan", "project.deps_unavailable", "project.session_read_error", "project.query_not_found", "project.query_ambiguous", "project.list", "project.list_empty", "project.details", "project.attached_no_workspace", "project.cross_instance", "project.hybrid_ambiguous", "project.remote_unavailable", "project.remote_truncated", "project.session_not_found", "project.save_error", "project.workspace_create_error", "project.created", "project.read_error", "project.not_found", "project.attached", "project.move_blocked", "project.log_no_project", "project.log_save_error", "project.log_added", "project.log_empty", "project.log_list", "project.invariants_no_project", "project.invariants_empty", "project.invariants_saved", "project.invariants_save_error", "project.write_forbidden", "project.updated", "project.updated_ok", "project.invalid_icon", "project.invalid_color", "project.no_project", "project.workspace_set", "project.workspace_invalid", "project.workspace_denied", "project.workspace_confirm_required", "project.workspace_missing", "project.repo_cloned", "project.repo_initialized", "project.repo_registered", "project.repo_fetched", "project.repo_removed", "project.repo_not_found", "projectctx.info_title", "projectctx.info_id", "projectctx.info_workspace", "projectctx.info_description", "projectctx.not_found", "projectctx.missing", "projectctx.working_dir", "projectctx.no_plan_hint", "projectctx.git_section", "projectctx.repo_branch", "projectctx.repo_remote", "projectctx.repo_state", "projectctx.repo_state_dirty", "projectctx.repo_state_clean", "projectctx.repo_last_commit", "projectctx.repos_title", "projectctx.repo_not_found", "projectctx.repos_none", "projectctx.repos_found", "projectctx.repo_destination", "projectctx.repo_name", "projectctx.repo_url", "projectctx.repo_type", "projectctx.repo_default_branch", "projectctx.repo_ssh_key", "projectctx.repo_last_fetch", "tool.classified", "reference.session_manager_unavailable", "reference.session_not_found", "reference.no_messages", "reference.session_title", "permission.yolo_auto_approved", "permission.plan_write_blocked", "permission.plan_source_mode", "permission.plan_source_strict", "permission.plan_shell_denied", "permission.mcp_unavailable", "permission.dep_unavailable", "permission.workspace_unavailable", "permission.storage_unavailable", "permission.external_directory_default", "permission.no_rules", "permission.rule_matched", "permission.rule_pattern_matched", "permission.rule_prefix_matched", "permission.rule_command_matched", "permission.ask_timeout", "permission.ask_cancelled", "permission.ask_no_subscribers", "permission.ask_denied", "permission.authority_denied_unknown", "permission.authority_denied_explicit", "permission.authority_denied_no_grant", "permission.authority_ask", "shellguard.allow_default", "shellguard.deny_prefix", "shellguard.deny_path", "shellguard.ask_path", "shellguard.ask_external", "shellguard.ask_command", "shellguard.ask_code", "shellguard.ask_stdin_code", "shellguard.deny_dir", "protectedpaths.unresolvable", "protectedpaths.dynamic", "protectedpaths.allow_default", "security.warn_prefix", "security.injection_blocked", "gateway.input_blocked", "gateway.rate_limit_warning", "gateway.output_secrets_reason", "gateway.filter_denied", "gateway.filter_unavailable", "router.timeout", "router.network_error", "router.provider_not_found", "router.provider_disabled", "router.provider_unspecified", "router.model_disabled", "router.escalation", "router.context_length_exceeded", "router.rate_limit_exceeded", "router.quota_exceeded", "router.no_user_query", "router.remote_auth_expired", "stop.steps_limit", "stop.context_budget", "stop.stopped_by_user", "stop.denied", "stop.restarted", "stop.orphaned", "stop.internal", "qc.min_length_ok", "qc.min_length_fail_detail", "qc.min_length_fail", "qc.constraint_empty", "qc.constraint_parse_error", "qc.constraint_ok", "qc.self_check_skipped", "qc.self_check_unparsed", "qc.self_check_low", "qc.self_check_low_reason", "qc.self_check_ok", "qc.self_check_error", "qc.all_passed", "micro.greeting", "micro.farewell", "micro.thanks", "micro.enum.yes", "micro.enum.no", "micro.enum.approve", "micro.enum.reject", "micro.enum.mode_plan", "micro.enum.mode_act", "micro.intent.question", "micro.intent.command", "micro.intent.review", "micro.intent.explain", "micro.intent.debug", "micro.intent.fix", "micro.intent.test", "skill.args_error", "skill.not_found", "skill.untrusted", "skill.delegation", "skill.file_not_found", "skill.scope_disabled", "command.unknown", "command.denied", "command.unavailable", "command.help", "command.list_empty", "command.skills_empty", "command.summary_enqueued", "command.summary_unavailable", "command.compact_enqueued", "command.compact_unavailable", "context.compression_empty", "context.compression_failed", "context.compression_template", "context.compression_output_limit", "context.summary_applied", "command.inline_shell_disabled", "command.inline_shell_denied", "command.inline_shell_failed", "command.inline_shell_truncated", "command.inline_shell_unavailable", "sshkey.not_found", "sshkey.name_exists", "sshkey.encryption_unavailable", "sshkey.decrypt_failed", "sshkey.env_failed", "ssh.access.key_not_found", "ssh.access.usage_denied", "ssh.access.agent_not_linked", "ssh.access.host_denied", "ssh.access.port_denied", "ssh.access.policy_required", "ssh.access.ambiguous", "ssh.copy.uploaded", "ssh.copy.downloaded", "ssh.tunnel.started", "ssh.tunnel.socks_unsupported", "git.ssh_key_required", "git.ssh_key_required_hint", "git.ssh_keys_none", "sshkeys.tool.header", "sshkeys.tool.empty", "sshkeys.tool.deps_unavailable", "git.repo_path_invalid", "git.repo_not_a_repo", "git.repo_exists", "git.repo_occupied_repo", "git.repo_occupied_stub", "git.repo_occupied_dir", "git.repo_path_unreadable", "git.clone_timeout", "git.fetch_timeout", "git.timeout", "worktree.directory_missing", "worktree.tool.deps_unavailable", "worktree.tool.no_project", "worktree.tool.list_empty", "worktree.tool.list_header", "worktree.tool.list_row", "worktree.tool.created", "worktree.tool.removed", "worktree.tool.pruned", "worktree.tool.force_required", "worktree.tool.busy", "worktree.tool.not_found", "event.ingested", "event.routed.bound", "event.routed.ephemeral", "event.routed.queue", "event.routed.drop", "event.binding.not_found", "event.source_not_allowed", "event.duplicate", "hook.blocked", "steer.injected", "steer.limit_exceeded", "steer.interrupted", "steer.dropped_aborted", "steer.dropped_turn_ended", "steer.requeued_aborted", "steer.requeued_turn_ended", "profile.deps_unavailable", "profile.session_read_error", "profile.session_not_found", "profile.user_unavailable", "profile.save_error", "profile.updated", "pipeline.not_found", "pipeline.not_published", "pipeline.invalid_spec", "pipeline.loop_limit", "pipeline.cancelled", "pipeline.executor_missing", "pipeline.gate_rejected", "pipeline.gate_timeout", "pipeline.step_failed", "pipeline.step_timeout", "pipeline.run_not_found", "pipeline.invalid_state", "pipeline.tool_not_found", "pipeline.tool_failed", "pipeline.script_failed", "pipeline.script_no_command", "pipeline.permission_denied", "pipeline.agent_unavailable", "pipeline.provider_not_found", "pipeline.llm_failed", "pipeline.llm_unrecoverable", "pipeline.tool.deps_unavailable", "pipeline.tool.no_project", "pipeline.tool.forbidden", "pipeline.tool.not_found", "pipeline.tool.already_running", "pipeline.tool.invalid_spec", "pipeline.tool.not_published", "pipeline.tool.run_not_found", "pipeline.tool.run_foreign", "pipeline.tool.run_not_waiting", "pipeline.tool.template_not_found", "pipeline.tool.template_unsupported", "pipeline.tool.saved", "pipeline.tool.published", "pipeline.tool.deleted", "pipeline.tool.run_started", "pipeline.tool.run_resumed", "pipeline.tool.run_cancelled", "pipeline.tool.instantiated", "pipeline.tool.list_empty", "pipeline.tool.runs_empty", "pipeline.tool.templates_empty", "schedule.tool.deps_unavailable", "schedule.tool.forbidden", "schedule.tool.not_found", "schedule.tool.invalid", "schedule.tool.saved", "schedule.tool.deleted", "schedule.tool.ran", "schedule.tool.list_empty", "schedule.tool.jobs_empty", "schedule.tool.target_forbidden", "schedule.tool.not_published", "timer.tool.deps_unavailable", "timer.tool.no_project", "timer.tool.not_found", "timer.tool.created", "timer.tool.updated", "timer.tool.cancelled", "timer.tool.stopped", "timer.tool.already_fired", "timer.tool.already_stopped", "timer.tool.deleted", "timer.tool.show_header", "timer.tool.duplicate", "timer.tool.wrong_kind", "timer.tool.time_in_past", "timer.tool.not_active", "timer.tool.list_header", "timer.tool.list_empty", "timer.tool.invalid_comment", "timer.tool.invalid_interval", "timer.tool.invalid_time", "timer.tool.invalid_timezone", "timer.tool.invalid_horizon", "timer.tool.invalid_target", "timer.tool.limit_exceeded", "execution.remote_url_required", "execution.remote_unavailable", "question.answered", "question.cancelled", "question.timeout", "question.deps_unavailable", "background.started.process", "background.started.subagent", "background.detached.process", "background.detached.subagent", "background.detached.process_message", "background.detached.subagent_message", "process.deps_unavailable", "process.background_limit", "process.background_unsupported", "process.background_disabled", "process.tool.empty", "process.tool.not_found", "process.tool.deps_unavailable", "process.tool.header", "process.tool.no_log", "process.tool.child_history", "process.tool.not_running", "process.tool.running", "process.tool.stopping", "process.tool.deleted", "attach.message.from_workspace", "attach.tool.attached", "attach.tool.deps_unavailable", "attach.tool.delivery_unavailable", "attach.tool.disabled", "attach.tool.not_found", "attach.tool.not_a_file", "attach.tool.too_large", "attach.tool.unsupported_mime", "attach.tool.modality_unsupported", "attach.tool.unrecognized", "attach.tool.queued", "attach.tool.saved", "attach.tool.ambiguous", "attach.tool.no_attachment", "attach.tool.exists", "attach.tool.save_failed", "models.list.header", "models.list.current", "models.list.defaults", "models.list.skipped", "models.list.empty", "models.list.provider_unknown", "models.list.deps_unavailable", "models.list.unavailable", "instance.deps_unavailable", "instance.info", "instance.mcp_list", "instance.mcp_not_found", "instance.mcp_test_ok", "instance.mcp_test_failed", "instance.mcp_add.added", "instance.mcp_update.updated", "instance.mcp_remove.removed", "instance.mcp_enable.session_ok", "instance.mcp_enable.project_ok", "instance.mcp_enable.instance_ok", "instance.mcp_enable.no_project", "instance.mcp_enable.no_session", "instance.mcp_enable.session_forbidden", "instance.mcp_reconnect.ok", "instance.mcp_reconnect.failed", "instance.mcp.forbidden", "instance.mcp.instance_forbidden", "instance.mcp.project_forbidden", "instance.mcp.credential_unsupported", "instance.mcp.secret_header", "instance.mcp.network_denied", "instance.mcp.invalid_config", "instance.mcp.exists", "terminal.tool.deps_unavailable", "terminal.tool.disabled", "terminal.tool.project_required", "terminal.tool.empty", "terminal.tool.header", "terminal.tool.not_found", "terminal.tool.no_output", "terminal.tool.opened", "terminal.tool.written", "terminal.tool.signalled", "terminal.tool.closed", "terminal.tool.command_denied", "terminal.tool.command_requires_approval", "terminal.tool.limit", "terminal.tool.unavailable", "terminal.tool.history_empty", "terminal.tool.snapshot_empty", "terminal.tool.run_background_started", "terminal.tool.run_result_header", "terminal.tool.run_finished", "terminal.tool.run_timeout", "terminal.tool.run_exited", "terminal.tool.run_still_running", "terminal.tool.run_busy", "terminal.tool.foreground_app", "terminal.tool.foreground_busy", "terminal.tool.exit_code", "script.tool.deps_unavailable", "script.tool.run_hint", "script.tool.empty", "script.tool.header", "script.tool.audit_failed", "script.not_found", "script.untrusted", "script.denied", "script.args_not_allowed", "script.args_invalid", "script.cwd_outside", "script.background_disabled", "script.started", "script.plan_blocked", "script.gateway_unsupported"];
15
15
  export type EngineMessageKey = (typeof ENGINE_MESSAGE_KEYS)[number];
16
16
  export declare const ENGINE_MESSAGE_PARAMS: Record<EngineMessageKey, readonly string[]>;
17
17
  /** Достаёт имена {param}-плейсхолдеров из шаблона. Уникальные, в порядке появления. */