@tinycloud/node-sdk 2.7.0-beta.3 → 2.7.0-beta.5

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.
@@ -351,6 +351,8 @@ declare class NodeUserAuthorization implements IUserAuthorization {
351
351
  * {@link ensureTinyCloudHosts}.
352
352
  */
353
353
  setRestoredTinyCloudSession(session: TinyCloudSession, hosts?: string[]): void;
354
+ /** @internal Atomically adopt the state staged by TinyCloudNode.restoreSession. */
355
+ installRestoredSession(sessionManager: ISessionManager, session: TinyCloudSession | undefined, hosts?: string[]): void;
354
356
  /**
355
357
  * Ensure `tinycloudHosts` are resolved before a host-needing call.
356
358
  *
@@ -621,6 +623,47 @@ interface DelegationAuthority {
621
623
  prompted: boolean;
622
624
  }>;
623
625
  }
626
+ /**
627
+ * Authority that the validated runtime-delegation activation helper needs.
628
+ * `TinyCloudNode` implements this surface directly; keeping it structural
629
+ * makes the helper usable by a compatible Node wrapper without exposing node
630
+ * internals.
631
+ */
632
+ interface RuntimeDelegationActivator {
633
+ readonly sessionDid: string;
634
+ readonly did?: string;
635
+ readonly isSessionOnly?: boolean;
636
+ computeDelegationCid(authorization: string): string;
637
+ useRuntimeDelegation(delegation: PortableDelegation): Promise<void>;
638
+ useDelegation?(delegation: PortableDelegation): Promise<unknown>;
639
+ getRuntimePermissionDelegations(): PortableDelegation[];
640
+ }
641
+ /** The installed authority returned by {@link activateValidatedRuntimeDelegation}. */
642
+ interface ValidatedRuntimeDelegation {
643
+ /** CID recomputed from the signed authorization bytes. */
644
+ readonly cid: string;
645
+ /** The authority object installed by the node runtime. */
646
+ readonly delegation: PortableDelegation;
647
+ /** Capabilities read from the signed compact UCAN attenuation. */
648
+ readonly effectivePermissions: readonly PermissionEntry[];
649
+ /** Expiry read from the signed compact UCAN payload. */
650
+ readonly expiry: Date;
651
+ /** Audience read from the signed compact UCAN payload. */
652
+ readonly audience: string;
653
+ /** Host selected for, and used by, the runtime activation. */
654
+ readonly host: string;
655
+ }
656
+ /**
657
+ * CID-bind and activate one compact runtime delegation.
658
+ *
659
+ * The helper derives audience, expiry, and effective permissions from the
660
+ * compact UCAN's signed payload, verifies the transport fields agree, then
661
+ * invokes {@link TinyCloudNode.useRuntimeDelegation}. The node activation call
662
+ * remains the authority and delegation-chain validation boundary.
663
+ */
664
+ declare function activateValidatedRuntimeDelegation(node: RuntimeDelegationActivator, delegation: PortableDelegation, options: {
665
+ host: string;
666
+ }): Promise<ValidatedRuntimeDelegation>;
624
667
  /**
625
668
  * Turn a delegation REQUEST into a signed GRANT.
626
669
  *
@@ -757,6 +800,47 @@ declare class DelegatedAccess {
757
800
  * ```
758
801
  */
759
802
 
803
+ /** Input for {@link TinyCloudNode.readSecret}. The target space is required. */
804
+ interface SecretReadInput {
805
+ /** Explicit full space URI or an owned-space name. */
806
+ space: string;
807
+ /** Env-style secret name. */
808
+ name: string;
809
+ /** Optional logical secret scope. */
810
+ scope?: string;
811
+ }
812
+ /** Safe, validated capability hint returned when the node denies one read phase. */
813
+ interface SecretPermissionHint {
814
+ readonly service: "tinycloud.kv" | "tinycloud.encryption";
815
+ readonly space?: string;
816
+ readonly path: string;
817
+ readonly actions: readonly string[];
818
+ }
819
+ /**
820
+ * Safe classified result for an explicit-space secret read.
821
+ *
822
+ * Failure variants contain no raw node response, envelope, plaintext, keys,
823
+ * tokens, or delegation data.
824
+ */
825
+ type SecretReadResult = {
826
+ status: "ok";
827
+ value: string;
828
+ } | {
829
+ status: "not_found";
830
+ } | {
831
+ status: "permission_required";
832
+ hint: SecretPermissionHint;
833
+ } | {
834
+ status: "node_unreachable";
835
+ } | {
836
+ status: "read_failed";
837
+ } | {
838
+ status: "corrupt_envelope";
839
+ } | {
840
+ status: "decrypt_failed";
841
+ } | {
842
+ status: "invalid_payload";
843
+ };
760
844
  interface CreateOwnerDelegationParams {
761
845
  readonly delegateDid: string;
762
846
  readonly spaceId: string;
@@ -777,6 +861,10 @@ interface OwnerDelegationReceipt {
777
861
  readonly skipped: readonly string[];
778
862
  };
779
863
  }
864
+ declare class UnsupportedSessionRestoreError extends Error {
865
+ readonly code: "RESTORE_SESSION_KEY_REPLACEMENT_UNSUPPORTED";
866
+ constructor(reason?: string);
867
+ }
780
868
  /**
781
869
  * Configuration for TinyCloudNode.
782
870
  * All fields are optional - TinyCloudNode can work with zero configuration.
@@ -909,6 +997,7 @@ declare class TinyCloudNode {
909
997
  private _chainId;
910
998
  private wasmBindings;
911
999
  private sessionManager;
1000
+ private _serviceGraph;
912
1001
  private _serviceContext?;
913
1002
  private _kv?;
914
1003
  private _sql?;
@@ -916,6 +1005,7 @@ declare class TinyCloudNode {
916
1005
  private _hooks?;
917
1006
  private _vault?;
918
1007
  private _encryption?;
1008
+ private _baseVaults;
919
1009
  private _baseSecrets;
920
1010
  private _secrets;
921
1011
  private _account?;
@@ -1002,6 +1092,7 @@ declare class TinyCloudNode {
1002
1092
  */
1003
1093
  private setupAuth;
1004
1094
  private shouldUseBootstrapSignInRequest;
1095
+ private createServiceGraphLifetime;
1005
1096
  private syncResolvedHostFromAuth;
1006
1097
  /**
1007
1098
  * Install or replace the manifest that drives the SIWE recap at
@@ -1034,6 +1125,15 @@ declare class TinyCloudNode {
1034
1125
  * Use this when you specifically need the session key, not the user identity.
1035
1126
  */
1036
1127
  get sessionDid(): string;
1128
+ /**
1129
+ * Return the current session's signed ReCap capabilities after the session
1130
+ * has been authenticated or restored. This is intentionally distinct from
1131
+ * installed runtime delegations: it reports base-session authority only.
1132
+ *
1133
+ * Invalid or unparseable signed ReCap material throws so callers fail closed
1134
+ * rather than treating a malformed session as unrestricted authority.
1135
+ */
1136
+ getVerifiedSessionCapabilities(): PermissionEntry[];
1037
1137
  /**
1038
1138
  * Get the Ethereum address for this user.
1039
1139
  */
@@ -1224,6 +1324,8 @@ declare class TinyCloudNode {
1224
1324
  };
1225
1325
  delegationCid: string;
1226
1326
  spaceId: string;
1327
+ /** Additional capability spaces persisted with the primary session. */
1328
+ spaces?: Record<string, string>;
1227
1329
  jwk: object;
1228
1330
  verificationMethod: string;
1229
1331
  address?: string;
@@ -1238,11 +1340,16 @@ declare class TinyCloudNode {
1238
1340
  */
1239
1341
  siwe?: string;
1240
1342
  /**
1241
- * The wallet/OpenKey signature over `siwe`. Optional because the
1242
- * runtime doesn't re-verify it — it's persisted alongside the SIWE
1243
- * for callers that need to round-trip the full session shape.
1343
+ * The wallet/OpenKey signature over `siwe`. When any signed-session
1344
+ * metadata is restored, this is required and verified in WASM before
1345
+ * local ReCap or expiry authority is installed.
1244
1346
  */
1245
1347
  signature?: string;
1348
+ /**
1349
+ * Persisted policy expiry. Required when an otherwise valid SIWE omits
1350
+ * `Expiration Time`; restore never invents a new renewable lifetime.
1351
+ */
1352
+ expiresAt?: string;
1246
1353
  /**
1247
1354
  * The TinyCloud hosts this session was created against (from
1248
1355
  * {@link PersistedSessionData.tinycloudHosts}). When present they are
@@ -1254,6 +1361,8 @@ declare class TinyCloudNode {
1254
1361
  */
1255
1362
  tinycloudHosts?: string[];
1256
1363
  }): Promise<void>;
1364
+ private stagePrimarySessionState;
1365
+ private stageRestoredServiceGraph;
1257
1366
  /**
1258
1367
  * Resolve the host a restored session should target.
1259
1368
  *
@@ -1331,9 +1440,16 @@ declare class TinyCloudNode {
1331
1440
  getEncryptionNetworkIdForSpace(spaceId: string, name?: string): string;
1332
1441
  private ownerDidFromSpaceId;
1333
1442
  private requireServiceSession;
1443
+ /**
1444
+ * Runtime-permission helpers can be used from an authenticated Node session
1445
+ * before its public ServiceContext is initialized. They still need the
1446
+ * current signed session, never an optional or stale authority object.
1447
+ */
1448
+ private requireEncryptionSession;
1334
1449
  private createEncryptionCrypto;
1335
1450
  private fetchNodeId;
1336
1451
  private signRawNetworkAuthorization;
1452
+ private fetchEncryptionNetworkAt;
1337
1453
  private createEncryptionService;
1338
1454
  private getEncryptionService;
1339
1455
  private createVaultService;
@@ -1371,7 +1487,7 @@ declare class TinyCloudNode {
1371
1487
  * with expiry longer than the current session.
1372
1488
  * @internal
1373
1489
  */
1374
- createOwnerDelegation(params: CreateOwnerDelegationParams): Promise<OwnerDelegationReceipt>;
1490
+ createOwnerDelegation(params: CreateOwnerDelegationParams, assertActive?: () => void): Promise<OwnerDelegationReceipt>;
1375
1491
  private createRootDelegationForSharing;
1376
1492
  /**
1377
1493
  * Track a received delegation in the capability registry.
@@ -1440,7 +1556,14 @@ declare class TinyCloudNode {
1440
1556
  * App-facing secrets API backed by the requested space's vault.
1441
1557
  */
1442
1558
  secretsForSpace(spaceId: string): ISecretsService;
1559
+ /**
1560
+ * Read a secret from an explicit target space without requesting or
1561
+ * auto-signing authority. Active runtime delegations are selected by the
1562
+ * normal KV and encryption invocation paths.
1563
+ */
1564
+ readSecret(input: SecretReadInput): Promise<SecretReadResult>;
1443
1565
  private getBaseSecrets;
1566
+ private getBaseVault;
1444
1567
  /**
1445
1568
  * Hooks write stream subscription API.
1446
1569
  */
@@ -1498,6 +1621,15 @@ declare class TinyCloudNode {
1498
1621
  * returned. Base-session manifest permissions are not represented here.
1499
1622
  */
1500
1623
  getRuntimePermissionDelegations(permissions?: PermissionEntry[]): PortableDelegation[];
1624
+ /**
1625
+ * Return the effective capabilities of installed runtime grants.
1626
+ *
1627
+ * The result is projected from the SDK's activated, expiry-pruned grant
1628
+ * operations rather than from PortableDelegation transport metadata. Base
1629
+ * session authority is intentionally omitted; callers that need the full
1630
+ * live authority must combine this with {@link getVerifiedSessionCapabilities}.
1631
+ */
1632
+ getEffectiveRuntimePermissionEntries(): PermissionEntry[];
1501
1633
  /**
1502
1634
  * Install a portable runtime permission delegation into this SDK instance so
1503
1635
  * matching service calls and downstream `delegateTo()` calls can use it.
@@ -1650,7 +1782,7 @@ declare class TinyCloudNode {
1650
1782
  revokeDelegation(cid: string): Promise<DelegationResult<DelegationRevocationReceipt>>;
1651
1783
  /** Read node-confirmed lifecycle state for one delegation. */
1652
1784
  getDelegationStatus(cid: string): Promise<DelegationResult<DelegationStatus>>;
1653
- /** Compute the canonical CID of a compact delegation authorization. */
1785
+ /** Compute the canonical CID of a compact UCAN or DAG-CBOR delegation authorization. */
1654
1786
  computeDelegationCid(authorization: string): string;
1655
1787
  /**
1656
1788
  * List all delegations for the current session's space.
@@ -1744,6 +1876,20 @@ declare class TinyCloudNode {
1744
1876
  private createDelegationViaRuntimeGrant;
1745
1877
  private resolvePermissionSpace;
1746
1878
  private expandPermissionEntries;
1879
+ /**
1880
+ * The current WASM child-delegation APIs accept action-only maps. Refuse any
1881
+ * constrained branch rather than signing a broader action-only child UCAN.
1882
+ */
1883
+ private assertDelegationCaveatsPreservable;
1884
+ /**
1885
+ * Runtime grant selection intentionally allows an uncaveated operation to
1886
+ * select a caveated grant so invocation can restore the signed caveat before
1887
+ * crossing the caveat-aware WASM boundary. Child delegation cannot do that:
1888
+ * it only accepts action maps, so reject the selected constrained branch.
1889
+ */
1890
+ private assertRuntimeGrantCaveatsPreservable;
1891
+ /** Reject caveated parent branches before action-only child signing. */
1892
+ private assertPortableDelegationCaveatsPreservable;
1747
1893
  private shortServiceName;
1748
1894
  private permissionsToAbilities;
1749
1895
  private isEncryptionPermissionEntry;
@@ -1789,6 +1935,8 @@ declare class TinyCloudNode {
1789
1935
  private normalizeSpaceAddress;
1790
1936
  private actionContains;
1791
1937
  private invocationServiceName;
1938
+ /** Prefer the v2 caveat-preserving parser while retaining old custom WASM. */
1939
+ private parseRecapWithCaveats;
1792
1940
  private isEncryptionNetworkOperation;
1793
1941
  private operationFromInvokeAnyEntry;
1794
1942
  private pathContains;
@@ -1981,4 +2129,4 @@ declare class WasmKeyProvider implements KeyProvider {
1981
2129
  */
1982
2130
  declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
1983
2131
 
1984
- export { type AuthDelegationArtifact as A, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SignStrategy as S, TinyCloudNode as T, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimePermissionGrantOptions as g, type TinyCloudNodeConfig as h, type WasmKeyProviderConfig as i, createWasmKeyProvider as j, defaultSignStrategy as k, deserializeDelegation as l, grantAuthRequest as m, serializeDelegation as s };
2132
+ export { type AuthDelegationArtifact as A, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, UnsupportedSessionRestoreError as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimeDelegationActivator as g, type RuntimePermissionGrantOptions as h, type SecretReadInput as i, type SecretReadResult as j, type SignStrategy as k, type TinyCloudNodeConfig as l, type WasmKeyProviderConfig as m, activateValidatedRuntimeDelegation as n, createWasmKeyProvider as o, defaultSignStrategy as p, deserializeDelegation as q, grantAuthRequest as r, serializeDelegation as s };
@@ -351,6 +351,8 @@ declare class NodeUserAuthorization implements IUserAuthorization {
351
351
  * {@link ensureTinyCloudHosts}.
352
352
  */
353
353
  setRestoredTinyCloudSession(session: TinyCloudSession, hosts?: string[]): void;
354
+ /** @internal Atomically adopt the state staged by TinyCloudNode.restoreSession. */
355
+ installRestoredSession(sessionManager: ISessionManager, session: TinyCloudSession | undefined, hosts?: string[]): void;
354
356
  /**
355
357
  * Ensure `tinycloudHosts` are resolved before a host-needing call.
356
358
  *
@@ -621,6 +623,47 @@ interface DelegationAuthority {
621
623
  prompted: boolean;
622
624
  }>;
623
625
  }
626
+ /**
627
+ * Authority that the validated runtime-delegation activation helper needs.
628
+ * `TinyCloudNode` implements this surface directly; keeping it structural
629
+ * makes the helper usable by a compatible Node wrapper without exposing node
630
+ * internals.
631
+ */
632
+ interface RuntimeDelegationActivator {
633
+ readonly sessionDid: string;
634
+ readonly did?: string;
635
+ readonly isSessionOnly?: boolean;
636
+ computeDelegationCid(authorization: string): string;
637
+ useRuntimeDelegation(delegation: PortableDelegation): Promise<void>;
638
+ useDelegation?(delegation: PortableDelegation): Promise<unknown>;
639
+ getRuntimePermissionDelegations(): PortableDelegation[];
640
+ }
641
+ /** The installed authority returned by {@link activateValidatedRuntimeDelegation}. */
642
+ interface ValidatedRuntimeDelegation {
643
+ /** CID recomputed from the signed authorization bytes. */
644
+ readonly cid: string;
645
+ /** The authority object installed by the node runtime. */
646
+ readonly delegation: PortableDelegation;
647
+ /** Capabilities read from the signed compact UCAN attenuation. */
648
+ readonly effectivePermissions: readonly PermissionEntry[];
649
+ /** Expiry read from the signed compact UCAN payload. */
650
+ readonly expiry: Date;
651
+ /** Audience read from the signed compact UCAN payload. */
652
+ readonly audience: string;
653
+ /** Host selected for, and used by, the runtime activation. */
654
+ readonly host: string;
655
+ }
656
+ /**
657
+ * CID-bind and activate one compact runtime delegation.
658
+ *
659
+ * The helper derives audience, expiry, and effective permissions from the
660
+ * compact UCAN's signed payload, verifies the transport fields agree, then
661
+ * invokes {@link TinyCloudNode.useRuntimeDelegation}. The node activation call
662
+ * remains the authority and delegation-chain validation boundary.
663
+ */
664
+ declare function activateValidatedRuntimeDelegation(node: RuntimeDelegationActivator, delegation: PortableDelegation, options: {
665
+ host: string;
666
+ }): Promise<ValidatedRuntimeDelegation>;
624
667
  /**
625
668
  * Turn a delegation REQUEST into a signed GRANT.
626
669
  *
@@ -757,6 +800,47 @@ declare class DelegatedAccess {
757
800
  * ```
758
801
  */
759
802
 
803
+ /** Input for {@link TinyCloudNode.readSecret}. The target space is required. */
804
+ interface SecretReadInput {
805
+ /** Explicit full space URI or an owned-space name. */
806
+ space: string;
807
+ /** Env-style secret name. */
808
+ name: string;
809
+ /** Optional logical secret scope. */
810
+ scope?: string;
811
+ }
812
+ /** Safe, validated capability hint returned when the node denies one read phase. */
813
+ interface SecretPermissionHint {
814
+ readonly service: "tinycloud.kv" | "tinycloud.encryption";
815
+ readonly space?: string;
816
+ readonly path: string;
817
+ readonly actions: readonly string[];
818
+ }
819
+ /**
820
+ * Safe classified result for an explicit-space secret read.
821
+ *
822
+ * Failure variants contain no raw node response, envelope, plaintext, keys,
823
+ * tokens, or delegation data.
824
+ */
825
+ type SecretReadResult = {
826
+ status: "ok";
827
+ value: string;
828
+ } | {
829
+ status: "not_found";
830
+ } | {
831
+ status: "permission_required";
832
+ hint: SecretPermissionHint;
833
+ } | {
834
+ status: "node_unreachable";
835
+ } | {
836
+ status: "read_failed";
837
+ } | {
838
+ status: "corrupt_envelope";
839
+ } | {
840
+ status: "decrypt_failed";
841
+ } | {
842
+ status: "invalid_payload";
843
+ };
760
844
  interface CreateOwnerDelegationParams {
761
845
  readonly delegateDid: string;
762
846
  readonly spaceId: string;
@@ -777,6 +861,10 @@ interface OwnerDelegationReceipt {
777
861
  readonly skipped: readonly string[];
778
862
  };
779
863
  }
864
+ declare class UnsupportedSessionRestoreError extends Error {
865
+ readonly code: "RESTORE_SESSION_KEY_REPLACEMENT_UNSUPPORTED";
866
+ constructor(reason?: string);
867
+ }
780
868
  /**
781
869
  * Configuration for TinyCloudNode.
782
870
  * All fields are optional - TinyCloudNode can work with zero configuration.
@@ -909,6 +997,7 @@ declare class TinyCloudNode {
909
997
  private _chainId;
910
998
  private wasmBindings;
911
999
  private sessionManager;
1000
+ private _serviceGraph;
912
1001
  private _serviceContext?;
913
1002
  private _kv?;
914
1003
  private _sql?;
@@ -916,6 +1005,7 @@ declare class TinyCloudNode {
916
1005
  private _hooks?;
917
1006
  private _vault?;
918
1007
  private _encryption?;
1008
+ private _baseVaults;
919
1009
  private _baseSecrets;
920
1010
  private _secrets;
921
1011
  private _account?;
@@ -1002,6 +1092,7 @@ declare class TinyCloudNode {
1002
1092
  */
1003
1093
  private setupAuth;
1004
1094
  private shouldUseBootstrapSignInRequest;
1095
+ private createServiceGraphLifetime;
1005
1096
  private syncResolvedHostFromAuth;
1006
1097
  /**
1007
1098
  * Install or replace the manifest that drives the SIWE recap at
@@ -1034,6 +1125,15 @@ declare class TinyCloudNode {
1034
1125
  * Use this when you specifically need the session key, not the user identity.
1035
1126
  */
1036
1127
  get sessionDid(): string;
1128
+ /**
1129
+ * Return the current session's signed ReCap capabilities after the session
1130
+ * has been authenticated or restored. This is intentionally distinct from
1131
+ * installed runtime delegations: it reports base-session authority only.
1132
+ *
1133
+ * Invalid or unparseable signed ReCap material throws so callers fail closed
1134
+ * rather than treating a malformed session as unrestricted authority.
1135
+ */
1136
+ getVerifiedSessionCapabilities(): PermissionEntry[];
1037
1137
  /**
1038
1138
  * Get the Ethereum address for this user.
1039
1139
  */
@@ -1224,6 +1324,8 @@ declare class TinyCloudNode {
1224
1324
  };
1225
1325
  delegationCid: string;
1226
1326
  spaceId: string;
1327
+ /** Additional capability spaces persisted with the primary session. */
1328
+ spaces?: Record<string, string>;
1227
1329
  jwk: object;
1228
1330
  verificationMethod: string;
1229
1331
  address?: string;
@@ -1238,11 +1340,16 @@ declare class TinyCloudNode {
1238
1340
  */
1239
1341
  siwe?: string;
1240
1342
  /**
1241
- * The wallet/OpenKey signature over `siwe`. Optional because the
1242
- * runtime doesn't re-verify it — it's persisted alongside the SIWE
1243
- * for callers that need to round-trip the full session shape.
1343
+ * The wallet/OpenKey signature over `siwe`. When any signed-session
1344
+ * metadata is restored, this is required and verified in WASM before
1345
+ * local ReCap or expiry authority is installed.
1244
1346
  */
1245
1347
  signature?: string;
1348
+ /**
1349
+ * Persisted policy expiry. Required when an otherwise valid SIWE omits
1350
+ * `Expiration Time`; restore never invents a new renewable lifetime.
1351
+ */
1352
+ expiresAt?: string;
1246
1353
  /**
1247
1354
  * The TinyCloud hosts this session was created against (from
1248
1355
  * {@link PersistedSessionData.tinycloudHosts}). When present they are
@@ -1254,6 +1361,8 @@ declare class TinyCloudNode {
1254
1361
  */
1255
1362
  tinycloudHosts?: string[];
1256
1363
  }): Promise<void>;
1364
+ private stagePrimarySessionState;
1365
+ private stageRestoredServiceGraph;
1257
1366
  /**
1258
1367
  * Resolve the host a restored session should target.
1259
1368
  *
@@ -1331,9 +1440,16 @@ declare class TinyCloudNode {
1331
1440
  getEncryptionNetworkIdForSpace(spaceId: string, name?: string): string;
1332
1441
  private ownerDidFromSpaceId;
1333
1442
  private requireServiceSession;
1443
+ /**
1444
+ * Runtime-permission helpers can be used from an authenticated Node session
1445
+ * before its public ServiceContext is initialized. They still need the
1446
+ * current signed session, never an optional or stale authority object.
1447
+ */
1448
+ private requireEncryptionSession;
1334
1449
  private createEncryptionCrypto;
1335
1450
  private fetchNodeId;
1336
1451
  private signRawNetworkAuthorization;
1452
+ private fetchEncryptionNetworkAt;
1337
1453
  private createEncryptionService;
1338
1454
  private getEncryptionService;
1339
1455
  private createVaultService;
@@ -1371,7 +1487,7 @@ declare class TinyCloudNode {
1371
1487
  * with expiry longer than the current session.
1372
1488
  * @internal
1373
1489
  */
1374
- createOwnerDelegation(params: CreateOwnerDelegationParams): Promise<OwnerDelegationReceipt>;
1490
+ createOwnerDelegation(params: CreateOwnerDelegationParams, assertActive?: () => void): Promise<OwnerDelegationReceipt>;
1375
1491
  private createRootDelegationForSharing;
1376
1492
  /**
1377
1493
  * Track a received delegation in the capability registry.
@@ -1440,7 +1556,14 @@ declare class TinyCloudNode {
1440
1556
  * App-facing secrets API backed by the requested space's vault.
1441
1557
  */
1442
1558
  secretsForSpace(spaceId: string): ISecretsService;
1559
+ /**
1560
+ * Read a secret from an explicit target space without requesting or
1561
+ * auto-signing authority. Active runtime delegations are selected by the
1562
+ * normal KV and encryption invocation paths.
1563
+ */
1564
+ readSecret(input: SecretReadInput): Promise<SecretReadResult>;
1443
1565
  private getBaseSecrets;
1566
+ private getBaseVault;
1444
1567
  /**
1445
1568
  * Hooks write stream subscription API.
1446
1569
  */
@@ -1498,6 +1621,15 @@ declare class TinyCloudNode {
1498
1621
  * returned. Base-session manifest permissions are not represented here.
1499
1622
  */
1500
1623
  getRuntimePermissionDelegations(permissions?: PermissionEntry[]): PortableDelegation[];
1624
+ /**
1625
+ * Return the effective capabilities of installed runtime grants.
1626
+ *
1627
+ * The result is projected from the SDK's activated, expiry-pruned grant
1628
+ * operations rather than from PortableDelegation transport metadata. Base
1629
+ * session authority is intentionally omitted; callers that need the full
1630
+ * live authority must combine this with {@link getVerifiedSessionCapabilities}.
1631
+ */
1632
+ getEffectiveRuntimePermissionEntries(): PermissionEntry[];
1501
1633
  /**
1502
1634
  * Install a portable runtime permission delegation into this SDK instance so
1503
1635
  * matching service calls and downstream `delegateTo()` calls can use it.
@@ -1650,7 +1782,7 @@ declare class TinyCloudNode {
1650
1782
  revokeDelegation(cid: string): Promise<DelegationResult<DelegationRevocationReceipt>>;
1651
1783
  /** Read node-confirmed lifecycle state for one delegation. */
1652
1784
  getDelegationStatus(cid: string): Promise<DelegationResult<DelegationStatus>>;
1653
- /** Compute the canonical CID of a compact delegation authorization. */
1785
+ /** Compute the canonical CID of a compact UCAN or DAG-CBOR delegation authorization. */
1654
1786
  computeDelegationCid(authorization: string): string;
1655
1787
  /**
1656
1788
  * List all delegations for the current session's space.
@@ -1744,6 +1876,20 @@ declare class TinyCloudNode {
1744
1876
  private createDelegationViaRuntimeGrant;
1745
1877
  private resolvePermissionSpace;
1746
1878
  private expandPermissionEntries;
1879
+ /**
1880
+ * The current WASM child-delegation APIs accept action-only maps. Refuse any
1881
+ * constrained branch rather than signing a broader action-only child UCAN.
1882
+ */
1883
+ private assertDelegationCaveatsPreservable;
1884
+ /**
1885
+ * Runtime grant selection intentionally allows an uncaveated operation to
1886
+ * select a caveated grant so invocation can restore the signed caveat before
1887
+ * crossing the caveat-aware WASM boundary. Child delegation cannot do that:
1888
+ * it only accepts action maps, so reject the selected constrained branch.
1889
+ */
1890
+ private assertRuntimeGrantCaveatsPreservable;
1891
+ /** Reject caveated parent branches before action-only child signing. */
1892
+ private assertPortableDelegationCaveatsPreservable;
1747
1893
  private shortServiceName;
1748
1894
  private permissionsToAbilities;
1749
1895
  private isEncryptionPermissionEntry;
@@ -1789,6 +1935,8 @@ declare class TinyCloudNode {
1789
1935
  private normalizeSpaceAddress;
1790
1936
  private actionContains;
1791
1937
  private invocationServiceName;
1938
+ /** Prefer the v2 caveat-preserving parser while retaining old custom WASM. */
1939
+ private parseRecapWithCaveats;
1792
1940
  private isEncryptionNetworkOperation;
1793
1941
  private operationFromInvokeAnyEntry;
1794
1942
  private pathContains;
@@ -1981,4 +2129,4 @@ declare class WasmKeyProvider implements KeyProvider {
1981
2129
  */
1982
2130
  declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
1983
2131
 
1984
- export { type AuthDelegationArtifact as A, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SignStrategy as S, TinyCloudNode as T, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimePermissionGrantOptions as g, type TinyCloudNodeConfig as h, type WasmKeyProviderConfig as i, createWasmKeyProvider as j, defaultSignStrategy as k, deserializeDelegation as l, grantAuthRequest as m, serializeDelegation as s };
2132
+ export { type AuthDelegationArtifact as A, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, UnsupportedSessionRestoreError as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimeDelegationActivator as g, type RuntimePermissionGrantOptions as h, type SecretReadInput as i, type SecretReadResult as j, type SignStrategy as k, type TinyCloudNodeConfig as l, type WasmKeyProviderConfig as m, activateValidatedRuntimeDelegation as n, createWasmKeyProvider as o, defaultSignStrategy as p, deserializeDelegation as q, grantAuthRequest as r, serializeDelegation as s };