Files
paseo/plugins/zai-usage-source/index.server.ts
T
Mohamed BoudraandJiayang Wu 4842f7e24d fix(usage): support OpenCode v2 usageSession, OpenCode session scopes, and Codex opencode.db logins (#11153)
* fix(usage): support OpenCode v2 usageSession, session scopes, and Codex opencode.db logins

- Implement usageSession() on OpenCodeV2Session with provider "opencode",
  authoritative model tracking (info.model falling back to config.model),
  effective provider + launch harness environment, and a stable sessionKey.
- Read active and migrated OpenAI OAuth logins from OpenCode v2's opencode.db
  in codex-usage-source (honoring absolute/relative OPENCODE_DB, active=1 or
  migrated active IS NULL, falling back to v1 auth.json, and normalizing
  provider to "opencode").
- Add OpenCode session-scope discovery to built-in usage sources OpenCode
  serves (opencode-go, minimax, zai, kimi, grok, copilot, openrouter-host).

Co-authored-by: Jiayang Wu <651475459@qq.com>

* fix(usage): keep Copilot/Kimi default visibility hints and deduplicate session discovery helpers

---------

Co-authored-by: Jiayang Wu <651475459@qq.com>
2026-11-28 14:22:19 +07:00

16 lines
510 B
TypeScript

import type { PluginServerContext } from "@getpaseo/plugin/server";
import { inputSchema } from "./shared/input.js";
import { fetchUsage, discover, discoverSession } from "./server/usage.js";
export default function contribute(server: PluginServerContext) {
server.registerUsageSource({
id: "zai",
label: "Z.ai",
icon: "icon.svg",
input: inputSchema,
discover: (scope) => (scope.kind === "global" ? discover() : discoverSession(scope)),
fetch: fetchUsage,
});
return () => {};
}