Files
OpenHands/__tests__/scripts/docs-version-sync.test.ts
T
cc63f48a07 refactor(acp): source ACP model lists from typescript-client (closes #740) (#775)
* refactor(acp): source model lists from typescript-client registry

Replace the hand-mined CLAUDE_MODELS / CODEX_MODELS / GEMINI_MODELS lists (and
the duplicated provider metadata) with the @openhands/typescript-client ACP
registry, which mirrors the Python SDK source of truth
(openhands.sdk.settings.acp_providers). acp-providers.ts becomes a thin
adapter: it enriches each upstream record with Canvas-only UI fields (brand
icon + onboarding description) and keeps the helper functions + public export
surface unchanged, so no consumers change.

- Bump the @openhands/typescript-client pin to the #187 merge commit
  (082d4d46), which adds available_models / default_model to the registry.
- Delete the three hardcoded model lists; build ACP_PROVIDERS from
  getAcpProvider() + a small ACP_PROVIDER_UI map.
- Incidentally corrects the Gemini default to auto-gemini-2.5 (the CLI's
  auto-router default), matching the merged SDK/client.

Closes #740.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(acp): pin typescript-client to v1.23.2 tag (was SHA)

Now that typescript-client v1.23.2 is tagged/released (includes #187's ACP
registry, mirroring SDK #3389), pin to the tag instead of the raw #187 merge
SHA. v1.23.2 tracks the SDK's v1.23.2 patch line. Resolves to the same commit
as the prior SHA, so no resolved-content change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci(acp): remove obsolete ACP providers sync check

The acp-providers-sync workflow + scripts/check-acp-providers-sync.mjs existed
to keep Canvas's hand-kept ACP registry mirror in sync with the SDK source
(agent-canvas#587). That mirror is gone — acp-providers.ts now sources its
model data from @openhands/typescript-client, which carries its own
SDK-drift check (check-acp-drift.py). So this canvas-side check is redundant
and was failing on the refactored ACP_PROVIDERS (no longer a literal array).

- Delete .github/workflows/acp-providers-sync.yml + the script.
- Drop the docs-version-sync test case that asserted the script's example.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Debug Agent <debug@example.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 19:25:08 +02:00

59 lines
2.1 KiB
TypeScript

// @vitest-environment node
//
// Drift-detection: documented agent-server version examples must match the
// authoritative `versions.agentServer` pin in `config/defaults.json`.
//
// PR #670 bumped the central pin to 1.23.0 but left stale `1.22.1` examples in
// AGENTS.md and several script JSDocs. This test fails when those references
// drift from the central pin so the next bump cannot silently leave docs
// behind.
import { readFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
const repoRoot = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
"../..",
);
function read(rel: string): string {
return readFileSync(path.join(repoRoot, rel), "utf-8");
}
const config = JSON.parse(read("config/defaults.json")) as {
versions: { agentServer: string };
};
const v = config.versions.agentServer;
describe("docs/example references stay in sync with config/defaults.json", () => {
it("AGENTS.md documents the current default version", () => {
const agentsMd = read("AGENTS.md");
expect(agentsMd).toContain(
`\`OH_AGENT_SERVER_VERSION\` — specific PyPI version (e.g., "${v}")`,
);
expect(agentsMd).toContain(
`Default: released PyPI version \`${v}\` for agent-server SDK libraries`,
);
});
it("scripts/dev-safe.mjs JSDoc example matches the current default", () => {
const devSafe = read("scripts/dev-safe.mjs");
expect(devSafe).toContain(
`OH_AGENT_SERVER_VERSION: Specific PyPI version (e.g., "${v}")`,
);
});
it("scripts/check-sdk-version-sync.mjs examples match the current default", () => {
const src = read("scripts/check-sdk-version-sync.mjs");
expect(src).toContain(`EXPECTED_SDK_VERSION=${v}`);
expect(src).toContain(`"version": "${v}"`);
expect(src).toContain(`"openhands-sdk>=${v},<2.0.0"`);
expect(src).toContain(`"openhands-tools==${v}"`);
expect(src).toContain(`"openhands-workspace (>=${v})"`);
expect(src).toContain(
`">=${v}", "==${v}", "(>=${v})", "~=${v}"`,
);
});
});