@remodex/rmx 1.0.2
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/AGENTS_INSTALL.md +91 -0
- package/LICENSE +21 -0
- package/README.md +242 -0
- package/assets/architecture.png +0 -0
- package/assets/banner.png +0 -0
- package/assets/claude-code-models.gif +0 -0
- package/assets/codex-app-picker.png +0 -0
- package/bin/ocx.mjs +584 -0
- package/bin/package-main.mjs +9 -0
- package/gui/dist/assets/index-CZqebSPQ.css +1 -0
- package/gui/dist/assets/index-CkETtt7P.js +71 -0
- package/gui/dist/favicon.png +0 -0
- package/gui/dist/fonts/google-sans-cyrillic.woff2 +0 -0
- package/gui/dist/fonts/google-sans-latin.woff2 +0 -0
- package/gui/dist/icons.svg +24 -0
- package/gui/dist/index.html +25 -0
- package/gui/dist/logo.png +0 -0
- package/gui/dist/provider-icons/alibaba-color.svg +1 -0
- package/gui/dist/provider-icons/antigravity-color.svg +1 -0
- package/gui/dist/provider-icons/claude-color.svg +1 -0
- package/gui/dist/provider-icons/cline-color.svg +16 -0
- package/gui/dist/provider-icons/cloudflare-ai-gateway-color.svg +1 -0
- package/gui/dist/provider-icons/commandcode-color.svg +1 -0
- package/gui/dist/provider-icons/copilot-color.svg +1 -0
- package/gui/dist/provider-icons/cursor-color.svg +2 -0
- package/gui/dist/provider-icons/deepseek-color.svg +1 -0
- package/gui/dist/provider-icons/discord.svg +1 -0
- package/gui/dist/provider-icons/firepass-color.svg +1 -0
- package/gui/dist/provider-icons/fireworks-color.svg +1 -0
- package/gui/dist/provider-icons/gemini-color.svg +1 -0
- package/gui/dist/provider-icons/github-copilot-color.svg +1 -0
- package/gui/dist/provider-icons/gitlab-duo-color.svg +1 -0
- package/gui/dist/provider-icons/grok.svg +1 -0
- package/gui/dist/provider-icons/groq-color.svg +1 -0
- package/gui/dist/provider-icons/huggingface-color.svg +1 -0
- package/gui/dist/provider-icons/kimi-color.svg +1 -0
- package/gui/dist/provider-icons/kiro-color.svg +15 -0
- package/gui/dist/provider-icons/lm-studio-color.svg +1 -0
- package/gui/dist/provider-icons/mistral-color.svg +1 -0
- package/gui/dist/provider-icons/moonshot-color.svg +1 -0
- package/gui/dist/provider-icons/nvidia-color.svg +1 -0
- package/gui/dist/provider-icons/ollama-color.svg +1 -0
- package/gui/dist/provider-icons/openai.svg +1 -0
- package/gui/dist/provider-icons/opencode.svg +2 -0
- package/gui/dist/provider-icons/openrouter-color.svg +1 -0
- package/gui/dist/provider-icons/pi.svg +21 -0
- package/gui/dist/provider-icons/qianfan-color.svg +1 -0
- package/gui/dist/provider-icons/qwen-portal-color.svg +1 -0
- package/gui/dist/provider-icons/telegram.svg +1 -0
- package/gui/dist/provider-icons/vercel-ai-gateway-color.svg +1 -0
- package/gui/dist/provider-icons/vllm-color.svg +1 -0
- package/gui/dist/provider-icons/xiaomi-color.svg +1 -0
- package/package.json +118 -0
- package/src/AGENTS.md +28 -0
- package/src/adapters/anthropic-image-guard.ts +251 -0
- package/src/adapters/anthropic-image-normalize.ts +518 -0
- package/src/adapters/anthropic.ts +1205 -0
- package/src/adapters/azure.ts +36 -0
- package/src/adapters/base.ts +83 -0
- package/src/adapters/client-fingerprint.ts +59 -0
- package/src/adapters/command-code.ts +453 -0
- package/src/adapters/cursor/arg-codec.ts +38 -0
- package/src/adapters/cursor/arg-normalize.ts +104 -0
- package/src/adapters/cursor/cursor-errors.ts +165 -0
- package/src/adapters/cursor/discovery.ts +276 -0
- package/src/adapters/cursor/effort-map.ts +139 -0
- package/src/adapters/cursor/exec-policy.ts +88 -0
- package/src/adapters/cursor/framing.ts +250 -0
- package/src/adapters/cursor/gen/agent_pb.ts +15274 -0
- package/src/adapters/cursor/kv-store.ts +52 -0
- package/src/adapters/cursor/live-models.ts +153 -0
- package/src/adapters/cursor/live-smoke-gate.ts +41 -0
- package/src/adapters/cursor/live-transport.ts +1235 -0
- package/src/adapters/cursor/mcp-config.ts +42 -0
- package/src/adapters/cursor/mcp-manager.ts +333 -0
- package/src/adapters/cursor/message-mapper.ts +49 -0
- package/src/adapters/cursor/native-exec-common.ts +59 -0
- package/src/adapters/cursor/native-exec-desktop.ts +184 -0
- package/src/adapters/cursor/native-exec-fs.ts +332 -0
- package/src/adapters/cursor/native-exec-mcp.ts +153 -0
- package/src/adapters/cursor/native-exec-network.ts +43 -0
- package/src/adapters/cursor/native-exec-shell.ts +548 -0
- package/src/adapters/cursor/native-exec-tools.ts +118 -0
- package/src/adapters/cursor/native-exec.ts +604 -0
- package/src/adapters/cursor/protobuf-events.ts +735 -0
- package/src/adapters/cursor/protobuf-request.ts +719 -0
- package/src/adapters/cursor/request-builder.ts +280 -0
- package/src/adapters/cursor/thread-continuity.ts +67 -0
- package/src/adapters/cursor/tool-definitions.ts +621 -0
- package/src/adapters/cursor/transport-retry.ts +132 -0
- package/src/adapters/cursor/transport.ts +57 -0
- package/src/adapters/cursor/types.ts +59 -0
- package/src/adapters/cursor.ts +196 -0
- package/src/adapters/google-antigravity-replay.ts +520 -0
- package/src/adapters/google-antigravity-wire.ts +140 -0
- package/src/adapters/google-errors.ts +85 -0
- package/src/adapters/google-http.ts +100 -0
- package/src/adapters/google-tool-schema.ts +173 -0
- package/src/adapters/google-truncation.ts +24 -0
- package/src/adapters/google-wire-compiler.ts +232 -0
- package/src/adapters/google.ts +859 -0
- package/src/adapters/identity.ts +77 -0
- package/src/adapters/image.ts +23 -0
- package/src/adapters/kiro-constants.ts +16 -0
- package/src/adapters/kiro-errors.ts +208 -0
- package/src/adapters/kiro-events.ts +197 -0
- package/src/adapters/kiro-images.ts +129 -0
- package/src/adapters/kiro-retry.ts +312 -0
- package/src/adapters/kiro-thinking.ts +104 -0
- package/src/adapters/kiro-tool-fallback.ts +36 -0
- package/src/adapters/kiro-tools.ts +224 -0
- package/src/adapters/kiro-truncation.ts +33 -0
- package/src/adapters/kiro-wire.ts +129 -0
- package/src/adapters/kiro.ts +1924 -0
- package/src/adapters/mimo-free.ts +263 -0
- package/src/adapters/openai-chat.ts +1265 -0
- package/src/adapters/openai-responses.ts +1309 -0
- package/src/adapters/run-turn-queue.ts +114 -0
- package/src/adapters/tool-catalog-nudge.ts +71 -0
- package/src/adapters/upstream-http-error.ts +48 -0
- package/src/android-remote/assets.ts +218 -0
- package/src/android-remote/attachments.ts +168 -0
- package/src/android-remote/auth.ts +237 -0
- package/src/android-remote/cloudflare-provisioning.ts +409 -0
- package/src/android-remote/cloudflare-secret.ts +106 -0
- package/src/android-remote/cloudflare-tunnel.ts +488 -0
- package/src/android-remote/cloudflared.ts +286 -0
- package/src/android-remote/codex-app-server.ts +565 -0
- package/src/android-remote/desktop-history-page.ts +936 -0
- package/src/android-remote/desktop-ipc.ts +3643 -0
- package/src/android-remote/desktop-ownership-store.ts +98 -0
- package/src/android-remote/desktop-project-registration.ts +129 -0
- package/src/android-remote/desktop-session-stream.ts +1110 -0
- package/src/android-remote/desktop-workspace-state.ts +443 -0
- package/src/android-remote/file-change-parser.ts +112 -0
- package/src/android-remote/gateway.ts +9108 -0
- package/src/android-remote/mutation-store.ts +299 -0
- package/src/android-remote/projection.ts +1780 -0
- package/src/android-remote/queued-turn-store.ts +248 -0
- package/src/android-remote/session-command-recovery.ts +1384 -0
- package/src/android-remote/store.ts +466 -0
- package/src/android-remote/thread-reconciliation.ts +133 -0
- package/src/android-remote/thread-source-paths.ts +307 -0
- package/src/android-remote/thread-stream.ts +546 -0
- package/src/android-remote/turn-activity.ts +235 -0
- package/src/android-remote/user-message-identity.ts +94 -0
- package/src/bridge.ts +1793 -0
- package/src/chat/inbound.ts +295 -0
- package/src/chat/outbound.ts +821 -0
- package/src/claude/agents-inject.ts +267 -0
- package/src/claude/alias.ts +149 -0
- package/src/claude/auth-detect.ts +229 -0
- package/src/claude/auth-mode-migration.ts +32 -0
- package/src/claude/auth-mode.ts +62 -0
- package/src/claude/context-windows.ts +189 -0
- package/src/claude/desktop-3p-guard.ts +35 -0
- package/src/claude/desktop-3p-paths.ts +84 -0
- package/src/claude/desktop-3p.ts +601 -0
- package/src/claude/desktop-health.ts +26 -0
- package/src/claude/desktop-profile.ts +263 -0
- package/src/claude/gateway-cache.ts +70 -0
- package/src/claude/inbound-debug.ts +163 -0
- package/src/claude/inbound.ts +519 -0
- package/src/claude/model-info.ts +154 -0
- package/src/claude/outbound.ts +898 -0
- package/src/cli/access.ts +108 -0
- package/src/cli/account-api.ts +296 -0
- package/src/cli/account-auth.ts +250 -0
- package/src/cli/account-catalog-refresh.ts +14 -0
- package/src/cli/account-extended.ts +476 -0
- package/src/cli/account-main.ts +317 -0
- package/src/cli/account.ts +297 -0
- package/src/cli/agent-driven.ts +70 -0
- package/src/cli/agent.ts +184 -0
- package/src/cli/catalog-prewarm.ts +27 -0
- package/src/cli/claude-desktop.ts +211 -0
- package/src/cli/claude.ts +302 -0
- package/src/cli/codex-shim-autorestore.ts +45 -0
- package/src/cli/codex-shim-readiness.ts +69 -0
- package/src/cli/combo.ts +124 -0
- package/src/cli/config-command.ts +183 -0
- package/src/cli/debug.ts +228 -0
- package/src/cli/desktop-first-run.ts +25 -0
- package/src/cli/doctor.ts +1022 -0
- package/src/cli/export-command.ts +201 -0
- package/src/cli/help.ts +370 -0
- package/src/cli/index.ts +1565 -0
- package/src/cli/init.ts +224 -0
- package/src/cli/integrations.ts +225 -0
- package/src/cli/interactive-confirm.ts +133 -0
- package/src/cli/internal-dispatch.ts +35 -0
- package/src/cli/launcher-context.ts +77 -0
- package/src/cli/models-runtime.ts +224 -0
- package/src/cli/models.ts +340 -0
- package/src/cli/observe.ts +170 -0
- package/src/cli/opencode.ts +587 -0
- package/src/cli/provider-runtime.ts +179 -0
- package/src/cli/provider.ts +476 -0
- package/src/cli/ready.ts +301 -0
- package/src/cli/route-policy.ts +92 -0
- package/src/cli/runtime-api.ts +328 -0
- package/src/cli/star-prompt.ts +211 -0
- package/src/cli/status-oauth.ts +78 -0
- package/src/cli/status.ts +321 -0
- package/src/cli/system-command.ts +196 -0
- package/src/cli/system-restart-client.ts +146 -0
- package/src/cli/tray-proxy.ts +205 -0
- package/src/cli/v2.ts +200 -0
- package/src/cli.ts +10 -0
- package/src/clients/config-export.ts +1109 -0
- package/src/codex/account-id.ts +34 -0
- package/src/codex/account-label.ts +34 -0
- package/src/codex/account-lifecycle.ts +172 -0
- package/src/codex/account-namespace-match.ts +63 -0
- package/src/codex/account-namespaces.ts +195 -0
- package/src/codex/account-pause.ts +20 -0
- package/src/codex/account-priority.ts +83 -0
- package/src/codex/account-runtime-state.ts +31 -0
- package/src/codex/account-store.ts +517 -0
- package/src/codex/account-usability.ts +40 -0
- package/src/codex/admission.ts +263 -0
- package/src/codex/app-server-processes.ts +799 -0
- package/src/codex/auth-api.ts +2098 -0
- package/src/codex/auth-collision.ts +107 -0
- package/src/codex/auth-context.ts +480 -0
- package/src/codex/autostart-health.ts +156 -0
- package/src/codex/catalog/account-models.ts +67 -0
- package/src/codex/catalog/aggregation.ts +471 -0
- package/src/codex/catalog/bundled.ts +533 -0
- package/src/codex/catalog/effort.ts +432 -0
- package/src/codex/catalog/filesystem-evidence.ts +302 -0
- package/src/codex/catalog/kinds.ts +2 -0
- package/src/codex/catalog/metadata.ts +287 -0
- package/src/codex/catalog/native-models.ts +7 -0
- package/src/codex/catalog/parsing.ts +503 -0
- package/src/codex/catalog/provider-fetch.ts +2267 -0
- package/src/codex/catalog/sync.ts +1606 -0
- package/src/codex/catalog-admission.ts +197 -0
- package/src/codex/catalog-refresh-status.ts +87 -0
- package/src/codex/catalog-write-serialization.ts +242 -0
- package/src/codex/catalog.ts +15 -0
- package/src/codex/codex-write-lock.ts +384 -0
- package/src/codex/convergence-types.ts +593 -0
- package/src/codex/convergence.ts +580 -0
- package/src/codex/custom-model-catalog-migration.ts +176 -0
- package/src/codex/data/upstream-models.json +830 -0
- package/src/codex/desired-state.ts +230 -0
- package/src/codex/desktop-client-processes.ts +521 -0
- package/src/codex/exec-invocation.ts +22 -0
- package/src/codex/features.ts +1091 -0
- package/src/codex/generation.ts +202 -0
- package/src/codex/history-job.ts +347 -0
- package/src/codex/history-lock.ts +242 -0
- package/src/codex/history-migration-guardian.ts +115 -0
- package/src/codex/history-provider.ts +1075 -0
- package/src/codex/history-transition.ts +105 -0
- package/src/codex/history-worker.ts +204 -0
- package/src/codex/home.ts +206 -0
- package/src/codex/inject-coordination.ts +257 -0
- package/src/codex/inject.ts +1857 -0
- package/src/codex/injected-marker.ts +79 -0
- package/src/codex/integration-record.ts +266 -0
- package/src/codex/internal/catalog-writer.ts +203 -0
- package/src/codex/internal/history-writer.ts +105 -0
- package/src/codex/journal.ts +172 -0
- package/src/codex/main-account-cache.ts +56 -0
- package/src/codex/main-account.ts +40 -0
- package/src/codex/management-convergence.ts +114 -0
- package/src/codex/model-cache.ts +267 -0
- package/src/codex/native-main-admission.ts +47 -0
- package/src/codex/native-main-auth-temp.ts +187 -0
- package/src/codex/native-main-claim.ts +167 -0
- package/src/codex/native-main-lock-file.ts +162 -0
- package/src/codex/native-main-owner.ts +329 -0
- package/src/codex/native-profile-api.ts +247 -0
- package/src/codex/native-profile-manager.ts +1531 -0
- package/src/codex/native-profile-processes.ts +121 -0
- package/src/codex/native-profile-recovery.ts +99 -0
- package/src/codex/native-profile-stage-store.ts +387 -0
- package/src/codex/native-profile-startup.ts +348 -0
- package/src/codex/native-profile-store.ts +855 -0
- package/src/codex/native-profile-types.ts +120 -0
- package/src/codex/native-residue.ts +691 -0
- package/src/codex/paths.ts +78 -0
- package/src/codex/plugins-doctor.ts +242 -0
- package/src/codex/pool-rotation.ts +295 -0
- package/src/codex/project-config-warnings.ts +426 -0
- package/src/codex/prompt-journal.ts +311 -0
- package/src/codex/prompt-layers.ts +967 -0
- package/src/codex/prompt-lock.ts +143 -0
- package/src/codex/provider-adoption.ts +242 -0
- package/src/codex/quota-rejection.ts +224 -0
- package/src/codex/quota.ts +494 -0
- package/src/codex/refresh.ts +60 -0
- package/src/codex/routing.ts +1855 -0
- package/src/codex/runtime.ts +659 -0
- package/src/codex/shim.ts +1215 -0
- package/src/codex/subagent-defaults.ts +557 -0
- package/src/codex/subagent-model-fallback.ts +560 -0
- package/src/codex/sync.ts +238 -0
- package/src/codex/transition-state.ts +612 -0
- package/src/codex/upstream-host-health.ts +368 -0
- package/src/codex/user-identity.ts +374 -0
- package/src/codex/warmup.ts +192 -0
- package/src/codex/websocket-registry.ts +100 -0
- package/src/codex/write-coordination.ts +114 -0
- package/src/combos/failover.ts +140 -0
- package/src/combos/index.ts +44 -0
- package/src/combos/request.ts +64 -0
- package/src/combos/resolve.ts +232 -0
- package/src/combos/types.ts +392 -0
- package/src/config.ts +3270 -0
- package/src/generated/model-metadata.ts +144 -0
- package/src/github/star-state.ts +203 -0
- package/src/grok/inject.ts +540 -0
- package/src/grok/inspect.ts +45 -0
- package/src/grok/status.ts +127 -0
- package/src/grok/sync.ts +66 -0
- package/src/images/artifacts.ts +516 -0
- package/src/images/fulfill-video.ts +163 -0
- package/src/images/fulfill.ts +149 -0
- package/src/images/index.ts +4 -0
- package/src/images/loop.ts +922 -0
- package/src/images/plan.ts +133 -0
- package/src/images/synthetic-tool.ts +133 -0
- package/src/images/types.ts +41 -0
- package/src/images/xai-client.ts +141 -0
- package/src/images/xai-video-client.ts +163 -0
- package/src/index.ts +22 -0
- package/src/integrations/config-io.ts +151 -0
- package/src/integrations/journal.ts +315 -0
- package/src/integrations/merge.ts +135 -0
- package/src/integrations/native/ownership-preflight.ts +202 -0
- package/src/integrations/ownership.ts +111 -0
- package/src/integrations/registry.ts +108 -0
- package/src/integrations/serialize.ts +235 -0
- package/src/integrations/state.ts +290 -0
- package/src/integrations/store.ts +103 -0
- package/src/integrations/writer.ts +492 -0
- package/src/lib/abort.ts +146 -0
- package/src/lib/admin-secrets.ts +25 -0
- package/src/lib/admission.ts +83 -0
- package/src/lib/app-owned-memory-stores.ts +173 -0
- package/src/lib/app-owned-memory.ts +265 -0
- package/src/lib/bounded-body.ts +242 -0
- package/src/lib/bun-binary-validator.d.mts +3 -0
- package/src/lib/bun-binary-validator.mjs +18 -0
- package/src/lib/bun-runtime.ts +184 -0
- package/src/lib/bun-stream-caps.ts +127 -0
- package/src/lib/config-ownership.ts +438 -0
- package/src/lib/crash-guard.ts +344 -0
- package/src/lib/debug-log-buffer.ts +83 -0
- package/src/lib/debug-settings.ts +108 -0
- package/src/lib/debug.ts +31 -0
- package/src/lib/destination-policy.ts +316 -0
- package/src/lib/errors.ts +364 -0
- package/src/lib/eventstream-decoder.ts +253 -0
- package/src/lib/gcp-adc.ts +341 -0
- package/src/lib/injection-debug-log.ts +58 -0
- package/src/lib/local-management-attestation.ts +51 -0
- package/src/lib/open-url.ts +25 -0
- package/src/lib/pinned-http.ts +182 -0
- package/src/lib/privacy.ts +20 -0
- package/src/lib/process-control.ts +168 -0
- package/src/lib/provider-environment.ts +470 -0
- package/src/lib/provider-outbound.ts +203 -0
- package/src/lib/provider-url.ts +14 -0
- package/src/lib/proxy-env.ts +18 -0
- package/src/lib/redact.ts +510 -0
- package/src/lib/remodex-home.ts +616 -0
- package/src/lib/retry-after.ts +55 -0
- package/src/lib/service-secrets.ts +178 -0
- package/src/lib/shadow-call.ts +54 -0
- package/src/lib/sidecar-tracker.ts +52 -0
- package/src/lib/sse-decoder.ts +364 -0
- package/src/lib/state-store-registrations.ts +109 -0
- package/src/lib/state-store-sweeper.ts +184 -0
- package/src/lib/system-restart-contract.ts +73 -0
- package/src/lib/test-home-guard.ts +98 -0
- package/src/lib/token-estimate.ts +69 -0
- package/src/lib/translator-budget.ts +366 -0
- package/src/lib/upstream-reachability.ts +91 -0
- package/src/lib/upstream-retry.ts +508 -0
- package/src/lib/win-exec.ts +115 -0
- package/src/lib/win-paths.ts +68 -0
- package/src/lib/windows-elevation.ts +705 -0
- package/src/lib/windows-secret-acl.ts +817 -0
- package/src/lib/windows-user-principal.ts +283 -0
- package/src/lib/winsw.ts +402 -0
- package/src/model-sources.ts +73 -0
- package/src/oauth/anthropic-routing.ts +594 -0
- package/src/oauth/anthropic.ts +177 -0
- package/src/oauth/callback-server.ts +294 -0
- package/src/oauth/chatgpt.ts +150 -0
- package/src/oauth/command-code.ts +239 -0
- package/src/oauth/cursor.ts +231 -0
- package/src/oauth/github-copilot.ts +428 -0
- package/src/oauth/google-antigravity.ts +230 -0
- package/src/oauth/health.ts +443 -0
- package/src/oauth/index.ts +1280 -0
- package/src/oauth/key-providers.ts +128 -0
- package/src/oauth/kimi.ts +213 -0
- package/src/oauth/kiro-credentials.ts +726 -0
- package/src/oauth/kiro.ts +621 -0
- package/src/oauth/local-token-detect.ts +121 -0
- package/src/oauth/log.ts +48 -0
- package/src/oauth/login-cli.ts +163 -0
- package/src/oauth/pkce.ts +15 -0
- package/src/oauth/store.ts +655 -0
- package/src/oauth/token-guardian.ts +309 -0
- package/src/oauth/types.ts +62 -0
- package/src/oauth/xai.ts +241 -0
- package/src/providers/alibaba-region-backup.ts +75 -0
- package/src/providers/alibaba-region-migration.ts +156 -0
- package/src/providers/alibaba-region-startup.ts +36 -0
- package/src/providers/antigravity-models.ts +317 -0
- package/src/providers/api-keys.ts +140 -0
- package/src/providers/base-url-choices.ts +64 -0
- package/src/providers/codex-capacity.ts +288 -0
- package/src/providers/command-code-efforts.ts +85 -0
- package/src/providers/context-cap.ts +73 -0
- package/src/providers/derive.ts +451 -0
- package/src/providers/free-directory.ts +187 -0
- package/src/providers/github-copilot-transport.ts +56 -0
- package/src/providers/google-vertex-location.ts +14 -0
- package/src/providers/key-failover.ts +271 -0
- package/src/providers/kiro-models.ts +67 -0
- package/src/providers/label.ts +19 -0
- package/src/providers/model-discovery-limits.ts +16 -0
- package/src/providers/model-discovery.ts +361 -0
- package/src/providers/openai-sidecar.ts +235 -0
- package/src/providers/openai-tier-startup.ts +27 -0
- package/src/providers/openai-tiers.ts +301 -0
- package/src/providers/openai-virtual-models.ts +83 -0
- package/src/providers/openrouter-routing.ts +102 -0
- package/src/providers/provider-id-rewrite.ts +179 -0
- package/src/providers/quota.ts +1942 -0
- package/src/providers/reasoning-capabilities.ts +336 -0
- package/src/providers/registry.ts +2375 -0
- package/src/providers/slug-codec.ts +74 -0
- package/src/providers/xai-transport.ts +149 -0
- package/src/reasoning-effort.ts +243 -0
- package/src/responses/compaction.ts +124 -0
- package/src/responses/hosted-tool-policy.ts +9 -0
- package/src/responses/parser.ts +714 -0
- package/src/responses/reasoning-envelope.ts +60 -0
- package/src/responses/reasoning-replay-cache.ts +106 -0
- package/src/responses/schema.ts +159 -0
- package/src/responses/spill-store.ts +431 -0
- package/src/responses/state.ts +1039 -0
- package/src/responses/tool-groups.ts +19 -0
- package/src/router.ts +802 -0
- package/src/routing/analytics.ts +377 -0
- package/src/routing/capability.ts +205 -0
- package/src/routing/cost.ts +77 -0
- package/src/routing/evaluator.ts +444 -0
- package/src/routing/health.ts +401 -0
- package/src/routing/history/cursor.ts +43 -0
- package/src/routing/history/indexer.ts +605 -0
- package/src/routing/history/schema.ts +72 -0
- package/src/routing/profile-namespace.ts +15 -0
- package/src/routing/profile.ts +424 -0
- package/src/routing/quota.ts +145 -0
- package/src/routing/request-evidence.ts +45 -0
- package/src/routing/trace.ts +686 -0
- package/src/server/adapter-resolve.ts +83 -0
- package/src/server/auth-cors.ts +606 -0
- package/src/server/chat-completions.ts +379 -0
- package/src/server/claude-messages.ts +980 -0
- package/src/server/effort-policy.ts +251 -0
- package/src/server/github-copilot-responses-repair.ts +338 -0
- package/src/server/gui-static.ts +152 -0
- package/src/server/image-retry.ts +42 -0
- package/src/server/images.ts +485 -0
- package/src/server/index.ts +1633 -0
- package/src/server/lifecycle.ts +482 -0
- package/src/server/live.ts +609 -0
- package/src/server/management/agent-settings-routes.ts +1180 -0
- package/src/server/management/android-remote-routes.ts +390 -0
- package/src/server/management/api-access.ts +141 -0
- package/src/server/management/api-key-usage.ts +167 -0
- package/src/server/management/body.ts +35 -0
- package/src/server/management/combo-routes.ts +244 -0
- package/src/server/management/config-routes.ts +602 -0
- package/src/server/management/context.ts +88 -0
- package/src/server/management/integration-routes.ts +538 -0
- package/src/server/management/logs-usage-routes.ts +516 -0
- package/src/server/management/model-routes.ts +519 -0
- package/src/server/management/model-rows.ts +143 -0
- package/src/server/management/native-integration-routes.ts +781 -0
- package/src/server/management/oauth-account-routes.ts +573 -0
- package/src/server/management/provider-routes.ts +781 -0
- package/src/server/management/request-history-routes.ts +191 -0
- package/src/server/management/routing-analytics-routes.ts +74 -0
- package/src/server/management/routing-profile-routes.ts +384 -0
- package/src/server/management/shared.ts +277 -0
- package/src/server/management/sidebar-routes.ts +106 -0
- package/src/server/management/sync-response.ts +69 -0
- package/src/server/management/system-restart.ts +433 -0
- package/src/server/management/system-routes.ts +141 -0
- package/src/server/management/usage-summary-cache.ts +86 -0
- package/src/server/management-api.ts +269 -0
- package/src/server/management-auth.ts +353 -0
- package/src/server/memory-watchdog.ts +156 -0
- package/src/server/port-reclaim.ts +307 -0
- package/src/server/ports.ts +156 -0
- package/src/server/proxy-liveness.ts +326 -0
- package/src/server/proxy-stop.ts +92 -0
- package/src/server/readiness.ts +99 -0
- package/src/server/relay-eager.ts +353 -0
- package/src/server/relay.ts +1179 -0
- package/src/server/request-decompress.ts +132 -0
- package/src/server/request-log-conversation.ts +168 -0
- package/src/server/request-log.ts +1072 -0
- package/src/server/responses/collaboration.ts +409 -0
- package/src/server/responses/compact.ts +710 -0
- package/src/server/responses/core.ts +3561 -0
- package/src/server/responses/encrypted-payload.ts +308 -0
- package/src/server/responses/fetch-helpers.ts +171 -0
- package/src/server/responses/passthrough-error.ts +78 -0
- package/src/server/responses/policy-fallback.ts +152 -0
- package/src/server/responses/terminal-guard.ts +230 -0
- package/src/server/responses/upstream-error.ts +48 -0
- package/src/server/responses-image-gen-repair.ts +132 -0
- package/src/server/responses-item-id-repair.ts +272 -0
- package/src/server/responses-json-events.ts +52 -0
- package/src/server/responses-model-rewrite.ts +29 -0
- package/src/server/responses-snapshot-repair.ts +621 -0
- package/src/server/responses.ts +10 -0
- package/src/server/search.ts +181 -0
- package/src/server/sse-frame-buffer.ts +292 -0
- package/src/server/sse-payload-rewrite.ts +263 -0
- package/src/server/startup-action-control.ts +308 -0
- package/src/server/startup-health-cache.ts +119 -0
- package/src/server/system-env.ts +418 -0
- package/src/server/windows-tcp-drop.ts +184 -0
- package/src/server/windows-tray-control.ts +41 -0
- package/src/server/ws-bridge.ts +470 -0
- package/src/service-manager-probe.ts +824 -0
- package/src/service.ts +3011 -0
- package/src/stall-timeout.ts +20 -0
- package/src/storage/cleanup-job.ts +57 -0
- package/src/storage/cleanup.ts +3085 -0
- package/src/storage/policy-job.ts +457 -0
- package/src/storage/policy-scheduler.ts +40 -0
- package/src/storage/policy-worker.ts +59 -0
- package/src/storage/policy.ts +527 -0
- package/src/storage/restore-job.ts +299 -0
- package/src/storage/restore-worker.ts +58 -0
- package/src/storage/scanner.ts +238 -0
- package/src/storage/storage-mutation-coordinator.ts +139 -0
- package/src/storage/worker-lifecycle.ts +215 -0
- package/src/tray/assets/opencodex-tray-offline.ico +0 -0
- package/src/tray/assets/opencodex-tray-online.ico +0 -0
- package/src/tray/assets/opencodex-tray-warning.ico +0 -0
- package/src/tray/assets/opencodex-tray.png +0 -0
- package/src/tray/windows-tray.ps1 +364 -0
- package/src/tray/windows.ts +738 -0
- package/src/types.ts +1531 -0
- package/src/update/badge.ts +72 -0
- package/src/update/desktop-release.ts +1620 -0
- package/src/update/index.ts +402 -0
- package/src/update/job.ts +1906 -0
- package/src/update/notify.ts +261 -0
- package/src/update/npm-cache-preflight.d.mts +47 -0
- package/src/update/npm-cache-preflight.mjs +201 -0
- package/src/update/npm-invocation.d.mts +23 -0
- package/src/update/npm-invocation.mjs +94 -0
- package/src/update/tray-update-plan.d.mts +18 -0
- package/src/update/tray-update-plan.mjs +38 -0
- package/src/usage/cost.ts +0 -0
- package/src/usage/debug.ts +97 -0
- package/src/usage/expected-prices.ts +283 -0
- package/src/usage/log.ts +695 -0
- package/src/usage/summary.ts +585 -0
- package/src/usage/totals.ts +14 -0
- package/src/vision/anthropic-describe.ts +185 -0
- package/src/vision/describe.ts +127 -0
- package/src/vision/index.ts +558 -0
- package/src/vision/reasoning.ts +55 -0
- package/src/web-search/anthropic-executor.ts +189 -0
- package/src/web-search/executor.ts +105 -0
- package/src/web-search/format-result.ts +89 -0
- package/src/web-search/index.ts +196 -0
- package/src/web-search/loop.ts +791 -0
- package/src/web-search/parse.ts +235 -0
- package/src/web-search/progress-stream.ts +342 -0
- package/src/web-search/synthetic-tool.ts +47 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `rmx export --client <id>` — print a client config for the live proxy.
|
|
3
|
+
*
|
|
4
|
+
* Seven clients, four formats: opencode and Pi are JSON, OMP, Hermes and Gajae
|
|
5
|
+
* are YAML, OpenClaw JSON5, Kimi TOML.
|
|
6
|
+
*
|
|
7
|
+
* Two consumers, one payload (devlog 260731_client_config_export/020):
|
|
8
|
+
*
|
|
9
|
+
* - **Agent** (`--json`): stdout is exactly the client config as JSON and nothing else,
|
|
10
|
+
* so `rmx export --client pi --json > models.json` is safe to pipe. This is JSON for
|
|
11
|
+
* every client, including the YAML/JSON5/TOML ones — the flag is about machine
|
|
12
|
+
* readability, not the client's native format. Every diagnostic — including the
|
|
13
|
+
* `--out` write note — goes to stderr.
|
|
14
|
+
* - **Human** (no flag) and `--out`: the client's NATIVE serialization leads, then the
|
|
15
|
+
* destination path, the merge warning, the env export line, and the model/degraded
|
|
16
|
+
* counts.
|
|
17
|
+
*
|
|
18
|
+
* The command never writes the user's real config path. `--out` is an explicit target and
|
|
19
|
+
* refuses to clobber an existing file without `--force`, because the common mistake
|
|
20
|
+
* (`--out ~/.config/opencode/opencode.json`) would silently destroy other providers.
|
|
21
|
+
*
|
|
22
|
+
* Serialization itself belongs to src/clients/config-export.ts; this module only resolves
|
|
23
|
+
* the base URL, filters the catalog, and renders. No secret is ever serialized: the config
|
|
24
|
+
* carries the client's documented env reference — or, for Kimi, which cannot hold one, a
|
|
25
|
+
* loopback placeholder — and the real key stays in the environment.
|
|
26
|
+
*/
|
|
27
|
+
import { writeFileSync } from "node:fs";
|
|
28
|
+
import { loadConfig } from "../config";
|
|
29
|
+
import {
|
|
30
|
+
EXPORT_CLIENTS,
|
|
31
|
+
EXPORT_CLIENT_IDS,
|
|
32
|
+
buildClientConfigText,
|
|
33
|
+
isExportClientId,
|
|
34
|
+
opencodeProxyBaseUrl,
|
|
35
|
+
type ExportClientId,
|
|
36
|
+
type ExportModel,
|
|
37
|
+
} from "../clients/config-export";
|
|
38
|
+
import { opencodeCatalogFromProxyRows, type OpencodeProxyModelRow } from "./opencode";
|
|
39
|
+
import type { OcxConfig } from "../types";
|
|
40
|
+
import {
|
|
41
|
+
CliUsageError,
|
|
42
|
+
RuntimeApiError,
|
|
43
|
+
printData,
|
|
44
|
+
rejectArgs,
|
|
45
|
+
runCliAction,
|
|
46
|
+
runtimeBaseUrl,
|
|
47
|
+
runtimeRequest,
|
|
48
|
+
takeFlag,
|
|
49
|
+
takeOption,
|
|
50
|
+
type RuntimeApiDeps,
|
|
51
|
+
} from "./runtime-api";
|
|
52
|
+
|
|
53
|
+
const USAGE = `Usage:
|
|
54
|
+
rmx export --client <${EXPORT_CLIENT_IDS.join("|")}> [--json] [--out <path>] [--force]`;
|
|
55
|
+
|
|
56
|
+
export interface ExportCommandDeps extends RuntimeApiDeps {
|
|
57
|
+
/** Live config seam; tests inject a fixture instead of reading the user's config. */
|
|
58
|
+
configImpl?: () => OcxConfig;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* `/api/models` row plus the modality list Pi consumes. The launcher's row type predates
|
|
63
|
+
* the Pi exporter and stops at the fields OpenCode needs.
|
|
64
|
+
*/
|
|
65
|
+
type ExportProxyModelRow = OpencodeProxyModelRow & { inputModalities?: string[] };
|
|
66
|
+
|
|
67
|
+
/** Same authoritativeness rule the serializers apply, for the degraded-count line. */
|
|
68
|
+
function hasContextLimit(model: ExportModel): boolean {
|
|
69
|
+
return typeof model.contextWindow === "number"
|
|
70
|
+
&& Number.isFinite(model.contextWindow)
|
|
71
|
+
&& model.contextWindow > 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Export rows from proxy `/api/models` rows.
|
|
76
|
+
*
|
|
77
|
+
* `opencodeCatalogFromProxyRows` owns the visibility rules (drop `disabled`, drop dupes,
|
|
78
|
+
* drop native under Codex Direct) — the export core does none of that, so a row filtered
|
|
79
|
+
* here is the only thing keeping a disabled model out of a client's picker. Modalities are
|
|
80
|
+
* re-joined by `namespaced` because the launcher's catalog type does not carry them.
|
|
81
|
+
*/
|
|
82
|
+
export function exportModelsFromProxyRows(
|
|
83
|
+
rows: readonly ExportProxyModelRow[],
|
|
84
|
+
config: OcxConfig,
|
|
85
|
+
): ExportModel[] {
|
|
86
|
+
const modalities = new Map<string, string[]>();
|
|
87
|
+
for (const row of rows) {
|
|
88
|
+
const namespaced = row.namespaced?.trim();
|
|
89
|
+
if (namespaced && Array.isArray(row.inputModalities) && row.inputModalities.length > 0) {
|
|
90
|
+
if (!modalities.has(namespaced)) modalities.set(namespaced, [...row.inputModalities]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return opencodeCatalogFromProxyRows(rows, config).map(entry => {
|
|
94
|
+
const model: ExportModel = {
|
|
95
|
+
namespaced: entry.namespaced,
|
|
96
|
+
provider: entry.provider ?? (entry.native ? "openai" : "routed"),
|
|
97
|
+
id: entry.id ?? entry.namespaced,
|
|
98
|
+
};
|
|
99
|
+
if (entry.native) model.native = true;
|
|
100
|
+
if (entry.displayName) model.displayName = entry.displayName;
|
|
101
|
+
if (entry.contextWindow !== undefined) model.contextWindow = entry.contextWindow;
|
|
102
|
+
const input = modalities.get(entry.namespaced);
|
|
103
|
+
if (input) model.inputModalities = input;
|
|
104
|
+
return model;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* `http://host:port/v1` for the proxy that is actually listening.
|
|
110
|
+
*
|
|
111
|
+
* `runtimeBaseUrl` is the identity-checked `findLiveProxy` probe the launcher uses, and it
|
|
112
|
+
* already throws the "Start it with: rmx start" error when nothing answers — so a config
|
|
113
|
+
* with an empty models block can never be emitted.
|
|
114
|
+
*
|
|
115
|
+
* Resolved ONCE and handed back to `runtimeRequest` as `baseUrl`, so the catalog and the
|
|
116
|
+
* exported endpoint can never come from two different probes.
|
|
117
|
+
*/
|
|
118
|
+
function proxyV1BaseUrl(root: string): string {
|
|
119
|
+
const url = new URL(root);
|
|
120
|
+
const port = url.port ? Number(url.port) : url.protocol === "https:" ? 443 : 80;
|
|
121
|
+
return opencodeProxyBaseUrl(port, url.hostname);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function parseClient(args: string[]): ExportClientId {
|
|
125
|
+
const raw = takeOption(args, "--client");
|
|
126
|
+
if (raw === undefined) {
|
|
127
|
+
throw new CliUsageError(`--client is required (${EXPORT_CLIENT_IDS.join(", ")})`, USAGE);
|
|
128
|
+
}
|
|
129
|
+
const client = raw.trim().toLowerCase();
|
|
130
|
+
if (!isExportClientId(client)) {
|
|
131
|
+
throw new CliUsageError(`--client must be one of: ${EXPORT_CLIENT_IDS.join(", ")}`, USAGE);
|
|
132
|
+
}
|
|
133
|
+
return client;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Write the config, refusing to replace an existing file without `--force`.
|
|
138
|
+
*
|
|
139
|
+
* The `wx` flag does the refusal in the kernel rather than after an `existsSync` check, so
|
|
140
|
+
* a file created between the two can never be truncated. Nothing is printed before this
|
|
141
|
+
* runs: a refusal leaves both the target bytes and stdout untouched.
|
|
142
|
+
*/
|
|
143
|
+
function writeExport(path: string, text: string, force: boolean): void {
|
|
144
|
+
try {
|
|
145
|
+
writeFileSync(path, text, force ? { encoding: "utf8" } : { encoding: "utf8", flag: "wx" });
|
|
146
|
+
} catch (error) {
|
|
147
|
+
if ((error as NodeJS.ErrnoException).code === "EEXIST") {
|
|
148
|
+
throw new CliUsageError(
|
|
149
|
+
`${path} already exists. Re-run with --force to replace it, or print the config and merge it yourself.`,
|
|
150
|
+
USAGE,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export async function handleExportCommand(argv: string[], deps: ExportCommandDeps = {}): Promise<number> {
|
|
158
|
+
return runCliAction(async () => {
|
|
159
|
+
const args = [...argv];
|
|
160
|
+
const client = parseClient(args);
|
|
161
|
+
const wantsJson = takeFlag(args, "--json");
|
|
162
|
+
const force = takeFlag(args, "--force");
|
|
163
|
+
const out = takeOption(args, "--out");
|
|
164
|
+
rejectArgs(args, USAGE);
|
|
165
|
+
|
|
166
|
+
const spec = EXPORT_CLIENTS[client];
|
|
167
|
+
const config = (deps.configImpl ?? loadConfig)();
|
|
168
|
+
const root = await runtimeBaseUrl(deps);
|
|
169
|
+
const rows = await runtimeRequest<ExportProxyModelRow[]>("/api/models", {}, { ...deps, baseUrl: root });
|
|
170
|
+
if (!Array.isArray(rows)) {
|
|
171
|
+
throw new RuntimeApiError("Management API returned an unexpected /api/models payload.", 502, rows);
|
|
172
|
+
}
|
|
173
|
+
const models = exportModelsFromProxyRows(rows, config);
|
|
174
|
+
// The text is the client's OWN format — YAML, TOML and JSON5 clients would
|
|
175
|
+
// otherwise receive a JSON rendering their parser reads differently.
|
|
176
|
+
const built = buildClientConfigText(client, { baseUrl: proxyV1BaseUrl(root), models, config });
|
|
177
|
+
const clientConfig = built.document;
|
|
178
|
+
const text = built.text;
|
|
179
|
+
|
|
180
|
+
// Every serializer already ends with exactly one newline.
|
|
181
|
+
if (out !== undefined) writeExport(out, text, force);
|
|
182
|
+
// stderr, so `--json` stdout stays a standalone JSON document.
|
|
183
|
+
if (out !== undefined && wantsJson) console.error(`Wrote ${out}`);
|
|
184
|
+
|
|
185
|
+
const degraded = models.filter(model => !hasContextLimit(model)).length;
|
|
186
|
+
// `--json` keeps emitting the DOCUMENT at the top level as JSON for scripts;
|
|
187
|
+
// `--out` is the path that writes the selected client's native format.
|
|
188
|
+
// Format metadata rides in the human lines below.
|
|
189
|
+
printData(clientConfig, wantsJson, [
|
|
190
|
+
text.trimEnd(),
|
|
191
|
+
"",
|
|
192
|
+
...(out !== undefined ? [`Wrote ${out}`] : []),
|
|
193
|
+
`Destination: ${spec.destination(process.env)}`,
|
|
194
|
+
"Merge this provider block into that file; do not replace it.",
|
|
195
|
+
`Before launching: ${spec.exportHint}`,
|
|
196
|
+
`${models.length} model${models.length === 1 ? "" : "s"}; ${degraded} omit context limits (the client applies its own defaults).`,
|
|
197
|
+
]);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export const EXPORT_USAGE = USAGE;
|
package/src/cli/help.ts
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const repoRoot = dirname(fileURLToPath(new URL("../../package.json", import.meta.url)));
|
|
6
|
+
|
|
7
|
+
type HelpEntry = {
|
|
8
|
+
usage: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
details?: string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const CANONICAL_CLI = "rmx";
|
|
14
|
+
const COMPATIBILITY_ALIASES = ["remodex", "opencodex", "ocx"] as const;
|
|
15
|
+
|
|
16
|
+
function canonicalCommand(value: string): string {
|
|
17
|
+
// Help text contains paths such as `ocx.pid`; replace only command-shaped
|
|
18
|
+
// tokens so compatibility filenames and environment names remain accurate.
|
|
19
|
+
return value.replace(/\bocx(?=\s|$|[`|])/g, CANONICAL_CLI);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const helpEntries: Record<string, HelpEntry> = {
|
|
23
|
+
init: { usage: "rmx init", summary: "Interactive setup for providers and Codex config injection." },
|
|
24
|
+
setup: { usage: "rmx setup", summary: "Interactive setup for providers and Codex config injection (alias of init)." },
|
|
25
|
+
start: { usage: "rmx start [--port <port>]", summary: "Start the proxy server and sync models to Codex." },
|
|
26
|
+
stop: { usage: "rmx stop", summary: "Stop the proxy and restore native Codex config." },
|
|
27
|
+
restore: {
|
|
28
|
+
usage: "rmx restore [back]",
|
|
29
|
+
summary: "Restore native Codex config without stopping the proxy; `restore back` re-points codex at the running proxy.",
|
|
30
|
+
},
|
|
31
|
+
eject: {
|
|
32
|
+
usage: "rmx eject [back]",
|
|
33
|
+
summary: "Restore native Codex config without stopping the proxy; `eject back` re-points codex at the running proxy.",
|
|
34
|
+
},
|
|
35
|
+
"recover-history": {
|
|
36
|
+
usage: "rmx recover-history --legacy-openai",
|
|
37
|
+
summary: "Explicitly recover pre-backup syncResumeHistory rows.",
|
|
38
|
+
},
|
|
39
|
+
uninstall: {
|
|
40
|
+
usage: "rmx uninstall",
|
|
41
|
+
summary: "Remove service/shim/config and restore native Codex.",
|
|
42
|
+
details: [
|
|
43
|
+
"Alias: rmx remove",
|
|
44
|
+
"Config cleanup requires ownership metadata created by a fresh install; legacy or shared directories are left in place.",
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
remove: {
|
|
48
|
+
usage: "rmx remove",
|
|
49
|
+
summary: "Remove service/shim/config and restore native Codex.",
|
|
50
|
+
details: [
|
|
51
|
+
"Alias of: rmx uninstall",
|
|
52
|
+
"Config cleanup requires ownership metadata created by a fresh install; legacy or shared directories are left in place.",
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
service: {
|
|
56
|
+
usage: "rmx service [install|repair|start|stop|status|uninstall|remove] [--native|--scheduler]",
|
|
57
|
+
summary: "Run as a background service.",
|
|
58
|
+
details: [
|
|
59
|
+
"With no subcommand, installs/updates and starts the background service.",
|
|
60
|
+
"Use `rmx service status` to see diagnostics and log paths.",
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
"codex-shim": {
|
|
64
|
+
usage: "rmx codex-shim <install|status|uninstall|remove>",
|
|
65
|
+
summary: "Auto-start the proxy when `codex` launches.",
|
|
66
|
+
details: ["Use `remove` as an alias for `uninstall`."],
|
|
67
|
+
},
|
|
68
|
+
tray: {
|
|
69
|
+
usage: "rmx tray <install|start|stop|status|uninstall|remove> [--json] [--no-start]",
|
|
70
|
+
summary: "Install and control the Windows status tray icon.",
|
|
71
|
+
details: [
|
|
72
|
+
"The tray starts at Windows login and provides one-click proxy controls.",
|
|
73
|
+
"Tray start/stop controls the icon only; use its menu to start or stop the proxy.",
|
|
74
|
+
"--no-start (install only) installs the tray without launching it immediately.",
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
ensure: { usage: "rmx ensure", summary: "Ensure the proxy is running and Codex config/cache are current." },
|
|
78
|
+
sync: {
|
|
79
|
+
usage: "rmx sync [--restart-codex]",
|
|
80
|
+
summary: "Fetch provider models and inject them into Codex config.",
|
|
81
|
+
details: [
|
|
82
|
+
"After writing the catalog, warns if long-lived Codex app-server processes are still running.",
|
|
83
|
+
"--restart-codex sends SIGTERM only to matching app-server / code-mode-host processes (may interrupt active turns).",
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
"sync-cache": {
|
|
87
|
+
usage: "rmx sync-cache [--restart-codex]",
|
|
88
|
+
summary: "Refresh Codex's model cache from the active catalog.",
|
|
89
|
+
details: [
|
|
90
|
+
"Warns when Codex app-server processes still hold an in-memory model list.",
|
|
91
|
+
"--restart-codex sends SIGTERM only to matching app-server / code-mode-host processes (may interrupt active turns).",
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
status: { usage: "rmx status", summary: "Check proxy server status." },
|
|
95
|
+
doctor: { usage: "rmx doctor", summary: "Diagnose environment/network issues (paths, WSL /mnt, proxy env, ChatGPT reachability)." },
|
|
96
|
+
debug: {
|
|
97
|
+
usage: "rmx debug <provider|usage|injection|claude> <on|off|status|reset|logs [-f]>",
|
|
98
|
+
summary: "Show or toggle runtime provider, usage, injection, and Claude debug capture.",
|
|
99
|
+
details: [
|
|
100
|
+
"Provider: rmx debug provider on | off | status | reset | logs [-f]",
|
|
101
|
+
"Usage JSONL: rmx debug usage on | off | status | reset | logs [-f]",
|
|
102
|
+
"Env default: OCX_DEBUG=1 (legacy OCX_DEBUG_FRAMES still works)",
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
login: { usage: "rmx login <provider>", summary: "OAuth or API-key login for a provider." },
|
|
106
|
+
logout: { usage: "rmx logout <provider>", summary: "Remove a stored provider login." },
|
|
107
|
+
gui: { usage: "rmx gui", summary: "Open the Remodex dashboard." },
|
|
108
|
+
update: {
|
|
109
|
+
usage: "rmx update [--tag latest|preview]",
|
|
110
|
+
summary: "Update Remodex. Preview installs stay on the preview tag unless overridden.",
|
|
111
|
+
},
|
|
112
|
+
provider: {
|
|
113
|
+
usage: "rmx provider <list|add|edit|test|remove|show|set-default|selected|quota|presets|account-mode>",
|
|
114
|
+
summary: "Non-interactive provider management.",
|
|
115
|
+
details: [
|
|
116
|
+
"Subcommands: list, add/edit/test/remove/show, set-default, selected, quota, presets, account-mode",
|
|
117
|
+
"Registry providers are auto-configured by name. Custom providers need --adapter and --base-url.",
|
|
118
|
+
"Run `rmx provider --help` for full usage and examples.",
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
account: {
|
|
122
|
+
usage: "rmx account <list|current|use|refresh|auto-switch|priority|login|reauth|code|cancel|remove|add-key|reset-credits|main> ...",
|
|
123
|
+
summary: "List and switch provider accounts and API-key pools (GUI parity).",
|
|
124
|
+
details: [
|
|
125
|
+
"list [provider] Codex account pool, OAuth accounts and API keys (identifiers shown masked as the API returns them).",
|
|
126
|
+
"current <provider> Show the active account or key.",
|
|
127
|
+
"use <provider> <id> Switch the active credential; 'main' selects the Codex App login.",
|
|
128
|
+
"refresh <provider> Force-refresh Codex or provider quota reports.",
|
|
129
|
+
"auto-switch <provider> <on|off|status|threshold N> Control the Codex pool threshold.",
|
|
130
|
+
"priority <provider> <id|main> [first|earlier|normal|later|last|-100..100|reset] Selection order; omit the value to read it.",
|
|
131
|
+
"remove <provider> <id> --yes Remove a stored account or key after an existence check.",
|
|
132
|
+
"add-key <provider> [--label <label>] Add a key read only from piped stdin.",
|
|
133
|
+
"login/reauth/code/cancel Run browser or manual-code auth from a headless shell.",
|
|
134
|
+
"reset-credits <id|main> [--consume --yes] Inspect or consume Codex reset credits.",
|
|
135
|
+
"main <subcommand> Manage the physical native Codex login separately from Pool routing.",
|
|
136
|
+
"Switching the active account takes effect immediately; running threads move on their next request, and in-flight requests keep the account they captured.",
|
|
137
|
+
"A selection-order change applies from the next unbound request and never moves a bound thread.",
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
models: {
|
|
141
|
+
usage: "rmx models <list|live|add|edit|remove|enable|disable|provider|selected|context|shadow> ...",
|
|
142
|
+
summary: "List models and manage custom (manually registered) models.",
|
|
143
|
+
details: [
|
|
144
|
+
"List available models from static config with no subcommand (liveModels may add more at runtime).",
|
|
145
|
+
"add: register a model the provider catalog does not advertise yet.",
|
|
146
|
+
" --display-name <name> Human label (no slashes).",
|
|
147
|
+
" --context-window <tokens> e.g. 200000.",
|
|
148
|
+
" --modalities text,image Comma-separated (text|image|audio).",
|
|
149
|
+
"remove: delete a custom model by UUID or <provider>/<modelId>.",
|
|
150
|
+
"list-custom: show all custom models.",
|
|
151
|
+
"Changes apply immediately to a running proxy (catalog sync).",
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
model: {
|
|
155
|
+
usage: "rmx model <subcommand>",
|
|
156
|
+
summary: "Alias of rmx models.",
|
|
157
|
+
},
|
|
158
|
+
combo: {
|
|
159
|
+
usage: "rmx combo <list|show|set|remove> ...",
|
|
160
|
+
summary: "Manage combo failover and round-robin virtual models.",
|
|
161
|
+
details: ["Alias hierarchy: rmx route combo ...", "Use --targets provider/model[:weight],provider/model[:weight]."],
|
|
162
|
+
},
|
|
163
|
+
route: {
|
|
164
|
+
usage: "rmx route combo <list|show|set|remove> ...",
|
|
165
|
+
summary: "Manage routing features; combo is currently the supported routing resource.",
|
|
166
|
+
},
|
|
167
|
+
agent: {
|
|
168
|
+
usage: "rmx agent <status|injection|effort|subagents|fallback|sidecar> ...",
|
|
169
|
+
summary: "Manage headless multi-agent, roster, effort, injection, and sidecar settings.",
|
|
170
|
+
},
|
|
171
|
+
observe: {
|
|
172
|
+
usage: "rmx observe <logs|usage|storage|memory|debug|claude-inbound|injection> ...",
|
|
173
|
+
summary: "Inspect proxy requests, usage, storage, memory, and debug data.",
|
|
174
|
+
},
|
|
175
|
+
logs: { usage: "rmx logs [filters] [--follow] [--json|--jsonl]", summary: "Alias of rmx observe logs." },
|
|
176
|
+
usage: { usage: "rmx usage [--range <7d|30d|all>] [--surface <all|codex|claude|grok>] [--json]", summary: "Alias of rmx observe usage." },
|
|
177
|
+
storage: { usage: "rmx storage [--json]", summary: "Alias of rmx observe storage." },
|
|
178
|
+
memory: { usage: "rmx memory [--json]", summary: "Alias of rmx observe memory." },
|
|
179
|
+
access: {
|
|
180
|
+
usage: "rmx access <key|endpoints|models|test> ...",
|
|
181
|
+
summary: "Manage Remodex admission API keys and inspect external endpoints.",
|
|
182
|
+
},
|
|
183
|
+
"api-key": { usage: "rmx api-key <list|create|remove> ...", summary: "Alias of rmx access key." },
|
|
184
|
+
export: {
|
|
185
|
+
usage: "rmx export --client <opencode|pi|omp|hermes|openclaw|kimi|gajae> [--json] [--out <path>] [--force]",
|
|
186
|
+
summary: "Print a client config (opencode, Pi, OMP, Hermes, OpenClaw, Kimi Code, Gajae Code) wired to the running proxy.",
|
|
187
|
+
details: [
|
|
188
|
+
"--json prints the generated document as JSON on stdout; use --out for the client's native format.",
|
|
189
|
+
"--out <path> writes the native config there and refuses to replace an existing file without --force.",
|
|
190
|
+
"The config never contains a real key; it carries a documented env reference or a non-secret loopback placeholder.",
|
|
191
|
+
"The destination path is printed for merging by hand — rmx never writes your real client config.",
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
grok: { usage: "rmx grok <status|exclude|include|set|clear|apply> ...", summary: "Manage and apply the Grok Build model fence." },
|
|
195
|
+
integration: { usage: "rmx integration <claude|grok|client> ...", summary: "Manage supported client integrations." },
|
|
196
|
+
system: {
|
|
197
|
+
usage: "rmx system <status|settings|startup|diagnostics|sync|update|desktop-update> ...",
|
|
198
|
+
summary: "Manage headless runtime settings, startup, sync, diagnostics, and updates.",
|
|
199
|
+
details: [
|
|
200
|
+
"desktop-update check [--channel latest|preview] Check the native desktop release manifest.",
|
|
201
|
+
"desktop-update run [--channel latest|preview] Download and verify a native desktop update.",
|
|
202
|
+
"desktop-update status Show shared tray/dashboard update state.",
|
|
203
|
+
"Headless commands never install a native package; installation requires the desktop shell.",
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
config: {
|
|
207
|
+
usage: "rmx config <show|get|set|unset|validate|export|import> ...",
|
|
208
|
+
summary: "Inspect and safely modify validated Remodex configuration.",
|
|
209
|
+
details: ["Secrets are masked by show/get. Import requires --yes and validates before writing."],
|
|
210
|
+
},
|
|
211
|
+
claude: {
|
|
212
|
+
usage: "rmx claude [claude args...]",
|
|
213
|
+
summary: "Launch Claude Code wired to the proxy (env injection + gateway model discovery).",
|
|
214
|
+
details: [
|
|
215
|
+
"Ensures the proxy is running, then execs `claude` with ANTHROPIC_BASE_URL/ANTHROPIC_AUTH_TOKEN,",
|
|
216
|
+
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 and model slots from config.claudeCode.",
|
|
217
|
+
"Routed models appear in the native /model picker with stable claude-opus-4-8-2026MMDD slot aliases (Claude Code >= 2.1.129).",
|
|
218
|
+
"Older versions: pick models via ANTHROPIC_MODEL or /model <id> directly (any string passes through).",
|
|
219
|
+
"User-exported ANTHROPIC_* variables always take precedence.",
|
|
220
|
+
"",
|
|
221
|
+
"Claude Desktop profile:",
|
|
222
|
+
" rmx claude desktop [apply] Save and apply the four-family profile",
|
|
223
|
+
" rmx claude desktop show [--json] Show routes, families, and defaults",
|
|
224
|
+
" rmx claude desktop move <route> <family> [--default]",
|
|
225
|
+
" rmx claude desktop default <family> <route|none>",
|
|
226
|
+
" rmx claude desktop export <path|-> Export versioned JSON (`-` = stdout)",
|
|
227
|
+
" rmx claude desktop import <path> [--apply] Validate and import JSON",
|
|
228
|
+
"Families: opus, fable, sonnet, haiku. New routes start in opus.",
|
|
229
|
+
"`none` is valid only when that family is empty.",
|
|
230
|
+
"Legacy apply flags remain supported: --static, --hybrid, --discovery-only.",
|
|
231
|
+
"",
|
|
232
|
+
"Claude Code settings: rmx claude config <status|set> ...",
|
|
233
|
+
],
|
|
234
|
+
},
|
|
235
|
+
opencode: {
|
|
236
|
+
usage: "rmx opencode [opencode args...]",
|
|
237
|
+
summary: "Launch opencode wired to the proxy (runtime provider config).",
|
|
238
|
+
details: [
|
|
239
|
+
"Ensures the proxy is running, then execs `opencode` with the generated `provider.opencodex`",
|
|
240
|
+
"block injected through OpenCode's inline runtime layer (`OPENCODE_CONFIG_CONTENT`). Any",
|
|
241
|
+
"existing inline config in the environment is preserved and only `provider.opencodex` is",
|
|
242
|
+
"overwritten for this launch.",
|
|
243
|
+
"Global/project opencode.json may be read to warn about an existing provider.opencodex",
|
|
244
|
+
"override; on-disk files are never modified.",
|
|
245
|
+
"Routed models appear in the model picker under Remodex using the compatibility id opencodex/<provider>/<model>.",
|
|
246
|
+
"Stop using `rmx opencode` and plain `opencode` behaves exactly as before.",
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
restart: {
|
|
250
|
+
usage: "rmx restart",
|
|
251
|
+
summary: "Stop the proxy and restart it (background). Equivalent to stop + ensure.",
|
|
252
|
+
},
|
|
253
|
+
v2: {
|
|
254
|
+
usage: "rmx v2 <status|on|off|mode <v1|default|v2>|threads <n>>",
|
|
255
|
+
summary: "Toggle the Codex multi_agent_v2 feature (multi-agent surface).",
|
|
256
|
+
details: [
|
|
257
|
+
"status Show flag, multi-agent mode, and thread limit.",
|
|
258
|
+
"on | off Enable/disable multi_agent_v2 (catalog resyncs).",
|
|
259
|
+
"mode <v1|default|v2> Force all models to one surface, or respect upstream pins.",
|
|
260
|
+
"threads <n> Set max_concurrent_threads_per_session (integer >= 1).",
|
|
261
|
+
"Flips preserve the active thread limit while moving between v1/v2 modes.",
|
|
262
|
+
],
|
|
263
|
+
},
|
|
264
|
+
health: {
|
|
265
|
+
usage: "rmx health [--json]",
|
|
266
|
+
summary: "Check proxy health. Exits 0 if healthy, 1 otherwise.",
|
|
267
|
+
details: ["Use --json for structured output: {ok, pid, port}."],
|
|
268
|
+
},
|
|
269
|
+
ready: {
|
|
270
|
+
usage: "rmx ready [--json] [--wait [--timeout <seconds>]]",
|
|
271
|
+
summary: "Check post-sync readiness. Exits 0 only when ready.",
|
|
272
|
+
details: [
|
|
273
|
+
"Exact unauthenticated GET /readyz returns HTTP 200 when ready, or 503 with Retry-After: 1 for pending or failed.",
|
|
274
|
+
"Its sanitized HTTP identity is {service, version, uptime, pid, port, status}; /healthz is separate liveness, not readiness.",
|
|
275
|
+
"Default is a single identity-checked /readyz probe; old proxies without /readyz fail closed as unreachable.",
|
|
276
|
+
"--wait polls until ready or timeout, but exits immediately on terminal failed (default 45s, max 300s).",
|
|
277
|
+
"--timeout requires --wait and accepts a positive integer (1..300).",
|
|
278
|
+
"--json emits {ready, status, pid, port}; status is one of ready|pending|failed|unreachable.",
|
|
279
|
+
"Invalid or unknown arguments exit 64. Not-ready, pending, failed, timeout, and unreachable exit 1.",
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
function packageVersion(): string {
|
|
285
|
+
const raw = readFileSync(join(repoRoot, "package.json"), "utf8");
|
|
286
|
+
const parsed = JSON.parse(raw) as { version?: unknown };
|
|
287
|
+
return typeof parsed.version === "string" ? parsed.version : "unknown";
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export function printVersion(): void {
|
|
291
|
+
console.log(`Remodex ${packageVersion()}`);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function printUsage(): void {
|
|
295
|
+
const canonical = `Remodex (rmx) — Universal provider proxy for Codex
|
|
296
|
+
|
|
297
|
+
Usage:
|
|
298
|
+
rmx setup Interactive setup (alias: init)
|
|
299
|
+
rmx start [--port <port>] Start the proxy server (auto-syncs models to Codex)
|
|
300
|
+
rmx stop Stop the proxy AND restore native Codex (plain codex works again)
|
|
301
|
+
rmx restore Restore native Codex without stopping (alias: eject)
|
|
302
|
+
rmx restore back Re-point codex at the running proxy (undo restore)
|
|
303
|
+
rmx recover-history --legacy-openai
|
|
304
|
+
Explicitly recover pre-backup syncResumeHistory rows
|
|
305
|
+
rmx uninstall Remove service/shim/config and restore native Codex (alias: remove)
|
|
306
|
+
rmx service [sub] Run as a background service (default: install/update/start)
|
|
307
|
+
rmx codex-shim <sub> Auto-start proxy when \`codex\` launches (install|status|uninstall|remove)
|
|
308
|
+
rmx tray <sub> Windows status tray (install|start|stop|status|uninstall)
|
|
309
|
+
rmx ensure Ensure the proxy is running and Codex config/cache are current
|
|
310
|
+
rmx sync [--restart-codex] Fetch models from providers and inject into Codex config
|
|
311
|
+
rmx sync-cache [--restart-codex]
|
|
312
|
+
Refresh Codex's model cache from the active catalog
|
|
313
|
+
rmx status Check proxy server status
|
|
314
|
+
rmx doctor Diagnose environment/network issues (WSL, proxy, ChatGPT reachability)
|
|
315
|
+
rmx debug <scope> provider/usage/injection/claude on|off|status|reset
|
|
316
|
+
rmx login <provider> OAuth or API-key provider login
|
|
317
|
+
rmx logout <provider> Remove a stored OAuth login
|
|
318
|
+
rmx gui Open the Remodex dashboard
|
|
319
|
+
rmx update [--tag <tag>] Update Remodex (keeps preview installs on @preview)
|
|
320
|
+
rmx restart Stop and restart the proxy
|
|
321
|
+
rmx v2 <sub> multi_agent_v2 surface (status|on|off|mode|threads)
|
|
322
|
+
rmx health [--json] Check proxy health (exit 0=healthy, 1=not)
|
|
323
|
+
rmx ready [--json] [--wait [--timeout <s>]] Check post-sync readiness (exit 0 only when ready)
|
|
324
|
+
rmx provider <sub> Providers, connectivity, quota, and selected models
|
|
325
|
+
rmx account <sub> Accounts, login/reauth, key pools, and quota controls
|
|
326
|
+
rmx models <sub> Live/custom models, visibility, context, and shadow calls
|
|
327
|
+
rmx combo <sub> Combo failover/round-robin routing
|
|
328
|
+
rmx agent <sub> Subagents, injection, effort caps, and sidecars
|
|
329
|
+
rmx observe <sub> Logs, usage, storage, memory, and debug data
|
|
330
|
+
rmx access <sub> External API keys and endpoint information
|
|
331
|
+
rmx export --client <id> Print a client config wired to the running proxy (7 clients)
|
|
332
|
+
rmx integration client <sub> Enable, disable, inspect or roll back a client integration
|
|
333
|
+
rmx grok <sub> Grok Build model selection and apply
|
|
334
|
+
rmx system <sub> Runtime settings, startup, sync, diagnostics, and updates
|
|
335
|
+
rmx config <sub> Validated configuration show/get/set/import/export
|
|
336
|
+
rmx claude [args...] Launch Claude Code wired to the proxy (model discovery on)
|
|
337
|
+
rmx claude desktop [sub] Manage and apply Claude Desktop's four-family profile
|
|
338
|
+
rmx opencode [args...] Launch opencode wired to the proxy (runtime provider config)
|
|
339
|
+
rmx help [command] Show help
|
|
340
|
+
rmx --version | -v Print version
|
|
341
|
+
|
|
342
|
+
Examples:
|
|
343
|
+
rmx init Set up provider and inject into Codex
|
|
344
|
+
rmx start Start on default port (10100)
|
|
345
|
+
rmx start --port 8080 Start on custom port
|
|
346
|
+
rmx help service Show service command help
|
|
347
|
+
rmx sync Sync available models to Codex`;
|
|
348
|
+
console.log(`${canonical}
|
|
349
|
+
|
|
350
|
+
Compatibility aliases: ${COMPATIBILITY_ALIASES.join(", ")}
|
|
351
|
+
These aliases accept the same commands as rmx.`);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export function hasHelpFlag(values: string[]): boolean {
|
|
355
|
+
return values.some(value => value === "--help" || value === "-h" || value === "help");
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export function printSubcommandUsage(name: string | undefined): void {
|
|
359
|
+
const entry = name ? helpEntries[name] : undefined;
|
|
360
|
+
if (!entry) {
|
|
361
|
+
console.error(`Unknown command: ${name ?? ""}`.trim());
|
|
362
|
+
printUsage();
|
|
363
|
+
process.exit(1);
|
|
364
|
+
}
|
|
365
|
+
const canonicalUsage = canonicalCommand(entry.usage);
|
|
366
|
+
console.log(`Usage: ${canonicalUsage}\n\n${canonicalCommand(entry.summary)}`);
|
|
367
|
+
if (entry.details?.length) {
|
|
368
|
+
console.log(`\n${entry.details.map(canonicalCommand).join("\n")}`);
|
|
369
|
+
}
|
|
370
|
+
}
|