You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove the 4 external @mariozechner/pi-* npm packages, all dead model management infrastructure, and cascade-update ~35 callers that use dead in-process model resolution patterns. These packages powered OpenClaw's in-process LLM execution engine, which has been replaced by RemoteClaw's CLI subprocess architecture (Claude, Gemini, Codex, OpenCode runtimes). Model selection, auth, and context windows are now handled by the CLI agents themselves.
Previous PRs (#63–#94) deleted the execution engine and most importing files. This PR removes the packages themselves plus ~60 dead files, and cascade-updates ~35 caller files that still reference the dead model management layer. These callers were written for OpenClaw's in-process execution model and use patterns (model resolution, context window lookup, fallback orchestration) that don't exist in RemoteClaw — ChannelBridge (the live execution path) has zero model management imports, confirming the architecture.
Simplify model selection to config-based runtime lookup
Live Utility Extraction
Before deleting core files, extract functions with genuine live callers:
normalizeProviderId() (from model-selection.ts) → extract to src/agents/provider-utils.ts or inline (trivial: lowercase + trim; used by plugin-auto-enable, auth-profiles)
resolveApiKeyForProvider() (from model-auth.ts) → already simplified by feat: gut centralized OAuth and auth profiles #92; keep in surviving auth infrastructure for media-understanding and onboarding
ModelRef type / parseModelRef() → keep minimal type if needed for config parsing
Surviving pi-* Import Sites
After all deletions and cascade updates, remaining files with @mariozechner/pi-* imports need import removal or replacement with local type stubs. The goal is zero @mariozechner/pi-* imports so the 4 packages can be removed from package.json.
Verification
4 @mariozechner/pi-* packages removed from package.json
All dead files listed above are deleted
~35 callers cascade-updated to remove dead model management patterns
Live utilities extracted (normalizeProviderId, resolveApiKeyForProvider)
Zero from "@mariozechner/pi- imports remain in src/
Summary
Remove the 4 external
@mariozechner/pi-*npm packages, all dead model management infrastructure, and cascade-update ~35 callers that use dead in-process model resolution patterns. These packages powered OpenClaw's in-process LLM execution engine, which has been replaced by RemoteClaw's CLI subprocess architecture (Claude, Gemini, Codex, OpenCode runtimes). Model selection, auth, and context windows are now handled by the CLI agents themselves.Previous PRs (#63–#94) deleted the execution engine and most importing files. This PR removes the packages themselves plus ~60 dead files, and cascade-updates ~35 caller files that still reference the dead model management layer. These callers were written for OpenClaw's in-process execution model and use patterns (model resolution, context window lookup, fallback orchestration) that don't exist in RemoteClaw — ChannelBridge (the live execution path) has zero model management imports, confirming the architecture.
Packages to Remove from
package.jsonCore Files to Delete
Model management (~8 source + ~9 tests in
src/agents/)Source files:
model-auth.ts,model-auth-label.ts,model-catalog.ts,model-fallback.tsmodel-selection.ts,model-alias-lines.ts,context.ts,context-window-guard.tsTest files:
model-auth.test.ts,model-auth.profiles.test.ts,model-catalog.test.tsmodel-catalog.test-harness.ts,model-fallback.test.ts,model-selection.test.tscontext.test.ts,context-window-guard.test.tsNote:
model-compat.ts,model-forward-compat.ts,model-scan.ts,live-model-filter.tsand their tests were already deleted by #94.Provider catalogs (~11 source + ~14 tests in
src/agents/)Source files:
models-config.ts,models-config.providers.ts,bedrock-discovery.tscloudflare-ai-gateway.ts,huggingface-models.ts,opencode-zen-models.tspi-model-discovery.ts,synthetic-models.ts,together-models.tsvenice-models.ts,minimax-vlm.tsmodels-config.e2e-harness.ts,models-config.test-utils.tsTest files:
bedrock-discovery.test.ts,huggingface-models.test.ts,opencode-zen-models.test.tsminimax-vlm.normalizes-api-key.test.tsmodels-config.auto-injects-github-copilot-provider-token-is.test.tsmodels-config.falls-back-default-baseurl-token-exchange-fails.test.tsmodels-config.skips-writing-models-json-no-env-token.test.tsmodels-config.uses-first-github-copilot-profile-env-tokens.test.tsmodels-config.providers.kilocode.test.tsmodels-config.providers.kimi-coding.test.tsmodels-config.providers.nvidia.test.tsmodels-config.providers.ollama.test.tsmodels-config.providers.qianfan.test.tsmodels-config.providers.volcengine-byteplus.test.tsNote:
ollama-stream.tswas already deleted by #94.Config types
src/config/types.models.ts(model config type definitions — all consumers are deleted)Orphaned execution utilities (~5 source + ~7 tests in
src/agents/)Source files:
compaction.ts,failover-error.ts,cache-trace.tscommand-poll-backoff.ts,anthropic-payload-log.tsTest files:
compaction.test.ts,compaction.retry.test.ts,compaction.token-sanitize.test.tscompaction.tool-result-details.test.ts,failover-error.test.tscache-trace.test.ts,command-poll-backoff.test.tsOld CLI runner chain (displaced by
middleware/runtimes)src/agents/cli-runner.ts,cli-runner.test.tssrc/agents/cli-runner/helpers.ts,cli-runner/reliability.tsOld system prompt chain (displaced by
middleware/system-prompt.ts)Delete:
src/agents/system-prompt.ts,system-prompt-params.ts,system-prompt-report.tsModify (redirect to middleware system prompt):
src/auto-reply/reply/commands-system-prompt.ts— usebuildSystemPrompt()from middlewaresrc/auto-reply/reply/commands-context-report.ts— update importsCascade: Update Callers of Dead Model Management (~35 files)
The deleted model management files have ~35 callers using dead in-process execution patterns. These must be cascade-updated.
Telegram (2 files)
bot-message-dispatch.ts,sticker-cache.tsresolveDefaultModelForAgent()vision feature gatesAuto-reply (5-7 files)
agent-runner.ts,agent-runner-execution.ts,commands-system-prompt.ts,get-reply.ts,get-reply-directives.ts,status.ts,memory-flush.ts,directive-handling.persist.ts,commands-registry.tslookupContextTokens()context budgeting (CLI agent manages its own context)runWithModelFallback()wrapper (CLI agent handles fallback or fails)Gateway (3-5 files)
session-utils.ts,server-startup.ts,server-startup-log.ts,chat.ts,sessions-patch.tslookupContextTokens(), model ref resolution,resolveThinkingDefault()callsCommands (3-5 files)
agent.ts,sessions.ts,sessions-table.ts,doctor.ts,status.summary.tsresolveDefaultModelForAgent(),loadModelCatalog(), model resolutionCron (2 files)
isolated-agent/run.ts+ testrunWithModelFallback(), model catalog lookups, context window accountingMedia understanding (2-3 files)
runner.ts,providers/index.ts,providers/image.tsloadModelCatalog()/modelSupportsVision()capability discoveryresolveApiKeyForProvider()for vision provider auth (genuine live need, already simplified by feat: gut centralized OAuth and auth profiles #92)Config/Plugin (1-2 files)
plugin-auto-enable.ts— keepnormalizeProviderId()(extract before deletion)Agent infrastructure (3-5 files)
cli-session.ts,cli-backends.ts,transcript-policy.ts,live-auth-keys.ts,subagent-spawn.ts,tools/session-status-tool.tsLive Utility Extraction
Before deleting core files, extract functions with genuine live callers:
normalizeProviderId()(frommodel-selection.ts) → extract tosrc/agents/provider-utils.tsor inline (trivial: lowercase + trim; used by plugin-auto-enable, auth-profiles)resolveApiKeyForProvider()(frommodel-auth.ts) → already simplified by feat: gut centralized OAuth and auth profiles #92; keep in surviving auth infrastructure for media-understanding and onboardingModelReftype /parseModelRef()→ keep minimal type if needed for config parsingSurviving pi-* Import Sites
After all deletions and cascade updates, remaining files with
@mariozechner/pi-*imports need import removal or replacement with local type stubs. The goal is zero@mariozechner/pi-*imports so the 4 packages can be removed frompackage.json.Verification
@mariozechner/pi-*packages removed frompackage.jsonnormalizeProviderId,resolveApiKeyForProvider)from "@mariozechner/pi-imports remain insrc/pnpm buildpasses