Skip to content

Register PasClaw.Markdown.Render in PasClaw.dproj (dcc64 F2613 fix) - #156

Merged
FMXExpress merged 1 commit into
mainfrom
claude/markdown-render-dproj
Jun 6, 2026
Merged

FMXExpress merged 1 commit into
mainfrom
claude/markdown-render-dproj

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

TL;DR

dcc64 reports after PR #155 merge:

[dcc64 Fatal Error] PasClaw.Cmd.Agent.pas(50): F2613 Unit
'PasClaw.Markdown.Render' not found.

PR #155 added the new unit dir to the Makefile's UNIT_DIRS (for FPC) but didn't update src/pasclaw/PasClaw.dproj (for Delphi). The .dproj has its own list — DCC_UnitSearchPath plus an explicit DCCReference per .pas — and adds don't auto-sync from the Makefile side.

Fix

Two edits in src/pasclaw/PasClaw.dproj:

  1. DCC_UnitSearchPath gains ..\pkg\markdown so dcc64 finds the directory on the unit search path (mirror of the Makefile's UNIT_DIRS += src/pkg/markdown).
  2. DCCReference added for ..\pkg\markdown\PasClaw.Markdown.Render.pas alongside the other pkg/* entries so the unit is part of the project (and gets a build slot in the IDE).

No source changes. FPC build still clean (make smoke passes).

Process gap on my end

Every time I add a new unit directory I update Makefile but consistently forget the .dproj. Suggested follow-up: a make check-dproj target that diffs the .pas files under src/cmd + src/pkg/** against the DCCReference list, fails if any are missing. Would have caught this. Want me to add that in a separate PR?

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon


Generated by Claude Code

dcc64 reports:
  [dcc64 Fatal Error] PasClaw.Cmd.Agent.pas(50): F2613 Unit
  'PasClaw.Markdown.Render' not found.

The Makefile's UNIT_DIRS list got updated for FPC but the Delphi
project file didn't. .dproj has its own list — DCC_UnitSearchPath
plus an explicit DCCReference per .pas — and adds aren't
automatically synced from the Makefile side.

Two edits in PasClaw.dproj:

  1. DCC_UnitSearchPath gains \`..\\pkg\\markdown\` so dcc64 finds
     the directory on the search path (mirror of the Makefile's
     UNIT_DIRS += src/pkg/markdown).

  2. DCCReference Include="..\\pkg\\markdown\\PasClaw.Markdown.Render.pas"
     added alongside the other pkg/* entries so the unit is part
     of the project (and gets a build slot in the IDE).

No source changes. FPC build still clean.
@FMXExpress
FMXExpress merged commit 8211b8d into main Jun 6, 2026
khongten001 pushed a commit to khongten001/PasClaw that referenced this pull request Jul 13, 2026
…+ localvector + Cmd.Memory

dcc64 F2613 on PR FMXExpress#166:
  PasClaw.Cmd.Memory.pas(49): Unit 'LocalVector.Models' not found.

Same shape as PR FMXExpress#156's miss after PR FMXExpress#155 — the FPC Makefile got the
new unit dirs but the Delphi .dproj didn't. PR FMXExpress#165 added the in-tree
localvector port under src/pkg/memory/localvector/ + the new
PasClaw.Memory.Vector adapter; PR FMXExpress#166 added src/cmd/PasClaw.Cmd.Memory.pas.
Neither was wired into PasClaw.dproj, so the Delphi build can't resolve
LocalVector.Models / LocalVector.VectorStore / LocalVector.OrtProvision /
LocalVector.VecProvision / LocalVector.Downloader / etc.

Edits:

  DCC_UnitSearchPath
    Added `..\pkg\memory\localvector` (right after `..\pkg\memory` to
    keep the source-tree shape readable).

  DCCReference — pkg/memory
    Added `..\pkg\memory\PasClaw.Memory.Vector.pas` (PR FMXExpress#165 new file).
    Added all 13 in-tree localvector files under a fresh
    `pkg/memory/localvector` comment block:
      LocalVector.Models.pas
      LocalVector.Runtime.pas
      LocalVector.Sqlite3.pas
      LocalVector.Tokenizer.pas
      LocalVector.Embedder.pas
      LocalVector.VectorStore.pas
      LocalVector.VectorStore.Sqlite.pas
      LocalVector.VectorStore.FireDAC.pas
      LocalVector.Downloader.pas
      LocalVector.OrtProvision.pas
      LocalVector.VecProvision.pas
      onnxruntime.pas
      onnxruntime_pas_api.pas

  DCCReference — cmd
    Added `..\cmd\PasClaw.Cmd.Memory.pas` (PR FMXExpress#166 new file). Slotted
    next to PasClaw.Cmd.Membench.pas, matching the .pas filename
    ordering already present in this block.

Stacks on PR FMXExpress#166 (which stacks on PR FMXExpress#165). Lands after both;
merge order FMXExpress#165 → FMXExpress#166 → this.
khongten001 pushed a commit to khongten001/PasClaw that referenced this pull request Jul 13, 2026
Lifts the "use the provider's /models endpoint" idea from
UltraCode-Shim's Auto Router (and the carry-over from PR FMXExpress#163's
followup question) into a complete loop: discover, cache, surface
in onboarding.

New unit: src/pkg/providers/PasClaw.Providers.Models.pas

  Three family parsers driven off TProviderSpec.Family:

    pfOpenAI     GET <base>/v1/models, Bearer auth (or asNone for
                 Ollama / vLLM / LM Studio). Parses `data[].id` +
                 `data[].created`. Used by 14 catalog rows that share
                 the OpenAI-compatible /v1/models shape — openrouter,
                 groq, deepseek, mistral, xai, qwen, zhipu, cerebras,
                 moonshot, ollama, vllm, lmstudio, litellm, openai.

    pfAnthropic  GET <base>/v1/models, x-api-key + anthropic-version
                 headers. Parses `data[].id` + `display_name` + ISO
                 `created_at`.

    pfGemini     GET <base>/v1beta/models, x-goog-api-key header.
                 Strips the "models/" namespace prefix from each
                 `name`, filters out rows that don't list
                 "generateContent" in supportedGenerationMethods
                 (embedders and counters live there too and would
                 404 the chat path).

  Cache at $PASCLAW_HOME/cache/models/<provider>.json with a
  fetched_at unix timestamp. JoinPath built up segment-by-segment
  so PathDelim insertion stays consistent on Windows (PR FMXExpress#169 trap).

  Discovery never raises; failure modes return Ok=False with a
  human-readable ErrMsg the caller surfaces verbatim. Empty result
  is Ok=True with Length=0 (the operator's call whether to retry).

New subcommands: src/cmd/PasClaw.Cmd.Model.pas

    pasclaw model refresh <provider>     hit /v1/models, save cache
    pasclaw model refresh --all          refresh every configured row
    pasclaw model list <provider>        show cached roster + age

  `pasclaw model show` now adds a cache-freshness annotation for the
  default provider — "models cached: 47 (refreshed 3 days ago)" or
  the gentle nudge "(none — run `pasclaw model refresh anthropic`
  to populate)" when no cache exists yet.

Onboarding picker: src/cmd/PasClaw.Cmd.Onboard.pas

  Flipped the order: now prompts for the API key BEFORE the model,
  so the key is available for the /v1/models fetch. Live fetch is
  bounded at 8s — onboarding is interactive, a slow provider status
  page shouldn't make the user wait 30s. On success: numbered
  picker over the top 12 newest models (sorted by created_at desc),
  with the option to type a free-form id or hit Enter for the
  catalog default. On failure: falls back to the existing text
  prompt verbatim so a broken /v1/models never blocks first-time
  setup.

  Both the full result AND a sort-truncated view get cached, so
  `pasclaw model list <provider>` later shows the whole roster
  even though the onboarding picker only displayed the top 12.

New test: src/tests/model_discovery_tests.pas

  Covers the cache schema contract (Save → Load round-trip preserves
  every field), missing-cache fallback (LoadCachedModels returns
  False, NOT True-with-empty-array), HumanAge bucket boundaries
  (minutes / hours / days / over-a-year cap), and case-insensitive
  ModelCachePath canonicalisation. Wired into `make test` as
  test-model-discovery.

Updated:
  - src/pasclaw/PasClaw.dproj: registers PasClaw.Providers.Models
    so the Delphi build resolves it too (PR FMXExpress#156 / FMXExpress#167 pattern).
  - README.md: maintenance section adds `model refresh` / `model list`
    examples + explains the onboarding picker behaviour.
  - Makefile: adds test-model-discovery target and rolls it into the
    composite `test:` target.

Verified end-to-end on Linux/FPC:

  $ pasclaw model show
    default provider: anthropic
    default model:    claude-opus-4-7
    models cached:    (none — run `pasclaw model refresh anthropic` to populate)

  $ pasclaw model refresh anthropic        # without a real key
      · fetching /models from Anthropic ...
      ✗ anthropic: API key required for Anthropic /models endpoint

  $ # synthesised cache file → list works:
  $ pasclaw model list openai
    openai (3 cached, refreshed over a year ago)
      · gpt-4o   (GPT-4o)
      · gpt-4o-mini   (GPT-4o Mini)
      · gpt-5   (GPT-5)

  $ make test
    ... all 11 test suites green including model_discovery_tests: OK

Live-HTTP verification against real Anthropic / OpenAI / Gemini /
xAI keys hasn't run in this environment (no real keys), but the
parser tests cover the JSON shapes documented in each provider's
current API reference.
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