@claude-flow/cli 3.62.0 → 3.63.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/.claude/helpers/helpers.manifest.json +2 -2
- package/README.md +2 -2
- package/catalog-manifest.json +3 -3
- package/dist/src/mcp-tools/agentbbs-tools.js +7 -2
- package/dist/src/mcp-tools/managed-agent-tools.d.ts +1 -20
- package/dist/src/mcp-tools/managed-agent-tools.js +347 -108
- package/dist/src/mcp-tools/managed-learning-tool.d.ts +4 -0
- package/dist/src/mcp-tools/managed-learning-tool.js +46 -0
- package/dist/src/mcp-tools/memory-tools.js +6 -3
- package/dist/src/missions/schemas.d.ts +12 -12
- package/dist/src/ruvector/diskann-backend.d.ts +78 -0
- package/dist/src/ruvector/diskann-backend.js +310 -0
- package/dist/src/services/flywheel-transaction.js +5 -0
- package/dist/src/services/managed-learning-loop.d.ts +79 -0
- package/dist/src/services/managed-learning-loop.js +76 -0
- package/dist/src/services/managed-learning-store.d.ts +187 -0
- package/dist/src/services/managed-learning-store.js +238 -0
- package/dist/src/services/managed-learning.d.ts +108 -0
- package/dist/src/services/managed-learning.js +197 -0
- package/dist/src/services/managed-memory-client.d.ts +72 -0
- package/dist/src/services/managed-memory-client.js +236 -0
- package/dist/src/services/managed-memory-worker.d.ts +56 -0
- package/dist/src/services/managed-memory-worker.js +161 -0
- package/dist/src/services/managed-run-collector.d.ts +93 -0
- package/dist/src/services/managed-run-collector.js +181 -0
- package/dist/src/services/managed-run-store.d.ts +52 -0
- package/dist/src/services/managed-run-store.js +119 -0
- package/dist/src/services/managed-workflows.d.ts +101 -0
- package/dist/src/services/managed-workflows.js +183 -0
- package/node_modules/@claude-flow/codex/dist/cli.js +0 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +0 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts +6 -6
- package/package.json +1 -1
- package/plugins/ruflo-console/dist/tui.mjs +167 -164
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/** Provider event semantics for ADR-115 / dynamic workflows. No model calls. */
|
|
2
|
+
export interface ManagedEvent {
|
|
3
|
+
id: string;
|
|
4
|
+
type: string;
|
|
5
|
+
processed_at?: string | null;
|
|
6
|
+
content?: Array<{
|
|
7
|
+
type: string;
|
|
8
|
+
text?: string;
|
|
9
|
+
}>;
|
|
10
|
+
name?: string;
|
|
11
|
+
input?: unknown;
|
|
12
|
+
stop_reason?: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
workflow_run_id?: string | null;
|
|
16
|
+
session_thread_id?: string;
|
|
17
|
+
result?: {
|
|
18
|
+
type: string;
|
|
19
|
+
} | string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface EventPage {
|
|
23
|
+
data: ManagedEvent[];
|
|
24
|
+
next_page?: string | null;
|
|
25
|
+
}
|
|
26
|
+
/** Validate untrusted pages before deriving lifecycle claims. */
|
|
27
|
+
export declare function eventPage(value: unknown): EventPage;
|
|
28
|
+
/** Reads complete history, bounded and deduplicated. Cursor is opaque, never a URL. */
|
|
29
|
+
export declare function readManagedEvents(read: (query: string) => Promise<unknown>, since?: string): Promise<ManagedEvent[]>;
|
|
30
|
+
/** Incremental reducer. Provider completion is always unverified. */
|
|
31
|
+
export declare class ManagedProgress {
|
|
32
|
+
private seen;
|
|
33
|
+
private text;
|
|
34
|
+
private tools;
|
|
35
|
+
private runs;
|
|
36
|
+
private failures;
|
|
37
|
+
private status;
|
|
38
|
+
private stopReason;
|
|
39
|
+
private cost;
|
|
40
|
+
private since;
|
|
41
|
+
private bytes;
|
|
42
|
+
private finished;
|
|
43
|
+
private interrupted;
|
|
44
|
+
accept(events: ManagedEvent[]): void;
|
|
45
|
+
watermark(): string | undefined;
|
|
46
|
+
snapshot(): {
|
|
47
|
+
assistantText: string;
|
|
48
|
+
toolUses: {
|
|
49
|
+
name: string;
|
|
50
|
+
input: unknown;
|
|
51
|
+
}[];
|
|
52
|
+
status: string;
|
|
53
|
+
stopReason: string | null;
|
|
54
|
+
eventCount: number;
|
|
55
|
+
workflowRuns: {
|
|
56
|
+
id: string;
|
|
57
|
+
status: string;
|
|
58
|
+
result?: string;
|
|
59
|
+
}[];
|
|
60
|
+
openRuns: number;
|
|
61
|
+
finished: boolean;
|
|
62
|
+
interrupted: boolean;
|
|
63
|
+
blocked: boolean;
|
|
64
|
+
observedFailures: number;
|
|
65
|
+
listCost: unknown;
|
|
66
|
+
verification: "unverified";
|
|
67
|
+
needsThreadInspection: boolean;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/** Build only the supported configuration; do not pass arbitrary multiagent JSON. */
|
|
71
|
+
export declare function dynamicConfig(input: Record<string, unknown>): {
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
budget: {
|
|
74
|
+
type: string;
|
|
75
|
+
max_list_cost: {
|
|
76
|
+
amount: string;
|
|
77
|
+
currency: string;
|
|
78
|
+
};
|
|
79
|
+
} | undefined;
|
|
80
|
+
multiagent: {
|
|
81
|
+
type: string;
|
|
82
|
+
subagents: {
|
|
83
|
+
type: string;
|
|
84
|
+
};
|
|
85
|
+
workflows: {
|
|
86
|
+
inline_agents?: {
|
|
87
|
+
type: string;
|
|
88
|
+
} | undefined;
|
|
89
|
+
predefined_agents?: any[] | undefined;
|
|
90
|
+
type: string;
|
|
91
|
+
};
|
|
92
|
+
} | undefined;
|
|
93
|
+
networking: {
|
|
94
|
+
type: string;
|
|
95
|
+
allowed_hosts: any[];
|
|
96
|
+
} | {
|
|
97
|
+
type: {};
|
|
98
|
+
allowed_hosts?: undefined;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=managed-workflows.d.ts.map
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/** Validate untrusted pages before deriving lifecycle claims. */
|
|
2
|
+
export function eventPage(value) {
|
|
3
|
+
if (!value || typeof value !== 'object')
|
|
4
|
+
throw new Error('Invalid Managed Agents event page');
|
|
5
|
+
const page = value;
|
|
6
|
+
if (!Array.isArray(page.data) || page.data.some(e => !e || typeof e.id !== 'string' || !e.id || typeof e.type !== 'string')) {
|
|
7
|
+
throw new Error('Invalid Managed Agents events');
|
|
8
|
+
}
|
|
9
|
+
for (const e of page.data) {
|
|
10
|
+
if (e.processed_at != null && (typeof e.processed_at !== 'string' || !Number.isFinite(Date.parse(e.processed_at))))
|
|
11
|
+
throw new Error('Invalid event timestamp');
|
|
12
|
+
if (e.type === 'agent.message' && e.content !== undefined && (!Array.isArray(e.content) || e.content.some(b => !b || typeof b.type !== 'string' || (b.text !== undefined && typeof b.text !== 'string'))))
|
|
13
|
+
throw new Error('Invalid event content');
|
|
14
|
+
if (e.stop_reason != null && typeof e.stop_reason.type !== 'string')
|
|
15
|
+
throw new Error('Invalid event stop reason');
|
|
16
|
+
if (e.type === 'workflow_run.status_ended' && (!e.result || typeof e.result !== 'object' || typeof e.result.type !== 'string'))
|
|
17
|
+
throw new Error('Invalid workflow result');
|
|
18
|
+
if (e.type.startsWith('workflow_run.') && e.type !== 'workflow_run.error' && (typeof e.workflow_run_id !== 'string' || !e.workflow_run_id))
|
|
19
|
+
throw new Error('Invalid workflow ID');
|
|
20
|
+
if (e.workflow_run_id != null && typeof e.workflow_run_id !== 'string')
|
|
21
|
+
throw new Error('Invalid workflow ID');
|
|
22
|
+
}
|
|
23
|
+
if (page.next_page != null && (typeof page.next_page !== 'string' || !page.next_page || page.next_page.length > 4096)) {
|
|
24
|
+
throw new Error('Invalid Managed Agents cursor');
|
|
25
|
+
}
|
|
26
|
+
return page;
|
|
27
|
+
}
|
|
28
|
+
/** Reads complete history, bounded and deduplicated. Cursor is opaque, never a URL. */
|
|
29
|
+
export async function readManagedEvents(read, since) {
|
|
30
|
+
const events = new Map();
|
|
31
|
+
const cursors = new Set();
|
|
32
|
+
let bytes = 0;
|
|
33
|
+
let cursor;
|
|
34
|
+
for (let count = 0; count < 100; count++) {
|
|
35
|
+
const query = new URLSearchParams({ order: 'asc', limit: '100' });
|
|
36
|
+
if (cursor)
|
|
37
|
+
query.set('page', cursor);
|
|
38
|
+
if (since)
|
|
39
|
+
query.set('created_at[gte]', since);
|
|
40
|
+
const page = eventPage(await read(query.toString()));
|
|
41
|
+
bytes += Buffer.byteLength(JSON.stringify(page), 'utf8');
|
|
42
|
+
if (bytes > 16_000_000)
|
|
43
|
+
throw new Error('Managed Agents transcript limit exceeded');
|
|
44
|
+
for (const e of page.data)
|
|
45
|
+
events.set(e.id, e);
|
|
46
|
+
if (events.size > 10_000)
|
|
47
|
+
throw new Error('Managed Agents event limit exceeded');
|
|
48
|
+
if (!page.next_page)
|
|
49
|
+
return [...events.values()];
|
|
50
|
+
if (cursors.has(page.next_page))
|
|
51
|
+
throw new Error('Repeated Managed Agents cursor');
|
|
52
|
+
cursors.add(page.next_page);
|
|
53
|
+
cursor = page.next_page;
|
|
54
|
+
}
|
|
55
|
+
throw new Error('Managed Agents page limit exceeded');
|
|
56
|
+
}
|
|
57
|
+
/** Incremental reducer. Provider completion is always unverified. */
|
|
58
|
+
export class ManagedProgress {
|
|
59
|
+
seen = new Set();
|
|
60
|
+
text = [];
|
|
61
|
+
tools = [];
|
|
62
|
+
runs = new Map();
|
|
63
|
+
failures = 0;
|
|
64
|
+
status = 'unknown';
|
|
65
|
+
stopReason = null;
|
|
66
|
+
cost = null;
|
|
67
|
+
since;
|
|
68
|
+
bytes = 0;
|
|
69
|
+
finished = false;
|
|
70
|
+
interrupted = false;
|
|
71
|
+
accept(events) {
|
|
72
|
+
for (const e of events) {
|
|
73
|
+
// Queued user messages may be returned again after processing.
|
|
74
|
+
if (!e.processed_at)
|
|
75
|
+
continue;
|
|
76
|
+
if (this.seen.has(e.id))
|
|
77
|
+
continue;
|
|
78
|
+
if (this.seen.size >= 10_000)
|
|
79
|
+
throw new Error('Managed Agents event limit exceeded');
|
|
80
|
+
this.bytes += Buffer.byteLength(JSON.stringify(e), 'utf8');
|
|
81
|
+
if (this.bytes > 16_000_000)
|
|
82
|
+
throw new Error('Managed Agents transcript limit exceeded');
|
|
83
|
+
this.seen.add(e.id);
|
|
84
|
+
if (!this.since || e.processed_at > this.since)
|
|
85
|
+
this.since = e.processed_at;
|
|
86
|
+
if (e.type === 'user.message') {
|
|
87
|
+
this.finished = false;
|
|
88
|
+
this.interrupted = false;
|
|
89
|
+
}
|
|
90
|
+
else if (e.type === 'user.interrupt') {
|
|
91
|
+
this.finished = false;
|
|
92
|
+
this.interrupted = true;
|
|
93
|
+
}
|
|
94
|
+
else if (e.type === 'agent.message' && Array.isArray(e.content)) {
|
|
95
|
+
this.text.push(e.content.filter(b => b?.type === 'text' && typeof b.text === 'string').map(b => b.text).join(''));
|
|
96
|
+
}
|
|
97
|
+
else if (e.type === 'agent.tool_use' || e.type === 'agent.mcp_tool_use') {
|
|
98
|
+
this.tools.push({ name: e.name ?? '?', input: e.input });
|
|
99
|
+
}
|
|
100
|
+
else if (e.type === 'session.status_running') {
|
|
101
|
+
this.status = 'running';
|
|
102
|
+
this.stopReason = null;
|
|
103
|
+
this.finished = false;
|
|
104
|
+
}
|
|
105
|
+
else if (e.type === 'session.status_idle') {
|
|
106
|
+
this.status = 'idle';
|
|
107
|
+
this.stopReason = e.stop_reason?.type ?? null;
|
|
108
|
+
this.finished = this.stopReason === 'end_turn' && !this.interrupted && [...this.runs.values()].every(r => r.status === 'ended');
|
|
109
|
+
}
|
|
110
|
+
else if (e.type === 'session.status_terminated') {
|
|
111
|
+
this.status = 'terminated';
|
|
112
|
+
this.finished = false;
|
|
113
|
+
}
|
|
114
|
+
else if (e.type === 'session.error' || e.type === 'session.status_error' || e.type === 'session.status_failed') {
|
|
115
|
+
this.failures++;
|
|
116
|
+
}
|
|
117
|
+
else if (e.type === 'session.usage') {
|
|
118
|
+
this.cost = e.usage && typeof e.usage === 'object' ? e.usage.list_cost ?? null : null;
|
|
119
|
+
}
|
|
120
|
+
if (e.type === 'workflow_run.error')
|
|
121
|
+
this.failures++;
|
|
122
|
+
if (e.workflow_run_id && e.type.startsWith('workflow_run.')) {
|
|
123
|
+
this.finished = false;
|
|
124
|
+
const run = this.runs.get(e.workflow_run_id) ?? { id: e.workflow_run_id, status: 'running' };
|
|
125
|
+
if (e.type === 'workflow_run.status_ended') {
|
|
126
|
+
run.status = 'ended';
|
|
127
|
+
run.result = typeof e.result === 'object' ? e.result.type : 'unknown';
|
|
128
|
+
if (run.result !== 'completed')
|
|
129
|
+
this.failures++;
|
|
130
|
+
}
|
|
131
|
+
else if (e.type === 'workflow_run.status_idle' && run.status !== 'ended')
|
|
132
|
+
run.status = 'idle';
|
|
133
|
+
else if (e.type === 'workflow_run.status_running' && run.status !== 'ended')
|
|
134
|
+
run.status = 'running';
|
|
135
|
+
this.runs.set(run.id, run);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
watermark() { return this.since; }
|
|
140
|
+
snapshot() {
|
|
141
|
+
const workflowRuns = [...this.runs.values()].map(r => ({ ...r }));
|
|
142
|
+
const openRuns = workflowRuns.filter(r => r.status !== 'ended').length;
|
|
143
|
+
const blocked = this.status === 'idle' && ['budget_reached', 'requires_action'].includes(this.stopReason ?? '');
|
|
144
|
+
return {
|
|
145
|
+
assistantText: this.text.join(''), toolUses: [...this.tools], status: this.status,
|
|
146
|
+
stopReason: this.stopReason, eventCount: this.seen.size, workflowRuns, openRuns,
|
|
147
|
+
finished: this.finished, interrupted: this.interrupted, blocked, observedFailures: this.failures, listCost: this.cost,
|
|
148
|
+
verification: 'unverified',
|
|
149
|
+
needsThreadInspection: workflowRuns.length > 0,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/** Build only the supported configuration; do not pass arbitrary multiagent JSON. */
|
|
154
|
+
export function dynamicConfig(input) {
|
|
155
|
+
if (input.dynamicWorkflows !== undefined && typeof input.dynamicWorkflows !== 'boolean')
|
|
156
|
+
throw new Error('dynamicWorkflows must be boolean');
|
|
157
|
+
const enabled = input.dynamicWorkflows === true;
|
|
158
|
+
if (input.budgetCents !== undefined || enabled) {
|
|
159
|
+
if (typeof input.budgetCents !== 'string' || !/^[1-9][0-9]{0,8}$/.test(input.budgetCents)) {
|
|
160
|
+
throw new Error('budgetCents must be a positive integer cents string (maximum 999999999)');
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (enabled && input.networking !== undefined && input.networking !== 'limited')
|
|
164
|
+
throw new Error('Dynamic workflows require limited networking');
|
|
165
|
+
const hosts = input.allowedHosts ?? [];
|
|
166
|
+
if (!Array.isArray(hosts) || hosts.length > 100 || hosts.some(h => typeof h !== 'string' || h.length > 253 || !/^[a-z0-9]+(?:[.-][a-z0-9]+)*$/i.test(h))) {
|
|
167
|
+
throw new Error('allowedHosts must contain at most 100 exact hostnames');
|
|
168
|
+
}
|
|
169
|
+
const agents = input.predefinedAgents;
|
|
170
|
+
if (agents !== undefined && (!Array.isArray(agents) || agents.length < 1 || agents.length > 20 || agents.some(a => typeof a !== 'string' || !/^agent_[A-Za-z0-9]+$/.test(a)))) {
|
|
171
|
+
throw new Error('predefinedAgents must contain 1 to 20 agent IDs');
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
enabled,
|
|
175
|
+
budget: input.budgetCents === undefined ? undefined : { type: 'limit', max_list_cost: { amount: input.budgetCents, currency: 'USD' } },
|
|
176
|
+
multiagent: enabled ? {
|
|
177
|
+
type: 'multiagent_20261001', subagents: { type: 'disabled' },
|
|
178
|
+
workflows: { type: 'enabled', ...(agents ? { inline_agents: { type: 'disabled' }, predefined_agents: agents } : {}) },
|
|
179
|
+
} : undefined,
|
|
180
|
+
networking: enabled || input.networking === 'limited' ? { type: 'limited', allowed_hosts: hosts } : { type: input.networking ?? 'unrestricted' },
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=managed-workflows.js.map
|
|
File without changes
|
|
File without changes
|
|
@@ -159,14 +159,14 @@ export declare const SpawnAgentSchema: z.ZodObject<{
|
|
|
159
159
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
160
160
|
}, "strip", z.ZodTypeAny, {
|
|
161
161
|
type: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
|
|
162
|
+
id?: string | undefined;
|
|
162
163
|
config?: Record<string, unknown> | undefined;
|
|
163
164
|
timeout?: number | undefined;
|
|
164
|
-
id?: string | undefined;
|
|
165
165
|
}, {
|
|
166
166
|
type: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
|
|
167
|
+
id?: string | undefined;
|
|
167
168
|
config?: Record<string, unknown> | undefined;
|
|
168
169
|
timeout?: number | undefined;
|
|
169
|
-
id?: string | undefined;
|
|
170
170
|
}>;
|
|
171
171
|
/**
|
|
172
172
|
* Task input schema
|
|
@@ -181,13 +181,13 @@ export declare const TaskInputSchema: z.ZodObject<{
|
|
|
181
181
|
taskId: string;
|
|
182
182
|
content: string;
|
|
183
183
|
agentType: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
|
|
184
|
-
priority?: "
|
|
184
|
+
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
185
185
|
metadata?: Record<string, unknown> | undefined;
|
|
186
186
|
}, {
|
|
187
187
|
taskId: string;
|
|
188
188
|
content: string;
|
|
189
189
|
agentType: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
|
|
190
|
-
priority?: "
|
|
190
|
+
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
191
191
|
metadata?: Record<string, unknown> | undefined;
|
|
192
192
|
}>;
|
|
193
193
|
/**
|
|
@@ -234,16 +234,16 @@ export declare const ExecutorConfigSchema: z.ZodObject<{
|
|
|
234
234
|
cwd: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
235
235
|
allowSudo: z.ZodDefault<z.ZodBoolean>;
|
|
236
236
|
}, "strip", z.ZodTypeAny, {
|
|
237
|
-
allowedCommands: string[];
|
|
238
237
|
timeout: number;
|
|
238
|
+
allowedCommands: string[];
|
|
239
239
|
maxBuffer: number;
|
|
240
240
|
allowSudo: boolean;
|
|
241
241
|
blockedPatterns?: string[] | undefined;
|
|
242
242
|
cwd?: string | undefined;
|
|
243
243
|
}, {
|
|
244
244
|
allowedCommands: string[];
|
|
245
|
-
blockedPatterns?: string[] | undefined;
|
|
246
245
|
timeout?: number | undefined;
|
|
246
|
+
blockedPatterns?: string[] | undefined;
|
|
247
247
|
maxBuffer?: number | undefined;
|
|
248
248
|
cwd?: string | undefined;
|
|
249
249
|
allowSudo?: boolean | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.63.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
|
|
6
6
|
"main": "dist/src/index.js",
|