@cynodia/axiom-agent-api 0.8.1-alpha.1 → 0.9.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 +54 -2
- package/dist/queries.js +87 -2
- package/package.json +2 -2
package/dist/queries.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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';
|
|
1
|
+
import type { ActionDef, AnyNode, ApplicationGraph, ConstraintDef, EdgeKind, EventDef, Expression, ExpressionDef, FieldId, FormNode, GraphEdge, IntegrationDef, IntegrationOperationDef, Location, NodeId, StateDef, StorageDef, SubscriptionDef, TransitionConstraintDef, TriggerDef, UINode, ViewNode } from '@cynodia/axiom-core';
|
|
2
2
|
export interface SubgraphRequest {
|
|
3
3
|
root: NodeId;
|
|
4
4
|
depth?: number;
|
|
@@ -120,8 +120,60 @@ export declare class GraphQueries {
|
|
|
120
120
|
};
|
|
121
121
|
/** Triggers that fire on a schedule rather than on an event or a lifecycle moment. */
|
|
122
122
|
getTimedTriggers(): TriggerDef[];
|
|
123
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* Events at least one trigger reacts to — the internal/external facts this application
|
|
125
|
+
* listens for.
|
|
126
|
+
*
|
|
127
|
+
* This is a **graph-static** query: it answers "which `EventDef`s have a `TriggerDef`
|
|
128
|
+
* bound to them", not "which webhook deliveries has this server received". An event
|
|
129
|
+
* returned here may be dispatched by a verified external webhook, by an effect's
|
|
130
|
+
* `succeededEventId`/`failedEventId`, or by any other internal source — "webhook-ness" is
|
|
131
|
+
* not a property the graph records, so a name implying it overstates what this answers
|
|
132
|
+
* (spec 8.2 §34-35).
|
|
133
|
+
*/
|
|
134
|
+
getTriggeredEvents(): EventDef[];
|
|
135
|
+
/**
|
|
136
|
+
* @deprecated Renamed to {@link getTriggeredEvents} (spec 8.2 §34-36): this answers
|
|
137
|
+
* "which events have a trigger bound to them", not "which webhook deliveries were
|
|
138
|
+
* received" — the two are not the same, since the same query covers effect-outcome
|
|
139
|
+
* events too. Kept as an alias for backward compatibility; new code should call
|
|
140
|
+
* `getTriggeredEvents()` directly.
|
|
141
|
+
*/
|
|
124
142
|
getWebhookEvents(): EventDef[];
|
|
143
|
+
/** Every long-lived external event source this application declares. */
|
|
144
|
+
listSubscriptions(): SubscriptionDef[];
|
|
145
|
+
/** The subscriptions an integration's adapter is responsible for maintaining. */
|
|
146
|
+
getSubscriptionsForIntegration(integrationId: NodeId): SubscriptionDef[];
|
|
147
|
+
/** The `EventDef` a subscription's deliveries become. */
|
|
148
|
+
getEventForSubscription(subscriptionId: NodeId): EventDef | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Every action a delivery on this subscription can reach, following its event through the
|
|
151
|
+
* triggers bound to it. The answer to "what can this feed actually change" without
|
|
152
|
+
* walking the graph by hand.
|
|
153
|
+
*/
|
|
154
|
+
getActionsReachableFromSubscription(subscriptionId: NodeId): ActionDef[];
|
|
155
|
+
/**
|
|
156
|
+
* Every way the outside world can reach this application, in one answer: the integrations
|
|
157
|
+
* it calls, the operations it calls on them, the live sources it listens to, the events
|
|
158
|
+
* those deliver, and the object stores it reads or writes.
|
|
159
|
+
*
|
|
160
|
+
* Graph-static, like every other query here — it says what the application *can* do, not
|
|
161
|
+
* what any running authority has done.
|
|
162
|
+
*/
|
|
163
|
+
getExternalEventSources(): {
|
|
164
|
+
subscriptions: SubscriptionDef[];
|
|
165
|
+
events: EventDef[];
|
|
166
|
+
integrations: IntegrationDef[];
|
|
167
|
+
};
|
|
168
|
+
/** Every object store this application declares. */
|
|
169
|
+
listStorages(): StorageDef[];
|
|
170
|
+
/** Actions that read from, commit into or delete from this store. */
|
|
171
|
+
getActionsUsingStorage(storageId: NodeId): ActionDef[];
|
|
172
|
+
/**
|
|
173
|
+
* Stores that would serve nothing and accept nothing, because they declare no access
|
|
174
|
+
* rule. A missing rule is refusal, so this reports dead capability rather than a hole.
|
|
175
|
+
*/
|
|
176
|
+
getStoragesWithoutAccessRules(): StorageDef[];
|
|
125
177
|
/** Whether an ordinary client `InvokeRequest` may name this action at all. */
|
|
126
178
|
isClientInvocable(actionId: NodeId): boolean;
|
|
127
179
|
/** Whether this action accepts only trigger-, event- or effect-outcome-originated calls. */
|
package/dist/queries.js
CHANGED
|
@@ -394,14 +394,99 @@ export class GraphQueries {
|
|
|
394
394
|
.getNodesByKind('trigger')
|
|
395
395
|
.filter((trigger) => trigger.when.kind === 'interval' || trigger.when.kind === 'delay');
|
|
396
396
|
}
|
|
397
|
-
/**
|
|
398
|
-
|
|
397
|
+
/**
|
|
398
|
+
* Events at least one trigger reacts to — the internal/external facts this application
|
|
399
|
+
* listens for.
|
|
400
|
+
*
|
|
401
|
+
* This is a **graph-static** query: it answers "which `EventDef`s have a `TriggerDef`
|
|
402
|
+
* bound to them", not "which webhook deliveries has this server received". An event
|
|
403
|
+
* returned here may be dispatched by a verified external webhook, by an effect's
|
|
404
|
+
* `succeededEventId`/`failedEventId`, or by any other internal source — "webhook-ness" is
|
|
405
|
+
* not a property the graph records, so a name implying it overstates what this answers
|
|
406
|
+
* (spec 8.2 §34-35).
|
|
407
|
+
*/
|
|
408
|
+
getTriggeredEvents() {
|
|
399
409
|
const referenced = new Set(this.graph
|
|
400
410
|
.getNodesByKind('trigger')
|
|
401
411
|
.filter((trigger) => trigger.when.kind === 'event')
|
|
402
412
|
.map((trigger) => trigger.when.eventId));
|
|
403
413
|
return this.graph.getNodesByKind('event').filter((event) => referenced.has(event.id));
|
|
404
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* @deprecated Renamed to {@link getTriggeredEvents} (spec 8.2 §34-36): this answers
|
|
417
|
+
* "which events have a trigger bound to them", not "which webhook deliveries were
|
|
418
|
+
* received" — the two are not the same, since the same query covers effect-outcome
|
|
419
|
+
* events too. Kept as an alias for backward compatibility; new code should call
|
|
420
|
+
* `getTriggeredEvents()` directly.
|
|
421
|
+
*/
|
|
422
|
+
getWebhookEvents() {
|
|
423
|
+
return this.getTriggeredEvents();
|
|
424
|
+
}
|
|
425
|
+
// -------------------------------------------- subscriptions and object storage
|
|
426
|
+
/** Every long-lived external event source this application declares. */
|
|
427
|
+
listSubscriptions() {
|
|
428
|
+
return this.graph.getNodesByKind('subscription');
|
|
429
|
+
}
|
|
430
|
+
/** The subscriptions an integration's adapter is responsible for maintaining. */
|
|
431
|
+
getSubscriptionsForIntegration(integrationId) {
|
|
432
|
+
return this.listSubscriptions().filter((subscription) => subscription.integrationId === integrationId);
|
|
433
|
+
}
|
|
434
|
+
/** The `EventDef` a subscription's deliveries become. */
|
|
435
|
+
getEventForSubscription(subscriptionId) {
|
|
436
|
+
const subscription = this.graph.getNode(subscriptionId);
|
|
437
|
+
if (subscription?.kind !== 'subscription') {
|
|
438
|
+
return undefined;
|
|
439
|
+
}
|
|
440
|
+
const event = this.graph.getNode(subscription.eventId);
|
|
441
|
+
return event?.kind === 'event' ? event : undefined;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Every action a delivery on this subscription can reach, following its event through the
|
|
445
|
+
* triggers bound to it. The answer to "what can this feed actually change" without
|
|
446
|
+
* walking the graph by hand.
|
|
447
|
+
*/
|
|
448
|
+
getActionsReachableFromSubscription(subscriptionId) {
|
|
449
|
+
const event = this.getEventForSubscription(subscriptionId);
|
|
450
|
+
return event ? this.getActionsTriggeredByEvent(event.id) : [];
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Every way the outside world can reach this application, in one answer: the integrations
|
|
454
|
+
* it calls, the operations it calls on them, the live sources it listens to, the events
|
|
455
|
+
* those deliver, and the object stores it reads or writes.
|
|
456
|
+
*
|
|
457
|
+
* Graph-static, like every other query here — it says what the application *can* do, not
|
|
458
|
+
* what any running authority has done.
|
|
459
|
+
*/
|
|
460
|
+
getExternalEventSources() {
|
|
461
|
+
const subscriptions = this.listSubscriptions();
|
|
462
|
+
const eventIds = new Set(subscriptions.map((subscription) => subscription.eventId));
|
|
463
|
+
const integrationIds = new Set(subscriptions.map((subscription) => subscription.integrationId));
|
|
464
|
+
return {
|
|
465
|
+
subscriptions,
|
|
466
|
+
events: this.graph.getNodesByKind('event').filter((event) => eventIds.has(event.id)),
|
|
467
|
+
integrations: this.listIntegrations().filter((integration) => integrationIds.has(integration.id)),
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
/** Every object store this application declares. */
|
|
471
|
+
listStorages() {
|
|
472
|
+
return this.graph.getNodesByKind('storage');
|
|
473
|
+
}
|
|
474
|
+
/** Actions that read from, commit into or delete from this store. */
|
|
475
|
+
getActionsUsingStorage(storageId) {
|
|
476
|
+
return this.graph
|
|
477
|
+
.getNodesByKind('action')
|
|
478
|
+
.filter((action) => (action.operations ?? []).some((operation) => (operation.kind === 'blob-metadata' ||
|
|
479
|
+
operation.kind === 'blob-commit' ||
|
|
480
|
+
operation.kind === 'blob-delete') &&
|
|
481
|
+
operation.storageId === storageId));
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Stores that would serve nothing and accept nothing, because they declare no access
|
|
485
|
+
* rule. A missing rule is refusal, so this reports dead capability rather than a hole.
|
|
486
|
+
*/
|
|
487
|
+
getStoragesWithoutAccessRules() {
|
|
488
|
+
return this.listStorages().filter((storage) => !storage.readAuthorization && !storage.uploadAuthorization);
|
|
489
|
+
}
|
|
405
490
|
/** Whether an ordinary client `InvokeRequest` may name this action at all. */
|
|
406
491
|
isClientInvocable(actionId) {
|
|
407
492
|
const action = this.graph.getNode(actionId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cynodia/axiom-agent-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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.9.0-alpha.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc -b tsconfig.json tsconfig.test.json",
|