openmatrix 0.1.99 → 0.2.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/dist/agents/impl/coder-agent.js +42 -42
- package/dist/agents/impl/executor-agent.js +75 -75
- package/dist/agents/impl/planner-agent.js +63 -63
- package/dist/agents/impl/reviewer-agent.js +66 -66
- package/dist/agents/impl/tester-agent.js +56 -56
- package/dist/cli/commands/report.js +45 -45
- package/dist/cli/commands/start.js +163 -34
- package/dist/cli/commands/step.js +62 -35
- package/dist/orchestrator/ai-reviewer.d.ts +29 -1
- package/dist/orchestrator/ai-reviewer.js +312 -207
- package/dist/orchestrator/approval-manager.js +14 -13
- package/dist/orchestrator/executor.d.ts +10 -1
- package/dist/orchestrator/executor.js +56 -2
- package/dist/orchestrator/meeting-manager.js +32 -31
- package/dist/orchestrator/phase-executor.js +7 -5
- package/dist/orchestrator/scheduler.d.ts +8 -6
- package/dist/orchestrator/scheduler.js +53 -22
- package/dist/orchestrator/state-machine.js +2 -2
- package/dist/orchestrator/task-planner.d.ts +81 -2
- package/dist/orchestrator/task-planner.js +683 -122
- package/dist/storage/state-manager.d.ts +6 -0
- package/dist/storage/state-manager.js +28 -0
- package/package.json +55 -55
- package/scripts/build-check.js +19 -19
- package/scripts/install-skills.js +57 -57
- package/skills/approve.md +250 -250
- package/skills/auto.md +298 -298
- package/skills/meeting.md +324 -324
- package/skills/om.md +112 -112
- package/skills/openmatrix.md +112 -112
- package/skills/start.md +24 -1
- package/dist/cli/commands/upgrade.d.ts +0 -2
- package/dist/cli/commands/upgrade.js +0 -329
- package/dist/orchestrator/task-planner.old.d.ts +0 -87
- package/dist/orchestrator/task-planner.old.js +0 -444
|
@@ -9,8 +9,14 @@ export declare class StateManager {
|
|
|
9
9
|
*
|
|
10
10
|
* 使用 O_EXCL | O_CREAT 原子创建锁文件,Windows/Linux/macOS 均支持
|
|
11
11
|
* 支持可重入:同进程内嵌套调用(如 updateTask → updateTaskStatistics)直接执行
|
|
12
|
+
* 崩溃恢复:如果锁文件存在但持有者 PID 已不存在,则自动清理
|
|
12
13
|
*/
|
|
13
14
|
private withFileLock;
|
|
15
|
+
/**
|
|
16
|
+
* 尝试清理残留锁文件
|
|
17
|
+
* 如果锁文件持有者 PID 已不在进程表中,则删除锁文件
|
|
18
|
+
*/
|
|
19
|
+
private tryCleanStaleLock;
|
|
14
20
|
initialize(): Promise<void>;
|
|
15
21
|
getState(): Promise<GlobalState>;
|
|
16
22
|
updateState(updates: Partial<GlobalState>): Promise<void>;
|
|
@@ -23,6 +23,7 @@ class StateManager {
|
|
|
23
23
|
*
|
|
24
24
|
* 使用 O_EXCL | O_CREAT 原子创建锁文件,Windows/Linux/macOS 均支持
|
|
25
25
|
* 支持可重入:同进程内嵌套调用(如 updateTask → updateTaskStatistics)直接执行
|
|
26
|
+
* 崩溃恢复:如果锁文件存在但持有者 PID 已不存在,则自动清理
|
|
26
27
|
*/
|
|
27
28
|
async withFileLock(fn) {
|
|
28
29
|
// 可重入:同一进程内嵌套调用直接执行
|
|
@@ -40,6 +41,11 @@ class StateManager {
|
|
|
40
41
|
break;
|
|
41
42
|
}
|
|
42
43
|
catch {
|
|
44
|
+
// 锁文件已存在,检查是否是残留锁(持有者进程已不存在)
|
|
45
|
+
if (i === 0) {
|
|
46
|
+
await this.tryCleanStaleLock(lockPath);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
43
49
|
if (i === maxRetries - 1)
|
|
44
50
|
throw new Error('Cannot acquire state lock');
|
|
45
51
|
await new Promise(r => setTimeout(r, retryDelay));
|
|
@@ -54,6 +60,28 @@ class StateManager {
|
|
|
54
60
|
await (0, promises_1.unlink)(lockPath).catch(() => { });
|
|
55
61
|
}
|
|
56
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* 尝试清理残留锁文件
|
|
65
|
+
* 如果锁文件持有者 PID 已不在进程表中,则删除锁文件
|
|
66
|
+
*/
|
|
67
|
+
async tryCleanStaleLock(lockPath) {
|
|
68
|
+
try {
|
|
69
|
+
const content = await (0, promises_1.readFile)(lockPath, 'utf-8');
|
|
70
|
+
const pid = parseInt(content.trim(), 10);
|
|
71
|
+
if (!isNaN(pid)) {
|
|
72
|
+
try {
|
|
73
|
+
process.kill(pid, 0);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// 进程不存在,锁文件是残留的,删除它
|
|
77
|
+
await (0, promises_1.unlink)(lockPath).catch(() => { });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// 读取失败,不处理
|
|
83
|
+
}
|
|
84
|
+
}
|
|
57
85
|
async initialize() {
|
|
58
86
|
const existing = await this.store.readJson('state.json');
|
|
59
87
|
if (!existing) {
|
package/package.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "openmatrix",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "AI Agent task orchestration system with Claude Code Skills integration",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"bin": {
|
|
8
|
-
"openmatrix": "dist/cli/index.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist",
|
|
12
|
-
"skills",
|
|
13
|
-
"scripts",
|
|
14
|
-
"README.md"
|
|
15
|
-
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsc",
|
|
18
|
-
"dev": "tsx src/cli/index.ts",
|
|
19
|
-
"test": "vitest",
|
|
20
|
-
"postinstall": "node scripts/install-skills.js"
|
|
21
|
-
},
|
|
22
|
-
"keywords": [
|
|
23
|
-
"claude",
|
|
24
|
-
"claude-code",
|
|
25
|
-
"ai-agent",
|
|
26
|
-
"task-orchestration",
|
|
27
|
-
"automation",
|
|
28
|
-
"multi-agent"
|
|
29
|
-
],
|
|
30
|
-
"author": "",
|
|
31
|
-
"license": "MIT",
|
|
32
|
-
"type": "commonjs",
|
|
33
|
-
"repository": {
|
|
34
|
-
"type": "git",
|
|
35
|
-
"url": "git+https://github.com/bigfish1913/openmatrix.git"
|
|
36
|
-
},
|
|
37
|
-
"homepage": "https://github.com/bigfish1913/openmatrix#readme",
|
|
38
|
-
"bugs": {
|
|
39
|
-
"url": "https://github.com/bigfish1913/openmatrix/issues"
|
|
40
|
-
},
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"@types/node": "^22.0.0",
|
|
43
|
-
"chalk": "^5.6.2",
|
|
44
|
-
"chokidar": "^5.0.0",
|
|
45
|
-
"commander": "^14.0.3",
|
|
46
|
-
"typescript": "^5.3.3",
|
|
47
|
-
"winston": "^3.19.0"
|
|
48
|
-
},
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"vitest": "^1.6.0"
|
|
51
|
-
},
|
|
52
|
-
"engines": {
|
|
53
|
-
"node": ">=18.0.0"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "openmatrix",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "AI Agent task orchestration system with Claude Code Skills integration",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"openmatrix": "dist/cli/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"skills",
|
|
13
|
+
"scripts",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"dev": "tsx src/cli/index.ts",
|
|
19
|
+
"test": "vitest",
|
|
20
|
+
"postinstall": "node scripts/install-skills.js"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"claude",
|
|
24
|
+
"claude-code",
|
|
25
|
+
"ai-agent",
|
|
26
|
+
"task-orchestration",
|
|
27
|
+
"automation",
|
|
28
|
+
"multi-agent"
|
|
29
|
+
],
|
|
30
|
+
"author": "",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"type": "commonjs",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/bigfish1913/openmatrix.git"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/bigfish1913/openmatrix#readme",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/bigfish1913/openmatrix/issues"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@types/node": "^22.0.0",
|
|
43
|
+
"chalk": "^5.6.2",
|
|
44
|
+
"chokidar": "^5.0.0",
|
|
45
|
+
"commander": "^14.0.3",
|
|
46
|
+
"typescript": "^5.3.3",
|
|
47
|
+
"winston": "^3.19.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"vitest": "^1.6.0"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=18.0.0"
|
|
54
|
+
}
|
|
55
|
+
}
|
package/scripts/build-check.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
// Safe build script that checks if dependencies are available
|
|
2
|
-
const { existsSync } = require('fs');
|
|
3
|
-
const { execSync } = require('child_process');
|
|
4
|
-
|
|
5
|
-
// Check if we're in a git clone scenario (npm install from github)
|
|
6
|
-
// In this case, node_modules might not be fully populated yet
|
|
7
|
-
const tscPath = require.resolve('typescript').replace('lib/typescript.js', 'bin/tsc');
|
|
8
|
-
|
|
9
|
-
if (!existsSync(tscPath)) {
|
|
10
|
-
console.log('Skipping build: TypeScript not available yet');
|
|
11
|
-
process.exit(0);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
execSync(`node "${tscPath}"`, { stdio: 'inherit' });
|
|
16
|
-
} catch (e) {
|
|
17
|
-
console.log('Build failed, but continuing installation');
|
|
18
|
-
process.exit(0);
|
|
19
|
-
}
|
|
1
|
+
// Safe build script that checks if dependencies are available
|
|
2
|
+
const { existsSync } = require('fs');
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
// Check if we're in a git clone scenario (npm install from github)
|
|
6
|
+
// In this case, node_modules might not be fully populated yet
|
|
7
|
+
const tscPath = require.resolve('typescript').replace('lib/typescript.js', 'bin/tsc');
|
|
8
|
+
|
|
9
|
+
if (!existsSync(tscPath)) {
|
|
10
|
+
console.log('Skipping build: TypeScript not available yet');
|
|
11
|
+
process.exit(0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
execSync(`node "${tscPath}"`, { stdio: 'inherit' });
|
|
16
|
+
} catch (e) {
|
|
17
|
+
console.log('Build failed, but continuing installation');
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const os = require('os');
|
|
6
|
-
|
|
7
|
-
// Change to home directory to avoid cwd issues
|
|
8
|
-
process.chdir(os.homedir());
|
|
9
|
-
|
|
10
|
-
// Get the package skills directory - use the path relative to this script
|
|
11
|
-
const scriptDir = __dirname;
|
|
12
|
-
const skillsDir = path.join(scriptDir, '..', 'skills');
|
|
13
|
-
|
|
14
|
-
// Target directories for different AI coding tools
|
|
15
|
-
const targets = [
|
|
16
|
-
{
|
|
17
|
-
name: 'Claude Code',
|
|
18
|
-
dir: path.join(os.homedir(), '.claude', 'commands', 'om'),
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: 'OpenCode',
|
|
22
|
-
dir: path.join(os.homedir(), '.config', 'opencode', 'commands', 'om'),
|
|
23
|
-
},
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
if (!fs.existsSync(skillsDir)) {
|
|
27
|
-
console.log('Skills directory not found, skipping installation.');
|
|
28
|
-
process.exit(0);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const files = fs.readdirSync(skillsDir).filter(f => f.endsWith('.md'));
|
|
32
|
-
|
|
33
|
-
for (const target of targets) {
|
|
34
|
-
try {
|
|
35
|
-
// Create commands directory if it doesn't exist
|
|
36
|
-
if (!fs.existsSync(target.dir)) {
|
|
37
|
-
fs.mkdirSync(target.dir, { recursive: true });
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let installed = 0;
|
|
41
|
-
for (const file of files) {
|
|
42
|
-
const src = path.join(skillsDir, file);
|
|
43
|
-
const dest = path.join(target.dir, file);
|
|
44
|
-
try {
|
|
45
|
-
fs.copyFileSync(src, dest);
|
|
46
|
-
installed++;
|
|
47
|
-
} catch (copyErr) {
|
|
48
|
-
console.log(` ⚠️ Skipped: ${file} (${copyErr.message})`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
console.log(`✅ ${target.name}: ${installed} skills installed to ${target.dir}`);
|
|
53
|
-
} catch (err) {
|
|
54
|
-
console.log(`⚠️ ${target.name}: skipped (${err.message})`);
|
|
55
|
-
console.log(` Please run: mkdir -p ${target.dir}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
// Change to home directory to avoid cwd issues
|
|
8
|
+
process.chdir(os.homedir());
|
|
9
|
+
|
|
10
|
+
// Get the package skills directory - use the path relative to this script
|
|
11
|
+
const scriptDir = __dirname;
|
|
12
|
+
const skillsDir = path.join(scriptDir, '..', 'skills');
|
|
13
|
+
|
|
14
|
+
// Target directories for different AI coding tools
|
|
15
|
+
const targets = [
|
|
16
|
+
{
|
|
17
|
+
name: 'Claude Code',
|
|
18
|
+
dir: path.join(os.homedir(), '.claude', 'commands', 'om'),
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'OpenCode',
|
|
22
|
+
dir: path.join(os.homedir(), '.config', 'opencode', 'commands', 'om'),
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
if (!fs.existsSync(skillsDir)) {
|
|
27
|
+
console.log('Skills directory not found, skipping installation.');
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const files = fs.readdirSync(skillsDir).filter(f => f.endsWith('.md'));
|
|
32
|
+
|
|
33
|
+
for (const target of targets) {
|
|
34
|
+
try {
|
|
35
|
+
// Create commands directory if it doesn't exist
|
|
36
|
+
if (!fs.existsSync(target.dir)) {
|
|
37
|
+
fs.mkdirSync(target.dir, { recursive: true });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let installed = 0;
|
|
41
|
+
for (const file of files) {
|
|
42
|
+
const src = path.join(skillsDir, file);
|
|
43
|
+
const dest = path.join(target.dir, file);
|
|
44
|
+
try {
|
|
45
|
+
fs.copyFileSync(src, dest);
|
|
46
|
+
installed++;
|
|
47
|
+
} catch (copyErr) {
|
|
48
|
+
console.log(` ⚠️ Skipped: ${file} (${copyErr.message})`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
console.log(`✅ ${target.name}: ${installed} skills installed to ${target.dir}`);
|
|
53
|
+
} catch (err) {
|
|
54
|
+
console.log(`⚠️ ${target.name}: skipped (${err.message})`);
|
|
55
|
+
console.log(` Please run: mkdir -p ${target.dir}`);
|
|
56
|
+
}
|
|
57
|
+
}
|