@kontextmind/kxm 0.7.112 → 0.7.118
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-plugin/marketplace.json +1 -1
- package/.kxm/agents/implementer.yaml +1 -1
- package/.kxm/roles/writer.yaml +1 -1
- package/docs/contributing/assignment-runner.md +3 -3
- package/package.json +1 -1
- package/packages/core/tui/dist/index.js +478 -0
- package/packages/core/tui/src/adapters/claude.ts +131 -0
- package/packages/core/tui/src/adapters/historyExport.ts +35 -0
- package/packages/core/tui/src/adapters/omp.ts +174 -0
- package/packages/core/tui/src/adapters/pi.ts +34 -0
- package/packages/core/tui/src/exports/index.ts +8 -0
- package/packages/core/tui/src/tui/history.ts +106 -0
- package/packages/core/tui/src/tui/modelSelector.ts +43 -0
- package/packages/core/tui/src/tui/optimizer.ts +154 -0
- package/packages/core/tui/src/tui/queue.ts +90 -0
- package/packages/core/tui/src/tui/roleBudget.ts +104 -0
- package/plugins/kxm/.claude-plugin/plugin.json +1 -1
- package/plugins/kxm/dist/cli.js +220 -22
- package/plugins/kxm/dist/mcp-server.js +1 -1
- package/plugins/kxm/dist/runtime-supervisor.js +36 -4
- package/plugins/kxm/dist/runtime.js +36 -4
- package/plugins/kxm/dist/server.js +22 -0
- package/plugins/kxm/package.json +1 -1
- package/plugins/kxm/skills/kxm-harness-auth/SKILL.md +6 -0
- package/plugins/kxm/src/autocomplete.ts +3 -0
- package/plugins/kxm/src/cli/plugins.ts +201 -0
- package/plugins/kxm/src/cli.ts +14 -0
- package/plugins/kxm/src/harness.ts +36 -4
- package/plugins/kxm/src/mcp-server.ts +1 -1
- package/scripts/assignment-run.d.mts +7 -0
- package/scripts/assignment-run.mjs +128 -1
- package/scripts/demo-overlay.mjs +175 -0
- package/scripts/harness-run.mjs +2 -2
- package/scripts/native-critic.mjs +7 -7
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interactive Demo for KXM Task & Plan TUI Overlay.
|
|
5
|
+
*
|
|
6
|
+
* Demonstrates:
|
|
7
|
+
* - Collapsible overlay (Ctrl+O or F2 to toggle collapsed strip vs 3-pane view)
|
|
8
|
+
* - Auto-Dispatch toggle (press 'a')
|
|
9
|
+
* - Full Workflow History view (press 'h')
|
|
10
|
+
* - Dual History Export (press 'x' in history view)
|
|
11
|
+
* - Plan Optimizer (press 'o')
|
|
12
|
+
* - Task Reordering & navigation
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { ProcessTerminal, TuiAltScreen } from "@earendil-works/pi-tui";
|
|
16
|
+
import { createKxmTuiRegistry } from "../packages/core/tui/dist/index.js";
|
|
17
|
+
import { createKxmTuiOmpOverlay } from "../packages/core/tui/dist/index.js";
|
|
18
|
+
import { createDefaultKxmTuiTheme } from "../packages/core/tui/dist/index.js";
|
|
19
|
+
import { exportWorkflowHistory } from "../packages/core/tui/dist/index.js";
|
|
20
|
+
import { evaluatePlanOptimizations, applyPlanOptimizations } from "../packages/core/tui/dist/index.js";
|
|
21
|
+
|
|
22
|
+
const registry = createKxmTuiRegistry();
|
|
23
|
+
|
|
24
|
+
// Register mock workflow tasks and stages
|
|
25
|
+
registry.register({
|
|
26
|
+
source: "kxm/demo",
|
|
27
|
+
listSections: () => [
|
|
28
|
+
{
|
|
29
|
+
id: "active_stage",
|
|
30
|
+
title: "Stage 2: Implementation (Active)",
|
|
31
|
+
fields: [
|
|
32
|
+
{
|
|
33
|
+
id: "task_1",
|
|
34
|
+
label: "● task_1: Generate PKCE verifier",
|
|
35
|
+
value: "Passed (omp/claude-sonnet) ⏱ 12s",
|
|
36
|
+
status: "saved",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "task_2",
|
|
40
|
+
label: "● task_2: Exchange route /v1/auth/exchange",
|
|
41
|
+
value: "Passed (omp/claude-sonnet) ⏱ 28s",
|
|
42
|
+
status: "saved",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "task_3",
|
|
46
|
+
label: "◐ task_3: Validate refresh rotation",
|
|
47
|
+
value: "Attempt 2/3 (pi/qwen3) ⏱ 14s",
|
|
48
|
+
status: "busy",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "upcoming_queue",
|
|
54
|
+
title: "Upcoming Tasks & Lookahead",
|
|
55
|
+
fields: [
|
|
56
|
+
{
|
|
57
|
+
id: "task_4",
|
|
58
|
+
label: "◌ task_4: Write unit tests",
|
|
59
|
+
value: "Role: implementer (pi/qwen3) [Requires: task_3]",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "task_5",
|
|
63
|
+
label: "◌ task_5: Document auth endpoints",
|
|
64
|
+
value: "Role: doc-writer (omp/gemini) [Ready]",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "task_6",
|
|
68
|
+
label: "◌ task_6: Security critic audit",
|
|
69
|
+
value: "Role: security-critic (claude) [Requires: task_4]",
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
handlers: {},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const terminal = new ProcessTerminal();
|
|
78
|
+
const tui = new TuiAltScreen(terminal, false, undefined, { mouse: true });
|
|
79
|
+
const theme = createDefaultKxmTuiTheme();
|
|
80
|
+
|
|
81
|
+
let finished = false;
|
|
82
|
+
|
|
83
|
+
const overlay = createKxmTuiOmpOverlay({
|
|
84
|
+
registry,
|
|
85
|
+
tui: {
|
|
86
|
+
requestRender: () => {
|
|
87
|
+
tui.requestRender();
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
theme: theme,
|
|
91
|
+
title: "KXM Task & Plan Overlay Demo",
|
|
92
|
+
goal: "Implement OAuth PKCE & Token Refresh (#14)",
|
|
93
|
+
autoDispatch: false,
|
|
94
|
+
onToggleAutoDispatch: (auto) => {
|
|
95
|
+
// notified
|
|
96
|
+
},
|
|
97
|
+
onRunOptimizer: async () => {
|
|
98
|
+
const sampleTasks = [
|
|
99
|
+
{
|
|
100
|
+
id: "task_4",
|
|
101
|
+
title: "Write unit tests",
|
|
102
|
+
stageId: "s2",
|
|
103
|
+
role: "implementer",
|
|
104
|
+
harness: "pi",
|
|
105
|
+
model: "claude-3-5-sonnet",
|
|
106
|
+
dependencies: [],
|
|
107
|
+
category: "test",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "task_5",
|
|
111
|
+
title: "Document auth endpoints",
|
|
112
|
+
stageId: "s2",
|
|
113
|
+
role: "doc-writer",
|
|
114
|
+
harness: "omp",
|
|
115
|
+
model: "claude-3-5-sonnet",
|
|
116
|
+
dependencies: [],
|
|
117
|
+
category: "docs",
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
const result = evaluatePlanOptimizations(sampleTasks);
|
|
121
|
+
// proposal computed
|
|
122
|
+
},
|
|
123
|
+
onExportHistory: async (format) => {
|
|
124
|
+
const sampleEvents = [
|
|
125
|
+
{
|
|
126
|
+
id: "ev_1",
|
|
127
|
+
timestamp: new Date().toISOString(),
|
|
128
|
+
category: "task",
|
|
129
|
+
title: "Generate PKCE verifier",
|
|
130
|
+
status: "passed",
|
|
131
|
+
role: "implementer",
|
|
132
|
+
harness: "omp",
|
|
133
|
+
model: "claude-sonnet",
|
|
134
|
+
durationMs: 12000,
|
|
135
|
+
costUsd: 0.018,
|
|
136
|
+
artifacts: ["src/auth/pkce.ts"],
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: "ev_2",
|
|
140
|
+
timestamp: new Date().toISOString(),
|
|
141
|
+
category: "task",
|
|
142
|
+
title: "Validate refresh rotation",
|
|
143
|
+
status: "passed",
|
|
144
|
+
role: "implementer",
|
|
145
|
+
harness: "pi",
|
|
146
|
+
model: "qwen3-coder",
|
|
147
|
+
durationMs: 14000,
|
|
148
|
+
costUsd: 0.003,
|
|
149
|
+
},
|
|
150
|
+
];
|
|
151
|
+
return exportWorkflowHistory("run_demo_8f3a", sampleEvents, ".kxm/assets/retrospectives");
|
|
152
|
+
},
|
|
153
|
+
done: () => {
|
|
154
|
+
finished = true;
|
|
155
|
+
tui.stop();
|
|
156
|
+
process.exit(0);
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
tui.start({
|
|
161
|
+
render: (width) => overlay.render(width),
|
|
162
|
+
handleInput: (data) => {
|
|
163
|
+
// q to quit demo
|
|
164
|
+
if (data === "q" || data === "\x03") {
|
|
165
|
+
overlay.dispose();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
overlay.handleInput(data);
|
|
169
|
+
},
|
|
170
|
+
invalidate: () => overlay.invalidate(),
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
process.on("SIGINT", () => {
|
|
174
|
+
overlay.dispose();
|
|
175
|
+
});
|
package/scripts/harness-run.mjs
CHANGED
|
@@ -137,7 +137,7 @@ export const ROUTES = Object.freeze({
|
|
|
137
137
|
provider: "xai",
|
|
138
138
|
roles: Object.freeze(["writer"]),
|
|
139
139
|
permissions: Object.freeze(["edit"]),
|
|
140
|
-
models: Object.freeze(["grok-4.
|
|
140
|
+
models: Object.freeze(["grok-4.7"]),
|
|
141
141
|
efforts: Object.freeze(["low", "medium", "high"]),
|
|
142
142
|
auth: Object.freeze({ args: ["models"], loginHint: "grok (OAuth to auth.x.ai)" }),
|
|
143
143
|
},
|
|
@@ -153,7 +153,7 @@ export const ROUTES = Object.freeze({
|
|
|
153
153
|
provider: "anthropic",
|
|
154
154
|
roles: Object.freeze(["planner", "reviewer-arch"]),
|
|
155
155
|
permissions: Object.freeze(["read-only"]),
|
|
156
|
-
models: Object.freeze(["fable"]),
|
|
156
|
+
models: Object.freeze(["fable", "opus"]),
|
|
157
157
|
efforts: Object.freeze(["low", "medium", "high", "xhigh", "max"]),
|
|
158
158
|
auth: Object.freeze({ args: ["auth", "status"], loginHint: "claude auth login" }),
|
|
159
159
|
},
|
|
@@ -8,13 +8,13 @@ import { buildArgv } from "./harness-run.mjs";
|
|
|
8
8
|
|
|
9
9
|
// Launch intent only: these labels are not observed model identity or admission.
|
|
10
10
|
export function nativeCriticLaunch(harness) {
|
|
11
|
-
if (!["fable", "astra"].includes(harness)) {
|
|
12
|
-
throw new Error("usage: native-critic.mjs <fable|astra> <prompt>");
|
|
11
|
+
if (!["fable", "astra", "opus"].includes(harness)) {
|
|
12
|
+
throw new Error("usage: native-critic.mjs <fable|astra|opus> <prompt>");
|
|
13
13
|
}
|
|
14
|
-
const model = harness === "fable" ? "fable" : "gpt-6-astra";
|
|
15
|
-
const command = harness === "fable" ? "claude" : "codex";
|
|
16
|
-
const args = harness === "fable"
|
|
17
|
-
? ["-p", "--model", model, "--output-format", "json", "--no-session-persistence", "--tools", "Read,Glob,Grep", "--setting-sources", "user"]
|
|
14
|
+
const model = harness === "fable" ? "fable" : harness === "opus" ? "opus" : "gpt-6-astra";
|
|
15
|
+
const command = harness === "fable" || harness === "opus" ? "claude" : "codex";
|
|
16
|
+
const args = harness === "fable" || harness === "opus"
|
|
17
|
+
? ["-p", "--model", model, "--effort", "medium", "--output-format", "json", "--no-session-persistence", "--tools", "Read,Glob,Grep", "--setting-sources", "user"]
|
|
18
18
|
: buildArgv({ harness: "codex", model, effort: "low", permission: "read-only", prompt_file: "-" });
|
|
19
19
|
return { model, command, args };
|
|
20
20
|
}
|
|
@@ -36,7 +36,7 @@ async function main() {
|
|
|
36
36
|
mkdirSync(outDir, { recursive: true });
|
|
37
37
|
const client = new HubClient({ serverUrl, authToken: env.KXM_AUTH_TOKEN, name: `${harness}-critic`, purpose: "independent CLI critic", project: env.KXM_PROJECT || ".kxm", model });
|
|
38
38
|
const prompt = promptParts.join(" ");
|
|
39
|
-
const agent = await client.start(() => {});
|
|
39
|
+
const agent = await client.start(() => { });
|
|
40
40
|
const result = await new Promise((resolve) => {
|
|
41
41
|
const child = spawn(command, args, { env, stdio: ["pipe", "pipe", "pipe"], shell: false });
|
|
42
42
|
let stdout = "", stderr = "";
|