@cynodia/axiom-agent-api 0.7.0-alpha.2 → 0.8.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 +23 -1
- package/dist/queries.js +57 -0
- package/package.json +2 -2
package/dist/queries.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionDef, AnyNode, ApplicationGraph, ConstraintDef, EdgeKind, Expression, ExpressionDef, FieldId, FormNode, GraphEdge, Location, NodeId, StateDef, TransitionConstraintDef, UINode, ViewNode } from '@cynodia/axiom-core';
|
|
1
|
+
import type { ActionDef, AnyNode, ApplicationGraph, ConstraintDef, EdgeKind, EventDef, Expression, ExpressionDef, FieldId, FormNode, GraphEdge, IntegrationDef, IntegrationOperationDef, Location, NodeId, StateDef, TransitionConstraintDef, TriggerDef, UINode, ViewNode } from '@cynodia/axiom-core';
|
|
2
2
|
export interface SubgraphRequest {
|
|
3
3
|
root: NodeId;
|
|
4
4
|
depth?: number;
|
|
@@ -100,6 +100,28 @@ export declare class GraphQueries {
|
|
|
100
100
|
private derivedStatesFrom;
|
|
101
101
|
private nodesWithFieldEdge;
|
|
102
102
|
protected ancestors(id: NodeId): UINode[];
|
|
103
|
+
/** Every external capability domain the application declares. */
|
|
104
|
+
listIntegrations(): IntegrationDef[];
|
|
105
|
+
/** The typed operations an integration exposes, or every operation of every integration. */
|
|
106
|
+
listIntegrationOperations(integrationId?: NodeId): IntegrationOperationDef[];
|
|
107
|
+
getIntegrationOperation(id: NodeId): IntegrationOperationDef | undefined;
|
|
108
|
+
/** Actions that call an operation of this integration, directly. */
|
|
109
|
+
getActionsUsingIntegration(integrationId: NodeId): ActionDef[];
|
|
110
|
+
/** The effect-mode operations an action calls — what it can do to an external system. */
|
|
111
|
+
getEffectsForAction(actionId: NodeId): IntegrationOperationDef[];
|
|
112
|
+
/** Triggers that invoke this action. */
|
|
113
|
+
getTriggersForAction(actionId: NodeId): TriggerDef[];
|
|
114
|
+
/** The actions an event, once dispatched, invokes — following every trigger bound to it. */
|
|
115
|
+
getActionsTriggeredByEvent(eventId: NodeId): ActionDef[];
|
|
116
|
+
/** Every external capability this application can reach, and what it can do with each. */
|
|
117
|
+
getExternalDependencies(): {
|
|
118
|
+
integrations: IntegrationDef[];
|
|
119
|
+
operations: IntegrationOperationDef[];
|
|
120
|
+
};
|
|
121
|
+
/** Triggers that fire on a schedule rather than on an event or a lifecycle moment. */
|
|
122
|
+
getTimedTriggers(): TriggerDef[];
|
|
123
|
+
/** Events at least one trigger reacts to — the external/internal facts this application listens for. */
|
|
124
|
+
getWebhookEvents(): EventDef[];
|
|
103
125
|
protected enclosingViews(id: NodeId): ViewNode[];
|
|
104
126
|
private resolve;
|
|
105
127
|
}
|
package/dist/queries.js
CHANGED
|
@@ -345,6 +345,63 @@ export class GraphQueries {
|
|
|
345
345
|
}
|
|
346
346
|
return found;
|
|
347
347
|
}
|
|
348
|
+
// ------------------------------------------- integrations, effects, triggers, events
|
|
349
|
+
/** Every external capability domain the application declares. */
|
|
350
|
+
listIntegrations() {
|
|
351
|
+
return this.graph.getNodesByKind('integration');
|
|
352
|
+
}
|
|
353
|
+
/** The typed operations an integration exposes, or every operation of every integration. */
|
|
354
|
+
listIntegrationOperations(integrationId) {
|
|
355
|
+
const all = this.graph.getNodesByKind('integration-operation');
|
|
356
|
+
return integrationId ? all.filter((operation) => operation.integrationId === integrationId) : all;
|
|
357
|
+
}
|
|
358
|
+
getIntegrationOperation(id) {
|
|
359
|
+
const node = this.graph.getNode(id);
|
|
360
|
+
return node?.kind === 'integration-operation' ? node : undefined;
|
|
361
|
+
}
|
|
362
|
+
/** Actions that call an operation of this integration, directly. */
|
|
363
|
+
getActionsUsingIntegration(integrationId) {
|
|
364
|
+
const operationIds = new Set(this.listIntegrationOperations(integrationId).map((operation) => operation.id));
|
|
365
|
+
return this.graph
|
|
366
|
+
.getNodesByKind('action')
|
|
367
|
+
.filter((action) => this.graph.getOutgoingEdges(action.id, { kinds: ['references'] }).some((edge) => operationIds.has(edge.to)));
|
|
368
|
+
}
|
|
369
|
+
/** The effect-mode operations an action calls — what it can do to an external system. */
|
|
370
|
+
getEffectsForAction(actionId) {
|
|
371
|
+
return this.graph
|
|
372
|
+
.getOutgoingEdges(actionId, { kinds: ['references'] })
|
|
373
|
+
.map((edge) => this.getIntegrationOperation(edge.to))
|
|
374
|
+
.filter((operation) => operation?.mode === 'effect');
|
|
375
|
+
}
|
|
376
|
+
/** Triggers that invoke this action. */
|
|
377
|
+
getTriggersForAction(actionId) {
|
|
378
|
+
return this.graph.getNodesByKind('trigger').filter((trigger) => trigger.actionId === actionId);
|
|
379
|
+
}
|
|
380
|
+
/** The actions an event, once dispatched, invokes — following every trigger bound to it. */
|
|
381
|
+
getActionsTriggeredByEvent(eventId) {
|
|
382
|
+
const triggers = this.graph
|
|
383
|
+
.getNodesByKind('trigger')
|
|
384
|
+
.filter((trigger) => trigger.when.kind === 'event' && trigger.when.eventId === eventId);
|
|
385
|
+
return this.resolve(triggers.map((trigger) => trigger.actionId)).filter((node) => node.kind === 'action');
|
|
386
|
+
}
|
|
387
|
+
/** Every external capability this application can reach, and what it can do with each. */
|
|
388
|
+
getExternalDependencies() {
|
|
389
|
+
return { integrations: this.listIntegrations(), operations: this.graph.getNodesByKind('integration-operation') };
|
|
390
|
+
}
|
|
391
|
+
/** Triggers that fire on a schedule rather than on an event or a lifecycle moment. */
|
|
392
|
+
getTimedTriggers() {
|
|
393
|
+
return this.graph
|
|
394
|
+
.getNodesByKind('trigger')
|
|
395
|
+
.filter((trigger) => trigger.when.kind === 'interval' || trigger.when.kind === 'delay');
|
|
396
|
+
}
|
|
397
|
+
/** Events at least one trigger reacts to — the external/internal facts this application listens for. */
|
|
398
|
+
getWebhookEvents() {
|
|
399
|
+
const referenced = new Set(this.graph
|
|
400
|
+
.getNodesByKind('trigger')
|
|
401
|
+
.filter((trigger) => trigger.when.kind === 'event')
|
|
402
|
+
.map((trigger) => trigger.when.eventId));
|
|
403
|
+
return this.graph.getNodesByKind('event').filter((event) => referenced.has(event.id));
|
|
404
|
+
}
|
|
348
405
|
enclosingViews(id) {
|
|
349
406
|
const node = this.graph.getNode(id);
|
|
350
407
|
const self = node && node.kind === 'view' ? [node] : [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cynodia/axiom-agent-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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.8.0-alpha.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc -b tsconfig.json tsconfig.test.json",
|