@stacksjs/defaults 0.75.582 → 0.75.584

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.
@@ -508,6 +508,85 @@ Retained evidence:
508
508
  - [storage/framework/core/realtime/tests/ws-auth.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/ws-auth.test.ts)
509
509
  - [storage/framework/core/realtime/tests/websocket-options.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/websocket-options.test.ts)
510
510
 
511
+ ## realtime: redis-invalidations
512
+
513
+ Status: **experimental**. Topology: worker-and-redis.
514
+
515
+ Implementation: [storage/framework/core/realtime/src/redis-invalidations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/redis-invalidations.ts).
516
+
517
+ Prerequisites:
518
+
519
+ - Explicit createRedisInvalidationBus and createBroadcastResponse invalidations option
520
+ - Bun native Redis Pub/Sub methods (qualified on Bun 1.4.4)
521
+ - Operator-owned Redis URL and application/environment namespace
522
+ - Owned Redis binary for live tests (qualified on Redis 8.8.0)
523
+ - Current per-request/channel authorization
524
+
525
+ Limitations:
526
+
527
+ - Metadata-only at-most-once hints; no transcript forwarding, durable delivery or automatic WebSocket cluster fan-out.
528
+ - Bun documents the native Pub/Sub interface as experimental; unsupported runtimes fail only on explicit factory use.
529
+ - Live tests own isolated loopback Redis and skip without STACKS_TEST_REDIS_BINARY or redis-server on PATH; this record does not claim a CI service contract.
530
+ - Reconnect issues resync hints, but producer-only outages can lose hints; applications still need authoritative snapshots/replay or periodic refresh.
531
+ - TLS, ACL and managed cluster configurations require separate qualification.
532
+
533
+ Retained evidence:
534
+
535
+ - [storage/framework/core/realtime/tests/invalidation-bus.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/invalidation-bus.test.ts)
536
+ - [storage/framework/core/realtime/tests/stream-invalidations.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/stream-invalidations.test.ts)
537
+ - [storage/framework/core/realtime/tests/redis-invalidations.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/redis-invalidations.test.ts)
538
+ - [storage/framework/core/realtime/tests/redis-invalidation-process.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/redis-invalidation-process.test.ts)
539
+
540
+ ## realtime: sqlite-replay
541
+
542
+ Status: **supported**. Topology: worker-and-embedded-sqlite.
543
+
544
+ Implementation: [storage/framework/core/realtime/src/durable-replay-sql.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/durable-replay-sql.ts).
545
+
546
+ Prerequisites:
547
+
548
+ - Opt-in app-owned model-generated channel/event tables
549
+ - Transaction-bound SQLite adapter that resolves after commit
550
+ - Fresh application channel authorization
551
+
552
+ Limitations:
553
+
554
+ - Selected explicitly with createSqlDurableReplayStore; this is finite history, not a live transport driver.
555
+ - Idempotency expires with retained events; permanent domain deduplication remains application-owned.
556
+ - Applications bound channel cardinality and prune inactive channels.
557
+ - Nested savepoints cannot publish a committed cursor before the outer transaction commits.
558
+
559
+ Retained evidence:
560
+
561
+ - [storage/framework/core/realtime/tests/durable-replay-sql.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/durable-replay-sql.test.ts)
562
+ - [storage/framework/core/realtime/tests/durable-replay-process.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/durable-replay-process.test.ts)
563
+ - [storage/framework/core/realtime/tests/durable-replay-http.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/durable-replay-http.test.ts)
564
+
565
+ ## realtime: postgres-replay
566
+
567
+ Status: **supported**. Topology: client-server.
568
+
569
+ Implementation: [storage/framework/core/realtime/src/durable-replay-sql.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/durable-replay-sql.ts).
570
+
571
+ Prerequisites:
572
+
573
+ - Opt-in app-owned model-generated channel/event tables
574
+ - Transaction-bound PostgreSQL adapter that resolves after commit
575
+ - Fresh application channel authorization
576
+
577
+ Limitations:
578
+
579
+ - Selected explicitly with createSqlDurableReplayStore; this is finite history, not a live transport driver.
580
+ - Idempotency expires with retained events; permanent domain deduplication remains application-owned.
581
+ - Applications bound channel cardinality and prune inactive channels.
582
+ - Nested savepoints cannot publish a committed cursor before the outer transaction commits.
583
+
584
+ Retained evidence:
585
+
586
+ - [storage/framework/core/realtime/tests/durable-replay-sql.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/durable-replay-sql.test.ts)
587
+ - [storage/framework/core/realtime/tests/durable-replay-process.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/durable-replay-process.test.ts)
588
+ - [storage/framework/core/realtime/tests/durable-replay-http.test.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests/durable-replay-http.test.ts)
589
+
511
590
  ## deploy: ts-cloud-hetzner
512
591
 
513
592
  Status: **experimental**. Topology: hetzner-vm-systemd-rpx.
@@ -73,7 +73,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
73
73
  | `@stacksjs/push` | [`stacks-push`](../stacks-push/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/index.ts) | 8 |
74
74
  | `@stacksjs/query-builder` | [`stacks-query-builder`](../stacks-query-builder/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/query-builder/src/index.ts) | 7 |
75
75
  | `@stacksjs/queue` | [`stacks-queue`](../stacks-queue/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/queue/src/index.ts) | 58 |
76
- | `@stacksjs/realtime` | [`stacks-realtime`](../stacks-realtime/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/index.ts) | 13 |
76
+ | `@stacksjs/realtime` | [`stacks-realtime`](../stacks-realtime/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/index.ts) | 21 |
77
77
  | `@stacksjs/registry` | [`stacks-registry`](../stacks-registry/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/registry/src/index.ts) | 1 |
78
78
  | `@stacksjs/repl` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/repl/src/index.ts) | 2 |
79
79
  | `@stacksjs/router` | [`stacks-router`](../stacks-router/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/index.ts) | 104 |
@@ -718,11 +718,11 @@ Evidence directory: [58 retained tests](https://github.com/stacksjs/stacks/blob/
718
718
 
719
719
  Guidance: [`stacks-realtime`](../stacks-realtime/SKILL.md). Source: [storage/framework/core/realtime/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/index.ts).
720
720
 
721
- Declared runtime exports: `LegacyBroadcast`, `StacksChannel`, `channel`, `createBroadcastHub`, `createBroadcastResponse`, `createChannel`, `createServer`, `debugSnapshot`, `dispatchBroadcast`, `emit`, `emitToUser`, `emitToUsers`, `getReplayBuffer`, `getServer`, `getWsAuthenticator`, `pruneExpired`, `recordBroadcast`, `replaySince`, `runBroadcast`, `setReplayBuffer`, `setServer`, `setWsAuthenticator`, `stopServer`, `storeWebSocketEvent`.
721
+ Declared runtime exports: `DurableReplayError`, `InvalidationError`, `LegacyBroadcast`, `StacksChannel`, `channel`, `createBroadcastHub`, `createBroadcastResponse`, `createChannel`, `createDurableReplayResponse`, `createMemoryDurableReplayStore`, `createMemoryInvalidationBus`, `createRedisInvalidationBus`, `createServer`, `createSqlDurableReplayStore`, `debugSnapshot`, `dispatchBroadcast`, `emit`, `emitToUser`, `emitToUsers`, `getReplayBuffer`, `getServer`, `getWsAuthenticator`, `pruneExpired`, `publishDurableReplay`, `recordBroadcast`, `replaySince`, `runBroadcast`, `setReplayBuffer`, `setServer`, `setWsAuthenticator`, `stopServer`, `storeWebSocketEvent`.
722
722
 
723
- Local source modules: [src/broadcast.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/broadcast.ts), [src/channel.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/channel.ts), [src/emit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/emit.ts), [src/replay-buffer.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/replay-buffer.ts), [src/server-instance.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/server-instance.ts), [src/stream.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/stream.ts), [src/ws.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/ws.ts).
723
+ Local source modules: [src/broadcast.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/broadcast.ts), [src/channel.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/channel.ts), [src/durable-replay-http.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/durable-replay-http.ts), [src/durable-replay-sql.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/durable-replay-sql.ts), [src/durable-replay.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/durable-replay.ts), [src/emit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/emit.ts), [src/invalidation-bus.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/invalidation-bus.ts), [src/redis-invalidations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/redis-invalidations.ts), [src/replay-buffer.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/replay-buffer.ts), [src/server-instance.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/server-instance.ts), [src/stream.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/stream.ts), [src/ws.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/ws.ts).
724
724
 
725
- Evidence directory: [13 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
725
+ Evidence directory: [21 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
726
726
 
727
727
  ### @stacksjs/registry
728
728
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-realtime
3
- description: Use when implementing real-time features in Stacks - WebSocket broadcasting, public/private/presence channels, emit to users, the Channel class, broadcast discovery, server lifecycle, or realtime configuration. Covers @stacksjs/realtime and config/realtime.ts.
3
+ description: Use when implementing real-time features in Stacks - WebSocket broadcasting, Redis invalidation hints, durable SQL replay, public/private/presence channels, emit to users, the Channel class, broadcast discovery, server lifecycle, or realtime configuration. Covers @stacksjs/realtime and config/realtime.ts.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -361,7 +361,7 @@ automatic broadcast socket upgrade handler.
361
361
  - There is no Stacks heartbeat or backpressure guard; use `createServer({ websocket: { idleTimeout, sendPings, backpressureLimit, closeOnBackpressureLimit } })`
362
362
  - Serverless/provider shapes in config describe cloud options; inspect their actual deploy/runtime wiring before claiming the Stacks broadcast APIs support that topology
363
363
  - Rate limiting defaults: 100 connections per IP, 50 messages/second, 64KB max payload, 300s ban duration
364
- - The supported Stacks runtime contract is single-process WebSocket; scale-out requires an application-provided fan-out layer and separate provider evidence
364
+ - WebSocket broadcasting remains single-process; the separate opt-in Redis invalidation adapter wakes authorized HTTP consumers only
365
365
  - Auto-scaling config (min/max/targetCPU) is for cloud deployment orchestration
366
366
  - The `satisfies RealtimeConfig` type annotation ensures the config matches the expected type from `@stacksjs/types`
367
367
 
@@ -407,3 +407,68 @@ STX's `useBroadcastStream({ request, endpoint, onMessage, onConnected })` makes
407
407
  fresh authenticated requests using the application's injected transport, reconnects
408
408
  with backoff, and cancels on `close()`. Re-read durable state in `onConnected`;
409
409
  this stream does not promise durable replay. Credentials stay in HTTP headers.
410
+
411
+
412
+ ## Durable SQL replay (explicit opt-in)
413
+
414
+ `createSqlDurableReplayStore({dialect,tables,scope,transaction,...limits})` uses
415
+ application-owned, model-generated channel/event tables. The callback supplies
416
+ one genuinely transaction-bound query handle; checkpoint UPDATE locks serialize
417
+ append, retention and replay. Persisted incarnation/sequence cursors detect
418
+ channel recreation; gaps require domain snapshot resynchronization. Existing
419
+ synchronous `setReplayBuffer`/`emit` behavior is unchanged.
420
+
421
+ `createMemoryDurableReplayStore` is the deterministic fake for this separate
422
+ contract. `publishDurableReplay({store,input,notify})` commits before notifying;
423
+ hints can repeat and have no exactly-once/network/fan-out guarantee.
424
+ `createDurableReplayResponse({store,channel,after,authorize})` requires current
425
+ per-request/channel authorization before and after storage. Scope columns and
426
+ cursor strings never grant authority. Applications own visibility and channel
427
+ selection; do not replay private messages from a browser-supplied channel name.
428
+
429
+ Event idempotency lasts only while the event remains retained. JSON payload,
430
+ page, TTL and count bounds are validated; retention records a durable prefix
431
+ floor. Checkpoints retain metadata indefinitely, so applications bound channel
432
+ creation and schedule inactive pruning. Same-policy workers are required.
433
+ No schema is installed by importing realtime and no runtime DDL is performed.
434
+ Read `core/realtime/docs/durable-replay.md` for the exact SQL/transaction contract,
435
+ bounds, crash/retention limitations and native model examples under
436
+ `core/realtime/tests/fixtures/replay-app`. Retained tests are
437
+ `core/realtime/tests/durable-replay*.test.ts`, including independent SQLite and
438
+ PostgreSQL workers, rollback/SIGKILL, restart, scope/reset and HTTP revocation.
439
+
440
+ ## Redis invalidation hints (explicit opt-in, experimental)
441
+
442
+ `createRedisInvalidationBus({url,namespace,...bounds})` owns separate publisher
443
+ and subscriber Bun clients. Use operator-owned configuration and an explicit
444
+ app/environment namespace: Redis Pub/Sub database numbers do not isolate topics.
445
+ The public API is `publish(channel)`, `subscribe({channels,onInvalidate,onClose?,signal?})`,
446
+ `close()` and readonly `status`. `createMemoryInvalidationBus` is the deterministic
447
+ fake. Importing realtime does not connect Redis; unsupported Bun Pub/Sub methods
448
+ fail only when the explicit Redis factory is called.
449
+
450
+ Pass a shared worker bus as `createBroadcastResponse({invalidations,channels,authorize,signal})`.
451
+ It captures the initially authorized exact channel set, awaits subscription ACK,
452
+ reauthorizes before opening SSE, then retains per-event and heartbeat checks.
453
+ Hints emit only `{channel,event:'invalidated',data:null}` and require an authorized
454
+ state/replay read. No wildcard subscription, transcript, file, credential or
455
+ arbitrary Redis body is forwarded. Existing local-only callers keep their bytes.
456
+
457
+ Publish only after domain/outbox commit. Redis Pub/Sub is at-most-once; its
458
+ subscriber connection count is not browser delivery or a durable receipt.
459
+ Reconnect restores subscriptions and emits a bounded resync hint; a producer-only
460
+ outage may still lose hints. Keep authoritative replay/snapshot or periodic refresh.
461
+ Bounds cover channels/subscribers, queued hints, callbacks, pending publishes,
462
+ nonces and command/connect deadlines. Abort/dispose releases references; shutdown
463
+ closes the owned clients and cancels retry/deadline work. Status callbacks receive
464
+ only enums and core paths do not log broker URLs/errors or domain payloads.
465
+
466
+ Bun's native Pub/Sub interface is experimental, qualified with Bun 1.4.4 and an
467
+ owned Redis 8.8.0 loopback service. TLS/ACL/managed cluster deployments need
468
+ separate evidence. Read `core/realtime/docs/redis-invalidations.md` for protocol,
469
+ limits, archive checksum and live test instructions. `redis-invalidations` and
470
+ `redis-invalidation-process` tests start/stop an owned binary, never shared Redis;
471
+ set `STACKS_TEST_REDIS_BINARY` (or provide redis-server on PATH) so these cases
472
+ run rather than skip. Retained evidence includes separate API/publisher processes,
473
+ real HTTP/SSE, namespace isolation, outage, restart/resync, offline revocation and
474
+ physical unsubscribe. This does not turn WebSocket broadcasting into a cluster.
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.582",
5
+ "version": "0.75.584",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.582",
5
+ "version": "0.75.584",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -45,14 +45,14 @@
45
45
  "dependencies": {
46
46
  "@iconify-json/f7": "^1.2.2",
47
47
  "@iconify-json/hugeicons": "^1.2.35",
48
- "@stacksjs/mobile": "0.75.582",
48
+ "@stacksjs/mobile": "0.75.584",
49
49
  "@stacksjs/sanitizer": "^0.2.872",
50
50
  "@stacksjs/stx": "^0.2.872",
51
- "@stacksjs/strings": "0.75.582",
51
+ "@stacksjs/strings": "0.75.584",
52
52
  "@xterm/addon-fit": "^0.11.0",
53
53
  "@xterm/xterm": "^6.0.0",
54
54
  "ts-qr-codes": "^0.1.8",
55
- "@stacksjs/support": "0.75.582",
56
- "@stacksjs/browser": "0.75.582"
55
+ "@stacksjs/support": "0.75.584",
56
+ "@stacksjs/browser": "0.75.584"
57
57
  }
58
58
  }