tribunal-kit 4.4.5 → 4.5.1
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/mcp-server.js +159 -0
- package/bin/tribunal-kit.js +1228 -1119
- package/bin/wrapper.js +16 -7
- package/mcp_config.json +11 -0
- package/package.json +14 -6
- package/scripts/changelog.js +4 -3
- package/scripts/validate-payload.js +6 -1
- package/scripts/postinstall.js +0 -127
package/bin/wrapper.js
CHANGED
|
@@ -21,14 +21,23 @@ const RUST_COMMANDS = new Set(['init', 'validate', 'status']);
|
|
|
21
21
|
function getBinaryPath() {
|
|
22
22
|
const isWindows = os.platform() === 'win32';
|
|
23
23
|
const ext = isWindows ? '.exe' : '';
|
|
24
|
+
const platform = os.platform();
|
|
25
|
+
const arch = os.arch();
|
|
24
26
|
|
|
25
|
-
// First,
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
// First, try production resolution (from optionalDependencies)
|
|
28
|
+
const pkgName = `@tribunal-kit/core-${platform}-${arch}`;
|
|
29
|
+
try {
|
|
30
|
+
// Try to resolve the binary from the optional dependency package
|
|
31
|
+
const pkgPath = require.resolve(`${pkgName}/package.json`);
|
|
32
|
+
const binPath = path.resolve(path.dirname(pkgPath), `bin/tribunal-core${ext}`);
|
|
33
|
+
if (fs.existsSync(binPath)) {
|
|
34
|
+
return binPath;
|
|
35
|
+
}
|
|
36
|
+
} catch (e) {
|
|
37
|
+
// Package not found, ignore and fall back to local dev targets
|
|
29
38
|
}
|
|
30
39
|
|
|
31
|
-
// Second, try to find the binary compiled from crates/core/Cargo.toml
|
|
40
|
+
// Second, try to find the binary compiled from crates/core/Cargo.toml (Local dev)
|
|
32
41
|
const devPath = path.resolve(__dirname, '..', 'target', 'release', `tribunal-core${ext}`);
|
|
33
42
|
if (fs.existsSync(devPath)) {
|
|
34
43
|
return devPath;
|
|
@@ -40,13 +49,13 @@ function getBinaryPath() {
|
|
|
40
49
|
return debugPath;
|
|
41
50
|
}
|
|
42
51
|
|
|
43
|
-
// Production resolution (from optionalDependencies) would go here
|
|
44
52
|
return null;
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
function runRustBinary(binPath, args) {
|
|
56
|
+
const stdio = ['inherit', process.stdout.isTTY ? 'ignore' : 'inherit', 'inherit'];
|
|
48
57
|
const result = spawnSync(binPath, args, {
|
|
49
|
-
stdio:
|
|
58
|
+
stdio: stdio,
|
|
50
59
|
env: process.env
|
|
51
60
|
});
|
|
52
61
|
|
package/mcp_config.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tribunal-kit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "Anti-Hallucination AI Agent Kit — 40 specialist agents, 32 slash commands, 16 parallel Tribunal reviewers, Performance Swarm engine, Supreme Court case law pipeline, and long-running agent harness.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"scripts/",
|
|
51
51
|
".agent/",
|
|
52
52
|
"README.md",
|
|
53
|
-
"LICENSE"
|
|
53
|
+
"LICENSE",
|
|
54
|
+
"mcp_config.json"
|
|
54
55
|
],
|
|
55
56
|
"engines": {
|
|
56
57
|
"node": ">=18.0.0"
|
|
@@ -65,13 +66,20 @@
|
|
|
65
66
|
"changelog:preview": "node scripts/changelog.js --preview",
|
|
66
67
|
"sync": "node scripts/sync-version.js",
|
|
67
68
|
"validate-payload": "node scripts/validate-payload.js",
|
|
68
|
-
"postinstall": "node scripts/postinstall.js",
|
|
69
69
|
"build": "echo 'No build step required for this project'"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
72
|
+
"eslint": "^9.1.1",
|
|
73
|
+
"jest": "^25.0.0",
|
|
74
|
+
"typescript": "^5.4.5"
|
|
75
|
+
},
|
|
76
|
+
"optionalDependencies": {
|
|
77
|
+
"@tribunal-kit/core-darwin-arm64": "^4.5.1",
|
|
78
|
+
"@tribunal-kit/core-darwin-x64": "^4.5.1",
|
|
79
|
+
"@tribunal-kit/core-linux-arm64": "^4.5.1",
|
|
80
|
+
"@tribunal-kit/core-linux-x64": "^4.5.1",
|
|
81
|
+
"@tribunal-kit/core-win32-arm64": "^4.5.1",
|
|
82
|
+
"@tribunal-kit/core-win32-x64": "^4.5.1"
|
|
75
83
|
},
|
|
76
84
|
"jest": {
|
|
77
85
|
"testMatch": [
|
package/scripts/changelog.js
CHANGED
|
@@ -56,13 +56,14 @@ function getLatestTag() {
|
|
|
56
56
|
|
|
57
57
|
function getCommits(since) {
|
|
58
58
|
const range = since ? `${since}..HEAD` : 'HEAD';
|
|
59
|
-
const
|
|
60
|
-
const
|
|
59
|
+
const MAX_COMMITS = 500;
|
|
60
|
+
const format = '--format=%H||%s||%an||%ai';
|
|
61
|
+
const raw = git(`log ${range} ${format} --no-merges -n ${MAX_COMMITS}`);
|
|
61
62
|
if (!raw) return [];
|
|
62
63
|
|
|
63
64
|
return raw.split('\n').filter(Boolean).map(line => {
|
|
64
65
|
const [hash, subject, author, date] = line.split('||');
|
|
65
|
-
return { hash: hash?.slice(0, 7), subject, author, date: date?.slice(0, 10) };
|
|
66
|
+
return { hash: hash?.replace(/^"/, '').slice(0, 7), subject, author, date: date?.replace(/"$/, '').slice(0, 10) };
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
|
|
@@ -3,7 +3,12 @@ const path = require('path');
|
|
|
3
3
|
|
|
4
4
|
// Simple Markdown frontmatter and Tribunal header validator
|
|
5
5
|
function validateMarkdownFile(filePath) {
|
|
6
|
-
|
|
6
|
+
let content;
|
|
7
|
+
try {
|
|
8
|
+
content = fs.readFileSync(filePath, 'utf8');
|
|
9
|
+
} catch (e) {
|
|
10
|
+
return [`Failed to read file: ${e.message}`];
|
|
11
|
+
}
|
|
7
12
|
let errors = [];
|
|
8
13
|
|
|
9
14
|
// Check for frontmatter
|
package/scripts/postinstall.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* postinstall.js — Binary Download Script
|
|
4
|
-
*
|
|
5
|
-
* After `npm install`, this script downloads the pre-compiled Rust binary
|
|
6
|
-
* for the user's platform from the latest GitHub Release.
|
|
7
|
-
*
|
|
8
|
-
* If the download fails (offline, unsupported platform, etc.), it's a soft failure.
|
|
9
|
-
* The wrapper.js will detect the missing binary and fall back to the JS engine.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const fs = require('fs');
|
|
13
|
-
const path = require('path');
|
|
14
|
-
const https = require('https');
|
|
15
|
-
const os = require('os');
|
|
16
|
-
const crypto = require('crypto');
|
|
17
|
-
|
|
18
|
-
const PKG = require(path.resolve(__dirname, '..', 'package.json'));
|
|
19
|
-
const VERSION = PKG.version;
|
|
20
|
-
|
|
21
|
-
const BINARY_DIR = path.resolve(__dirname, '..', 'bin');
|
|
22
|
-
const REPO = 'Harmitx7/tribunal-kit';
|
|
23
|
-
|
|
24
|
-
function getPlatformBinary() {
|
|
25
|
-
const platform = os.platform();
|
|
26
|
-
const arch = os.arch();
|
|
27
|
-
|
|
28
|
-
const map = {
|
|
29
|
-
'win32-x64': 'tribunal-core-win-x64.exe',
|
|
30
|
-
'win32-arm64': 'tribunal-core-win-arm64.exe',
|
|
31
|
-
'darwin-x64': 'tribunal-core-darwin-x64',
|
|
32
|
-
'darwin-arm64': 'tribunal-core-darwin-arm64',
|
|
33
|
-
'linux-x64': 'tribunal-core-linux-x64',
|
|
34
|
-
'linux-arm64': 'tribunal-core-linux-arm64',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const key = `${platform}-${arch}`;
|
|
38
|
-
return map[key] || null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function getLocalBinaryPath() {
|
|
42
|
-
const isWindows = os.platform() === 'win32';
|
|
43
|
-
return path.join(BINARY_DIR, `tribunal-core${isWindows ? '.exe' : ''}`);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function download(url) {
|
|
47
|
-
return new Promise((resolve, reject) => {
|
|
48
|
-
const request = https.get(url, { headers: { 'User-Agent': `tribunal-kit/${VERSION}` } }, (res) => {
|
|
49
|
-
// Handle redirects (GitHub sends 302 to the actual download URL)
|
|
50
|
-
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
51
|
-
download(res.headers.location).then(resolve).catch(reject);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (res.statusCode !== 200) {
|
|
56
|
-
reject(new Error(`HTTP ${res.statusCode}`));
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const chunks = [];
|
|
61
|
-
res.on('data', (chunk) => chunks.push(chunk));
|
|
62
|
-
res.on('end', () => resolve(Buffer.concat(chunks)));
|
|
63
|
-
res.on('error', reject);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
request.on('error', reject);
|
|
67
|
-
request.setTimeout(30000, () => { request.destroy(); reject(new Error('Timeout')); });
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async function main() {
|
|
72
|
-
const binaryName = getPlatformBinary();
|
|
73
|
-
|
|
74
|
-
if (!binaryName) {
|
|
75
|
-
console.log(`[tribunal-kit] No pre-built binary for ${os.platform()}-${os.arch()}. Using JS fallback.`);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const localPath = getLocalBinaryPath();
|
|
80
|
-
|
|
81
|
-
// Skip if binary already exists (e.g. dev environment with cargo build)
|
|
82
|
-
if (fs.existsSync(localPath)) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${binaryName}`;
|
|
87
|
-
const checksumsUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/checksums.txt`;
|
|
88
|
-
|
|
89
|
-
console.log(`[tribunal-kit] Downloading native binary for ${os.platform()}-${os.arch()}...`);
|
|
90
|
-
|
|
91
|
-
try {
|
|
92
|
-
// 1. Download checksums file
|
|
93
|
-
const checksumsData = await download(checksumsUrl);
|
|
94
|
-
const checksumsText = checksumsData.toString('utf-8');
|
|
95
|
-
|
|
96
|
-
// 2. Extract expected hash
|
|
97
|
-
const hashMatch = checksumsText.split('\n').find(line => line.includes(binaryName));
|
|
98
|
-
if (!hashMatch) {
|
|
99
|
-
throw new Error(`Checksum for ${binaryName} not found in checksums.txt`);
|
|
100
|
-
}
|
|
101
|
-
const expectedHash = hashMatch.split(' ')[0].trim();
|
|
102
|
-
|
|
103
|
-
// 3. Download binary
|
|
104
|
-
const data = await download(url);
|
|
105
|
-
|
|
106
|
-
// 4. Verify checksum
|
|
107
|
-
const actualHash = crypto.createHash('sha256').update(data).digest('hex');
|
|
108
|
-
if (actualHash !== expectedHash) {
|
|
109
|
-
throw new Error(`Checksum mismatch! Expected ${expectedHash}, got ${actualHash}. Potential tamper detected.`);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// 5. Write to disk
|
|
113
|
-
fs.writeFileSync(localPath, data);
|
|
114
|
-
|
|
115
|
-
// Make executable on Unix
|
|
116
|
-
if (os.platform() !== 'win32') {
|
|
117
|
-
fs.chmodSync(localPath, 0o755);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
console.log(`[tribunal-kit] Native binary installed and verified successfully.`);
|
|
121
|
-
} catch (e) {
|
|
122
|
-
// Soft failure — wrapper.js will use the JS engine
|
|
123
|
-
console.log(`[tribunal-kit] Binary download skipped (${e.message}). Using JS fallback.`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
main();
|