@monoes/monomindcli 1.11.11 → 1.11.12
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/autodev.md +1 -1
- 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/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/dist/src/init/statusline-generator.js +3 -3
- package/dist/src/observability/replay-reader.d.ts +1 -1
- package/dist/src/observability/replay-reader.d.ts.map +1 -1
- package/dist/src/update/checker.d.ts.map +1 -1
- package/dist/src/update/checker.js +24 -7
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/update/index.d.ts.map +1 -1
- package/dist/src/update/index.js +3 -6
- package/dist/src/update/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/agents/halt-signal.d.ts +0 -25
- package/dist/src/agents/halt-signal.d.ts.map +0 -1
- package/dist/src/agents/halt-signal.js +0 -76
- package/dist/src/agents/halt-signal.js.map +0 -1
- package/dist/src/agents/index.d.ts +0 -18
- package/dist/src/agents/index.d.ts.map +0 -1
- package/dist/src/agents/index.js +0 -13
- package/dist/src/agents/index.js.map +0 -1
- package/dist/src/agents/managed-agent.d.ts +0 -41
- package/dist/src/agents/managed-agent.d.ts.map +0 -1
- package/dist/src/agents/managed-agent.js +0 -69
- package/dist/src/agents/managed-agent.js.map +0 -1
- package/dist/src/agents/prompt-experiment.d.ts +0 -23
- package/dist/src/agents/prompt-experiment.d.ts.map +0 -1
- package/dist/src/agents/prompt-experiment.js +0 -49
- package/dist/src/agents/prompt-experiment.js.map +0 -1
- package/dist/src/agents/prompt-version-manager.d.ts +0 -22
- package/dist/src/agents/prompt-version-manager.d.ts.map +0 -1
- package/dist/src/agents/prompt-version-manager.js +0 -80
- package/dist/src/agents/prompt-version-manager.js.map +0 -1
- package/dist/src/agents/registry-query.d.ts +0 -71
- package/dist/src/agents/registry-query.d.ts.map +0 -1
- package/dist/src/agents/registry-query.js +0 -125
- package/dist/src/agents/registry-query.js.map +0 -1
- package/dist/src/agents/score-decay.d.ts +0 -19
- package/dist/src/agents/score-decay.d.ts.map +0 -1
- package/dist/src/agents/score-decay.js +0 -22
- package/dist/src/agents/score-decay.js.map +0 -1
- package/dist/src/agents/shared-instructions-loader.d.ts +0 -13
- package/dist/src/agents/shared-instructions-loader.d.ts.map +0 -1
- package/dist/src/agents/shared-instructions-loader.js +0 -40
- package/dist/src/agents/shared-instructions-loader.js.map +0 -1
- package/dist/src/agents/specialization-scorer.d.ts +0 -54
- package/dist/src/agents/specialization-scorer.d.ts.map +0 -1
- package/dist/src/agents/specialization-scorer.js +0 -212
- package/dist/src/agents/specialization-scorer.js.map +0 -1
- package/dist/src/agents/termination-watcher.d.ts +0 -30
- package/dist/src/agents/termination-watcher.d.ts.map +0 -1
- package/dist/src/agents/termination-watcher.js +0 -84
- package/dist/src/agents/termination-watcher.js.map +0 -1
- package/dist/src/agents/trigger-index.d.ts +0 -20
- package/dist/src/agents/trigger-index.d.ts.map +0 -1
- package/dist/src/agents/trigger-index.js +0 -38
- package/dist/src/agents/trigger-index.js.map +0 -1
- package/dist/src/agents/trigger-scanner.d.ts +0 -64
- package/dist/src/agents/trigger-scanner.d.ts.map +0 -1
- package/dist/src/agents/trigger-scanner.js +0 -308
- package/dist/src/agents/trigger-scanner.js.map +0 -1
- package/dist/src/agents/version-diff.d.ts +0 -18
- package/dist/src/agents/version-diff.d.ts.map +0 -1
- package/dist/src/agents/version-diff.js +0 -64
- package/dist/src/agents/version-diff.js.map +0 -1
- package/dist/src/agents/version-store.d.ts +0 -60
- package/dist/src/agents/version-store.d.ts.map +0 -1
- package/dist/src/agents/version-store.js +0 -235
- package/dist/src/agents/version-store.js.map +0 -1
- package/dist/src/benchmarks/pretrain/index.d.ts +0 -45
- package/dist/src/benchmarks/pretrain/index.d.ts.map +0 -1
- package/dist/src/benchmarks/pretrain/index.js +0 -404
- package/dist/src/benchmarks/pretrain/index.js.map +0 -1
- package/dist/src/commands/agent-wasm.d.ts +0 -14
- package/dist/src/commands/agent-wasm.d.ts.map +0 -1
- package/dist/src/commands/agent-wasm.js +0 -333
- package/dist/src/commands/agent-wasm.js.map +0 -1
- package/dist/src/commands/embeddings.d.ts.map +0 -1
- package/dist/src/commands/embeddings.js.map +0 -1
- package/dist/src/commands/ui.js +0 -68
- package/dist/src/consensus/index.d.ts +0 -7
- package/dist/src/consensus/index.d.ts.map +0 -1
- package/dist/src/consensus/index.js +0 -6
- package/dist/src/consensus/index.js.map +0 -1
- package/dist/src/context/context-provider.d.ts +0 -44
- package/dist/src/context/context-provider.d.ts.map +0 -1
- package/dist/src/context/context-provider.js +0 -25
- package/dist/src/context/context-provider.js.map +0 -1
- package/dist/src/context/git-state-provider.d.ts +0 -12
- package/dist/src/context/git-state-provider.d.ts.map +0 -1
- package/dist/src/context/git-state-provider.js +0 -34
- package/dist/src/context/git-state-provider.js.map +0 -1
- package/dist/src/context/index.d.ts +0 -12
- package/dist/src/context/index.d.ts.map +0 -1
- package/dist/src/context/index.js +0 -12
- package/dist/src/context/index.js.map +0 -1
- package/dist/src/context/project-conventions-provider.d.ts +0 -15
- package/dist/src/context/project-conventions-provider.d.ts.map +0 -1
- package/dist/src/context/project-conventions-provider.js +0 -19
- package/dist/src/context/project-conventions-provider.js.map +0 -1
- package/dist/src/context/prompt-assembler.d.ts +0 -26
- package/dist/src/context/prompt-assembler.d.ts.map +0 -1
- package/dist/src/context/prompt-assembler.js +0 -93
- package/dist/src/context/prompt-assembler.js.map +0 -1
- package/dist/src/context/task-history-provider.d.ts +0 -24
- package/dist/src/context/task-history-provider.d.ts.map +0 -1
- package/dist/src/context/task-history-provider.js +0 -32
- package/dist/src/context/task-history-provider.js.map +0 -1
- package/dist/src/context/user-preferences-provider.d.ts +0 -14
- package/dist/src/context/user-preferences-provider.d.ts.map +0 -1
- package/dist/src/context/user-preferences-provider.js +0 -27
- package/dist/src/context/user-preferences-provider.js.map +0 -1
- package/dist/src/dlq/dlq-reader.d.ts +0 -31
- package/dist/src/dlq/dlq-reader.d.ts.map +0 -1
- package/dist/src/dlq/dlq-reader.js +0 -81
- package/dist/src/dlq/dlq-reader.js.map +0 -1
- package/dist/src/dlq/dlq-writer.d.ts +0 -24
- package/dist/src/dlq/dlq-writer.d.ts.map +0 -1
- package/dist/src/dlq/dlq-writer.js +0 -65
- package/dist/src/dlq/dlq-writer.js.map +0 -1
- package/dist/src/dlq/index.d.ts +0 -10
- package/dist/src/dlq/index.d.ts.map +0 -1
- package/dist/src/dlq/index.js +0 -7
- package/dist/src/dlq/index.js.map +0 -1
- package/dist/src/eval/dataset-manager.d.ts +0 -33
- package/dist/src/eval/dataset-manager.d.ts.map +0 -1
- package/dist/src/eval/dataset-manager.js +0 -107
- package/dist/src/eval/dataset-manager.js.map +0 -1
- package/dist/src/eval/dataset-runner.d.ts +0 -23
- package/dist/src/eval/dataset-runner.d.ts.map +0 -1
- package/dist/src/eval/dataset-runner.js +0 -59
- package/dist/src/eval/dataset-runner.js.map +0 -1
- package/dist/src/eval/index.d.ts +0 -10
- package/dist/src/eval/index.d.ts.map +0 -1
- package/dist/src/eval/index.js +0 -7
- package/dist/src/eval/index.js.map +0 -1
- package/dist/src/eval/trace-collector.d.ts +0 -40
- package/dist/src/eval/trace-collector.d.ts.map +0 -1
- package/dist/src/eval/trace-collector.js +0 -102
- package/dist/src/eval/trace-collector.js.map +0 -1
- package/dist/src/graph/enrich.mjs +0 -362
- package/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +0 -1
- package/dist/src/infrastructure/in-memory-repositories.js +0 -264
- package/dist/src/infrastructure/in-memory-repositories.js.map +0 -1
- package/dist/src/interactive/interrupt.d.ts +0 -22
- package/dist/src/interactive/interrupt.d.ts.map +0 -1
- package/dist/src/interactive/interrupt.js +0 -71
- package/dist/src/interactive/interrupt.js.map +0 -1
- package/dist/src/mcp/deprecation-injector.d.ts +0 -25
- package/dist/src/mcp/deprecation-injector.d.ts.map +0 -1
- package/dist/src/mcp/deprecation-injector.js +0 -48
- package/dist/src/mcp/deprecation-injector.js.map +0 -1
- package/dist/src/mcp/tool-registry.d.ts +0 -61
- package/dist/src/mcp/tool-registry.d.ts.map +0 -1
- package/dist/src/mcp/tool-registry.js +0 -246
- package/dist/src/mcp/tool-registry.js.map +0 -1
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts +0 -9
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts.map +0 -1
- package/dist/src/mcp-tools/wasm-agent-tools.js +0 -230
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +0 -1
- package/dist/src/model/complexity-scorer.d.ts +0 -21
- package/dist/src/model/complexity-scorer.d.ts.map +0 -1
- package/dist/src/model/complexity-scorer.js +0 -106
- package/dist/src/model/complexity-scorer.js.map +0 -1
- package/dist/src/model/index.d.ts +0 -4
- package/dist/src/model/index.d.ts.map +0 -1
- package/dist/src/model/index.js +0 -4
- package/dist/src/model/index.js.map +0 -1
- package/dist/src/model/model-settings.d.ts +0 -22
- package/dist/src/model/model-settings.d.ts.map +0 -1
- package/dist/src/model/model-settings.js +0 -33
- package/dist/src/model/model-settings.js.map +0 -1
- package/dist/src/model/model-tier-resolver.d.ts +0 -24
- package/dist/src/model/model-tier-resolver.d.ts.map +0 -1
- package/dist/src/model/model-tier-resolver.js +0 -65
- package/dist/src/model/model-tier-resolver.js.map +0 -1
- package/dist/src/monovector/capabilities.d.ts +0 -34
- package/dist/src/monovector/capabilities.d.ts.map +0 -1
- package/dist/src/monovector/capabilities.js +0 -37
- package/dist/src/monovector/capabilities.js.map +0 -1
- package/dist/src/orchestration/index.d.ts +0 -7
- package/dist/src/orchestration/index.d.ts.map +0 -1
- package/dist/src/orchestration/index.js +0 -6
- package/dist/src/orchestration/index.js.map +0 -1
- package/dist/src/orchestration/mode-dispatcher.d.ts +0 -11
- package/dist/src/orchestration/mode-dispatcher.d.ts.map +0 -1
- package/dist/src/orchestration/mode-dispatcher.js +0 -31
- package/dist/src/orchestration/mode-dispatcher.js.map +0 -1
- package/dist/src/orchestration/routing-modes.d.ts +0 -68
- package/dist/src/orchestration/routing-modes.d.ts.map +0 -1
- package/dist/src/orchestration/routing-modes.js +0 -180
- package/dist/src/orchestration/routing-modes.js.map +0 -1
- package/dist/src/plugins/tests/demo-plugin-store.d.ts +0 -7
- package/dist/src/plugins/tests/demo-plugin-store.d.ts.map +0 -1
- package/dist/src/plugins/tests/demo-plugin-store.js +0 -126
- package/dist/src/plugins/tests/demo-plugin-store.js.map +0 -1
- package/dist/src/plugins/tests/standalone-test.d.ts +0 -12
- package/dist/src/plugins/tests/standalone-test.d.ts.map +0 -1
- package/dist/src/plugins/tests/standalone-test.js +0 -188
- package/dist/src/plugins/tests/standalone-test.js.map +0 -1
- package/dist/src/plugins/tests/test-plugin-store.d.ts +0 -7
- package/dist/src/plugins/tests/test-plugin-store.d.ts.map +0 -1
- package/dist/src/plugins/tests/test-plugin-store.js +0 -206
- package/dist/src/plugins/tests/test-plugin-store.js.map +0 -1
- package/dist/src/runtime/headless.d.ts +0 -60
- package/dist/src/runtime/headless.d.ts.map +0 -1
- package/dist/src/runtime/headless.js +0 -284
- package/dist/src/runtime/headless.js.map +0 -1
- package/dist/src/services/agentic-flow-bridge.d.ts +0 -50
- package/dist/src/services/agentic-flow-bridge.d.ts.map +0 -1
- package/dist/src/services/agentic-flow-bridge.js +0 -95
- package/dist/src/services/agentic-flow-bridge.js.map +0 -1
- package/dist/src/services/container-worker-pool.d.ts +0 -197
- package/dist/src/services/container-worker-pool.d.ts.map +0 -1
- package/dist/src/services/container-worker-pool.js +0 -623
- package/dist/src/services/container-worker-pool.js.map +0 -1
- package/dist/src/services/index.d.ts +0 -13
- package/dist/src/services/index.d.ts.map +0 -1
- package/dist/src/services/index.js +0 -11
- package/dist/src/services/index.js.map +0 -1
- package/dist/src/services/worker-queue.d.ts +0 -201
- package/dist/src/services/worker-queue.d.ts.map +0 -1
- package/dist/src/services/worker-queue.js +0 -594
- package/dist/src/services/worker-queue.js.map +0 -1
- package/dist/src/swarm/communication-graph.d.ts +0 -25
- package/dist/src/swarm/communication-graph.d.ts.map +0 -1
- package/dist/src/swarm/communication-graph.js +0 -77
- package/dist/src/swarm/communication-graph.js.map +0 -1
- package/dist/src/swarm/flow-enforcer.d.ts +0 -31
- package/dist/src/swarm/flow-enforcer.d.ts.map +0 -1
- package/dist/src/swarm/flow-enforcer.js +0 -61
- package/dist/src/swarm/flow-enforcer.js.map +0 -1
- package/dist/src/swarm/flow-visualizer.d.ts +0 -19
- package/dist/src/swarm/flow-visualizer.d.ts.map +0 -1
- package/dist/src/swarm/flow-visualizer.js +0 -68
- package/dist/src/swarm/flow-visualizer.js.map +0 -1
- package/dist/src/transfer/deploy-seraphine.d.ts +0 -13
- package/dist/src/transfer/deploy-seraphine.d.ts.map +0 -1
- package/dist/src/transfer/deploy-seraphine.js +0 -205
- package/dist/src/transfer/deploy-seraphine.js.map +0 -1
- package/dist/src/transfer/store/tests/standalone-test.d.ts +0 -12
- package/dist/src/transfer/store/tests/standalone-test.d.ts.map +0 -1
- package/dist/src/transfer/store/tests/standalone-test.js +0 -190
- package/dist/src/transfer/store/tests/standalone-test.js.map +0 -1
- package/dist/src/transfer/test-seraphine.d.ts +0 -6
- package/dist/src/transfer/test-seraphine.d.ts.map +0 -1
- package/dist/src/transfer/test-seraphine.js +0 -105
- package/dist/src/transfer/test-seraphine.js.map +0 -1
- package/dist/src/transfer/tests/test-store.d.ts +0 -7
- package/dist/src/transfer/tests/test-store.d.ts.map +0 -1
- package/dist/src/transfer/tests/test-store.js +0 -214
- package/dist/src/transfer/tests/test-store.js.map +0 -1
- package/dist/src/ui/.monomind/data/pending-insights.jsonl +0 -0
- package/dist/src/ui/.monomind/data/ranked-context.json +0 -5
- package/dist/src/ui/.monomind/loops/mastermind-review-1778664132789.json +0 -16
- package/dist/src/ui/.monomind/sessions/current.json +0 -13
- package/dist/src/ui/.monomind/sessions/session-1776778451399.json +0 -15
- package/dist/src/ui/collector.mjs +0 -646
- package/dist/src/ui/dashboard.html +0 -9694
- package/dist/src/ui/data/mastermind-events.jsonl +0 -59
- package/dist/src/ui/data/mastermind-sessions.json +0 -1
- package/dist/src/ui/orgs.html +0 -1360
- package/dist/src/ui/server.mjs +0 -4334
- package/dist/src/workflow/condition-evaluator.d.ts +0 -10
- package/dist/src/workflow/condition-evaluator.d.ts.map +0 -1
- package/dist/src/workflow/condition-evaluator.js +0 -82
- package/dist/src/workflow/condition-evaluator.js.map +0 -1
- package/dist/src/workflow/context-resolver.d.ts +0 -12
- package/dist/src/workflow/context-resolver.d.ts.map +0 -1
- package/dist/src/workflow/context-resolver.js +0 -23
- package/dist/src/workflow/context-resolver.js.map +0 -1
- package/dist/src/workflow/dag-builder.d.ts +0 -17
- package/dist/src/workflow/dag-builder.d.ts.map +0 -1
- package/dist/src/workflow/dag-builder.js +0 -129
- package/dist/src/workflow/dag-builder.js.map +0 -1
- package/dist/src/workflow/dag-executor.d.ts +0 -9
- package/dist/src/workflow/dag-executor.d.ts.map +0 -1
- package/dist/src/workflow/dag-executor.js +0 -116
- package/dist/src/workflow/dag-executor.js.map +0 -1
- package/dist/src/workflow/dag-types.d.ts +0 -41
- package/dist/src/workflow/dag-types.d.ts.map +0 -1
- package/dist/src/workflow/dag-types.js +0 -8
- package/dist/src/workflow/dag-types.js.map +0 -1
- package/dist/src/workflow/dsl-parser.d.ts +0 -12
- package/dist/src/workflow/dsl-parser.d.ts.map +0 -1
- package/dist/src/workflow/dsl-parser.js +0 -20
- package/dist/src/workflow/dsl-parser.js.map +0 -1
- package/dist/src/workflow/dsl-schema.d.ts +0 -165
- package/dist/src/workflow/dsl-schema.d.ts.map +0 -1
- package/dist/src/workflow/dsl-schema.js +0 -82
- package/dist/src/workflow/dsl-schema.js.map +0 -1
- package/dist/src/workflow/index.d.ts +0 -13
- package/dist/src/workflow/index.d.ts.map +0 -1
- package/dist/src/workflow/index.js +0 -11
- package/dist/src/workflow/index.js.map +0 -1
- package/dist/src/workflow/template-engine.d.ts +0 -11
- package/dist/src/workflow/template-engine.d.ts.map +0 -1
- package/dist/src/workflow/template-engine.js +0 -40
- package/dist/src/workflow/template-engine.js.map +0 -1
- package/dist/src/workflow/workflow-executor.d.ts +0 -29
- package/dist/src/workflow/workflow-executor.d.ts.map +0 -1
- package/dist/src/workflow/workflow-executor.js +0 -227
- package/dist/src/workflow/workflow-executor.js.map +0 -1
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool Registry (Task 31)
|
|
3
|
-
*
|
|
4
|
-
* Manages semver versioning for MCP tools with deprecation tracking
|
|
5
|
-
* and tool-to-agent impact analysis. Uses JSONL file storage.
|
|
6
|
-
*/
|
|
7
|
-
import { appendFileSync, readFileSync, existsSync, mkdirSync, readdirSync, lstatSync, } from 'fs';
|
|
8
|
-
import { join, dirname, extname, resolve, sep } from 'path';
|
|
9
|
-
/** Default JSONL storage path relative to project root. */
|
|
10
|
-
const DEFAULT_STORAGE_PATH = '.monomind/tool-versions.jsonl';
|
|
11
|
-
/**
|
|
12
|
-
* Registry for versioned MCP tools.
|
|
13
|
-
*
|
|
14
|
-
* Stores tool metadata and version history in a JSONL file.
|
|
15
|
-
* Supports deprecation marking and agent impact analysis.
|
|
16
|
-
*/
|
|
17
|
-
export class ToolRegistry {
|
|
18
|
-
tools = new Map();
|
|
19
|
-
history = [];
|
|
20
|
-
storagePath;
|
|
21
|
-
constructor(storagePath = DEFAULT_STORAGE_PATH) {
|
|
22
|
-
const resolvedPath = resolve(storagePath);
|
|
23
|
-
const allowedRoot = process.env.MONOMIND_DATA_DIR
|
|
24
|
-
? resolve(process.env.MONOMIND_DATA_DIR)
|
|
25
|
-
: resolve(process.cwd());
|
|
26
|
-
if (resolvedPath !== allowedRoot && !resolvedPath.startsWith(allowedRoot + sep)) {
|
|
27
|
-
throw new Error(`Tool registry storagePath escapes allowed root: ${resolvedPath}`);
|
|
28
|
-
}
|
|
29
|
-
this.storagePath = resolvedPath;
|
|
30
|
-
this.loadFromDisk();
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Register a new tool or update an existing one.
|
|
34
|
-
*/
|
|
35
|
-
register(tool) {
|
|
36
|
-
const existing = this.tools.get(tool.toolName);
|
|
37
|
-
const changeType = existing
|
|
38
|
-
? 'updated'
|
|
39
|
-
: 'added';
|
|
40
|
-
this.tools.set(tool.toolName, { ...tool });
|
|
41
|
-
const entry = {
|
|
42
|
-
toolName: tool.toolName,
|
|
43
|
-
version: tool.version,
|
|
44
|
-
changeType,
|
|
45
|
-
changedAt: new Date().toISOString(),
|
|
46
|
-
description: changeType === 'added'
|
|
47
|
-
? `Registered tool ${tool.toolName} v${tool.version}`
|
|
48
|
-
: `Updated tool ${tool.toolName} to v${tool.version}`,
|
|
49
|
-
};
|
|
50
|
-
this.history.push(entry);
|
|
51
|
-
this.appendEntry(entry);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Mark a tool as deprecated with an optional successor.
|
|
55
|
-
*/
|
|
56
|
-
deprecate(toolName, message, successor) {
|
|
57
|
-
const tool = this.tools.get(toolName);
|
|
58
|
-
if (!tool) {
|
|
59
|
-
throw new Error(`Tool "${toolName}" not found in registry`);
|
|
60
|
-
}
|
|
61
|
-
tool.deprecated = true;
|
|
62
|
-
tool.deprecationMessage = message;
|
|
63
|
-
tool.deprecatedAt = new Date().toISOString();
|
|
64
|
-
if (successor) {
|
|
65
|
-
tool.successor = successor;
|
|
66
|
-
}
|
|
67
|
-
const entry = {
|
|
68
|
-
toolName,
|
|
69
|
-
version: tool.version,
|
|
70
|
-
changeType: 'deprecated',
|
|
71
|
-
changedAt: tool.deprecatedAt,
|
|
72
|
-
description: message,
|
|
73
|
-
};
|
|
74
|
-
this.history.push(entry);
|
|
75
|
-
this.appendEntry(entry);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Get the current version info for a tool.
|
|
79
|
-
* Returns null if the tool is not registered.
|
|
80
|
-
*/
|
|
81
|
-
getVersion(toolName) {
|
|
82
|
-
return this.tools.get(toolName) ?? null;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* List all deprecated tools.
|
|
86
|
-
*/
|
|
87
|
-
listDeprecated() {
|
|
88
|
-
const result = [];
|
|
89
|
-
for (const tool of this.tools.values()) {
|
|
90
|
-
if (tool.deprecated) {
|
|
91
|
-
result.push({ ...tool });
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Find agents that reference the given tool.
|
|
98
|
-
*
|
|
99
|
-
* Scans agent markdown files under the provided agents directory
|
|
100
|
-
* and returns slugs of agents whose `tools:` frontmatter or body
|
|
101
|
-
* mention the tool name.
|
|
102
|
-
*/
|
|
103
|
-
getImpactedAgents(toolName, agentsDir = 'agents') {
|
|
104
|
-
// Reject empty or short tool names — `content.includes('')` returns true
|
|
105
|
-
// for every file, turning the registry into a directory enumerator.
|
|
106
|
-
if (typeof toolName !== 'string' || toolName.length < 2 || !/^[a-zA-Z0-9_.-]+$/.test(toolName)) {
|
|
107
|
-
return [];
|
|
108
|
-
}
|
|
109
|
-
const impacted = [];
|
|
110
|
-
const mdFiles = collectMdFiles(agentsDir);
|
|
111
|
-
for (const filePath of mdFiles) {
|
|
112
|
-
let content;
|
|
113
|
-
try {
|
|
114
|
-
content = readFileSync(filePath, 'utf-8');
|
|
115
|
-
}
|
|
116
|
-
catch {
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
if (content.includes(toolName)) {
|
|
120
|
-
// Derive slug from filename (strip .md extension)
|
|
121
|
-
const parts = filePath.split('/');
|
|
122
|
-
const filename = parts[parts.length - 1];
|
|
123
|
-
const slug = filename.replace(/\.md$/, '');
|
|
124
|
-
impacted.push(slug);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return impacted;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Get the full version history for a tool, or all tools if no name given.
|
|
131
|
-
*/
|
|
132
|
-
getHistory(toolName) {
|
|
133
|
-
if (!toolName) {
|
|
134
|
-
return [...this.history];
|
|
135
|
-
}
|
|
136
|
-
return this.history.filter((e) => e.toolName === toolName);
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Get all registered tools.
|
|
140
|
-
*/
|
|
141
|
-
listAll() {
|
|
142
|
-
return Array.from(this.tools.values()).map((t) => ({ ...t }));
|
|
143
|
-
}
|
|
144
|
-
// ---- Private helpers ----
|
|
145
|
-
/**
|
|
146
|
-
* Load existing entries from the JSONL file on disk.
|
|
147
|
-
*/
|
|
148
|
-
loadFromDisk() {
|
|
149
|
-
if (!existsSync(this.storagePath)) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
let raw;
|
|
153
|
-
try {
|
|
154
|
-
raw = readFileSync(this.storagePath, 'utf-8');
|
|
155
|
-
}
|
|
156
|
-
catch {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
const NAME_RE = /^[a-zA-Z0-9_.-]{1,128}$/;
|
|
160
|
-
const STR_MAX = 500;
|
|
161
|
-
for (const line of raw.split('\n')) {
|
|
162
|
-
const trimmed = line.trim();
|
|
163
|
-
if (!trimmed)
|
|
164
|
-
continue;
|
|
165
|
-
try {
|
|
166
|
-
const record = JSON.parse(trimmed);
|
|
167
|
-
if (!record || typeof record !== 'object')
|
|
168
|
-
continue;
|
|
169
|
-
// Validate fields before storage. The JSONL file lives on disk; an
|
|
170
|
-
// attacker with local write access could otherwise plant attacker-controlled
|
|
171
|
-
// strings (e.g. malicious deprecationMessage with markup) that reach
|
|
172
|
-
// downstream renderers (DOT visualizer, deprecation-injector warnings).
|
|
173
|
-
if (record._type === 'tool') {
|
|
174
|
-
if (typeof record.toolName !== 'string' || !NAME_RE.test(record.toolName))
|
|
175
|
-
continue;
|
|
176
|
-
if (record.successor !== undefined && (typeof record.successor !== 'string' || !NAME_RE.test(record.successor)))
|
|
177
|
-
continue;
|
|
178
|
-
if (record.deprecationMessage !== undefined && (typeof record.deprecationMessage !== 'string' || record.deprecationMessage.length > STR_MAX))
|
|
179
|
-
continue;
|
|
180
|
-
this.tools.set(record.toolName, record);
|
|
181
|
-
}
|
|
182
|
-
else if (record._type === 'history') {
|
|
183
|
-
if (typeof record.toolName !== 'string' || !NAME_RE.test(record.toolName))
|
|
184
|
-
continue;
|
|
185
|
-
this.history.push(record);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
catch {
|
|
189
|
-
// Skip malformed lines
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Append a version history entry and the current tool state to disk.
|
|
195
|
-
*/
|
|
196
|
-
appendEntry(entry) {
|
|
197
|
-
const dir = dirname(this.storagePath);
|
|
198
|
-
if (!existsSync(dir)) {
|
|
199
|
-
mkdirSync(dir, { recursive: true });
|
|
200
|
-
}
|
|
201
|
-
const tool = this.tools.get(entry.toolName);
|
|
202
|
-
const lines = [];
|
|
203
|
-
if (tool) {
|
|
204
|
-
lines.push(JSON.stringify({ _type: 'tool', ...tool }));
|
|
205
|
-
}
|
|
206
|
-
lines.push(JSON.stringify({ _type: 'history', ...entry }));
|
|
207
|
-
appendFileSync(this.storagePath, lines.join('\n') + '\n', 'utf-8');
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Recursively collect all `.md` files under a directory.
|
|
212
|
-
*/
|
|
213
|
-
function collectMdFiles(root) {
|
|
214
|
-
const results = [];
|
|
215
|
-
let entries;
|
|
216
|
-
try {
|
|
217
|
-
entries = readdirSync(root);
|
|
218
|
-
}
|
|
219
|
-
catch {
|
|
220
|
-
return results;
|
|
221
|
-
}
|
|
222
|
-
for (const entry of entries) {
|
|
223
|
-
const full = join(root, entry);
|
|
224
|
-
let stat;
|
|
225
|
-
try {
|
|
226
|
-
// Use lstatSync so symlinks aren't followed — otherwise a symlink under
|
|
227
|
-
// `agentsDir` could redirect this scan into arbitrary filesystem
|
|
228
|
-
// locations, which combined with `getImpactedAgents` becomes a content
|
|
229
|
-
// oracle that fingerprints arbitrary text files outside the project.
|
|
230
|
-
stat = lstatSync(full);
|
|
231
|
-
}
|
|
232
|
-
catch {
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
if (stat.isSymbolicLink())
|
|
236
|
-
continue;
|
|
237
|
-
if (stat.isDirectory()) {
|
|
238
|
-
results.push(...collectMdFiles(full));
|
|
239
|
-
}
|
|
240
|
-
else if (stat.isFile() && extname(entry) === '.md') {
|
|
241
|
-
results.push(full);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return results;
|
|
245
|
-
}
|
|
246
|
-
//# sourceMappingURL=tool-registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../../../src/mcp/tool-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,cAAc,EACd,YAAY,EACZ,UAAU,EACV,SAAS,EACT,WAAW,EAEX,SAAS,GACV,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAM5D,2DAA2D;AAC3D,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,OAAO,YAAY;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MAAM,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,EAAE,CAAC;YACrD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WASM Agent MCP Tools
|
|
3
|
-
*
|
|
4
|
-
* Exposes @monoes/rvagent-wasm operations via MCP protocol.
|
|
5
|
-
* All tools gracefully degrade when the WASM package is not installed.
|
|
6
|
-
*/
|
|
7
|
-
import type { MCPTool } from './types.js';
|
|
8
|
-
export declare const wasmAgentTools: MCPTool[];
|
|
9
|
-
//# sourceMappingURL=wasm-agent-tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-agent-tools.d.ts","sourceRoot":"","sources":["../../../src/mcp-tools/wasm-agent-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAO1C,eAAO,MAAM,cAAc,EAAE,OAAO,EAgNnC,CAAC"}
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WASM Agent MCP Tools
|
|
3
|
-
*
|
|
4
|
-
* Exposes @monoes/rvagent-wasm operations via MCP protocol.
|
|
5
|
-
* All tools gracefully degrade when the WASM package is not installed.
|
|
6
|
-
*/
|
|
7
|
-
async function loadAgentWasm() {
|
|
8
|
-
const mod = await import('../monovector/agent-wasm.js');
|
|
9
|
-
return mod;
|
|
10
|
-
}
|
|
11
|
-
export const wasmAgentTools = [
|
|
12
|
-
{
|
|
13
|
-
name: 'wasm_agent_create',
|
|
14
|
-
description: 'Create a sandboxed WASM agent with virtual filesystem (no OS access). Optionally use a gallery template.',
|
|
15
|
-
inputSchema: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
template: { type: 'string', description: 'Gallery template name (coder, researcher, tester, reviewer, security, swarm)' },
|
|
19
|
-
model: { type: 'string', description: 'Model identifier (default: anthropic:claude-sonnet-4-20250514)' },
|
|
20
|
-
instructions: { type: 'string', description: 'System instructions for the agent' },
|
|
21
|
-
maxTurns: { type: 'number', description: 'Max conversation turns (default: 50)' },
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
handler: async (args) => {
|
|
25
|
-
try {
|
|
26
|
-
const wasm = await loadAgentWasm();
|
|
27
|
-
if (args.template) {
|
|
28
|
-
const info = await wasm.createAgentFromTemplate(args.template);
|
|
29
|
-
return { content: [{ type: 'text', text: JSON.stringify({ success: true, agent: info, source: 'gallery' }, null, 2) }] };
|
|
30
|
-
}
|
|
31
|
-
const info = await wasm.createWasmAgent({
|
|
32
|
-
model: args.model,
|
|
33
|
-
instructions: args.instructions,
|
|
34
|
-
maxTurns: args.maxTurns,
|
|
35
|
-
});
|
|
36
|
-
return { content: [{ type: 'text', text: JSON.stringify({ success: true, agent: info }, null, 2) }] };
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
return { content: [{ type: 'text', text: JSON.stringify({ error: String(err) }) }], isError: true };
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'wasm_agent_prompt',
|
|
45
|
-
description: 'Send a prompt to a WASM agent and get a response.',
|
|
46
|
-
inputSchema: {
|
|
47
|
-
type: 'object',
|
|
48
|
-
properties: {
|
|
49
|
-
agentId: { type: 'string', description: 'WASM agent ID' },
|
|
50
|
-
input: { type: 'string', description: 'User prompt to send' },
|
|
51
|
-
},
|
|
52
|
-
required: ['agentId', 'input'],
|
|
53
|
-
},
|
|
54
|
-
handler: async (args) => {
|
|
55
|
-
try {
|
|
56
|
-
const wasm = await loadAgentWasm();
|
|
57
|
-
const result = await wasm.promptWasmAgent(args.agentId, args.input);
|
|
58
|
-
return { content: [{ type: 'text', text: result }] };
|
|
59
|
-
}
|
|
60
|
-
catch (err) {
|
|
61
|
-
return { content: [{ type: 'text', text: JSON.stringify({ error: String(err) }) }], isError: true };
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'wasm_agent_tool',
|
|
67
|
-
description: 'Execute a tool on a WASM agent sandbox. Tools: read_file, write_file, edit_file, write_todos, list_files. Use flat format: {tool, path, content, ...}.',
|
|
68
|
-
inputSchema: {
|
|
69
|
-
type: 'object',
|
|
70
|
-
properties: {
|
|
71
|
-
agentId: { type: 'string', description: 'WASM agent ID' },
|
|
72
|
-
toolName: { type: 'string', description: 'Tool name (read_file, write_file, edit_file, write_todos, list_files)' },
|
|
73
|
-
toolInput: { type: 'object', description: 'Tool parameters (flat: {path, content, old_string, new_string, todos})' },
|
|
74
|
-
},
|
|
75
|
-
required: ['agentId', 'toolName'],
|
|
76
|
-
},
|
|
77
|
-
handler: async (args) => {
|
|
78
|
-
try {
|
|
79
|
-
const wasm = await loadAgentWasm();
|
|
80
|
-
// Flat format: {tool: 'write_file', path: '...', content: '...'}
|
|
81
|
-
const toolCall = {
|
|
82
|
-
tool: args.toolName,
|
|
83
|
-
...(args.toolInput ?? {}),
|
|
84
|
-
};
|
|
85
|
-
const result = await wasm.executeWasmTool(args.agentId, toolCall);
|
|
86
|
-
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
89
|
-
return { content: [{ type: 'text', text: JSON.stringify({ error: String(err) }) }], isError: true };
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
name: 'wasm_agent_list',
|
|
95
|
-
description: 'List all active WASM agents.',
|
|
96
|
-
inputSchema: { type: 'object', properties: {} },
|
|
97
|
-
handler: async () => {
|
|
98
|
-
try {
|
|
99
|
-
const wasm = await loadAgentWasm();
|
|
100
|
-
const agents = wasm.listWasmAgents();
|
|
101
|
-
return { content: [{ type: 'text', text: JSON.stringify({ agents, count: agents.length }, null, 2) }] };
|
|
102
|
-
}
|
|
103
|
-
catch (err) {
|
|
104
|
-
return { content: [{ type: 'text', text: JSON.stringify({ error: String(err) }) }], isError: true };
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: 'wasm_agent_terminate',
|
|
110
|
-
description: 'Terminate a WASM agent and free resources.',
|
|
111
|
-
inputSchema: {
|
|
112
|
-
type: 'object',
|
|
113
|
-
properties: {
|
|
114
|
-
agentId: { type: 'string', description: 'WASM agent ID' },
|
|
115
|
-
},
|
|
116
|
-
required: ['agentId'],
|
|
117
|
-
},
|
|
118
|
-
handler: async (args) => {
|
|
119
|
-
try {
|
|
120
|
-
const wasm = await loadAgentWasm();
|
|
121
|
-
const ok = wasm.terminateWasmAgent(args.agentId);
|
|
122
|
-
return { content: [{ type: 'text', text: JSON.stringify({ success: ok }) }] };
|
|
123
|
-
}
|
|
124
|
-
catch (err) {
|
|
125
|
-
return { content: [{ type: 'text', text: JSON.stringify({ error: String(err) }) }], isError: true };
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: 'wasm_agent_files',
|
|
131
|
-
description: 'Get a WASM agent\'s available tools and info.',
|
|
132
|
-
inputSchema: {
|
|
133
|
-
type: 'object',
|
|
134
|
-
properties: {
|
|
135
|
-
agentId: { type: 'string', description: 'WASM agent ID' },
|
|
136
|
-
},
|
|
137
|
-
required: ['agentId'],
|
|
138
|
-
},
|
|
139
|
-
handler: async (args) => {
|
|
140
|
-
try {
|
|
141
|
-
const wasm = await loadAgentWasm();
|
|
142
|
-
const tools = wasm.getWasmAgentTools(args.agentId);
|
|
143
|
-
const info = wasm.getWasmAgent(args.agentId);
|
|
144
|
-
return { content: [{ type: 'text', text: JSON.stringify({ tools, fileCount: info?.fileCount ?? 0, turnCount: info?.turnCount ?? 0 }, null, 2) }] };
|
|
145
|
-
}
|
|
146
|
-
catch (err) {
|
|
147
|
-
return { content: [{ type: 'text', text: JSON.stringify({ error: String(err) }) }], isError: true };
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
name: 'wasm_agent_export',
|
|
153
|
-
description: 'Export a WASM agent\'s full state (config, filesystem, conversation) as JSON.',
|
|
154
|
-
inputSchema: {
|
|
155
|
-
type: 'object',
|
|
156
|
-
properties: {
|
|
157
|
-
agentId: { type: 'string', description: 'WASM agent ID' },
|
|
158
|
-
},
|
|
159
|
-
required: ['agentId'],
|
|
160
|
-
},
|
|
161
|
-
handler: async (args) => {
|
|
162
|
-
try {
|
|
163
|
-
const wasm = await loadAgentWasm();
|
|
164
|
-
const state = wasm.exportWasmState(args.agentId);
|
|
165
|
-
return { content: [{ type: 'text', text: state }] };
|
|
166
|
-
}
|
|
167
|
-
catch (err) {
|
|
168
|
-
return { content: [{ type: 'text', text: JSON.stringify({ error: String(err) }) }], isError: true };
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: 'wasm_gallery_list',
|
|
174
|
-
description: 'List all available WASM agent gallery templates (Coder, Researcher, Tester, Reviewer, Security, Swarm).',
|
|
175
|
-
inputSchema: { type: 'object', properties: {} },
|
|
176
|
-
handler: async () => {
|
|
177
|
-
try {
|
|
178
|
-
const wasm = await loadAgentWasm();
|
|
179
|
-
const templates = await wasm.listGalleryTemplates();
|
|
180
|
-
return { content: [{ type: 'text', text: JSON.stringify({ templates, count: templates.length }, null, 2) }] };
|
|
181
|
-
}
|
|
182
|
-
catch (err) {
|
|
183
|
-
return { content: [{ type: 'text', text: JSON.stringify({ error: String(err) }) }], isError: true };
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
name: 'wasm_gallery_search',
|
|
189
|
-
description: 'Search WASM agent gallery templates by query.',
|
|
190
|
-
inputSchema: {
|
|
191
|
-
type: 'object',
|
|
192
|
-
properties: {
|
|
193
|
-
query: { type: 'string', description: 'Search query' },
|
|
194
|
-
},
|
|
195
|
-
required: ['query'],
|
|
196
|
-
},
|
|
197
|
-
handler: async (args) => {
|
|
198
|
-
try {
|
|
199
|
-
const wasm = await loadAgentWasm();
|
|
200
|
-
const results = await wasm.searchGalleryTemplates(args.query);
|
|
201
|
-
return { content: [{ type: 'text', text: JSON.stringify({ results, count: results.length }, null, 2) }] };
|
|
202
|
-
}
|
|
203
|
-
catch (err) {
|
|
204
|
-
return { content: [{ type: 'text', text: JSON.stringify({ error: String(err) }) }], isError: true };
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: 'wasm_gallery_create',
|
|
210
|
-
description: 'Create a WASM agent from a gallery template.',
|
|
211
|
-
inputSchema: {
|
|
212
|
-
type: 'object',
|
|
213
|
-
properties: {
|
|
214
|
-
template: { type: 'string', description: 'Template name (coder, researcher, tester, reviewer, security, swarm)' },
|
|
215
|
-
},
|
|
216
|
-
required: ['template'],
|
|
217
|
-
},
|
|
218
|
-
handler: async (args) => {
|
|
219
|
-
try {
|
|
220
|
-
const wasm = await loadAgentWasm();
|
|
221
|
-
const info = await wasm.createAgentFromTemplate(args.template);
|
|
222
|
-
return { content: [{ type: 'text', text: JSON.stringify({ success: true, agent: info, template: args.template }, null, 2) }] };
|
|
223
|
-
}
|
|
224
|
-
catch (err) {
|
|
225
|
-
return { content: [{ type: 'text', text: JSON.stringify({ error: String(err) }) }], isError: true };
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
];
|
|
230
|
-
//# sourceMappingURL=wasm-agent-tools.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-agent-tools.js","sourceRoot":"","sources":["../../../src/mcp-tools/wasm-agent-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,KAAK,UAAU,aAAa;IAC1B,MAAM,GAAG,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,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YACtG,CAAC;QACH,CAAC;KACF;CACF,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Heuristic complexity scorer for task descriptions.
|
|
3
|
-
*
|
|
4
|
-
* Returns a score in [0, 100] that drives automatic model-tier selection.
|
|
5
|
-
* Higher scores indicate tasks that benefit from more capable (and costly)
|
|
6
|
-
* models.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Agent slugs that inherently deal with high-complexity work.
|
|
10
|
-
* When one of these agents is involved the score gets a +20 bonus.
|
|
11
|
-
*/
|
|
12
|
-
export declare const HIGH_COMPLEXITY_AGENTS: ReadonlySet<string>;
|
|
13
|
-
/**
|
|
14
|
-
* Score the complexity of a task description.
|
|
15
|
-
*
|
|
16
|
-
* @param taskDescription - Free-text description of the task.
|
|
17
|
-
* @param agentSlug - Optional agent identifier; certain agents boost the score.
|
|
18
|
-
* @returns A number in [0, 100].
|
|
19
|
-
*/
|
|
20
|
-
export declare function scoreComplexity(taskDescription: string, agentSlug?: string): number;
|
|
21
|
-
//# sourceMappingURL=complexity-scorer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"complexity-scorer.d.ts","sourceRoot":"","sources":["../../../src/model/complexity-scorer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAuCH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAQrD,CAAC;AAcH;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,eAAe,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAuCR"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Heuristic complexity scorer for task descriptions.
|
|
3
|
-
*
|
|
4
|
-
* Returns a score in [0, 100] that drives automatic model-tier selection.
|
|
5
|
-
* Higher scores indicate tasks that benefit from more capable (and costly)
|
|
6
|
-
* models.
|
|
7
|
-
*/
|
|
8
|
-
// ---------------------------------------------------------------------------
|
|
9
|
-
// Keyword sets
|
|
10
|
-
// ---------------------------------------------------------------------------
|
|
11
|
-
const HIGH_COMPLEXITY_KEYWORDS = [
|
|
12
|
-
'architecture',
|
|
13
|
-
'distributed',
|
|
14
|
-
'security audit',
|
|
15
|
-
'cve',
|
|
16
|
-
'consensus',
|
|
17
|
-
'fault-tolerant',
|
|
18
|
-
'migrate',
|
|
19
|
-
'refactor across',
|
|
20
|
-
'orchestrat',
|
|
21
|
-
'design system',
|
|
22
|
-
'database schema',
|
|
23
|
-
'performance optim',
|
|
24
|
-
'threat model',
|
|
25
|
-
'encryption',
|
|
26
|
-
'zero-knowledge',
|
|
27
|
-
];
|
|
28
|
-
const LOW_COMPLEXITY_KEYWORDS = [
|
|
29
|
-
'format',
|
|
30
|
-
'list',
|
|
31
|
-
'rename',
|
|
32
|
-
'sort',
|
|
33
|
-
'typo',
|
|
34
|
-
'lint',
|
|
35
|
-
'log',
|
|
36
|
-
'comment',
|
|
37
|
-
'print',
|
|
38
|
-
'echo',
|
|
39
|
-
'delete unused',
|
|
40
|
-
'remove import',
|
|
41
|
-
];
|
|
42
|
-
/**
|
|
43
|
-
* Agent slugs that inherently deal with high-complexity work.
|
|
44
|
-
* When one of these agents is involved the score gets a +20 bonus.
|
|
45
|
-
*/
|
|
46
|
-
export const HIGH_COMPLEXITY_AGENTS = new Set([
|
|
47
|
-
'engineering-software-architect',
|
|
48
|
-
'security-architect',
|
|
49
|
-
'security-auditor',
|
|
50
|
-
'system-architect',
|
|
51
|
-
'performance-engineer',
|
|
52
|
-
'byzantine-coordinator',
|
|
53
|
-
'collective-intelligence-coordinator',
|
|
54
|
-
]);
|
|
55
|
-
// ---------------------------------------------------------------------------
|
|
56
|
-
// Patterns
|
|
57
|
-
// ---------------------------------------------------------------------------
|
|
58
|
-
const STEP_INDICATOR_RE = /(?:step\s*\d|first[\s,].*then[\s,]|phase\s*\d)/i;
|
|
59
|
-
const CODE_BLOCK_RE = /```[\s\S]*?```/;
|
|
60
|
-
const FILE_REF_RE = /\b[\w./-]+\.\w{1,5}\b/;
|
|
61
|
-
// ---------------------------------------------------------------------------
|
|
62
|
-
// Scorer
|
|
63
|
-
// ---------------------------------------------------------------------------
|
|
64
|
-
/**
|
|
65
|
-
* Score the complexity of a task description.
|
|
66
|
-
*
|
|
67
|
-
* @param taskDescription - Free-text description of the task.
|
|
68
|
-
* @param agentSlug - Optional agent identifier; certain agents boost the score.
|
|
69
|
-
* @returns A number in [0, 100].
|
|
70
|
-
*/
|
|
71
|
-
export function scoreComplexity(taskDescription, agentSlug) {
|
|
72
|
-
let score = 50;
|
|
73
|
-
const lower = taskDescription.toLowerCase();
|
|
74
|
-
const wordCount = taskDescription.trim().split(/\s+/).length;
|
|
75
|
-
// -- Word-count adjustments ------------------------------------------------
|
|
76
|
-
if (wordCount < 20) {
|
|
77
|
-
score -= 20;
|
|
78
|
-
}
|
|
79
|
-
if (wordCount > 100) {
|
|
80
|
-
score += 20;
|
|
81
|
-
}
|
|
82
|
-
if (wordCount > 200) {
|
|
83
|
-
score += 10;
|
|
84
|
-
}
|
|
85
|
-
// -- Keyword adjustments (first match only) --------------------------------
|
|
86
|
-
if (HIGH_COMPLEXITY_KEYWORDS.some((kw) => lower.includes(kw))) {
|
|
87
|
-
score += 10;
|
|
88
|
-
}
|
|
89
|
-
if (LOW_COMPLEXITY_KEYWORDS.some((kw) => lower.includes(kw))) {
|
|
90
|
-
score -= 10;
|
|
91
|
-
}
|
|
92
|
-
// -- Structural indicators -------------------------------------------------
|
|
93
|
-
if (STEP_INDICATOR_RE.test(taskDescription)) {
|
|
94
|
-
score += 10;
|
|
95
|
-
}
|
|
96
|
-
if (CODE_BLOCK_RE.test(taskDescription) || FILE_REF_RE.test(taskDescription)) {
|
|
97
|
-
score += 5;
|
|
98
|
-
}
|
|
99
|
-
// -- Agent bonus -----------------------------------------------------------
|
|
100
|
-
if (agentSlug && HIGH_COMPLEXITY_AGENTS.has(agentSlug)) {
|
|
101
|
-
score += 20;
|
|
102
|
-
}
|
|
103
|
-
// -- Clamp -----------------------------------------------------------------
|
|
104
|
-
return Math.max(0, Math.min(100, score));
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=complexity-scorer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"complexity-scorer.js","sourceRoot":"","sources":["../../../src/model/complexity-scorer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,MAAM,wBAAwB,GAAsB;IAClD,cAAc;IACd,aAAa;IACb,gBAAgB;IAChB,KAAK;IACL,WAAW;IACX,gBAAgB;IAChB,SAAS;IACT,iBAAiB;IACjB,YAAY;IACZ,eAAe;IACf,iBAAiB;IACjB,mBAAmB;IACnB,cAAc;IACd,YAAY;IACZ,gBAAgB;CACjB,CAAC;AAEF,MAAM,uBAAuB,GAAsB;IACjD,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,SAAS;IACT,OAAO;IACP,MAAM;IACN,eAAe;IACf,eAAe;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAC;IACjE,gCAAgC;IAChC,oBAAoB;IACpB,kBAAkB;IAClB,kBAAkB;IAClB,sBAAsB;IACtB,uBAAuB;IACvB,qCAAqC;CACtC,CAAC,CAAC;AAEH,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E,MAAM,iBAAiB,GAAG,iDAAiD,CAAC;AAC5E,MAAM,aAAa,GAA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AA6E;IAC7E,IAAI,SAAS,IAAI,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACvD,KAAK,IAAI,EAAE,CAAC;IACd,CAAC;IAED,6EAA6E;IAC7E,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { type ModelTier, type ModelSettings, type ModelPreference, TIER_DEFAULTS, MODEL_IDS, } from './model-settings.js';
|
|
2
|
-
export { scoreComplexity, HIGH_COMPLEXITY_AGENTS, } from './complexity-scorer.js';
|
|
3
|
-
export { type ResolvedModelSettings, resolveModelTier, } from './model-tier-resolver.js';
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,aAAa,EACb,SAAS,GACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,eAAe,EACf,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,KAAK,qBAAqB,EAC1B,gBAAgB,GACjB,MAAM,0BAA0B,CAAC"}
|