@astrale-os/kernel-client 0.6.0-beta.84 → 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
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 {
|
|
@@ -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)
|
|
@@ -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",
|