mirror of
https://github.com/lemon07r/opencode-kimi-full.git
synced 2026-07-18 08:05:52 +02:00
6549be2f3d
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, ...}].
47 lines
1.1 KiB
JSON
47 lines
1.1 KiB
JSON
{
|
|
"name": "opencode-kimi-full",
|
|
"version": "1.1.0",
|
|
"description": "OpenCode plugin that adds first-class support for Kimi K2.6 (kimi-for-coding) via the official Kimi OAuth device flow, matching the upstream kimi-cli 1:1.",
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/lemon07r/opencode-kimi-full.git"
|
|
},
|
|
"homepage": "https://github.com/lemon07r/opencode-kimi-full#readme",
|
|
"bugs": {
|
|
"url": "https://github.com/lemon07r/opencode-kimi-full/issues"
|
|
},
|
|
"publishConfig": {
|
|
"access": "public",
|
|
"provenance": true
|
|
},
|
|
"type": "module",
|
|
"main": "./src/index.ts",
|
|
"exports": {
|
|
".": "./src/index.ts"
|
|
},
|
|
"files": [
|
|
"src",
|
|
"README.md",
|
|
"AGENTS.md",
|
|
"LICENSE"
|
|
],
|
|
"keywords": [
|
|
"opencode",
|
|
"opencode-plugin",
|
|
"kimi",
|
|
"kimi-for-coding",
|
|
"kimi-k26",
|
|
"moonshot",
|
|
"oauth"
|
|
],
|
|
"peerDependencies": {
|
|
"@opencode-ai/plugin": ">=1.4.6"
|
|
},
|
|
"devDependencies": {
|
|
"@opencode-ai/plugin": "^1.4.7",
|
|
"typescript": "^5.6.0",
|
|
"@types/node": "^22.0.0"
|
|
}
|
|
}
|