50 Commits

Author SHA1 Message Date
lemon07r 86a3d32208 Add video_in discovery, clamp xhigh/max effort, fix image config v1.4.0 2026-05-09 08:08:29 -04:00
lemon07r 76f58b429e Sync kimi-cli 1.41.0 parity: bump version, drop OAuth scope v1.3.0 2026-05-09 06:31:58 -04:00
Lamim 86e697a53a Merge pull request #5 from ooojustin/feat/usage
Add Kimi usage TUI command
2026-05-07 05:37:00 -04:00
justin 0b7142fa49 fix: address usage review findings 2026-05-01 20:10:56 -04:00
justin c433c71928 feat: add kimi usage command 2026-05-01 18:45:39 -04:00
lemon07r 5efc6c39a3 Backfill Kimi image input capability v1.2.9 2026-04-23 01:29:08 -04:00
Lamim a40a340dd2 Update README to enhance plugin description
Clarified the functionality of the opencode Kimi plugin.
2026-04-22 08:02:54 -04:00
lemon07r e5fd91feba Use v1 PluginModule format to fix Windows plugin loading
opencode's getLegacyPlugins iterates every module export and throws on
non-function values. On Windows, Bun's standalone-binary dynamic imports
can produce module namespace objects with extra non-function metadata,
silently preventing the plugin from loading (the provider never appears
in `opencode auth login`).

Switch the default export from a bare Plugin function to the v1
PluginModule object ({ id, server }), which opencode's readV1Plugin
detects and handles before getLegacyPlugins ever runs. Also add
exports["./server"] for explicit entry point resolution.
v1.2.8
2026-04-22 05:31:05 -04:00
lemon07r 8018ca9f4d Clarify plugin install and login flow 2026-04-21 19:33:42 -04:00
lemon07r eff07a347d Merge remote-tracking branch 'origin/master' 2026-04-21 16:58:08 -04:00
lemon07r 79938fe1bd Update README and sync kimi-cli 1.37.0 parity v1.2.7 2026-04-21 16:57:22 -04:00
Lamim abd3fce438 Update README to clarify Kimi plugin features
Expanded description to include support for Kimi-specific extensions.
2026-04-19 20:57:14 -04:00
lemon07r c6b13940ac docs: simplify README setup flow 2026-04-19 10:04:57 -04:00
lemon07r 7aeb8d36fa Add OAuth request timeouts and release checks v1.2.6 2026-04-19 02:20:10 -04:00
lemon07r efca301079 Harden OAuth refresh token recovery v1.2.5 2026-04-19 01:39:56 -04:00
lemon07r 60bfb23030 docs: clarify reasoning effort behavior in README and ignore .factory directory 2026-04-19 00:09:10 -04:00
lemon07r 038e9d67ca Serialize concurrent token refreshes v1.2.4 2026-04-18 23:31:18 -04:00
lemon07r 0d22121a01 Fix invalid login config hint v1.2.3 2026-04-18 23:02:03 -04:00
lemon07r d9b89198b9 Merge remote-tracking branch 'origin/master' 2026-04-18 07:48:23 -04:00
lemon07r 14d93a6bf3 Fix Kimi provider metadata discovery v1.2.2 2026-04-18 07:47:25 -04:00
Lamim 6757ef2180 Update README to clarify Kimi K2.6 access
Clarify that Kimi K2.6 can be accessed via OAuth.
2026-04-18 01:37:50 -04:00
lemon07r a802ff0bac Fix Kimi request body injection v1.2.1 2026-04-17 15:10:14 -04:00
lemon07r 8f17119356 Fix auth discovery and refresh parity v1.2.0 2026-04-17 14:20:36 -04:00
lemon07r 36e2b62cf5 docs: align auto variant with live config 2026-04-17 13:55:36 -04:00
lemon07r 18b3183aa6 docs: simplify install wording and restore K2.6 note 2026-04-17 13:53:51 -04:00
lemon07r cacb7c795c docs: clarify manual plugin install path 2026-04-17 13:51:08 -04:00
lemon07r 6b2afb57ec refactor: update Kimi For Coding plugin documentation and refine reasoning variant request parameters 2026-04-17 13:51:08 -04:00
Lamim f178827ecc Update README with Kimi K2.6 information
Added information about Kimi K2.6 availability and clarified authentication details.
2026-04-17 13:11:14 -04:00
lemon07r d0c2c32707 docs: clarify Kimi-specific wire shape and authentication requirements in README 2026-04-17 06:38:49 -04:00
lemon07r b9c39fafc2 Release v1.1.2: prefer canonical kimi-for-coding slug; drop K2.6-specific wording
All Kimi For Coding plans currently return `kimi-for-coding` from
/coding/v1/models, so there's no real K2.5 vs K2.6 differentiation to
surface. Keep the wire-rewrite safety net (in case Moonshot ever ships
a non-canonical slug), but:

- Selection now prefers the `kimi-for-coding` entry when the server
  returns it, falling back to the first element only when absent.
  Applies to both loader refresh and the post-login authorize callback.
- Post-login console message no longer implies K2.6-specific validation
  ("Authorized for Kimi For Coding" instead of "Kimi for Coding:
  authorized" followed by tier speculation).
- README drops K2.5/K2.6 tier routing language that was never quite
  accurate and is now moot. The model-id rewrite is described as a
  safety net, not a per-tier behavior.
- Added test/plugin.test.ts coverage for the canonical-slug preference.
v1.1.2
2026-04-17 05:35:50 -04:00
lemon07r 8046c22c34 Release v1.1.1: reorder reasoning variants (off, auto, low, medium, high)
off first (the most conservative, fastest option), then auto (server-picked
default), then the escalating levels. Matches the post-login config block
printed by the authorize callback and the user's live config.
v1.1.1
2026-04-17 05:06:13 -04:00
lemon07r 6549be2f3d Release v1.1.0: auto-discover model id + context length from /coding/v1/models
Mirrors kimi-cli's refresh_managed_models behavior: at login (and on every
token refresh) the plugin now GETs /coding/v1/models with the user's JWT,
caches the first returned {id, context_length, display_name} in auth.json,
and rewrites the wire 'model' body field to the cached id inside
loader.fetch. K2.5 accounts (server returns e.g. 'k2p5') and K2.6 accounts
(server returns 'kimi-for-coding') now share identical opencode config.

After successful login, the authorize callback prints a ready-to-paste
provider config block with the discovered values filled in.

- src/oauth.ts: added listModels() (GET /coding/v1/models).
- src/index.ts: OAuthAuth extended with model_id/context_length/model_display;
  ensureFresh() refetches on refresh; loader.fetch rewrites JSON body
  'model' when cached id differs from MODEL_ID; authorize callback runs
  listModels() + console.logs a ready-to-paste config block.
- README.md: drop hardcoded context/output limits and K2.6-specific name;
  explain auto-discovery and the K2.5/K2.6 alias mechanism.
- AGENTS.md: rule 6 rewritten to describe the wire-rewrite contract.
- test/plugin.test.ts: +3 tests (discovery on refresh persists metadata,
  graceful /models failure, body.model rewrite K2.5 + K2.6 no-op);
  existing 401-retry and refresh tests updated for the extra /models call.

Tested live against a real K2.6 account — listModels() returns
[{id: 'kimi-for-coding', context_length: 262144, ...}].
v1.1.0
2026-04-17 04:53:27 -04:00
lemon07r 194da3cc9b Release v1.0.6: fix chat.params crash and add reasoning variants
Two user-visible fixes:

1. Runtime crash 'undefined is not an object (evaluating
   input.provider.info.id)' on any chat. The @opencode-ai/plugin
   ProviderContext type claims .info.id exists, but opencode's
   session/llm.ts::stream passes the flat ProviderConfig as provider
   (research/opencode/packages/opencode/src/session/llm.ts ~line 168).
   Gate on input.model.providerID instead — matches cloudflare.ts,
   codex.ts, github-copilot/copilot.ts.

2. Ctrl+T reasoning variants (off/auto/low/medium/high) were not
   available. README config now declares model.variants, which opencode
   merges into options before chat.params runs; the hook normalizes
   'auto' to omit both thinking and reasoning_effort so Moonshot picks
   dynamically, matching kimi-cli's 'nothing passed' default.

Also:
- AGENTS.md rule 4 updated with 'auto' row and the providerID gating
  warning, citing the live 2026-04-17 repro.
- test/plugin.test.ts input shape updated to match runtime; added a
  test for the 'auto' variant.
v1.0.6
2026-04-17 04:19:59 -04:00
lemon07r 422a204154 Release v1.0.5: bump CI to Node 24 and latest action majors
- actions/checkout v4 -> v6
- actions/setup-node v4 -> v6 (Node 20 -> 24 LTS)
- softprops/action-gh-release v2 -> v3

Clears the Node.js 20 deprecation warning that CI was emitting.
v1.0.5
2026-04-17 04:09:44 -04:00
lemon07r 70e059a343 Release v1.0.4: rename provider display name to 'Kimi For Coding (OAuth)'
The previous display name 'Kimi K2.6 (for coding)' was confusing —
K2.6 is a model, not a provider, and it collided visually with the
models.dev 'Kimi For Coding' entry in interactive 'opencode auth login'.
Name now clearly signals this is the OAuth variant.
v1.0.4
2026-04-17 04:07:31 -04:00
lemon07r ed7145c9c9 Release v1.0.3: fix header fingerprint (UA, Device-Model, Os-Version)
Plugin was silently 403ing every live request with
'access_terminated_error: only available for Coding Agents'. Discovered by
capturing what kimi-cli actually sends on the wire and diffing.

Three fingerprint bugs, each sufficient on its own to trigger the 403:

* User-Agent was 'KimiCodeCLI/<v>'; upstream sends 'KimiCLI/<v>'.
  (research/kimi-cli/src/kimi_cli/constant.py::get_user_agent)
* X-Msh-Device-Model was 'x86_64'; upstream sends
  '{system} {release} {machine}' e.g. 'Linux 7.0.0 x86_64'.
  (research/kimi-cli/src/kimi_cli/auth/oauth.py::_device_model)
* X-Msh-Os-Version was '{type} {release}' e.g. 'Linux 7.0.0'; upstream
  sends platform.version() i.e. the kernel build string. Node equivalent
  is os.version().

Verified live against api.kimi.com/coding/v1 with a freshly-minted JWT:
200 OK and real K2.6 response after the fix; 403 before.

Locked in with regression tests in test/headers.test.ts and
test/constants.test.ts, and documented in AGENTS.md contract rule 1.
v1.0.3
2026-04-17 03:51:45 -04:00
lemon07r 64550fb057 Release v1.0.2: broaden offline test coverage
Adds one test file per source file plus a shared fetch mock helper:

- test/constants.test.ts: OAuth scope/client_id/PROVIDER_ID/MODEL_ID pins,
  rules 1, 6, 8.
- test/headers.test.ts: seven fingerprint header keys, UA/X-Msh-Version
  track KIMI_CLI_VERSION, ASCII-only values, device-id format and
  stability across calls (rules 1, 2).
- test/oauth.test.ts: form-encoded bodies for device-start/refresh,
  authorization_pending/expired_token/unknown-error branches, non-OK and
  non-JSON error shapes.
- test/plugin.test.ts: chat.params provider+model gating, full effort
  matrix (rule 4), prompt_cache_key gating (rule 5), camelCase effort
  input, loader Authorization ownership (rule 3), refresh-on-expiry with
  persistAuth, 401 single-retry no-loop, device-flow authorize wiring.
- test/_util/fetchMock.ts: zero-dep global-fetch swap returning canned
  Responses with call capture.

Notes:

- Tests use the real ~/.kimi/device_id; getDeviceId is idempotent and the
  file is shared with kimi-cli by design (AGENTS.md rule 2), so no HOME
  redirect is needed. Attempted monkey-patching os.homedir instead is
  fragile under Bun's eager import-binding resolution.
- pollDeviceToken tests use interval=1 because `device.interval || 5`
  treats 0 as the default 5s and would push each iteration past the
  default bun-test timeout.

Total: 35 tests, ~5s to run.
v1.0.2
2026-04-17 03:18:23 -04:00
lemon07r 0626597690 Release v1.0.1: fix silent plugin load failure
Plugin v1.0.0 exported a named PROVIDER_ID constant alongside the default
export. opencode's plugin loader (getLegacyPlugins) iterates every export
and requires each to be a function; the named string export caused it to
throw 'Plugin export is not a function', which was only visible in the
log file — the provider silently vanished from 'opencode auth login'.

- Move PROVIDER_ID into src/constants.ts and import it in src/index.ts.
- Add test/exports.test.ts as a regression guard (bun test).
- Add bunfig.toml to scope bun test away from research/ and node_modules/.
- Wire 'bun test' into the release workflow.
- Document rule 9 in AGENTS.md (single default export in src/index.ts).
- Also pick up the previous session's README fix (opencode auth login -p).
v1.0.1
2026-04-17 02:40:07 -04:00
lemon07r be643ba628 docs: clarify description of unimplemented Kimi-specific extras in README 2026-04-17 02:19:36 -04:00
lemon07r aacda9c89f feat: bun.lock 2026-04-17 02:17:14 -04:00
lemon07r 022145e03e docs: update README with Kimi K2.6 Code Preview details and add bun.lock file 2026-04-17 01:54:05 -04:00
lemon07r 837d642714 Fix loader auth read: use readAuth callback instead of client.auth.get v1.0.0 2026-04-17 01:51:14 -04:00
lemon07r aafdd1312d Release v1.0.0: add repo metadata and publishConfig 2026-04-17 01:48:36 -04:00
lemon07r 0f8f14dbd4 feat: add GitHub Actions release workflow and rename provider to kimi-for-coding-oauth 2026-04-17 01:33:39 -04:00
lemon07r 3c7dd8a097 docs: clarify kimi CLI parity and K2.6 access requirements in README 2026-04-17 01:20:45 -04:00
lemon07r 9d47e4cb19 Add README and AGENTS.md 2026-04-17 01:18:36 -04:00
lemon07r c1fc4688a4 Wire opencode auth/loader/chat.params hooks for kimi-for-coding 2026-04-16 23:24:46 -04:00
lemon07r 2bf6c4b605 Add Kimi OAuth device flow and refresh helpers 2026-04-16 23:24:46 -04:00
lemon07r 4df98757e3 Add constants and X-Msh-* header builder with persistent ~/.kimi/device_id 2026-04-16 23:24:46 -04:00
lemon07r e39f1bc5e5 Scaffold plugin package (npm manifest, tsconfig, license, gitignore) 2026-04-16 23:24:46 -04:00