mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-15 05:36:10 +00:00
* fix(extensions): make indexed access explicit across channel plugins Transport-payload-safe burn-down: malformed Telegram/Discord/QQ/LINE and sibling channel input keeps existing skip paths; no synthesized fields, no new throws in delivery loops. Zalo escape sentinels preserve literal matches instead of undefined replacements. * fix(extensions): make indexed access explicit across provider and memory plugins Stream and model iteration, tool-block guards, capture guards, and sparse accumulators; singleton model reads carry named invariants. * fix(extensions): make indexed access explicit across tooling plugins, flip the extensions lane Remaining plugins (oc-path, qa-lab, browser, logbook, and siblings) plus the tsconfig.extensions.json flag flip. Cleanup: logbook sampleFrames NaN index at max=1, QA retry clamp at non-positive attempts, dead Canvas probe and OpenShell no-op slice removed, twitch test setup leak excluded from the prod lane. * refactor(plugin-sdk): expose expectDefined via a focused SDK subpath Extensions imported @openclaw/normalization-core directly, crossing the external-plugin packaging boundary (it only worked because the runtime builder bundles undeclared workspace helpers). expect-runtime joins the canonical entrypoints JSON, generated exports, API baseline, docs, and subpath contract test; all 78 extension imports now use the SDK seam. Two scanner-shaped locals renamed for review-bundle hygiene. * chore(plugin-sdk): raise surface budgets for the expect-runtime subpath One new entrypoint with one callable export, added intentionally as the packaging-honest seam for extension invariant helpers.
45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
/**
|
|
* Cohere model catalog helpers derived from the plugin manifest.
|
|
*/
|
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-model-shared";
|
|
import manifest from "./openclaw.plugin.json" with { type: "json" };
|
|
|
|
const COHERE_MANIFEST_CATALOG = manifest.modelCatalog.providers.cohere;
|
|
|
|
export const COHERE_BASE_URL = COHERE_MANIFEST_CATALOG.baseUrl;
|
|
export const COHERE_MODEL_CATALOG = COHERE_MANIFEST_CATALOG.models;
|
|
export const COHERE_COMMAND_A_PLUS_MODEL_ID = "command-a-plus-05-2026";
|
|
export const COHERE_COMMAND_A_REASONING_MODEL_ID = "command-a-reasoning-08-2025";
|
|
export const COHERE_COMMAND_A_VISION_MODEL_ID = "command-a-vision-07-2025";
|
|
export const COHERE_NORTH_MINI_CODE_MODEL_ID = "north-mini-code-1-0";
|
|
|
|
const COHERE_MODERN_MODEL_IDS = new Set([
|
|
COHERE_COMMAND_A_PLUS_MODEL_ID,
|
|
COHERE_COMMAND_A_REASONING_MODEL_ID,
|
|
// Modern sweeps require agent tool use; Vision explicitly does not support tools.
|
|
COHERE_NORTH_MINI_CODE_MODEL_ID,
|
|
]);
|
|
|
|
export function isModernCohereModelId(modelId: string): boolean {
|
|
return COHERE_MODERN_MODEL_IDS.has(modelId.trim().toLowerCase());
|
|
}
|
|
|
|
export function buildCohereCatalogModels(): ModelDefinitionConfig[] {
|
|
return buildManifestModelProviderConfig({
|
|
providerId: "cohere",
|
|
catalog: COHERE_MANIFEST_CATALOG,
|
|
}).models;
|
|
}
|
|
|
|
export function buildCohereModelDefinition(
|
|
model: (typeof COHERE_MODEL_CATALOG)[number],
|
|
): ModelDefinitionConfig {
|
|
const providerConfig = buildManifestModelProviderConfig({
|
|
providerId: "cohere",
|
|
catalog: { ...COHERE_MANIFEST_CATALOG, models: [model] },
|
|
});
|
|
return expectDefined(providerConfig.models.at(0), "normalized Cohere manifest model");
|
|
}
|