@shuind/dsh-codex-harness 0.1.16 → 0.1.17

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/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  ## 安装
16
16
 
17
17
  ```sh
18
- dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.15
18
+ dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.17
19
19
  ```
20
20
 
21
21
  重启 Web,创建新会话,在模式菜单中选择 **Codex 模式**。
package/lib/client.js CHANGED
@@ -410,6 +410,16 @@ window.__ModuleLoader__.load({
410
410
  const CODEX_CONTEXT_UNIT = 1e3;
411
411
  const CODEX_CONTEXT_MAX = 1e6;
412
412
  //#endregion
413
+ //#region lib/types/client/activity.js
414
+ /** Client-only inference used while the host activity projection frame is in flight. */
415
+ /** Infer the model-wait phase from the existing conversation snapshot. */
416
+ function awaitingModelStartedAt(snapshot) {
417
+ if (!snapshot.running || snapshot.partial !== null || snapshot.runningCalls.length > 0) return void 0;
418
+ let latest;
419
+ for (const timing of snapshot.turnTimings.values()) if (timing.endTime === void 0) latest = timing.startTime;
420
+ return latest;
421
+ }
422
+ //#endregion
413
423
  //#region lib/types/client/index.js
414
424
  /** Browser controls for the Codex request settings mounted by the Host plugin. */
415
425
  const NS = "codex";
@@ -600,9 +610,14 @@ window.__ModuleLoader__.load({
600
610
  function elapsedSeconds(startedAt, now) {
601
611
  return Math.max(0, Math.floor((now - startedAt) / 1e3));
602
612
  }
603
- function ActivityLine({ sessionId, useSessions, useProjection, t }) {
613
+ function ActivityLine({ sessionId, useSession, useSessions, useProjection, t }) {
604
614
  const agentPreset = useSessions((state) => state.byId[sessionId]?.agentPreset);
605
- const activity = useProjection("codexActivity");
615
+ const projectedActivity = useProjection("codexActivity");
616
+ const fallbackStartedAt = useSession((snapshot) => awaitingModelStartedAt(snapshot));
617
+ const activity = projectedActivity ?? (agentPreset === "codex" && fallbackStartedAt !== void 0 ? {
618
+ activity: "awaiting-model",
619
+ startedAt: fallbackStartedAt
620
+ } : null);
606
621
  const [now, setNow] = (0, import_react.useState)(() => Date.now());
607
622
  (0, import_react.useEffect)(() => {
608
623
  if (agentPreset !== "codex" || activity === void 0 || activity === null) return void 0;
@@ -0,0 +1,6 @@
1
+ /** Client-only inference used while the host activity projection frame is in flight. */
2
+ import type { ConversationSnapshot } from '@deepseek-ai/dsh-client-runtime/client';
3
+ export type ActivitySessionSnapshot = Pick<ConversationSnapshot, 'running' | 'partial' | 'runningCalls' | 'turnTimings'>;
4
+ /** Infer the model-wait phase from the existing conversation snapshot. */
5
+ export declare function awaitingModelStartedAt(snapshot: ActivitySessionSnapshot): number | undefined;
6
+ //# sourceMappingURL=activity.d.ts.map
@@ -0,0 +1,13 @@
1
+ /** Client-only inference used while the host activity projection frame is in flight. */
2
+ /** Infer the model-wait phase from the existing conversation snapshot. */
3
+ export function awaitingModelStartedAt(snapshot) {
4
+ if (!snapshot.running || snapshot.partial !== null || snapshot.runningCalls.length > 0)
5
+ return undefined;
6
+ let latest;
7
+ for (const timing of snapshot.turnTimings.values()) {
8
+ if (timing.endTime === undefined)
9
+ latest = timing.startTime;
10
+ }
11
+ return latest;
12
+ }
13
+ //# sourceMappingURL=activity.js.map
@@ -33,7 +33,7 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
33
33
  }
34
34
  }
35
35
  type ActivityProps = PropsRuntime<'conversation.input.dock'> & PropsLocale<'codex'>;
36
- export declare function ActivityLine({ sessionId, useSessions, useProjection, t }: ActivityProps): import("react").JSX.Element | null;
36
+ export declare function ActivityLine({ sessionId, useSession, useSessions, useProjection, t }: ActivityProps): import("react").JSX.Element | null;
37
37
  export declare const inject: string[];
38
38
  /** Mount Fast inside the model selector and context size inside the meter panel. */
39
39
  export declare function apply(ctx: Context): void;
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /** Browser controls for the Codex request settings mounted by the Host plugin. */
3
3
  import { useEffect, useState } from 'react';
4
4
  import { CODEX_CONTEXT_MAX, CODEX_CONTEXT_UNIT, CODEX_PRESET_ID } from "../context.js";
5
+ import { awaitingModelStartedAt } from "./activity.js";
5
6
  const NS = 'codex';
6
7
  const SETTINGS_NAMESPACE = 'codex';
7
8
  const en = {
@@ -92,11 +93,18 @@ function ContextSizeControl({ contextWindow, useSettings, setSetting, unsetSetti
92
93
  function elapsedSeconds(startedAt, now) {
93
94
  return Math.max(0, Math.floor((now - startedAt) / 1_000));
94
95
  }
95
- export function ActivityLine({ sessionId, useSessions, useProjection, t }) {
96
+ export function ActivityLine({ sessionId, useSession, useSessions, useProjection, t }) {
96
97
  const agentPreset = useSessions(state => state.byId[sessionId]?.agentPreset);
97
98
  // Keep the projection seam optional: this package must still load when the
98
99
  // host has no session-projection registry or has not carried this key.
99
- const activity = useProjection('codexActivity');
100
+ const projectedActivity = useProjection('codexActivity');
101
+ // The projection is the authoritative clock. The session snapshot fallback
102
+ // only covers the short wire gap before the next projection frame arrives;
103
+ // running tool calls and streamed output intentionally remain silent.
104
+ const fallbackStartedAt = useSession((snapshot) => awaitingModelStartedAt(snapshot));
105
+ const activity = projectedActivity ?? (agentPreset === CODEX_PRESET_ID && fallbackStartedAt !== undefined
106
+ ? { activity: 'awaiting-model', startedAt: fallbackStartedAt }
107
+ : null);
100
108
  const [now, setNow] = useState(() => Date.now());
101
109
  useEffect(() => {
102
110
  if (agentPreset !== CODEX_PRESET_ID || activity === undefined || activity === null)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shuind/dsh-codex-harness",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "A minimal Codex harness for GPT models that do not fit DSH's native interface, while remaining compatible with the DSH plugin ecosystem.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",