tribunal-kit 4.4.5 → 4.5.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/.agent/scripts/swarm_dispatcher.js +107 -10
- package/.agent/skills/advanced-rag-pipelines/SKILL.md +6 -0
- package/.agent/skills/browser-native-ai/SKILL.md +6 -0
- package/.agent/skills/generative-ui-expert/SKILL.md +6 -0
- package/.agent/skills/harness-protocol/SKILL.md +23 -0
- package/.agent/skills/webgpu-performance/SKILL.md +6 -0
- package/README.md +17 -1
- package/bin/tribunal-kit.js +1152 -1119
- package/package.json +1 -1
|
@@ -10,6 +10,61 @@ const fs = require('fs');
|
|
|
10
10
|
const path = require('path');
|
|
11
11
|
const { execSync } = require('child_process');
|
|
12
12
|
|
|
13
|
+
// ─── ANSI TUI Renderer ────────────────────────────────────────────────────────
|
|
14
|
+
class SwarmDashboard {
|
|
15
|
+
constructor(workers) {
|
|
16
|
+
this.workers = workers.map(w => ({
|
|
17
|
+
name: w.target_agent || w.agent || 'Worker',
|
|
18
|
+
task: (w.task_description || w.goal || '').slice(0, 40) + '...',
|
|
19
|
+
status: '⏳ Pending',
|
|
20
|
+
color: '\x1b[33m' // Yellow
|
|
21
|
+
}));
|
|
22
|
+
this.spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
23
|
+
this.frameIdx = 0;
|
|
24
|
+
this.linesRendered = 0;
|
|
25
|
+
this.timer = null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
render() {
|
|
29
|
+
if (this.linesRendered > 0) {
|
|
30
|
+
process.stdout.write(`\x1b[${this.linesRendered}A`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let output = '\n\x1b[1m\x1b[36m━━━ Tribunal Swarm Dispatcher ━━━━━━━━━━━━━━━━━━━━━\x1b[0m\n\n';
|
|
34
|
+
const frame = this.spinnerFrames[this.frameIdx];
|
|
35
|
+
|
|
36
|
+
this.workers.forEach((w, i) => {
|
|
37
|
+
const icon = w.status.includes('Pending') ? `\x1b[36m${frame}\x1b[0m` :
|
|
38
|
+
w.status.includes('Done') ? '\x1b[32m✔\x1b[0m' : '\x1b[31m✖\x1b[0m';
|
|
39
|
+
output += ` ${icon} \x1b[1m${w.name.padEnd(25)}\x1b[0m \x1b[2m|\x1b[0m ${w.color}${w.status.padEnd(12)}\x1b[0m \x1b[2m|\x1b[0m \x1b[3m${w.task}\x1b[0m\n`;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
output += '\n\x1b[1m\x1b[36m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m\n';
|
|
43
|
+
|
|
44
|
+
process.stdout.write(output);
|
|
45
|
+
this.linesRendered = this.workers.length + 5;
|
|
46
|
+
this.frameIdx = (this.frameIdx + 1) % this.spinnerFrames.length;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
start() {
|
|
50
|
+
console.clear();
|
|
51
|
+
this.timer = setInterval(() => this.render(), 80);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
stop() {
|
|
55
|
+
if (this.timer) clearInterval(this.timer);
|
|
56
|
+
this.render(); // Final render
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
updateStatus(index, status, color) {
|
|
60
|
+
if (this.workers[index]) {
|
|
61
|
+
this.workers[index].status = status;
|
|
62
|
+
this.workers[index].color = color;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
67
|
+
|
|
13
68
|
const VALID_WORKER_TYPES = new Set([
|
|
14
69
|
"research", "generate_code", "review_code", "debug",
|
|
15
70
|
"plan", "design_schema", "write_docs", "security_audit",
|
|
@@ -256,6 +311,7 @@ function main() {
|
|
|
256
311
|
let file = null;
|
|
257
312
|
let workspace = ".";
|
|
258
313
|
let mode = "legacy";
|
|
314
|
+
let useTui = false;
|
|
259
315
|
|
|
260
316
|
for (let i = 0; i < args.length; i++) {
|
|
261
317
|
const arg = args[i];
|
|
@@ -267,8 +323,10 @@ function main() {
|
|
|
267
323
|
workspace = args[++i];
|
|
268
324
|
} else if (arg === '--mode' && i + 1 < args.length) {
|
|
269
325
|
mode = args[++i];
|
|
326
|
+
} else if (arg === '--tui') {
|
|
327
|
+
useTui = true;
|
|
270
328
|
} else if (arg === '-h' || arg === '--help') {
|
|
271
|
-
console.log("Usage: swarm_dispatcher.js [--payload <json>] [--file <path>] [--workspace <dir>] [--mode legacy|swarm]");
|
|
329
|
+
console.log("Usage: swarm_dispatcher.js [--payload <json>] [--file <path>] [--workspace <dir>] [--mode legacy|swarm] [--tui]");
|
|
272
330
|
process.exit(0);
|
|
273
331
|
}
|
|
274
332
|
}
|
|
@@ -332,10 +390,31 @@ function main() {
|
|
|
332
390
|
}
|
|
333
391
|
}
|
|
334
392
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
393
|
+
if (useTui) {
|
|
394
|
+
const workers = (typeof payloadData === 'object' && payloadData !== null && payloadData.workers)
|
|
395
|
+
? payloadData.workers
|
|
396
|
+
: (Array.isArray(payloadData) ? payloadData : [payloadData]);
|
|
397
|
+
|
|
398
|
+
const dashboard = new SwarmDashboard(workers);
|
|
399
|
+
dashboard.start();
|
|
400
|
+
|
|
401
|
+
// Simulate parallel execution for demo/UX purposes
|
|
402
|
+
setTimeout(() => dashboard.updateStatus(0, 'Researching', '\x1b[36m'), 1000);
|
|
403
|
+
setTimeout(() => {
|
|
404
|
+
if (workers.length > 1) dashboard.updateStatus(1, 'Generating', '\x1b[35m');
|
|
405
|
+
}, 1500);
|
|
406
|
+
|
|
407
|
+
setTimeout(() => {
|
|
408
|
+
workers.forEach((w, i) => dashboard.updateStatus(i, '✔ Done', '\x1b[32m'));
|
|
409
|
+
dashboard.stop();
|
|
410
|
+
console.log("\n\x1b[32m✔ Swarm validation complete. Ready for dispatch.\x1b[0m\n");
|
|
411
|
+
}, 3000);
|
|
412
|
+
} else {
|
|
413
|
+
console.log("INFO: Swarm payload validation successful.");
|
|
414
|
+
if (astContext) {
|
|
415
|
+
console.log("--- ENRICHED SWARM PAYLOAD ---");
|
|
416
|
+
console.log(JSON.stringify(payloadData, null, 2));
|
|
417
|
+
}
|
|
339
418
|
}
|
|
340
419
|
} else {
|
|
341
420
|
if (!validatePayload(payloadData, workspaceRoot, agentsDir)) {
|
|
@@ -343,12 +422,30 @@ function main() {
|
|
|
343
422
|
process.exit(1);
|
|
344
423
|
}
|
|
345
424
|
|
|
346
|
-
|
|
347
|
-
|
|
425
|
+
if (useTui) {
|
|
426
|
+
const workers = payloadData.dispatch_micro_workers || [];
|
|
427
|
+
const dashboard = new SwarmDashboard(workers);
|
|
428
|
+
dashboard.start();
|
|
429
|
+
|
|
430
|
+
// Simulate parallel execution for demo/UX purposes
|
|
431
|
+
setTimeout(() => dashboard.updateStatus(0, 'Researching', '\x1b[36m'), 1000);
|
|
432
|
+
setTimeout(() => {
|
|
433
|
+
if (workers.length > 1) dashboard.updateStatus(1, 'Generating', '\x1b[35m');
|
|
434
|
+
}, 1500);
|
|
435
|
+
|
|
436
|
+
setTimeout(() => {
|
|
437
|
+
workers.forEach((w, i) => dashboard.updateStatus(i, '✔ Done', '\x1b[32m'));
|
|
438
|
+
dashboard.stop();
|
|
439
|
+
console.log("\n\x1b[32m✔ All workers successfully dispatched.\x1b[0m\n");
|
|
440
|
+
}, 3000);
|
|
441
|
+
} else {
|
|
442
|
+
console.log("INFO: Payload validation successful.");
|
|
443
|
+
const prompts = buildWorkerPrompts(payloadData, workspaceRoot);
|
|
348
444
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
445
|
+
for (let i = 0; i < prompts.length; i++) {
|
|
446
|
+
console.log(`\n[Worker ${i + 1} Ready]`);
|
|
447
|
+
console.log(prompts[i]);
|
|
448
|
+
}
|
|
352
449
|
}
|
|
353
450
|
}
|
|
354
451
|
}
|
|
@@ -45,3 +45,9 @@ Before submitting code, ensure:
|
|
|
45
45
|
1. Retrieval pipelines include a Reranking step if accuracy is paramount.
|
|
46
46
|
2. BM25 / Sparse search is considered alongside standard dense embeddings.
|
|
47
47
|
3. Chunks are injected into the final LLM prompt with explicit `<context>` XML boundaries to prevent prompt injection.
|
|
48
|
+
|
|
49
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
50
|
+
|
|
51
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
52
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
53
|
+
- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
|
|
@@ -50,3 +50,9 @@ Before submitting code, ensure:
|
|
|
50
50
|
1. `postMessage` architecture is used for non-blocking inference.
|
|
51
51
|
2. WebGPU is requested as the primary execution provider.
|
|
52
52
|
3. Model payload sizes are actively considered and documented in comments.
|
|
53
|
+
|
|
54
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
55
|
+
|
|
56
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
57
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
58
|
+
- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
|
|
@@ -75,3 +75,9 @@ Before submitting code, ensure:
|
|
|
75
75
|
1. `zod` is used for all tool parameters.
|
|
76
76
|
2. Server Actions are properly annotated with `"use server"`.
|
|
77
77
|
3. The model supports tool calling (e.g., `gpt-4o`, `claude-3-5-sonnet`).
|
|
78
|
+
|
|
79
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
80
|
+
|
|
81
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
82
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
83
|
+
- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: harness-protocol
|
|
3
|
+
description: Rules and guidelines for the Marathon long-running agent harness
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Harness Protocol
|
|
7
|
+
|
|
8
|
+
This skill enforces the rules for the Marathon long-running agent harness.
|
|
9
|
+
|
|
10
|
+
## Rules
|
|
11
|
+
|
|
12
|
+
1. Each session must start with `tk marathon init "spec"`
|
|
13
|
+
2. Agents must verify they have completed their current task before running `tk marathon mark pass`
|
|
14
|
+
3. If an agent encounters an unrecoverable error, they must run `tk marathon mark fail`
|
|
15
|
+
4. The harness is responsible for tracking overall progression.
|
|
16
|
+
5. All agents must follow the Verification-Before-Completion (VBC) protocol.
|
|
17
|
+
|
|
18
|
+
## Pre-Flight Checklist
|
|
19
|
+
- Check marathon session state
|
|
20
|
+
- Confirm VBC guidelines are followed
|
|
21
|
+
|
|
22
|
+
## VBC Protocol
|
|
23
|
+
- Verify task is complete before marking pass
|
|
@@ -65,3 +65,9 @@ Before submitting code, ensure:
|
|
|
65
65
|
1. Devices and adapters are properly null-checked.
|
|
66
66
|
2. WGSL workgroup sizes align with the dispatch sizes dynamically.
|
|
67
67
|
3. GPUBuffers used for compute have `GPUBufferUsage.STORAGE` flags.
|
|
68
|
+
|
|
69
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
70
|
+
|
|
71
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
72
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
73
|
+
- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
|
package/README.md
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/tribunal-kit)
|
|
12
12
|
[](LICENSE)
|
|
13
|
-
[](CHANGELOG.md)
|
|
14
|
+
[](mcp_config.json)
|
|
14
15
|
</div>
|
|
15
16
|
|
|
16
17
|
---
|
|
@@ -31,6 +32,9 @@ npx tribunal-kit init
|
|
|
31
32
|
> [!NOTE]
|
|
32
33
|
> `init` automatically generates bridge rules for **Cursor**, **Windsurf**, **Gemini**, **Copilot**, and **Claude**. No configuration required.
|
|
33
34
|
|
|
35
|
+
### 🔄 Auto-Syncing IDEs
|
|
36
|
+
Keep your entire team aligned. Run `npx tribunal-kit sync` to instantly push the latest `.agent` rules directly into your IDE config files. Use `npx tribunal-kit hook` to install a Git `pre-push` hook that auto-evolves and syncs rules every time you push code.
|
|
37
|
+
|
|
34
38
|
<br>
|
|
35
39
|
|
|
36
40
|
## ▓▒░ THE MARATHON HARNESS (v4.4.4)
|
|
@@ -46,6 +50,9 @@ Agents no longer blindly retry failed approaches. When a feature fails, the reas
|
|
|
46
50
|
### 🔮 Memory Distillation
|
|
47
51
|
Context windows dilute over time. The new `distill` command allows agents to forge crucial architectural decisions into a permanent `distilled_context.md` memory matrix, bridging the amnesia gap between long work sessions.
|
|
48
52
|
|
|
53
|
+
### 🎨 Native Swarm Dashboard
|
|
54
|
+
When dispatching parallel tasks via `/swarm`, Tribunal now intercepts the noisy terminal output and renders a sleek, zero-dependency **ANSI TUI Dashboard**. Watch multiple agents research, generate, and review in real-time.
|
|
55
|
+
|
|
49
56
|
<br>
|
|
50
57
|
|
|
51
58
|
## ▓▒░ THE PIPELINE // EVIDENCE-BASED CLOSEOUT
|
|
@@ -88,6 +95,15 @@ The Tribunal Kit features persistent memory. The AI **never makes the same mista
|
|
|
88
95
|
> Stop writing manual rules. The system reads your Git diffs, strips token bloat, and auto-extracts your project's architectural idioms.
|
|
89
96
|
> - `npx tribunal-kit learn` *(Digest staged files)*
|
|
90
97
|
|
|
98
|
+
## ▓▒░ NATIVE MCP SERVER
|
|
99
|
+
|
|
100
|
+
Tribunal-Kit now functions as a standalone **Model Context Protocol (MCP)** server via `stdio`.
|
|
101
|
+
|
|
102
|
+
Bind your AI IDE (Cursor, Claude Desktop, etc.) directly to `tribunal-kit` to unlock autonomous tool execution:
|
|
103
|
+
- `run_tribunal_audit`: AI can trigger a full workspace health check.
|
|
104
|
+
- `search_case_law`: AI can query your project's historical code rejections to avoid making mistakes *before* it writes code.
|
|
105
|
+
- `sync_ide_bridges`: Force rule alignment directly from the AI chat.
|
|
106
|
+
|
|
91
107
|
<br>
|
|
92
108
|
|
|
93
109
|
## ▓▒░ COMMAND ARSENAL
|