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

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,44 @@ 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
+ computeDelegationCid(authorization: string): string;
635
+ useRuntimeDelegation(delegation: PortableDelegation): Promise<void>;
636
+ getRuntimePermissionDelegations(): PortableDelegation[];
637
+ }
638
+ /** The installed authority returned by {@link activateValidatedRuntimeDelegation}. */
639
+ interface ValidatedRuntimeDelegation {
640
+ /** CID recomputed from the signed authorization bytes. */
641
+ readonly cid: string;
642
+ /** The authority object installed by the node runtime. */
643
+ readonly delegation: PortableDelegation;
644
+ /** Capabilities read from the signed compact UCAN attenuation. */
645
+ readonly effectivePermissions: readonly PermissionEntry[];
646
+ /** Expiry read from the signed compact UCAN payload. */
647
+ readonly expiry: Date;
648
+ /** Audience read from the signed compact UCAN payload. */
649
+ readonly audience: string;
650
+ /** Host selected for, and used by, the runtime activation. */
651
+ readonly host: string;
652
+ }
653
+ /**
654
+ * CID-bind and activate one compact runtime delegation.
655
+ *
656
+ * The helper derives audience, expiry, and effective permissions from the
657
+ * compact UCAN's signed payload, verifies the transport fields agree, then
658
+ * invokes {@link TinyCloudNode.useRuntimeDelegation}. The node activation call
659
+ * remains the authority and delegation-chain validation boundary.
660
+ */
661
+ declare function activateValidatedRuntimeDelegation(node: RuntimeDelegationActivator | TinyCloudNode, delegation: PortableDelegation, options: {
662
+ host: string;
663
+ }): Promise<ValidatedRuntimeDelegation>;
624
664
  /**
625
665
  * Turn a delegation REQUEST into a signed GRANT.
626
666
  *
@@ -757,6 +797,47 @@ declare class DelegatedAccess {
757
797
  * ```
758
798
  */
759
799
 
800
+ /** Input for {@link TinyCloudNode.readSecret}. The target space is required. */
801
+ interface SecretReadInput {
802
+ /** Explicit full space URI or an owned-space name. */
803
+ space: string;
804
+ /** Env-style secret name. */
805
+ name: string;
806
+ /** Optional logical secret scope. */
807
+ scope?: string;
808
+ }
809
+ /** Safe, validated capability hint returned when the node denies one read phase. */
810
+ interface SecretPermissionHint {
811
+ readonly service: "tinycloud.kv" | "tinycloud.encryption";
812
+ readonly space?: string;
813
+ readonly path: string;
814
+ readonly actions: readonly string[];
815
+ }
816
+ /**
817
+ * Safe classified result for an explicit-space secret read.
818
+ *
819
+ * Failure variants contain no raw node response, envelope, plaintext, keys,
820
+ * tokens, or delegation data.
821
+ */
822
+ type SecretReadResult = {
823
+ status: "ok";
824
+ value: string;
825
+ } | {
826
+ status: "not_found";
827
+ } | {
828
+ status: "permission_required";
829
+ hint: SecretPermissionHint;
830
+ } | {
831
+ status: "node_unreachable";
832
+ } | {
833
+ status: "read_failed";
834
+ } | {
835
+ status: "corrupt_envelope";
836
+ } | {
837
+ status: "decrypt_failed";
838
+ } | {
839
+ status: "invalid_payload";
840
+ };
760
841
  interface CreateOwnerDelegationParams {
761
842
  readonly delegateDid: string;
762
843
  readonly spaceId: string;
@@ -777,6 +858,10 @@ interface OwnerDelegationReceipt {
777
858
  readonly skipped: readonly string[];
778
859
  };
779
860
  }
861
+ declare class UnsupportedSessionRestoreError extends Error {
862
+ readonly code: "RESTORE_SESSION_KEY_REPLACEMENT_UNSUPPORTED";
863
+ constructor(reason?: string);
864
+ }
780
865
  /**
781
866
  * Configuration for TinyCloudNode.
782
867
  * All fields are optional - TinyCloudNode can work with zero configuration.
@@ -909,6 +994,7 @@ declare class TinyCloudNode {
909
994
  private _chainId;
910
995
  private wasmBindings;
911
996
  private sessionManager;
997
+ private _serviceGraph;
912
998
  private _serviceContext?;
913
999
  private _kv?;
914
1000
  private _sql?;
@@ -916,6 +1002,7 @@ declare class TinyCloudNode {
916
1002
  private _hooks?;
917
1003
  private _vault?;
918
1004
  private _encryption?;
1005
+ private _baseVaults;
919
1006
  private _baseSecrets;
920
1007
  private _secrets;
921
1008
  private _account?;
@@ -1002,6 +1089,7 @@ declare class TinyCloudNode {
1002
1089
  */
1003
1090
  private setupAuth;
1004
1091
  private shouldUseBootstrapSignInRequest;
1092
+ private createServiceGraphLifetime;
1005
1093
  private syncResolvedHostFromAuth;
1006
1094
  /**
1007
1095
  * Install or replace the manifest that drives the SIWE recap at
@@ -1034,6 +1122,15 @@ declare class TinyCloudNode {
1034
1122
  * Use this when you specifically need the session key, not the user identity.
1035
1123
  */
1036
1124
  get sessionDid(): string;
1125
+ /**
1126
+ * Return the current session's signed ReCap capabilities after the session
1127
+ * has been authenticated or restored. This is intentionally distinct from
1128
+ * installed runtime delegations: it reports base-session authority only.
1129
+ *
1130
+ * Invalid or unparseable signed ReCap material throws so callers fail closed
1131
+ * rather than treating a malformed session as unrestricted authority.
1132
+ */
1133
+ getVerifiedSessionCapabilities(): PermissionEntry[];
1037
1134
  /**
1038
1135
  * Get the Ethereum address for this user.
1039
1136
  */
@@ -1224,6 +1321,8 @@ declare class TinyCloudNode {
1224
1321
  };
1225
1322
  delegationCid: string;
1226
1323
  spaceId: string;
1324
+ /** Additional capability spaces persisted with the primary session. */
1325
+ spaces?: Record<string, string>;
1227
1326
  jwk: object;
1228
1327
  verificationMethod: string;
1229
1328
  address?: string;
@@ -1238,11 +1337,16 @@ declare class TinyCloudNode {
1238
1337
  */
1239
1338
  siwe?: string;
1240
1339
  /**
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.
1340
+ * The wallet/OpenKey signature over `siwe`. When any signed-session
1341
+ * metadata is restored, this is required and verified in WASM before
1342
+ * local ReCap or expiry authority is installed.
1244
1343
  */
1245
1344
  signature?: string;
1345
+ /**
1346
+ * Persisted policy expiry. Required when an otherwise valid SIWE omits
1347
+ * `Expiration Time`; restore never invents a new renewable lifetime.
1348
+ */
1349
+ expiresAt?: string;
1246
1350
  /**
1247
1351
  * The TinyCloud hosts this session was created against (from
1248
1352
  * {@link PersistedSessionData.tinycloudHosts}). When present they are
@@ -1254,6 +1358,8 @@ declare class TinyCloudNode {
1254
1358
  */
1255
1359
  tinycloudHosts?: string[];
1256
1360
  }): Promise<void>;
1361
+ private stagePrimarySessionState;
1362
+ private stageRestoredServiceGraph;
1257
1363
  /**
1258
1364
  * Resolve the host a restored session should target.
1259
1365
  *
@@ -1331,9 +1437,16 @@ declare class TinyCloudNode {
1331
1437
  getEncryptionNetworkIdForSpace(spaceId: string, name?: string): string;
1332
1438
  private ownerDidFromSpaceId;
1333
1439
  private requireServiceSession;
1440
+ /**
1441
+ * Runtime-permission helpers can be used from an authenticated Node session
1442
+ * before its public ServiceContext is initialized. They still need the
1443
+ * current signed session, never an optional or stale authority object.
1444
+ */
1445
+ private requireEncryptionSession;
1334
1446
  private createEncryptionCrypto;
1335
1447
  private fetchNodeId;
1336
1448
  private signRawNetworkAuthorization;
1449
+ private fetchEncryptionNetworkAt;
1337
1450
  private createEncryptionService;
1338
1451
  private getEncryptionService;
1339
1452
  private createVaultService;
@@ -1371,7 +1484,7 @@ declare class TinyCloudNode {
1371
1484
  * with expiry longer than the current session.
1372
1485
  * @internal
1373
1486
  */
1374
- createOwnerDelegation(params: CreateOwnerDelegationParams): Promise<OwnerDelegationReceipt>;
1487
+ createOwnerDelegation(params: CreateOwnerDelegationParams, assertActive?: () => void): Promise<OwnerDelegationReceipt>;
1375
1488
  private createRootDelegationForSharing;
1376
1489
  /**
1377
1490
  * Track a received delegation in the capability registry.
@@ -1440,7 +1553,14 @@ declare class TinyCloudNode {
1440
1553
  * App-facing secrets API backed by the requested space's vault.
1441
1554
  */
1442
1555
  secretsForSpace(spaceId: string): ISecretsService;
1556
+ /**
1557
+ * Read a secret from an explicit target space without requesting or
1558
+ * auto-signing authority. Active runtime delegations are selected by the
1559
+ * normal KV and encryption invocation paths.
1560
+ */
1561
+ readSecret(input: SecretReadInput): Promise<SecretReadResult>;
1443
1562
  private getBaseSecrets;
1563
+ private getBaseVault;
1444
1564
  /**
1445
1565
  * Hooks write stream subscription API.
1446
1566
  */
@@ -1498,6 +1618,15 @@ declare class TinyCloudNode {
1498
1618
  * returned. Base-session manifest permissions are not represented here.
1499
1619
  */
1500
1620
  getRuntimePermissionDelegations(permissions?: PermissionEntry[]): PortableDelegation[];
1621
+ /**
1622
+ * Return the effective capabilities of installed runtime grants.
1623
+ *
1624
+ * The result is projected from the SDK's activated, expiry-pruned grant
1625
+ * operations rather than from PortableDelegation transport metadata. Base
1626
+ * session authority is intentionally omitted; callers that need the full
1627
+ * live authority must combine this with {@link getVerifiedSessionCapabilities}.
1628
+ */
1629
+ getEffectiveRuntimePermissionEntries(): PermissionEntry[];
1501
1630
  /**
1502
1631
  * Install a portable runtime permission delegation into this SDK instance so
1503
1632
  * matching service calls and downstream `delegateTo()` calls can use it.
@@ -1650,7 +1779,7 @@ declare class TinyCloudNode {
1650
1779
  revokeDelegation(cid: string): Promise<DelegationResult<DelegationRevocationReceipt>>;
1651
1780
  /** Read node-confirmed lifecycle state for one delegation. */
1652
1781
  getDelegationStatus(cid: string): Promise<DelegationResult<DelegationStatus>>;
1653
- /** Compute the canonical CID of a compact delegation authorization. */
1782
+ /** Compute the canonical CID of a compact UCAN or DAG-CBOR delegation authorization. */
1654
1783
  computeDelegationCid(authorization: string): string;
1655
1784
  /**
1656
1785
  * List all delegations for the current session's space.
@@ -1744,6 +1873,20 @@ declare class TinyCloudNode {
1744
1873
  private createDelegationViaRuntimeGrant;
1745
1874
  private resolvePermissionSpace;
1746
1875
  private expandPermissionEntries;
1876
+ /**
1877
+ * The current WASM child-delegation APIs accept action-only maps. Refuse any
1878
+ * constrained branch rather than signing a broader action-only child UCAN.
1879
+ */
1880
+ private assertDelegationCaveatsPreservable;
1881
+ /**
1882
+ * Runtime grant selection intentionally allows an uncaveated operation to
1883
+ * select a caveated grant so invocation can restore the signed caveat before
1884
+ * crossing the caveat-aware WASM boundary. Child delegation cannot do that:
1885
+ * it only accepts action maps, so reject the selected constrained branch.
1886
+ */
1887
+ private assertRuntimeGrantCaveatsPreservable;
1888
+ /** Reject caveated parent branches before action-only child signing. */
1889
+ private assertPortableDelegationCaveatsPreservable;
1747
1890
  private shortServiceName;
1748
1891
  private permissionsToAbilities;
1749
1892
  private isEncryptionPermissionEntry;
@@ -1789,6 +1932,8 @@ declare class TinyCloudNode {
1789
1932
  private normalizeSpaceAddress;
1790
1933
  private actionContains;
1791
1934
  private invocationServiceName;
1935
+ /** Prefer the v2 caveat-preserving parser while retaining old custom WASM. */
1936
+ private parseRecapWithCaveats;
1792
1937
  private isEncryptionNetworkOperation;
1793
1938
  private operationFromInvokeAnyEntry;
1794
1939
  private pathContains;
@@ -1981,4 +2126,4 @@ declare class WasmKeyProvider implements KeyProvider {
1981
2126
  */
1982
2127
  declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
1983
2128
 
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 };
2129
+ 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,44 @@ 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
+ computeDelegationCid(authorization: string): string;
635
+ useRuntimeDelegation(delegation: PortableDelegation): Promise<void>;
636
+ getRuntimePermissionDelegations(): PortableDelegation[];
637
+ }
638
+ /** The installed authority returned by {@link activateValidatedRuntimeDelegation}. */
639
+ interface ValidatedRuntimeDelegation {
640
+ /** CID recomputed from the signed authorization bytes. */
641
+ readonly cid: string;
642
+ /** The authority object installed by the node runtime. */
643
+ readonly delegation: PortableDelegation;
644
+ /** Capabilities read from the signed compact UCAN attenuation. */
645
+ readonly effectivePermissions: readonly PermissionEntry[];
646
+ /** Expiry read from the signed compact UCAN payload. */
647
+ readonly expiry: Date;
648
+ /** Audience read from the signed compact UCAN payload. */
649
+ readonly audience: string;
650
+ /** Host selected for, and used by, the runtime activation. */
651
+ readonly host: string;
652
+ }
653
+ /**
654
+ * CID-bind and activate one compact runtime delegation.
655
+ *
656
+ * The helper derives audience, expiry, and effective permissions from the
657
+ * compact UCAN's signed payload, verifies the transport fields agree, then
658
+ * invokes {@link TinyCloudNode.useRuntimeDelegation}. The node activation call
659
+ * remains the authority and delegation-chain validation boundary.
660
+ */
661
+ declare function activateValidatedRuntimeDelegation(node: RuntimeDelegationActivator | TinyCloudNode, delegation: PortableDelegation, options: {
662
+ host: string;
663
+ }): Promise<ValidatedRuntimeDelegation>;
624
664
  /**
625
665
  * Turn a delegation REQUEST into a signed GRANT.
626
666
  *
@@ -757,6 +797,47 @@ declare class DelegatedAccess {
757
797
  * ```
758
798
  */
759
799
 
800
+ /** Input for {@link TinyCloudNode.readSecret}. The target space is required. */
801
+ interface SecretReadInput {
802
+ /** Explicit full space URI or an owned-space name. */
803
+ space: string;
804
+ /** Env-style secret name. */
805
+ name: string;
806
+ /** Optional logical secret scope. */
807
+ scope?: string;
808
+ }
809
+ /** Safe, validated capability hint returned when the node denies one read phase. */
810
+ interface SecretPermissionHint {
811
+ readonly service: "tinycloud.kv" | "tinycloud.encryption";
812
+ readonly space?: string;
813
+ readonly path: string;
814
+ readonly actions: readonly string[];
815
+ }
816
+ /**
817
+ * Safe classified result for an explicit-space secret read.
818
+ *
819
+ * Failure variants contain no raw node response, envelope, plaintext, keys,
820
+ * tokens, or delegation data.
821
+ */
822
+ type SecretReadResult = {
823
+ status: "ok";
824
+ value: string;
825
+ } | {
826
+ status: "not_found";
827
+ } | {
828
+ status: "permission_required";
829
+ hint: SecretPermissionHint;
830
+ } | {
831
+ status: "node_unreachable";
832
+ } | {
833
+ status: "read_failed";
834
+ } | {
835
+ status: "corrupt_envelope";
836
+ } | {
837
+ status: "decrypt_failed";
838
+ } | {
839
+ status: "invalid_payload";
840
+ };
760
841
  interface CreateOwnerDelegationParams {
761
842
  readonly delegateDid: string;
762
843
  readonly spaceId: string;
@@ -777,6 +858,10 @@ interface OwnerDelegationReceipt {
777
858
  readonly skipped: readonly string[];
778
859
  };
779
860
  }
861
+ declare class UnsupportedSessionRestoreError extends Error {
862
+ readonly code: "RESTORE_SESSION_KEY_REPLACEMENT_UNSUPPORTED";
863
+ constructor(reason?: string);
864
+ }
780
865
  /**
781
866
  * Configuration for TinyCloudNode.
782
867
  * All fields are optional - TinyCloudNode can work with zero configuration.
@@ -909,6 +994,7 @@ declare class TinyCloudNode {
909
994
  private _chainId;
910
995
  private wasmBindings;
911
996
  private sessionManager;
997
+ private _serviceGraph;
912
998
  private _serviceContext?;
913
999
  private _kv?;
914
1000
  private _sql?;
@@ -916,6 +1002,7 @@ declare class TinyCloudNode {
916
1002
  private _hooks?;
917
1003
  private _vault?;
918
1004
  private _encryption?;
1005
+ private _baseVaults;
919
1006
  private _baseSecrets;
920
1007
  private _secrets;
921
1008
  private _account?;
@@ -1002,6 +1089,7 @@ declare class TinyCloudNode {
1002
1089
  */
1003
1090
  private setupAuth;
1004
1091
  private shouldUseBootstrapSignInRequest;
1092
+ private createServiceGraphLifetime;
1005
1093
  private syncResolvedHostFromAuth;
1006
1094
  /**
1007
1095
  * Install or replace the manifest that drives the SIWE recap at
@@ -1034,6 +1122,15 @@ declare class TinyCloudNode {
1034
1122
  * Use this when you specifically need the session key, not the user identity.
1035
1123
  */
1036
1124
  get sessionDid(): string;
1125
+ /**
1126
+ * Return the current session's signed ReCap capabilities after the session
1127
+ * has been authenticated or restored. This is intentionally distinct from
1128
+ * installed runtime delegations: it reports base-session authority only.
1129
+ *
1130
+ * Invalid or unparseable signed ReCap material throws so callers fail closed
1131
+ * rather than treating a malformed session as unrestricted authority.
1132
+ */
1133
+ getVerifiedSessionCapabilities(): PermissionEntry[];
1037
1134
  /**
1038
1135
  * Get the Ethereum address for this user.
1039
1136
  */
@@ -1224,6 +1321,8 @@ declare class TinyCloudNode {
1224
1321
  };
1225
1322
  delegationCid: string;
1226
1323
  spaceId: string;
1324
+ /** Additional capability spaces persisted with the primary session. */
1325
+ spaces?: Record<string, string>;
1227
1326
  jwk: object;
1228
1327
  verificationMethod: string;
1229
1328
  address?: string;
@@ -1238,11 +1337,16 @@ declare class TinyCloudNode {
1238
1337
  */
1239
1338
  siwe?: string;
1240
1339
  /**
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.
1340
+ * The wallet/OpenKey signature over `siwe`. When any signed-session
1341
+ * metadata is restored, this is required and verified in WASM before
1342
+ * local ReCap or expiry authority is installed.
1244
1343
  */
1245
1344
  signature?: string;
1345
+ /**
1346
+ * Persisted policy expiry. Required when an otherwise valid SIWE omits
1347
+ * `Expiration Time`; restore never invents a new renewable lifetime.
1348
+ */
1349
+ expiresAt?: string;
1246
1350
  /**
1247
1351
  * The TinyCloud hosts this session was created against (from
1248
1352
  * {@link PersistedSessionData.tinycloudHosts}). When present they are
@@ -1254,6 +1358,8 @@ declare class TinyCloudNode {
1254
1358
  */
1255
1359
  tinycloudHosts?: string[];
1256
1360
  }): Promise<void>;
1361
+ private stagePrimarySessionState;
1362
+ private stageRestoredServiceGraph;
1257
1363
  /**
1258
1364
  * Resolve the host a restored session should target.
1259
1365
  *
@@ -1331,9 +1437,16 @@ declare class TinyCloudNode {
1331
1437
  getEncryptionNetworkIdForSpace(spaceId: string, name?: string): string;
1332
1438
  private ownerDidFromSpaceId;
1333
1439
  private requireServiceSession;
1440
+ /**
1441
+ * Runtime-permission helpers can be used from an authenticated Node session
1442
+ * before its public ServiceContext is initialized. They still need the
1443
+ * current signed session, never an optional or stale authority object.
1444
+ */
1445
+ private requireEncryptionSession;
1334
1446
  private createEncryptionCrypto;
1335
1447
  private fetchNodeId;
1336
1448
  private signRawNetworkAuthorization;
1449
+ private fetchEncryptionNetworkAt;
1337
1450
  private createEncryptionService;
1338
1451
  private getEncryptionService;
1339
1452
  private createVaultService;
@@ -1371,7 +1484,7 @@ declare class TinyCloudNode {
1371
1484
  * with expiry longer than the current session.
1372
1485
  * @internal
1373
1486
  */
1374
- createOwnerDelegation(params: CreateOwnerDelegationParams): Promise<OwnerDelegationReceipt>;
1487
+ createOwnerDelegation(params: CreateOwnerDelegationParams, assertActive?: () => void): Promise<OwnerDelegationReceipt>;
1375
1488
  private createRootDelegationForSharing;
1376
1489
  /**
1377
1490
  * Track a received delegation in the capability registry.
@@ -1440,7 +1553,14 @@ declare class TinyCloudNode {
1440
1553
  * App-facing secrets API backed by the requested space's vault.
1441
1554
  */
1442
1555
  secretsForSpace(spaceId: string): ISecretsService;
1556
+ /**
1557
+ * Read a secret from an explicit target space without requesting or
1558
+ * auto-signing authority. Active runtime delegations are selected by the
1559
+ * normal KV and encryption invocation paths.
1560
+ */
1561
+ readSecret(input: SecretReadInput): Promise<SecretReadResult>;
1443
1562
  private getBaseSecrets;
1563
+ private getBaseVault;
1444
1564
  /**
1445
1565
  * Hooks write stream subscription API.
1446
1566
  */
@@ -1498,6 +1618,15 @@ declare class TinyCloudNode {
1498
1618
  * returned. Base-session manifest permissions are not represented here.
1499
1619
  */
1500
1620
  getRuntimePermissionDelegations(permissions?: PermissionEntry[]): PortableDelegation[];
1621
+ /**
1622
+ * Return the effective capabilities of installed runtime grants.
1623
+ *
1624
+ * The result is projected from the SDK's activated, expiry-pruned grant
1625
+ * operations rather than from PortableDelegation transport metadata. Base
1626
+ * session authority is intentionally omitted; callers that need the full
1627
+ * live authority must combine this with {@link getVerifiedSessionCapabilities}.
1628
+ */
1629
+ getEffectiveRuntimePermissionEntries(): PermissionEntry[];
1501
1630
  /**
1502
1631
  * Install a portable runtime permission delegation into this SDK instance so
1503
1632
  * matching service calls and downstream `delegateTo()` calls can use it.
@@ -1650,7 +1779,7 @@ declare class TinyCloudNode {
1650
1779
  revokeDelegation(cid: string): Promise<DelegationResult<DelegationRevocationReceipt>>;
1651
1780
  /** Read node-confirmed lifecycle state for one delegation. */
1652
1781
  getDelegationStatus(cid: string): Promise<DelegationResult<DelegationStatus>>;
1653
- /** Compute the canonical CID of a compact delegation authorization. */
1782
+ /** Compute the canonical CID of a compact UCAN or DAG-CBOR delegation authorization. */
1654
1783
  computeDelegationCid(authorization: string): string;
1655
1784
  /**
1656
1785
  * List all delegations for the current session's space.
@@ -1744,6 +1873,20 @@ declare class TinyCloudNode {
1744
1873
  private createDelegationViaRuntimeGrant;
1745
1874
  private resolvePermissionSpace;
1746
1875
  private expandPermissionEntries;
1876
+ /**
1877
+ * The current WASM child-delegation APIs accept action-only maps. Refuse any
1878
+ * constrained branch rather than signing a broader action-only child UCAN.
1879
+ */
1880
+ private assertDelegationCaveatsPreservable;
1881
+ /**
1882
+ * Runtime grant selection intentionally allows an uncaveated operation to
1883
+ * select a caveated grant so invocation can restore the signed caveat before
1884
+ * crossing the caveat-aware WASM boundary. Child delegation cannot do that:
1885
+ * it only accepts action maps, so reject the selected constrained branch.
1886
+ */
1887
+ private assertRuntimeGrantCaveatsPreservable;
1888
+ /** Reject caveated parent branches before action-only child signing. */
1889
+ private assertPortableDelegationCaveatsPreservable;
1747
1890
  private shortServiceName;
1748
1891
  private permissionsToAbilities;
1749
1892
  private isEncryptionPermissionEntry;
@@ -1789,6 +1932,8 @@ declare class TinyCloudNode {
1789
1932
  private normalizeSpaceAddress;
1790
1933
  private actionContains;
1791
1934
  private invocationServiceName;
1935
+ /** Prefer the v2 caveat-preserving parser while retaining old custom WASM. */
1936
+ private parseRecapWithCaveats;
1792
1937
  private isEncryptionNetworkOperation;
1793
1938
  private operationFromInvokeAnyEntry;
1794
1939
  private pathContains;
@@ -1981,4 +2126,4 @@ declare class WasmKeyProvider implements KeyProvider {
1981
2126
  */
1982
2127
  declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
1983
2128
 
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 };
2129
+ 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 };