Skip to content

TUI: move PasClaw.Providers.Models to interface uses so dcc64 sees it - #174

Merged
FMXExpress merged 1 commit into
mainfrom
claude/tui-slash-model-delphi-fix
Jun 7, 2026
Merged

FMXExpress merged 1 commit into
mainfrom
claude/tui-slash-model-delphi-fix

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Summary

Stacks on top of PR #173. Fixes two Delphi (dcc64) errors that surfaced when building the /model TUI overlay:

PasClaw.TUI.pas(91): E2003 Undeclared identifier: 'TModelInfoArray'
MVCFramework.Console.pas(166): F2063 Could not compile used unit 'LoggerPro.AnsiColors.pas'

FModelMenuModels: TModelInfoArray is declared inside the TTUI class in the interface section. Delphi requires every type named in an interface-section class declaration to be visible from the interface's uses clause — the implementation uses isn't enough. FPC's mode delphi was permissive about this so make was green; dcc64 is strict and rejects it.

Fix: move PasClaw.Providers.Models from the implementation uses to the interface uses, with a comment explaining why it has to live there.

The F2063 Could not compile on LoggerPro.AnsiColors cascades from the same root — once dcc64 fails the TUI unit, the units downstream of it in the compilation queue report fatal "could not compile" diagnostics. Fixing the interface-visibility error clears both.

Test plan

  • make clean rebuild succeeds (FPC, mode Delphi) — verifies the shuffled uses clauses don't break the FPC path either
  • make test — all suites pass (smoke, hashline, toolview, server-tools, printer, utf8, schema-strip, markdown, json-utf8, model_discovery)
  • dcc64 / Delphi clean build of PasClaw.dproj — confirm both E2003 and F2063 are gone
  • /model overlay still opens and switches models inside the Delphi build of pasclaw tui

Stacking note

This PR is based on claude/tui-slash-model (PR #173), so it includes the /model slash-command commits as well. Merging this alone delivers both the feature and the Delphi build fix; merging PR #173 first would shrink this PR to the one-commit uses-clause delta.


Generated by Claude Code

dcc64 reported:

  PasClaw.TUI.pas(91): E2003 Undeclared identifier: 'TModelInfoArray'
  MVCFramework.Console.pas(166): F2063 Could not compile used unit
                                       'LoggerPro.AnsiColors.pas'

FModelMenuModels is declared as TModelInfoArray inside the TTUI class
in the interface section. Delphi requires every type named there to
be visible from the interface's uses clause — the implementation
uses isn't enough. FPC was permissive about this and built fine; the
fix is just to move PasClaw.Providers.Models into interface uses.

The F2063 LoggerPro.AnsiColors error cascades from the same root —
once dcc64 fails the TUI unit, units downstream of it report fatal
"could not compile" for whatever was next in line. Fixing the
interface-visibility error clears both diagnostics.
@FMXExpress
FMXExpress merged commit 89f4b65 into main Jun 7, 2026
khongten001 pushed a commit to khongten001/PasClaw that referenced this pull request Jul 13, 2026
  E2003 PasClaw.TUI.pas(144) -- TToolLoopResult undeclared. Same
  fix shape as PR FMXExpress#174's TModelInfoArray: AccumulateLoopStats is
  declared in the TTUI interface section's class body, so dcc64
  needs PasClaw.Tools.ToolLoop visible from the interface uses,
  not just the implementation. Moved it up; left a one-line
  comment in the impl uses pointing back.

  H2077 dead writes -- "value assigned to X never used":
    - PasClaw.Channels.LINE.pas:377 (`Root := nil`)
    - PasClaw.Channels.WhatsApp.pas:384 (`Root := nil`)
    - PasClaw.Channels.Matrix.pas:427 (`Root := nil`)
      Pre-try defensive init for TJsonObject.Parse. The except
      branch always Exits, so the nil value is never read --
      Parse either assigns Root or we leave via except.
    - PasClaw.MCP.Hub.pas:373 (`Result := False`)
      Both function exits (hub success / builtin fallback) set
      Result := True before returning. The initial False can't
      survive to a read.
    - PasClaw.Cmd.Skills.pas:364 (`ClawNotFound := False`)
      Unconditionally reassigned via SameText(...) before the
      first read.
    - PasClaw.Gateway.Server.pas:1676 (`StreamClosed := Streamer.Closed`)
      `raise;` below unwinds the stack; the assignment is never
      read by anything in this method or its callers.

  H2219 unused private symbol:
    - PasClaw.Gateway.Server.pas:105 (`WriteSSE`). Streaming
      paths use TSSEStreamer + TLogStreamWriter.WriteSSE (a
      different class). The TGatewayServer copy was never wired
      up. Removed both declaration and implementation.

  W1036 maybe-uninitialized var:
    - PasClaw.Gateway.Server.pas:580 (`if i = 0 then;`).
      HandleMemoryRead declared a stray `i: Integer;` and the
      "silence unused-var" hack at the end read it without
      assignment. Removed both the decl and the hack.

  W1050 WideChar narrowed to byte in set:
    - PasClaw.Channels.Email.pas:168. Replaced the bare
      `Ch in ['s', 'm', ...]` with CharInSet(Ch, ['s', 'm', ...]).
      Same semantics on UnicodeString (default in dcc64);
      CharInSet handles the implicit narrowing safely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants