Skip to content

feat(kimi): report the profile nickname as account displayName - #27

Merged
xxchan merged 1 commit into
mainfrom
kai/kimi-display-name
Sep 29, 2026
Merged

xxchan merged 1 commit into
mainfrom
kai/kimi-display-name

Conversation

@TennyZhuang

Copy link
Copy Markdown
Contributor

Requested by @artin in Raft (#proj-runtime): the Kimi usage popover in Raft can't show which account it belongs to.

Why: Kimi accounts that sign in by phone or WeChat have no email in /me. Here is a real profile, with values masked:
{ user_id, nickname: "登月者8387", phone: { number: "156****8387" }, user_level_name: "Max", … }.
That means accountUsage returned plan but no identity. artin chose to show the nickname.

Change

  • Contract: add an optional displayName on kind: "available" snapshots (runtime-reported display name; omitted when not exposed). Adding an optional field doesn't break existing consumers.
  • Kimi: kimiAccountDisplayName reads /me nickname, using the same user_id guard as email and plan.
  • Refactor: I moved the /me identity half (the extractors and fetchKimiAccountIdentity) into kimi/profile.ts, because account-usage.ts went over the 300-line max-lines limit. Behavior is unchanged.
  • Docs: docs/runtimes/kimi.md now lists what /me supplies.

Verification: typecheck, lint, and the full vitest suite pass (362 passed, 27 skipped). The new reader test uses a phone sign-in /me with no email field and asserts displayName: "登月者8387" with no email. When I drop displayName from the identity result, that test fails.

Heads-up for consumers: Raft's daemon still pins @botiverse/[email protected], so using this there also means upgrading from 0.0.7 to a version that includes it.

🤖 Generated with Claude Code

Kimi accounts signed in by phone or WeChat have no `email` in `/me`, so
account usage carried no readable identity. Add an optional `displayName`
to the available snapshot and fill it from the `/me` nickname.

The `/me` identity half moves to kimi/profile.ts; account-usage.ts was
over the 300-line lint limit with the new extractor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@xxchan
xxchan merged commit ce8d954 into main Sep 29, 2026
12 checks passed
xxchan pushed a commit that referenced this pull request Sep 29, 2026
…#29)

Fixes #28. Reviewed on the Raft side by @XX, who asked for both points
below.

**Problem:** `claudeAccountUsage` spawns `claude -p …` with the user's
full config. On CLI 2.1.283, every usage read ran the user's
`SessionStart` hook and started their MCP servers, at both user level
(`CLAUDE_CONFIG_DIR`) and project level. The HTTP reader in 0.0.7 had no
such side effect.

**Change**
- Add `--safe-mode` to the query process. It disables hooks, MCP
servers, plugins and CLAUDE.md while keeping auth, and
`initialize`/`get_usage` answer as before.
- **Fallback:** if `claude --help` doesn't list `--safe-mode`, return `{
kind: "unsupported", reason: "unsupported_installation" }`. The reader
never launches the CLI without isolation. The help probe takes about 60
ms. Only a successful probe is cached (per command and version), so a
transient probe failure is retried on the next read.
- Tests pin `--safe-mode` in the spawn args, check that an old CLI is
never spawned, and check that a failed probe isn't cached. Removing the
flag fails 1 test; skipping the support check fails 2.

**Verification**
- typecheck, lint, the full vitest suite (362 passed, 27 skipped) and
the build all pass.
- Live runs with the built package (CLI 2.1.283):

| Setup | Hook / MCP markers | Result |
|---|---|---|
| 0.8.0, user-level config | SessionStart + MCP both fired | reads usage
|
| This PR, user-level config | none | reads usage |
| This PR, project-level config | none | `available`, 3 windows |

The user-level runs return `quota_unavailable` on both 0.8.0 and this
branch; that comes from the empty temp config dir, not from this change.

Should ship in the same release as #27 (Kimi nickname), so that Raft can
upgrade once, from 0.0.7 straight to that version.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Kai <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
xxchan added a commit that referenced this pull request Sep 29, 2026
Upgrade Pi to 0.87.1 and pin undici to 8.10.2, matching the SDK
dependency and removing the affected 8.9.0 version. Update the Pi
system-prompt snapshot for its new tagged format and bump both packages
to 0.9.0 for the release containing #27 and #29.

Fixes #30.

Validation: typecheck and lint pass; Pi behavior suite and strict
CI-mode vendor snapshots pass. Full local suite encountered a process
timing failure under heavy machine load; CI will validate on clean
runners before release.
@xxchan
xxchan deleted the kai/kimi-display-name branch October 3, 2026 07:50
stamp-build Bot added a commit that referenced this pull request Nov 18, 2026
<!-- stamp:review:v1 -->
<sup><img src="https://api.raft.build/api/avatars/pixel/ZXll.svg"
width="16" height="16" align="absmiddle" alt=""> <b>Lookout</b> from
open-agent-runtime opened this pull request through
Stamp</sup><br><sup><a
href="https://stamp.build/review?receipt=prc_c065213bcfc91c582370007c7bf2b6a1"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img
src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg"
width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp
→</a></sup>

---
<!-- /stamp:review:v1 -->

OpenCode 2.3.2 received builtin scope for two skill URIs even though OAR
had verified their ownership only in the 2.2.7 and 2.3.0 catalogs. Pass
the already-resolved full release identifier to skill classification and
restrict that inference to those exact versions. Other releases and
suffixed builds retain their native URI without scope. Numeric version
comparisons and filesystem-root classification keep their behavior; no
process is added.

Correct the runtime documentation to state that v1's `<built-in>`
location becomes `source: "builtin"` without a path, and that v2 model
listing uses `models --standalone` and returns bare IDs. Align the
linked inventory wording with the same path exception and version
boundary.

Validation: the boundary controls failed before the fix and now pass,
including version detection without installation metadata, prereleases
and custom suffixes. Isolated native 1.19.5, 2.2.7, 2.3.0 and 2.3.2
controls pass: 13 vendor cases, three v1 HTTP skips, and process/port
cleanup. The v1 behavior suite passes 18 cases with two capability
skips. Selected before/after catalogs, exact package identities and
reproduction instructions are committed under
`experiments/opencode-skills`. No real account or model prompt was used
by the inventory controls.

Full `CI=1 pnpm run check` passes: 4929 tests and 19 mock cases.

Requested by Cindy from the harbor OpenCode audit, task #27 in
inspection.

Co-authored-by: Lookout <[email protected]>
Co-authored-by: Cindy <[email protected]>
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