@goodandready/dsh-moa 0.2.15 → 0.2.16
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/README.md +7 -0
- package/lib/best-effort.js +38 -0
- package/lib/client.js +7 -4
- package/lib/file-workspace.js +48 -34
- package/lib/history.js +4 -4
- package/lib/index.js +17 -382
- package/lib/moa-candidates.js +225 -0
- package/lib/moa-runner.js +13 -222
- package/lib/routes.js +408 -0
- package/lib/updater.js +280 -0
- package/package.json +1 -2
- package/docs/README.ru.md +0 -287
- package/docs/README.zh.md +0 -243
- package/docs/design/DESIGN.md +0 -79
- package/docs/plans/47-client-js-split-plan.md +0 -57
- package/docs/plans/55-resilience-plan.md +0 -33
- package/docs/plans/59-power-pack-plan.md +0 -73
- package/docs/plans/63-stability-polish-plan.md +0 -15
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# План: разбиение lib/client.js (issue #47)
|
|
2
|
-
|
|
3
|
-
Статус: принято решение, реализация отложена до появления подтверждённой механики бандлера.
|
|
4
|
-
Дата: 2026-09-11. Исполнитель: zcode. Связанная issue: #47.
|
|
5
|
-
|
|
6
|
-
## Контекст
|
|
7
|
-
|
|
8
|
-
Корневой чек-лист code review требует файл ≤800 строк; `lib/client.js` — ~1240 строк
|
|
9
|
-
после батча качества. `MoAEditor` ≈500 строк, словари ≈110 строк, CSS ≈85 строк.
|
|
10
|
-
Прямое разбиение упирается в механику клиентского бандлера DSH.
|
|
11
|
-
|
|
12
|
-
## Собранный evidence (2026-09-11)
|
|
13
|
-
|
|
14
|
-
1. **Харнесс отдаёт ровно один модуль на пакет**: на тест-контуре (DSH 0.1.5-rc.2)
|
|
15
|
-
клиент плагина обслуживается по единому URL
|
|
16
|
-
`/plugins/??@goodandready/dsh-moa/client.js&rev=<hash>` (combo-загрузчик);
|
|
17
|
-
реестр модулей в индекс-странице ссылается только на `client.js` пакета.
|
|
18
|
-
2. **Ни один плагин семейства не использует относительный require в клиентском
|
|
19
|
-
коде**: dsh-lanmode (23 файла в lib/), dsh-tts (client.js 1851 строка),
|
|
20
|
-
dsh-model-sync (17 файлов), dsh-clinebot (5 файлов), dsh-grok-xsearch (14
|
|
21
|
-
файлов) — везде `require('./...')` в client.js отсутствует. Многофайловость
|
|
22
|
-
живёт только в серверной половине.
|
|
23
|
-
3. Клиентская factory получает `require` (пакетные зависимости: `react`,
|
|
24
|
-
`@deepseek-ai/dsh-client-ui-primitives`) — документированных свидетельств
|
|
25
|
-
поддержки относительных require внутри клиентского модуля нет.
|
|
26
|
-
|
|
27
|
-
## Варианты
|
|
28
|
-
|
|
29
|
-
- **A. Оставить один файл (принято сейчас).** Нулевой риск для загрузки карточки;
|
|
30
|
-
известный компромисс с чек-листом зафиксирован в issue.
|
|
31
|
-
- **B. Сборочная склейка (concat/минимальный bundler перед `npm pack`).** С.Split
|
|
32
|
-
исходников на части + prepublish-скрипт, собирающий `lib/client.js`.
|
|
33
|
-
Плюс: файлы в репозитории маленькие, публикуется по-прежнему один модуль.
|
|
34
|
-
Минус: в семействе нет ни одного плагина со сборочным шагом — вводит новую
|
|
35
|
-
конвенцию, усложняет publish-пайплайн и локальную отладку.
|
|
36
|
-
- **C. Относительный require в клиенте.** Самый чистый вариант, но требует
|
|
37
|
-
подтверждённой поддержки в бандлере харнесса (эксперимент на тест-контуре).
|
|
38
|
-
|
|
39
|
-
## Решение и критерии пересмотра
|
|
40
|
-
|
|
41
|
-
- Сейчас — вариант A: риск поломки загрузки карточки выше пользы, а файл после
|
|
42
|
-
батча качества сократился (1240 строк против 1311) и остаётся цельным по смыслу.
|
|
43
|
-
- Пересмотреть к варианту C, если появится подтверждённый пример относительного
|
|
44
|
-
require в клиентском модуле любого плагина семейства (эксперимент: маленький
|
|
45
|
-
пакет-проба `require('./client-part.js')` на тест-контуре + проверка загрузки
|
|
46
|
-
карточки без ошибок в консоли).
|
|
47
|
-
- Пересмотреть к варианту B, если файл превысит ~1800 строк или в семействе
|
|
48
|
-
появится первый плагин со сборочным шагом.
|
|
49
|
-
|
|
50
|
-
## Чек-лист разбиения (когда механика подтверждена)
|
|
51
|
-
|
|
52
|
-
1. Вынести словари и `makeT` в `lib/client-dict.js`, стили — в `lib/client-styles.js`,
|
|
53
|
-
`SearchableModelPicker` — в `lib/client-picker.js`.
|
|
54
|
-
2. `lib/client.js` остаётся единственной точкой входа `__ModuleLoader__.load`.
|
|
55
|
-
3. Проверки: клиентский модуль отдаётся 200 по per-plugin URL; карточка
|
|
56
|
-
рендерится (settings.plugin.item) без ошибок в консоли; локали регистрируются;
|
|
57
|
-
HMR/обновление соседнего плагина не ломает стили (атрибут data-dsh-plugin).
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Task Plan: MoA Resilience, Async I/O, Configurable Timeouts and Modularization
|
|
2
|
-
|
|
3
|
-
Issue: #55
|
|
4
|
-
Branch: `feat/moa-resilience-refactor`
|
|
5
|
-
Worktree: `/mnt/external/Project/DEV/dhsplugins/dsh-moa/.worktrees/feat/moa-resilience-refactor`
|
|
6
|
-
|
|
7
|
-
## Objectives
|
|
8
|
-
1. Modularize `lib/moa-runner.js` into clean, focused modules under 800 lines:
|
|
9
|
-
- `lib/moa-prompts.js`: Rubric, system prompts, synthesis and questionnaire prompts.
|
|
10
|
-
- `lib/moa-parser.js`: Output parsing, winner extraction, recommended assembler, file block extraction.
|
|
11
|
-
- `lib/moa-runner.js`: Focused pipeline orchestrator.
|
|
12
|
-
2. Optimize storage in `lib/history.js`:
|
|
13
|
-
- Non-blocking async append via `fs.promises.appendFile`.
|
|
14
|
-
- File size rotation (>10MB or >5000 lines -> `.jsonl.1` backup).
|
|
15
|
-
- Fast tail reader for paginated history to avoid loading gigantic files in memory.
|
|
16
|
-
3. Configurable timeouts in `lib/index.js` and `PresetSchema`:
|
|
17
|
-
- `reference_timeout_sec` (default: 60s).
|
|
18
|
-
- `aggregator_timeout_sec` (default: 180s).
|
|
19
|
-
- Forward timeouts into `callLlm` and `AbortController`.
|
|
20
|
-
4. Fallback recovery on malformed judge output:
|
|
21
|
-
- When judge output is empty or truncated, cleanly fall back to `aggregator_fallbacks` before degrading.
|
|
22
|
-
5. Verification & Tests:
|
|
23
|
-
- Add unit tests in `test/moa-resilience.test.mjs`.
|
|
24
|
-
- Verify existing 60/60 tests pass without regression.
|
|
25
|
-
- Update `docs/design/DESIGN.md` and README files.
|
|
26
|
-
|
|
27
|
-
## Phases
|
|
28
|
-
- [x] Phase 1: Planning & Setup (Issue #55, isolated worktree created, test suite verified)
|
|
29
|
-
- [ ] Phase 2: Modularization of moa-runner (`lib/moa-prompts.js`, `lib/moa-parser.js`)
|
|
30
|
-
- [ ] Phase 3: History Storage Rotation & Async I/O (`lib/history.js`)
|
|
31
|
-
- [ ] Phase 4: Configurable Timeouts & Fallback Recovery (`lib/index.js`, `lib/moa-runner.js`)
|
|
32
|
-
- [ ] Phase 5: Test Coverage & Verification (`test/moa-resilience.test.mjs`)
|
|
33
|
-
- [ ] Phase 6: Documentation, PR, Merge, Release & Deploy
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# Plan 59: MoA Power Pack v0.2.13
|
|
2
|
-
|
|
3
|
-
## Objectives
|
|
4
|
-
Implement the 5 approved feature expansions for `@goodandready/dsh-moa`:
|
|
5
|
-
1. User Candidate Override (`allow_candidate_override: boolean`).
|
|
6
|
-
2. 10 specialized built-in presets + candidate role personas (`role_persona`).
|
|
7
|
-
3. Syntax Pre-check Gate with Judge Auto-Fix Directive.
|
|
8
|
-
4. Consilium / Peer Critique Round 2 (`peer_critique_enabled: boolean`).
|
|
9
|
-
5. Analytics filtering by preset and CSV/JSON export.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Technical Specifications
|
|
14
|
-
|
|
15
|
-
### 1. User Candidate Override
|
|
16
|
-
- **Schema**: `PresetSchema` field `allow_candidate_override: z.boolean().default(false)`.
|
|
17
|
-
- **Backend**:
|
|
18
|
-
- `writeCandidateWorkspace` stores candidates in `.moa-workspaces/<runId>/candidate-<index>`.
|
|
19
|
-
- Add API route `POST /dsh-moa/promote` with `{ runId, candidateIndex }` that promotes specified candidate files to the project root.
|
|
20
|
-
- In `formatMoAResponse`, if enabled, render interactive action hints:
|
|
21
|
-
`🔄 Alternative Candidate Override: /moa promote <runId> <candidateIndex>`
|
|
22
|
-
- **Client**: Add toggle in Section 1 / Section 3 of `lib/client.js`.
|
|
23
|
-
|
|
24
|
-
### 2. 10 Built-in Presets & Candidate Role Personas
|
|
25
|
-
- **Presets**:
|
|
26
|
-
1. `default`: General MoA ensemble.
|
|
27
|
-
2. `code-review`: Zero regressions, backward compatibility, edge cases.
|
|
28
|
-
3. `fast-audit`: Quorum mitigation, low latency.
|
|
29
|
-
4. `deep-architect`: System architecture, API contracts, curator synthesis.
|
|
30
|
-
5. `bug-hunter`: Concurrency, race conditions, memory leaks, null safety.
|
|
31
|
-
6. `refactor-cleanup`: Ponytail minimalism, stdlib first, zero external dependencies.
|
|
32
|
-
7. `frontend-ui`: Ergonomics, DSH design tokens, responsive layout, no AI slop.
|
|
33
|
-
8. `security-audit`: OWASP Top 10, input sanitization, safe error handling.
|
|
34
|
-
9. `math-logic`: Algorithmic correctness, asymptotic proofs.
|
|
35
|
-
10. `creative-brainstorm`: High divergence, alternative architectures.
|
|
36
|
-
- **Candidate Roles (`role_persona`)**:
|
|
37
|
-
- `minimalist`: Ponytail style, stdlib only, fewest lines.
|
|
38
|
-
- `robustness`: Paranoid validation, edge cases, defensive typing.
|
|
39
|
-
- `performance`: Memory efficiency, asymptotic complexity.
|
|
40
|
-
- `tester`: TDD, unit test coverage, mock isolation.
|
|
41
|
-
- `general`: Standard expert proposer.
|
|
42
|
-
|
|
43
|
-
### 3. Syntax Pre-check Gate with Judge Auto-fix Directive
|
|
44
|
-
- **Checker**:
|
|
45
|
-
- JS/MJS/CJS: `new vm.Script(code)` from built-in `node:vm` (instant, memory-safe).
|
|
46
|
-
- JSON: `JSON.parse(code)`.
|
|
47
|
-
- Python: `python3 -m py_compile`.
|
|
48
|
-
- **Judge Directive**:
|
|
49
|
-
- If a candidate has a syntax warning, inform the judge:
|
|
50
|
-
`CRITICAL JUDGE DIRECTIVE: If Candidate X has the best overall architecture or solution despite this syntax error, DO NOT reject them! You MUST correct the syntax error directly during final code synthesis and declare Candidate X the winner.`
|
|
51
|
-
|
|
52
|
-
### 4. Consilium / Peer Critique Round 2
|
|
53
|
-
- **Schema**: `peer_critique_enabled: z.boolean().default(false)`.
|
|
54
|
-
- **Pipeline**:
|
|
55
|
-
- If enabled and `candidates.length >= 2`, run Round 2:
|
|
56
|
-
- Pass anonymized candidate proposals to each proposer.
|
|
57
|
-
- Collect refined solutions with peer critique.
|
|
58
|
-
- Supply improved proposals to Judge/Curator.
|
|
59
|
-
|
|
60
|
-
### 5. Analytics Filtering & CSV/JSON Export
|
|
61
|
-
- **Leaderboard Filter**: `getMoaLeaderboard(historyFilePath, limit, filterPreset)`.
|
|
62
|
-
- **Export Endpoints**:
|
|
63
|
-
- `GET /dsh-moa/leaderboard?preset=<name>&format=json|csv`.
|
|
64
|
-
- **Client UI**:
|
|
65
|
-
- Dropdown filter by preset in Section 4.
|
|
66
|
-
- `Export CSV` / `Export JSON` action buttons.
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## Verification
|
|
71
|
-
- Unit tests for all 5 features in `test/moa-power-pack.test.mjs`.
|
|
72
|
-
- Total test suite passing with 0 regressions.
|
|
73
|
-
- Live deployment to `/home/vadim/.dsh/profiles/web` on MiniPC and endpoint verification.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Implementation Plan - Issue #63: Pipeline Stability and Quality Polish
|
|
2
|
-
|
|
3
|
-
## 1. Context & Objectives
|
|
4
|
-
Polish runtime stability, error recovery, token efficiency, and file generation integrity across `@goodandready/dsh-moa`:
|
|
5
|
-
1. **Refinement Context & Heuristic**: Fix `isRefinementTask` parameter handling in `moa-runner.js` and format collected files into Markdown code fences via `formatProjectContext(files)`, preventing `[object Object]` prompt injection.
|
|
6
|
-
2. **Round 2 Workspace Sync**: Save refined files to `.moa/candidate-N/` in Consilium Round 2 so promoted winner files contain peer-critiqued code rather than stale Round 1 drafts.
|
|
7
|
-
3. **End-to-End AbortSignal Propagation**: Propagate `signal` from `streamMoATurn` through `runMoAPipeline`, `runReferencesParallel`, Round 2 calls, and judge synthesis, cancelling in-flight requests and preventing token waste.
|
|
8
|
-
4. **Context Window Protection**: Apply `stripOrSummarizeCode` in Round 2 peer review and judge synthesis prompts when candidate outputs exceed threshold.
|
|
9
|
-
5. **Architectural Standard**: Maintain file size of `lib/moa-runner.js` strictly under 800 lines.
|
|
10
|
-
|
|
11
|
-
## 2. Modules Impacted
|
|
12
|
-
- `lib/file-workspace.js`: Add `formatProjectContext`, enhance `isRefinementTask`.
|
|
13
|
-
- `lib/moa-prompts.js`: Context protection in `buildPeerCritiquePrompt` & `buildSynthesisPrompt`.
|
|
14
|
-
- `lib/moa-runner.js`: `signal` propagation, Round 2 workspace persistence, refinement context formatting.
|
|
15
|
-
- `test/`: Add regression tests for all fixes.
|