@goodandready/dsh-moa 0.2.74 → 0.2.76
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 +8 -0
- package/README.ru.md +8 -0
- package/README.zh.md +8 -0
- package/lib/client.js +103 -2
- package/lib/events.js +4 -1
- package/lib/moa-schema.js +12 -1
- package/lib/pipeline/context.js +31 -0
- package/lib/pipeline/cove-verifier.js +401 -0
- package/lib/pipeline/developer-preferences.js +196 -0
- package/lib/pipeline/manifest-stack.js +287 -0
- package/lib/pipeline/runner.js +37 -2
- package/lib/pipeline/security-fuzzer.js +290 -0
- package/lib/routes/preferences.js +108 -0
- package/lib/routes.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,6 +52,8 @@ Single-model AI generation often suffers from blind spots, single-perspective bi
|
|
|
52
52
|
9. **Run History & Win-Rate Leaderboard**: Persistent logging of every run kind (synthesis, fast mode, questionnaire) with built-in REST endpoints (`/dsh-moa/history`, `/dsh-moa/leaderboard`, `/dsh-moa/runs/<id>`).
|
|
53
53
|
10. **Live Canvas 1-Click Preview (optional)**: when the `@goodandready/dsh-live-canvas` plugin is installed in the same profile, the promoted HTML is pushed to its sandbox and the MoA answer carries a one-click preview link; without it the step is skipped silently.
|
|
54
54
|
11. **Interactive Workbench (File Scoring 1–10, User Pick & Mix, Top-Model Glue & Judge Re-Check)**: Judge scores each candidate file (1–10) with pros and cons. Users can mix and match files across proposals in the WebUI. The turn's top-performing reference model harmonizes cross-file imports and contracts, followed by a final judge re-audit before promotion. Companion integration with [`dsh-time-machine`](https://github.com/goodandready/dsh-time-machine) for safe pre-promotion rollback checkpoints.
|
|
55
|
+
12. **Adversarial White-Hat Security Fuzzing Gate (#302)**: Red Team security audit scanning candidate code for SQLi, XSS, Command Injection, Path Traversal, ReDoS, and Prototype Pollution with blocking `SECURITY_VETO`.
|
|
56
|
+
13. **Chain-of-Verification (CoVe) Fact-Checking Gate for Code (#314)**: Independent pre-judge verification formulating factual API questions, validating modules and functions against standard library and project manifests to eliminate hallucinated methods.
|
|
55
57
|
|
|
56
58
|
---
|
|
57
59
|
|
|
@@ -195,6 +197,12 @@ Dispatches `moa/judge-escalation` Cordis events and displays escalation decision
|
|
|
195
197
|
### 22. Self-Consistency Temperature Sampling for Single Models
|
|
196
198
|
Allows single-model configurations (such as a local Ollama/vLLM instance or a single API key) to leverage Mixture-of-Agents diversity. When enabled on a preset with 1 model slot, the runner expands it into $N$ parallel candidate streams with distinct temperatures (e.g. 0.2, 0.6, 0.9) and complementary personas (`proposer`, `challenger`, `minimalist`), calculates agreement ratio, and performs full MoA consensus synthesis. Dispatches `moa/self-consistency-expand` Cordis events. Configured via `self_consistency_enabled: true`, `self_consistency_samples: 3`, and `self_consistency_temperatures: [0.2, 0.6, 0.9]`.
|
|
197
199
|
|
|
200
|
+
### 23. Stack-Aware Dynamic Persona Evolution
|
|
201
|
+
Scans project manifests (`package.json`, `Cargo.toml`, `pyproject.toml`, `requirements.txt`, `go.mod`) to detect languages, frameworks, and libraries. Automatically specializes candidate proposers into domain-specific roles (e.g. React Optimization, TypeScript Safety, Accessibility, FastAPI Async) to maximize hypothesis diversity. Emits `moa/stack-detected` Cordis events. Configured via `stack_aware_personas_enabled: true`.
|
|
202
|
+
|
|
203
|
+
### 24. Self-Learning Developer Preferences Metaprompt
|
|
204
|
+
Maintains a persistent profile of developer coding principles and architectural preferences in `~/.dsh/moa/preferences.json`. Injects active principles into the Judge prompt to bias consensus toward team standards (strict typing, functional immutability, error boundaries). Manageable via `GET/POST/DELETE /dsh-moa/preferences` REST endpoints and preset toggle `developer_preferences_enabled: true`.
|
|
205
|
+
|
|
198
206
|
### 6. Live Canvas 1-Click Preview (optional)
|
|
199
207
|
If `@goodandready/dsh-live-canvas` is installed in the same profile, `dsh-moa` pushes the promoted HTML file to the Live Canvas REST contract (`POST /dsh-live-canvas/api/preview`, served by the same harness webServer) and appends a one-click preview link (`/dsh-live-canvas/sandbox/<id>`) to the answer. Without the plugin the step is skipped silently — no errors in the log, no dead links.
|
|
200
208
|
|
package/README.ru.md
CHANGED
|
@@ -52,6 +52,8 @@
|
|
|
52
52
|
9. **История запусков и лидерборд моделей**: Персистентное логирование всех видов запусков (синтез, fast mode, опросник) и REST-эндпоинты (`/dsh-moa/history`, `/dsh-moa/leaderboard`, `/dsh-moa/runs/<id>`).
|
|
53
53
|
10. **Live Canvas 1-клик предпросмотр (опционально)**: если в профиле установлен `@goodandready/dsh-live-canvas`, промоученный HTML отправляется в его песочницу, а ответ MoA содержит ссылку на предпросмотр в 1 клик; без плагина шаг тихо пропускается.
|
|
54
54
|
11. **Интерактивный воркбенч (Оценка файлов 1–10, выбор в UI, склейка лучшей моделью и повторный аудит)**: Судья оценивает каждый сгенерированный файл каждого кандидата (1–10) с указанием ключевых плюсов и минусов. Пользователь комбинирует желаемый набор файлов в WebUI; лучшая модель раунда вызывается для гармонизации импортов и контрактов, после чего судья выполняет финальную валидацию перед промоушеном. Совместимо с [`dsh-time-machine`](https://github.com/goodandready/dsh-time-machine) для безопасных теневых снимков Git.
|
|
55
|
+
12. **Состязательный White-Hat фильтр безопасности (#302)**: Red Team аудит безопасности перед арбитражем судьи, выявляющий SQLi, XSS, инъекции команд, Path Traversal, ReDoS и Prototype Pollution с блокирующим вердиктом `SECURITY_VETO`.
|
|
56
|
+
13. **Фильтр верификации фактов и API (CoVe) (#314)**: Автономная цепочка верификации (Chain-of-Verification), формулирующая проверочные вопросы по вызовам методов и пакетам, исключающая галлюцинированные и несуществующие API библиотек.
|
|
55
57
|
|
|
56
58
|
---
|
|
57
59
|
|
|
@@ -195,6 +197,12 @@ graph TD
|
|
|
195
197
|
### 22. Самосогласованное температурное сэмплирование для одиночных моделей (Self-Consistency)
|
|
196
198
|
Позволяет пользователям с единственной моделью (локальная Ollama, vLLM или единственный API-ключ) получать преимущества ансамблевой валидации MoA. Автоматически разворачивает одиночный слот на $N$ параллельных запусков с различными температурами (`0.2, 0.6, 0.9`) и дополняющими друг друга инженерными персонами (`proposer`, `challenger`, `minimalist`), вычисляет коэффициент согласия (Self-Consistency Agreement) и синтезирует итоговый результат. Генерирует событие `moa/self-consistency-expand`.
|
|
197
199
|
|
|
200
|
+
### 23. Динамическая адаптация персон по манифестам проекта (Stack-Aware Personas)
|
|
201
|
+
Автоматически сканирует манифесты проекта (`package.json`, `Cargo.toml`, `pyproject.toml`, `requirements.txt`, `go.mod`) для определения стека технологий и библиотек. Специализирует роли кандидатов под конкретный стек (оптимизация рендера, строгая типизация, доступность, асинхронные интерфейсы), обеспечивая многоаспектный анализ задачи. Генерирует событие `moa/stack-detected`. Включается через `stack_aware_personas_enabled: true`.
|
|
202
|
+
|
|
203
|
+
### 24. Метапромпт предпочтений разработчика (Developer Preferences)
|
|
204
|
+
Хранит профиль архитектурных стандартов и стилевых предпочтений разработчика в `~/.dsh/moa/preferences.json`. Инжектирует активные принципы в контекст судьи, гарантируя соответствие выбранного решения вкусам команды (строгая типизация, иммутабельность, обработка ошибок). Доступен REST API (`GET/POST/DELETE /dsh-moa/preferences`) и опция пресета `developer_preferences_enabled: true`.
|
|
205
|
+
|
|
198
206
|
### 6. Live Canvas 1-клик предпросмотр (опционально)
|
|
199
207
|
Если в профиле установлен `@goodandready/dsh-live-canvas`, `dsh-moa` отправляет промоученный HTML-файл в REST-контракт Live Canvas (`POST /dsh-live-canvas/api/preview`, тот же webServer харнесса) и добавляет к ответу ссылку на предпросмотр (`/dsh-live-canvas/sandbox/<id>`). Без плагина шаг пропускается тихо — без ошибок в журнале и без битых ссылок.
|
|
200
208
|
|
package/README.zh.md
CHANGED
|
@@ -52,6 +52,8 @@
|
|
|
52
52
|
9. **运行历史与胜率排行榜**:对每一类运行(综合、快速模式、问卷)进行持久化记录,并内置 REST 端点(`/dsh-moa/history`、`/dsh-moa/leaderboard`、`/dsh-moa/runs/<id>`)。
|
|
53
53
|
10. **Live Canvas 一键预览(可选)**:当同一 profile 中安装了 `@goodandready/dsh-live-canvas` 时,提升到项目根目录的 HTML 会被推入其沙箱,MoA 回答附带一键预览链接;未安装时该步骤静默跳过。
|
|
54
54
|
11. **交互式工作台 (1-10分文件打分、自由混搭、最优模型粘合与裁判复审)**:裁判对每个候选模型生成的每个文件进行 1–10 分打分并列出优缺点。用户可在 WebUI 中自由勾选组合所需文件;当轮最高分模型被调用以粘合协同跨文件导入与类型接口,随后由裁判进行最终复审。支持配套插件 [`dsh-time-machine`](https://github.com/goodandready/dsh-time-machine) 在文件提升前创建影子 Git 回滚快照。
|
|
55
|
+
12. **对抗性白帽安全模糊测试关卡 (#302)**:红队安全审计器在裁判前检查 SQLi、XSS、命令注入、路径穿越、ReDoS 和原型污染漏洞,发现严重漏洞时触发 `SECURITY_VETO` 否决。
|
|
56
|
+
13. **代码事实与 API 验证链关卡 (CoVe) (#314)**:独立的裁判前事实核验,生成针对性 API 问题并对照标准库及项目配置清单,杜绝调用虚构不存在的幻觉方法。
|
|
55
57
|
|
|
56
58
|
---
|
|
57
59
|
|
|
@@ -172,6 +174,12 @@ graph TD
|
|
|
172
174
|
### 22. 单模型自洽性温度采样 (Self-Consistency Temperature Sampling)
|
|
173
175
|
专为仅配置单模型(如本地 Ollama/vLLM 或单一 API Key)的场景设计。开启后自动将单槽位扩展为 $N$ 个并行采样(分别采用 0.2、0.6、0.9 等递增温度与 `proposer`、`challenger`、`minimalist` 互补提示词),评估自洽一致性比率并进行全流程 MoA 综合聚合,触发 `moa/self-consistency-expand` 事件。
|
|
174
176
|
|
|
177
|
+
### 23. 基于项目清单的感知角色演化 (Stack-Aware Personas)
|
|
178
|
+
自动扫描工作区清单 (`package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`) 识别编程语言、框架与核心依赖,动态为各候选槽位分派互补的领域专家角色(如 React 渲染优化、TypeScript 严格类型安全、可访问性审查、FastAPI 异步架构),触发 `moa/stack-detected` 事件。通过 `stack_aware_personas_enabled: true` 配置。
|
|
179
|
+
|
|
180
|
+
### 24. 自学习开发者代码偏好元提示词 (Developer Preferences)
|
|
181
|
+
在本地 `~/.dsh/moa/preferences.json` 持久化存储团队编码规范与架构偏好,将启用的规则动态注入裁判评审阶段,使综合方案贴合开发者个人习惯(严格类型、函数不可变性、防御性错误边界)。提供 `GET/POST/DELETE /dsh-moa/preferences` REST 端点,通过 `developer_preferences_enabled: true` 开启。
|
|
182
|
+
|
|
175
183
|
### 6. Live Canvas 一键预览(可选)
|
|
176
184
|
若同一 profile 中安装了 `@goodandready/dsh-live-canvas`,`dsh-moa` 会将提升后的 HTML 文件推送到 Live Canvas 的 REST 契约(`POST /dsh-live-canvas/api/preview`,由同一 harness webServer 提供服务),并在回答中附上一键预览链接(`/dsh-live-canvas/sandbox/<id>`)。未安装该插件时此步骤静默跳过——日志无报错,也不会出现死链接。
|
|
177
185
|
|
package/lib/client.js
CHANGED
|
@@ -224,7 +224,15 @@ window.__ModuleLoader__.load({
|
|
|
224
224
|
"aggregator.escalation_policy_upgrade": "Auto-Upgrade to Senior Judge on Divergence",
|
|
225
225
|
"aggregator.escalation_policy_council": "Convene 3-Judge Majority Council on Divergence",
|
|
226
226
|
"aggregator.escalation_threshold": "Divergence Threshold:",
|
|
227
|
-
"aggregator.escalation_judge_label": "Senior Judge:"
|
|
227
|
+
"aggregator.escalation_judge_label": "Senior Judge:",
|
|
228
|
+
"aggregator.stack_personas_title": "\u{1F4E6} Stack-Aware Dynamic Persona Evolution (Project Manifests)",
|
|
229
|
+
"aggregator.stack_personas_desc": "Scans project manifests (package.json, Cargo.toml, pyproject.toml, go.mod) and assigns specialized engineering roles to candidate slots.",
|
|
230
|
+
"aggregator.preferences_title": "\u{1F9E0} Developer Coding Principles & Preferences Metaprompt",
|
|
231
|
+
"aggregator.preferences_desc": "Injects learned developer preferences (strict typing, functional immutability, error boundaries) to guide Judge synthesis.",
|
|
232
|
+
"aggregator.security_gate_title": "\u{1F6E1}\uFE0F Adversarial White-Hat Security Fuzzing Gate",
|
|
233
|
+
"aggregator.security_gate_desc": "Red-team security auditor checks candidate proposals for SQLi, XSS, ReDoS, Command Injection and Path Traversal with blocking SECURITY_VETO.",
|
|
234
|
+
"aggregator.cove_gate_title": "\u{1F50D} Chain-of-Verification (CoVe) Fact-Checking Gate",
|
|
235
|
+
"aggregator.cove_gate_desc": "Formulates API existence & method signature verification questions, disqualifying candidates that use hallucinated methods."
|
|
228
236
|
};
|
|
229
237
|
const zh = {
|
|
230
238
|
title: "\u667A\u80FD\u4F53\u6DF7\u5408 (MoA)",
|
|
@@ -439,7 +447,15 @@ window.__ModuleLoader__.load({
|
|
|
439
447
|
"aggregator.escalation_policy_upgrade": "\u5206\u6B67\u65F6\u81EA\u52A8\u5347\u7EA7\u81F3\u9AD8\u9636\u88C1\u5224",
|
|
440
448
|
"aggregator.escalation_policy_council": "\u5206\u6B67\u65F6\u7EC4\u5EFA 3 \u88C1\u5224\u591A\u6570\u51B3\u7B56\u5E2D",
|
|
441
449
|
"aggregator.escalation_threshold": "\u5206\u6B67\u9608\u503C:",
|
|
442
|
-
"aggregator.escalation_judge_label": "\u9AD8\u9636\u88C1\u5224\u6A21\u578B:"
|
|
450
|
+
"aggregator.escalation_judge_label": "\u9AD8\u9636\u88C1\u5224\u6A21\u578B:",
|
|
451
|
+
"aggregator.stack_personas_title": "\u{1F4E6} \u57FA\u4E8E\u9879\u76EE\u914D\u7F6E\u6E05\u5355\u7684\u611F\u77E5\u89D2\u8272\u6F14\u5316 (Stack-Aware Personas)",
|
|
452
|
+
"aggregator.stack_personas_desc": "\u81EA\u52A8\u626B\u63CF\u9879\u76EE\u6E05\u5355 (package.json, Cargo.toml, pyproject.toml, go.mod) \u5E76\u4E3A\u5404\u5019\u9009\u69FD\u4F4D\u6307\u6D3E\u4E13\u5C5E\u4E13\u4E1A\u89D2\u8272\u3002",
|
|
453
|
+
"aggregator.preferences_title": "\u{1F9E0} \u81EA\u5B66\u4E60\u5F00\u53D1\u8005\u4EE3\u7801\u504F\u597D\u5143\u63D0\u793A\u8BCD (Developer Preferences)",
|
|
454
|
+
"aggregator.preferences_desc": "\u5C06\u5F00\u53D1\u8005\u504F\u597D\uFF08\u4E25\u683C\u7C7B\u578B\u3001\u51FD\u6570\u4E0D\u53EF\u53D8\u6027\u3001\u9632\u5FA1\u6027\u9519\u8BEF\u5904\u7406\u7B49\uFF09\u6CE8\u5165\u88C1\u5224\u7EFC\u5408\u8BC4\u5BA1\u9636\u6BB5\u3002",
|
|
455
|
+
"aggregator.security_gate_title": "\u{1F6E1}\uFE0F \u5BF9\u6297\u6027\u767D\u5E3D\u5B89\u5168\u6A21\u7CCA\u6D4B\u8BD5\u5173\u5361",
|
|
456
|
+
"aggregator.security_gate_desc": "\u7EA2\u961F\u5B89\u5168\u5BA1\u8BA1\u5668\u68C0\u67E5\u5019\u9009\u65B9\u6848\u4E2D\u7684 SQLi\u3001XSS\u3001ReDoS\u3001\u547D\u4EE4\u6CE8\u5165\u548C\u8DEF\u5F84\u7A7F\u8D8A\u6F0F\u6D1E\uFF0C\u5E76\u5728\u53D1\u73B0\u4E25\u91CD\u6F0F\u6D1E\u65F6\u89E6\u53D1 SECURITY_VETO \u5426\u51B3\u3002",
|
|
457
|
+
"aggregator.cove_gate_title": "\u{1F50D} \u9A8C\u8BC1\u94FE (CoVe) \u4EE3\u7801\u4E8B\u5B9E\u4E0E API \u6838\u67E5\u5173\u5361",
|
|
458
|
+
"aggregator.cove_gate_desc": "\u751F\u6210 API \u5B58\u5728\u6027\u4E0E\u65B9\u6CD5\u7B7E\u540D\u6838\u9A8C\u95EE\u9898\uFF0C\u81EA\u52A8\u60E9\u7F5A\u6216\u53D6\u6D88\u4F7F\u7528\u865A\u6784\u5E7B\u89C9\u65B9\u6CD5\u7684\u5019\u9009\u65B9\u6848\u3002"
|
|
443
459
|
};
|
|
444
460
|
function makeT(dict, fallback) {
|
|
445
461
|
return function t(key, vars) {
|
|
@@ -2354,6 +2370,7 @@ window.__ModuleLoader__.load({
|
|
|
2354
2370
|
)
|
|
2355
2371
|
)
|
|
2356
2372
|
),
|
|
2373
|
+
// --- src/client/86-card-aggregator-ext2.js ---
|
|
2357
2374
|
/* Pre-Judge Local Syntax Gate (#303) & Early Semantic Consensus (#299) */
|
|
2358
2375
|
React.createElement(
|
|
2359
2376
|
"div",
|
|
@@ -2559,6 +2576,90 @@ window.__ModuleLoader__.load({
|
|
|
2559
2576
|
)
|
|
2560
2577
|
)
|
|
2561
2578
|
),
|
|
2579
|
+
/* Stack-Aware Dynamic Persona Evolution (#308) */
|
|
2580
|
+
React.createElement(
|
|
2581
|
+
"div",
|
|
2582
|
+
{ style: { display: "flex", flexDirection: "column", gap: 6, padding: "8px 12px", background: "var(--dsw-alias-bg-layer-2)", borderRadius: 8, border: "1px solid var(--dsw-alias-border-l2)", marginTop: 8 } },
|
|
2583
|
+
React.createElement(
|
|
2584
|
+
"label",
|
|
2585
|
+
{ style: { display: "flex", alignItems: "center", gap: 8, cursor: "pointer", fontSize: 13, fontWeight: 500 } },
|
|
2586
|
+
React.createElement("input", {
|
|
2587
|
+
type: "checkbox",
|
|
2588
|
+
checked: Boolean(currentPreset.stack_aware_personas_enabled),
|
|
2589
|
+
onChange: (e) => updateCurrentPreset((p) => ({ ...p, stack_aware_personas_enabled: e.target.checked })),
|
|
2590
|
+
style: { accentColor: "var(--dsw-alias-state-brand-primary, var(--dsw-alias-label-primary))", cursor: "pointer" }
|
|
2591
|
+
}),
|
|
2592
|
+
t("aggregator.stack_personas_title") || "\u{1F4E6} Stack-Aware Dynamic Persona Evolution (Project Manifests)"
|
|
2593
|
+
),
|
|
2594
|
+
React.createElement(
|
|
2595
|
+
"div",
|
|
2596
|
+
{ style: { fontSize: 12, color: "var(--dsw-alias-label-secondary)", marginLeft: 22 } },
|
|
2597
|
+
t("aggregator.stack_personas_desc") || "Scans project manifests (package.json, Cargo.toml, pyproject.toml, go.mod) and assigns specialized engineering roles to candidate slots."
|
|
2598
|
+
)
|
|
2599
|
+
),
|
|
2600
|
+
/* Self-Learning Developer Preferences Metaprompt (#309) */
|
|
2601
|
+
React.createElement(
|
|
2602
|
+
"div",
|
|
2603
|
+
{ style: { display: "flex", flexDirection: "column", gap: 6, padding: "8px 12px", background: "var(--dsw-alias-bg-layer-2)", borderRadius: 8, border: "1px solid var(--dsw-alias-border-l2)", marginTop: 8 } },
|
|
2604
|
+
React.createElement(
|
|
2605
|
+
"label",
|
|
2606
|
+
{ style: { display: "flex", alignItems: "center", gap: 8, cursor: "pointer", fontSize: 13, fontWeight: 500 } },
|
|
2607
|
+
React.createElement("input", {
|
|
2608
|
+
type: "checkbox",
|
|
2609
|
+
checked: Boolean(currentPreset.developer_preferences_enabled),
|
|
2610
|
+
onChange: (e) => updateCurrentPreset((p) => ({ ...p, developer_preferences_enabled: e.target.checked })),
|
|
2611
|
+
style: { accentColor: "var(--dsw-alias-state-brand-primary, var(--dsw-alias-label-primary))", cursor: "pointer" }
|
|
2612
|
+
}),
|
|
2613
|
+
t("aggregator.preferences_title") || "\u{1F9E0} Developer Coding Principles & Preferences Metaprompt"
|
|
2614
|
+
),
|
|
2615
|
+
React.createElement(
|
|
2616
|
+
"div",
|
|
2617
|
+
{ style: { fontSize: 12, color: "var(--dsw-alias-label-secondary)", marginLeft: 22 } },
|
|
2618
|
+
t("aggregator.preferences_desc") || "Injects learned developer preferences (strict typing, functional immutability, error boundaries) to guide Judge synthesis."
|
|
2619
|
+
)
|
|
2620
|
+
),
|
|
2621
|
+
/* Adversarial White-Hat Security Fuzzing Gate (#302) */
|
|
2622
|
+
React.createElement(
|
|
2623
|
+
"div",
|
|
2624
|
+
{ style: { display: "flex", flexDirection: "column", gap: 6, padding: "8px 12px", background: "var(--dsw-alias-bg-layer-2)", borderRadius: 8, border: "1px solid var(--dsw-alias-border-l2)", marginTop: 8 } },
|
|
2625
|
+
React.createElement(
|
|
2626
|
+
"label",
|
|
2627
|
+
{ style: { display: "flex", alignItems: "center", gap: 8, cursor: "pointer", fontSize: 13, fontWeight: 500 } },
|
|
2628
|
+
React.createElement("input", {
|
|
2629
|
+
type: "checkbox",
|
|
2630
|
+
checked: Boolean(currentPreset.security_gate_enabled),
|
|
2631
|
+
onChange: (e) => updateCurrentPreset((p) => ({ ...p, security_gate_enabled: e.target.checked })),
|
|
2632
|
+
style: { accentColor: "var(--dsw-alias-state-brand-primary, var(--dsw-alias-label-primary))", cursor: "pointer" }
|
|
2633
|
+
}),
|
|
2634
|
+
t("aggregator.security_gate_title") || "\u{1F6E1}\uFE0F Adversarial White-Hat Security Fuzzing Gate"
|
|
2635
|
+
),
|
|
2636
|
+
React.createElement(
|
|
2637
|
+
"div",
|
|
2638
|
+
{ style: { fontSize: 12, color: "var(--dsw-alias-label-secondary)", marginLeft: 22 } },
|
|
2639
|
+
t("aggregator.security_gate_desc") || "Red-team security auditor checks candidate proposals for SQLi, XSS, ReDoS, Command Injection and Path Traversal with blocking SECURITY_VETO."
|
|
2640
|
+
)
|
|
2641
|
+
),
|
|
2642
|
+
/* Chain-of-Verification (CoVe) Fact-Checking Gate (#314) */
|
|
2643
|
+
React.createElement(
|
|
2644
|
+
"div",
|
|
2645
|
+
{ style: { display: "flex", flexDirection: "column", gap: 6, padding: "8px 12px", background: "var(--dsw-alias-bg-layer-2)", borderRadius: 8, border: "1px solid var(--dsw-alias-border-l2)", marginTop: 8 } },
|
|
2646
|
+
React.createElement(
|
|
2647
|
+
"label",
|
|
2648
|
+
{ style: { display: "flex", alignItems: "center", gap: 8, cursor: "pointer", fontSize: 13, fontWeight: 500 } },
|
|
2649
|
+
React.createElement("input", {
|
|
2650
|
+
type: "checkbox",
|
|
2651
|
+
checked: Boolean(currentPreset.cove_verification_enabled),
|
|
2652
|
+
onChange: (e) => updateCurrentPreset((p) => ({ ...p, cove_verification_enabled: e.target.checked })),
|
|
2653
|
+
style: { accentColor: "var(--dsw-alias-state-brand-primary, var(--dsw-alias-label-primary))", cursor: "pointer" }
|
|
2654
|
+
}),
|
|
2655
|
+
t("aggregator.cove_gate_title") || "\u{1F50D} Chain-of-Verification (CoVe) Fact-Checking Gate"
|
|
2656
|
+
),
|
|
2657
|
+
React.createElement(
|
|
2658
|
+
"div",
|
|
2659
|
+
{ style: { fontSize: 12, color: "var(--dsw-alias-label-secondary)", marginLeft: 22 } },
|
|
2660
|
+
t("aggregator.cove_gate_desc") || "Formulates API existence & method signature verification questions, disqualifying candidates that use hallucinated methods."
|
|
2661
|
+
)
|
|
2662
|
+
),
|
|
2562
2663
|
/* Fallback Judges Chain */
|
|
2563
2664
|
React.createElement(
|
|
2564
2665
|
"div",
|
package/lib/events.js
CHANGED
|
@@ -9,6 +9,10 @@ export const MOA_EVENTS = {
|
|
|
9
9
|
EARLY_CONSENSUS: 'moa/early-consensus',
|
|
10
10
|
JUDGE_ESCALATION: 'moa/judge-escalation',
|
|
11
11
|
SELF_CONSISTENCY_EXPAND: 'moa/self-consistency-expand',
|
|
12
|
+
STACK_DETECTED: 'moa/stack-detected',
|
|
13
|
+
PREFERENCES_APPLIED: 'moa/preferences-applied',
|
|
14
|
+
SECURITY_AUDIT: 'moa/security-audit',
|
|
15
|
+
COVE_VERIFIED: 'moa/cove-verified',
|
|
12
16
|
CRITIQUE_COMPLETE: 'moa/critique-complete',
|
|
13
17
|
JUDGE_VERDICT: 'moa/judge-verdict',
|
|
14
18
|
CONTEXT_PRUNING: 'moa/context-pruning',
|
|
@@ -34,4 +38,3 @@ export function emitEvent(ctx, eventName, payload) {
|
|
|
34
38
|
/* best-effort event dispatch: listener exceptions must never abort pipeline */
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
|
-
|
package/lib/moa-schema.js
CHANGED
|
@@ -89,6 +89,12 @@ export const PresetSchema = z.object({
|
|
|
89
89
|
escalation_policy: z.string().default('single'),
|
|
90
90
|
escalation_disagreement_threshold: z.number().default(0.40),
|
|
91
91
|
escalation_judge: ModelSlotSchema.default({ provider: '', model: '' }),
|
|
92
|
+
stack_aware_personas_enabled: z.boolean().default(false),
|
|
93
|
+
developer_preferences_enabled: z.boolean().default(false),
|
|
94
|
+
security_gate_enabled: z.boolean().default(false),
|
|
95
|
+
security_gate_strict_veto: z.boolean().default(true),
|
|
96
|
+
cove_verification_enabled: z.boolean().default(false),
|
|
97
|
+
cove_max_questions: z.number().default(5),
|
|
92
98
|
})
|
|
93
99
|
|
|
94
100
|
export const Config = z.object({
|
|
@@ -124,6 +130,12 @@ export const Config = z.object({
|
|
|
124
130
|
escalation_policy: z.string().default('single').volatile(),
|
|
125
131
|
escalation_disagreement_threshold: z.number().default(0.40).volatile(),
|
|
126
132
|
escalation_judge: ModelSlotSchema.default({ provider: '', model: '' }).volatile(),
|
|
133
|
+
stack_aware_personas_enabled: z.boolean().default(false).volatile(),
|
|
134
|
+
developer_preferences_enabled: z.boolean().default(false).volatile(),
|
|
135
|
+
security_gate_enabled: z.boolean().default(false).volatile(),
|
|
136
|
+
security_gate_strict_veto: z.boolean().default(true).volatile(),
|
|
137
|
+
cove_verification_enabled: z.boolean().default(false).volatile(),
|
|
138
|
+
cove_max_questions: z.number().default(5).volatile(),
|
|
127
139
|
smart_routing_model: ModelSlotSchema.default({ provider: '', model: '' }).volatile(),
|
|
128
140
|
prices: z.dict(PriceRow).default({}).volatile(),
|
|
129
141
|
presets: z.array(PresetSchema).default([
|
|
@@ -193,4 +205,3 @@ export function plainConfig(value) {
|
|
|
193
205
|
}
|
|
194
206
|
return value
|
|
195
207
|
}
|
|
196
|
-
|
package/lib/pipeline/context.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { detectProjectStack, assignStackAwarePersonas, formatStackAwareDirective } from './manifest-stack.js'
|
|
2
|
+
import { formatPreferencesDirective } from './developer-preferences.js'
|
|
1
3
|
import { expandSelfConsistencySlots } from './self-consistency.js'
|
|
2
4
|
import { emitEvent, MOA_EVENTS } from '../events.js'
|
|
3
5
|
import { balanceCandidateQuotas } from '../moa-quota-balancer.js'
|
|
@@ -81,6 +83,34 @@ export async function stageProjectContext({
|
|
|
81
83
|
const semanticCacheEnabled = Boolean(preset?.semantic_cache_enabled)
|
|
82
84
|
const semanticCacheTtlHours = typeof preset?.semantic_cache_ttl_hours === 'number' ? preset.semantic_cache_ttl_hours : 168
|
|
83
85
|
|
|
86
|
+
const stackInfo = detectProjectStack(cwd)
|
|
87
|
+
if (stackInfo.manifestFound) {
|
|
88
|
+
emitEvent(ctx, MOA_EVENTS.STACK_DETECTED, {
|
|
89
|
+
primaryLanguage: stackInfo.primaryLanguage,
|
|
90
|
+
frameworks: stackInfo.frameworks,
|
|
91
|
+
libraries: stackInfo.libraries,
|
|
92
|
+
stackSummary: stackInfo.stackSummary,
|
|
93
|
+
})
|
|
94
|
+
if (typeof onProgress === 'function' && stackInfo.stackSummary) {
|
|
95
|
+
onProgress(`📦 *Project Stack: Detected ${stackInfo.stackSummary}*\n`)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const stackAwarePersonasEnabled = Boolean(preset?.stack_aware_personas_enabled)
|
|
100
|
+
if (stackAwarePersonasEnabled && !selfConsistencyExpanded) {
|
|
101
|
+
const stackRes = assignStackAwarePersonas(effectiveReferenceModels, stackInfo, { enabled: true })
|
|
102
|
+
if (stackRes.isSpecialized) {
|
|
103
|
+
effectiveReferenceModels = stackRes.references
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const developerPreferencesEnabled = Boolean(preset?.developer_preferences_enabled)
|
|
108
|
+
const developerPreferencesDirective = formatPreferencesDirective(null, { enabled: developerPreferencesEnabled })
|
|
109
|
+
if (developerPreferencesDirective) {
|
|
110
|
+
emitEvent(ctx, MOA_EVENTS.PREFERENCES_APPLIED, { enabled: true })
|
|
111
|
+
}
|
|
112
|
+
const stackAwareDirective = formatStackAwareDirective(stackInfo)
|
|
113
|
+
|
|
84
114
|
const collectedCtx = await collectProjectContext(cwd, 16000)
|
|
85
115
|
const isRefinement = Boolean(collectedCtx?.files?.length > 0 && isRefinementTask(userPrompt, collectedCtx.files))
|
|
86
116
|
let projectContext = ''
|
|
@@ -170,6 +200,7 @@ export async function stageProjectContext({
|
|
|
170
200
|
semanticCacheEnabled, semanticCacheTtlHours,
|
|
171
201
|
selfConsistencyEnabled, selfConsistencyExpanded, selfConsistencySamples, selfConsistencyTemperatures,
|
|
172
202
|
escalationPolicy, escalationDisagreementThreshold, escalationJudge,
|
|
203
|
+
stackInfo, stackAwareDirective, developerPreferencesDirective,
|
|
173
204
|
}
|
|
174
205
|
}
|
|
175
206
|
|