monomind 1.11.11 → 1.11.13
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/.claude/commands/mastermind/idea.md +1 -1
- package/.claude/commands/mastermind/master.md +1 -1
- package/.claude/skills/mastermind/_protocol.md +4 -4
- package/.claude/skills/mastermind/architect.md +7 -4
- package/.claude/skills/mastermind/autodev.md +4 -2
- package/.claude/skills/mastermind/build.md +3 -3
- package/.claude/skills/mastermind/content.md +3 -3
- package/.claude/skills/mastermind/createorg.md +2 -2
- package/.claude/skills/mastermind/finance.md +3 -3
- package/.claude/skills/mastermind/idea.md +8 -0
- package/.claude/skills/mastermind/marketing.md +3 -3
- package/.claude/skills/mastermind/ops.md +3 -3
- package/.claude/skills/mastermind/release.md +3 -3
- package/.claude/skills/mastermind/research.md +3 -3
- package/.claude/skills/mastermind/review.md +3 -3
- package/.claude/skills/mastermind/sales.md +3 -3
- package/package.json +1 -1
- package/packages/@monomind/cli/dist/src/index.js +19 -14
- package/packages/@monomind/cli/dist/src/init/statusline-generator.js +3 -3
- package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/update/checker.js +24 -7
- package/packages/@monomind/cli/dist/src/update/index.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/update/index.js +29 -2
- package/packages/@monomind/cli/package.json +1 -1
- package/packages/@monomind/cli/dist/src/agents/halt-signal.d.ts +0 -25
- package/packages/@monomind/cli/dist/src/agents/halt-signal.js +0 -76
- package/packages/@monomind/cli/dist/src/agents/index.d.ts +0 -18
- package/packages/@monomind/cli/dist/src/agents/index.js +0 -13
- package/packages/@monomind/cli/dist/src/agents/managed-agent.d.ts +0 -41
- package/packages/@monomind/cli/dist/src/agents/managed-agent.js +0 -69
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.d.ts +0 -23
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.js +0 -49
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.d.ts +0 -22
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.js +0 -80
- package/packages/@monomind/cli/dist/src/agents/registry-query.d.ts +0 -71
- package/packages/@monomind/cli/dist/src/agents/registry-query.js +0 -125
- package/packages/@monomind/cli/dist/src/agents/score-decay.d.ts +0 -19
- package/packages/@monomind/cli/dist/src/agents/score-decay.js +0 -22
- package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.d.ts +0 -13
- package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.js +0 -40
- package/packages/@monomind/cli/dist/src/agents/specialization-scorer.d.ts +0 -54
- package/packages/@monomind/cli/dist/src/agents/specialization-scorer.js +0 -212
- package/packages/@monomind/cli/dist/src/agents/termination-watcher.d.ts +0 -30
- package/packages/@monomind/cli/dist/src/agents/termination-watcher.js +0 -84
- package/packages/@monomind/cli/dist/src/agents/trigger-index.d.ts +0 -20
- package/packages/@monomind/cli/dist/src/agents/trigger-index.js +0 -38
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.d.ts +0 -64
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.js +0 -308
- package/packages/@monomind/cli/dist/src/agents/version-diff.d.ts +0 -18
- package/packages/@monomind/cli/dist/src/agents/version-diff.js +0 -64
- package/packages/@monomind/cli/dist/src/agents/version-store.d.ts +0 -60
- package/packages/@monomind/cli/dist/src/agents/version-store.js +0 -235
- package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.d.ts +0 -45
- package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.js +0 -404
- package/packages/@monomind/cli/dist/src/commands/agent-wasm.d.ts +0 -14
- package/packages/@monomind/cli/dist/src/commands/agent-wasm.js +0 -333
- package/packages/@monomind/cli/dist/src/commands/ui.js +0 -68
- package/packages/@monomind/cli/dist/src/consensus/index.d.ts +0 -7
- package/packages/@monomind/cli/dist/src/consensus/index.js +0 -6
- package/packages/@monomind/cli/dist/src/context/context-provider.d.ts +0 -44
- package/packages/@monomind/cli/dist/src/context/context-provider.js +0 -25
- package/packages/@monomind/cli/dist/src/context/git-state-provider.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/context/git-state-provider.js +0 -34
- package/packages/@monomind/cli/dist/src/context/index.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/context/index.js +0 -12
- package/packages/@monomind/cli/dist/src/context/project-conventions-provider.d.ts +0 -15
- package/packages/@monomind/cli/dist/src/context/project-conventions-provider.js +0 -19
- package/packages/@monomind/cli/dist/src/context/prompt-assembler.d.ts +0 -26
- package/packages/@monomind/cli/dist/src/context/prompt-assembler.js +0 -93
- package/packages/@monomind/cli/dist/src/context/task-history-provider.d.ts +0 -24
- package/packages/@monomind/cli/dist/src/context/task-history-provider.js +0 -32
- package/packages/@monomind/cli/dist/src/context/user-preferences-provider.d.ts +0 -14
- package/packages/@monomind/cli/dist/src/context/user-preferences-provider.js +0 -27
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.d.ts +0 -31
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.js +0 -81
- package/packages/@monomind/cli/dist/src/dlq/dlq-writer.d.ts +0 -24
- package/packages/@monomind/cli/dist/src/dlq/dlq-writer.js +0 -65
- package/packages/@monomind/cli/dist/src/dlq/index.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/dlq/index.js +0 -7
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.d.ts +0 -33
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.js +0 -107
- package/packages/@monomind/cli/dist/src/eval/dataset-runner.d.ts +0 -23
- package/packages/@monomind/cli/dist/src/eval/dataset-runner.js +0 -59
- package/packages/@monomind/cli/dist/src/eval/index.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/eval/index.js +0 -7
- package/packages/@monomind/cli/dist/src/eval/trace-collector.d.ts +0 -40
- package/packages/@monomind/cli/dist/src/eval/trace-collector.js +0 -102
- package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
- package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.js +0 -264
- package/packages/@monomind/cli/dist/src/interactive/interrupt.d.ts +0 -22
- package/packages/@monomind/cli/dist/src/interactive/interrupt.js +0 -71
- package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.d.ts +0 -25
- package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.js +0 -48
- package/packages/@monomind/cli/dist/src/mcp/tool-registry.d.ts +0 -61
- package/packages/@monomind/cli/dist/src/mcp/tool-registry.js +0 -246
- package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.js +0 -230
- package/packages/@monomind/cli/dist/src/model/complexity-scorer.d.ts +0 -21
- package/packages/@monomind/cli/dist/src/model/complexity-scorer.js +0 -106
- package/packages/@monomind/cli/dist/src/model/index.d.ts +0 -4
- package/packages/@monomind/cli/dist/src/model/index.js +0 -4
- package/packages/@monomind/cli/dist/src/model/model-settings.d.ts +0 -22
- package/packages/@monomind/cli/dist/src/model/model-settings.js +0 -33
- package/packages/@monomind/cli/dist/src/model/model-tier-resolver.d.ts +0 -24
- package/packages/@monomind/cli/dist/src/model/model-tier-resolver.js +0 -65
- package/packages/@monomind/cli/dist/src/monovector/capabilities.d.ts +0 -34
- package/packages/@monomind/cli/dist/src/monovector/capabilities.js +0 -37
- package/packages/@monomind/cli/dist/src/orchestration/index.d.ts +0 -7
- package/packages/@monomind/cli/dist/src/orchestration/index.js +0 -6
- package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.js +0 -31
- package/packages/@monomind/cli/dist/src/orchestration/routing-modes.d.ts +0 -68
- package/packages/@monomind/cli/dist/src/orchestration/routing-modes.js +0 -180
- package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +0 -7
- package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.js +0 -126
- package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.js +0 -188
- package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.d.ts +0 -7
- package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.js +0 -206
- package/packages/@monomind/cli/dist/src/runtime/headless.d.ts +0 -60
- package/packages/@monomind/cli/dist/src/runtime/headless.js +0 -284
- package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.d.ts +0 -50
- package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.js +0 -95
- package/packages/@monomind/cli/dist/src/services/container-worker-pool.d.ts +0 -197
- package/packages/@monomind/cli/dist/src/services/container-worker-pool.js +0 -623
- package/packages/@monomind/cli/dist/src/services/index.d.ts +0 -13
- package/packages/@monomind/cli/dist/src/services/index.js +0 -11
- package/packages/@monomind/cli/dist/src/services/worker-queue.d.ts +0 -201
- package/packages/@monomind/cli/dist/src/services/worker-queue.js +0 -594
- package/packages/@monomind/cli/dist/src/swarm/communication-graph.d.ts +0 -25
- package/packages/@monomind/cli/dist/src/swarm/communication-graph.js +0 -77
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.d.ts +0 -31
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.js +0 -61
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.d.ts +0 -19
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.js +0 -68
- package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.d.ts +0 -13
- package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.js +0 -205
- package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.js +0 -190
- package/packages/@monomind/cli/dist/src/transfer/test-seraphine.d.ts +0 -6
- package/packages/@monomind/cli/dist/src/transfer/test-seraphine.js +0 -105
- package/packages/@monomind/cli/dist/src/transfer/tests/test-store.d.ts +0 -7
- package/packages/@monomind/cli/dist/src/transfer/tests/test-store.js +0 -214
- package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.js +0 -82
- package/packages/@monomind/cli/dist/src/workflow/context-resolver.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/workflow/context-resolver.js +0 -23
- package/packages/@monomind/cli/dist/src/workflow/dag-builder.d.ts +0 -17
- package/packages/@monomind/cli/dist/src/workflow/dag-builder.js +0 -129
- package/packages/@monomind/cli/dist/src/workflow/dag-executor.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/workflow/dag-executor.js +0 -116
- package/packages/@monomind/cli/dist/src/workflow/dag-types.d.ts +0 -41
- package/packages/@monomind/cli/dist/src/workflow/dag-types.js +0 -8
- package/packages/@monomind/cli/dist/src/workflow/dsl-parser.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/workflow/dsl-parser.js +0 -20
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.d.ts +0 -165
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.js +0 -82
- package/packages/@monomind/cli/dist/src/workflow/index.d.ts +0 -13
- package/packages/@monomind/cli/dist/src/workflow/index.js +0 -11
- package/packages/@monomind/cli/dist/src/workflow/template-engine.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/workflow/template-engine.js +0 -40
- package/packages/@monomind/cli/dist/src/workflow/workflow-executor.d.ts +0 -29
- package/packages/@monomind/cli/dist/src/workflow/workflow-executor.js +0 -227
- package/packages/@monomind/guidance/dist/adversarial.d.ts +0 -284
- package/packages/@monomind/guidance/dist/adversarial.js +0 -572
- package/packages/@monomind/guidance/dist/analyzer.d.ts +0 -530
- package/packages/@monomind/guidance/dist/analyzer.js +0 -2518
- package/packages/@monomind/guidance/dist/artifacts.d.ts +0 -283
- package/packages/@monomind/guidance/dist/artifacts.js +0 -356
- package/packages/@monomind/guidance/dist/authority.d.ts +0 -290
- package/packages/@monomind/guidance/dist/authority.js +0 -558
- package/packages/@monomind/guidance/dist/capabilities.d.ts +0 -209
- package/packages/@monomind/guidance/dist/capabilities.js +0 -485
- package/packages/@monomind/guidance/dist/coherence.d.ts +0 -233
- package/packages/@monomind/guidance/dist/coherence.js +0 -372
- package/packages/@monomind/guidance/dist/compiler.d.ts +0 -87
- package/packages/@monomind/guidance/dist/compiler.js +0 -419
- package/packages/@monomind/guidance/dist/conformance-kit.d.ts +0 -225
- package/packages/@monomind/guidance/dist/conformance-kit.js +0 -629
- package/packages/@monomind/guidance/dist/continue-gate.d.ts +0 -214
- package/packages/@monomind/guidance/dist/continue-gate.js +0 -353
- package/packages/@monomind/guidance/dist/crypto-utils.d.ts +0 -17
- package/packages/@monomind/guidance/dist/crypto-utils.js +0 -24
- package/packages/@monomind/guidance/dist/evolution.d.ts +0 -282
- package/packages/@monomind/guidance/dist/evolution.js +0 -500
- package/packages/@monomind/guidance/dist/gates.d.ts +0 -79
- package/packages/@monomind/guidance/dist/gates.js +0 -302
- package/packages/@monomind/guidance/dist/gateway.d.ts +0 -206
- package/packages/@monomind/guidance/dist/gateway.js +0 -452
- package/packages/@monomind/guidance/dist/generators.d.ts +0 -153
- package/packages/@monomind/guidance/dist/generators.js +0 -682
- package/packages/@monomind/guidance/dist/headless.d.ts +0 -177
- package/packages/@monomind/guidance/dist/headless.js +0 -342
- package/packages/@monomind/guidance/dist/hooks.d.ts +0 -109
- package/packages/@monomind/guidance/dist/hooks.js +0 -347
- package/packages/@monomind/guidance/dist/index.d.ts +0 -205
- package/packages/@monomind/guidance/dist/index.js +0 -321
- package/packages/@monomind/guidance/dist/ledger.d.ts +0 -162
- package/packages/@monomind/guidance/dist/ledger.js +0 -375
- package/packages/@monomind/guidance/dist/manifest-validator.d.ts +0 -289
- package/packages/@monomind/guidance/dist/manifest-validator.js +0 -838
- package/packages/@monomind/guidance/dist/memory-gate.d.ts +0 -222
- package/packages/@monomind/guidance/dist/memory-gate.js +0 -382
- package/packages/@monomind/guidance/dist/meta-governance.d.ts +0 -265
- package/packages/@monomind/guidance/dist/meta-governance.js +0 -348
- package/packages/@monomind/guidance/dist/optimizer.d.ts +0 -104
- package/packages/@monomind/guidance/dist/optimizer.js +0 -329
- package/packages/@monomind/guidance/dist/persistence.d.ts +0 -189
- package/packages/@monomind/guidance/dist/persistence.js +0 -464
- package/packages/@monomind/guidance/dist/proof.d.ts +0 -185
- package/packages/@monomind/guidance/dist/proof.js +0 -238
- package/packages/@monomind/guidance/dist/retriever.d.ts +0 -116
- package/packages/@monomind/guidance/dist/retriever.js +0 -394
- package/packages/@monomind/guidance/dist/ruvbot-integration.d.ts +0 -370
- package/packages/@monomind/guidance/dist/ruvbot-integration.js +0 -738
- package/packages/@monomind/guidance/dist/temporal.d.ts +0 -426
- package/packages/@monomind/guidance/dist/temporal.js +0 -658
- package/packages/@monomind/guidance/dist/trust.d.ts +0 -283
- package/packages/@monomind/guidance/dist/trust.js +0 -473
- package/packages/@monomind/guidance/dist/truth-anchors.d.ts +0 -276
- package/packages/@monomind/guidance/dist/truth-anchors.js +0 -488
- package/packages/@monomind/guidance/dist/types.d.ts +0 -378
- package/packages/@monomind/guidance/dist/types.js +0 -10
- package/packages/@monomind/guidance/dist/uncertainty.d.ts +0 -372
- package/packages/@monomind/guidance/dist/uncertainty.js +0 -619
- package/packages/@monomind/guidance/dist/wasm-kernel.d.ts +0 -48
- package/packages/@monomind/guidance/dist/wasm-kernel.js +0 -158
|
@@ -1,40 +0,0 @@
|
|
|
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
|
|
@@ -1,102 +0,0 @@
|
|
|
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
|
|
@@ -1,68 +0,0 @@
|
|
|
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
|
|
@@ -1,264 +0,0 @@
|
|
|
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
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
|
@@ -1,71 +0,0 @@
|
|
|
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
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
/**
|
|
8
|
-
* Injects deprecation metadata into MCP responses.
|
|
9
|
-
*/
|
|
10
|
-
export class DeprecationInjector {
|
|
11
|
-
registry;
|
|
12
|
-
constructor(registry) {
|
|
13
|
-
this.registry = registry;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* If `toolName` is deprecated, augment the response with a warning.
|
|
17
|
-
*
|
|
18
|
-
* Returns the original response unmodified when the tool is not
|
|
19
|
-
* deprecated. When deprecated, adds `_deprecation` metadata.
|
|
20
|
-
*
|
|
21
|
-
* Warning format:
|
|
22
|
-
* [DEPRECATED] Tool "<name>" is deprecated. <message>. Use "<successor>" instead.
|
|
23
|
-
*/
|
|
24
|
-
inject(response, toolName) {
|
|
25
|
-
const tool = this.registry.getVersion(toolName);
|
|
26
|
-
if (!tool || !tool.deprecated) {
|
|
27
|
-
return response;
|
|
28
|
-
}
|
|
29
|
-
const parts = [`[DEPRECATED] Tool "${toolName}" is deprecated.`];
|
|
30
|
-
if (tool.deprecationMessage) {
|
|
31
|
-
parts.push(tool.deprecationMessage + '.');
|
|
32
|
-
}
|
|
33
|
-
if (tool.successor) {
|
|
34
|
-
parts.push(`Use "${tool.successor}" instead.`);
|
|
35
|
-
}
|
|
36
|
-
const warning = parts.join(' ');
|
|
37
|
-
return {
|
|
38
|
-
...response,
|
|
39
|
-
_deprecation: {
|
|
40
|
-
warning,
|
|
41
|
-
deprecated: true,
|
|
42
|
-
successor: tool.successor ?? null,
|
|
43
|
-
deprecatedAt: tool.deprecatedAt ?? null,
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=deprecation-injector.js.map
|