0xray 3.4.10 → 3.5.0
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/.xray/features.json +2 -1
- package/AGENTS-consumer.md +1 -1
- package/AGENTS.md +1 -1
- package/README.md +1 -1
- package/SKILLS.md +1 -1
- package/dist/AGENTS.md +1 -1
- package/dist/CHANGELOG.md +20 -0
- package/dist/README.md +1 -1
- package/dist/SKILLS.md +1 -1
- package/dist/core/features-config.d.ts +2 -0
- package/dist/integrations/grok/hooks/grok-hook-utils.js +390 -16
- package/dist/integrations/grok/hooks/post-tool-use.js +62 -0
- package/dist/integrations/grok/hooks/pre-tool-use.js +43 -5
- package/dist/integrations/grok/hooks/session-start.js +8 -0
- package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +15 -0
- package/dist/mcps/orchestrator/handlers/complexity-handler.d.ts +1 -0
- package/dist/mcps/orchestrator/handlers/complexity-handler.js +7 -0
- package/dist/mcps/orchestrator/handlers/task-handler.js +20 -3
- package/dist/nucleus/lead-dev-plan-persistence.d.ts +43 -0
- package/dist/nucleus/lead-dev-plan-persistence.js +155 -0
- package/dist/nucleus/pending-delegations.d.ts +71 -0
- package/dist/nucleus/pending-delegations.js +285 -0
- package/package.json +4 -2
- package/scripts/mjs/verify-grok-delegation-gate.mjs +173 -0
- package/scripts/mjs/verify-orchestrator-behavior.mjs +47 -1
- package/src/integrations/grok/plugin/0xray/hooks/hooks.json +15 -0
- package/src/mcps/orchestrator/handlers/complexity-handler.ts +8 -1
- package/src/mcps/orchestrator/handlers/task-handler.ts +53 -3
- package/xray/features.json +2 -1
|
@@ -9,6 +9,11 @@ import { getExecutionPlanner } from '../execution/execution-planner.js';
|
|
|
9
9
|
import { mcpClientManager } from '../../../mcps/mcp-client.js';
|
|
10
10
|
import { addObservations, extractOrchestrationObservations, spawnAside } from '../aside-context.js';
|
|
11
11
|
import { getProvider } from '../config/memory-routing-bridge.js';
|
|
12
|
+
import {
|
|
13
|
+
delegationSummaryForResponse,
|
|
14
|
+
recordDeferredDelegations,
|
|
15
|
+
type PendingDelegation,
|
|
16
|
+
} from '../../../nucleus/pending-delegations.js';
|
|
12
17
|
import type { OrchestrationResult, OrchestrationTask } from '../types.js';
|
|
13
18
|
|
|
14
19
|
export interface TaskHandlerDeps {
|
|
@@ -66,6 +71,7 @@ export class TaskHandler {
|
|
|
66
71
|
};
|
|
67
72
|
|
|
68
73
|
const startTime = Date.now();
|
|
74
|
+
let pendingDelegations: PendingDelegation[] = [];
|
|
69
75
|
|
|
70
76
|
try {
|
|
71
77
|
// Validate tasks
|
|
@@ -90,6 +96,16 @@ export class TaskHandler {
|
|
|
90
96
|
|
|
91
97
|
const results = await this.executePlan(executionPlan, sessionId, timeout);
|
|
92
98
|
|
|
99
|
+
if (results.deferredRecords.length > 0) {
|
|
100
|
+
pendingDelegations = recordDeferredDelegations(sessionId, results.deferredRecords);
|
|
101
|
+
await frameworkLogger.log(
|
|
102
|
+
'orchestrator.task-handler',
|
|
103
|
+
'pending-delegations-recorded',
|
|
104
|
+
'info',
|
|
105
|
+
{ count: pendingDelegations.length, sessionId },
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
93
109
|
// Feed per-task outcomes back to memory provider (not aggregate session stats)
|
|
94
110
|
if (memoryProvider.ingestFeedback) {
|
|
95
111
|
const outcomeByKey = new Map(
|
|
@@ -150,7 +166,12 @@ export class TaskHandler {
|
|
|
150
166
|
|
|
151
167
|
orchestrationResult.duration = Date.now() - startTime;
|
|
152
168
|
|
|
153
|
-
const response = this.formatOrchestrationResponse(
|
|
169
|
+
const response = this.formatOrchestrationResponse(
|
|
170
|
+
description,
|
|
171
|
+
orchestrationResult,
|
|
172
|
+
executionMode,
|
|
173
|
+
pendingDelegations,
|
|
174
|
+
);
|
|
154
175
|
|
|
155
176
|
return { content: [{ type: 'text', text: response }] };
|
|
156
177
|
}
|
|
@@ -173,6 +194,12 @@ export class TaskHandler {
|
|
|
173
194
|
bottlenecks: string[];
|
|
174
195
|
recommendations: string[];
|
|
175
196
|
agentOutputs?: Record<string, string>;
|
|
197
|
+
deferredRecords: Array<{
|
|
198
|
+
taskId: string;
|
|
199
|
+
agent: string;
|
|
200
|
+
description: string;
|
|
201
|
+
type?: string;
|
|
202
|
+
}>;
|
|
176
203
|
taskOutcomes: Array<{
|
|
177
204
|
taskId: string;
|
|
178
205
|
agent: string;
|
|
@@ -185,6 +212,12 @@ export class TaskHandler {
|
|
|
185
212
|
let failedTasks = 0;
|
|
186
213
|
let deferredTasks = 0;
|
|
187
214
|
const agentOutputs: Record<string, string> = {};
|
|
215
|
+
const deferredRecords: Array<{
|
|
216
|
+
taskId: string;
|
|
217
|
+
agent: string;
|
|
218
|
+
description: string;
|
|
219
|
+
type?: string;
|
|
220
|
+
}> = [];
|
|
188
221
|
const taskOutcomes: Array<{
|
|
189
222
|
taskId: string;
|
|
190
223
|
agent: string;
|
|
@@ -245,6 +278,12 @@ export class TaskHandler {
|
|
|
245
278
|
} else {
|
|
246
279
|
for (const task of tasks) {
|
|
247
280
|
deferredTasks++;
|
|
281
|
+
deferredRecords.push({
|
|
282
|
+
taskId: task.id,
|
|
283
|
+
agent,
|
|
284
|
+
description: task.description,
|
|
285
|
+
type: task.type,
|
|
286
|
+
});
|
|
248
287
|
taskOutcomes.push({
|
|
249
288
|
taskId: task.id,
|
|
250
289
|
agent,
|
|
@@ -288,6 +327,7 @@ export class TaskHandler {
|
|
|
288
327
|
bottlenecks,
|
|
289
328
|
recommendations,
|
|
290
329
|
agentOutputs,
|
|
330
|
+
deferredRecords,
|
|
291
331
|
taskOutcomes,
|
|
292
332
|
};
|
|
293
333
|
}
|
|
@@ -329,8 +369,18 @@ export class TaskHandler {
|
|
|
329
369
|
private formatOrchestrationResponse(
|
|
330
370
|
description: string,
|
|
331
371
|
result: OrchestrationResult,
|
|
332
|
-
executionMode: string
|
|
372
|
+
executionMode: string,
|
|
373
|
+
pendingDelegations: PendingDelegation[] = [],
|
|
333
374
|
): string {
|
|
375
|
+
const delegationsBlock =
|
|
376
|
+
pendingDelegations.length > 0
|
|
377
|
+
? `\n**Delegations (host Task required):**\n\`\`\`json\n${JSON.stringify(
|
|
378
|
+
{ delegations: delegationSummaryForResponse(pendingDelegations) },
|
|
379
|
+
null,
|
|
380
|
+
2,
|
|
381
|
+
)}\n\`\`\`\n`
|
|
382
|
+
: '';
|
|
383
|
+
|
|
334
384
|
return `🎯 Orchestration Complete: "${description}"
|
|
335
385
|
|
|
336
386
|
**Session ID:** ${result.sessionId}
|
|
@@ -355,6 +405,6 @@ ${result.recommendations.length > 0 ? result.recommendations.map((r) => `•
|
|
|
355
405
|
|
|
356
406
|
${result.agentOutputs && Object.keys(result.agentOutputs).length > 0
|
|
357
407
|
? `**Agent Outputs (real MCP responses):**\n${Object.entries(result.agentOutputs).map(([k, v]) => `• ${k}: ${v.substring(0, 200)}${v.length > 200 ? '...' : ''}`).join('\n')}\n`
|
|
358
|
-
: ''}`;
|
|
408
|
+
: ''}${delegationsBlock}`;
|
|
359
409
|
}
|
|
360
410
|
}
|
package/xray/features.json
CHANGED