@astrale-os/kernel-core 0.9.0-beta.52 → 0.9.0-beta.54

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.
@@ -1,10 +1,11 @@
1
1
  import { nodeClass, property } from '@astrale-os/kernel-dsl/v1';
2
+ import { Identity } from '../identity/index.js';
2
3
  import { FunctionMethods } from '../kernel/syscalls/declarations/index.js';
3
4
  import { Descriptable } from '../meta/index.js';
4
5
  export const Function = nodeClass({
5
6
  abstract: false,
6
- description: 'The installed projection of a standalone Function or Node Method declaration; it is not a principal.',
7
- extends: [Descriptable],
7
+ description: 'An invocable resource that can carry its own Identity authority.',
8
+ extends: [Descriptable, Identity],
8
9
  properties: {
9
10
  kind: { enum: ['function', 'method'] },
10
11
  input: {},
@@ -174,21 +174,6 @@ export declare const Identity: builder.NodeClass<{
174
174
  })[];
175
175
  };
176
176
  }, "authenticated", true, false>>, "whoami", "self"> | builder.AuthoredMethodProjection<builder.Method<builder.CallableProjection<{
177
- audience?: string | undefined;
178
- ttlSeconds: number;
179
- grant?: unknown;
180
- identity: string;
181
- }, {
182
- readonly mode: 'value';
183
- readonly value: string;
184
- }, "authorized", true, false>>, "impersonate", "self"> | builder.AuthoredMethodProjection<builder.Method<builder.CallableProjection<{
185
- audience?: string | undefined;
186
- ttlSeconds: number;
187
- grant?: unknown;
188
- }, {
189
- readonly mode: 'value';
190
- readonly value: string;
191
- }, "authenticated", true, false>>, "mint", "self"> | builder.AuthoredMethodProjection<builder.Method<builder.CallableProjection<{
192
177
  principal: string;
193
178
  audience: string;
194
179
  ttlSeconds: number;
@@ -220,6 +205,21 @@ export declare const Identity: builder.NodeClass<{
220
205
  })[];
221
206
  } | null;
222
207
  }, "authorized", true, false>>, "whois", "self"> | builder.AuthoredMethodProjection<builder.Method<builder.CallableProjection<{
208
+ audience?: string | undefined;
209
+ ttlSeconds: number;
210
+ grant?: unknown;
211
+ }, {
212
+ readonly mode: 'value';
213
+ readonly value: string;
214
+ }, "authenticated", true, false>>, "mint", "self"> | builder.AuthoredMethodProjection<builder.Method<builder.CallableProjection<{
215
+ audience?: string | undefined;
216
+ ttlSeconds: number;
217
+ grant?: unknown;
218
+ identity: string;
219
+ }, {
220
+ readonly mode: 'value';
221
+ readonly value: string;
222
+ }, "authorized", true, false>>, "impersonate", "self"> | builder.AuthoredMethodProjection<builder.Method<builder.CallableProjection<{
223
223
  policy: string;
224
224
  object: string;
225
225
  } | {
@@ -95,8 +95,9 @@ function walk(domain, payload) {
95
95
  [K.classes.of_domain.self.properties.member.key]: `core.${slug}`,
96
96
  })));
97
97
  }
98
- for (const declaration of domainSchema.core.edges) {
99
- addEdge(coreEdges, coreEndpoint(declaration.source, domain, persistedDomainEndpoint, coreLocations), coreEndpoint(declaration.target, domain, persistedDomainEndpoint, coreLocations), declaration.class, payload(() => declaration.properties));
98
+ // Resolved edges carry each endpoint's own identity; the source IR only names it.
99
+ for (const edge of domain.core.edges) {
100
+ addEdge(coreEdges, coreEndpoint(edge.source, domain, persistedDomainEndpoint, coreLocations), coreEndpoint(edge.target, domain, persistedDomainEndpoint, coreLocations), edge.class.ref, payload(() => edge.properties));
100
101
  }
101
102
  return Object.freeze({
102
103
  origin: domain.origin,
@@ -133,10 +134,16 @@ function projectionLocations(paths) {
133
134
  function invert(locations) {
134
135
  return new Map([...locations].map(([path, binding]) => [binding, path]));
135
136
  }
137
+ /**
138
+ * A Core Node binds inside the Core part; every other local Definition is already projected as a
139
+ * managed declaration, so it is addressed by its canonical Path exactly like the owning Domain.
140
+ */
136
141
  function coreEndpoint(value, domain, domainEndpoint, locations) {
137
- if (value.kind === 'domain')
138
- return domainEndpoint;
139
- return endpoint(PathValue.project({ origin: domain.origin, kind: 'core', name: value.name }).raw, locations);
142
+ if ('ref' in value)
143
+ return endpoint(PathValue.project(value.ref).raw, locations);
144
+ if ('owner' in value)
145
+ return endpoint(projectedMethodPath(domain, value), locations);
146
+ return domainEndpoint;
140
147
  }
141
148
  function projectDefinitionRelations(domain, definition, definitionEndpoint, locations, edges, payload) {
142
149
  if (isResolvedClass(definition)) {