@soulcraft/cor 3.0.0-rc.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/LICENSE +16 -0
- package/README.md +328 -0
- package/dist/aggregation/NativeAggregationEngine.d.ts +118 -0
- package/dist/aggregation/NativeAggregationEngine.js +186 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.js +236 -0
- package/dist/graph/GraphAccelerationAdapter.d.ts +153 -0
- package/dist/graph/GraphAccelerationAdapter.js +326 -0
- package/dist/graph/NativeGraphAdjacencyIndex.d.ts +286 -0
- package/dist/graph/NativeGraphAdjacencyIndex.js +944 -0
- package/dist/hnsw/AdaptiveDiskAnnModeSelector.d.ts +187 -0
- package/dist/hnsw/AdaptiveDiskAnnModeSelector.js +313 -0
- package/dist/hnsw/NativeDiskAnnWrapper.d.ts +489 -0
- package/dist/hnsw/NativeDiskAnnWrapper.js +1456 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +29 -0
- package/dist/legacyLayoutGuard.d.ts +93 -0
- package/dist/legacyLayoutGuard.js +237 -0
- package/dist/license/constants.d.ts +30 -0
- package/dist/license/constants.js +30 -0
- package/dist/license/onlineValidator.d.ts +43 -0
- package/dist/license/onlineValidator.js +225 -0
- package/dist/license/types.d.ts +39 -0
- package/dist/license/types.js +5 -0
- package/dist/license.d.ts +64 -0
- package/dist/license.js +165 -0
- package/dist/migration/MigrationCoordinator.d.ts +171 -0
- package/dist/migration/MigrationCoordinator.js +249 -0
- package/dist/migration/indexEpochGuard.d.ts +163 -0
- package/dist/migration/indexEpochGuard.js +202 -0
- package/dist/native/NativeEmbeddingEngine.d.ts +79 -0
- package/dist/native/NativeEmbeddingEngine.js +318 -0
- package/dist/native/NativeRoaringBitmap32.d.ts +114 -0
- package/dist/native/NativeRoaringBitmap32.js +221 -0
- package/dist/native/ffi.d.ts +20 -0
- package/dist/native/ffi.js +48 -0
- package/dist/native/idMapperTestSupport.d.ts +67 -0
- package/dist/native/idMapperTestSupport.js +112 -0
- package/dist/native/index.d.ts +49 -0
- package/dist/native/index.js +87 -0
- package/dist/native/napi.d.ts +21 -0
- package/dist/native/napi.js +88 -0
- package/dist/native/types.d.ts +1298 -0
- package/dist/native/types.js +16 -0
- package/dist/plugin.d.ts +50 -0
- package/dist/plugin.js +388 -0
- package/dist/providerContracts.d.ts +277 -0
- package/dist/providerContracts.js +38 -0
- package/dist/resource/OsMemoryProbe.d.ts +175 -0
- package/dist/resource/OsMemoryProbe.js +206 -0
- package/dist/resource/ResourceManager.d.ts +491 -0
- package/dist/resource/ResourceManager.js +960 -0
- package/dist/utils/ColumnManifest.d.ts +97 -0
- package/dist/utils/ColumnManifest.js +129 -0
- package/dist/utils/NativeColumnStore.d.ts +284 -0
- package/dist/utils/NativeColumnStore.js +685 -0
- package/dist/utils/NativeMetadataIndex.d.ts +882 -0
- package/dist/utils/NativeMetadataIndex.js +2631 -0
- package/dist/utils/NativeUnifiedCache.d.ts +87 -0
- package/dist/utils/NativeUnifiedCache.js +273 -0
- package/dist/utils/binaryIdMapperFactory.d.ts +59 -0
- package/dist/utils/binaryIdMapperFactory.js +94 -0
- package/dist/utils/collation.d.ts +30 -0
- package/dist/utils/collation.js +40 -0
- package/dist/utils/columnStoreTypes.d.ts +161 -0
- package/dist/utils/columnStoreTypes.js +29 -0
- package/dist/utils/nativeBinaryEntityIdMapper.d.ts +211 -0
- package/dist/utils/nativeBinaryEntityIdMapper.js +381 -0
- package/dist/utils/nativeEntityIdMapper.d.ts +111 -0
- package/dist/utils/nativeEntityIdMapper.js +170 -0
- package/docs/ADR-002-diskann-100-percent-rust.md +294 -0
- package/docs/ADR-003-semantic-time-travel.md +100 -0
- package/docs/aggregation.md +251 -0
- package/docs/comparison.md +162 -0
- package/docs/deployment-limits.md +87 -0
- package/docs/diskann.md +184 -0
- package/docs/migration-3.0.md +396 -0
- package/docs/performance-budget.md +274 -0
- package/docs/performance.md +117 -0
- package/docs/scaling.md +439 -0
- package/docs/snapshot-safety.md +246 -0
- package/docs/u64-id-space.md +214 -0
- package/docs/verification-report.md +670 -0
- package/native/brainy-native.node +0 -0
- package/native/index.d.ts +3916 -0
- package/package.json +92 -0
- package/scripts/migrate-cortex-2x-to-3x.mjs +970 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* cor CLI — license management for @soulcraft/cor
|
|
4
|
+
*
|
|
5
|
+
* Commands:
|
|
6
|
+
* activate <code-or-key> Write activation code or JWT to .soulcraft.json
|
|
7
|
+
* status Show current license configuration and validation result
|
|
8
|
+
* deactivate Remove the cor license from .soulcraft.json
|
|
9
|
+
* help Print this help text
|
|
10
|
+
*/
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { readConfig, writeConfig, isShortCode, exchangeShortCode, readLicenseToken } from './license.js';
|
|
13
|
+
import { SHORT_CODE_PATTERN, CONFIG_FILE } from './license/constants.js';
|
|
14
|
+
const JWT_PREFIX = 'sc_cor_';
|
|
15
|
+
// Legacy prefix still accepted during the cortex→cor rename transition.
|
|
16
|
+
const LEGACY_JWT_PREFIX = 'sc_cortex_';
|
|
17
|
+
const isJwtToken = (s) => s.startsWith(JWT_PREFIX) || s.startsWith(LEGACY_JWT_PREFIX);
|
|
18
|
+
/** Read the license value from either the new `cor` key or the legacy `cortex` key. */
|
|
19
|
+
const readLicenseValue = (config) => config.cor ?? config.cortex;
|
|
20
|
+
/**
|
|
21
|
+
* Determine the raw license value and which source provided it, using the same
|
|
22
|
+
* cache→env→file order as readLicenseToken(). We do NOT consult the in-memory
|
|
23
|
+
* cache here: a fresh `cor status` process has no heartbeat-populated cache, so
|
|
24
|
+
* the externally-observable sources are the env var and the config file.
|
|
25
|
+
*/
|
|
26
|
+
function resolveLicenseSource(config) {
|
|
27
|
+
// Env var wins over the file (matches readLicenseToken). Trimmed because
|
|
28
|
+
// secrets managers and `$(cat …)` often append a trailing newline.
|
|
29
|
+
const corEnv = process.env.COR_LICENSE_KEY?.trim();
|
|
30
|
+
if (corEnv)
|
|
31
|
+
return { source: 'env', value: corEnv, envVarName: 'COR_LICENSE_KEY' };
|
|
32
|
+
const legacyEnv = process.env.CORTEX_LICENSE_KEY?.trim();
|
|
33
|
+
if (legacyEnv)
|
|
34
|
+
return { source: 'env', value: legacyEnv, envVarName: 'CORTEX_LICENSE_KEY' };
|
|
35
|
+
const fileValue = readLicenseValue(config);
|
|
36
|
+
if (fileValue)
|
|
37
|
+
return { source: 'file', value: fileValue };
|
|
38
|
+
return { source: 'none', value: undefined };
|
|
39
|
+
}
|
|
40
|
+
function printHelp() {
|
|
41
|
+
console.log(`
|
|
42
|
+
cor — license management for @soulcraft/cor
|
|
43
|
+
|
|
44
|
+
USAGE
|
|
45
|
+
npx @soulcraft/cor <command> [args]
|
|
46
|
+
|
|
47
|
+
COMMANDS
|
|
48
|
+
activate <code-or-key> Activate with a short code (CO-XXXX-XXXX) or JWT
|
|
49
|
+
status Show current license status
|
|
50
|
+
deactivate Remove the cor license key
|
|
51
|
+
help Print this help text
|
|
52
|
+
|
|
53
|
+
EXAMPLES
|
|
54
|
+
npx @soulcraft/cor activate CO-7F3A-9B2D
|
|
55
|
+
npx @soulcraft/cor status
|
|
56
|
+
npx @soulcraft/cor deactivate
|
|
57
|
+
|
|
58
|
+
NOTES
|
|
59
|
+
Activation writes to ${CONFIG_FILE} in the current directory.
|
|
60
|
+
Commit this file — it deploys with your app and works in dev/staging/prod.
|
|
61
|
+
Get your activation code at https://soulcraft.com/account
|
|
62
|
+
`.trimStart());
|
|
63
|
+
}
|
|
64
|
+
async function cmdActivate(arg) {
|
|
65
|
+
if (!arg) {
|
|
66
|
+
console.error('Error: activate requires a code or key argument');
|
|
67
|
+
console.error(' Usage: npx @soulcraft/cor activate <code-or-key>');
|
|
68
|
+
console.error(' Example: npx @soulcraft/cor activate CO-7F3A-9B2D');
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
const isCode = isShortCode(arg);
|
|
72
|
+
const isJwt = isJwtToken(arg);
|
|
73
|
+
if (!isCode && !isJwt) {
|
|
74
|
+
console.error(`Error: invalid format — "${arg}"`);
|
|
75
|
+
console.error('');
|
|
76
|
+
console.error('Expected either:');
|
|
77
|
+
console.error(` A short code matching ${SHORT_CODE_PATTERN} (e.g. CO-7F3A-9B2D)`);
|
|
78
|
+
console.error(` A JWT starting with "${JWT_PREFIX}"`);
|
|
79
|
+
console.error('');
|
|
80
|
+
console.error('Get your activation code at https://soulcraft.com/account');
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
if (isCode) {
|
|
84
|
+
// Exchange the short code for a JWT first — write only the JWT to .soulcraft.json.
|
|
85
|
+
// The JWT validates offline, so the deployed app never needs to reach the exchange API.
|
|
86
|
+
process.stdout.write(`Exchanging ${arg} with soulcraft.com... `);
|
|
87
|
+
const jwt = await exchangeShortCode(arg);
|
|
88
|
+
if (!jwt) {
|
|
89
|
+
console.error('failed');
|
|
90
|
+
console.error('');
|
|
91
|
+
console.error('Could not exchange activation code. Check:');
|
|
92
|
+
console.error(' - Your code is correct at https://soulcraft.com/account');
|
|
93
|
+
console.error(' - This machine has outbound HTTPS access to soulcraft.com');
|
|
94
|
+
console.error('');
|
|
95
|
+
console.error('Tip: activate on a machine with internet access, then commit .soulcraft.json');
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
console.log('ok');
|
|
99
|
+
await writeConfig({ cor: jwt });
|
|
100
|
+
console.log(`\nActivated. ${CONFIG_FILE} written — commit it to your repository.`);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// Direct JWT — write immediately; validates offline, no exchange needed.
|
|
104
|
+
await writeConfig({ cor: arg });
|
|
105
|
+
console.log(`License key written to ${CONFIG_FILE} — commit it to your repository.`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function cmdStatus() {
|
|
109
|
+
// Resolve the same way the runtime does (cache→env→file), so an env-var-only
|
|
110
|
+
// deploy (COR_LICENSE_KEY set, no .soulcraft.json) reports as configured.
|
|
111
|
+
const config = await readConfig();
|
|
112
|
+
const { source, value, envVarName } = resolveLicenseSource(config);
|
|
113
|
+
if (source === 'none' || !value) {
|
|
114
|
+
console.log('No Soulcraft Cor license configured.');
|
|
115
|
+
console.log(`Add one with: npx @soulcraft/cor activate CO-XXXX-XXXX`);
|
|
116
|
+
console.log('Or set the COR_LICENSE_KEY environment variable.');
|
|
117
|
+
console.log('Or visit https://soulcraft.com/account for your activation code.');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const isCode = isShortCode(value);
|
|
121
|
+
const isJwt = isJwtToken(value);
|
|
122
|
+
// Report which source supplied the value — env var vs .soulcraft.json.
|
|
123
|
+
if (source === 'env') {
|
|
124
|
+
console.log(`Source: ${envVarName} environment variable`);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
console.log(`Source: ${CONFIG_FILE}`);
|
|
128
|
+
}
|
|
129
|
+
console.log(` key: ${isCode ? value : value.slice(0, 20) + '...'}`);
|
|
130
|
+
console.log(` type: ${isCode ? 'activation code' : isJwt ? 'JWT' : 'unknown format'}`);
|
|
131
|
+
console.log('');
|
|
132
|
+
if (isCode) {
|
|
133
|
+
// Use the runtime resolver so short-code exchange and caching match exactly
|
|
134
|
+
// what validateLicense() would do for this same value.
|
|
135
|
+
process.stdout.write('Exchanging short code with soulcraft.com... ');
|
|
136
|
+
const jwt = await readLicenseToken();
|
|
137
|
+
if (!jwt) {
|
|
138
|
+
console.log('failed (server unreachable or invalid code)');
|
|
139
|
+
console.log('Check your code at https://soulcraft.com/account');
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
console.log('ok');
|
|
143
|
+
console.log('');
|
|
144
|
+
await printValidation(jwt);
|
|
145
|
+
}
|
|
146
|
+
else if (isJwt) {
|
|
147
|
+
await printValidation(value);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
console.log('Warning: unrecognized format — expected CO-XXXX-XXXX or sc_cor_...');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async function printValidation(token) {
|
|
154
|
+
try {
|
|
155
|
+
const { loadNativeModule, isNativeAvailable } = await import('./native/index.js');
|
|
156
|
+
if (!isNativeAvailable()) {
|
|
157
|
+
console.log('Native module unavailable — cannot validate locally.');
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const native = loadNativeModule();
|
|
161
|
+
const result = native.validateLicenseKey(token);
|
|
162
|
+
if (result.valid) {
|
|
163
|
+
console.log(`Status: valid`);
|
|
164
|
+
console.log(` Tier: ${result.tier}`);
|
|
165
|
+
console.log(` Email: ${result.email}`);
|
|
166
|
+
if (result.expiresAt > 0) {
|
|
167
|
+
const expiry = new Date(result.expiresAt * 1000).toISOString().split('T')[0];
|
|
168
|
+
console.log(` Expires: ${expiry}`);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
console.log(` Expires: never (internal)`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
console.log(`Status: invalid`);
|
|
176
|
+
if (result.error)
|
|
177
|
+
console.log(` Error: ${result.error}`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
console.log('Could not load native module for local validation.');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async function cmdDeactivate() {
|
|
185
|
+
const config = await readConfig();
|
|
186
|
+
if (!config.cor && !config.cortex) {
|
|
187
|
+
console.log('Nothing to deactivate — no cor license in .soulcraft.json');
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
// Strip both the new `cor` key and the legacy `cortex` key.
|
|
191
|
+
const { cor: _c1, cortex: _c2, ...remaining } = config;
|
|
192
|
+
const remainingKeys = Object.keys(remaining);
|
|
193
|
+
if (remainingKeys.length === 0) {
|
|
194
|
+
// Remove the file entirely
|
|
195
|
+
const { unlink } = await import('node:fs/promises');
|
|
196
|
+
try {
|
|
197
|
+
await unlink(join(process.cwd(), CONFIG_FILE));
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
// Already gone
|
|
201
|
+
}
|
|
202
|
+
console.log(`Removed Soulcraft Cor license. ${CONFIG_FILE} deleted (was empty).`);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
// Write remaining keys directly — writeConfig merges, so we write the file ourselves
|
|
206
|
+
const { writeFile: _writeFile, rename: _rename } = await import('node:fs/promises');
|
|
207
|
+
const configPath = join(process.cwd(), CONFIG_FILE);
|
|
208
|
+
const tmpPath = `${configPath}.tmp`;
|
|
209
|
+
await _writeFile(tmpPath, JSON.stringify(remaining, null, 2) + '\n', 'utf-8');
|
|
210
|
+
await _rename(tmpPath, configPath);
|
|
211
|
+
console.log(`Removed Soulcraft Cor license from ${CONFIG_FILE}.`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const [, , command, ...args] = process.argv;
|
|
215
|
+
switch (command) {
|
|
216
|
+
case 'activate':
|
|
217
|
+
await cmdActivate(args[0]);
|
|
218
|
+
break;
|
|
219
|
+
case 'status':
|
|
220
|
+
await cmdStatus();
|
|
221
|
+
break;
|
|
222
|
+
case 'deactivate':
|
|
223
|
+
await cmdDeactivate();
|
|
224
|
+
break;
|
|
225
|
+
case 'help':
|
|
226
|
+
case '--help':
|
|
227
|
+
case '-h':
|
|
228
|
+
case undefined:
|
|
229
|
+
printHelp();
|
|
230
|
+
break;
|
|
231
|
+
default:
|
|
232
|
+
console.error(`Unknown command: ${command}`);
|
|
233
|
+
console.error('Run "npx @soulcraft/cor help" for usage.');
|
|
234
|
+
process.exit(1);
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module graph/GraphAccelerationAdapter
|
|
3
|
+
* @description The `'graphAcceleration'` provider — cor's native graph
|
|
4
|
+
* engine behind brainy 8.0's optional {@link GraphAccelerationProvider}
|
|
5
|
+
* contract (ADR-006). When brainy feature-detects this provider, the
|
|
6
|
+
* public `brain.graph.*` surface (`subgraph` / `export`) and the
|
|
7
|
+
* `related()` / `find({ connected })` paths route here instead of brainy's
|
|
8
|
+
* pure-TS adjacency fallback.
|
|
9
|
+
*
|
|
10
|
+
* **It wraps the SAME native handle the `graphIndex` provider already
|
|
11
|
+
* holds** — never a second `NativeGraphAdjacencyIndex` (which would split
|
|
12
|
+
* state + double RAM). brainy's `activate(context)` hook has no storage and
|
|
13
|
+
* its provider factories are called with storage only (not the graphIndex
|
|
14
|
+
* instance), and the `graphAcceleration` value is feature-detected raw
|
|
15
|
+
* (the factory is never invoked with storage), so this adapter is
|
|
16
|
+
* registered at `activate()` time bound to a *resolver* that the
|
|
17
|
+
* `graphIndex` factory fills once it constructs the native engine. Until
|
|
18
|
+
* the engine is built + loaded, {@link isInitialized} reports `false` and
|
|
19
|
+
* brainy keeps serving graph ops from TS — the contract's safety valve, so
|
|
20
|
+
* a read is never routed here before the data is loaded.
|
|
21
|
+
*
|
|
22
|
+
* **Scope (cor 3.0 / brainy 8.0):** the full `GraphAccelerationProvider`
|
|
23
|
+
* surface — `traverse`, `edgesForNode`, the streaming cursor
|
|
24
|
+
* (`graphCursorOpen` / `graphCursorNext` / `graphCursorClose`), AND the Phase C
|
|
25
|
+
* analytics (`pageRank`, `connectedComponents`, `shortestPath`,
|
|
26
|
+
* `neighborhoodSample`, `topByDegree`). All five analytics ship together (the
|
|
27
|
+
* feature-detect anchors on `traverse` + `graphCursorOpen`, but brainy does not
|
|
28
|
+
* per-method-guard the analytics — a partial set would throw). **`shortestPath`
|
|
29
|
+
* is hops-only** — cor stores no edge weights, so the adapter refuses
|
|
30
|
+
* `weight: 'edge'` and brainy must serve weighted paths from TS.
|
|
31
|
+
*
|
|
32
|
+
* **Zero-copy decode:** native reads return columnar little-endian
|
|
33
|
+
* {@link Buffer}s; this adapter views each as the matching typed array over
|
|
34
|
+
* the same memory (no element-wise copy) on the little-endian hosts cor
|
|
35
|
+
* targets, falling back to a copy only on the (never-expected) misaligned
|
|
36
|
+
* Buffer. brainy resolves the u64 node/verb ints to UUIDs lazily.
|
|
37
|
+
*
|
|
38
|
+
* **Not applied here:** `excludeVisibility` (the graph index carries no
|
|
39
|
+
* node-visibility data — that lives in the metadata/vector layer; brainy
|
|
40
|
+
* applies visibility on reassembly) and `subtypes` (cor's traverse filters
|
|
41
|
+
* by verb-type index only). Both are dropped at this seam, matching Phase A
|
|
42
|
+
* `traverse`.
|
|
43
|
+
*/
|
|
44
|
+
import type { Subgraph, OpaqueIdSet, TraverseOptions, EdgesForNodeOptions, GraphCursorOptions, GraphCursorChunk, GraphCursorHandle, GraphScores, GraphCommunities, GraphPath, RankOptions, CommunitiesOptions, PathOptions, SampleOptions, MostConnectedOptions } from '@soulcraft/brainy/plugin';
|
|
45
|
+
import type { GraphAdjacencyIndex } from './NativeGraphAdjacencyIndex.js';
|
|
46
|
+
/**
|
|
47
|
+
* @description cor's `'graphAcceleration'` provider. Registered structurally
|
|
48
|
+
* (NOT via `implements GraphAccelerationProvider`, which would force the 5
|
|
49
|
+
* Phase-C analytics methods to exist) — brainy validates it at runtime via
|
|
50
|
+
* the two-anchor feature-detect (`traverse` + `graphCursorOpen`).
|
|
51
|
+
*/
|
|
52
|
+
export declare class GraphAccelerationAdapter {
|
|
53
|
+
private readonly resolveEngine;
|
|
54
|
+
/**
|
|
55
|
+
* @param resolveEngine - Resolver for the shared `graphIndex` provider
|
|
56
|
+
* instance. Returns `undefined` until the `graphIndex` factory has
|
|
57
|
+
* constructed the native engine; the adapter reports
|
|
58
|
+
* {@link isInitialized} `false` until then so brainy doesn't route here.
|
|
59
|
+
*/
|
|
60
|
+
constructor(resolveEngine: () => GraphAdjacencyIndex | undefined);
|
|
61
|
+
/** The shared native graph engine, or `undefined` before construction. */
|
|
62
|
+
private get engine();
|
|
63
|
+
/**
|
|
64
|
+
* `false` until the shared native graph engine is constructed AND has
|
|
65
|
+
* loaded its persisted state. brainy probes this before routing, so a
|
|
66
|
+
* read is never served from native before the data is present.
|
|
67
|
+
*/
|
|
68
|
+
get isInitialized(): boolean;
|
|
69
|
+
/** Resolve the native instance or throw a clear error (defensive — brainy
|
|
70
|
+
* gates on {@link isInitialized}, so this should never fire in practice). */
|
|
71
|
+
private native;
|
|
72
|
+
/** Translate brainy's {@link TraverseOptions} to the native shape (drops
|
|
73
|
+
* `subtypes` / `excludeVisibility`, which this seam does not apply). */
|
|
74
|
+
private toNativeTraverse;
|
|
75
|
+
/**
|
|
76
|
+
* @description Bounded multi-hop expansion from `seeds` (entity ints or a
|
|
77
|
+
* `find()` {@link OpaqueIdSet}), returning the reachable subgraph in one
|
|
78
|
+
* native call.
|
|
79
|
+
* @param seeds - Start nodes as `bigint[]`, or an OpaqueIdSet envelope
|
|
80
|
+
* (forwarded with no id materialization — the query→expand fusion).
|
|
81
|
+
* @param options - Depth, direction, verb-type filter, caps.
|
|
82
|
+
* @param generation - Optional as-of generation (omitted = now).
|
|
83
|
+
*/
|
|
84
|
+
traverse(seeds: bigint[] | OpaqueIdSet, options: TraverseOptions, generation?: bigint): Promise<Subgraph>;
|
|
85
|
+
/**
|
|
86
|
+
* @description All edges incident to one node, both directions — a
|
|
87
|
+
* depth-1 {@link traverse} from the single node.
|
|
88
|
+
* @param nodeInt - The node's interned entity int.
|
|
89
|
+
* @param options - Direction, verb-type filter, limit.
|
|
90
|
+
* @param generation - Optional as-of generation.
|
|
91
|
+
*/
|
|
92
|
+
edgesForNode(nodeInt: bigint, options: EdgesForNodeOptions, generation?: bigint): Promise<Subgraph>;
|
|
93
|
+
/**
|
|
94
|
+
* @description Open a snapshot-consistent streaming walk of the whole
|
|
95
|
+
* graph (or a seeded region), pinned to a generation. Returns a
|
|
96
|
+
* TTL-bounded handle for {@link graphCursorNext} / {@link graphCursorClose}.
|
|
97
|
+
* @param options - Direction, projection, optional seeds / resume cursor.
|
|
98
|
+
* @param generation - Optional explicit as-of generation to pin.
|
|
99
|
+
*/
|
|
100
|
+
graphCursorOpen(options: GraphCursorOptions, generation?: bigint): Promise<GraphCursorHandle>;
|
|
101
|
+
/**
|
|
102
|
+
* @description Pull the next chunk from an open cursor.
|
|
103
|
+
* @param handle - From {@link graphCursorOpen}.
|
|
104
|
+
* @param chunkSize - Target number of edges in this chunk.
|
|
105
|
+
* @throws An error whose message starts `SnapshotExpired:` if the handle
|
|
106
|
+
* sat idle past its TTL — reopen with the last chunk's `cursor` to resume.
|
|
107
|
+
*/
|
|
108
|
+
graphCursorNext(handle: GraphCursorHandle, chunkSize: number): Promise<GraphCursorChunk>;
|
|
109
|
+
/**
|
|
110
|
+
* @description Release an open cursor's pinned generation + server-side
|
|
111
|
+
* state. Idempotent.
|
|
112
|
+
* @param handle - From {@link graphCursorOpen}.
|
|
113
|
+
*/
|
|
114
|
+
graphCursorClose(handle: GraphCursorHandle): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* @description `rank` — importance/influence ranking over the visible graph.
|
|
117
|
+
* Intent-level: cor implements it natively via PageRank (algorithm is the
|
|
118
|
+
* provider's choice). `excludeVisibility` is dropped at this seam — brainy
|
|
119
|
+
* post-filters (and renormalizes/re-top-Ks) on hydrate; the native rank is
|
|
120
|
+
* over all nodes. (Renamed from `pageRank` for brainy rc.3 intent contract, #71.)
|
|
121
|
+
*/
|
|
122
|
+
rank(options: RankOptions, generation?: bigint): Promise<GraphScores>;
|
|
123
|
+
/**
|
|
124
|
+
* @description `communities` — group related nodes. Intent-level: cor
|
|
125
|
+
* implements it natively via connected components (`directed` → strong/SCC,
|
|
126
|
+
* else weak). The labels are arbitrary-but-stable — only the partition is
|
|
127
|
+
* meaningful; do not cache them as keys. (Renamed from `connectedComponents`, #71.)
|
|
128
|
+
*/
|
|
129
|
+
communities(options: CommunitiesOptions, generation?: bigint): Promise<GraphCommunities>;
|
|
130
|
+
/**
|
|
131
|
+
* @description `path` — best route between two nodes. Intent-level: cor
|
|
132
|
+
* implements hops natively. cor stores no edge weights, so `by: 'weight'` is
|
|
133
|
+
* unsupported here — brainy serves least-weight paths from its TS fallback.
|
|
134
|
+
* Returns `null` when unreachable. (Renamed from `shortestPath`; `weight` →
|
|
135
|
+
* `by` for brainy rc.3, #71.)
|
|
136
|
+
* @throws If `options.by === 'weight'`.
|
|
137
|
+
*/
|
|
138
|
+
path(fromInt: bigint, toInt: bigint, options: PathOptions, generation?: bigint): Promise<GraphPath | null>;
|
|
139
|
+
/**
|
|
140
|
+
* @description `sample` — deterministic, seeded bounded neighborhood sample for
|
|
141
|
+
* dense-graph viz. Intent-level; cor implements it natively. (Renamed from
|
|
142
|
+
* `neighborhoodSample`, #71.)
|
|
143
|
+
* @param seeds - `bigint[]` or a `find()` OpaqueIdSet.
|
|
144
|
+
*/
|
|
145
|
+
sample(seeds: bigint[] | OpaqueIdSet, options: SampleOptions, generation?: bigint): Promise<Subgraph>;
|
|
146
|
+
/**
|
|
147
|
+
* @description `mostConnected` — the top-K most-connected nodes. Intent-level:
|
|
148
|
+
* cor implements it natively via degree. `excludeVisibility` dropped at this
|
|
149
|
+
* seam (brainy post-filters). (Renamed from `topByDegree`, #71.)
|
|
150
|
+
*/
|
|
151
|
+
mostConnected(options: MostConnectedOptions, generation?: bigint): Promise<GraphScores>;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=GraphAccelerationAdapter.d.ts.map
|