0xray 3.3.1 → 3.4.2
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/enforcer-config.json +1 -4
- package/.xray/codex.json +598 -0
- package/.xray/config.json +25 -0
- package/.xray/features.json +146 -0
- package/.xray/features.schema.json +33 -0
- package/AGENTS-consumer.md +127 -10
- package/AGENTS.md +172 -56
- package/README.md +159 -82
- package/SKILLS.md +79 -53
- package/dist/AGENTS.md +172 -56
- package/dist/CHANGELOG.md +90 -51
- package/dist/README.md +159 -82
- package/dist/SKILLS.md +79 -53
- package/dist/analytics/routing-refiner.js +0 -2
- package/dist/core/boot-orchestrator.js +9 -1
- package/dist/core/features-config.js +5 -1
- package/dist/integrations/grok/grok-cli.js +47 -25
- package/dist/integrations/grok/hooks/grok-hook-activity.js +53 -0
- package/dist/integrations/grok/hooks/grok-hook-utils.js +261 -0
- package/dist/integrations/grok/hooks/pre-tool-use.js +85 -115
- package/dist/integrations/grok/hooks/session-start.js +52 -0
- package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +20 -3
- package/dist/integrations/hermes-agent/bridge.mjs +11 -1
- package/dist/mcps/config/server-config-registry.js +4 -3
- package/dist/mcps/orchestrator/handlers/complexity-handler.js +33 -3
- package/dist/mcps/orchestrator/server.js +1 -1
- package/dist/mcps/registry.json +0 -1
- package/dist/mcps/researcher.server.js +3 -0
- package/dist/nucleus/autonomy-kernel.js +176 -0
- package/dist/nucleus/index.js +1 -0
- package/dist/orchestrator/universal-registry-bridge.js +1 -1
- package/dist/skills/boot-orchestrator/SKILL.md +1 -5
- package/dist/skills/orchestrator/SKILL.md +35 -12
- package/dist/skills/registry.json +0 -1
- package/dist/skills/researcher/SKILL.md +17 -4
- package/dist/skills/strategist/SKILL.md +12 -0
- package/dist/skills/testing-strategy/SKILL.md +13 -2
- package/package.json +23 -8
- package/scripts/node/consumer-install-smoke.mjs +163 -0
- package/scripts/node/enforce-agents-md.mjs +0 -26
- package/scripts/node/enforce-version-compliance.sh +0 -1
- package/scripts/node/enforce-version-compliance.ts +0 -10
- package/scripts/node/install-bridges.cjs +154 -39
- package/scripts/node/pre-publish-guard.js +108 -165
- package/scripts/node/reconcile-version.mjs +147 -0
- package/scripts/node/release-gate.mjs +66 -0
- package/scripts/node/release.js +5 -147
- package/scripts/node/release.mjs +106 -181
- package/scripts/node/setup.cjs +21 -26
- package/scripts/node/sync-versions.mjs +12 -134
- package/scripts/node/universal-version-manager.js +22 -4
- package/scripts/node/validate-release-docs.mjs +299 -0
- package/scripts/node/version-manager.mjs +225 -49
- package/src/integrations/grok/plugin/0xray/hooks/hooks.json +20 -3
- package/src/mcps/config/__tests__/server-config-registry.test.ts +9 -0
- package/src/mcps/config/server-config-registry.ts +5 -3
- package/src/mcps/orchestrator/handlers/complexity-handler.ts +54 -3
- package/src/mcps/orchestrator/server.ts +1 -1
- package/src/mcps/registry.json +0 -1
- package/src/mcps/researcher.server.ts +4 -0
- package/src/opencode/enforcer-config.json +1 -4
- package/src/skills/boot-orchestrator/SKILL.md +1 -5
- package/src/skills/orchestrator/SKILL.md +35 -12
- package/src/skills/registry.json +0 -1
- package/src/skills/researcher/SKILL.md +17 -4
- package/src/skills/strategist/SKILL.md +12 -0
- package/src/skills/testing-strategy/SKILL.md +13 -2
- package/xray/config.json +25 -0
- package/xray/features.json +146 -0
- package/xray/features.schema.json +33 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Grok SessionStart / UserPromptSubmit — writes session-boot.json + activity.log.
|
|
4
|
+
* Stdout is ignored by Grok for these events; side effects are the suit contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
buildSessionBootPayload,
|
|
9
|
+
ensureSessionBoot,
|
|
10
|
+
readStdinJson,
|
|
11
|
+
workspaceRoot,
|
|
12
|
+
writeSessionBoot,
|
|
13
|
+
} from './grok-hook-utils.js';
|
|
14
|
+
import { appendHookActivity } from './grok-hook-activity.js';
|
|
15
|
+
|
|
16
|
+
const HOOK_EVENT = process.env.GROK_HOOK_EVENT || 'session_start';
|
|
17
|
+
|
|
18
|
+
async function main() {
|
|
19
|
+
const root = workspaceRoot();
|
|
20
|
+
try {
|
|
21
|
+
const event = await readStdinJson();
|
|
22
|
+
const eventRoot = event.workspaceRoot || event.cwd || root;
|
|
23
|
+
const source =
|
|
24
|
+
HOOK_EVENT === 'user_prompt_submit'
|
|
25
|
+
? '0xray/grok-user-prompt-submit'
|
|
26
|
+
: '0xray/grok-session-start';
|
|
27
|
+
|
|
28
|
+
const payload = buildSessionBootPayload(eventRoot, source, {
|
|
29
|
+
hookEvent: HOOK_EVENT,
|
|
30
|
+
sessionId: event.sessionId || process.env.GROK_SESSION_ID || null,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const bootPath = writeSessionBoot(eventRoot, payload) || ensureSessionBoot(eventRoot, source);
|
|
34
|
+
|
|
35
|
+
appendHookActivity(eventRoot, 'grok-session-start', 'session-boot-written', 'success', {
|
|
36
|
+
bootPath,
|
|
37
|
+
hookEvent: HOOK_EVENT,
|
|
38
|
+
lead_dev_mode: payload.lead_dev_mode,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
console.log(JSON.stringify(payload));
|
|
42
|
+
process.exit(0);
|
|
43
|
+
} catch (err) {
|
|
44
|
+
appendHookActivity(root, 'grok-session-start', 'session-boot-error', 'error', {
|
|
45
|
+
error: err.message,
|
|
46
|
+
hookEvent: HOOK_EVENT,
|
|
47
|
+
});
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
main();
|
|
@@ -20,11 +20,28 @@
|
|
|
20
20
|
"hooks": [
|
|
21
21
|
{
|
|
22
22
|
"type": "command",
|
|
23
|
-
"command": "
|
|
24
|
-
"args": [
|
|
23
|
+
"command": "node",
|
|
24
|
+
"args": [
|
|
25
|
+
"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/session-start.js"
|
|
26
|
+
],
|
|
27
|
+
"timeout": 15000
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"UserPromptSubmit": [
|
|
33
|
+
{
|
|
34
|
+
"hooks": [
|
|
35
|
+
{
|
|
36
|
+
"type": "command",
|
|
37
|
+
"command": "node",
|
|
38
|
+
"args": [
|
|
39
|
+
"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/session-start.js"
|
|
40
|
+
],
|
|
41
|
+
"timeout": 15000
|
|
25
42
|
}
|
|
26
43
|
]
|
|
27
44
|
}
|
|
28
45
|
]
|
|
29
46
|
}
|
|
30
|
-
}
|
|
47
|
+
}
|
|
@@ -53,9 +53,19 @@ let frameworkLoadAttempted = false;
|
|
|
53
53
|
|
|
54
54
|
// ── Project root detection ───────────────────────────────────
|
|
55
55
|
function findProjectRoot() {
|
|
56
|
-
const envHome = process.env.XRAY_HOME;
|
|
56
|
+
const envHome = process.env.XRAY_HOME || process.env.XRAY_ROOT;
|
|
57
57
|
if (envHome && existsSync(join(envHome, "package.json"))) return envHome;
|
|
58
58
|
|
|
59
|
+
const consumerMarker = join(__dirname, "xray-consumer-root.txt");
|
|
60
|
+
if (existsSync(consumerMarker)) {
|
|
61
|
+
try {
|
|
62
|
+
const marked = readFileSync(consumerMarker, "utf-8").trim();
|
|
63
|
+
if (marked && existsSync(join(marked, "package.json"))) return marked;
|
|
64
|
+
} catch {
|
|
65
|
+
// fall through
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
59
69
|
const candidates = [
|
|
60
70
|
process.cwd(),
|
|
61
71
|
join(homedir(), "dev", "xray"),
|
|
@@ -38,10 +38,11 @@ function resolveFrameworkPaths() {
|
|
|
38
38
|
if (fs.existsSync(pkgPath)) {
|
|
39
39
|
try {
|
|
40
40
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
41
|
-
if (pkg.name === '0xray'
|
|
42
|
-
const xrayCfg = pkg.xray;
|
|
41
|
+
if (pkg.name === '0xray') {
|
|
42
|
+
const xrayCfg = (pkg.xray ?? {});
|
|
43
43
|
const frameworkRoot = currentDir;
|
|
44
|
-
const declaredMcp = xrayCfg.mcpServersPath ||
|
|
44
|
+
const declaredMcp = xrayCfg.mcpServersPath ||
|
|
45
|
+
(xrayCfg.dist ? join(xrayCfg.dist, 'mcps') : 'dist/mcps');
|
|
45
46
|
return {
|
|
46
47
|
frameworkRoot,
|
|
47
48
|
mcpServersPath: join(frameworkRoot, declaredMcp),
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Handles complexity analysis requests
|
|
5
5
|
*/
|
|
6
6
|
import { frameworkLogger } from '../../../core/framework-logger.js';
|
|
7
|
+
import { buildLeadDevPlan, isLeadDevModeActive, persistLeadDevPlan, } from '../../../nucleus/autonomy-kernel.js';
|
|
7
8
|
import { getExecutionPlanner } from '../execution/execution-planner.js';
|
|
8
9
|
import { addObservations, extractComplexityObservations } from '../aside-context.js';
|
|
9
10
|
/**
|
|
@@ -24,11 +25,24 @@ export class ComplexityHandler {
|
|
|
24
25
|
if (asideId) {
|
|
25
26
|
addObservations(asideId, extractComplexityObservations(analysis));
|
|
26
27
|
}
|
|
28
|
+
const primaryDescription = tasks.map((t) => t.description).filter(Boolean).join(' ');
|
|
29
|
+
const taskTypes = tasks.map((t) => t.type).filter(Boolean);
|
|
30
|
+
const leadDevPlan = isLeadDevModeActive() && primaryDescription
|
|
31
|
+
? buildLeadDevPlan(primaryDescription, taskTypes.length ? taskTypes : ['implement'])
|
|
32
|
+
: null;
|
|
33
|
+
if (leadDevPlan) {
|
|
34
|
+
try {
|
|
35
|
+
persistLeadDevPlan(leadDevPlan);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
await frameworkLogger.log('orchestrator.server', 'lead-dev-plan-persist-failed', 'warning', { error: err instanceof Error ? err.message : String(err) });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
27
41
|
return {
|
|
28
42
|
content: [
|
|
29
43
|
{
|
|
30
44
|
type: 'text',
|
|
31
|
-
text: this.formatComplexityResponse(analysis, recommendations, tasks.length),
|
|
45
|
+
text: this.formatComplexityResponse(analysis, recommendations, tasks.length, leadDevPlan),
|
|
32
46
|
},
|
|
33
47
|
],
|
|
34
48
|
};
|
|
@@ -72,7 +86,23 @@ export class ComplexityHandler {
|
|
|
72
86
|
/**
|
|
73
87
|
* Format complexity response
|
|
74
88
|
*/
|
|
75
|
-
formatComplexityResponse(analysis, recommendations, taskCount) {
|
|
89
|
+
formatComplexityResponse(analysis, recommendations, taskCount, leadDevPlan = null) {
|
|
90
|
+
const leadDevSection = leadDevPlan
|
|
91
|
+
? `
|
|
92
|
+
|
|
93
|
+
**Lead-dev plan (codex ${leadDevPlan.codexTerms.join(', ')}):**
|
|
94
|
+
${leadDevPlan.phases
|
|
95
|
+
.map((p) => `### ${p.id} — ${p.name}\n${p.todos
|
|
96
|
+
.map((t) => `- [ ] ${t.id} (${t.subagent}): ${t.task}`)
|
|
97
|
+
.join('\n')}`)
|
|
98
|
+
.join('\n\n')}
|
|
99
|
+
|
|
100
|
+
**Test protocol:** ${leadDevPlan.testProtocol.hint}
|
|
101
|
+
|
|
102
|
+
\`\`\`json
|
|
103
|
+
${JSON.stringify(leadDevPlan, null, 2)}
|
|
104
|
+
\`\`\``
|
|
105
|
+
: '';
|
|
76
106
|
return `🔍 Complexity Analysis Results
|
|
77
107
|
|
|
78
108
|
**Tasks Analyzed:** ${taskCount}
|
|
@@ -93,6 +123,6 @@ ${analysis.agentAssignments
|
|
|
93
123
|
${recommendations.map((r) => `• 💡 ${r}`).join('\n')}
|
|
94
124
|
|
|
95
125
|
**Execution Estimate:** ${analysis.estimatedDuration}ms
|
|
96
|
-
**Parallel Potential:** ${Math.round(analysis.parallelPotential * 100)}
|
|
126
|
+
**Parallel Potential:** ${Math.round(analysis.parallelPotential * 100)}%${leadDevSection}`;
|
|
97
127
|
}
|
|
98
128
|
}
|
|
@@ -105,7 +105,7 @@ export class OrchestratorServer {
|
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
name: 'analyze-complexity',
|
|
108
|
-
description: 'Analyze task complexity and recommend
|
|
108
|
+
description: 'Analyze task complexity and recommend orchestration strategy. When lead_dev_mode is on (features.json), includes phased plan + todos + subagent routes.',
|
|
109
109
|
inputSchema: {
|
|
110
110
|
type: 'object',
|
|
111
111
|
properties: {
|
package/dist/mcps/registry.json
CHANGED
|
@@ -11,11 +11,14 @@ import * as fs from "fs";
|
|
|
11
11
|
import * as path from "path";
|
|
12
12
|
import { frameworkLogger } from "../core/framework-logger.js";
|
|
13
13
|
import { tryLLMGovernance } from "../governance/llm-governance-provider.js";
|
|
14
|
+
import { initializeMemoryRouting } from "../memory-routing/index.js";
|
|
14
15
|
import { buildMemoryRoutingEvidence, formatMemoryRoutingBlock, resolveResearcherMemoryContext, } from "./researcher-confidence.js";
|
|
15
16
|
import { XrayKnowledgeSkillBase } from "./shared/knowledge-skill-base.js";
|
|
16
17
|
class XrayLibrarianServer extends XrayKnowledgeSkillBase {
|
|
17
18
|
constructor() {
|
|
18
19
|
super("researcher", "3.1.0");
|
|
20
|
+
// Kick off MemoryRoutingProvider load so trap routing is ready in MCP subprocess mode.
|
|
21
|
+
initializeMemoryRouting();
|
|
19
22
|
this.tools = [
|
|
20
23
|
{
|
|
21
24
|
name: "search_codebase",
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lead-dev plan builder — internal implementation for orchestrator + hooks.
|
|
3
|
+
* Config: features.json → multi_agent_orchestration (lead_dev_mode), NOT a separate surface.
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import { featuresConfigLoader } from '../core/features-config.js';
|
|
8
|
+
import { scoreComplexity } from './thin-dispatch.js';
|
|
9
|
+
export const LEAD_DEV_RULES = [
|
|
10
|
+
'Phased plan + detailed todos; assign best subagent; monitor output; iterate fully',
|
|
11
|
+
'Lead dev takes helm — loop test fix until complete; no permission pings',
|
|
12
|
+
'Per-suite test triage after major changes; full suite only when individuals pass',
|
|
13
|
+
'Lead stays main thread; subagents execute; update todos continuously',
|
|
14
|
+
'Read all console and test output; triage fix rerun',
|
|
15
|
+
'Never defer errors as pre-existing — add todo and resolve',
|
|
16
|
+
'Resolve all errors before phase completion',
|
|
17
|
+
];
|
|
18
|
+
export const MANDATORY_MAJOR_CONSULTS = [
|
|
19
|
+
'researcher',
|
|
20
|
+
'architect-tools',
|
|
21
|
+
'code-review',
|
|
22
|
+
];
|
|
23
|
+
const TASK_TYPE_ROUTES = {
|
|
24
|
+
plan: 'strategist',
|
|
25
|
+
architecture: 'architect-tools',
|
|
26
|
+
research: 'researcher',
|
|
27
|
+
implement: 'backend-engineer',
|
|
28
|
+
frontend: 'frontend-engineer',
|
|
29
|
+
test: 'bug-triage',
|
|
30
|
+
review: 'code-review',
|
|
31
|
+
security: 'security-audit',
|
|
32
|
+
governance: 'enforcer',
|
|
33
|
+
};
|
|
34
|
+
function orchestrationConfig() {
|
|
35
|
+
try {
|
|
36
|
+
return featuresConfigLoader.loadConfig().multi_agent_orchestration;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return { enabled: true };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function isLeadDevModeActive() {
|
|
43
|
+
const cfg = orchestrationConfig();
|
|
44
|
+
return cfg.enabled && cfg.lead_dev_mode !== false;
|
|
45
|
+
}
|
|
46
|
+
export function routeSubagent(taskType) {
|
|
47
|
+
return TASK_TYPE_ROUTES[taskType.toLowerCase().trim()] ?? 'backend-engineer';
|
|
48
|
+
}
|
|
49
|
+
export function shouldFlagFullTestSuite(command) {
|
|
50
|
+
const cfg = orchestrationConfig();
|
|
51
|
+
if (!cfg.enabled || cfg.per_suite_test_triage === false)
|
|
52
|
+
return false;
|
|
53
|
+
const cmd = command.toLowerCase();
|
|
54
|
+
const isTest = /\b(npm\s+(run\s+)?test|vitest\s+run|pnpm\s+test|yarn\s+test)\b/.test(cmd);
|
|
55
|
+
const hasFocusedTarget = /--\s+\S+\.test/.test(cmd) ||
|
|
56
|
+
/vitest\s+run\s+\S+\.test/.test(cmd) ||
|
|
57
|
+
/\btest:\w+/.test(cmd);
|
|
58
|
+
return isTest && !hasFocusedTarget;
|
|
59
|
+
}
|
|
60
|
+
export function buildLeadDevPlan(description, taskTypes = ['implement']) {
|
|
61
|
+
if (!isLeadDevModeActive())
|
|
62
|
+
return null;
|
|
63
|
+
const cfg = orchestrationConfig();
|
|
64
|
+
const threshold = cfg.phased_plan_threshold ?? 25;
|
|
65
|
+
const score = scoreComplexity(description, { taskTypes });
|
|
66
|
+
const complexity = score.score;
|
|
67
|
+
const requiresPhasedPlan = complexity > threshold;
|
|
68
|
+
const mandatoryConsults = cfg.auto_consult_major_work !== false && requiresPhasedPlan
|
|
69
|
+
? [...MANDATORY_MAJOR_CONSULTS]
|
|
70
|
+
: [];
|
|
71
|
+
const phases = requiresPhasedPlan
|
|
72
|
+
? [
|
|
73
|
+
{
|
|
74
|
+
id: 'phase-1',
|
|
75
|
+
name: 'Research & architecture',
|
|
76
|
+
goal: 'Understand scope before edits',
|
|
77
|
+
definitionOfDone: 'researcher + architect-tools + code-review consulted',
|
|
78
|
+
todos: mandatoryConsults.map((subagent, i) => ({
|
|
79
|
+
id: `1.${i + 1}`,
|
|
80
|
+
task: `Consult ${subagent} on: ${description.slice(0, 120)}`,
|
|
81
|
+
subagent: subagent,
|
|
82
|
+
status: 'pending',
|
|
83
|
+
})),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'phase-2',
|
|
87
|
+
name: 'Implementation',
|
|
88
|
+
goal: 'Execute with best subagent per todo',
|
|
89
|
+
definitionOfDone: 'Affected per-suite tests green',
|
|
90
|
+
todos: taskTypes.map((type, i) => ({
|
|
91
|
+
id: `2.${i + 1}`,
|
|
92
|
+
task: description.slice(0, 200),
|
|
93
|
+
subagent: routeSubagent(type),
|
|
94
|
+
status: 'pending',
|
|
95
|
+
})),
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 'phase-3',
|
|
99
|
+
name: 'Verification',
|
|
100
|
+
goal: 'Per-suite triage then full suite gate',
|
|
101
|
+
definitionOfDone: 'Full test suite green; zero open errors',
|
|
102
|
+
todos: [
|
|
103
|
+
{
|
|
104
|
+
id: '3.1',
|
|
105
|
+
task: 'Run affected test files individually; triage and fix',
|
|
106
|
+
subagent: 'bug-triage',
|
|
107
|
+
status: 'pending',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: '3.2',
|
|
111
|
+
task: 'Run full test suite gate',
|
|
112
|
+
subagent: 'bug-triage',
|
|
113
|
+
status: 'pending',
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
]
|
|
118
|
+
: [
|
|
119
|
+
{
|
|
120
|
+
id: 'phase-1',
|
|
121
|
+
name: 'Direct execution',
|
|
122
|
+
goal: description.slice(0, 120),
|
|
123
|
+
definitionOfDone: 'Task complete with tests green',
|
|
124
|
+
todos: [
|
|
125
|
+
{
|
|
126
|
+
id: '1.1',
|
|
127
|
+
task: description.slice(0, 200),
|
|
128
|
+
subagent: routeSubagent(taskTypes[0] ?? 'implement'),
|
|
129
|
+
status: 'pending',
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
return {
|
|
135
|
+
active: true,
|
|
136
|
+
rules: LEAD_DEV_RULES,
|
|
137
|
+
codexTerms: [59, 67, 68, 69],
|
|
138
|
+
description,
|
|
139
|
+
complexity,
|
|
140
|
+
requiresPhasedPlan,
|
|
141
|
+
recommendedStrategy: score.recommendedStrategy,
|
|
142
|
+
mandatoryConsults,
|
|
143
|
+
phases,
|
|
144
|
+
testProtocol: {
|
|
145
|
+
perSuiteFirst: cfg.per_suite_test_triage !== false,
|
|
146
|
+
fullSuiteGate: true,
|
|
147
|
+
hint: 'After major changes: npm test -- path/to/file.test.ts → fix → repeat → full npm test last',
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export function buildSessionBootContext() {
|
|
152
|
+
if (!isLeadDevModeActive()) {
|
|
153
|
+
return { lead_dev_mode: false, reason: 'multi_agent_orchestration.lead_dev_mode=false' };
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
lead_dev_mode: true,
|
|
157
|
+
codexTerms: [67, 68],
|
|
158
|
+
rules: LEAD_DEV_RULES,
|
|
159
|
+
mcpBoot: 'xray-orchestrator → analyze-complexity (includes lead-dev plan when active)',
|
|
160
|
+
message: '[0xRay] Lead dev mode ON — phased todos, subagent dispatch, loop until green.',
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** Persist plan for PreToolUse spawn_subagent gate */
|
|
164
|
+
export function persistLeadDevPlan(plan, projectRoot = process.cwd()) {
|
|
165
|
+
const stateDir = path.join(projectRoot, '.xray', 'state');
|
|
166
|
+
fs.mkdirSync(stateDir, { recursive: true });
|
|
167
|
+
const planPath = path.join(stateDir, 'lead-dev-plan.json');
|
|
168
|
+
const payload = { ...plan, persistedAt: new Date().toISOString() };
|
|
169
|
+
fs.writeFileSync(planPath, JSON.stringify(payload, null, 2));
|
|
170
|
+
return planPath;
|
|
171
|
+
}
|
|
172
|
+
/** @deprecated Use isLeadDevModeActive */
|
|
173
|
+
export const isAutonomyKernelActive = isLeadDevModeActive;
|
|
174
|
+
/** @deprecated Use buildLeadDevPlan */
|
|
175
|
+
export const buildAutonomyIntake = buildLeadDevPlan;
|
|
176
|
+
export const AUTONOMY_RULES = LEAD_DEV_RULES;
|
package/dist/nucleus/index.js
CHANGED
|
@@ -8,4 +8,5 @@ export { handleGovernRequest, governSingle, getGovernanceService, GovernHTTPAdap
|
|
|
8
8
|
export { pluginRegistry, } from './plugin-registry.js';
|
|
9
9
|
export { scoreComplexity, routeToAgent, scoreAndRoute } from './thin-dispatch.js';
|
|
10
10
|
export { NUCLEUS_THIN_DISPATCH_VERSION } from './thin-dispatch.js';
|
|
11
|
+
export { LEAD_DEV_RULES, isLeadDevModeActive, buildLeadDevPlan, buildSessionBootContext, shouldFlagFullTestSuite, } from './autonomy-kernel.js';
|
|
11
12
|
export { registerDefaultPlugins } from './default-plugins.js';
|
|
@@ -28,10 +28,6 @@ Framework initialization and boot orchestration.
|
|
|
28
28
|
- **initialization**: Initialization
|
|
29
29
|
- **framework_startup**: Framework startup
|
|
30
30
|
|
|
31
|
-
## Usage
|
|
32
|
-
|
|
33
|
-
This skill provides infrastructure capabilities for boot orchestrator functionality.
|
|
34
|
-
|
|
35
31
|
## Integration
|
|
36
32
|
|
|
37
|
-
|
|
33
|
+
Lead-dev boot is handled by SessionStart hook + `orchestrator` skill — see `multi_agent_orchestration.lead_dev_mode` in features.json.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
source: framework
|
|
3
3
|
name: orchestrator
|
|
4
|
-
description: Multi-agent workflow coordination and task delegation
|
|
4
|
+
description: Multi-agent workflow coordination, lead-dev operating model (codex 67-68), and task delegation. Default when suit is worn — no keywords required.
|
|
5
5
|
author: Xray Framework
|
|
6
6
|
version: 1.0.0
|
|
7
7
|
schema_version: "1.0"
|
|
8
|
-
tags: [orchestration, orchestrator]
|
|
8
|
+
tags: [orchestration, orchestrator, lead-dev]
|
|
9
9
|
capabilities:
|
|
10
10
|
- coordinate_agents
|
|
11
11
|
- delegate_tasks
|
|
@@ -18,20 +18,43 @@ mcp:
|
|
|
18
18
|
args: [node_modules/0xray/dist/mcps/orchestrator.server.js]
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
-
# Orchestrator Skill
|
|
21
|
+
# Orchestrator Skill — includes lead-dev operating model
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
When `multi_agent_orchestration.lead_dev_mode` is true in `features.json` (default when suit is worn), this is the **default OS behavior** — not a separate skill or MCP.
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Seven rules (codex 67–68)
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
27
|
+
1. Phased plan + detailed todos; assign best subagent; monitor output
|
|
28
|
+
2. Lead dev loops test→fix until green; no permission pings
|
|
29
|
+
3. Per-suite test triage after major changes; full suite last
|
|
30
|
+
4. Lead stays main thread; subagents execute; update todos
|
|
31
|
+
5. Read all console and test output; triage fix rerun
|
|
32
|
+
6. Never defer errors as "pre-existing" — add todo and resolve
|
|
33
|
+
7. Resolve all errors before phase completion
|
|
30
34
|
|
|
31
|
-
##
|
|
35
|
+
## MCP loop (one tool surface — no autonomy-intake)
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
| Step | MCP tool | Notes |
|
|
38
|
+
|------|----------|-------|
|
|
39
|
+
| **Intake + classify** | `analyze-complexity` | Pass `tasks` array; response includes **lead-dev plan JSON** when mode is on |
|
|
40
|
+
| Delegate | `orchestrate-task` | Include agent + sessionId (codex 67) |
|
|
41
|
+
| Monitor | `get-orchestration-status` | Lead updates todos |
|
|
42
|
+
| Major work | researcher + architect-tools + code-review | Auto-listed in plan when complexity > threshold |
|
|
34
43
|
|
|
35
|
-
##
|
|
44
|
+
## Subagent routing
|
|
36
45
|
|
|
37
|
-
|
|
46
|
+
| Task | Subagent |
|
|
47
|
+
|------|----------|
|
|
48
|
+
| Phasing | strategist |
|
|
49
|
+
| Architecture | architect-tools |
|
|
50
|
+
| Research | researcher |
|
|
51
|
+
| Implementation | backend-engineer / frontend-engineer |
|
|
52
|
+
| Test failures | bug-triage |
|
|
53
|
+
| Review | code-review |
|
|
54
|
+
|
|
55
|
+
## Hooks (rewired, not new MCPs)
|
|
56
|
+
|
|
57
|
+
- **SessionStart** → `session-start.js` boots lead_dev_mode
|
|
58
|
+
- **PreToolUse** → hints `per_suite_triage_required` on full `npm test`
|
|
59
|
+
|
|
60
|
+
Config: `features.json` → `multi_agent_orchestration.lead_dev_mode`
|
|
@@ -28,10 +28,23 @@ Multi-repo analysis, documentation lookup, and implementation examples.
|
|
|
28
28
|
- **find_implementations**: Find implementations
|
|
29
29
|
- **analyze_documentation**: Analyze documentation
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## When to invoke (autonomy-command)
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Lead dev dispatches researcher **before** major planning, refactors, or cross-repo work — not only when user says "research."
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
| Trigger | Action |
|
|
36
|
+
|---------|--------|
|
|
37
|
+
| Major refactor / new phase | `search_codebase`, `get_documentation`, `find_implementation` |
|
|
38
|
+
| Prior art / patterns | Search sibling repos (xray, groover, repertoire) |
|
|
39
|
+
| Proposal analysis | `analyze_proposal` via xray-researcher MCP |
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
## MCP tools (xray-researcher)
|
|
42
|
+
|
|
43
|
+
- `get_documentation` — module/class docs (`target` required)
|
|
44
|
+
- `search_codebase` — text search in workspace
|
|
45
|
+
- `find_implementation` — locate implementations
|
|
46
|
+
- `analyze_proposal` — governance-aware proposal review
|
|
47
|
+
|
|
48
|
+
## Return shape for lead
|
|
49
|
+
|
|
50
|
+
Summarize: findings (3–5 bullets), file paths, recommended next todos. Do not defer work back to lead without concrete patches or todos.
|
|
@@ -30,3 +30,15 @@ Think deeply before recommending. Consider trade-offs and long-term implications
|
|
|
30
30
|
- Risk analysis and mitigation planning
|
|
31
31
|
- High-level system design and framework evolution
|
|
32
32
|
- Technical debt identification and prioritization
|
|
33
|
+
|
|
34
|
+
## When to invoke (autonomy-command)
|
|
35
|
+
|
|
36
|
+
Lead dev dispatches strategist when `analyze-complexity` score **>25** or work spans multiple repos/phases.
|
|
37
|
+
|
|
38
|
+
| Output required | Format |
|
|
39
|
+
|-----------------|--------|
|
|
40
|
+
| Phased plan | Phase N + goal + definition of done |
|
|
41
|
+
| Todo breakdown | ID, task, subagent assignment |
|
|
42
|
+
| Risks | Top 3 with mitigations |
|
|
43
|
+
|
|
44
|
+
Use `orchestrate-task` or Task subagent. Return actionable todos — not essays.
|
|
@@ -38,6 +38,17 @@ This skill helps design and optimize testing strategies for:
|
|
|
38
38
|
- Test coverage optimization
|
|
39
39
|
- Testing best practices implementation
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## Per-suite triage (autonomy-command rule 3)
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
After major changes, **do not** run the full test suite first.
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
1. Identify affected test file(s) from the diff
|
|
47
|
+
2. Run ONE suite: npm test -- path/to/focused.test.ts
|
|
48
|
+
3. Read ALL failure output — triage root cause
|
|
49
|
+
4. Fix → rerun that suite until green
|
|
50
|
+
5. Repeat for each affected suite
|
|
51
|
+
6. Only then: npm test (full suite gate)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Lead dev owns every failure. No "pre-existing" deferrals.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "0xray",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"description": "Multi-agent orchestration and Codex governance for OpenCode, Hermes, Grok Build, and OpenClaw",
|
|
5
5
|
"readme": "README.md",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,12 +55,16 @@
|
|
|
55
55
|
"plugin": "./dist/plugin/xray-codex-injection.js",
|
|
56
56
|
"mcps": "./dist/mcps/"
|
|
57
57
|
},
|
|
58
|
+
"xray": {
|
|
59
|
+
"dist": "dist",
|
|
60
|
+
"mcpServersPath": "dist/mcps"
|
|
61
|
+
},
|
|
58
62
|
"scripts": {
|
|
59
|
-
"prepublishOnly": "npm run prepare-consumer && npm run build:all && find dist -name '*.d.ts' -o -name '*.d.ts.map' -o -name '*.js.map' | xargs rm -f",
|
|
63
|
+
"prepublishOnly": "node scripts/node/reconcile-version.mjs --check && npm run prepare-consumer && npm run build:all && find dist -name '*.d.ts' -o -name '*.d.ts.map' -o -name '*.js.map' | xargs rm -f",
|
|
60
64
|
"version:bump": "node scripts/node/version-manager.mjs",
|
|
61
65
|
"version": "node scripts/node/version-manager.mjs",
|
|
62
66
|
"prebuild": "rm -rf dist tsconfig.tsbuildinfo tsconfig.*.tsbuildinfo",
|
|
63
|
-
"build": "tsc && mkdir -p dist/public dist/scripts && cp -r public/* dist/public/ && cp scripts/hooks/pre-command dist/scripts/ && cp scripts/hooks/pre-command.mjs dist/scripts/ && cp README.md AGENTS.md SKILLS.md CHANGELOG.md LICENSE .gitignore.default dist/ && find src -name '*.mjs' ! -path '*/__tests__/*' | while read f; do tgt=\"dist/${f#src/}\"; mkdir -p \"$(dirname $tgt)\"; cp \"$f\" \"$tgt\"; done && for dir in skills integrations mcps; do find src/$dir -type f ! -name '*.ts' ! -path '*/.pytest_cache/*' | while read f; do tgt=\"dist/${f#src/}\"; mkdir -p \"$(dirname $tgt)\"; cp \"$f\" \"$tgt\"; done; done && mkdir -p dist/plugin && (find dist/plugin -name '*codex-injection*.js' -exec cp {} dist/plugin/xray-codex-injection.js \\; 2>/dev/null || true) && cp -r src/opencode/ .opencode/ && mkdir -p .xray &&
|
|
67
|
+
"build": "tsc && mkdir -p dist/public dist/scripts && cp -r public/* dist/public/ && cp scripts/hooks/pre-command dist/scripts/ && cp scripts/hooks/pre-command.mjs dist/scripts/ && cp README.md AGENTS.md SKILLS.md CHANGELOG.md LICENSE .gitignore.default dist/ && find src -name '*.mjs' ! -path '*/__tests__/*' | while read f; do tgt=\"dist/${f#src/}\"; mkdir -p \"$(dirname $tgt)\"; cp \"$f\" \"$tgt\"; done && for dir in skills integrations mcps; do find src/$dir -type f ! -name '*.ts' ! -path '*/.pytest_cache/*' | while read f; do tgt=\"dist/${f#src/}\"; mkdir -p \"$(dirname $tgt)\"; cp \"$f\" \"$tgt\"; done; done && mkdir -p dist/plugin && (find dist/plugin -name '*codex-injection*.js' -exec cp {} dist/plugin/xray-codex-injection.js \\; 2>/dev/null || true) && cp -r src/opencode/ .opencode/ && mkdir -p .xray && for f in codex.json features.json features.schema.json config.json; do cp xray/$f .xray/$f 2>/dev/null || true; done",
|
|
64
68
|
"build:all": "npm run build",
|
|
65
69
|
"ci-install": "npm ci",
|
|
66
70
|
"clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.*.tsbuildinfo",
|
|
@@ -94,6 +98,7 @@
|
|
|
94
98
|
"test:dependency-scan": "npm run security-audit",
|
|
95
99
|
"test:integration": "node scripts/mjs/test-consumer-readiness.mjs && node scripts/mjs/test-mcp-functionality.mjs",
|
|
96
100
|
"test:e2e": "node scripts/node/validate-mcp-connectivity.js && node scripts/node/validate-external-processes.js",
|
|
101
|
+
"live-feedback-session": "npx --yes tsx scripts/live-taskhandler-feedback-session.ts",
|
|
97
102
|
"validate": "echo \"[xray] Use 'npm test' or 'npm run test:comprehensive'.\"",
|
|
98
103
|
"validate:quick": "npm run validate",
|
|
99
104
|
"debug:inference:force": "XRAY_FORCE_MCP_GOVERNANCE=true XRAY_DEV_PATH=dist node dist/cli/index.js inference:run --force",
|
|
@@ -108,15 +113,18 @@
|
|
|
108
113
|
"build:clean": "node scripts/build/utils.js clean",
|
|
109
114
|
"build:verify": "node scripts/build/utils.js verify",
|
|
110
115
|
"enforce:versions": "bash scripts/node/enforce-version-compliance.sh",
|
|
111
|
-
"version:sync": "node scripts/node/
|
|
112
|
-
"
|
|
113
|
-
"release": "node scripts/node/release.js",
|
|
116
|
+
"version:sync": "node scripts/node/version-manager.mjs --artifacts-only",
|
|
117
|
+
"release": "node scripts/node/release.mjs patch",
|
|
114
118
|
"release:minor": "node scripts/node/release.mjs minor",
|
|
115
119
|
"release:major": "node scripts/node/release.mjs major",
|
|
116
|
-
"release:dry": "node scripts/node/release.
|
|
120
|
+
"release:dry": "node scripts/node/release.mjs patch --dry-run",
|
|
121
|
+
"version:reconcile": "node scripts/node/reconcile-version.mjs",
|
|
122
|
+
"consumer:smoke": "node scripts/node/consumer-install-smoke.mjs",
|
|
123
|
+
"release:gate": "node scripts/node/release-gate.mjs",
|
|
124
|
+
"release:docs-check": "node scripts/node/validate-release-docs.mjs",
|
|
117
125
|
"pre-publish-guard": "node scripts/node/pre-publish-guard.js",
|
|
118
126
|
"safe-publish": "npm run prepare-consumer && npm run build",
|
|
119
|
-
"publish": "npm run
|
|
127
|
+
"publish": "npm run release:gate && npm run safe-publish && npm publish --access public",
|
|
120
128
|
"release:patch": "node scripts/node/release.mjs patch"
|
|
121
129
|
},
|
|
122
130
|
"files": [
|
|
@@ -155,6 +163,13 @@
|
|
|
155
163
|
"SKILLS.md",
|
|
156
164
|
"xray/agents_template.md",
|
|
157
165
|
"xray/codex.json",
|
|
166
|
+
"xray/features.json",
|
|
167
|
+
"xray/features.schema.json",
|
|
168
|
+
"xray/config.json",
|
|
169
|
+
".xray/codex.json",
|
|
170
|
+
".xray/features.json",
|
|
171
|
+
".xray/features.schema.json",
|
|
172
|
+
".xray/config.json",
|
|
158
173
|
".gitignore.default",
|
|
159
174
|
"LICENSE"
|
|
160
175
|
],
|