amalgm 0.1.203 → 0.1.205

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.203",
3
+ "version": "0.1.205",
4
4
  "description": "Amalgm local computer runtime: login, MCP, chat, events, previews, and tunnels.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -23,6 +23,7 @@ fs.writeFileSync(
23
23
  );
24
24
 
25
25
  const { closeLocalDb } = require('../state/db');
26
+ const { appendStateEvent } = require('../state/events');
26
27
  const { acknowledgeCloudMutation } = require('../state/mutations');
27
28
  const { registerReplica } = require('../state/replicas');
28
29
  const { openDoc, getDocText, writeDocText } = require('../state/docs');
@@ -256,6 +257,15 @@ test('a repo project appends immutable machine records', async () => {
256
257
  null,
257
258
  );
258
259
  assert.equal(publishedCardFor(refreshed.cards[0]).positionVersion, 1);
260
+ const readyObjects = {
261
+ ...refreshed.cards[0],
262
+ objects: { kind: 'bundle' },
263
+ refs: refreshed.cards[0].refs.map((ref) => ({
264
+ ...ref,
265
+ objects: { kind: 'bundle' },
266
+ })),
267
+ };
268
+ assert.equal(publishedCardFor(readyObjects), null);
259
269
 
260
270
  const again = publishWall(repoKey);
261
271
  assert.equal(again.published, false);
@@ -546,6 +556,20 @@ test('project stats name every project resource, binding, and publish counter',
546
556
  assert.ok(stats.paths.includes(project.file));
547
557
  });
548
558
 
559
+ test('ready repo objects wake the card publisher', async () => {
560
+ startWallService();
561
+ await new Promise((resolve) => setTimeout(resolve, 100));
562
+ const before = wallStats();
563
+ appendStateEvent({ resource: 'repo-objects', op: 'update', id: 'ready-bundle' });
564
+ await new Promise((resolve) => setTimeout(resolve, 100));
565
+ stopWallService();
566
+ const after = wallStats();
567
+ assert.ok(
568
+ after.publishes + after.publishSkips
569
+ > before.publishes + before.publishSkips,
570
+ );
571
+ });
572
+
549
573
  test('a restarted wall publishes once even when the project is already attached', async () => {
550
574
  const before = wallStats();
551
575
  startWallService();
@@ -194,6 +194,7 @@ function publishedCardFor(card) {
194
194
  || published.head?.branch !== card.head?.branch
195
195
  || published.head?.oid !== card.head?.oid
196
196
  || Boolean(published.head?.detached) !== Boolean(card.head?.detached)
197
+ || hasObjectUpgrade(card, { card: published, branches: published.branches })
197
198
  ) return null;
198
199
  return published;
199
200
  }
@@ -670,6 +671,7 @@ function startWallService() {
670
671
  if (
671
672
  event.resource === 'repo-cards'
672
673
  || event.resource === 'repo-checkpoints'
674
+ || event.resource === 'repo-objects'
673
675
  || acknowledged
674
676
  ) {
675
677
  ensureProjects().catch(() => {});