@shuind/dsh-codex-harness 0.2.12 → 0.2.13

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/lib/client.js CHANGED
@@ -82,21 +82,23 @@ window.__ModuleLoader__.load({
82
82
  }
83
83
  /** Infer the request-phase clock from the existing conversation snapshot. */
84
84
  function awaitingModelStartedAt(snapshot) {
85
- if (!snapshot.running || snapshot.runningCalls.length > 0) return void 0;
85
+ if (!snapshot.running || (snapshot.runningCalls?.length ?? 0) > 0) return void 0;
86
+ if (snapshot.turnTimings === void 0) return void 0;
86
87
  let latest;
87
88
  for (const timing of snapshot.turnTimings.values()) if (timing.endTime === void 0) latest = timing.startTime;
88
89
  return latest;
89
90
  }
90
91
  /** Infer the first non-empty model token timestamp from the current snapshot. */
91
92
  function modelReplyStartedAt(snapshot) {
92
- if (!snapshot.running || snapshot.runningCalls.length > 0) return void 0;
93
+ if (!snapshot.running || (snapshot.runningCalls?.length ?? 0) > 0) return void 0;
94
+ if (snapshot.turnTimings === void 0) return void 0;
93
95
  let openTurn;
94
96
  for (const [turn, timing] of snapshot.turnTimings) if (timing.endTime === void 0) openTurn = {
95
97
  turn,
96
98
  startTime: timing.startTime
97
99
  };
98
100
  if (openTurn === void 0) return void 0;
99
- if (snapshot.partial !== null && snapshot.partial.turn === openTurn.turn) {
101
+ if (snapshot.partial !== void 0 && snapshot.partial !== null && snapshot.partial.turn === openTurn.turn) {
100
102
  const partialReplyStartedAt = snapshot.partial.replyStartedAt;
101
103
  if (partialReplyStartedAt !== void 0) return partialReplyStartedAt;
102
104
  }
@@ -1,6 +1,10 @@
1
1
  /** Client-only inference used while the host activity projection frame is in flight. */
2
2
  import type { ConversationSnapshot } from '@deepseek-ai/dsh-client-runtime/client';
3
- export type ActivitySessionSnapshot = Pick<ConversationSnapshot, 'running' | 'partial' | 'runningCalls' | 'turnTimings'> & {
3
+ export type ActivitySessionSnapshot = Pick<ConversationSnapshot, 'running'> & {
4
+ /** Optional because older/newer hosts can publish the shell snapshot before the chat slice. */
5
+ readonly partial?: ConversationSnapshot['partial'];
6
+ readonly runningCalls?: ConversationSnapshot['runningCalls'];
7
+ readonly turnTimings?: ConversationSnapshot['turnTimings'];
4
8
  /** Optional for hosts that predate the assembled Chat snapshot. */
5
9
  readonly chat?: ConversationSnapshot['chat'];
6
10
  };
@@ -5,7 +5,9 @@ export function sameModelActivity(left, right) {
5
5
  }
6
6
  /** Infer the request-phase clock from the existing conversation snapshot. */
7
7
  export function awaitingModelStartedAt(snapshot) {
8
- if (!snapshot.running || snapshot.runningCalls.length > 0)
8
+ if (!snapshot.running || (snapshot.runningCalls?.length ?? 0) > 0)
9
+ return undefined;
10
+ if (snapshot.turnTimings === undefined)
9
11
  return undefined;
10
12
  let latest;
11
13
  for (const timing of snapshot.turnTimings.values()) {
@@ -16,7 +18,9 @@ export function awaitingModelStartedAt(snapshot) {
16
18
  }
17
19
  /** Infer the first non-empty model token timestamp from the current snapshot. */
18
20
  export function modelReplyStartedAt(snapshot) {
19
- if (!snapshot.running || snapshot.runningCalls.length > 0)
21
+ if (!snapshot.running || (snapshot.runningCalls?.length ?? 0) > 0)
22
+ return undefined;
23
+ if (snapshot.turnTimings === undefined)
20
24
  return undefined;
21
25
  let openTurn;
22
26
  for (const [turn, timing] of snapshot.turnTimings) {
@@ -25,7 +29,7 @@ export function modelReplyStartedAt(snapshot) {
25
29
  }
26
30
  if (openTurn === undefined)
27
31
  return undefined;
28
- if (snapshot.partial !== null && snapshot.partial.turn === openTurn.turn) {
32
+ if (snapshot.partial !== undefined && snapshot.partial !== null && snapshot.partial.turn === openTurn.turn) {
29
33
  const partialReplyStartedAt = snapshot.partial.replyStartedAt;
30
34
  if (partialReplyStartedAt !== undefined)
31
35
  return partialReplyStartedAt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shuind/dsh-codex-harness",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "Codex coding preset with customizable prompts and tools for DSH.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",