@cynodia/axiom-agent-api 0.8.2-alpha.1 → 0.9.0-alpha.2

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 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;
@@ -140,6 +140,40 @@ export declare class GraphQueries {
140
140
  * `getTriggeredEvents()` directly.
141
141
  */
142
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[];
143
177
  /** Whether an ordinary client `InvokeRequest` may name this action at all. */
144
178
  isClientInvocable(actionId: NodeId): boolean;
145
179
  /** Whether this action accepts only trigger-, event- or effect-outcome-originated calls. */
package/dist/queries.js CHANGED
@@ -422,6 +422,71 @@ export class GraphQueries {
422
422
  getWebhookEvents() {
423
423
  return this.getTriggeredEvents();
424
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
+ }
425
490
  /** Whether an ordinary client `InvokeRequest` may name this action at all. */
426
491
  isClientInvocable(actionId) {
427
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.8.2-alpha.1",
3
+ "version": "0.9.0-alpha.2",
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.8.2-alpha.1"
34
+ "@cynodia/axiom-core": "0.9.0-alpha.2"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "tsc -b tsconfig.json tsconfig.test.json",