@cynodia/axiom-agent-api 0.6.2-alpha.1 → 0.7.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/queries.d.ts +19 -2
- package/dist/queries.js +34 -2
- package/package.json +2 -2
package/dist/queries.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionDef, AnyNode, ApplicationGraph, ConstraintDef, EdgeKind, Expression, FieldId, FormNode, GraphEdge, Location, NodeId, StateDef, TransitionConstraintDef, UINode, ViewNode } from '@cynodia/axiom-core';
|
|
1
|
+
import type { ActionDef, AnyNode, ApplicationGraph, ConstraintDef, EdgeKind, Expression, ExpressionDef, FieldId, FormNode, GraphEdge, Location, NodeId, StateDef, TransitionConstraintDef, UINode, ViewNode } from '@cynodia/axiom-core';
|
|
2
2
|
export interface SubgraphRequest {
|
|
3
3
|
root: NodeId;
|
|
4
4
|
depth?: number;
|
|
@@ -67,8 +67,25 @@ export declare class GraphQueries {
|
|
|
67
67
|
* This is the query an agent uses instead of reading files.
|
|
68
68
|
*/
|
|
69
69
|
getSubgraph(request: SubgraphRequest): Subgraph;
|
|
70
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Ids a node's expressions reference, for dependency reporting.
|
|
72
|
+
*
|
|
73
|
+
* Named expressions are followed, so an answer does not change because a calculation was
|
|
74
|
+
* given a name instead of being written out.
|
|
75
|
+
*/
|
|
71
76
|
referencedBy(expression: Expression): NodeId[];
|
|
77
|
+
/** Every named, reusable expression in the graph. */
|
|
78
|
+
listExpressionDefinitions(): ExpressionDef[];
|
|
79
|
+
getExpressionDefinition(id: NodeId): ExpressionDef | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* What uses a named expression — the question a reuse mechanism exists to make answerable.
|
|
82
|
+
*
|
|
83
|
+
* A definition with no consumers is dead weight, and one with many is a place where an
|
|
84
|
+
* edit reaches further than it looks.
|
|
85
|
+
*/
|
|
86
|
+
getExpressionConsumers(id: NodeId): AnyNode[];
|
|
87
|
+
/** The states a named expression reads, its own and those of the definitions it uses. */
|
|
88
|
+
getExpressionDependencies(id: NodeId): StateDef[];
|
|
72
89
|
/** Nodes that read a specific field, from the field metadata on their read edges. */
|
|
73
90
|
getFieldReaders(fieldId: FieldId): AnyNode[];
|
|
74
91
|
/** Nodes that write a specific field — actions and the inputs bound to it. */
|
package/dist/queries.js
CHANGED
|
@@ -163,9 +163,41 @@ export class GraphQueries {
|
|
|
163
163
|
}
|
|
164
164
|
return { nodes: this.resolve([...visited]), edges: [...edges.values()] };
|
|
165
165
|
}
|
|
166
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* Ids a node's expressions reference, for dependency reporting.
|
|
168
|
+
*
|
|
169
|
+
* Named expressions are followed, so an answer does not change because a calculation was
|
|
170
|
+
* given a name instead of being written out.
|
|
171
|
+
*/
|
|
167
172
|
referencedBy(expression) {
|
|
168
|
-
return referencedIds(expression);
|
|
173
|
+
return referencedIds(expression, (id) => this.getExpressionDefinition(id));
|
|
174
|
+
}
|
|
175
|
+
/** Every named, reusable expression in the graph. */
|
|
176
|
+
listExpressionDefinitions() {
|
|
177
|
+
return this.graph.getNodesByKind('expression');
|
|
178
|
+
}
|
|
179
|
+
getExpressionDefinition(id) {
|
|
180
|
+
const node = this.graph.getNode(id);
|
|
181
|
+
return node?.kind === 'expression' ? node : undefined;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* What uses a named expression — the question a reuse mechanism exists to make answerable.
|
|
185
|
+
*
|
|
186
|
+
* A definition with no consumers is dead weight, and one with many is a place where an
|
|
187
|
+
* edit reaches further than it looks.
|
|
188
|
+
*/
|
|
189
|
+
getExpressionConsumers(id) {
|
|
190
|
+
return this.resolve(this.graph
|
|
191
|
+
.getIncomingEdges(id, { kinds: ['references'] })
|
|
192
|
+
.map((edge) => edge.from)).filter((node) => node.id !== id);
|
|
193
|
+
}
|
|
194
|
+
/** The states a named expression reads, its own and those of the definitions it uses. */
|
|
195
|
+
getExpressionDependencies(id) {
|
|
196
|
+
const definition = this.getExpressionDefinition(id);
|
|
197
|
+
if (!definition) {
|
|
198
|
+
return [];
|
|
199
|
+
}
|
|
200
|
+
return this.getDependencies(id, READ_KINDS).filter((node) => node.kind === 'state');
|
|
169
201
|
}
|
|
170
202
|
/** Nodes that read a specific field, from the field metadata on their read edges. */
|
|
171
203
|
getFieldReaders(fieldId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cynodia/axiom-agent-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-alpha.1",
|
|
4
4
|
"description": "Semantic queries and transactional graph transformations for AI agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "AskTech AS",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@cynodia/axiom-core": "0.
|
|
34
|
+
"@cynodia/axiom-core": "0.7.0-alpha.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc -b tsconfig.json tsconfig.test.json",
|