@cynodia/axiom-agent-api 0.7.0-alpha.2 → 0.8.1-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 +31 -1
- package/dist/queries.js +79 -1
- 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,36 @@ 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[];
|
|
125
|
+
/** Whether an ordinary client `InvokeRequest` may name this action at all. */
|
|
126
|
+
isClientInvocable(actionId: NodeId): boolean;
|
|
127
|
+
/** Whether this action accepts only trigger-, event- or effect-outcome-originated calls. */
|
|
128
|
+
isSystemOnly(actionId: NodeId): boolean;
|
|
129
|
+
/** Every action reachable only through a trigger, event or effect outcome — never a client. */
|
|
130
|
+
getSystemOnlyActions(): ActionDef[];
|
|
131
|
+
/** Triggers whose target action cannot accept the `'system'`-sourced invocation the trigger always makes. */
|
|
132
|
+
getTriggersTargetingClientOnlyActions(): TriggerDef[];
|
|
103
133
|
protected enclosingViews(id: NodeId): ViewNode[];
|
|
104
134
|
private resolve;
|
|
105
135
|
}
|
package/dist/queries.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isUINode, locationFieldIds, locationRootStateId, locationSelectorFieldIds, referencedIds, } from '@cynodia/axiom-core';
|
|
1
|
+
import { allowedInvocationSources, isClientInvocable as actionIsClientInvocable, isSystemOnlyAction, isUINode, locationFieldIds, locationRootStateId, locationSelectorFieldIds, referencedIds, } from '@cynodia/axiom-core';
|
|
2
2
|
const READ_KINDS = ['reads', 'binds', 'derives-from'];
|
|
3
3
|
const WRITE_KINDS = ['writes'];
|
|
4
4
|
const CONTAINMENT_KINDS = ['contains', 'renders'];
|
|
@@ -345,6 +345,84 @@ 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
|
+
}
|
|
405
|
+
/** Whether an ordinary client `InvokeRequest` may name this action at all. */
|
|
406
|
+
isClientInvocable(actionId) {
|
|
407
|
+
const action = this.graph.getNode(actionId);
|
|
408
|
+
return action?.kind === 'action' ? actionIsClientInvocable(action) : false;
|
|
409
|
+
}
|
|
410
|
+
/** Whether this action accepts only trigger-, event- or effect-outcome-originated calls. */
|
|
411
|
+
isSystemOnly(actionId) {
|
|
412
|
+
const action = this.graph.getNode(actionId);
|
|
413
|
+
return action?.kind === 'action' ? isSystemOnlyAction(action) : false;
|
|
414
|
+
}
|
|
415
|
+
/** Every action reachable only through a trigger, event or effect outcome — never a client. */
|
|
416
|
+
getSystemOnlyActions() {
|
|
417
|
+
return this.graph.getNodesByKind('action').filter((action) => isSystemOnlyAction(action));
|
|
418
|
+
}
|
|
419
|
+
/** Triggers whose target action cannot accept the `'system'`-sourced invocation the trigger always makes. */
|
|
420
|
+
getTriggersTargetingClientOnlyActions() {
|
|
421
|
+
return this.graph.getNodesByKind('trigger').filter((trigger) => {
|
|
422
|
+
const action = this.graph.getNode(trigger.actionId);
|
|
423
|
+
return action?.kind === 'action' && !allowedInvocationSources(action).includes('system');
|
|
424
|
+
});
|
|
425
|
+
}
|
|
348
426
|
enclosingViews(id) {
|
|
349
427
|
const node = this.graph.getNode(id);
|
|
350
428
|
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.1-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.1-alpha.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc -b tsconfig.json tsconfig.test.json",
|