@claude-flow/plugin-quantum-optimizer 3.0.0-alpha.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/README.md +300 -0
- package/dist/bridges/dag-bridge.d.ts +95 -0
- package/dist/bridges/dag-bridge.d.ts.map +1 -0
- package/dist/bridges/dag-bridge.js +461 -0
- package/dist/bridges/dag-bridge.js.map +1 -0
- package/dist/bridges/exotic-bridge.d.ts +64 -0
- package/dist/bridges/exotic-bridge.d.ts.map +1 -0
- package/dist/bridges/exotic-bridge.js +434 -0
- package/dist/bridges/exotic-bridge.js.map +1 -0
- package/dist/bridges/index.d.ts +10 -0
- package/dist/bridges/index.d.ts.map +1 -0
- package/dist/bridges/index.js +8 -0
- package/dist/bridges/index.js.map +1 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-tools.d.ts +34 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +525 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/types.d.ts +789 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +154 -0
- package/dist/types.js.map +1 -0
- package/package.json +100 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quantum Optimizer Plugin - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Types for quantum-inspired optimization including QUBO problems,
|
|
5
|
+
* annealing parameters, QAOA circuits, and Grover search.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
/**
|
|
9
|
+
* Quadratic Unconstrained Binary Optimization problem
|
|
10
|
+
*/
|
|
11
|
+
export interface QUBOProblem {
|
|
12
|
+
/** Problem type identifier */
|
|
13
|
+
readonly type: 'qubo' | 'ising' | 'sat' | 'max_cut' | 'tsp' | 'dependency';
|
|
14
|
+
/** Number of binary variables */
|
|
15
|
+
readonly variables: number;
|
|
16
|
+
/** Linear coefficients (diagonal of Q matrix) */
|
|
17
|
+
readonly linear: Float32Array;
|
|
18
|
+
/** Quadratic coefficients (upper triangular of Q matrix, flattened) */
|
|
19
|
+
readonly quadratic: Float32Array;
|
|
20
|
+
/** Optional constraint violations penalty */
|
|
21
|
+
readonly penalty?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* QUBO solution
|
|
25
|
+
*/
|
|
26
|
+
export interface QUBOSolution {
|
|
27
|
+
/** Binary assignment (0 or 1 for each variable) */
|
|
28
|
+
readonly assignment: Uint8Array;
|
|
29
|
+
/** Energy/cost of the solution */
|
|
30
|
+
readonly energy: number;
|
|
31
|
+
/** Whether this is optimal (or best found) */
|
|
32
|
+
readonly optimal: boolean;
|
|
33
|
+
/** Number of iterations/reads performed */
|
|
34
|
+
readonly iterations: number;
|
|
35
|
+
/** Confidence in optimality */
|
|
36
|
+
readonly confidence: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Temperature schedule for annealing
|
|
40
|
+
*/
|
|
41
|
+
export interface TemperatureSchedule {
|
|
42
|
+
/** Initial temperature */
|
|
43
|
+
readonly initial: number;
|
|
44
|
+
/** Final temperature */
|
|
45
|
+
readonly final: number;
|
|
46
|
+
/** Schedule type */
|
|
47
|
+
readonly type: 'linear' | 'exponential' | 'logarithmic' | 'adaptive';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Annealing configuration
|
|
51
|
+
*/
|
|
52
|
+
export interface AnnealingConfig {
|
|
53
|
+
/** Number of independent runs */
|
|
54
|
+
readonly numReads: number;
|
|
55
|
+
/** Total annealing time (abstract units) */
|
|
56
|
+
readonly annealingTime: number;
|
|
57
|
+
/** Chain strength for embedding */
|
|
58
|
+
readonly chainStrength: number;
|
|
59
|
+
/** Temperature schedule */
|
|
60
|
+
readonly temperature: TemperatureSchedule;
|
|
61
|
+
/** Embedding strategy */
|
|
62
|
+
readonly embedding: 'auto' | 'minor' | 'pegasus' | 'chimera';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Annealing result
|
|
66
|
+
*/
|
|
67
|
+
export interface AnnealingResult {
|
|
68
|
+
/** Best solution found */
|
|
69
|
+
readonly solution: QUBOSolution;
|
|
70
|
+
/** All solutions found (sorted by energy) */
|
|
71
|
+
readonly samples: QUBOSolution[];
|
|
72
|
+
/** Energy histogram */
|
|
73
|
+
readonly energyHistogram: Map<number, number>;
|
|
74
|
+
/** Timing information */
|
|
75
|
+
readonly timing: {
|
|
76
|
+
readonly totalMs: number;
|
|
77
|
+
readonly annealingMs: number;
|
|
78
|
+
readonly embeddingMs: number;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Problem graph for QAOA
|
|
83
|
+
*/
|
|
84
|
+
export interface ProblemGraph {
|
|
85
|
+
/** Number of nodes */
|
|
86
|
+
readonly nodes: number;
|
|
87
|
+
/** Edges as [source, target] pairs */
|
|
88
|
+
readonly edges: ReadonlyArray<readonly [number, number]>;
|
|
89
|
+
/** Edge weights (optional) */
|
|
90
|
+
readonly weights?: Float32Array;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* QAOA circuit configuration
|
|
94
|
+
*/
|
|
95
|
+
export interface QAOACircuit {
|
|
96
|
+
/** Circuit depth (p parameter) */
|
|
97
|
+
readonly depth: number;
|
|
98
|
+
/** Classical optimizer */
|
|
99
|
+
readonly optimizer: 'cobyla' | 'bfgs' | 'adam' | 'nelder-mead';
|
|
100
|
+
/** Initial parameter strategy */
|
|
101
|
+
readonly initialParams: 'random' | 'heuristic' | 'transfer' | 'fourier';
|
|
102
|
+
/** Number of measurement shots */
|
|
103
|
+
readonly shots: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* QAOA result
|
|
107
|
+
*/
|
|
108
|
+
export interface QAOAResult {
|
|
109
|
+
/** Best solution found */
|
|
110
|
+
readonly solution: QUBOSolution;
|
|
111
|
+
/** Optimal variational parameters (gamma, beta) */
|
|
112
|
+
readonly parameters: {
|
|
113
|
+
readonly gamma: Float32Array;
|
|
114
|
+
readonly beta: Float32Array;
|
|
115
|
+
};
|
|
116
|
+
/** Approximation ratio (solution / optimal) */
|
|
117
|
+
readonly approximationRatio: number;
|
|
118
|
+
/** Convergence history */
|
|
119
|
+
readonly convergence: Float32Array;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Search space configuration
|
|
123
|
+
*/
|
|
124
|
+
export interface SearchSpace {
|
|
125
|
+
/** Size of search space (N) */
|
|
126
|
+
readonly size: number;
|
|
127
|
+
/** Oracle predicate definition (safe expression) */
|
|
128
|
+
readonly oracle: string;
|
|
129
|
+
/** Structure of search space */
|
|
130
|
+
readonly structure: 'unstructured' | 'database' | 'tree' | 'graph';
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Amplification configuration
|
|
134
|
+
*/
|
|
135
|
+
export interface AmplificationConfig {
|
|
136
|
+
/** Amplification method */
|
|
137
|
+
readonly method: 'standard' | 'fixed_point' | 'robust';
|
|
138
|
+
/** Boost factor for robust amplification */
|
|
139
|
+
readonly boostFactor?: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Grover search result
|
|
143
|
+
*/
|
|
144
|
+
export interface GroverResult {
|
|
145
|
+
/** Found solution(s) */
|
|
146
|
+
readonly solutions: Uint8Array[];
|
|
147
|
+
/** Number of oracle queries */
|
|
148
|
+
readonly queries: number;
|
|
149
|
+
/** Theoretical optimal queries (pi/4 * sqrt(N/M)) */
|
|
150
|
+
readonly optimalQueries: number;
|
|
151
|
+
/** Success probability */
|
|
152
|
+
readonly successProbability: number;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Package descriptor for dependency resolution
|
|
156
|
+
*/
|
|
157
|
+
export interface PackageDescriptor {
|
|
158
|
+
/** Package name */
|
|
159
|
+
readonly name: string;
|
|
160
|
+
/** Version string */
|
|
161
|
+
readonly version: string;
|
|
162
|
+
/** Dependencies as name -> version constraint */
|
|
163
|
+
readonly dependencies: Record<string, string>;
|
|
164
|
+
/** Conflicting packages */
|
|
165
|
+
readonly conflicts: ReadonlyArray<string>;
|
|
166
|
+
/** Package size in KB */
|
|
167
|
+
readonly size?: number;
|
|
168
|
+
/** Known vulnerabilities */
|
|
169
|
+
readonly vulnerabilities?: ReadonlyArray<string>;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Dependency resolution constraints
|
|
173
|
+
*/
|
|
174
|
+
export interface DependencyConstraints {
|
|
175
|
+
/** Optimization objective */
|
|
176
|
+
readonly minimize: 'versions' | 'size' | 'vulnerabilities' | 'depth';
|
|
177
|
+
/** Existing lockfile constraints */
|
|
178
|
+
readonly lockfile?: Record<string, string>;
|
|
179
|
+
/** Include peer dependencies */
|
|
180
|
+
readonly includePeer: boolean;
|
|
181
|
+
/** Maximum resolution time in ms */
|
|
182
|
+
readonly timeout: number;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Dependency resolution result
|
|
186
|
+
*/
|
|
187
|
+
export interface DependencyResult {
|
|
188
|
+
/** Resolved package versions */
|
|
189
|
+
readonly resolved: Record<string, string>;
|
|
190
|
+
/** Installation order */
|
|
191
|
+
readonly order: ReadonlyArray<string>;
|
|
192
|
+
/** Conflicts that were resolved */
|
|
193
|
+
readonly resolvedConflicts: ReadonlyArray<{
|
|
194
|
+
readonly packages: [string, string];
|
|
195
|
+
readonly resolution: string;
|
|
196
|
+
}>;
|
|
197
|
+
/** Total size if calculated */
|
|
198
|
+
readonly totalSize?: number;
|
|
199
|
+
/** Remaining vulnerabilities */
|
|
200
|
+
readonly vulnerabilities?: ReadonlyArray<string>;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Task for scheduling
|
|
204
|
+
*/
|
|
205
|
+
export interface ScheduleTask {
|
|
206
|
+
/** Unique task ID */
|
|
207
|
+
readonly id: string;
|
|
208
|
+
/** Task duration in time units */
|
|
209
|
+
readonly duration: number;
|
|
210
|
+
/** Prerequisite task IDs */
|
|
211
|
+
readonly dependencies: ReadonlyArray<string>;
|
|
212
|
+
/** Required resources */
|
|
213
|
+
readonly resources: ReadonlyArray<string>;
|
|
214
|
+
/** Optional deadline */
|
|
215
|
+
readonly deadline?: number;
|
|
216
|
+
/** Priority (higher = more important) */
|
|
217
|
+
readonly priority?: number;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Resource for scheduling
|
|
221
|
+
*/
|
|
222
|
+
export interface ScheduleResource {
|
|
223
|
+
/** Unique resource ID */
|
|
224
|
+
readonly id: string;
|
|
225
|
+
/** Maximum concurrent usage */
|
|
226
|
+
readonly capacity: number;
|
|
227
|
+
/** Cost per time unit */
|
|
228
|
+
readonly cost: number;
|
|
229
|
+
/** Availability windows */
|
|
230
|
+
readonly availability?: ReadonlyArray<{
|
|
231
|
+
readonly start: number;
|
|
232
|
+
readonly end: number;
|
|
233
|
+
}>;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Schedule optimization objective
|
|
237
|
+
*/
|
|
238
|
+
export type ScheduleObjective = 'makespan' | 'cost' | 'utilization' | 'weighted';
|
|
239
|
+
/**
|
|
240
|
+
* Scheduled task assignment
|
|
241
|
+
*/
|
|
242
|
+
export interface ScheduledTask {
|
|
243
|
+
/** Task ID */
|
|
244
|
+
readonly taskId: string;
|
|
245
|
+
/** Start time */
|
|
246
|
+
readonly start: number;
|
|
247
|
+
/** End time */
|
|
248
|
+
readonly end: number;
|
|
249
|
+
/** Assigned resources */
|
|
250
|
+
readonly resources: ReadonlyArray<string>;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Schedule optimization result
|
|
254
|
+
*/
|
|
255
|
+
export interface ScheduleResult {
|
|
256
|
+
/** Scheduled tasks */
|
|
257
|
+
readonly schedule: ReadonlyArray<ScheduledTask>;
|
|
258
|
+
/** Total makespan */
|
|
259
|
+
readonly makespan: number;
|
|
260
|
+
/** Total cost */
|
|
261
|
+
readonly cost: number;
|
|
262
|
+
/** Resource utilization per resource */
|
|
263
|
+
readonly utilization: Record<string, number>;
|
|
264
|
+
/** Critical path */
|
|
265
|
+
readonly criticalPath: ReadonlyArray<string>;
|
|
266
|
+
/** Optimization score */
|
|
267
|
+
readonly score: number;
|
|
268
|
+
}
|
|
269
|
+
export declare const TemperatureScheduleSchema: z.ZodObject<{
|
|
270
|
+
initial: z.ZodDefault<z.ZodNumber>;
|
|
271
|
+
final: z.ZodDefault<z.ZodNumber>;
|
|
272
|
+
type: z.ZodDefault<z.ZodEnum<["linear", "exponential", "logarithmic", "adaptive"]>>;
|
|
273
|
+
}, "strip", z.ZodTypeAny, {
|
|
274
|
+
initial: number;
|
|
275
|
+
final: number;
|
|
276
|
+
type: "linear" | "exponential" | "logarithmic" | "adaptive";
|
|
277
|
+
}, {
|
|
278
|
+
initial?: number | undefined;
|
|
279
|
+
final?: number | undefined;
|
|
280
|
+
type?: "linear" | "exponential" | "logarithmic" | "adaptive" | undefined;
|
|
281
|
+
}>;
|
|
282
|
+
export declare const AnnealingSolveInputSchema: z.ZodObject<{
|
|
283
|
+
problem: z.ZodObject<{
|
|
284
|
+
type: z.ZodEnum<["qubo", "ising", "sat", "max_cut", "tsp", "dependency"]>;
|
|
285
|
+
variables: z.ZodNumber;
|
|
286
|
+
constraints: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
287
|
+
objective: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
288
|
+
linear: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
289
|
+
quadratic: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
290
|
+
}, "strip", z.ZodTypeAny, {
|
|
291
|
+
type: "qubo" | "ising" | "sat" | "max_cut" | "tsp" | "dependency";
|
|
292
|
+
variables: number;
|
|
293
|
+
linear?: number[] | undefined;
|
|
294
|
+
constraints?: unknown[] | undefined;
|
|
295
|
+
objective?: Record<string, number> | undefined;
|
|
296
|
+
quadratic?: number[] | undefined;
|
|
297
|
+
}, {
|
|
298
|
+
type: "qubo" | "ising" | "sat" | "max_cut" | "tsp" | "dependency";
|
|
299
|
+
variables: number;
|
|
300
|
+
linear?: number[] | undefined;
|
|
301
|
+
constraints?: unknown[] | undefined;
|
|
302
|
+
objective?: Record<string, number> | undefined;
|
|
303
|
+
quadratic?: number[] | undefined;
|
|
304
|
+
}>;
|
|
305
|
+
parameters: z.ZodOptional<z.ZodObject<{
|
|
306
|
+
numReads: z.ZodDefault<z.ZodNumber>;
|
|
307
|
+
annealingTime: z.ZodDefault<z.ZodNumber>;
|
|
308
|
+
chainStrength: z.ZodDefault<z.ZodNumber>;
|
|
309
|
+
temperature: z.ZodOptional<z.ZodObject<{
|
|
310
|
+
initial: z.ZodDefault<z.ZodNumber>;
|
|
311
|
+
final: z.ZodDefault<z.ZodNumber>;
|
|
312
|
+
type: z.ZodDefault<z.ZodEnum<["linear", "exponential", "logarithmic", "adaptive"]>>;
|
|
313
|
+
}, "strip", z.ZodTypeAny, {
|
|
314
|
+
initial: number;
|
|
315
|
+
final: number;
|
|
316
|
+
type: "linear" | "exponential" | "logarithmic" | "adaptive";
|
|
317
|
+
}, {
|
|
318
|
+
initial?: number | undefined;
|
|
319
|
+
final?: number | undefined;
|
|
320
|
+
type?: "linear" | "exponential" | "logarithmic" | "adaptive" | undefined;
|
|
321
|
+
}>>;
|
|
322
|
+
}, "strip", z.ZodTypeAny, {
|
|
323
|
+
numReads: number;
|
|
324
|
+
annealingTime: number;
|
|
325
|
+
chainStrength: number;
|
|
326
|
+
temperature?: {
|
|
327
|
+
initial: number;
|
|
328
|
+
final: number;
|
|
329
|
+
type: "linear" | "exponential" | "logarithmic" | "adaptive";
|
|
330
|
+
} | undefined;
|
|
331
|
+
}, {
|
|
332
|
+
numReads?: number | undefined;
|
|
333
|
+
annealingTime?: number | undefined;
|
|
334
|
+
chainStrength?: number | undefined;
|
|
335
|
+
temperature?: {
|
|
336
|
+
initial?: number | undefined;
|
|
337
|
+
final?: number | undefined;
|
|
338
|
+
type?: "linear" | "exponential" | "logarithmic" | "adaptive" | undefined;
|
|
339
|
+
} | undefined;
|
|
340
|
+
}>>;
|
|
341
|
+
embedding: z.ZodDefault<z.ZodEnum<["auto", "minor", "pegasus", "chimera"]>>;
|
|
342
|
+
}, "strip", z.ZodTypeAny, {
|
|
343
|
+
problem: {
|
|
344
|
+
type: "qubo" | "ising" | "sat" | "max_cut" | "tsp" | "dependency";
|
|
345
|
+
variables: number;
|
|
346
|
+
linear?: number[] | undefined;
|
|
347
|
+
constraints?: unknown[] | undefined;
|
|
348
|
+
objective?: Record<string, number> | undefined;
|
|
349
|
+
quadratic?: number[] | undefined;
|
|
350
|
+
};
|
|
351
|
+
embedding: "auto" | "minor" | "pegasus" | "chimera";
|
|
352
|
+
parameters?: {
|
|
353
|
+
numReads: number;
|
|
354
|
+
annealingTime: number;
|
|
355
|
+
chainStrength: number;
|
|
356
|
+
temperature?: {
|
|
357
|
+
initial: number;
|
|
358
|
+
final: number;
|
|
359
|
+
type: "linear" | "exponential" | "logarithmic" | "adaptive";
|
|
360
|
+
} | undefined;
|
|
361
|
+
} | undefined;
|
|
362
|
+
}, {
|
|
363
|
+
problem: {
|
|
364
|
+
type: "qubo" | "ising" | "sat" | "max_cut" | "tsp" | "dependency";
|
|
365
|
+
variables: number;
|
|
366
|
+
linear?: number[] | undefined;
|
|
367
|
+
constraints?: unknown[] | undefined;
|
|
368
|
+
objective?: Record<string, number> | undefined;
|
|
369
|
+
quadratic?: number[] | undefined;
|
|
370
|
+
};
|
|
371
|
+
parameters?: {
|
|
372
|
+
numReads?: number | undefined;
|
|
373
|
+
annealingTime?: number | undefined;
|
|
374
|
+
chainStrength?: number | undefined;
|
|
375
|
+
temperature?: {
|
|
376
|
+
initial?: number | undefined;
|
|
377
|
+
final?: number | undefined;
|
|
378
|
+
type?: "linear" | "exponential" | "logarithmic" | "adaptive" | undefined;
|
|
379
|
+
} | undefined;
|
|
380
|
+
} | undefined;
|
|
381
|
+
embedding?: "auto" | "minor" | "pegasus" | "chimera" | undefined;
|
|
382
|
+
}>;
|
|
383
|
+
export type AnnealingSolveInput = z.infer<typeof AnnealingSolveInputSchema>;
|
|
384
|
+
export declare const QAOAOptimizeInputSchema: z.ZodObject<{
|
|
385
|
+
problem: z.ZodObject<{
|
|
386
|
+
type: z.ZodEnum<["max_cut", "portfolio", "scheduling", "routing"]>;
|
|
387
|
+
graph: z.ZodObject<{
|
|
388
|
+
nodes: z.ZodNumber;
|
|
389
|
+
edges: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
|
|
390
|
+
weights: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
391
|
+
}, "strip", z.ZodTypeAny, {
|
|
392
|
+
nodes: number;
|
|
393
|
+
edges: [number, number][];
|
|
394
|
+
weights?: number[] | undefined;
|
|
395
|
+
}, {
|
|
396
|
+
nodes: number;
|
|
397
|
+
edges: [number, number][];
|
|
398
|
+
weights?: number[] | undefined;
|
|
399
|
+
}>;
|
|
400
|
+
}, "strip", z.ZodTypeAny, {
|
|
401
|
+
graph: {
|
|
402
|
+
nodes: number;
|
|
403
|
+
edges: [number, number][];
|
|
404
|
+
weights?: number[] | undefined;
|
|
405
|
+
};
|
|
406
|
+
type: "max_cut" | "portfolio" | "scheduling" | "routing";
|
|
407
|
+
}, {
|
|
408
|
+
graph: {
|
|
409
|
+
nodes: number;
|
|
410
|
+
edges: [number, number][];
|
|
411
|
+
weights?: number[] | undefined;
|
|
412
|
+
};
|
|
413
|
+
type: "max_cut" | "portfolio" | "scheduling" | "routing";
|
|
414
|
+
}>;
|
|
415
|
+
circuit: z.ZodOptional<z.ZodObject<{
|
|
416
|
+
depth: z.ZodDefault<z.ZodNumber>;
|
|
417
|
+
optimizer: z.ZodDefault<z.ZodEnum<["cobyla", "bfgs", "adam", "nelder-mead"]>>;
|
|
418
|
+
initialParams: z.ZodDefault<z.ZodEnum<["random", "heuristic", "transfer", "fourier"]>>;
|
|
419
|
+
}, "strip", z.ZodTypeAny, {
|
|
420
|
+
depth: number;
|
|
421
|
+
optimizer: "cobyla" | "bfgs" | "adam" | "nelder-mead";
|
|
422
|
+
initialParams: "random" | "heuristic" | "transfer" | "fourier";
|
|
423
|
+
}, {
|
|
424
|
+
depth?: number | undefined;
|
|
425
|
+
optimizer?: "cobyla" | "bfgs" | "adam" | "nelder-mead" | undefined;
|
|
426
|
+
initialParams?: "random" | "heuristic" | "transfer" | "fourier" | undefined;
|
|
427
|
+
}>>;
|
|
428
|
+
shots: z.ZodDefault<z.ZodNumber>;
|
|
429
|
+
}, "strip", z.ZodTypeAny, {
|
|
430
|
+
problem: {
|
|
431
|
+
graph: {
|
|
432
|
+
nodes: number;
|
|
433
|
+
edges: [number, number][];
|
|
434
|
+
weights?: number[] | undefined;
|
|
435
|
+
};
|
|
436
|
+
type: "max_cut" | "portfolio" | "scheduling" | "routing";
|
|
437
|
+
};
|
|
438
|
+
shots: number;
|
|
439
|
+
circuit?: {
|
|
440
|
+
depth: number;
|
|
441
|
+
optimizer: "cobyla" | "bfgs" | "adam" | "nelder-mead";
|
|
442
|
+
initialParams: "random" | "heuristic" | "transfer" | "fourier";
|
|
443
|
+
} | undefined;
|
|
444
|
+
}, {
|
|
445
|
+
problem: {
|
|
446
|
+
graph: {
|
|
447
|
+
nodes: number;
|
|
448
|
+
edges: [number, number][];
|
|
449
|
+
weights?: number[] | undefined;
|
|
450
|
+
};
|
|
451
|
+
type: "max_cut" | "portfolio" | "scheduling" | "routing";
|
|
452
|
+
};
|
|
453
|
+
circuit?: {
|
|
454
|
+
depth?: number | undefined;
|
|
455
|
+
optimizer?: "cobyla" | "bfgs" | "adam" | "nelder-mead" | undefined;
|
|
456
|
+
initialParams?: "random" | "heuristic" | "transfer" | "fourier" | undefined;
|
|
457
|
+
} | undefined;
|
|
458
|
+
shots?: number | undefined;
|
|
459
|
+
}>;
|
|
460
|
+
export type QAOAOptimizeInput = z.infer<typeof QAOAOptimizeInputSchema>;
|
|
461
|
+
export declare const GroverSearchInputSchema: z.ZodObject<{
|
|
462
|
+
searchSpace: z.ZodObject<{
|
|
463
|
+
size: z.ZodNumber;
|
|
464
|
+
oracle: z.ZodString;
|
|
465
|
+
structure: z.ZodEnum<["unstructured", "database", "tree", "graph"]>;
|
|
466
|
+
}, "strip", z.ZodTypeAny, {
|
|
467
|
+
size: number;
|
|
468
|
+
oracle: string;
|
|
469
|
+
structure: "unstructured" | "database" | "tree" | "graph";
|
|
470
|
+
}, {
|
|
471
|
+
size: number;
|
|
472
|
+
oracle: string;
|
|
473
|
+
structure: "unstructured" | "database" | "tree" | "graph";
|
|
474
|
+
}>;
|
|
475
|
+
targets: z.ZodDefault<z.ZodNumber>;
|
|
476
|
+
iterations: z.ZodDefault<z.ZodEnum<["optimal", "fixed", "adaptive"]>>;
|
|
477
|
+
amplification: z.ZodOptional<z.ZodObject<{
|
|
478
|
+
method: z.ZodDefault<z.ZodEnum<["standard", "fixed_point", "robust"]>>;
|
|
479
|
+
boostFactor: z.ZodOptional<z.ZodNumber>;
|
|
480
|
+
}, "strip", z.ZodTypeAny, {
|
|
481
|
+
method: "standard" | "fixed_point" | "robust";
|
|
482
|
+
boostFactor?: number | undefined;
|
|
483
|
+
}, {
|
|
484
|
+
method?: "standard" | "fixed_point" | "robust" | undefined;
|
|
485
|
+
boostFactor?: number | undefined;
|
|
486
|
+
}>>;
|
|
487
|
+
}, "strip", z.ZodTypeAny, {
|
|
488
|
+
searchSpace: {
|
|
489
|
+
size: number;
|
|
490
|
+
oracle: string;
|
|
491
|
+
structure: "unstructured" | "database" | "tree" | "graph";
|
|
492
|
+
};
|
|
493
|
+
targets: number;
|
|
494
|
+
iterations: "adaptive" | "optimal" | "fixed";
|
|
495
|
+
amplification?: {
|
|
496
|
+
method: "standard" | "fixed_point" | "robust";
|
|
497
|
+
boostFactor?: number | undefined;
|
|
498
|
+
} | undefined;
|
|
499
|
+
}, {
|
|
500
|
+
searchSpace: {
|
|
501
|
+
size: number;
|
|
502
|
+
oracle: string;
|
|
503
|
+
structure: "unstructured" | "database" | "tree" | "graph";
|
|
504
|
+
};
|
|
505
|
+
targets?: number | undefined;
|
|
506
|
+
iterations?: "adaptive" | "optimal" | "fixed" | undefined;
|
|
507
|
+
amplification?: {
|
|
508
|
+
method?: "standard" | "fixed_point" | "robust" | undefined;
|
|
509
|
+
boostFactor?: number | undefined;
|
|
510
|
+
} | undefined;
|
|
511
|
+
}>;
|
|
512
|
+
export type GroverSearchInput = z.infer<typeof GroverSearchInputSchema>;
|
|
513
|
+
export declare const DependencyResolveInputSchema: z.ZodObject<{
|
|
514
|
+
packages: z.ZodArray<z.ZodObject<{
|
|
515
|
+
name: z.ZodString;
|
|
516
|
+
version: z.ZodString;
|
|
517
|
+
dependencies: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
518
|
+
conflicts: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
519
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
520
|
+
vulnerabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
521
|
+
}, "strip", z.ZodTypeAny, {
|
|
522
|
+
name: string;
|
|
523
|
+
version: string;
|
|
524
|
+
dependencies: Record<string, string>;
|
|
525
|
+
conflicts: string[];
|
|
526
|
+
size?: number | undefined;
|
|
527
|
+
vulnerabilities?: string[] | undefined;
|
|
528
|
+
}, {
|
|
529
|
+
name: string;
|
|
530
|
+
version: string;
|
|
531
|
+
size?: number | undefined;
|
|
532
|
+
vulnerabilities?: string[] | undefined;
|
|
533
|
+
dependencies?: Record<string, string> | undefined;
|
|
534
|
+
conflicts?: string[] | undefined;
|
|
535
|
+
}>, "many">;
|
|
536
|
+
constraints: z.ZodOptional<z.ZodObject<{
|
|
537
|
+
minimize: z.ZodDefault<z.ZodEnum<["versions", "size", "vulnerabilities", "depth"]>>;
|
|
538
|
+
lockfile: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
539
|
+
includePeer: z.ZodDefault<z.ZodBoolean>;
|
|
540
|
+
timeout: z.ZodDefault<z.ZodNumber>;
|
|
541
|
+
}, "strip", z.ZodTypeAny, {
|
|
542
|
+
minimize: "versions" | "size" | "vulnerabilities" | "depth";
|
|
543
|
+
includePeer: boolean;
|
|
544
|
+
timeout: number;
|
|
545
|
+
lockfile?: Record<string, string> | undefined;
|
|
546
|
+
}, {
|
|
547
|
+
minimize?: "versions" | "size" | "vulnerabilities" | "depth" | undefined;
|
|
548
|
+
lockfile?: Record<string, string> | undefined;
|
|
549
|
+
includePeer?: boolean | undefined;
|
|
550
|
+
timeout?: number | undefined;
|
|
551
|
+
}>>;
|
|
552
|
+
solver: z.ZodDefault<z.ZodEnum<["quantum_annealing", "qaoa", "hybrid"]>>;
|
|
553
|
+
}, "strip", z.ZodTypeAny, {
|
|
554
|
+
packages: {
|
|
555
|
+
name: string;
|
|
556
|
+
version: string;
|
|
557
|
+
dependencies: Record<string, string>;
|
|
558
|
+
conflicts: string[];
|
|
559
|
+
size?: number | undefined;
|
|
560
|
+
vulnerabilities?: string[] | undefined;
|
|
561
|
+
}[];
|
|
562
|
+
solver: "quantum_annealing" | "qaoa" | "hybrid";
|
|
563
|
+
constraints?: {
|
|
564
|
+
minimize: "versions" | "size" | "vulnerabilities" | "depth";
|
|
565
|
+
includePeer: boolean;
|
|
566
|
+
timeout: number;
|
|
567
|
+
lockfile?: Record<string, string> | undefined;
|
|
568
|
+
} | undefined;
|
|
569
|
+
}, {
|
|
570
|
+
packages: {
|
|
571
|
+
name: string;
|
|
572
|
+
version: string;
|
|
573
|
+
size?: number | undefined;
|
|
574
|
+
vulnerabilities?: string[] | undefined;
|
|
575
|
+
dependencies?: Record<string, string> | undefined;
|
|
576
|
+
conflicts?: string[] | undefined;
|
|
577
|
+
}[];
|
|
578
|
+
constraints?: {
|
|
579
|
+
minimize?: "versions" | "size" | "vulnerabilities" | "depth" | undefined;
|
|
580
|
+
lockfile?: Record<string, string> | undefined;
|
|
581
|
+
includePeer?: boolean | undefined;
|
|
582
|
+
timeout?: number | undefined;
|
|
583
|
+
} | undefined;
|
|
584
|
+
solver?: "quantum_annealing" | "qaoa" | "hybrid" | undefined;
|
|
585
|
+
}>;
|
|
586
|
+
export type DependencyResolveInput = z.infer<typeof DependencyResolveInputSchema>;
|
|
587
|
+
export declare const ScheduleOptimizeInputSchema: z.ZodObject<{
|
|
588
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
589
|
+
id: z.ZodString;
|
|
590
|
+
duration: z.ZodNumber;
|
|
591
|
+
dependencies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
592
|
+
resources: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
593
|
+
deadline: z.ZodOptional<z.ZodNumber>;
|
|
594
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
595
|
+
}, "strip", z.ZodTypeAny, {
|
|
596
|
+
dependencies: string[];
|
|
597
|
+
id: string;
|
|
598
|
+
duration: number;
|
|
599
|
+
resources: string[];
|
|
600
|
+
deadline?: number | undefined;
|
|
601
|
+
priority?: number | undefined;
|
|
602
|
+
}, {
|
|
603
|
+
id: string;
|
|
604
|
+
duration: number;
|
|
605
|
+
dependencies?: string[] | undefined;
|
|
606
|
+
resources?: string[] | undefined;
|
|
607
|
+
deadline?: number | undefined;
|
|
608
|
+
priority?: number | undefined;
|
|
609
|
+
}>, "many">;
|
|
610
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
611
|
+
id: z.ZodString;
|
|
612
|
+
capacity: z.ZodNumber;
|
|
613
|
+
cost: z.ZodNumber;
|
|
614
|
+
availability: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
615
|
+
start: z.ZodNumber;
|
|
616
|
+
end: z.ZodNumber;
|
|
617
|
+
}, "strip", z.ZodTypeAny, {
|
|
618
|
+
start: number;
|
|
619
|
+
end: number;
|
|
620
|
+
}, {
|
|
621
|
+
start: number;
|
|
622
|
+
end: number;
|
|
623
|
+
}>, "many">>;
|
|
624
|
+
}, "strip", z.ZodTypeAny, {
|
|
625
|
+
cost: number;
|
|
626
|
+
id: string;
|
|
627
|
+
capacity: number;
|
|
628
|
+
availability?: {
|
|
629
|
+
start: number;
|
|
630
|
+
end: number;
|
|
631
|
+
}[] | undefined;
|
|
632
|
+
}, {
|
|
633
|
+
cost: number;
|
|
634
|
+
id: string;
|
|
635
|
+
capacity: number;
|
|
636
|
+
availability?: {
|
|
637
|
+
start: number;
|
|
638
|
+
end: number;
|
|
639
|
+
}[] | undefined;
|
|
640
|
+
}>, "many">;
|
|
641
|
+
objective: z.ZodDefault<z.ZodEnum<["makespan", "cost", "utilization", "weighted"]>>;
|
|
642
|
+
weights: z.ZodOptional<z.ZodObject<{
|
|
643
|
+
makespan: z.ZodDefault<z.ZodNumber>;
|
|
644
|
+
cost: z.ZodDefault<z.ZodNumber>;
|
|
645
|
+
utilization: z.ZodDefault<z.ZodNumber>;
|
|
646
|
+
}, "strip", z.ZodTypeAny, {
|
|
647
|
+
makespan: number;
|
|
648
|
+
cost: number;
|
|
649
|
+
utilization: number;
|
|
650
|
+
}, {
|
|
651
|
+
makespan?: number | undefined;
|
|
652
|
+
cost?: number | undefined;
|
|
653
|
+
utilization?: number | undefined;
|
|
654
|
+
}>>;
|
|
655
|
+
}, "strip", z.ZodTypeAny, {
|
|
656
|
+
objective: "makespan" | "cost" | "utilization" | "weighted";
|
|
657
|
+
resources: {
|
|
658
|
+
cost: number;
|
|
659
|
+
id: string;
|
|
660
|
+
capacity: number;
|
|
661
|
+
availability?: {
|
|
662
|
+
start: number;
|
|
663
|
+
end: number;
|
|
664
|
+
}[] | undefined;
|
|
665
|
+
}[];
|
|
666
|
+
tasks: {
|
|
667
|
+
dependencies: string[];
|
|
668
|
+
id: string;
|
|
669
|
+
duration: number;
|
|
670
|
+
resources: string[];
|
|
671
|
+
deadline?: number | undefined;
|
|
672
|
+
priority?: number | undefined;
|
|
673
|
+
}[];
|
|
674
|
+
weights?: {
|
|
675
|
+
makespan: number;
|
|
676
|
+
cost: number;
|
|
677
|
+
utilization: number;
|
|
678
|
+
} | undefined;
|
|
679
|
+
}, {
|
|
680
|
+
resources: {
|
|
681
|
+
cost: number;
|
|
682
|
+
id: string;
|
|
683
|
+
capacity: number;
|
|
684
|
+
availability?: {
|
|
685
|
+
start: number;
|
|
686
|
+
end: number;
|
|
687
|
+
}[] | undefined;
|
|
688
|
+
}[];
|
|
689
|
+
tasks: {
|
|
690
|
+
id: string;
|
|
691
|
+
duration: number;
|
|
692
|
+
dependencies?: string[] | undefined;
|
|
693
|
+
resources?: string[] | undefined;
|
|
694
|
+
deadline?: number | undefined;
|
|
695
|
+
priority?: number | undefined;
|
|
696
|
+
}[];
|
|
697
|
+
objective?: "makespan" | "cost" | "utilization" | "weighted" | undefined;
|
|
698
|
+
weights?: {
|
|
699
|
+
makespan?: number | undefined;
|
|
700
|
+
cost?: number | undefined;
|
|
701
|
+
utilization?: number | undefined;
|
|
702
|
+
} | undefined;
|
|
703
|
+
}>;
|
|
704
|
+
export type ScheduleOptimizeInput = z.infer<typeof ScheduleOptimizeInputSchema>;
|
|
705
|
+
export interface MCPToolInputSchema {
|
|
706
|
+
type: 'object';
|
|
707
|
+
properties: Record<string, unknown>;
|
|
708
|
+
required?: string[];
|
|
709
|
+
}
|
|
710
|
+
export interface MCPToolResult {
|
|
711
|
+
content: Array<{
|
|
712
|
+
type: 'text' | 'image' | 'resource';
|
|
713
|
+
text?: string;
|
|
714
|
+
data?: string;
|
|
715
|
+
mimeType?: string;
|
|
716
|
+
}>;
|
|
717
|
+
isError?: boolean;
|
|
718
|
+
}
|
|
719
|
+
export interface MCPTool {
|
|
720
|
+
name: string;
|
|
721
|
+
description: string;
|
|
722
|
+
inputSchema: MCPToolInputSchema;
|
|
723
|
+
category?: string;
|
|
724
|
+
tags?: string[];
|
|
725
|
+
version?: string;
|
|
726
|
+
cacheable?: boolean;
|
|
727
|
+
cacheTTL?: number;
|
|
728
|
+
handler: (input: Record<string, unknown>, context?: ToolContext) => Promise<MCPToolResult>;
|
|
729
|
+
}
|
|
730
|
+
export interface Logger {
|
|
731
|
+
debug(message: string, meta?: Record<string, unknown>): void;
|
|
732
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
733
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
734
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
735
|
+
}
|
|
736
|
+
export interface QuantumOptimizerConfig {
|
|
737
|
+
annealing: {
|
|
738
|
+
defaultReads: number;
|
|
739
|
+
maxVariables: number;
|
|
740
|
+
timeout: number;
|
|
741
|
+
};
|
|
742
|
+
qaoa: {
|
|
743
|
+
maxDepth: number;
|
|
744
|
+
maxNodes: number;
|
|
745
|
+
defaultShots: number;
|
|
746
|
+
};
|
|
747
|
+
grover: {
|
|
748
|
+
maxSearchSpace: number;
|
|
749
|
+
allowedOracleOps: string[];
|
|
750
|
+
};
|
|
751
|
+
resourceLimits: {
|
|
752
|
+
maxMemoryBytes: number;
|
|
753
|
+
maxCpuTimeMs: number;
|
|
754
|
+
maxIterations: number;
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
export interface QuantumOptimizerBridge {
|
|
758
|
+
initialized: boolean;
|
|
759
|
+
initialize(): Promise<void>;
|
|
760
|
+
dispose(): Promise<void>;
|
|
761
|
+
solveQubo(problem: QUBOProblem, config: AnnealingConfig): Promise<AnnealingResult>;
|
|
762
|
+
runQaoa(graph: ProblemGraph, circuit: QAOACircuit): Promise<QAOAResult>;
|
|
763
|
+
groverSearch(space: SearchSpace, config: AmplificationConfig): Promise<GroverResult>;
|
|
764
|
+
}
|
|
765
|
+
export interface ToolContext {
|
|
766
|
+
bridge?: QuantumOptimizerBridge;
|
|
767
|
+
config?: QuantumOptimizerConfig;
|
|
768
|
+
logger?: Logger;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Create a successful MCP tool result
|
|
772
|
+
*/
|
|
773
|
+
export declare function successResult(data: unknown): MCPToolResult;
|
|
774
|
+
/**
|
|
775
|
+
* Create an error MCP tool result
|
|
776
|
+
*/
|
|
777
|
+
export declare function errorResult(error: Error | string): MCPToolResult;
|
|
778
|
+
export declare const RESOURCE_LIMITS: {
|
|
779
|
+
readonly MAX_VARIABLES: 10000;
|
|
780
|
+
readonly MAX_ITERATIONS: 1000000;
|
|
781
|
+
readonly MAX_MEMORY_BYTES: 4294967296;
|
|
782
|
+
readonly MAX_CPU_TIME_MS: 600000;
|
|
783
|
+
readonly MAX_CIRCUIT_DEPTH: 20;
|
|
784
|
+
readonly MAX_QUBITS: 50;
|
|
785
|
+
readonly PROGRESS_CHECK_INTERVAL_MS: 10000;
|
|
786
|
+
readonly MIN_PROGRESS_THRESHOLD: 0.001;
|
|
787
|
+
};
|
|
788
|
+
export declare const ALLOWED_ORACLE_OPS: readonly ["==", "!=", "<", ">", "<=", ">=", "&&", "||", "!", "+", "-", "*", "/", "%", "."];
|
|
789
|
+
//# sourceMappingURL=types.d.ts.map
|