@cloudpftc/opencode-orchestrator 3.5.15 → 3.6.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/.opencode/helpers/auto-memory-hook.mjs +104 -0
- package/.opencode/helpers/hook-handler.cjs +223 -0
- package/.opencode/helpers/intelligence.cjs +197 -0
- package/.opencode/helpers/memory.js +83 -0
- package/.opencode/helpers/post-commit +16 -0
- package/.opencode/helpers/pre-commit +26 -0
- package/.opencode/helpers/router.js +66 -0
- package/.opencode/helpers/session.js +127 -0
- package/.opencode/helpers/statusline.cjs +774 -0
- package/.opencode/settings.json +319 -0
- package/opencode.json +35 -78
- package/package.json +2 -6
- package/v3/@claude-flow/cli/README.md +391 -534
- package/v3/@claude-flow/cli/dist/src/commands/benchmark.js +2 -2
- package/v3/@claude-flow/cli/dist/src/commands/claims.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/config.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/daemon.js +3 -3
- package/v3/@claude-flow/cli/dist/src/commands/deployment.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/doctor.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/embeddings.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/hooks.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/init.js +16 -16
- package/v3/@claude-flow/cli/dist/src/commands/neural.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/performance.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/plugins.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/providers.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/security.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/start.js +10 -10
- package/v3/@claude-flow/cli/dist/src/commands/status.js +2 -2
- package/v3/@claude-flow/cli/dist/src/commands/transfer-store.js +1 -1
- package/v3/@claude-flow/cli/dist/src/init/executor.js +181 -133
- package/v3/@claude-flow/cli/dist/src/init/helpers-generator.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +20 -20
- package/v3/@claude-flow/cli/dist/src/init/index.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/init/index.js +1 -1
- package/v3/@claude-flow/cli/dist/src/init/mcp-generator.d.ts +2 -2
- package/v3/@claude-flow/cli/dist/src/init/mcp-generator.js +15 -15
- package/v3/@claude-flow/cli/dist/src/init/opencode-generator.d.ts +42 -0
- package/v3/@claude-flow/cli/dist/src/init/opencode-generator.js +107 -0
- package/v3/@claude-flow/cli/dist/src/init/settings-generator.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/init/settings-generator.js +18 -18
- package/v3/@claude-flow/cli/dist/src/init/{claudemd-generator.d.ts → skillmd-generator.d.ts} +8 -8
- package/v3/@claude-flow/cli/dist/src/init/{claudemd-generator.js → skillmd-generator.js} +9 -9
- package/v3/@claude-flow/cli/dist/src/init/statusline-generator.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +39 -23
- package/v3/@claude-flow/cli/dist/src/init/types.d.ts +14 -10
- package/v3/@claude-flow/cli/dist/src/init/types.js +3 -3
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +1 -1
- package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.js +1 -1
- package/v3/@claude-flow/cli/dist/src/runtime/headless.js +3 -3
- package/v3/@claude-flow/cli/dist/src/services/claim-service.js +1 -1
- package/v3/@claude-flow/cli/dist/src/types.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/types.js +1 -1
- package/v3/@claude-flow/cli/package.json +1 -1
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/**
|
|
13
13
|
* Generate optimized statusline script
|
|
14
14
|
* Output format:
|
|
15
|
-
* ▊
|
|
15
|
+
* ▊ OpenCode Orchestrator ● user │ ⎇ branch │ Opus 4.6
|
|
16
16
|
* ─────────────────────────────────────────────────────
|
|
17
17
|
* 🏗️ DDD Domains [●●○○○] 2/5 ⚡ HNSW 150x
|
|
18
18
|
* 🤖 Swarm ◉ [ 5/15] 👥 2 🪝 10/17 🟢 CVE 3/3 💾 4MB 🧠 63%
|
|
@@ -23,7 +23,7 @@ export function generateStatuslineScript(options) {
|
|
|
23
23
|
const maxAgents = options.runtime.maxAgents;
|
|
24
24
|
return `#!/usr/bin/env node
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* OpenCode Orchestrator Statusline Generator (Optimized)
|
|
27
27
|
* Displays real-time V3 implementation progress and system status
|
|
28
28
|
*
|
|
29
29
|
* Usage: node statusline.cjs [--json] [--compact]
|
|
@@ -104,7 +104,9 @@ function safeStat(filePath) {
|
|
|
104
104
|
let _settingsCache = undefined;
|
|
105
105
|
function getSettings() {
|
|
106
106
|
if (_settingsCache !== undefined) return _settingsCache;
|
|
107
|
-
_settingsCache = readJSON(path.join(CWD, '.
|
|
107
|
+
_settingsCache = readJSON(path.join(CWD, 'opencode.json'))
|
|
108
|
+
|| readJSON(path.join(CWD, '.opencode', 'settings.json'))
|
|
109
|
+
|| readJSON(path.join(CWD, '.claude', 'settings.json'))
|
|
108
110
|
|| readJSON(path.join(CWD, '.claude', 'settings.local.json'))
|
|
109
111
|
|| null;
|
|
110
112
|
return _settingsCache;
|
|
@@ -202,6 +204,7 @@ function getModelName() {
|
|
|
202
204
|
function getLearningStats() {
|
|
203
205
|
const memoryPaths = [
|
|
204
206
|
path.join(CWD, '.swarm', 'memory.db'),
|
|
207
|
+
path.join(CWD, '.opencode', 'memory.db'),
|
|
205
208
|
path.join(CWD, '.claude-flow', 'memory.db'),
|
|
206
209
|
path.join(CWD, '.claude', 'memory.db'),
|
|
207
210
|
path.join(CWD, 'data', 'memory.db'),
|
|
@@ -237,7 +240,8 @@ function getV3Progress() {
|
|
|
237
240
|
const learning = getLearningStats();
|
|
238
241
|
const totalDomains = 5;
|
|
239
242
|
|
|
240
|
-
const dddData = readJSON(path.join(CWD, '.
|
|
243
|
+
const dddData = readJSON(path.join(CWD, '.opencode', 'metrics', 'ddd-progress.json'))
|
|
244
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'ddd-progress.json'));
|
|
241
245
|
let dddProgress = dddData ? (dddData.progress || 0) : 0;
|
|
242
246
|
let domainsCompleted = Math.min(5, Math.floor(dddProgress / 20));
|
|
243
247
|
|
|
@@ -260,7 +264,8 @@ function getV3Progress() {
|
|
|
260
264
|
// Security status (pure file reads)
|
|
261
265
|
function getSecurityStatus() {
|
|
262
266
|
const totalCves = 3;
|
|
263
|
-
const auditData = readJSON(path.join(CWD, '.
|
|
267
|
+
const auditData = readJSON(path.join(CWD, '.opencode', 'security', 'audit-status.json'))
|
|
268
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'security', 'audit-status.json'));
|
|
264
269
|
if (auditData) {
|
|
265
270
|
return {
|
|
266
271
|
status: auditData.status || 'PENDING',
|
|
@@ -286,7 +291,8 @@ function getSecurityStatus() {
|
|
|
286
291
|
|
|
287
292
|
// Swarm status (pure file reads, NO ps aux)
|
|
288
293
|
function getSwarmStatus() {
|
|
289
|
-
const activityData = readJSON(path.join(CWD, '.
|
|
294
|
+
const activityData = readJSON(path.join(CWD, '.opencode', 'metrics', 'swarm-activity.json'))
|
|
295
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'swarm-activity.json'));
|
|
290
296
|
if (activityData && activityData.swarm) {
|
|
291
297
|
return {
|
|
292
298
|
activeAgents: activityData.swarm.agent_count || 0,
|
|
@@ -295,7 +301,8 @@ function getSwarmStatus() {
|
|
|
295
301
|
};
|
|
296
302
|
}
|
|
297
303
|
|
|
298
|
-
const progressData = readJSON(path.join(CWD, '.
|
|
304
|
+
const progressData = readJSON(path.join(CWD, '.opencode', 'metrics', 'v3-progress.json'))
|
|
305
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'v3-progress.json'));
|
|
299
306
|
if (progressData && progressData.swarm) {
|
|
300
307
|
return {
|
|
301
308
|
activeAgents: progressData.swarm.activeAgents || progressData.swarm.agent_count || 0,
|
|
@@ -314,7 +321,8 @@ function getSystemMetrics() {
|
|
|
314
321
|
const agentdb = getAgentDBStats();
|
|
315
322
|
|
|
316
323
|
// Intelligence from learning.json
|
|
317
|
-
const learningData = readJSON(path.join(CWD, '.
|
|
324
|
+
const learningData = readJSON(path.join(CWD, '.opencode', 'metrics', 'learning.json'))
|
|
325
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'learning.json'));
|
|
318
326
|
let intelligencePct = 0;
|
|
319
327
|
let contextPct = 0;
|
|
320
328
|
|
|
@@ -347,7 +355,8 @@ function getSystemMetrics() {
|
|
|
347
355
|
|
|
348
356
|
// Sub-agents from file metrics (no ps aux)
|
|
349
357
|
let subAgents = 0;
|
|
350
|
-
const activityData = readJSON(path.join(CWD, '.
|
|
358
|
+
const activityData = readJSON(path.join(CWD, '.opencode', 'metrics', 'swarm-activity.json'))
|
|
359
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'swarm-activity.json'));
|
|
351
360
|
if (activityData && activityData.processes && activityData.processes.estimated_agents) {
|
|
352
361
|
subAgents = activityData.processes.estimated_agents;
|
|
353
362
|
}
|
|
@@ -357,7 +366,8 @@ function getSystemMetrics() {
|
|
|
357
366
|
|
|
358
367
|
// ADR status (count files only — don't read contents)
|
|
359
368
|
function getADRStatus() {
|
|
360
|
-
const complianceData = readJSON(path.join(CWD, '.
|
|
369
|
+
const complianceData = readJSON(path.join(CWD, '.opencode', 'metrics', 'adr-compliance.json'))
|
|
370
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'adr-compliance.json'));
|
|
361
371
|
if (complianceData) {
|
|
362
372
|
const checks = complianceData.checks || {};
|
|
363
373
|
const total = Object.keys(checks).length;
|
|
@@ -369,6 +379,7 @@ function getADRStatus() {
|
|
|
369
379
|
const adrPaths = [
|
|
370
380
|
path.join(CWD, 'v3', 'implementation', 'adrs'),
|
|
371
381
|
path.join(CWD, 'docs', 'adrs'),
|
|
382
|
+
path.join(CWD, '.opencode', 'adrs'),
|
|
372
383
|
path.join(CWD, '.claude-flow', 'adrs'),
|
|
373
384
|
];
|
|
374
385
|
|
|
@@ -402,7 +413,7 @@ function getHooksStatus() {
|
|
|
402
413
|
}
|
|
403
414
|
|
|
404
415
|
try {
|
|
405
|
-
const hooksDir = path.join(CWD, '.
|
|
416
|
+
const hooksDir = path.join(CWD, '.opencode', 'hooks');
|
|
406
417
|
if (fs.existsSync(hooksDir)) {
|
|
407
418
|
const hookFiles = fs.readdirSync(hooksDir).filter(f => f.endsWith('.js') || f.endsWith('.sh')).length;
|
|
408
419
|
enabled = Math.max(enabled, hookFiles);
|
|
@@ -421,6 +432,7 @@ function getAgentDBStats() {
|
|
|
421
432
|
|
|
422
433
|
const dbFiles = [
|
|
423
434
|
path.join(CWD, '.swarm', 'memory.db'),
|
|
435
|
+
path.join(CWD, '.opencode', 'memory.db'),
|
|
424
436
|
path.join(CWD, '.claude-flow', 'memory.db'),
|
|
425
437
|
path.join(CWD, '.claude', 'memory.db'),
|
|
426
438
|
path.join(CWD, 'data', 'memory.db'),
|
|
@@ -438,6 +450,7 @@ function getAgentDBStats() {
|
|
|
438
450
|
|
|
439
451
|
if (vectorCount === 0) {
|
|
440
452
|
const dbDirs = [
|
|
453
|
+
path.join(CWD, '.opencode', 'agentdb'),
|
|
441
454
|
path.join(CWD, '.claude-flow', 'agentdb'),
|
|
442
455
|
path.join(CWD, '.swarm', 'agentdb'),
|
|
443
456
|
path.join(CWD, '.agentdb'),
|
|
@@ -459,6 +472,7 @@ function getAgentDBStats() {
|
|
|
459
472
|
}
|
|
460
473
|
|
|
461
474
|
const hnswPaths = [
|
|
475
|
+
path.join(CWD, '.opencode', 'hnsw.index'),
|
|
462
476
|
path.join(CWD, '.swarm', 'hnsw.index'),
|
|
463
477
|
path.join(CWD, '.claude-flow', 'hnsw.index'),
|
|
464
478
|
];
|
|
@@ -520,7 +534,9 @@ function getIntegrationStatus() {
|
|
|
520
534
|
}
|
|
521
535
|
|
|
522
536
|
if (mcpServers.total === 0) {
|
|
523
|
-
const mcpConfig = readJSON(path.join(CWD, '.
|
|
537
|
+
const mcpConfig = readJSON(path.join(CWD, 'opencode.json'))
|
|
538
|
+
|| readJSON(path.join(CWD, '.mcp.json'))
|
|
539
|
+
|| readJSON(path.join(os.homedir(), '.opencode', 'mcp.json'))
|
|
524
540
|
|| readJSON(path.join(os.homedir(), '.claude', 'mcp.json'));
|
|
525
541
|
if (mcpConfig && mcpConfig.mcpServers) {
|
|
526
542
|
const s = Object.keys(mcpConfig.mcpServers);
|
|
@@ -529,7 +545,7 @@ function getIntegrationStatus() {
|
|
|
529
545
|
}
|
|
530
546
|
}
|
|
531
547
|
|
|
532
|
-
const hasDatabase = ['.swarm/memory.db', '.claude-flow/memory.db', 'data/memory.db']
|
|
548
|
+
const hasDatabase = ['.opencode/memory.db', '.swarm/memory.db', '.claude-flow/memory.db', 'data/memory.db']
|
|
533
549
|
.some(p => fs.existsSync(path.join(CWD, p)));
|
|
534
550
|
const hasApi = !!(process.env.ANTHROPIC_API_KEY || process.env.OPENAI_API_KEY);
|
|
535
551
|
|
|
@@ -538,7 +554,7 @@ function getIntegrationStatus() {
|
|
|
538
554
|
|
|
539
555
|
// Session stats (pure file reads)
|
|
540
556
|
function getSessionStats() {
|
|
541
|
-
var sessionPaths = ['.claude-flow/session.json', '.claude/session.json'];
|
|
557
|
+
var sessionPaths = ['.opencode/session.json', '.claude-flow/session.json', '.claude/session.json'];
|
|
542
558
|
for (var i = 0; i < sessionPaths.length; i++) {
|
|
543
559
|
const data = readJSON(path.join(CWD, sessionPaths[i]));
|
|
544
560
|
if (data && data.startTime) {
|
|
@@ -578,7 +594,7 @@ function generateStatusline() {
|
|
|
578
594
|
const lines = [];
|
|
579
595
|
|
|
580
596
|
// Header
|
|
581
|
-
let header = c.bold + c.brightPurple + '\\u258A
|
|
597
|
+
let header = c.bold + c.brightPurple + '\\u258A OpenCode V3 ' + c.reset;
|
|
582
598
|
header += (swarm.coordinationActive ? c.brightCyan : c.dim) + '\\u25CF ' + c.brightCyan + git.name + c.reset;
|
|
583
599
|
if (git.gitBranch) {
|
|
584
600
|
header += ' ' + c.dim + '\\u2502' + c.reset + ' ' + c.brightBlue + '\\u23C7 ' + git.gitBranch + c.reset;
|
|
@@ -789,28 +805,28 @@ export function generateStatuslineHook(options) {
|
|
|
789
805
|
return '#!/bin/bash\n# Statusline disabled\n';
|
|
790
806
|
}
|
|
791
807
|
return `#!/bin/bash
|
|
792
|
-
#
|
|
808
|
+
# OpenCode Orchestrator V3 Statusline Hook
|
|
793
809
|
# Source this in your .bashrc/.zshrc for terminal statusline
|
|
794
810
|
|
|
795
811
|
# Function to get statusline
|
|
796
|
-
|
|
797
|
-
local statusline_script="\${
|
|
812
|
+
opencode_statusline() {
|
|
813
|
+
local statusline_script="\${OPENCODE_DIR:-.opencode}/helpers/statusline.cjs"
|
|
798
814
|
if [ -f "$statusline_script" ]; then
|
|
799
815
|
node "$statusline_script" 2>/dev/null || echo ""
|
|
800
816
|
fi
|
|
801
817
|
}
|
|
802
818
|
|
|
803
819
|
# Bash: Add to PS1
|
|
804
|
-
# export PS1='$(
|
|
820
|
+
# export PS1='$(opencode_statusline) \\n\\$ '
|
|
805
821
|
|
|
806
822
|
# Zsh: Add to RPROMPT
|
|
807
|
-
# export RPROMPT='$(
|
|
823
|
+
# export RPROMPT='$(opencode_statusline)'
|
|
808
824
|
|
|
809
|
-
#
|
|
825
|
+
# OpenCode: Add to opencode.json
|
|
810
826
|
# "statusLine": {
|
|
811
827
|
# "type": "command",
|
|
812
|
-
# "command": "node .
|
|
813
|
-
# "when": "test -f .
|
|
828
|
+
# "command": "node .opencode/helpers/statusline.cjs 2>/dev/null"
|
|
829
|
+
# "when": "test -f .opencode/helpers/statusline.cjs"
|
|
814
830
|
# }
|
|
815
831
|
`;
|
|
816
832
|
}
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
* Components that can be initialized
|
|
7
7
|
*/
|
|
8
8
|
export interface InitComponents {
|
|
9
|
-
/** Create .
|
|
9
|
+
/** Create .opencode/settings.json with hooks */
|
|
10
10
|
settings: boolean;
|
|
11
|
-
/** Copy skills to .
|
|
11
|
+
/** Copy skills to .opencode/skills/ */
|
|
12
12
|
skills: boolean;
|
|
13
|
-
/** Copy commands to .
|
|
13
|
+
/** Copy commands to .opencode/commands/ */
|
|
14
14
|
commands: boolean;
|
|
15
|
-
/** Copy agents to .
|
|
15
|
+
/** Copy agents to .opencode/agents/ */
|
|
16
16
|
agents: boolean;
|
|
17
|
-
/** Create helper scripts in .
|
|
17
|
+
/** Create helper scripts in .opencode/helpers/ */
|
|
18
18
|
helpers: boolean;
|
|
19
19
|
/** Configure statusline */
|
|
20
20
|
statusline: boolean;
|
|
@@ -22,8 +22,8 @@ export interface InitComponents {
|
|
|
22
22
|
mcp: boolean;
|
|
23
23
|
/** Create .claude-flow/ directory (V3 runtime) */
|
|
24
24
|
runtime: boolean;
|
|
25
|
-
/** Create
|
|
26
|
-
|
|
25
|
+
/** Create SKILL.md with swarm guidance */
|
|
26
|
+
opencodeMd: boolean;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Hook configuration options
|
|
@@ -173,11 +173,15 @@ export interface RuntimeConfig {
|
|
|
173
173
|
enableMemoryGraph?: boolean;
|
|
174
174
|
/** Enable AgentMemoryScope (ADR-049) - 3-scope agent memory */
|
|
175
175
|
enableAgentScopes?: boolean;
|
|
176
|
-
/**
|
|
177
|
-
|
|
176
|
+
/** SKILL.md template variant */
|
|
177
|
+
opencodeMdTemplate?: SkillMdTemplate;
|
|
178
|
+
/** Enable ruv-swarm MCP server */
|
|
179
|
+
swarm?: boolean;
|
|
180
|
+
/** Enable flow-nexus MCP server */
|
|
181
|
+
flowNexus?: boolean;
|
|
178
182
|
}
|
|
179
183
|
/** Template variants for generated CLAUDE.md files */
|
|
180
|
-
export type
|
|
184
|
+
export type SkillMdTemplate = 'minimal' | 'standard' | 'full' | 'security' | 'performance' | 'solo';
|
|
181
185
|
/**
|
|
182
186
|
* Embeddings configuration
|
|
183
187
|
*/
|
|
@@ -55,7 +55,7 @@ export const DEFAULT_INIT_OPTIONS = {
|
|
|
55
55
|
statusline: true,
|
|
56
56
|
mcp: true,
|
|
57
57
|
runtime: true,
|
|
58
|
-
|
|
58
|
+
opencodeMd: true,
|
|
59
59
|
},
|
|
60
60
|
hooks: {
|
|
61
61
|
preToolUse: true,
|
|
@@ -151,7 +151,7 @@ export const MINIMAL_INIT_OPTIONS = {
|
|
|
151
151
|
statusline: false,
|
|
152
152
|
mcp: true,
|
|
153
153
|
runtime: true,
|
|
154
|
-
|
|
154
|
+
opencodeMd: true,
|
|
155
155
|
},
|
|
156
156
|
hooks: {
|
|
157
157
|
...DEFAULT_INIT_OPTIONS.hooks,
|
|
@@ -215,7 +215,7 @@ export const FULL_INIT_OPTIONS = {
|
|
|
215
215
|
statusline: true,
|
|
216
216
|
mcp: true,
|
|
217
217
|
runtime: true,
|
|
218
|
-
|
|
218
|
+
opencodeMd: true,
|
|
219
219
|
},
|
|
220
220
|
skills: {
|
|
221
221
|
core: true,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Enhanced schema with pattern confidence, temporal decay, versioning
|
|
13
13
|
* Vector embeddings enabled for semantic search
|
|
14
14
|
*/
|
|
15
|
-
export declare const MEMORY_SCHEMA_V3 = "\n--
|
|
15
|
+
export declare const MEMORY_SCHEMA_V3 = "\n-- OpenCode Orchestrator Memory Database\n-- Version: 3.0.0\n-- Features: Pattern learning, vector embeddings, temporal decay, migration tracking\n\nPRAGMA journal_mode = WAL;\nPRAGMA synchronous = NORMAL;\nPRAGMA foreign_keys = ON;\n\n-- ============================================\n-- CORE MEMORY TABLES\n-- ============================================\n\n-- Memory entries (main storage)\nCREATE TABLE IF NOT EXISTS memory_entries (\n id TEXT PRIMARY KEY,\n key TEXT NOT NULL,\n namespace TEXT DEFAULT 'default',\n content TEXT NOT NULL,\n type TEXT DEFAULT 'semantic' CHECK(type IN ('semantic', 'episodic', 'procedural', 'working', 'pattern')),\n\n -- Vector embedding for semantic search (stored as JSON array)\n embedding TEXT,\n embedding_model TEXT DEFAULT 'local',\n embedding_dimensions INTEGER,\n\n -- Metadata\n tags TEXT, -- JSON array\n metadata TEXT, -- JSON object\n owner_id TEXT,\n\n -- Timestamps\n created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000),\n updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000),\n expires_at INTEGER,\n last_accessed_at INTEGER,\n\n -- Access tracking for hot/cold detection\n access_count INTEGER DEFAULT 0,\n\n -- Status\n status TEXT DEFAULT 'active' CHECK(status IN ('active', 'archived', 'deleted')),\n\n UNIQUE(namespace, key)\n);\n\n-- Indexes for memory entries\nCREATE INDEX IF NOT EXISTS idx_memory_namespace ON memory_entries(namespace);\nCREATE INDEX IF NOT EXISTS idx_memory_key ON memory_entries(key);\nCREATE INDEX IF NOT EXISTS idx_memory_type ON memory_entries(type);\nCREATE INDEX IF NOT EXISTS idx_memory_status ON memory_entries(status);\nCREATE INDEX IF NOT EXISTS idx_memory_created ON memory_entries(created_at);\nCREATE INDEX IF NOT EXISTS idx_memory_accessed ON memory_entries(last_accessed_at);\nCREATE INDEX IF NOT EXISTS idx_memory_owner ON memory_entries(owner_id);\n\n-- ============================================\n-- PATTERN LEARNING TABLES\n-- ============================================\n\n-- Learned patterns with confidence scoring and versioning\nCREATE TABLE IF NOT EXISTS patterns (\n id TEXT PRIMARY KEY,\n\n -- Pattern identification\n name TEXT NOT NULL,\n pattern_type TEXT NOT NULL CHECK(pattern_type IN (\n 'task-routing', 'error-recovery', 'optimization', 'learning',\n 'coordination', 'prediction', 'code-pattern', 'workflow'\n )),\n\n -- Pattern definition\n condition TEXT NOT NULL, -- Regex or semantic match\n action TEXT NOT NULL, -- What to do when pattern matches\n description TEXT,\n\n -- Confidence scoring (0.0 - 1.0)\n confidence REAL DEFAULT 0.5,\n success_count INTEGER DEFAULT 0,\n failure_count INTEGER DEFAULT 0,\n\n -- Temporal decay\n decay_rate REAL DEFAULT 0.01, -- How fast confidence decays\n half_life_days INTEGER DEFAULT 30, -- Days until confidence halves without use\n\n -- Vector embedding for semantic pattern matching\n embedding TEXT,\n embedding_dimensions INTEGER,\n\n -- Versioning\n version INTEGER DEFAULT 1,\n parent_id TEXT REFERENCES patterns(id),\n\n -- Metadata\n tags TEXT, -- JSON array\n metadata TEXT, -- JSON object\n source TEXT, -- Where the pattern was learned from\n\n -- Timestamps\n created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000),\n updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000),\n last_matched_at INTEGER,\n last_success_at INTEGER,\n last_failure_at INTEGER,\n\n -- Status\n status TEXT DEFAULT 'active' CHECK(status IN ('active', 'archived', 'deprecated', 'experimental'))\n);\n\n-- Indexes for patterns\nCREATE INDEX IF NOT EXISTS idx_patterns_type ON patterns(pattern_type);\nCREATE INDEX IF NOT EXISTS idx_patterns_confidence ON patterns(confidence DESC);\nCREATE INDEX IF NOT EXISTS idx_patterns_status ON patterns(status);\nCREATE INDEX IF NOT EXISTS idx_patterns_last_matched ON patterns(last_matched_at);\n\n-- Pattern evolution history (for versioning)\nCREATE TABLE IF NOT EXISTS pattern_history (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n pattern_id TEXT NOT NULL REFERENCES patterns(id),\n version INTEGER NOT NULL,\n\n -- Snapshot of pattern state\n confidence REAL,\n success_count INTEGER,\n failure_count INTEGER,\n condition TEXT,\n action TEXT,\n\n -- What changed\n change_type TEXT CHECK(change_type IN ('created', 'updated', 'success', 'failure', 'decay', 'merged', 'split')),\n change_reason TEXT,\n\n created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000)\n);\n\nCREATE INDEX IF NOT EXISTS idx_pattern_history_pattern ON pattern_history(pattern_id);\n\n-- ============================================\n-- LEARNING & TRAJECTORY TABLES\n-- ============================================\n\n-- Learning trajectories (SONA integration)\nCREATE TABLE IF NOT EXISTS trajectories (\n id TEXT PRIMARY KEY,\n session_id TEXT,\n\n -- Trajectory state\n status TEXT DEFAULT 'active' CHECK(status IN ('active', 'completed', 'failed', 'abandoned')),\n verdict TEXT CHECK(verdict IN ('success', 'failure', 'partial', NULL)),\n\n -- Context\n task TEXT,\n context TEXT, -- JSON object\n\n -- Metrics\n total_steps INTEGER DEFAULT 0,\n total_reward REAL DEFAULT 0,\n\n -- Timestamps\n started_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000),\n ended_at INTEGER,\n\n -- Reference to extracted pattern (if any)\n extracted_pattern_id TEXT REFERENCES patterns(id)\n);\n\n-- Trajectory steps\nCREATE TABLE IF NOT EXISTS trajectory_steps (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n trajectory_id TEXT NOT NULL REFERENCES trajectories(id),\n step_number INTEGER NOT NULL,\n\n -- Step data\n action TEXT NOT NULL,\n observation TEXT,\n reward REAL DEFAULT 0,\n\n -- Metadata\n metadata TEXT, -- JSON object\n\n created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000)\n);\n\nCREATE INDEX IF NOT EXISTS idx_steps_trajectory ON trajectory_steps(trajectory_id);\n\n-- ============================================\n-- MIGRATION STATE TRACKING\n-- ============================================\n\n-- Migration state (for resume capability)\nCREATE TABLE IF NOT EXISTS migration_state (\n id TEXT PRIMARY KEY,\n migration_type TEXT NOT NULL, -- 'v2-to-v3', 'pattern', 'memory', etc.\n\n -- Progress tracking\n status TEXT DEFAULT 'pending' CHECK(status IN ('pending', 'in_progress', 'completed', 'failed', 'rolled_back')),\n total_items INTEGER DEFAULT 0,\n processed_items INTEGER DEFAULT 0,\n failed_items INTEGER DEFAULT 0,\n skipped_items INTEGER DEFAULT 0,\n\n -- Current position (for resume)\n current_batch INTEGER DEFAULT 0,\n last_processed_id TEXT,\n\n -- Source/destination info\n source_path TEXT,\n source_type TEXT,\n destination_path TEXT,\n\n -- Backup info\n backup_path TEXT,\n backup_created_at INTEGER,\n\n -- Error tracking\n last_error TEXT,\n errors TEXT, -- JSON array of errors\n\n -- Timestamps\n started_at INTEGER,\n completed_at INTEGER,\n created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000),\n updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000)\n);\n\n-- ============================================\n-- SESSION MANAGEMENT\n-- ============================================\n\n-- Sessions for context persistence\nCREATE TABLE IF NOT EXISTS sessions (\n id TEXT PRIMARY KEY,\n\n -- Session state\n state TEXT NOT NULL, -- JSON object with full session state\n status TEXT DEFAULT 'active' CHECK(status IN ('active', 'paused', 'completed', 'expired')),\n\n -- Context\n project_path TEXT,\n branch TEXT,\n\n -- Metrics\n tasks_completed INTEGER DEFAULT 0,\n patterns_learned INTEGER DEFAULT 0,\n\n -- Timestamps\n created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000),\n updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000),\n expires_at INTEGER\n);\n\n-- ============================================\n-- VECTOR INDEX METADATA (for HNSW)\n-- ============================================\n\n-- Track HNSW index state\nCREATE TABLE IF NOT EXISTS vector_indexes (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL UNIQUE,\n\n -- Index configuration\n dimensions INTEGER NOT NULL,\n metric TEXT DEFAULT 'cosine' CHECK(metric IN ('cosine', 'euclidean', 'dot')),\n\n -- HNSW parameters\n hnsw_m INTEGER DEFAULT 16,\n hnsw_ef_construction INTEGER DEFAULT 200,\n hnsw_ef_search INTEGER DEFAULT 100,\n\n -- Quantization\n quantization_type TEXT CHECK(quantization_type IN ('none', 'scalar', 'product')),\n quantization_bits INTEGER DEFAULT 8,\n\n -- Statistics\n total_vectors INTEGER DEFAULT 0,\n last_rebuild_at INTEGER,\n\n created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000),\n updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now') * 1000)\n);\n\n-- ============================================\n-- SYSTEM METADATA\n-- ============================================\n\nCREATE TABLE IF NOT EXISTS metadata (\n key TEXT PRIMARY KEY,\n value TEXT NOT NULL,\n updated_at INTEGER DEFAULT (strftime('%s', 'now') * 1000)\n);\n";
|
|
16
16
|
interface HNSWEntry {
|
|
17
17
|
id: string;
|
|
18
18
|
key: string;
|
|
@@ -31,7 +31,7 @@ async function getBridge() {
|
|
|
31
31
|
* Vector embeddings enabled for semantic search
|
|
32
32
|
*/
|
|
33
33
|
export const MEMORY_SCHEMA_V3 = `
|
|
34
|
-
--
|
|
34
|
+
-- OpenCode Orchestrator Memory Database
|
|
35
35
|
-- Version: 3.0.0
|
|
36
36
|
-- Features: Pattern learning, vector embeddings, temporal decay, migration tracking
|
|
37
37
|
|
|
@@ -491,7 +491,7 @@ export class PluginDiscoveryService {
|
|
|
491
491
|
id: '@claude-flow/plugins',
|
|
492
492
|
name: '@claude-flow/plugins',
|
|
493
493
|
displayName: 'Plugin SDK',
|
|
494
|
-
description: 'Unified Plugin SDK for
|
|
494
|
+
description: 'Unified Plugin SDK for OpenCode Orchestrator - Worker, Hook, and Provider Integration. Create, test, and publish OpenCode plugins.',
|
|
495
495
|
version: '3.0.0-alpha.2',
|
|
496
496
|
cid: 'bafybeipluginsdk2024xyz',
|
|
497
497
|
size: 156000,
|
|
@@ -63,7 +63,7 @@ function parseArgs() {
|
|
|
63
63
|
*/
|
|
64
64
|
function showHelp() {
|
|
65
65
|
console.log(`
|
|
66
|
-
Headless Runtime for
|
|
66
|
+
Headless Runtime for OpenCode Orchestrator
|
|
67
67
|
|
|
68
68
|
Usage:
|
|
69
69
|
headless --worker <type> Run a specific worker
|
|
@@ -150,7 +150,7 @@ async function runDaemon() {
|
|
|
150
150
|
* Run benchmarks
|
|
151
151
|
*/
|
|
152
152
|
async function runBenchmarks() {
|
|
153
|
-
console.log('===
|
|
153
|
+
console.log('=== OpenCode Orchestrator Performance Benchmarks ===\n');
|
|
154
154
|
// Initialize intelligence
|
|
155
155
|
await initializeIntelligence();
|
|
156
156
|
// SONA Benchmark
|
|
@@ -216,7 +216,7 @@ async function runBenchmarks() {
|
|
|
216
216
|
* Show system status
|
|
217
217
|
*/
|
|
218
218
|
async function showStatus() {
|
|
219
|
-
console.log('===
|
|
219
|
+
console.log('=== OpenCode Orchestrator System Status ===\n');
|
|
220
220
|
// Check daemon
|
|
221
221
|
const daemon = getDaemon();
|
|
222
222
|
console.log('Daemon:');
|
|
@@ -675,7 +675,7 @@ export class GitHubSync {
|
|
|
675
675
|
const claimantStr = claimant.type === 'human'
|
|
676
676
|
? `@${claimant.name.replace(/[^a-zA-Z0-9_-]/g, '')}`
|
|
677
677
|
: `Agent: ${(claimant.agentType || 'unknown').replace(/[^a-zA-Z0-9_-]/g, '')}`;
|
|
678
|
-
const comment = `🤖 **Issue claimed** by ${claimantStr}\n\n_Coordinated by
|
|
678
|
+
const comment = `🤖 **Issue claimed** by ${claimantStr}\n\n_Coordinated by OpenCode Orchestrator_`;
|
|
679
679
|
try {
|
|
680
680
|
execFileSync('gh', [
|
|
681
681
|
'issue', 'comment', String(issueNumber),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencode-orchestrator/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode Orchestrator CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory",
|
|
6
6
|
"main": "dist/src/index.js",
|