@sentropic/cluster-mesh 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sentropic contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @sentropic/cluster-mesh
2
+
3
+ Federal-shaped cluster contracts with a functional single-instance runtime.
4
+
5
+ Version 0.1 ships the degenerate topology: one Sentropic server, its attached local
6
+ workstations, local signed projections, and the existing device-code lifecycle. It does
7
+ not implement server-to-server federation.
8
+
9
+ ## Available in v1
10
+
11
+ - A directory containing the local server and its attached workstations.
12
+ - Device-code issue, poll, and approve delegation through an injected application port.
13
+ - Human identity, agent identity, and memory snapshot projections that remain on their
14
+ declared home server and are consumed by signed reference.
15
+ - Exact local mapping of attest, offboard, and SPIFFE-bundle export to injected `h2a nhi`
16
+ command execution.
17
+ - Tenant residence resolved only through an approved-membership port.
18
+ - Deterministic workspace references in the form `ws:sha256:<digest>`.
19
+
20
+ Tenant identity and workspace identity are intentionally distinct. `tid` is returned by
21
+ the authoritative membership resolver; it is never copied from a request workspace id.
22
+ An unresolved membership throws `TenantBoundaryError`.
23
+
24
+ ## Gated seams
25
+
26
+ The public surface already defines the future federal ports, but the v1 runtime fails
27
+ closed for all of them:
28
+
29
+ - inter-server discovery and member revocation;
30
+ - RFC 8693 token exchange;
31
+ - remote signed-projection resolution;
32
+ - memory snapshot replication and purge.
33
+
34
+ Invoking one of these seams throws `CapabilityGatedError`. The package exposes no broker
35
+ HTTP route, trusted-issuer store, inter-server directory, or replication runtime.
36
+
37
+ ## Construction
38
+
39
+ `createDegenerateClusterMesh` composes the membership, trust, wrap, device, and tenant
40
+ boundary domains. Every effectful operation is supplied through a typed port, so the
41
+ package owns no application persistence or transport.
42
+
43
+ ```ts
44
+ import { createDegenerateClusterMesh } from '@sentropic/cluster-mesh';
45
+
46
+ const mesh = createDegenerateClusterMesh({
47
+ self,
48
+ workstations,
49
+ memberships,
50
+ projections,
51
+ nhiRunner,
52
+ devices,
53
+ });
54
+
55
+ console.log(mesh.capabilities.mode); // single-node
56
+ ```
57
+
58
+ ## Publication
59
+
60
+ Manual publication is forbidden. For the first release, merge the validated package,
61
+ run the `ci.yml` workflow with `bootstrap_publish_target=cluster-mesh`, then attach the
62
+ npm OIDC trusted publisher to `rhanka/sentropic` and `ci.yml`. Later releases use the
63
+ repository CI publication path.
@@ -0,0 +1,31 @@
1
+ import type { ClusterNodeId } from './membership.js';
2
+ export type WorkspaceReference = `ws:sha256:${string}`;
3
+ export interface MembershipLookup {
4
+ readonly workspaceId: string;
5
+ readonly userId: string;
6
+ }
7
+ export interface ValidatedTenantMembership {
8
+ readonly tenantId: string;
9
+ readonly userId: string;
10
+ readonly status: 'approved';
11
+ }
12
+ export interface ValidatedMembershipPort {
13
+ resolveApproved(input: MembershipLookup): Promise<ValidatedTenantMembership | null>;
14
+ }
15
+ export interface TenantResidenceContext {
16
+ readonly tid: string;
17
+ readonly workspace: WorkspaceReference;
18
+ readonly userId: string;
19
+ readonly homeNodeId: ClusterNodeId;
20
+ }
21
+ export interface BoundaryDomain {
22
+ resolve(input: MembershipLookup): Promise<TenantResidenceContext>;
23
+ workspaceReference(workspaceId: string): Promise<WorkspaceReference>;
24
+ }
25
+ export declare function deriveWorkspaceReference(workspaceId: string): Promise<WorkspaceReference>;
26
+ /** Tenant identity is obtained only from the validated-membership port, never from input data. */
27
+ export declare function createBoundaryDomain(input: {
28
+ readonly homeNodeId: ClusterNodeId;
29
+ readonly memberships: ValidatedMembershipPort;
30
+ }): BoundaryDomain;
31
+ //# sourceMappingURL=boundaries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundaries.d.ts","sourceRoot":"","sources":["../src/boundaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,kBAAkB,GAAG,aAAa,MAAM,EAAE,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAC;CACrF;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;CACpC;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAClE,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACtE;AAED,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAI/F;AAED,kGAAkG;AAClG,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,uBAAuB,CAAC;CAC/C,GAAG,cAAc,CAsBjB"}
@@ -0,0 +1,29 @@
1
+ import { TenantBoundaryError } from './errors.js';
2
+ export async function deriveWorkspaceReference(workspaceId) {
3
+ const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(workspaceId));
4
+ const hex = Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, '0')).join('');
5
+ return `ws:sha256:${hex}`;
6
+ }
7
+ /** Tenant identity is obtained only from the validated-membership port, never from input data. */
8
+ export function createBoundaryDomain(input) {
9
+ return {
10
+ workspaceReference: deriveWorkspaceReference,
11
+ async resolve(lookup) {
12
+ const membership = await input.memberships.resolveApproved(lookup);
13
+ if (!membership
14
+ || membership.status !== 'approved'
15
+ || membership.userId !== lookup.userId
16
+ || typeof membership.tenantId !== 'string'
17
+ || membership.tenantId.trim().length === 0) {
18
+ throw new TenantBoundaryError();
19
+ }
20
+ return {
21
+ tid: membership.tenantId,
22
+ workspace: await deriveWorkspaceReference(lookup.workspaceId),
23
+ userId: membership.userId,
24
+ homeNodeId: input.homeNodeId,
25
+ };
26
+ },
27
+ };
28
+ }
29
+ //# sourceMappingURL=boundaries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundaries.js","sourceRoot":"","sources":["../src/boundaries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAgClD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,WAAmB;IAChE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5F,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtG,OAAO,aAAa,GAAG,EAAE,CAAC;AAC5B,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,oBAAoB,CAAC,KAGpC;IACC,OAAO;QACL,kBAAkB,EAAE,wBAAwB;QAC5C,KAAK,CAAC,OAAO,CAAC,MAAM;YAClB,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YACnE,IACE,CAAC,UAAU;mBACR,UAAU,CAAC,MAAM,KAAK,UAAU;mBAChC,UAAU,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;mBACnC,OAAO,UAAU,CAAC,QAAQ,KAAK,QAAQ;mBACvC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAC1C,CAAC;gBACD,MAAM,IAAI,mBAAmB,EAAE,CAAC;YAClC,CAAC;YACD,OAAO;gBACL,GAAG,EAAE,UAAU,CAAC,QAAQ;gBACxB,SAAS,EAAE,MAAM,wBAAwB,CAAC,MAAM,CAAC,WAAW,CAAC;gBAC7D,MAAM,EAAE,UAAU,CAAC,MAAM;gBACzB,UAAU,EAAE,KAAK,CAAC,UAAU;aAC7B,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ export interface IssuedDeviceCode {
2
+ readonly deviceCode: string;
3
+ readonly userCode: string;
4
+ readonly intervalSec: number;
5
+ readonly expiresAt: Date;
6
+ }
7
+ export type DeviceApprovalResult = {
8
+ readonly ok: true;
9
+ } | {
10
+ readonly ok: false;
11
+ readonly reason: 'not_found' | 'expired' | 'already_resolved';
12
+ };
13
+ export type DevicePollOutcome = {
14
+ readonly status: 'authorization_pending' | 'slow_down' | 'expired' | 'denied';
15
+ } | {
16
+ readonly status: 'approved';
17
+ readonly userId: string;
18
+ readonly role: string;
19
+ readonly deviceName: string;
20
+ };
21
+ /** Existing API device-code lifecycle binding; cowork/auth clients remain transport consumers. */
22
+ export interface LocalDeviceAttachmentPort {
23
+ issueDeviceCode(deviceName?: string | null): IssuedDeviceCode;
24
+ pollDeviceCode(deviceCode: string): DevicePollOutcome;
25
+ approveDeviceCode(userCode: string, userId: string, role: string, deviceName?: string | null): DeviceApprovalResult;
26
+ }
27
+ export interface DeviceDomain extends LocalDeviceAttachmentPort {
28
+ }
29
+ export declare function createLocalDeviceDomain(port: LocalDeviceAttachmentPort): DeviceDomain;
30
+ //# sourceMappingURL=device.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../src/device.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B;AAED,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GACrB;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,kBAAkB,CAAA;CAAE,CAAC;AAE1F,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,MAAM,EAAE,uBAAuB,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAA;CAAE,GACjF;IACE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEN,kGAAkG;AAClG,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,gBAAgB,CAAC;IAC9D,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,CAAC;IACtD,iBAAiB,CACf,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,oBAAoB,CAAC;CACzB;AAED,MAAM,WAAW,YAAa,SAAQ,yBAAyB;CAAG;AAElE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,yBAAyB,GAAG,YAAY,CAYrF"}
package/dist/device.js ADDED
@@ -0,0 +1,14 @@
1
+ export function createLocalDeviceDomain(port) {
2
+ return {
3
+ issueDeviceCode(deviceName) {
4
+ return port.issueDeviceCode(deviceName);
5
+ },
6
+ pollDeviceCode(deviceCode) {
7
+ return port.pollDeviceCode(deviceCode);
8
+ },
9
+ approveDeviceCode(userCode, userId, role, deviceName) {
10
+ return port.approveDeviceCode(userCode, userId, role, deviceName);
11
+ },
12
+ };
13
+ }
14
+ //# sourceMappingURL=device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.js","sourceRoot":"","sources":["../src/device.ts"],"names":[],"mappings":"AAkCA,MAAM,UAAU,uBAAuB,CAAC,IAA+B;IACrE,OAAO;QACL,eAAe,CAAC,UAAU;YACxB,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAC1C,CAAC;QACD,cAAc,CAAC,UAAU;YACvB,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACzC,CAAC;QACD,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU;YAClD,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QACpE,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ export type GatedCapability = 'inter_server_discovery' | 'inter_server_revocation' | 'rfc8693_token_exchange' | 'remote_projection' | 'memory_replication';
2
+ /** A federal API seam that is intentionally unavailable in the v1 degenerate runtime. */
3
+ export declare class CapabilityGatedError extends Error {
4
+ readonly capability: GatedCapability;
5
+ readonly code = "capability_gated";
6
+ constructor(capability: GatedCapability);
7
+ }
8
+ /** Raised when no validated membership can establish the tenant boundary. */
9
+ export declare class TenantBoundaryError extends Error {
10
+ readonly code = "tenant_membership_required";
11
+ constructor();
12
+ }
13
+ export declare class InvalidProjectionReferenceError extends Error {
14
+ readonly code = "invalid_projection_reference";
15
+ constructor();
16
+ }
17
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACvB,wBAAwB,GACxB,yBAAyB,GACzB,wBAAwB,GACxB,mBAAmB,GACnB,oBAAoB,CAAC;AAEzB,yFAAyF;AACzF,qBAAa,oBAAqB,SAAQ,KAAK;aAGjB,UAAU,EAAE,eAAe;IAFvD,QAAQ,CAAC,IAAI,sBAAsB;gBAEP,UAAU,EAAE,eAAe;CAIxD;AAED,6EAA6E;AAC7E,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,gCAAgC;;CAM9C;AAED,qBAAa,+BAAgC,SAAQ,KAAK;IACxD,QAAQ,CAAC,IAAI,kCAAkC;;CAMhD"}
package/dist/errors.js ADDED
@@ -0,0 +1,26 @@
1
+ /** A federal API seam that is intentionally unavailable in the v1 degenerate runtime. */
2
+ export class CapabilityGatedError extends Error {
3
+ capability;
4
+ code = 'capability_gated';
5
+ constructor(capability) {
6
+ super(`Cluster mesh capability is gated: ${capability}`);
7
+ this.capability = capability;
8
+ this.name = 'CapabilityGatedError';
9
+ }
10
+ }
11
+ /** Raised when no validated membership can establish the tenant boundary. */
12
+ export class TenantBoundaryError extends Error {
13
+ code = 'tenant_membership_required';
14
+ constructor() {
15
+ super('A validated tenant membership is required');
16
+ this.name = 'TenantBoundaryError';
17
+ }
18
+ }
19
+ export class InvalidProjectionReferenceError extends Error {
20
+ code = 'invalid_projection_reference';
21
+ constructor() {
22
+ super('The signed projection reference is invalid');
23
+ this.name = 'InvalidProjectionReferenceError';
24
+ }
25
+ }
26
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAOA,yFAAyF;AACzF,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAGjB;IAFnB,IAAI,GAAG,kBAAkB,CAAC;IAEnC,YAA4B,UAA2B;QACrD,KAAK,CAAC,qCAAqC,UAAU,EAAE,CAAC,CAAC;QAD/B,eAAU,GAAV,UAAU,CAAiB;QAErD,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED,6EAA6E;AAC7E,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACnC,IAAI,GAAG,4BAA4B,CAAC;IAE7C;QACE,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IAC/C,IAAI,GAAG,8BAA8B,CAAC;IAE/C;QACE,KAAK,CAAC,4CAA4C,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC;IAChD,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ export * from './errors.js';
2
+ export * from './boundaries.js';
3
+ export * from './device.js';
4
+ export * from './membership.js';
5
+ export * from './memory.js';
6
+ export * from './mesh.js';
7
+ export * from './nhi.js';
8
+ export * from './projection.js';
9
+ export * from './trust.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export * from './errors.js';
2
+ export * from './boundaries.js';
3
+ export * from './device.js';
4
+ export * from './membership.js';
5
+ export * from './memory.js';
6
+ export * from './mesh.js';
7
+ export * from './nhi.js';
8
+ export * from './projection.js';
9
+ export * from './trust.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { BoundaryDomain, MembershipLookup } from './boundaries.js';
2
+ export type ClusterNodeId = `node:${string}`;
3
+ export type WorkstationId = `device:${string}`;
4
+ export interface ClusterNodeDescriptor {
5
+ readonly kind: 'server';
6
+ readonly nodeId: ClusterNodeId;
7
+ readonly issuer: string;
8
+ readonly endpoint: string;
9
+ readonly state: 'active';
10
+ }
11
+ export interface LocalWorkstationDescriptor {
12
+ readonly kind: 'workstation';
13
+ readonly deviceId: WorkstationId;
14
+ readonly displayName: string;
15
+ readonly ownerSubject: string;
16
+ readonly state: 'attached';
17
+ }
18
+ export type ClusterDirectoryEntry = ClusterNodeDescriptor | (LocalWorkstationDescriptor & {
19
+ readonly homeNodeId: ClusterNodeId;
20
+ });
21
+ export interface LocalWorkstationDirectoryPort {
22
+ listAttached(): Promise<readonly LocalWorkstationDescriptor[]>;
23
+ }
24
+ /** Future F-C discovery and member-revocation seam. It has no live v1 binding. */
25
+ export interface InterServerDirectoryPort {
26
+ discover(): Promise<readonly ClusterNodeDescriptor[]>;
27
+ revoke(nodeId: ClusterNodeId): Promise<void>;
28
+ }
29
+ export interface MembershipDomain {
30
+ readonly self: ClusterNodeDescriptor;
31
+ readonly interServer: InterServerDirectoryPort;
32
+ listDirectory(input: MembershipLookup): Promise<readonly ClusterDirectoryEntry[]>;
33
+ }
34
+ export declare function createGatedInterServerDirectory(): InterServerDirectoryPort;
35
+ /** Real v1 directory: exactly this server followed by its currently attached local devices. */
36
+ export declare function createSingleNodeMembership(input: {
37
+ self: ClusterNodeDescriptor;
38
+ boundaries: Pick<BoundaryDomain, 'resolve'>;
39
+ workstations: LocalWorkstationDirectoryPort;
40
+ }): MembershipDomain;
41
+ //# sourceMappingURL=membership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../src/membership.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExE,MAAM,MAAM,aAAa,GAAG,QAAQ,MAAM,EAAE,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,UAAU,MAAM,EAAE,CAAC;AAE/C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AAED,MAAM,MAAM,qBAAqB,GAC7B,qBAAqB,GACrB,CAAC,0BAA0B,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAE1E,MAAM,WAAW,6BAA6B;IAC5C,YAAY,IAAI,OAAO,CAAC,SAAS,0BAA0B,EAAE,CAAC,CAAC;CAChE;AAED,kFAAkF;AAClF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,IAAI,OAAO,CAAC,SAAS,qBAAqB,EAAE,CAAC,CAAC;IACtD,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,wBAAwB,CAAC;IAC/C,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,qBAAqB,EAAE,CAAC,CAAC;CACnF;AAED,wBAAgB,+BAA+B,IAAI,wBAAwB,CAS1E;AAED,+FAA+F;AAC/F,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,IAAI,EAAE,qBAAqB,CAAC;IAC5B,UAAU,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAC5C,YAAY,EAAE,6BAA6B,CAAC;CAC7C,GAAG,gBAAgB,CAgBnB"}
@@ -0,0 +1,30 @@
1
+ import { CapabilityGatedError } from './errors.js';
2
+ export function createGatedInterServerDirectory() {
3
+ return {
4
+ async discover() {
5
+ throw new CapabilityGatedError('inter_server_discovery');
6
+ },
7
+ async revoke() {
8
+ throw new CapabilityGatedError('inter_server_revocation');
9
+ },
10
+ };
11
+ }
12
+ /** Real v1 directory: exactly this server followed by its currently attached local devices. */
13
+ export function createSingleNodeMembership(input) {
14
+ const interServer = createGatedInterServerDirectory();
15
+ return {
16
+ self: input.self,
17
+ interServer,
18
+ async listDirectory(lookup) {
19
+ const residence = await input.boundaries.resolve(lookup);
20
+ const devices = await input.workstations.listAttached();
21
+ return [
22
+ input.self,
23
+ ...devices
24
+ .filter((device) => device.ownerSubject === residence.userId)
25
+ .map((device) => ({ ...device, homeNodeId: input.self.nodeId })),
26
+ ];
27
+ },
28
+ };
29
+ }
30
+ //# sourceMappingURL=membership.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"membership.js","sourceRoot":"","sources":["../src/membership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AA0CnD,MAAM,UAAU,+BAA+B;IAC7C,OAAO;QACL,KAAK,CAAC,QAAQ;YACZ,MAAM,IAAI,oBAAoB,CAAC,wBAAwB,CAAC,CAAC;QAC3D,CAAC;QACD,KAAK,CAAC,MAAM;YACV,MAAM,IAAI,oBAAoB,CAAC,yBAAyB,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC;AACJ,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,0BAA0B,CAAC,KAI1C;IACC,MAAM,WAAW,GAAG,+BAA+B,EAAE,CAAC;IACtD,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,WAAW;QACX,KAAK,CAAC,aAAa,CAAC,MAAM;YACxB,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACzD,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;YACxD,OAAO;gBACL,KAAK,CAAC,IAAI;gBACV,GAAG,OAAO;qBACP,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,KAAK,SAAS,CAAC,MAAM,CAAC;qBAC5D,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;aACnE,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { SignedProjectionReference } from './projection.js';
2
+ /** Future W-C cache seam. V1 never copies or purges a remote memory snapshot. */
3
+ export interface MemoryReplicationPort {
4
+ replicate(reference: SignedProjectionReference): Promise<void>;
5
+ purge(reference: SignedProjectionReference): Promise<void>;
6
+ }
7
+ export declare function createGatedMemoryReplication(): MemoryReplicationPort;
8
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAEjE,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,SAAS,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,KAAK,CAAC,SAAS,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED,wBAAgB,4BAA4B,IAAI,qBAAqB,CAKpE"}
package/dist/memory.js ADDED
@@ -0,0 +1,8 @@
1
+ import { CapabilityGatedError } from './errors.js';
2
+ export function createGatedMemoryReplication() {
3
+ const gated = async () => {
4
+ throw new CapabilityGatedError('memory_replication');
5
+ };
6
+ return { replicate: gated, purge: gated };
7
+ }
8
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AASnD,MAAM,UAAU,4BAA4B;IAC1C,MAAM,KAAK,GAAG,KAAK,IAAI,EAAE;QACvB,MAAM,IAAI,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;IACvD,CAAC,CAAC;IACF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC5C,CAAC"}
package/dist/mesh.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ import { type BoundaryDomain, type ValidatedMembershipPort } from './boundaries.js';
2
+ import { type DeviceDomain, type LocalDeviceAttachmentPort } from './device.js';
3
+ import { type MemoryReplicationPort } from './memory.js';
4
+ import { type ClusterNodeDescriptor, type LocalWorkstationDirectoryPort, type MembershipDomain } from './membership.js';
5
+ import { type CommandRunnerPort, type NhiLifecyclePort } from './nhi.js';
6
+ import { type LocalProjectionPort, type ProjectionDomain } from './projection.js';
7
+ import { type TrustDomain } from './trust.js';
8
+ export interface WrapDomain {
9
+ readonly projections: ProjectionDomain;
10
+ readonly nhi: NhiLifecyclePort;
11
+ readonly memoryReplication: MemoryReplicationPort;
12
+ }
13
+ export interface ClusterMesh {
14
+ readonly membership: MembershipDomain;
15
+ readonly trust: TrustDomain;
16
+ readonly wrap: WrapDomain;
17
+ readonly devices: DeviceDomain;
18
+ readonly boundaries: BoundaryDomain;
19
+ readonly capabilities: {
20
+ readonly mode: 'single-node';
21
+ readonly localDevices: 'available';
22
+ readonly localProjection: 'available';
23
+ readonly interServerDirectory: 'gated';
24
+ readonly tokenExchange: 'gated';
25
+ readonly memoryReplication: 'gated';
26
+ };
27
+ }
28
+ export declare function createDegenerateClusterMesh(input: {
29
+ readonly self: ClusterNodeDescriptor;
30
+ readonly workstations: LocalWorkstationDirectoryPort;
31
+ readonly memberships: ValidatedMembershipPort;
32
+ readonly projections: LocalProjectionPort;
33
+ readonly nhiRunner: CommandRunnerPort;
34
+ readonly devices: LocalDeviceAttachmentPort;
35
+ }): ClusterMesh;
36
+ //# sourceMappingURL=mesh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh.d.ts","sourceRoot":"","sources":["../src/mesh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,cAAc,EAAE,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAA2B,KAAK,YAAY,EAAE,KAAK,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACzG,OAAO,EAAgC,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAyB,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAChG,OAAO,EAA+B,KAAK,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/G,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACvC,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;CACnD;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE;QACrB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;QAC7B,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC;QACnC,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC;QACtC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;QACvC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;QAChC,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;KACrC,CAAC;CACH;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,6BAA6B,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,uBAAuB,CAAC;IAC9C,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,yBAAyB,CAAC;CAC7C,GAAG,WAAW,CAwBd"}
package/dist/mesh.js ADDED
@@ -0,0 +1,33 @@
1
+ import { createBoundaryDomain } from './boundaries.js';
2
+ import { createLocalDeviceDomain } from './device.js';
3
+ import { createGatedMemoryReplication } from './memory.js';
4
+ import { createSingleNodeMembership, } from './membership.js';
5
+ import { createH2aNhiLifecycle } from './nhi.js';
6
+ import { createLocalProjectionDomain } from './projection.js';
7
+ import { createGatedTrustDomain } from './trust.js';
8
+ export function createDegenerateClusterMesh(input) {
9
+ const boundaries = createBoundaryDomain({
10
+ homeNodeId: input.self.nodeId,
11
+ memberships: input.memberships,
12
+ });
13
+ return {
14
+ membership: createSingleNodeMembership({ ...input, boundaries }),
15
+ trust: createGatedTrustDomain(),
16
+ wrap: {
17
+ projections: createLocalProjectionDomain({ homeNodeId: input.self.nodeId, local: input.projections }),
18
+ nhi: createH2aNhiLifecycle(input.nhiRunner),
19
+ memoryReplication: createGatedMemoryReplication(),
20
+ },
21
+ devices: createLocalDeviceDomain(input.devices),
22
+ boundaries,
23
+ capabilities: {
24
+ mode: 'single-node',
25
+ localDevices: 'available',
26
+ localProjection: 'available',
27
+ interServerDirectory: 'gated',
28
+ tokenExchange: 'gated',
29
+ memoryReplication: 'gated',
30
+ },
31
+ };
32
+ }
33
+ //# sourceMappingURL=mesh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh.js","sourceRoot":"","sources":["../src/mesh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAqD,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAAE,uBAAuB,EAAqD,MAAM,aAAa,CAAC;AACzG,OAAO,EAAE,4BAA4B,EAA8B,MAAM,aAAa,CAAC;AACvF,OAAO,EACL,0BAA0B,GAI3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAiD,MAAM,UAAU,CAAC;AAChG,OAAO,EAAE,2BAA2B,EAAmD,MAAM,iBAAiB,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAoB,MAAM,YAAY,CAAC;AAwBtE,MAAM,UAAU,2BAA2B,CAAC,KAO3C;IACC,MAAM,UAAU,GAAG,oBAAoB,CAAC;QACtC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM;QAC7B,WAAW,EAAE,KAAK,CAAC,WAAW;KAC/B,CAAC,CAAC;IACH,OAAO;QACL,UAAU,EAAE,0BAA0B,CAAC,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,CAAC;QAChE,KAAK,EAAE,sBAAsB,EAAE;QAC/B,IAAI,EAAE;YACJ,WAAW,EAAE,2BAA2B,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;YACrG,GAAG,EAAE,qBAAqB,CAAC,KAAK,CAAC,SAAS,CAAC;YAC3C,iBAAiB,EAAE,4BAA4B,EAAE;SAClD;QACD,OAAO,EAAE,uBAAuB,CAAC,KAAK,CAAC,OAAO,CAAC;QAC/C,UAAU;QACV,YAAY,EAAE;YACZ,IAAI,EAAE,aAAa;YACnB,YAAY,EAAE,WAAW;YACzB,eAAe,EAAE,WAAW;YAC5B,oBAAoB,EAAE,OAAO;YAC7B,aAAa,EAAE,OAAO;YACtB,iBAAiB,EAAE,OAAO;SAC3B;KACF,CAAC;AACJ,CAAC"}
package/dist/nhi.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ export interface CommandResult {
2
+ readonly exitCode: number;
3
+ readonly stdout: string;
4
+ readonly stderr: string;
5
+ }
6
+ export interface CommandRunnerPort {
7
+ run(command: 'h2a', args: readonly string[]): Promise<CommandResult>;
8
+ }
9
+ export interface NhiLifecyclePort {
10
+ attest(input: {
11
+ instance: string;
12
+ privateKey: string;
13
+ root?: string;
14
+ }): Promise<CommandResult>;
15
+ offboard(input: {
16
+ instance: string;
17
+ root?: string;
18
+ }): Promise<CommandResult>;
19
+ exportBundle(input: {
20
+ instance: string;
21
+ trustDomain: string;
22
+ root?: string;
23
+ }): Promise<CommandResult>;
24
+ }
25
+ /** Exact local mapping to the shipped h2a NHI lifecycle; h2a remains the authority. */
26
+ export declare function createH2aNhiLifecycle(runner: CommandRunnerPort): NhiLifecyclePort;
27
+ //# sourceMappingURL=nhi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nhi.d.ts","sourceRoot":"","sources":["../src/nhi.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/F,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7E,YAAY,CAAC,KAAK,EAAE;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC5B;AAMD,uFAAuF;AACvF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,gBAAgB,CAkBjF"}
package/dist/nhi.js ADDED
@@ -0,0 +1,24 @@
1
+ function withRoot(args, root) {
2
+ return root ? [...args, '--root', root] : args;
3
+ }
4
+ /** Exact local mapping to the shipped h2a NHI lifecycle; h2a remains the authority. */
5
+ export function createH2aNhiLifecycle(runner) {
6
+ return {
7
+ attest(input) {
8
+ return runner.run('h2a', withRoot([
9
+ 'nhi', 'attest', '--instance', input.instance, '--private-key', input.privateKey,
10
+ ], input.root));
11
+ },
12
+ offboard(input) {
13
+ return runner.run('h2a', withRoot([
14
+ 'nhi', 'offboard', '--instance', input.instance,
15
+ ], input.root));
16
+ },
17
+ exportBundle(input) {
18
+ return runner.run('h2a', withRoot([
19
+ 'nhi', 'export', '--instance', input.instance, '--trust-domain', input.trustDomain,
20
+ ], input.root));
21
+ },
22
+ };
23
+ }
24
+ //# sourceMappingURL=nhi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nhi.js","sourceRoot":"","sources":["../src/nhi.ts"],"names":[],"mappings":"AAoBA,SAAS,QAAQ,CAAC,IAAc,EAAE,IAAa;IAC7C,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,qBAAqB,CAAC,MAAyB;IAC7D,OAAO;QACL,MAAM,CAAC,KAAK;YACV,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC;gBAChC,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC,UAAU;aACjF,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,QAAQ,CAAC,KAAK;YACZ,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC;gBAChC,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,CAAC,QAAQ;aAChD,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,YAAY,CAAC,KAAK;YAChB,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC;gBAChC,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,CAAC,WAAW;aACnF,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { ClusterNodeId } from './membership.js';
2
+ export type ProjectionKind = 'human_identity' | 'agent_identity' | 'memory_snapshot';
3
+ /** Opaque W-A reference: payload and signature remain owned by the home server. */
4
+ export interface SignedProjectionReference {
5
+ readonly kind: ProjectionKind;
6
+ readonly reference: string;
7
+ readonly homeNodeId: ClusterNodeId;
8
+ readonly issuer: string;
9
+ readonly keyId: string;
10
+ readonly signature: string;
11
+ }
12
+ export interface LocalProjectionPort {
13
+ create(kind: ProjectionKind, localId: string): Promise<SignedProjectionReference>;
14
+ verify(reference: SignedProjectionReference): Promise<boolean>;
15
+ resolve<T>(reference: SignedProjectionReference): Promise<T>;
16
+ }
17
+ export interface ProjectionDomain {
18
+ project(kind: ProjectionKind, localId: string): Promise<SignedProjectionReference>;
19
+ resolve<T>(reference: SignedProjectionReference): Promise<T>;
20
+ }
21
+ /** W-A degenerate binding: signed references resolve only on their declared local home node. */
22
+ export declare function createLocalProjectionDomain(input: {
23
+ readonly homeNodeId: ClusterNodeId;
24
+ readonly local: LocalProjectionPort;
25
+ }): ProjectionDomain;
26
+ //# sourceMappingURL=projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../src/projection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAErF,mFAAmF;AACnF,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAClF,MAAM,CAAC,SAAS,EAAE,yBAAyB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,yBAAyB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC9D;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACnF,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,yBAAyB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC9D;AAED,gGAAgG;AAChG,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;CACrC,GAAG,gBAAgB,CAiBnB"}
@@ -0,0 +1,22 @@
1
+ import { CapabilityGatedError, InvalidProjectionReferenceError } from './errors.js';
2
+ /** W-A degenerate binding: signed references resolve only on their declared local home node. */
3
+ export function createLocalProjectionDomain(input) {
4
+ return {
5
+ async project(kind, localId) {
6
+ const reference = await input.local.create(kind, localId);
7
+ if (reference.homeNodeId !== input.homeNodeId || !(await input.local.verify(reference))) {
8
+ throw new InvalidProjectionReferenceError();
9
+ }
10
+ return reference;
11
+ },
12
+ async resolve(reference) {
13
+ if (reference.homeNodeId !== input.homeNodeId) {
14
+ throw new CapabilityGatedError('remote_projection');
15
+ }
16
+ if (!(await input.local.verify(reference)))
17
+ throw new InvalidProjectionReferenceError();
18
+ return input.local.resolve(reference);
19
+ },
20
+ };
21
+ }
22
+ //# sourceMappingURL=projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.js","sourceRoot":"","sources":["../src/projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AA0BpF,gGAAgG;AAChG,MAAM,UAAU,2BAA2B,CAAC,KAG3C;IACC,OAAO;QACL,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO;YACzB,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC1D,IAAI,SAAS,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;gBACxF,MAAM,IAAI,+BAA+B,EAAE,CAAC;YAC9C,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,SAAS;YACrB,IAAI,SAAS,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,EAAE,CAAC;gBAC9C,MAAM,IAAI,oBAAoB,CAAC,mBAAmB,CAAC,CAAC;YACtD,CAAC;YACD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBAAE,MAAM,IAAI,+BAA+B,EAAE,CAAC;YACxF,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ export declare const RFC8693_GRANT_TYPE: "urn:ietf:params:oauth:grant-type:token-exchange";
2
+ export declare const ACCESS_TOKEN_TYPE: "urn:ietf:params:oauth:token-type:access_token";
3
+ export interface TokenExchangeActor {
4
+ readonly sub: string;
5
+ readonly iss: string;
6
+ /** Opaque h2a engagement reference; cluster-mesh never interprets it. */
7
+ readonly h2aEngagement: string;
8
+ }
9
+ export interface TokenExchangeRequest {
10
+ readonly grantType: typeof RFC8693_GRANT_TYPE;
11
+ readonly subjectToken: string;
12
+ readonly subjectTokenType: string;
13
+ readonly requestedTokenType?: string;
14
+ readonly audience: string;
15
+ readonly scope: readonly string[];
16
+ readonly actor?: TokenExchangeActor;
17
+ }
18
+ export interface TokenExchangeResponse {
19
+ readonly accessToken: string;
20
+ readonly issuedTokenType: string;
21
+ readonly tokenType: 'Bearer' | 'DPoP';
22
+ readonly expiresIn: number;
23
+ readonly scope: readonly string[];
24
+ }
25
+ /** RFC 8693 broker seam. A future binding owns issuer trust, membership and DPoP policy. */
26
+ export interface TokenExchangePort {
27
+ exchange(request: TokenExchangeRequest): Promise<TokenExchangeResponse>;
28
+ }
29
+ export interface TrustDomain {
30
+ readonly tokenExchange: TokenExchangePort;
31
+ }
32
+ export declare function createGatedTrustDomain(): TrustDomain;
33
+ //# sourceMappingURL=trust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust.d.ts","sourceRoot":"","sources":["../src/trust.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,mDAA6D,CAAC;AAC7F,eAAO,MAAM,iBAAiB,iDAA2D,CAAC;AAE1F,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,OAAO,kBAAkB,CAAC;IAC9C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,kBAAkB,CAAC;CACrC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,QAAQ,GAAG,MAAM,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,4FAA4F;AAC5F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACzE;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,aAAa,EAAE,iBAAiB,CAAC;CAC3C;AAED,wBAAgB,sBAAsB,IAAI,WAAW,CAQpD"}
package/dist/trust.js ADDED
@@ -0,0 +1,13 @@
1
+ import { CapabilityGatedError } from './errors.js';
2
+ export const RFC8693_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:token-exchange';
3
+ export const ACCESS_TOKEN_TYPE = 'urn:ietf:params:oauth:token-type:access_token';
4
+ export function createGatedTrustDomain() {
5
+ return {
6
+ tokenExchange: {
7
+ async exchange() {
8
+ throw new CapabilityGatedError('rfc8693_token_exchange');
9
+ },
10
+ },
11
+ };
12
+ }
13
+ //# sourceMappingURL=trust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust.js","sourceRoot":"","sources":["../src/trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iDAA0D,CAAC;AAC7F,MAAM,CAAC,MAAM,iBAAiB,GAAG,+CAAwD,CAAC;AAoC1F,MAAM,UAAU,sBAAsB;IACpC,OAAO;QACL,aAAa,EAAE;YACb,KAAK,CAAC,QAAQ;gBACZ,MAAM,IAAI,oBAAoB,CAAC,wBAAwB,CAAC,CAAC;YAC3D,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@sentropic/cluster-mesh",
3
+ "version": "0.1.0",
4
+ "description": "Federal-shaped cluster membership, trust, identity, device, and tenant-boundary contracts with a single-instance runtime.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/rhanka/sentropic.git",
10
+ "directory": "packages/cluster-mesh"
11
+ },
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "publishConfig": {
26
+ "provenance": true,
27
+ "access": "public"
28
+ },
29
+ "sideEffects": false,
30
+ "scripts": {
31
+ "build": "tsc -p tsconfig.json",
32
+ "typecheck": "tsc --noEmit -p tsconfig.json",
33
+ "test": "vitest run tests"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "^22.10.10",
37
+ "typescript": "5.4.5"
38
+ }
39
+ }