0xray 3.3.0 → 3.4.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/codex.codex +1 -1
- package/.opencode/enforcer-config.json +1 -4
- package/dist/CHANGELOG.md +22 -0
- package/dist/analytics/routing-refiner.js +0 -2
- package/dist/core/boot-orchestrator.js +9 -1
- package/dist/core/features-config.js +0 -1
- package/dist/integrations/grok/grok-cli.js +53 -25
- package/dist/integrations/hermes-agent/bridge.mjs +11 -1
- package/dist/mcps/index.js +1 -0
- package/dist/mcps/knowledge-skills/skill-invocation.server.js +3 -2
- package/dist/mcps/knowledge-skills/storyteller.server.js +167 -0
- package/dist/mcps/orchestrator/execution/execution-planner.js +14 -2
- package/dist/mcps/registry.json +0 -1
- package/dist/mcps/researcher-confidence.js +92 -0
- package/dist/mcps/researcher.server.js +19 -3
- package/dist/memory-routing/null-provider.js +12 -0
- package/dist/orchestrator/universal-registry-bridge.js +1 -1
- package/dist/skills/registry.json +0 -1
- package/package.json +1 -1
- 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 +466 -0
- package/scripts/node/postinstall.cjs +24 -83
- package/scripts/node/pre-publish-guard.js +20 -16
- package/scripts/node/setup.cjs +11 -10
- package/scripts/node/universal-version-manager.js +17 -3
- package/src/mcps/index.ts +1 -0
- package/src/mcps/knowledge-skills/skill-invocation.server.ts +3 -2
- package/src/mcps/knowledge-skills/storyteller.server.ts +206 -0
- package/src/mcps/orchestrator/execution/execution-planner.ts +14 -2
- package/src/mcps/orchestrator/types.ts +4 -0
- package/src/mcps/registry.json +0 -1
- package/src/mcps/researcher-confidence.ts +144 -0
- package/src/mcps/researcher.server.ts +28 -3
- package/src/opencode/codex.codex +1 -1
- package/src/opencode/enforcer-config.json +1 -4
- package/src/skills/registry.json +0 -1
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { frameworkLogger } from '../core/framework-logger.js';
|
|
2
|
+
import { getMemoryRoutingProviderSync } from '../memory-routing/index.js';
|
|
3
|
+
import type {
|
|
4
|
+
MemoryRoutingContext,
|
|
5
|
+
MemoryTaskConfidence,
|
|
6
|
+
} from '../memory-routing/types.js';
|
|
7
|
+
|
|
8
|
+
const TRAP_LANGUAGE = /TYPE:\s*ontological-trap|ontological[- ]trap/i;
|
|
9
|
+
const DEFAULT_MIN_CONFIDENCE_GATE = 0.55;
|
|
10
|
+
|
|
11
|
+
export interface ResearcherMemoryContext {
|
|
12
|
+
providerId: string;
|
|
13
|
+
confidence: MemoryTaskConfidence;
|
|
14
|
+
matchedSignals: string[];
|
|
15
|
+
recommendedAgent: string | null;
|
|
16
|
+
triggeredBy: 'trap-language' | 'high-confidence-primitives';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function shouldQueryRepertoireConfidence(
|
|
20
|
+
description: string,
|
|
21
|
+
proposalType = '',
|
|
22
|
+
): boolean {
|
|
23
|
+
const text = `${description} ${proposalType}`.trim();
|
|
24
|
+
return TRAP_LANGUAGE.test(text);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function hasHighConfidencePrimitiveMatch(
|
|
28
|
+
routingContext: MemoryRoutingContext,
|
|
29
|
+
minConfidence = DEFAULT_MIN_CONFIDENCE_GATE,
|
|
30
|
+
): boolean {
|
|
31
|
+
const confidences = routingContext.signalConfidences ?? {};
|
|
32
|
+
return Object.values(confidences).some((confidence) => confidence >= minConfidence);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function buildTaskText(
|
|
36
|
+
proposalTitle: string,
|
|
37
|
+
proposalDescription: string,
|
|
38
|
+
proposalType: string,
|
|
39
|
+
): string {
|
|
40
|
+
return [proposalTitle, proposalDescription, proposalType].filter(Boolean).join('\n');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Resolve Repertoire task confidence for researcher proposal analysis.
|
|
45
|
+
* Triggered by ontological-trap language or high-confidence primitive matches.
|
|
46
|
+
*/
|
|
47
|
+
export function resolveResearcherMemoryContext(input: {
|
|
48
|
+
proposalTitle?: string;
|
|
49
|
+
proposalDescription?: string;
|
|
50
|
+
proposalType?: string;
|
|
51
|
+
}): ResearcherMemoryContext | null {
|
|
52
|
+
const proposalTitle = input.proposalTitle ?? '';
|
|
53
|
+
const proposalDescription = input.proposalDescription ?? '';
|
|
54
|
+
const proposalType = input.proposalType ?? '';
|
|
55
|
+
const taskText = buildTaskText(proposalTitle, proposalDescription, proposalType);
|
|
56
|
+
|
|
57
|
+
const provider = getMemoryRoutingProviderSync();
|
|
58
|
+
if (provider.id === 'null' || !provider.getTaskConfidence) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const trapLanguageDetected = shouldQueryRepertoireConfidence(
|
|
63
|
+
proposalDescription,
|
|
64
|
+
proposalType,
|
|
65
|
+
);
|
|
66
|
+
const routingContext = provider.buildRoutingContext(taskText);
|
|
67
|
+
const primitiveMatchDetected = hasHighConfidencePrimitiveMatch(routingContext);
|
|
68
|
+
|
|
69
|
+
if (!trapLanguageDetected && !primitiveMatchDetected) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const confidence = provider.getTaskConfidence({
|
|
74
|
+
id: 'researcher-proposal',
|
|
75
|
+
description: taskText,
|
|
76
|
+
type: proposalType || 'governance',
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const matchedSignals =
|
|
80
|
+
confidence.matchedSignals.length > 0
|
|
81
|
+
? confidence.matchedSignals
|
|
82
|
+
: routingContext.matchedSignals;
|
|
83
|
+
|
|
84
|
+
const context: ResearcherMemoryContext = {
|
|
85
|
+
providerId: provider.id,
|
|
86
|
+
confidence,
|
|
87
|
+
matchedSignals,
|
|
88
|
+
recommendedAgent: confidence.recommendedAgent,
|
|
89
|
+
triggeredBy: trapLanguageDetected ? 'trap-language' : 'high-confidence-primitives',
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
if (confidence.highConfidenceTrapPresent) {
|
|
93
|
+
frameworkLogger.log('mcps/researcher', 'repertoire-trap-detected', 'info', {
|
|
94
|
+
providerId: provider.id,
|
|
95
|
+
matchedSignals,
|
|
96
|
+
complexityBoost: confidence.complexityBoost,
|
|
97
|
+
recommendedAgent: confidence.recommendedAgent,
|
|
98
|
+
triggeredBy: context.triggeredBy,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return context;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function buildMemoryRoutingEvidence(
|
|
106
|
+
context: ResearcherMemoryContext,
|
|
107
|
+
): string[] {
|
|
108
|
+
const { confidence, matchedSignals, recommendedAgent } = context;
|
|
109
|
+
const signalSummary = confidence.signals
|
|
110
|
+
.map((entry) => `${entry.name} (${entry.confidence.toFixed(2)})`)
|
|
111
|
+
.join(', ');
|
|
112
|
+
|
|
113
|
+
const lines = [
|
|
114
|
+
`Repertoire memory routing (${context.providerId}, trigger: ${context.triggeredBy})`,
|
|
115
|
+
`Matched signals: ${matchedSignals.join(', ') || 'none'}`,
|
|
116
|
+
`Signal confidences: ${signalSummary || 'none'}`,
|
|
117
|
+
`High-confidence trap present: ${confidence.highConfidenceTrapPresent}`,
|
|
118
|
+
`Complexity boost: ${confidence.complexityBoost}`,
|
|
119
|
+
];
|
|
120
|
+
|
|
121
|
+
if (recommendedAgent) {
|
|
122
|
+
lines.push(`Recommended agent for trap handling: ${recommendedAgent}`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return lines;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function formatMemoryRoutingBlock(context: ResearcherMemoryContext): string {
|
|
129
|
+
const { confidence, matchedSignals, recommendedAgent } = context;
|
|
130
|
+
const lines = [
|
|
131
|
+
'MEMORY_ROUTING:',
|
|
132
|
+
` provider: ${context.providerId}`,
|
|
133
|
+
` trigger: ${context.triggeredBy}`,
|
|
134
|
+
` matchedSignals: ${matchedSignals.join(', ') || 'none'}`,
|
|
135
|
+
` highConfidenceTrapPresent: ${confidence.highConfidenceTrapPresent}`,
|
|
136
|
+
` complexityBoost: ${confidence.complexityBoost}`,
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
if (recommendedAgent) {
|
|
140
|
+
lines.push(` recommendedAgent: ${recommendedAgent}`);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return lines.join('\n');
|
|
144
|
+
}
|
|
@@ -13,6 +13,11 @@ import * as fs from "fs";
|
|
|
13
13
|
import * as path from "path";
|
|
14
14
|
import { frameworkLogger } from "../core/framework-logger.js";
|
|
15
15
|
import { tryLLMGovernance } from "../governance/llm-governance-provider.js";
|
|
16
|
+
import {
|
|
17
|
+
buildMemoryRoutingEvidence,
|
|
18
|
+
formatMemoryRoutingBlock,
|
|
19
|
+
resolveResearcherMemoryContext,
|
|
20
|
+
} from "./researcher-confidence.js";
|
|
16
21
|
import { XrayKnowledgeSkillBase } from "./shared/knowledge-skill-base.js";
|
|
17
22
|
|
|
18
23
|
interface SearchResult {
|
|
@@ -452,20 +457,40 @@ class XrayLibrarianServer extends XrayKnowledgeSkillBase {
|
|
|
452
457
|
async analyzeProposal(args: AnalyzeProposalArgs): Promise<CallToolResult> {
|
|
453
458
|
const { proposalTitle = "", proposalDescription = "", evidence = [], proposalType = "" } = args || {};
|
|
454
459
|
|
|
460
|
+
const memoryContext = resolveResearcherMemoryContext({
|
|
461
|
+
proposalTitle,
|
|
462
|
+
proposalDescription,
|
|
463
|
+
proposalType,
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
const enrichedEvidence = [...(evidence || [])];
|
|
467
|
+
if (memoryContext?.confidence.highConfidenceTrapPresent) {
|
|
468
|
+
enrichedEvidence.push(...buildMemoryRoutingEvidence(memoryContext));
|
|
469
|
+
}
|
|
470
|
+
|
|
455
471
|
const vote = await tryLLMGovernance(
|
|
456
472
|
"researcher",
|
|
457
473
|
proposalTitle || "",
|
|
458
474
|
proposalDescription || "",
|
|
459
|
-
|
|
475
|
+
enrichedEvidence,
|
|
460
476
|
proposalType || "",
|
|
461
477
|
);
|
|
462
478
|
|
|
479
|
+
const memoryRoutingBlock =
|
|
480
|
+
memoryContext?.confidence.highConfidenceTrapPresent
|
|
481
|
+
? `\n${formatMemoryRoutingBlock(memoryContext)}`
|
|
482
|
+
: "";
|
|
483
|
+
|
|
463
484
|
if (!vote) {
|
|
485
|
+
const abstainReason = memoryContext?.confidence.highConfidenceTrapPresent
|
|
486
|
+
? "No LLM governance provider configured. Repertoire detected a high-confidence ontological trap — route to the recommended agent before proceeding."
|
|
487
|
+
: "No LLM governance provider configured. Set XRAY_GOVERNANCE_LLM_ENABLED=true + XRAY_LLM_ENDPOINT, or install Hermes and run: hermes auth add xai-oauth --no-browser";
|
|
488
|
+
|
|
464
489
|
return {
|
|
465
490
|
content: [
|
|
466
491
|
{
|
|
467
492
|
type: "text",
|
|
468
|
-
text:
|
|
493
|
+
text: `DECISION: abstain\nCONFIDENCE: 0.50\nREASONING: ${abstainReason}${memoryRoutingBlock}`,
|
|
469
494
|
},
|
|
470
495
|
],
|
|
471
496
|
};
|
|
@@ -475,7 +500,7 @@ class XrayLibrarianServer extends XrayKnowledgeSkillBase {
|
|
|
475
500
|
content: [
|
|
476
501
|
{
|
|
477
502
|
type: "text",
|
|
478
|
-
text: `DECISION: ${vote.decision}\nCONFIDENCE: ${vote.confidence.toFixed(2)}\nREASONING: ${vote.reasoning}`,
|
|
503
|
+
text: `DECISION: ${vote.decision}\nCONFIDENCE: ${vote.confidence.toFixed(2)}\nREASONING: ${vote.reasoning}${memoryRoutingBlock}`,
|
|
479
504
|
},
|
|
480
505
|
],
|
|
481
506
|
};
|
package/src/opencode/codex.codex
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.3.
|
|
2
|
+
"version": "3.3.1",
|
|
3
3
|
"terms": [
|
|
4
4
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60
|
|
5
5
|
],
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"version": "3.1.0",
|
|
4
|
-
"description": "Codex-compliant framework configuration for Credible UI project",
|
|
2
|
+
"description": "Codex-compliant framework configuration",
|
|
5
3
|
"thresholds": {
|
|
6
4
|
"bundleSize": {
|
|
7
5
|
"maxSize": "3MB",
|
|
@@ -220,7 +218,6 @@
|
|
|
220
218
|
}
|
|
221
219
|
},
|
|
222
220
|
"codex": {
|
|
223
|
-
"version": "3.1.0",
|
|
224
221
|
"terms": [
|
|
225
222
|
1,
|
|
226
223
|
2,
|