Narrow daemon health mode type in TUI sync #6845

Closed
opened 2026-02-16 18:05:25 -05:00 by yindo · 1 comment
Owner

Originally created by @adolago on GitHub (Jan 19, 2026).

Originally assigned to: @rekram1-node on GitHub.

Problem

normalizeDaemonHealth returns mode as string | undefined, which is incompatible with the store type "source" | "binary" | undefined and fails typecheck.

Proposed fix

  • Add a type guard (or cast) so mode is narrowed to "source" | "binary" when the value matches.
  • Keep the existing fallback to undefined for unknown values.

Acceptance criteria

  • Typecheck passes without TS2345 in packages/agent-core/src/cli/cmd/tui/context/sync.tsx.
  • daemon.mode remains "source" or "binary" when returned by the API.

Test plan

  • bun run typecheck
Originally created by @adolago on GitHub (Jan 19, 2026). Originally assigned to: @rekram1-node on GitHub. ## Problem `normalizeDaemonHealth` returns `mode` as `string | undefined`, which is incompatible with the store type `"source" | "binary" | undefined` and fails typecheck. ## Proposed fix - Add a type guard (or cast) so `mode` is narrowed to `"source" | "binary"` when the value matches. - Keep the existing fallback to `undefined` for unknown values. ## Acceptance criteria - Typecheck passes without TS2345 in `packages/agent-core/src/cli/cmd/tui/context/sync.tsx`. - `daemon.mode` remains `"source"` or `"binary"` when returned by the API. ## Test plan - `bun run typecheck`
yindo added the opentui label 2026-02-16 18:05:25 -05:00
yindo closed this issue 2026-02-16 18:05:25 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 19, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #9169: Typecheck failures in packages/opencode - mentions similar type narrowing issues with tracker.mode and other string/union type mismatches

Feel free to ignore if this doesn't address your specific case.

@github-actions[bot] commented on GitHub (Jan 19, 2026): This issue might be a duplicate of existing issues. Please check: - #9169: Typecheck failures in packages/opencode - mentions similar type narrowing issues with tracker.mode and other string/union type mismatches Feel free to ignore if this doesn't address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6845