monomind 1.11.13 → 1.11.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/.claude/commands/mastermind/idea.md +1 -1
  2. package/.claude/commands/mastermind/master.md +1 -1
  3. package/.claude/scheduled_tasks.lock +1 -1
  4. package/.claude/skills/mastermind/_protocol.md +4 -4
  5. package/.claude/skills/mastermind/architect.md +4 -7
  6. package/.claude/skills/mastermind/autodev.md +2 -4
  7. package/.claude/skills/mastermind/build.md +3 -3
  8. package/.claude/skills/mastermind/content.md +3 -3
  9. package/.claude/skills/mastermind/createorg.md +2 -2
  10. package/.claude/skills/mastermind/finance.md +3 -3
  11. package/.claude/skills/mastermind/idea.md +0 -8
  12. package/.claude/skills/mastermind/marketing.md +3 -3
  13. package/.claude/skills/mastermind/monitor.md +2 -2
  14. package/.claude/skills/mastermind/ops.md +3 -3
  15. package/.claude/skills/mastermind/release.md +3 -3
  16. package/.claude/skills/mastermind/research.md +3 -3
  17. package/.claude/skills/mastermind/review.md +3 -3
  18. package/.claude/skills/mastermind/sales.md +3 -3
  19. package/README.md +286 -129
  20. package/package.json +2 -2
  21. package/packages/@monomind/cli/README.md +286 -129
  22. package/packages/@monomind/cli/bundled-graph/dist/src/build.js +73 -0
  23. package/packages/@monomind/cli/bundled-graph/dist/src/cluster.js +120 -0
  24. package/packages/@monomind/cli/bundled-graph/package.json +57 -0
  25. package/packages/@monomind/cli/dist/src/agents/halt-signal.d.ts +25 -0
  26. package/packages/@monomind/cli/dist/src/agents/halt-signal.js +76 -0
  27. package/packages/@monomind/cli/dist/src/agents/index.d.ts +18 -0
  28. package/packages/@monomind/cli/dist/src/agents/index.js +13 -0
  29. package/packages/@monomind/cli/dist/src/agents/managed-agent.d.ts +41 -0
  30. package/packages/@monomind/cli/dist/src/agents/managed-agent.js +69 -0
  31. package/packages/@monomind/cli/dist/src/agents/prompt-experiment.d.ts +23 -0
  32. package/packages/@monomind/cli/dist/src/agents/prompt-experiment.js +49 -0
  33. package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.d.ts +22 -0
  34. package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.js +80 -0
  35. package/packages/@monomind/cli/dist/src/agents/registry-query.d.ts +71 -0
  36. package/packages/@monomind/cli/dist/src/agents/registry-query.js +125 -0
  37. package/packages/@monomind/cli/dist/src/agents/score-decay.d.ts +19 -0
  38. package/packages/@monomind/cli/dist/src/agents/score-decay.js +22 -0
  39. package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.d.ts +13 -0
  40. package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.js +40 -0
  41. package/packages/@monomind/cli/dist/src/agents/specialization-scorer.d.ts +54 -0
  42. package/packages/@monomind/cli/dist/src/agents/specialization-scorer.js +212 -0
  43. package/packages/@monomind/cli/dist/src/agents/termination-watcher.d.ts +30 -0
  44. package/packages/@monomind/cli/dist/src/agents/termination-watcher.js +84 -0
  45. package/packages/@monomind/cli/dist/src/agents/trigger-index.d.ts +20 -0
  46. package/packages/@monomind/cli/dist/src/agents/trigger-index.js +38 -0
  47. package/packages/@monomind/cli/dist/src/agents/trigger-scanner.d.ts +64 -0
  48. package/packages/@monomind/cli/dist/src/agents/trigger-scanner.js +308 -0
  49. package/packages/@monomind/cli/dist/src/agents/version-diff.d.ts +18 -0
  50. package/packages/@monomind/cli/dist/src/agents/version-diff.js +64 -0
  51. package/packages/@monomind/cli/dist/src/agents/version-store.d.ts +60 -0
  52. package/packages/@monomind/cli/dist/src/agents/version-store.js +235 -0
  53. package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.d.ts +45 -0
  54. package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.js +404 -0
  55. package/packages/@monomind/cli/dist/src/commands/agent-wasm.d.ts +14 -0
  56. package/packages/@monomind/cli/dist/src/commands/agent-wasm.js +333 -0
  57. package/packages/@monomind/cli/dist/src/commands/doctor.js +55 -1
  58. package/packages/@monomind/cli/dist/src/commands/ui.js +68 -0
  59. package/packages/@monomind/cli/dist/src/consensus/index.d.ts +7 -0
  60. package/packages/@monomind/cli/dist/src/consensus/index.js +6 -0
  61. package/packages/@monomind/cli/dist/src/context/context-provider.d.ts +44 -0
  62. package/packages/@monomind/cli/dist/src/context/context-provider.js +25 -0
  63. package/packages/@monomind/cli/dist/src/context/git-state-provider.d.ts +12 -0
  64. package/packages/@monomind/cli/dist/src/context/git-state-provider.js +34 -0
  65. package/packages/@monomind/cli/dist/src/context/index.d.ts +12 -0
  66. package/packages/@monomind/cli/dist/src/context/index.js +12 -0
  67. package/packages/@monomind/cli/dist/src/context/project-conventions-provider.d.ts +15 -0
  68. package/packages/@monomind/cli/dist/src/context/project-conventions-provider.js +19 -0
  69. package/packages/@monomind/cli/dist/src/context/prompt-assembler.d.ts +26 -0
  70. package/packages/@monomind/cli/dist/src/context/prompt-assembler.js +93 -0
  71. package/packages/@monomind/cli/dist/src/context/task-history-provider.d.ts +24 -0
  72. package/packages/@monomind/cli/dist/src/context/task-history-provider.js +32 -0
  73. package/packages/@monomind/cli/dist/src/context/user-preferences-provider.d.ts +14 -0
  74. package/packages/@monomind/cli/dist/src/context/user-preferences-provider.js +27 -0
  75. package/packages/@monomind/cli/dist/src/dlq/dlq-reader.d.ts +31 -0
  76. package/packages/@monomind/cli/dist/src/dlq/dlq-reader.js +81 -0
  77. package/packages/@monomind/cli/dist/src/dlq/dlq-writer.d.ts +24 -0
  78. package/packages/@monomind/cli/dist/src/dlq/dlq-writer.js +65 -0
  79. package/packages/@monomind/cli/dist/src/dlq/index.d.ts +10 -0
  80. package/packages/@monomind/cli/dist/src/dlq/index.js +7 -0
  81. package/packages/@monomind/cli/dist/src/eval/dataset-manager.d.ts +33 -0
  82. package/packages/@monomind/cli/dist/src/eval/dataset-manager.js +107 -0
  83. package/packages/@monomind/cli/dist/src/eval/dataset-runner.d.ts +23 -0
  84. package/packages/@monomind/cli/dist/src/eval/dataset-runner.js +59 -0
  85. package/packages/@monomind/cli/dist/src/eval/index.d.ts +10 -0
  86. package/packages/@monomind/cli/dist/src/eval/index.js +7 -0
  87. package/packages/@monomind/cli/dist/src/eval/trace-collector.d.ts +40 -0
  88. package/packages/@monomind/cli/dist/src/eval/trace-collector.js +102 -0
  89. package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
  90. package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.js +264 -0
  91. package/packages/@monomind/cli/dist/src/init/statusline-generator.js +3 -3
  92. package/packages/@monomind/cli/dist/src/interactive/interrupt.d.ts +22 -0
  93. package/packages/@monomind/cli/dist/src/interactive/interrupt.js +71 -0
  94. package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.d.ts +25 -0
  95. package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.js +48 -0
  96. package/packages/@monomind/cli/dist/src/mcp/tool-registry.d.ts +61 -0
  97. package/packages/@monomind/cli/dist/src/mcp/tool-registry.js +246 -0
  98. package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
  99. package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.js +230 -0
  100. package/packages/@monomind/cli/dist/src/model/complexity-scorer.d.ts +21 -0
  101. package/packages/@monomind/cli/dist/src/model/complexity-scorer.js +106 -0
  102. package/packages/@monomind/cli/dist/src/model/index.d.ts +4 -0
  103. package/packages/@monomind/cli/dist/src/model/index.js +4 -0
  104. package/packages/@monomind/cli/dist/src/model/model-settings.d.ts +22 -0
  105. package/packages/@monomind/cli/dist/src/model/model-settings.js +33 -0
  106. package/packages/@monomind/cli/dist/src/model/model-tier-resolver.d.ts +24 -0
  107. package/packages/@monomind/cli/dist/src/model/model-tier-resolver.js +65 -0
  108. package/packages/@monomind/cli/dist/src/monovector/capabilities.d.ts +34 -0
  109. package/packages/@monomind/cli/dist/src/monovector/capabilities.js +37 -0
  110. package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +1 -1
  111. package/packages/@monomind/cli/dist/src/orchestration/index.d.ts +7 -0
  112. package/packages/@monomind/cli/dist/src/orchestration/index.js +6 -0
  113. package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.d.ts +11 -0
  114. package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.js +31 -0
  115. package/packages/@monomind/cli/dist/src/orchestration/routing-modes.d.ts +68 -0
  116. package/packages/@monomind/cli/dist/src/orchestration/routing-modes.js +180 -0
  117. package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
  118. package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.js +126 -0
  119. package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.d.ts +12 -0
  120. package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.js +188 -0
  121. package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
  122. package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.js +206 -0
  123. package/packages/@monomind/cli/dist/src/runtime/headless.d.ts +60 -0
  124. package/packages/@monomind/cli/dist/src/runtime/headless.js +284 -0
  125. package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.d.ts +50 -0
  126. package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.js +95 -0
  127. package/packages/@monomind/cli/dist/src/services/container-worker-pool.d.ts +197 -0
  128. package/packages/@monomind/cli/dist/src/services/container-worker-pool.js +623 -0
  129. package/packages/@monomind/cli/dist/src/services/index.d.ts +13 -0
  130. package/packages/@monomind/cli/dist/src/services/index.js +11 -0
  131. package/packages/@monomind/cli/dist/src/services/worker-queue.d.ts +201 -0
  132. package/packages/@monomind/cli/dist/src/services/worker-queue.js +594 -0
  133. package/packages/@monomind/cli/dist/src/swarm/communication-graph.d.ts +25 -0
  134. package/packages/@monomind/cli/dist/src/swarm/communication-graph.js +77 -0
  135. package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.d.ts +31 -0
  136. package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.js +61 -0
  137. package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.d.ts +19 -0
  138. package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.js +68 -0
  139. package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.d.ts +13 -0
  140. package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.js +205 -0
  141. package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
  142. package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.js +190 -0
  143. package/packages/@monomind/cli/dist/src/transfer/test-seraphine.d.ts +6 -0
  144. package/packages/@monomind/cli/dist/src/transfer/test-seraphine.js +105 -0
  145. package/packages/@monomind/cli/dist/src/transfer/tests/test-store.d.ts +7 -0
  146. package/packages/@monomind/cli/dist/src/transfer/tests/test-store.js +214 -0
  147. package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.d.ts +10 -0
  148. package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.js +82 -0
  149. package/packages/@monomind/cli/dist/src/workflow/context-resolver.d.ts +12 -0
  150. package/packages/@monomind/cli/dist/src/workflow/context-resolver.js +23 -0
  151. package/packages/@monomind/cli/dist/src/workflow/dag-builder.d.ts +17 -0
  152. package/packages/@monomind/cli/dist/src/workflow/dag-builder.js +129 -0
  153. package/packages/@monomind/cli/dist/src/workflow/dag-executor.d.ts +9 -0
  154. package/packages/@monomind/cli/dist/src/workflow/dag-executor.js +116 -0
  155. package/packages/@monomind/cli/dist/src/workflow/dag-types.d.ts +41 -0
  156. package/packages/@monomind/cli/dist/src/workflow/dag-types.js +8 -0
  157. package/packages/@monomind/cli/dist/src/workflow/dsl-parser.d.ts +12 -0
  158. package/packages/@monomind/cli/dist/src/workflow/dsl-parser.js +20 -0
  159. package/packages/@monomind/cli/dist/src/workflow/dsl-schema.d.ts +165 -0
  160. package/packages/@monomind/cli/dist/src/workflow/dsl-schema.js +82 -0
  161. package/packages/@monomind/cli/dist/src/workflow/index.d.ts +13 -0
  162. package/packages/@monomind/cli/dist/src/workflow/index.js +11 -0
  163. package/packages/@monomind/cli/dist/src/workflow/template-engine.d.ts +11 -0
  164. package/packages/@monomind/cli/dist/src/workflow/template-engine.js +40 -0
  165. package/packages/@monomind/cli/dist/src/workflow/workflow-executor.d.ts +29 -0
  166. package/packages/@monomind/cli/dist/src/workflow/workflow-executor.js +227 -0
  167. package/packages/@monomind/cli/package.json +9 -9
  168. package/packages/@monomind/guidance/dist/adversarial.d.ts +284 -0
  169. package/packages/@monomind/guidance/dist/adversarial.js +572 -0
  170. package/packages/@monomind/guidance/dist/analyzer.d.ts +530 -0
  171. package/packages/@monomind/guidance/dist/analyzer.js +2518 -0
  172. package/packages/@monomind/guidance/dist/artifacts.d.ts +283 -0
  173. package/packages/@monomind/guidance/dist/artifacts.js +356 -0
  174. package/packages/@monomind/guidance/dist/authority.d.ts +290 -0
  175. package/packages/@monomind/guidance/dist/authority.js +558 -0
  176. package/packages/@monomind/guidance/dist/capabilities.d.ts +209 -0
  177. package/packages/@monomind/guidance/dist/capabilities.js +485 -0
  178. package/packages/@monomind/guidance/dist/coherence.d.ts +233 -0
  179. package/packages/@monomind/guidance/dist/coherence.js +372 -0
  180. package/packages/@monomind/guidance/dist/compiler.d.ts +87 -0
  181. package/packages/@monomind/guidance/dist/compiler.js +419 -0
  182. package/packages/@monomind/guidance/dist/conformance-kit.d.ts +225 -0
  183. package/packages/@monomind/guidance/dist/conformance-kit.js +629 -0
  184. package/packages/@monomind/guidance/dist/continue-gate.d.ts +214 -0
  185. package/packages/@monomind/guidance/dist/continue-gate.js +353 -0
  186. package/packages/@monomind/guidance/dist/crypto-utils.d.ts +17 -0
  187. package/packages/@monomind/guidance/dist/crypto-utils.js +24 -0
  188. package/packages/@monomind/guidance/dist/evolution.d.ts +282 -0
  189. package/packages/@monomind/guidance/dist/evolution.js +500 -0
  190. package/packages/@monomind/guidance/dist/gates.d.ts +79 -0
  191. package/packages/@monomind/guidance/dist/gates.js +302 -0
  192. package/packages/@monomind/guidance/dist/gateway.d.ts +206 -0
  193. package/packages/@monomind/guidance/dist/gateway.js +452 -0
  194. package/packages/@monomind/guidance/dist/generators.d.ts +153 -0
  195. package/packages/@monomind/guidance/dist/generators.js +682 -0
  196. package/packages/@monomind/guidance/dist/headless.d.ts +177 -0
  197. package/packages/@monomind/guidance/dist/headless.js +342 -0
  198. package/packages/@monomind/guidance/dist/hooks.d.ts +109 -0
  199. package/packages/@monomind/guidance/dist/hooks.js +347 -0
  200. package/packages/@monomind/guidance/dist/index.d.ts +205 -0
  201. package/packages/@monomind/guidance/dist/index.js +321 -0
  202. package/packages/@monomind/guidance/dist/ledger.d.ts +162 -0
  203. package/packages/@monomind/guidance/dist/ledger.js +375 -0
  204. package/packages/@monomind/guidance/dist/manifest-validator.d.ts +289 -0
  205. package/packages/@monomind/guidance/dist/manifest-validator.js +838 -0
  206. package/packages/@monomind/guidance/dist/memory-gate.d.ts +222 -0
  207. package/packages/@monomind/guidance/dist/memory-gate.js +382 -0
  208. package/packages/@monomind/guidance/dist/meta-governance.d.ts +265 -0
  209. package/packages/@monomind/guidance/dist/meta-governance.js +348 -0
  210. package/packages/@monomind/guidance/dist/optimizer.d.ts +104 -0
  211. package/packages/@monomind/guidance/dist/optimizer.js +329 -0
  212. package/packages/@monomind/guidance/dist/persistence.d.ts +189 -0
  213. package/packages/@monomind/guidance/dist/persistence.js +464 -0
  214. package/packages/@monomind/guidance/dist/proof.d.ts +185 -0
  215. package/packages/@monomind/guidance/dist/proof.js +238 -0
  216. package/packages/@monomind/guidance/dist/retriever.d.ts +116 -0
  217. package/packages/@monomind/guidance/dist/retriever.js +394 -0
  218. package/packages/@monomind/guidance/dist/ruvbot-integration.d.ts +370 -0
  219. package/packages/@monomind/guidance/dist/ruvbot-integration.js +738 -0
  220. package/packages/@monomind/guidance/dist/temporal.d.ts +426 -0
  221. package/packages/@monomind/guidance/dist/temporal.js +658 -0
  222. package/packages/@monomind/guidance/dist/trust.d.ts +283 -0
  223. package/packages/@monomind/guidance/dist/trust.js +473 -0
  224. package/packages/@monomind/guidance/dist/truth-anchors.d.ts +276 -0
  225. package/packages/@monomind/guidance/dist/truth-anchors.js +488 -0
  226. package/packages/@monomind/guidance/dist/types.d.ts +378 -0
  227. package/packages/@monomind/guidance/dist/types.js +10 -0
  228. package/packages/@monomind/guidance/dist/uncertainty.d.ts +372 -0
  229. package/packages/@monomind/guidance/dist/uncertainty.js +619 -0
  230. package/packages/@monomind/guidance/dist/wasm-kernel.d.ts +48 -0
  231. package/packages/@monomind/guidance/dist/wasm-kernel.js +158 -0
@@ -0,0 +1,59 @@
1
+ /**
2
+ * DatasetRunner - Run eval datasets against agents and detect regressions (Task 33)
3
+ */
4
+ import { randomUUID } from 'crypto';
5
+ export class DatasetRunner {
6
+ /**
7
+ * Run all traces through the agent runner and compute stats.
8
+ * Optionally compare against a baseline to detect regressions.
9
+ */
10
+ async run(opts) {
11
+ const { datasetId, agentVersion, traces, agentRunner, baselineResult, regressionThreshold = 0.1, } = opts;
12
+ const results = [];
13
+ for (const trace of traces) {
14
+ const result = await agentRunner(trace);
15
+ results.push({ trace, result });
16
+ }
17
+ const passCount = results.filter((r) => r.result.outcome === 'success').length;
18
+ const failCount = results.length - passCount;
19
+ const totalQuality = results.reduce((sum, r) => sum + r.result.qualityScore, 0);
20
+ const totalLatency = results.reduce((sum, r) => sum + r.result.latencyMs, 0);
21
+ const avgQualityScore = results.length > 0 ? totalQuality / results.length : 0;
22
+ const avgLatencyMs = results.length > 0 ? totalLatency / results.length : 0;
23
+ // Regression detection
24
+ const regressionDetails = [];
25
+ let regressionDetected = false;
26
+ if (baselineResult) {
27
+ const delta = baselineResult.avgQualityScore - avgQualityScore;
28
+ if (delta > regressionThreshold) {
29
+ regressionDetected = true;
30
+ // Report per-trace regressions for traces with quality below baseline average
31
+ for (const { trace, result } of results) {
32
+ if (result.qualityScore < baselineResult.avgQualityScore) {
33
+ regressionDetails.push({
34
+ traceId: trace.traceId,
35
+ agentSlug: trace.agentSlug,
36
+ baselineScore: baselineResult.avgQualityScore,
37
+ currentScore: result.qualityScore,
38
+ delta: baselineResult.avgQualityScore - result.qualityScore,
39
+ });
40
+ }
41
+ }
42
+ }
43
+ }
44
+ return {
45
+ runId: randomUUID(),
46
+ datasetId,
47
+ runAt: new Date().toISOString(),
48
+ agentVersion,
49
+ entriesTested: results.length,
50
+ passCount,
51
+ failCount,
52
+ avgQualityScore,
53
+ avgLatencyMs,
54
+ regressionDetected,
55
+ regressionDetails,
56
+ };
57
+ }
58
+ }
59
+ //# sourceMappingURL=dataset-runner.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Eval Module - Automated eval dataset from production traces (Task 33)
3
+ */
4
+ export { TraceCollector } from './trace-collector.js';
5
+ export type { RecordTraceInput } from './trace-collector.js';
6
+ export { DatasetManager } from './dataset-manager.js';
7
+ export type { CreateFromTracesOpts } from './dataset-manager.js';
8
+ export { DatasetRunner } from './dataset-runner.js';
9
+ export type { AgentRunnerResult, DatasetRunOpts } from './dataset-runner.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Eval Module - Automated eval dataset from production traces (Task 33)
3
+ */
4
+ export { TraceCollector } from './trace-collector.js';
5
+ export { DatasetManager } from './dataset-manager.js';
6
+ export { DatasetRunner } from './dataset-runner.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,40 @@
1
+ import type { EvalTrace } from '../../../shared/src/types/eval.js';
2
+ export interface RecordTraceInput {
3
+ agentSlug: string;
4
+ agentVersion: string;
5
+ taskDescription: string;
6
+ taskInput: string;
7
+ agentOutput: string;
8
+ retryCount: number;
9
+ qualityScore?: number;
10
+ outcome: 'success' | 'failure' | 'timeout';
11
+ latencyMs: number;
12
+ tokenCount?: number;
13
+ costUsd?: number;
14
+ correctedOutput?: string;
15
+ }
16
+ export declare class TraceCollector {
17
+ private filePath;
18
+ constructor(filePath: string);
19
+ /**
20
+ * Determine auto review status based on trace quality signals.
21
+ */
22
+ autoReviewStatus(input: RecordTraceInput): 'pending' | 'approved';
23
+ /**
24
+ * Auto-generate tags based on trace characteristics.
25
+ */
26
+ autoTag(input: RecordTraceInput): string[];
27
+ /**
28
+ * Record a trace, auto-generating traceId, capturedAt, reviewStatus, and tags.
29
+ */
30
+ record(input: RecordTraceInput): EvalTrace;
31
+ /**
32
+ * Read all traces from the JSONL file.
33
+ */
34
+ readAll(): EvalTrace[];
35
+ /**
36
+ * Get traces pending review, with optional limit.
37
+ */
38
+ getTracesPendingReview(limit?: number): EvalTrace[];
39
+ }
40
+ //# sourceMappingURL=trace-collector.d.ts.map
@@ -0,0 +1,102 @@
1
+ /**
2
+ * TraceCollector - JSONL-based production trace collection (Task 33)
3
+ */
4
+ import { randomUUID } from 'crypto';
5
+ import { appendFileSync, readFileSync, existsSync, statSync } from 'fs';
6
+ import { parseJsonl } from '../utils/parse-jsonl.js';
7
+ export class TraceCollector {
8
+ filePath;
9
+ constructor(filePath) {
10
+ this.filePath = filePath;
11
+ }
12
+ /**
13
+ * Determine auto review status based on trace quality signals.
14
+ */
15
+ autoReviewStatus(input) {
16
+ if (input.retryCount > 1)
17
+ return 'pending';
18
+ if (input.qualityScore !== undefined && input.qualityScore < 0.6)
19
+ return 'pending';
20
+ if (input.outcome === 'failure')
21
+ return 'pending';
22
+ return 'approved';
23
+ }
24
+ /**
25
+ * Auto-generate tags based on trace characteristics.
26
+ */
27
+ autoTag(input) {
28
+ const tags = [];
29
+ if (input.retryCount > 1)
30
+ tags.push('high-retry');
31
+ if (input.outcome === 'failure')
32
+ tags.push('failure');
33
+ if (input.outcome === 'timeout')
34
+ tags.push('timeout');
35
+ return tags;
36
+ }
37
+ /**
38
+ * Record a trace, auto-generating traceId, capturedAt, reviewStatus, and tags.
39
+ */
40
+ record(input) {
41
+ const trace = {
42
+ traceId: randomUUID(),
43
+ agentSlug: input.agentSlug,
44
+ agentVersion: input.agentVersion,
45
+ taskDescription: input.taskDescription,
46
+ taskInput: input.taskInput,
47
+ agentOutput: input.agentOutput,
48
+ retryCount: input.retryCount,
49
+ qualityScore: input.qualityScore,
50
+ outcome: input.outcome,
51
+ latencyMs: input.latencyMs,
52
+ tokenCount: input.tokenCount,
53
+ costUsd: input.costUsd,
54
+ capturedAt: new Date().toISOString(),
55
+ reviewStatus: this.autoReviewStatus(input),
56
+ correctedOutput: input.correctedOutput,
57
+ tags: this.autoTag(input),
58
+ };
59
+ // Defensive serialization — agent outputs may contain circular references
60
+ // or BigInt; without this guard the writer crashes mid-trace.
61
+ let serialized;
62
+ try {
63
+ serialized = JSON.stringify(trace);
64
+ }
65
+ catch {
66
+ serialized = JSON.stringify({
67
+ traceId: trace.traceId,
68
+ agentSlug: trace.agentSlug,
69
+ capturedAt: trace.capturedAt,
70
+ reviewStatus: trace.reviewStatus,
71
+ outcome: 'serialize_failed',
72
+ });
73
+ }
74
+ appendFileSync(this.filePath, serialized + '\n', 'utf-8');
75
+ return trace;
76
+ }
77
+ /**
78
+ * Read all traces from the JSONL file.
79
+ */
80
+ readAll() {
81
+ if (!existsSync(this.filePath))
82
+ return [];
83
+ const stat = statSync(this.filePath);
84
+ if (stat.size > 256 * 1024 * 1024) {
85
+ throw new Error(`Trace file exceeds 256MB (${stat.size} bytes). Run rotation/cleanup.`);
86
+ }
87
+ const content = readFileSync(this.filePath, 'utf-8').trim();
88
+ if (!content)
89
+ return [];
90
+ return parseJsonl(content);
91
+ }
92
+ /**
93
+ * Get traces pending review, with optional limit.
94
+ */
95
+ getTracesPendingReview(limit) {
96
+ const all = this.readAll().filter((t) => t.reviewStatus === 'pending');
97
+ if (limit !== undefined)
98
+ return all.slice(0, limit);
99
+ return all;
100
+ }
101
+ }
102
+ //# sourceMappingURL=trace-collector.js.map
@@ -0,0 +1,68 @@
1
+ /**
2
+ * In-Memory Repositories - CLI Infrastructure
3
+ *
4
+ * Lightweight in-memory implementations for CLI use.
5
+ *
6
+ * @module v1/cli/infrastructure
7
+ */
8
+ import { Agent, AgentStatus, AgentRole } from '../../../swarm/src/domain/entities/agent.js';
9
+ import { Task, TaskStatus, TaskPriority } from '../../../swarm/src/domain/entities/task.js';
10
+ import { IAgentRepository, AgentQueryOptions, AgentStatistics } from '../../../swarm/src/domain/repositories/agent-repository.interface.js';
11
+ import { ITaskRepository, TaskQueryOptions, TaskStatistics } from '../../../swarm/src/domain/repositories/task-repository.interface.js';
12
+ /**
13
+ * In-Memory Agent Repository
14
+ */
15
+ export declare class InMemoryAgentRepository implements IAgentRepository {
16
+ private agents;
17
+ private initialized;
18
+ initialize(): Promise<void>;
19
+ shutdown(): Promise<void>;
20
+ clear(): Promise<void>;
21
+ save(agent: Agent): Promise<void>;
22
+ findById(id: string): Promise<Agent | null>;
23
+ findByName(name: string): Promise<Agent | null>;
24
+ delete(id: string): Promise<boolean>;
25
+ exists(id: string): Promise<boolean>;
26
+ saveMany(agents: Agent[]): Promise<void>;
27
+ findByIds(ids: string[]): Promise<Agent[]>;
28
+ deleteMany(ids: string[]): Promise<number>;
29
+ findAll(options?: AgentQueryOptions): Promise<Agent[]>;
30
+ findByStatus(status: AgentStatus): Promise<Agent[]>;
31
+ findByRole(role: AgentRole): Promise<Agent[]>;
32
+ findByDomain(domain: string): Promise<Agent[]>;
33
+ findByParent(parentId: string): Promise<Agent[]>;
34
+ findByCapability(capability: string): Promise<Agent[]>;
35
+ findAvailable(): Promise<Agent[]>;
36
+ getStatistics(): Promise<AgentStatistics>;
37
+ count(options?: AgentQueryOptions): Promise<number>;
38
+ }
39
+ /**
40
+ * In-Memory Task Repository
41
+ */
42
+ export declare class InMemoryTaskRepository implements ITaskRepository {
43
+ private tasks;
44
+ private initialized;
45
+ initialize(): Promise<void>;
46
+ shutdown(): Promise<void>;
47
+ clear(): Promise<void>;
48
+ save(task: Task): Promise<void>;
49
+ findById(id: string): Promise<Task | null>;
50
+ delete(id: string): Promise<boolean>;
51
+ exists(id: string): Promise<boolean>;
52
+ saveMany(tasks: Task[]): Promise<void>;
53
+ findByIds(ids: string[]): Promise<Task[]>;
54
+ deleteMany(ids: string[]): Promise<number>;
55
+ findAll(options?: TaskQueryOptions): Promise<Task[]>;
56
+ findByStatus(status: TaskStatus): Promise<Task[]>;
57
+ findByPriority(priority: TaskPriority): Promise<Task[]>;
58
+ findByAgent(agentId: string): Promise<Task[]>;
59
+ findPending(): Promise<Task[]>;
60
+ findQueued(): Promise<Task[]>;
61
+ findRunning(): Promise<Task[]>;
62
+ findTimedOut(): Promise<Task[]>;
63
+ getNextTask(agentCapabilities?: string[]): Promise<Task | null>;
64
+ getTaskQueue(limit?: number): Promise<Task[]>;
65
+ getStatistics(): Promise<TaskStatistics>;
66
+ count(options?: TaskQueryOptions): Promise<number>;
67
+ }
68
+ //# sourceMappingURL=in-memory-repositories.d.ts.map
@@ -0,0 +1,264 @@
1
+ /**
2
+ * In-Memory Repositories - CLI Infrastructure
3
+ *
4
+ * Lightweight in-memory implementations for CLI use.
5
+ *
6
+ * @module v1/cli/infrastructure
7
+ */
8
+ /**
9
+ * In-Memory Agent Repository
10
+ */
11
+ export class InMemoryAgentRepository {
12
+ agents = new Map();
13
+ initialized = false;
14
+ async initialize() {
15
+ this.initialized = true;
16
+ }
17
+ async shutdown() {
18
+ this.agents.clear();
19
+ this.initialized = false;
20
+ }
21
+ async clear() {
22
+ this.agents.clear();
23
+ }
24
+ async save(agent) {
25
+ this.agents.set(agent.id, agent);
26
+ }
27
+ async findById(id) {
28
+ return this.agents.get(id) ?? null;
29
+ }
30
+ async findByName(name) {
31
+ for (const agent of this.agents.values()) {
32
+ if (agent.name === name)
33
+ return agent;
34
+ }
35
+ return null;
36
+ }
37
+ async delete(id) {
38
+ return this.agents.delete(id);
39
+ }
40
+ async exists(id) {
41
+ return this.agents.has(id);
42
+ }
43
+ async saveMany(agents) {
44
+ for (const agent of agents) {
45
+ this.agents.set(agent.id, agent);
46
+ }
47
+ }
48
+ async findByIds(ids) {
49
+ return ids.map((id) => this.agents.get(id)).filter((a) => a !== undefined);
50
+ }
51
+ async deleteMany(ids) {
52
+ let deleted = 0;
53
+ for (const id of ids) {
54
+ if (this.agents.delete(id))
55
+ deleted++;
56
+ }
57
+ return deleted;
58
+ }
59
+ async findAll(options) {
60
+ let result = Array.from(this.agents.values());
61
+ if (options?.status)
62
+ result = result.filter((a) => a.status === options.status);
63
+ if (options?.role)
64
+ result = result.filter((a) => a.role === options.role);
65
+ if (options?.domain)
66
+ result = result.filter((a) => a.domain === options.domain);
67
+ if (options?.limit)
68
+ result = result.slice(0, options.limit);
69
+ return result;
70
+ }
71
+ async findByStatus(status) {
72
+ return this.findAll({ status });
73
+ }
74
+ async findByRole(role) {
75
+ return this.findAll({ role });
76
+ }
77
+ async findByDomain(domain) {
78
+ return this.findAll({ domain });
79
+ }
80
+ async findByParent(parentId) {
81
+ return Array.from(this.agents.values()).filter((a) => a.parentId === parentId);
82
+ }
83
+ async findByCapability(capability) {
84
+ return Array.from(this.agents.values()).filter((a) => a.hasCapability(capability));
85
+ }
86
+ async findAvailable() {
87
+ return Array.from(this.agents.values()).filter((a) => a.isAvailable());
88
+ }
89
+ async getStatistics() {
90
+ const agents = Array.from(this.agents.values());
91
+ const byStatus = {
92
+ idle: 0,
93
+ active: 0,
94
+ busy: 0,
95
+ paused: 0,
96
+ terminated: 0,
97
+ error: 0,
98
+ };
99
+ const byRole = {};
100
+ const byDomain = {};
101
+ let totalCompleted = 0;
102
+ let totalUtilization = 0;
103
+ for (const agent of agents) {
104
+ byStatus[agent.status]++;
105
+ byRole[agent.role] = (byRole[agent.role] ?? 0) + 1;
106
+ byDomain[agent.domain] = (byDomain[agent.domain] ?? 0) + 1;
107
+ totalCompleted += agent.completedTaskCount;
108
+ totalUtilization += agent.getUtilization();
109
+ }
110
+ return {
111
+ total: agents.length,
112
+ byStatus,
113
+ byRole,
114
+ byDomain,
115
+ totalTasksCompleted: totalCompleted,
116
+ averageUtilization: agents.length > 0 ? totalUtilization / agents.length : 0,
117
+ };
118
+ }
119
+ async count(options) {
120
+ return (await this.findAll(options)).length;
121
+ }
122
+ }
123
+ /**
124
+ * In-Memory Task Repository
125
+ */
126
+ export class InMemoryTaskRepository {
127
+ tasks = new Map();
128
+ initialized = false;
129
+ async initialize() {
130
+ this.initialized = true;
131
+ }
132
+ async shutdown() {
133
+ this.tasks.clear();
134
+ this.initialized = false;
135
+ }
136
+ async clear() {
137
+ this.tasks.clear();
138
+ }
139
+ async save(task) {
140
+ this.tasks.set(task.id, task);
141
+ }
142
+ async findById(id) {
143
+ return this.tasks.get(id) ?? null;
144
+ }
145
+ async delete(id) {
146
+ return this.tasks.delete(id);
147
+ }
148
+ async exists(id) {
149
+ return this.tasks.has(id);
150
+ }
151
+ async saveMany(tasks) {
152
+ for (const task of tasks) {
153
+ this.tasks.set(task.id, task);
154
+ }
155
+ }
156
+ async findByIds(ids) {
157
+ return ids.map((id) => this.tasks.get(id)).filter((t) => t !== undefined);
158
+ }
159
+ async deleteMany(ids) {
160
+ let deleted = 0;
161
+ for (const id of ids) {
162
+ if (this.tasks.delete(id))
163
+ deleted++;
164
+ }
165
+ return deleted;
166
+ }
167
+ async findAll(options) {
168
+ let result = Array.from(this.tasks.values());
169
+ if (options?.status)
170
+ result = result.filter((t) => t.status === options.status);
171
+ if (options?.priority)
172
+ result = result.filter((t) => t.priority === options.priority);
173
+ if (options?.type)
174
+ result = result.filter((t) => t.type === options.type);
175
+ if (options?.assignedAgentId)
176
+ result = result.filter((t) => t.assignedAgentId === options.assignedAgentId);
177
+ if (options?.limit)
178
+ result = result.slice(0, options.limit);
179
+ return result;
180
+ }
181
+ async findByStatus(status) {
182
+ return this.findAll({ status });
183
+ }
184
+ async findByPriority(priority) {
185
+ return this.findAll({ priority });
186
+ }
187
+ async findByAgent(agentId) {
188
+ return this.findAll({ assignedAgentId: agentId });
189
+ }
190
+ async findPending() {
191
+ return this.findByStatus('pending');
192
+ }
193
+ async findQueued() {
194
+ return this.findByStatus('queued');
195
+ }
196
+ async findRunning() {
197
+ return this.findByStatus('running');
198
+ }
199
+ async findTimedOut() {
200
+ return Array.from(this.tasks.values()).filter((t) => t.isTimedOut());
201
+ }
202
+ async getNextTask(agentCapabilities) {
203
+ const queued = await this.findQueued();
204
+ if (queued.length === 0)
205
+ return null;
206
+ queued.sort((a, b) => a.comparePriority(b));
207
+ return queued[0];
208
+ }
209
+ async getTaskQueue(limit = 10) {
210
+ const queued = await this.findQueued();
211
+ queued.sort((a, b) => a.comparePriority(b));
212
+ return queued.slice(0, limit);
213
+ }
214
+ async getStatistics() {
215
+ const tasks = Array.from(this.tasks.values());
216
+ const byStatus = {
217
+ pending: 0,
218
+ queued: 0,
219
+ assigned: 0,
220
+ running: 0,
221
+ completed: 0,
222
+ failed: 0,
223
+ cancelled: 0,
224
+ };
225
+ const byPriority = {
226
+ critical: 0,
227
+ high: 0,
228
+ normal: 0,
229
+ low: 0,
230
+ };
231
+ const byType = {};
232
+ let totalDuration = 0;
233
+ let completedCount = 0;
234
+ let failedCount = 0;
235
+ let retryTotal = 0;
236
+ for (const task of tasks) {
237
+ byStatus[task.status]++;
238
+ byPriority[task.priority]++;
239
+ byType[task.type] = (byType[task.type] ?? 0) + 1;
240
+ if (task.status === 'completed') {
241
+ completedCount++;
242
+ const duration = task.getExecutionDuration();
243
+ if (duration)
244
+ totalDuration += duration;
245
+ }
246
+ if (task.status === 'failed')
247
+ failedCount++;
248
+ retryTotal += task.retryCount;
249
+ }
250
+ return {
251
+ total: tasks.length,
252
+ byStatus,
253
+ byPriority,
254
+ byType,
255
+ averageExecutionTime: completedCount > 0 ? totalDuration / completedCount : 0,
256
+ successRate: tasks.length > 0 ? completedCount / tasks.length : 0,
257
+ retryRate: tasks.length > 0 ? retryTotal / tasks.length : 0,
258
+ };
259
+ }
260
+ async count(options) {
261
+ return (await this.findAll(options)).length;
262
+ }
263
+ }
264
+ //# sourceMappingURL=in-memory-repositories.js.map
@@ -1149,10 +1149,10 @@ function generateDashboard() {
1149
1149
 
1150
1150
  const hil = getHILPending();
1151
1151
  const hilStr = hil.pending > 0
1152
- ? \` \${DIV} \${x.coral}✨ \${x.bold}\${hil.pending}\${x.reset}\${x.coral} HIL pending\${x.reset}\`
1153
- : \`\`;
1152
+ ? \`\${x.coral}✨ \${x.bold}\${hil.pending}\${x.reset}\${x.coral} HIL pending\${x.reset}\`
1153
+ : \`\${x.slate}✨ no pending HIL\${x.reset}\`;
1154
1154
 
1155
- lines.push(\`\${x.teal}🧠 CONTEXT\${x.reset} \${graphStr}\${hilStr}\`);
1155
+ lines.push(\`\${x.teal}🧠 CONTEXT\${x.reset} \${graphStr} \${DIV} \${hilStr}\`);
1156
1156
 
1157
1157
  return lines.join('\\n');
1158
1158
  }
@@ -0,0 +1,22 @@
1
+ export type InterruptDecision = 'approved' | 'rejected' | 'edited';
2
+ export interface InterruptPromptResult {
3
+ decision: InterruptDecision;
4
+ editedTask?: string;
5
+ }
6
+ export interface InterruptConfig {
7
+ interruptBefore: string[];
8
+ confidenceThreshold?: number;
9
+ autoApprove?: boolean;
10
+ }
11
+ export declare class InterruptRegistry {
12
+ private config;
13
+ load(config: InterruptConfig): void;
14
+ shouldInterrupt(agentSlug: string, confidence?: number): boolean;
15
+ getConfig(): InterruptConfig;
16
+ }
17
+ export declare const interruptRegistry: InterruptRegistry;
18
+ export declare class InterruptController {
19
+ prompt(agentSlug: string, taskDescription: string, checkpointId: string): Promise<InterruptPromptResult>;
20
+ }
21
+ export declare const interruptController: InterruptController;
22
+ //# sourceMappingURL=interrupt.d.ts.map
@@ -0,0 +1,71 @@
1
+ import * as readline from 'node:readline';
2
+ export class InterruptRegistry {
3
+ config = { interruptBefore: [] };
4
+ load(config) {
5
+ this.config = config;
6
+ }
7
+ shouldInterrupt(agentSlug, confidence) {
8
+ if (this.config.autoApprove)
9
+ return false;
10
+ if (this.config.interruptBefore.includes(agentSlug))
11
+ return true;
12
+ if (confidence !== undefined &&
13
+ this.config.confidenceThreshold !== undefined &&
14
+ confidence < this.config.confidenceThreshold) {
15
+ return true;
16
+ }
17
+ return false;
18
+ }
19
+ getConfig() {
20
+ return { ...this.config };
21
+ }
22
+ }
23
+ export const interruptRegistry = new InterruptRegistry();
24
+ export class InterruptController {
25
+ async prompt(agentSlug, taskDescription, checkpointId) {
26
+ // Non-TTY / CI mode
27
+ if (!process.stdin.isTTY || process.env.CI_AUTO_APPROVE === '1') {
28
+ return { decision: 'approved' };
29
+ }
30
+ const rl = readline.createInterface({
31
+ input: process.stdin,
32
+ output: process.stdout,
33
+ });
34
+ // Strip control characters from interpolated fields. ANSI escape sequences
35
+ // in any of these fields would let a malicious agent or LLM-generated task
36
+ // description redraw the screen and trick the user into approving an
37
+ // entirely different action than the one shown — defeating this very gate.
38
+ const safe = (s) => String(s ?? '').replace(/[\x00-\x1f\x7f-\x9f]/g, '?').slice(0, 500);
39
+ console.log('\n' + '='.repeat(60));
40
+ console.log('[MONOMIND] Interrupt — Human approval required');
41
+ console.log(` Agent: ${safe(agentSlug)}`);
42
+ console.log(` Task: ${safe(taskDescription)}`);
43
+ console.log(` Checkpoint: ${safe(checkpointId)}`);
44
+ console.log('='.repeat(60));
45
+ console.log(' Options: [y] approve [n] reject [e] edit task');
46
+ return new Promise((resolve) => {
47
+ rl.question(' Choice (y/n/e): ', (answer) => {
48
+ rl.close();
49
+ const trimmed = answer.trim().toLowerCase();
50
+ if (trimmed === 'y' || trimmed === 'yes') {
51
+ resolve({ decision: 'approved' });
52
+ }
53
+ else if (trimmed === 'e' || trimmed === 'edit') {
54
+ const rl2 = readline.createInterface({
55
+ input: process.stdin,
56
+ output: process.stdout,
57
+ });
58
+ rl2.question(' New task description: ', (newTask) => {
59
+ rl2.close();
60
+ resolve({ decision: 'edited', editedTask: newTask });
61
+ });
62
+ }
63
+ else {
64
+ resolve({ decision: 'rejected' });
65
+ }
66
+ });
67
+ });
68
+ }
69
+ }
70
+ export const interruptController = new InterruptController();
71
+ //# sourceMappingURL=interrupt.js.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Deprecation Injector (Task 31)
3
+ *
4
+ * Injects deprecation warnings into MCP tool responses when the
5
+ * invoked tool has been marked as deprecated in the ToolRegistry.
6
+ */
7
+ import type { ToolRegistry } from './tool-registry.js';
8
+ /**
9
+ * Injects deprecation metadata into MCP responses.
10
+ */
11
+ export declare class DeprecationInjector {
12
+ private readonly registry;
13
+ constructor(registry: ToolRegistry);
14
+ /**
15
+ * If `toolName` is deprecated, augment the response with a warning.
16
+ *
17
+ * Returns the original response unmodified when the tool is not
18
+ * deprecated. When deprecated, adds `_deprecation` metadata.
19
+ *
20
+ * Warning format:
21
+ * [DEPRECATED] Tool "<name>" is deprecated. <message>. Use "<successor>" instead.
22
+ */
23
+ inject(response: Record<string, unknown>, toolName: string): Record<string, unknown>;
24
+ }
25
+ //# sourceMappingURL=deprecation-injector.d.ts.map