opencode-ccgo-provider/src/constants.ts

37 lines
1.3 KiB
TypeScript

// Wire-format constants for the CommandCode /alpha/generate API.
// The provider id must not collide with a models.dev catalog id: opencode merges the
// catalog entry for a config-defined provider with the same id and forwards its `api`
// (the OpenAI-compatible base, e.g. `…/provider/v1`) as `options.baseURL`, which breaks
// the `/alpha/generate` path. `commandcode` is taken by the official catalog entry, so
// this provider registers as `commandcode-go` (disable the built-in via
// `disabled_providers`).
export const PROVIDER_ID = "commandcode-go";
export const DEFAULT_BASE_URL = "https://api.commandcode.ai";
export const GENERATE_PATH = "/alpha/generate";
export const MODELS_PATH = "/provider/v1/models";
export const DEFAULT_CC_VERSION = "1.84.0";
export const DEFAULT_MAX_TOKENS = 32000;
export const DEFAULT_MAX_RETRIES = 2;
export const BASE_RETRY_DELAY = 0.5;
export const DEFAULT_RETRY_MAX_DELAY = 60;
export const STATIC_CONFIG = {
workingDir: "",
date: "",
environment: "",
structure: [] as unknown[],
isGitRepo: false,
currentBranch: "",
mainBranch: "main",
gitStatus: "",
recentCommits: [] as unknown[],
};
export const ZERO_USAGE = {
inputTokens: { total: 0, noCache: 0, cacheRead: 0, cacheWrite: 0 },
outputTokens: { total: 0, text: 0, reasoning: 0 },
};