amalgm 0.1.166 → 0.1.167

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amalgm",
3
- "version": "0.1.166",
3
+ "version": "0.1.167",
4
4
  "description": "Amalgm local computer runtime: login, MCP, chat, events, previews, and tunnels.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -11,8 +11,9 @@
11
11
  * a doc byte must outlive everything.
12
12
  *
13
13
  * Ownership rules the wire shape enforces:
14
- * - Identity is stamped HERE from the enrolled account (workspace/identity),
15
- * never accepted from the publisher. A blob cannot impersonate.
14
+ * - The stable account id is stamped here from enrollment, never accepted
15
+ * from the publisher. Cross-account display identity is authenticated and
16
+ * added by the gateway, then passed through this state unchanged.
16
17
  * - The blob is opaque. Only the surface bound to the same resource on the
17
18
  * other end knows its coordinate system (text caret, canvas x,y, nothing).
18
19
  * - Absence is the default presence must re-earn: entries live TTL_MS from
@@ -63,6 +64,7 @@ function peersOf(resource) {
63
64
  return peers ? Array.from(peers.values(), (peer) => ({
64
65
  session: peer.session,
65
66
  user: peer.user,
67
+ ...(peer.identity ? { identity: peer.identity } : {}),
66
68
  blob: peer.blob,
67
69
  at: peer.at,
68
70
  activeAt: peer.activeAt,
@@ -223,6 +225,7 @@ function replaceCloudPresence(input) {
223
225
  peers.set(peer.session, {
224
226
  session: peer.session,
225
227
  user: peer.user,
228
+ ...(peer.identity && typeof peer.identity === 'object' ? { identity: peer.identity } : {}),
226
229
  blob: peer.blob ?? null,
227
230
  at: Number(peer.at) || now,
228
231
  activeAt: Number(peer.activeAt) || now,
@@ -77,6 +77,7 @@ test('the runtime tunnel bridges presence in both directions without a durable q
77
77
  peers: [{
78
78
  session: 'ps_direct',
79
79
  user: 'direct-user',
80
+ identity: { name: 'Direct Person', avatarUrl: 'https://example.com/direct.png' },
80
81
  blob: { anchor: 8 },
81
82
  at: 20,
82
83
  activeAt: 20,
@@ -92,6 +93,7 @@ test('the runtime tunnel bridges presence in both directions without a durable q
92
93
  peers: [{
93
94
  session: 'ps_direct',
94
95
  user: 'direct-user',
96
+ identity: { name: 'Direct Person', avatarUrl: 'https://example.com/direct.png' },
95
97
  blob: { anchor: 8 },
96
98
  at: 20,
97
99
  activeAt: 20,
@@ -165,11 +165,22 @@ test('shared presence forwards local facts, merges cloud peers, and clears them
165
165
  resource: localResource,
166
166
  peers: [
167
167
  { session: 'ps_local', user: 'official-local', blob: null, at: 10, activeAt: 10 },
168
- { session: 'ps_remote', user: 'remote-user', blob: { anchor: 9 }, at: 11, activeAt: 11 },
168
+ {
169
+ session: 'ps_remote',
170
+ user: 'remote-user',
171
+ identity: { name: 'Remote Person', avatarUrl: 'https://example.com/remote.png' },
172
+ blob: { anchor: 9 },
173
+ at: 11,
174
+ activeAt: 11,
175
+ },
169
176
  ],
170
177
  });
171
178
  assert.equal(publishes.length, 1, 'an inbound cloud roster never echoes back upstream');
172
179
  assert.deepEqual(frames.at(-1).peers.map((peer) => peer.session).sort(), ['ps_local', 'ps_remote']);
180
+ assert.deepEqual(
181
+ frames.at(-1).peers.find((peer) => peer.session === 'ps_remote').identity,
182
+ { name: 'Remote Person', avatarUrl: 'https://example.com/remote.png' },
183
+ );
173
184
 
174
185
  await sharedRest.handleReplicaRevoked(
175
186
  { resourceId: cloudResourceId, reason: 'access-removed' },