dsh-department 0.1.0 → 0.2.0

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/client.js CHANGED
@@ -20,6 +20,7 @@ window.__ModuleLoader__.load({
20
20
  'nav.office': 'Офис',
21
21
  'nav.blueprint': 'Схема',
22
22
  'nav.charts': 'Графики',
23
+ 'nav.editor': 'Редактор',
23
24
  'nav.refresh': 'Обновить',
24
25
  'office.title': 'Офис отдела',
25
26
  'office.staff': 'сотрудников: {n} из {m}',
@@ -38,12 +39,13 @@ window.__ModuleLoader__.load({
38
39
  'tabs.billing': 'Бюджет',
39
40
  'tabs.git': 'Git',
40
41
 
41
- 'stage.analysis': 'Анализ',
42
+ 'stage.analysis': 'Обсуждение',
42
43
  'stage.concept': 'Концепция',
43
44
  'stage.concept_review': 'Проверка концепции',
44
45
  'stage.spec': 'ТЗ',
45
46
  'stage.spec_review': 'Проверка ТЗ',
46
47
  'stage.executing': 'Исполнение',
48
+ 'stage.release': 'Подготовка к продакшену',
47
49
  'stage.done': 'Завершено',
48
50
  'stage.blocked': 'Заблокировано',
49
51
  'status.pass': 'Пройдено',
@@ -77,6 +79,9 @@ window.__ModuleLoader__.load({
77
79
  'block.cost': 'Стоимость',
78
80
  'block.calls': 'Вызовов модели',
79
81
  'block.approval': 'Утверждение',
82
+ 'approve.spec': 'Утвердить ТЗ',
83
+ 'approve.concept': 'Утвердить концепцию',
84
+ 'doc.main': 'главный документ',
80
85
  'block.openQuestions': 'Открытые вопросы',
81
86
  'block.documents': 'Документы',
82
87
  'block.recentEvents': 'Последние события',
@@ -108,6 +113,77 @@ window.__ModuleLoader__.load({
108
113
  'event.unknown': 'событие',
109
114
  'branch.prefix': 'ветка',
110
115
 
116
+
117
+ 'dept.enabled': 'Отдел: вкл',
118
+ 'dept.disabled': 'Отдел: выкл',
119
+ 'dept.newTask': '+ Задача',
120
+ 'dept.createTitle': 'Новая задача отдела',
121
+ 'dept.root': 'Проект',
122
+ 'dept.taskId': 'ID задачи',
123
+ 'dept.title': 'Название',
124
+ 'dept.brief': 'Бриф',
125
+ 'dept.test': 'Команда тестов',
126
+ 'dept.create': 'Создать',
127
+ 'dept.cancel': 'Отмена',
128
+ 'dept.offBanner': 'Отдел выключен — новые задачи не запускаются, инструменты заблокированы.',
129
+ 'activity.title': 'Сейчас работают',
130
+ 'activity.none': 'активности нет',
131
+ 'office.lounge': 'КОМНАТА ОТДЫХА',
132
+ 'office.status.paused': 'пауза',
133
+ 'office.status.working': 'работает',
134
+ 'office.status.walking': 'идёт',
135
+ 'office.status.break': 'перерыв',
136
+ 'office.status.free': 'свободно',
137
+ 'side.project': 'Проект:',
138
+ 'side.now': 'Сейчас',
139
+ 'side.files': 'Файлы:',
140
+ 'side.recent': 'Последние действия',
141
+ 'side.openTask': 'Открыть задачу',
142
+ 'side.choose': 'Выбери человечка на схеме — здесь появятся проект, файлы и история.',
143
+ 'badge.onPause': '⏸ на паузе',
144
+ 'msg.pricesSaved': 'Цены сохранены',
145
+ 'msg.done': 'Готово',
146
+ 'msg.error': 'ошибка',
147
+
148
+ 'billing.hint': 'Лимит и цены за 1M токенов; курс — для пересчёта в рубли.',
149
+ 'billing.live': 'сейчас (после перезапуска)',
150
+ 'billing.total': 'всего по этапам',
151
+ 'billing.totalCost': 'стоимость по этапам',
152
+ 'billing.snapshot': 'снимок при последнем коммите',
153
+ 'billing.humanSet': 'лимит установлен человеком',
154
+ 'billing.limit': 'Лимит токенов',
155
+ 'billing.input': '$/1M вход',
156
+ 'billing.output': '$/1M выход',
157
+ 'billing.cacheRead': '$/1M кэш-чтение',
158
+ 'billing.cacheWrite': '$/1M кэш-запись',
159
+ 'billing.rate': 'курс ₽',
160
+ 'roles.hint': 'Модель и reasoning для каждой роли. Пустая модель — по умолчанию.',
161
+ 'roles.core': 'основная роль — всегда включена',
162
+ 'roles.toggle': 'включить/выключить роль',
163
+ 'roles.saved': 'Лимит роли сохранён',
164
+ 'git.noCommits': 'нет коммитов',
165
+ 'none.short': 'нет',
166
+ 'questions.empty': 'Открытых вопросов нет.',
167
+ 'questions.waiting': 'ждёт ответа',
168
+ 'questions.answer': 'ответ',
169
+ 'questions.answerBtn': 'Ответить',
170
+ 'questions.memos': 'Служебные записки (ждут решения человека)',
171
+ 'questions.memo': 'записка',
172
+ 'questions.decision': 'решение команды: ',
173
+ 'questions.file': 'файл: ',
174
+ 'questions.remarks': 'замечания (если не устраивает)',
175
+ 'questions.approve': 'Утвердить',
176
+ 'questions.changes': 'Замечания',
177
+ 'questions.answered': 'Отвеченные',
178
+ 'questions.answeredBadge': 'отвечен',
179
+ 'correction.hint': 'Как письмо руководителю: что поменять и к чему это относится.',
180
+ 'correction.toManager': 'Руководитель возьмёт в работу и соберёт специалистов.',
181
+ 'correction.concept': 'Концепция',
182
+ 'correction.spec': 'ТЗ',
183
+ 'correction.plan': 'План',
184
+ 'correction.code': 'Код',
185
+ 'correction.data': 'Данные',
186
+ 'correction.interface': 'Интерфейс',
111
187
  'block.newCorrection': 'Новая корректировка',
112
188
  'block.correctionHistory': 'История корректировок',
113
189
  'block.billing': 'Бюджет и цены',
@@ -149,6 +225,62 @@ window.__ModuleLoader__.load({
149
225
  'event.idea_critiqued': 'Идея оценена',
150
226
  'event.module_planned': 'Модули спланированы',
151
227
 
228
+ 'projects.count': "проектов: {n}",
229
+ 'projects.none': "Проектов с задачами нет.",
230
+ 'btn.reset': "Сбросить",
231
+ 'btn.save': "Сохранить",
232
+ 'title.textSize': "Размер текста",
233
+ 'pause.byButton': "по кнопке",
234
+ 'roles.instances': "сколько экземпляров роли можно запускать одновременно",
235
+ 'roles.enabled': "Роль включена",
236
+ 'roles.disabled': "Роль выключена",
237
+ 'roles.coreMark': " · основная",
238
+ 'block.byStages': "По этапам",
239
+ 'unit.tokens': " т. · $",
240
+ 'chart.costTitle': "Стоимость",
241
+ 'form.name': "ваше имя",
242
+ 'form.nameTitle': "Имя для подписи",
243
+ 'empty.projects': "Нет проектов с задачами.",
244
+ 'empty.tasks': "Нет задач.",
245
+ 'empty.noTasksHint': "Задач пока нет. Создай задачу через dept_start.",
246
+ 'loading.task': "Загрузка задачи…",
247
+ 'title.department': "ИИ-отдел разработки",
248
+ 'title.departmentShort': "ИИ-отдел",
249
+ 'count.tasks': "задач: {n}",
250
+ 'count.refreshing': " · обновление…",
251
+ 'charts.tokensLine': "токенов: {t} · ${c} · время: {h} ч {m} мин",
252
+ 'charts.duration': "Длительность",
253
+ 'charts.gates': "Гейты по этапам",
254
+ 'minutesShort': "мин",
255
+ 'status.workingBadge': "● работает",
256
+ 'status.breakBadge': "○ перерыв",
257
+ 'status.pausedBadge': "⏸ пауза",
258
+ 'bp.filesCount': "файлов: {n}",
259
+ 'bp.linesCount': "строк: {n}",
260
+ 'bp.stats': "файлов: {f} · строк: {l} · связей: {e}",
261
+ 'bp.loading': "загрузка…",
262
+ 'bp.allGroups': "← Все группы",
263
+ 'bp.groups': "Группы",
264
+ 'bp.lines': "строк",
265
+ 'bp.layer': "слой",
266
+ 'bp.symbols': "Функции и классы",
267
+ 'bp.imports': "Импортирует",
268
+ 'bp.usedBy': "Используется в",
269
+ 'bp.inner': "внутри группы связей: {i} · наружу: {o}",
270
+ 'bp.root': "(корень)",
271
+ 'layer.core': "Ядро",
272
+ 'layer.ui': "Интерфейс",
273
+ 'layer.tests': "Тесты",
274
+ 'layer.docs': "Документы",
275
+ 'bp.title': "Схема проекта",
276
+ 'bp.byDir': "По папкам",
277
+ 'bp.byLayer': "По слоям",
278
+ 'bp.choose': "Выбери группу слева, затем файл на схеме.",
279
+ 'charts.title': "Графики по этапам",
280
+ 'stageNo': "этап",
281
+ 'none.yet': "пока нет",
282
+ 'activity.manager': "менеджер",
283
+ 'activity.subagent': "субагент",
152
284
  },
153
285
  en: {
154
286
  'nav.board': 'Board',
@@ -156,6 +288,7 @@ window.__ModuleLoader__.load({
156
288
  'nav.office': 'Office',
157
289
  'nav.blueprint': 'Blueprint',
158
290
  'nav.charts': 'Charts',
291
+ 'nav.editor': 'Editor',
159
292
  'nav.refresh': 'Refresh',
160
293
  'office.title': 'Department office',
161
294
  'office.staff': 'staff: {n} of {m}',
@@ -174,12 +307,13 @@ window.__ModuleLoader__.load({
174
307
  'tabs.billing': 'Budget',
175
308
  'tabs.git': 'Git',
176
309
 
177
- 'stage.analysis': 'Analysis',
310
+ 'stage.analysis': 'Discussion',
178
311
  'stage.concept': 'Concept',
179
312
  'stage.concept_review': 'Concept review',
180
313
  'stage.spec': 'Spec',
181
314
  'stage.spec_review': 'Spec review',
182
315
  'stage.executing': 'Execution',
316
+ 'stage.release': 'Production prep',
183
317
  'stage.done': 'Done',
184
318
  'stage.blocked': 'Blocked',
185
319
  'status.pass': 'Pass',
@@ -213,6 +347,9 @@ window.__ModuleLoader__.load({
213
347
  'block.cost': 'Cost',
214
348
  'block.calls': 'Model calls',
215
349
  'block.approval': 'Approval',
350
+ 'approve.spec': 'Approve spec',
351
+ 'approve.concept': 'Approve concept',
352
+ 'doc.main': 'key document',
216
353
  'block.openQuestions': 'Open questions',
217
354
  'block.documents': 'Documents',
218
355
  'block.recentEvents': 'Recent events',
@@ -244,6 +381,137 @@ window.__ModuleLoader__.load({
244
381
  'event.unknown': 'event',
245
382
  'branch.prefix': 'branch',
246
383
 
384
+
385
+ 'dept.enabled': 'Department: on',
386
+ 'dept.disabled': 'Department: off',
387
+ 'dept.newTask': '+ Task',
388
+ 'dept.createTitle': 'New department task',
389
+ 'dept.root': 'Project',
390
+ 'dept.taskId': 'Task ID',
391
+ 'dept.title': 'Title',
392
+ 'dept.brief': 'Brief',
393
+ 'dept.test': 'Test command',
394
+ 'dept.create': 'Create',
395
+ 'dept.cancel': 'Cancel',
396
+ 'dept.offBanner': 'Department is off — new tasks are not started, tools are blocked.',
397
+ 'activity.title': 'Working now',
398
+ 'activity.none': 'no activity',
399
+ 'office.lounge': 'LOUNGE',
400
+ 'office.status.paused': 'paused',
401
+ 'office.status.working': 'working',
402
+ 'office.status.walking': 'walking',
403
+ 'office.status.break': 'on break',
404
+ 'office.status.free': 'free',
405
+ 'side.project': 'Project:',
406
+ 'side.now': 'Now',
407
+ 'side.files': 'Files:',
408
+ 'side.recent': 'Recent actions',
409
+ 'side.openTask': 'Open task',
410
+ 'side.choose': 'Pick a person on the map — project, files and history appear here.',
411
+ 'badge.onPause': '⏸ paused',
412
+ 'msg.pricesSaved': 'Prices saved',
413
+ 'msg.done': 'Done',
414
+ 'msg.error': 'error',
415
+
416
+
417
+
418
+
419
+
420
+ 'projects.count': 'projects: {n}',
421
+ 'projects.none': 'No projects with tasks.',
422
+ 'btn.reset': 'Reset',
423
+ 'btn.save': 'Save',
424
+ 'title.textSize': 'Text size',
425
+ 'pause.byButton': 'by button',
426
+ 'roles.instances': 'how many instances of the role can run at once',
427
+ 'roles.enabled': 'Role enabled',
428
+ 'roles.disabled': 'Role disabled',
429
+ 'roles.coreMark': ' · core',
430
+ 'block.byStages': 'By stages',
431
+ 'unit.tokens': ' k · $',
432
+ 'chart.costTitle': 'Cost',
433
+ 'form.name': 'your name',
434
+ 'form.nameTitle': 'Signature name',
435
+ 'empty.projects': 'No projects with tasks.',
436
+ 'empty.tasks': 'No tasks.',
437
+ 'empty.noTasksHint': 'No tasks yet. Create one with dept_start.',
438
+ 'loading.task': 'Loading task…',
439
+ 'title.department': 'AI development department',
440
+ 'title.departmentShort': 'Department',
441
+ 'count.tasks': 'tasks: {n}',
442
+ 'count.refreshing': ' · refreshing…',
443
+ 'charts.tokensLine': 'tokens: {t} · ${c} · time: {h}h {m}m',
444
+ 'charts.duration': 'Duration',
445
+ 'charts.gates': 'Gates by stages',
446
+ 'minutesShort': 'min',
447
+ 'status.workingBadge': '● working',
448
+ 'status.breakBadge': '○ on break',
449
+ 'status.pausedBadge': '⏸ paused',
450
+ 'bp.filesCount': 'files: {n}',
451
+ 'bp.linesCount': 'lines: {n}',
452
+ 'bp.stats': 'files: {f} · lines: {l} · edges: {e}',
453
+ 'bp.loading': 'loading…',
454
+ 'bp.allGroups': '← All groups',
455
+ 'bp.groups': 'Groups',
456
+ 'bp.lines': 'lines',
457
+ 'bp.layer': 'layer',
458
+ 'bp.symbols': 'Functions and classes',
459
+ 'bp.imports': 'Imports',
460
+ 'bp.usedBy': 'Used by',
461
+ 'bp.inner': 'inside group edges: {i} · outside: {o}',
462
+ 'bp.root': '(root)',
463
+ 'layer.core': 'Core',
464
+ 'layer.ui': 'UI',
465
+ 'layer.tests': 'Tests',
466
+ 'layer.docs': 'Docs',
467
+ 'bp.title': 'Project blueprint',
468
+ 'bp.byDir': 'By folders',
469
+ 'bp.byLayer': 'By layers',
470
+ 'bp.choose': 'Pick a group on the left, then a file on the map.',
471
+ 'charts.title': 'Charts by stages',
472
+ 'stageNo': 'stage',
473
+ 'none.yet': 'none yet',
474
+ 'activity.manager': 'manager',
475
+ 'activity.subagent': 'subagent',
476
+ 'billing.hint': 'Token limit and prices per 1M tokens; rate converts to RUB.',
477
+ 'billing.live': 'current (since restart)',
478
+ 'billing.total': 'total by stages',
479
+ 'billing.totalCost': 'cost by stages',
480
+ 'billing.snapshot': 'snapshot at last commit',
481
+ 'billing.humanSet': 'limit set by human',
482
+ 'billing.limit': 'Token limit',
483
+ 'billing.input': '$/1M input',
484
+ 'billing.output': '$/1M output',
485
+ 'billing.cacheRead': '$/1M cache read',
486
+ 'billing.cacheWrite': '$/1M cache write',
487
+ 'billing.rate': 'rate RUB',
488
+ 'roles.hint': 'Model and reasoning per role. Empty model means default.',
489
+ 'roles.core': 'core role — always enabled',
490
+ 'roles.toggle': 'enable/disable role',
491
+ 'roles.saved': 'Role limit saved',
492
+ 'git.noCommits': 'no commits',
493
+ 'none.short': 'none',
494
+ 'questions.empty': 'No open questions.',
495
+ 'questions.waiting': 'waiting for answer',
496
+ 'questions.answer': 'answer',
497
+ 'questions.answerBtn': 'Answer',
498
+ 'questions.memos': 'Memos (waiting for human decision)',
499
+ 'questions.memo': 'memo',
500
+ 'questions.decision': 'team decision: ',
501
+ 'questions.file': 'file: ',
502
+ 'questions.remarks': 'remarks (if not satisfied)',
503
+ 'questions.approve': 'Approve',
504
+ 'questions.changes': 'Remarks',
505
+ 'questions.answered': 'Answered',
506
+ 'questions.answeredBadge': 'answered',
507
+ 'correction.hint': 'Like a letter to the manager: what to change and what it relates to.',
508
+ 'correction.toManager': 'The manager will take it and gather specialists.',
509
+ 'correction.concept': 'Concept',
510
+ 'correction.spec': 'Spec',
511
+ 'correction.plan': 'Plan',
512
+ 'correction.code': 'Code',
513
+ 'correction.data': 'Data',
514
+ 'correction.interface': 'Interface',
247
515
  'block.newCorrection': 'New correction',
248
516
  'block.correctionHistory': 'Correction history',
249
517
  'block.billing': 'Budget & prices',
@@ -367,6 +635,9 @@ window.__ModuleLoader__.load({
367
635
  document: '/api/department/document',
368
636
  correction: '/api/department/correction',
369
637
  pause: '/api/department/pause',
638
+ settings: '/api/department/settings',
639
+ createTask: '/api/department/task/create',
640
+ editor: '/api/department/editor',
370
641
  projects: '/api/department/projects',
371
642
  review: '/api/department/review',
372
643
  }
@@ -431,7 +702,11 @@ window.__ModuleLoader__.load({
431
702
  .dept-table th { background: #182235; color: #c9d6ea; }
432
703
  .dept-table tr:nth-child(even) td { background: #121a28; }
433
704
  .dept-pre { white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: calc(var(--dept-text, 13px) - 1px); color: var(--dsw-alias-label-secondary, #b8c4d6); }
434
- .dept-empty { padding: 24px; text-align: center; color: var(--dsw-alias-label-tertiary, #8b98ad); }
705
+ .dept-modal { position: fixed; inset: 0; background: #0008; display: flex; align-items: center; justify-content: center; z-index: 50; }
706
+ .dept-modal-card { background: var(--dsw-alias-bg-secondary, #141a28); border: 1px solid var(--dsw-alias-border-secondary, #2a3446); border-radius: 12px; padding: 16px; width: min(560px, 92vw); display: flex; flex-direction: column; gap: 10px; }
707
+ .dept-form-row { display: grid; grid-template-columns: 140px 1fr; gap: 8px; align-items: center; }
708
+ .dept-form-row textarea { resize: vertical; }
709
+ .dept-empty { padding: 24px; text-align: center; color: var(--dsw-alias-label-tertiary, #8b98ad); }
435
710
  .dept-office-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
436
711
  .dept-office { min-width: 0; }
437
712
  .dept-office-side { width: 340px; border: 1px solid var(--dsw-alias-border-secondary, #232c3d); border-radius: 12px; padding: 10px; background: var(--dsw-alias-bg-secondary, #10151f); display: flex; flex-direction: column; gap: 6px; }
@@ -516,14 +791,14 @@ window.__ModuleLoader__.load({
516
791
  return h(
517
792
  'div',
518
793
  null,
519
- h('div', { className: 'dept-title' }, 'Сейчас работают'),
794
+ h('div', { className: 'dept-title' }, t('activity.title')),
520
795
  error ? h('div', { className: 'dept-sub' }, error) : null,
521
796
  items.length === 0
522
- ? h('div', { className: 'dept-sub' }, 'активности нет')
797
+ ? h('div', { className: 'dept-sub' }, t('activity.none'))
523
798
  : h('div', { className: 'dept-events' }, ...items.map((entry) =>
524
799
  h('div', { key: entry.sessionId, className: 'dept-event' },
525
800
  h('span', { className: entry.busy ? 'dept-badge ok' : 'dept-badge wait' }, entry.busy ? '●' : '○'),
526
- h('span', null, `${entry.kind}: ${entry.lastAction}${entry.tool ? ' · ' + entry.tool : ''}`),
801
+ h('span', null, `${entry.kind === 'менеджер' ? t('activity.manager') : t('activity.subagent')}: ${entry.lastAction}${entry.tool ? ' · ' + entry.tool : ''}`),
527
802
  h('span', { className: 'dept-sub' }, formatElapsed(entry.elapsedMs)),
528
803
  ))),
529
804
  )
@@ -850,7 +1125,7 @@ window.__ModuleLoader__.load({
850
1125
  { className: 'dept-root' },
851
1126
  h('div', { className: 'dept-row' },
852
1127
  h('div', { className: 'dept-title' }, t('office.title')),
853
- paused ? h('span', { className: 'dept-badge wait' }, '⏸ отдел на паузе' + (pauseReason ? ': ' + pauseReason : '')) : null,
1128
+ paused ? h('span', { className: 'dept-badge wait' }, t('office.paused') + (pauseReason ? ': ' + pauseReason : '')) : null,
854
1129
  h('div', { className: 'dept-sub' }, items.length ? t('office.staff', { n: items.length, m: DESKS.length }) : t('office.empty'))),
855
1130
  party
856
1131
  ? h('div', { className: 'dept-block', style: { borderColor: '#7fdc9a', textAlign: 'center' } },
@@ -859,7 +1134,7 @@ window.__ModuleLoader__.load({
859
1134
  : null,
860
1135
  h('div', { style: { display: 'flex', gap: '12px', alignItems: 'flex-start', flexWrap: 'nowrap' } },
861
1136
  h('div', { className: 'dept-office', style: { flex: '1 1 auto', minWidth: 0 } },
862
- h('svg', { viewBox: '0 0 640 400', role: 'img', 'aria-label': 'Офис ИИ-отдела', style: { imageRendering: 'pixelated' } },
1137
+ h('svg', { viewBox: '0 0 640 400', role: 'img', 'aria-label': t('office.fullTitle'), style: { imageRendering: 'pixelated' } },
863
1138
  h('defs', null,
864
1139
  h('pattern', { id: 'dept-floor', width: 16, height: 16, patternUnits: 'userSpaceOnUse' },
865
1140
  box(0, 0, 16, 16, '#c9b48c'),
@@ -872,7 +1147,7 @@ window.__ModuleLoader__.load({
872
1147
  wall(404, 14, 8, 128), door(404, 142, 8, 34), wall(404, 176, 8, 116),
873
1148
  wall(412, 292, 216, 8), wall(12, 292, 172, 8), door(184, 292, 40, 8), door(470, 292, 40, 8), wall(510, 292, 118, 8),
874
1149
  h('text', { x: 22, y: 34, fill: '#8a96ad', fontSize: 9 }, 'OPEN SPACE'),
875
- h('text', { x: 420, y: 34, fill: '#8a96ad', fontSize: 9 }, 'КОМНАТА ОТДЫХА'),
1150
+ h('text', { x: 420, y: 34, fill: '#8a96ad', fontSize: 9 }, t('office.lounge')),
876
1151
  plant(26, 268), plant(386, 24), plant(26, 24), plant(618, 276),
877
1152
  cooler(366, 58),
878
1153
  // диван вдоль стены комнаты отдыха
@@ -919,7 +1194,7 @@ window.__ModuleLoader__.load({
919
1194
  const busy = Boolean(entry?.busy)
920
1195
  const atDesk = actor?.mode === 'desk'
921
1196
  return h('text', { key: 'label-' + desk.key, x: desk.x, y: desk.y + 48, fill: atDesk ? '#9fd0ff' : '#6f7f98', fontSize: 8, textAnchor: 'middle' },
922
- desk.label + (paused ? ' · пауза' : entry ? (atDesk ? ' · работает' : busy ? ' · идёт' : ' · перерыв') : ' · свободно'))
1197
+ roleLabel(desk.key) + (paused ? ' · ' + t('office.status.paused') : entry ? (atDesk ? ' · ' + t('office.status.working') : busy ? ' · ' + t('office.status.walking') : ' · ' + t('office.status.break')) : ' · ' + t('office.status.free')))
923
1198
  }),
924
1199
  ),
925
1200
  ),
@@ -928,22 +1203,22 @@ window.__ModuleLoader__.load({
928
1203
  ? [
929
1204
  h('div', { className: 'dept-title' }, roleLabel(selectedEntry.kind === 'менеджер' ? 'manager' : (assignments.current.get(selectedEntry.sessionId) ?? inferRole(selectedEntry)))),
930
1205
  h('div', { className: 'dept-row' },
931
- h('span', { className: (selectedEntry.busy && !paused) ? 'dept-badge ok' : 'dept-badge wait' }, paused ? '⏸ пауза' : selectedEntry.busy ? '● работает' : '○ перерыв'),
1206
+ h('span', { className: (selectedEntry.busy && !paused) ? 'dept-badge ok' : 'dept-badge wait' }, paused ? t('status.pausedBadge') : selectedEntry.busy ? t('status.workingBadge') : t('status.breakBadge')),
932
1207
  h('span', { className: 'dept-sub' }, formatElapsed(selectedEntry.elapsedMs))),
933
- h('div', { className: 'dept-sub' }, 'Проект: ' + projectName(selectedEntry.cwd) + (selectedTask ? ' · ' + selectedTask.taskId + ' · ' + selectedTask.stage : '')),
934
- h('div', { className: 'dept-sub' }, 'Сейчас'),
1208
+ h('div', { className: 'dept-sub' }, t('side.project') + ' ' + projectName(selectedEntry.cwd) + (selectedTask ? ' · ' + selectedTask.taskId + ' · ' + selectedTask.stage : '')),
1209
+ h('div', { className: 'dept-sub' }, t('side.now')),
935
1210
  h('div', { className: 'dept-pre' }, `${selectedEntry.lastAction}${selectedEntry.tool ? '\n' + selectedEntry.tool : ''}${selectedEntry.args ? '\n' + selectedEntry.args : ''}`),
936
- (filesOf(selectedEntry).length ? h('div', { className: 'dept-sub' }, 'Файлы: ' + filesOf(selectedEntry).join(', ')) : null),
937
- h('div', { className: 'dept-sub' }, 'Последние действия'),
1211
+ (filesOf(selectedEntry).length ? h('div', { className: 'dept-sub' }, t('side.files') + ' ' + filesOf(selectedEntry).join(', ')) : null),
1212
+ h('div', { className: 'dept-sub' }, t('side.recent')),
938
1213
  (selectedEntry.recent ?? []).length === 0
939
- ? h('div', { className: 'dept-sub' }, 'пока нет')
1214
+ ? h('div', { className: 'dept-sub' }, t('none.yet'))
940
1215
  : h('div', { className: 'dept-events' }, ...selectedEntry.recent.map((event, index) =>
941
1216
  h('div', { key: index, className: 'dept-event' },
942
1217
  h('time', null, String(new Date(event.ts).toLocaleTimeString('ru-RU'))),
943
1218
  h('span', null, event.text)))),
944
- selectedTask ? h('button', { className: 'dept-btn', onClick: () => onOpenTask(selectedEntry.cwd) }, 'Открыть задачу') : null,
1219
+ selectedTask ? h('button', { className: 'dept-btn', onClick: () => onOpenTask(selectedEntry.cwd) }, t('side.openTask')) : null,
945
1220
  ]
946
- : h('div', { className: 'dept-sub' }, 'Выбери человечка на схеме — здесь появятся проект, файлы и история.'),
1221
+ : h('div', { className: 'dept-sub' }, t('side.choose')),
947
1222
  ),
948
1223
  ),
949
1224
  )
@@ -988,6 +1263,11 @@ window.__ModuleLoader__.load({
988
1263
  .catch((problem) => setContent(t('doc.error') + problem.message))
989
1264
  }, [selected, root, taskId])
990
1265
 
1266
+ const MAIN_DOCS = ['spec.md', 'concept.md', 'plan.md']
1267
+ const mainRank = (item) => {
1268
+ const index = MAIN_DOCS.indexOf(String(item.path).split('/').pop())
1269
+ return index === -1 ? 9 : index
1270
+ }
991
1271
  const types = ['all', ...new Set(documents.map((item) => item.type))]
992
1272
  const memoPaths = memos ?? []
993
1273
  const isMemo = (item) => item.type === 'служебная записка' && memoPaths.some((path) => String(path).endsWith(item.path))
@@ -998,7 +1278,7 @@ window.__ModuleLoader__.load({
998
1278
  const haystack = (item.title + ' ' + item.path + ' ' + item.type).toLowerCase()
999
1279
  return haystack.includes(query.trim().toLowerCase())
1000
1280
  })
1001
- .sort((a, b) => Number(isMemo(b)) - Number(isMemo(a)) || String(b.ts).localeCompare(String(a.ts)))
1281
+ .sort((a, b) => mainRank(a) - mainRank(b) || Number(isMemo(b)) - Number(isMemo(a)) || String(b.ts).localeCompare(String(a.ts)))
1002
1282
 
1003
1283
  return h('div', { style: { display: 'grid', gridTemplateColumns: '320px minmax(0, 1fr)', gap: '12px', alignItems: 'start' } },
1004
1284
  h('div', { className: 'dept-block', style: { maxHeight: '560px', overflow: 'auto' } },
@@ -1026,7 +1306,7 @@ window.__ModuleLoader__.load({
1026
1306
  : h('div', { className: 'dept-sub' }, t('doc.choose'))))
1027
1307
  }
1028
1308
 
1029
- function TaskDetail({ detail, onBack, onReload }) {
1309
+ function TaskDetail({ detail, onBack, onReload, onEditor }) {
1030
1310
  const docs = ['task.md', 'analysis.md', 'concept.md', 'spec.md', 'plan.md', 'backlog.md']
1031
1311
  const [tab, setTab] = useState('overview')
1032
1312
  const [name, setName] = useState(() => localStorage.getItem('dept-approver') || 'vladimir')
@@ -1085,7 +1365,7 @@ window.__ModuleLoader__.load({
1085
1365
  }),
1086
1366
  })
1087
1367
  const data = await response.json().catch(() => ({}))
1088
- setMessage(response.ok ? 'Цены сохранены' : (data.error || 'ошибка'))
1368
+ setMessage(response.ok ? t('msg.pricesSaved') : (data.error || t('msg.error')))
1089
1369
  } finally {
1090
1370
  setSavingBudget(false)
1091
1371
  }
@@ -1098,7 +1378,7 @@ window.__ModuleLoader__.load({
1098
1378
  const response = await fetch(path, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ ...body, by: name }) })
1099
1379
  const data = await response.json().catch(() => ({}))
1100
1380
  if (!response.ok) throw new Error(data.error || response.statusText)
1101
- setMessage('Готово')
1381
+ setMessage(t('msg.done'))
1102
1382
  if (onReload) onReload()
1103
1383
  return data
1104
1384
  } catch (problem) {
@@ -1137,18 +1417,18 @@ window.__ModuleLoader__.load({
1137
1417
  return h('div', { className: 'dept-block' },
1138
1418
  h('div', { className: 'dept-block-title' }, t('block.openQuestions')),
1139
1419
  openQuestions.length === 0
1140
- ? h('div', { className: 'dept-sub' }, 'Открытых вопросов нет.')
1420
+ ? h('div', { className: 'dept-sub' }, t('questions.empty'))
1141
1421
  : h('div', { className: 'dept-events' }, ...openQuestions.map((question) =>
1142
1422
  h('div', { key: question.id, className: 'dept-block', style: { gap: '6px' } },
1143
1423
  h('div', { className: 'dept-row' },
1144
- h('span', { className: 'dept-badge wait' }, 'ждёт ответа'),
1424
+ h('span', { className: 'dept-badge wait' }, t('questions.waiting')),
1145
1425
  h('span', { className: 'dept-sub' }, question.id)),
1146
1426
  h('div', null, question.text),
1147
1427
  question.recommended ? h('div', { className: 'dept-sub' }, `отдел выбрал: ${question.recommended}`) : null,
1148
1428
  h('div', { className: 'dept-row' },
1149
1429
  h('input', {
1150
1430
  className: 'dept-input',
1151
- placeholder: question.options?.length ? question.options.join(' / ') : 'ответ',
1431
+ placeholder: question.options?.length ? question.options.join(' / ') : t('questions.answer'),
1152
1432
  value: drafts[question.id] ?? '',
1153
1433
  onChange: (event) => setDrafts({ ...drafts, [question.id]: event.target.value }),
1154
1434
  }),
@@ -1156,30 +1436,30 @@ window.__ModuleLoader__.load({
1156
1436
  className: 'dept-btn',
1157
1437
  disabled: busy || !(drafts[question.id] ?? '').trim(),
1158
1438
  onClick: () => post(ROUTES.answer, { root: detail.root, taskId: detail.taskId, questionId: question.id, answer: (drafts[question.id] ?? '').trim() }),
1159
- }, 'Ответить'))))),
1160
- detail.paused ? h('div', { className: 'dept-row', style: { marginTop: '4px' } }, h('span', { className: 'dept-badge wait' }, '⏸ на паузе' + (detail.pauseReason ? ': ' + detail.pauseReason : ''))) : null,
1439
+ }, t('questions.answerBtn')))))),
1440
+ detail.paused ? h('div', { className: 'dept-row', style: { marginTop: '4px' } }, h('span', { className: 'dept-badge wait' }, t('badge.onPause') + (detail.pauseReason ? ': ' + detail.pauseReason : ''))) : null,
1161
1441
  (detail.questions ?? []).filter((question) => question.status === 'memo').length > 0
1162
1442
  ? h('div', null,
1163
- h('div', { className: 'dept-block-title' }, 'Служебные записки (ждут решения человека)'),
1443
+ h('div', { className: 'dept-block-title' }, t('questions.memos')),
1164
1444
  ...(detail.questions ?? []).filter((question) => question.status === 'memo').map((question) =>
1165
1445
  h('div', { key: question.id, className: 'dept-block', style: { gap: '6px' } },
1166
1446
  h('div', { className: 'dept-row' },
1167
- h('span', { className: 'dept-badge wait' }, 'записка'),
1447
+ h('span', { className: 'dept-badge wait' }, t('questions.memo')),
1168
1448
  h('span', { className: 'dept-sub' }, question.id)),
1169
1449
  h('div', null, question.text),
1170
- question.decision ? h('div', { className: 'dept-sub' }, 'решение команды: ' + question.decision) : null,
1171
- question.memoPath ? h('div', { className: 'dept-sub' }, 'файл: ' + question.memoPath) : null,
1172
- h('input', { className: 'dept-input', placeholder: 'замечания (если не устраивает)', value: remarks[question.id] ?? '', onChange: (event) => setRemarks({ ...remarks, [question.id]: event.target.value }) }),
1450
+ question.decision ? h('div', { className: 'dept-sub' }, t('questions.decision') + question.decision) : null,
1451
+ question.memoPath ? h('div', { className: 'dept-sub' }, t('questions.file') + question.memoPath) : null,
1452
+ h('input', { className: 'dept-input', placeholder: t('questions.remarks'), value: remarks[question.id] ?? '', onChange: (event) => setRemarks({ ...remarks, [question.id]: event.target.value }) }),
1173
1453
  h('div', { className: 'dept-row' },
1174
- h('button', { className: 'dept-btn', disabled: busy, onClick: () => post(ROUTES.review, { root: detail.root, taskId: detail.taskId, questionId: question.id, verdict: 'approve' }) }, 'Утвердить'),
1175
- h('button', { className: 'dept-btn', disabled: busy || !(remarks[question.id] ?? '').trim(), onClick: () => post(ROUTES.review, { root: detail.root, taskId: detail.taskId, questionId: question.id, verdict: 'changes', remarks: (remarks[question.id] ?? '').trim() }) }, 'Замечания')))))
1454
+ h('button', { className: 'dept-btn', disabled: busy, onClick: () => post(ROUTES.review, { root: detail.root, taskId: detail.taskId, questionId: question.id, verdict: 'approve' }) }, t('questions.approve')),
1455
+ h('button', { className: 'dept-btn', disabled: busy || !(remarks[question.id] ?? '').trim(), onClick: () => post(ROUTES.review, { root: detail.root, taskId: detail.taskId, questionId: question.id, verdict: 'changes', remarks: (remarks[question.id] ?? '').trim() }) }, t('questions.changes'))))))
1176
1456
  : null,
1177
1457
  answeredQuestions.length > 0
1178
1458
  ? h('div', null,
1179
- h('div', { className: 'dept-block-title' }, 'Отвеченные'),
1459
+ h('div', { className: 'dept-block-title' }, t('questions.answered')),
1180
1460
  h('div', { className: 'dept-events' }, ...answeredQuestions.map((question) =>
1181
1461
  h('div', { key: question.id, className: 'dept-event' },
1182
- h('span', { className: 'dept-badge ok' }, 'отвечен'),
1462
+ h('span', { className: 'dept-badge ok' }, t('questions.answeredBadge')),
1183
1463
  h('span', null, question.answer),
1184
1464
  h('span', { className: 'dept-sub' }, question.answeredBy)))))
1185
1465
  : null)
@@ -1221,16 +1501,16 @@ window.__ModuleLoader__.load({
1221
1501
  return h('div', { style: { display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) 340px', gap: '12px', alignItems: 'start' } },
1222
1502
  h('div', { className: 'dept-block' },
1223
1503
  h('div', { className: 'dept-block-title' }, t('block.newCorrection')),
1224
- h('div', { className: 'dept-sub' }, 'Как письмо руководителю: что поменять и к чему это относится.'),
1504
+ h('div', { className: 'dept-sub' }, t('correction.hint')),
1225
1505
  h('div', { className: 'dept-form-row' },
1226
1506
  h('label', null, t('field.doc')),
1227
1507
  h('select', { className: 'dept-input', value: corr.doc, onChange: (event) => setCorr({ ...corr, doc: event.target.value }) },
1228
- h('option', { value: 'concept' }, 'Концепция'),
1229
- h('option', { value: 'spec' }, 'ТЗ'),
1230
- h('option', { value: 'plan' }, 'План'),
1231
- h('option', { value: 'code' }, 'Код'),
1232
- h('option', { value: 'data' }, 'Данные'),
1233
- h('option', { value: 'interface' }, 'Интерфейс'))),
1508
+ h('option', { value: 'concept' }, t('correction.concept')),
1509
+ h('option', { value: 'spec' }, t('correction.spec')),
1510
+ h('option', { value: 'plan' }, t('correction.plan')),
1511
+ h('option', { value: 'code' }, t('correction.code')),
1512
+ h('option', { value: 'data' }, t('correction.data')),
1513
+ h('option', { value: 'interface' }, t('correction.interface')))),
1234
1514
  h('div', { className: 'dept-form-row' },
1235
1515
  h('label', null, t('field.subject')),
1236
1516
  h('input', { className: 'dept-input', value: corr.subject, onChange: (event) => setCorr({ ...corr, subject: event.target.value }) })),
@@ -1246,11 +1526,11 @@ window.__ModuleLoader__.load({
1246
1526
  if (result) setCorr({ doc: corr.doc, subject: '', text: '' })
1247
1527
  },
1248
1528
  }, t('btn.sendCorrection')),
1249
- h('span', { className: 'dept-sub' }, 'Руководитель возьмёт в работу и соберёт специалистов.'))),
1529
+ h('span', { className: 'dept-sub' }, t('correction.toManager')))),
1250
1530
  h('div', { className: 'dept-block', style: { maxHeight: '560px', overflow: 'auto' } },
1251
1531
  h('div', { className: 'dept-block-title' }, t('block.correctionHistory')),
1252
1532
  corrections.length === 0
1253
- ? h('div', { className: 'dept-sub' }, 'пока нет')
1533
+ ? h('div', { className: 'dept-sub' }, t('none.yet'))
1254
1534
  : h('div', { className: 'dept-events' }, ...corrections.map((item) =>
1255
1535
  h('div', { key: item.id, className: 'dept-block', style: { gap: '4px' } },
1256
1536
  h('div', { className: 'dept-row' },
@@ -1262,14 +1542,14 @@ window.__ModuleLoader__.load({
1262
1542
  if (tab === 'roles') {
1263
1543
  return h('div', { className: 'dept-block' },
1264
1544
  h('div', { className: 'dept-block-title' }, t('block.roles')),
1265
- h('div', { className: 'dept-sub' }, 'Модель и reasoning для каждой роли. Пустая модель — по умолчанию.'),
1545
+ h('div', { className: 'dept-sub' }, t('roles.hint')),
1266
1546
  ...roles.map((role) =>
1267
1547
  h('div', { key: role.name, className: 'dept-kv', style: { alignItems: 'center', gap: '6px' } },
1268
1548
  h('input', {
1269
1549
  type: 'checkbox',
1270
1550
  checked: role.enabled !== false,
1271
1551
  disabled: role.core,
1272
- title: role.core ? 'основная роль — всегда включена' : 'включить/выключить роль',
1552
+ title: role.core ? t('roles.core') : t('roles.toggle'),
1273
1553
  onChange: async (event) => {
1274
1554
  const response = await fetch(ROUTES.roles, {
1275
1555
  method: 'POST',
@@ -1284,7 +1564,7 @@ window.__ModuleLoader__.load({
1284
1564
  h('input', {
1285
1565
  type: 'number', min: 1, max: 10,
1286
1566
  className: 'dept-input', style: { width: '64px', minWidth: '64px' },
1287
- title: 'сколько экземпляров роли можно запускать одновременно',
1567
+ title: t('roles.instances'),
1288
1568
  value: role.maxInstances ?? 1,
1289
1569
  onChange: async (event) => {
1290
1570
  const value = Number(event.target.value)
@@ -1294,7 +1574,7 @@ window.__ModuleLoader__.load({
1294
1574
  body: JSON.stringify({ root: detail.root, taskId: detail.taskId, role: role.name, model: role.model, reasoning: role.reasoning, enabled: role.enabled, maxInstances: value }),
1295
1575
  })
1296
1576
  const data = await response.json().catch(() => ({}))
1297
- if (response.ok) { setRoles(data.roles); setMessage('Лимит роли сохранён') } else { setMessage(data.error || 'ошибка') }
1577
+ if (response.ok) { setRoles(data.roles); setMessage(t('roles.saved')) } else { setMessage(data.error || 'ошибка') }
1298
1578
  },
1299
1579
  }),
1300
1580
  h('input', {
@@ -1318,54 +1598,54 @@ window.__ModuleLoader__.load({
1318
1598
  onClick: async () => {
1319
1599
  const response = await fetch(ROUTES.roles, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ root: detail.root, taskId: detail.taskId, role: role.name, model: role.model, reasoning: role.reasoning }) })
1320
1600
  const data = await response.json().catch(() => ({}))
1321
- if (response.ok) { setRoles(data.roles); setMessage('Роль сохранена') } else { setMessage(data.error || 'ошибка') }
1601
+ if (response.ok) { setRoles(data.roles); setMessage(t('roles.saved')) } else { setMessage(data.error || 'ошибка') }
1322
1602
  },
1323
- }, 'Сохранить'))))
1603
+ }, t('btn.save')))))
1324
1604
  }
1325
1605
  if (tab === 'billing') {
1326
1606
  return h('div', { className: 'dept-block' },
1327
1607
  h('div', { className: 'dept-block-title' }, t('block.billing')),
1328
- h('div', { className: 'dept-sub' }, 'Лимит и цены за 1M токенов; курс — для пересчёта в рубли.'),
1329
- h('div', { className: 'dept-kv' }, h('span', null, 'сейчас (после перезапуска)'), h('span', null, `${((budget?.usage?.inputTokens ?? 0) + (budget?.usage?.outputTokens ?? 0)).toLocaleString('ru-RU')} т.`)),
1330
- h('div', { className: 'dept-kv' }, h('span', null, 'всего по этапам'), h('span', null, `${(budget?.history ?? []).reduce((sum, item) => sum + Number(item.tokens ?? 0), 0).toLocaleString('ru-RU')} т.`)),
1331
- h('div', { className: 'dept-kv' }, h('span', null, 'стоимость по этапам'), h('span', null, `$${(budget?.history ?? []).reduce((sum, item) => sum + Number(item.costUSD ?? 0), 0).toFixed(3)}`)),
1332
- h('div', { className: 'dept-kv' }, h('span', null, 'снимок при последнем коммите'), h('span', null, `${(budget?.usedTokens ?? 0).toLocaleString('ru-RU')} т.`)),
1333
- budget?.humanSet ? h('div', { className: 'dept-badge ok' }, 'лимит установлен человеком') : null,
1608
+ h('div', { className: 'dept-sub' }, t('billing.hint')),
1609
+ h('div', { className: 'dept-kv' }, h('span', null, t('billing.live')), h('span', null, `${((budget?.usage?.inputTokens ?? 0) + (budget?.usage?.outputTokens ?? 0)).toLocaleString(deptLang === 'en' ? 'en-US' : 'ru-RU')} т.`)),
1610
+ h('div', { className: 'dept-kv' }, h('span', null, t('billing.total')), h('span', null, `${(budget?.history ?? []).reduce((sum, item) => sum + Number(item.tokens ?? 0), 0).toLocaleString(deptLang === 'en' ? 'en-US' : 'ru-RU')} т.`)),
1611
+ h('div', { className: 'dept-kv' }, h('span', null, t('billing.totalCost')), h('span', null, `$${(budget?.history ?? []).reduce((sum, item) => sum + Number(item.costUSD ?? 0), 0).toFixed(3)}`)),
1612
+ h('div', { className: 'dept-kv' }, h('span', null, t('billing.snapshot')), h('span', null, `${(budget?.usedTokens ?? 0).toLocaleString(deptLang === 'en' ? 'en-US' : 'ru-RU')} т.`)),
1613
+ budget?.humanSet ? h('div', { className: 'dept-badge ok' }, t('billing.humanSet')) : null,
1334
1614
  h('div', { className: 'dept-row' },
1335
1615
  h('div', { className: 'dept-form-row' },
1336
- h('label', null, 'Лимит токенов'),
1616
+ h('label', null, t('billing.limit')),
1337
1617
  h('input', { className: 'dept-input', value: prices.limit, onChange: (event) => setPrices({ ...prices, limit: event.target.value }) })),
1338
1618
  h('div', { className: 'dept-form-row' },
1339
- h('label', null, '$/1M вход'),
1619
+ h('label', null, t('billing.input')),
1340
1620
  h('input', { className: 'dept-input', value: prices.input, onChange: (event) => setPrices({ ...prices, input: event.target.value }) })),
1341
1621
  h('div', { className: 'dept-form-row' },
1342
- h('label', null, '$/1M выход'),
1622
+ h('label', null, t('billing.output')),
1343
1623
  h('input', { className: 'dept-input', value: prices.output, onChange: (event) => setPrices({ ...prices, output: event.target.value }) })),
1344
1624
  h('div', { className: 'dept-form-row' },
1345
- h('label', null, '$/1M кэш-чтение'),
1625
+ h('label', null, t('billing.cacheRead')),
1346
1626
  h('input', { className: 'dept-input', value: prices.cacheRead, onChange: (event) => setPrices({ ...prices, cacheRead: event.target.value }) })),
1347
1627
  h('div', { className: 'dept-form-row' },
1348
- h('label', null, '$/1M кэш-запись'),
1628
+ h('label', null, t('billing.cacheWrite')),
1349
1629
  h('input', { className: 'dept-input', value: prices.cacheWrite, onChange: (event) => setPrices({ ...prices, cacheWrite: event.target.value }) })),
1350
1630
  h('div', { className: 'dept-form-row' },
1351
- h('label', null, 'курс ₽'),
1631
+ h('label', null, t('billing.rate')),
1352
1632
  h('input', { className: 'dept-input', value: prices.rate, onChange: (event) => setPrices({ ...prices, rate: event.target.value }) }))),
1353
1633
  h('div', { className: 'dept-row' },
1354
1634
  h('button', { className: 'dept-btn', disabled: savingBudget, onClick: savePrices }, t('btn.savePrices')),
1355
1635
  h('span', { className: 'dept-sub' }, message ?? '')),
1356
1636
  (budget?.history ?? []).length > 0
1357
1637
  ? h('div', null,
1358
- h('div', { className: 'dept-block-title' }, 'По этапам'),
1638
+ h('div', { className: 'dept-block-title' }, t('block.byStages')),
1359
1639
  ...(budget.history ?? []).map((item, index) =>
1360
1640
  h('div', { key: index, className: 'dept-kv' },
1361
- h('span', null, 'этап ' + item.stage),
1362
- h('span', null, item.tokens.toLocaleString('ru-RU') + ' т. · $' + Number(item.costUSD).toFixed(2)))))
1641
+ h('span', null, t('stageNo') + ' ' + item.stage),
1642
+ h('span', null, item.tokens.toLocaleString(deptLang === 'en' ? 'en-US' : 'ru-RU') + t('unit.tokens') + Number(item.costUSD).toFixed(2)))))
1363
1643
  : null)
1364
1644
  }
1365
1645
  if (tab === 'git') {
1366
1646
  return h('div', { className: 'dept-block' },
1367
1647
  h('div', { className: 'dept-block-title' }, t('block.commits')),
1368
- h('div', { className: 'dept-pre' }, (detail.recentCommits ?? []).join('\n') || 'нет коммитов'),
1648
+ h('div', { className: 'dept-pre' }, (detail.recentCommits ?? []).join('\n') || t('git.noCommits')),
1369
1649
  h('div', { className: 'dept-block-title' }, t('block.tags')),
1370
1650
  h('div', { className: 'dept-sub' }, (detail.tags ?? []).join(', ') || '—'),
1371
1651
  h('div', { className: 'dept-block-title' }, t('block.branch')),
@@ -1395,17 +1675,18 @@ window.__ModuleLoader__.load({
1395
1675
  h('div', null,
1396
1676
  h('div', { className: 'dept-title' }, detail.title),
1397
1677
  h('div', { className: 'dept-sub' }, `${detail.taskId} · ${stageLabel(detail.stage)} · ${detail.progress}% · ${detail.currentBranch ?? detail.branch}`),
1398
- detail.paused ? h('div', { className: 'dept-row', style: { marginTop: '4px' } }, h('span', { className: 'dept-badge wait' }, '⏸ на паузе' + (detail.pauseReason ? ': ' + detail.pauseReason : ''))) : null,
1678
+ detail.paused ? h('div', { className: 'dept-row', style: { marginTop: '4px' } }, h('span', { className: 'dept-badge wait' }, t('badge.onPause') + (detail.pauseReason ? ': ' + detail.pauseReason : ''))) : null,
1399
1679
  (detail.questions ?? []).filter((question) => question.status === 'memo').length > 0
1400
1680
  ? h('div', { className: 'dept-row', style: { marginTop: '4px' } },
1401
1681
  h('span', { className: 'dept-badge wait' }, '✍ служебных записок: ' + (detail.questions ?? []).filter((question) => question.status === 'memo').length))
1402
1682
  : null),
1403
1683
  h('div', { className: 'dept-row' },
1404
- h('input', { className: 'dept-input', value: name, onChange: (event) => setName(event.target.value), placeholder: 'ваше имя', title: 'Имя для подписи' }),
1684
+ h('input', { className: 'dept-input', value: name, onChange: (event) => setName(event.target.value), placeholder: t('form.name'), title: t('form.nameTitle') }),
1685
+ h('button', { className: 'dept-btn', onClick: () => onEditor && onEditor() }, t('nav.editor')),
1405
1686
  h('button', {
1406
1687
  className: 'dept-btn',
1407
1688
  disabled: busy,
1408
- onClick: () => post(ROUTES.pause, { root: detail.root, taskId: detail.taskId, paused: !detail.paused, reason: 'по кнопке' }),
1689
+ onClick: () => post(ROUTES.pause, { root: detail.root, taskId: detail.taskId, paused: !detail.paused, reason: t('pause.byButton') }),
1409
1690
  }, detail.paused ? t('task.resume') : t('task.pause')),
1410
1691
  h('button', { className: 'dept-btn', onClick: onBack }, '← ' + t('nav.back')))),
1411
1692
  h('div', { className: 'dept-tabs' }, ...tabs.map(([key, label]) =>
@@ -1418,16 +1699,16 @@ window.__ModuleLoader__.load({
1418
1699
  kv(t('block.attempts'), detail.attempts),
1419
1700
  kv(t('block.tests'), detail.tests),
1420
1701
  kv(t('block.review'), detail.review),
1421
- kv(t('block.tokens'), `${tokens.toLocaleString('ru-RU')} / ${(budget?.limitTokens ?? 0).toLocaleString('ru-RU')}`),
1702
+ kv(t('block.tokens'), `${tokens.toLocaleString(deptLang === 'en' ? 'en-US' : 'ru-RU')} / ${(budget?.limitTokens ?? 0).toLocaleString(deptLang === 'en' ? 'en-US' : 'ru-RU')}`),
1422
1703
  kv(t('block.cost'), `${budget?.costUSD ? '$' + budget.costUSD.toFixed(2) : '—'}${costRub ? ' ≈ ' + costRub.toFixed(0) + ' ₽' : ''}`),
1423
1704
  kv(t('block.calls'), usage?.calls ?? 0),
1424
1705
  h('div', { className: 'dept-bar' }, h('i', { style: { width: `${detail.progress}%` } }))),
1425
- (detail.stage === 'concept' && !approved.has('concept')) || (detail.stage === 'spec' && !approved.has('spec'))
1706
+ (detail.stage === 'spec_review' && !approved.has('spec')) || (detail.stage === 'concept_review' && !approved.has('concept'))
1426
1707
  ? h('div', { className: 'dept-block' },
1427
1708
  h('div', { className: 'dept-block-title' }, t('block.approval')),
1428
- detail.stage === 'concept'
1429
- ? h('button', { className: 'dept-btn', disabled: busy, onClick: () => post(ROUTES.approve, { root: detail.root, taskId: detail.taskId, doc: 'concept' }) }, 'Утвердить концепцию')
1430
- : h('button', { className: 'dept-btn', disabled: busy, onClick: () => post(ROUTES.approve, { root: detail.root, taskId: detail.taskId, doc: 'spec' }) }, 'Утвердить ТЗ'))
1709
+ detail.stage === 'spec_review'
1710
+ ? h('button', { className: 'dept-btn', disabled: busy, onClick: () => post(ROUTES.approve, { root: detail.root, taskId: detail.taskId, doc: 'spec' }) }, t('approve.spec'))
1711
+ : h('button', { className: 'dept-btn', disabled: busy, onClick: () => post(ROUTES.approve, { root: detail.root, taskId: detail.taskId, doc: 'concept' }) }, t('approve.concept')))
1431
1712
  : null),
1432
1713
  content,
1433
1714
  ),
@@ -1460,7 +1741,7 @@ window.__ModuleLoader__.load({
1460
1741
  .finally(() => setLoading(false))
1461
1742
  }, [root])
1462
1743
 
1463
- if (!root) return h('div', { className: 'dept-root' }, h('div', { className: 'dept-empty' }, 'Нет проектов с задачами.'))
1744
+ if (!root) return h('div', { className: 'dept-root' }, h('div', { className: 'dept-empty' }, t('empty.projects')))
1464
1745
 
1465
1746
  const files = blueprint?.files ?? []
1466
1747
  const edges = blueprint?.edges ?? []
@@ -1474,8 +1755,8 @@ window.__ModuleLoader__.load({
1474
1755
  bucket.loc += item.loc
1475
1756
  }
1476
1757
  const groupList = [...groups.values()].sort((a, b) => b.files.length - a.files.length)
1477
- const LAYER_TITLES = { core: 'Ядро', ui: 'Интерфейс', tests: 'Тесты', docs: 'Документы' }
1478
- const groupName = (dir) => (mode === 'layer' ? (LAYER_TITLES[dir] ?? dir) : (dir === '.' ? '(корень)' : dir))
1758
+ const LAYER_TITLES = { core: t('layer.core'), ui: t('layer.ui'), tests: t('layer.tests'), docs: t('layer.docs') }
1759
+ const groupName = (dir) => (mode === 'layer' ? (LAYER_TITLES[dir] ?? dir) : (dir === '.' ? t('bp.root') : dir))
1479
1760
  const colorOf = (dir) => BLUEPRINT_COLORS[Math.max(0, groupList.findIndex((item) => item.dir === dir)) % BLUEPRINT_COLORS.length]
1480
1761
 
1481
1762
  // связи между группами
@@ -1517,8 +1798,8 @@ window.__ModuleLoader__.load({
1517
1798
  return h('g', { key: item.dir, style: { cursor: 'pointer' }, onClick: () => { setGroup(item.dir); setFile(null) } },
1518
1799
  h('rect', { x: position.x, y: position.y, width: 110, height: 62, rx: 10, fill: '#1b2438', stroke: color, strokeWidth: 1.5 }),
1519
1800
  h('text', { x: position.x + 8, y: position.y + 20, fill: '#e6edf7', fontSize: 9 }, groupName(item.dir).slice(0, 16)),
1520
- h('text', { x: position.x + 8, y: position.y + 36, fill: '#8b98ad', fontSize: 8 }, `файлов: ${item.files.length}`),
1521
- h('text', { x: position.x + 8, y: position.y + 50, fill: '#8b98ad', fontSize: 8 }, `строк: ${item.loc}`),
1801
+ h('text', { x: position.x + 8, y: position.y + 36, fill: '#8b98ad', fontSize: 8 }, t('bp.filesCount', { n: item.files.length })),
1802
+ h('text', { x: position.x + 8, y: position.y + 50, fill: '#8b98ad', fontSize: 8 }, t('bp.linesCount', { n: item.loc })),
1522
1803
  h('circle', { cx: position.x + 98, cy: position.y + 12, r: 4, fill: color }))
1523
1804
  }))
1524
1805
  }
@@ -1553,7 +1834,7 @@ window.__ModuleLoader__.load({
1553
1834
  h('circle', { cx: position.x, cy: position.y, r: isSelected ? 8 : 6, fill: colorOf(dir), stroke: isSelected ? '#fff' : '#0b1220', strokeWidth: 1 }),
1554
1835
  h('text', { x: position.x + 10, y: position.y + 3, fill: '#c9d6ea', fontSize: 8 }, item.path.split('/').pop().slice(0, 18)))
1555
1836
  }),
1556
- h('text', { x: 20, y: 400, fill: '#8b98ad', fontSize: 9 }, `внутри группы связей: ${inner.length} · наружу: ${outer.length}`))
1837
+ h('text', { x: 20, y: 400, fill: '#8b98ad', fontSize: 9 }, t('bp.inner', { i: inner.length, o: outer.length })))
1557
1838
  }
1558
1839
 
1559
1840
  const selectedFile = file ? files.find((item) => item.path === file) : null
@@ -1562,20 +1843,20 @@ window.__ModuleLoader__.load({
1562
1843
  return h('div', { className: 'dept-root' },
1563
1844
  h('div', { className: 'dept-head' },
1564
1845
  h('div', null,
1565
- h('div', { className: 'dept-title' }, 'Схема проекта'),
1566
- h('div', { className: 'dept-sub' }, blueprint ? `файлов: ${blueprint.stats.files} · строк: ${blueprint.stats.loc} · связей: ${edges.length}` : (loading ? 'загрузка…' : '—'))),
1846
+ h('div', { className: 'dept-title' }, t('bp.title')),
1847
+ h('div', { className: 'dept-sub' }, blueprint ? t('bp.stats', { f: blueprint.stats.files, l: blueprint.stats.loc, e: edges.length }) : (loading ? t('bp.loading') : '—'))),
1567
1848
  h('div', { className: 'dept-row' },
1568
1849
  roots.length > 1
1569
1850
  ? h('select', { className: 'dept-input', value: root, onChange: (event) => setRoot(event.target.value) },
1570
1851
  ...roots.map((candidate) => h('option', { key: candidate, value: candidate }, candidate.split('/').pop())))
1571
1852
  : null,
1572
- h('button', { className: 'dept-btn' + (mode === 'dir' ? ' active' : ''), onClick: () => { setMode('dir'); setGroup(null); setFile(null) } }, 'По папкам'),
1573
- h('button', { className: 'dept-btn' + (mode === 'layer' ? ' active' : ''), onClick: () => { setMode('layer'); setGroup(null); setFile(null) } }, 'По слоям'),
1574
- group ? h('button', { className: 'dept-btn', onClick: () => { setGroup(null); setFile(null) } }, '← Все группы') : null)),
1853
+ h('button', { className: 'dept-btn' + (mode === 'dir' ? ' active' : ''), onClick: () => { setMode('dir'); setGroup(null); setFile(null) } }, t('bp.byDir')),
1854
+ h('button', { className: 'dept-btn' + (mode === 'layer' ? ' active' : ''), onClick: () => { setMode('layer'); setGroup(null); setFile(null) } }, t('bp.byLayer')),
1855
+ group ? h('button', { className: 'dept-btn', onClick: () => { setGroup(null); setFile(null) } }, t('bp.allGroups')) : null)),
1575
1856
  error ? h('div', { className: 'dept-badge fail' }, error) : null,
1576
1857
  h('div', { style: { display: 'grid', gridTemplateColumns: '260px minmax(0, 1fr) 300px', gap: '12px', alignItems: 'start' } },
1577
1858
  h('div', { className: 'dept-block', style: { maxHeight: '460px', overflow: 'auto' } },
1578
- h('div', { className: 'dept-block-title' }, 'Группы'),
1859
+ h('div', { className: 'dept-block-title' }, t('bp.groups')),
1579
1860
  ...groupList.map((item) =>
1580
1861
  h('div', {
1581
1862
  key: item.dir,
@@ -1591,9 +1872,9 @@ window.__ModuleLoader__.load({
1591
1872
  ? [
1592
1873
  h('div', { className: 'dept-block-title' }, selectedFile.path.split('/').pop()),
1593
1874
  h('div', { className: 'dept-sub' }, selectedFile.path),
1594
- h('div', { className: 'dept-kv' }, h('span', null, 'строк'), h('span', null, selectedFile.loc)),
1595
- h('div', { className: 'dept-kv' }, h('span', null, 'слой'), h('span', null, LAYER_TITLES[selectedFile.layer] ?? selectedFile.layer)),
1596
- h('div', { className: 'dept-block-title' }, 'Функции и классы'),
1875
+ h('div', { className: 'dept-kv' }, h('span', null, t('bp.lines')), h('span', null, selectedFile.loc)),
1876
+ h('div', { className: 'dept-kv' }, h('span', null, t('bp.layer')), h('span', null, LAYER_TITLES[selectedFile.layer] ?? selectedFile.layer)),
1877
+ h('div', { className: 'dept-block-title' }, t('bp.symbols')),
1597
1878
  (selectedFile.symbols ?? []).length === 0
1598
1879
  ? h('div', { className: 'dept-sub' }, '—')
1599
1880
  : h('div', { className: 'dept-events', style: { maxHeight: '180px', overflow: 'auto' } },
@@ -1601,17 +1882,17 @@ window.__ModuleLoader__.load({
1601
1882
  h('div', { key: symbol.name + symbol.line, className: 'dept-event' },
1602
1883
  h('span', { className: 'dept-sub', style: { minWidth: '34px' } }, symbol.line),
1603
1884
  h('span', null, symbol.name)))),
1604
- h('div', { className: 'dept-block-title' }, 'Импортирует'),
1885
+ h('div', { className: 'dept-block-title' }, t('bp.imports')),
1605
1886
  selectedFile.imports.length === 0 ? h('div', { className: 'dept-sub' }, '—') : h('div', { className: 'dept-events' },
1606
1887
  ...selectedFile.imports.map((target) => h('div', { key: target, className: 'dept-event' }, h('span', null, target)))),
1607
- h('div', { className: 'dept-block-title' }, 'Используется в'),
1888
+ h('div', { className: 'dept-block-title' }, t('bp.usedBy')),
1608
1889
  (() => {
1609
1890
  const dependents = edges.filter((edge) => edge.to === selectedFile.path).map((edge) => edge.from)
1610
1891
  return dependents.length === 0 ? h('div', { className: 'dept-sub' }, '—') : h('div', { className: 'dept-events' },
1611
1892
  ...dependents.map((source) => h('div', { key: source, className: 'dept-event' }, h('span', null, source))))
1612
1893
  })(),
1613
1894
  ]
1614
- : h('div', { className: 'dept-sub' }, 'Выбери группу слева, затем файл на схеме.')),
1895
+ : h('div', { className: 'dept-sub' }, t('bp.choose'))),
1615
1896
  ),
1616
1897
  )
1617
1898
  }
@@ -1630,7 +1911,7 @@ window.__ModuleLoader__.load({
1630
1911
  .catch((problem) => setError(problem.message))
1631
1912
  }, [current?.root, current?.taskId])
1632
1913
 
1633
- if (!current) return h('div', { className: 'dept-root' }, h('div', { className: 'dept-empty' }, 'Нет задач.'))
1914
+ if (!current) return h('div', { className: 'dept-root' }, h('div', { className: 'dept-empty' }, t('empty.tasks')))
1634
1915
 
1635
1916
  const history = detail?.history ?? []
1636
1917
  const totalTokens = history.reduce((sum, item) => sum + item.tokens, 0)
@@ -1644,7 +1925,7 @@ window.__ModuleLoader__.load({
1644
1925
 
1645
1926
  const rows = (items, max, format) => h('div', { className: 'dept-events' }, ...items.map((item) =>
1646
1927
  h('div', { key: item.stage, className: 'dept-event', style: { alignItems: 'center' } },
1647
- h('span', { style: { minWidth: '64px' } }, 'этап ' + item.stage),
1928
+ h('span', { style: { minWidth: '64px' } }, t('stageNo') + ' ' + item.stage),
1648
1929
  h('div', { style: { flex: '1 1 auto', height: '10px', background: '#1b2438', borderRadius: '6px', overflow: 'hidden' } },
1649
1930
  h('div', { style: { width: Math.max(2, Math.round((item.value / max) * 100)) + '%', height: '100%', background: item.color } })),
1650
1931
  h('span', { className: 'dept-sub', style: { minWidth: '84px', textAlign: 'right' } }, format(item)))))
@@ -1652,8 +1933,8 @@ window.__ModuleLoader__.load({
1652
1933
  return h('div', { className: 'dept-root' },
1653
1934
  h('div', { className: 'dept-head' },
1654
1935
  h('div', null,
1655
- h('div', { className: 'dept-title' }, 'Графики по этапам'),
1656
- h('div', { className: 'dept-sub' }, 'токенов: ' + totalTokens.toLocaleString('ru-RU') + ' · $' + totalCost.toFixed(2) + ' · время: ' + hours + ' ч ' + minutes + ' мин')),
1936
+ h('div', { className: 'dept-title' }, t('charts.title')),
1937
+ h('div', { className: 'dept-sub' }, t('charts.tokensLine', { t: totalTokens.toLocaleString(deptLang === 'en' ? 'en-US' : 'ru-RU'), c: totalCost.toFixed(2), h: hours, m: minutes }))),
1657
1938
  tasks.length > 1
1658
1939
  ? h('select', { className: 'dept-input', value: current.taskId, onChange: (event) => setCurrent(tasks.find((task) => task.taskId === event.target.value) ?? tasks[0]) },
1659
1940
  ...tasks.map((task) => h('option', { key: task.root + task.taskId, value: task.taskId }, task.taskId)))
@@ -1664,18 +1945,18 @@ window.__ModuleLoader__.load({
1664
1945
  : h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))', gap: '12px' } },
1665
1946
  h('div', { className: 'dept-block' },
1666
1947
  h('div', { className: 'dept-block-title' }, 'Токены'),
1667
- rows(history.map((item) => ({ ...item, value: item.tokens, color: '#4b8bff' })), maxTokens, (item) => item.tokens.toLocaleString('ru-RU'))),
1948
+ rows(history.map((item) => ({ ...item, value: item.tokens, color: '#4b8bff' })), maxTokens, (item) => item.tokens.toLocaleString(deptLang === 'en' ? 'en-US' : 'ru-RU'))),
1668
1949
  h('div', { className: 'dept-block' },
1669
- h('div', { className: 'dept-block-title' }, 'Стоимость'),
1950
+ h('div', { className: 'dept-block-title' }, t('chart.costTitle')),
1670
1951
  rows(history.map((item) => ({ ...item, value: item.costUSD, color: '#7fdc9a' })), maxCost, (item) => '$' + item.costUSD.toFixed(3))),
1671
1952
  h('div', { className: 'dept-block' },
1672
- h('div', { className: 'dept-block-title' }, 'Длительность'),
1673
- rows(history.map((item) => ({ ...item, value: item.durationMs, color: '#d8c07a' })), maxMs, (item) => Math.round(item.durationMs / 60000) + ' мин'))),
1953
+ h('div', { className: 'dept-block-title' }, t('charts.duration')),
1954
+ rows(history.map((item) => ({ ...item, value: item.durationMs, color: '#d8c07a' })), maxMs, (item) => Math.round(item.durationMs / 60000) + ' ' + t('minutesShort')))),
1674
1955
  h('div', { className: 'dept-block' },
1675
- h('div', { className: 'dept-block-title' }, 'Гейты по этапам'),
1956
+ h('div', { className: 'dept-block-title' }, t('charts.gates')),
1676
1957
  ...history.map((item) =>
1677
1958
  h('div', { key: item.stage, className: 'dept-kv' },
1678
- h('span', null, 'этап ' + item.stage),
1959
+ h('span', null, t('stageNo') + ' ' + item.stage),
1679
1960
  h('span', { className: 'dept-row' },
1680
1961
  h('span', { className: 'dept-badge ' + (item.tests === 'pass' ? 'ok' : item.tests === 'fail' ? 'fail' : 'wait') }, 'тесты: ' + item.tests),
1681
1962
  h('span', { className: 'dept-badge ' + (item.review === 'pass' ? 'ok' : item.review === 'fail' ? 'fail' : 'wait') }, 'ревью: ' + item.review))))))
@@ -1707,18 +1988,18 @@ window.__ModuleLoader__.load({
1707
1988
  h('div', { className: 'dept-head' },
1708
1989
  h('div', null,
1709
1990
  h('div', { className: 'dept-title' }, t('projects.title')),
1710
- h('div', { className: 'dept-sub' }, `проектов: ${projects.length}${loading ? ' · обновление…' : ''}`)),
1991
+ h('div', { className: 'dept-sub' }, t('projects.count', { n: projects.length }) + (loading ? t('count.refreshing') : ''))),
1711
1992
  h('button', { className: 'dept-btn', onClick: load }, t('nav.refresh'))),
1712
1993
  error ? h('div', { className: 'dept-badge fail' }, error) : null,
1713
1994
  projects.length === 0 && !loading
1714
- ? h('div', { className: 'dept-empty' }, 'Проектов с задачами нет.')
1995
+ ? h('div', { className: 'dept-empty' }, t('projects.none'))
1715
1996
  : h('div', { className: 'dept-list' }, ...projects.map((project) =>
1716
1997
  h('div', { key: project.root, className: 'dept-card', onClick: () => onOpen(project.root) },
1717
1998
  h('div', { className: 'dept-row' }, h('strong', null, project.name), h('span', { className: 'dept-sub' }, project.root)),
1718
1999
  h('div', { className: 'dept-row' },
1719
- h('span', { className: 'dept-badge' }, `задач: ${project.taskCount}`),
2000
+ h('span', { className: 'dept-badge' }, t('count.tasks', { n: project.taskCount })),
1720
2001
  h('span', { className: 'dept-badge ' + (project.active > 0 ? 'ok' : 'wait') }, `в работе: ${project.active}`),
1721
- h('span', { className: 'dept-sub' }, `токены: ${project.budgetUsed.toLocaleString('ru-RU')}`)),
2002
+ h('span', { className: 'dept-sub' }, `токены: ${project.budgetUsed.toLocaleString(deptLang === 'en' ? 'en-US' : 'ru-RU')}`)),
1722
2003
  h('div', { className: 'dept-sub' }, Object.entries(project.stages).map(([stage, count]) => `${stage}: ${count}`).join(' · ')),
1723
2004
  project.lastEvent ? h('div', { className: 'dept-sub' }, `${project.lastEvent.action} · ${project.lastEvent.detail ?? ''}`) : null))) )
1724
2005
  }
@@ -1856,6 +2137,13 @@ window.__ModuleLoader__.load({
1856
2137
  const [loading, setLoading] = useState(true)
1857
2138
  const [selectedSession, setSelectedSession] = useState(null)
1858
2139
  const [projectFilter, setProjectFilter] = useState(null)
2140
+ const [name, setName] = useState(() => localStorage.getItem('dept-approver') || 'vladimir')
2141
+ const [settings, setSettings] = useState({ enabled: true })
2142
+ const [editorKey, setEditorKey] = useState('')
2143
+ const [showCreate, setShowCreate] = useState(false)
2144
+ const [form, setForm] = useState({ root: '', taskId: '', title: '', brief: '', testCommand: '' })
2145
+ const [creating, setCreating] = useState(false)
2146
+ const [createError, setCreateError] = useState(null)
1859
2147
  const [langTick, setLangTick] = useState(0)
1860
2148
  const [textSize, setTextSize] = useState(() => {
1861
2149
  const saved = Number(localStorage.getItem('dept-text-size'))
@@ -1878,6 +2166,41 @@ window.__ModuleLoader__.load({
1878
2166
  }
1879
2167
  }
1880
2168
 
2169
+ useEffect(() => {
2170
+ api(ROUTES.settings).then(setSettings).catch(() => {})
2171
+ }, [])
2172
+
2173
+ async function postJson(path, body) {
2174
+ const response = await fetch(path, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) })
2175
+ const data = await response.json().catch(() => ({}))
2176
+ if (!response.ok) throw new Error(data.error || response.statusText)
2177
+ return data
2178
+ }
2179
+
2180
+ async function toggleDepartment() {
2181
+ try {
2182
+ const next = await postJson(ROUTES.settings, { enabled: !settings.enabled, by: name })
2183
+ setSettings(next)
2184
+ } catch (problem) {
2185
+ setError(problem.message)
2186
+ }
2187
+ }
2188
+
2189
+ async function createTask() {
2190
+ setCreating(true)
2191
+ setCreateError(null)
2192
+ try {
2193
+ await postJson(ROUTES.createTask, { ...form, by: name })
2194
+ setShowCreate(false)
2195
+ setForm({ root: '', taskId: '', title: '', brief: '', testCommand: '' })
2196
+ await loadTasks()
2197
+ } catch (problem) {
2198
+ setCreateError(problem.message)
2199
+ } finally {
2200
+ setCreating(false)
2201
+ }
2202
+ }
2203
+
1881
2204
  async function openTask(task) {
1882
2205
  setSelected(task)
1883
2206
  setDetail(null)
@@ -1898,8 +2221,8 @@ window.__ModuleLoader__.load({
1898
2221
 
1899
2222
  if (selected) {
1900
2223
  return detail
1901
- ? h(TaskDetail, { detail, onBack: () => { setSelected(null); setDetail(null) }, onReload: () => { if (selected) openTask(selected) } })
1902
- : h('div', { className: 'dept-root' }, h('div', { className: 'dept-empty' }, 'Загрузка задачи…'))
2224
+ ? h(TaskDetail, { detail, onEditor: () => { setEditorKey(detail.root + ':' + detail.taskId); setView('editor'); setSelected(null); setDetail(null) }, onBack: () => { setSelected(null); setDetail(null) }, onReload: () => { if (selected) openTask(selected) } })
2225
+ : h('div', { className: 'dept-root' }, h('div', { className: 'dept-empty' }, t('loading.task')))
1903
2226
  }
1904
2227
 
1905
2228
  if (view === 'projects') {
@@ -1910,7 +2233,9 @@ window.__ModuleLoader__.load({
1910
2233
  h('button', { className: 'dept-btn active' }, t('nav.projects')),
1911
2234
  h('button', { className: 'dept-btn', onClick: () => setView('office') }, t('nav.office')),
1912
2235
  h('button', { className: 'dept-btn', onClick: () => setView('blueprint') }, t('nav.blueprint')),
1913
- h('button', { className: 'dept-btn', onClick: () => setView('charts') }, t('nav.charts')))),
2236
+ h('button', { className: 'dept-btn', onClick: () => setView('charts') }, t('nav.charts')), h('button', { className: 'dept-btn', onClick: () => setView('editor') }, t('nav.editor')),
2237
+ h('button', { className: 'dept-btn', onClick: () => setShowCreate(true) }, t('dept.newTask')),
2238
+ h('button', { className: 'dept-btn' + (settings.enabled ? '' : ' fail'), onClick: toggleDepartment }, settings.enabled ? t('dept.enabled') : t('dept.disabled')))),
1914
2239
  h(ProjectsView, { onOpen: (root) => { setProjectFilter(root); setView('board') } }))
1915
2240
  }
1916
2241
 
@@ -1926,6 +2251,30 @@ window.__ModuleLoader__.load({
1926
2251
  h(ChartsView, { tasks }))
1927
2252
  }
1928
2253
 
2254
+ if (view === 'editor') {
2255
+ const editorTasks = projectFilter ? tasks.filter((task) => task.root === projectFilter) : tasks
2256
+ const current = editorTasks.find((task) => `${task.root}:${task.taskId}` === editorKey) ?? editorTasks[0] ?? null
2257
+ return h('div', { className: 'dept-root' },
2258
+ h('div', { className: 'dept-head' },
2259
+ h('div', null,
2260
+ h('div', { className: 'dept-title' }, t('nav.editor')),
2261
+ h('div', { className: 'dept-sub' }, 'Рисуйте спрайты и отправляйте художнику; трафарет помогает обводить контуры.')),
2262
+ h('div', { className: 'dept-row' },
2263
+ h('select', {
2264
+ className: 'dept-input',
2265
+ value: current ? `${current.root}:${current.taskId}` : '',
2266
+ onChange: (event) => setEditorKey(event.target.value),
2267
+ }, ...editorTasks.map((task) => h('option', { key: `${task.root}:${task.taskId}`, value: `${task.root}:${task.taskId}` }, `${task.root.split('/').pop()} · ${task.taskId}`))),
2268
+ h('button', { className: 'dept-btn', onClick: () => setView('board') }, '← ' + t('nav.board')))),
2269
+ current
2270
+ ? h('iframe', {
2271
+ src: `${ROUTES.editor}?root=${encodeURIComponent(current.root)}&taskId=${encodeURIComponent(current.taskId)}`,
2272
+ style: { width: '100%', height: 'calc(100vh - 150px)', border: '0', borderRadius: '12px', background: '#0b0f18' },
2273
+ title: 'Пиксель-редактор',
2274
+ })
2275
+ : h('div', { className: 'dept-empty' }, t('empty.noTasksHint')))
2276
+ }
2277
+
1929
2278
  if (view === 'blueprint') {
1930
2279
  return h('div', { className: 'dept-root' },
1931
2280
  h('div', { className: 'dept-head' },
@@ -1944,7 +2293,9 @@ window.__ModuleLoader__.load({
1944
2293
  h('button', { className: 'dept-btn', onClick: () => setView('board') }, t('nav.board')),
1945
2294
  h('button', { className: 'dept-btn active', onClick: () => setView('office') }, t('nav.office')),
1946
2295
  h('button', { className: 'dept-btn', onClick: () => setView('blueprint') }, t('nav.blueprint')),
1947
- h('button', { className: 'dept-btn', onClick: () => setView('charts') }, t('nav.charts'))),
2296
+ h('button', { className: 'dept-btn', onClick: () => setView('charts') }, t('nav.charts')), h('button', { className: 'dept-btn', onClick: () => setView('editor') }, t('nav.editor')),
2297
+ h('button', { className: 'dept-btn', onClick: () => setShowCreate(true) }, t('dept.newTask')),
2298
+ h('button', { className: 'dept-btn' + (settings.enabled ? '' : ' fail'), onClick: toggleDepartment }, settings.enabled ? t('dept.enabled') : t('dept.disabled'))),
1948
2299
  h('button', { className: 'dept-btn', onClick: loadTasks }, t('nav.refresh'))),
1949
2300
  h(OfficeView, { items: activity.items, selected: selectedSession, onSelect: setSelectedSession, tasks, attention, onOpenTask: (root) => { const task = tasks.find((candidate) => candidate.root === root); if (task) openTask(task) }, party, paused: tasks.some((task) => task.paused), pauseReason: (tasks.find((task) => task.paused) ?? {}).pauseReason }),
1950
2301
  )
@@ -1955,15 +2306,17 @@ window.__ModuleLoader__.load({
1955
2306
  { className: 'dept-root' },
1956
2307
  h('div', { className: 'dept-head' },
1957
2308
  h('div', null,
1958
- h('div', { className: 'dept-title' }, 'ИИ-отдел разработки'),
1959
- h('div', { className: 'dept-sub' }, `задач: ${tasks.length}${loading ? ' · обновление…' : ''}`),
2309
+ h('div', { className: 'dept-title' }, t('title.department')),
2310
+ h('div', { className: 'dept-sub' }, t('count.tasks', { n: tasks.length }) + (loading ? t('count.refreshing') : '')),
1960
2311
  ),
1961
2312
  h('div', { className: 'dept-tabs' },
1962
2313
  h('button', { className: 'dept-btn active', onClick: () => setView('board') }, t('nav.board')),
1963
2314
  h('button', { className: 'dept-btn', onClick: () => setView('projects') }, t('nav.projects')),
1964
2315
  h('button', { className: 'dept-btn', onClick: () => setView('office') }, t('nav.office')),
1965
2316
  h('button', { className: 'dept-btn', onClick: () => setView('blueprint') }, t('nav.blueprint')),
1966
- h('button', { className: 'dept-btn', onClick: () => setView('charts') }, t('nav.charts')),
2317
+ h('button', { className: 'dept-btn', onClick: () => setView('charts') }, t('nav.charts')), h('button', { className: 'dept-btn', onClick: () => setView('editor') }, t('nav.editor')),
2318
+ h('button', { className: 'dept-btn', onClick: () => setShowCreate(true) }, t('dept.newTask')),
2319
+ h('button', { className: 'dept-btn' + (settings.enabled ? '' : ' fail'), onClick: toggleDepartment }, settings.enabled ? t('dept.enabled') : t('dept.disabled')),
1967
2320
  h('button', {
1968
2321
  className: 'dept-btn',
1969
2322
  onClick: () => {
@@ -1972,9 +2325,16 @@ window.__ModuleLoader__.load({
1972
2325
  },
1973
2326
  title: 'Language / Язык',
1974
2327
  }, deptLang === 'en' ? 'RU' : 'EN'),
1975
- h('button', { className: 'dept-btn', onClick: () => setTextSize(textSize >= 19 ? 12 : textSize + 2), title: 'Размер текста' }, 'A+'),
2328
+ h('button', { className: 'dept-btn', onClick: () => setTextSize(textSize >= 19 ? 12 : textSize + 2), title: t('title.textSize') }, 'A+'),
2329
+ h('button', {
2330
+ className: 'dept-btn' + (settings.enabled ? '' : ' fail'),
2331
+ onClick: toggleDepartment,
2332
+ title: settings.enabled ? 'Выключить отдел' : 'Включить отдел',
2333
+ }, settings.enabled ? t('dept.enabled') : t('dept.disabled')),
2334
+ h('button', { className: 'dept-btn', onClick: () => setShowCreate(true) }, t('dept.newTask')),
1976
2335
  h('button', { className: 'dept-btn', onClick: loadTasks }, t('nav.refresh'))),
1977
2336
  ),
2337
+ settings.enabled ? null : h('div', { className: 'dept-badge fail' }, t('dept.offBanner')),
1978
2338
  attention > 0
1979
2339
  ? h('div', { className: 'dept-block' },
1980
2340
  h('div', { className: 'dept-block-title' }, 'Требует внимания'),
@@ -1982,10 +2342,29 @@ window.__ModuleLoader__.load({
1982
2342
  : null,
1983
2343
  h(ActivityBlock, { items: activity.items, error: activity.error }),
1984
2344
  error ? h('div', { className: 'dept-badge fail' }, error) : null,
1985
- projectFilter ? h('div', { className: 'dept-row' }, h('span', { className: 'dept-badge' }, 'проект: ' + projectFilter.split('/').pop()), h('button', { className: 'dept-btn', onClick: () => setProjectFilter(null) }, 'Сбросить')) : null,
2345
+ projectFilter ? h('div', { className: 'dept-row' }, h('span', { className: 'dept-badge' }, 'проект: ' + projectFilter.split('/').pop()), h('button', { className: 'dept-btn', onClick: () => setProjectFilter(null) }, t('btn.reset'))) : null,
1986
2346
  (projectFilter ? tasks.filter((task) => task.root === projectFilter) : tasks).length === 0 && !loading
1987
- ? h('div', { className: 'dept-empty' }, 'Задач пока нет. Создай задачу через dept_start.')
2347
+ ? h('div', { className: 'dept-empty' }, t('empty.noTasksHint'))
1988
2348
  : h('div', { className: 'dept-list' }, ...tasks.map((task) => h(TaskCard, { key: `${task.root}:${task.taskId}`, task, onOpen: openTask }))),
2349
+ showCreate
2350
+ ? h('div', { className: 'dept-modal' },
2351
+ h('div', { className: 'dept-modal-card' },
2352
+ h('div', { className: 'dept-title' }, t('dept.createTitle')),
2353
+ h('div', { className: 'dept-form-row' }, h('label', null, t('dept.root')),
2354
+ h('input', { className: 'dept-input', value: form.root, placeholder: '/home/agent/work/projects/my-app', onChange: (event) => setForm({ ...form, root: event.target.value }) })),
2355
+ h('div', { className: 'dept-form-row' }, h('label', null, t('dept.taskId')),
2356
+ h('input', { className: 'dept-input', value: form.taskId, placeholder: 'feature-01', onChange: (event) => setForm({ ...form, taskId: event.target.value }) })),
2357
+ h('div', { className: 'dept-form-row' }, h('label', null, t('dept.title')),
2358
+ h('input', { className: 'dept-input', value: form.title, onChange: (event) => setForm({ ...form, title: event.target.value }) })),
2359
+ h('div', { className: 'dept-form-row' }, h('label', null, t('dept.test')),
2360
+ h('input', { className: 'dept-input', value: form.testCommand, placeholder: 'npm test', onChange: (event) => setForm({ ...form, testCommand: event.target.value }) })),
2361
+ h('div', { className: 'dept-form-row' }, h('label', null, t('dept.brief')),
2362
+ h('textarea', { className: 'dept-input', rows: 5, value: form.brief, onChange: (event) => setForm({ ...form, brief: event.target.value }) })),
2363
+ createError ? h('div', { className: 'dept-badge fail' }, createError) : null,
2364
+ h('div', { className: 'dept-row' },
2365
+ h('button', { className: 'dept-btn', disabled: creating || !form.root || !form.taskId, onClick: createTask }, t('dept.create')),
2366
+ h('button', { className: 'dept-btn', onClick: () => { setShowCreate(false); setCreateError(null) } }, t('dept.cancel')))))
2367
+ : null,
1989
2368
  )
1990
2369
  }
1991
2370
 
@@ -2002,7 +2381,7 @@ window.__ModuleLoader__.load({
2002
2381
 
2003
2382
  function apply(ctx) {
2004
2383
  ctx.slots.inject('sidebar.panellist', () => ctx.slots.register(
2005
- { name: 'sidebar.panellist', id: PANEL_ID, order: 55, label: 'ИИ-отдел' },
2384
+ { name: 'sidebar.panellist', id: PANEL_ID, order: 55, label: t('title.departmentShort') },
2006
2385
  DepartmentIcon,
2007
2386
  ))
2008
2387
  ctx.slots.inject('main', () => ctx.slots.register(