@astrale-os/kernel-core 0.9.0-beta.37 → 0.9.0-beta.39
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/authority/admission/admission.js +17 -0
- package/dist/auth/authority/language/predicate.d.ts +9 -1
- package/dist/auth/authority/language/predicate.js +1 -1
- package/dist/auth/authority/normalization/normalize.js +9 -0
- package/dist/schema/kernel/schema.d.ts +19 -19
- package/package.json +2 -2
|
@@ -44,6 +44,13 @@ function admit(input, path, locals, subjectBound, depth) {
|
|
|
44
44
|
grant: acceptGrant(value.grant),
|
|
45
45
|
where: admit(required(value.where, `${path}/where`), `${path}/where`, locals, true, depth + 1),
|
|
46
46
|
};
|
|
47
|
+
case 'same-node':
|
|
48
|
+
exact(value, ['op', 'left', 'right'], path);
|
|
49
|
+
return {
|
|
50
|
+
op: 'same-node',
|
|
51
|
+
left: term(value.left, `${path}/left`, locals, subjectBound),
|
|
52
|
+
right: term(value.right, `${path}/right`, locals, subjectBound),
|
|
53
|
+
};
|
|
47
54
|
case 'related': {
|
|
48
55
|
const hasRepeat = Object.hasOwn(value, 'repeat');
|
|
49
56
|
exact(value, hasRepeat
|
|
@@ -119,6 +126,16 @@ function term(input, path, locals, subjectBound) {
|
|
|
119
126
|
case 'domain':
|
|
120
127
|
exact(value, ['kind', 'origin'], path);
|
|
121
128
|
return { kind: 'domain', origin: domainOrigin(value.origin, `${path}/origin`) };
|
|
129
|
+
case 'ref': {
|
|
130
|
+
exact(value, ['kind', 'ref'], path);
|
|
131
|
+
const ref = absoluteRef(value.ref, `${path}/ref`);
|
|
132
|
+
if (ref.kind === 'core')
|
|
133
|
+
return { kind: 'ref', ref: coreRef(value.ref, `${path}/ref`) };
|
|
134
|
+
if (!['class', 'function', 'policy', 'view'].includes(ref.kind))
|
|
135
|
+
invalid(`${path}/ref/kind`, 'Expected a projected Schema member');
|
|
136
|
+
definitionName(ref.name, `${path}/ref/name`);
|
|
137
|
+
return { kind: 'ref', ref: ref };
|
|
138
|
+
}
|
|
122
139
|
case 'core':
|
|
123
140
|
exact(value, ['kind', 'ref'], path);
|
|
124
141
|
return { kind: 'core', ref: coreRef(value.ref, `${path}/ref`) };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ClassRef, CoreRef, Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
|
+
import type { PolicyObjectRef } from '@astrale-os/kernel-dsl/v1/language';
|
|
2
3
|
import type { NodeId } from '../../../graph/node/index.js';
|
|
3
4
|
import type { Grant } from '../../grant/index.js';
|
|
4
|
-
export declare const AUTHORITY_PREDICATE_VERSION:
|
|
5
|
+
export declare const AUTHORITY_PREDICATE_VERSION: 8;
|
|
5
6
|
export type Operation = 'create' | 'read' | 'traverse' | 'update' | 'delete';
|
|
6
7
|
export type Input = 'object' | 'source' | 'target';
|
|
7
8
|
export type { ClassRef } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
@@ -20,6 +21,9 @@ export type Term = {
|
|
|
20
21
|
} | {
|
|
21
22
|
readonly kind: 'core';
|
|
22
23
|
readonly ref: CoreRef;
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: 'ref';
|
|
26
|
+
readonly ref: PolicyObjectRef;
|
|
23
27
|
} | {
|
|
24
28
|
readonly kind: 'local';
|
|
25
29
|
readonly id: number;
|
|
@@ -46,6 +50,10 @@ export interface Requirement {
|
|
|
46
50
|
readonly evidence: 'allowed' | 'owner';
|
|
47
51
|
}
|
|
48
52
|
export type AuthorityExpr = {
|
|
53
|
+
readonly op: 'same-node';
|
|
54
|
+
readonly left: Term;
|
|
55
|
+
readonly right: Term;
|
|
56
|
+
} | {
|
|
49
57
|
readonly op: 'true';
|
|
50
58
|
} | {
|
|
51
59
|
readonly op: 'false';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AUTHORITY_PREDICATE_VERSION =
|
|
1
|
+
export const AUTHORITY_PREDICATE_VERSION = 8;
|
|
@@ -39,6 +39,13 @@ function normalize(expr, path, locals, subjectBound) {
|
|
|
39
39
|
grant: canonicalizeGrant(expr.grant),
|
|
40
40
|
where: normalize(expr.where, `${path}/where`, locals, true),
|
|
41
41
|
});
|
|
42
|
+
case 'same-node': {
|
|
43
|
+
const left = normalizeTerm(expr.left);
|
|
44
|
+
const right = normalizeTerm(expr.right);
|
|
45
|
+
return Object.freeze(compare(portable.json.serialize(left), portable.json.serialize(right)) <= 0
|
|
46
|
+
? { op: 'same-node', left, right }
|
|
47
|
+
: { op: 'same-node', left: right, right: left });
|
|
48
|
+
}
|
|
42
49
|
case 'related':
|
|
43
50
|
return Object.freeze({
|
|
44
51
|
op: 'related',
|
|
@@ -114,6 +121,8 @@ function normalizeTerm(term) {
|
|
|
114
121
|
return Object.freeze({ kind: 'class', ref: Object.freeze({ ...term.ref }) });
|
|
115
122
|
case 'domain':
|
|
116
123
|
return Object.freeze({ kind: 'domain', origin: term.origin });
|
|
124
|
+
case 'ref':
|
|
125
|
+
return Object.freeze({ kind: 'ref', ref: Object.freeze({ ...term.ref }) });
|
|
117
126
|
case 'core':
|
|
118
127
|
return Object.freeze({ kind: 'core', ref: Object.freeze({ ...term.ref }) });
|
|
119
128
|
case 'local':
|
|
@@ -5625,16 +5625,6 @@ export declare const AuthorityRelations: Readonly<{
|
|
|
5625
5625
|
}>;
|
|
5626
5626
|
/** Exact authorized Kernel Functions for which pristine Root receives direct can_use authority. */
|
|
5627
5627
|
export declare const KernelRootFunctions: readonly ((import("@astrale-os/kernel-dsl/v1").ResolvedFunction<{
|
|
5628
|
-
kind: "bundle" | "inspect";
|
|
5629
|
-
origin: string;
|
|
5630
|
-
}, {
|
|
5631
|
-
readonly mode: 'binary';
|
|
5632
|
-
}, "authenticated", import("@astrale-os/kernel-dsl/v1").PolicyCheckExpression<import("@astrale-os/kernel-dsl/v1").PolicyRef, import("@astrale-os/kernel-dsl/v1/language").PolicyCheckObject>> & {
|
|
5633
|
-
readonly ref: import("@astrale-os/kernel-dsl/v1").FunctionRef<"introspect"> & {
|
|
5634
|
-
readonly origin: "kernel.astrale.ai";
|
|
5635
|
-
};
|
|
5636
|
-
readonly key: "kernel.astrale.ai:function.introspect";
|
|
5637
|
-
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedFunction<{
|
|
5638
5628
|
operation: string;
|
|
5639
5629
|
domains: ({
|
|
5640
5630
|
artifact: {
|
|
@@ -5659,6 +5649,16 @@ export declare const KernelRootFunctions: readonly ((import("@astrale-os/kernel-
|
|
|
5659
5649
|
readonly origin: "kernel.astrale.ai";
|
|
5660
5650
|
};
|
|
5661
5651
|
readonly key: "kernel.astrale.ai:function.install";
|
|
5652
|
+
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedFunction<{
|
|
5653
|
+
kind: "bundle" | "inspect";
|
|
5654
|
+
origin: string;
|
|
5655
|
+
}, {
|
|
5656
|
+
readonly mode: 'binary';
|
|
5657
|
+
}, "authenticated", import("@astrale-os/kernel-dsl/v1").PolicyCheckExpression<import("@astrale-os/kernel-dsl/v1").PolicyRef, import("@astrale-os/kernel-dsl/v1/language").PolicyCheckObject>> & {
|
|
5658
|
+
readonly ref: import("@astrale-os/kernel-dsl/v1").FunctionRef<"introspect"> & {
|
|
5659
|
+
readonly origin: "kernel.astrale.ai";
|
|
5660
|
+
};
|
|
5661
|
+
readonly key: "kernel.astrale.ai:function.introspect";
|
|
5662
5662
|
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedFunction<{
|
|
5663
5663
|
invocation?: {
|
|
5664
5664
|
source: string;
|
|
@@ -6465,6 +6465,15 @@ export declare const KernelRootFunctions: readonly ((import("@astrale-os/kernel-
|
|
|
6465
6465
|
readonly origin: "kernel.astrale.ai";
|
|
6466
6466
|
};
|
|
6467
6467
|
readonly key: "kernel.astrale.ai:function.uninstall";
|
|
6468
|
+
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedMethod<{
|
|
6469
|
+
audience?: string | undefined;
|
|
6470
|
+
ttlSeconds: number;
|
|
6471
|
+
grant?: unknown;
|
|
6472
|
+
}, {
|
|
6473
|
+
readonly mode: 'value';
|
|
6474
|
+
readonly value: string;
|
|
6475
|
+
}, true, "default", "authenticated", import("@astrale-os/kernel-dsl/v1").PolicyCheckExpression<import("@astrale-os/kernel-dsl/v1").PolicyRef, import("@astrale-os/kernel-dsl/v1/language").PolicyCheckObject>, "kernel.astrale.ai:class.Identity.method.mint"> & {
|
|
6476
|
+
readonly name: "mint";
|
|
6468
6477
|
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedMethod<{
|
|
6469
6478
|
iss: string;
|
|
6470
6479
|
sub: string;
|
|
@@ -6524,15 +6533,6 @@ export declare const KernelRootFunctions: readonly ((import("@astrale-os/kernel-
|
|
|
6524
6533
|
};
|
|
6525
6534
|
}, true, "sealed", "authorized", import("@astrale-os/kernel-dsl/v1").PolicyCheckExpression<import("@astrale-os/kernel-dsl/v1").PolicyRef, import("@astrale-os/kernel-dsl/v1/language").PolicyCheckObject>, "kernel.astrale.ai:class.View.method.resolve"> & {
|
|
6526
6535
|
readonly name: "resolve";
|
|
6527
|
-
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedMethod<{
|
|
6528
|
-
audience?: string | undefined;
|
|
6529
|
-
ttlSeconds: number;
|
|
6530
|
-
grant?: unknown;
|
|
6531
|
-
}, {
|
|
6532
|
-
readonly mode: 'value';
|
|
6533
|
-
readonly value: string;
|
|
6534
|
-
}, true, "default", "authenticated", import("@astrale-os/kernel-dsl/v1").PolicyCheckExpression<import("@astrale-os/kernel-dsl/v1").PolicyRef, import("@astrale-os/kernel-dsl/v1/language").PolicyCheckObject>, "kernel.astrale.ai:class.Identity.method.mint"> & {
|
|
6535
|
-
readonly name: "mint";
|
|
6536
6536
|
}))[];
|
|
6537
6537
|
export { AuthorityOperationOrder, AuthorityOperations, operationOf } from '../authority/index.js';
|
|
6538
6538
|
export type { AuthorityOperation, AuthorityRelation } from '../authority/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-core",
|
|
3
|
-
"version": "0.9.0-beta.
|
|
3
|
+
"version": "0.9.0-beta.39",
|
|
4
4
|
"description": "Astrale Kernel Core - Types, Invariants, and Pure Logic",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"access": "public"
|
|
161
161
|
},
|
|
162
162
|
"dependencies": {
|
|
163
|
-
"@astrale-os/kernel-dsl": "0.2.0-beta.
|
|
163
|
+
"@astrale-os/kernel-dsl": "0.2.0-beta.30",
|
|
164
164
|
"@noble/hashes": "2.3.0",
|
|
165
165
|
"@types/json-schema": "^7.0.15",
|
|
166
166
|
"dequal": "2.0.3"
|