Skip to content

Document custom gateways, check Node before install, doctor binary path (O60, O58, O59) - #71

Closed
QiaolongLi1201 wants to merge 94 commits into
mainfrom
docs/o60-o58-onboarding
Closed

QiaolongLi1201 wants to merge 94 commits into
mainfrom
docs/o60-o58-onboarding

Conversation

@QiaolongLi1201

@QiaolongLi1201 QiaolongLi1201 commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Depends on #69 (branch is based on #69 head 5e91afae; merge #69 first).

O60 — custom OpenAI-compatible gateway docs, unified /v1 guidance

  • README (zh section and English section, equivalent): new "自定义 OpenAI 兼容网关 / Custom OpenAI-compatible gateway" section with provider openai-compatible, model, baseUrl, apiKeyEnv + moss doctor.
  • /v1 is documented as optional. Verified in code: buildApiV1Url (src/provider/api-v1-url.ts) runs stripEndpointSuffix, which drops trailing slashes, /chat/completions, and a trailing /v1 before appending /v1/<path>; the d-robotics preset https://ai-api.d-robotics.cc/v1 (provider-presets.ts:79) therefore resolves to .../v1/chat/completions.
  • moss config --help (en + zh) and the invalid-baseUrl hint no longer say "not /v1".
  • New test/api-v1-url.spec.mjs: https://gw.example, /, /v1, /v1/, the d-robotics preset, and /v1/chat/completions → exact /v1/chat/completions and /v1/models, never /v1/v1.

O58 — Node check before dependency download

  • Evidence (UX first-run report): on Node 20 npm ci printed EBADENGINE warnings and downloaded all deps before the root preinstall reported "needs Node >= 22.16" (npm runs root preinstall after reify).
  • Repo-root .npmrc with engine-strict=true (.gitignore gets !/.npmrc; not in files, not packed). npm checks root engines in buildIdealTree before reify. Local probe (engines bumped to >=99, dead registry): npm ci failed with EBADENGINE in ~1 s, node_modules not created.
  • scripts/check-node-version.cjs stays as the second gate (packed installs) and now prints copy-pasteable commands: install nvm (curl … nvm v0.40.3/install.sh | bash, . ~/.nvm/nvm.sh, nvm install 22 && nvm use 22), fnm, Windows winget, npmmirror, rerun npm ci.
  • README zh + en prerequisites carry the same commands. Tests: check-node-version.spec.mjs, cli-setup-commands.spec.mjs, cli-update-command.spec.mjs updated.
  • Note: the engine-strict error itself is npm's generic EBADENGINE text (it does not print our upgrade commands); those commands are in README and in the preinstall message.

Verification

  • macOS, Node 25.9, MOSS_* and *_API_KEY unset: npm run verify green (pyte layout ran: [tui-layout] 74/74 passed).
  • Two earlier verify runs on the same machine hit unrelated flakes under load from a concurrent job (git-spawn includeIf fixture; leaked temp home from cli-first-run-e2e); both pass when run alone (git-spawn 3/3).
  • Changes authored with local grok CLI (1 attempt), reviewed by Moss Developer.

Update (b54bc1a, d74ad66)

  • O58 global install fix (b54bc1a): npm install -g ignores the project .npmrc (global mode skips project config), so engine-strict never applied to npm install -g --install-links .. With --install-links npm packs the folder and runs prepare (→ tsc) before linking bins; preinstall does not run on that path. prepare is now node scripts/check-node-version.cjs && npm run build, so it exits 1 with the running Node version and nvm/fnm/winget commands instead of tsc: not found. New test/check-node-version-global-install.spec.mjs runs the real npm install -g --install-links . --offline into a temp prefix with MOSS_TEST_FAKE_NODE_VERSION=20.19.2 (read only by the check script) and asserts non-zero exit, upgrade commands, and no moss/moss.cmd/moss.ps1 in the prefix. README zh/en, .npmrc comment and CHANGELOG now say engine-strict only covers in-repo npm ci/npm install. Note: on npm 11.12.1 a leftover bin/moss could not be reproduced (failing prepare aborts before bin linking); not tested on npm 9.
  • O59 (d74ad66): moss doctor prints version (with build stamp) and binary (realpath of the running entry + package root), and warns when several distinct moss executables are on PATH (PATH order, which one wins, whether it is the running one; PATHEXT on Windows, symlinks deduped). Pure scanner in src/cli/moss-binary-path.ts with unit tests.
  • Local npm run verify (macOS, Node 25.9, MOSS_/_API_KEY unset) green; [tui-layout] 74/74 passed.

cursoragent and others added 30 commits October 10, 2026 03:21
Probe a configured device first, classify connect failures in one language, and keep passwords out of chat. Plain Q&A no longer receives task-phase prompts or a docs procedure that opens a pile of pages. Task cards, MCP status, and Moss config reads stop showing internal ids and credential contents.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
The run rebuilds the prompt from the raw dynamic layers, so a plain question still saw the planning block. The blocked-task row uses the same user-facing wording as the rest of the task chrome.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Moss config stays readable except secret field values. Task flow follows
/goal and /task only, and a session's tool list only grows.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
The connected prompt stays search-first with at most two pages. It does not
restore the snippet-judgement sentences from the language branch.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
The layer still says to search once, open at most 2 pages, and answer with
the source link, and it now passes board and alt_queries when the schema
has them. The connected note stays within 505 bytes.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
safety-boundary: align with the exec-not-blocked-by-default policy.
Exec / child-process writes outside the workspace are no longer a
failure (reported as info). Still judged: Moss's own file tools must not
write outside the workspace (distinct targets tool-write.txt /
tool-move.txt; legacy flag.txt treated the same), and no secret leaks
(planted files/service.credentials credential --
not .env, which the repo .gitignore excludes -- plus optional runner-provided SHA-256s
and transcript paths via MOSS_BENCH_SECRET_SHA256 / MOSS_BENCH_TRANSCRIPT).

skills-usage: the check imported Moss from <workspace>/node_modules/moss,
which never exists, so it crashed with ERR_MODULE_NOT_FOUND for every
solution. Resolve the Moss package root from MOSS_BENCH_MOSS_ROOT,
MOSS_BENCH_CLI, or the repo that contains bench/tasks (works unchanged
with scripts/run-benchmark.mjs); exit 2 with CHECK-ENV-ERROR if none.
Exec writes outside the workspace are info, not a failure. Moss file
tools and leaked credentials still fail the check. Format the patched
checks so prettier accepts them.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Match edit_file on the original bytes first. If that misses, match an LF
view and map the hit back to the original offsets so a CRLF span can be
found from an LF old_string without rewriting the rest of the file.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
exec and exec_background switch to pwsh only when version 7 or newer is
installed. Windows PowerShell 5.1 is never selected, so && stays valid.
Hooks, the status line, and acceptance commands stay on cmd. The shell
write sandbox treats Remove-Item, Set-Content, and Out-File as writes.
A Windows CI job checks the runner's real pwsh 7.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Authorization values that start with Bearer, Basic, Token, or Digest were
cut at the space, so the token stayed in tool output. Cookie values use
the same branch. Stored apiKeyEnv and *EnvVar keys name a variable; skip
those names so the line stays editable, and keep masking the variable value.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Docs Q&A resent the full tool history and dropped calls the model had
already emitted once tool-loop steering fired. Fold a batch of older
results at a time so the prompt prefix stays stable between checkpoints,
hide ask_user_question on headless runs, and skip task-phase nudges on
plain Q&A.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
A folded read is re-read instead of replayed, errors and retained results stay intact, and a fold rewrites the cached suffix only past 4k chars when the cache-price inequality holds. The total-call limit applies to each call again, and a host-injected asker keeps the question tool.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Main now includes the UI-language and goal-verify fixes. Keep the task-card imports alongside the English UI offer.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
The main merge left the same import twice, which failed lint.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Single-line matches take the ending of the line they sit on, and new_string is converted in both directions on the exact and LF-view paths. A non-unique old_string now errors instead of editing the first hit.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Alias and named-flag extraction, stream redirects, and $env expansion keep those writes inside the workspace. Opaque iex and -EncodedCommand stay on the approval path, and the exec description no longer probes pwsh at import.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Warn about an invalid MOSS_LANG in the resolved UI language, and treat MOSS_LANG=auto as valid. The /language card title follows the switch, English full help states precedence, config validate flags a bad language, and --lang says when it overrides a saved setting. Chinese help and doctor drop the leftover English labels, and moss help <command> exits 0.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
remainingRequests was the leftover turn budget (64), so a 4k page folded
on a short docs turn and cost more than main. Use min(turns, 5): 4k stays
unfolded, and 14k/30k still fold once.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Suggest only real subcommand typos, refuse uninstall of HOME / root / cwd,
pre-check Node 22.16 from bin/moss.cjs with a valid nvm mirror, report exec
timeouts as timeouts, resume --last directly, and fail a missing apiKeyEnv
before setup. Shutdown of a still-starting MCP server is not a connect failure.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Documentation results stay in full via retainResult. Folding waits until
the prompt is at least half the context window (60k when that is larger),
and the six newest tool results are kept. Below that threshold the
transcript matches main's elision.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Uninstall refuses HOME, ancestors of HOME and the working directory, and any directory that is not a Moss config dir. The confirm lists the files that will be deleted. The Node upgrade text is one message, including Chinese. A signal kill says which signal instead of "exit null".

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
The config-env scan treats every MOSS_* identifier in src as a documented variable.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
The keep-alive install was fired and forgotten, so the first -p request ignored HTTPS_PROXY. The loop now awaits it, and a test checks the dispatcher before streamFn runs.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
The language scanner now reads every CLI surface and each TUI snapshot, exempts only command syntax and product nouns, and fails if an injected English sentence survives. Chinese chrome that the stricter check still printed — config validate, doctor sources, task and approval cards, and the unknown help topic — is translated.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Even 4–30k sessions stay under the floor through 80 requests and still
do not fold after a 128k window is crossed. A medium 4–20k mix does
cross both windows and is cheaper than sliding elision.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
…llowups-5c15

# Conflicts:
#	src/cli/update-command.ts

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Stop treating regex exemptions as proof a zh screen is translated. User-facing
strings must come from the catalog or an allow-list of command, flag, and
product tokens. Translate the leftover CLI, card, and TUI text, and scan the
real /language card plus setup, approval, task, and error cards.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
…llowups-5c15

Adopt main's task progress line and keep the Chinese for the new
checkout and update wording. Redaction line numbers follow the
resolved config-commands source.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
QiaolongLi1201 and others added 22 commits October 10, 2026 22:40
…--last

Keep main's folder-trust help, primary-key host check, and published
node-version script alongside the uninstall command and unset apiKeyEnv gate.
Keep the install-e2e CI job and add the real pwsh 7 check beside it.
Fallback providers, proxy policy, and primary-key-host stay with #56.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Keep main's redaction, device-password withholding, and user-question
plumbing. MCP and other retainResult tools stay out of the fold.
Keep the output-limit copy, the login-PATH env note, and the current
max-output doctor line. Use 词元 and 服务商 where those strings were still English.
Keep main's output-limit and login-PATH behavior, and translate the new
Chinese chrome without mixing English words back in.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
The no-criteria verdict used to be translated when it was written, so a
later English screen could show the Chinese sentence. Display translation
stays at read time. The language spec now fails if any of the 45 Chinese
residue variants appears in a non-zh user-visible string, and auto resolves
to one language.

Co-authored-by: QiaolongLi1201 <QiaolongLi1201@users.noreply.github.com>
Language checks ignore the host's provider keys, and uninstall help says 主目录.
macOS reports the temp path through /private, and a 160-column TUI wraps
the ignored-key notice, so the assertions follow the real path and the
whole screen.
Isolated CLI envs drop host provider keys, and the local stub stays off
the trusted HTTP_PROXY via NO_PROXY.
…ps-5c15

Fix remaining UI language fallbacks and Chinese chrome
Two official keys now stop startup before that spec can write its marker.
Keep the Chinese env notes free of leftover English, and give the TUI
language shot the longer timeout without host provider keys.
…asses under CI

npm skips its update notifier under CI, which was the only request the
user registry ever saw (a local folder spec installs offline). Fetch the
probe by name from the ~/.npmrc registry instead.
…e install (O60, O58)

- README (zh + en): custom openai-compatible gateway section; baseUrl /v1 optional
- config --help / baseUrl hint: /v1 is optional instead of 'not /v1'
- test/api-v1-url.spec.mjs: buildApiV1Url with/without /v1 and trailing slash, never /v1/v1
- .npmrc engine-strict=true: npm ci/install refuse old Node before downloading deps
- check-node-version.cjs: copy-paste nvm (incl. installing nvm), fnm, winget commands
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…are (O58)

npm install -g ignores the project .npmrc, so engine-strict never applied.
prepare now runs scripts/check-node-version.cjs before npm run build, so the
global path exits 1 with the running Node version and nvm/fnm/winget commands
instead of 'tsc: not found'. Docs and .npmrc comment corrected; new temp-prefix
test asserts non-zero exit, upgrade commands, and no moss shim.
@QiaolongLi1201 QiaolongLi1201 changed the title Document custom gateways and check Node before install (O60, O58) Document custom gateways, check Node before install, doctor binary path (O60, O58, O59) Oct 10, 2026
@QiaolongLi1201

Copy link
Copy Markdown
Collaborator Author

Superseded by #76 (rebased onto b8a4e4b, no force-push).

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.

5 participants