mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-05-08 16:17:54 +08:00
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-model-shared";
|
|
|
|
const DEFAULT_CONTEXT_WINDOW = 128_000;
|
|
const DEFAULT_MAX_TOKENS = 8192;
|
|
|
|
// Copilot model ids vary by plan/org and can change.
|
|
// We keep this list intentionally broad; if a model isn't available Copilot will
|
|
// return an error and users can remove it from their config.
|
|
const DEFAULT_MODEL_IDS = [
|
|
"claude-sonnet-4.6",
|
|
"claude-sonnet-4.5",
|
|
"gpt-4o",
|
|
"gpt-4.1",
|
|
"gpt-4.1-mini",
|
|
"gpt-4.1-nano",
|
|
"o1",
|
|
"o1-mini",
|
|
"o3-mini",
|
|
] as const;
|
|
|
|
export function getDefaultCopilotModelIds(): string[] {
|
|
return [...DEFAULT_MODEL_IDS];
|
|
}
|
|
|
|
export function buildCopilotModelDefinition(modelId: string): ModelDefinitionConfig {
|
|
const id = modelId.trim();
|
|
if (!id) {
|
|
throw new Error("Model id required");
|
|
}
|
|
return {
|
|
id,
|
|
name: id,
|
|
// pi-coding-agent's registry schema doesn't know about a "github-copilot" API.
|
|
// We use OpenAI-compatible responses API, while keeping the provider id as
|
|
// "github-copilot" (pi-ai uses that to attach Copilot-specific headers).
|
|
api: "openai-responses",
|
|
reasoning: false,
|
|
input: ["text", "image"],
|
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
contextWindow: DEFAULT_CONTEXT_WINDOW,
|
|
maxTokens: DEFAULT_MAX_TOKENS,
|
|
};
|
|
}
|