claude-chrome-parallel 3.5.1 → 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/dist/hints/hint-engine.d.ts +1 -1
- package/dist/hints/hint-engine.js +1 -1
- package/dist/hints/index.d.ts +1 -1
- package/dist/hints/index.js +1 -1
- package/dist/mcp-server.d.ts +19 -0
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +70 -2
- package/dist/mcp-server.js.map +1 -1
- package/dist/memory/domain-memory.d.ts +68 -0
- package/dist/memory/domain-memory.d.ts.map +1 -0
- package/dist/memory/domain-memory.js +227 -0
- package/dist/memory/domain-memory.js.map +1 -0
- package/dist/orchestration/plan-executor.d.ts +19 -0
- package/dist/orchestration/plan-executor.d.ts.map +1 -0
- package/dist/orchestration/plan-executor.js +284 -0
- package/dist/orchestration/plan-executor.js.map +1 -0
- package/dist/orchestration/plan-registry.d.ts +55 -0
- package/dist/orchestration/plan-registry.d.ts.map +1 -0
- package/dist/orchestration/plan-registry.js +255 -0
- package/dist/orchestration/plan-registry.js.map +1 -0
- package/dist/orchestration/workflow-engine.d.ts +7 -1
- package/dist/orchestration/workflow-engine.d.ts.map +1 -1
- package/dist/orchestration/workflow-engine.js +74 -4
- package/dist/orchestration/workflow-engine.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/memory.d.ts +10 -0
- package/dist/tools/memory.d.ts.map +1 -0
- package/dist/tools/memory.js +141 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/orchestration.d.ts.map +1 -1
- package/dist/tools/orchestration.js +143 -2
- package/dist/tools/orchestration.js.map +1 -1
- package/dist/types/plan-cache.d.ts +121 -0
- package/dist/types/plan-cache.d.ts.map +1 -0
- package/dist/types/plan-cache.js +9 -0
- package/dist/types/plan-cache.js.map +1 -0
- package/dist/types/tool-manifest.d.ts +52 -0
- package/dist/types/tool-manifest.d.ts.map +1 -0
- package/dist/types/tool-manifest.js +37 -0
- package/dist/types/tool-manifest.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PlanExecutor - Executes compiled plans by chaining tool handlers internally.
|
|
4
|
+
*
|
|
5
|
+
* Bypasses per-step agent LLM round-trips by resolving and calling tool handlers
|
|
6
|
+
* directly from the MCP server's internal registry.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PlanExecutor = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* Recursively substitute ${varName} templates in a value using the params map.
|
|
12
|
+
* Handles strings, objects, and arrays. Non-string primitives are returned as-is.
|
|
13
|
+
* Missing vars are left as-is (no crash).
|
|
14
|
+
*/
|
|
15
|
+
function substituteParams(value, params) {
|
|
16
|
+
if (typeof value === 'string') {
|
|
17
|
+
return value.replace(/\$\{([^}]+)\}/g, (match, varName) => {
|
|
18
|
+
const resolved = params[varName];
|
|
19
|
+
if (resolved === undefined)
|
|
20
|
+
return match;
|
|
21
|
+
if (typeof resolved === 'string')
|
|
22
|
+
return resolved;
|
|
23
|
+
return JSON.stringify(resolved);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(value)) {
|
|
27
|
+
return value.map((item) => substituteParams(item, params));
|
|
28
|
+
}
|
|
29
|
+
if (value !== null && typeof value === 'object') {
|
|
30
|
+
const result = {};
|
|
31
|
+
for (const [k, v] of Object.entries(value)) {
|
|
32
|
+
result[k] = substituteParams(v, params);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Apply a timeout to a promise via Promise.race.
|
|
40
|
+
*/
|
|
41
|
+
function withTimeout(promise, timeoutMs, label) {
|
|
42
|
+
return Promise.race([
|
|
43
|
+
promise,
|
|
44
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error(`Timeout after ${timeoutMs}ms (${label})`)), timeoutMs)),
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Extract result data from an MCPResult according to parseResult spec.
|
|
49
|
+
* Returns the extracted value (raw text, parsed JSON, or a specific field).
|
|
50
|
+
*/
|
|
51
|
+
function extractResult(mcpResult, parseResult) {
|
|
52
|
+
const content = mcpResult.content;
|
|
53
|
+
const text = content && content.length > 0 ? content[0].text ?? '' : '';
|
|
54
|
+
if (parseResult.format === 'text') {
|
|
55
|
+
return text;
|
|
56
|
+
}
|
|
57
|
+
// format === 'json'
|
|
58
|
+
let parsed;
|
|
59
|
+
try {
|
|
60
|
+
parsed = JSON.parse(text);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
parsed = text;
|
|
64
|
+
}
|
|
65
|
+
if (parseResult.extractField) {
|
|
66
|
+
const obj = parsed;
|
|
67
|
+
parsed = obj?.[parseResult.extractField];
|
|
68
|
+
}
|
|
69
|
+
return parsed;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Check whether an MCPResult represents an empty/no-data result.
|
|
73
|
+
*/
|
|
74
|
+
function isEmptyResult(mcpResult) {
|
|
75
|
+
if (mcpResult.isError)
|
|
76
|
+
return false; // errors are not "empty"
|
|
77
|
+
const content = mcpResult.content;
|
|
78
|
+
if (!content || content.length === 0)
|
|
79
|
+
return true;
|
|
80
|
+
const text = content[0].text ?? '';
|
|
81
|
+
if (text.trim() === '' || text.trim() === 'null' || text.trim() === '[]' || text.trim() === '{}') {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Validate final params against the plan's success criteria.
|
|
88
|
+
* Returns null if valid, or an error string describing the violation.
|
|
89
|
+
*/
|
|
90
|
+
function validateSuccessCriteria(criteria, params) {
|
|
91
|
+
if (criteria.minDataItems !== undefined) {
|
|
92
|
+
// Find the first array or object in params that could represent "data items"
|
|
93
|
+
let found = false;
|
|
94
|
+
for (const val of Object.values(params)) {
|
|
95
|
+
if (Array.isArray(val)) {
|
|
96
|
+
if (val.length < criteria.minDataItems) {
|
|
97
|
+
return `minDataItems requirement not met: got ${val.length}, need ${criteria.minDataItems}`;
|
|
98
|
+
}
|
|
99
|
+
found = true;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
else if (val !== null && typeof val === 'object') {
|
|
103
|
+
const count = Object.keys(val).length;
|
|
104
|
+
if (count < criteria.minDataItems) {
|
|
105
|
+
return `minDataItems requirement not met: got ${count}, need ${criteria.minDataItems}`;
|
|
106
|
+
}
|
|
107
|
+
found = true;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (!found && criteria.minDataItems > 0) {
|
|
112
|
+
return `minDataItems requirement not met: no collection found in params`;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (criteria.requiredFields && criteria.requiredFields.length > 0) {
|
|
116
|
+
for (const field of criteria.requiredFields) {
|
|
117
|
+
if (!(field in params) || params[field] === undefined) {
|
|
118
|
+
return `Required field missing from params: ${field}`;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
class PlanExecutor {
|
|
125
|
+
toolResolver;
|
|
126
|
+
constructor(toolResolver) {
|
|
127
|
+
this.toolResolver = toolResolver;
|
|
128
|
+
}
|
|
129
|
+
async execute(plan, sessionId, runtimeParams) {
|
|
130
|
+
const startTime = Date.now();
|
|
131
|
+
let stepsExecuted = 0;
|
|
132
|
+
// 1. Build params map: plan defaults first, runtime overrides on top
|
|
133
|
+
const params = {};
|
|
134
|
+
for (const [key, spec] of Object.entries(plan.parameters)) {
|
|
135
|
+
if (spec.default !== undefined) {
|
|
136
|
+
params[key] = spec.default;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
Object.assign(params, runtimeParams);
|
|
140
|
+
const failure = (error) => ({
|
|
141
|
+
success: false,
|
|
142
|
+
planId: plan.id,
|
|
143
|
+
error,
|
|
144
|
+
durationMs: Date.now() - startTime,
|
|
145
|
+
stepsExecuted,
|
|
146
|
+
totalSteps: plan.steps.length,
|
|
147
|
+
});
|
|
148
|
+
// 2. Execute each step sequentially
|
|
149
|
+
for (const step of plan.steps) {
|
|
150
|
+
const stepLabel = `plan=${plan.id} step=${step.order} tool=${step.tool}`;
|
|
151
|
+
// a. Resolve handler
|
|
152
|
+
const handler = this.toolResolver(step.tool);
|
|
153
|
+
if (!handler) {
|
|
154
|
+
const msg = `No handler found for tool "${step.tool}" at ${stepLabel}`;
|
|
155
|
+
console.error(`[PlanExecutor] ${msg}`);
|
|
156
|
+
return failure(msg);
|
|
157
|
+
}
|
|
158
|
+
// b. Substitute template variables in args
|
|
159
|
+
const substitutedArgs = substituteParams(step.args, params);
|
|
160
|
+
// c. Call handler with timeout
|
|
161
|
+
let mcpResult;
|
|
162
|
+
try {
|
|
163
|
+
mcpResult = await withTimeout(handler(sessionId, substitutedArgs), step.timeout, stepLabel);
|
|
164
|
+
stepsExecuted++;
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
168
|
+
console.error(`[PlanExecutor] Step failed at ${stepLabel}: ${errMsg}`);
|
|
169
|
+
// Check for a matching error handler
|
|
170
|
+
const conditionKey = `step${step.order}_error`;
|
|
171
|
+
const recovered = await this.tryRecovery(conditionKey, plan.errorHandlers, sessionId, params, stepsExecuted);
|
|
172
|
+
if (recovered !== null) {
|
|
173
|
+
stepsExecuted = recovered.stepsExecuted;
|
|
174
|
+
// Merge any params updates from recovery into our params
|
|
175
|
+
Object.assign(params, recovered.params);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
return failure(`Step ${step.order} (${step.tool}) failed: ${errMsg}`);
|
|
179
|
+
}
|
|
180
|
+
// d. Check for error result
|
|
181
|
+
if (mcpResult.isError) {
|
|
182
|
+
const errMsg = mcpResult.content?.[0]?.text ?? 'Unknown tool error';
|
|
183
|
+
console.error(`[PlanExecutor] Tool returned error at ${stepLabel}: ${errMsg}`);
|
|
184
|
+
const conditionKey = `step${step.order}_error`;
|
|
185
|
+
const recovered = await this.tryRecovery(conditionKey, plan.errorHandlers, sessionId, params, stepsExecuted);
|
|
186
|
+
if (recovered !== null) {
|
|
187
|
+
stepsExecuted = recovered.stepsExecuted;
|
|
188
|
+
Object.assign(params, recovered.params);
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
return failure(`Step ${step.order} (${step.tool}) returned error: ${errMsg}`);
|
|
192
|
+
}
|
|
193
|
+
// e. Check for empty result (before storing) — may trigger empty_result handler
|
|
194
|
+
if (isEmptyResult(mcpResult)) {
|
|
195
|
+
const conditionKey = `step${step.order}_empty_result`;
|
|
196
|
+
const recovered = await this.tryRecovery(conditionKey, plan.errorHandlers, sessionId, params, stepsExecuted);
|
|
197
|
+
if (recovered !== null) {
|
|
198
|
+
stepsExecuted = recovered.stepsExecuted;
|
|
199
|
+
Object.assign(params, recovered.params);
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
// No handler for empty — treat as non-fatal, just skip storing
|
|
203
|
+
}
|
|
204
|
+
// f. Parse and store result if requested
|
|
205
|
+
if (step.parseResult && step.parseResult.storeAs) {
|
|
206
|
+
try {
|
|
207
|
+
const extracted = extractResult(mcpResult, step.parseResult);
|
|
208
|
+
params[step.parseResult.storeAs] = extracted;
|
|
209
|
+
}
|
|
210
|
+
catch (err) {
|
|
211
|
+
console.error(`[PlanExecutor] Failed to extract result at ${stepLabel}: ${err instanceof Error ? err.message : String(err)}`);
|
|
212
|
+
// Non-fatal: continue without storing
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// 3. Validate success criteria
|
|
217
|
+
const criteriaError = validateSuccessCriteria(plan.successCriteria, params);
|
|
218
|
+
if (criteriaError) {
|
|
219
|
+
console.error(`[PlanExecutor] Success criteria failed for plan=${plan.id}: ${criteriaError}`);
|
|
220
|
+
return {
|
|
221
|
+
success: false,
|
|
222
|
+
planId: plan.id,
|
|
223
|
+
error: `Success criteria not met: ${criteriaError}`,
|
|
224
|
+
durationMs: Date.now() - startTime,
|
|
225
|
+
stepsExecuted,
|
|
226
|
+
totalSteps: plan.steps.length,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
// 4. Return success with all collected params as data
|
|
230
|
+
return {
|
|
231
|
+
success: true,
|
|
232
|
+
planId: plan.id,
|
|
233
|
+
data: params,
|
|
234
|
+
durationMs: Date.now() - startTime,
|
|
235
|
+
stepsExecuted,
|
|
236
|
+
totalSteps: plan.steps.length,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Attempt to find and run a recovery handler for a given condition.
|
|
241
|
+
* Returns updated stepsExecuted + params snapshot on success, null if no handler.
|
|
242
|
+
*/
|
|
243
|
+
async tryRecovery(conditionKey, errorHandlers, sessionId, params, currentStepsExecuted) {
|
|
244
|
+
const handler = errorHandlers.find((h) => h.condition === conditionKey);
|
|
245
|
+
if (!handler)
|
|
246
|
+
return null;
|
|
247
|
+
console.error(`[PlanExecutor] Running error handler "${handler.action}" for condition "${conditionKey}"`);
|
|
248
|
+
let stepsExecuted = currentStepsExecuted;
|
|
249
|
+
for (const step of handler.steps) {
|
|
250
|
+
const stepLabel = `recovery action=${handler.action} step=${step.order} tool=${step.tool}`;
|
|
251
|
+
const toolHandler = this.toolResolver(step.tool);
|
|
252
|
+
if (!toolHandler) {
|
|
253
|
+
console.error(`[PlanExecutor] Recovery: no handler for tool "${step.tool}" at ${stepLabel}`);
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const substitutedArgs = substituteParams(step.args, params);
|
|
257
|
+
let mcpResult;
|
|
258
|
+
try {
|
|
259
|
+
mcpResult = await withTimeout(toolHandler(sessionId, substitutedArgs), step.timeout, stepLabel);
|
|
260
|
+
stepsExecuted++;
|
|
261
|
+
}
|
|
262
|
+
catch (err) {
|
|
263
|
+
console.error(`[PlanExecutor] Recovery step failed at ${stepLabel}: ${err instanceof Error ? err.message : String(err)}`);
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
if (mcpResult.isError) {
|
|
267
|
+
console.error(`[PlanExecutor] Recovery step returned error at ${stepLabel}: ${mcpResult.content?.[0]?.text ?? 'unknown'}`);
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (step.parseResult && step.parseResult.storeAs) {
|
|
271
|
+
try {
|
|
272
|
+
const extracted = extractResult(mcpResult, step.parseResult);
|
|
273
|
+
params[step.parseResult.storeAs] = extracted;
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
console.error(`[PlanExecutor] Recovery: failed to extract result at ${stepLabel}: ${err instanceof Error ? err.message : String(err)}`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return { stepsExecuted, params };
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
exports.PlanExecutor = PlanExecutor;
|
|
284
|
+
//# sourceMappingURL=plan-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-executor.js","sourceRoot":"","sources":["../../src/orchestration/plan-executor.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAUH;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,KAAc,EAAE,MAA+B;IACvE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YACxD,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;YACjC,IAAI,QAAQ,KAAK,SAAS;gBAAE,OAAO,KAAK,CAAC;YACzC,IAAI,OAAO,QAAQ,KA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AAC,GAAG,CACjD,EAAE,CACH,CAAC;gBACF,SAAS;YACX,CAAC;YAED,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;gBACtB,OAAO,CAAC,KAAK,CACX,kDAAkD,SAAS,KACzD,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,SAClC,EAAE,CACH,CAAC;gBACF,SAAS;YACX,CAAC;YAED,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;gBACjD,IAAI,CAAC;oBACH,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;oBAC7D,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;gBAC/C,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,OAAO,CAAC,KAAK,CACX,wDAAwD,SAAS,KAC/D,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CACjD,EAAE,CACH,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC;CACF;AA1OD,oCA0OC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PlanRegistry — Manages compiled plan storage, loading, matching, and stats tracking.
|
|
3
|
+
*
|
|
4
|
+
* Plans are stored at {basePath}/plan-registry.json (index) and
|
|
5
|
+
* {basePath}/plans/{planId}.json (individual plan files).
|
|
6
|
+
*/
|
|
7
|
+
import type { CompiledPlan, PlanEntry, TaskPattern } from '../types/plan-cache';
|
|
8
|
+
export declare class PlanRegistry {
|
|
9
|
+
private basePath;
|
|
10
|
+
private registryPath;
|
|
11
|
+
private plansDir;
|
|
12
|
+
private data;
|
|
13
|
+
constructor(basePath?: string);
|
|
14
|
+
/**
|
|
15
|
+
* Load plan registry from disk.
|
|
16
|
+
*/
|
|
17
|
+
load(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Persist plan registry to disk.
|
|
20
|
+
*/
|
|
21
|
+
save(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Find the best matching plan entry for a given task and URL.
|
|
24
|
+
* Filters by urlPattern, taskKeywords, and confidence threshold.
|
|
25
|
+
* Returns the highest-confidence match, or null if none found.
|
|
26
|
+
*/
|
|
27
|
+
matchTask(task: string, url: string): PlanEntry | null;
|
|
28
|
+
/**
|
|
29
|
+
* Load a compiled plan from disk by its registry entry.
|
|
30
|
+
*/
|
|
31
|
+
loadPlan(entry: PlanEntry): CompiledPlan | null;
|
|
32
|
+
/**
|
|
33
|
+
* Update execution stats for a plan and recalculate confidence.
|
|
34
|
+
*/
|
|
35
|
+
updateStats(planId: string, success: boolean, durationMs: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* Register a new compiled plan with the given task pattern.
|
|
38
|
+
* Saves plan JSON to disk and adds entry to the registry.
|
|
39
|
+
*/
|
|
40
|
+
registerPlan(plan: CompiledPlan, pattern: TaskPattern): PlanEntry;
|
|
41
|
+
/**
|
|
42
|
+
* Get all plan entries.
|
|
43
|
+
*/
|
|
44
|
+
getEntries(): PlanEntry[];
|
|
45
|
+
/**
|
|
46
|
+
* Get a single plan entry by ID.
|
|
47
|
+
*/
|
|
48
|
+
getEntry(planId: string): PlanEntry | null;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get a singleton PlanRegistry instance.
|
|
52
|
+
* Pass basePath to create/replace the singleton with a new base path.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getPlanRegistry(basePath?: string): PlanRegistry;
|
|
55
|
+
//# sourceMappingURL=plan-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-registry.d.ts","sourceRoot":"","sources":["../../src/orchestration/plan-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EAET,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAO7B,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,IAAI,CAAmB;gBAEnB,QAAQ,GAAE,MAA0B;IAWhD;;OAEG;IACH,IAAI,IAAI,IAAI;IAeZ;;OAEG;IACH,IAAI,IAAI,IAAI;IAUZ;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAgDtD;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,GAAG,IAAI;IAY/C;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IA+BvE;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,GAAG,SAAS;IAyCjE;;OAEG;IACH,UAAU,IAAI,SAAS,EAAE;IAIzB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;CAI3C;AAMD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,CAQ/D"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PlanRegistry — Manages compiled plan storage, loading, matching, and stats tracking.
|
|
4
|
+
*
|
|
5
|
+
* Plans are stored at {basePath}/plan-registry.json (index) and
|
|
6
|
+
* {basePath}/plans/{planId}.json (individual plan files).
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.PlanRegistry = void 0;
|
|
43
|
+
exports.getPlanRegistry = getPlanRegistry;
|
|
44
|
+
const fs = __importStar(require("fs"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
const DEFAULT_BASE_PATH = '.chrome-parallel/plans/';
|
|
47
|
+
const REGISTRY_FILENAME = 'plan-registry.json';
|
|
48
|
+
const PLANS_SUBDIR = 'plans';
|
|
49
|
+
const REGISTRY_VERSION = '1.0.0';
|
|
50
|
+
class PlanRegistry {
|
|
51
|
+
basePath;
|
|
52
|
+
registryPath;
|
|
53
|
+
plansDir;
|
|
54
|
+
data;
|
|
55
|
+
constructor(basePath = DEFAULT_BASE_PATH) {
|
|
56
|
+
this.basePath = basePath;
|
|
57
|
+
this.registryPath = path.join(basePath, REGISTRY_FILENAME);
|
|
58
|
+
this.plansDir = path.join(basePath, PLANS_SUBDIR);
|
|
59
|
+
this.data = {
|
|
60
|
+
version: REGISTRY_VERSION,
|
|
61
|
+
plans: [],
|
|
62
|
+
updatedAt: Date.now(),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Load plan registry from disk.
|
|
67
|
+
*/
|
|
68
|
+
load() {
|
|
69
|
+
try {
|
|
70
|
+
const raw = fs.readFileSync(this.registryPath, 'utf-8');
|
|
71
|
+
const parsed = JSON.parse(raw);
|
|
72
|
+
this.data = parsed;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Best-effort — start with empty registry
|
|
76
|
+
this.data = {
|
|
77
|
+
version: REGISTRY_VERSION,
|
|
78
|
+
plans: [],
|
|
79
|
+
updatedAt: Date.now(),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Persist plan registry to disk.
|
|
85
|
+
*/
|
|
86
|
+
save() {
|
|
87
|
+
try {
|
|
88
|
+
fs.mkdirSync(this.basePath, { recursive: true });
|
|
89
|
+
this.data.updatedAt = Date.now();
|
|
90
|
+
fs.writeFileSync(this.registryPath, JSON.stringify(this.data, null, 2));
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Best-effort
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Find the best matching plan entry for a given task and URL.
|
|
98
|
+
* Filters by urlPattern, taskKeywords, and confidence threshold.
|
|
99
|
+
* Returns the highest-confidence match, or null if none found.
|
|
100
|
+
*/
|
|
101
|
+
matchTask(task, url) {
|
|
102
|
+
const taskLower = task.toLowerCase();
|
|
103
|
+
const candidates = this.data.plans.filter(entry => {
|
|
104
|
+
// Filter by confidence threshold
|
|
105
|
+
if (entry.confidence < entry.minConfidenceToUse) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
// Filter by urlPattern (if specified)
|
|
109
|
+
if (entry.pattern.urlPattern) {
|
|
110
|
+
try {
|
|
111
|
+
const regex = new RegExp(entry.pattern.urlPattern);
|
|
112
|
+
if (!regex.test(url)) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// Invalid regex — skip this entry
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Filter by taskKeywords (all must be present, case-insensitive)
|
|
122
|
+
const allKeywordsMatch = entry.pattern.taskKeywords.every(kw => taskLower.includes(kw.toLowerCase()));
|
|
123
|
+
if (!allKeywordsMatch) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
return true;
|
|
127
|
+
});
|
|
128
|
+
if (candidates.length === 0) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
// Sort by confidence desc, then successCount desc
|
|
132
|
+
candidates.sort((a, b) => {
|
|
133
|
+
if (b.confidence !== a.confidence) {
|
|
134
|
+
return b.confidence - a.confidence;
|
|
135
|
+
}
|
|
136
|
+
return b.stats.successCount - a.stats.successCount;
|
|
137
|
+
});
|
|
138
|
+
return candidates[0];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Load a compiled plan from disk by its registry entry.
|
|
142
|
+
*/
|
|
143
|
+
loadPlan(entry) {
|
|
144
|
+
try {
|
|
145
|
+
const planPath = path.isAbsolute(entry.planPath)
|
|
146
|
+
? entry.planPath
|
|
147
|
+
: path.join(this.basePath, entry.planPath);
|
|
148
|
+
const raw = fs.readFileSync(planPath, 'utf-8');
|
|
149
|
+
return JSON.parse(raw);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Update execution stats for a plan and recalculate confidence.
|
|
157
|
+
*/
|
|
158
|
+
updateStats(planId, success, durationMs) {
|
|
159
|
+
const entry = this.data.plans.find(p => p.id === planId);
|
|
160
|
+
if (!entry)
|
|
161
|
+
return;
|
|
162
|
+
const stats = entry.stats;
|
|
163
|
+
stats.totalExecutions++;
|
|
164
|
+
if (success) {
|
|
165
|
+
stats.successCount++;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
stats.failCount++;
|
|
169
|
+
}
|
|
170
|
+
// Rolling average for duration
|
|
171
|
+
if (stats.totalExecutions === 1) {
|
|
172
|
+
stats.avgDurationMs = durationMs;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
stats.avgDurationMs = Math.round((stats.avgDurationMs * (stats.totalExecutions - 1) + durationMs) /
|
|
176
|
+
stats.totalExecutions);
|
|
177
|
+
}
|
|
178
|
+
stats.lastUsed = Date.now();
|
|
179
|
+
// Recalculate confidence as success rate
|
|
180
|
+
entry.confidence = stats.totalExecutions > 0
|
|
181
|
+
? stats.successCount / stats.totalExecutions
|
|
182
|
+
: 0;
|
|
183
|
+
this.save();
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Register a new compiled plan with the given task pattern.
|
|
187
|
+
* Saves plan JSON to disk and adds entry to the registry.
|
|
188
|
+
*/
|
|
189
|
+
registerPlan(plan, pattern) {
|
|
190
|
+
try {
|
|
191
|
+
fs.mkdirSync(this.plansDir, { recursive: true });
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
// Best-effort
|
|
195
|
+
}
|
|
196
|
+
const planFilename = `${plan.id}.json`;
|
|
197
|
+
const planPath = path.join(PLANS_SUBDIR, planFilename);
|
|
198
|
+
const planFullPath = path.join(this.plansDir, planFilename);
|
|
199
|
+
try {
|
|
200
|
+
fs.writeFileSync(planFullPath, JSON.stringify(plan, null, 2));
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
// Best-effort
|
|
204
|
+
}
|
|
205
|
+
// Remove existing entry with same ID (if any)
|
|
206
|
+
this.data.plans = this.data.plans.filter(p => p.id !== plan.id);
|
|
207
|
+
const entry = {
|
|
208
|
+
id: plan.id,
|
|
209
|
+
pattern,
|
|
210
|
+
planPath,
|
|
211
|
+
stats: {
|
|
212
|
+
totalExecutions: 0,
|
|
213
|
+
successCount: 0,
|
|
214
|
+
failCount: 0,
|
|
215
|
+
avgDurationMs: 0,
|
|
216
|
+
lastUsed: 0,
|
|
217
|
+
},
|
|
218
|
+
confidence: 0.5, // Initial neutral confidence
|
|
219
|
+
minConfidenceToUse: 0.3,
|
|
220
|
+
};
|
|
221
|
+
this.data.plans.push(entry);
|
|
222
|
+
this.save();
|
|
223
|
+
return entry;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Get all plan entries.
|
|
227
|
+
*/
|
|
228
|
+
getEntries() {
|
|
229
|
+
return this.data.plans;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Get a single plan entry by ID.
|
|
233
|
+
*/
|
|
234
|
+
getEntry(planId) {
|
|
235
|
+
return this.data.plans.find(p => p.id === planId) ?? null;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
exports.PlanRegistry = PlanRegistry;
|
|
239
|
+
// Singleton instance cache
|
|
240
|
+
let _instance = null;
|
|
241
|
+
let _instanceBasePath = null;
|
|
242
|
+
/**
|
|
243
|
+
* Get a singleton PlanRegistry instance.
|
|
244
|
+
* Pass basePath to create/replace the singleton with a new base path.
|
|
245
|
+
*/
|
|
246
|
+
function getPlanRegistry(basePath) {
|
|
247
|
+
const resolvedPath = basePath ?? DEFAULT_BASE_PATH;
|
|
248
|
+
if (!_instance || _instanceBasePath !== resolvedPath) {
|
|
249
|
+
_instance = new PlanRegistry(resolvedPath);
|
|
250
|
+
_instanceBasePath = resolvedPath;
|
|
251
|
+
_instance.load();
|
|
252
|
+
}
|
|
253
|
+
return _instance;
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=plan-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-registry.js","sourceRoot":"","sources":["../../src/orchestration/plan-registry.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2OH,0CAQC;AAjPD,uCAAyB;AACzB,2CAA6B;AAQ7B,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AACpD,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAC/C,MAAM,YAAY,GAAG,OAAO,CAAC;AAC7B,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAEjC,MAAa,YAAY;IACf,QAAQ,CAAS;IACjB,YAAY,CAAS;IACrB,QAAQ,CAAS;IACjB,IAAI,CAAmB;IAE/B,YAAY,WAAmB,iBAAiB;QAC9C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG;YACV,OAAO,EAAE,gBAAgB;YACzB,KAAK,EAAE,EAAE;YACT,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAI;QACF,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YACxD,MAAM,MAAM,GAAqB,IAAI,CAAC,K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AAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,MAAc;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC;IAC5D,CAAC;CAEF;AAjND,oCAiNC;AAED,2BAA2B;AAC3B,IAAI,SAAS,GAAwB,IAAI,CAAC;AAC1C,IAAI,iBAAiB,GAAkB,IAAI,CAAC;AAE5C;;;GAGG;AACH,SAAgB,eAAe,CAAC,QAAiB;IAC/C,MAAM,YAAY,GAAG,QAAQ,IAAI,iBAAiB,CAAC;IACnD,IAAI,CAAC,SAAS,IAAI,iBAAiB,KAAK,YAAY,EAAE,CAAC;QACrD,SAAS,GAAG,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC;QAC3C,iBAAiB,GAAG,YAAY,CAAC;QACjC,SAAS,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Manages worker lifecycle and result aggregation
|
|
4
4
|
*/
|
|
5
5
|
import { OrchestrationState, WorkerState } from './state-manager';
|
|
6
|
+
import { ToolEntry } from '../types/tool-manifest';
|
|
6
7
|
export interface WorkflowStep {
|
|
7
8
|
workerId: string;
|
|
8
9
|
workerName: string;
|
|
@@ -147,10 +148,15 @@ export declare class WorkflowEngine {
|
|
|
147
148
|
* Cleanup workflow resources
|
|
148
149
|
*/
|
|
149
150
|
cleanupWorkflow(sessionId: string): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Generate MCP tool documentation from a ToolEntry array.
|
|
153
|
+
* Groups tools by category and formats each tool with its parameters.
|
|
154
|
+
*/
|
|
155
|
+
private generateToolDocs;
|
|
150
156
|
/**
|
|
151
157
|
* Generate worker agent prompt for Background Task
|
|
152
158
|
*/
|
|
153
|
-
generateWorkerPrompt(workerId: string, workerName: string, tabId: string, task: string, successCriteria: string): string;
|
|
159
|
+
generateWorkerPrompt(workerId: string, workerName: string, tabId: string, task: string, successCriteria: string, manifestTools?: ToolEntry[], targetUrl?: string): string;
|
|
154
160
|
}
|
|
155
161
|
export declare function getWorkflowEngine(): WorkflowEngine;
|
|
156
162
|
//# sourceMappingURL=workflow-engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-engine.d.ts","sourceRoot":"","sources":["../../src/orchestration/workflow-engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAgC,kBAAkB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-engine.d.ts","sourceRoot":"","sources":["../../src/orchestration/workflow-engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAgC,kBAAkB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEhG,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,qFAAqF;IACrF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oEAAo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