agentic-flow 3.2.0 → 3.3.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/.agents/skills/agentic-flow-ecosystem/SKILL.md +6 -5
- package/.claude/skills/agentic-flow-ecosystem/skill.md +6 -5
- package/CHANGELOG.md +25 -0
- package/README.md +2 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/config/claudeFlow.d.ts +1 -1
- package/dist/integrations/index.d.ts +2 -2
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/optional.d.ts +3 -15
- package/dist/integrations/optional.d.ts.map +1 -1
- package/dist/integrations/optional.js +4 -28
- package/dist/integrations/optional.js.map +1 -1
- package/dist/integrations/sublinear.d.ts +56 -28
- package/dist/integrations/sublinear.d.ts.map +1 -1
- package/dist/integrations/sublinear.js +165 -89
- package/dist/integrations/sublinear.js.map +1 -1
- package/dist/intelligence/RuVectorIntelligence.d.ts.map +1 -1
- package/dist/intelligence/RuVectorIntelligence.js +4 -3
- package/dist/intelligence/RuVectorIntelligence.js.map +1 -1
- package/dist/mcp/standalone-stdio.js +1 -1
- package/dist/mcp/standalone-stdio.js.map +1 -1
- package/dist/mcp/tools/ecosystem-tools.d.ts +4 -4
- package/dist/mcp/tools/ecosystem-tools.d.ts.map +1 -1
- package/dist/mcp/tools/ecosystem-tools.js +30 -8
- package/dist/mcp/tools/ecosystem-tools.js.map +1 -1
- package/dist/optimizations/configuration-tuning.d.ts +1 -1
- package/dist/services/sona-loader.d.ts +15 -1
- package/dist/services/sona-loader.d.ts.map +1 -1
- package/dist/services/sona-loader.js +54 -2
- package/dist/services/sona-loader.js.map +1 -1
- package/package.json +5 -5
|
@@ -26,7 +26,7 @@ export declare function getMemoryConfig(agentName?: string): {
|
|
|
26
26
|
* Initialize swarm coordination for multi-agent tasks
|
|
27
27
|
*/
|
|
28
28
|
export declare function getSwarmConfig(topology?: ClaudeFlowConfig['coordinationTopology']): {
|
|
29
|
-
topology: "
|
|
29
|
+
topology: "hierarchical" | "mesh" | "ring" | "star";
|
|
30
30
|
maxAgents: number;
|
|
31
31
|
strategy: "balanced";
|
|
32
32
|
};
|
|
@@ -6,8 +6,8 @@ export { scanPromptInjection, promptInjectionEngine, getInjectionPolicy } from '
|
|
|
6
6
|
export type { InjectionScan, InjectionThreat, InjectionPolicy, InjectionSeverity } from './prompt-injection.js';
|
|
7
7
|
export { partitionTaskGraph } from './task-partition.js';
|
|
8
8
|
export type { TaskDependency, TaskPartition } from './task-partition.js';
|
|
9
|
-
export { solveLinearSystem, pageRank } from './sublinear.js';
|
|
10
|
-
export type { LinearSolveResult, PageRankResult, MatrixInput, SparseEntry } from './sublinear.js';
|
|
9
|
+
export { solveLinearSystem, pageRank, loadSublinearCore } from './sublinear.js';
|
|
10
|
+
export type { LinearSolveResult, PageRankResult, PageRankOptions, PageRankEdge, MatrixInput, SparseEntry, SolveMethod, SublinearEngine } from './sublinear.js';
|
|
11
11
|
export { applyAgentBoosterEdit, getAgentBoosterLibrary } from './agent-booster.js';
|
|
12
12
|
export type { BoosterEditResult } from './agent-booster.js';
|
|
13
13
|
export { OnnxWasmTextEmbedder, getOnnxWasmEmbedder, loadOnnxWasmModule, onnxWasmModelCached } from './onnx-wasm-embedder.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACvG,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACvG,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAChF,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC/J,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACnF,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC7H,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { scanPromptInjection, promptInjectionEngine, getInjectionPolicy } from './prompt-injection.js';
|
|
6
6
|
export { partitionTaskGraph } from './task-partition.js';
|
|
7
|
-
export { solveLinearSystem, pageRank } from './sublinear.js';
|
|
7
|
+
export { solveLinearSystem, pageRank, loadSublinearCore } from './sublinear.js';
|
|
8
8
|
export { applyAgentBoosterEdit, getAgentBoosterLibrary } from './agent-booster.js';
|
|
9
9
|
export { OnnxWasmTextEmbedder, getOnnxWasmEmbedder, loadOnnxWasmModule, onnxWasmModelCached } from './onnx-wasm-embedder.js';
|
|
10
10
|
export { isOptionalInstalled } from './optional.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEhF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEnF,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC7H,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/**\n * agentic-flow/integrations — programmatic access to the optional ruvnet\n * package integrations (each with a built-in fallback).\n */\n\nexport { scanPromptInjection, promptInjectionEngine, getInjectionPolicy } from './prompt-injection.js';\nexport type { InjectionScan, InjectionThreat, InjectionPolicy, InjectionSeverity } from './prompt-injection.js';\nexport { partitionTaskGraph } from './task-partition.js';\nexport type { TaskDependency, TaskPartition } from './task-partition.js';\nexport { solveLinearSystem, pageRank, loadSublinearCore } from './sublinear.js';\nexport type { LinearSolveResult, PageRankResult, PageRankOptions, PageRankEdge, MatrixInput, SparseEntry, SolveMethod, SublinearEngine } from './sublinear.js';\nexport { applyAgentBoosterEdit, getAgentBoosterLibrary } from './agent-booster.js';\nexport type { BoosterEditResult } from './agent-booster.js';\nexport { OnnxWasmTextEmbedder, getOnnxWasmEmbedder, loadOnnxWasmModule, onnxWasmModelCached } from './onnx-wasm-embedder.js';\nexport { isOptionalInstalled } from './optional.js';\n"]}
|
|
@@ -17,28 +17,16 @@
|
|
|
17
17
|
export declare function requireOptional<T = any>(specifier: string): T | null;
|
|
18
18
|
/**
|
|
19
19
|
* Whether a package is installed, without loading it. ESM-only packages whose
|
|
20
|
-
* exports map has no require/default condition (
|
|
21
|
-
*
|
|
20
|
+
* exports map has no require/default condition cannot be require.resolve()d,
|
|
21
|
+
* but that error itself proves the package is there.
|
|
22
22
|
*/
|
|
23
23
|
export declare function isOptionalInstalled(specifier: string): boolean;
|
|
24
24
|
/** Asynchronously import an optional package (ESM or CJS), or return null. */
|
|
25
|
-
export declare function importOptional<T = any>(specifier: string
|
|
26
|
-
quietStdout?: boolean;
|
|
27
|
-
}): Promise<T | null>;
|
|
25
|
+
export declare function importOptional<T = any>(specifier: string): Promise<T | null>;
|
|
28
26
|
/** Why the last load of `specifier` failed, if it did. */
|
|
29
27
|
export declare function optionalLoadError(specifier: string): string | undefined;
|
|
30
28
|
/** Resolve a package's entry file without loading it, or null if absent. */
|
|
31
29
|
export declare function resolveOptional(specifier: string): string | null;
|
|
32
|
-
/**
|
|
33
|
-
* Run `fn` with `console.log`/`console.info` sent to stderr.
|
|
34
|
-
*
|
|
35
|
-
* The MCP stdio server speaks JSON-RPC over stdout, so a dependency that
|
|
36
|
-
* prints a banner (sublinear-time-solver does, from `console.log`) would
|
|
37
|
-
* corrupt the protocol stream. Only the console methods are patched — never
|
|
38
|
-
* `process.stdout.write` — so a protocol frame written by the server while
|
|
39
|
-
* `fn` is pending still reaches stdout.
|
|
40
|
-
*/
|
|
41
|
-
export declare function withStdoutToStderr<T>(fn: () => Promise<T> | T): Promise<T>;
|
|
42
30
|
/** Test hook: forget cached load results. */
|
|
43
31
|
export declare function _resetOptionalCache(): void;
|
|
44
32
|
//# sourceMappingURL=optional.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.d.ts","sourceRoot":"","sources":["../../src/integrations/optional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAWpE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAO9D;AAED,8EAA8E;AAC9E,wBAAsB,cAAc,CAAC,CAAC,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"optional.d.ts","sourceRoot":"","sources":["../../src/integrations/optional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAWpE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAO9D;AAED,8EAA8E;AAC9E,wBAAsB,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAalF;AAED,0DAA0D;AAC1D,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvE;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMhE;AAED,6CAA6C;AAC7C,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C"}
|
|
@@ -34,8 +34,8 @@ export function requireOptional(specifier) {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Whether a package is installed, without loading it. ESM-only packages whose
|
|
37
|
-
* exports map has no require/default condition (
|
|
38
|
-
*
|
|
37
|
+
* exports map has no require/default condition cannot be require.resolve()d,
|
|
38
|
+
* but that error itself proves the package is there.
|
|
39
39
|
*/
|
|
40
40
|
export function isOptionalInstalled(specifier) {
|
|
41
41
|
try {
|
|
@@ -47,14 +47,12 @@ export function isOptionalInstalled(specifier) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
/** Asynchronously import an optional package (ESM or CJS), or return null. */
|
|
50
|
-
export async function importOptional(specifier
|
|
50
|
+
export async function importOptional(specifier) {
|
|
51
51
|
let pending = asyncCache.get(specifier);
|
|
52
52
|
if (!pending) {
|
|
53
53
|
pending = (async () => {
|
|
54
54
|
try {
|
|
55
|
-
|
|
56
|
-
const mod = options.quietStdout ? await withStdoutToStderr(load) : await load();
|
|
57
|
-
return { mod };
|
|
55
|
+
return { mod: await import(specifier) };
|
|
58
56
|
}
|
|
59
57
|
catch (err) {
|
|
60
58
|
return { mod: null, error: err?.message ?? String(err) };
|
|
@@ -77,28 +75,6 @@ export function resolveOptional(specifier) {
|
|
|
77
75
|
return null;
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Run `fn` with `console.log`/`console.info` sent to stderr.
|
|
82
|
-
*
|
|
83
|
-
* The MCP stdio server speaks JSON-RPC over stdout, so a dependency that
|
|
84
|
-
* prints a banner (sublinear-time-solver does, from `console.log`) would
|
|
85
|
-
* corrupt the protocol stream. Only the console methods are patched — never
|
|
86
|
-
* `process.stdout.write` — so a protocol frame written by the server while
|
|
87
|
-
* `fn` is pending still reaches stdout.
|
|
88
|
-
*/
|
|
89
|
-
export async function withStdoutToStderr(fn) {
|
|
90
|
-
const originalLog = console.log;
|
|
91
|
-
const originalInfo = console.info;
|
|
92
|
-
console.log = (...args) => console.error(...args);
|
|
93
|
-
console.info = (...args) => console.error(...args);
|
|
94
|
-
try {
|
|
95
|
-
return await fn();
|
|
96
|
-
}
|
|
97
|
-
finally {
|
|
98
|
-
console.log = originalLog;
|
|
99
|
-
console.info = originalInfo;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
78
|
/** Test hook: forget cached load results. */
|
|
103
79
|
export function _resetOptionalCache() {
|
|
104
80
|
syncCache.clear();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../src/integrations/optional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAGnD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;AAChD,MAAM,UAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;AAE1D,sEAAsE;AACtE,MAAM,UAAU,eAAe,CAAU,SAAiB;IACxD,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC,GAAe,CAAC;IAC1C,IAAI,KAAiB,CAAC;IACtB,IAAI,CAAC;QACH,KAAK,GAAG,EAAE,GAAG,EAAE,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;IAC1C,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,KAAK,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;IAC5D,CAAC;IACD,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAChC,OAAO,KAAK,CAAC,GAAe,CAAC;AA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A6C;AAC7C,MAAM,UAAU,mBAAmB;IACjC,SAAS,CAAC,KAAK,EAAE,CAAC;IAClB,UAAU,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Optional ecosystem packages — one place to load them.\n *\n * Every package loaded here is an `optionalDependency` of agentic-flow: npm\n * installs it by default, but it may be missing (`--omit=optional`, an\n * unsupported platform, a failed native build). Callers therefore always get\n * either the module or `null`, never a throw, and keep a built-in fallback.\n *\n * Two loaders:\n * - `requireOptional` is synchronous (createRequire) for CommonJS packages that\n * must be usable from synchronous code paths (e.g. input validation).\n * - `importOptional` is asynchronous for ESM packages.\n *\n * Results (including \"not installed\") are cached per specifier.\n */\n\nimport { createRequire } from 'node:module';\n\nconst nodeRequire = createRequire(import.meta.url);\n\ntype CacheEntry = { mod: any | null; error?: string };\nconst syncCache = new Map<string, CacheEntry>();\nconst asyncCache = new Map<string, Promise<CacheEntry>>();\n\n/** Synchronously load a CommonJS optional package, or return null. */\nexport function requireOptional<T = any>(specifier: string): T | null {\n const cached = syncCache.get(specifier);\n if (cached) return cached.mod as T | null;\n let entry: CacheEntry;\n try {\n entry = { mod: nodeRequire(specifier) };\n } catch (err: any) {\n entry = { mod: null, error: err?.message ?? String(err) };\n }\n syncCache.set(specifier, entry);\n return entry.mod as T | null;\n}\n\n/**\n * Whether a package is installed, without loading it. ESM-only packages whose\n * exports map has no require/default condition cannot be require.resolve()d,\n * but that error itself proves the package is there.\n */\nexport function isOptionalInstalled(specifier: string): boolean {\n try {\n nodeRequire.resolve(specifier);\n return true;\n } catch (err: any) {\n return err?.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED';\n }\n}\n\n/** Asynchronously import an optional package (ESM or CJS), or return null. */\nexport async function importOptional<T = any>(specifier: string): Promise<T | null> {\n let pending = asyncCache.get(specifier);\n if (!pending) {\n pending = (async (): Promise<CacheEntry> => {\n try {\n return { mod: await import(specifier) };\n } catch (err: any) {\n return { mod: null, error: err?.message ?? String(err) };\n }\n })();\n asyncCache.set(specifier, pending);\n }\n return (await pending).mod as T | null;\n}\n\n/** Why the last load of `specifier` failed, if it did. */\nexport function optionalLoadError(specifier: string): string | undefined {\n return syncCache.get(specifier)?.error;\n}\n\n/** Resolve a package's entry file without loading it, or null if absent. */\nexport function resolveOptional(specifier: string): string | null {\n try {\n return nodeRequire.resolve(specifier);\n } catch {\n return null;\n }\n}\n\n/** Test hook: forget cached load results. */\nexport function _resetOptionalCache(): void {\n syncCache.clear();\n asyncCache.clear();\n}\n"]}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Linear solves and PageRank through
|
|
2
|
+
* Linear solves and PageRank through `@ruvnet/sublinear-core`, verified.
|
|
3
3
|
*
|
|
4
|
-
* sublinear-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
11
|
-
* built-in Gauss-Seidel solve replaces it when the check fails;
|
|
12
|
-
* - the import, construction and solve run with console output sent to stderr
|
|
13
|
-
* (the MCP stdio server owns stdout).
|
|
4
|
+
* @ruvnet/sublinear-core (optionalDependency, zero dependencies, ~220 kB) is
|
|
5
|
+
* the embeddable core of sublinear-time-solver: sparse iterative solvers
|
|
6
|
+
* (Gauss-Seidel, conjugate gradient, Jacobi, Neumann), PageRank, personalized
|
|
7
|
+
* PageRank and local forward push. It reports the residual of the x it
|
|
8
|
+
* returns, but every answer is still checked here against ||Mx - b||_inf, and
|
|
9
|
+
* a built-in Gauss-Seidel solve replaces it when the check fails or the
|
|
10
|
+
* package is not installed.
|
|
14
11
|
*
|
|
15
12
|
* The 5 bundled `sublinear/*` agents name sublinear-time-solver tools; the
|
|
16
13
|
* `sublinear_solve` / `sublinear_pagerank` MCP tools in this package give them
|
|
17
14
|
* a working in-process path without a separate MCP server.
|
|
18
15
|
*/
|
|
16
|
+
export declare const SUBLINEAR_CORE = "@ruvnet/sublinear-core";
|
|
19
17
|
export interface SparseEntry {
|
|
20
18
|
row: number;
|
|
21
19
|
col: number;
|
|
@@ -25,47 +23,77 @@ export type MatrixInput = number[][] | {
|
|
|
25
23
|
size: number;
|
|
26
24
|
entries: SparseEntry[];
|
|
27
25
|
};
|
|
26
|
+
export type SolveMethod = 'auto' | 'gauss-seidel' | 'conjugate-gradient' | 'jacobi' | 'neumann';
|
|
27
|
+
export type SublinearEngine = 'sublinear-core' | 'builtin';
|
|
28
28
|
export interface LinearSolveResult {
|
|
29
29
|
solution: number[];
|
|
30
|
-
/** max_i |(Mx - b)_i
|
|
30
|
+
/** max_i |(Mx - b)_i|, recomputed here from the returned solution. */
|
|
31
31
|
residual: number;
|
|
32
32
|
converged: boolean;
|
|
33
33
|
iterations: number;
|
|
34
34
|
diagonallyDominant: boolean;
|
|
35
|
-
engine:
|
|
35
|
+
engine: SublinearEngine;
|
|
36
|
+
/** Method that produced the solution. */
|
|
37
|
+
method: Exclude<SolveMethod, 'auto'>;
|
|
36
38
|
/** Set when the library answered but failed verification. */
|
|
37
39
|
libraryRejected?: string;
|
|
38
40
|
}
|
|
41
|
+
/** The core module, or null when it is not installed. */
|
|
42
|
+
export declare function loadSublinearCore(): Promise<any | null>;
|
|
39
43
|
/**
|
|
40
|
-
* Solve Mx = b. Intended for (row) diagonally dominant
|
|
41
|
-
* attempted with Gauss-Seidel and reported with
|
|
44
|
+
* Solve Mx = b. Intended for (row) diagonally dominant or symmetric positive
|
|
45
|
+
* definite M; other matrices are attempted with Gauss-Seidel and reported with
|
|
46
|
+
* `converged: false` if it fails.
|
|
42
47
|
*/
|
|
43
48
|
export declare function solveLinearSystem(matrix: MatrixInput, b: number[], options?: {
|
|
44
49
|
tolerance?: number;
|
|
45
50
|
maxIterations?: number;
|
|
51
|
+
method?: SolveMethod;
|
|
46
52
|
engine?: 'auto' | 'builtin';
|
|
47
53
|
}): Promise<LinearSolveResult>;
|
|
54
|
+
export interface PageRankEdge {
|
|
55
|
+
from: string;
|
|
56
|
+
to: string;
|
|
57
|
+
weight?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface PageRankOptions {
|
|
60
|
+
/** Probability of following an out-edge (1 - restart probability). Default 0.85. */
|
|
61
|
+
damping?: number;
|
|
62
|
+
/** Extra nodes with no edges. */
|
|
63
|
+
nodes?: string[];
|
|
64
|
+
/** Personalized PageRank: restart at these nodes (equal weight) or by weight. */
|
|
65
|
+
seeds?: string[] | Record<string, number>;
|
|
66
|
+
/**
|
|
67
|
+
* With `seeds`: estimate by local forward push instead of power iteration.
|
|
68
|
+
* Work depends on `epsilon`, not on the graph size; scores of nodes far from
|
|
69
|
+
* the seeds are left at 0 and `residualMass` bounds the total L1 error.
|
|
70
|
+
*/
|
|
71
|
+
approximate?: boolean;
|
|
72
|
+
/** Forward-push residual threshold. Default 1e-6. */
|
|
73
|
+
epsilon?: number;
|
|
74
|
+
/** Return only the top N in `ranking` (and `scores`, for approximate runs). */
|
|
75
|
+
top?: number;
|
|
76
|
+
engine?: 'auto' | 'builtin';
|
|
77
|
+
}
|
|
48
78
|
export interface PageRankResult {
|
|
49
79
|
scores: Record<string, number>;
|
|
50
80
|
ranking: Array<{
|
|
51
81
|
node: string;
|
|
52
82
|
score: number;
|
|
53
83
|
}>;
|
|
54
|
-
engine:
|
|
84
|
+
engine: SublinearEngine;
|
|
85
|
+
method: 'power-iteration' | 'forward-push' | 'gauss-seidel';
|
|
86
|
+
personalized: boolean;
|
|
87
|
+
/** Linear-system residual (gauss-seidel) or last L1 change (power iteration). */
|
|
55
88
|
residual: number;
|
|
89
|
+
/** forward-push only: unpushed mass, an upper bound on the total L1 error. */
|
|
90
|
+
residualMass?: number;
|
|
91
|
+
/** Set when the library answered but failed verification. */
|
|
92
|
+
libraryRejected?: string;
|
|
56
93
|
}
|
|
57
94
|
/**
|
|
58
|
-
* PageRank over a directed graph
|
|
59
|
-
*
|
|
60
|
-
* equals PageRank with uniform teleport from dangling nodes.
|
|
95
|
+
* PageRank over a directed graph, or personalized PageRank from `seeds`.
|
|
96
|
+
* Scores sum to 1 (approximate runs: to 1 - residualMass).
|
|
61
97
|
*/
|
|
62
|
-
export declare function pageRank(edges:
|
|
63
|
-
from: string;
|
|
64
|
-
to: string;
|
|
65
|
-
weight?: number;
|
|
66
|
-
}>, options?: {
|
|
67
|
-
damping?: number;
|
|
68
|
-
nodes?: string[];
|
|
69
|
-
engine?: 'auto' | 'builtin';
|
|
70
|
-
}): Promise<PageRankResult>;
|
|
98
|
+
export declare function pageRank(edges: PageRankEdge[], options?: PageRankOptions): Promise<PageRankResult>;
|
|
71
99
|
//# sourceMappingURL=sublinear.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sublinear.d.ts","sourceRoot":"","sources":["../../src/integrations/sublinear.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sublinear.d.ts","sourceRoot":"","sources":["../../src/integrations/sublinear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,eAAO,MAAM,cAAc,2BAA2B,CAAC;AAEvD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,EAAE,EAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,cAAc,GAAG,oBAAoB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhG,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,OAA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