@graphrefly/graphrefly 0.9.0 → 0.10.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/compat/nestjs/index.js +2 -2
- package/dist/index.cjs +2246 -1397
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +217 -2
- package/dist/index.d.ts +217 -2
- package/dist/index.js +1418 -570
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1329,6 +1329,220 @@ declare namespace demoShell$1 {
|
|
|
1329
1329
|
export { type demoShell$1_DemoShellHandle as DemoShellHandle, type demoShell$1_DemoShellOptions as DemoShellOptions, type demoShell$1_FullscreenPane as FullscreenPane, type demoShell$1_GraphLabelSize as GraphLabelSize, type demoShell$1_HighlightCallbacks as HighlightCallbacks, type demoShell$1_HoverPaneType as HoverPaneType, type demoShell$1_HoverTarget as HoverTarget, type demoShell$1_NodeRegistry as NodeRegistry, demoShell$1_demoShell as demoShell };
|
|
1330
1330
|
}
|
|
1331
1331
|
|
|
1332
|
+
/**
|
|
1333
|
+
* LLM graph composition (roadmap §8.3).
|
|
1334
|
+
*
|
|
1335
|
+
* Declarative GraphSpec schema + compiler/decompiler for graph topology.
|
|
1336
|
+
* The LLM designs graphs as JSON; compileSpec instantiates them; decompileGraph
|
|
1337
|
+
* extracts them back. Templates support reusable subgraph patterns. Feedback
|
|
1338
|
+
* edges express bounded cycles via §8.1 feedback().
|
|
1339
|
+
*
|
|
1340
|
+
* @module
|
|
1341
|
+
*/
|
|
1342
|
+
|
|
1343
|
+
/** A single node declaration in a GraphSpec. */
|
|
1344
|
+
type GraphSpecNode = {
|
|
1345
|
+
/** Node kind: state, producer, derived, effect, operator. */
|
|
1346
|
+
type: "state" | "producer" | "derived" | "effect" | "operator";
|
|
1347
|
+
/** Dependency node names (for derived/effect/operator). */
|
|
1348
|
+
deps?: string[];
|
|
1349
|
+
/** Named function from the catalog (for derived/effect/operator/producer). */
|
|
1350
|
+
fn?: string;
|
|
1351
|
+
/** Named source from the catalog (for producer). */
|
|
1352
|
+
source?: string;
|
|
1353
|
+
/** Freeform config passed to the catalog fn/source factory. */
|
|
1354
|
+
config?: Record<string, unknown>;
|
|
1355
|
+
/** Initial value (for state nodes). */
|
|
1356
|
+
initial?: unknown;
|
|
1357
|
+
/** Human/LLM-readable metadata. */
|
|
1358
|
+
meta?: Record<string, unknown>;
|
|
1359
|
+
};
|
|
1360
|
+
/** Template instantiation node — expanded at compile time. */
|
|
1361
|
+
type GraphSpecTemplateRef = {
|
|
1362
|
+
type: "template";
|
|
1363
|
+
/** Name of the template to instantiate. */
|
|
1364
|
+
template: string;
|
|
1365
|
+
/** Parameter bindings: template param name → node name. */
|
|
1366
|
+
bind: Record<string, string>;
|
|
1367
|
+
};
|
|
1368
|
+
/** A reusable subgraph pattern with parameter substitution. */
|
|
1369
|
+
type GraphSpecTemplate = {
|
|
1370
|
+
/** Parameter names (prefixed with $ in node refs). */
|
|
1371
|
+
params: string[];
|
|
1372
|
+
/** Node declarations within the template. */
|
|
1373
|
+
nodes: Record<string, GraphSpecNode>;
|
|
1374
|
+
/** Which node's output is the template's output. */
|
|
1375
|
+
output: string;
|
|
1376
|
+
};
|
|
1377
|
+
/** A feedback edge: bounded cycle from condition to reentry. */
|
|
1378
|
+
type GraphSpecFeedbackEdge = {
|
|
1379
|
+
/** Node whose DATA triggers the feedback. */
|
|
1380
|
+
from: string;
|
|
1381
|
+
/** State node that receives the feedback value. */
|
|
1382
|
+
to: string;
|
|
1383
|
+
/** Max iterations before stopping (default: 10). */
|
|
1384
|
+
maxIterations?: number;
|
|
1385
|
+
};
|
|
1386
|
+
/** Declarative graph topology for LLM composition (§8.3). */
|
|
1387
|
+
type GraphSpec = {
|
|
1388
|
+
/** Graph name. */
|
|
1389
|
+
name: string;
|
|
1390
|
+
/** Node declarations (keyed by node name). */
|
|
1391
|
+
nodes: Record<string, GraphSpecNode | GraphSpecTemplateRef>;
|
|
1392
|
+
/** Reusable subgraph templates. */
|
|
1393
|
+
templates?: Record<string, GraphSpecTemplate>;
|
|
1394
|
+
/** Feedback edges (bounded cycles). */
|
|
1395
|
+
feedback?: GraphSpecFeedbackEdge[];
|
|
1396
|
+
};
|
|
1397
|
+
/**
|
|
1398
|
+
* Factory for creating a derived/effect/operator node from catalog.
|
|
1399
|
+
* Receives resolved dep nodes and the config from the spec.
|
|
1400
|
+
*/
|
|
1401
|
+
type FnFactory = (deps: Node<unknown>[], config: Record<string, unknown>) => Node<unknown>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Factory for creating a producer node from catalog.
|
|
1404
|
+
* Receives the config from the spec.
|
|
1405
|
+
*/
|
|
1406
|
+
type SourceFactory = (config: Record<string, unknown>) => Node<unknown>;
|
|
1407
|
+
/** Fn/source lookup table passed to compileSpec. */
|
|
1408
|
+
type GraphSpecCatalog = {
|
|
1409
|
+
fns?: Record<string, FnFactory>;
|
|
1410
|
+
sources?: Record<string, SourceFactory>;
|
|
1411
|
+
};
|
|
1412
|
+
/** Validation result from {@link validateSpec}. */
|
|
1413
|
+
type GraphSpecValidation = {
|
|
1414
|
+
valid: boolean;
|
|
1415
|
+
errors: string[];
|
|
1416
|
+
};
|
|
1417
|
+
/**
|
|
1418
|
+
* Validate a GraphSpec JSON object.
|
|
1419
|
+
*
|
|
1420
|
+
* Checks structural validity: required fields, node types, dep references,
|
|
1421
|
+
* template references, feedback edge targets, self-cycles, and bind completeness.
|
|
1422
|
+
*/
|
|
1423
|
+
declare function validateSpec(spec: unknown): GraphSpecValidation;
|
|
1424
|
+
/** Options for {@link compileSpec}. */
|
|
1425
|
+
type CompileSpecOptions = {
|
|
1426
|
+
/** Fn/source catalog for resolving named factories. */
|
|
1427
|
+
catalog?: GraphSpecCatalog;
|
|
1428
|
+
};
|
|
1429
|
+
/**
|
|
1430
|
+
* Instantiate a Graph from a GraphSpec.
|
|
1431
|
+
*
|
|
1432
|
+
* Handles template expansion (mounted subgraphs), feedback wiring via §8.1
|
|
1433
|
+
* feedback(), node factory lookup from the catalog, and topology validation.
|
|
1434
|
+
*
|
|
1435
|
+
* @param spec - Declarative graph topology.
|
|
1436
|
+
* @param opts - Catalog and compile options.
|
|
1437
|
+
* @returns A running Graph.
|
|
1438
|
+
* @throws On validation failure, missing catalog entries, or unresolvable deps.
|
|
1439
|
+
*
|
|
1440
|
+
* @category patterns
|
|
1441
|
+
*/
|
|
1442
|
+
declare function compileSpec(spec: GraphSpec, opts?: CompileSpecOptions): Graph;
|
|
1443
|
+
/**
|
|
1444
|
+
* Extract a GraphSpec from a running graph.
|
|
1445
|
+
*
|
|
1446
|
+
* Uses `describe({ detail: "standard" })` as a starting point, then enriches:
|
|
1447
|
+
* - Feedback edges recovered from counter node meta (`feedbackFrom`/`feedbackTo`)
|
|
1448
|
+
* - Template refs recovered from output node meta (`_templateName`/`_templateBind`)
|
|
1449
|
+
* - Structural fingerprinting as fallback for 2+ identical mounted subgraphs
|
|
1450
|
+
*
|
|
1451
|
+
* @param graph - Running graph to decompile.
|
|
1452
|
+
* @returns A GraphSpec representation.
|
|
1453
|
+
*
|
|
1454
|
+
* @category patterns
|
|
1455
|
+
*/
|
|
1456
|
+
declare function decompileGraph(graph: Graph): GraphSpec;
|
|
1457
|
+
/** A single change in a spec diff. */
|
|
1458
|
+
type SpecDiffEntry = {
|
|
1459
|
+
type: "added" | "removed" | "changed";
|
|
1460
|
+
path: string;
|
|
1461
|
+
detail?: string;
|
|
1462
|
+
};
|
|
1463
|
+
/** Structural diff between two GraphSpecs. */
|
|
1464
|
+
type SpecDiffResult = {
|
|
1465
|
+
entries: SpecDiffEntry[];
|
|
1466
|
+
summary: string;
|
|
1467
|
+
};
|
|
1468
|
+
/**
|
|
1469
|
+
* Compute a structural diff between two GraphSpecs.
|
|
1470
|
+
*
|
|
1471
|
+
* Template-aware: reports "changed template definition" vs "changed
|
|
1472
|
+
* instantiation bindings." No runtime needed — pure JSON comparison.
|
|
1473
|
+
*
|
|
1474
|
+
* @param specA - The "before" spec.
|
|
1475
|
+
* @param specB - The "after" spec.
|
|
1476
|
+
* @returns Diff entries and a human-readable summary.
|
|
1477
|
+
*
|
|
1478
|
+
* @category patterns
|
|
1479
|
+
*/
|
|
1480
|
+
declare function specDiff(specA: GraphSpec, specB: GraphSpec): SpecDiffResult;
|
|
1481
|
+
/** Options for {@link llmCompose}. */
|
|
1482
|
+
type LLMComposeOptions = {
|
|
1483
|
+
model?: string;
|
|
1484
|
+
temperature?: number;
|
|
1485
|
+
maxTokens?: number;
|
|
1486
|
+
/** Extra instructions appended to the system prompt. */
|
|
1487
|
+
systemPromptExtra?: string;
|
|
1488
|
+
/** Available fn/source catalog names for the LLM to reference. */
|
|
1489
|
+
catalogDescription?: string;
|
|
1490
|
+
};
|
|
1491
|
+
/**
|
|
1492
|
+
* Ask an LLM to compose a GraphSpec from a natural-language problem description.
|
|
1493
|
+
*
|
|
1494
|
+
* The LLM generates a GraphSpec (with templates + feedback), validated before
|
|
1495
|
+
* returning. The spec is for human review before compilation via compileSpec().
|
|
1496
|
+
*
|
|
1497
|
+
* @param problem - Natural language problem description.
|
|
1498
|
+
* @param adapter - LLM adapter for the generation call.
|
|
1499
|
+
* @param opts - Model options and catalog description.
|
|
1500
|
+
* @returns A validated GraphSpec.
|
|
1501
|
+
* @throws On invalid LLM output or validation failure.
|
|
1502
|
+
*
|
|
1503
|
+
* @category patterns
|
|
1504
|
+
*/
|
|
1505
|
+
declare function llmCompose(problem: string, adapter: LLMAdapter, opts?: LLMComposeOptions): Promise<GraphSpec>;
|
|
1506
|
+
/** Options for {@link llmRefine}. */
|
|
1507
|
+
type LLMRefineOptions = LLMComposeOptions;
|
|
1508
|
+
/**
|
|
1509
|
+
* Ask an LLM to modify an existing GraphSpec based on feedback or changed requirements.
|
|
1510
|
+
*
|
|
1511
|
+
* @param currentSpec - The current GraphSpec to modify.
|
|
1512
|
+
* @param feedback - Natural language feedback or changed requirements.
|
|
1513
|
+
* @param adapter - LLM adapter for the generation call.
|
|
1514
|
+
* @param opts - Model options.
|
|
1515
|
+
* @returns A new GraphSpec incorporating the feedback.
|
|
1516
|
+
* @throws On invalid LLM output or validation failure.
|
|
1517
|
+
*
|
|
1518
|
+
* @category patterns
|
|
1519
|
+
*/
|
|
1520
|
+
declare function llmRefine(currentSpec: GraphSpec, feedback: string, adapter: LLMAdapter, opts?: LLMRefineOptions): Promise<GraphSpec>;
|
|
1521
|
+
|
|
1522
|
+
type graphspec_CompileSpecOptions = CompileSpecOptions;
|
|
1523
|
+
type graphspec_FnFactory = FnFactory;
|
|
1524
|
+
type graphspec_GraphSpec = GraphSpec;
|
|
1525
|
+
type graphspec_GraphSpecCatalog = GraphSpecCatalog;
|
|
1526
|
+
type graphspec_GraphSpecFeedbackEdge = GraphSpecFeedbackEdge;
|
|
1527
|
+
type graphspec_GraphSpecNode = GraphSpecNode;
|
|
1528
|
+
type graphspec_GraphSpecTemplate = GraphSpecTemplate;
|
|
1529
|
+
type graphspec_GraphSpecTemplateRef = GraphSpecTemplateRef;
|
|
1530
|
+
type graphspec_GraphSpecValidation = GraphSpecValidation;
|
|
1531
|
+
type graphspec_LLMComposeOptions = LLMComposeOptions;
|
|
1532
|
+
type graphspec_LLMRefineOptions = LLMRefineOptions;
|
|
1533
|
+
type graphspec_SourceFactory = SourceFactory;
|
|
1534
|
+
type graphspec_SpecDiffEntry = SpecDiffEntry;
|
|
1535
|
+
type graphspec_SpecDiffResult = SpecDiffResult;
|
|
1536
|
+
declare const graphspec_compileSpec: typeof compileSpec;
|
|
1537
|
+
declare const graphspec_decompileGraph: typeof decompileGraph;
|
|
1538
|
+
declare const graphspec_llmCompose: typeof llmCompose;
|
|
1539
|
+
declare const graphspec_llmRefine: typeof llmRefine;
|
|
1540
|
+
declare const graphspec_specDiff: typeof specDiff;
|
|
1541
|
+
declare const graphspec_validateSpec: typeof validateSpec;
|
|
1542
|
+
declare namespace graphspec {
|
|
1543
|
+
export { type graphspec_CompileSpecOptions as CompileSpecOptions, type graphspec_FnFactory as FnFactory, type graphspec_GraphSpec as GraphSpec, type graphspec_GraphSpecCatalog as GraphSpecCatalog, type graphspec_GraphSpecFeedbackEdge as GraphSpecFeedbackEdge, type graphspec_GraphSpecNode as GraphSpecNode, type graphspec_GraphSpecTemplate as GraphSpecTemplate, type graphspec_GraphSpecTemplateRef as GraphSpecTemplateRef, type graphspec_GraphSpecValidation as GraphSpecValidation, type graphspec_LLMComposeOptions as LLMComposeOptions, type graphspec_LLMRefineOptions as LLMRefineOptions, type graphspec_SourceFactory as SourceFactory, type graphspec_SpecDiffEntry as SpecDiffEntry, type graphspec_SpecDiffResult as SpecDiffResult, graphspec_compileSpec as compileSpec, graphspec_decompileGraph as decompileGraph, graphspec_llmCompose as llmCompose, graphspec_llmRefine as llmRefine, graphspec_specDiff as specDiff, graphspec_validateSpec as validateSpec };
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1332
1546
|
/**
|
|
1333
1547
|
* Messaging patterns (roadmap §4.2).
|
|
1334
1548
|
*
|
|
@@ -1774,12 +1988,13 @@ declare namespace reduction {
|
|
|
1774
1988
|
|
|
1775
1989
|
declare const index_ai: typeof ai;
|
|
1776
1990
|
declare const index_cqrs: typeof cqrs;
|
|
1991
|
+
declare const index_graphspec: typeof graphspec;
|
|
1777
1992
|
declare const index_memory: typeof memory;
|
|
1778
1993
|
declare const index_messaging: typeof messaging;
|
|
1779
1994
|
declare const index_orchestration: typeof orchestration;
|
|
1780
1995
|
declare const index_reduction: typeof reduction;
|
|
1781
1996
|
declare namespace index {
|
|
1782
|
-
export { index_ai as ai, index_cqrs as cqrs, demoShell$1 as demoShell, index$b as layout, index_memory as memory, index_messaging as messaging, index_orchestration as orchestration, index_reduction as reduction };
|
|
1997
|
+
export { index_ai as ai, index_cqrs as cqrs, demoShell$1 as demoShell, index_graphspec as graphspec, index$b as layout, index_memory as memory, index_messaging as messaging, index_orchestration as orchestration, index_reduction as reduction };
|
|
1783
1998
|
}
|
|
1784
1999
|
|
|
1785
2000
|
/**
|
|
@@ -1787,4 +2002,4 @@ declare namespace index {
|
|
|
1787
2002
|
*/
|
|
1788
2003
|
declare const version = "0.0.0";
|
|
1789
2004
|
|
|
1790
|
-
export { Actor, AutoCheckpointAdapter, DistillBundle, Extraction, Graph, GraphAutoCheckpointHandle, GraphAutoCheckpointOptions, GraphOptions, Node, NodeActions, NodeFn, NodeInput, NodeOptions, ReactiveListSnapshot, ReactiveLogSnapshot, ReactiveMapSnapshot, ai, index$1 as compat, cqrs, demoShell$1 as demoShell, index$9 as jotai, index$b as layout, memory, messaging, index$8 as nanostores, index$a as nestjs, orchestration, index as patterns, index$7 as react, reduction, index$6 as signals, index$5 as solid, index$4 as svelte, version, index$3 as vue, index$2 as zustand };
|
|
2005
|
+
export { Actor, AutoCheckpointAdapter, DistillBundle, Extraction, Graph, GraphAutoCheckpointHandle, GraphAutoCheckpointOptions, GraphOptions, Node, NodeActions, NodeFn, NodeInput, NodeOptions, ReactiveListSnapshot, ReactiveLogSnapshot, ReactiveMapSnapshot, ai, index$1 as compat, cqrs, demoShell$1 as demoShell, graphspec, index$9 as jotai, index$b as layout, memory, messaging, index$8 as nanostores, index$a as nestjs, orchestration, index as patterns, index$7 as react, reduction, index$6 as signals, index$5 as solid, index$4 as svelte, version, index$3 as vue, index$2 as zustand };
|
package/dist/index.d.ts
CHANGED
|
@@ -1329,6 +1329,220 @@ declare namespace demoShell$1 {
|
|
|
1329
1329
|
export { type demoShell$1_DemoShellHandle as DemoShellHandle, type demoShell$1_DemoShellOptions as DemoShellOptions, type demoShell$1_FullscreenPane as FullscreenPane, type demoShell$1_GraphLabelSize as GraphLabelSize, type demoShell$1_HighlightCallbacks as HighlightCallbacks, type demoShell$1_HoverPaneType as HoverPaneType, type demoShell$1_HoverTarget as HoverTarget, type demoShell$1_NodeRegistry as NodeRegistry, demoShell$1_demoShell as demoShell };
|
|
1330
1330
|
}
|
|
1331
1331
|
|
|
1332
|
+
/**
|
|
1333
|
+
* LLM graph composition (roadmap §8.3).
|
|
1334
|
+
*
|
|
1335
|
+
* Declarative GraphSpec schema + compiler/decompiler for graph topology.
|
|
1336
|
+
* The LLM designs graphs as JSON; compileSpec instantiates them; decompileGraph
|
|
1337
|
+
* extracts them back. Templates support reusable subgraph patterns. Feedback
|
|
1338
|
+
* edges express bounded cycles via §8.1 feedback().
|
|
1339
|
+
*
|
|
1340
|
+
* @module
|
|
1341
|
+
*/
|
|
1342
|
+
|
|
1343
|
+
/** A single node declaration in a GraphSpec. */
|
|
1344
|
+
type GraphSpecNode = {
|
|
1345
|
+
/** Node kind: state, producer, derived, effect, operator. */
|
|
1346
|
+
type: "state" | "producer" | "derived" | "effect" | "operator";
|
|
1347
|
+
/** Dependency node names (for derived/effect/operator). */
|
|
1348
|
+
deps?: string[];
|
|
1349
|
+
/** Named function from the catalog (for derived/effect/operator/producer). */
|
|
1350
|
+
fn?: string;
|
|
1351
|
+
/** Named source from the catalog (for producer). */
|
|
1352
|
+
source?: string;
|
|
1353
|
+
/** Freeform config passed to the catalog fn/source factory. */
|
|
1354
|
+
config?: Record<string, unknown>;
|
|
1355
|
+
/** Initial value (for state nodes). */
|
|
1356
|
+
initial?: unknown;
|
|
1357
|
+
/** Human/LLM-readable metadata. */
|
|
1358
|
+
meta?: Record<string, unknown>;
|
|
1359
|
+
};
|
|
1360
|
+
/** Template instantiation node — expanded at compile time. */
|
|
1361
|
+
type GraphSpecTemplateRef = {
|
|
1362
|
+
type: "template";
|
|
1363
|
+
/** Name of the template to instantiate. */
|
|
1364
|
+
template: string;
|
|
1365
|
+
/** Parameter bindings: template param name → node name. */
|
|
1366
|
+
bind: Record<string, string>;
|
|
1367
|
+
};
|
|
1368
|
+
/** A reusable subgraph pattern with parameter substitution. */
|
|
1369
|
+
type GraphSpecTemplate = {
|
|
1370
|
+
/** Parameter names (prefixed with $ in node refs). */
|
|
1371
|
+
params: string[];
|
|
1372
|
+
/** Node declarations within the template. */
|
|
1373
|
+
nodes: Record<string, GraphSpecNode>;
|
|
1374
|
+
/** Which node's output is the template's output. */
|
|
1375
|
+
output: string;
|
|
1376
|
+
};
|
|
1377
|
+
/** A feedback edge: bounded cycle from condition to reentry. */
|
|
1378
|
+
type GraphSpecFeedbackEdge = {
|
|
1379
|
+
/** Node whose DATA triggers the feedback. */
|
|
1380
|
+
from: string;
|
|
1381
|
+
/** State node that receives the feedback value. */
|
|
1382
|
+
to: string;
|
|
1383
|
+
/** Max iterations before stopping (default: 10). */
|
|
1384
|
+
maxIterations?: number;
|
|
1385
|
+
};
|
|
1386
|
+
/** Declarative graph topology for LLM composition (§8.3). */
|
|
1387
|
+
type GraphSpec = {
|
|
1388
|
+
/** Graph name. */
|
|
1389
|
+
name: string;
|
|
1390
|
+
/** Node declarations (keyed by node name). */
|
|
1391
|
+
nodes: Record<string, GraphSpecNode | GraphSpecTemplateRef>;
|
|
1392
|
+
/** Reusable subgraph templates. */
|
|
1393
|
+
templates?: Record<string, GraphSpecTemplate>;
|
|
1394
|
+
/** Feedback edges (bounded cycles). */
|
|
1395
|
+
feedback?: GraphSpecFeedbackEdge[];
|
|
1396
|
+
};
|
|
1397
|
+
/**
|
|
1398
|
+
* Factory for creating a derived/effect/operator node from catalog.
|
|
1399
|
+
* Receives resolved dep nodes and the config from the spec.
|
|
1400
|
+
*/
|
|
1401
|
+
type FnFactory = (deps: Node<unknown>[], config: Record<string, unknown>) => Node<unknown>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Factory for creating a producer node from catalog.
|
|
1404
|
+
* Receives the config from the spec.
|
|
1405
|
+
*/
|
|
1406
|
+
type SourceFactory = (config: Record<string, unknown>) => Node<unknown>;
|
|
1407
|
+
/** Fn/source lookup table passed to compileSpec. */
|
|
1408
|
+
type GraphSpecCatalog = {
|
|
1409
|
+
fns?: Record<string, FnFactory>;
|
|
1410
|
+
sources?: Record<string, SourceFactory>;
|
|
1411
|
+
};
|
|
1412
|
+
/** Validation result from {@link validateSpec}. */
|
|
1413
|
+
type GraphSpecValidation = {
|
|
1414
|
+
valid: boolean;
|
|
1415
|
+
errors: string[];
|
|
1416
|
+
};
|
|
1417
|
+
/**
|
|
1418
|
+
* Validate a GraphSpec JSON object.
|
|
1419
|
+
*
|
|
1420
|
+
* Checks structural validity: required fields, node types, dep references,
|
|
1421
|
+
* template references, feedback edge targets, self-cycles, and bind completeness.
|
|
1422
|
+
*/
|
|
1423
|
+
declare function validateSpec(spec: unknown): GraphSpecValidation;
|
|
1424
|
+
/** Options for {@link compileSpec}. */
|
|
1425
|
+
type CompileSpecOptions = {
|
|
1426
|
+
/** Fn/source catalog for resolving named factories. */
|
|
1427
|
+
catalog?: GraphSpecCatalog;
|
|
1428
|
+
};
|
|
1429
|
+
/**
|
|
1430
|
+
* Instantiate a Graph from a GraphSpec.
|
|
1431
|
+
*
|
|
1432
|
+
* Handles template expansion (mounted subgraphs), feedback wiring via §8.1
|
|
1433
|
+
* feedback(), node factory lookup from the catalog, and topology validation.
|
|
1434
|
+
*
|
|
1435
|
+
* @param spec - Declarative graph topology.
|
|
1436
|
+
* @param opts - Catalog and compile options.
|
|
1437
|
+
* @returns A running Graph.
|
|
1438
|
+
* @throws On validation failure, missing catalog entries, or unresolvable deps.
|
|
1439
|
+
*
|
|
1440
|
+
* @category patterns
|
|
1441
|
+
*/
|
|
1442
|
+
declare function compileSpec(spec: GraphSpec, opts?: CompileSpecOptions): Graph;
|
|
1443
|
+
/**
|
|
1444
|
+
* Extract a GraphSpec from a running graph.
|
|
1445
|
+
*
|
|
1446
|
+
* Uses `describe({ detail: "standard" })` as a starting point, then enriches:
|
|
1447
|
+
* - Feedback edges recovered from counter node meta (`feedbackFrom`/`feedbackTo`)
|
|
1448
|
+
* - Template refs recovered from output node meta (`_templateName`/`_templateBind`)
|
|
1449
|
+
* - Structural fingerprinting as fallback for 2+ identical mounted subgraphs
|
|
1450
|
+
*
|
|
1451
|
+
* @param graph - Running graph to decompile.
|
|
1452
|
+
* @returns A GraphSpec representation.
|
|
1453
|
+
*
|
|
1454
|
+
* @category patterns
|
|
1455
|
+
*/
|
|
1456
|
+
declare function decompileGraph(graph: Graph): GraphSpec;
|
|
1457
|
+
/** A single change in a spec diff. */
|
|
1458
|
+
type SpecDiffEntry = {
|
|
1459
|
+
type: "added" | "removed" | "changed";
|
|
1460
|
+
path: string;
|
|
1461
|
+
detail?: string;
|
|
1462
|
+
};
|
|
1463
|
+
/** Structural diff between two GraphSpecs. */
|
|
1464
|
+
type SpecDiffResult = {
|
|
1465
|
+
entries: SpecDiffEntry[];
|
|
1466
|
+
summary: string;
|
|
1467
|
+
};
|
|
1468
|
+
/**
|
|
1469
|
+
* Compute a structural diff between two GraphSpecs.
|
|
1470
|
+
*
|
|
1471
|
+
* Template-aware: reports "changed template definition" vs "changed
|
|
1472
|
+
* instantiation bindings." No runtime needed — pure JSON comparison.
|
|
1473
|
+
*
|
|
1474
|
+
* @param specA - The "before" spec.
|
|
1475
|
+
* @param specB - The "after" spec.
|
|
1476
|
+
* @returns Diff entries and a human-readable summary.
|
|
1477
|
+
*
|
|
1478
|
+
* @category patterns
|
|
1479
|
+
*/
|
|
1480
|
+
declare function specDiff(specA: GraphSpec, specB: GraphSpec): SpecDiffResult;
|
|
1481
|
+
/** Options for {@link llmCompose}. */
|
|
1482
|
+
type LLMComposeOptions = {
|
|
1483
|
+
model?: string;
|
|
1484
|
+
temperature?: number;
|
|
1485
|
+
maxTokens?: number;
|
|
1486
|
+
/** Extra instructions appended to the system prompt. */
|
|
1487
|
+
systemPromptExtra?: string;
|
|
1488
|
+
/** Available fn/source catalog names for the LLM to reference. */
|
|
1489
|
+
catalogDescription?: string;
|
|
1490
|
+
};
|
|
1491
|
+
/**
|
|
1492
|
+
* Ask an LLM to compose a GraphSpec from a natural-language problem description.
|
|
1493
|
+
*
|
|
1494
|
+
* The LLM generates a GraphSpec (with templates + feedback), validated before
|
|
1495
|
+
* returning. The spec is for human review before compilation via compileSpec().
|
|
1496
|
+
*
|
|
1497
|
+
* @param problem - Natural language problem description.
|
|
1498
|
+
* @param adapter - LLM adapter for the generation call.
|
|
1499
|
+
* @param opts - Model options and catalog description.
|
|
1500
|
+
* @returns A validated GraphSpec.
|
|
1501
|
+
* @throws On invalid LLM output or validation failure.
|
|
1502
|
+
*
|
|
1503
|
+
* @category patterns
|
|
1504
|
+
*/
|
|
1505
|
+
declare function llmCompose(problem: string, adapter: LLMAdapter, opts?: LLMComposeOptions): Promise<GraphSpec>;
|
|
1506
|
+
/** Options for {@link llmRefine}. */
|
|
1507
|
+
type LLMRefineOptions = LLMComposeOptions;
|
|
1508
|
+
/**
|
|
1509
|
+
* Ask an LLM to modify an existing GraphSpec based on feedback or changed requirements.
|
|
1510
|
+
*
|
|
1511
|
+
* @param currentSpec - The current GraphSpec to modify.
|
|
1512
|
+
* @param feedback - Natural language feedback or changed requirements.
|
|
1513
|
+
* @param adapter - LLM adapter for the generation call.
|
|
1514
|
+
* @param opts - Model options.
|
|
1515
|
+
* @returns A new GraphSpec incorporating the feedback.
|
|
1516
|
+
* @throws On invalid LLM output or validation failure.
|
|
1517
|
+
*
|
|
1518
|
+
* @category patterns
|
|
1519
|
+
*/
|
|
1520
|
+
declare function llmRefine(currentSpec: GraphSpec, feedback: string, adapter: LLMAdapter, opts?: LLMRefineOptions): Promise<GraphSpec>;
|
|
1521
|
+
|
|
1522
|
+
type graphspec_CompileSpecOptions = CompileSpecOptions;
|
|
1523
|
+
type graphspec_FnFactory = FnFactory;
|
|
1524
|
+
type graphspec_GraphSpec = GraphSpec;
|
|
1525
|
+
type graphspec_GraphSpecCatalog = GraphSpecCatalog;
|
|
1526
|
+
type graphspec_GraphSpecFeedbackEdge = GraphSpecFeedbackEdge;
|
|
1527
|
+
type graphspec_GraphSpecNode = GraphSpecNode;
|
|
1528
|
+
type graphspec_GraphSpecTemplate = GraphSpecTemplate;
|
|
1529
|
+
type graphspec_GraphSpecTemplateRef = GraphSpecTemplateRef;
|
|
1530
|
+
type graphspec_GraphSpecValidation = GraphSpecValidation;
|
|
1531
|
+
type graphspec_LLMComposeOptions = LLMComposeOptions;
|
|
1532
|
+
type graphspec_LLMRefineOptions = LLMRefineOptions;
|
|
1533
|
+
type graphspec_SourceFactory = SourceFactory;
|
|
1534
|
+
type graphspec_SpecDiffEntry = SpecDiffEntry;
|
|
1535
|
+
type graphspec_SpecDiffResult = SpecDiffResult;
|
|
1536
|
+
declare const graphspec_compileSpec: typeof compileSpec;
|
|
1537
|
+
declare const graphspec_decompileGraph: typeof decompileGraph;
|
|
1538
|
+
declare const graphspec_llmCompose: typeof llmCompose;
|
|
1539
|
+
declare const graphspec_llmRefine: typeof llmRefine;
|
|
1540
|
+
declare const graphspec_specDiff: typeof specDiff;
|
|
1541
|
+
declare const graphspec_validateSpec: typeof validateSpec;
|
|
1542
|
+
declare namespace graphspec {
|
|
1543
|
+
export { type graphspec_CompileSpecOptions as CompileSpecOptions, type graphspec_FnFactory as FnFactory, type graphspec_GraphSpec as GraphSpec, type graphspec_GraphSpecCatalog as GraphSpecCatalog, type graphspec_GraphSpecFeedbackEdge as GraphSpecFeedbackEdge, type graphspec_GraphSpecNode as GraphSpecNode, type graphspec_GraphSpecTemplate as GraphSpecTemplate, type graphspec_GraphSpecTemplateRef as GraphSpecTemplateRef, type graphspec_GraphSpecValidation as GraphSpecValidation, type graphspec_LLMComposeOptions as LLMComposeOptions, type graphspec_LLMRefineOptions as LLMRefineOptions, type graphspec_SourceFactory as SourceFactory, type graphspec_SpecDiffEntry as SpecDiffEntry, type graphspec_SpecDiffResult as SpecDiffResult, graphspec_compileSpec as compileSpec, graphspec_decompileGraph as decompileGraph, graphspec_llmCompose as llmCompose, graphspec_llmRefine as llmRefine, graphspec_specDiff as specDiff, graphspec_validateSpec as validateSpec };
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1332
1546
|
/**
|
|
1333
1547
|
* Messaging patterns (roadmap §4.2).
|
|
1334
1548
|
*
|
|
@@ -1774,12 +1988,13 @@ declare namespace reduction {
|
|
|
1774
1988
|
|
|
1775
1989
|
declare const index_ai: typeof ai;
|
|
1776
1990
|
declare const index_cqrs: typeof cqrs;
|
|
1991
|
+
declare const index_graphspec: typeof graphspec;
|
|
1777
1992
|
declare const index_memory: typeof memory;
|
|
1778
1993
|
declare const index_messaging: typeof messaging;
|
|
1779
1994
|
declare const index_orchestration: typeof orchestration;
|
|
1780
1995
|
declare const index_reduction: typeof reduction;
|
|
1781
1996
|
declare namespace index {
|
|
1782
|
-
export { index_ai as ai, index_cqrs as cqrs, demoShell$1 as demoShell, index$b as layout, index_memory as memory, index_messaging as messaging, index_orchestration as orchestration, index_reduction as reduction };
|
|
1997
|
+
export { index_ai as ai, index_cqrs as cqrs, demoShell$1 as demoShell, index_graphspec as graphspec, index$b as layout, index_memory as memory, index_messaging as messaging, index_orchestration as orchestration, index_reduction as reduction };
|
|
1783
1998
|
}
|
|
1784
1999
|
|
|
1785
2000
|
/**
|
|
@@ -1787,4 +2002,4 @@ declare namespace index {
|
|
|
1787
2002
|
*/
|
|
1788
2003
|
declare const version = "0.0.0";
|
|
1789
2004
|
|
|
1790
|
-
export { Actor, AutoCheckpointAdapter, DistillBundle, Extraction, Graph, GraphAutoCheckpointHandle, GraphAutoCheckpointOptions, GraphOptions, Node, NodeActions, NodeFn, NodeInput, NodeOptions, ReactiveListSnapshot, ReactiveLogSnapshot, ReactiveMapSnapshot, ai, index$1 as compat, cqrs, demoShell$1 as demoShell, index$9 as jotai, index$b as layout, memory, messaging, index$8 as nanostores, index$a as nestjs, orchestration, index as patterns, index$7 as react, reduction, index$6 as signals, index$5 as solid, index$4 as svelte, version, index$3 as vue, index$2 as zustand };
|
|
2005
|
+
export { Actor, AutoCheckpointAdapter, DistillBundle, Extraction, Graph, GraphAutoCheckpointHandle, GraphAutoCheckpointOptions, GraphOptions, Node, NodeActions, NodeFn, NodeInput, NodeOptions, ReactiveListSnapshot, ReactiveLogSnapshot, ReactiveMapSnapshot, ai, index$1 as compat, cqrs, demoShell$1 as demoShell, graphspec, index$9 as jotai, index$b as layout, memory, messaging, index$8 as nanostores, index$a as nestjs, orchestration, index as patterns, index$7 as react, reduction, index$6 as signals, index$5 as solid, index$4 as svelte, version, index$3 as vue, index$2 as zustand };
|