holosphere 2.0.0-alpha21 → 2.0.0-alpha23

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.
Files changed (69) hide show
  1. package/README.md +1 -2
  2. package/dist/cjs/holosphere.cjs +1 -1
  3. package/dist/esm/holosphere.js +61 -58
  4. package/dist/{index-B6-8KAQm.js → index-BEkCLOwI.js} +2 -2
  5. package/dist/{index-B6-8KAQm.js.map → index-BEkCLOwI.js.map} +1 -1
  6. package/dist/{index-D2WstuZJ.js → index-BEvX6DxG.js} +2 -2
  7. package/dist/{index-D2WstuZJ.js.map → index-BEvX6DxG.js.map} +1 -1
  8. package/dist/{index--QsHG_gD.cjs → index-BGTOiJ2Y.cjs} +2 -2
  9. package/dist/{index--QsHG_gD.cjs.map → index-BGTOiJ2Y.cjs.map} +1 -1
  10. package/dist/{index-COpLk9gL.cjs → index-BH1woZXL.cjs} +2 -2
  11. package/dist/{index-COpLk9gL.cjs.map → index-BH1woZXL.cjs.map} +1 -1
  12. package/dist/{index-BHptWysv.js → index-Cvxov2jv.js} +2970 -7753
  13. package/dist/index-Cvxov2jv.js.map +1 -0
  14. package/dist/index-vTKI_BAX.cjs +29 -0
  15. package/dist/index-vTKI_BAX.cjs.map +1 -0
  16. package/dist/{indexeddb-storage-wKG4mICM.cjs → indexeddb-storage-BmnCNnSg.cjs} +2 -2
  17. package/dist/{indexeddb-storage-wKG4mICM.cjs.map → indexeddb-storage-BmnCNnSg.cjs.map} +1 -1
  18. package/dist/{indexeddb-storage-kQ53UHEE.js → indexeddb-storage-MIFisaPy.js} +2 -2
  19. package/dist/{indexeddb-storage-kQ53UHEE.js.map → indexeddb-storage-MIFisaPy.js.map} +1 -1
  20. package/dist/{memory-storage-CGC8xM2G.cjs → memory-storage-BJjK3F4r.cjs} +2 -2
  21. package/dist/{memory-storage-CGC8xM2G.cjs.map → memory-storage-BJjK3F4r.cjs.map} +1 -1
  22. package/dist/{memory-storage-DnXCSbBl.js → memory-storage-DhHXdKQ-.js} +2 -2
  23. package/dist/{memory-storage-DnXCSbBl.js.map → memory-storage-DhHXdKQ-.js.map} +1 -1
  24. package/examples/demo.html +2 -29
  25. package/package.json +3 -8
  26. package/src/content/social-protocols.js +3 -59
  27. package/src/core/holosphere.js +16 -554
  28. package/src/crypto/nostr-utils.js +98 -1
  29. package/src/crypto/secp256k1.js +4 -393
  30. package/src/federation/discovery.js +7 -75
  31. package/src/federation/handshake.js +69 -202
  32. package/src/federation/hologram.js +222 -298
  33. package/src/federation/index.js +2 -9
  34. package/src/federation/registry.js +67 -1257
  35. package/src/federation/request-card.js +21 -35
  36. package/src/hierarchical/upcast.js +4 -9
  37. package/src/index.js +145 -296
  38. package/src/lib/federation-methods.js +370 -909
  39. package/src/storage/global-tables.js +1 -1
  40. package/src/storage/nostr-wrapper.js +9 -5
  41. package/src/subscriptions/manager.js +1 -1
  42. package/types/index.d.ts +145 -37
  43. package/bin/holosphere-activitypub.js +0 -158
  44. package/dist/2019-BzVkRcax.js +0 -6680
  45. package/dist/2019-BzVkRcax.js.map +0 -1
  46. package/dist/2019-C1hPR_Os.cjs +0 -8
  47. package/dist/2019-C1hPR_Os.cjs.map +0 -1
  48. package/dist/browser-BcmACE3G.js +0 -3058
  49. package/dist/browser-BcmACE3G.js.map +0 -1
  50. package/dist/browser-DaqYUTcG.cjs +0 -2
  51. package/dist/browser-DaqYUTcG.cjs.map +0 -1
  52. package/dist/index-BHptWysv.js.map +0 -1
  53. package/dist/index-CDlhzxT2.cjs +0 -29
  54. package/dist/index-CDlhzxT2.cjs.map +0 -1
  55. package/src/federation/capabilities.js +0 -46
  56. package/src/storage/backend-factory.js +0 -130
  57. package/src/storage/backend-interface.js +0 -161
  58. package/src/storage/backends/activitypub/server.js +0 -675
  59. package/src/storage/backends/activitypub-backend.js +0 -295
  60. package/src/storage/backends/gundb-backend.js +0 -875
  61. package/src/storage/backends/nostr-backend.js +0 -251
  62. package/src/storage/gun-async.js +0 -341
  63. package/src/storage/gun-auth.js +0 -373
  64. package/src/storage/gun-federation.js +0 -785
  65. package/src/storage/gun-references.js +0 -209
  66. package/src/storage/gun-schema.js +0 -306
  67. package/src/storage/gun-wrapper.js +0 -642
  68. package/src/storage/migration.js +0 -351
  69. package/src/storage/unified-storage.js +0 -161
@@ -8,13 +8,11 @@
8
8
  * @module federation/request-card
9
9
  */
10
10
 
11
- import { issueCapabilitiesForLenses } from './registry.js';
12
11
 
13
12
  /**
14
13
  * @typedef {Object} LensConfig
15
14
  * @property {string} name - Lens name
16
- * @property {boolean} enabled - Whether lens is enabled for federation
17
- * @property {string} direction - 'inbound', 'outbound', or 'bidirectional'
15
+ * @property {boolean} enabled - Whether lens is enabled for sharing
18
16
  * @property {string[]} permissions - Permissions to grant ('read', 'write')
19
17
  */
20
18
 
@@ -60,16 +58,15 @@ export function createFederationCard({
60
58
  defaultConfig = {},
61
59
  }) {
62
60
  const {
63
- defaultDirection = 'bidirectional',
64
61
  defaultPermissions = ['read'],
65
62
  enabledByDefault = true,
66
63
  } = defaultConfig;
67
64
 
68
65
  // Create lens configurations for all available lenses
66
+ // Direction is implicit in the share model — no direction toggles needed
69
67
  const lenses = availableLenses.map(name => ({
70
68
  name,
71
69
  enabled: enabledByDefault,
72
- direction: defaultDirection,
73
70
  permissions: [...defaultPermissions],
74
71
  }));
75
72
 
@@ -194,26 +191,22 @@ export function getEnabledLenses(card) {
194
191
  }
195
192
 
196
193
  /**
197
- * Get lens configuration for handshake (inbound/outbound arrays)
194
+ * Get lens configuration for share/handshake.
195
+ * In the share model, enabled lenses are shared bidirectionally.
196
+ * Returns both inbound/outbound for backward compat, plus a flat `lenses` array.
198
197
  * @param {FederationCardConfig} card - Card configuration
199
- * @returns {Object} { inbound: string[], outbound: string[] }
198
+ * @returns {Object} { inbound: string[], outbound: string[], lenses: string[] }
200
199
  */
201
200
  export function getLensConfigForHandshake(card) {
202
- const inbound = [];
203
- const outbound = [];
201
+ const lenses = [];
204
202
 
205
203
  for (const lens of card.lenses) {
206
204
  if (!lens.enabled) continue;
207
-
208
- if (lens.direction === 'inbound' || lens.direction === 'bidirectional') {
209
- inbound.push(lens.name);
210
- }
211
- if (lens.direction === 'outbound' || lens.direction === 'bidirectional') {
212
- outbound.push(lens.name);
213
- }
205
+ lenses.push(lens.name);
214
206
  }
215
207
 
216
- return { inbound, outbound };
208
+ // Backward compat: inbound/outbound are both the full set
209
+ return { inbound: [...lenses], outbound: [...lenses], lenses };
217
210
  }
218
211
 
219
212
  /**
@@ -273,18 +266,13 @@ export function cardToHandshakeParams(card) {
273
266
  */
274
267
  export async function generateCapabilitiesForCard(client, card) {
275
268
  const { outbound } = getLensConfigForHandshake(card);
276
-
277
- if (outbound.length === 0) {
278
- return [];
279
- }
280
-
281
- return issueCapabilitiesForLenses(
282
- client,
283
- card.holonId,
284
- outbound,
285
- card.partnerPubKey,
286
- { permissions: ['read'] }
287
- );
269
+ // In the simplified model, capabilities are not needed.
270
+ // Return stub entries so callers still get a list of lenses.
271
+ return outbound.map(lensName => ({
272
+ token: 'federation-member',
273
+ scope: { holonId: card.holonId, lensName, dataId: '*' },
274
+ permissions: ['read', 'write'],
275
+ }));
288
276
  }
289
277
 
290
278
  /**
@@ -295,8 +283,7 @@ export async function generateCapabilitiesForCard(client, card) {
295
283
  */
296
284
  export function renderCardAsText(card, options = {}) {
297
285
  const { initialLensCount = DEFAULT_INITIAL_LENS_COUNT } = options;
298
- const { visibleLenses, hiddenCount, isExpanded } = getVisibleLenses(card, initialLensCount);
299
- const { inbound, outbound } = getLensConfigForHandshake(card);
286
+ const { visibleLenses, hiddenCount } = getVisibleLenses(card, initialLensCount);
300
287
 
301
288
  const lines = [
302
289
  `┌─────────────────────────────────────────────────────┐`,
@@ -310,9 +297,7 @@ export function renderCardAsText(card, options = {}) {
310
297
 
311
298
  for (const lens of visibleLenses) {
312
299
  const status = lens.enabled ? '✓' : '○';
313
- const dir = lens.direction === 'bidirectional' ? '↔' :
314
- lens.direction === 'inbound' ? '←' : '→';
315
- lines.push(`│ ${status} ${lens.name.padEnd(20)} ${dir.padEnd(22)}│`);
300
+ lines.push(`│ ${status} ${lens.name.padEnd(43)}│`);
316
301
  }
317
302
 
318
303
  if (hiddenCount > 0) {
@@ -320,7 +305,8 @@ export function renderCardAsText(card, options = {}) {
320
305
  }
321
306
 
322
307
  lines.push(`├─────────────────────────────────────────────────────┤`);
323
- lines.push(`│ Sharing: ${outbound.length} lenses | Receiving: ${inbound.length} lenses`.padEnd(52) + `│`);
308
+ const { lenses: enabledLenses } = getLensConfigForHandshake(card);
309
+ lines.push(`│ Sharing: ${enabledLenses.length} lenses`.padEnd(52) + `│`);
324
310
  lines.push(`└─────────────────────────────────────────────────────┘`);
325
311
 
326
312
  return lines.join('\n');
@@ -2,14 +2,14 @@
2
2
  * @fileoverview Hierarchical aggregation (upcast) operations for propagating data to parent holons.
3
3
  * Implements upcast operations (FR-025 to FR-027) for H3-based geographic hierarchies.
4
4
  *
5
- * UNIFIED MODEL: Uses createHologramWithCapability for consistent capability-based federation.
5
+ * Uses holograms for consistent federation-based hierarchy propagation.
6
6
  *
7
7
  * @module hierarchical/upcast
8
8
  */
9
9
 
10
10
  import { getParents, isValidH3 } from '../spatial/h3-operations.js';
11
11
  import { createHologramWithCapability } from '../federation/hologram.js';
12
- import { write } from '../storage/unified-storage.js';
12
+ import { write } from '../storage/nostr-wrapper.js';
13
13
 
14
14
  /**
15
15
  * Upcast data to parent holons in the H3 hierarchy.
@@ -53,7 +53,7 @@ export async function upcast(hs, holonId, lensName, dataId, options = {}) {
53
53
 
54
54
  /**
55
55
  * Propagate data to a parent holon by creating a hologram reference.
56
- * UNIFIED MODEL: Uses createHologramWithCapability for consistent capability-based federation.
56
+ * Uses holograms for consistent federation-based hierarchy propagation.
57
57
  * @private
58
58
  * @param {Object} client - Nostr client instance
59
59
  * @param {string} appname - Application name
@@ -73,7 +73,6 @@ async function propagateToParent(
73
73
  dataId,
74
74
  operation
75
75
  ) {
76
- // UNIFIED MODEL: Create hologram with capability
77
76
  const hologram = await createHologramWithCapability(
78
77
  client,
79
78
  sourceHolon,
@@ -81,11 +80,7 @@ async function propagateToParent(
81
80
  lensName,
82
81
  dataId,
83
82
  appname,
84
- {
85
- // Use client's public key as source author (self-federation for upcast)
86
- sourceAuthorPubKey: client.publicKey,
87
- permissions: ['read'],
88
- }
83
+ { sourceAuthorPubKey: client.publicKey }
89
84
  );
90
85
 
91
86
  // Add operation metadata