karajan-code 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -4
- package/package.json +5 -2
- package/src/agents/aider-agent.js +1 -2
- package/src/agents/base-agent.js +63 -1
- package/src/agents/claude-agent.js +3 -4
- package/src/agents/codex-agent.js +1 -2
- package/src/agents/gemini-agent.js +1 -2
- package/src/agents/index.js +11 -2
- package/src/agents/opencode-agent.js +1 -2
- package/src/brain/decision-tracker.js +123 -0
- package/src/brain/decisor.js +243 -0
- package/src/brain/solomon-consult.js +163 -0
- package/src/budget/comparison.js +96 -0
- package/src/checks/binaries.js +123 -0
- package/src/checks/ci.js +105 -0
- package/src/checks/config-files.js +217 -0
- package/src/checks/dir-setup.js +63 -0
- package/src/checks/mcp-health.js +157 -0
- package/src/checks/node.js +61 -0
- package/src/checks/ports.js +110 -0
- package/src/checks/rtk.js +36 -0
- package/src/checks/runner.js +267 -0
- package/src/checks/skills.js +49 -0
- package/src/checks/sonar.js +67 -0
- package/src/checks/system.js +53 -0
- package/src/checks/tokens.js +96 -0
- package/src/checks/types.js +105 -0
- package/src/cli.js +29 -3
- package/src/commands/board.js +23 -0
- package/src/commands/doctor.js +130 -362
- package/src/commands/resume.js +1 -1
- package/src/commands/run.js +2 -1
- package/src/commands/skills.js +49 -0
- package/src/config/schema.js +222 -0
- package/src/config.js +32 -3
- package/src/guards/policy-resolver.js +8 -0
- package/src/hu/store.js +9 -0
- package/src/infrastructure/command-runner.js +44 -0
- package/src/infrastructure/environment.js +38 -0
- package/src/infrastructure/file-system-service.js +63 -0
- package/src/infrastructure/mocks.js +182 -0
- package/src/mcp/handlers/management-handlers.js +7 -2
- package/src/mcp/tools.js +10 -3
- package/src/orchestrator/config-init.js +16 -1
- package/src/orchestrator/flow-runner.js +2085 -0
- package/src/orchestrator/pipeline-context.js +17 -0
- package/src/orchestrator/preflight-checks.js +78 -4
- package/src/orchestrator/solomon-escalation.js +21 -0
- package/src/orchestrator/stages/stage-executor.js +155 -0
- package/src/orchestrator.js +19 -1923
- package/src/prompts/architect.js +2 -2
- package/src/prompts/coder.js +2 -2
- package/src/prompts/prompt-resolver.js +127 -0
- package/src/prompts/reviewer.js +2 -2
- package/src/roles/architect-role.js +3 -1
- package/src/roles/base-role.js +23 -2
- package/src/roles/coder-role.js +3 -1
- package/src/roles/security-role.js +12 -0
- package/src/roles/tester-role.js +11 -0
- package/src/session/journal/decisions-writer.js +200 -0
- package/src/session/journal/iteration-logger.js +194 -0
- package/src/session/journal/summary-writer.js +176 -0
- package/src/session/journal/tree-writer.js +164 -0
- package/src/skills/semantic-detector.js +147 -0
- package/src/skills/skill-detector.js +186 -8
- package/src/skills/skill-loader.js +131 -1
- package/src/skills/skills-cache.js +128 -0
- package/src/types/agent.js +55 -0
- package/src/types/config.js +114 -0
- package/src/types/hu.js +47 -0
- package/src/types/index.js +34 -0
- package/src/types/policy.js +43 -0
- package/src/types/session.js +74 -0
- package/src/types/stage.js +68 -0
- package/src/utils/display/event-handlers.js +389 -0
- package/src/utils/display/formatters.js +132 -0
- package/src/utils/display/header.js +48 -0
- package/src/utils/display/session-summary.js +108 -0
- package/src/utils/display/solomon.js +42 -0
- package/src/utils/port-check.js +45 -0
- package/src/utils/port-occupant.js +95 -0
- package/src/utils/provider-env.js +116 -0
- package/src/utils/with-timeout.js +42 -0
- package/templates/roles/architect/anthropic.md +65 -0
- package/templates/roles/architect/default.md +63 -0
- package/templates/roles/architect/google.md +52 -0
- package/templates/roles/architect/openai.md +51 -0
- package/templates/roles/architect/opencode.md +50 -0
- package/templates/roles/coder/anthropic.md +72 -0
- package/templates/roles/coder/default.md +69 -0
- package/templates/roles/coder/google.md +78 -0
- package/templates/roles/coder/openai.md +59 -0
- package/templates/roles/coder/opencode.md +49 -0
- package/templates/roles/planner/anthropic.md +50 -0
- package/templates/roles/planner/default.md +48 -0
- package/templates/roles/planner/google.md +66 -0
- package/templates/roles/planner/openai.md +46 -0
- package/templates/roles/planner/opencode.md +53 -0
- package/templates/roles/reviewer/anthropic.md +61 -0
- package/templates/roles/reviewer/default.md +62 -0
- package/templates/roles/reviewer/google.md +63 -0
- package/templates/roles/reviewer/openai.md +57 -0
- package/templates/roles/reviewer/opencode.md +42 -0
- package/templates/roles/solomon/anthropic.md +71 -0
- package/templates/roles/solomon/default.md +83 -0
- package/templates/roles/solomon/google.md +61 -0
- package/templates/roles/solomon/openai.md +53 -0
- package/templates/roles/solomon/opencode.md +55 -0
- package/src/utils/display.js +0 -669
package/src/mcp/tools.js
CHANGED
|
@@ -12,12 +12,16 @@ export const tools = [
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
name: "kj_doctor",
|
|
15
|
-
description: "Check system dependencies and
|
|
15
|
+
description: "Check system dependencies, agent CLIs, ports, tokens and MCP health — auto-remediates when possible",
|
|
16
16
|
inputSchema: {
|
|
17
17
|
type: "object",
|
|
18
18
|
properties: {
|
|
19
19
|
kjHome: { type: "string" },
|
|
20
|
-
timeoutMs: { type: "number" }
|
|
20
|
+
timeoutMs: { type: "number" },
|
|
21
|
+
checkOnly: { type: "boolean", description: "Detect only, do not apply fixes" },
|
|
22
|
+
yes: { type: "boolean", description: "Auto-confirm prompts for invasive remediations" },
|
|
23
|
+
json: { type: "boolean", description: "Emit machine-readable JSON output" },
|
|
24
|
+
verbose: { type: "boolean", description: "Include fix hints and timing per check" }
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
},
|
|
@@ -105,7 +109,10 @@ export const tools = [
|
|
|
105
109
|
kjHome: { type: "string" },
|
|
106
110
|
sonarToken: { type: "string" },
|
|
107
111
|
timeoutMs: { type: "number" },
|
|
108
|
-
domain: { type: "string", description: "Domain knowledge: inline text describing the project domain, or absolute path to a .md file. Auto-saved to .karajan/domains/ for the curator." }
|
|
112
|
+
domain: { type: "string", description: "Domain knowledge: inline text describing the project domain, or absolute path to a .md file. Auto-saved to .karajan/domains/ for the curator." },
|
|
113
|
+
brain: { type: "string", enum: ["on", "off"], description: "Brain decisor: on|off. Controls whether intent-driven routing overrides pipeline flags." },
|
|
114
|
+
forceRole: { type: "array", items: { type: "string" }, description: "Force roles ON regardless of triage (e.g. [\"security\"])" },
|
|
115
|
+
skipRole: { type: "array", items: { type: "string" }, description: "Force roles OFF regardless of triage (e.g. [\"tester\"])" }
|
|
109
116
|
}
|
|
110
117
|
}
|
|
111
118
|
},
|
|
@@ -10,6 +10,7 @@ import { buildReviewerPrompt } from "../prompts/reviewer.js";
|
|
|
10
10
|
import { resolveRole } from "../config.js";
|
|
11
11
|
import { emitProgress, makeEvent } from "../utils/events.js";
|
|
12
12
|
import { BudgetTracker, extractUsageMetrics } from "../utils/budget.js";
|
|
13
|
+
import { computeKjComparison } from "../budget/comparison.js";
|
|
13
14
|
import { resolveRoleMdPath, loadFirstExisting } from "../roles/base-role.js";
|
|
14
15
|
import { applyPolicies } from "../guards/policy-resolver.js";
|
|
15
16
|
import { resolveReviewProfile } from "../review/profiles.js";
|
|
@@ -280,7 +281,7 @@ export async function handleDryRun({ task, config, flags, emitter, pipelineFlags
|
|
|
280
281
|
return summary;
|
|
281
282
|
}
|
|
282
283
|
|
|
283
|
-
export function createBudgetManager({ config, emitter, eventBase }) {
|
|
284
|
+
export function createBudgetManager({ config, emitter, eventBase, getCompressionStats = null }) {
|
|
284
285
|
const budgetTracker = new BudgetTracker({ pricing: config?.budget?.pricing });
|
|
285
286
|
const budgetLimit = Number(config?.max_budget_usd);
|
|
286
287
|
const hasBudgetLimit = Number.isFinite(budgetLimit) && budgetLimit >= 0;
|
|
@@ -290,6 +291,20 @@ export function createBudgetManager({ config, emitter, eventBase }) {
|
|
|
290
291
|
function budgetSummary() {
|
|
291
292
|
const s = budgetTracker.summary();
|
|
292
293
|
s.trace = budgetTracker.trace();
|
|
294
|
+
// Attach the "With KJ vs Without KJ" comparison when compression data
|
|
295
|
+
// is available (TSK-0274). hasCompression: false means no savings to
|
|
296
|
+
// report; the display falls back to the plain cost line.
|
|
297
|
+
if (typeof getCompressionStats === "function") {
|
|
298
|
+
try {
|
|
299
|
+
const stats = getCompressionStats() || {};
|
|
300
|
+
s.kj_comparison = computeKjComparison({
|
|
301
|
+
realTokens: s.total_tokens,
|
|
302
|
+
realCost: s.total_cost_usd,
|
|
303
|
+
rtkSavings: stats.rtkSavings,
|
|
304
|
+
brainCtx: stats.brainCtx,
|
|
305
|
+
});
|
|
306
|
+
} catch { /* best-effort — omit comparison on failure */ }
|
|
307
|
+
}
|
|
293
308
|
return s;
|
|
294
309
|
}
|
|
295
310
|
|