@astrale-os/kernel-client 0.6.0-beta.64 → 0.6.0-beta.65
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/schema/index.d.ts +1 -1
- package/dist/schema/schema.d.ts +2 -0
- package/dist/schema/schema.js +3 -0
- package/dist/session/bound.js +3 -1
- package/dist/session/reference.d.ts +5 -0
- package/dist/session/reference.js +7 -1
- package/dist/session/routing/dispatch.js +1 -0
- package/dist/session/session.js +6 -1
- package/package.json +5 -5
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createSchema, DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS, type SchemaApi, type SchemaCall, type SchemaOptions, type DomainBundle, type DomainInfo, type InstallResult, } from './schema.js';
|
|
1
|
+
export { createSchema, DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS, type SchemaApi, type SchemaCall, type SchemaOptions, type DomainBundle, type DomainDependencies, type DomainInfo, type InstallResult, } from './schema.js';
|
|
2
2
|
export { acceptOperationId, createOperationId } from './operation.js';
|
|
3
3
|
export type { DomainRequest, InstallReceipt, InstallRequest, OperationId, UninstallReceipt, UninstallRequest, } from './contracts.js';
|
package/dist/schema/schema.d.ts
CHANGED
|
@@ -9,12 +9,14 @@ export interface SchemaOptions extends protocolSchema.installation.introspection
|
|
|
9
9
|
}
|
|
10
10
|
export type DomainInfo = protocolSchema.installation.introspection.DomainInfo;
|
|
11
11
|
export type DomainBundle = protocolSchema.installation.introspection.DomainBundle;
|
|
12
|
+
export type DomainDependencies = protocolSchema.installation.introspection.DomainDependencies;
|
|
12
13
|
export type InstallResult = protocolSchema.installation.InstallResult;
|
|
13
14
|
export interface SchemaApi {
|
|
14
15
|
install(request: InstallRequest, options?: RequestOptions): Promise<InstallResult>;
|
|
15
16
|
uninstall(request: UninstallRequest, options?: RequestOptions): Promise<UninstallReceipt>;
|
|
16
17
|
inspect(origin: Key.Origin, options?: RequestOptions): Promise<DomainInfo>;
|
|
17
18
|
bundle(origin: Key.Origin, options?: RequestOptions): Promise<DomainBundle>;
|
|
19
|
+
dependencies(origin: Key.Origin, options?: RequestOptions): Promise<DomainDependencies>;
|
|
18
20
|
}
|
|
19
21
|
export declare const DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS = 110000;
|
|
20
22
|
/** Bind the canonical Schema lifecycle syscalls to one caller-scoped value-call capability. */
|
package/dist/schema/schema.js
CHANGED
|
@@ -43,6 +43,9 @@ export function createSchema(call, limits) {
|
|
|
43
43
|
async bundle(origin, options) {
|
|
44
44
|
return introspect(call, admittedLimits, { kind: 'bundle', origin }, options);
|
|
45
45
|
},
|
|
46
|
+
async dependencies(origin, options) {
|
|
47
|
+
return introspect(call, admittedLimits, { kind: 'dependencies', origin }, options);
|
|
48
|
+
},
|
|
46
49
|
});
|
|
47
50
|
}
|
|
48
51
|
function snapshotUninstallRequest(request) {
|
package/dist/session/bound.js
CHANGED
|
@@ -23,7 +23,8 @@ export function bindSession(source, controls) {
|
|
|
23
23
|
const uninstall = (request, options) => schemaSource.uninstall(request, controlOptions(options, admittedControls));
|
|
24
24
|
const inspect = (origin, options) => schemaSource.inspect(origin, controlOptions(options, admittedControls));
|
|
25
25
|
const bundle = (origin, options) => schemaSource.bundle(origin, controlOptions(options, admittedControls));
|
|
26
|
-
const
|
|
26
|
+
const dependencies = (origin, options) => schemaSource.dependencies(origin, controlOptions(options, admittedControls));
|
|
27
|
+
const schema = Object.freeze({ install, uninstall, inspect, bundle, dependencies });
|
|
27
28
|
const graph = createGraph(call);
|
|
28
29
|
const auth = createAuth((target, input, options) => call(createCall(target, input), options));
|
|
29
30
|
return Object.freeze({
|
|
@@ -82,6 +83,7 @@ function captureSchema(input) {
|
|
|
82
83
|
uninstall: capture(input, 'uninstall'),
|
|
83
84
|
inspect: capture(input, 'inspect'),
|
|
84
85
|
bundle: capture(input, 'bundle'),
|
|
86
|
+
dependencies: capture(input, 'dependencies'),
|
|
85
87
|
});
|
|
86
88
|
}
|
|
87
89
|
function invalid() {
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { Path as PathValue, PathLike } from '@astrale-os/kernel-core/path';
|
|
2
2
|
import type { CallableInputOf, CallableOutputOf, CallableResultOf, Domain, ResolvedFunction, ExecutableMethod } from '@astrale-os/kernel-dsl/v1';
|
|
3
3
|
import type { Revision } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
4
|
+
import { schema as dslSchema } from '@astrale-os/kernel-dsl/v1';
|
|
4
5
|
import { type Key as KeyType } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
5
6
|
import type { Binary, Input } from '../client/index.js';
|
|
6
7
|
declare const REFERENCE_INPUT: unique symbol;
|
|
7
8
|
declare const REFERENCE_OUTPUT: unique symbol;
|
|
8
9
|
export interface CallableReference<InputValue = Input, Output = unknown> {
|
|
9
10
|
readonly origin: KeyType.Origin;
|
|
11
|
+
/** @deprecated Informational only; dispatch pins `fingerprint` and revision pinning will be removed. */
|
|
10
12
|
readonly revision: Revision;
|
|
13
|
+
/** Meaning fingerprint of the callable; a generated reference always carries one. */
|
|
14
|
+
readonly fingerprint?: dslSchema.MeaningFingerprint;
|
|
11
15
|
readonly callable: KeyType.Callable;
|
|
12
16
|
readonly target: PathValue;
|
|
13
17
|
readonly outputMode: 'value' | 'stream' | 'binary';
|
|
@@ -18,6 +22,7 @@ export interface InstanceCallableReference<InputValue = Input, Output = unknown>
|
|
|
18
22
|
(receiver: PathLike): CallableReference<InputValue, Output>;
|
|
19
23
|
readonly origin: KeyType.Origin;
|
|
20
24
|
readonly revision: Revision;
|
|
25
|
+
readonly fingerprint: dslSchema.MeaningFingerprint;
|
|
21
26
|
readonly callable: KeyType.Callable;
|
|
22
27
|
readonly outputMode: 'value' | 'stream' | 'binary';
|
|
23
28
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
+
import { schema as dslSchema } from '@astrale-os/kernel-dsl/v1';
|
|
2
3
|
import { callableAddress, Key, patterns, } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
4
|
+
const FINGERPRINT_PATTERN = /^sha256:[0-9a-f]{64}$/u;
|
|
3
5
|
export function reference(domain, callable) {
|
|
4
6
|
if (Key.origin(callable.key) !== domain.origin)
|
|
5
7
|
invalid();
|
|
@@ -8,6 +10,7 @@ export function reference(domain, callable) {
|
|
|
8
10
|
const common = Object.freeze({
|
|
9
11
|
origin: domain.origin,
|
|
10
12
|
revision: domain.revision,
|
|
13
|
+
fingerprint: dslSchema.callableFingerprint(callable),
|
|
11
14
|
callable: callable.key,
|
|
12
15
|
outputMode: callable.output.mode,
|
|
13
16
|
});
|
|
@@ -33,7 +36,9 @@ export function admitReference(input) {
|
|
|
33
36
|
typeof input.callable !== 'string' ||
|
|
34
37
|
!Key.is(input.callable) ||
|
|
35
38
|
Key.origin(input.callable) !== input.origin ||
|
|
36
|
-
!['value', 'stream', 'binary'].includes(input.outputMode)
|
|
39
|
+
!['value', 'stream', 'binary'].includes(input.outputMode) ||
|
|
40
|
+
(input.fingerprint !== undefined &&
|
|
41
|
+
(typeof input.fingerprint !== 'string' || !FINGERPRINT_PATTERN.test(input.fingerprint))))
|
|
37
42
|
invalid();
|
|
38
43
|
const target = Path.from(input.target);
|
|
39
44
|
if (!matchesCallable(target, input.callable))
|
|
@@ -41,6 +46,7 @@ export function admitReference(input) {
|
|
|
41
46
|
return Object.freeze({
|
|
42
47
|
origin: input.origin,
|
|
43
48
|
revision: input.revision,
|
|
49
|
+
...(input.fingerprint === undefined ? {} : { fingerprint: input.fingerprint }),
|
|
44
50
|
callable: input.callable,
|
|
45
51
|
target,
|
|
46
52
|
outputMode: input.outputMode,
|
|
@@ -122,6 +122,7 @@ function isRouteCompatibilityConflict(input) {
|
|
|
122
122
|
...(input.data === undefined ? {} : { data: input.data }),
|
|
123
123
|
});
|
|
124
124
|
return (failure?.data.code === invocationProtocol.SCHEMA_REVISION_MISMATCH ||
|
|
125
|
+
failure?.data.code === invocationProtocol.CALLABLE_FINGERPRINT_MISMATCH ||
|
|
125
126
|
failure?.data.code === invocationProtocol.SERVICE_TRUST_REQUIRED);
|
|
126
127
|
}
|
|
127
128
|
function requireTargetPublication(route, target) {
|
package/dist/session/session.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
+
import { schema as dslSchema } from '@astrale-os/kernel-dsl/v1';
|
|
2
3
|
import { Client } from '../client/index.js';
|
|
3
4
|
import { SessionError } from '../errors/index.js';
|
|
4
5
|
import { createDomainBinding } from '../graph/domain/binding.js';
|
|
@@ -128,10 +129,13 @@ export class ClientSession {
|
|
|
128
129
|
const instance = last?.kind === 'method' && last.dispatch === 'instance'
|
|
129
130
|
? Path.fromAST({ anchor, steps: steps.slice(0, -1) }).raw
|
|
130
131
|
: undefined;
|
|
132
|
+
// A generated reference pins the callable meaning; a hand-written one still pins the revision.
|
|
131
133
|
const result = await this.dispatcher.dispatch({
|
|
132
134
|
target: Object.freeze({
|
|
133
135
|
callable: admittedReference.callable,
|
|
134
|
-
|
|
136
|
+
...(admittedReference.fingerprint === undefined
|
|
137
|
+
? { revision: admittedReference.revision }
|
|
138
|
+
: { fingerprint: admittedReference.fingerprint }),
|
|
135
139
|
...(instance === undefined ? {} : { instance }),
|
|
136
140
|
}),
|
|
137
141
|
input,
|
|
@@ -174,6 +178,7 @@ export class ClientSession {
|
|
|
174
178
|
return this.invoke({
|
|
175
179
|
origin: owner.origin,
|
|
176
180
|
revision: owner.revision,
|
|
181
|
+
fingerprint: dslSchema.callableFingerprint(method),
|
|
177
182
|
callable: method.key,
|
|
178
183
|
target: Path.instanceMethod(Path.id(node.id), method.key),
|
|
179
184
|
outputMode: method.output.mode,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-client",
|
|
3
|
-
"version": "0.6.0-beta.
|
|
3
|
+
"version": "0.6.0-beta.65",
|
|
4
4
|
"description": "Universal Client — protocol-first, transport-agnostic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -65,14 +65,14 @@
|
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@astrale-os/kernel-core": "0.9.0-beta.
|
|
69
|
-
"@astrale-os/kernel-dsl": "0.2.0-beta.
|
|
70
|
-
"@astrale-os/kernel-protocol": "0.5.0-beta.
|
|
68
|
+
"@astrale-os/kernel-core": "0.9.0-beta.50",
|
|
69
|
+
"@astrale-os/kernel-dsl": "0.2.0-beta.35",
|
|
70
|
+
"@astrale-os/kernel-protocol": "0.5.0-beta.56",
|
|
71
71
|
"@tanstack/pacer": "0.20.1",
|
|
72
72
|
"msgpackr": "^2.0.5"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@astrale-os/kernel-server": "0.5.0-beta.
|
|
75
|
+
"@astrale-os/kernel-server": "0.5.0-beta.58",
|
|
76
76
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
77
77
|
"@types/node": "^22.0.0",
|
|
78
78
|
"typescript": "7.0.2",
|