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.
- package/.claude/commands/mastermind/idea.md +1 -1
- package/.claude/commands/mastermind/master.md +1 -1
- package/.claude/scheduled_tasks.lock +1 -1
- package/.claude/skills/mastermind/_protocol.md +4 -4
- package/.claude/skills/mastermind/architect.md +4 -7
- package/.claude/skills/mastermind/autodev.md +2 -4
- 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 +0 -8
- package/.claude/skills/mastermind/marketing.md +3 -3
- package/.claude/skills/mastermind/monitor.md +2 -2
- 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/README.md +286 -129
- package/package.json +2 -2
- package/packages/@monomind/cli/README.md +286 -129
- package/packages/@monomind/cli/bundled-graph/dist/src/build.js +73 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.js +120 -0
- package/packages/@monomind/cli/bundled-graph/package.json +57 -0
- package/packages/@monomind/cli/dist/src/agents/halt-signal.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/agents/halt-signal.js +76 -0
- package/packages/@monomind/cli/dist/src/agents/index.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/agents/index.js +13 -0
- package/packages/@monomind/cli/dist/src/agents/managed-agent.d.ts +41 -0
- package/packages/@monomind/cli/dist/src/agents/managed-agent.js +69 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.d.ts +23 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.js +49 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.js +80 -0
- package/packages/@monomind/cli/dist/src/agents/registry-query.d.ts +71 -0
- package/packages/@monomind/cli/dist/src/agents/registry-query.js +125 -0
- package/packages/@monomind/cli/dist/src/agents/score-decay.d.ts +19 -0
- package/packages/@monomind/cli/dist/src/agents/score-decay.js +22 -0
- package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.js +40 -0
- package/packages/@monomind/cli/dist/src/agents/specialization-scorer.d.ts +54 -0
- package/packages/@monomind/cli/dist/src/agents/specialization-scorer.js +212 -0
- package/packages/@monomind/cli/dist/src/agents/termination-watcher.d.ts +30 -0
- package/packages/@monomind/cli/dist/src/agents/termination-watcher.js +84 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-index.d.ts +20 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-index.js +38 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.d.ts +64 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.js +308 -0
- package/packages/@monomind/cli/dist/src/agents/version-diff.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/agents/version-diff.js +64 -0
- package/packages/@monomind/cli/dist/src/agents/version-store.d.ts +60 -0
- package/packages/@monomind/cli/dist/src/agents/version-store.js +235 -0
- package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.d.ts +45 -0
- package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.js +404 -0
- package/packages/@monomind/cli/dist/src/commands/agent-wasm.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/commands/agent-wasm.js +333 -0
- package/packages/@monomind/cli/dist/src/commands/doctor.js +55 -1
- package/packages/@monomind/cli/dist/src/commands/ui.js +68 -0
- package/packages/@monomind/cli/dist/src/consensus/index.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/consensus/index.js +6 -0
- package/packages/@monomind/cli/dist/src/context/context-provider.d.ts +44 -0
- package/packages/@monomind/cli/dist/src/context/context-provider.js +25 -0
- package/packages/@monomind/cli/dist/src/context/git-state-provider.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/context/git-state-provider.js +34 -0
- package/packages/@monomind/cli/dist/src/context/index.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/context/index.js +12 -0
- package/packages/@monomind/cli/dist/src/context/project-conventions-provider.d.ts +15 -0
- package/packages/@monomind/cli/dist/src/context/project-conventions-provider.js +19 -0
- package/packages/@monomind/cli/dist/src/context/prompt-assembler.d.ts +26 -0
- package/packages/@monomind/cli/dist/src/context/prompt-assembler.js +93 -0
- package/packages/@monomind/cli/dist/src/context/task-history-provider.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/context/task-history-provider.js +32 -0
- package/packages/@monomind/cli/dist/src/context/user-preferences-provider.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/context/user-preferences-provider.js +27 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.d.ts +31 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.js +81 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-writer.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-writer.js +65 -0
- package/packages/@monomind/cli/dist/src/dlq/index.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/dlq/index.js +7 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.d.ts +33 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.js +107 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-runner.d.ts +23 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-runner.js +59 -0
- package/packages/@monomind/cli/dist/src/eval/index.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/eval/index.js +7 -0
- package/packages/@monomind/cli/dist/src/eval/trace-collector.d.ts +40 -0
- package/packages/@monomind/cli/dist/src/eval/trace-collector.js +102 -0
- package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.js +264 -0
- package/packages/@monomind/cli/dist/src/init/statusline-generator.js +3 -3
- package/packages/@monomind/cli/dist/src/interactive/interrupt.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/interactive/interrupt.js +71 -0
- package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.js +48 -0
- package/packages/@monomind/cli/dist/src/mcp/tool-registry.d.ts +61 -0
- package/packages/@monomind/cli/dist/src/mcp/tool-registry.js +246 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.js +230 -0
- package/packages/@monomind/cli/dist/src/model/complexity-scorer.d.ts +21 -0
- package/packages/@monomind/cli/dist/src/model/complexity-scorer.js +106 -0
- package/packages/@monomind/cli/dist/src/model/index.d.ts +4 -0
- package/packages/@monomind/cli/dist/src/model/index.js +4 -0
- package/packages/@monomind/cli/dist/src/model/model-settings.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/model/model-settings.js +33 -0
- package/packages/@monomind/cli/dist/src/model/model-tier-resolver.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/model/model-tier-resolver.js +65 -0
- package/packages/@monomind/cli/dist/src/monovector/capabilities.d.ts +34 -0
- package/packages/@monomind/cli/dist/src/monovector/capabilities.js +37 -0
- package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/orchestration/index.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/orchestration/index.js +6 -0
- package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.js +31 -0
- package/packages/@monomind/cli/dist/src/orchestration/routing-modes.d.ts +68 -0
- package/packages/@monomind/cli/dist/src/orchestration/routing-modes.js +180 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.js +188 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/packages/@monomind/cli/dist/src/runtime/headless.d.ts +60 -0
- package/packages/@monomind/cli/dist/src/runtime/headless.js +284 -0
- package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.js +95 -0
- package/packages/@monomind/cli/dist/src/services/container-worker-pool.d.ts +197 -0
- package/packages/@monomind/cli/dist/src/services/container-worker-pool.js +623 -0
- package/packages/@monomind/cli/dist/src/services/index.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/services/index.js +11 -0
- package/packages/@monomind/cli/dist/src/services/worker-queue.d.ts +201 -0
- package/packages/@monomind/cli/dist/src/services/worker-queue.js +594 -0
- package/packages/@monomind/cli/dist/src/swarm/communication-graph.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/swarm/communication-graph.js +77 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.d.ts +31 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.js +61 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.d.ts +19 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.js +68 -0
- package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.js +205 -0
- package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/packages/@monomind/cli/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/packages/@monomind/cli/dist/src/transfer/test-seraphine.js +105 -0
- package/packages/@monomind/cli/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/transfer/tests/test-store.js +214 -0
- package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.js +82 -0
- package/packages/@monomind/cli/dist/src/workflow/context-resolver.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/workflow/context-resolver.js +23 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-builder.d.ts +17 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-builder.js +129 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-executor.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-executor.js +116 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-types.d.ts +41 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-types.js +8 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-parser.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-parser.js +20 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.d.ts +165 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.js +82 -0
- package/packages/@monomind/cli/dist/src/workflow/index.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/workflow/index.js +11 -0
- package/packages/@monomind/cli/dist/src/workflow/template-engine.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/workflow/template-engine.js +40 -0
- package/packages/@monomind/cli/dist/src/workflow/workflow-executor.d.ts +29 -0
- package/packages/@monomind/cli/dist/src/workflow/workflow-executor.js +227 -0
- package/packages/@monomind/cli/package.json +9 -9
- package/packages/@monomind/guidance/dist/adversarial.d.ts +284 -0
- package/packages/@monomind/guidance/dist/adversarial.js +572 -0
- package/packages/@monomind/guidance/dist/analyzer.d.ts +530 -0
- package/packages/@monomind/guidance/dist/analyzer.js +2518 -0
- package/packages/@monomind/guidance/dist/artifacts.d.ts +283 -0
- package/packages/@monomind/guidance/dist/artifacts.js +356 -0
- package/packages/@monomind/guidance/dist/authority.d.ts +290 -0
- package/packages/@monomind/guidance/dist/authority.js +558 -0
- package/packages/@monomind/guidance/dist/capabilities.d.ts +209 -0
- package/packages/@monomind/guidance/dist/capabilities.js +485 -0
- package/packages/@monomind/guidance/dist/coherence.d.ts +233 -0
- package/packages/@monomind/guidance/dist/coherence.js +372 -0
- package/packages/@monomind/guidance/dist/compiler.d.ts +87 -0
- package/packages/@monomind/guidance/dist/compiler.js +419 -0
- package/packages/@monomind/guidance/dist/conformance-kit.d.ts +225 -0
- package/packages/@monomind/guidance/dist/conformance-kit.js +629 -0
- package/packages/@monomind/guidance/dist/continue-gate.d.ts +214 -0
- package/packages/@monomind/guidance/dist/continue-gate.js +353 -0
- package/packages/@monomind/guidance/dist/crypto-utils.d.ts +17 -0
- package/packages/@monomind/guidance/dist/crypto-utils.js +24 -0
- package/packages/@monomind/guidance/dist/evolution.d.ts +282 -0
- package/packages/@monomind/guidance/dist/evolution.js +500 -0
- package/packages/@monomind/guidance/dist/gates.d.ts +79 -0
- package/packages/@monomind/guidance/dist/gates.js +302 -0
- package/packages/@monomind/guidance/dist/gateway.d.ts +206 -0
- package/packages/@monomind/guidance/dist/gateway.js +452 -0
- package/packages/@monomind/guidance/dist/generators.d.ts +153 -0
- package/packages/@monomind/guidance/dist/generators.js +682 -0
- package/packages/@monomind/guidance/dist/headless.d.ts +177 -0
- package/packages/@monomind/guidance/dist/headless.js +342 -0
- package/packages/@monomind/guidance/dist/hooks.d.ts +109 -0
- package/packages/@monomind/guidance/dist/hooks.js +347 -0
- package/packages/@monomind/guidance/dist/index.d.ts +205 -0
- package/packages/@monomind/guidance/dist/index.js +321 -0
- package/packages/@monomind/guidance/dist/ledger.d.ts +162 -0
- package/packages/@monomind/guidance/dist/ledger.js +375 -0
- package/packages/@monomind/guidance/dist/manifest-validator.d.ts +289 -0
- package/packages/@monomind/guidance/dist/manifest-validator.js +838 -0
- package/packages/@monomind/guidance/dist/memory-gate.d.ts +222 -0
- package/packages/@monomind/guidance/dist/memory-gate.js +382 -0
- package/packages/@monomind/guidance/dist/meta-governance.d.ts +265 -0
- package/packages/@monomind/guidance/dist/meta-governance.js +348 -0
- package/packages/@monomind/guidance/dist/optimizer.d.ts +104 -0
- package/packages/@monomind/guidance/dist/optimizer.js +329 -0
- package/packages/@monomind/guidance/dist/persistence.d.ts +189 -0
- package/packages/@monomind/guidance/dist/persistence.js +464 -0
- package/packages/@monomind/guidance/dist/proof.d.ts +185 -0
- package/packages/@monomind/guidance/dist/proof.js +238 -0
- package/packages/@monomind/guidance/dist/retriever.d.ts +116 -0
- package/packages/@monomind/guidance/dist/retriever.js +394 -0
- package/packages/@monomind/guidance/dist/ruvbot-integration.d.ts +370 -0
- package/packages/@monomind/guidance/dist/ruvbot-integration.js +738 -0
- package/packages/@monomind/guidance/dist/temporal.d.ts +426 -0
- package/packages/@monomind/guidance/dist/temporal.js +658 -0
- package/packages/@monomind/guidance/dist/trust.d.ts +283 -0
- package/packages/@monomind/guidance/dist/trust.js +473 -0
- package/packages/@monomind/guidance/dist/truth-anchors.d.ts +276 -0
- package/packages/@monomind/guidance/dist/truth-anchors.js +488 -0
- package/packages/@monomind/guidance/dist/types.d.ts +378 -0
- package/packages/@monomind/guidance/dist/types.js +10 -0
- package/packages/@monomind/guidance/dist/uncertainty.d.ts +372 -0
- package/packages/@monomind/guidance/dist/uncertainty.js +619 -0
- package/packages/@monomind/guidance/dist/wasm-kernel.d.ts +48 -0
- package/packages/@monomind/guidance/dist/wasm-kernel.js +158 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WASM Agent CLI Subcommands
|
|
3
|
+
*
|
|
4
|
+
* Exposes @monoes/rvagent-wasm operations via the `agent` CLI command.
|
|
5
|
+
* Wraps functions from monovector/agent-wasm.ts for CLI usage.
|
|
6
|
+
*/
|
|
7
|
+
import type { Command } from '../types.js';
|
|
8
|
+
export declare const wasmStatusCommand: Command;
|
|
9
|
+
export declare const wasmCreateCommand: Command;
|
|
10
|
+
export declare const wasmPromptCommand: Command;
|
|
11
|
+
export declare const wasmGalleryCommand: Command;
|
|
12
|
+
/** All WASM subcommands for the agent command */
|
|
13
|
+
export declare const wasmSubcommands: Command[];
|
|
14
|
+
//# sourceMappingURL=agent-wasm.d.ts.map
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WASM Agent CLI Subcommands
|
|
3
|
+
*
|
|
4
|
+
* Exposes @monoes/rvagent-wasm operations via the `agent` CLI command.
|
|
5
|
+
* Wraps functions from monovector/agent-wasm.ts for CLI usage.
|
|
6
|
+
*/
|
|
7
|
+
import { output } from '../output.js';
|
|
8
|
+
const WASM_NOT_AVAILABLE_MSG = '@monoes/rvagent-wasm is not installed.\n' +
|
|
9
|
+
'Install it with: npm install @monoes/rvagent-wasm';
|
|
10
|
+
async function loadWasm() {
|
|
11
|
+
const mod = await import('../monovector/agent-wasm.js');
|
|
12
|
+
return mod;
|
|
13
|
+
}
|
|
14
|
+
// agent wasm-status
|
|
15
|
+
export const wasmStatusCommand = {
|
|
16
|
+
name: 'wasm-status',
|
|
17
|
+
description: 'Check rvagent-wasm availability, version, and capabilities',
|
|
18
|
+
options: [],
|
|
19
|
+
examples: [
|
|
20
|
+
{ command: 'monomind agent wasm-status', description: 'Check WASM agent runtime status' },
|
|
21
|
+
],
|
|
22
|
+
action: async (ctx) => {
|
|
23
|
+
try {
|
|
24
|
+
const wasm = await loadWasm();
|
|
25
|
+
const available = await wasm.isAgentWasmAvailable();
|
|
26
|
+
if (!available) {
|
|
27
|
+
output.writeln();
|
|
28
|
+
output.printWarning(WASM_NOT_AVAILABLE_MSG);
|
|
29
|
+
if (ctx.flags.format === 'json') {
|
|
30
|
+
output.printJson({ available: false });
|
|
31
|
+
}
|
|
32
|
+
return { success: true, data: { available: false } };
|
|
33
|
+
}
|
|
34
|
+
// Init to get full status
|
|
35
|
+
await wasm.initAgentWasm();
|
|
36
|
+
const agents = wasm.listWasmAgents();
|
|
37
|
+
let galleryCount = 0;
|
|
38
|
+
let categories = {};
|
|
39
|
+
try {
|
|
40
|
+
galleryCount = await wasm.getGalleryCount();
|
|
41
|
+
categories = await wasm.getGalleryCategories();
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Gallery may not be available in all builds
|
|
45
|
+
}
|
|
46
|
+
const statusData = {
|
|
47
|
+
available: true,
|
|
48
|
+
activeAgents: agents.length,
|
|
49
|
+
gallery: {
|
|
50
|
+
templates: galleryCount,
|
|
51
|
+
categories,
|
|
52
|
+
},
|
|
53
|
+
tools: ['read_file', 'write_file', 'edit_file', 'write_todos', 'list_files'],
|
|
54
|
+
features: ['sandboxed-execution', 'virtual-filesystem', 'gallery-templates', 'rvf-containers', 'mcp-bridge'],
|
|
55
|
+
};
|
|
56
|
+
if (ctx.flags.format === 'json') {
|
|
57
|
+
output.printJson(statusData);
|
|
58
|
+
return { success: true, data: statusData };
|
|
59
|
+
}
|
|
60
|
+
output.writeln();
|
|
61
|
+
output.writeln(output.bold('WASM Agent Runtime'));
|
|
62
|
+
output.writeln();
|
|
63
|
+
output.printTable({
|
|
64
|
+
columns: [
|
|
65
|
+
{ key: 'property', header: 'Property', width: 20 },
|
|
66
|
+
{ key: 'value', header: 'Value', width: 40 },
|
|
67
|
+
],
|
|
68
|
+
data: [
|
|
69
|
+
{ property: 'Available', value: output.success('yes') },
|
|
70
|
+
{ property: 'Active Agents', value: String(agents.length) },
|
|
71
|
+
{ property: 'Gallery Templates', value: String(galleryCount) },
|
|
72
|
+
{ property: 'Sandbox Tools', value: statusData.tools.join(', ') },
|
|
73
|
+
{ property: 'Features', value: statusData.features.join(', ') },
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
if (Object.keys(categories).length > 0) {
|
|
77
|
+
output.writeln();
|
|
78
|
+
output.writeln(output.bold('Gallery Categories'));
|
|
79
|
+
output.printTable({
|
|
80
|
+
columns: [
|
|
81
|
+
{ key: 'category', header: 'Category', width: 20 },
|
|
82
|
+
{ key: 'count', header: 'Templates', width: 10, align: 'right' },
|
|
83
|
+
],
|
|
84
|
+
data: Object.entries(categories).map(([category, count]) => ({ category, count })),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return { success: true, data: statusData };
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
output.printError(`WASM status check failed: ${String(error)}`);
|
|
91
|
+
return { success: false, exitCode: 1 };
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
// agent wasm-create
|
|
96
|
+
export const wasmCreateCommand = {
|
|
97
|
+
name: 'wasm-create',
|
|
98
|
+
description: 'Create a WASM-sandboxed agent',
|
|
99
|
+
options: [
|
|
100
|
+
{
|
|
101
|
+
name: 'template',
|
|
102
|
+
short: 't',
|
|
103
|
+
description: 'Gallery template (coder, researcher, tester, reviewer, security, swarm)',
|
|
104
|
+
type: 'string',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'model',
|
|
108
|
+
short: 'm',
|
|
109
|
+
description: 'Model identifier (default: anthropic:claude-sonnet-4-20250514)',
|
|
110
|
+
type: 'string',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'instructions',
|
|
114
|
+
short: 'i',
|
|
115
|
+
description: 'System instructions for the agent',
|
|
116
|
+
type: 'string',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'max-turns',
|
|
120
|
+
description: 'Maximum conversation turns (default: 50)',
|
|
121
|
+
type: 'number',
|
|
122
|
+
default: 50,
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
examples: [
|
|
126
|
+
{ command: 'monomind agent wasm-create', description: 'Create a default WASM agent' },
|
|
127
|
+
{ command: 'monomind agent wasm-create -t coder', description: 'Create from gallery template' },
|
|
128
|
+
{ command: 'monomind agent wasm-create -m "anthropic:claude-sonnet-4-20250514" -i "You are a security auditor"', description: 'Create with custom config' },
|
|
129
|
+
],
|
|
130
|
+
action: async (ctx) => {
|
|
131
|
+
try {
|
|
132
|
+
const wasm = await loadWasm();
|
|
133
|
+
const available = await wasm.isAgentWasmAvailable();
|
|
134
|
+
if (!available) {
|
|
135
|
+
output.printError(WASM_NOT_AVAILABLE_MSG);
|
|
136
|
+
return { success: false, exitCode: 1 };
|
|
137
|
+
}
|
|
138
|
+
const template = ctx.flags.template;
|
|
139
|
+
let info;
|
|
140
|
+
if (template) {
|
|
141
|
+
output.printInfo(`Creating WASM agent from template: ${output.highlight(template)}`);
|
|
142
|
+
info = await wasm.createAgentFromTemplate(template);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
output.printInfo('Creating WASM agent...');
|
|
146
|
+
info = await wasm.createWasmAgent({
|
|
147
|
+
model: ctx.flags.model,
|
|
148
|
+
instructions: ctx.flags.instructions,
|
|
149
|
+
maxTurns: ctx.flags['max-turns'],
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (ctx.flags.format === 'json') {
|
|
153
|
+
output.printJson({ success: true, agent: info, source: template ? 'gallery' : 'custom' });
|
|
154
|
+
return { success: true, data: info };
|
|
155
|
+
}
|
|
156
|
+
output.writeln();
|
|
157
|
+
output.printTable({
|
|
158
|
+
columns: [
|
|
159
|
+
{ key: 'property', header: 'Property', width: 15 },
|
|
160
|
+
{ key: 'value', header: 'Value', width: 45 },
|
|
161
|
+
],
|
|
162
|
+
data: [
|
|
163
|
+
{ property: 'ID', value: info.id },
|
|
164
|
+
{ property: 'State', value: info.state },
|
|
165
|
+
{ property: 'Model', value: info.model },
|
|
166
|
+
{ property: 'Turn Count', value: String(info.turnCount) },
|
|
167
|
+
{ property: 'File Count', value: String(info.fileCount) },
|
|
168
|
+
{ property: 'Created', value: info.createdAt },
|
|
169
|
+
...(template ? [{ property: 'Template', value: template }] : []),
|
|
170
|
+
],
|
|
171
|
+
});
|
|
172
|
+
output.writeln();
|
|
173
|
+
output.printSuccess(`WASM agent created: ${info.id}`);
|
|
174
|
+
return { success: true, data: info };
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
output.printError(`Failed to create WASM agent: ${String(error)}`);
|
|
178
|
+
return { success: false, exitCode: 1 };
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
// agent wasm-prompt
|
|
183
|
+
export const wasmPromptCommand = {
|
|
184
|
+
name: 'wasm-prompt',
|
|
185
|
+
description: 'Send a prompt to a WASM agent',
|
|
186
|
+
options: [
|
|
187
|
+
{
|
|
188
|
+
name: 'agent-id',
|
|
189
|
+
short: 'a',
|
|
190
|
+
description: 'WASM agent ID (required)',
|
|
191
|
+
type: 'string',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'input',
|
|
195
|
+
short: 'i',
|
|
196
|
+
description: 'Prompt text to send',
|
|
197
|
+
type: 'string',
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
examples: [
|
|
201
|
+
{ command: 'monomind agent wasm-prompt -a wasm-agent-1-abc -i "Write a hello world"', description: 'Send prompt to WASM agent' },
|
|
202
|
+
],
|
|
203
|
+
action: async (ctx) => {
|
|
204
|
+
const agentId = ctx.flags['agent-id'] || ctx.args[0];
|
|
205
|
+
const promptInput = ctx.flags.input || ctx.args[1];
|
|
206
|
+
if (!agentId) {
|
|
207
|
+
output.printError('Agent ID is required. Use --agent-id or -a');
|
|
208
|
+
return { success: false, exitCode: 1 };
|
|
209
|
+
}
|
|
210
|
+
if (!promptInput) {
|
|
211
|
+
output.printError('Prompt input is required. Use --input or -i');
|
|
212
|
+
return { success: false, exitCode: 1 };
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
const wasm = await loadWasm();
|
|
216
|
+
const available = await wasm.isAgentWasmAvailable();
|
|
217
|
+
if (!available) {
|
|
218
|
+
output.printError(WASM_NOT_AVAILABLE_MSG);
|
|
219
|
+
return { success: false, exitCode: 1 };
|
|
220
|
+
}
|
|
221
|
+
output.printInfo(`Sending prompt to ${output.highlight(agentId)}...`);
|
|
222
|
+
const result = await wasm.promptWasmAgent(agentId, promptInput);
|
|
223
|
+
if (ctx.flags.format === 'json') {
|
|
224
|
+
output.printJson({ agentId, response: result });
|
|
225
|
+
return { success: true, data: { agentId, response: result } };
|
|
226
|
+
}
|
|
227
|
+
output.writeln();
|
|
228
|
+
output.writeln(output.bold('Response'));
|
|
229
|
+
output.writeln();
|
|
230
|
+
output.writeln(result);
|
|
231
|
+
// Show updated agent info
|
|
232
|
+
const info = wasm.getWasmAgent(agentId);
|
|
233
|
+
if (info) {
|
|
234
|
+
output.writeln();
|
|
235
|
+
output.writeln(output.dim(`[turns: ${info.turnCount}, files: ${info.fileCount}, state: ${info.state}]`));
|
|
236
|
+
}
|
|
237
|
+
return { success: true, data: { agentId, response: result } };
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
output.printError(`Prompt failed: ${String(error)}`);
|
|
241
|
+
return { success: false, exitCode: 1 };
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
// agent wasm-gallery
|
|
246
|
+
export const wasmGalleryCommand = {
|
|
247
|
+
name: 'wasm-gallery',
|
|
248
|
+
description: 'List available WASM agent gallery templates',
|
|
249
|
+
options: [
|
|
250
|
+
{
|
|
251
|
+
name: 'search',
|
|
252
|
+
short: 's',
|
|
253
|
+
description: 'Search templates by query',
|
|
254
|
+
type: 'string',
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: 'category',
|
|
258
|
+
short: 'c',
|
|
259
|
+
description: 'Filter by category',
|
|
260
|
+
type: 'string',
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
examples: [
|
|
264
|
+
{ command: 'monomind agent wasm-gallery', description: 'List all gallery templates' },
|
|
265
|
+
{ command: 'monomind agent wasm-gallery -s coder', description: 'Search gallery templates' },
|
|
266
|
+
],
|
|
267
|
+
action: async (ctx) => {
|
|
268
|
+
try {
|
|
269
|
+
const wasm = await loadWasm();
|
|
270
|
+
const available = await wasm.isAgentWasmAvailable();
|
|
271
|
+
if (!available) {
|
|
272
|
+
output.printError(WASM_NOT_AVAILABLE_MSG);
|
|
273
|
+
return { success: false, exitCode: 1 };
|
|
274
|
+
}
|
|
275
|
+
const searchQuery = ctx.flags.search;
|
|
276
|
+
const category = ctx.flags.category;
|
|
277
|
+
let templates;
|
|
278
|
+
if (searchQuery) {
|
|
279
|
+
output.printInfo(`Searching gallery for: ${output.highlight(searchQuery)}`);
|
|
280
|
+
templates = await wasm.searchGalleryTemplates(searchQuery);
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
templates = await wasm.listGalleryTemplates();
|
|
284
|
+
}
|
|
285
|
+
// Filter by category if specified
|
|
286
|
+
if (category) {
|
|
287
|
+
templates = templates.filter((t) => t.category.toLowerCase() === category.toLowerCase());
|
|
288
|
+
}
|
|
289
|
+
if (ctx.flags.format === 'json') {
|
|
290
|
+
output.printJson({ templates, count: templates.length });
|
|
291
|
+
return { success: true, data: { templates, count: templates.length } };
|
|
292
|
+
}
|
|
293
|
+
output.writeln();
|
|
294
|
+
output.writeln(output.bold('WASM Agent Gallery'));
|
|
295
|
+
output.writeln();
|
|
296
|
+
if (templates.length === 0) {
|
|
297
|
+
output.printInfo('No templates found matching criteria');
|
|
298
|
+
return { success: true, data: { templates: [], count: 0 } };
|
|
299
|
+
}
|
|
300
|
+
output.printTable({
|
|
301
|
+
columns: [
|
|
302
|
+
{ key: 'id', header: 'ID', width: 20 },
|
|
303
|
+
{ key: 'name', header: 'Name', width: 18 },
|
|
304
|
+
{ key: 'category', header: 'Category', width: 12 },
|
|
305
|
+
{ key: 'description', header: 'Description', width: 35 },
|
|
306
|
+
{ key: 'version', header: 'Version', width: 10 },
|
|
307
|
+
],
|
|
308
|
+
data: templates.map((t) => ({
|
|
309
|
+
id: t.id,
|
|
310
|
+
name: t.name,
|
|
311
|
+
category: t.category,
|
|
312
|
+
description: t.description.length > 35 ? t.description.slice(0, 32) + '...' : t.description,
|
|
313
|
+
version: t.version,
|
|
314
|
+
})),
|
|
315
|
+
});
|
|
316
|
+
output.writeln();
|
|
317
|
+
output.printInfo(`${templates.length} template(s) found. Create with: agent wasm-create -t <id>`);
|
|
318
|
+
return { success: true, data: { templates, count: templates.length } };
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
output.printError(`Gallery listing failed: ${String(error)}`);
|
|
322
|
+
return { success: false, exitCode: 1 };
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
/** All WASM subcommands for the agent command */
|
|
327
|
+
export const wasmSubcommands = [
|
|
328
|
+
wasmStatusCommand,
|
|
329
|
+
wasmCreateCommand,
|
|
330
|
+
wasmPromptCommand,
|
|
331
|
+
wasmGalleryCommand,
|
|
332
|
+
];
|
|
333
|
+
//# sourceMappingURL=agent-wasm.js.map
|
|
@@ -579,6 +579,58 @@ async function checkMonoesIntegration() {
|
|
|
579
579
|
};
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
+
// Patterns that must be covered by .gitignore to prevent leaking session data / machine paths.
|
|
583
|
+
// Uses the surgical approach: ignore specific sensitive subdirs and file globs inside .monomind/
|
|
584
|
+
// rather than the entire directory, so safe content (orgs/, test-fixtures/) can still be tracked.
|
|
585
|
+
const REQUIRED_GITIGNORE_PATTERNS = [
|
|
586
|
+
{ pattern: '.monomind/sessions/', reason: 'session files contain cwd and machine paths' },
|
|
587
|
+
{ pattern: '.monomind/data/', reason: 'intelligence data with edit file paths' },
|
|
588
|
+
{ pattern: '.monomind/metrics/', reason: 'metrics with file path references' },
|
|
589
|
+
{ pattern: '.monomind/knowledge/', reason: 'knowledge chunks with local file content' },
|
|
590
|
+
{ pattern: '.monomind/*.json', reason: 'root-level runtime JSON (control, registry, routing)' },
|
|
591
|
+
{ pattern: '.monomind/*.jsonl', reason: 'root-level event logs (decisions, routing-feedback)' },
|
|
592
|
+
{ pattern: '**/.monomind/sessions/', reason: 'nested session files in sub-packages' },
|
|
593
|
+
{ pattern: '**/.monomind/*.json', reason: 'nested runtime JSON in sub-packages' },
|
|
594
|
+
{ pattern: 'data/sessions/', reason: 'session files with machine paths' },
|
|
595
|
+
{ pattern: 'data/mastermind-*.json', reason: 'mastermind session data' },
|
|
596
|
+
{ pattern: 'data/mastermind-*.jsonl', reason: 'mastermind event logs' },
|
|
597
|
+
{ pattern: '**/.claude-flow/', reason: 'claude-flow runtime data with paths' },
|
|
598
|
+
{ pattern: '.hive-mind/', reason: 'hive-mind state with session info' },
|
|
599
|
+
{ pattern: '.swarm/', reason: 'swarm state files' },
|
|
600
|
+
];
|
|
601
|
+
// Check whether a gitignore file covers all required monomind runtime patterns
|
|
602
|
+
async function checkGitignoreCoverage() {
|
|
603
|
+
const gitignorePath = join(process.cwd(), '.gitignore');
|
|
604
|
+
if (!existsSync(gitignorePath)) {
|
|
605
|
+
return {
|
|
606
|
+
name: 'Gitignore Coverage',
|
|
607
|
+
status: 'warn',
|
|
608
|
+
message: 'No .gitignore found — all monomind runtime paths are unprotected',
|
|
609
|
+
fix: 'echo ".monomind/\\n**/.monomind/" >> .gitignore',
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
const content = readFileSync(gitignorePath, 'utf-8');
|
|
613
|
+
const lines = content.split('\n').map(l => l.trim()).filter(l => l && !l.startsWith('#'));
|
|
614
|
+
const missing = REQUIRED_GITIGNORE_PATTERNS.filter(({ pattern }) => {
|
|
615
|
+
// A pattern is "covered" if the gitignore contains it exactly, or a parent glob covers it
|
|
616
|
+
const base = pattern.replace(/\*\*\//g, '').replace(/\*/g, '');
|
|
617
|
+
return !lines.some(l => l === pattern ||
|
|
618
|
+
l === pattern.replace(/\/$/, '') ||
|
|
619
|
+
// e.g. "**/.monomind/" covers ".monomind/"
|
|
620
|
+
(l.includes('**') && base && l.replace(/\*\*\//g, '').replace(/\*/g, '') === base));
|
|
621
|
+
});
|
|
622
|
+
if (missing.length === 0) {
|
|
623
|
+
return { name: 'Gitignore Coverage', status: 'pass', message: 'All monomind runtime paths are gitignored' };
|
|
624
|
+
}
|
|
625
|
+
const missingList = missing.map(m => m.pattern).join(', ');
|
|
626
|
+
const fixLines = missing.map(m => m.pattern).join('\\n');
|
|
627
|
+
return {
|
|
628
|
+
name: 'Gitignore Coverage',
|
|
629
|
+
status: 'warn',
|
|
630
|
+
message: `${missing.length} runtime path(s) not in .gitignore: ${missingList}`,
|
|
631
|
+
fix: `printf "${fixLines}\\n" >> .gitignore`,
|
|
632
|
+
};
|
|
633
|
+
}
|
|
582
634
|
async function checkGuidanceGates() {
|
|
583
635
|
const settingsPath = join(process.cwd(), '.claude', 'settings.json');
|
|
584
636
|
const gatesHandlerPath = join(process.cwd(), '.claude', 'helpers', 'handlers', 'gates-handler.cjs');
|
|
@@ -671,7 +723,7 @@ export const doctorCommand = {
|
|
|
671
723
|
{
|
|
672
724
|
name: 'component',
|
|
673
725
|
short: 'c',
|
|
674
|
-
description: 'Check specific component (version, node, npm, config, daemon, memory, api, git, mcp, claude, disk, typescript, monograph, helpers, monoes, gates)',
|
|
726
|
+
description: 'Check specific component (version, node, npm, config, daemon, memory, api, git, mcp, claude, disk, typescript, monograph, helpers, monoes, gates, gitignore)',
|
|
675
727
|
type: 'string'
|
|
676
728
|
},
|
|
677
729
|
{
|
|
@@ -718,6 +770,7 @@ export const doctorCommand = {
|
|
|
718
770
|
checkAgenticFlow,
|
|
719
771
|
checkMonoesIntegration,
|
|
720
772
|
checkGuidanceGates,
|
|
773
|
+
checkGitignoreCoverage,
|
|
721
774
|
];
|
|
722
775
|
const componentMap = {
|
|
723
776
|
'version': checkVersionFreshness,
|
|
@@ -738,6 +791,7 @@ export const doctorCommand = {
|
|
|
738
791
|
'agentic-flow': checkAgenticFlow,
|
|
739
792
|
'monoes': checkMonoesIntegration,
|
|
740
793
|
'gates': checkGuidanceGates,
|
|
794
|
+
'gitignore': checkGitignoreCoverage,
|
|
741
795
|
};
|
|
742
796
|
let checksToRun = allChecks;
|
|
743
797
|
if (component && componentMap[component]) {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* monomind ui — Live dashboard command
|
|
3
|
+
* Starts a local HTTP server serving the Neural Control Room dashboard.
|
|
4
|
+
*/
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
import * as os from 'os';
|
|
7
|
+
|
|
8
|
+
export const uiCommand = {
|
|
9
|
+
name: 'ui',
|
|
10
|
+
description: 'Start the live Monomind dashboard (Neural Control Room)',
|
|
11
|
+
category: 'core',
|
|
12
|
+
async action(ctx) {
|
|
13
|
+
return this.execute(ctx.args || [], ctx.flags || {});
|
|
14
|
+
},
|
|
15
|
+
async execute(args = [], options = {}) {
|
|
16
|
+
const port = parseInt(options.port || options.p || '4242', 10);
|
|
17
|
+
const noOpen = options['no-open'] || options['no-browser'] || false;
|
|
18
|
+
const projectDir = options.dir || process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
19
|
+
|
|
20
|
+
console.log('\x1b[36m◆ Monomind Neural Control Room\x1b[0m');
|
|
21
|
+
console.log('\x1b[2mStarting dashboard server...\x1b[0m\n');
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const { fileURLToPath } = await import('url');
|
|
25
|
+
const { dirname } = await import('path');
|
|
26
|
+
const { createRequire } = await import('module');
|
|
27
|
+
const serverPath = new URL('../ui/server.mjs', import.meta.url);
|
|
28
|
+
const { startServer } = await import(serverPath.href);
|
|
29
|
+
|
|
30
|
+
const result = await startServer({
|
|
31
|
+
port,
|
|
32
|
+
projectDir,
|
|
33
|
+
openBrowser: !noOpen,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
console.log(`\x1b[32m✓ Dashboard running at \x1b[1m${result.url}\x1b[0m`);
|
|
37
|
+
console.log(`\x1b[2m Project: ${projectDir}\x1b[0m`);
|
|
38
|
+
console.log(`\x1b[2m Press Ctrl+C to stop\x1b[0m\n`);
|
|
39
|
+
|
|
40
|
+
// Keep alive
|
|
41
|
+
await new Promise((resolve) => {
|
|
42
|
+
process.on('SIGINT', resolve);
|
|
43
|
+
process.on('SIGTERM', resolve);
|
|
44
|
+
});
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error(`\x1b[31m✗ Failed to start dashboard: ${err.message}\x1b[0m`);
|
|
47
|
+
if (process.env.DEBUG) console.error(err.stack);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
help() {
|
|
52
|
+
return `
|
|
53
|
+
\x1b[1mUsage:\x1b[0m monomind ui [options]
|
|
54
|
+
|
|
55
|
+
\x1b[1mOptions:\x1b[0m
|
|
56
|
+
--port, -p <number> Port to listen on (default: 4242)
|
|
57
|
+
--no-open Don't open browser automatically
|
|
58
|
+
--dir <path> Project directory to monitor (default: cwd)
|
|
59
|
+
|
|
60
|
+
\x1b[1mExamples:\x1b[0m
|
|
61
|
+
monomind ui
|
|
62
|
+
monomind ui --port 8080
|
|
63
|
+
monomind ui --no-open --dir /path/to/project
|
|
64
|
+
`.trim();
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default uiCommand;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consensus module barrel export (Task 36)
|
|
3
|
+
*/
|
|
4
|
+
export { deriveSigningKey, signVote, verifyVote } from './vote-signer.js';
|
|
5
|
+
export { AuditWriter } from './audit-writer.js';
|
|
6
|
+
export type { RecordInput } from './audit-writer.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Provider — interfaces and base class for dynamic prompt assembly.
|
|
3
|
+
*
|
|
4
|
+
* Each provider contributes a named section of context to the assembled prompt.
|
|
5
|
+
* Providers are prioritised (0-100) and budget-aware via token estimation.
|
|
6
|
+
*/
|
|
7
|
+
export interface RunContext {
|
|
8
|
+
agentSlug: string;
|
|
9
|
+
taskDescription: string;
|
|
10
|
+
sessionId: string;
|
|
11
|
+
swarmId?: string;
|
|
12
|
+
workingDir?: string;
|
|
13
|
+
metadata: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export interface ContextSection {
|
|
16
|
+
name: string;
|
|
17
|
+
content: string;
|
|
18
|
+
tokenCount: number;
|
|
19
|
+
priority: number;
|
|
20
|
+
required: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface ContextProvider {
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly priority: number;
|
|
25
|
+
readonly maxTokens: number;
|
|
26
|
+
readonly required: boolean;
|
|
27
|
+
provide(ctx: RunContext): Promise<string>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Convenience base class that implements the ContextProvider contract and
|
|
31
|
+
* supplies a rough token-truncation helper (approx 4 chars per token).
|
|
32
|
+
*/
|
|
33
|
+
export declare abstract class BaseContextProvider implements ContextProvider {
|
|
34
|
+
abstract readonly name: string;
|
|
35
|
+
abstract readonly priority: number;
|
|
36
|
+
readonly maxTokens: number;
|
|
37
|
+
readonly required: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Truncate `text` so that it fits within `maxTokens` (4 chars/token).
|
|
40
|
+
*/
|
|
41
|
+
protected truncateToTokens(text: string, maxTokens: number): string;
|
|
42
|
+
abstract provide(ctx: RunContext): Promise<string>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=context-provider.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Provider — interfaces and base class for dynamic prompt assembly.
|
|
3
|
+
*
|
|
4
|
+
* Each provider contributes a named section of context to the assembled prompt.
|
|
5
|
+
* Providers are prioritised (0-100) and budget-aware via token estimation.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Convenience base class that implements the ContextProvider contract and
|
|
9
|
+
* supplies a rough token-truncation helper (approx 4 chars per token).
|
|
10
|
+
*/
|
|
11
|
+
export class BaseContextProvider {
|
|
12
|
+
maxTokens = 500;
|
|
13
|
+
required = false;
|
|
14
|
+
/**
|
|
15
|
+
* Truncate `text` so that it fits within `maxTokens` (4 chars/token).
|
|
16
|
+
*/
|
|
17
|
+
truncateToTokens(text, maxTokens) {
|
|
18
|
+
const maxChars = maxTokens * 4;
|
|
19
|
+
if (text.length <= maxChars) {
|
|
20
|
+
return text;
|
|
21
|
+
}
|
|
22
|
+
return text.slice(0, maxChars);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=context-provider.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitStateProvider — injects current git branch, recent log, and changed files
|
|
3
|
+
* into the assembled prompt. Falls back gracefully when not inside a git repo.
|
|
4
|
+
*/
|
|
5
|
+
import { BaseContextProvider, type RunContext } from './context-provider.js';
|
|
6
|
+
export declare class GitStateProvider extends BaseContextProvider {
|
|
7
|
+
readonly name: "git-state";
|
|
8
|
+
readonly priority = 60;
|
|
9
|
+
readonly maxTokens = 300;
|
|
10
|
+
provide(ctx: RunContext): Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=git-state-provider.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitStateProvider — injects current git branch, recent log, and changed files
|
|
3
|
+
* into the assembled prompt. Falls back gracefully when not inside a git repo.
|
|
4
|
+
*/
|
|
5
|
+
import { execSync } from 'child_process';
|
|
6
|
+
import { BaseContextProvider } from './context-provider.js';
|
|
7
|
+
export class GitStateProvider extends BaseContextProvider {
|
|
8
|
+
name = 'git-state';
|
|
9
|
+
priority = 60;
|
|
10
|
+
maxTokens = 300;
|
|
11
|
+
async provide(ctx) {
|
|
12
|
+
try {
|
|
13
|
+
const cwd = ctx.workingDir ?? process.cwd();
|
|
14
|
+
const opts = { cwd, encoding: 'utf-8', timeout: 5000 };
|
|
15
|
+
const branch = execSync('git branch --show-current', opts).trim();
|
|
16
|
+
const log = execSync('git log --oneline -5', opts).trim();
|
|
17
|
+
const changed = execSync('git diff --name-only HEAD', opts).trim();
|
|
18
|
+
const parts = [
|
|
19
|
+
`**Branch:** ${branch}`,
|
|
20
|
+
'',
|
|
21
|
+
'**Recent commits:**',
|
|
22
|
+
log,
|
|
23
|
+
];
|
|
24
|
+
if (changed) {
|
|
25
|
+
parts.push('', '**Changed files:**', changed);
|
|
26
|
+
}
|
|
27
|
+
return this.truncateToTokens(parts.join('\n'), this.maxTokens);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return 'Git state unavailable (not a git repository or git not installed).';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=git-state-provider.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context module — dynamic system prompt assembly.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all context providers and the prompt assembler.
|
|
5
|
+
*/
|
|
6
|
+
export { type RunContext, type ContextSection, type ContextProvider, BaseContextProvider, } from './context-provider.js';
|
|
7
|
+
export { GitStateProvider } from './git-state-provider.js';
|
|
8
|
+
export { TaskHistoryProvider, type SearchFn, type SearchResult, } from './task-history-provider.js';
|
|
9
|
+
export { ProjectConventionsProvider, type ConventionsLoader, } from './project-conventions-provider.js';
|
|
10
|
+
export { UserPreferencesProvider, type PreferencesGetter, } from './user-preferences-provider.js';
|
|
11
|
+
export { PromptAssembler, type AssemblyConfig, type AssembledPrompt, } from './prompt-assembler.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context module — dynamic system prompt assembly.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all context providers and the prompt assembler.
|
|
5
|
+
*/
|
|
6
|
+
export { BaseContextProvider, } from './context-provider.js';
|
|
7
|
+
export { GitStateProvider } from './git-state-provider.js';
|
|
8
|
+
export { TaskHistoryProvider, } from './task-history-provider.js';
|
|
9
|
+
export { ProjectConventionsProvider, } from './project-conventions-provider.js';
|
|
10
|
+
export { UserPreferencesProvider, } from './user-preferences-provider.js';
|
|
11
|
+
export { PromptAssembler, } from './prompt-assembler.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|