@tinycloud/sdk-core 2.4.0-beta.9 → 2.4.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/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { InvokeFunction, InvokeAnyFunction, ParsedNetworkId, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, TelemetryConfig, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService, IEncryptionService, IDatabaseHandle, SqlValue, QueryResponse } from '@tinycloud/sdk-services';
3
- export { BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CanonicalDecryptRequest, CanonicalJson, ColumnInfo, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IEncryptionService, IHooksService, IKVService, IPrefixedKVService, ISQLService, ISecretsService, IService, IServiceContext, InlineEncryptedEnvelope, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, PrefixedKVService, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, ResolvedSecretPath, Result, RetryPolicy, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SignedReceiverKeyInput, SqlStatement, SqlValue, SubscribeOptions, TableInfo, TelemetryConfig, TelemetryEventHandler, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalHashHex, canonicalSignedResponse, canonicalizeEncryptionJson, canonicalizeSecretScope, checkDecryptInvocationInput, createVaultCrypto, decryptEnvelopeWithKey, defaultRetryPolicy, deriveSignedReceiverKey, discoverNetwork, encryptToNetwork, base64Decode as encryptionBase64Decode, base64Encode as encryptionBase64Encode, encryptionError, utf8Decode as encryptionUtf8Decode, utf8Encode as encryptionUtf8Encode, ensureNetworkUsableForDecrypt, err, generateRandomReceiverKey, hexDecode, hexEncode, isNetworkId, networkDiscoveryKey, ok, openWrappedKey, parseNetworkId, resolveSecretListPrefix, resolveSecretPath, serviceError, validateEnvelope, verifyDecryptResponse } from '@tinycloud/sdk-services';
3
+ export { BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CanonicalDecryptRequest, CanonicalJson, ColumnInfo, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IEncryptionService, IHooksService, IKVService, IPrefixedKVService, ISQLService, ISecretsService, IService, IServiceContext, InlineEncryptedEnvelope, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, PrefixedKVService, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, ResolvedSecretPath, Result, RetryPolicy, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SignedReceiverKeyInput, SqlStatement, SqlValue, SubscribeOptions, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalHashHex, canonicalSignedResponse, canonicalizeEncryptionJson, canonicalizeSecretScope, checkDecryptInvocationInput, clearTinyCloudDebugLogs, createVaultCrypto, decryptEnvelopeWithKey, defaultRetryPolicy, deriveSignedReceiverKey, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, base64Decode as encryptionBase64Decode, base64Encode as encryptionBase64Encode, encryptionError, utf8Decode as encryptionUtf8Decode, utf8Encode as encryptionUtf8Encode, ensureNetworkUsableForDecrypt, err, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isNetworkId, networkDiscoveryKey, ok, openWrappedKey, parseNetworkId, resolveSecretListPrefix, resolveSecretPath, serviceError, tinyCloudDebugLogger, validateEnvelope, verifyDecryptResponse } from '@tinycloud/sdk-services';
4
+ export { ACCOUNT_INDEX_SCHEMA, BOOTSTRAP_ALLOWLIST, BOOTSTRAP_DEFAULT_SPACE, BOOTSTRAP_ENCRYPTION_NETWORK_NAME, BOOTSTRAP_ENCRYPTION_NETWORK_RESOURCE_TEMPLATE, BOOTSTRAP_MANIFEST, BOOTSTRAP_PERSISTED_APPLICATION_MANIFESTS, BOOTSTRAP_PUBLIC_SPACE, BOOTSTRAP_SESSION_REQUESTS, BOOTSTRAP_SPACE_MANIFESTS, BOOTSTRAP_SPACE_NAMES, BootstrapAllowlistEntry, BootstrapAllowlistKind, BootstrapEncryptionNetworkStep, BootstrapManifest, BootstrapRawAbilityAllowlistEntry, BootstrapSchemaStep, BootstrapSeedApplicationsStep, BootstrapSeedSpacesStep, BootstrapSpaceDescriptor, BootstrapSpaceName, BootstrapSpaceStep, BootstrapStep, BootstrapStepKind, SECRET_RECORDS_SCHEMA, TINYCLOUD_ACCOUNT_SPACE_MANIFEST, TINYCLOUD_APPLICATIONS_SPACE_MANIFEST, TINYCLOUD_DEFAULT_SPACE_MANIFEST, TINYCLOUD_PUBLIC_SPACE_MANIFEST, TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST, bootstrapEncryptionNetworkId, bootstrapSpaceId, bootstrapSteps, composeBootstrapSpaceManifest } from '@tinycloud/bootstrap';
4
5
  export { SiweMessage } from 'siwe';
5
6
 
6
7
  /**
@@ -218,7 +219,7 @@ interface PermissionEntry {
218
219
  */
219
220
  path: string;
220
221
  /**
221
- * Short action names (e.g. "get", "put", "read", "ddl"). The SDK expands
222
+ * Short action names (e.g. "get", "put", "read", "schema"). The SDK expands
222
223
  * these to full URNs (e.g. `tinycloud.kv/get`) during resolution.
223
224
  * Already-expanded URNs are passed through unchanged.
224
225
  */
@@ -244,13 +245,22 @@ type ManifestSecretActions = true | string | string[] | {
244
245
  *
245
246
  * - `false` → no auto-included permissions
246
247
  * - `true` → standard tier (KV + SQL read/write + capabilities:read)
247
- * - `"admin"` → standard + SQL ddl
248
+ * - `"admin"` → standard + SQL schema
248
249
  * - `"all"` → everything the SDK supports (including DuckDB)
249
250
  *
250
251
  * Unknown string values silently fall back to `true`. Values are normalized
251
252
  * (lowercase + trim) before matching.
252
253
  */
253
254
  type ManifestDefaults = boolean | "admin" | "all";
255
+ /**
256
+ * Agent-readable app knowledge bundle pointer.
257
+ *
258
+ * - `true` means the default root: `knowledge/index.md`
259
+ * - string values must point at a markdown root under `knowledge/`
260
+ */
261
+ type ManifestKnowledge = true | string;
262
+ /** Default root used when `manifest.knowledge === true`. */
263
+ declare const DEFAULT_KNOWLEDGE_ROOT = "knowledge/index.md";
254
264
  /**
255
265
  * The raw manifest shape an app declares. See `.claude/specs/manifest.md`.
256
266
  */
@@ -286,6 +296,8 @@ interface Manifest {
286
296
  defaults?: ManifestDefaults | string;
287
297
  /** Whether to include the public-space companion delegation. Default `true`. */
288
298
  includePublicSpace?: boolean;
299
+ /** Agent-readable knowledge bundle root. `true` means `knowledge/index.md`. */
300
+ knowledge?: ManifestKnowledge;
289
301
  /**
290
302
  * Additional permissions beyond the defaults. Use for cross-space access,
291
303
  * DuckDB (opt-in), or `skipPrefix: true` entries.
@@ -404,6 +416,7 @@ declare const DEFAULT_MANIFEST_SPACE = "applications";
404
416
  declare const ACCOUNT_REGISTRY_SPACE = "account";
405
417
  /** Account-space KV prefix used for installed-application registry records. */
406
418
  declare const ACCOUNT_REGISTRY_PATH = "applications/";
419
+ declare const SECRETS_SPACE = "secrets";
407
420
  /** SDK-only permission service for encrypted vault resources. */
408
421
  declare const VAULT_PERMISSION_SERVICE = "tinycloud.vault";
409
422
  /**
@@ -493,6 +506,12 @@ declare function loadManifest(url: string): Promise<Manifest>;
493
506
  * Throws {@link ManifestValidationError} on any hard failure.
494
507
  */
495
508
  declare function validateManifest(input: unknown): Manifest;
509
+ /**
510
+ * Resolve a manifest knowledge pointer to its root markdown file.
511
+ *
512
+ * This is metadata only; app knowledge does not create capabilities.
513
+ */
514
+ declare function resolveManifestKnowledgeRoot(knowledge: Manifest["knowledge"] | undefined): string | undefined;
496
515
  /**
497
516
  * Normalize a `defaults` value: lowercase + trim, then match against known
498
517
  * tiers. Unknown string values silently fall back to `true` (standard).
@@ -959,6 +978,14 @@ declare const PersistedSessionDataSchema: z.ZodObject<{
959
978
  domain?: string | null | undefined;
960
979
  avatarUrl?: string | null | undefined;
961
980
  }>>;
981
+ /**
982
+ * TinyCloud hosts this session was created against. Persisted so a
983
+ * restored session resolves to the same node without re-running the
984
+ * registry/fallback resolution (or the wallet sign-in flow). Optional
985
+ * for backward compatibility with sessions persisted before this field
986
+ * existed — those restore and lazily re-resolve their hosts.
987
+ */
988
+ tinycloudHosts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
962
989
  }, "strip", z.ZodTypeAny, {
963
990
  chainId: number;
964
991
  address: string;
@@ -981,6 +1008,7 @@ declare const PersistedSessionDataSchema: z.ZodObject<{
981
1008
  verificationMethod: string;
982
1009
  spaces?: Record<string, string> | undefined;
983
1010
  } | undefined;
1011
+ tinycloudHosts?: string[] | undefined;
984
1012
  }, {
985
1013
  chainId: number;
986
1014
  address: string;
@@ -1003,6 +1031,7 @@ declare const PersistedSessionDataSchema: z.ZodObject<{
1003
1031
  verificationMethod: string;
1004
1032
  spaces?: Record<string, string> | undefined;
1005
1033
  } | undefined;
1034
+ tinycloudHosts?: string[] | undefined;
1006
1035
  }>;
1007
1036
  type PersistedSessionData = z.infer<typeof PersistedSessionDataSchema>;
1008
1037
  /**
@@ -2219,6 +2248,7 @@ declare const ShareLinkSchema: z.ZodObject<{
2219
2248
  /** Human-readable description of what is being shared */
2220
2249
  description: z.ZodOptional<z.ZodString>;
2221
2250
  }, "strip", z.ZodTypeAny, {
2251
+ schema: "base64" | "compact" | "ipfs";
2222
2252
  url: string;
2223
2253
  delegation: {
2224
2254
  path: string;
@@ -2235,10 +2265,10 @@ declare const ShareLinkSchema: z.ZodObject<{
2235
2265
  authHeader?: string | undefined;
2236
2266
  };
2237
2267
  token: string;
2238
- schema: "base64" | "compact" | "ipfs";
2239
2268
  description?: string | undefined;
2240
2269
  expiresAt?: Date | undefined;
2241
2270
  }, {
2271
+ schema: "base64" | "compact" | "ipfs";
2242
2272
  url: string;
2243
2273
  delegation: {
2244
2274
  path: string;
@@ -2255,7 +2285,6 @@ declare const ShareLinkSchema: z.ZodObject<{
2255
2285
  authHeader?: string | undefined;
2256
2286
  };
2257
2287
  token: string;
2258
- schema: "base64" | "compact" | "ipfs";
2259
2288
  description?: string | undefined;
2260
2289
  expiresAt?: Date | undefined;
2261
2290
  }>;
@@ -2312,17 +2341,17 @@ declare const GenerateShareParamsSchema: z.ZodObject<{
2312
2341
  baseUrl: z.ZodOptional<z.ZodString>;
2313
2342
  }, "strip", z.ZodTypeAny, {
2314
2343
  path: string;
2344
+ schema?: "base64" | "compact" | "ipfs" | undefined;
2315
2345
  expiry?: Date | undefined;
2316
2346
  description?: string | undefined;
2317
2347
  actions?: string[] | undefined;
2318
- schema?: "base64" | "compact" | "ipfs" | undefined;
2319
2348
  baseUrl?: string | undefined;
2320
2349
  }, {
2321
2350
  path: string;
2351
+ schema?: "base64" | "compact" | "ipfs" | undefined;
2322
2352
  expiry?: Date | undefined;
2323
2353
  description?: string | undefined;
2324
2354
  actions?: string[] | undefined;
2325
- schema?: "base64" | "compact" | "ipfs" | undefined;
2326
2355
  baseUrl?: string | undefined;
2327
2356
  }>;
2328
2357
  type GenerateShareParams = z.infer<typeof GenerateShareParamsSchema>;
@@ -2905,6 +2934,56 @@ interface SignResponse {
2905
2934
  * Callback handler type for sign requests.
2906
2935
  */
2907
2936
  type SignCallback = (request: SignRequest) => Promise<SignResponse>;
2937
+ interface OpenKeySigningStrategyOptions {
2938
+ /**
2939
+ * OpenKey signing endpoint URL.
2940
+ *
2941
+ * The SDK sends `POST endpoint` with JSON:
2942
+ * `{ address, chainId, message, type, keyId? }`.
2943
+ *
2944
+ * Expected successful response shape:
2945
+ * `{ signature: "0x..." }` or `{ approved: true, signature: "0x..." }`.
2946
+ *
2947
+ * Explicit-approval-needed response shape:
2948
+ * `{ approved: false, reason?: string }` or
2949
+ * `{ needsApproval: true, reason?: string, approvalUrl?: string }`.
2950
+ */
2951
+ endpoint: string;
2952
+ /** Optional OpenKey managed key id. */
2953
+ keyId?: string;
2954
+ /** Optional bearer token or async token supplier. */
2955
+ token?: string | (() => string | Promise<string | undefined>) | undefined;
2956
+ /** Extra headers to include on every request. */
2957
+ headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
2958
+ /** Fetch implementation. Defaults to `globalThis.fetch`. */
2959
+ fetch?: typeof fetch;
2960
+ /** Request credentials mode for browser integrations. */
2961
+ credentials?: "include" | "omit" | "same-origin";
2962
+ }
2963
+ interface OpenKeySigningRequestBody extends SignRequest {
2964
+ keyId?: string;
2965
+ }
2966
+ interface OpenKeySigningResponseBody {
2967
+ approved?: boolean;
2968
+ signature?: string;
2969
+ reason?: string;
2970
+ error?: string;
2971
+ needsApproval?: boolean;
2972
+ approvalUrl?: string;
2973
+ }
2974
+ interface OpenKeyCallbackStrategy extends CallbackStrategy {
2975
+ /** Marker used by SDK runtimes to choose the bootstrap-safe initial SIWE. */
2976
+ openKeyAutoSign: true;
2977
+ }
2978
+ /**
2979
+ * Create a callback signing strategy that delegates message signing to OpenKey.
2980
+ *
2981
+ * The helper deliberately returns the existing `CallbackStrategy` shape. When
2982
+ * OpenKey's policy gate says a request needs explicit approval, the callback
2983
+ * returns `{ approved: false, reason }`; `NodeUserAuthorization` then surfaces
2984
+ * that reason as the sign-in/signing error.
2985
+ */
2986
+ declare function createOpenKeyCallbackSigningStrategy(options: OpenKeySigningStrategyOptions): OpenKeyCallbackStrategy;
2908
2987
  /**
2909
2988
  * Auto-sign strategy: automatically signs all requests.
2910
2989
  *
@@ -4532,6 +4611,9 @@ interface AccountIndexRebuildResult {
4532
4611
  delegations: number;
4533
4612
  syncedAt: string;
4534
4613
  }
4614
+ interface AccountIndexEnsureResult {
4615
+ database: string;
4616
+ }
4535
4617
  interface AccountIndexedReadOptions {
4536
4618
  preferIndex?: boolean;
4537
4619
  refreshIndex?: boolean;
@@ -4579,6 +4661,7 @@ declare class AccountService {
4579
4661
  revoke: (options: AccountDelegationRevokeOptions) => Promise<Result$1<void>>;
4580
4662
  };
4581
4663
  readonly index: {
4664
+ ensure: () => Promise<Result$1<AccountIndexEnsureResult>>;
4582
4665
  rebuild: () => Promise<Result$1<AccountIndexRebuildResult>>;
4583
4666
  applications: {
4584
4667
  list: () => Promise<Result$1<AccountApplication[]>>;
@@ -4607,6 +4690,7 @@ declare class AccountService {
4607
4690
  private replaceApplicationsIndexQuietly;
4608
4691
  private replaceSpacesIndexQuietly;
4609
4692
  private replaceDelegationsIndexQuietly;
4693
+ private ensureAccountIndex;
4610
4694
  }
4611
4695
  interface AccountIndexStatus {
4612
4696
  database: string;
@@ -4837,4 +4921,4 @@ declare const EXPIRY: {
4837
4921
  declare const DEFAULT_SIGNED_READ_URL_EXPIRY_MS: number;
4838
4922
  type ExpiryTier = keyof typeof EXPIRY;
4839
4923
 
4840
- export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, type AbilitiesMap, type AccountApplication, type AccountApplicationListOptions, type AccountDelegation, type AccountDelegationListOptions, type AccountDelegationRevokeOptions, type AccountIndexRebuildResult, type AccountIndexStatus, type AccountIndexedReadOptions, AccountService, type AccountServiceConfig, type AccountSpace, type AccountSpaceListOptions, type AccountStatus, AutoApproveSpaceCreationHandler, type AutoRejectStrategy, type AutoSignStrategy, type Bytes, type CallbackStrategy, type CanonicalAddress, type CanonicalParsedNetworkId, type CapabilityEntry, CapabilityKeyRegistry, type CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, type ClientSession, ClientSessionSchema, CloudLocationResolutionError, type ComposeManifestOptions, type ComposedManifestRequest, type CreateDelegationFunction, type CreateDelegationParams, type CreateDelegationWasmParams, type CreateDelegationWasmResult, DEFAULT_DEFAULTS, DEFAULT_EXPIRY, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DEFAULT_TINYCLOUD_FALLBACK_HOST, DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL, type DelegatedResource, type Delegation, type DelegationApiResponse, type DelegationChain, type DelegationChainV2, type DelegationDirection, type DelegationError, type DelegationErrorCode, DelegationErrorCodes, type DelegationFilters, DelegationManager, type DelegationManagerConfig, type DelegationRecord, type Result as DelegationResult, type DidCacheKeyOptions, type DidEqualsOptions, ENCRYPTION_MANIFEST_SPACE, ENCRYPTION_PERMISSION_SERVICE, EXPIRY, type EncodedShareData, type EnsData, EnsDataSchema, type EventEmitterStrategy, type ExpiryTier, type Extension, type GenerateShareParams, type ICapabilityKeyRegistry, type IENSResolver, type INotificationHandler, type ISessionManager, type ISessionStorage, type ISharingService, type ISigner, type ISpace, type ISpaceCreationHandler, type ISpaceScopedDelegations, type ISpaceScopedSharing, type ISpaceService, type IUserAuthorization, type IWasmBindings, IdentityParseError, type IngestOptions, type JWK, type KeyInfo, type KeyProvider, type KeyType, type LocationCandidate, type LocationCandidateInput, type LocationRecord, type LocationRecordPayload, type LocationRecordSigner, LocationRecordValidationError, type LocationResolutionAttempt, type LocationSource, type Manifest, type ManifestDefaults, type ManifestRegistryRecord, type ManifestSecretActions, ManifestValidationError, type NodeInfo, type ParseRecapFromSiwe, type PartialSiweMessage, type PermissionEntry, PermissionNotInManifestError, type PersistedSessionData, type PersistedTinyCloudSession, type PkhDidParts, ProtocolMismatchError, type ReceiveOptions, type ResolveCloudLocationOptions, type ResolveTinyCloudHostsOptions, type ResolvedCapabilities, type ResolvedCloudLocation, type ResolvedDelegate, type ResolvedTinyCloudHosts, type ResourceCapability, SERVICE_LONG_TO_SHORT, SERVICE_SHORT_TO_LONG, type ServerHost, SessionExpiredError, type ShareAccess, type ShareLink, type ShareLinkData, type ShareSchema, SharingService, type SharingServiceConfig, type SignCallback, type SignInOptions, type SignRequest, type SignResponse, type SignStrategy, SilentNotificationHandler, type SiweConfig, SiweConfigSchema, Space, type SpaceAbilitiesMap, type SpaceConfig, type SpaceCreationContext, type SpaceDelegationParams, type SpaceErrorCode, SpaceErrorCodes, type SpaceHostResult, type SpaceInfo, type SpaceOwnership, SpaceService, type SpaceServiceConfig, type StoredDelegationChain, type SubsetCheckResult, TinyCloud, type TinyCloudConfig, type TinyCloudSession, UnsupportedFeatureError, type UserAuthorizationConfig, VAULT_PERMISSION_SERVICE, type ValidationError, VersionCheckError, type WasmRecapEntry, activateSessionWithHost, addressStorageKey, applyPrefix, buildSpaceUri, canonicalLocationPayload, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, checkNodeInfo, composeManifestRequest, createCapabilityKeyRegistry, createSharingService, createSpaceService, defaultSignStrategy, defaultSpaceCreationHandler, didCacheKey, didEquals, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, fetchLocationRecord, fetchPeerId, httpUrlToMultiaddr, isCapabilitySubset, isEvmAddress, loadManifest, locationPayloadForRecord, makePkhSpaceId, makePublicSpaceId, manifestAbilitiesUnion, multiaddrToHttpUrl, normalizeDefaults, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseRecapCapabilities, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveCloudLocation, resolveManifest, resolveTinyCloudHosts, resourceCapabilitiesToAbilitiesMap, resourceCapabilitiesToSpaceAbilitiesMap, signLocationRecord, submitHostDelegation, validateClientSession, validateLocationRecord, validateLocationRecordPayload, validateManifest, validatePersistedSessionData, verifyDidKeyEd25519Signature, verifyLocationRecord };
4924
+ export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, type AbilitiesMap, type AccountApplication, type AccountApplicationListOptions, type AccountDelegation, type AccountDelegationListOptions, type AccountDelegationRevokeOptions, type AccountIndexEnsureResult, type AccountIndexRebuildResult, type AccountIndexStatus, type AccountIndexedReadOptions, AccountService, type AccountServiceConfig, type AccountSpace, type AccountSpaceListOptions, type AccountStatus, AutoApproveSpaceCreationHandler, type AutoRejectStrategy, type AutoSignStrategy, type Bytes, type CallbackStrategy, type CanonicalAddress, type CanonicalParsedNetworkId, type CapabilityEntry, CapabilityKeyRegistry, type CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, type ClientSession, ClientSessionSchema, CloudLocationResolutionError, type ComposeManifestOptions, type ComposedManifestRequest, type CreateDelegationFunction, type CreateDelegationParams, type CreateDelegationWasmParams, type CreateDelegationWasmResult, DEFAULT_DEFAULTS, DEFAULT_EXPIRY, DEFAULT_KNOWLEDGE_ROOT, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DEFAULT_TINYCLOUD_FALLBACK_HOST, DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL, type DelegatedResource, type Delegation, type DelegationApiResponse, type DelegationChain, type DelegationChainV2, type DelegationDirection, type DelegationError, type DelegationErrorCode, DelegationErrorCodes, type DelegationFilters, DelegationManager, type DelegationManagerConfig, type DelegationRecord, type Result as DelegationResult, type DidCacheKeyOptions, type DidEqualsOptions, ENCRYPTION_MANIFEST_SPACE, ENCRYPTION_PERMISSION_SERVICE, EXPIRY, type EncodedShareData, type EnsData, EnsDataSchema, type EventEmitterStrategy, type ExpiryTier, type Extension, type GenerateShareParams, type ICapabilityKeyRegistry, type IENSResolver, type INotificationHandler, type ISessionManager, type ISessionStorage, type ISharingService, type ISigner, type ISpace, type ISpaceCreationHandler, type ISpaceScopedDelegations, type ISpaceScopedSharing, type ISpaceService, type IUserAuthorization, type IWasmBindings, IdentityParseError, type IngestOptions, type JWK, type KeyInfo, type KeyProvider, type KeyType, type LocationCandidate, type LocationCandidateInput, type LocationRecord, type LocationRecordPayload, type LocationRecordSigner, LocationRecordValidationError, type LocationResolutionAttempt, type LocationSource, type Manifest, type ManifestDefaults, type ManifestKnowledge, type ManifestRegistryRecord, type ManifestSecretActions, ManifestValidationError, type NodeInfo, type OpenKeyCallbackStrategy, type OpenKeySigningRequestBody, type OpenKeySigningResponseBody, type OpenKeySigningStrategyOptions, type ParseRecapFromSiwe, type PartialSiweMessage, type PermissionEntry, PermissionNotInManifestError, type PersistedSessionData, type PersistedTinyCloudSession, type PkhDidParts, ProtocolMismatchError, type ReceiveOptions, type ResolveCloudLocationOptions, type ResolveTinyCloudHostsOptions, type ResolvedCapabilities, type ResolvedCloudLocation, type ResolvedDelegate, type ResolvedTinyCloudHosts, type ResourceCapability, SECRETS_SPACE, SERVICE_LONG_TO_SHORT, SERVICE_SHORT_TO_LONG, type ServerHost, SessionExpiredError, type ShareAccess, type ShareLink, type ShareLinkData, type ShareSchema, SharingService, type SharingServiceConfig, type SignCallback, type SignInOptions, type SignRequest, type SignResponse, type SignStrategy, SilentNotificationHandler, type SiweConfig, SiweConfigSchema, Space, type SpaceAbilitiesMap, type SpaceConfig, type SpaceCreationContext, type SpaceDelegationParams, type SpaceErrorCode, SpaceErrorCodes, type SpaceHostResult, type SpaceInfo, type SpaceOwnership, SpaceService, type SpaceServiceConfig, type StoredDelegationChain, type SubsetCheckResult, TinyCloud, type TinyCloudConfig, type TinyCloudSession, UnsupportedFeatureError, type UserAuthorizationConfig, VAULT_PERMISSION_SERVICE, type ValidationError, VersionCheckError, type WasmRecapEntry, activateSessionWithHost, addressStorageKey, applyPrefix, buildSpaceUri, canonicalLocationPayload, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, checkNodeInfo, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, defaultSignStrategy, defaultSpaceCreationHandler, didCacheKey, didEquals, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, fetchLocationRecord, fetchPeerId, httpUrlToMultiaddr, isCapabilitySubset, isEvmAddress, loadManifest, locationPayloadForRecord, makePkhSpaceId, makePublicSpaceId, manifestAbilitiesUnion, multiaddrToHttpUrl, normalizeDefaults, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseRecapCapabilities, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveCloudLocation, resolveManifest, resolveManifestKnowledgeRoot, resolveTinyCloudHosts, resourceCapabilitiesToAbilitiesMap, resourceCapabilitiesToSpaceAbilitiesMap, signLocationRecord, submitHostDelegation, validateClientSession, validateLocationRecord, validateLocationRecordPayload, validateManifest, validatePersistedSessionData, verifyDidKeyEd25519Signature, verifyLocationRecord };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { InvokeFunction, InvokeAnyFunction, ParsedNetworkId, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, TelemetryConfig, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService, IEncryptionService, IDatabaseHandle, SqlValue, QueryResponse } from '@tinycloud/sdk-services';
3
- export { BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CanonicalDecryptRequest, CanonicalJson, ColumnInfo, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IEncryptionService, IHooksService, IKVService, IPrefixedKVService, ISQLService, ISecretsService, IService, IServiceContext, InlineEncryptedEnvelope, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, PrefixedKVService, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, ResolvedSecretPath, Result, RetryPolicy, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SignedReceiverKeyInput, SqlStatement, SqlValue, SubscribeOptions, TableInfo, TelemetryConfig, TelemetryEventHandler, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalHashHex, canonicalSignedResponse, canonicalizeEncryptionJson, canonicalizeSecretScope, checkDecryptInvocationInput, createVaultCrypto, decryptEnvelopeWithKey, defaultRetryPolicy, deriveSignedReceiverKey, discoverNetwork, encryptToNetwork, base64Decode as encryptionBase64Decode, base64Encode as encryptionBase64Encode, encryptionError, utf8Decode as encryptionUtf8Decode, utf8Encode as encryptionUtf8Encode, ensureNetworkUsableForDecrypt, err, generateRandomReceiverKey, hexDecode, hexEncode, isNetworkId, networkDiscoveryKey, ok, openWrappedKey, parseNetworkId, resolveSecretListPrefix, resolveSecretPath, serviceError, validateEnvelope, verifyDecryptResponse } from '@tinycloud/sdk-services';
3
+ export { BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CanonicalDecryptRequest, CanonicalJson, ColumnInfo, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IEncryptionService, IHooksService, IKVService, IPrefixedKVService, ISQLService, ISecretsService, IService, IServiceContext, InlineEncryptedEnvelope, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, PrefixedKVService, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, ResolvedSecretPath, Result, RetryPolicy, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SignedReceiverKeyInput, SqlStatement, SqlValue, SubscribeOptions, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalHashHex, canonicalSignedResponse, canonicalizeEncryptionJson, canonicalizeSecretScope, checkDecryptInvocationInput, clearTinyCloudDebugLogs, createVaultCrypto, decryptEnvelopeWithKey, defaultRetryPolicy, deriveSignedReceiverKey, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, base64Decode as encryptionBase64Decode, base64Encode as encryptionBase64Encode, encryptionError, utf8Decode as encryptionUtf8Decode, utf8Encode as encryptionUtf8Encode, ensureNetworkUsableForDecrypt, err, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isNetworkId, networkDiscoveryKey, ok, openWrappedKey, parseNetworkId, resolveSecretListPrefix, resolveSecretPath, serviceError, tinyCloudDebugLogger, validateEnvelope, verifyDecryptResponse } from '@tinycloud/sdk-services';
4
+ export { ACCOUNT_INDEX_SCHEMA, BOOTSTRAP_ALLOWLIST, BOOTSTRAP_DEFAULT_SPACE, BOOTSTRAP_ENCRYPTION_NETWORK_NAME, BOOTSTRAP_ENCRYPTION_NETWORK_RESOURCE_TEMPLATE, BOOTSTRAP_MANIFEST, BOOTSTRAP_PERSISTED_APPLICATION_MANIFESTS, BOOTSTRAP_PUBLIC_SPACE, BOOTSTRAP_SESSION_REQUESTS, BOOTSTRAP_SPACE_MANIFESTS, BOOTSTRAP_SPACE_NAMES, BootstrapAllowlistEntry, BootstrapAllowlistKind, BootstrapEncryptionNetworkStep, BootstrapManifest, BootstrapRawAbilityAllowlistEntry, BootstrapSchemaStep, BootstrapSeedApplicationsStep, BootstrapSeedSpacesStep, BootstrapSpaceDescriptor, BootstrapSpaceName, BootstrapSpaceStep, BootstrapStep, BootstrapStepKind, SECRET_RECORDS_SCHEMA, TINYCLOUD_ACCOUNT_SPACE_MANIFEST, TINYCLOUD_APPLICATIONS_SPACE_MANIFEST, TINYCLOUD_DEFAULT_SPACE_MANIFEST, TINYCLOUD_PUBLIC_SPACE_MANIFEST, TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST, bootstrapEncryptionNetworkId, bootstrapSpaceId, bootstrapSteps, composeBootstrapSpaceManifest } from '@tinycloud/bootstrap';
4
5
  export { SiweMessage } from 'siwe';
5
6
 
6
7
  /**
@@ -218,7 +219,7 @@ interface PermissionEntry {
218
219
  */
219
220
  path: string;
220
221
  /**
221
- * Short action names (e.g. "get", "put", "read", "ddl"). The SDK expands
222
+ * Short action names (e.g. "get", "put", "read", "schema"). The SDK expands
222
223
  * these to full URNs (e.g. `tinycloud.kv/get`) during resolution.
223
224
  * Already-expanded URNs are passed through unchanged.
224
225
  */
@@ -244,13 +245,22 @@ type ManifestSecretActions = true | string | string[] | {
244
245
  *
245
246
  * - `false` → no auto-included permissions
246
247
  * - `true` → standard tier (KV + SQL read/write + capabilities:read)
247
- * - `"admin"` → standard + SQL ddl
248
+ * - `"admin"` → standard + SQL schema
248
249
  * - `"all"` → everything the SDK supports (including DuckDB)
249
250
  *
250
251
  * Unknown string values silently fall back to `true`. Values are normalized
251
252
  * (lowercase + trim) before matching.
252
253
  */
253
254
  type ManifestDefaults = boolean | "admin" | "all";
255
+ /**
256
+ * Agent-readable app knowledge bundle pointer.
257
+ *
258
+ * - `true` means the default root: `knowledge/index.md`
259
+ * - string values must point at a markdown root under `knowledge/`
260
+ */
261
+ type ManifestKnowledge = true | string;
262
+ /** Default root used when `manifest.knowledge === true`. */
263
+ declare const DEFAULT_KNOWLEDGE_ROOT = "knowledge/index.md";
254
264
  /**
255
265
  * The raw manifest shape an app declares. See `.claude/specs/manifest.md`.
256
266
  */
@@ -286,6 +296,8 @@ interface Manifest {
286
296
  defaults?: ManifestDefaults | string;
287
297
  /** Whether to include the public-space companion delegation. Default `true`. */
288
298
  includePublicSpace?: boolean;
299
+ /** Agent-readable knowledge bundle root. `true` means `knowledge/index.md`. */
300
+ knowledge?: ManifestKnowledge;
289
301
  /**
290
302
  * Additional permissions beyond the defaults. Use for cross-space access,
291
303
  * DuckDB (opt-in), or `skipPrefix: true` entries.
@@ -404,6 +416,7 @@ declare const DEFAULT_MANIFEST_SPACE = "applications";
404
416
  declare const ACCOUNT_REGISTRY_SPACE = "account";
405
417
  /** Account-space KV prefix used for installed-application registry records. */
406
418
  declare const ACCOUNT_REGISTRY_PATH = "applications/";
419
+ declare const SECRETS_SPACE = "secrets";
407
420
  /** SDK-only permission service for encrypted vault resources. */
408
421
  declare const VAULT_PERMISSION_SERVICE = "tinycloud.vault";
409
422
  /**
@@ -493,6 +506,12 @@ declare function loadManifest(url: string): Promise<Manifest>;
493
506
  * Throws {@link ManifestValidationError} on any hard failure.
494
507
  */
495
508
  declare function validateManifest(input: unknown): Manifest;
509
+ /**
510
+ * Resolve a manifest knowledge pointer to its root markdown file.
511
+ *
512
+ * This is metadata only; app knowledge does not create capabilities.
513
+ */
514
+ declare function resolveManifestKnowledgeRoot(knowledge: Manifest["knowledge"] | undefined): string | undefined;
496
515
  /**
497
516
  * Normalize a `defaults` value: lowercase + trim, then match against known
498
517
  * tiers. Unknown string values silently fall back to `true` (standard).
@@ -959,6 +978,14 @@ declare const PersistedSessionDataSchema: z.ZodObject<{
959
978
  domain?: string | null | undefined;
960
979
  avatarUrl?: string | null | undefined;
961
980
  }>>;
981
+ /**
982
+ * TinyCloud hosts this session was created against. Persisted so a
983
+ * restored session resolves to the same node without re-running the
984
+ * registry/fallback resolution (or the wallet sign-in flow). Optional
985
+ * for backward compatibility with sessions persisted before this field
986
+ * existed — those restore and lazily re-resolve their hosts.
987
+ */
988
+ tinycloudHosts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
962
989
  }, "strip", z.ZodTypeAny, {
963
990
  chainId: number;
964
991
  address: string;
@@ -981,6 +1008,7 @@ declare const PersistedSessionDataSchema: z.ZodObject<{
981
1008
  verificationMethod: string;
982
1009
  spaces?: Record<string, string> | undefined;
983
1010
  } | undefined;
1011
+ tinycloudHosts?: string[] | undefined;
984
1012
  }, {
985
1013
  chainId: number;
986
1014
  address: string;
@@ -1003,6 +1031,7 @@ declare const PersistedSessionDataSchema: z.ZodObject<{
1003
1031
  verificationMethod: string;
1004
1032
  spaces?: Record<string, string> | undefined;
1005
1033
  } | undefined;
1034
+ tinycloudHosts?: string[] | undefined;
1006
1035
  }>;
1007
1036
  type PersistedSessionData = z.infer<typeof PersistedSessionDataSchema>;
1008
1037
  /**
@@ -2219,6 +2248,7 @@ declare const ShareLinkSchema: z.ZodObject<{
2219
2248
  /** Human-readable description of what is being shared */
2220
2249
  description: z.ZodOptional<z.ZodString>;
2221
2250
  }, "strip", z.ZodTypeAny, {
2251
+ schema: "base64" | "compact" | "ipfs";
2222
2252
  url: string;
2223
2253
  delegation: {
2224
2254
  path: string;
@@ -2235,10 +2265,10 @@ declare const ShareLinkSchema: z.ZodObject<{
2235
2265
  authHeader?: string | undefined;
2236
2266
  };
2237
2267
  token: string;
2238
- schema: "base64" | "compact" | "ipfs";
2239
2268
  description?: string | undefined;
2240
2269
  expiresAt?: Date | undefined;
2241
2270
  }, {
2271
+ schema: "base64" | "compact" | "ipfs";
2242
2272
  url: string;
2243
2273
  delegation: {
2244
2274
  path: string;
@@ -2255,7 +2285,6 @@ declare const ShareLinkSchema: z.ZodObject<{
2255
2285
  authHeader?: string | undefined;
2256
2286
  };
2257
2287
  token: string;
2258
- schema: "base64" | "compact" | "ipfs";
2259
2288
  description?: string | undefined;
2260
2289
  expiresAt?: Date | undefined;
2261
2290
  }>;
@@ -2312,17 +2341,17 @@ declare const GenerateShareParamsSchema: z.ZodObject<{
2312
2341
  baseUrl: z.ZodOptional<z.ZodString>;
2313
2342
  }, "strip", z.ZodTypeAny, {
2314
2343
  path: string;
2344
+ schema?: "base64" | "compact" | "ipfs" | undefined;
2315
2345
  expiry?: Date | undefined;
2316
2346
  description?: string | undefined;
2317
2347
  actions?: string[] | undefined;
2318
- schema?: "base64" | "compact" | "ipfs" | undefined;
2319
2348
  baseUrl?: string | undefined;
2320
2349
  }, {
2321
2350
  path: string;
2351
+ schema?: "base64" | "compact" | "ipfs" | undefined;
2322
2352
  expiry?: Date | undefined;
2323
2353
  description?: string | undefined;
2324
2354
  actions?: string[] | undefined;
2325
- schema?: "base64" | "compact" | "ipfs" | undefined;
2326
2355
  baseUrl?: string | undefined;
2327
2356
  }>;
2328
2357
  type GenerateShareParams = z.infer<typeof GenerateShareParamsSchema>;
@@ -2905,6 +2934,56 @@ interface SignResponse {
2905
2934
  * Callback handler type for sign requests.
2906
2935
  */
2907
2936
  type SignCallback = (request: SignRequest) => Promise<SignResponse>;
2937
+ interface OpenKeySigningStrategyOptions {
2938
+ /**
2939
+ * OpenKey signing endpoint URL.
2940
+ *
2941
+ * The SDK sends `POST endpoint` with JSON:
2942
+ * `{ address, chainId, message, type, keyId? }`.
2943
+ *
2944
+ * Expected successful response shape:
2945
+ * `{ signature: "0x..." }` or `{ approved: true, signature: "0x..." }`.
2946
+ *
2947
+ * Explicit-approval-needed response shape:
2948
+ * `{ approved: false, reason?: string }` or
2949
+ * `{ needsApproval: true, reason?: string, approvalUrl?: string }`.
2950
+ */
2951
+ endpoint: string;
2952
+ /** Optional OpenKey managed key id. */
2953
+ keyId?: string;
2954
+ /** Optional bearer token or async token supplier. */
2955
+ token?: string | (() => string | Promise<string | undefined>) | undefined;
2956
+ /** Extra headers to include on every request. */
2957
+ headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
2958
+ /** Fetch implementation. Defaults to `globalThis.fetch`. */
2959
+ fetch?: typeof fetch;
2960
+ /** Request credentials mode for browser integrations. */
2961
+ credentials?: "include" | "omit" | "same-origin";
2962
+ }
2963
+ interface OpenKeySigningRequestBody extends SignRequest {
2964
+ keyId?: string;
2965
+ }
2966
+ interface OpenKeySigningResponseBody {
2967
+ approved?: boolean;
2968
+ signature?: string;
2969
+ reason?: string;
2970
+ error?: string;
2971
+ needsApproval?: boolean;
2972
+ approvalUrl?: string;
2973
+ }
2974
+ interface OpenKeyCallbackStrategy extends CallbackStrategy {
2975
+ /** Marker used by SDK runtimes to choose the bootstrap-safe initial SIWE. */
2976
+ openKeyAutoSign: true;
2977
+ }
2978
+ /**
2979
+ * Create a callback signing strategy that delegates message signing to OpenKey.
2980
+ *
2981
+ * The helper deliberately returns the existing `CallbackStrategy` shape. When
2982
+ * OpenKey's policy gate says a request needs explicit approval, the callback
2983
+ * returns `{ approved: false, reason }`; `NodeUserAuthorization` then surfaces
2984
+ * that reason as the sign-in/signing error.
2985
+ */
2986
+ declare function createOpenKeyCallbackSigningStrategy(options: OpenKeySigningStrategyOptions): OpenKeyCallbackStrategy;
2908
2987
  /**
2909
2988
  * Auto-sign strategy: automatically signs all requests.
2910
2989
  *
@@ -4532,6 +4611,9 @@ interface AccountIndexRebuildResult {
4532
4611
  delegations: number;
4533
4612
  syncedAt: string;
4534
4613
  }
4614
+ interface AccountIndexEnsureResult {
4615
+ database: string;
4616
+ }
4535
4617
  interface AccountIndexedReadOptions {
4536
4618
  preferIndex?: boolean;
4537
4619
  refreshIndex?: boolean;
@@ -4579,6 +4661,7 @@ declare class AccountService {
4579
4661
  revoke: (options: AccountDelegationRevokeOptions) => Promise<Result$1<void>>;
4580
4662
  };
4581
4663
  readonly index: {
4664
+ ensure: () => Promise<Result$1<AccountIndexEnsureResult>>;
4582
4665
  rebuild: () => Promise<Result$1<AccountIndexRebuildResult>>;
4583
4666
  applications: {
4584
4667
  list: () => Promise<Result$1<AccountApplication[]>>;
@@ -4607,6 +4690,7 @@ declare class AccountService {
4607
4690
  private replaceApplicationsIndexQuietly;
4608
4691
  private replaceSpacesIndexQuietly;
4609
4692
  private replaceDelegationsIndexQuietly;
4693
+ private ensureAccountIndex;
4610
4694
  }
4611
4695
  interface AccountIndexStatus {
4612
4696
  database: string;
@@ -4837,4 +4921,4 @@ declare const EXPIRY: {
4837
4921
  declare const DEFAULT_SIGNED_READ_URL_EXPIRY_MS: number;
4838
4922
  type ExpiryTier = keyof typeof EXPIRY;
4839
4923
 
4840
- export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, type AbilitiesMap, type AccountApplication, type AccountApplicationListOptions, type AccountDelegation, type AccountDelegationListOptions, type AccountDelegationRevokeOptions, type AccountIndexRebuildResult, type AccountIndexStatus, type AccountIndexedReadOptions, AccountService, type AccountServiceConfig, type AccountSpace, type AccountSpaceListOptions, type AccountStatus, AutoApproveSpaceCreationHandler, type AutoRejectStrategy, type AutoSignStrategy, type Bytes, type CallbackStrategy, type CanonicalAddress, type CanonicalParsedNetworkId, type CapabilityEntry, CapabilityKeyRegistry, type CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, type ClientSession, ClientSessionSchema, CloudLocationResolutionError, type ComposeManifestOptions, type ComposedManifestRequest, type CreateDelegationFunction, type CreateDelegationParams, type CreateDelegationWasmParams, type CreateDelegationWasmResult, DEFAULT_DEFAULTS, DEFAULT_EXPIRY, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DEFAULT_TINYCLOUD_FALLBACK_HOST, DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL, type DelegatedResource, type Delegation, type DelegationApiResponse, type DelegationChain, type DelegationChainV2, type DelegationDirection, type DelegationError, type DelegationErrorCode, DelegationErrorCodes, type DelegationFilters, DelegationManager, type DelegationManagerConfig, type DelegationRecord, type Result as DelegationResult, type DidCacheKeyOptions, type DidEqualsOptions, ENCRYPTION_MANIFEST_SPACE, ENCRYPTION_PERMISSION_SERVICE, EXPIRY, type EncodedShareData, type EnsData, EnsDataSchema, type EventEmitterStrategy, type ExpiryTier, type Extension, type GenerateShareParams, type ICapabilityKeyRegistry, type IENSResolver, type INotificationHandler, type ISessionManager, type ISessionStorage, type ISharingService, type ISigner, type ISpace, type ISpaceCreationHandler, type ISpaceScopedDelegations, type ISpaceScopedSharing, type ISpaceService, type IUserAuthorization, type IWasmBindings, IdentityParseError, type IngestOptions, type JWK, type KeyInfo, type KeyProvider, type KeyType, type LocationCandidate, type LocationCandidateInput, type LocationRecord, type LocationRecordPayload, type LocationRecordSigner, LocationRecordValidationError, type LocationResolutionAttempt, type LocationSource, type Manifest, type ManifestDefaults, type ManifestRegistryRecord, type ManifestSecretActions, ManifestValidationError, type NodeInfo, type ParseRecapFromSiwe, type PartialSiweMessage, type PermissionEntry, PermissionNotInManifestError, type PersistedSessionData, type PersistedTinyCloudSession, type PkhDidParts, ProtocolMismatchError, type ReceiveOptions, type ResolveCloudLocationOptions, type ResolveTinyCloudHostsOptions, type ResolvedCapabilities, type ResolvedCloudLocation, type ResolvedDelegate, type ResolvedTinyCloudHosts, type ResourceCapability, SERVICE_LONG_TO_SHORT, SERVICE_SHORT_TO_LONG, type ServerHost, SessionExpiredError, type ShareAccess, type ShareLink, type ShareLinkData, type ShareSchema, SharingService, type SharingServiceConfig, type SignCallback, type SignInOptions, type SignRequest, type SignResponse, type SignStrategy, SilentNotificationHandler, type SiweConfig, SiweConfigSchema, Space, type SpaceAbilitiesMap, type SpaceConfig, type SpaceCreationContext, type SpaceDelegationParams, type SpaceErrorCode, SpaceErrorCodes, type SpaceHostResult, type SpaceInfo, type SpaceOwnership, SpaceService, type SpaceServiceConfig, type StoredDelegationChain, type SubsetCheckResult, TinyCloud, type TinyCloudConfig, type TinyCloudSession, UnsupportedFeatureError, type UserAuthorizationConfig, VAULT_PERMISSION_SERVICE, type ValidationError, VersionCheckError, type WasmRecapEntry, activateSessionWithHost, addressStorageKey, applyPrefix, buildSpaceUri, canonicalLocationPayload, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, checkNodeInfo, composeManifestRequest, createCapabilityKeyRegistry, createSharingService, createSpaceService, defaultSignStrategy, defaultSpaceCreationHandler, didCacheKey, didEquals, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, fetchLocationRecord, fetchPeerId, httpUrlToMultiaddr, isCapabilitySubset, isEvmAddress, loadManifest, locationPayloadForRecord, makePkhSpaceId, makePublicSpaceId, manifestAbilitiesUnion, multiaddrToHttpUrl, normalizeDefaults, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseRecapCapabilities, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveCloudLocation, resolveManifest, resolveTinyCloudHosts, resourceCapabilitiesToAbilitiesMap, resourceCapabilitiesToSpaceAbilitiesMap, signLocationRecord, submitHostDelegation, validateClientSession, validateLocationRecord, validateLocationRecordPayload, validateManifest, validatePersistedSessionData, verifyDidKeyEd25519Signature, verifyLocationRecord };
4924
+ export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, type AbilitiesMap, type AccountApplication, type AccountApplicationListOptions, type AccountDelegation, type AccountDelegationListOptions, type AccountDelegationRevokeOptions, type AccountIndexEnsureResult, type AccountIndexRebuildResult, type AccountIndexStatus, type AccountIndexedReadOptions, AccountService, type AccountServiceConfig, type AccountSpace, type AccountSpaceListOptions, type AccountStatus, AutoApproveSpaceCreationHandler, type AutoRejectStrategy, type AutoSignStrategy, type Bytes, type CallbackStrategy, type CanonicalAddress, type CanonicalParsedNetworkId, type CapabilityEntry, CapabilityKeyRegistry, type CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, type ClientSession, ClientSessionSchema, CloudLocationResolutionError, type ComposeManifestOptions, type ComposedManifestRequest, type CreateDelegationFunction, type CreateDelegationParams, type CreateDelegationWasmParams, type CreateDelegationWasmResult, DEFAULT_DEFAULTS, DEFAULT_EXPIRY, DEFAULT_KNOWLEDGE_ROOT, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DEFAULT_TINYCLOUD_FALLBACK_HOST, DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL, type DelegatedResource, type Delegation, type DelegationApiResponse, type DelegationChain, type DelegationChainV2, type DelegationDirection, type DelegationError, type DelegationErrorCode, DelegationErrorCodes, type DelegationFilters, DelegationManager, type DelegationManagerConfig, type DelegationRecord, type Result as DelegationResult, type DidCacheKeyOptions, type DidEqualsOptions, ENCRYPTION_MANIFEST_SPACE, ENCRYPTION_PERMISSION_SERVICE, EXPIRY, type EncodedShareData, type EnsData, EnsDataSchema, type EventEmitterStrategy, type ExpiryTier, type Extension, type GenerateShareParams, type ICapabilityKeyRegistry, type IENSResolver, type INotificationHandler, type ISessionManager, type ISessionStorage, type ISharingService, type ISigner, type ISpace, type ISpaceCreationHandler, type ISpaceScopedDelegations, type ISpaceScopedSharing, type ISpaceService, type IUserAuthorization, type IWasmBindings, IdentityParseError, type IngestOptions, type JWK, type KeyInfo, type KeyProvider, type KeyType, type LocationCandidate, type LocationCandidateInput, type LocationRecord, type LocationRecordPayload, type LocationRecordSigner, LocationRecordValidationError, type LocationResolutionAttempt, type LocationSource, type Manifest, type ManifestDefaults, type ManifestKnowledge, type ManifestRegistryRecord, type ManifestSecretActions, ManifestValidationError, type NodeInfo, type OpenKeyCallbackStrategy, type OpenKeySigningRequestBody, type OpenKeySigningResponseBody, type OpenKeySigningStrategyOptions, type ParseRecapFromSiwe, type PartialSiweMessage, type PermissionEntry, PermissionNotInManifestError, type PersistedSessionData, type PersistedTinyCloudSession, type PkhDidParts, ProtocolMismatchError, type ReceiveOptions, type ResolveCloudLocationOptions, type ResolveTinyCloudHostsOptions, type ResolvedCapabilities, type ResolvedCloudLocation, type ResolvedDelegate, type ResolvedTinyCloudHosts, type ResourceCapability, SECRETS_SPACE, SERVICE_LONG_TO_SHORT, SERVICE_SHORT_TO_LONG, type ServerHost, SessionExpiredError, type ShareAccess, type ShareLink, type ShareLinkData, type ShareSchema, SharingService, type SharingServiceConfig, type SignCallback, type SignInOptions, type SignRequest, type SignResponse, type SignStrategy, SilentNotificationHandler, type SiweConfig, SiweConfigSchema, Space, type SpaceAbilitiesMap, type SpaceConfig, type SpaceCreationContext, type SpaceDelegationParams, type SpaceErrorCode, SpaceErrorCodes, type SpaceHostResult, type SpaceInfo, type SpaceOwnership, SpaceService, type SpaceServiceConfig, type StoredDelegationChain, type SubsetCheckResult, TinyCloud, type TinyCloudConfig, type TinyCloudSession, UnsupportedFeatureError, type UserAuthorizationConfig, VAULT_PERMISSION_SERVICE, type ValidationError, VersionCheckError, type WasmRecapEntry, activateSessionWithHost, addressStorageKey, applyPrefix, buildSpaceUri, canonicalLocationPayload, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, checkNodeInfo, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, defaultSignStrategy, defaultSpaceCreationHandler, didCacheKey, didEquals, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, fetchLocationRecord, fetchPeerId, httpUrlToMultiaddr, isCapabilitySubset, isEvmAddress, loadManifest, locationPayloadForRecord, makePkhSpaceId, makePublicSpaceId, manifestAbilitiesUnion, multiaddrToHttpUrl, normalizeDefaults, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseRecapCapabilities, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveCloudLocation, resolveManifest, resolveManifestKnowledgeRoot, resolveTinyCloudHosts, resourceCapabilitiesToAbilitiesMap, resourceCapabilitiesToSpaceAbilitiesMap, signLocationRecord, submitHostDelegation, validateClientSession, validateLocationRecord, validateLocationRecordPayload, validateManifest, validatePersistedSessionData, verifyDidKeyEd25519Signature, verifyLocationRecord };