@astrale-os/kernel-client 0.6.0-beta.83 → 0.6.0-beta.85
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/auth/auth.d.ts +4 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/schema.d.ts +3 -0
- package/dist/schema/schema.js +3 -0
- package/dist/session/admission.d.ts +2 -2
- package/dist/session/admission.js +3 -10
- package/dist/session/bound.js +10 -1
- package/dist/session/exchange/exchange.js +1 -1
- package/dist/session/routing/cache.js +3 -13
- package/dist/session/session.js +1 -1
- package/package.json +5 -5
package/dist/auth/auth.d.ts
CHANGED
|
@@ -14,7 +14,10 @@ export interface FunctionAdmission {
|
|
|
14
14
|
readonly receiver?: NodePath;
|
|
15
15
|
}
|
|
16
16
|
export interface AdmissionOptions extends RequestOptions {
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Ignored. Admission always delegates the session caller unchanged (`self`); the
|
|
19
|
+
* Kernel refuses any other attenuation.
|
|
20
|
+
*/
|
|
18
21
|
readonly attenuation?: UnresolvedIdentityExpr;
|
|
19
22
|
}
|
|
20
23
|
export interface AuthApi {
|
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 DomainDependencies, 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 InstalledPin, type InstalledRelease, 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
|
@@ -10,6 +10,8 @@ export interface SchemaOptions extends protocolSchema.installation.introspection
|
|
|
10
10
|
export type DomainInfo = protocolSchema.installation.introspection.DomainInfo;
|
|
11
11
|
export type DomainBundle = protocolSchema.installation.introspection.DomainBundle;
|
|
12
12
|
export type DomainDependencies = protocolSchema.installation.introspection.DomainDependencies;
|
|
13
|
+
export type InstalledRelease = protocolSchema.installation.introspection.InstalledRelease;
|
|
14
|
+
export type InstalledPin = protocolSchema.installation.introspection.InstalledPin;
|
|
13
15
|
export type InstallResult = protocolSchema.installation.InstallResult;
|
|
14
16
|
export interface SchemaApi {
|
|
15
17
|
install(request: InstallRequest, options?: RequestOptions): Promise<InstallResult>;
|
|
@@ -17,6 +19,7 @@ export interface SchemaApi {
|
|
|
17
19
|
inspect(origin: Key.Origin, options?: RequestOptions): Promise<DomainInfo>;
|
|
18
20
|
bundle(origin: Key.Origin, options?: RequestOptions): Promise<DomainBundle>;
|
|
19
21
|
dependencies(origin: Key.Origin, options?: RequestOptions): Promise<DomainDependencies>;
|
|
22
|
+
installed(options?: RequestOptions): Promise<readonly InstalledRelease[]>;
|
|
20
23
|
}
|
|
21
24
|
export declare const DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS = 110000;
|
|
22
25
|
/** Bind the canonical Schema lifecycle syscalls to one caller-scoped value-call capability. */
|
package/dist/schema/schema.js
CHANGED
|
@@ -54,6 +54,9 @@ export function createSchema(call, limits) {
|
|
|
54
54
|
async dependencies(origin, options) {
|
|
55
55
|
return introspect(call, admittedLimits, { kind: 'dependencies', origin }, options);
|
|
56
56
|
},
|
|
57
|
+
async installed(options) {
|
|
58
|
+
return introspect(call, admittedLimits, { kind: 'installed' }, options);
|
|
59
|
+
},
|
|
57
60
|
});
|
|
58
61
|
}
|
|
59
62
|
function snapshotUninstallRequest(request) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { invocation } from '@astrale-os/kernel-protocol';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FunctionAdmission } from '../auth/index.js';
|
|
3
3
|
import type { SessionOperation } from './context/index.js';
|
|
4
4
|
import type { ExchangeDependencies } from './exchange/index.js';
|
|
5
5
|
/** Check a remote Call through the existing Domain exchange and Kernel admission protocols. */
|
|
6
|
-
export declare function admitFunction(dependencies: ExchangeDependencies, call: invocation.Call,
|
|
6
|
+
export declare function admitFunction(dependencies: ExchangeDependencies, call: invocation.Call, operation: SessionOperation): Promise<FunctionAdmission>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { grant } from '@astrale-os/kernel-core/auth';
|
|
2
1
|
import { targetPath } from '@astrale-os/kernel-core/callable';
|
|
3
2
|
import { Path } from '@astrale-os/kernel-core/path';
|
|
4
3
|
import { admitOutput } from '@astrale-os/kernel-core/schema/kernel/syscalls/contracts';
|
|
@@ -11,15 +10,12 @@ import { matchesCallable } from './reference.js';
|
|
|
11
10
|
import { requireResultKind, resolveAuth } from './routing/index.js';
|
|
12
11
|
const ADMIT = Path.staticMethod(Path.project(functions.admit.owner), functions.admit.name);
|
|
13
12
|
/** Check a remote Call through the existing Domain exchange and Kernel admission protocols. */
|
|
14
|
-
export async function admitFunction(dependencies, call,
|
|
13
|
+
export async function admitFunction(dependencies, call, operation) {
|
|
15
14
|
const target = Path.parse(targetPath(call.target));
|
|
16
15
|
const origin = callableOrigin(target);
|
|
17
16
|
if (origin === undefined) {
|
|
18
17
|
throw new ClientError('Function admission requires a Domain-qualified callable target.');
|
|
19
18
|
}
|
|
20
|
-
const attenuation = options?.attenuation === undefined
|
|
21
|
-
? undefined
|
|
22
|
-
: grant.acceptUnresolved({ v: 1, expr: options.attenuation }).expr;
|
|
23
19
|
const effective = await resolveAuth(dependencies.auth, call, operation);
|
|
24
20
|
if (!isAuthority(effective)) {
|
|
25
21
|
throw new ClientError('Function admission requires an authenticated session.');
|
|
@@ -29,11 +25,8 @@ export async function admitFunction(dependencies, call, options, operation) {
|
|
|
29
25
|
if (domain === undefined) {
|
|
30
26
|
throw new ClientError('Function admission through token exchange requires a remote Domain.');
|
|
31
27
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
ttlSeconds: effective.delegate.ttlSeconds,
|
|
35
|
-
attenuation: attenuation ?? effective.delegate.attenuation ?? SELF_ATTENUATION,
|
|
36
|
-
}, operation);
|
|
28
|
+
// The Kernel preserves the session caller; `self` is the only attenuation it admits.
|
|
29
|
+
const exchanged = await exchangeDomainCredential(dependencies, effective, { issuer: domain, ttlSeconds: effective.delegate.ttlSeconds, attenuation: SELF_ATTENUATION }, operation);
|
|
37
30
|
const result = await runSessionOperation(operation, () => dependencies
|
|
38
31
|
.source()
|
|
39
32
|
.as(exchanged.credential)
|
package/dist/session/bound.js
CHANGED
|
@@ -34,7 +34,15 @@ export function bindSession(source, controls) {
|
|
|
34
34
|
const inspect = (origin, options) => schemaSource.inspect(origin, controlOptions(options, admittedControls));
|
|
35
35
|
const bundle = (origin, options) => schemaSource.bundle(origin, controlOptions(options, admittedControls));
|
|
36
36
|
const dependencies = (origin, options) => schemaSource.dependencies(origin, controlOptions(options, admittedControls));
|
|
37
|
-
const
|
|
37
|
+
const installed = (options) => schemaSource.installed(controlOptions(options, admittedControls));
|
|
38
|
+
const schema = Object.freeze({
|
|
39
|
+
install,
|
|
40
|
+
uninstall,
|
|
41
|
+
inspect,
|
|
42
|
+
bundle,
|
|
43
|
+
dependencies,
|
|
44
|
+
installed,
|
|
45
|
+
});
|
|
38
46
|
const graph = createGraph(call);
|
|
39
47
|
const auth = createAuth((target, input, options) => call(createCall(target, input), options), admit);
|
|
40
48
|
return Object.freeze({
|
|
@@ -103,6 +111,7 @@ function captureSchema(input) {
|
|
|
103
111
|
inspect: capture(input, 'inspect'),
|
|
104
112
|
bundle: capture(input, 'bundle'),
|
|
105
113
|
dependencies: capture(input, 'dependencies'),
|
|
114
|
+
installed: capture(input, 'installed'),
|
|
106
115
|
});
|
|
107
116
|
}
|
|
108
117
|
function invalid() {
|
|
@@ -47,7 +47,7 @@ export async function acquireDomainCredential(dependencies, request, operation)
|
|
|
47
47
|
const exchange = (source) => exchangeDomainCredential(dependencies, source, {
|
|
48
48
|
issuer: request.issuer,
|
|
49
49
|
ttlSeconds: request.ttlSeconds,
|
|
50
|
-
attenuation:
|
|
50
|
+
attenuation: SELF_ATTENUATION,
|
|
51
51
|
...(request.ttlSeconds * 1_000 > coverageMs ? { coverageMs } : {}),
|
|
52
52
|
}, operation);
|
|
53
53
|
const source = await resolveAuth(auth, call, operation);
|
|
@@ -277,19 +277,9 @@ function canonicalDelegate(input) {
|
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
function canonicalExpr(input) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
: { kind: 'identity', credential: input.credential };
|
|
284
|
-
}
|
|
285
|
-
if (input.kind === 'exclude') {
|
|
286
|
-
return {
|
|
287
|
-
kind: 'exclude',
|
|
288
|
-
base: canonicalExpr(input.base),
|
|
289
|
-
excluded: input.excluded.map(canonicalExpr),
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
return { kind: input.kind, operands: input.operands.map(canonicalExpr) };
|
|
280
|
+
return 'self' in input
|
|
281
|
+
? { kind: 'identity', self: true }
|
|
282
|
+
: { kind: 'identity', credential: input.credential };
|
|
293
283
|
}
|
|
294
284
|
async function digestText(input) {
|
|
295
285
|
const webCrypto = typeof crypto === 'undefined' ? undefined : crypto;
|
package/dist/session/session.js
CHANGED
|
@@ -138,7 +138,7 @@ export class ClientSession {
|
|
|
138
138
|
this.graph = createGraph((call, options) => this.call(call, options));
|
|
139
139
|
this.auth = createAuth((target, input, options) => this.call({ target, input }, options), (call, options) => {
|
|
140
140
|
const operation = this.operation(admitControlOptions(options));
|
|
141
|
-
return admitFunction(this.exchangeDependencies, acceptCall(call),
|
|
141
|
+
return admitFunction(this.exchangeDependencies, acceptCall(call), operation);
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
/** Bind one admitted DSL Domain to authenticated graph projection and Method dispatch. */
|
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.85",
|
|
4
4
|
"description": "Universal Client — protocol-first, transport-agnostic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -65,13 +65,13 @@
|
|
|
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.64",
|
|
69
|
+
"@astrale-os/kernel-dsl": "0.2.0-beta.46",
|
|
70
|
+
"@astrale-os/kernel-protocol": "0.5.0-beta.70",
|
|
71
71
|
"@tanstack/pacer": "0.20.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@astrale-os/kernel-server": "0.5.0-beta.
|
|
74
|
+
"@astrale-os/kernel-server": "0.5.0-beta.72",
|
|
75
75
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
76
76
|
"@types/node": "^22.0.0",
|
|
77
77
|
"typescript": "7.0.2",
|