@cynodia/axiom-agent-api 0.11.2-alpha.1 → 0.12.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/api.d.ts +10 -0
- package/dist/api.js +12 -0
- package/dist/distributed.d.ts +52 -0
- package/dist/distributed.js +85 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { PresentationQueries } from './presentation-queries.js';
|
|
|
3
3
|
import { Transaction } from './transaction.js';
|
|
4
4
|
import type { ChangeSet } from './changes.js';
|
|
5
5
|
import type { MigrationImpact, SchemaInspection } from './migration.js';
|
|
6
|
+
import type { DistributedSemanticsInspection } from './distributed.js';
|
|
6
7
|
/**
|
|
7
8
|
* The machine-facing interface to an application. Agents query semantics and apply
|
|
8
9
|
* structural transformations; they never edit generated code.
|
|
@@ -32,5 +33,14 @@ export declare class AgentAPI extends PresentationQueries {
|
|
|
32
33
|
* actions, read policies, constraints and UI nodes reference something a migration touches.
|
|
33
34
|
*/
|
|
34
35
|
migrationImpact(previous: ApplicationGraph): MigrationImpact;
|
|
36
|
+
/**
|
|
37
|
+
* The distributed-authority semantics of this application (spec12 §56, §57): its
|
|
38
|
+
* framework-owned async work classes and the guarantee that applies to each, its
|
|
39
|
+
* compatibility identity, cache coherence, and the operational knobs — with the semantic
|
|
40
|
+
* guarantee, the runtime-state source, the provider capability and the tuning kept
|
|
41
|
+
* separate. Static over the graph; live runtime state is `AxiomServer.authority()` /
|
|
42
|
+
* `inspectDistributedWork()`.
|
|
43
|
+
*/
|
|
44
|
+
inspectDistributedSemantics(serverContract?: string): DistributedSemanticsInspection;
|
|
35
45
|
}
|
|
36
46
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.js
CHANGED
|
@@ -2,6 +2,7 @@ import { diffSchema, validateGraph } from '@cynodia/axiom-core';
|
|
|
2
2
|
import { PresentationQueries } from './presentation-queries.js';
|
|
3
3
|
import { Transaction } from './transaction.js';
|
|
4
4
|
import { inspectSchema, migrationImpact } from './migration.js';
|
|
5
|
+
import { inspectDistributedSemantics } from './distributed.js';
|
|
5
6
|
/**
|
|
6
7
|
* The machine-facing interface to an application. Agents query semantics and apply
|
|
7
8
|
* structural transformations; they never edit generated code.
|
|
@@ -49,4 +50,15 @@ export class AgentAPI extends PresentationQueries {
|
|
|
49
50
|
migrationImpact(previous) {
|
|
50
51
|
return migrationImpact(previous, this.graph);
|
|
51
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* The distributed-authority semantics of this application (spec12 §56, §57): its
|
|
55
|
+
* framework-owned async work classes and the guarantee that applies to each, its
|
|
56
|
+
* compatibility identity, cache coherence, and the operational knobs — with the semantic
|
|
57
|
+
* guarantee, the runtime-state source, the provider capability and the tuning kept
|
|
58
|
+
* separate. Static over the graph; live runtime state is `AxiomServer.authority()` /
|
|
59
|
+
* `inspectDistributedWork()`.
|
|
60
|
+
*/
|
|
61
|
+
inspectDistributedSemantics(serverContract) {
|
|
62
|
+
return inspectDistributedSemantics(this.graph, serverContract);
|
|
63
|
+
}
|
|
52
64
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ApplicationGraph, type AuthorityCompatibilityKey } from '@cynodia/axiom-core';
|
|
2
|
+
/**
|
|
3
|
+
* Static, graph-derivable distributed-authority inspection (spec12 §56, §57).
|
|
4
|
+
*
|
|
5
|
+
* The AgentAPI works over an `ApplicationGraph`, not a running authority, so it answers the
|
|
6
|
+
* *semantic* questions — which framework-owned async work this application has, and what
|
|
7
|
+
* distributed guarantee applies to each — not the live runtime state (that is
|
|
8
|
+
* `AxiomServer.authority()` / `inspectDistributedWork()`).
|
|
9
|
+
*
|
|
10
|
+
* Every answer separates the four things spec12 §56 says must never be conflated:
|
|
11
|
+
* `semanticGuarantee` (fixed by the framework), `runtimeStateAvailableFrom` (where to read
|
|
12
|
+
* the live state), `providerCapabilityRequired` (what a provider must advertise), and
|
|
13
|
+
* `operationalTuning` (knobs that never change a guarantee).
|
|
14
|
+
*/
|
|
15
|
+
export interface DeliveryContract {
|
|
16
|
+
logicalCreation: 'exactly-once';
|
|
17
|
+
physicalExecution: 'at-least-once' | 'exactly-once-if-provider-idempotent';
|
|
18
|
+
completionTransition: 'exactly-once';
|
|
19
|
+
}
|
|
20
|
+
export interface DistributedWorkClassInfo {
|
|
21
|
+
workClass: 'effect' | 'schedule-firing' | 'subscription-delivery';
|
|
22
|
+
/** The graph nodes that produce this class of work. */
|
|
23
|
+
sources: string[];
|
|
24
|
+
ownership: 'leased-per-work-item-fenced';
|
|
25
|
+
orderingScope: 'none' | 'per-subscription';
|
|
26
|
+
delivery: DeliveryContract | {
|
|
27
|
+
guarantee: 'at-least-once';
|
|
28
|
+
duplicatesPossible: true;
|
|
29
|
+
};
|
|
30
|
+
providerCapabilityRequired: string[];
|
|
31
|
+
runtimeStateAvailableFrom: string;
|
|
32
|
+
}
|
|
33
|
+
export interface DistributedSemanticsInspection {
|
|
34
|
+
/** No application API activates this; a capable shared provider does (spec12 §88). */
|
|
35
|
+
activation: 'automatic-when-coordination-provider-and-durable-persistence-shared';
|
|
36
|
+
compatibility: AuthorityCompatibilityKey & {
|
|
37
|
+
note: string;
|
|
38
|
+
};
|
|
39
|
+
workClasses: DistributedWorkClassInfo[];
|
|
40
|
+
cacheCoherence: {
|
|
41
|
+
mechanism: 'durable-revision-observation';
|
|
42
|
+
stalenessBoundRevisions: 0;
|
|
43
|
+
requiresBroadcast: false;
|
|
44
|
+
};
|
|
45
|
+
operationalTuning: string[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Summarize the distributed-authority semantics of an application (spec12 §56). Pure over
|
|
49
|
+
* the graph. `serverContract` defaults to `axiom.server.v7` (0.12 adds no IR vocabulary).
|
|
50
|
+
*/
|
|
51
|
+
export declare function inspectDistributedSemantics(graph: ApplicationGraph, serverContract?: string): DistributedSemanticsInspection;
|
|
52
|
+
//# sourceMappingURL=distributed.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { authorityCompatibilityKey, schemaFingerprint, semanticFingerprint, } from '@cynodia/axiom-core';
|
|
2
|
+
const EFFECT_OP_KINDS = new Set(['integration-effect', 'blob-commit', 'blob-delete']);
|
|
3
|
+
function actionsWithEffects(graph) {
|
|
4
|
+
return graph.getNodesByKind('action').filter((action) => (action.operations ?? []).some((op) => EFFECT_OP_KINDS.has(op.kind)));
|
|
5
|
+
}
|
|
6
|
+
function scheduledTriggers(graph) {
|
|
7
|
+
return graph.getNodesByKind('trigger').filter((trigger) => trigger.when.kind === 'interval' || trigger.when.kind === 'delay');
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Summarize the distributed-authority semantics of an application (spec12 §56). Pure over
|
|
11
|
+
* the graph. `serverContract` defaults to `axiom.server.v7` (0.12 adds no IR vocabulary).
|
|
12
|
+
*/
|
|
13
|
+
export function inspectDistributedSemantics(graph, serverContract = 'axiom.server.v7') {
|
|
14
|
+
const effects = actionsWithEffects(graph);
|
|
15
|
+
const schedules = scheduledTriggers(graph);
|
|
16
|
+
const subscriptions = graph.getNodesByKind('subscription');
|
|
17
|
+
const workClasses = [];
|
|
18
|
+
if (effects.length > 0) {
|
|
19
|
+
workClasses.push({
|
|
20
|
+
workClass: 'effect',
|
|
21
|
+
sources: effects.map((action) => String(action.id)),
|
|
22
|
+
ownership: 'leased-per-work-item-fenced',
|
|
23
|
+
orderingScope: 'none',
|
|
24
|
+
delivery: {
|
|
25
|
+
logicalCreation: 'exactly-once',
|
|
26
|
+
physicalExecution: 'at-least-once', // 'exactly-once-if-provider-idempotent' per operation
|
|
27
|
+
completionTransition: 'exactly-once',
|
|
28
|
+
},
|
|
29
|
+
providerCapabilityRequired: ['distributed-lease', 'fencing', 'atomic-work-claim', 'durable-retry'],
|
|
30
|
+
runtimeStateAvailableFrom: 'AxiomServer.inspectDistributedWork().effects',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (schedules.length > 0) {
|
|
34
|
+
workClasses.push({
|
|
35
|
+
workClass: 'schedule-firing',
|
|
36
|
+
sources: schedules.map((trigger) => String(trigger.id)),
|
|
37
|
+
ownership: 'leased-per-work-item-fenced',
|
|
38
|
+
orderingScope: 'none',
|
|
39
|
+
delivery: {
|
|
40
|
+
logicalCreation: 'exactly-once',
|
|
41
|
+
physicalExecution: 'at-least-once',
|
|
42
|
+
completionTransition: 'exactly-once',
|
|
43
|
+
},
|
|
44
|
+
providerCapabilityRequired: ['distributed-lease', 'fencing', 'atomic-work-claim'],
|
|
45
|
+
runtimeStateAvailableFrom: 'AxiomServer.inspectDistributedWork().schedules',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (subscriptions.length > 0) {
|
|
49
|
+
workClasses.push({
|
|
50
|
+
workClass: 'subscription-delivery',
|
|
51
|
+
sources: subscriptions.map((subscription) => String(subscription.id)),
|
|
52
|
+
ownership: 'leased-per-work-item-fenced',
|
|
53
|
+
orderingScope: 'per-subscription',
|
|
54
|
+
delivery: { guarantee: 'at-least-once', duplicatesPossible: true },
|
|
55
|
+
providerCapabilityRequired: ['distributed-lease', 'fencing', 'durable-subscription-cursor', 'event-dedup'],
|
|
56
|
+
runtimeStateAvailableFrom: 'AxiomServer.subscriptionLog() + inspectDistributedWork().subscriptionCursors',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
activation: 'automatic-when-coordination-provider-and-durable-persistence-shared',
|
|
61
|
+
compatibility: {
|
|
62
|
+
...authorityCompatibilityKey({
|
|
63
|
+
schemaVersion: graph.schemaVersion,
|
|
64
|
+
schemaFingerprint: schemaFingerprint(graph),
|
|
65
|
+
serverContract,
|
|
66
|
+
semanticFingerprint: semanticFingerprint(graph),
|
|
67
|
+
}),
|
|
68
|
+
note: 'Two authorities may execute the same durable work iff these four fields are equal (fail closed).',
|
|
69
|
+
},
|
|
70
|
+
workClasses,
|
|
71
|
+
cacheCoherence: {
|
|
72
|
+
mechanism: 'durable-revision-observation',
|
|
73
|
+
stalenessBoundRevisions: 0,
|
|
74
|
+
requiresBroadcast: false,
|
|
75
|
+
},
|
|
76
|
+
operationalTuning: [
|
|
77
|
+
'instanceId',
|
|
78
|
+
'leaseDurationMs',
|
|
79
|
+
'renewIntervalMs',
|
|
80
|
+
'workerConcurrency',
|
|
81
|
+
'claimBatchSize',
|
|
82
|
+
'pollIntervalMs',
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cynodia/axiom-agent-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.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.12.0-alpha.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc -b tsconfig.json tsconfig.test.json",
|