@astrale-os/kernel-core 0.9.0-beta.48 → 0.9.0-beta.49

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.
@@ -0,0 +1,2 @@
1
+ /** Canonical form, not an authorization decision. Crossing values still require admission. */
2
+ export declare function isCanonical(input: unknown): boolean;
@@ -0,0 +1,15 @@
1
+ import * as portable from '@astrale-os/kernel-dsl/value';
2
+ import { accept } from './accept.js';
3
+ import { ownsCanonical } from './ownership.optimization.js';
4
+ /** Canonical form, not an authorization decision. Crossing values still require admission. */
5
+ export function isCanonical(input) {
6
+ if (ownsCanonical(input))
7
+ return true;
8
+ try {
9
+ const canonical = accept(input);
10
+ return portable.json.serialize(canonical) === portable.json.serialize(input);
11
+ }
12
+ catch {
13
+ return false;
14
+ }
15
+ }
@@ -1,4 +1,5 @@
1
1
  export { accept } from './accept.js';
2
+ export { isCanonical } from './canonical.js';
2
3
  export { limits } from './admission/index.js';
3
4
  export { canonicalize } from './normalization/index.js';
4
5
  export { AUTHORITY_PREDICATE_VERSION } from './language/index.js';
@@ -1,4 +1,5 @@
1
1
  export { accept } from './accept.js';
2
+ export { isCanonical } from './canonical.js';
2
3
  export { limits } from './admission/index.js';
3
4
  export { canonicalize } from './normalization/index.js';
4
5
  export { AUTHORITY_PREDICATE_VERSION } from './language/index.js';
@@ -4,16 +4,17 @@ import { AuthValueError } from '../../error.js';
4
4
  import { canonicalize as canonicalizeGrant } from '../../grant/index.js';
5
5
  import { admitAuthorityExpr, limits } from '../admission/index.js';
6
6
  import { AUTHORITY_PREDICATE_VERSION } from '../language/index.js';
7
+ import { ownCanonical } from '../ownership.optimization.js';
7
8
  /** Validate and canonicalize one authority expression into its versioned crossing envelope. */
8
9
  export function canonicalize(expr) {
9
10
  const admitted = admitAuthorityExpr(portable.accept(expr));
10
11
  return canonicalizeAdmitted(admitted);
11
12
  }
12
13
  export function canonicalizeAdmitted(expr) {
13
- return Object.freeze({
14
+ return ownCanonical(Object.freeze({
14
15
  version: AUTHORITY_PREDICATE_VERSION,
15
16
  predicate: normalize(expr, '/predicate', new Set(), false),
16
- });
17
+ }));
17
18
  }
18
19
  function normalize(expr, path, locals, subjectBound) {
19
20
  switch (expr.op) {
@@ -0,0 +1,4 @@
1
+ import type { AuthorityPredicate } from './language/index.js';
2
+ /** Called only by the owner after detachment, admission and immutable normalization. */
3
+ export declare function ownCanonical(predicate: AuthorityPredicate): AuthorityPredicate;
4
+ export declare function ownsCanonical(input: unknown): boolean;
@@ -0,0 +1,10 @@
1
+ // Static construction provenance only. No evaluated authority or graph facts live here.
2
+ const canonical = new WeakSet();
3
+ /** Called only by the owner after detachment, admission and immutable normalization. */
4
+ export function ownCanonical(predicate) {
5
+ canonical.add(predicate);
6
+ return predicate;
7
+ }
8
+ export function ownsCanonical(input) {
9
+ return input !== null && typeof input === 'object' && canonical.has(input);
10
+ }
@@ -5492,6 +5492,17 @@ export declare const KernelRootFunctions: readonly ((import("@astrale-os/kernel-
5492
5492
  readonly origin: "kernel.astrale.ai";
5493
5493
  };
5494
5494
  readonly key: "kernel.astrale.ai:function.uninstall";
5495
+ }) | (import("@astrale-os/kernel-dsl/v1").ResolvedMethod<{
5496
+ audience?: string | undefined;
5497
+ ttlSeconds: number;
5498
+ grant?: unknown;
5499
+ identity: string;
5500
+ }, {
5501
+ readonly mode: 'value';
5502
+ readonly value: string;
5503
+ }, true, false, "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.Identity.method.impersonate"> & {
5504
+ readonly name: "impersonate";
5505
+ readonly executable: true;
5495
5506
  }) | (import("@astrale-os/kernel-dsl/v1").ResolvedMethod<{
5496
5507
  iss: string;
5497
5508
  sub: string;
@@ -5560,17 +5571,6 @@ export declare const KernelRootFunctions: readonly ((import("@astrale-os/kernel-
5560
5571
  }, true, false, "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"> & {
5561
5572
  readonly name: "resolve";
5562
5573
  readonly executable: true;
5563
- }) | (import("@astrale-os/kernel-dsl/v1").ResolvedMethod<{
5564
- audience?: string | undefined;
5565
- ttlSeconds: number;
5566
- grant?: unknown;
5567
- identity: string;
5568
- }, {
5569
- readonly mode: 'value';
5570
- readonly value: string;
5571
- }, true, false, "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.Identity.method.impersonate"> & {
5572
- readonly name: "impersonate";
5573
- readonly executable: true;
5574
5574
  }))[];
5575
5575
  export { AuthorityOperationOrder, AuthorityOperations, operationOf } from '../authority/index.js';
5576
5576
  export type { AuthorityOperation, AuthorityRelation } from '../authority/index.js';
@@ -379,6 +379,29 @@ export declare const Functions: Readonly<{
379
379
  };
380
380
  })[];
381
381
  operations: ({
382
+ op: "edge.update";
383
+ edge: {
384
+ source: string;
385
+ target: string;
386
+ class: string;
387
+ };
388
+ slug: unknown;
389
+ props?: {
390
+ set: Record<string, unknown>;
391
+ unset: string[];
392
+ } | undefined;
393
+ } | {
394
+ op: "edge.update";
395
+ edge: {
396
+ source: string;
397
+ target: string;
398
+ class: string;
399
+ };
400
+ props: {
401
+ set: Record<string, unknown>;
402
+ unset: string[];
403
+ };
404
+ } | {
382
405
  op: "node.create";
383
406
  as: string;
384
407
  class: string;
@@ -406,29 +429,6 @@ export declare const Functions: Readonly<{
406
429
  };
407
430
  slug?: unknown;
408
431
  props: Record<string, unknown>;
409
- } | {
410
- op: "edge.update";
411
- edge: {
412
- source: string;
413
- target: string;
414
- class: string;
415
- };
416
- slug: unknown;
417
- props?: {
418
- set: Record<string, unknown>;
419
- unset: string[];
420
- } | undefined;
421
- } | {
422
- op: "edge.update";
423
- edge: {
424
- source: string;
425
- target: string;
426
- class: string;
427
- };
428
- props: {
429
- set: Record<string, unknown>;
430
- unset: string[];
431
- };
432
432
  } | {
433
433
  op: "edge.delete";
434
434
  edge: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/kernel-core",
3
- "version": "0.9.0-beta.48",
3
+ "version": "0.9.0-beta.49",
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.33",
163
+ "@astrale-os/kernel-dsl": "0.2.0-beta.34",
164
164
  "@noble/hashes": "2.3.0",
165
165
  "@types/json-schema": "^7.0.15",
166
166
  "dequal": "2.0.3"