@ccmsg/protocol 2.0.0 → 2.0.1

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": "@ccmsg/protocol",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Wire contract (schema + types + op attribute table) shared by the ccmsg daemon and web UI",
5
5
  "license": "MIT",
6
6
  "author": "kawaz",
@@ -40,8 +40,9 @@ export type SessionRun = Static<typeof SessionRun>;
40
40
  * whether anything it says can still be trusted. */
41
41
  export const SessionStatusStanding = Type.Union(
42
42
  [
43
- /** No transcript, so there is nothing to fold. A session that has just
44
- * started stands here until the harness writes its first record. */
43
+ /** Nothing is folded: there is no transcript yet (a session that has just
44
+ * started stands here until the harness writes its first record), or this
45
+ * instance holds no fold of it because nothing has asked for one. */
45
46
  Type.Literal("absent"),
46
47
  /** The transcript is being read from the top; what the fold says so far is
47
48
  * incomplete. */
@@ -236,10 +237,16 @@ export function liveness(
236
237
  now: number,
237
238
  ): Liveness {
238
239
  if (row.runs.length >= 2) return "duplicated";
239
- const running =
240
- (row.runs.length > 0 && row.stopped_at === undefined) ||
241
- (row.gateway_active_at !== undefined && now - row.gateway_active_at <= GATEWAY_LIVE_WINDOW_MS);
242
- if (running) return "alive";
240
+ if (row.runs.length === 1) return "alive";
241
+ // No run is seen, so the declaration and the gateway are all there is to go
242
+ // on: inference still running for it is a session that is alive somewhere
243
+ // this instance cannot see the process of.
244
+ if (
245
+ row.gateway_active_at !== undefined &&
246
+ now - row.gateway_active_at <= GATEWAY_LIVE_WINDOW_MS
247
+ ) {
248
+ return "alive";
249
+ }
243
250
  return row.stopped_at === undefined ? "disappeared" : "paused";
244
251
  }
245
252