@adea-ai/runtime-sdk 3.1.0 → 3.2.0
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/README.md +11 -16
- package/dist/fixtures.d.ts +3 -3
- package/dist/fixtures.js +14 -1
- package/dist/pi-durable-approvals.js +2 -2
- package/dist/registry.js +1 -4
- package/dist/sessions.js +2 -5
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
# @control-plane/runtime-sdk
|
|
2
2
|
|
|
3
3
|
SDK for building runtimes that plug into the Control Plane: implement the
|
|
4
|
-
adapter interface, declare capabilities, and pass conformance
|
|
4
|
+
adapter interface, declare capabilities, and pass conformance, without
|
|
5
5
|
touching Control Plane internals.
|
|
6
6
|
|
|
7
|
-
Depends only on [`@adea-ai/contracts`](https://www.npmjs.com/package/@adea-ai/contracts)
|
|
8
|
-
|
|
9
|
-
for the service boundary.
|
|
7
|
+
Depends only on [`@adea-ai/contracts`](https://www.npmjs.com/package/@adea-ai/contracts),
|
|
8
|
+
which also carries the service boundary, and Zod.
|
|
10
9
|
|
|
11
10
|
## What's inside
|
|
12
11
|
|
|
13
|
-
- **Adapter
|
|
14
|
-
- **Capabilities & eligibility
|
|
12
|
+
- **Adapter**: the runtime adapter contract and registration types.
|
|
13
|
+
- **Capabilities & eligibility**: declare what a runtime supports and let
|
|
15
14
|
the Control Plane route accordingly.
|
|
16
|
-
- **Discovery & inventory
|
|
15
|
+
- **Discovery & inventory**: runtime discovery records, health, and
|
|
17
16
|
eligibility evaluation.
|
|
18
|
-
- **Conformance & compatibility
|
|
17
|
+
- **Conformance & compatibility**: versioned conformance suites and
|
|
19
18
|
compatibility checks for runtime implementations.
|
|
20
|
-
- **Sessions & routing
|
|
21
|
-
- **Transport
|
|
19
|
+
- **Sessions & routing**: external session types and routing decisions.
|
|
20
|
+
- **Transport**: the co-located transport port with deterministic in-memory
|
|
22
21
|
doubles (`mock.ts`, `fixtures.ts`) for testing adapters.
|
|
23
22
|
|
|
24
23
|
Runtime usage accounting distinguishes HQ-funded API usage (`hq_managed`),
|
|
@@ -46,12 +45,8 @@ import {
|
|
|
46
45
|
const metadata = RuntimeAdapterMetadataSchema.parse(raw)
|
|
47
46
|
```
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
```sh
|
|
53
|
-
bun scripts/compatibility.ts --check
|
|
54
|
-
```
|
|
48
|
+
In this repository, `bun run compatibility:check` (from the root) validates the
|
|
49
|
+
runtime certification matrix and its generated schema.
|
|
55
50
|
|
|
56
51
|
## License
|
|
57
52
|
|
package/dist/fixtures.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const RuntimeFixtures: Readonly<{
|
|
2
|
-
mock: {
|
|
2
|
+
readonly mock: {
|
|
3
3
|
runtimeDefinitionId: import("@adea-ai/contracts").OpaqueIdentifier<"runtime-definition ID">;
|
|
4
4
|
family: string;
|
|
5
5
|
adapterVersion: string;
|
|
@@ -28,7 +28,7 @@ export declare const RuntimeFixtures: Readonly<{
|
|
|
28
28
|
reason?: string | undefined;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
futurePi: {
|
|
31
|
+
readonly futurePi: {
|
|
32
32
|
runtimeDefinitionId: import("@adea-ai/contracts").OpaqueIdentifier<"runtime-definition ID">;
|
|
33
33
|
family: string;
|
|
34
34
|
adapterVersion: string;
|
|
@@ -57,7 +57,7 @@ export declare const RuntimeFixtures: Readonly<{
|
|
|
57
57
|
reason?: string | undefined;
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
|
-
futureAcp: {
|
|
60
|
+
readonly futureAcp: {
|
|
61
61
|
runtimeDefinitionId: import("@adea-ai/contracts").OpaqueIdentifier<"runtime-definition ID">;
|
|
62
62
|
family: string;
|
|
63
63
|
adapterVersion: string;
|
package/dist/fixtures.js
CHANGED
|
@@ -5,7 +5,7 @@ const testedVersions = {
|
|
|
5
5
|
driverVersion: '1.0.0',
|
|
6
6
|
harnessVersion: '1.0.0',
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
const buildFixtures = () => ({
|
|
9
9
|
mock: runtime('rtd_01JABCDEF0123456789ABCDEFG', 'mock', [
|
|
10
10
|
capability('stream.output'),
|
|
11
11
|
capability('output.structured'),
|
|
@@ -28,6 +28,19 @@ export const RuntimeFixtures = Object.freeze({
|
|
|
28
28
|
capability('session.load'),
|
|
29
29
|
]),
|
|
30
30
|
});
|
|
31
|
+
let built;
|
|
32
|
+
const fixtures = () => (built ??= buildFixtures());
|
|
33
|
+
export const RuntimeFixtures = Object.freeze({
|
|
34
|
+
get mock() {
|
|
35
|
+
return fixtures().mock;
|
|
36
|
+
},
|
|
37
|
+
get futurePi() {
|
|
38
|
+
return fixtures().futurePi;
|
|
39
|
+
},
|
|
40
|
+
get futureAcp() {
|
|
41
|
+
return fixtures().futureAcp;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
31
44
|
function runtime(runtimeDefinitionId, family, capabilities) {
|
|
32
45
|
return RuntimeDefinitionSchema.parse({
|
|
33
46
|
runtimeDefinitionId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { canonicalJsonEqual, IdentifierSchemas, Sha256DigestSchema, TimestampSchema, } from '@adea-ai/contracts';
|
|
3
3
|
import { PiDurableDispatchIdSchema } from './pi-durable-ids.js';
|
|
4
4
|
export const PiDurableApprovalEffectDigestSchema = Sha256DigestSchema;
|
|
5
5
|
export const PiDurableApprovalDecisionIdSchema = z.string().regex(/^pi-decision:[a-f0-9]{32}$/);
|
|
@@ -37,5 +37,5 @@ export const PiDurableApprovalDecisionSchema = z.strictObject({
|
|
|
37
37
|
export function samePiDurableApprovalDecision(left, right) {
|
|
38
38
|
const { decidedAt: _left, ...a } = left;
|
|
39
39
|
const { decidedAt: _right, ...b } = right;
|
|
40
|
-
return
|
|
40
|
+
return canonicalJsonEqual(a, b);
|
|
41
41
|
}
|
package/dist/registry.js
CHANGED
|
@@ -220,7 +220,7 @@ export class InMemoryRuntimeConnectionRepository {
|
|
|
220
220
|
return true;
|
|
221
221
|
}
|
|
222
222
|
async get(runtimeConnectionId) {
|
|
223
|
-
return
|
|
223
|
+
return structuredClone(this.#connections.get(runtimeConnectionId));
|
|
224
224
|
}
|
|
225
225
|
async getByIdentityDigest(identityDigest) {
|
|
226
226
|
const runtimeConnectionId = this.#identities.get(identityDigest);
|
|
@@ -303,6 +303,3 @@ function latest(...timestamps) {
|
|
|
303
303
|
function fail(code) {
|
|
304
304
|
throw new RuntimeConnectionRegistryError(code);
|
|
305
305
|
}
|
|
306
|
-
function cloneOptional(value) {
|
|
307
|
-
return value === undefined ? undefined : structuredClone(value);
|
|
308
|
-
}
|
package/dist/sessions.js
CHANGED
|
@@ -128,10 +128,10 @@ export class InMemoryExternalSessionRepository {
|
|
|
128
128
|
return true;
|
|
129
129
|
}
|
|
130
130
|
async get(externalSessionId) {
|
|
131
|
-
return
|
|
131
|
+
return structuredClone(this.#sessions.get(externalSessionId));
|
|
132
132
|
}
|
|
133
133
|
async findByNativeIdentity(runtimeConnectionId, opaqueNativeSessionId) {
|
|
134
|
-
return
|
|
134
|
+
return structuredClone([...this.#sessions.values()].find((session) => session.runtimeConnectionId === runtimeConnectionId &&
|
|
135
135
|
session.opaqueNativeSessionId === opaqueNativeSessionId));
|
|
136
136
|
}
|
|
137
137
|
async list(scope) {
|
|
@@ -400,6 +400,3 @@ function sameRegistration(session, input) {
|
|
|
400
400
|
function fail(code, currentVersion) {
|
|
401
401
|
throw new ExternalSessionRegistryError(code, currentVersion);
|
|
402
402
|
}
|
|
403
|
-
function cloneOptional(value) {
|
|
404
|
-
return value === undefined ? undefined : structuredClone(value);
|
|
405
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adea-ai/runtime-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "SDK for building Control Plane runtimes: adapters, capabilities, conformance, discovery, eligibility, health, sessions, transport, and routing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adapter",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"type": "module",
|
|
24
|
+
"sideEffects": false,
|
|
24
25
|
"browser": false,
|
|
25
26
|
"types": "./dist/index.d.ts",
|
|
26
27
|
"exports": {
|
|
@@ -42,8 +43,8 @@
|
|
|
42
43
|
"test": "bun test src"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
|
-
"@adea-ai/contracts": "^5.0
|
|
46
|
-
"zod": "4.6.
|
|
46
|
+
"@adea-ai/contracts": "^5.1.0",
|
|
47
|
+
"zod": "4.6.7"
|
|
47
48
|
},
|
|
48
49
|
"engines": {
|
|
49
50
|
"node": "24.21.0"
|