@graphty/graphty-element 2.6.2 → 3.0.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/dist/ai.js +3 -3
- package/dist/catalog.js +53 -54
- package/dist/chunks/{AiManager-4iQpsJW1.js → AiManager-Bhh0rR_p.js} +706 -655
- package/dist/chunks/GraphSession-DPoTaT3b.js +21175 -0
- package/dist/chunks/{GraphtyLogger-B_O67a6c.js → GraphtyLogger-BtcBJQPL.js} +1 -1
- package/dist/chunks/{VoiceInputAdapter-Cc6mHXTI.js → VoiceInputAdapter-CdLsJ_nG.js} +1 -1
- package/dist/chunks/{XRPivotCameraController-BLa89LXn.js → XRPivotCameraController-CiLJ9Gz6.js} +2 -2
- package/dist/chunks/algorithms-qij74zEN.js +6811 -0
- package/dist/chunks/{capability-check-Am2zliFj.js → capability-check-BbgTejS3.js} +1 -1
- package/dist/chunks/definePalette-BYt2Llxs.js +1333 -0
- package/dist/chunks/fields-5uVC1Pll.js +4999 -0
- package/dist/chunks/{format-detection-BHwrAVzW.js → format-detection-FKaDMshR.js} +1 -1
- package/dist/chunks/{index-BkBLbvui.js → index-Cc_6D9hV.js} +6034 -7127
- package/dist/chunks/interpolation-Dk206AhZ.js +105 -0
- package/dist/chunks/paletteRegistry-De3CGdst.js +357 -0
- package/dist/chunks/parse-SVp77JbE.js +669 -0
- package/dist/chunks/{pluginRegistry-Bs8bEkz9.js → pluginRegistry-Ddfl6Mv2.js} +27 -24
- package/dist/chunks/{registry-BdGvyZou.js → registry-CgMqldp4.js} +1 -1
- package/dist/chunks/{DataSource-BL2UzPff.js → sources-BbAJCDIH.js} +279 -108
- package/dist/commands.d.ts +128 -19
- package/dist/commands.js +49 -1
- package/dist/custom-elements.json +1 -1
- package/dist/extend.d.ts +10 -2
- package/dist/extend.js +64 -57
- package/dist/graphty-catalog.json +6 -3
- package/dist/graphty.bundle.js +267177 -240648
- package/dist/graphty.js +84 -78
- package/dist/index.d.ts +4 -0
- package/dist/logging.js +2 -2
- package/dist/schema.js +70 -71
- package/dist/session.d.ts +5 -6
- package/dist/session.js +40 -86
- package/dist/src/Edge.d.ts +31 -67
- package/dist/src/Graph.d.ts +335 -77
- package/dist/src/Node.d.ts +36 -3
- package/dist/src/NodeBehavior.d.ts +28 -0
- package/dist/src/Styles.d.ts +15 -4
- package/dist/src/acceleration/AccelerationController.d.ts +8 -0
- package/dist/src/acceleration/narrow.d.ts +9 -1
- package/dist/src/acceleration/types.d.ts +10 -0
- package/dist/src/ai/AiController.d.ts +12 -0
- package/dist/src/ai/AiManager.d.ts +7 -0
- package/dist/src/ai/commands/AlgorithmCommands.d.ts +1 -1
- package/dist/src/ai/commands/LayoutCommands.d.ts +1 -1
- package/dist/src/ai/commands/StyleCommands.d.ts +1 -1
- package/dist/src/ai/commands/types.d.ts +20 -1
- package/dist/src/algorithms/Algorithm.d.ts +21 -4
- package/dist/src/algorithms/BFSAlgorithm.d.ts +0 -9
- package/dist/src/algorithms/BellmanFordAlgorithm.d.ts +0 -14
- package/dist/src/algorithms/DFSAlgorithm.d.ts +1 -1
- package/dist/src/algorithms/FloydWarshallAlgorithm.d.ts +5 -0
- package/dist/src/algorithms/GirvanNewmanAlgorithm.d.ts +5 -0
- package/dist/src/algorithms/LeidenAlgorithm.d.ts +5 -0
- package/dist/src/algorithms/PageRankAlgorithm.d.ts +1 -1
- package/dist/src/algorithms/StronglyConnectedComponentsAlgorithm.d.ts +1 -1
- package/dist/src/algorithms/metrics/fields.d.ts +23 -1
- package/dist/src/algorithms/utils/graphUtils.d.ts +13 -1
- package/dist/src/catalog/paletteRegistry.d.ts +4 -4
- package/dist/src/catalog/registry.d.ts +3 -2
- package/dist/src/catalog/types.d.ts +18 -1
- package/dist/src/config/GraphStyle.d.ts +1 -1
- package/dist/src/config/StyleTemplate.d.ts +2 -2
- package/dist/src/config/xr-config-schema.d.ts +4 -4
- package/dist/src/data/CSVDataSource.d.ts +77 -22
- package/dist/src/data/ErrorAggregator.d.ts +5 -0
- package/dist/src/data/GEXFDataSource.d.ts +12 -61
- package/dist/src/data/GraphMLDataSource.d.ts +3 -44
- package/dist/src/data/GraphStore.d.ts +322 -15
- package/dist/src/data/JsonDataSource.d.ts +43 -1
- package/dist/src/data/graph-io-import.d.ts +89 -0
- package/dist/src/data/graph-io-records.d.ts +64 -0
- package/dist/src/data/lane.d.ts +23 -0
- package/dist/src/data/positions.d.ts +13 -0
- package/dist/src/data/seedPosition.d.ts +16 -0
- package/dist/src/errors/GraphtyError.d.ts +3 -1
- package/dist/src/errors/codes.d.ts +23 -0
- package/dist/src/events.d.ts +12 -0
- package/dist/src/graphty-element.d.ts +149 -54
- package/dist/src/input/types.d.ts +2 -0
- package/dist/src/layout/D3GraphLayoutEngine.d.ts +17 -3
- package/dist/src/layout/FixedLayoutEngine.d.ts +20 -4
- package/dist/src/layout/KamadaKawaiLayoutEngine.d.ts +6 -0
- package/dist/src/layout/LayoutEngine.d.ts +214 -116
- package/dist/src/layout/NGraphLayoutEngine.d.ts +10 -3
- package/dist/src/layout/SimulationLayoutEngine.d.ts +8 -3
- package/dist/src/managers/AlgorithmManager.d.ts +24 -5
- package/dist/src/managers/DataManager.d.ts +258 -181
- package/dist/src/managers/EventManager.d.ts +5 -2
- package/dist/src/managers/GraphContext.d.ts +7 -0
- package/dist/src/managers/InputManager.d.ts +11 -0
- package/dist/src/managers/LayoutManager.d.ts +129 -50
- package/dist/src/managers/RenderManager.d.ts +14 -1
- package/dist/src/managers/UpdateManager.d.ts +20 -0
- package/dist/src/screenshot/ScreenshotCapture.d.ts +1 -1
- package/dist/src/session/GraphSession.d.ts +83 -6
- package/dist/src/session/commands/algo.d.ts +169 -0
- package/dist/src/session/commands/config.d.ts +45 -0
- package/dist/src/session/commands/data.d.ts +178 -0
- package/dist/src/session/commands/doors.d.ts +93 -0
- package/dist/src/session/commands/index.d.ts +20 -0
- package/dist/src/session/commands/layout.d.ts +104 -0
- package/dist/src/session/commands/positions.d.ts +30 -0
- package/dist/src/session/commands/sets.d.ts +113 -0
- package/dist/src/session/commands/style.d.ts +92 -0
- package/dist/src/session/commands/view.d.ts +57 -0
- package/dist/src/session/commands/visibility.d.ts +41 -0
- package/dist/src/session/data.d.ts +131 -4
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/planning.d.ts +25 -8
- package/dist/src/session/project/Dispatcher.d.ts +905 -0
- package/dist/src/session/project/History.d.ts +382 -0
- package/dist/src/session/project/arrangement.d.ts +247 -0
- package/dist/src/session/project/derive.d.ts +132 -0
- package/dist/src/session/project/digest.d.ts +33 -0
- package/dist/src/session/project/draft.d.ts +194 -0
- package/dist/src/session/project/graphOps.d.ts +304 -0
- package/dist/src/session/project/ingest.d.ts +364 -0
- package/dist/src/session/project/state.d.ts +145 -0
- package/dist/src/session/project/strict.d.ts +68 -0
- package/dist/src/session/results/RunResult.d.ts +48 -0
- package/dist/src/session/results/statistics.d.ts +20 -0
- package/dist/src/session/runs/Run.d.ts +80 -4
- package/dist/src/session/runs/RunsApi.d.ts +23 -6
- package/dist/src/session/runs/types.d.ts +25 -6
- package/dist/src/session/scope/ElementMask.d.ts +14 -0
- package/dist/src/session/scope/ScopeApi.d.ts +3 -22
- package/dist/src/session/scope/spaces.d.ts +29 -0
- package/dist/src/session/sealed.d.ts +22 -0
- package/dist/src/session/selection/SelectionApi.d.ts +14 -4
- package/dist/src/session/sets/SetsApi.d.ts +13 -5
- package/dist/src/session/sets/store.d.ts +54 -53
- package/dist/src/session/sets/types.d.ts +5 -2
- package/dist/src/session/styles/Layer.d.ts +5 -0
- package/dist/src/session/styles/StylesApi.d.ts +68 -17
- package/dist/src/session/styles/autoApply.d.ts +64 -53
- package/dist/src/session/styles/index.d.ts +3 -3
- package/dist/src/session/styles/predicate.d.ts +7 -0
- package/dist/src/session/styles/repaint.d.ts +16 -1
- package/dist/src/session/styles/sources.d.ts +1 -1
- package/dist/src/session/types.d.ts +625 -54
- package/dist/src/session/visibility/VisibilityApi.d.ts +38 -18
- package/dist/src/session/visibility/filter.d.ts +10 -0
- package/dist/src/simple/defineAlgorithm.d.ts +28 -0
- package/dist/src/simple/defineLayout.d.ts +35 -0
- package/dist/src/simple/defineLogDestination.d.ts +31 -0
- package/dist/src/simple/definePalette.d.ts +26 -0
- package/dist/src/simple/definition.d.ts +106 -0
- package/dist/src/simple/options.d.ts +33 -0
- package/dist/src/simple/source.d.ts +49 -0
- package/dist/src/simple/types.d.ts +366 -0
- package/dist/src/simple/view.d.ts +107 -0
- package/dist/webgpu.js +2 -2
- package/package.json +10 -12
- package/dist/chunks/GraphSession-BhuHSXIo.js +0 -12819
- package/dist/chunks/GraphStyle-Cwr55SAE.js +0 -65
- package/dist/chunks/algorithms-BJ6DQMOe.js +0 -3777
- package/dist/chunks/detect-fyuVnlCT.js +0 -88
- package/dist/chunks/interpolation-DY-PNpqX.js +0 -43
- package/dist/chunks/optionsFromZod-CKMYSwTz.js +0 -3636
- package/dist/chunks/paletteRegistry-BCFSwJGK.js +0 -1196
- package/dist/chunks/parse-BMTqt4SS.js +0 -3658
- package/dist/src/data/csv-variant-detection.d.ts +0 -29
- package/dist/src/data/ingest.d.ts +0 -104
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { l as
|
|
2
|
-
import { G as
|
|
3
|
-
import { z as
|
|
4
|
-
import {
|
|
5
|
-
import { N as
|
|
6
|
-
import
|
|
1
|
+
import { l as ee } from "./VoiceInputAdapter-CdLsJ_nG.js";
|
|
2
|
+
import { G as te } from "./GraphtyLogger-BtcBJQPL.js";
|
|
3
|
+
import { z as d } from "zod";
|
|
4
|
+
import { t as se, A as M, U as E } from "./fields-5uVC1Pll.js";
|
|
5
|
+
import { k as re, N as ae, f as oe, C as ne, e as ie } from "./algorithms-qij74zEN.js";
|
|
6
|
+
import le from "jmespath";
|
|
7
|
+
import { i as _ } from "./pluginRegistry-Ddfl6Mv2.js";
|
|
7
8
|
import { inferSchema as A } from "@jsonhero/schema-infer";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
class F {
|
|
9
|
+
import { createAnthropic as ce } from "@ai-sdk/anthropic";
|
|
10
|
+
import { createGoogleGenerativeAI as ue } from "@ai-sdk/google";
|
|
11
|
+
import { createOpenAI as de } from "@ai-sdk/openai";
|
|
12
|
+
import { generateText as me, streamText as pe } from "ai";
|
|
13
|
+
import { A as he } from "./ApiKeyManager-C0ac91dE.js";
|
|
14
|
+
class K {
|
|
15
15
|
/**
|
|
16
16
|
* Creates a new AiStatusManager instance.
|
|
17
17
|
*/
|
|
@@ -112,13 +112,13 @@ class F {
|
|
|
112
112
|
* @param result - Optional result data
|
|
113
113
|
*/
|
|
114
114
|
updateToolCallStatus(e, t, s) {
|
|
115
|
-
const { toolCalls:
|
|
116
|
-
if (!
|
|
115
|
+
const { toolCalls: a } = this.status;
|
|
116
|
+
if (!a)
|
|
117
117
|
return;
|
|
118
|
-
const o =
|
|
118
|
+
const o = a.findIndex((l) => l.name === e);
|
|
119
119
|
if (o === -1)
|
|
120
120
|
return;
|
|
121
|
-
const n = [...
|
|
121
|
+
const n = [...a];
|
|
122
122
|
n[o] = {
|
|
123
123
|
...n[o],
|
|
124
124
|
status: t,
|
|
@@ -186,14 +186,19 @@ class F {
|
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
const f =
|
|
190
|
-
class
|
|
189
|
+
const f = te.getLogger(["graphty", "ai"]);
|
|
190
|
+
class T extends Error {
|
|
191
|
+
constructor(e) {
|
|
192
|
+
super(e.message), this.result = e;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
class ge {
|
|
191
196
|
/**
|
|
192
197
|
* Creates a new AiController instance.
|
|
193
198
|
* @param options - Configuration options for the controller
|
|
194
199
|
*/
|
|
195
200
|
constructor(e) {
|
|
196
|
-
this.abortController = null, this.disposed = !1, this.currentInput = null, this.startTime = null, this.lastInput = null, this.lastError = null, this.provider = e.provider, this.commandRegistry = e.commandRegistry, this.graph = e.graph, this.statusManager = new
|
|
201
|
+
this.abortController = null, this.disposed = !1, this.currentInput = null, this.startTime = null, this.lastInput = null, this.lastError = null, this.provider = e.provider, this.commandRegistry = e.commandRegistry, this.graph = e.graph, this.statusManager = new K(), this.schemaManager = e.schemaManager ?? null, this.emitEvent = e.emitEvent, this.statusManager.subscribe((t) => {
|
|
197
202
|
this.emitAiEvent({
|
|
198
203
|
type: "ai-status-change",
|
|
199
204
|
status: t
|
|
@@ -224,41 +229,26 @@ class me {
|
|
|
224
229
|
timestamp: this.startTime
|
|
225
230
|
}), this.statusManager.submit();
|
|
226
231
|
try {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
accumulated: r.text
|
|
237
|
-
})), r.toolCalls.length === 0) {
|
|
238
|
-
this.statusManager.complete();
|
|
239
|
-
const n = {
|
|
240
|
-
success: !0,
|
|
241
|
-
message: r.text || "No response from AI",
|
|
242
|
-
llmText: r.text
|
|
243
|
-
};
|
|
244
|
-
return this.emitAiEvent({
|
|
245
|
-
type: "ai-command-complete",
|
|
246
|
-
result: n,
|
|
247
|
-
duration: Date.now() - this.startTime
|
|
248
|
-
}), n;
|
|
232
|
+
let t;
|
|
233
|
+
try {
|
|
234
|
+
t = await this.graph.getSession().transaction(e, (s, a) => this.converse(e, s, a), {
|
|
235
|
+
provenance: { via: "assistant" }
|
|
236
|
+
});
|
|
237
|
+
} catch (s) {
|
|
238
|
+
if (!(s instanceof T))
|
|
239
|
+
throw s;
|
|
240
|
+
({ result: t } = s);
|
|
249
241
|
}
|
|
250
|
-
this.statusManager.startExecuting();
|
|
251
|
-
const o = await this.executeToolCalls(r.toolCalls, r.text);
|
|
252
242
|
return this.statusManager.complete(), this.emitAiEvent({
|
|
253
243
|
type: "ai-command-complete",
|
|
254
|
-
result:
|
|
244
|
+
result: t,
|
|
255
245
|
duration: Date.now() - this.startTime
|
|
256
|
-
}),
|
|
246
|
+
}), t;
|
|
257
247
|
} catch (t) {
|
|
258
|
-
const s = t instanceof Error ? t.message : String(t),
|
|
259
|
-
return this.lastError =
|
|
248
|
+
const s = t instanceof Error ? t.message : String(t), a = t instanceof Error ? t : new Error(s);
|
|
249
|
+
return this.lastError = a, this.statusManager.setError(a, !0), this.emitAiEvent({
|
|
260
250
|
type: "ai-command-error",
|
|
261
|
-
error:
|
|
251
|
+
error: a,
|
|
262
252
|
input: e,
|
|
263
253
|
canRetry: !0
|
|
264
254
|
}), {
|
|
@@ -320,87 +310,128 @@ When the user asks you to perform an action, use the appropriate tool. If no too
|
|
|
320
310
|
${this.schemaManager.getFormattedSchema()}
|
|
321
311
|
`;
|
|
322
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* One message, inside its transaction: ask the model, then run the tools it calls.
|
|
315
|
+
* @param input - The user's natural language input
|
|
316
|
+
* @param tx - The message's transaction, which the tools write through
|
|
317
|
+
* @param signal - Fires when the message is cancelled or its transaction aborted
|
|
318
|
+
* @returns The execution result
|
|
319
|
+
*/
|
|
320
|
+
async converse(e, t, s) {
|
|
321
|
+
const { abortController: a } = this;
|
|
322
|
+
s.addEventListener(
|
|
323
|
+
"abort",
|
|
324
|
+
() => {
|
|
325
|
+
a?.abort(s.reason);
|
|
326
|
+
},
|
|
327
|
+
{ once: !0 }
|
|
328
|
+
);
|
|
329
|
+
const o = a?.signal ?? s, n = this.buildMessages(e), l = this.commandRegistry.toToolDefinitions();
|
|
330
|
+
f.debug("Request", { messages: n, tools: l.map((c) => c.name) }), this.statusManager.startStreaming();
|
|
331
|
+
const i = await this.provider.generate(n, l, { signal: o });
|
|
332
|
+
return f.debug("Response", {
|
|
333
|
+
text: i.text || "(no text)",
|
|
334
|
+
toolCalls: i.toolCalls.map((c) => ({ name: c.name, arguments: c.arguments }))
|
|
335
|
+
}), i.text && (this.statusManager.appendStreamedText(i.text), this.emitAiEvent({
|
|
336
|
+
type: "ai-stream-chunk",
|
|
337
|
+
text: i.text,
|
|
338
|
+
accumulated: i.text
|
|
339
|
+
})), i.toolCalls.length === 0 ? {
|
|
340
|
+
success: !0,
|
|
341
|
+
message: i.text || "No response from AI",
|
|
342
|
+
llmText: i.text
|
|
343
|
+
} : (this.statusManager.startExecuting(), this.executeToolCalls(i.toolCalls, t, o, i.text));
|
|
344
|
+
}
|
|
323
345
|
/**
|
|
324
346
|
* Execute a list of tool calls.
|
|
325
347
|
* @param toolCalls - Tool calls to execute
|
|
348
|
+
* @param tx - The message's transaction
|
|
349
|
+
* @param signal - Fires when the message is cancelled
|
|
326
350
|
* @param llmText - Text response from LLM (if any)
|
|
327
351
|
* @returns Combined execution result
|
|
352
|
+
* @throws MessageRolledBack when a tool threw, so the message's transaction rolls back.
|
|
328
353
|
*/
|
|
329
|
-
async executeToolCalls(e, t) {
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
|
|
354
|
+
async executeToolCalls(e, t, s, a) {
|
|
355
|
+
const o = [];
|
|
356
|
+
let n = !1;
|
|
357
|
+
for (const i of e) {
|
|
358
|
+
s.throwIfAborted(), this.statusManager.addToolCall(i.name), this.statusManager.updateToolCallStatus(i.name, "executing"), this.emitAiEvent({
|
|
333
359
|
type: "ai-stream-tool-call",
|
|
334
|
-
name:
|
|
335
|
-
params:
|
|
360
|
+
name: i.name,
|
|
361
|
+
params: i.arguments
|
|
336
362
|
});
|
|
337
363
|
try {
|
|
338
|
-
const
|
|
339
|
-
if (
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
364
|
+
const c = await this.executeToolCall(i, t);
|
|
365
|
+
if (o.push(c), this.statusManager.updateToolCallStatus(
|
|
366
|
+
i.name,
|
|
367
|
+
c.success ? "complete" : "error",
|
|
368
|
+
c.data ?? { message: c.message }
|
|
343
369
|
), this.emitAiEvent({
|
|
344
370
|
type: "ai-stream-tool-result",
|
|
345
|
-
name:
|
|
346
|
-
result:
|
|
347
|
-
success:
|
|
348
|
-
}), !
|
|
371
|
+
name: i.name,
|
|
372
|
+
result: c.data ?? { message: c.message },
|
|
373
|
+
success: c.success
|
|
374
|
+
}), !c.success)
|
|
349
375
|
break;
|
|
350
|
-
} catch (
|
|
351
|
-
const
|
|
376
|
+
} catch (c) {
|
|
377
|
+
const u = c instanceof Error ? c.message : String(c), p = {
|
|
352
378
|
success: !1,
|
|
353
|
-
message: `Error executing ${
|
|
379
|
+
message: `Error executing ${i.name}: ${u}`
|
|
354
380
|
};
|
|
355
|
-
|
|
381
|
+
o.push(p), this.statusManager.updateToolCallStatus(i.name, "error", { error: u }), this.emitAiEvent({
|
|
356
382
|
type: "ai-stream-tool-result",
|
|
357
|
-
name:
|
|
358
|
-
result: { error:
|
|
383
|
+
name: i.name,
|
|
384
|
+
result: { error: u },
|
|
359
385
|
success: !1
|
|
360
|
-
});
|
|
386
|
+
}), n = !0;
|
|
361
387
|
break;
|
|
362
388
|
}
|
|
363
389
|
}
|
|
364
|
-
|
|
390
|
+
const l = this.combineResults(o, a);
|
|
391
|
+
if (n)
|
|
392
|
+
throw new T(l);
|
|
393
|
+
return l;
|
|
365
394
|
}
|
|
366
395
|
/**
|
|
367
396
|
* Execute a single tool call.
|
|
368
397
|
* @param toolCall - The tool call to execute
|
|
398
|
+
* @param tx - The message's transaction, handed to the command as `ctx.tx`
|
|
369
399
|
* @returns Command result
|
|
370
400
|
*/
|
|
371
|
-
async executeToolCall(e) {
|
|
401
|
+
async executeToolCall(e, t) {
|
|
372
402
|
f.debug("Executing command", { name: e.name, arguments: e.arguments });
|
|
373
|
-
const
|
|
374
|
-
if (!
|
|
403
|
+
const s = this.commandRegistry.get(e.name);
|
|
404
|
+
if (!s)
|
|
375
405
|
return f.debug("Command result: FAILED - Unknown command", { name: e.name }), {
|
|
376
406
|
success: !1,
|
|
377
407
|
message: `Unknown command: ${e.name}. Command not found in registry.`
|
|
378
408
|
};
|
|
379
|
-
let
|
|
409
|
+
let a;
|
|
380
410
|
try {
|
|
381
|
-
|
|
382
|
-
} catch (
|
|
383
|
-
const
|
|
384
|
-
return f.debug("Command result: FAILED - Invalid arguments", { error:
|
|
411
|
+
a = s.parameters.parse(e.arguments), f.debug("Validated arguments", { arguments: a });
|
|
412
|
+
} catch (l) {
|
|
413
|
+
const i = l instanceof Error ? l.message : String(l);
|
|
414
|
+
return f.debug("Command result: FAILED - Invalid arguments", { error: i }), {
|
|
385
415
|
success: !1,
|
|
386
|
-
message: `Invalid arguments for ${e.name}: ${
|
|
416
|
+
message: `Invalid arguments for ${e.name}: ${i}`
|
|
387
417
|
};
|
|
388
418
|
}
|
|
389
|
-
const
|
|
419
|
+
const o = {
|
|
390
420
|
graph: this.graph,
|
|
421
|
+
tx: t,
|
|
391
422
|
abortSignal: this.abortController?.signal ?? new AbortController().signal,
|
|
392
|
-
emitEvent: (
|
|
393
|
-
f.debug("Command emitted event", { type:
|
|
423
|
+
emitEvent: (l, i) => {
|
|
424
|
+
f.debug("Command emitted event", { type: l, data: i });
|
|
394
425
|
},
|
|
395
|
-
updateStatus: (
|
|
396
|
-
|
|
426
|
+
updateStatus: (l) => {
|
|
427
|
+
l.stageMessage && this.statusManager.setStage("executing", l.stageMessage);
|
|
397
428
|
}
|
|
398
|
-
},
|
|
429
|
+
}, n = await s.execute(this.graph, a, o);
|
|
399
430
|
return f.debug("Command result", {
|
|
400
|
-
success:
|
|
401
|
-
message:
|
|
402
|
-
data:
|
|
403
|
-
}),
|
|
431
|
+
success: n.success,
|
|
432
|
+
message: n.message,
|
|
433
|
+
data: n.data
|
|
434
|
+
}), n;
|
|
404
435
|
}
|
|
405
436
|
/**
|
|
406
437
|
* Combine multiple command results into a single result.
|
|
@@ -415,12 +446,12 @@ ${this.schemaManager.getFormattedSchema()}
|
|
|
415
446
|
message: t ?? "No commands executed",
|
|
416
447
|
llmText: t
|
|
417
448
|
};
|
|
418
|
-
const s = e.every((i) => i.success),
|
|
419
|
-
t &&
|
|
449
|
+
const s = e.every((i) => i.success), a = e.map((i) => i.message);
|
|
450
|
+
t && a.unshift(t);
|
|
420
451
|
const o = [...new Set(e.flatMap((i) => i.affectedNodes ?? []))], n = [...new Set(e.flatMap((i) => i.affectedEdges ?? []))], l = e.filter((i) => i.success).pop() ?? e[e.length - 1];
|
|
421
452
|
return {
|
|
422
453
|
success: s,
|
|
423
|
-
message:
|
|
454
|
+
message: a.join(`
|
|
424
455
|
`),
|
|
425
456
|
data: l.data,
|
|
426
457
|
affectedNodes: o.length > 0 ? o : void 0,
|
|
@@ -460,7 +491,7 @@ ${this.schemaManager.getFormattedSchema()}
|
|
|
460
491
|
this.disposed = !0, this.cancel(), this.statusManager.reset();
|
|
461
492
|
}
|
|
462
493
|
}
|
|
463
|
-
class
|
|
494
|
+
class fe {
|
|
464
495
|
constructor() {
|
|
465
496
|
this.commands = /* @__PURE__ */ new Map();
|
|
466
497
|
}
|
|
@@ -529,7 +560,7 @@ class pe {
|
|
|
529
560
|
}));
|
|
530
561
|
}
|
|
531
562
|
}
|
|
532
|
-
const
|
|
563
|
+
const ye = {
|
|
533
564
|
maxSampleSize: 1e3,
|
|
534
565
|
maxDepth: 3,
|
|
535
566
|
enumMaxAbsoluteUnique: 10,
|
|
@@ -537,7 +568,7 @@ const he = {
|
|
|
537
568
|
enumMaxStringLength: 64,
|
|
538
569
|
enumMinSampleSize: 25
|
|
539
570
|
};
|
|
540
|
-
class
|
|
571
|
+
class ve {
|
|
541
572
|
constructor(e) {
|
|
542
573
|
this.values = /* @__PURE__ */ new Map(), this.options = e;
|
|
543
574
|
}
|
|
@@ -559,10 +590,10 @@ class ge {
|
|
|
559
590
|
*/
|
|
560
591
|
trackObject(e, t = "", s = 0) {
|
|
561
592
|
if (!(s >= this.options.maxDepth))
|
|
562
|
-
for (const [
|
|
563
|
-
if (t === "" &&
|
|
593
|
+
for (const [a, o] of Object.entries(e)) {
|
|
594
|
+
if (t === "" && a === "id")
|
|
564
595
|
continue;
|
|
565
|
-
const n = t ? `${t}.${
|
|
596
|
+
const n = t ? `${t}.${a}` : a;
|
|
566
597
|
typeof o == "string" ? this.trackValue(n, o) : o !== null && typeof o == "object" && !Array.isArray(o) && this.trackObject(o, n, s + 1);
|
|
567
598
|
}
|
|
568
599
|
}
|
|
@@ -581,27 +612,27 @@ class ge {
|
|
|
581
612
|
const t = this.values.get(e);
|
|
582
613
|
if (!t || t.length < this.options.enumMinSampleSize)
|
|
583
614
|
return { isEnum: !1 };
|
|
584
|
-
const s = [...new Set(t)],
|
|
615
|
+
const s = [...new Set(t)], a = s.length / t.length, o = s.length <= this.options.enumMaxAbsoluteUnique || a <= this.options.enumMaxUniqueRatio, n = s.every((l) => l.length <= this.options.enumMaxStringLength);
|
|
585
616
|
return o && n ? { isEnum: !0, values: s.sort() } : { isEnum: !1 };
|
|
586
617
|
}
|
|
587
618
|
}
|
|
588
|
-
class
|
|
619
|
+
class W {
|
|
589
620
|
/**
|
|
590
621
|
* Creates a new SchemaExtractor instance.
|
|
591
622
|
* @param graph - The graph to extract schema from
|
|
592
623
|
* @param options - Optional extraction options
|
|
593
624
|
*/
|
|
594
625
|
constructor(e, t = {}) {
|
|
595
|
-
this.graph = e, this.options = { ...
|
|
626
|
+
this.graph = e, this.options = { ...ye, ...t };
|
|
596
627
|
}
|
|
597
628
|
/**
|
|
598
629
|
* Extract schema from the graph.
|
|
599
630
|
* @returns SchemaSummary with node and edge property information
|
|
600
631
|
*/
|
|
601
632
|
extract() {
|
|
602
|
-
const e = this.graph.getDataManager(), t = this.graph.getNodeCount(), s = this.graph.getEdgeCount(),
|
|
633
|
+
const e = this.graph.getDataManager(), t = this.graph.getNodeCount(), s = this.graph.getEdgeCount(), a = Array.from(e.nodes.values()).map((n) => n.data).filter((n) => n !== void 0), o = Array.from(e.edges.values()).map((n) => n.data).filter((n) => n !== void 0);
|
|
603
634
|
return {
|
|
604
|
-
nodeProperties: this.extractFromCollection(
|
|
635
|
+
nodeProperties: this.extractFromCollection(a),
|
|
605
636
|
edgeProperties: this.extractFromCollection(o),
|
|
606
637
|
nodeCount: t,
|
|
607
638
|
edgeCount: s
|
|
@@ -615,14 +646,14 @@ class O {
|
|
|
615
646
|
extractFromCollection(e) {
|
|
616
647
|
if (e.length === 0)
|
|
617
648
|
return [];
|
|
618
|
-
const t = e.length <= this.options.maxSampleSize ? e : this.sampleEvenly(e, this.options.maxSampleSize), [s, ...
|
|
649
|
+
const t = e.length <= this.options.maxSampleSize ? e : this.sampleEvenly(e, this.options.maxSampleSize), [s, ...a] = t;
|
|
619
650
|
let o = A(s);
|
|
620
|
-
for (const i of
|
|
651
|
+
for (const i of a)
|
|
621
652
|
o = A(
|
|
622
653
|
i,
|
|
623
654
|
o
|
|
624
655
|
);
|
|
625
|
-
const n = o.toSnapshot(), l = new
|
|
656
|
+
const n = o.toSnapshot(), l = new ve(this.options);
|
|
626
657
|
for (const i of t)
|
|
627
658
|
l.trackObject(i, "", 0);
|
|
628
659
|
return this.mergeResults(n, l);
|
|
@@ -636,12 +667,12 @@ class O {
|
|
|
636
667
|
mergeResults(e, t) {
|
|
637
668
|
const s = [];
|
|
638
669
|
if (e.type === "object" && e.properties) {
|
|
639
|
-
for (const [
|
|
640
|
-
this.extractProperties(
|
|
641
|
-
for (const [
|
|
642
|
-
this.extractProperties(
|
|
670
|
+
for (const [a, o] of Object.entries(e.properties.required))
|
|
671
|
+
this.extractProperties(a, o, t, "", !1, s);
|
|
672
|
+
for (const [a, o] of Object.entries(e.properties.optional))
|
|
673
|
+
this.extractProperties(a, o, t, "", !0, s);
|
|
643
674
|
}
|
|
644
|
-
return s.sort((
|
|
675
|
+
return s.sort((a, o) => a.name.localeCompare(o.name));
|
|
645
676
|
}
|
|
646
677
|
/**
|
|
647
678
|
* Recursively extract properties, handling nested objects with dot notation.
|
|
@@ -653,19 +684,19 @@ class O {
|
|
|
653
684
|
* @param properties - Array to accumulate property summaries
|
|
654
685
|
* @param depth - Current recursion depth
|
|
655
686
|
*/
|
|
656
|
-
extractProperties(e, t, s,
|
|
657
|
-
const i =
|
|
658
|
-
if (
|
|
687
|
+
extractProperties(e, t, s, a, o, n, l = 0) {
|
|
688
|
+
const i = a ? `${a}.${e}` : e;
|
|
689
|
+
if (a === "" && e === "id" || l >= this.options.maxDepth)
|
|
659
690
|
return;
|
|
660
|
-
let
|
|
661
|
-
if (t.type === "nullable" && t.schema && (
|
|
662
|
-
for (const [m, h] of Object.entries(
|
|
691
|
+
let c = o, u = t;
|
|
692
|
+
if (t.type === "nullable" && t.schema && (c = !0, u = t.schema), u.type === "object" && u.properties) {
|
|
693
|
+
for (const [m, h] of Object.entries(u.properties.required))
|
|
663
694
|
this.extractProperties(m, h, s, i, !1, n, l + 1);
|
|
664
|
-
for (const [m, h] of Object.entries(
|
|
695
|
+
for (const [m, h] of Object.entries(u.properties.optional))
|
|
665
696
|
this.extractProperties(m, h, s, i, !0, n, l + 1);
|
|
666
697
|
return;
|
|
667
698
|
}
|
|
668
|
-
const p = this.schemaToSummary(i,
|
|
699
|
+
const p = this.schemaToSummary(i, u, s, c);
|
|
669
700
|
p && n.push(p);
|
|
670
701
|
}
|
|
671
702
|
/**
|
|
@@ -676,11 +707,11 @@ class O {
|
|
|
676
707
|
* @param nullable - Whether the property can be null
|
|
677
708
|
* @returns Property summary or null if not convertible
|
|
678
709
|
*/
|
|
679
|
-
schemaToSummary(e, t, s,
|
|
710
|
+
schemaToSummary(e, t, s, a) {
|
|
680
711
|
const o = {
|
|
681
712
|
name: e,
|
|
682
713
|
type: this.inferredTypeToPropertyType(t),
|
|
683
|
-
nullable:
|
|
714
|
+
nullable: a
|
|
684
715
|
};
|
|
685
716
|
switch (t.type) {
|
|
686
717
|
case "string": {
|
|
@@ -735,19 +766,19 @@ class O {
|
|
|
735
766
|
* @returns Array of evenly distributed samples
|
|
736
767
|
*/
|
|
737
768
|
sampleEvenly(e, t) {
|
|
738
|
-
const s = [],
|
|
769
|
+
const s = [], a = e.length / t;
|
|
739
770
|
for (let o = 0; o < t; o++) {
|
|
740
|
-
const n = Math.floor(o *
|
|
771
|
+
const n = Math.floor(o * a);
|
|
741
772
|
s.push(e[n]);
|
|
742
773
|
}
|
|
743
774
|
return s;
|
|
744
775
|
}
|
|
745
776
|
}
|
|
746
|
-
const
|
|
777
|
+
const be = d.enum(["nodeCount", "edgeCount", "currentLayout", "all", "summary"]).describe("Type of information to query about the graph"), we = {
|
|
747
778
|
name: "queryGraph",
|
|
748
779
|
description: "Query information about the graph structure, including node count, edge count, current layout, and overall statistics.",
|
|
749
|
-
parameters:
|
|
750
|
-
query:
|
|
780
|
+
parameters: d.object({
|
|
781
|
+
query: be
|
|
751
782
|
}),
|
|
752
783
|
examples: [
|
|
753
784
|
{ input: "How many nodes are there?", params: { query: "nodeCount" } },
|
|
@@ -756,12 +787,12 @@ const fe = c.enum(["nodeCount", "edgeCount", "currentLayout", "all", "summary"])
|
|
|
756
787
|
{ input: "Show me the graph summary", params: { query: "summary" } },
|
|
757
788
|
{ input: "Give me all the graph stats", params: { query: "all" } }
|
|
758
789
|
],
|
|
759
|
-
execute(
|
|
790
|
+
execute(r, e) {
|
|
760
791
|
const { query: t } = e;
|
|
761
792
|
try {
|
|
762
793
|
switch (t) {
|
|
763
794
|
case "nodeCount": {
|
|
764
|
-
const s =
|
|
795
|
+
const s = r.getNodeCount();
|
|
765
796
|
return Promise.resolve({
|
|
766
797
|
success: !0,
|
|
767
798
|
message: `The graph has ${s} node${s !== 1 ? "s" : ""}.`,
|
|
@@ -769,7 +800,7 @@ const fe = c.enum(["nodeCount", "edgeCount", "currentLayout", "all", "summary"])
|
|
|
769
800
|
});
|
|
770
801
|
}
|
|
771
802
|
case "edgeCount": {
|
|
772
|
-
const s =
|
|
803
|
+
const s = r.getEdgeCount();
|
|
773
804
|
return Promise.resolve({
|
|
774
805
|
success: !0,
|
|
775
806
|
message: `The graph has ${s} edge${s !== 1 ? "s" : ""}.`,
|
|
@@ -777,37 +808,37 @@ const fe = c.enum(["nodeCount", "edgeCount", "currentLayout", "all", "summary"])
|
|
|
777
808
|
});
|
|
778
809
|
}
|
|
779
810
|
case "currentLayout": {
|
|
780
|
-
const
|
|
811
|
+
const a = r.getLayoutManager().layoutEngine?.type ?? "unknown";
|
|
781
812
|
return Promise.resolve({
|
|
782
813
|
success: !0,
|
|
783
|
-
message: `The current layout is "${
|
|
784
|
-
data: { layout:
|
|
814
|
+
message: `The current layout is "${a}".`,
|
|
815
|
+
data: { layout: a }
|
|
785
816
|
});
|
|
786
817
|
}
|
|
787
818
|
case "all":
|
|
788
819
|
case "summary": {
|
|
789
|
-
const s =
|
|
820
|
+
const s = r.getNodeCount(), a = r.getEdgeCount(), n = r.getLayoutManager().layoutEngine?.type ?? "unknown", l = r.getViewMode() === "2d";
|
|
790
821
|
return Promise.resolve({
|
|
791
822
|
success: !0,
|
|
792
823
|
message: `Graph Summary:
|
|
793
824
|
- Nodes: ${s}
|
|
794
|
-
- Edges: ${
|
|
825
|
+
- Edges: ${a}
|
|
795
826
|
- Layout: ${n}
|
|
796
827
|
- Mode: ${l ? "2D" : "3D"}`,
|
|
797
828
|
data: {
|
|
798
829
|
nodeCount: s,
|
|
799
|
-
edgeCount:
|
|
830
|
+
edgeCount: a,
|
|
800
831
|
layout: n,
|
|
801
832
|
is2D: l
|
|
802
833
|
}
|
|
803
834
|
});
|
|
804
835
|
}
|
|
805
836
|
default: {
|
|
806
|
-
const s =
|
|
837
|
+
const s = r.getNodeCount(), a = r.getEdgeCount();
|
|
807
838
|
return Promise.resolve({
|
|
808
839
|
success: !0,
|
|
809
|
-
message: `Unknown query type "${String(t)}". The graph has ${s} nodes and ${
|
|
810
|
-
data: { nodeCount: s, edgeCount:
|
|
840
|
+
message: `Unknown query type "${String(t)}". The graph has ${s} nodes and ${a} edges.`,
|
|
841
|
+
data: { nodeCount: s, edgeCount: a }
|
|
811
842
|
});
|
|
812
843
|
}
|
|
813
844
|
}
|
|
@@ -818,44 +849,44 @@ const fe = c.enum(["nodeCount", "edgeCount", "currentLayout", "all", "summary"])
|
|
|
818
849
|
});
|
|
819
850
|
}
|
|
820
851
|
}
|
|
821
|
-
},
|
|
852
|
+
}, Se = 50, Ce = {
|
|
822
853
|
name: "findNodes",
|
|
823
854
|
description: "Find nodes in the graph that match specific criteria. Returns the total number of matches and at most `limit` matching node IDs (50 when no limit is given), with `truncated` true when the list was cut. Note: selectors search within node data directly, so use 'type' not 'data.type'.",
|
|
824
|
-
parameters:
|
|
825
|
-
selector:
|
|
855
|
+
parameters: d.object({
|
|
856
|
+
selector: d.string().describe(
|
|
826
857
|
`Simple selector to match nodes (e.g., 'type == "server"'). Search is performed on node data directly, so use property names like 'type' not 'data.type'.`
|
|
827
858
|
),
|
|
828
|
-
limit:
|
|
859
|
+
limit: d.number().optional().describe("Maximum number of node IDs to return (default 50)")
|
|
829
860
|
}),
|
|
830
861
|
examples: [
|
|
831
862
|
{ input: "Find all server nodes", params: { selector: "type == 'server'" } },
|
|
832
863
|
{ input: "Find nodes with high degree", params: { selector: "degree > 5" } },
|
|
833
864
|
{ input: "Get first 10 nodes", params: { selector: "", limit: 10 } }
|
|
834
865
|
],
|
|
835
|
-
execute(
|
|
866
|
+
execute(r, e) {
|
|
836
867
|
const { selector: t, limit: s } = e;
|
|
837
868
|
try {
|
|
838
|
-
const
|
|
869
|
+
const a = r.getDataManager(), o = Array.from(a.nodes.values());
|
|
839
870
|
let n;
|
|
840
871
|
!t || t === "" || t === "*" ? n = o : n = o.filter((p) => {
|
|
841
872
|
try {
|
|
842
873
|
const m = /^(\w+)\s*==\s*['"](.+)['"]$/.exec(t);
|
|
843
874
|
if (m) {
|
|
844
|
-
const [, g,
|
|
845
|
-
return typeof
|
|
875
|
+
const [, g, v] = m, w = p.data[g];
|
|
876
|
+
return typeof w == "boolean" ? w === (v === "true") : w === v;
|
|
846
877
|
}
|
|
847
878
|
const h = /^(\w+)\s*(>|<|>=|<=)\s*(\d+)$/.exec(t);
|
|
848
879
|
if (h) {
|
|
849
|
-
const [, g,
|
|
850
|
-
switch (
|
|
880
|
+
const [, g, v, w] = h, S = Number(p.data[g]), C = Number(w);
|
|
881
|
+
switch (v) {
|
|
851
882
|
case ">":
|
|
852
|
-
return
|
|
883
|
+
return S > C;
|
|
853
884
|
case "<":
|
|
854
|
-
return
|
|
885
|
+
return S < C;
|
|
855
886
|
case ">=":
|
|
856
|
-
return
|
|
887
|
+
return S >= C;
|
|
857
888
|
case "<=":
|
|
858
|
-
return
|
|
889
|
+
return S <= C;
|
|
859
890
|
default:
|
|
860
891
|
return !1;
|
|
861
892
|
}
|
|
@@ -865,31 +896,31 @@ const fe = c.enum(["nodeCount", "edgeCount", "currentLayout", "all", "summary"])
|
|
|
865
896
|
return !1;
|
|
866
897
|
}
|
|
867
898
|
});
|
|
868
|
-
const l = n.length, i = n.slice(0, s !== void 0 && s > 0 ? s :
|
|
899
|
+
const l = n.length, i = n.slice(0, s !== void 0 && s > 0 ? s : Se).map((p) => String(p.id)), c = i.length, u = l > c;
|
|
869
900
|
return Promise.resolve({
|
|
870
901
|
success: !0,
|
|
871
|
-
message: `Found ${l} matching node${l !== 1 ? "s" : ""}${
|
|
902
|
+
message: `Found ${l} matching node${l !== 1 ? "s" : ""}${u ? ` (showing ${c})` : ""}.`,
|
|
872
903
|
data: {
|
|
873
904
|
total: l,
|
|
874
|
-
returned:
|
|
875
|
-
count:
|
|
876
|
-
truncated:
|
|
905
|
+
returned: c,
|
|
906
|
+
count: c,
|
|
907
|
+
truncated: u,
|
|
877
908
|
nodeIds: i
|
|
878
909
|
},
|
|
879
910
|
affectedNodes: i
|
|
880
911
|
});
|
|
881
|
-
} catch (
|
|
912
|
+
} catch (a) {
|
|
882
913
|
return Promise.resolve({
|
|
883
914
|
success: !1,
|
|
884
|
-
message: `Failed to find nodes: ${
|
|
915
|
+
message: `Failed to find nodes: ${a.message}`
|
|
885
916
|
});
|
|
886
917
|
}
|
|
887
918
|
}
|
|
888
|
-
},
|
|
919
|
+
}, $e = d.enum(["nodeTypes", "edgeTypes", "nodeProperties", "edgeProperties", "all"]).describe("Type of schema information to retrieve"), xe = {
|
|
889
920
|
name: "getSchema",
|
|
890
921
|
description: "Get schema information about the graph data including node types, edge types, and available properties. Use this to discover what types of nodes exist or what properties are available for filtering.",
|
|
891
|
-
parameters:
|
|
892
|
-
query:
|
|
922
|
+
parameters: d.object({
|
|
923
|
+
query: $e
|
|
893
924
|
}),
|
|
894
925
|
examples: [
|
|
895
926
|
{ input: "What types of nodes are there?", params: { query: "nodeTypes" } },
|
|
@@ -898,21 +929,21 @@ const fe = c.enum(["nodeCount", "edgeCount", "currentLayout", "all", "summary"])
|
|
|
898
929
|
{ input: "What edge properties are available?", params: { query: "edgeProperties" } },
|
|
899
930
|
{ input: "Show me the data schema", params: { query: "all" } }
|
|
900
931
|
],
|
|
901
|
-
execute(
|
|
932
|
+
execute(r, e) {
|
|
902
933
|
const { query: t } = e;
|
|
903
934
|
try {
|
|
904
|
-
const
|
|
905
|
-
const
|
|
935
|
+
const a = new W(r).extract(), o = r.getDataManager(), n = (l, i, c = 20) => {
|
|
936
|
+
const u = /* @__PURE__ */ new Set();
|
|
906
937
|
for (const p of l) {
|
|
907
938
|
const m = p.data?.[i];
|
|
908
|
-
if (typeof m == "string" && (
|
|
939
|
+
if (typeof m == "string" && (u.add(m), u.size > c))
|
|
909
940
|
return [];
|
|
910
941
|
}
|
|
911
|
-
return Array.from(
|
|
942
|
+
return Array.from(u).sort();
|
|
912
943
|
};
|
|
913
944
|
switch (t) {
|
|
914
945
|
case "nodeTypes": {
|
|
915
|
-
let i =
|
|
946
|
+
let i = a.nodeProperties.find((c) => c.name === "type")?.enumValues ?? [];
|
|
916
947
|
return i.length === 0 && (i = n(o.nodes.values(), "type")), i.length === 0 ? Promise.resolve({
|
|
917
948
|
success: !0,
|
|
918
949
|
message: "No distinct node types found. Nodes may not have a 'type' property, or there are too many unique values to categorize.",
|
|
@@ -924,7 +955,7 @@ const fe = c.enum(["nodeCount", "edgeCount", "currentLayout", "all", "summary"])
|
|
|
924
955
|
});
|
|
925
956
|
}
|
|
926
957
|
case "edgeTypes": {
|
|
927
|
-
let i =
|
|
958
|
+
let i = a.edgeProperties.find((c) => c.name === "type")?.enumValues ?? [];
|
|
928
959
|
return i.length === 0 && (i = n(o.edges.values(), "type")), i.length === 0 ? Promise.resolve({
|
|
929
960
|
success: !0,
|
|
930
961
|
message: "No distinct edge types found. Edges may not have a 'type' property, or there are too many unique values to categorize.",
|
|
@@ -936,22 +967,22 @@ const fe = c.enum(["nodeCount", "edgeCount", "currentLayout", "all", "summary"])
|
|
|
936
967
|
});
|
|
937
968
|
}
|
|
938
969
|
case "nodeProperties": {
|
|
939
|
-
const l =
|
|
940
|
-
let
|
|
941
|
-
return i.enumValues && i.enumValues.length > 0 && (
|
|
970
|
+
const l = a.nodeProperties.map((i) => {
|
|
971
|
+
let c = `${i.name}: ${i.type}`;
|
|
972
|
+
return i.enumValues && i.enumValues.length > 0 && (c += ` (values: ${i.enumValues.join(", ")})`), i.range && (c += ` (range: ${i.range.min}-${i.range.max})`), c;
|
|
942
973
|
});
|
|
943
974
|
return Promise.resolve({
|
|
944
975
|
success: !0,
|
|
945
976
|
message: `Node properties:
|
|
946
977
|
${l.map((i) => `- ${i}`).join(`
|
|
947
978
|
`)}`,
|
|
948
|
-
data: { nodeProperties:
|
|
979
|
+
data: { nodeProperties: a.nodeProperties }
|
|
949
980
|
});
|
|
950
981
|
}
|
|
951
982
|
case "edgeProperties": {
|
|
952
|
-
const l =
|
|
953
|
-
let
|
|
954
|
-
return i.enumValues && i.enumValues.length > 0 && (
|
|
983
|
+
const l = a.edgeProperties.map((i) => {
|
|
984
|
+
let c = `${i.name}: ${i.type}`;
|
|
985
|
+
return i.enumValues && i.enumValues.length > 0 && (c += ` (values: ${i.enumValues.join(", ")})`), i.range && (c += ` (range: ${i.range.min}-${i.range.max})`), c;
|
|
955
986
|
});
|
|
956
987
|
return l.length === 0 ? Promise.resolve({
|
|
957
988
|
success: !0,
|
|
@@ -962,23 +993,23 @@ ${l.map((i) => `- ${i}`).join(`
|
|
|
962
993
|
message: `Edge properties:
|
|
963
994
|
${l.map((i) => `- ${i}`).join(`
|
|
964
995
|
`)}`,
|
|
965
|
-
data: { edgeProperties:
|
|
996
|
+
data: { edgeProperties: a.edgeProperties }
|
|
966
997
|
});
|
|
967
998
|
}
|
|
968
999
|
case "all": {
|
|
969
|
-
let i =
|
|
1000
|
+
let i = a.nodeProperties.find((g) => g.name === "type")?.enumValues ?? [];
|
|
970
1001
|
i.length === 0 && (i = n(o.nodes.values(), "type"));
|
|
971
|
-
let
|
|
972
|
-
|
|
973
|
-
const p =
|
|
1002
|
+
let u = a.edgeProperties.find((g) => g.name === "type")?.enumValues ?? [];
|
|
1003
|
+
u.length === 0 && (u = n(o.edges.values(), "type"));
|
|
1004
|
+
const p = a.nodeProperties.map((g) => g.name), m = a.edgeProperties.map((g) => g.name);
|
|
974
1005
|
let h = `Graph Schema Summary:
|
|
975
|
-
- ${
|
|
976
|
-
- ${
|
|
1006
|
+
- ${a.nodeCount} nodes with ${a.nodeProperties.length} properties
|
|
1007
|
+
- ${a.edgeCount} edges with ${a.edgeProperties.length} properties`;
|
|
977
1008
|
return i.length > 0 && (h += `
|
|
978
1009
|
|
|
979
|
-
Node types: ${i.join(", ")}`),
|
|
1010
|
+
Node types: ${i.join(", ")}`), u.length > 0 && (h += `
|
|
980
1011
|
|
|
981
|
-
Edge types: ${
|
|
1012
|
+
Edge types: ${u.join(", ")}`), p.length > 0 && (h += `
|
|
982
1013
|
|
|
983
1014
|
Node properties: ${p.join(", ")}`), m.length > 0 && (h += `
|
|
984
1015
|
|
|
@@ -986,12 +1017,12 @@ Edge properties: ${m.join(", ")}`), Promise.resolve({
|
|
|
986
1017
|
success: !0,
|
|
987
1018
|
message: h,
|
|
988
1019
|
data: {
|
|
989
|
-
nodeCount:
|
|
990
|
-
edgeCount:
|
|
1020
|
+
nodeCount: a.nodeCount,
|
|
1021
|
+
edgeCount: a.edgeCount,
|
|
991
1022
|
nodeTypes: i,
|
|
992
|
-
edgeTypes:
|
|
993
|
-
nodeProperties:
|
|
994
|
-
edgeProperties:
|
|
1023
|
+
edgeTypes: u,
|
|
1024
|
+
nodeProperties: a.nodeProperties,
|
|
1025
|
+
edgeProperties: a.edgeProperties
|
|
995
1026
|
}
|
|
996
1027
|
});
|
|
997
1028
|
}
|
|
@@ -1008,12 +1039,16 @@ Edge properties: ${m.join(", ")}`), Promise.resolve({
|
|
|
1008
1039
|
});
|
|
1009
1040
|
}
|
|
1010
1041
|
}
|
|
1011
|
-
}
|
|
1042
|
+
};
|
|
1043
|
+
function y(r, e) {
|
|
1044
|
+
return e?.tx ?? r.getSession();
|
|
1045
|
+
}
|
|
1046
|
+
const Me = d.string().describe("Layout algorithm type (e.g., 'circular', 'ngraph', 'random', 'spiral', 'd3')"), Pe = d.enum(["2d", "3d"]).describe("Dimension mode: '2d' or '3d'"), Ee = {
|
|
1012
1047
|
name: "setLayout",
|
|
1013
1048
|
description: "Change the graph layout algorithm. Common layouts include 'circular' (nodes in a circle), 'ngraph' (force-directed physics), 'random', 'spiral', 'shell', 'd3' (D3 force simulation), 'spring', 'planar', 'spectral', and 'forceatlas2'.",
|
|
1014
|
-
parameters:
|
|
1015
|
-
type:
|
|
1016
|
-
options:
|
|
1049
|
+
parameters: d.object({
|
|
1050
|
+
type: Me,
|
|
1051
|
+
options: d.record(d.unknown()).optional().describe("Additional layout-specific options")
|
|
1017
1052
|
}),
|
|
1018
1053
|
examples: [
|
|
1019
1054
|
{ input: "Use circular layout", params: { type: "circular" } },
|
|
@@ -1023,30 +1058,30 @@ Edge properties: ${m.join(", ")}`), Promise.resolve({
|
|
|
1023
1058
|
{ input: "Use D3 force layout", params: { type: "d3" } },
|
|
1024
1059
|
{ input: "Shell layout", params: { type: "shell" } }
|
|
1025
1060
|
],
|
|
1026
|
-
async execute(
|
|
1027
|
-
const { type:
|
|
1061
|
+
async execute(r, e, t) {
|
|
1062
|
+
const { type: s, options: a = {} } = e;
|
|
1028
1063
|
try {
|
|
1029
|
-
return await
|
|
1064
|
+
return await y(r, t).layout.set(re(s) ?? s, { engine: s, options: a }), {
|
|
1030
1065
|
success: !0,
|
|
1031
|
-
message: `Layout changed to "${
|
|
1032
|
-
data: { layoutType:
|
|
1066
|
+
message: `Layout changed to "${s}". The graph is now being rearranged.`,
|
|
1067
|
+
data: { layoutType: s }
|
|
1033
1068
|
};
|
|
1034
|
-
} catch (
|
|
1035
|
-
const
|
|
1036
|
-
return o.includes("not found") ||
|
|
1069
|
+
} catch (o) {
|
|
1070
|
+
const n = o.message;
|
|
1071
|
+
return _(o) && o.code === "E_UNKNOWN_LAYOUT" || n.includes("not found") || n.includes("unknown") || n.includes("invalid") ? {
|
|
1037
1072
|
success: !1,
|
|
1038
|
-
message: `Invalid layout type "${
|
|
1073
|
+
message: `Invalid layout type "${s}". Try 'circular', 'ngraph', 'random', 'spiral', 'shell', or 'd3'.`
|
|
1039
1074
|
} : {
|
|
1040
1075
|
success: !1,
|
|
1041
|
-
message: `Failed to set layout to "${
|
|
1076
|
+
message: `Failed to set layout to "${s}": ${n}`
|
|
1042
1077
|
};
|
|
1043
1078
|
}
|
|
1044
1079
|
}
|
|
1045
|
-
},
|
|
1080
|
+
}, Ae = {
|
|
1046
1081
|
name: "setDimension",
|
|
1047
1082
|
description: "Switch between 2D and 3D graph visualization modes. In 2D mode, nodes are arranged on a flat plane. In 3D mode, nodes can be positioned in three-dimensional space.",
|
|
1048
|
-
parameters:
|
|
1049
|
-
dimension:
|
|
1083
|
+
parameters: d.object({
|
|
1084
|
+
dimension: Pe
|
|
1050
1085
|
}),
|
|
1051
1086
|
examples: [
|
|
1052
1087
|
{ input: "Switch to 2D view", params: { dimension: "2d" } },
|
|
@@ -1054,27 +1089,27 @@ Edge properties: ${m.join(", ")}`), Promise.resolve({
|
|
|
1054
1089
|
{ input: "Make it flat", params: { dimension: "2d" } },
|
|
1055
1090
|
{ input: "Enable 3D mode", params: { dimension: "3d" } }
|
|
1056
1091
|
],
|
|
1057
|
-
async execute(
|
|
1058
|
-
const { dimension:
|
|
1092
|
+
async execute(r, e, t) {
|
|
1093
|
+
const { dimension: s } = e;
|
|
1059
1094
|
try {
|
|
1060
|
-
const
|
|
1061
|
-
return await
|
|
1095
|
+
const a = s === "2d", o = a ? "2D" : "3D";
|
|
1096
|
+
return await y(r, t).layout.setDimension(a ? "2d" : "3d"), {
|
|
1062
1097
|
success: !0,
|
|
1063
|
-
message: `Switched to ${
|
|
1064
|
-
data: { dimension:
|
|
1098
|
+
message: `Switched to ${o} mode. The graph will now be displayed ${a ? "on a flat plane" : "in three-dimensional space"}.`,
|
|
1099
|
+
data: { dimension: o, is2D: a }
|
|
1065
1100
|
};
|
|
1066
|
-
} catch (
|
|
1101
|
+
} catch (a) {
|
|
1067
1102
|
return {
|
|
1068
1103
|
success: !1,
|
|
1069
|
-
message: `Failed to change dimension: ${
|
|
1104
|
+
message: `Failed to change dimension: ${a.message}`
|
|
1070
1105
|
};
|
|
1071
1106
|
}
|
|
1072
1107
|
}
|
|
1073
|
-
},
|
|
1108
|
+
}, Te = d.enum(["vr", "ar", "exit"]).describe("VR for virtual reality, AR for augmented reality, exit to return to normal view"), Ne = {
|
|
1074
1109
|
name: "setImmersiveMode",
|
|
1075
1110
|
description: "Enter or exit VR/AR immersive modes using WebXR. Use 'vr' for virtual reality (headset), 'ar' for augmented reality (pass-through or mobile AR), or 'exit' to return to normal desktop view.",
|
|
1076
|
-
parameters:
|
|
1077
|
-
mode:
|
|
1111
|
+
parameters: d.object({
|
|
1112
|
+
mode: Te
|
|
1078
1113
|
}),
|
|
1079
1114
|
examples: [
|
|
1080
1115
|
{ input: "Enter VR mode", params: { mode: "vr" } },
|
|
@@ -1085,25 +1120,25 @@ Edge properties: ${m.join(", ")}`), Promise.resolve({
|
|
|
1085
1120
|
{ input: "Show augmented reality view", params: { mode: "ar" } },
|
|
1086
1121
|
{ input: "Go back to normal view", params: { mode: "exit" } }
|
|
1087
1122
|
],
|
|
1088
|
-
async execute(
|
|
1123
|
+
async execute(r, e) {
|
|
1089
1124
|
const { mode: t } = e;
|
|
1090
1125
|
try {
|
|
1091
1126
|
if (t === "exit") {
|
|
1092
|
-
const n =
|
|
1093
|
-
return n && await n.call(
|
|
1127
|
+
const n = r.exitImmersiveMode;
|
|
1128
|
+
return n && await n.call(r), {
|
|
1094
1129
|
success: !0,
|
|
1095
1130
|
message: "Exited immersive mode, returned to normal view."
|
|
1096
1131
|
};
|
|
1097
1132
|
}
|
|
1098
|
-
const { getXRHelper: s } =
|
|
1099
|
-
if (!
|
|
1133
|
+
const { getXRHelper: s } = r, a = s?.call(r);
|
|
1134
|
+
if (!a)
|
|
1100
1135
|
return {
|
|
1101
1136
|
success: !1,
|
|
1102
1137
|
message: `WebXR is not available. ${t.toUpperCase()} mode requires a WebXR-capable browser and device.`
|
|
1103
1138
|
};
|
|
1104
1139
|
if (t === "vr") {
|
|
1105
|
-
const { enterVR: n } =
|
|
1106
|
-
return n ? (await n.call(
|
|
1140
|
+
const { enterVR: n } = a;
|
|
1141
|
+
return n ? (await n.call(a), {
|
|
1107
1142
|
success: !0,
|
|
1108
1143
|
message: "Entering VR mode. Put on your headset to view the graph in virtual reality."
|
|
1109
1144
|
}) : {
|
|
@@ -1111,8 +1146,8 @@ Edge properties: ${m.join(", ")}`), Promise.resolve({
|
|
|
1111
1146
|
message: "VR mode is not supported on this device or browser."
|
|
1112
1147
|
};
|
|
1113
1148
|
}
|
|
1114
|
-
const { enterAR: o } =
|
|
1115
|
-
return o ? (await o.call(
|
|
1149
|
+
const { enterAR: o } = a;
|
|
1150
|
+
return o ? (await o.call(a), {
|
|
1116
1151
|
success: !0,
|
|
1117
1152
|
message: "Entering AR mode. Point your device to see the graph in augmented reality."
|
|
1118
1153
|
}) : {
|
|
@@ -1126,60 +1161,60 @@ Edge properties: ${m.join(", ")}`), Promise.resolve({
|
|
|
1126
1161
|
};
|
|
1127
1162
|
}
|
|
1128
1163
|
}
|
|
1129
|
-
},
|
|
1130
|
-
color:
|
|
1131
|
-
size:
|
|
1132
|
-
shape:
|
|
1133
|
-
glowColor:
|
|
1134
|
-
glowStrength:
|
|
1135
|
-
outlineColor:
|
|
1136
|
-
outlineWidth:
|
|
1164
|
+
}, ke = d.object({
|
|
1165
|
+
color: d.string().optional().describe("Color for the node (e.g., '#ff0000', 'red')"),
|
|
1166
|
+
size: d.number().positive().optional().describe("Size of the node (default is 1)"),
|
|
1167
|
+
shape: d.string().optional().describe("Shape type (e.g., 'sphere', 'box', 'cylinder')"),
|
|
1168
|
+
glowColor: d.string().optional().describe("Glow effect color"),
|
|
1169
|
+
glowStrength: d.number().positive().optional().describe("Glow effect strength. One strength is drawn at a time for the whole scene"),
|
|
1170
|
+
outlineColor: d.string().optional().describe("Outline color"),
|
|
1171
|
+
outlineWidth: d.number().positive().optional().describe(
|
|
1137
1172
|
"Outline width. Not drawn: every outline in the scene is stroked at one width, so asking for this is answered with the reason rather than applied"
|
|
1138
1173
|
),
|
|
1139
|
-
enabled:
|
|
1140
|
-
}).describe("Style properties for nodes"),
|
|
1141
|
-
color:
|
|
1142
|
-
width:
|
|
1143
|
-
lineType:
|
|
1144
|
-
arrowColor:
|
|
1145
|
-
arrowSize:
|
|
1146
|
-
arrowOpacity:
|
|
1147
|
-
enabled:
|
|
1148
|
-
}).describe("Style properties for edges"),
|
|
1149
|
-
function
|
|
1174
|
+
enabled: d.boolean().optional().describe("Whether the node is visible")
|
|
1175
|
+
}).describe("Style properties for nodes"), Ie = d.object({
|
|
1176
|
+
color: d.string().optional().describe("Color for the edge line (e.g., '#00ff00', 'green')"),
|
|
1177
|
+
width: d.number().positive().optional().describe("Width of the edge line"),
|
|
1178
|
+
lineType: d.string().optional().describe("Line pattern (e.g., 'solid', 'dash', 'dot')"),
|
|
1179
|
+
arrowColor: d.string().optional().describe("Color for the arrow head"),
|
|
1180
|
+
arrowSize: d.number().positive().optional().describe("Size of the arrow head"),
|
|
1181
|
+
arrowOpacity: d.number().min(0).max(1).optional().describe("Opacity of the arrow head, 0 to 1"),
|
|
1182
|
+
enabled: d.boolean().optional().describe("Whether the edge is visible")
|
|
1183
|
+
}).describe("Style properties for edges"), Re = { by: "plugin", name: "graphty-ai" };
|
|
1184
|
+
function De(r) {
|
|
1150
1185
|
const e = {}, t = [];
|
|
1151
|
-
return
|
|
1186
|
+
return r.color !== void 0 && (e["node.color"] = r.color), r.size !== void 0 && (e["node.size"] = r.size), r.shape !== void 0 && (e["node.shape"] = r.shape), r.glowColor !== void 0 && (e["node.glow"] = r.glowColor), r.glowStrength !== void 0 && (e["node.glowStrength"] = r.glowStrength), r.outlineColor !== void 0 && (e["node.outline"] = r.outlineColor), r.enabled === !1 && (e["node.opacity"] = 0), r.outlineWidth !== void 0 && t.push({ property: "outlineWidth", reason: ae }), { set: e, unsupported: t };
|
|
1152
1187
|
}
|
|
1153
|
-
function
|
|
1188
|
+
function Le(r) {
|
|
1154
1189
|
const e = {};
|
|
1155
|
-
return
|
|
1190
|
+
return r.color !== void 0 && (e["edge.color"] = r.color), r.width !== void 0 && (e["edge.width"] = r.width), r.lineType !== void 0 && (e["edge.style"] = r.lineType), r.enabled === !1 && (e["edge.opacity"] = 0), r.arrowColor !== void 0 && (e["edge.arrowHeadColor"] = r.arrowColor), r.arrowSize !== void 0 && (e["edge.arrowHeadSize"] = r.arrowSize), r.arrowOpacity !== void 0 && (e["edge.arrowHeadOpacity"] = r.arrowOpacity), { set: e, unsupported: [] };
|
|
1156
1191
|
}
|
|
1157
|
-
const
|
|
1158
|
-
function
|
|
1159
|
-
return !
|
|
1192
|
+
const je = /* @__PURE__ */ new Set(["", "*", "all", "*.*", "true"]);
|
|
1193
|
+
function ze(r) {
|
|
1194
|
+
return !r || je.has(r.toLowerCase().trim());
|
|
1160
1195
|
}
|
|
1161
|
-
function
|
|
1196
|
+
function G(r, e, t, s) {
|
|
1162
1197
|
return {
|
|
1163
|
-
name:
|
|
1198
|
+
name: r,
|
|
1164
1199
|
target: e,
|
|
1165
1200
|
kind: "custom",
|
|
1166
|
-
source:
|
|
1167
|
-
selector:
|
|
1201
|
+
source: Re,
|
|
1202
|
+
selector: ze(t) ? { match: "everything" } : { match: "expression", where: t.replace(/"/g, "'") },
|
|
1168
1203
|
set: s
|
|
1169
1204
|
};
|
|
1170
1205
|
}
|
|
1171
|
-
function
|
|
1172
|
-
return
|
|
1206
|
+
function H(r) {
|
|
1207
|
+
return _(r) ? `${r.message} (${r.code})` : r instanceof Error ? r.message : String(r);
|
|
1173
1208
|
}
|
|
1174
|
-
async function
|
|
1175
|
-
const { styles:
|
|
1209
|
+
async function B(r, e, t, s) {
|
|
1210
|
+
const { styles: a } = r, o = a.validate(e);
|
|
1176
1211
|
if (!o.ok)
|
|
1177
1212
|
return {
|
|
1178
1213
|
success: !1,
|
|
1179
1214
|
message: `That ${s} style could not be applied: ${o.errors.map((n) => n.message).join(" ")}`
|
|
1180
1215
|
};
|
|
1181
1216
|
try {
|
|
1182
|
-
const n = await
|
|
1217
|
+
const n = await a.add(e), l = t.map(({ property: c, reason: u }) => ` ${c} was not applied: ${u}`).join(""), i = o.unresolvedPaths.length === 0 ? "" : ` Nothing in this graph answers ${o.unresolvedPaths.join(", ")} yet, so the layer may paint nothing until it does.`;
|
|
1183
1218
|
return {
|
|
1184
1219
|
success: !0,
|
|
1185
1220
|
message: `Added the ${s} style layer "${n.name}".${l}${i}`,
|
|
@@ -1188,19 +1223,19 @@ async function W(a, e, t, s) {
|
|
|
1188
1223
|
} catch (n) {
|
|
1189
1224
|
return {
|
|
1190
1225
|
success: !1,
|
|
1191
|
-
message: `That ${s} style could not be applied: ${
|
|
1226
|
+
message: `That ${s} style could not be applied: ${H(n)}`
|
|
1192
1227
|
};
|
|
1193
1228
|
}
|
|
1194
1229
|
}
|
|
1195
|
-
const
|
|
1230
|
+
const Ue = {
|
|
1196
1231
|
name: "findAndStyleNodes",
|
|
1197
1232
|
description: `Style the nodes matching a selector by adding a style layer. Use an empty selector to match every node. A node's own fields are published under 'data.', so write 'data.type == "server"'. Styles include color, size, shape, glow color and outline color.`,
|
|
1198
|
-
parameters:
|
|
1199
|
-
selector:
|
|
1233
|
+
parameters: d.object({
|
|
1234
|
+
selector: d.string().describe(
|
|
1200
1235
|
`Expression matching nodes (empty string matches all). A record's own fields live under 'data.', so write 'data.type == "server"'.`
|
|
1201
1236
|
),
|
|
1202
|
-
style:
|
|
1203
|
-
layerName:
|
|
1237
|
+
style: ke,
|
|
1238
|
+
layerName: d.string().optional().describe("Name for this style layer (for later removal)")
|
|
1204
1239
|
}),
|
|
1205
1240
|
examples: [
|
|
1206
1241
|
{
|
|
@@ -1224,23 +1259,23 @@ const Le = {
|
|
|
1224
1259
|
params: { selector: "", style: { shape: "box" }, layerName: "box-shapes" }
|
|
1225
1260
|
}
|
|
1226
1261
|
],
|
|
1227
|
-
async execute(
|
|
1262
|
+
async execute(r, e, t) {
|
|
1228
1263
|
const {
|
|
1229
|
-
selector:
|
|
1230
|
-
style:
|
|
1231
|
-
layerName:
|
|
1232
|
-
} = e, { set:
|
|
1233
|
-
return
|
|
1264
|
+
selector: s,
|
|
1265
|
+
style: a,
|
|
1266
|
+
layerName: o = `ai-node-style-${Date.now()}`
|
|
1267
|
+
} = e, { set: n, unsupported: l } = De(a);
|
|
1268
|
+
return B(y(r, t), G(o, "node", s, n), l, "node");
|
|
1234
1269
|
}
|
|
1235
|
-
},
|
|
1270
|
+
}, qe = {
|
|
1236
1271
|
name: "findAndStyleEdges",
|
|
1237
1272
|
description: "Style the edges matching a selector by adding a style layer. Use an empty selector to match every edge. An edge's own fields are published under 'data.', so write 'data.weight > `0.5`'. Styles include color, width and line pattern.",
|
|
1238
|
-
parameters:
|
|
1239
|
-
selector:
|
|
1273
|
+
parameters: d.object({
|
|
1274
|
+
selector: d.string().describe(
|
|
1240
1275
|
"Expression matching edges (empty string matches all). A record's own fields live under 'data.', so write 'data.weight > `0.5`'."
|
|
1241
1276
|
),
|
|
1242
|
-
style:
|
|
1243
|
-
layerName:
|
|
1277
|
+
style: Ie,
|
|
1278
|
+
layerName: d.string().optional().describe("Name for this style layer (for later removal)")
|
|
1244
1279
|
}),
|
|
1245
1280
|
examples: [
|
|
1246
1281
|
{
|
|
@@ -1260,73 +1295,73 @@ const Le = {
|
|
|
1260
1295
|
params: { selector: "", style: { lineType: "dash" }, layerName: "dashed" }
|
|
1261
1296
|
}
|
|
1262
1297
|
],
|
|
1263
|
-
async execute(
|
|
1298
|
+
async execute(r, e, t) {
|
|
1264
1299
|
const {
|
|
1265
|
-
selector:
|
|
1266
|
-
style:
|
|
1267
|
-
layerName:
|
|
1268
|
-
} = e, { set:
|
|
1269
|
-
return
|
|
1300
|
+
selector: s,
|
|
1301
|
+
style: a,
|
|
1302
|
+
layerName: o = `ai-edge-style-${Date.now()}`
|
|
1303
|
+
} = e, { set: n, unsupported: l } = Le(a);
|
|
1304
|
+
return B(y(r, t), G(o, "edge", s, n), l, "edge");
|
|
1270
1305
|
}
|
|
1271
|
-
},
|
|
1306
|
+
}, Ve = {
|
|
1272
1307
|
name: "clearStyles",
|
|
1273
1308
|
description: "Clear styles added by AI commands. Specify a layerName to clear a specific style, or leave empty to clear all AI-added styles.",
|
|
1274
|
-
parameters:
|
|
1275
|
-
layerName:
|
|
1309
|
+
parameters: d.object({
|
|
1310
|
+
layerName: d.string().optional().describe("Name of the style layer to clear (clears all if not specified)")
|
|
1276
1311
|
}),
|
|
1277
1312
|
examples: [
|
|
1278
1313
|
{ input: "Clear all styling", params: {} },
|
|
1279
1314
|
{ input: "Remove red node styling", params: { layerName: "red-nodes" } }
|
|
1280
1315
|
],
|
|
1281
|
-
async execute(
|
|
1282
|
-
const { layerName:
|
|
1316
|
+
async execute(r, e, t) {
|
|
1317
|
+
const { layerName: s } = e, { styles: a } = y(r, t);
|
|
1283
1318
|
try {
|
|
1284
|
-
if (
|
|
1285
|
-
const
|
|
1286
|
-
(
|
|
1319
|
+
if (s === void 0) {
|
|
1320
|
+
const n = await a.removeBySource(
|
|
1321
|
+
(l) => l.by === "plugin" && l.name === "graphty-ai"
|
|
1287
1322
|
);
|
|
1288
1323
|
return {
|
|
1289
1324
|
success: !0,
|
|
1290
|
-
message: `Cleared ${String(
|
|
1291
|
-
data: { clearedCount:
|
|
1325
|
+
message: `Cleared ${String(n.length)} AI-added style layer(s).`,
|
|
1326
|
+
data: { clearedCount: n.length }
|
|
1292
1327
|
};
|
|
1293
1328
|
}
|
|
1294
|
-
const
|
|
1295
|
-
(
|
|
1329
|
+
const o = a.list().filter(
|
|
1330
|
+
(n) => n.name === s && n.source.by === "plugin" && n.source.name === "graphty-ai"
|
|
1296
1331
|
);
|
|
1297
|
-
if (
|
|
1332
|
+
if (o.length === 0)
|
|
1298
1333
|
return {
|
|
1299
1334
|
success: !0,
|
|
1300
|
-
message: `Style layer "${
|
|
1335
|
+
message: `Style layer "${s}" not found (may already be cleared).`
|
|
1301
1336
|
};
|
|
1302
|
-
for (const
|
|
1303
|
-
await
|
|
1337
|
+
for (const n of o)
|
|
1338
|
+
await a.remove(n.id);
|
|
1304
1339
|
return {
|
|
1305
1340
|
success: !0,
|
|
1306
|
-
message: `Cleared style layer "${
|
|
1307
|
-
data: { clearedCount:
|
|
1341
|
+
message: `Cleared style layer "${s}".`,
|
|
1342
|
+
data: { clearedCount: o.length }
|
|
1308
1343
|
};
|
|
1309
|
-
} catch (
|
|
1344
|
+
} catch (o) {
|
|
1310
1345
|
return {
|
|
1311
1346
|
success: !1,
|
|
1312
|
-
message: `Failed to clear styles: ${
|
|
1347
|
+
message: `Failed to clear styles: ${H(o)}`
|
|
1313
1348
|
};
|
|
1314
1349
|
}
|
|
1315
1350
|
}
|
|
1316
1351
|
};
|
|
1317
|
-
function
|
|
1352
|
+
function N() {
|
|
1318
1353
|
return [
|
|
1319
|
-
...
|
|
1320
|
-
...
|
|
1354
|
+
...ne.map((r) => r.id),
|
|
1355
|
+
...se().map((r) => r.id)
|
|
1321
1356
|
];
|
|
1322
1357
|
}
|
|
1323
|
-
const
|
|
1358
|
+
const Fe = d.string().describe(
|
|
1324
1359
|
"Named camera view. The element ships 'fitToGraph', 'topView', 'sideView', 'frontView' and 'isometric'; an application may have registered others."
|
|
1325
|
-
),
|
|
1326
|
-
x:
|
|
1327
|
-
y:
|
|
1328
|
-
z:
|
|
1329
|
-
}).describe("3D position coordinates"),
|
|
1360
|
+
), k = d.object({
|
|
1361
|
+
x: d.number(),
|
|
1362
|
+
y: d.number(),
|
|
1363
|
+
z: d.number()
|
|
1364
|
+
}).describe("3D position coordinates"), Oe = {
|
|
1330
1365
|
name: "setCameraPosition",
|
|
1331
1366
|
/*
|
|
1332
1367
|
* READ AT PROMPT TIME, NOT AT IMPORT TIME. The description is what the system prompt shows
|
|
@@ -1337,13 +1372,13 @@ const qe = c.string().describe(
|
|
|
1337
1372
|
* registered.
|
|
1338
1373
|
*/
|
|
1339
1374
|
get description() {
|
|
1340
|
-
return `Set the camera position using a preset (${
|
|
1375
|
+
return `Set the camera position using a preset (${N().join(", ")}) or specific coordinates. Presets automatically calculate the best view for the current graph. Animation can be enabled for smooth transitions.`;
|
|
1341
1376
|
},
|
|
1342
|
-
parameters:
|
|
1343
|
-
preset:
|
|
1344
|
-
position:
|
|
1345
|
-
target:
|
|
1346
|
-
animate:
|
|
1377
|
+
parameters: d.object({
|
|
1378
|
+
preset: Fe.optional().describe("Named camera preset to apply"),
|
|
1379
|
+
position: k.optional().describe("Custom camera position (3D only)"),
|
|
1380
|
+
target: k.optional().describe("Point the camera should look at (3D only)"),
|
|
1381
|
+
animate: d.boolean().optional().describe("Whether to animate the camera transition (default: true)")
|
|
1347
1382
|
}),
|
|
1348
1383
|
examples: [
|
|
1349
1384
|
{ input: "Show from top", params: { preset: "topView", animate: !0 } },
|
|
@@ -1356,11 +1391,11 @@ const qe = c.string().describe(
|
|
|
1356
1391
|
params: { position: { x: 10, y: 20, z: 30 }, target: { x: 0, y: 0, z: 0 } }
|
|
1357
1392
|
}
|
|
1358
1393
|
],
|
|
1359
|
-
async execute(
|
|
1394
|
+
async execute(r, e) {
|
|
1360
1395
|
const {
|
|
1361
1396
|
preset: t,
|
|
1362
1397
|
position: s,
|
|
1363
|
-
target:
|
|
1398
|
+
target: a,
|
|
1364
1399
|
animate: o = !0
|
|
1365
1400
|
} = e;
|
|
1366
1401
|
try {
|
|
@@ -1370,23 +1405,23 @@ const qe = c.string().describe(
|
|
|
1370
1405
|
message: "Either 'preset' or 'position' must be provided."
|
|
1371
1406
|
};
|
|
1372
1407
|
if (t)
|
|
1373
|
-
return
|
|
1408
|
+
return oe(t) ? (await r.setCameraState({ preset: t }, { animate: o, description: `Setting camera to ${t} view` }), {
|
|
1374
1409
|
success: !0,
|
|
1375
1410
|
message: `Camera moved to ${t} view${o ? " (animated)" : ""}.`,
|
|
1376
1411
|
data: { preset: t, animated: o }
|
|
1377
1412
|
}) : {
|
|
1378
1413
|
success: !1,
|
|
1379
|
-
message: `Unknown camera view "${t}". Available views: ${
|
|
1414
|
+
message: `Unknown camera view "${t}". Available views: ${N().join(", ")}.`
|
|
1380
1415
|
};
|
|
1381
1416
|
if (s) {
|
|
1382
1417
|
const n = { position: s };
|
|
1383
|
-
return
|
|
1418
|
+
return a && (n.target = a), await r.setCameraState(n, {
|
|
1384
1419
|
animate: o,
|
|
1385
1420
|
description: "Moving camera to specified position"
|
|
1386
1421
|
}), {
|
|
1387
1422
|
success: !0,
|
|
1388
1423
|
message: `Camera moved to position (${s.x}, ${s.y}, ${s.z})${o ? " (animated)" : ""}.`,
|
|
1389
|
-
data: { position: s, target:
|
|
1424
|
+
data: { position: s, target: a, animated: o }
|
|
1390
1425
|
};
|
|
1391
1426
|
}
|
|
1392
1427
|
return {
|
|
@@ -1401,78 +1436,78 @@ const qe = c.string().describe(
|
|
|
1401
1436
|
}
|
|
1402
1437
|
}
|
|
1403
1438
|
};
|
|
1404
|
-
function
|
|
1405
|
-
const t =
|
|
1439
|
+
function _e(r, e) {
|
|
1440
|
+
const t = r.getDataManager(), { nodes: s } = t, a = [];
|
|
1406
1441
|
if (!e || e.length === 0) {
|
|
1407
1442
|
for (const [o] of s)
|
|
1408
|
-
|
|
1409
|
-
return
|
|
1443
|
+
a.push(String(o));
|
|
1444
|
+
return a;
|
|
1410
1445
|
}
|
|
1411
1446
|
try {
|
|
1412
1447
|
const n = `[?${e.replace(/"/g, "'")}]`;
|
|
1413
1448
|
for (const [l, i] of s) {
|
|
1414
|
-
const { data:
|
|
1415
|
-
Array.isArray(
|
|
1449
|
+
const { data: c } = i, u = le.search([c], n);
|
|
1450
|
+
Array.isArray(u) && u.length > 0 && a.push(String(l));
|
|
1416
1451
|
}
|
|
1417
1452
|
} catch {
|
|
1418
1453
|
return [];
|
|
1419
1454
|
}
|
|
1420
|
-
return
|
|
1455
|
+
return a;
|
|
1421
1456
|
}
|
|
1422
|
-
const
|
|
1457
|
+
const Ke = {
|
|
1423
1458
|
name: "zoomToNodes",
|
|
1424
1459
|
description: "Zoom the camera to fit specific nodes in view. Use a JMESPath selector to choose which nodes to focus on, or leave empty to fit all nodes. Optionally add padding around the nodes.",
|
|
1425
|
-
parameters:
|
|
1426
|
-
selector:
|
|
1427
|
-
animate:
|
|
1428
|
-
padding:
|
|
1460
|
+
parameters: d.object({
|
|
1461
|
+
selector: d.string().optional().describe("JMESPath expression to match nodes (empty matches all)"),
|
|
1462
|
+
animate: d.boolean().optional().describe("Whether to animate the zoom (default: true)"),
|
|
1463
|
+
padding: d.number().optional().describe("Extra padding around nodes (default: 1.2 = 20% padding)")
|
|
1429
1464
|
}),
|
|
1430
1465
|
examples: [
|
|
1431
1466
|
{ input: "Zoom to fit all nodes", params: { selector: "" } },
|
|
1432
1467
|
{ input: "Zoom to server nodes", params: { selector: "type == 'server'" } },
|
|
1433
1468
|
{ input: "Fit graph with more padding", params: { selector: "", padding: 1.5 } }
|
|
1434
1469
|
],
|
|
1435
|
-
async execute(
|
|
1470
|
+
async execute(r, e) {
|
|
1436
1471
|
const { selector: t = "", animate: s = !0 } = e;
|
|
1437
1472
|
try {
|
|
1438
|
-
const
|
|
1439
|
-
if (
|
|
1473
|
+
const a = _e(r, t);
|
|
1474
|
+
if (a.length === 0 && t && t.length > 0)
|
|
1440
1475
|
return {
|
|
1441
1476
|
success: !0,
|
|
1442
1477
|
message: `No nodes matched the selector "${t}".`,
|
|
1443
1478
|
affectedNodes: []
|
|
1444
1479
|
};
|
|
1445
|
-
await
|
|
1446
|
-
...t && t.length > 0 ? { scope: { nodes:
|
|
1480
|
+
await r.applyCameraView("fitToGraph", {
|
|
1481
|
+
...t && t.length > 0 ? { scope: { nodes: a } } : {},
|
|
1447
1482
|
animate: s,
|
|
1448
1483
|
description: `Zooming to fit ${t ? "matching nodes" : "all nodes"}`
|
|
1449
1484
|
});
|
|
1450
|
-
const o = t ?
|
|
1485
|
+
const o = t ? a.length : r.getNodeCount();
|
|
1451
1486
|
return {
|
|
1452
1487
|
success: !0,
|
|
1453
1488
|
message: `Zoomed to fit ${o} node(s)${t ? ` matching "${t}"` : ""}.`,
|
|
1454
|
-
affectedNodes:
|
|
1489
|
+
affectedNodes: a,
|
|
1455
1490
|
data: { nodeCount: o, animated: s }
|
|
1456
1491
|
};
|
|
1457
|
-
} catch (
|
|
1492
|
+
} catch (a) {
|
|
1458
1493
|
return {
|
|
1459
1494
|
success: !1,
|
|
1460
|
-
message: `Failed to zoom to nodes: ${
|
|
1495
|
+
message: `Failed to zoom to nodes: ${a.message}`
|
|
1461
1496
|
};
|
|
1462
1497
|
}
|
|
1463
1498
|
}
|
|
1464
|
-
},
|
|
1465
|
-
namespace:
|
|
1466
|
-
type:
|
|
1467
|
-
options:
|
|
1499
|
+
}, I = d.object({
|
|
1500
|
+
namespace: d.string().describe("The namespace of the algorithm (e.g., 'graphty')"),
|
|
1501
|
+
type: d.string().describe("The type of algorithm to run (e.g., 'degree', 'pagerank')"),
|
|
1502
|
+
options: d.record(d.string(), d.unknown()).optional().describe(
|
|
1468
1503
|
"The algorithm's options, by name (e.g., { source: 'a', target: 'b' } for dijkstra, { dampingFactor: 0.9 } for pagerank). An unknown name or an out-of-range value is refused."
|
|
1469
1504
|
)
|
|
1470
|
-
}),
|
|
1471
|
-
namespace:
|
|
1472
|
-
}),
|
|
1505
|
+
}), R = 50, D = d.object({
|
|
1506
|
+
namespace: d.string().optional().describe("Optional namespace to filter algorithms by")
|
|
1507
|
+
}), We = {
|
|
1473
1508
|
name: "runAlgorithm",
|
|
1474
1509
|
description: "Run a graph algorithm to analyze the graph structure, optionally with options such as a source and target. Returns a bounded summary: the top 10 elements and the value range for a metric, the group sizes for a partition, the route for a path, plus any graph-level values.",
|
|
1475
|
-
parameters:
|
|
1510
|
+
parameters: I,
|
|
1476
1511
|
examples: [
|
|
1477
1512
|
{
|
|
1478
1513
|
input: "Calculate the degree of each node",
|
|
@@ -1491,63 +1526,72 @@ const Fe = {
|
|
|
1491
1526
|
params: { namespace: "graphty", type: "dijkstra", options: { source: "A", target: "B" } }
|
|
1492
1527
|
}
|
|
1493
1528
|
],
|
|
1494
|
-
async execute(
|
|
1495
|
-
const
|
|
1496
|
-
if (!
|
|
1529
|
+
async execute(r, e, t) {
|
|
1530
|
+
const s = I.safeParse(e);
|
|
1531
|
+
if (!s.success)
|
|
1497
1532
|
return {
|
|
1498
1533
|
success: !1,
|
|
1499
|
-
message: `Invalid parameters: ${
|
|
1534
|
+
message: `Invalid parameters: ${s.error.message}`
|
|
1500
1535
|
};
|
|
1501
|
-
const { namespace:
|
|
1536
|
+
const { namespace: a, type: o, options: n } = s.data;
|
|
1502
1537
|
try {
|
|
1503
|
-
if (!
|
|
1504
|
-
const
|
|
1538
|
+
if (!M.get(r, a, o)) {
|
|
1539
|
+
const h = M.getRegisteredAlgorithms(a), g = h.length > 0 ? `Available in namespace '${a}': ${h.map((v) => v.split(":")[1]).join(", ")}` : `No algorithms found in namespace '${a}'. Use listAlgorithms to see available options.`;
|
|
1505
1540
|
return {
|
|
1506
1541
|
success: !1,
|
|
1507
|
-
message: `Algorithm not found: ${
|
|
1542
|
+
message: `Algorithm not found: ${a}:${o}. ${g}`
|
|
1508
1543
|
};
|
|
1509
1544
|
}
|
|
1510
|
-
const
|
|
1511
|
-
if (
|
|
1512
|
-
return await
|
|
1545
|
+
const i = (a === "graphty" ? ie(o) : void 0) ?? E(`${a}:${o}`) ?? E(o);
|
|
1546
|
+
if (i === void 0)
|
|
1547
|
+
return await y(r, t).execute({
|
|
1548
|
+
op: "algo.legacy",
|
|
1549
|
+
namespace: a,
|
|
1550
|
+
type: o,
|
|
1551
|
+
...n === void 0 ? {} : { options: n }
|
|
1552
|
+
}), {
|
|
1513
1553
|
success: !0,
|
|
1514
|
-
message: `Successfully ran ${
|
|
1515
|
-
data: { namespace:
|
|
1554
|
+
message: `Successfully ran ${a}:${o} algorithm. Results are now available in node data.`,
|
|
1555
|
+
data: { namespace: a, type: o, nodeCount: r.getNodeCount() }
|
|
1516
1556
|
};
|
|
1517
|
-
const
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1557
|
+
const c = "params" in i ? i.params : {}, u = await y(r, t).run({
|
|
1558
|
+
op: "algo.run",
|
|
1559
|
+
algorithm: i.descriptor.key,
|
|
1560
|
+
params: { ...c, ...n }
|
|
1561
|
+
}), p = {
|
|
1562
|
+
namespace: a,
|
|
1563
|
+
type: o,
|
|
1564
|
+
algorithm: i.descriptor.key,
|
|
1521
1565
|
shape: u.shape,
|
|
1522
1566
|
summary: u.summary(),
|
|
1523
1567
|
graph: u.graph
|
|
1524
1568
|
};
|
|
1525
|
-
let
|
|
1569
|
+
let m;
|
|
1526
1570
|
if (u.shape === "path") {
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1529
|
-
nodeIds:
|
|
1530
|
-
total:
|
|
1531
|
-
truncated:
|
|
1571
|
+
const h = u.ranking("order").map((g) => String(g.id)).reverse();
|
|
1572
|
+
m = h.slice(0, R), p.path = {
|
|
1573
|
+
nodeIds: m,
|
|
1574
|
+
total: h.length,
|
|
1575
|
+
truncated: h.length > R
|
|
1532
1576
|
};
|
|
1533
1577
|
}
|
|
1534
1578
|
return {
|
|
1535
1579
|
success: !0,
|
|
1536
|
-
message: `Successfully ran ${
|
|
1537
|
-
data:
|
|
1538
|
-
...
|
|
1580
|
+
message: `Successfully ran ${a}:${o} algorithm. ${u.reading()}`,
|
|
1581
|
+
data: p,
|
|
1582
|
+
...m === void 0 ? {} : { affectedNodes: m }
|
|
1539
1583
|
};
|
|
1540
|
-
} catch (
|
|
1584
|
+
} catch (l) {
|
|
1541
1585
|
return {
|
|
1542
1586
|
success: !1,
|
|
1543
|
-
message: `Failed to run algorithm ${
|
|
1587
|
+
message: `Failed to run algorithm ${a}:${o}: ${l instanceof Error ? l.message : String(l)}`
|
|
1544
1588
|
};
|
|
1545
1589
|
}
|
|
1546
1590
|
}
|
|
1547
|
-
},
|
|
1591
|
+
}, Ge = {
|
|
1548
1592
|
name: "listAlgorithms",
|
|
1549
1593
|
description: "List all available graph algorithms that can be run on the graph. Optionally filter by namespace.",
|
|
1550
|
-
parameters:
|
|
1594
|
+
parameters: D,
|
|
1551
1595
|
examples: [
|
|
1552
1596
|
{
|
|
1553
1597
|
input: "What algorithms are available?",
|
|
@@ -1563,8 +1607,8 @@ const Fe = {
|
|
|
1563
1607
|
}
|
|
1564
1608
|
],
|
|
1565
1609
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
1566
|
-
async execute(
|
|
1567
|
-
const t =
|
|
1610
|
+
async execute(r, e) {
|
|
1611
|
+
const t = D.safeParse(e);
|
|
1568
1612
|
if (!t.success)
|
|
1569
1613
|
return {
|
|
1570
1614
|
success: !1,
|
|
@@ -1572,8 +1616,8 @@ const Fe = {
|
|
|
1572
1616
|
};
|
|
1573
1617
|
const { namespace: s } = t.data;
|
|
1574
1618
|
try {
|
|
1575
|
-
const
|
|
1576
|
-
return
|
|
1619
|
+
const a = M.getRegisteredAlgorithms(s);
|
|
1620
|
+
return a.length === 0 ? {
|
|
1577
1621
|
success: !0,
|
|
1578
1622
|
message: s ? `No algorithms found in namespace '${s}'.` : "No algorithms are currently registered.",
|
|
1579
1623
|
data: {
|
|
@@ -1582,180 +1626,180 @@ const Fe = {
|
|
|
1582
1626
|
}
|
|
1583
1627
|
} : {
|
|
1584
1628
|
success: !0,
|
|
1585
|
-
message: s ? `Found ${
|
|
1629
|
+
message: s ? `Found ${a.length} algorithm(s) in namespace '${s}': ${a.join(", ")}` : `Found ${a.length} available algorithm(s): ${a.join(", ")}`,
|
|
1586
1630
|
data: {
|
|
1587
|
-
algorithms:
|
|
1588
|
-
count:
|
|
1631
|
+
algorithms: a,
|
|
1632
|
+
count: a.length
|
|
1589
1633
|
}
|
|
1590
1634
|
};
|
|
1591
|
-
} catch (
|
|
1635
|
+
} catch (a) {
|
|
1592
1636
|
return {
|
|
1593
1637
|
success: !1,
|
|
1594
|
-
message: `Failed to list algorithms: ${
|
|
1638
|
+
message: `Failed to list algorithms: ${a instanceof Error ? a.message : String(a)}`
|
|
1595
1639
|
};
|
|
1596
1640
|
}
|
|
1597
1641
|
}
|
|
1598
1642
|
};
|
|
1599
|
-
function
|
|
1600
|
-
return
|
|
1643
|
+
function He(r, e = 100) {
|
|
1644
|
+
return r.length <= e ? r : `${r.slice(0, e)}...`;
|
|
1601
1645
|
}
|
|
1602
|
-
function
|
|
1603
|
-
if (
|
|
1646
|
+
function P(r, e) {
|
|
1647
|
+
if (r == null)
|
|
1604
1648
|
return;
|
|
1605
1649
|
const t = e.split(".");
|
|
1606
|
-
let s =
|
|
1607
|
-
for (const
|
|
1650
|
+
let s = r;
|
|
1651
|
+
for (const a of t) {
|
|
1608
1652
|
if (s == null || typeof s != "object")
|
|
1609
1653
|
return;
|
|
1610
|
-
s = s[
|
|
1654
|
+
s = s[a];
|
|
1611
1655
|
}
|
|
1612
1656
|
return s;
|
|
1613
1657
|
}
|
|
1614
|
-
function
|
|
1615
|
-
if (
|
|
1616
|
-
return
|
|
1617
|
-
if (typeof
|
|
1618
|
-
return
|
|
1619
|
-
if (Array.isArray(
|
|
1620
|
-
return
|
|
1621
|
-
if (typeof
|
|
1658
|
+
function $(r, e = 100) {
|
|
1659
|
+
if (r == null)
|
|
1660
|
+
return r;
|
|
1661
|
+
if (typeof r == "string")
|
|
1662
|
+
return He(r, e);
|
|
1663
|
+
if (Array.isArray(r))
|
|
1664
|
+
return r.map((t) => $(t, e));
|
|
1665
|
+
if (typeof r == "object") {
|
|
1622
1666
|
const t = {};
|
|
1623
|
-
for (const [s,
|
|
1624
|
-
t[s] =
|
|
1667
|
+
for (const [s, a] of Object.entries(r))
|
|
1668
|
+
t[s] = $(a, e);
|
|
1625
1669
|
return t;
|
|
1626
1670
|
}
|
|
1627
|
-
return
|
|
1671
|
+
return r;
|
|
1628
1672
|
}
|
|
1629
|
-
function
|
|
1630
|
-
if (
|
|
1673
|
+
function X(r) {
|
|
1674
|
+
if (r.length === 0)
|
|
1631
1675
|
return { min: 0, max: 0, avg: 0, median: 0, count: 0 };
|
|
1632
|
-
const e = [...
|
|
1633
|
-
return { min: s, max:
|
|
1676
|
+
const e = [...r].sort((i, c) => i - c), t = r.reduce((i, c) => i + c, 0), s = e[0], a = e[e.length - 1], o = t / r.length, n = Math.floor(e.length / 2), l = e.length % 2 === 0 ? (e[n - 1] + e[n]) / 2 : e[n];
|
|
1677
|
+
return { min: s, max: a, avg: o, median: l, count: r.length };
|
|
1634
1678
|
}
|
|
1635
|
-
function
|
|
1636
|
-
if (
|
|
1679
|
+
function Be(r, e = 5) {
|
|
1680
|
+
if (r.length === 0)
|
|
1637
1681
|
return [];
|
|
1638
|
-
const t = Math.min(...
|
|
1682
|
+
const t = Math.min(...r), s = Math.max(...r);
|
|
1639
1683
|
if (t === s)
|
|
1640
1684
|
return [
|
|
1641
1685
|
{
|
|
1642
|
-
range:
|
|
1643
|
-
count:
|
|
1686
|
+
range: L(t, s),
|
|
1687
|
+
count: r.length,
|
|
1644
1688
|
min: t,
|
|
1645
1689
|
max: s
|
|
1646
1690
|
}
|
|
1647
1691
|
];
|
|
1648
|
-
const
|
|
1692
|
+
const a = (s - t) / e, o = [];
|
|
1649
1693
|
for (let n = 0; n < e; n++) {
|
|
1650
|
-
const l = t + n *
|
|
1694
|
+
const l = t + n * a, i = n === e - 1 ? s : t + (n + 1) * a;
|
|
1651
1695
|
o.push({
|
|
1652
|
-
range:
|
|
1696
|
+
range: L(l, i),
|
|
1653
1697
|
count: 0,
|
|
1654
1698
|
min: l,
|
|
1655
1699
|
max: i
|
|
1656
1700
|
});
|
|
1657
1701
|
}
|
|
1658
|
-
for (const n of
|
|
1659
|
-
let l = Math.floor((n - t) /
|
|
1702
|
+
for (const n of r) {
|
|
1703
|
+
let l = Math.floor((n - t) / a);
|
|
1660
1704
|
l >= e && (l = e - 1), o[l].count++;
|
|
1661
1705
|
}
|
|
1662
1706
|
return o;
|
|
1663
1707
|
}
|
|
1664
|
-
function
|
|
1708
|
+
function L(r, e) {
|
|
1665
1709
|
const t = (s) => Number.isInteger(s) ? s.toString() : s.toFixed(2);
|
|
1666
|
-
return `${t(
|
|
1710
|
+
return `${t(r)} - ${t(e)}`;
|
|
1667
1711
|
}
|
|
1668
|
-
function
|
|
1669
|
-
if (
|
|
1712
|
+
function Xe(r) {
|
|
1713
|
+
if (r == null)
|
|
1670
1714
|
return "null";
|
|
1671
|
-
if (Array.isArray(
|
|
1715
|
+
if (Array.isArray(r))
|
|
1672
1716
|
return "array";
|
|
1673
|
-
const e = typeof
|
|
1717
|
+
const e = typeof r;
|
|
1674
1718
|
return e === "string" || e === "number" || e === "boolean" ? e : e === "object" ? "object" : "null";
|
|
1675
1719
|
}
|
|
1676
|
-
function
|
|
1720
|
+
function Ye(r, e) {
|
|
1677
1721
|
const t = [];
|
|
1678
1722
|
let s = 0;
|
|
1679
|
-
for (const
|
|
1680
|
-
const o =
|
|
1723
|
+
for (const a of r) {
|
|
1724
|
+
const o = P(a.data, e);
|
|
1681
1725
|
o == null ? s++ : t.push(o);
|
|
1682
1726
|
}
|
|
1683
1727
|
return { values: t, nullCount: s };
|
|
1684
1728
|
}
|
|
1685
|
-
function
|
|
1686
|
-
if (
|
|
1729
|
+
function Y(r) {
|
|
1730
|
+
if (r.length === 0)
|
|
1687
1731
|
return "null";
|
|
1688
1732
|
const e = /* @__PURE__ */ new Map();
|
|
1689
|
-
for (const t of
|
|
1690
|
-
const s =
|
|
1733
|
+
for (const t of r) {
|
|
1734
|
+
const s = Xe(t);
|
|
1691
1735
|
e.set(s, (e.get(s) ?? 0) + 1);
|
|
1692
1736
|
}
|
|
1693
1737
|
return e.delete("null"), e.size === 0 ? "null" : e.size > 1 ? "mixed" : e.keys().next().value;
|
|
1694
1738
|
}
|
|
1695
|
-
function
|
|
1739
|
+
function Ze(r, e = 3) {
|
|
1696
1740
|
const t = /* @__PURE__ */ new Set();
|
|
1697
|
-
for (const s of
|
|
1698
|
-
|
|
1741
|
+
for (const s of r)
|
|
1742
|
+
Z(s.data, "", t, 0, e);
|
|
1699
1743
|
return Array.from(t).sort();
|
|
1700
1744
|
}
|
|
1701
|
-
function
|
|
1702
|
-
if (!(s >=
|
|
1703
|
-
for (const o of Object.keys(
|
|
1745
|
+
function Z(r, e, t, s, a) {
|
|
1746
|
+
if (!(s >= a || r === null || r === void 0 || typeof r != "object" || Array.isArray(r)))
|
|
1747
|
+
for (const o of Object.keys(r)) {
|
|
1704
1748
|
const n = e ? `${e}.${o}` : o;
|
|
1705
1749
|
t.add(n);
|
|
1706
|
-
const l =
|
|
1707
|
-
l !== null && typeof l == "object" && !Array.isArray(l) &&
|
|
1750
|
+
const l = r[o];
|
|
1751
|
+
l !== null && typeof l == "object" && !Array.isArray(l) && Z(l, n, t, s + 1, a);
|
|
1708
1752
|
}
|
|
1709
1753
|
}
|
|
1710
|
-
const
|
|
1711
|
-
function
|
|
1712
|
-
if (
|
|
1713
|
-
return [...
|
|
1714
|
-
const t = [...
|
|
1754
|
+
const Je = d.enum(["nodes", "edges", "both"]).optional().describe("What to sample: 'nodes', 'edges', or 'both' (default)"), j = 3, z = 10, U = 100;
|
|
1755
|
+
function b(r, e) {
|
|
1756
|
+
if (r.length <= e)
|
|
1757
|
+
return [...r];
|
|
1758
|
+
const t = [...r];
|
|
1715
1759
|
for (let s = 0; s < e; s++) {
|
|
1716
|
-
const
|
|
1717
|
-
[t[s], t[
|
|
1760
|
+
const a = s + Math.floor(Math.random() * (t.length - s));
|
|
1761
|
+
[t[s], t[a]] = [t[a], t[s]];
|
|
1718
1762
|
}
|
|
1719
1763
|
return t.slice(0, e);
|
|
1720
1764
|
}
|
|
1721
|
-
function
|
|
1722
|
-
if (
|
|
1723
|
-
return [...
|
|
1724
|
-
const s = /* @__PURE__ */ new Map(),
|
|
1725
|
-
for (const i of
|
|
1726
|
-
const
|
|
1727
|
-
if (
|
|
1728
|
-
|
|
1765
|
+
function q(r, e, t) {
|
|
1766
|
+
if (r.length <= e)
|
|
1767
|
+
return [...r];
|
|
1768
|
+
const s = /* @__PURE__ */ new Map(), a = [];
|
|
1769
|
+
for (const i of r) {
|
|
1770
|
+
const c = t(i);
|
|
1771
|
+
if (c === void 0)
|
|
1772
|
+
a.push(i);
|
|
1729
1773
|
else {
|
|
1730
|
-
const
|
|
1731
|
-
|
|
1774
|
+
const u = s.get(c) ?? [];
|
|
1775
|
+
u.push(i), s.set(c, u);
|
|
1732
1776
|
}
|
|
1733
1777
|
}
|
|
1734
|
-
const o = s.size + (
|
|
1778
|
+
const o = s.size + (a.length > 0 ? 1 : 0);
|
|
1735
1779
|
if (o === 0)
|
|
1736
|
-
return
|
|
1780
|
+
return b(r, e);
|
|
1737
1781
|
const n = Math.max(1, Math.floor(e / o)), l = [];
|
|
1738
1782
|
for (const i of s.values()) {
|
|
1739
|
-
const
|
|
1740
|
-
l.push(...
|
|
1783
|
+
const c = b(i, n);
|
|
1784
|
+
l.push(...c);
|
|
1741
1785
|
}
|
|
1742
|
-
if (
|
|
1743
|
-
const i =
|
|
1786
|
+
if (a.length > 0) {
|
|
1787
|
+
const i = b(a, n);
|
|
1744
1788
|
l.push(...i);
|
|
1745
1789
|
}
|
|
1746
1790
|
if (l.length < e) {
|
|
1747
|
-
const i =
|
|
1748
|
-
l.push(...
|
|
1791
|
+
const i = r.filter((u) => !l.includes(u)), c = b(i, e - l.length);
|
|
1792
|
+
l.push(...c);
|
|
1749
1793
|
}
|
|
1750
1794
|
return l.slice(0, e);
|
|
1751
1795
|
}
|
|
1752
|
-
const
|
|
1796
|
+
const Qe = {
|
|
1753
1797
|
name: "sampleData",
|
|
1754
1798
|
description: "Get sample nodes and/or edges from the graph to inspect actual data structures. Useful for understanding what properties exist and what values they contain before writing selectors.",
|
|
1755
|
-
parameters:
|
|
1756
|
-
target:
|
|
1757
|
-
count:
|
|
1758
|
-
stratifyBy:
|
|
1799
|
+
parameters: d.object({
|
|
1800
|
+
target: Je,
|
|
1801
|
+
count: d.number().min(1).max(z).optional().describe(`Number of samples to return per type (1-${z}, default ${j})`),
|
|
1802
|
+
stratifyBy: d.string().optional().describe("Property path to stratify sampling by (e.g., 'data.type' to sample from each type)")
|
|
1759
1803
|
}),
|
|
1760
1804
|
examples: [
|
|
1761
1805
|
{ input: "Show me some example nodes", params: { target: "nodes" } },
|
|
@@ -1766,36 +1810,36 @@ const Ze = {
|
|
|
1766
1810
|
params: { target: "nodes", count: 6, stratifyBy: "data.type" }
|
|
1767
1811
|
}
|
|
1768
1812
|
],
|
|
1769
|
-
execute(
|
|
1813
|
+
execute(r, e) {
|
|
1770
1814
|
const {
|
|
1771
1815
|
target: t = "both",
|
|
1772
|
-
count: s =
|
|
1773
|
-
stratifyBy:
|
|
1816
|
+
count: s = j,
|
|
1817
|
+
stratifyBy: a
|
|
1774
1818
|
} = e;
|
|
1775
1819
|
try {
|
|
1776
|
-
const o =
|
|
1820
|
+
const o = r.getDataManager(), n = {};
|
|
1777
1821
|
if (t === "nodes" || t === "both") {
|
|
1778
1822
|
const i = Array.from(o.nodes.values());
|
|
1779
|
-
let
|
|
1780
|
-
|
|
1781
|
-
const p =
|
|
1823
|
+
let c;
|
|
1824
|
+
a ? c = q(i, s, (u) => {
|
|
1825
|
+
const p = P(u.data, a);
|
|
1782
1826
|
return typeof p == "string" ? p : void 0;
|
|
1783
|
-
}) :
|
|
1784
|
-
id: String(
|
|
1785
|
-
data:
|
|
1827
|
+
}) : c = b(i, s), n.nodes = c.map((u) => ({
|
|
1828
|
+
id: String(u.id),
|
|
1829
|
+
data: $(u.data, U)
|
|
1786
1830
|
}));
|
|
1787
1831
|
}
|
|
1788
1832
|
if (t === "edges" || t === "both") {
|
|
1789
1833
|
const i = Array.from(o.edges.values());
|
|
1790
|
-
let
|
|
1791
|
-
|
|
1792
|
-
const p =
|
|
1834
|
+
let c;
|
|
1835
|
+
a ? c = q(i, s, (u) => {
|
|
1836
|
+
const p = P(u.data, a);
|
|
1793
1837
|
return typeof p == "string" ? p : void 0;
|
|
1794
|
-
}) :
|
|
1795
|
-
id:
|
|
1796
|
-
source: String(
|
|
1797
|
-
target: String(
|
|
1798
|
-
data:
|
|
1838
|
+
}) : c = b(i, s), n.edges = c.map((u) => ({
|
|
1839
|
+
id: u.id,
|
|
1840
|
+
source: String(u.srcId),
|
|
1841
|
+
target: String(u.dstId),
|
|
1842
|
+
data: $(u.data, U)
|
|
1799
1843
|
}));
|
|
1800
1844
|
}
|
|
1801
1845
|
const l = [];
|
|
@@ -1811,35 +1855,35 @@ const Ze = {
|
|
|
1811
1855
|
});
|
|
1812
1856
|
}
|
|
1813
1857
|
}
|
|
1814
|
-
},
|
|
1815
|
-
function
|
|
1858
|
+
}, V = 20, F = 50, et = 5;
|
|
1859
|
+
function tt(r, e, t, s, a) {
|
|
1816
1860
|
const o = t.filter((p) => typeof p == "string"), n = /* @__PURE__ */ new Map();
|
|
1817
1861
|
for (const p of o)
|
|
1818
1862
|
n.set(p, (n.get(p) ?? 0) + 1);
|
|
1819
|
-
const l = Array.from(n.entries()).sort((p, m) => m[1] - p[1]), i = l.length >
|
|
1820
|
-
for (const [p, m] of
|
|
1821
|
-
|
|
1863
|
+
const l = Array.from(n.entries()).sort((p, m) => m[1] - p[1]), i = l.length > a, c = l.slice(0, a), u = {};
|
|
1864
|
+
for (const [p, m] of c)
|
|
1865
|
+
u[p] = {
|
|
1822
1866
|
count: m,
|
|
1823
1867
|
percentage: m / o.length * 100
|
|
1824
1868
|
};
|
|
1825
1869
|
return {
|
|
1826
|
-
property:
|
|
1870
|
+
property: r,
|
|
1827
1871
|
target: e,
|
|
1828
1872
|
type: "string",
|
|
1829
1873
|
totalCount: o.length + s,
|
|
1830
1874
|
nullCount: s,
|
|
1831
1875
|
uniqueCount: n.size,
|
|
1832
|
-
distribution:
|
|
1876
|
+
distribution: u,
|
|
1833
1877
|
truncated: i
|
|
1834
1878
|
};
|
|
1835
1879
|
}
|
|
1836
|
-
function
|
|
1837
|
-
const
|
|
1880
|
+
function st(r, e, t, s) {
|
|
1881
|
+
const a = t.filter((l) => typeof l == "number"), o = X(a), n = Be(a, et);
|
|
1838
1882
|
return {
|
|
1839
|
-
property:
|
|
1883
|
+
property: r,
|
|
1840
1884
|
target: e,
|
|
1841
1885
|
type: "number",
|
|
1842
|
-
totalCount:
|
|
1886
|
+
totalCount: a.length + s,
|
|
1843
1887
|
nullCount: s,
|
|
1844
1888
|
statistics: {
|
|
1845
1889
|
min: o.min,
|
|
@@ -1853,43 +1897,43 @@ function Qe(a, e, t, s) {
|
|
|
1853
1897
|
}))
|
|
1854
1898
|
};
|
|
1855
1899
|
}
|
|
1856
|
-
function
|
|
1857
|
-
const
|
|
1900
|
+
function rt(r, e, t, s) {
|
|
1901
|
+
const a = t.filter((l) => typeof l == "boolean"), o = a.filter((l) => l).length, n = a.length - o;
|
|
1858
1902
|
return {
|
|
1859
|
-
property:
|
|
1903
|
+
property: r,
|
|
1860
1904
|
target: e,
|
|
1861
1905
|
type: "boolean",
|
|
1862
|
-
totalCount:
|
|
1906
|
+
totalCount: a.length + s,
|
|
1863
1907
|
nullCount: s,
|
|
1864
1908
|
distribution: {
|
|
1865
1909
|
true: {
|
|
1866
1910
|
count: o,
|
|
1867
|
-
percentage:
|
|
1911
|
+
percentage: a.length > 0 ? o / a.length * 100 : 0
|
|
1868
1912
|
},
|
|
1869
1913
|
false: {
|
|
1870
1914
|
count: n,
|
|
1871
|
-
percentage:
|
|
1915
|
+
percentage: a.length > 0 ? n / a.length * 100 : 0
|
|
1872
1916
|
}
|
|
1873
1917
|
}
|
|
1874
1918
|
};
|
|
1875
1919
|
}
|
|
1876
|
-
function
|
|
1920
|
+
function at(r, e, t, s, a) {
|
|
1877
1921
|
const o = t.filter((h) => Array.isArray(h)), n = [], l = [];
|
|
1878
1922
|
for (const h of o)
|
|
1879
1923
|
l.push(h.length), n.push(...h);
|
|
1880
|
-
const i =
|
|
1924
|
+
const i = Y(n), c = /* @__PURE__ */ new Set();
|
|
1881
1925
|
for (const h of n)
|
|
1882
|
-
typeof h == "string" ?
|
|
1883
|
-
const
|
|
1926
|
+
typeof h == "string" ? c.add(h) : typeof h == "number" || typeof h == "boolean" ? c.add(String(h)) : h != null && c.add(JSON.stringify(h));
|
|
1927
|
+
const u = Array.from(c), p = u.length > a, m = X(l);
|
|
1884
1928
|
return {
|
|
1885
|
-
property:
|
|
1929
|
+
property: r,
|
|
1886
1930
|
target: e,
|
|
1887
1931
|
type: "array",
|
|
1888
1932
|
totalCount: o.length + s,
|
|
1889
1933
|
nullCount: s,
|
|
1890
1934
|
itemType: i,
|
|
1891
|
-
uniqueItems:
|
|
1892
|
-
uniqueItemCount:
|
|
1935
|
+
uniqueItems: u.slice(0, a),
|
|
1936
|
+
uniqueItemCount: u.length,
|
|
1893
1937
|
lengthStatistics: {
|
|
1894
1938
|
min: m.min,
|
|
1895
1939
|
max: m.max,
|
|
@@ -1898,28 +1942,28 @@ function tt(a, e, t, s, r) {
|
|
|
1898
1942
|
truncated: p
|
|
1899
1943
|
};
|
|
1900
1944
|
}
|
|
1901
|
-
function
|
|
1902
|
-
const
|
|
1945
|
+
function ot(r, e, t, s) {
|
|
1946
|
+
const a = {};
|
|
1903
1947
|
for (const o of t) {
|
|
1904
1948
|
const n = typeof o;
|
|
1905
|
-
Array.isArray(o) ?
|
|
1949
|
+
Array.isArray(o) ? a.array = (a.array || 0) + 1 : n === "object" && o !== null ? a.object = (a.object || 0) + 1 : (n === "string" || n === "number" || n === "boolean") && (a[n] = (a[n] || 0) + 1);
|
|
1906
1950
|
}
|
|
1907
1951
|
return {
|
|
1908
|
-
property:
|
|
1952
|
+
property: r,
|
|
1909
1953
|
target: e,
|
|
1910
1954
|
type: "mixed",
|
|
1911
1955
|
totalCount: t.length + s,
|
|
1912
1956
|
nullCount: s,
|
|
1913
|
-
typeCounts:
|
|
1957
|
+
typeCounts: a
|
|
1914
1958
|
};
|
|
1915
1959
|
}
|
|
1916
|
-
const
|
|
1960
|
+
const nt = {
|
|
1917
1961
|
name: "describeProperty",
|
|
1918
1962
|
description: "Get detailed information about a specific property in node or edge data. Returns value distributions for strings, statistics for numbers, counts for booleans, and unique items for arrays.",
|
|
1919
|
-
parameters:
|
|
1920
|
-
property:
|
|
1921
|
-
target:
|
|
1922
|
-
limit:
|
|
1963
|
+
parameters: d.object({
|
|
1964
|
+
property: d.string().describe("Property path to analyze (e.g., 'type', 'data.category', 'weight')"),
|
|
1965
|
+
target: d.enum(["nodes", "edges"]).optional().describe("Whether to analyze node or edge properties (default: 'nodes')"),
|
|
1966
|
+
limit: d.number().min(1).max(F).optional().describe(`Maximum number of unique values to show (1-${F}, default ${V})`)
|
|
1923
1967
|
}),
|
|
1924
1968
|
examples: [
|
|
1925
1969
|
{ input: "Describe the type property on nodes", params: { property: "type", target: "nodes" } },
|
|
@@ -1930,22 +1974,22 @@ const rt = {
|
|
|
1930
1974
|
{ input: "Show me the distribution of data.category", params: { property: "data.category" } },
|
|
1931
1975
|
{ input: "Analyze the tags property", params: { property: "tags", limit: 10 } }
|
|
1932
1976
|
],
|
|
1933
|
-
execute(
|
|
1977
|
+
execute(r, e) {
|
|
1934
1978
|
const {
|
|
1935
1979
|
property: t,
|
|
1936
1980
|
target: s = "nodes",
|
|
1937
|
-
limit:
|
|
1981
|
+
limit: a = V
|
|
1938
1982
|
} = e;
|
|
1939
1983
|
try {
|
|
1940
|
-
const o =
|
|
1984
|
+
const o = r.getDataManager(), n = Array.from(s === "nodes" ? o.nodes.values() : o.edges.values());
|
|
1941
1985
|
if (n.length === 0)
|
|
1942
1986
|
return Promise.resolve({
|
|
1943
1987
|
success: !1,
|
|
1944
1988
|
message: `No ${s} found in the graph.`
|
|
1945
1989
|
});
|
|
1946
|
-
const { values: l, nullCount: i } =
|
|
1990
|
+
const { values: l, nullCount: i } = Ye(n, t);
|
|
1947
1991
|
if (l.length === 0 && i === n.length) {
|
|
1948
|
-
const m =
|
|
1992
|
+
const m = Ze(n);
|
|
1949
1993
|
return Promise.resolve({
|
|
1950
1994
|
success: !1,
|
|
1951
1995
|
message: `Property "${t}" not found on ${s}. Available properties: ${m.slice(0, 10).join(", ")}${m.length > 10 ? "..." : ""}`,
|
|
@@ -1954,23 +1998,23 @@ const rt = {
|
|
|
1954
1998
|
}
|
|
1955
1999
|
});
|
|
1956
2000
|
}
|
|
1957
|
-
const
|
|
1958
|
-
let
|
|
1959
|
-
switch (
|
|
2001
|
+
const c = Y(l);
|
|
2002
|
+
let u;
|
|
2003
|
+
switch (c) {
|
|
1960
2004
|
case "string":
|
|
1961
|
-
|
|
2005
|
+
u = tt(t, s, l, i, a);
|
|
1962
2006
|
break;
|
|
1963
2007
|
case "number":
|
|
1964
|
-
|
|
2008
|
+
u = st(t, s, l, i);
|
|
1965
2009
|
break;
|
|
1966
2010
|
case "boolean":
|
|
1967
|
-
|
|
2011
|
+
u = rt(t, s, l, i);
|
|
1968
2012
|
break;
|
|
1969
2013
|
case "array":
|
|
1970
|
-
|
|
2014
|
+
u = at(t, s, l, i, a);
|
|
1971
2015
|
break;
|
|
1972
2016
|
case "mixed":
|
|
1973
|
-
|
|
2017
|
+
u = ot(t, s, l, i);
|
|
1974
2018
|
break;
|
|
1975
2019
|
default:
|
|
1976
2020
|
return Promise.resolve({
|
|
@@ -1979,29 +2023,29 @@ const rt = {
|
|
|
1979
2023
|
});
|
|
1980
2024
|
}
|
|
1981
2025
|
let p;
|
|
1982
|
-
switch (
|
|
2026
|
+
switch (c) {
|
|
1983
2027
|
case "string": {
|
|
1984
|
-
const m =
|
|
2028
|
+
const m = u;
|
|
1985
2029
|
p = `Property "${t}" is a string with ${m.uniqueCount} unique value${m.uniqueCount !== 1 ? "s" : ""}.`;
|
|
1986
2030
|
break;
|
|
1987
2031
|
}
|
|
1988
2032
|
case "number": {
|
|
1989
|
-
const m =
|
|
2033
|
+
const m = u;
|
|
1990
2034
|
p = `Property "${t}" is a number (min: ${m.statistics.min.toFixed(2)}, max: ${m.statistics.max.toFixed(2)}, avg: ${m.statistics.avg.toFixed(2)}).`;
|
|
1991
2035
|
break;
|
|
1992
2036
|
}
|
|
1993
2037
|
case "boolean": {
|
|
1994
|
-
const m =
|
|
2038
|
+
const m = u;
|
|
1995
2039
|
p = `Property "${t}" is a boolean (true: ${m.distribution.true.percentage.toFixed(1)}%, false: ${m.distribution.false.percentage.toFixed(1)}%).`;
|
|
1996
2040
|
break;
|
|
1997
2041
|
}
|
|
1998
2042
|
case "array": {
|
|
1999
|
-
const m =
|
|
2043
|
+
const m = u;
|
|
2000
2044
|
p = `Property "${t}" is an array of ${m.itemType} values with ${m.uniqueItemCount} unique item${m.uniqueItemCount !== 1 ? "s" : ""}.`;
|
|
2001
2045
|
break;
|
|
2002
2046
|
}
|
|
2003
2047
|
case "mixed": {
|
|
2004
|
-
const h = Object.keys(
|
|
2048
|
+
const h = Object.keys(u.typeCounts).join(", ");
|
|
2005
2049
|
p = `Property "${t}" has mixed types: ${h}.`;
|
|
2006
2050
|
break;
|
|
2007
2051
|
}
|
|
@@ -2011,7 +2055,7 @@ const rt = {
|
|
|
2011
2055
|
return Promise.resolve({
|
|
2012
2056
|
success: !0,
|
|
2013
2057
|
message: p,
|
|
2014
|
-
data:
|
|
2058
|
+
data: u
|
|
2015
2059
|
});
|
|
2016
2060
|
} catch (o) {
|
|
2017
2061
|
return Promise.resolve({
|
|
@@ -2021,7 +2065,7 @@ const rt = {
|
|
|
2021
2065
|
}
|
|
2022
2066
|
}
|
|
2023
2067
|
};
|
|
2024
|
-
class
|
|
2068
|
+
class it {
|
|
2025
2069
|
constructor() {
|
|
2026
2070
|
this.name = "mock", this.supportsStreaming = !0, this.supportsTools = !0, this.responses = /* @__PURE__ */ new Map(), this.defaultResponse = {
|
|
2027
2071
|
text: "This is a mock response.",
|
|
@@ -2088,12 +2132,12 @@ class at {
|
|
|
2088
2132
|
* @returns Matching response or default response
|
|
2089
2133
|
*/
|
|
2090
2134
|
findResponse(e) {
|
|
2091
|
-
const t = [...e].reverse().find((
|
|
2135
|
+
const t = [...e].reverse().find((a) => a.role === "user");
|
|
2092
2136
|
if (!t)
|
|
2093
2137
|
return this.defaultResponse;
|
|
2094
2138
|
const s = t.content.toLowerCase();
|
|
2095
|
-
for (const [
|
|
2096
|
-
if (s.includes(
|
|
2139
|
+
for (const [a, o] of this.responses)
|
|
2140
|
+
if (s.includes(a))
|
|
2097
2141
|
return o;
|
|
2098
2142
|
return this.defaultResponse;
|
|
2099
2143
|
}
|
|
@@ -2115,7 +2159,7 @@ class at {
|
|
|
2115
2159
|
throw new Error("Request was aborted");
|
|
2116
2160
|
if (this.configuredError)
|
|
2117
2161
|
throw this.configuredError;
|
|
2118
|
-
if (this.delay > 0 && await new Promise((
|
|
2162
|
+
if (this.delay > 0 && await new Promise((a) => setTimeout(a, this.delay)), s?.signal?.aborted)
|
|
2119
2163
|
throw new Error("Request was aborted");
|
|
2120
2164
|
return this.findResponse(e);
|
|
2121
2165
|
}
|
|
@@ -2127,24 +2171,24 @@ class at {
|
|
|
2127
2171
|
* @param callbacks - Streaming callbacks for text and tool calls
|
|
2128
2172
|
* @param signal - Optional abort signal
|
|
2129
2173
|
*/
|
|
2130
|
-
async generateStream(e, t, s,
|
|
2174
|
+
async generateStream(e, t, s, a) {
|
|
2131
2175
|
if (this.callHistory.push({
|
|
2132
2176
|
messages: e,
|
|
2133
2177
|
tools: t,
|
|
2134
2178
|
streaming: !0,
|
|
2135
2179
|
timestamp: Date.now()
|
|
2136
|
-
}),
|
|
2180
|
+
}), a?.aborted)
|
|
2137
2181
|
throw new Error("Request was aborted");
|
|
2138
2182
|
if (this.configuredError)
|
|
2139
2183
|
throw s.onError(this.configuredError), this.configuredError;
|
|
2140
2184
|
const o = this.findResponse(e), { text: n } = o;
|
|
2141
2185
|
for (const l of n) {
|
|
2142
|
-
if (
|
|
2186
|
+
if (a?.aborted)
|
|
2143
2187
|
throw new Error("Request was aborted");
|
|
2144
2188
|
s.onChunk(l), this.delay > 0 && await new Promise((i) => setTimeout(i, this.delay / n.length));
|
|
2145
2189
|
}
|
|
2146
2190
|
for (const l of o.toolCalls) {
|
|
2147
|
-
if (
|
|
2191
|
+
if (a?.aborted)
|
|
2148
2192
|
throw new Error("Request was aborted");
|
|
2149
2193
|
s.onToolCall(l.name, l.arguments);
|
|
2150
2194
|
}
|
|
@@ -2163,7 +2207,7 @@ class at {
|
|
|
2163
2207
|
return Promise.resolve(!0);
|
|
2164
2208
|
}
|
|
2165
2209
|
}
|
|
2166
|
-
class
|
|
2210
|
+
class lt {
|
|
2167
2211
|
/**
|
|
2168
2212
|
* Creates a new VercelAiProvider instance.
|
|
2169
2213
|
* @param providerType - Type of provider (openai, anthropic, or google)
|
|
@@ -2187,9 +2231,9 @@ class ot {
|
|
|
2187
2231
|
throw new Error(`API key not configured for ${this.name}`);
|
|
2188
2232
|
switch (this.providerType) {
|
|
2189
2233
|
case "openai":
|
|
2190
|
-
return
|
|
2234
|
+
return de({ apiKey: this.apiKey, baseURL: this.baseUrl })(this.model ?? "gpt-4o");
|
|
2191
2235
|
case "anthropic":
|
|
2192
|
-
return
|
|
2236
|
+
return ce({
|
|
2193
2237
|
apiKey: this.apiKey,
|
|
2194
2238
|
baseURL: this.baseUrl,
|
|
2195
2239
|
// Enable browser support - Anthropic requires this header for CORS
|
|
@@ -2198,7 +2242,7 @@ class ot {
|
|
|
2198
2242
|
}
|
|
2199
2243
|
})(this.model ?? "claude-3-haiku-20240307");
|
|
2200
2244
|
default:
|
|
2201
|
-
return
|
|
2245
|
+
return ue({ apiKey: this.apiKey, baseURL: this.baseUrl })(this.model ?? "gemini-2.0-flash");
|
|
2202
2246
|
}
|
|
2203
2247
|
}
|
|
2204
2248
|
/**
|
|
@@ -2210,8 +2254,8 @@ class ot {
|
|
|
2210
2254
|
* @returns Promise resolving to LLM response
|
|
2211
2255
|
*/
|
|
2212
2256
|
async generate(e, t, s) {
|
|
2213
|
-
const
|
|
2214
|
-
model:
|
|
2257
|
+
const a = this.getModel(), o = this.convertMessages(e), n = this.convertTools(t), l = await me({
|
|
2258
|
+
model: a,
|
|
2215
2259
|
messages: o,
|
|
2216
2260
|
tools: n,
|
|
2217
2261
|
maxOutputTokens: this.maxTokens,
|
|
@@ -2231,22 +2275,22 @@ class ot {
|
|
|
2231
2275
|
* @param callbacks - Streaming callbacks for text and tool calls
|
|
2232
2276
|
* @param signal - Optional abort signal
|
|
2233
2277
|
*/
|
|
2234
|
-
async generateStream(e, t, s,
|
|
2235
|
-
const o = this.getModel(), n = this.convertMessages(e), l = this.convertTools(t), i =
|
|
2278
|
+
async generateStream(e, t, s, a) {
|
|
2279
|
+
const o = this.getModel(), n = this.convertMessages(e), l = this.convertTools(t), i = pe({
|
|
2236
2280
|
model: o,
|
|
2237
2281
|
messages: n,
|
|
2238
2282
|
tools: l,
|
|
2239
2283
|
maxOutputTokens: this.maxTokens,
|
|
2240
2284
|
temperature: this.temperature,
|
|
2241
|
-
abortSignal:
|
|
2285
|
+
abortSignal: a
|
|
2242
2286
|
});
|
|
2243
|
-
let
|
|
2244
|
-
const
|
|
2287
|
+
let c = "";
|
|
2288
|
+
const u = [];
|
|
2245
2289
|
try {
|
|
2246
2290
|
for await (const m of i.fullStream)
|
|
2247
2291
|
switch (m.type) {
|
|
2248
2292
|
case "text-delta":
|
|
2249
|
-
|
|
2293
|
+
c += m.text, s.onChunk(m.text);
|
|
2250
2294
|
break;
|
|
2251
2295
|
case "tool-call": {
|
|
2252
2296
|
let h = {};
|
|
@@ -2256,7 +2300,7 @@ class ot {
|
|
|
2256
2300
|
name: m.toolName,
|
|
2257
2301
|
arguments: h
|
|
2258
2302
|
};
|
|
2259
|
-
|
|
2303
|
+
u.push(g), s.onToolCall(m.toolName, h);
|
|
2260
2304
|
break;
|
|
2261
2305
|
}
|
|
2262
2306
|
case "tool-result": {
|
|
@@ -2272,8 +2316,8 @@ class ot {
|
|
|
2272
2316
|
}
|
|
2273
2317
|
const p = await i.usage;
|
|
2274
2318
|
s.onComplete({
|
|
2275
|
-
text:
|
|
2276
|
-
toolCalls:
|
|
2319
|
+
text: c,
|
|
2320
|
+
toolCalls: u,
|
|
2277
2321
|
usage: p.inputTokens !== void 0 && p.outputTokens !== void 0 ? { promptTokens: p.inputTokens, completionTokens: p.outputTokens } : void 0
|
|
2278
2322
|
});
|
|
2279
2323
|
} catch (p) {
|
|
@@ -2366,75 +2410,75 @@ class ot {
|
|
|
2366
2410
|
}
|
|
2367
2411
|
}
|
|
2368
2412
|
}
|
|
2369
|
-
async function
|
|
2413
|
+
async function ct() {
|
|
2370
2414
|
return (await import("./WebLlmProvider-BEFvNcC5.js")).WebLlmProvider;
|
|
2371
2415
|
}
|
|
2372
|
-
function
|
|
2373
|
-
if (
|
|
2374
|
-
return new
|
|
2375
|
-
if (
|
|
2416
|
+
function ut(r) {
|
|
2417
|
+
if (r === "mock")
|
|
2418
|
+
return new it();
|
|
2419
|
+
if (r === "webllm")
|
|
2376
2420
|
throw new Error(
|
|
2377
2421
|
"WebLlmProvider cannot be created synchronously. Use createWebLlmProvider() or getWebLlmProviderClass() instead."
|
|
2378
2422
|
);
|
|
2379
|
-
return new
|
|
2423
|
+
return new lt(r);
|
|
2380
2424
|
}
|
|
2381
|
-
async function
|
|
2382
|
-
const
|
|
2383
|
-
return new
|
|
2425
|
+
async function Lt() {
|
|
2426
|
+
const r = await ct();
|
|
2427
|
+
return new r();
|
|
2384
2428
|
}
|
|
2385
|
-
const
|
|
2386
|
-
function
|
|
2429
|
+
const x = 10, O = 50;
|
|
2430
|
+
function dt(r) {
|
|
2387
2431
|
const e = [];
|
|
2388
|
-
return e.push(
|
|
2389
|
-
No custom properties on node data.`),
|
|
2432
|
+
return e.push(mt(r)), r.nodeProperties.length > 0 ? e.push(pt(r.nodeProperties)) : r.nodeCount > 0 && e.push(`### Node Properties
|
|
2433
|
+
No custom properties on node data.`), r.edgeProperties.length > 0 ? e.push(ht(r.edgeProperties)) : r.edgeCount > 0 && e.push(`### Edge Properties
|
|
2390
2434
|
No custom properties on edge data.`), e.join(`
|
|
2391
2435
|
|
|
2392
2436
|
`);
|
|
2393
2437
|
}
|
|
2394
|
-
function
|
|
2438
|
+
function mt(r) {
|
|
2395
2439
|
return `## Data Schema
|
|
2396
|
-
- Nodes: ${
|
|
2397
|
-
- Edges: ${
|
|
2440
|
+
- Nodes: ${r.nodeCount}
|
|
2441
|
+
- Edges: ${r.edgeCount}`;
|
|
2398
2442
|
}
|
|
2399
|
-
function
|
|
2443
|
+
function pt(r) {
|
|
2400
2444
|
const e = ["### Node Properties"];
|
|
2401
|
-
for (const t of
|
|
2402
|
-
e.push(
|
|
2445
|
+
for (const t of r)
|
|
2446
|
+
e.push(J(t));
|
|
2403
2447
|
return e.join(`
|
|
2404
2448
|
`);
|
|
2405
2449
|
}
|
|
2406
|
-
function
|
|
2450
|
+
function ht(r) {
|
|
2407
2451
|
const e = ["### Edge Properties"];
|
|
2408
|
-
for (const t of
|
|
2409
|
-
e.push(
|
|
2452
|
+
for (const t of r)
|
|
2453
|
+
e.push(J(t));
|
|
2410
2454
|
return e.join(`
|
|
2411
2455
|
`);
|
|
2412
2456
|
}
|
|
2413
|
-
function
|
|
2414
|
-
const e =
|
|
2415
|
-
return `- \`${e}\`: ${s}${t}${
|
|
2457
|
+
function J(r) {
|
|
2458
|
+
const e = vt(r.name), t = r.nullable ? "?" : "", s = gt(r), a = ft(r);
|
|
2459
|
+
return `- \`${e}\`: ${s}${t}${a}`;
|
|
2416
2460
|
}
|
|
2417
|
-
function
|
|
2418
|
-
return
|
|
2461
|
+
function gt(r) {
|
|
2462
|
+
return r.type === "array" && r.itemType ? `${r.itemType}[]` : r.type;
|
|
2419
2463
|
}
|
|
2420
|
-
function
|
|
2464
|
+
function ft(r) {
|
|
2421
2465
|
const e = [];
|
|
2422
|
-
if (
|
|
2423
|
-
const t =
|
|
2466
|
+
if (r.format && e.push(`format: ${r.format}`), r.enumValues && r.enumValues.length > 0) {
|
|
2467
|
+
const t = yt(r.enumValues);
|
|
2424
2468
|
e.push(`values: [${t}]`);
|
|
2425
2469
|
}
|
|
2426
|
-
return
|
|
2470
|
+
return r.range && e.push(`range: ${r.range.min}..${r.range.max}`), e.length === 0 ? "" : ` (${e.join(", ")})`;
|
|
2427
2471
|
}
|
|
2428
|
-
function
|
|
2429
|
-
if (
|
|
2430
|
-
return
|
|
2431
|
-
const e =
|
|
2472
|
+
function yt(r) {
|
|
2473
|
+
if (r.length <= x)
|
|
2474
|
+
return r.map((s) => `"${s}"`).join(", ");
|
|
2475
|
+
const e = r.slice(0, x), t = r.length - x;
|
|
2432
2476
|
return `${e.map((s) => `"${s}"`).join(", ")}, ... +${t} more`;
|
|
2433
2477
|
}
|
|
2434
|
-
function
|
|
2435
|
-
return
|
|
2478
|
+
function vt(r) {
|
|
2479
|
+
return r.length <= O ? r : `${r.slice(0, O - 3)}...`;
|
|
2436
2480
|
}
|
|
2437
|
-
class
|
|
2481
|
+
class bt {
|
|
2438
2482
|
/**
|
|
2439
2483
|
* Create a new SchemaManager.
|
|
2440
2484
|
* @param graph - The graph to extract schema from
|
|
@@ -2451,7 +2495,7 @@ class ft {
|
|
|
2451
2495
|
*/
|
|
2452
2496
|
extract() {
|
|
2453
2497
|
if (this.cachedSchema === null) {
|
|
2454
|
-
const e = new
|
|
2498
|
+
const e = new W(this.graph, this.options);
|
|
2455
2499
|
this.cachedSchema = e.extract();
|
|
2456
2500
|
}
|
|
2457
2501
|
return this.cachedSchema;
|
|
@@ -2472,7 +2516,7 @@ class ft {
|
|
|
2472
2516
|
getFormattedSchema() {
|
|
2473
2517
|
if (this.cachedFormattedSchema === null) {
|
|
2474
2518
|
const e = this.extract();
|
|
2475
|
-
this.cachedFormattedSchema =
|
|
2519
|
+
this.cachedFormattedSchema = dt(e);
|
|
2476
2520
|
}
|
|
2477
2521
|
return this.cachedFormattedSchema;
|
|
2478
2522
|
}
|
|
@@ -2486,13 +2530,13 @@ class ft {
|
|
|
2486
2530
|
this.cachedSchema = null, this.cachedFormattedSchema = null;
|
|
2487
2531
|
}
|
|
2488
2532
|
}
|
|
2489
|
-
const
|
|
2490
|
-
class
|
|
2533
|
+
const wt = 300;
|
|
2534
|
+
class Q {
|
|
2491
2535
|
/**
|
|
2492
2536
|
* Creates a new AiManager instance.
|
|
2493
2537
|
*/
|
|
2494
2538
|
constructor() {
|
|
2495
|
-
this.graph = null, this.controller = null, this.provider = null, this.schemaManager = null, this.dataAddedListenerId = null, this.debouncedSchemaUpdate = null, this.disposed = !1, this.initialized = !1, this.commandRegistry = new
|
|
2539
|
+
this.graph = null, this.controller = null, this.provider = null, this.schemaManager = null, this.dataAddedListenerId = null, this.debouncedSchemaUpdate = null, this.disposed = !1, this.initialized = !1, this.commandRegistry = new fe(), this.apiKeyManager = new he(), this.statusManager = new K();
|
|
2496
2540
|
}
|
|
2497
2541
|
/**
|
|
2498
2542
|
* Initialize the AI Manager with a graph and configuration.
|
|
@@ -2504,10 +2548,10 @@ class Z {
|
|
|
2504
2548
|
encryptionKey: t.keyPersistence.encryptionKey,
|
|
2505
2549
|
storage: t.keyPersistence.storage ?? "localStorage",
|
|
2506
2550
|
prefix: t.keyPersistence.prefix
|
|
2507
|
-
}), t.providerInstance ? this.provider = t.providerInstance : (this.provider =
|
|
2551
|
+
}), t.providerInstance ? this.provider = t.providerInstance : (this.provider = ut(t.provider), t.apiKey && (this.apiKeyManager.setKey(t.provider, t.apiKey), this.provider.configure({
|
|
2508
2552
|
apiKey: t.apiKey,
|
|
2509
2553
|
model: t.model
|
|
2510
|
-
}))), t.registerBuiltinCommands !== !1 && this.registerBuiltinCommands(), this.initializeSchemaManager(), this.controller = new
|
|
2554
|
+
}))), t.registerBuiltinCommands !== !1 && this.registerBuiltinCommands(), this.initializeSchemaManager(), this.controller = new ge({
|
|
2511
2555
|
provider: this.provider,
|
|
2512
2556
|
commandRegistry: this.commandRegistry,
|
|
2513
2557
|
graph: this.graph,
|
|
@@ -2524,9 +2568,9 @@ class Z {
|
|
|
2524
2568
|
*/
|
|
2525
2569
|
initializeSchemaManager() {
|
|
2526
2570
|
if (this.graph) {
|
|
2527
|
-
this.schemaManager = new
|
|
2571
|
+
this.schemaManager = new bt(this.graph), this.schemaManager.extract(), this.debouncedSchemaUpdate = ee.debounce(() => {
|
|
2528
2572
|
this.schemaManager && this.schemaManager.invalidateCache();
|
|
2529
|
-
},
|
|
2573
|
+
}, wt);
|
|
2530
2574
|
try {
|
|
2531
2575
|
const { eventManager: e } = this.graph;
|
|
2532
2576
|
this.dataAddedListenerId = e.addListener("data-added", () => {
|
|
@@ -2540,10 +2584,17 @@ class Z {
|
|
|
2540
2584
|
* Register built-in commands for graph control.
|
|
2541
2585
|
*/
|
|
2542
2586
|
registerBuiltinCommands() {
|
|
2543
|
-
this.registerCommand(
|
|
2587
|
+
this.registerCommand(we), this.registerCommand(Ce), this.registerCommand(xe), this.registerCommand(Qe), this.registerCommand(nt), this.registerCommand(Ge), this.registerCommand(We), this.registerCommand(Ee), this.registerCommand(Ae), this.registerCommand(Ne), this.registerCommand(Ue), this.registerCommand(qe), this.registerCommand(Ve), this.registerCommand(Oe), this.registerCommand(Ke);
|
|
2544
2588
|
}
|
|
2545
2589
|
/**
|
|
2546
2590
|
* Register a custom command.
|
|
2591
|
+
*
|
|
2592
|
+
* Each assistant message is one undoable step. A command joins it by writing through
|
|
2593
|
+
* `ctx.tx` (`ctx.tx.styles.add`, `ctx.tx.layout.set`, `ctx.tx.run`): those changes are undone
|
|
2594
|
+
* with the rest of the message, and rolled back if a command throws. A change made through
|
|
2595
|
+
* `ctx.graph` is a step of its own and is not rolled back. A command stops when
|
|
2596
|
+
* `ctx.abortSignal` fires, which happens when the message is cancelled or undone while it is
|
|
2597
|
+
* still going.
|
|
2547
2598
|
* @param command - The command to register
|
|
2548
2599
|
*/
|
|
2549
2600
|
registerCommand(e) {
|
|
@@ -2668,41 +2719,41 @@ class Z {
|
|
|
2668
2719
|
}
|
|
2669
2720
|
}
|
|
2670
2721
|
}
|
|
2671
|
-
function
|
|
2672
|
-
return new
|
|
2722
|
+
function St() {
|
|
2723
|
+
return new Q();
|
|
2673
2724
|
}
|
|
2674
|
-
const
|
|
2725
|
+
const jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2675
2726
|
__proto__: null,
|
|
2676
|
-
AiManager:
|
|
2677
|
-
createAiManager:
|
|
2727
|
+
AiManager: Q,
|
|
2728
|
+
createAiManager: St
|
|
2678
2729
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2679
2730
|
export {
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2731
|
+
ge as A,
|
|
2732
|
+
fe as C,
|
|
2733
|
+
it as M,
|
|
2734
|
+
W as S,
|
|
2735
|
+
lt as V,
|
|
2736
|
+
Q as a,
|
|
2737
|
+
K as b,
|
|
2738
|
+
bt as c,
|
|
2739
|
+
Ve as d,
|
|
2740
|
+
St as e,
|
|
2741
|
+
dt as f,
|
|
2742
|
+
ut as g,
|
|
2743
|
+
Lt as h,
|
|
2744
|
+
nt as i,
|
|
2745
|
+
qe as j,
|
|
2746
|
+
Ue as k,
|
|
2747
|
+
Ce as l,
|
|
2748
|
+
ct as m,
|
|
2749
|
+
Ge as n,
|
|
2750
|
+
Oe as o,
|
|
2751
|
+
Ae as p,
|
|
2752
|
+
we as q,
|
|
2753
|
+
We as r,
|
|
2754
|
+
Qe as s,
|
|
2755
|
+
Ne as t,
|
|
2756
|
+
Ee as u,
|
|
2757
|
+
jt as v,
|
|
2758
|
+
Ke as z
|
|
2708
2759
|
};
|