@shuind/dsh-codex-harness 0.1.16 → 0.1.18

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.18
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 active model phase from the existing conversation snapshot. */
416
+ function awaitingModelStartedAt(snapshot) {
417
+ if (!snapshot.running || 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 !== void 0 ? 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;
@@ -682,8 +697,8 @@ window.__ModuleLoader__.load({
682
697
  locale: NS,
683
698
  inject: injected
684
699
  }, ContextSizeControl));
685
- ctx.slots.inject("conversation.input.dock", () => ctx.slots.register({
686
- name: "conversation.input.dock",
700
+ ctx.slots.inject("conversation.composer.dock", () => ctx.slots.register({
701
+ name: "conversation.composer.dock",
687
702
  id: "codex-activity",
688
703
  order: 5,
689
704
  locale: NS
package/lib/index.js CHANGED
@@ -792,7 +792,7 @@ function applyCodexActivity(state, event) {
792
792
  startedAt: event.time
793
793
  };
794
794
  if (event.type === "turn/start" || event.type === "turn/end" || event.type === "compaction/end") return null;
795
- if (state?.activity === "awaiting-model" && (event.type === "llm/retry" || event.type === "assistant/chunk" || event.type === "assistant/message" || event.type === "step/end")) return null;
795
+ if (state?.activity === "awaiting-model" && (event.type === "llm/retry" || event.type === "tool/call" || event.type === "step/end")) return null;
796
796
  return state;
797
797
  }
798
798
  const codexActivityProjection = {
@@ -21,10 +21,12 @@ export function applyCodexActivity(state, event) {
21
21
  }
22
22
  if (event.type === 'turn/start' || event.type === 'turn/end' || event.type === 'compaction/end')
23
23
  return null;
24
+ // Keep the line through reasoning and streamed output. It is the only
25
+ // visible indication that the model is still progressing; tool cards have
26
+ // their own status, so a tool dispatch retires this ambient line.
24
27
  if (state?.activity === 'awaiting-model'
25
28
  && (event.type === 'llm/retry'
26
- || event.type === 'assistant/chunk'
27
- || event.type === 'assistant/message'
29
+ || event.type === 'tool/call'
28
30
  || event.type === 'step/end'))
29
31
  return null;
30
32
  return state;
@@ -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 active model 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 active model phase from the existing conversation snapshot. */
3
+ export function awaitingModelStartedAt(snapshot) {
4
+ if (!snapshot.running || 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
@@ -32,8 +32,8 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
32
32
  };
33
33
  }
34
34
  }
35
- type ActivityProps = PropsRuntime<'conversation.input.dock'> & PropsLocale<'codex'>;
36
- export declare function ActivityLine({ sessionId, useSessions, useProjection, t }: ActivityProps): import("react").JSX.Element | null;
35
+ type ActivityProps = PropsRuntime<'conversation.composer.dock'> & PropsLocale<'codex'>;
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,20 @@ 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
+ // `undefined` means the key has not arrived yet; `null` is an authoritative
106
+ // clear and must not be resurrected by the local snapshot fallback.
107
+ const activity = projectedActivity !== undefined ? projectedActivity : (agentPreset === CODEX_PRESET_ID && fallbackStartedAt !== undefined
108
+ ? { activity: 'awaiting-model', startedAt: fallbackStartedAt }
109
+ : null);
100
110
  const [now, setNow] = useState(() => Date.now());
101
111
  useEffect(() => {
102
112
  if (agentPreset !== CODEX_PRESET_ID || activity === undefined || activity === null)
@@ -151,8 +161,8 @@ export function apply(ctx) {
151
161
  locale: NS,
152
162
  inject: injected,
153
163
  }, ContextSizeControl));
154
- ctx.slots.inject('conversation.input.dock', () => ctx.slots.register({
155
- name: 'conversation.input.dock',
164
+ ctx.slots.inject('conversation.composer.dock', () => ctx.slots.register({
165
+ name: 'conversation.composer.dock',
156
166
  id: 'codex-activity',
157
167
  order: 5,
158
168
  locale: NS,
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.18",
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",