@fungi.computer/parakeet 0.6.1 → 0.7.0

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.
@@ -110,6 +110,8 @@ function sameExtensionSlots(next, current) {
110
110
  }
111
111
  /** Apply one already-decoded Shiitake frame to its authoritative projection. */
112
112
  export function applySessionFrame(current, frame) {
113
+ if (frame.kind === "heartbeat")
114
+ return current;
113
115
  if (frame.kind === "reset")
114
116
  return {
115
117
  ...frame.baseline,
@@ -1,6 +1,8 @@
1
1
  import { experimental_streamedQuery, infiniteQueryOptions, queryOptions, QueryObserver, } from "@tanstack/react-query";
2
2
  import { applySessionFrame } from "./session-projection.js";
3
3
  import { reportFailure } from "../lib/failure.js";
4
+ import * as Stream from "effect/Stream";
5
+ import { sessionSilenceDeadlineMs } from "@fungi.computer/shiitake/client";
4
6
  const emptyProjection = Object.freeze({
5
7
  observation: "connecting",
6
8
  snapshot: undefined,
@@ -54,7 +56,11 @@ async function* observeSession(session, signal) {
54
56
  return;
55
57
  let snapshot = watch.snapshot;
56
58
  yield { kind: "snapshot", value: snapshot };
57
- for await (const frame of watch.changes) {
59
+ const frames = Stream.fromAsyncIterable(watch.changes, (cause) => cause).pipe(Stream.timeoutOrElse({
60
+ duration: sessionSilenceDeadlineMs,
61
+ orElse: () => Stream.fail(new Error("Session feed is connected but silent; the service may be busy")),
62
+ }), Stream.toAsyncIterable);
63
+ for await (const frame of frames) {
58
64
  snapshot = applySessionFrame(snapshot, frame);
59
65
  if (snapshot.messages.length > LIVE_HISTORY_REFRESH_AT) {
60
66
  snapshot = await session.read({ limit: LIVE_HISTORY_LIMIT });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/parakeet",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "private": false,
6
6
  "description": "Standalone React composer for a typed Shiitake Session",
@@ -61,9 +61,9 @@
61
61
  "@fungi.computer/cairn": "0.1.0",
62
62
  "@fungi.computer/caps": "0.6.0",
63
63
  "@fungi.computer/gills": "0.2.0",
64
- "@fungi.computer/knapsack": "0.4.2",
65
- "@fungi.computer/shiitake": "0.8.0",
66
- "@fungi.computer/sigils": "0.2.1",
64
+ "@fungi.computer/knapsack": "0.4.3",
65
+ "@fungi.computer/shiitake": "0.9.0",
66
+ "@fungi.computer/sigils": "0.3.0",
67
67
  "@fungi.computer/sprite": "0.2.0",
68
68
  "@fungi.computer/sprite-zdog": "0.3.0",
69
69
  "@fungi.computer/whistle": "0.3.0",