@tinycloud/sdk-core 2.4.0-beta.9 → 2.5.0-beta.1

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.js CHANGED
@@ -188,7 +188,15 @@ var PersistedSessionDataSchema = z2.object({
188
188
  /** Schema version for migrations */
189
189
  version: z2.string(),
190
190
  /** Optional ENS data */
191
- ens: EnsDataSchema2.optional()
191
+ ens: EnsDataSchema2.optional(),
192
+ /**
193
+ * TinyCloud hosts this session was created against. Persisted so a
194
+ * restored session resolves to the same node without re-running the
195
+ * registry/fallback resolution (or the wallet sign-in flow). Optional
196
+ * for backward compatibility with sessions persisted before this field
197
+ * existed — those restore and lazily re-resolve their hosts.
198
+ */
199
+ tinycloudHosts: z2.array(z2.string()).optional()
192
200
  });
193
201
  var TinyCloudSessionSchema = z2.object({
194
202
  /** User's Ethereum address */
@@ -249,6 +257,15 @@ import {
249
257
  import { ok, err, serviceError } from "@tinycloud/sdk-services";
250
258
 
251
259
  // src/spaces/Space.ts
260
+ function unavailableSecretsService() {
261
+ return new Proxy({}, {
262
+ get: () => {
263
+ throw new Error(
264
+ "Secrets service factory not configured. Provide createSecrets in SpaceConfig."
265
+ );
266
+ }
267
+ });
268
+ }
252
269
  var Space = class {
253
270
  /**
254
271
  * Create a new Space instance.
@@ -260,6 +277,7 @@ var Space = class {
260
277
  this._name = config.name;
261
278
  this._kv = config.createKV(config.id);
262
279
  this._vault = config.createVault(config.id);
280
+ this._secrets = config.createSecrets?.(config.id) ?? unavailableSecretsService();
263
281
  this._delegations = config.createDelegations(config.id);
264
282
  this._sharing = config.createSharing(config.id);
265
283
  this._getInfo = config.getInfo;
@@ -288,6 +306,12 @@ var Space = class {
288
306
  get vault() {
289
307
  return this._vault;
290
308
  }
309
+ /**
310
+ * Secrets operations scoped to this space.
311
+ */
312
+ get secrets() {
313
+ return this._secrets;
314
+ }
291
315
  /**
292
316
  * Delegation operations scoped to this space.
293
317
  */
@@ -673,6 +697,8 @@ var SpaceConfigSchema = z4.object({
673
697
  createKV: z4.function(),
674
698
  /** Factory function to create a space-scoped Data Vault service */
675
699
  createVault: z4.function(),
700
+ /** Optional factory function to create a space-scoped secrets service */
701
+ createSecrets: z4.function().optional(),
676
702
  /** Factory function to create space-scoped delegations */
677
703
  createDelegations: z4.function(),
678
704
  /** Factory function to create space-scoped sharing */
@@ -695,6 +721,8 @@ var SpaceServiceConfigSchema = z4.object({
695
721
  createKVService: z4.function().optional(),
696
722
  /** Factory function to create a space-scoped Data Vault service */
697
723
  createVaultService: z4.function().optional(),
724
+ /** Factory function to create a space-scoped secrets service */
725
+ createSecretsService: z4.function().optional(),
698
726
  /** User's PKH DID (derived from address or provided explicitly) */
699
727
  userDid: z4.string().optional(),
700
728
  /** Optional SharingService for v2 sharing links (client-side) */
@@ -967,6 +995,7 @@ var SpaceService = class {
967
995
  this.capabilityRegistry = config.capabilityRegistry;
968
996
  this.createKVServiceFn = config.createKVService;
969
997
  this.createVaultServiceFn = config.createVaultService;
998
+ this.createSecretsServiceFn = config.createSecretsService;
970
999
  this._userDid = config.userDid;
971
1000
  this.sharingService = config.sharingService;
972
1001
  this.createDelegationFn = config.createDelegation;
@@ -983,6 +1012,7 @@ var SpaceService = class {
983
1012
  if (config.capabilityRegistry) this.capabilityRegistry = config.capabilityRegistry;
984
1013
  if (config.createKVService) this.createKVServiceFn = config.createKVService;
985
1014
  if (config.createVaultService) this.createVaultServiceFn = config.createVaultService;
1015
+ if (config.createSecretsService) this.createSecretsServiceFn = config.createSecretsService;
986
1016
  if (config.userDid !== void 0) this._userDid = config.userDid;
987
1017
  if (config.sharingService) this.sharingService = config.sharingService;
988
1018
  if (config.createDelegation) this.createDelegationFn = config.createDelegation;
@@ -1276,6 +1306,7 @@ var SpaceService = class {
1276
1306
  name,
1277
1307
  createKV: this.createSpaceScopedKV.bind(this),
1278
1308
  createVault: this.createSpaceScopedVault.bind(this),
1309
+ createSecrets: this.createSpaceScopedSecrets.bind(this),
1279
1310
  createDelegations: this.createSpaceScopedDelegations.bind(this),
1280
1311
  createSharing: this.createSpaceScopedSharing.bind(this),
1281
1312
  getInfo: this.getSpaceInfo.bind(this)
@@ -1420,6 +1451,21 @@ var SpaceService = class {
1420
1451
  }
1421
1452
  });
1422
1453
  }
1454
+ /**
1455
+ * Create a space-scoped secrets service.
1456
+ */
1457
+ createSpaceScopedSecrets(spaceId) {
1458
+ if (this.createSecretsServiceFn) {
1459
+ return this.createSecretsServiceFn(spaceId);
1460
+ }
1461
+ return new Proxy({}, {
1462
+ get: () => {
1463
+ throw new Error(
1464
+ "Secrets service factory not configured. Provide createSecretsService in SpaceServiceConfig."
1465
+ );
1466
+ }
1467
+ });
1468
+ }
1423
1469
  /**
1424
1470
  * Create space-scoped delegation operations.
1425
1471
  */
@@ -2172,6 +2218,7 @@ import {
2172
2218
  // src/manifest.ts
2173
2219
  import ms from "ms";
2174
2220
  import { resolveSecretPath, SECRET_NAME_RE } from "@tinycloud/sdk-services";
2221
+ var DEFAULT_KNOWLEDGE_ROOT = "knowledge/index.md";
2175
2222
  var ManifestValidationError = class extends Error {
2176
2223
  constructor(message) {
2177
2224
  super(`Manifest validation failed: ${message}`);
@@ -2226,7 +2273,7 @@ var DEFAULT_ADMIN_ENTRIES = [
2226
2273
  service: "tinycloud.sql",
2227
2274
  space: DEFAULT_MANIFEST_SPACE,
2228
2275
  path: "/",
2229
- actions: ["read", "write", "ddl"]
2276
+ actions: ["read", "write", "schema"]
2230
2277
  }
2231
2278
  ];
2232
2279
  var DEFAULT_ALL_ENTRIES = [
@@ -2240,7 +2287,7 @@ var DEFAULT_ALL_ENTRIES = [
2240
2287
  service: "tinycloud.sql",
2241
2288
  space: DEFAULT_MANIFEST_SPACE,
2242
2289
  path: "/",
2243
- actions: ["read", "write", "ddl"]
2290
+ actions: ["read", "write", "schema"]
2244
2291
  },
2245
2292
  {
2246
2293
  service: "tinycloud.duckdb",
@@ -2398,6 +2445,9 @@ function validateManifest(input) {
2398
2445
  if (m.expiry !== void 0) {
2399
2446
  parseExpiry(m.expiry);
2400
2447
  }
2448
+ if (m.knowledge !== void 0) {
2449
+ resolveManifestKnowledgeRoot(m.knowledge);
2450
+ }
2401
2451
  if (m.permissions !== void 0) {
2402
2452
  if (!Array.isArray(m.permissions)) {
2403
2453
  throw new ManifestValidationError(
@@ -2413,6 +2463,25 @@ function validateManifest(input) {
2413
2463
  }
2414
2464
  return m;
2415
2465
  }
2466
+ function resolveManifestKnowledgeRoot(knowledge) {
2467
+ if (knowledge === void 0) {
2468
+ return void 0;
2469
+ }
2470
+ if (knowledge === true) {
2471
+ return DEFAULT_KNOWLEDGE_ROOT;
2472
+ }
2473
+ if (typeof knowledge !== "string" || knowledge.length === 0) {
2474
+ throw new ManifestValidationError(
2475
+ "manifest.knowledge must be true or a knowledge/*.md root path"
2476
+ );
2477
+ }
2478
+ if (!/^knowledge\/.+\.md$/.test(knowledge)) {
2479
+ throw new ManifestValidationError(
2480
+ "manifest.knowledge must be true or a knowledge/*.md root path"
2481
+ );
2482
+ }
2483
+ return knowledge;
2484
+ }
2416
2485
  function validateManifestSecrets(secrets) {
2417
2486
  if (secrets === null || typeof secrets !== "object" || Array.isArray(secrets)) {
2418
2487
  throw new ManifestValidationError("manifest.secrets must be an object");
@@ -2812,7 +2881,7 @@ function accountRegistryIndexPermission() {
2812
2881
  service: "tinycloud.sql",
2813
2882
  space: ACCOUNT_REGISTRY_SPACE,
2814
2883
  path: "account",
2815
- actions: ["tinycloud.sql/read", "tinycloud.sql/write", "tinycloud.sql/ddl"]
2884
+ actions: ["tinycloud.sql/read", "tinycloud.sql/write", "tinycloud.sql/schema"]
2816
2885
  };
2817
2886
  }
2818
2887
  function composeManifestRequest(inputs, options = {}) {
@@ -2917,8 +2986,10 @@ function manifestAbilitiesUnion(resolved) {
2917
2986
  }
2918
2987
 
2919
2988
  // src/account/AccountService.ts
2989
+ import { ACCOUNT_INDEX_SCHEMA } from "@tinycloud/bootstrap";
2920
2990
  var SERVICE_NAME2 = "account";
2921
2991
  var ACCOUNT_INDEX_DB = "account";
2992
+ var ACCOUNT_INDEX_NAMESPACE = "tinycloud.account.index";
2922
2993
  var ACCOUNT_SPACES_PATH = "spaces/";
2923
2994
  var AccountService = class {
2924
2995
  constructor(config) {
@@ -3113,6 +3184,13 @@ var AccountService = class {
3113
3184
  }
3114
3185
  };
3115
3186
  this.index = {
3187
+ ensure: async () => {
3188
+ const dbResult = this.accountDb();
3189
+ if (!dbResult.ok) return dbResult;
3190
+ const schema = await this.ensureAccountIndex(dbResult.data);
3191
+ if (!schema.ok) return schema;
3192
+ return ok3({ database: ACCOUNT_INDEX_DB });
3193
+ },
3116
3194
  rebuild: async () => {
3117
3195
  const dbResult = this.accountDb();
3118
3196
  if (!dbResult.ok) return dbResult;
@@ -3123,8 +3201,9 @@ var AccountService = class {
3123
3201
  const delegations = await this.delegations.list();
3124
3202
  if (!delegations.ok) return delegations;
3125
3203
  const syncedAt = (/* @__PURE__ */ new Date()).toISOString();
3204
+ const schema = await this.ensureAccountIndex(dbResult.data);
3205
+ if (!schema.ok) return schema;
3126
3206
  const statements = [
3127
- ...ACCOUNT_INDEX_SCHEMA.map((sql) => ({ sql })),
3128
3207
  { sql: "DELETE FROM applications" },
3129
3208
  { sql: "DELETE FROM application_state" },
3130
3209
  { sql: "DELETE FROM spaces" },
@@ -3321,7 +3400,7 @@ var AccountService = class {
3321
3400
  async indexHasApplicationHash(appId, manifestHash) {
3322
3401
  const dbResult = this.accountDb();
3323
3402
  if (!dbResult.ok) return false;
3324
- const schema = await dbResult.data.batch(ACCOUNT_INDEX_SCHEMA.map((sql) => ({ sql })));
3403
+ const schema = await this.ensureAccountIndex(dbResult.data);
3325
3404
  if (!schema.ok) return false;
3326
3405
  const queried = await dbResult.data.query(
3327
3406
  "SELECT 1 FROM application_state WHERE app_id = ? AND manifest_hash = ? LIMIT 1",
@@ -3335,10 +3414,11 @@ var AccountService = class {
3335
3414
  async upsertApplicationIndex(app) {
3336
3415
  const dbResult = this.accountDb();
3337
3416
  if (!dbResult.ok) return ok3(void 0);
3417
+ const schema = await this.ensureAccountIndex(dbResult.data);
3418
+ if (!schema.ok) return schema;
3338
3419
  const updatedAt = app.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString();
3339
3420
  const manifestHash = app.manifestHash ?? hashJson(app.manifests);
3340
3421
  const written = await dbResult.data.batch([
3341
- ...ACCOUNT_INDEX_SCHEMA.map((sql) => ({ sql })),
3342
3422
  {
3343
3423
  sql: "INSERT OR REPLACE INTO applications (app_id, name, description, updated_at, manifest_json) VALUES (?, ?, ?, ?, ?)",
3344
3424
  params: [
@@ -3363,8 +3443,9 @@ var AccountService = class {
3363
3443
  async deleteApplicationIndex(appId) {
3364
3444
  const dbResult = this.accountDb();
3365
3445
  if (!dbResult.ok) return ok3(void 0);
3446
+ const schema = await this.ensureAccountIndex(dbResult.data);
3447
+ if (!schema.ok) return schema;
3366
3448
  const deleted = await dbResult.data.batch([
3367
- ...ACCOUNT_INDEX_SCHEMA.map((sql) => ({ sql })),
3368
3449
  { sql: "DELETE FROM applications WHERE app_id = ?", params: [appId] },
3369
3450
  { sql: "DELETE FROM application_state WHERE app_id = ?", params: [appId] }
3370
3451
  ]);
@@ -3377,9 +3458,10 @@ var AccountService = class {
3377
3458
  async upsertSpaceIndex(space) {
3378
3459
  const dbResult = this.accountDb();
3379
3460
  if (!dbResult.ok) return ok3(void 0);
3461
+ const schema = await this.ensureAccountIndex(dbResult.data);
3462
+ if (!schema.ok) return schema;
3380
3463
  const updatedAt = space.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString();
3381
3464
  const written = await dbResult.data.batch([
3382
- ...ACCOUNT_INDEX_SCHEMA.map((sql) => ({ sql })),
3383
3465
  {
3384
3466
  sql: "INSERT OR REPLACE INTO spaces (space_id, name, owner_did, type, permissions_json, status, registered_at, updated_at, expires_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
3385
3467
  params: [
@@ -3404,8 +3486,9 @@ var AccountService = class {
3404
3486
  async deleteSpaceIndex(spaceId) {
3405
3487
  const dbResult = this.accountDb();
3406
3488
  if (!dbResult.ok) return ok3(void 0);
3489
+ const schema = await this.ensureAccountIndex(dbResult.data);
3490
+ if (!schema.ok) return schema;
3407
3491
  const deleted = await dbResult.data.batch([
3408
- ...ACCOUNT_INDEX_SCHEMA.map((sql) => ({ sql })),
3409
3492
  { sql: "DELETE FROM spaces WHERE space_id = ?", params: [spaceId] }
3410
3493
  ]);
3411
3494
  if (!deleted.ok) return accountErr(deleted.error);
@@ -3427,8 +3510,9 @@ var AccountService = class {
3427
3510
  const dbResult = this.accountDb();
3428
3511
  if (!dbResult.ok) return;
3429
3512
  const syncedAt = (/* @__PURE__ */ new Date()).toISOString();
3513
+ const schema = await this.ensureAccountIndex(dbResult.data);
3514
+ if (!schema.ok) return;
3430
3515
  await dbResult.data.batch([
3431
- ...ACCOUNT_INDEX_SCHEMA.map((sql) => ({ sql })),
3432
3516
  { sql: "DELETE FROM applications" },
3433
3517
  { sql: "DELETE FROM application_state" },
3434
3518
  ...applications.map((app) => ({
@@ -3457,8 +3541,9 @@ var AccountService = class {
3457
3541
  const dbResult = this.accountDb();
3458
3542
  if (!dbResult.ok) return;
3459
3543
  const syncedAt = (/* @__PURE__ */ new Date()).toISOString();
3544
+ const schema = await this.ensureAccountIndex(dbResult.data);
3545
+ if (!schema.ok) return;
3460
3546
  await dbResult.data.batch([
3461
- ...ACCOUNT_INDEX_SCHEMA.map((sql) => ({ sql })),
3462
3547
  { sql: "DELETE FROM spaces" },
3463
3548
  ...spaces.map((space) => ({
3464
3549
  sql: "INSERT OR REPLACE INTO spaces (space_id, name, owner_did, type, permissions_json, status, registered_at, updated_at, expires_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
@@ -3486,8 +3571,9 @@ var AccountService = class {
3486
3571
  const dbResult = this.accountDb();
3487
3572
  if (!dbResult.ok) return;
3488
3573
  const syncedAt = (/* @__PURE__ */ new Date()).toISOString();
3574
+ const schema = await this.ensureAccountIndex(dbResult.data);
3575
+ if (!schema.ok) return;
3489
3576
  await dbResult.data.batch([
3490
- ...ACCOUNT_INDEX_SCHEMA.map((sql) => ({ sql })),
3491
3577
  { sql: "DELETE FROM delegations" },
3492
3578
  ...delegations.map((delegation) => ({
3493
3579
  sql: "INSERT OR REPLACE INTO delegations (cid, direction, space_id, space_name, counterparty_did, delegate_did, delegator_did, path, actions_json, expiry, status, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
@@ -3514,57 +3600,20 @@ var AccountService = class {
3514
3600
  ]);
3515
3601
  });
3516
3602
  }
3603
+ async ensureAccountIndex(db) {
3604
+ const migrated = await db.migrations.apply({
3605
+ namespace: ACCOUNT_INDEX_NAMESPACE,
3606
+ migrations: [
3607
+ {
3608
+ id: "001_initial",
3609
+ sql: [...ACCOUNT_INDEX_SCHEMA]
3610
+ }
3611
+ ]
3612
+ });
3613
+ if (!migrated.ok) return accountErr(migrated.error);
3614
+ return ok3(void 0);
3615
+ }
3517
3616
  };
3518
- var ACCOUNT_INDEX_SCHEMA = [
3519
- `CREATE TABLE IF NOT EXISTS applications (
3520
- app_id TEXT PRIMARY KEY,
3521
- name TEXT,
3522
- description TEXT,
3523
- updated_at TEXT,
3524
- manifest_json TEXT NOT NULL
3525
- )`,
3526
- `CREATE TABLE IF NOT EXISTS application_state (
3527
- app_id TEXT PRIMARY KEY,
3528
- manifest_hash TEXT NOT NULL,
3529
- indexed_at TEXT NOT NULL
3530
- )`,
3531
- `CREATE TABLE IF NOT EXISTS spaces (
3532
- space_id TEXT PRIMARY KEY,
3533
- name TEXT NOT NULL,
3534
- owner_did TEXT NOT NULL,
3535
- type TEXT NOT NULL,
3536
- permissions_json TEXT NOT NULL,
3537
- status TEXT NOT NULL,
3538
- registered_at TEXT,
3539
- updated_at TEXT NOT NULL,
3540
- expires_at TEXT
3541
- )`,
3542
- `CREATE TABLE IF NOT EXISTS delegations (
3543
- cid TEXT PRIMARY KEY,
3544
- direction TEXT NOT NULL,
3545
- space_id TEXT NOT NULL,
3546
- space_name TEXT,
3547
- counterparty_did TEXT NOT NULL,
3548
- delegate_did TEXT NOT NULL,
3549
- delegator_did TEXT,
3550
- path TEXT NOT NULL,
3551
- actions_json TEXT NOT NULL,
3552
- expiry TEXT NOT NULL,
3553
- status TEXT NOT NULL,
3554
- created_at TEXT,
3555
- updated_at TEXT NOT NULL
3556
- )`,
3557
- `CREATE TABLE IF NOT EXISTS sync_state (
3558
- source TEXT PRIMARY KEY,
3559
- synced_at TEXT NOT NULL,
3560
- count INTEGER NOT NULL
3561
- )`,
3562
- "CREATE INDEX IF NOT EXISTS idx_delegations_direction ON delegations(direction)",
3563
- "CREATE INDEX IF NOT EXISTS idx_delegations_space ON delegations(space_id)",
3564
- "CREATE INDEX IF NOT EXISTS idx_delegations_counterparty ON delegations(counterparty_did)",
3565
- "CREATE INDEX IF NOT EXISTS idx_spaces_owner ON spaces(owner_did)",
3566
- "CREATE INDEX IF NOT EXISTS idx_spaces_type ON spaces(type)"
3567
- ];
3568
3617
  function applicationKey(appId) {
3569
3618
  return `${ACCOUNT_REGISTRY_PATH}${appId}`;
3570
3619
  }
@@ -3739,6 +3788,13 @@ import {
3739
3788
  err as err5,
3740
3789
  serviceError as serviceError5,
3741
3790
  ErrorCodes as ErrorCodes2,
3791
+ TinyCloudDebugLogger,
3792
+ tinyCloudDebugLogger,
3793
+ enableTinyCloudDebug,
3794
+ disableTinyCloudDebug,
3795
+ getTinyCloudDebugLogs,
3796
+ clearTinyCloudDebugLogs,
3797
+ installTinyCloudDebugGlobals,
3742
3798
  defaultRetryPolicy as defaultRetryPolicy2,
3743
3799
  SQLService as SQLService2,
3744
3800
  DatabaseHandle,
@@ -5539,6 +5595,76 @@ function createCapabilityKeyRegistry() {
5539
5595
  }
5540
5596
 
5541
5597
  // src/authorization/strategies.ts
5598
+ async function resolveOpenKeyToken(token) {
5599
+ return typeof token === "function" ? token() : token;
5600
+ }
5601
+ async function resolveOpenKeyHeaders(headers) {
5602
+ return typeof headers === "function" ? headers() : headers ?? {};
5603
+ }
5604
+ function openKeyApprovalReason(body) {
5605
+ if (body.reason) return body.reason;
5606
+ if (body.error) return body.error;
5607
+ if (body.approvalUrl) {
5608
+ return `OpenKey explicit approval required: ${body.approvalUrl}`;
5609
+ }
5610
+ return "OpenKey explicit approval required";
5611
+ }
5612
+ function createOpenKeyCallbackSigningStrategy(options) {
5613
+ return {
5614
+ type: "callback",
5615
+ openKeyAutoSign: true,
5616
+ handler: async (request) => {
5617
+ const fetchImpl = options.fetch ?? globalThis.fetch;
5618
+ if (!fetchImpl) {
5619
+ throw new Error("OpenKey signing strategy requires a fetch implementation");
5620
+ }
5621
+ const token = await resolveOpenKeyToken(options.token);
5622
+ const extraHeaders = await resolveOpenKeyHeaders(options.headers);
5623
+ const body = {
5624
+ ...request,
5625
+ ...options.keyId ? { keyId: options.keyId } : {}
5626
+ };
5627
+ const response = await fetchImpl(options.endpoint, {
5628
+ method: "POST",
5629
+ credentials: options.credentials,
5630
+ headers: {
5631
+ "content-type": "application/json",
5632
+ ...token ? { authorization: `Bearer ${token}` } : {},
5633
+ ...extraHeaders
5634
+ },
5635
+ body: JSON.stringify(body)
5636
+ });
5637
+ let parsed;
5638
+ try {
5639
+ parsed = await response.json();
5640
+ } catch {
5641
+ parsed = void 0;
5642
+ }
5643
+ if (!response.ok) {
5644
+ return {
5645
+ approved: false,
5646
+ reason: parsed?.reason ?? parsed?.error ?? `OpenKey signing failed with HTTP ${response.status}`
5647
+ };
5648
+ }
5649
+ if (parsed?.needsApproval || parsed?.approved === false) {
5650
+ return {
5651
+ approved: false,
5652
+ reason: openKeyApprovalReason(parsed)
5653
+ };
5654
+ }
5655
+ if (typeof parsed?.signature === "string" && parsed.signature.length > 0) {
5656
+ return {
5657
+ approved: true,
5658
+ signature: parsed.signature
5659
+ };
5660
+ }
5661
+ return {
5662
+ approved: false,
5663
+ reason: "OpenKey signing response did not include a signature"
5664
+ };
5665
+ }
5666
+ };
5667
+ }
5542
5668
  var defaultSignStrategy = { type: "auto-sign" };
5543
5669
 
5544
5670
  // src/authorization/spaceCreation.ts
@@ -5614,6 +5740,31 @@ async function checkNodeInfo(host, sdkProtocol, fetchFn = globalThis.fetch.bind(
5614
5740
  };
5615
5741
  }
5616
5742
 
5743
+ // src/index.ts
5744
+ import {
5745
+ ACCOUNT_INDEX_SCHEMA as ACCOUNT_INDEX_SCHEMA2,
5746
+ BOOTSTRAP_ALLOWLIST,
5747
+ BOOTSTRAP_DEFAULT_SPACE,
5748
+ BOOTSTRAP_ENCRYPTION_NETWORK_NAME,
5749
+ BOOTSTRAP_ENCRYPTION_NETWORK_RESOURCE_TEMPLATE,
5750
+ BOOTSTRAP_MANIFEST,
5751
+ BOOTSTRAP_PERSISTED_APPLICATION_MANIFESTS,
5752
+ BOOTSTRAP_PUBLIC_SPACE,
5753
+ BOOTSTRAP_SESSION_REQUESTS,
5754
+ BOOTSTRAP_SPACE_MANIFESTS,
5755
+ BOOTSTRAP_SPACE_NAMES,
5756
+ SECRET_RECORDS_SCHEMA,
5757
+ TINYCLOUD_ACCOUNT_SPACE_MANIFEST,
5758
+ TINYCLOUD_APPLICATIONS_SPACE_MANIFEST,
5759
+ TINYCLOUD_DEFAULT_SPACE_MANIFEST,
5760
+ TINYCLOUD_PUBLIC_SPACE_MANIFEST,
5761
+ TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST,
5762
+ bootstrapEncryptionNetworkId,
5763
+ bootstrapSpaceId,
5764
+ bootstrapSteps,
5765
+ composeBootstrapSpaceManifest
5766
+ } from "@tinycloud/bootstrap";
5767
+
5617
5768
  // src/location.ts
5618
5769
  import { multiaddr } from "@multiformats/multiaddr";
5619
5770
  import { multiaddrToUri } from "@multiformats/multiaddr-to-uri";
@@ -6123,10 +6274,21 @@ function parseRecapCapabilities(parseWasm, siwe) {
6123
6274
  return normalized;
6124
6275
  }
6125
6276
  export {
6277
+ ACCOUNT_INDEX_SCHEMA2 as ACCOUNT_INDEX_SCHEMA,
6126
6278
  ACCOUNT_REGISTRY_PATH,
6127
6279
  ACCOUNT_REGISTRY_SPACE,
6128
6280
  AccountService,
6129
6281
  AutoApproveSpaceCreationHandler,
6282
+ BOOTSTRAP_ALLOWLIST,
6283
+ BOOTSTRAP_DEFAULT_SPACE,
6284
+ BOOTSTRAP_ENCRYPTION_NETWORK_NAME,
6285
+ BOOTSTRAP_ENCRYPTION_NETWORK_RESOURCE_TEMPLATE,
6286
+ BOOTSTRAP_MANIFEST,
6287
+ BOOTSTRAP_PERSISTED_APPLICATION_MANIFESTS,
6288
+ BOOTSTRAP_PUBLIC_SPACE,
6289
+ BOOTSTRAP_SESSION_REQUESTS,
6290
+ BOOTSTRAP_SPACE_MANIFESTS,
6291
+ BOOTSTRAP_SPACE_NAMES,
6130
6292
  CapabilityKeyRegistry,
6131
6293
  CapabilityKeyRegistryErrorCodes,
6132
6294
  ClientSessionSchema,
@@ -6138,6 +6300,7 @@ export {
6138
6300
  DEFAULT_ENCRYPTION_ALG,
6139
6301
  DEFAULT_EXPIRY,
6140
6302
  DEFAULT_KEY_VERSION,
6303
+ DEFAULT_KNOWLEDGE_ROOT,
6141
6304
  DEFAULT_MANIFEST_SPACE,
6142
6305
  DEFAULT_MANIFEST_VERSION,
6143
6306
  DEFAULT_SIGNED_READ_URL_EXPIRY_MS,
@@ -6170,7 +6333,9 @@ export {
6170
6333
  PermissionNotInManifestError,
6171
6334
  PrefixedKVService,
6172
6335
  ProtocolMismatchError,
6336
+ SECRETS_SPACE,
6173
6337
  SECRET_NAME_RE2 as SECRET_NAME_RE,
6338
+ SECRET_RECORDS_SCHEMA,
6174
6339
  SERVICE_LONG_TO_SHORT,
6175
6340
  SERVICE_SHORT_TO_LONG,
6176
6341
  SQLAction,
@@ -6185,7 +6350,13 @@ export {
6185
6350
  Space,
6186
6351
  SpaceErrorCodes,
6187
6352
  SpaceService,
6353
+ TINYCLOUD_ACCOUNT_SPACE_MANIFEST,
6354
+ TINYCLOUD_APPLICATIONS_SPACE_MANIFEST,
6355
+ TINYCLOUD_DEFAULT_SPACE_MANIFEST,
6356
+ TINYCLOUD_PUBLIC_SPACE_MANIFEST,
6357
+ TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST,
6188
6358
  TinyCloud,
6359
+ TinyCloudDebugLogger,
6189
6360
  UnsupportedFeatureError,
6190
6361
  VAULT_PERMISSION_SERVICE,
6191
6362
  VaultHeaders,
@@ -6194,6 +6365,9 @@ export {
6194
6365
  activateSessionWithHost,
6195
6366
  addressStorageKey,
6196
6367
  applyPrefix,
6368
+ bootstrapEncryptionNetworkId,
6369
+ bootstrapSpaceId,
6370
+ bootstrapSteps,
6197
6371
  buildCanonicalDecryptRequest,
6198
6372
  buildDecryptAttenuation,
6199
6373
  buildDecryptFacts,
@@ -6211,8 +6385,11 @@ export {
6211
6385
  canonicalizeSecretScope,
6212
6386
  checkDecryptInvocationInput,
6213
6387
  checkNodeInfo,
6388
+ clearTinyCloudDebugLogs,
6389
+ composeBootstrapSpaceManifest,
6214
6390
  composeManifestRequest,
6215
6391
  createCapabilityKeyRegistry,
6392
+ createOpenKeyCallbackSigningStrategy,
6216
6393
  createSharingService,
6217
6394
  createSpaceService,
6218
6395
  createVaultCrypto,
@@ -6223,7 +6400,9 @@ export {
6223
6400
  deriveSignedReceiverKey,
6224
6401
  didCacheKey,
6225
6402
  didEquals,
6403
+ disableTinyCloudDebug,
6226
6404
  discoverNetwork,
6405
+ enableTinyCloudDebug,
6227
6406
  encryptToNetwork,
6228
6407
  base64Decode as encryptionBase64Decode,
6229
6408
  base64Encode as encryptionBase64Encode,
@@ -6238,9 +6417,11 @@ export {
6238
6417
  fetchLocationRecord,
6239
6418
  fetchPeerId,
6240
6419
  generateRandomReceiverKey,
6420
+ getTinyCloudDebugLogs,
6241
6421
  hexDecode,
6242
6422
  hexEncode,
6243
6423
  httpUrlToMultiaddr,
6424
+ installTinyCloudDebugGlobals,
6244
6425
  isCapabilitySubset,
6245
6426
  isEvmAddress,
6246
6427
  isNetworkId,
@@ -6265,6 +6446,7 @@ export {
6265
6446
  principalDidEquals,
6266
6447
  resolveCloudLocation,
6267
6448
  resolveManifest,
6449
+ resolveManifestKnowledgeRoot,
6268
6450
  resolveSecretListPrefix,
6269
6451
  resolveSecretPath2 as resolveSecretPath,
6270
6452
  resolveTinyCloudHosts,
@@ -6273,6 +6455,7 @@ export {
6273
6455
  serviceError5 as serviceError,
6274
6456
  signLocationRecord,
6275
6457
  submitHostDelegation,
6458
+ tinyCloudDebugLogger,
6276
6459
  validateClientSession,
6277
6460
  validateEnvelope,
6278
6461
  validateLocationRecord,